Class ConstraintSet


  • public class ConstraintSet
    extends Constraint
    Groups a series of Constraints together. Specify whether in the query the relationship between them should be AND or OR
    Author:
    Richard Smith, Mark Woodbridge, Matthew Wakeling
    • Field Detail

      • constraints

        protected java.util.LinkedHashSet<Constraint> constraints
      • VALID_OPS

        protected static final java.util.List<ConstraintOp> VALID_OPS
    • Constructor Detail

      • ConstraintSet

        public ConstraintSet​(ConstraintOp op)
        Construct empty ConstraintSet
        Parameters:
        op - relationship between constraints
    • Method Detail

      • addConstraint

        public ConstraintSet addConstraint​(Constraint constraint)
        Add a Constraint to the set
        Parameters:
        constraint - Constraint to be added to set
        Returns:
        this ConstraintSet
      • removeConstraint

        public ConstraintSet removeConstraint​(Constraint constraint)
        Remove specified constraint
        Parameters:
        constraint - Constraint to be removed from set
        Returns:
        this ConstraintSet
      • getConstraints

        public java.util.Set<Constraint> getConstraints()
        Returns the Set of constraints.
        Returns:
        Set of Constraint objects
      • equals

        public boolean equals​(java.lang.Object obj)
        Test whether two ConstraintSets are equal, overrides Object.equals(). constraints are held in LinkedHashSet, it uses the Set.equals() method which should check for equality regardless of the element ordering imposed in LinkedHashSet.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object to compare with
        Returns:
        true if objects are equal
      • hashCode

        public int hashCode()
        Get the hashCode for this object overrides Object.hashCode().
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hashCode
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object