Package org.qdl_lang.expressions
Class ParenthesizedExpression
- java.lang.Object
-
- org.qdl_lang.expressions.ParenthesizedExpression
-
- All Implemented Interfaces:
Serializable,ExpressionNode,ExpressionInterface,HasResultInterface,Statement
public class ParenthesizedExpression extends Object implements ExpressionNode
Created by Jeff Gaynor
on 6/13/21 at 3:44 PM- See Also:
- Serialized Form
-
-
Field Summary
-
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
-
Fields inherited from interface org.qdl_lang.expressions.ExpressionNode
valence
-
-
Constructor Summary
Constructors Constructor Description ParenthesizedExpression()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QDLValueevaluate(State state)StringgetAlias()ExpressionInterfacegetArgAt(int index)intgetArgCount()ArrayList<ExpressionInterface>getArguments()ExpressionInterfacegetExpression()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.intgetOperatorType()QDLValuegetResult()intgetResultType()List<String>getSourceCode()TokenPositiongetTokenPosition()booleanhasAlias()booleanhasTokenPosition()booleanisEvaluated()ExpressionInterfacemakeCopy()voidsetAlias(String alias)voidsetArguments(ArrayList<ExpressionInterface> arguments)voidsetEvaluated(boolean evaluated)voidsetExpression(ExpressionInterface expression)voidsetOperatorType(int operatorType)voidsetResult(Object result)Convenience method.This should turn the object into a properQDLValueas needed.voidsetResult(QDLValue object)voidsetSourceCode(List<String> sourceCode)voidsetTokenPosition(TokenPosition tokenPosition)Set the location of this token from the parser.
-
-
-
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
-
getTokenPosition
public TokenPosition getTokenPosition()
- Specified by:
getTokenPositionin interfaceStatement
-
hasTokenPosition
public boolean hasTokenPosition()
- Specified by:
hasTokenPositionin interfaceStatement
-
hasAlias
public boolean hasAlias()
- Specified by:
hasAliasin interfaceExpressionInterface
-
getAlias
public String getAlias()
- Specified by:
getAliasin interfaceExpressionInterface
-
setAlias
public void setAlias(String alias)
- Specified by:
setAliasin interfaceExpressionInterface
-
getExpression
public ExpressionInterface getExpression()
-
getArgAt
public ExpressionInterface getArgAt(int index)
- Specified by:
getArgAtin interfaceExpressionNode
-
setExpression
public void setExpression(ExpressionInterface expression)
-
getResult
public QDLValue getResult()
- Specified by:
getResultin interfaceHasResultInterface
-
setResult
public void setResult(QDLValue object)
- Specified by:
setResultin interfaceHasResultInterface
-
setResult
public void setResult(Object result)
Description copied from interface:HasResultInterfaceConvenience method.This should turn the object into a properQDLValueas needed.- Specified by:
setResultin interfaceHasResultInterface
-
getResultType
public int getResultType()
- Specified by:
getResultTypein interfaceHasResultInterface
-
isEvaluated
public boolean isEvaluated()
- Specified by:
isEvaluatedin interfaceHasResultInterface
-
setEvaluated
public void setEvaluated(boolean evaluated)
- Specified by:
setEvaluatedin interfaceHasResultInterface
-
getSourceCode
public List<String> getSourceCode()
- Specified by:
getSourceCodein interfaceStatement
-
setSourceCode
public void setSourceCode(List<String> sourceCode)
- Specified by:
setSourceCodein interfaceStatement
-
makeCopy
public ExpressionInterface makeCopy()
- Specified by:
makeCopyin interfaceExpressionInterface
-
getArguments
public ArrayList<ExpressionInterface> getArguments()
- Specified by:
getArgumentsin interfaceExpressionNode
-
setArguments
public void setArguments(ArrayList<ExpressionInterface> arguments)
- Specified by:
setArgumentsin interfaceExpressionNode
-
getArgCount
public int getArgCount()
- Specified by:
getArgCountin interfaceExpressionNode
-
getOperatorType
public int getOperatorType()
- Specified by:
getOperatorTypein interfaceExpressionNode
-
setOperatorType
public void setOperatorType(int operatorType)
- Specified by:
setOperatorTypein interfaceExpressionNode
-
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).- Specified by:
getNodeTypein interfaceExpressionInterface- Returns:
-
-