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 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 boolean
negateResult
If we should negate the result of the match.Pattern
pattern
A predicate used to match a the regexp against the key.
-
Constructor Summary
Constructors Constructor Description KeyRegexpCondition(Pattern pattern, boolean negateResult)
Creates a new KeyPatternCondition
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
applies(Tagged osm)
Checks if the condition applies in the givenTagged
element.Tag
asTag(Tagged p)
Get the matched key and the corresponding value.String
toString()
-
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 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(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:Condition
Checks if the condition applies in the givenTagged
element.- Specified by:
applies
in interfaceCondition
- Specified by:
applies
in interfaceCondition.TagCondition
- Parameters:
osm
- The tagged to check.- Returns:
true
if 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:
asTag
in interfaceCondition.TagCondition
- Parameters:
p
- The primitive to get the value from.- Returns:
- The tag.
-
-