Package ru.ispras.fortress.expression
Class NodeOperation
- java.lang.Object
-
- ru.ispras.fortress.expression.Node
-
- ru.ispras.fortress.expression.NodeOperation
-
public final class NodeOperation extends Node
TheNodeOperation
class represents an expression node described by an operation and operands.
-
-
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).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Node
deepCopy()
Creates a deep copy of the current objects.boolean
equals(java.lang.Object obj)
DataType
getDataType()
Returns an object that describes the type of the value referred by the node.Node
getOperand(int index)
Returns an operand by its index.int
getOperandCount()
Returns the number of operands.java.util.List<Node>
getOperands()
Returns an unmodifiable list of operands.java.lang.Enum<?>
getOperationId()
Returns an operation identifier.int
hashCode()
java.lang.String
toString()
-
Methods inherited from class ru.ispras.fortress.expression.Node
deepestCopy, getDataTypeId, getKind, getUserData, isType, isType, isType, isType, setUserData
-
-
-
-
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) isnull
.
-
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 ornull
to rely on automated type calculation.- Throws:
java.lang.IllegalArgumentException
- if any parameter (including every operand) isnull
.
-
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) isnull
.
-
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 ornull
to rely on automated type calculation.operands
- Collection of expression operands.- Throws:
java.lang.IllegalArgumentException
- if any parameter (including every operand) isnull
.
-
-
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.
-
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 classNode
- Returns:
- A data type object.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-