Class ConditionFactory
java.lang.Object
org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory
Factory to generate
Conditions.- Since:
- 10837 (Extracted from Condition)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClass condition.static classA condition that is fulfilled whenever the expression is evaluated to be true.static classIndex condition.static classKeyCondition represent one of the following conditions in either the link or the primitive context:static enumThis defines howConditionFactory.KeyConditionmatches a given key.static classKeyPatternCondition represents a conditions matching keys based on a pattern.static classRepresents a key/value condition which is either applied to a primitive.static classThis condition requires a fixed key to match a given regexpstatic enumThis is the operation thatConditionFactory.KeyValueConditionuses to match.static classOpen end pseudo class condition.static classPseudo class condition.static final classLike CSS pseudo classes, MapCSS pseudo classes are written in lower case with dashes between words.static classA condition that checks that a key with the matching pattern has a value with the matching pattern.static classRole condition.static classMost common case of a KeyValueCondition, this is the basic key=value case. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateClassCondition(String id, boolean not, Condition.Context context) Create a new class conditioncreateExpressionCondition(Expression e, Condition.Context context) Create a new condition that a expression needs to be fulfilledstatic ConditioncreateKeyCondition(String k, boolean not, ConditionFactory.KeyMatchType matchType, Condition.Context context) Creates a condition that checks the given key.static ConditioncreateKeyValueCondition(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.createPseudoClassCondition(String id, boolean not, Condition.Context context) Create a new pseudo class conditionstatic ConditionCreate a condition in which the key and the value need to match a given regexp
-
Constructor Details
-
ConditionFactory
private ConditionFactory()
-
-
Method Details
-
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 considervas another key and compare the values of keykand 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-trueto 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-trueto 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-trueto 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
-