Class ArgumentSection

All Implemented Interfaces:
Finishing, SyntaxElement
Direct Known Subclasses:
ReturnSection, SecLoop

public abstract class ArgumentSection extends CodeSection implements Finishing
A CodeSection that can hold information about arguments.
  • Constructor Details

    • ArgumentSection

      public ArgumentSection()
  • Method Details

    • start

      protected Optional<? extends Statement> start()
      This function is called from the section containing the code, and returns an Optional describing the first Statement that should be run in the consumer.
      By default, returns CodeSection.getFirst().
    • step

      public void step(Statement item)
      After execution has stopped, because a statement has forcefully ended the execution, this consumer is fed with the last Statement that has been processed on the next iteration.
      Note that this function only needs to be called for iterative sections, like loops and maps, that need to execute certain actions after each iteration, instead of only when the execution has finished (see finish() for that)
      By default, does nothing.
      Parameters:
      item - the last statement
      See Also:
    • finish

      public void finish()
      Description copied from interface: Finishing
      By convention, this method should be fired in one of the following occasions:
      1. The execution of the section is completely done and the (actual) next element is referenced to be walked on.
      2. This method is completely stopped by any means whatsoever.
      An example of this second occasion is EffContinue continuing over multiple loops. If that effect continues 3 loops in one go, this means that the 2 most inner-loops need to be completely reset, since they have the possibility to be looped over again. EffContinue therefore calls this method on those loops.
      Another example is EffExit, which finishes every section that implements this interface, because of the same reasons specified above.
      Specified by:
      finish in interface Finishing
      See Also:
    • getArguments

      public Object[] getArguments()
      Returns:
      the arguments passed to this section's code
    • setArguments

      public void setArguments(Object... arguments)
      Sets the arguments that should be passed to the section code.
      Parameters:
      arguments - this section's arguments