Package org.qdl_lang.expressions
Class ModuleExpression
- java.lang.Object
-
- org.qdl_lang.expressions.ExpressionImpl
-
- org.qdl_lang.expressions.ModuleExpression
-
- All Implemented Interfaces:
Serializable,ExpressionNode,ExpressionInterface,HasResultInterface,Statement
public class ModuleExpression extends ExpressionImpl
Models a single module expression of the form A#expression where A is the alias giving the instance of the current module and expression is a general expression to be evaluated against the state of the module.Created by Jeff Gaynor
on 9/23/21 at 6:10 AM- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.qdl_lang.expressions.ExpressionImpl
arguments, result, valence
-
Fields inherited from interface org.qdl_lang.statements.ExpressionInterface
ALL_INDICES_NODE, ALT_IF_NODE, ASSIGNMENT_NODE, AXIS_RESTRICTION_NODE, CLOSED_SLICE_NODE, COMPARISON_DYAD_NODE, CONSTANT_NODE, DYAD_NODE, DYADIC_FUNCTION_REFERENCE_NODE, EXPRESSION_STEM_NODE, EXPRESSION_STEM2_NODE, FUNCTION_REFERENCE_NODE, LAMBDA_DEFINITION_NODE, LIST_NODE, MODULE_NODE, MONAD_NODE, NILAD_NODE, OPEN_SLICE_NODE, PARENTHESIZED_NODE, PARSE_EXPRESSION_BLOCK_NODE, PARSE_STATEMENT_BLOCK_NODE, POLYAD_NODE, QDL_NULL_NODE, SELECT_NODE, SET_NODE, STEM_ENTRY_NODE, STEM_EXTRACTION_NODE, STEM_NODE, UNKNOWN_NODE, VARIABLE_NODE
-
-
Constructor Summary
Constructors Constructor Description ModuleExpression()ModuleExpression(int operatorType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QDLValueevaluate(State ambientState)StringgetAlias()StategetAmbientState()ExpressionInterfacegetExpression()StategetLocalState(State state)ModulegetModule()The module associated with this expression.StategetModuleState()StategetModuleState(State state)The state of the current module only.intgetNodeType()QDL is not strongly typed but Java is, so each node type should have a unique integer and conditionals should use that, not the instanceof operator.booleanisDefaultNamespace()booleanisNewModuleVersion()ExpressionInterfacemakeCopy()voidset(State state, Object newValue)Set the value of this expression using the statevoidsetAlias(String alias)voidsetAmbientState(State ambientState)voidsetDefaultNamespace(boolean defaultNamespace)voidsetExpression(ExpressionInterface expressionInterface)voidsetModule(Module module)voidsetModuleState(State moduleState)voidsetNewModuleVersion(boolean newModuleVersion)-
Methods inherited from class org.qdl_lang.expressions.ExpressionImpl
addArgument, evalArg, evalLastArg, evaluatedArgs, getArgAt, getArgCount, getArguments, getEvaluatedArgs, getLastArg, getOperatorType, getResult, getResultType, getSourceCode, getTokenPosition, hasAlias, hasEvaluatedArgs, hasTokenPosition, isEvaluated, isSizeQuery, setArguments, setEvaluated, setEvaluatedArgs, setOperatorType, setResult, setResult, setSizeQuery, setSourceCode, setTokenPosition, toString
-
-
-
-
Method Detail
-
isDefaultNamespace
public boolean isDefaultNamespace()
-
setDefaultNamespace
public void setDefaultNamespace(boolean defaultNamespace)
-
getAlias
public String getAlias()
- Specified by:
getAliasin interfaceExpressionInterface- Overrides:
getAliasin classExpressionImpl
-
setAlias
public void setAlias(String alias)
- Specified by:
setAliasin interfaceExpressionInterface- Overrides:
setAliasin classExpressionImpl
-
isNewModuleVersion
public boolean isNewModuleVersion()
-
setNewModuleVersion
public void setNewModuleVersion(boolean newModuleVersion)
-
getExpression
public ExpressionInterface getExpression()
-
setExpression
public void setExpression(ExpressionInterface expressionInterface)
-
makeCopy
public ExpressionInterface makeCopy()
-
getModule
public Module getModule()
The module associated with this expression.- Returns:
-
setModule
public void setModule(Module module)
-
getModuleState
public State getModuleState()
-
getModuleState
public State getModuleState(State state)
The state of the current module only. This is used to construct the local state.- Returns:
-
setModuleState
public void setModuleState(State moduleState)
-
set
public void set(State state, Object newValue)
Set the value of this expression using the state- Parameters:
newValue-
-
getNodeType
public int getNodeType()
Description copied from interface:ExpressionInterfaceQDL is not strongly typed but Java is, so each node type should have a unique integer and conditionals should use that, not the instanceof operator. This allows for efficient programming with switch statements rather than a bevy of conditionals (potentially each of which gets done even if the correct case has been handled).- Returns:
-
getAmbientState
public State getAmbientState()
-
setAmbientState
public void setAmbientState(State ambientState)
-
-