Class ConditionFactory.KeyValueCondition
- java.lang.Object
-
- org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.KeyValueCondition
-
- All Implemented Interfaces:
Condition
,Condition.TagCondition
- Direct Known Subclasses:
ConditionFactory.KeyValueRegexpCondition
- Enclosing class:
- ConditionFactory
public static class ConditionFactory.KeyValueCondition extends java.lang.Object implements Condition.TagCondition
Represents a key/value condition which is either applied to a primitive.
-
-
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
considerValAsKey
If this flag is set,v
is treated as a key and the value is the value set for that key.java.lang.String
k
The key to search for.ConditionFactory.Op
op
The key/value match operation.java.lang.String
v
The value to search for.
-
Constructor Summary
Constructors Constructor Description KeyValueCondition(java.lang.String k, java.lang.String v, ConditionFactory.Op op, boolean considerValAsKey)
Creates a key/value-condition.
-
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 primitive)
Converts the current condition to a tagboolean
requiresExactKeyMatch()
Determines if this condition requires an exact key match.java.lang.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
-
k
public final java.lang.String k
The key to search for.
-
v
public final java.lang.String v
The value to search for.
-
op
public final ConditionFactory.Op op
The key/value match operation.
-
considerValAsKey
public final boolean considerValAsKey
If this flag is set,v
is treated as a key and the value is the value set for that key.
-
-
Constructor Detail
-
KeyValueCondition
public KeyValueCondition(java.lang.String k, java.lang.String v, ConditionFactory.Op op, boolean considerValAsKey)
Creates a key/value-condition.
- Parameters:
k
- the keyv
- the valueop
- the operationconsiderValAsKey
- whether to considerv
as another key and compare the values of keyk
and keyv
.
-
-
Method Detail
-
requiresExactKeyMatch
public boolean requiresExactKeyMatch()
Determines if this condition requires an exact key match.- Returns:
true
if this condition requires an exact key match.- Since:
- 14801
-
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 primitive)
Description copied from interface:Condition.TagCondition
Converts the current condition to a tag- Specified by:
asTag
in interfaceCondition.TagCondition
- Parameters:
primitive
- A tagged object to use as context. May be ignored.- Returns:
- A tag with the key/value of this condition.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-