public static class ConditionFactory.KeyCondition extends java.lang.Object implements Condition, Condition.ToTagConvertable
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
Condition.Context, Condition.ToTagConvertable
Modifier and Type | Field and Description |
---|---|
java.util.function.Predicate<java.lang.String> |
containsPattern
A predicate used to match a the regexp against the key.
|
java.lang.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 and Description |
---|
KeyCondition(java.lang.String label,
boolean negateResult,
ConditionFactory.KeyMatchType matchType)
Creates a new KeyCondition
|
Modifier and Type | Method and Description |
---|---|
boolean |
applies(Environment e)
Checks if the condition applies in the given MapCSS
Environment . |
Tag |
asTag(OsmPrimitive p)
Get the matched key and the corresponding value.
|
java.lang.String |
toString() |
public final java.lang.String label
public final boolean negateResult
public final ConditionFactory.KeyMatchType matchType
ConditionFactory.KeyMatchType
public final java.util.function.Predicate<java.lang.String> containsPattern
public KeyCondition(java.lang.String label, boolean negateResult, ConditionFactory.KeyMatchType matchType)
label
- The key name (or regexp) to use.negateResult
- If we should negate the result.,matchType
- The match type.public boolean applies(Environment e)
Condition
Environment
.public Tag asTag(OsmPrimitive p)
WARNING: This ignores negateResult
.
WARNING: For regexp, the regular expression is returned instead of a key if the match failed.
asTag
in interface Condition.ToTagConvertable
p
- The primitive to get the value from.public java.lang.String toString()
toString
in class java.lang.Object