org.nfunk.jep.function
Class Assign

java.lang.Object
  extended byorg.nfunk.jep.function.PostfixMathCommand
      extended byorg.nfunk.jep.function.Assign
All Implemented Interfaces:
PostfixMathCommandI, SpecialEvaluationI
Direct Known Subclasses:
MAssign, XAssign

public class Assign
extends PostfixMathCommand
implements SpecialEvaluationI

An assignment operator so we can do x=3+4. This function implements the SpecialEvaluationI interface so that it handles seting the value of a variable.

Author:
Rich Morris Created on 18-Nov-2003

Field Summary
 
Fields inherited from class org.nfunk.jep.function.PostfixMathCommand
curNumberOfParameters, numberOfParameters
 
Constructor Summary
Assign()
           
 
Method Summary
 java.lang.Object evaluate(Node node, java.lang.Object data, ParserVisitor pv, java.util.Stack inStack)
          For assignment set the value of the variable on the lhs to value returned by evaluating the righthand side.
 
Methods inherited from class org.nfunk.jep.function.PostfixMathCommand
checkStack, getNumberOfParameters, run, setCurNumberOfParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Assign

public Assign()
Method Detail

evaluate

public java.lang.Object evaluate(Node node,
                                 java.lang.Object data,
                                 ParserVisitor pv,
                                 java.util.Stack inStack)
                          throws ParseException
For assignment set the value of the variable on the lhs to value returned by evaluating the righthand side.

Specified by:
evaluate in interface SpecialEvaluationI
Parameters:
node - The current node
data - The data passed to visitor, typically not used
pv - The visitor, can be used evaluate the children
inStack - The stack of the evaluator
Returns:
the value after evaluation
Throws:
ParseException


http://www.singularsys.com/jep Copyright © 2004 Singular Systems