Class ConditionFactory
- java.lang.Object
-
- org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory
-
public final class ConditionFactory extends Object
Factory to generateCondition
s.- Since:
- 10837 (Extracted from Condition)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ConditionFactory.ClassCondition
Class condition.static class
ConditionFactory.ExpressionCondition
A condition that is fulfilled whenever the expression is evaluated to be true.static class
ConditionFactory.IndexCondition
Index condition.static class
ConditionFactory.KeyCondition
KeyCondition represent one of the following conditions in either the link or the primitive context:static class
ConditionFactory.KeyMatchType
This defines howConditionFactory.KeyCondition
matches a given key.static class
ConditionFactory.KeyRegexpCondition
KeyPatternCondition represents a conditions matching keys based on a pattern.static class
ConditionFactory.KeyValueCondition
Represents a key/value condition which is either applied to a primitive.static class
ConditionFactory.KeyValueRegexpCondition
This condition requires a fixed key to match a given regexpstatic class
ConditionFactory.Op
This is the operation thatConditionFactory.KeyValueCondition
uses to match.static class
ConditionFactory.OpenEndPseudoClassCondition
Open end pseudo class condition.static class
ConditionFactory.PseudoClassCondition
Pseudo class condition.static class
ConditionFactory.PseudoClasses
Like CSS pseudo classes, MapCSS pseudo classes are written in lower case with dashes between words.static class
ConditionFactory.RegexpKeyValueRegexpCondition
A condition that checks that a key with the matching pattern has a value with the matching pattern.static class
ConditionFactory.RoleCondition
Role condition.static class
ConditionFactory.SimpleKeyValueCondition
Most common case of a KeyValueCondition, this is the basic key=value case.
-
Constructor Summary
Constructors Modifier Constructor Description private
ConditionFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ConditionFactory.ClassCondition
createClassCondition(String id, boolean not, Condition.Context context)
Create a new class conditionstatic ConditionFactory.ExpressionCondition
createExpressionCondition(Expression e, Condition.Context context)
Create a new condition that a expression needs to be fulfilledstatic Condition
createKeyCondition(String k, boolean not, ConditionFactory.KeyMatchType matchType, Condition.Context context)
Creates a condition that checks the given key.static Condition
createKeyValueCondition(String k, String v, ConditionFactory.Op op, Condition.Context context, boolean considerValAsKey)
Create a new condition that checks the key and the value of the object.static ConditionFactory.PseudoClassCondition
createPseudoClassCondition(String id, boolean not, Condition.Context context)
Create a new pseudo class conditionstatic Condition
createRegexpKeyRegexpValueCondition(String k, String v, ConditionFactory.Op op)
Create a condition in which the key and the value need to match a given regexp
-
-
-
Constructor Detail
-
ConditionFactory
private ConditionFactory()
-
-
Method Detail
-
createKeyValueCondition
public static Condition createKeyValueCondition(String k, String v, ConditionFactory.Op op, Condition.Context context, boolean considerValAsKey)
Create a new condition that checks the key and the value of the object.- Parameters:
k
- The key.v
- The reference valueop
- The operation to use when comparing the valuecontext
- The type of context to use.considerValAsKey
- whether to considerv
as another key and compare the values of keyk
and keyv
.- Returns:
- The new condition.
- Throws:
MapCSSException
- if the arguments are incorrect
-
createRegexpKeyRegexpValueCondition
public static Condition createRegexpKeyRegexpValueCondition(String k, String v, ConditionFactory.Op op)
Create a condition in which the key and the value need to match a given regexp- Parameters:
k
- The key regexpv
- The value regexpop
- The operation to use when comparing the key and the value.- Returns:
- The new condition.
-
createKeyCondition
public static Condition createKeyCondition(String k, boolean not, ConditionFactory.KeyMatchType matchType, Condition.Context context)
Creates a condition that checks the given key.- Parameters:
k
- The key to test fornot
-true
to invert the matchmatchType
- The match type to check for.context
- The context this rule is found in.- Returns:
- the new condition.
-
createPseudoClassCondition
public static ConditionFactory.PseudoClassCondition createPseudoClassCondition(String id, boolean not, Condition.Context context)
Create a new pseudo class condition- Parameters:
id
- The id of the pseudo classnot
-true
to invert the conditioncontext
- The context the class is found in.- Returns:
- The new condition
-
createClassCondition
public static ConditionFactory.ClassCondition createClassCondition(String id, boolean not, Condition.Context context)
Create a new class condition- Parameters:
id
- The id of the class to matchnot
-true
to invert the conditioncontext
- Ignored- Returns:
- The new condition
-
createExpressionCondition
public static ConditionFactory.ExpressionCondition createExpressionCondition(Expression e, Condition.Context context)
Create a new condition that a expression needs to be fulfilled- Parameters:
e
- the expression to checkcontext
- Ignored- Returns:
- The new condition
-
-