Class MapList

java.lang.Object
nz.org.riskscape.engine.function.BaseRealizableFunction
nz.org.riskscape.engine.function.lang.MapList
All Implemented Interfaces:
nz.org.riskscape.engine.rl.RealizableFunction

public class MapList extends BaseRealizableFunction

Riskscape implementation of a list mapping function. Takes a list and a lambda function, returns a new list. Or, if the given arg is not a list, it applies the lambda expression to the arg directly. This allows a mapping expression to be applied to scalar values to make pipeline fragments easier to re-use, i.e. the same function applying expression can work on a list of hazard values or a single hazard value

  • Nested Class Summary

    Nested classes/interfaces inherited from interface nz.org.riskscape.engine.rl.RealizableFunction

    nz.org.riskscape.engine.rl.RealizableFunction.MetadataIdentifiedRealizableFunction
  • Field Summary

    Fields inherited from class nz.org.riskscape.engine.function.BaseRealizableFunction

    arguments, returnType
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.function.RiskscapeFunction>
    realize(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.FunctionCall functionCall, List<nz.org.riskscape.engine.types.Type> givenArgumentTypes)
    Implements some basic boilerplate error checks by default.

    Methods inherited from class nz.org.riskscape.engine.function.BaseRealizableFunction

    asFunction, build, builtin, getArguments, getReturnType, identified

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MapList

      public MapList()
  • Method Details

    • realize

      public nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.function.RiskscapeFunction> realize(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.FunctionCall functionCall, List<nz.org.riskscape.engine.types.Type> givenArgumentTypes)
      Description copied from class: BaseRealizableFunction

      Implements some basic boilerplate error checks by default. This allows simple realizable functions to just define the BaseRealizableFunction.build(RealizationContext, FunctionCall, List) guts of the function. More complicated realizable functions (i.e. with non-trivial type handling) may want to override this completely.

      Specified by:
      realize in interface nz.org.riskscape.engine.rl.RealizableFunction
      Overrides:
      realize in class BaseRealizableFunction