Class ConditionFactory.KeyRegexpCondition
- java.lang.Object
-
- org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyRegexpCondition
-
- All Implemented Interfaces:
Condition,Condition.TagCondition
- Enclosing class:
- ConditionFactory
public static class ConditionFactory.KeyRegexpCondition extends java.lang.Object implements Condition.TagCondition
KeyPatternCondition represents a conditions matching keys based on a pattern.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openstreetmap.josm.gui.mappaint.mapcss.Condition
Condition.Context, Condition.TagCondition
-
-
Field Summary
Fields Modifier and Type Field Description booleannegateResultIf we should negate the result of the match.java.util.regex.PatternpatternA predicate used to match a the regexp against the key.
-
Constructor Summary
Constructors Constructor Description KeyRegexpCondition(java.util.regex.Pattern pattern, boolean negateResult)Creates a new KeyPatternCondition
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanapplies(Tagged osm)Checks if the condition applies in the givenTaggedelement.TagasTag(Tagged p)Get the matched key and the corresponding value.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.gui.mappaint.mapcss.Condition.TagCondition
applies
-
-
-
-
Field Detail
-
pattern
public final java.util.regex.Pattern pattern
A predicate used to match a the regexp against the key. Only used if the match type is regexp.
-
negateResult
public final boolean negateResult
If we should negate the result of the match.
-
-
Constructor Detail
-
KeyRegexpCondition
public KeyRegexpCondition(java.util.regex.Pattern pattern, boolean negateResult)
Creates a new KeyPatternCondition- Parameters:
pattern- The regular expression for matching keys.negateResult- If we should negate the result.
-
-
Method Detail
-
applies
public boolean applies(Tagged osm)
Description copied from interface:ConditionChecks if the condition applies in the givenTaggedelement.- Specified by:
appliesin interfaceCondition- Specified by:
appliesin interfaceCondition.TagCondition- Parameters:
osm- The tagged to check.- Returns:
trueif the condition applies.
-
asTag
public Tag asTag(Tagged p)
Get the matched key and the corresponding value.WARNING: This ignores
negateResult.WARNING: For regexp, the regular expression is returned instead of a key if the match failed.
- Specified by:
asTagin interfaceCondition.TagCondition- Parameters:
p- The primitive to get the value from.- Returns:
- The tag.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-