Class DiscreteFunction

java.lang.Object
nz.org.riskscape.engine.function.DiscreteFunction
All Implemented Interfaces:
AutoCloseable, nz.org.riskscape.engine.function.RiskscapeFunction, nz.org.riskscape.engine.function.UntypedFunction

public class DiscreteFunction extends Object implements nz.org.riskscape.engine.function.RiskscapeFunction

An RiskscapeFunction that allows a discrete function to be defined. Can be defined from a mix of constant values and other RiskscapeFunctions points, ranges and points.

  • Field Details

    • NUMERIC_TYPE_RANK

      public static final List<nz.org.riskscape.engine.types.Type> NUMERIC_TYPE_RANK

      Ranks numeric Types, such that a higher ranked Type can represent any of the lower ranked Types. TODO consider moving this to the NumberTypes enum

  • Method Details

    • builder

      public static DiscreteFunction.Builder builder()
      Returns:
      a new DiscreteFunction.Builder for constructing a DiscreteFunction.
    • call

      public Object call(@NonNull @NonNull List<Object> args)
      Specified by:
      call in interface nz.org.riskscape.engine.function.UntypedFunction
    • getPairs

      public List<DiscreteFunction.Pair> getPairs()
    • getArgumentTypes

      public List<nz.org.riskscape.engine.types.Type> getArgumentTypes()
      Specified by:
      getArgumentTypes in interface nz.org.riskscape.engine.function.RiskscapeFunction
    • getReturnType

      public nz.org.riskscape.engine.types.Type getReturnType()
      Specified by:
      getReturnType in interface nz.org.riskscape.engine.function.RiskscapeFunction