Class OneOf

All Implemented Interfaces:
Serializable

public class OneOf extends ExecutionPolicy
An execution policy rule that encapsulates a test of type property_value_or_expression is one of [value1, ··· , valueN]. The test applies to numeric and string values.
Author:
Laurent Cohen
See Also:
  • Constructor Details

    • OneOf

      public OneOf(String propertyNameOrExpression, double... values)
      Determine whether the value of a property, expressed as a double, is in the specified array of values.
      Parameters:
      propertyNameOrExpression - either a literal string which represents a property name, or an expression resolving to a numeric value.
      values - the values to compare with.
    • OneOf

      public OneOf(String propertyNameOrExpression, String... values)
      Determine whether the value of a property, expressed as a double, is in the specified array of values.
      Parameters:
      propertyNameOrExpression - either a literal string which represents a property name, or an expression resolving to a numeric value.
      values - expressions resolving to double values to compare with.
    • OneOf

      public OneOf(String propertyNameOrExpression, boolean ignoreCase, String... values)
      Determine whether the value of a property, expressed as a String, is in the specified array of values.
      Parameters:
      propertyNameOrExpression - either a literal string which represents a property name, or an expression resolving to a numeric value.
      ignoreCase - determines if the comparison should ignore the string case.
      values - the values or expressions resolving to strings to compare with.
  • Method Details

    • accepts

      public boolean accepts(PropertiesCollection<String> info)
      Determines whether this policy accepts the specified node.
      Specified by:
      accepts in class ExecutionPolicy
      Parameters:
      info - system information for the node on which the tasks will run if accepted.
      Returns:
      true if the node is accepted, false otherwise.
    • toString

      public String toString(int n)
      Print this object to a string.
      Specified by:
      toString in class ExecutionPolicy
      Parameters:
      n - the size of the indent to startwith.
      Returns:
      an XML string representation of this object
    • getLeftOperandValue

      protected Object getLeftOperandValue(PropertiesCollection<String> properties)
      Parameters:
      properties - the proeprties collection to evaluate against.
      Returns:
      the typed value of the left operand expression.