Class SwitchDefaultNonLazy

All Implemented Interfaces:
PostfixMathCommandI, Serializable

public class SwitchDefaultNonLazy extends NaryFunction
A switch statement, with a default value. The argument is selected based on the integer value of the first argument, the last argument is returned if the first argument is greater than the number of arguments -2. For example switchDefault(2,5,6,7,8) will return 5, and switchDefault(9,5,6,7,8) will return 8. The first argument must be an exact integer.

This is the non-lazy version of the function, all arguments are evaluated before the switch statement is executed. See SwitchDefault for the lazy evaluation version.

Since:
Jep 4.1
Author:
Richard Morris
See Also:
  • Field Details

  • Constructor Details

    • SwitchDefaultNonLazy

      public SwitchDefaultNonLazy()
      Default switch statement. Exceptions are thrown if first argument is null.
    • SwitchDefaultNonLazy

      public SwitchDefaultNonLazy(SwitchDefaultNonLazy.NullBehaviour nullBehaviour)
      Switch function with defined null behaviour.
      Parameters:
      nullBehaviour - action to take if first argument is null.
      Since:
      Jep 3.5
  • Method Details