Interface ExpressionNode

All Superinterfaces:
Cloneable
All Known Implementing Classes:
ConstantNode, FunctionNode, OperatorNode, VariableNode

public interface ExpressionNode extends Cloneable

Name: ExpressionNode

Description: Common interface implemented by different nodes of an expression tree

Date: 08/dic/06 Time: 14:28:56

Version:
1.0
Author:
Bertoli Marco
  • Field Details

  • Method Details

    • getValue

      double getValue()
      Returns value of target node
      Returns:
      value of node
    • setVariable

      void setVariable(String name, double value)
      Sets the value for a variable
      Parameters:
      name - name of the variable to be set
      value - value for the variable
    • getType

      int getType()
      Returns type of node
      Returns:
      CONSTANT_NODE, VARIABLE_NODE, OPERATOR_NODE, FUNCTION_NODE
    • getSubtype

      String getSubtype()
      Returns more information on node type
      Returns:
      name of node function or operator symbol
    • getDepth

      int getDepth()
      Returns depth of current subtree
      Returns:
      depth of the tree
    • count

      int count()
      Counts number of nodes in current subtree
      Returns:
      number of nodes (included root)
    • getChildrenNodes

      ExpressionNode[] getChildrenNodes()
      Returns children nodes of this node, ordered from leftmost to rightmost.
      Returns:
      an array of children nodes. If node has no child, destination array has zero size.
    • toString

      String toString()
      Returns a string describing the entire tree
      Overrides:
      toString in class Object
      Returns:
      string describing the entire tree
    • clone

      Object clone()
      Clones current node
      Returns:
      deep copy of current node