Class ConditionFactory.KeyCondition
- java.lang.Object
-
- org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyCondition
-
- All Implemented Interfaces:
Condition
,Condition.TagCondition
- Enclosing class:
- ConditionFactory
public static class ConditionFactory.KeyCondition extends Object implements Condition.TagCondition
KeyCondition represent one of the following conditions in either the link or the primitive context:
["a label"] PRIMITIVE: the primitive has a tag "a label" LINK: the parent is a relation and it has at least one member with the role "a label" referring to the child [!"a label"] PRIMITIVE: the primitive doesn't have a tag "a label" LINK: the parent is a relation but doesn't have a member with the role "a label" referring to the child ["a label"?] PRIMITIVE: the primitive has a tag "a label" whose value evaluates to a true-value LINK: not supported ["a label"?!] PRIMITIVE: the primitive has a tag "a label" whose value evaluates to a false-value LINK: not supported
- See Also:
ConditionFactory.KeyRegexpCondition
-
-
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 String
label
The key name.ConditionFactory.KeyMatchType
matchType
Describes how to match the label against the key.boolean
negateResult
If we should negate the result of the match.
-
Constructor Summary
Constructors Constructor Description KeyCondition(String label, boolean negateResult, ConditionFactory.KeyMatchType matchType)
Creates a new KeyCondition
-
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.private Predicate<String>
keyPredicate()
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
-
negateResult
public final boolean negateResult
If we should negate the result of the match.
-
matchType
public final ConditionFactory.KeyMatchType matchType
Describes how to match the label against the key.- See Also:
ConditionFactory.KeyMatchType
-
-
Constructor Detail
-
KeyCondition
public KeyCondition(String label, boolean negateResult, ConditionFactory.KeyMatchType matchType)
Creates a new KeyCondition- Parameters:
label
- The key name (or regexp) to use.negateResult
- If we should negate the result.,matchType
- The match type.
-
-
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.
-
keyPredicate
private Predicate<String> keyPredicate()
-
asTag
public Tag asTag(Tagged p)
Get the matched key and the corresponding value.WARNING: This ignores
negateResult
.- Specified by:
asTag
in interfaceCondition.TagCondition
- Parameters:
p
- The primitive to get the value from.- Returns:
- The tag.
-
-