Package com.singularsys.jep.misc.functions

# Class ExpandingEle

java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.NaryFunction
com.singularsys.jep.functions.Ele
com.singularsys.jep.misc.functions.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:
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class com.singularsys.jep.functions.Ele

  `indexShift`

  ### Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand

  `curNumberOfParameters, description, name, NaN, numberOfParameters`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ExpandingEle(Object val)`
  `ExpandingEle(Object val, boolean shiftZero)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `set(Evaluator pv, Node node, Object value)`
  Sets an element of an vector valued variable.

  ### Methods inherited from class com.singularsys.jep.functions.Ele

  `checkNumberOfParameters, ele, ele, ele, ele, eval, findIndex, getVariable`

  ### Methods inherited from class com.singularsys.jep.functions.NaryFunction

  `run`

  ### Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand

  `asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, asType, getDescription, getDescription, getDescriptionWithType, getName, getNumberOfParameters, setCurNumberOfParameters, setDescription, setName, toString, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## 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