Package org.qdl_lang.functions
Class DyadicFunctionReferenceNode
- java.lang.Object
-
- org.qdl_lang.expressions.ExpressionImpl
-
- org.qdl_lang.functions.DyadicFunctionReferenceNode
-
- All Implemented Interfaces:
Serializable,Comparable,ExpressionNode,FunctionNodeInterface,FunctionReferenceNodeInterface,ExpressionInterface,HasResultInterface,Statement
public class DyadicFunctionReferenceNode extends ExpressionImpl implements FunctionReferenceNodeInterface, Comparable
Created by Jeff Gaynor
on 6/10/24 at 12:43 PM- 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 DyadicFunctionReferenceNode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Object object)QDLValueevaluate(State state)protected FunctionRecordgetFRByArgCount(State state, int argCount, String functionName)intgetFunctionArgCount()This is the left argument.StringgetFunctionName()FunctionRecordInterfacegetFunctionRecord()FunctionRecordInterfacegetFunctionRecord(int argCount)ModulegetModule()StategetModuleState()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.booleanhasFunctionRecord(int argCount)booleanhasModuleState()booleanisAnonymous()ExpressionInterfacemakeCopy()voidsetAnonymous(boolean anonymous)voidsetFunctionName(String functionName)voidsetFunctionRecord(FunctionRecordInterface functionRecord)voidsetModule(Module module)voidsetModuleState(State moduleState)StringtoString()-
Methods inherited from class org.qdl_lang.expressions.ExpressionImpl
addArgument, evalArg, evalLastArg, evaluatedArgs, getAlias, getArgAt, getArgCount, getArguments, getEvaluatedArgs, getLastArg, getOperatorType, getResult, getResultType, getSourceCode, getTokenPosition, hasAlias, hasEvaluatedArgs, hasTokenPosition, isEvaluated, isSizeQuery, setAlias, setArguments, setEvaluated, setEvaluatedArgs, setOperatorType, setResult, setResult, setSizeQuery, setSourceCode, setTokenPosition
-
-
-
-
Method Detail
-
compareTo
public int compareTo(Object object)
- Specified by:
compareToin interfaceComparable
-
makeCopy
public ExpressionInterface makeCopy()
- Specified by:
makeCopyin interfaceExpressionInterface
-
getFunctionArgCount
public int getFunctionArgCount()
This is the left argument. The contract is that the left argument evaluates into an integer (long, really, but java does not accept longs in many places) so this is distinct fromExpressionImpl.getArgCount()which is always 2 since this is a dyad.- Returns:
-
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- Specified by:
getNodeTypein interfaceFunctionNodeInterface- Returns:
-
getFRByArgCount
protected FunctionRecord getFRByArgCount(State state, int argCount, String functionName)
-
getFunctionName
public String getFunctionName()
- Specified by:
getFunctionNamein interfaceFunctionReferenceNodeInterface
-
setFunctionName
public void setFunctionName(String functionName)
- Specified by:
setFunctionNamein interfaceFunctionReferenceNodeInterface
-
isAnonymous
public boolean isAnonymous()
- Specified by:
isAnonymousin interfaceFunctionReferenceNodeInterface
-
setAnonymous
public void setAnonymous(boolean anonymous)
- Specified by:
setAnonymousin interfaceFunctionReferenceNodeInterface
-
getFunctionRecord
public FunctionRecordInterface getFunctionRecord()
-
setFunctionRecord
public void setFunctionRecord(FunctionRecordInterface functionRecord)
-
getFunctionRecord
public FunctionRecordInterface getFunctionRecord(int argCount)
- Specified by:
getFunctionRecordin interfaceFunctionReferenceNodeInterface
-
hasFunctionRecord
public boolean hasFunctionRecord(int argCount)
- Specified by:
hasFunctionRecordin interfaceFunctionReferenceNodeInterface
-
getModuleState
public State getModuleState()
- Specified by:
getModuleStatein interfaceFunctionReferenceNodeInterface
-
setModuleState
public void setModuleState(State moduleState)
- Specified by:
setModuleStatein interfaceFunctionReferenceNodeInterface
-
hasModuleState
public boolean hasModuleState()
- Specified by:
hasModuleStatein interfaceFunctionReferenceNodeInterface
-
toString
public String toString()
- Overrides:
toStringin classExpressionImpl
-
getModule
public Module getModule()
-
setModule
public void setModule(Module module)
-
-