Class Update

    • Constructor Detail

      • Update

        public Update()
        Constructs a default instance of this class.
      • Update

        public Update​(GroupSymbol group,
                      SetClauseList changeList)
        Construct with group and change list
        Parameters:
        group - Group to by updated
        changeList - List of CompareCriteria that represent Element and expression updates
      • Update

        public Update​(GroupSymbol group,
                      SetClauseList changeList,
                      Criteria criteria)
        Construct with group, change list, and criteria
        Parameters:
        group - DataGroupID that represents the group being updated
        changeList - of changeCriteria that represent Element and value pairings
        criteria - Criteria that defines what rows get updated
    • Method Detail

      • getType

        public int getType()
        Return type of command.
        Specified by:
        getType in class Command
        Returns:
        TYPE_UPDATE
      • setGroup

        public void setGroup​(GroupSymbol group)
        Set the group being updated
        Parameters:
        group - Group being updated
      • setChangeList

        public void setChangeList​(SetClauseList changeList)
        Set the list of CompareCriteria representing updates being made
        Parameters:
        changeList - List of CompareCriteria
      • getChangeList

        public SetClauseList getChangeList()
        Return the list of CompareCriteria representing updates being made
        Returns:
        List of CompareCriteria
      • addChange

        public void addChange​(ElementSymbol id,
                              Expression value)
        Add change to change list - a change is represented by a CompareCriteria internally but can be added here as an element and an expression
        Parameters:
        id - Element to be changed
        value - Expression, often a value, being set
      • getCriteria

        public Criteria getCriteria()
        Returns the criteria object for this command, may be null
        Specified by:
        getCriteria in interface FilteredCommand
        Returns:
        Criteria, may be null
      • setCriteria

        public void setCriteria​(Criteria criteria)
        Set the criteria for this Update command
        Specified by:
        setCriteria in interface FilteredCommand
        Parameters:
        criteria - Criteria to be associated with this command
      • acceptVisitor

        public void acceptVisitor​(LanguageVisitor visitor)
        Description copied from interface: LanguageObject
        Method for accepting a visitor. It is the responsibility of the language object to call back on the visitor.
        Specified by:
        acceptVisitor in interface LanguageObject
        Parameters:
        visitor - Visitor being used
      • hashCode

        public int hashCode()
        Get hashcode for command. WARNING: This hash code relies on the hash codes of the Group, changeList and Criteria clause. If the command changes, it's hash code will change and it can be lost from collections. Hash code is only valid after command has been completely constructed.
        Overrides:
        hashCode in class Object
        Returns:
        Hash code
      • toString

        public String toString()
        Returns a string representation of an instance of this class.
        Overrides:
        toString in class Command
        Returns:
        String representation of object
      • equals

        public boolean equals​(Object obj)
        Compare two update commands for equality. Will only evaluate to equal if they are IDENTICAL: group is equal, changeList contains same compareCriteria, criteria are in the same exact structure.
        Overrides:
        equals in class Object
        Parameters:
        obj - Other object
        Returns:
        True if equal
      • getProjectedSymbols

        public List getProjectedSymbols()
        Get the ordered list of all elements returned by this query. These elements may be ElementSymbols or ExpressionSymbols but in all cases each represents a single column.
        Specified by:
        getProjectedSymbols in class Command
        Returns:
        Ordered list of SingleElementSymbol
      • getConstraint

        public Criteria getConstraint()
      • setConstraint

        public void setConstraint​(Criteria constraint)