Class StreamSendToStream

java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.extensions.stream.StreamSendToStream
All Implemented Interfaces:
CallbackEvaluationI, JepComponent, PostfixMathCommandI, Serializable

public class StreamSendToStream extends PostfixMathCommand implements CallbackEvaluationI, JepComponent
An assignment operator allowing unclosed steams to be saved to a variable. For example
[1..50] . map(x=>x^2) --> s
s . filter(x=> x%2==0)
The variable can only be used once.

This function is not included in StreamOperatorTable it can be added with

ot.insertOperator(
    new Operator("-->",
        new StreamSendToStream(),
        Operator.BINARY+Operator.LEFT),
    ot.getAssign());
Since:
Jep 4.1 extensions 2.2
See Also:
  • Constructor Details

    • StreamSendToStream

      public StreamSendToStream()
  • Method Details

    • evaluate

      public Object evaluate(Node node, Evaluator pv) throws EvaluationException
      Evaluate the operator. The left hand child node is evaluated, the Variable or LValueI on the right hand is then set to this value. As a stream can only be used once the function returns zero.
      Specified by:
      evaluate in interface CallbackEvaluationI
      Parameters:
      node - tree to evaluate
      pv - the evaluator
      Returns:
      Zero.
      Throws:
      EvaluationException - if the calculation cannot be performed
      See Also:
    • init

      public void init(Jep jep)
      Description copied from interface: JepComponent
      Initialize the component. This method is called whenever a component is added to Jep. Hence, it allows components to keep track of the other components they may rely on.
      Specified by:
      init in interface JepComponent
      Parameters:
      jep - the current Jep instance
    • getLightWeightInstance

      public JepComponent getLightWeightInstance()
      Description copied from interface: JepComponent
      Gets a light-weight instance suitable for using in multiple threads.
      Specified by:
      getLightWeightInstance in interface JepComponent
      Returns:
      either a new instance, null or 'this'.