Class VariableExpressionNode

    • Constructor Detail

      • VariableExpressionNode

        public VariableExpressionNode​(String name)
        Construct with the name of the variable.
        Parameters:
        name - the name of the variable
    • Method Detail

      • getName

        public String getName()
        Returns:
        the name of the variable
      • getType

        public int getType()
        Returns the type of the node, in this case ExpressionNode.VARIABLE_NODE
        Specified by:
        getType in interface ExpressionNode
        Returns:
        type of the node
      • getValue

        public double getValue()
        Returns the value of the variable but throws an exception if the value has not been set
        Specified by:
        getValue in interface ExpressionNode
        Returns:
        value of expression
      • setValue

        public void setValue​(double value)
        Sets the value of the variable
        Parameters:
        value - the value of the variable
      • accept

        public void accept​(ExpressionNodeVisitor visitor)
        Implementation of the visitor design pattern. Calls visit on the visitor.
        Specified by:
        accept in interface ExpressionNode
        Parameters:
        visitor - the visitor