Class DefaultFunctionSet

java.lang.Object
nz.org.riskscape.engine.IdentifiedCollection.Base<nz.org.riskscape.engine.function.IdentifiedFunction>
nz.org.riskscape.engine.DefaultFunctionSet
All Implemented Interfaces:
nz.org.riskscape.engine.function.OperatorResolver, nz.org.riskscape.engine.FunctionSet, nz.org.riskscape.engine.IdentifiedCollection<nz.org.riskscape.engine.function.IdentifiedFunction>

public class DefaultFunctionSet extends nz.org.riskscape.engine.IdentifiedCollection.Base<nz.org.riskscape.engine.function.IdentifiedFunction> implements nz.org.riskscape.engine.function.OperatorResolver, nz.org.riskscape.engine.FunctionSet

Minimal interface for a set of IdentifiedFunctions that can be looked up by an id.

NB seems like overkill, but didn't want to pass around maps, where type signatures get big and unwieldy

  • Nested Class Summary

    Nested classes/interfaces inherited from class nz.org.riskscape.engine.IdentifiedCollection.Base

    nz.org.riskscape.engine.IdentifiedCollection.Base.Handle

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

    nz.org.riskscape.engine.IdentifiedCollection.Base<T extends nz.org.riskscape.engine.Identified>
  • Field Summary

    Fields inherited from class nz.org.riskscape.engine.IdentifiedCollection.Base

    results
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    insertFirst(nz.org.riskscape.engine.function.OperatorResolver operatorResolver)
    Add a new OperatorResolver with highest precedence.
    void
    insertLast(nz.org.riskscape.engine.function.OperatorResolver operatorResolver)
    Add a new OperatorResolver with lowest precedence.
    Optional<nz.org.riskscape.engine.function.RiskscapeFunction>
    resolve(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.BinaryOperation operation, nz.org.riskscape.engine.types.Type inputType, nz.org.riskscape.engine.types.Type lhs, nz.org.riskscape.engine.types.Type rhs)
    Resolve a binary operation by using all of the registered FunctionResolvers in order until one is found
    nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.function.RiskscapeFunction>
    resolve(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.FunctionCall functionCall, nz.org.riskscape.engine.types.Type inputType, List<nz.org.riskscape.engine.types.Type> argumentTypes, nz.org.riskscape.engine.function.FunctionResolver resolver)
    Resolve a function call by using all of the registered FunctionResolvers in order until one is found
    void
    validate(nz.org.riskscape.engine.bind.BindingContext context, Consumer<nz.org.riskscape.problem.Problem> problemConsumer)
     

    Methods inherited from class nz.org.riskscape.engine.IdentifiedCollection.Base

    add, add, add, addAll, addAll, clear, containsKey, determineCollectionClass, get, getAll, getAllProblems, getCollectionClass, getOr, getReferences, getResult, getSimilarIds, isEmpty, remove, removeAll

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface nz.org.riskscape.engine.IdentifiedCollection

    add, add, add, addAll, addAll, clear, containsKey, get, get, getAll, getAllProblems, getCollectionClass, getOr, getReferences, getResult, getSimilarIds, isEmpty, remove
  • Constructor Details

    • DefaultFunctionSet

      public DefaultFunctionSet()
  • Method Details

    • validate

      public void validate(nz.org.riskscape.engine.bind.BindingContext context, Consumer<nz.org.riskscape.problem.Problem> problemConsumer)
      Specified by:
      validate in interface nz.org.riskscape.engine.FunctionSet
    • resolve

      public nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.function.RiskscapeFunction> resolve(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.FunctionCall functionCall, nz.org.riskscape.engine.types.Type inputType, List<nz.org.riskscape.engine.types.Type> argumentTypes, nz.org.riskscape.engine.function.FunctionResolver resolver)

      Resolve a function call by using all of the registered FunctionResolvers in order until one is found

      Specified by:
      resolve in interface nz.org.riskscape.engine.FunctionSet
    • resolve

      public Optional<nz.org.riskscape.engine.function.RiskscapeFunction> resolve(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.rl.ast.BinaryOperation operation, nz.org.riskscape.engine.types.Type inputType, nz.org.riskscape.engine.types.Type lhs, nz.org.riskscape.engine.types.Type rhs)

      Resolve a binary operation by using all of the registered FunctionResolvers in order until one is found

      Specified by:
      resolve in interface nz.org.riskscape.engine.FunctionSet
      Specified by:
      resolve in interface nz.org.riskscape.engine.function.OperatorResolver
    • insertFirst

      public void insertFirst(nz.org.riskscape.engine.function.OperatorResolver operatorResolver)

      Add a new OperatorResolver with highest precedence.

      Specified by:
      insertFirst in interface nz.org.riskscape.engine.FunctionSet
    • insertLast

      public void insertLast(nz.org.riskscape.engine.function.OperatorResolver operatorResolver)

      Add a new OperatorResolver with lowest precedence.

      Specified by:
      insertLast in interface nz.org.riskscape.engine.FunctionSet