Class ConditionFactory
- java.lang.Object
-
- org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory
-
public final class ConditionFactory extends java.lang.Object
Factory to generateConditions.- Since:
- 10837 (Extracted from Condition)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConditionFactory.ClassConditionClass condition.static classConditionFactory.ExpressionConditionA condition that is fulfilled whenever the expression is evaluated to be true.static classConditionFactory.IndexConditionIndex condition.static classConditionFactory.KeyConditionKeyCondition represent one of the following conditions in either the link or the primitive context:static classConditionFactory.KeyMatchTypeThis defines howConditionFactory.KeyConditionmatches a given key.static classConditionFactory.KeyRegexpConditionKeyPatternCondition represents a conditions matching keys based on a pattern.static classConditionFactory.KeyValueConditionRepresents a key/value condition which is either applied to a primitive.static classConditionFactory.KeyValueRegexpConditionThis condition requires a fixed key to match a given regexpstatic classConditionFactory.OpThis is the operation thatConditionFactory.KeyValueConditionuses to match.static classConditionFactory.OpenEndPseudoClassConditionOpen end pseudo class condition.static classConditionFactory.PseudoClassConditionPseudo class condition.static classConditionFactory.PseudoClassesLike CSS pseudo classes, MapCSS pseudo classes are written in lower case with dashes between words.static classConditionFactory.RegexpKeyValueRegexpConditionA condition that checks that a key with the matching pattern has a value with the matching pattern.static classConditionFactory.RoleConditionRole condition.static classConditionFactory.SimpleKeyValueConditionMost common case of a KeyValueCondition, this is the basic key=value case.
-
Constructor Summary
Constructors Modifier Constructor Description privateConditionFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ConditionFactory.ClassConditioncreateClassCondition(java.lang.String id, boolean not, Condition.Context context)Create a new class conditionstatic ConditionFactory.ExpressionConditioncreateExpressionCondition(Expression e, Condition.Context context)Create a new condition that a expression needs to be fulfilledstatic ConditioncreateKeyCondition(java.lang.String k, boolean not, ConditionFactory.KeyMatchType matchType, Condition.Context context)Creates a condition that checks the given key.static ConditioncreateKeyValueCondition(java.lang.String k, java.lang.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.PseudoClassConditioncreatePseudoClassCondition(java.lang.String id, boolean not, Condition.Context context)Create a new pseudo class conditionstatic ConditioncreateRegexpKeyRegexpValueCondition(java.lang.String k, java.lang.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(java.lang.String k, java.lang.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(java.lang.String k, java.lang.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(java.lang.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(java.lang.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(java.lang.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
-
-