public static class Condition.KeyCondition extends Condition
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.ClassCondition, Condition.Context, Condition.ExpressionCondition, Condition.IndexCondition, Condition.KeyCondition, Condition.KeyMatchType, Condition.KeyValueCondition, Condition.KeyValueRegexpCondition, Condition.Op, Condition.OpenEndPseudoClassCondition, Condition.PseudoClassCondition, Condition.PseudoClasses, Condition.RegexpKeyValueRegexpCondition, Condition.RoleCondition, Condition.SimpleKeyValueCondition
Modifier and Type | Field and Description |
---|---|
Predicate<String> |
containsPattern
A predicate used to match a the regexp against the key.
|
String |
label
The key name.
|
Condition.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(String label,
boolean negateResult,
Condition.KeyMatchType matchType)
Creates a new KeyCondition
|
Modifier and Type | Method and Description |
---|---|
boolean |
applies(Environment e) |
Tag |
asTag(OsmPrimitive p)
Get the matched key and the corresponding value.
|
String |
toString() |
createClassCondition, createExpressionCondition, createKeyCondition, createKeyValueCondition, createPseudoClassCondition, createRegexpKeyRegexpValueCondition
public final boolean negateResult
public final Condition.KeyMatchType matchType
Condition.KeyMatchType
public final Predicate<String> containsPattern
public KeyCondition(String label, boolean negateResult, Condition.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)
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.
p
- The primitive to get the value from.