Package org.qdl_lang.expressions
Class ANode2
- java.lang.Object
-
- org.qdl_lang.expressions.ExpressionImpl
-
- org.qdl_lang.expressions.ANode2
-
- All Implemented Interfaces:
Serializable,ExpressionNode,ExpressionInterface,HasResultInterface,Statement
public class ANode2 extends ExpressionImpl
Very much improved way to handle assignments. Use thisCreated by Jeff Gaynor
on 6/3/21 at 5:10 AM- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intleftAssignmentTypestatic intrightAssignmentType-
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 ANode2(TokenPosition tokenPosition)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QDLValueevaluate(State state)intgetAssignmentType()ExpressionInterfacegetLeftArg()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.StringgetOp()ExpressionInterfacegetRightArg()TokenPositiongetTokenPosition()booleanhasLeftArg()booleanhasRightArg()booleanhasTokenPosition()ExpressionInterfacemakeCopy()protected QDLStemresultToStem()if the RHS is a stem, return it.voidsetLeftArg(ExpressionInterface leftArg)voidsetOp(String op)voidsetRightArg(ExpressionInterface rightArg)voidsetTokenPosition(TokenPosition tokenPosition)Set the location of this token from the parser.protected voidsetValueFromSWRI(ExpressionInterface swri, Object value, Object i, State state)StringtoString()-
Methods inherited from class org.qdl_lang.expressions.ExpressionImpl
addArgument, evalArg, evalLastArg, evaluatedArgs, getAlias, getArgAt, getArgCount, getArguments, getEvaluatedArgs, getLastArg, getOperatorType, getResult, getResultType, getSourceCode, hasAlias, hasEvaluatedArgs, isEvaluated, isSizeQuery, setAlias, setArguments, setEvaluated, setEvaluatedArgs, setOperatorType, setResult, setResult, setSizeQuery, setSourceCode
-
-
-
-
Field Detail
-
leftAssignmentType
public static final int leftAssignmentType
- See Also:
- Constant Field Values
-
rightAssignmentType
public static final int rightAssignmentType
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ANode2
public ANode2(TokenPosition tokenPosition)
-
-
Method Detail
-
setTokenPosition
public void setTokenPosition(TokenPosition tokenPosition)
Description copied from interface:StatementSet the location of this token from the parser. This is used for error notifications later.- Specified by:
setTokenPositionin interfaceStatement- Overrides:
setTokenPositionin classExpressionImpl
-
getTokenPosition
public TokenPosition getTokenPosition()
- Specified by:
getTokenPositionin interfaceStatement- Overrides:
getTokenPositionin classExpressionImpl
-
hasTokenPosition
public boolean hasTokenPosition()
- Specified by:
hasTokenPositionin interfaceStatement- Overrides:
hasTokenPositionin classExpressionImpl
-
getOp
public String getOp()
-
setOp
public void setOp(String op)
-
getLeftArg
public ExpressionInterface getLeftArg()
-
setLeftArg
public void setLeftArg(ExpressionInterface leftArg)
-
getRightArg
public ExpressionInterface getRightArg()
-
setRightArg
public void setRightArg(ExpressionInterface rightArg)
-
hasLeftArg
public boolean hasLeftArg()
-
hasRightArg
public boolean hasRightArg()
-
setValueFromSWRI
protected void setValueFromSWRI(ExpressionInterface swri, Object value, Object i, State state)
-
resultToStem
protected QDLStem resultToStem()
if the RHS is a stem, return it. If a scalar, return a stem with that has that as the default value.- Returns:
-
makeCopy
public ExpressionInterface makeCopy()
-
getAssignmentType
public int getAssignmentType()
-
toString
public String toString()
- Overrides:
toStringin classExpressionImpl
-
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:
-
-