Class ExpandingEle

All Implemented Interfaces:
LValueI, PostfixMathCommandI, Serializable

public class ExpandingEle extends Ele
An var[index] function whose set(Evaluator, Node, Object) method modifies and expands the Vector<Object> value of the variable. This contrast with the the standard Ele class than creating a new Vector on each call to set and throws an EvaluationException if the index is out of range. This can be useful for creating large lists by repeatedly adding elements, for example:
primes = [2];
primes[2] = 3;
primes[3] = 5;
Since:
Jep 4.1
See Also:
  • Constructor Details

    • ExpandingEle

      public ExpandingEle(Object val)
    • ExpandingEle

      public ExpandingEle(Object val, boolean shiftZero)
  • Method Details

    • set

      public void set(Evaluator pv, Node node, Object value) throws EvaluationException
      Description copied from class: Ele
      Sets an element of an vector valued variable. For the expression u[2] = 5 the left hand node is ASTOpNode for the Ele pfmc the method will be called like set(pv,lhs,5); The value of the variable will be replaced by a new Vector<Object> with the appropriate element replaced.
      Specified by:
      set in interface LValueI
      Overrides:
      set in class Ele
      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, root should be the ASTOpNode for the Ele pfmc.
      value - the value obtained by evaluating the right-hand side.
      Throws:
      EvaluationException - if the calculation cannot be performed