com.singularsys.jep.functions
Class Ele

java.lang.Object
  extended by com.singularsys.jep.functions.PostfixMathCommand
      extended by com.singularsys.jep.functions.Ele
All Implemented Interfaces:
LValueI, PostfixMathCommandI, java.io.Serializable

public class Ele
extends PostfixMathCommand
implements LValueI

Function which allows array access using the a[3] notation on left and right hand side. The first element is indexed with 1. a=[4,3,2,1]; a[2]; // Returns 2 a[2]=5; // Sets the 2nd element of a to 5. So a is now [4,5,2,1]

Author:
Richard Morris
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, numberOfParameters
 
Constructor Summary
Ele()
           
 
Method Summary
 void run(java.util.Stack<java.lang.Object> s)
          Run the function on the stack.
 void set(Evaluator pv, Node node, java.lang.Object value)
          Performs appropriate action to set an LValue.
 
Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand
checkNumberOfParameters, checkStack, getNumberOfParameters, setCurNumberOfParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Ele

public Ele()
Method Detail

set

public void set(Evaluator pv,
                Node node,
                java.lang.Object value)
         throws EvaluationException
Description copied from interface: LValueI
Performs appropriate action to set an LValue.

Specified by:
set in interface LValueI
Parameters:
pv - a pointer to the evaluator. The pv.eval() method can be used to evaluate the children of the node.
node - The top node for the LValue
value - the value obtained by evaluating the right hand side.
Throws:
EvaluationException

run

public void run(java.util.Stack<java.lang.Object> s)
         throws EvaluationException
Description copied from interface: PostfixMathCommandI
Run the function on the stack. Pops the arguments from the stack, and pushes the result on the top of the stack.

Specified by:
run in interface PostfixMathCommandI
Throws:
EvaluationException


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