Class SearchCompiler.ValueComparison
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.search.SearchCompiler.Match
-
- org.openstreetmap.josm.data.osm.search.SearchCompiler.TaggedMatch
-
- org.openstreetmap.josm.data.osm.search.SearchCompiler.ValueComparison
-
- All Implemented Interfaces:
java.util.function.Predicate<OsmPrimitive>
- Enclosing class:
- SearchCompiler
public static class SearchCompiler.ValueComparison extends SearchCompiler.TaggedMatch
Match a primitive based off of a value comparison. This currently supports:- ISO8601 dates (YYYY-MM-DD)
- Numbers
- Alpha-numeric comparison
-
-
Field Summary
Fields Modifier and Type Field Description private intcompareModeprivate static java.util.regex.PatternISO8601private java.lang.Stringkeyprivate java.lang.DoublereferenceNumberprivate java.lang.StringreferenceValue
-
Constructor Summary
Constructors Constructor Description ValueComparison(java.lang.String key, java.lang.String referenceValue, int compareMode)Create a newSearchCompiler.ValueComparisonobject
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)inthashCode()booleanmatch(Tagged osm)Tests whether the tagged object matches this criterion.java.lang.StringtoString()SearchCompiler.Matchvalidate()Check if this is a valid match object-
Methods inherited from class org.openstreetmap.josm.data.osm.search.SearchCompiler.TaggedMatch
compilePattern, match
-
Methods inherited from class org.openstreetmap.josm.data.osm.search.SearchCompiler.Match
test
-
-
-
-
Field Detail
-
key
private final java.lang.String key
-
referenceValue
private final java.lang.String referenceValue
-
referenceNumber
private final java.lang.Double referenceNumber
-
compareMode
private final int compareMode
-
ISO8601
private static final java.util.regex.Pattern ISO8601
-
-
Constructor Detail
-
ValueComparison
public ValueComparison(java.lang.String key, java.lang.String referenceValue, int compareMode)
Create a newSearchCompiler.ValueComparisonobject- Parameters:
key- The key to get the value fromreferenceValue- The value to compare tocompareMode- The compare mode to use;< 0iscurrentValue < referenceValueand> 0iscurrentValue > referenceValue.0is effectively an equality check.
-
-
Method Detail
-
match
public boolean match(Tagged osm)
Description copied from class:SearchCompiler.MatchTests whether the tagged object matches this criterion.- Specified by:
matchin classSearchCompiler.TaggedMatch- Parameters:
osm- the tagged object to test- Returns:
- true if the tagged object matches this criterion
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
validate
public SearchCompiler.Match validate() throws SearchParseError
Description copied from class:SearchCompiler.MatchCheck if this is a valid match object- Overrides:
validatein classSearchCompiler.Match- Returns:
this, for easy chaining- Throws:
SearchParseError- If the match is not valid
-
-