Class NodeOperation


  • public final class NodeOperation
    extends Node
    The NodeOperation class represents an expression node described by an operation and operands.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class ru.ispras.fortress.expression.Node

        Node.Kind
    • Constructor Summary

      Constructors 
      Constructor Description
      NodeOperation​(T operation, java.util.Collection<? extends Node> operands)
      Creates an operation node that has a variable number of operands (from 0 to infinity) packed into a collection.
      NodeOperation​(T operation, DataType dataType, java.util.Collection<? extends Node> operands)
      Creates an operation node that has a variable number of operands (from 0 to infinity) packed into a collection.
      NodeOperation​(T operation, DataType dataType, Node... operands)
      Creates an operation node that has a variable number of operands (from 0 to infinity).
      NodeOperation​(T operation, Node... operands)
      Creates an operation node that has a variable number of operands (from 0 to infinity).
    • Constructor Detail

      • NodeOperation

        public NodeOperation​(T operation,
                             Node... operands)
        Creates an operation node that has a variable number of operands (from 0 to infinity).
        Type Parameters:
        T - Operation identifier type.
        Parameters:
        operation - Operation identifier.
        operands - Array of expression operands.
        Throws:
        java.lang.IllegalArgumentException - if any parameter (including every operand) is null.
      • NodeOperation

        public NodeOperation​(T operation,
                             DataType dataType,
                             Node... operands)
        Creates an operation node that has a variable number of operands (from 0 to infinity).
        Type Parameters:
        T - Operation identifier type.
        Parameters:
        operation - Operation identifier.
        operands - Array of expression operands.
        dataType - Data type associated with the expression or null to rely on automated type calculation.
        Throws:
        java.lang.IllegalArgumentException - if any parameter (including every operand) is null.
      • NodeOperation

        public NodeOperation​(T operation,
                             java.util.Collection<? extends Node> operands)
        Creates an operation node that has a variable number of operands (from 0 to infinity) packed into a collection.
        Type Parameters:
        T - Operation identifier type.
        Parameters:
        operation - Operation identifier.
        operands - Collection of expression operands.
        Throws:
        java.lang.IllegalArgumentException - if any parameter (including every operand) is null.
      • NodeOperation

        public NodeOperation​(T operation,
                             DataType dataType,
                             java.util.Collection<? extends Node> operands)
        Creates an operation node that has a variable number of operands (from 0 to infinity) packed into a collection.
        Type Parameters:
        T - Operation identifier type.
        Parameters:
        operation - Operation identifier.
        dataType - Data type associated with the expression or null to rely on automated type calculation.
        operands - Collection of expression operands.
        Throws:
        java.lang.IllegalArgumentException - if any parameter (including every operand) is null.
    • Method Detail

      • deepCopy

        public Node deepCopy()
        Description copied from class: Node
        Creates a deep copy of the current objects. All aggregated objects that are not readonly must be cloned. This excludes user data as its type is unknown.
        Specified by:
        deepCopy in class Node
        Returns:
        Full copy of the current node object.
      • getOperandCount

        public int getOperandCount()
        Returns the number of operands.
        Returns:
        Number of operands.
      • getOperand

        public Node getOperand​(int index)
        Returns an operand by its index.
        Parameters:
        index - Index of the operand.
        Returns:
        An operand of the expression.
      • getOperands

        public java.util.List<Node> getOperands()
        Returns an unmodifiable list of operands.
        Returns:
        An unmodifiable list of operands.
      • getOperationId

        public java.lang.Enum<?> getOperationId()
        Returns an operation identifier.
        Returns:
        An operation identifier.
      • getDataType

        public DataType getDataType()
        Description copied from class: Node
        Returns an object that describes the type of the value referred by the node.
        Specified by:
        getDataType in class Node
        Returns:
        A data type object.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

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