Enum ConditionFactory.Op
- java.lang.Object
-
- java.lang.Enum<ConditionFactory.Op>
-
- org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ConditionFactory.Op>
- Enclosing class:
- ConditionFactory
public static enum ConditionFactory.Op extends java.lang.Enum<ConditionFactory.Op>
This is the operation thatConditionFactory.KeyValueCondition
uses to match.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BEGINS_WITH
The value needs to begin with the reference string.CONTAINS
The value needs to contain the reference string.ENDS_WITH
The value needs to end with the reference string.EQ
The value equals the given reference.GREATER
The value is greater than the given reference value (as float).GREATER_OR_EQUAL
The value is greater than or equal to the given reference value (as float).LESS
The value is less than the given reference value (as float).LESS_OR_EQUAL
The value is less than or equal to the given reference value (as float).NEQ
The value does not equal the reference.NREGEX
The reference is treated as regular expression and the value needs to not match it.ONE_OF
The reference is treated as a list separated by ';'.REGEX
The reference is treated as regular expression and the value needs to match it.
-
Field Summary
Fields Modifier and Type Field Description private java.util.function.BiPredicate<java.lang.String,java.lang.String>
function
private boolean
negated
(package private) static java.util.Set<ConditionFactory.Op>
NEGATED_OPS
-
Constructor Summary
Constructors Modifier Constructor Description private
Op(java.util.function.BiPredicate<java.lang.String,java.lang.String> func)
Create a new string operation.private
Op(java.util.function.IntFunction<java.lang.Boolean> comparatorResult)
Create a new float operation that compares two float valuesprivate
Op(ConditionFactory.Op negate)
Create a new Op by negating an other op.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
eval(java.lang.String testString, java.lang.String prototypeString)
Evaluates a value against a reference string.static ConditionFactory.Op
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static ConditionFactory.Op[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
EQ
public static final ConditionFactory.Op EQ
The value equals the given reference.
-
NEQ
public static final ConditionFactory.Op NEQ
The value does not equal the reference.
-
GREATER_OR_EQUAL
public static final ConditionFactory.Op GREATER_OR_EQUAL
The value is greater than or equal to the given reference value (as float).
-
GREATER
public static final ConditionFactory.Op GREATER
The value is greater than the given reference value (as float).
-
LESS_OR_EQUAL
public static final ConditionFactory.Op LESS_OR_EQUAL
The value is less than or equal to the given reference value (as float).
-
LESS
public static final ConditionFactory.Op LESS
The value is less than the given reference value (as float).
-
REGEX
public static final ConditionFactory.Op REGEX
The reference is treated as regular expression and the value needs to match it.
-
NREGEX
public static final ConditionFactory.Op NREGEX
The reference is treated as regular expression and the value needs to not match it.
-
ONE_OF
public static final ConditionFactory.Op ONE_OF
The reference is treated as a list separated by ';'. Spaces around the ; are ignored. The value needs to be equal one of the list elements.
-
BEGINS_WITH
public static final ConditionFactory.Op BEGINS_WITH
The value needs to begin with the reference string.
-
ENDS_WITH
public static final ConditionFactory.Op ENDS_WITH
The value needs to end with the reference string.
-
CONTAINS
public static final ConditionFactory.Op CONTAINS
The value needs to contain the reference string.
-
-
Field Detail
-
NEGATED_OPS
static final java.util.Set<ConditionFactory.Op> NEGATED_OPS
-
function
private final java.util.function.BiPredicate<java.lang.String,java.lang.String> function
-
negated
private final boolean negated
-
-
Constructor Detail
-
Op
private Op(java.util.function.BiPredicate<java.lang.String,java.lang.String> func)
Create a new string operation.- Parameters:
func
- The function to apply duringeval(String, String)
.
-
Op
private Op(java.util.function.IntFunction<java.lang.Boolean> comparatorResult)
Create a new float operation that compares two float values- Parameters:
comparatorResult
- A function to map the result of the comparison
-
Op
private Op(ConditionFactory.Op negate)
Create a new Op by negating an other op.- Parameters:
negate
- inverse operation
-
-
Method Detail
-
values
public static ConditionFactory.Op[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ConditionFactory.Op c : ConditionFactory.Op.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ConditionFactory.Op valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
eval
public boolean eval(java.lang.String testString, java.lang.String prototypeString)
Evaluates a value against a reference string.- Parameters:
testString
- The value. May benull
prototypeString
- The reference string-- Returns:
true
if and only if this operation matches for the given value/reference pair.
-
-