Package nz.org.riskscape.engine
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.HandleNested 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidinsertFirst(nz.org.riskscape.engine.function.OperatorResolver operatorResolver) Add a newOperatorResolverwith highest precedence.voidinsertLast(nz.org.riskscape.engine.function.OperatorResolver operatorResolver) Add a newOperatorResolverwith 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 registeredFunctionResolvers in order until one is foundnz.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 registeredFunctionResolvers in order until one is foundvoidvalidate(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, removeAllMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
validatein interfacenz.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:
resolvein interfacenz.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:
resolvein interfacenz.org.riskscape.engine.FunctionSet- Specified by:
resolvein interfacenz.org.riskscape.engine.function.OperatorResolver
-
insertFirst
public void insertFirst(nz.org.riskscape.engine.function.OperatorResolver operatorResolver) Add a new
OperatorResolverwith highest precedence.- Specified by:
insertFirstin interfacenz.org.riskscape.engine.FunctionSet
-
insertLast
public void insertLast(nz.org.riskscape.engine.function.OperatorResolver operatorResolver) Add a new
OperatorResolverwith lowest precedence.- Specified by:
insertLastin interfacenz.org.riskscape.engine.FunctionSet
-