Class RealizedExpressionWrapper
- All Implemented Interfaces:
AutoCloseable,RealizedExpression
Wrapper class for RealizedExpressions that wrap another RealizedExpression. The evaluate methods
are left abstract - I think we will always want to implement these for each implementation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Destroy/release/abandon any resources associated with this expression.booleanDetermine whether this expression is constant, that is the return value ofRealizedExpression.evaluateConstant()never changes.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface nz.org.riskscape.engine.rl.RealizedExpression
evaluate, evaluateConstant, evaluateValues
-
Field Details
-
wrapped
-
-
Constructor Details
-
RealizedExpressionWrapper
-
-
Method Details
-
getInputType
- Specified by:
getInputTypein interfaceRealizedExpression- Returns:
- the type that this expression was realized for
-
getResultType
- Specified by:
getResultTypein interfaceRealizedExpression- Returns:
- the type that this expression yields
-
getExpression
- Specified by:
getExpressionin interfaceRealizedExpression- Returns:
- the AST that this expression was realized from.
-
getDependencies
- Specified by:
getDependenciesin interfaceRealizedExpression- Returns:
- any
RealizedExpressions that are inputs in to this realized expression
-
isConstant
public boolean isConstant()Description copied from interface:RealizedExpressionDetermine whether this expression is constant, that is the return value of
RealizedExpression.evaluateConstant()never changes. Note that the same can not be said ofRealizedExpression.evaluate(Object), as the underlying expression may not be deterministic - the implementation of evaluateConstant should ensure that the expressions result is memoized and the same value returned each time.- Specified by:
isConstantin interfaceRealizedExpression- Returns:
- true if calls to
RealizedExpression.evaluateConstant()are allowed against this realized expression.
-
close
public void close()Description copied from interface:RealizedExpressionDestroy/release/abandon any resources associated with this expression. Note that a realized expression should propagate closing to any dependencies, as the default implementation does.
See Javadoc
Realizedfor more discussion on the life-cycle of executable objects like these.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRealizedExpression
-