Class Block

    • Constructor Detail

      • Block

        public Block()
        Constructor for Block.
      • Block

        public Block​(Statement statement)
        Constructor for Block with a single Statement.
        Parameters:
        statement - The Statement to be added to the block
    • Method Detail

      • getStatements

        public List<Statement> getStatements()
        Get all the statements contained on this block.
        Returns:
        A list of Statements contained in this block
      • setStatements

        public void setStatements​(List<Statement> statements)
        Set the statements contained on this block.
        Parameters:
        statements - A list of Statements contained in this block
      • addStatement

        public void addStatement​(Statement statement)
        Add a Statement to this block.
        Parameters:
        statement - The Statement to be added to the block
      • addStatement

        public void addStatement​(Statement statement,
                                 boolean exception)
      • 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
      • clone

        public Block clone()
        Deep clone statement to produce a new identical block.
        Specified by:
        clone in interface LanguageObject
        Specified by:
        clone in class Statement
        Returns:
        Deep clone
      • equals

        public boolean equals​(Object obj)
        Compare two queries for equality. Blocks will only evaluate to equal if they are IDENTICAL: statements in the block are equal and are in the same order.
        Overrides:
        equals in class Object
        Parameters:
        obj - Other object
        Returns:
        True if equal
      • hashCode

        public int hashCode()
        Get hashcode for block. WARNING: This hash code relies on the hash codes of the statements present in the block. If statements are added to the block or if statements on the block change the hash code will change. Hash code is only valid after the block 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 Statement
        Returns:
        String representation of object
      • isAtomic

        public boolean isAtomic()
      • setAtomic

        public void setAtomic​(boolean atomic)
      • getType

        public int getType()
        Description copied from class: Statement
        Return type of statement to make it easier to build switch statements by statement type.
        Specified by:
        getType in class Statement
        Returns:
        Type from TYPE constants
      • getExceptionGroup

        public String getExceptionGroup()
      • setExceptionGroup

        public void setExceptionGroup​(String exceptionGroup)
      • getExceptionStatements

        public List<Statement> getExceptionStatements()
      • setExceptionStatements

        public void setExceptionStatements​(List<Statement> exceptionStatements)