Class SubQueryConstraint

  • All Implemented Interfaces:
    SQLStringable

    public class SubQueryConstraint
    extends AbstractConstraint
    A representation of a constraint where an AbstractValue is IN the results of a Query.
    Author:
    Matthew Wakeling
    • Constructor Detail

      • SubQueryConstraint

        public SubQueryConstraint​(AbstractValue left,
                                  Query right)
        Constructor for SubQueryConstraint object.
        Parameters:
        left - the AbstractValue on the left of the constraint
        right - the Query containing the results. The query should only have one column in its results.
    • Method Detail

      • getSQLString

        public java.lang.String getSQLString()
        Returns a String representation of this SubQueryConstraint object, suitable for forming part of an SQL Query.
        Specified by:
        getSQLString in interface SQLStringable
        Specified by:
        getSQLString in class AbstractConstraint
        Returns:
        the String representation
      • compare

        public int compare​(AbstractConstraint obj,
                           java.util.Map<AbstractTable,​AbstractTable> tableMap,
                           java.util.Map<AbstractTable,​AbstractTable> reverseTableMap)
        Compare this SubQueryConstraint with another AbstractConstraint, ignoring aliases in member fields and tables. Compare this AbstractConstraint with another, ignoring aliases in member fields and tables.
        Specified by:
        compare in class AbstractConstraint
        Parameters:
        obj - an AbstractConstraint to compare to
        tableMap - a Map from tables in this constraint to tables in obj
        reverseTableMap - a reverse of tableMap
        Returns:
        INDEPENDENT, IMPLIED_BY, IMPLIES, EQUAL, OPPOSITE, EXCLUDES, or OR, depending on the constraints.
      • hashCode

        public int hashCode()
        Overrides Object.hashCode().
        Specified by:
        hashCode in class AbstractConstraint
        Returns:
        an arbitrary integer based on the contents of the Constraint