public class SearchCompiler extends java.lang.Object
expression = fact | expression fact expression fact fact = ( expression ) -fact term? term=term term:term term
Modifier and Type | Class and Description |
---|---|
static class |
SearchCompiler.Always
Matches every OsmPrimitive.
|
static class |
SearchCompiler.And
Matches if both left and right expressions match.
|
private static class |
SearchCompiler.Any
Match a string in any tags (key or value), with optional regex and case insensitivity.
|
private static class |
SearchCompiler.AreaSize
Matches if the size of the area is within the given range
|
static class |
SearchCompiler.BinaryMatch
A binary search operator which may take data parameters.
|
static interface |
SearchCompiler.BinaryMatchFactory |
private static class |
SearchCompiler.BooleanMatch
Matches if the value of the corresponding key is ''yes'', ''true'', ''1'' or ''on''.
|
private static class |
SearchCompiler.ChangesetId
Matches objects with a changeset ID in the given range.
|
static class |
SearchCompiler.Child
Matches objects if they are children of the expression
|
private static class |
SearchCompiler.Closed
Matches ways which are closed (i.e.
|
class |
SearchCompiler.CoreSimpleMatchFactory |
static class |
SearchCompiler.CoreUnaryMatchFactory |
static class |
SearchCompiler.ExactKeyValue
Matches objects with the exact given key-value pair.
|
private static class |
SearchCompiler.ExactType |
private static class |
SearchCompiler.HasRole
Matches relations with a member of the given role
|
private static class |
SearchCompiler.Id
Matches objects with ID in the given range.
|
private static class |
SearchCompiler.InArea
Matches objects within the given bounds.
|
private static class |
SearchCompiler.Incomplete
Match objects that are incomplete, where only id and type are known.
|
static class |
SearchCompiler.InDataSourceArea
Matches objects within source area ("downloaded area").
|
private static class |
SearchCompiler.InView
Matches objects within current map view.
|
private static class |
SearchCompiler.KeyValue
Matches objects with the given key-value pair.
|
static class |
SearchCompiler.Match
Base class for all search criteria.
|
private static interface |
SearchCompiler.MatchFactory
Classes implementing this interface can provide Match operators.
|
private static class |
SearchCompiler.Modified
Matches all objects that have been modified, created, or undeleted
|
static class |
SearchCompiler.Never
Never matches any OsmPrimitive.
|
private static class |
SearchCompiler.New
Matches objects that are new (i.e.
|
private static class |
SearchCompiler.NodeCountRange
Matches ways with a number of nodes in given range
|
static class |
SearchCompiler.Not
Inverts the match.
|
static class |
SearchCompiler.NotOutsideDataSourceArea
Matches objects which are not outside the source area ("downloaded area").
|
private static class |
SearchCompiler.Nth
Matches the n-th object of a relation and/or the n-th node of a way.
|
static class |
SearchCompiler.Or
Matches if the left OR the right expression match.
|
static class |
SearchCompiler.Parent
Matches objects if they are parents of the expression
|
static class |
SearchCompiler.ParseError |
private static class |
SearchCompiler.RangeMatch
Matches objects with properties in a certain range.
|
private static class |
SearchCompiler.RoleMatch
Matches objects with the given relation role (i.e.
|
private static class |
SearchCompiler.Selected
Matches all objects currently selected
|
static interface |
SearchCompiler.SimpleMatchFactory |
private static class |
SearchCompiler.TagCountRange
Matches objects with a number of tags in given range
|
static class |
SearchCompiler.TaggedMatch |
private static class |
SearchCompiler.TimestampRange
Matches objects with a timestamp in given range
|
static class |
SearchCompiler.UnaryMatch
A unary search operator which may take data parameters.
|
static interface |
SearchCompiler.UnaryMatchFactory |
private static class |
SearchCompiler.Untagged
Matches objects that don't have any interesting tags (i.e.
|
private static class |
SearchCompiler.UserMatch
Matches objects last changed by the given username.
|
static class |
SearchCompiler.ValueComparison |
private static class |
SearchCompiler.Version
Matches objects with a version number in the given range.
|
private static class |
SearchCompiler.WayCountRange
Matches objects with the number of referring/contained ways in the given range
|
private static class |
SearchCompiler.WayLength
Matches if the length of a way is within the given range
|
static class |
SearchCompiler.Xor
Matches if the left OR the right expression match, but not both.
|
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.lang.String,SearchCompiler.BinaryMatchFactory> |
binaryMatchFactoryMap |
private boolean |
caseSensitive |
private boolean |
regexSearch |
private static java.lang.String |
rxErrorMsg |
private static java.lang.String |
rxErrorMsgNoPos |
private static java.util.Map<java.lang.String,SearchCompiler.SimpleMatchFactory> |
simpleMatchFactoryMap |
private PushbackTokenizer |
tokenizer |
private static java.util.Map<java.lang.String,SearchCompiler.UnaryMatchFactory> |
unaryMatchFactoryMap |
Constructor and Description |
---|
SearchCompiler(boolean caseSensitive,
boolean regexSearch,
PushbackTokenizer tokenizer) |
Modifier and Type | Method and Description |
---|---|
static void |
addMatchFactory(SearchCompiler.MatchFactory factory)
Add (register) MatchFactory with SearchCompiler
|
static java.lang.String |
buildSearchStringForTag(java.lang.String key,
java.lang.String value)
Builds a search string for the given tag.
|
static SearchCompiler.Match |
compile(SearchAction.SearchSetting setting)
Compiles the search expression.
|
static SearchCompiler.Match |
compile(java.lang.String searchStr)
Compiles the search expression.
|
(package private) static SearchCompiler.Match |
compileMapCSS(java.lang.String mapCSS) |
(package private) static java.lang.String |
escapeStringForSearch(java.lang.String s) |
SearchCompiler.Match |
parse()
Parse search string.
|
private SearchCompiler.Match |
parseExpression()
Parse expression.
|
private SearchCompiler.Match |
parseExpression(java.lang.String errorMessage)
Parse expression, showing the specified error message if parsing fails.
|
private SearchCompiler.Match |
parseFactor()
Parse next factor (a search operator or search term).
|
private SearchCompiler.Match |
parseFactor(java.lang.String errorMessage) |
private static int |
regexFlags(boolean caseSensitive) |
private final boolean caseSensitive
private final boolean regexSearch
private static java.lang.String rxErrorMsg
private static java.lang.String rxErrorMsgNoPos
private final PushbackTokenizer tokenizer
private static java.util.Map<java.lang.String,SearchCompiler.SimpleMatchFactory> simpleMatchFactoryMap
private static java.util.Map<java.lang.String,SearchCompiler.UnaryMatchFactory> unaryMatchFactoryMap
private static java.util.Map<java.lang.String,SearchCompiler.BinaryMatchFactory> binaryMatchFactoryMap
public SearchCompiler(boolean caseSensitive, boolean regexSearch, PushbackTokenizer tokenizer)
public static void addMatchFactory(SearchCompiler.MatchFactory factory)
factory
- match factorypublic static SearchCompiler.Match compile(java.lang.String searchStr) throws SearchCompiler.ParseError
searchStr
- the search expressionSearchCompiler.Match
object for the expressionSearchCompiler.ParseError
- if an error has been encountered while compilingcompile(org.openstreetmap.josm.actions.search.SearchAction.SearchSetting)
public static SearchCompiler.Match compile(SearchAction.SearchSetting setting) throws SearchCompiler.ParseError
setting
- the settings to useSearchCompiler.Match
object for the expressionSearchCompiler.ParseError
- if an error has been encountered while compilingcompile(String)
static SearchCompiler.Match compileMapCSS(java.lang.String mapCSS) throws SearchCompiler.ParseError
SearchCompiler.ParseError
public SearchCompiler.Match parse() throws SearchCompiler.ParseError
SearchCompiler.ParseError
- if search expression cannot be parsedprivate SearchCompiler.Match parseExpression() throws SearchCompiler.ParseError
SearchCompiler.ParseError
- if search expression cannot be parsedprivate SearchCompiler.Match parseExpression(java.lang.String errorMessage) throws SearchCompiler.ParseError
errorMessage
- to display if parsing error occursSearchCompiler.ParseError
- if search expression cannot be parsedparseExpression()
private SearchCompiler.Match parseFactor() throws SearchCompiler.ParseError
SearchCompiler.ParseError
- if search expression cannot be parsedprivate SearchCompiler.Match parseFactor(java.lang.String errorMessage) throws SearchCompiler.ParseError
SearchCompiler.ParseError
private static int regexFlags(boolean caseSensitive)
static java.lang.String escapeStringForSearch(java.lang.String s)
public static java.lang.String buildSearchStringForTag(java.lang.String key, java.lang.String value)
key
- the tag keyvalue
- the tag value