Package nz.org.riskscape.engine.rl
Class DefaultExpressionRealizer
java.lang.Object
nz.org.riskscape.engine.rl.DefaultExpressionRealizer
- All Implemented Interfaces:
nz.org.riskscape.engine.rl.ExpressionRealizer
public class DefaultExpressionRealizer
extends Object
implements nz.org.riskscape.engine.rl.ExpressionRealizer
Realizes riskscape language expressions in to reified/realized objects that can be evaluated.
-
Nested Class Summary
Nested classes/interfaces inherited from interface nz.org.riskscape.engine.rl.ExpressionRealizer
nz.org.riskscape.engine.rl.ExpressionRealizer.ProblemCodes -
Field Summary
Fields inherited from interface nz.org.riskscape.engine.rl.ExpressionRealizer
NO_SUCH_MEMBER -
Constructor Summary
ConstructorsConstructorDescriptionDefaultExpressionRealizer(@NonNull nz.org.riskscape.engine.rl.RealizationContext context) DefaultExpressionRealizer(nz.org.riskscape.rl.ExpressionParser parser, nz.org.riskscape.engine.rl.RealizationContext realizationContext) -
Method Summary
Modifier and TypeMethodDescriptionnz.org.riskscape.engine.rl.RealizedExpressionasStruct(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.engine.rl.RealizedExpression expression) nz.org.riskscape.rl.ast.Expressionnz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.rl.RealizedExpression>nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.rl.RealizedExpression>realize(nz.org.riskscape.engine.types.Type inputType, nz.org.riskscape.rl.ast.Expression expression) nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.rl.agg.RealizedAggregateExpression>realizeAggregate(nz.org.riskscape.engine.types.Type inputType, nz.org.riskscape.rl.ast.Expression expression) nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.rl.RealizedExpression>realizeConstant(nz.org.riskscape.rl.ast.Expression expression) Attempts to realize the given expression against an empty struct, returning a meaningful problem if it looks like it failed to realize because it had property access problems (meaning it wasn't constant as it relies on the input scope)
-
Constructor Details
-
DefaultExpressionRealizer
public DefaultExpressionRealizer(@NonNull @NonNull nz.org.riskscape.engine.rl.RealizationContext context) -
DefaultExpressionRealizer
public DefaultExpressionRealizer(nz.org.riskscape.rl.ExpressionParser parser, nz.org.riskscape.engine.rl.RealizationContext realizationContext)
-
-
Method Details
-
asStruct
public nz.org.riskscape.engine.rl.RealizedExpression asStruct(nz.org.riskscape.engine.rl.RealizationContext context, nz.org.riskscape.engine.rl.RealizedExpression expression) - Specified by:
asStructin interfacenz.org.riskscape.engine.rl.ExpressionRealizer
-
realize
public nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.rl.RealizedExpression> realize(nz.org.riskscape.engine.types.Type inputType, String source) - Specified by:
realizein interfacenz.org.riskscape.engine.rl.ExpressionRealizer
-
realize
public nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.rl.RealizedExpression> realize(nz.org.riskscape.engine.types.Type inputType, nz.org.riskscape.rl.ast.Expression expression) - Specified by:
realizein interfacenz.org.riskscape.engine.rl.ExpressionRealizer
-
parse
- Specified by:
parsein interfacenz.org.riskscape.engine.rl.ExpressionRealizer
-
realizeAggregate
public nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.rl.agg.RealizedAggregateExpression> realizeAggregate(nz.org.riskscape.engine.types.Type inputType, nz.org.riskscape.rl.ast.Expression expression) - Specified by:
realizeAggregatein interfacenz.org.riskscape.engine.rl.ExpressionRealizer
-
realizeConstant
public nz.org.riskscape.problem.ResultOrProblems<nz.org.riskscape.engine.rl.RealizedExpression> realizeConstant(nz.org.riskscape.rl.ast.Expression expression) Attempts to realize the given expression against an empty struct, returning a meaningful problem if it looks like it failed to realize because it had property access problems (meaning it wasn't constant as it relies on the input scope)
- Specified by:
realizeConstantin interfacenz.org.riskscape.engine.rl.ExpressionRealizer- Returns:
- a
RealizedExpressionthat is constant, i.e should succeed when called likeexpr.evaluate(Tuple.EMPTY_TUPLE)and should always return the same result.
-