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 int
leftAssignmentType
static int
rightAssignmentType
-
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, 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 Object
evaluate(State state)
int
getAssignmentType()
ExpressionInterface
getLeftArg()
int
getNodeType()
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.String
getOp()
ExpressionInterface
getRightArg()
TokenPosition
getTokenPosition()
boolean
hasLeftArg()
boolean
hasRightArg()
boolean
hasTokenPosition()
ExpressionInterface
makeCopy()
Object
newAssign(State state)
void
setLeftArg(ExpressionInterface leftArg)
void
setOp(String op)
void
setRightArg(ExpressionInterface rightArg)
void
setTokenPosition(TokenPosition tokenPosition)
Set the location of this token from the parser.String
toString()
-
Methods inherited from class org.qdl_lang.expressions.ExpressionImpl
evalArg, evalLastArg, evaluatedArgs, getAlias, getArgAt, getArgCount, getArguments, getEvaluatedArgs, getLastArg, getOperatorType, getResult, getResultType, getSourceCode, hasAlias, hasEvaluatedArgs, isEvaluated, isSizeQuery, setAlias, setArguments, setEvaluated, setEvaluatedArgs, setOperatorType, setResult, setResultType, 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:Statement
Set the location of this token from the parser. This is used for error notifications later.- Specified by:
setTokenPosition
in interfaceStatement
- Overrides:
setTokenPosition
in classExpressionImpl
-
getTokenPosition
public TokenPosition getTokenPosition()
- Specified by:
getTokenPosition
in interfaceStatement
- Overrides:
getTokenPosition
in classExpressionImpl
-
hasTokenPosition
public boolean hasTokenPosition()
- Specified by:
hasTokenPosition
in interfaceStatement
- Overrides:
hasTokenPosition
in 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()
-
makeCopy
public ExpressionInterface makeCopy()
-
getAssignmentType
public int getAssignmentType()
-
toString
public String toString()
- Overrides:
toString
in classExpressionImpl
-
getNodeType
public int getNodeType()
Description copied from interface:ExpressionInterface
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. 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:
-
-