Class FieldOfMultiple

All Implemented Interfaces:
Constraint

public class FieldOfMultiple extends Field
Checks if generated elements has or has not a specific value for a field, or the field value of another set of generated elements.
Author:
Ozgun Babur
  • Field Details

    • con1

      protected MappedConst con1
      Generative constraint for first group of generated elements, to use on first mapped element.
    • con2

      protected MappedConst con2
      Generative constraint for second group of generated elements, to use on second mapped element.
  • Constructor Details

    • FieldOfMultiple

      public FieldOfMultiple(MappedConst con, String accessorString, Field.Operation oper, Object value)
      Constructor with accessor string for the field value of the element and the desired value. If the desired value is EMPTY, then emptiness is checked. If it is USE_SECOND_ARG, then the second mapped element is used as the desired value. If a filed of the second element is desired then the other constructor should be used.
      Parameters:
      con - the generative constraint of size 2 whose generated values will be checked
      accessorString - accessor string for the element
      oper - operation
      value - desired value
    • FieldOfMultiple

      public FieldOfMultiple(MappedConst con1, String accessorString1, MappedConst con2, String accessorString2, Field.Operation oper)
      Constructor with accessor strings for the field value of the element and the desired value that will be reached from the second element.
      Parameters:
      con1 - the generative constraint of size 2 for the first group of elements
      accessorString1 - accessor string for the first element
      con2 - the generative constraint of size 2 for the second group of elements
      accessorString2 - accessor string for the second element
      oper - operation
  • Method Details

    • getVariableSize

      public int getVariableSize()
      Size of this constraint is one less than con1 if con2 is null, otherwise it is two less than the total of size of con1 and con2.
      Specified by:
      getVariableSize in interface Constraint
      Overrides:
      getVariableSize in class ConstraintAdapter
      Returns:
      the size based on con1 and con2
    • satisfies

      public boolean satisfies(Match match, int... ind)
      Checks if the generated elements from the first mapped element has either the desired value, or has some value in common with the elements generated from second mapped element.
      Specified by:
      satisfies in interface Constraint
      Overrides:
      satisfies in class Field
      Parameters:
      match - current pattern match
      ind - mapped indices
      Returns:
      true if a value match is found