Enum ConditionFactory.Op

    • 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 values
      private 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.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • 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 during eval(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 name
        java.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 be null
        prototypeString - The reference string-
        Returns:
        true if and only if this operation matches for the given value/reference pair.