public class SearchCompiler extends 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.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.
|
private 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 operators.
|
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.
|
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
|
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.
|
static class |
SearchCompiler.Xor
Matches if the left OR the right expression match, but not both.
|
Modifier and Type | Field and Description |
---|---|
private static Map<String,SearchCompiler.BinaryMatchFactory> |
binaryMatchFactoryMap |
private boolean |
caseSensitive |
private boolean |
regexSearch |
private static String |
rxErrorMsg |
private static String |
rxErrorMsgNoPos |
private static Map<String,SearchCompiler.SimpleMatchFactory> |
simpleMatchFactoryMap |
private PushbackTokenizer |
tokenizer |
private static Map<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 SearchCompiler.Match |
compile(String searchStr,
boolean caseSensitive,
boolean regexSearch) |
SearchCompiler.Match |
parse()
Parse search string.
|
private SearchCompiler.Match |
parseExpression()
Parse expression.
|
private SearchCompiler.Match |
parseExpression(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(String errorMessage) |
private SearchCompiler.Match |
parseKV(String key,
String value) |
private static int |
regexFlags(boolean caseSensitive) |
private boolean caseSensitive
private boolean regexSearch
private static String rxErrorMsg
private static String rxErrorMsgNoPos
private PushbackTokenizer tokenizer
private static Map<String,SearchCompiler.SimpleMatchFactory> simpleMatchFactoryMap
private static Map<String,SearchCompiler.UnaryMatchFactory> unaryMatchFactoryMap
private static Map<String,SearchCompiler.BinaryMatchFactory> binaryMatchFactoryMap
public SearchCompiler(boolean caseSensitive, boolean regexSearch, PushbackTokenizer tokenizer)
public static void addMatchFactory(SearchCompiler.MatchFactory factory)
factory
- public static SearchCompiler.Match compile(String searchStr, boolean caseSensitive, boolean regexSearch) throws SearchCompiler.ParseError
SearchCompiler.ParseError
public SearchCompiler.Match parse() throws SearchCompiler.ParseError
SearchCompiler.ParseError
private SearchCompiler.Match parseExpression() throws SearchCompiler.ParseError
SearchCompiler.ParseError
private SearchCompiler.Match parseExpression(String errorMessage) throws SearchCompiler.ParseError
errorMessage
- to display if parsing error occursSearchCompiler.ParseError
parseExpression()
private SearchCompiler.Match parseFactor() throws SearchCompiler.ParseError
SearchCompiler.ParseError
private SearchCompiler.Match parseFactor(String errorMessage) throws SearchCompiler.ParseError
SearchCompiler.ParseError
private SearchCompiler.Match parseKV(String key, String value) throws SearchCompiler.ParseError
SearchCompiler.ParseError
private static int regexFlags(boolean caseSensitive)