Package org.qdl_lang.evaluate
Class FunctionEvaluator
- java.lang.Object
-
- org.qdl_lang.evaluate.AbstractEvaluator
-
- org.qdl_lang.evaluate.FunctionEvaluator
-
- All Implemented Interfaces:
Serializable,EvaluatorInterface
public class FunctionEvaluator extends AbstractEvaluator
Created by Jeff Gaynor
on 1/22/20 at 10:53 AM- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.qdl_lang.evaluate.AbstractEvaluator
AbstractEvaluator.CommonKeyIterator, AbstractEvaluator.fPointer, AbstractEvaluator.fpResult
-
-
Field Summary
Fields Modifier and Type Field Description static StringAPPLYstatic intAPPLY_TYPEstatic StringARG_COUNTstatic intARG_COUNT_TYPEstatic intBASE_FUNCTION_VALUEstatic StringDUMMY_BUILT_IN_FUNCTION_NAME_CAPUTstatic StringFUNCTION_NAMESPACEstatic StringIS_FUNCTIONstatic intIS_FUNCTION_TYPEstatic StringNAMESstatic intNAMES_TYPEstatic longserialVersionUID-
Fields inherited from class org.qdl_lang.evaluate.AbstractEvaluator
bigArgList, bigArgList0, FILE_OP_AUTO, FILE_OP_BINARY, FILE_OP_INPUT_STREAM, FILE_OP_TEXT_INI, FILE_OP_TEXT_STEM, FILE_OP_TEXT_STRING, FILE_OP_TEXT_WITHOUT_LIST_INI, fNames, MAX_ARG_COUNT
-
Fields inherited from interface org.qdl_lang.evaluate.EvaluatorInterface
UNKNOWN_VALUE
-
-
Constructor Summary
Constructors Constructor Description FunctionEvaluator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected BooleancheckIsFunction(String fName, int argCount, State state)protected String[]dereferenceFunctionName(String name)booleandispatch(Polyad polyad, State state)Does the actual evaluation of thePolyad.protected voiddoFunctionEvaluation(Polyad polyad, State state, FR_WithState frs)Executes a user-defined function, defined in QDL., E.g.protected voiddoIsFunction(Polyad polyad, State state)protected voiddoJavaFunction(Polyad polyad, State state, FR_WithState frs)Executes a user-defined function, defined in Java as an implementation ofQDLFunction.booleanevaluate(String alias, Polyad polyad, State state)booleanevaluate(Polyad polyad, State state)Decides if aPolyadis evaluated by this evaluator and if not, returns false, if so, it evaluates it and returns true.protected voidfigureOutEvaluation(Polyad polyad, State state, boolean checkForDuplicates)String[]getFunctionNames()StringgetNamespace()intgetType(String name)protected booleanisFDef(Statement statement)protected booleanisFunctionReference(String name)protected ArrayList<XThing>resolveArguments(FunctionRecordInterface functionRecord, Polyad polyad, State state, State localState)This will take the function record and polyad and find the arguments that are requested in the function record vs.protected booleantryScript(Polyad polyad, State state)-
Methods inherited from class org.qdl_lang.evaluate.AbstractEvaluator
areAllBigDecimals, areAllBoolean, areAllLongs, areAllNumbers, areAllSets, areAllStems, areAllStrings, areAnyBigDecimals, areNoneStems, bdEquals, checkNull, checkNull, convertArgsToStem, finishExpr, getBigArgList, getBigArgList0, getCommonKeys, getFQFunctionNames, getFunctionReferenceNode, getFunctionReferenceNode, getOperator, getOrCreateStem, isBigDecimal, isBoolean, isBuiltInFunction, isFunctionRef, isLong, isNumber, isScalar, isSet, isStem, isStemList, isString, listFunctions, NEWgetOperator, OLDgetOperator, process1, process2, process2, process3, processSet1, processSet2, processSet2, processStem1, processStem2, processStem3, resolveResourceToFile, tempFname, toBD, toConstants, toStem
-
-
-
-
Field Detail
-
serialVersionUID
public static long serialVersionUID
-
FUNCTION_NAMESPACE
public static final String FUNCTION_NAMESPACE
- See Also:
- Constant Field Values
-
BASE_FUNCTION_VALUE
public static final int BASE_FUNCTION_VALUE
- See Also:
- Constant Field Values
-
IS_FUNCTION
public static final String IS_FUNCTION
- See Also:
- Constant Field Values
-
IS_FUNCTION_TYPE
public static final int IS_FUNCTION_TYPE
- See Also:
- Constant Field Values
-
APPLY
public static final String APPLY
- See Also:
- Constant Field Values
-
APPLY_TYPE
public static final int APPLY_TYPE
- See Also:
- Constant Field Values
-
NAMES
public static final String NAMES
- See Also:
- Constant Field Values
-
NAMES_TYPE
public static final int NAMES_TYPE
- See Also:
- Constant Field Values
-
ARG_COUNT
public static final String ARG_COUNT
- See Also:
- Constant Field Values
-
ARG_COUNT_TYPE
public static final int ARG_COUNT_TYPE
- See Also:
- Constant Field Values
-
DUMMY_BUILT_IN_FUNCTION_NAME_CAPUT
public static final String DUMMY_BUILT_IN_FUNCTION_NAME_CAPUT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getNamespace
public String getNamespace()
-
getType
public int getType(String name)
-
getFunctionNames
public String[] getFunctionNames()
- Specified by:
getFunctionNamesin classAbstractEvaluator
-
evaluate
public boolean evaluate(String alias, Polyad polyad, State state)
- Overrides:
evaluatein classAbstractEvaluator
-
evaluate
public boolean evaluate(Polyad polyad, State state)
Description copied from class:AbstractEvaluatorDecides if aPolyadis evaluated by this evaluator and if not, returns false, if so, it evaluates it and returns true. This function actually just dispatches it toAbstractEvaluator.dispatch(Polyad, State)where the work is done and manages putting better trace information in if there is a failure.- Overrides:
evaluatein classAbstractEvaluator- Returns:
-
dispatch
public boolean dispatch(Polyad polyad, State state)
Description copied from class:AbstractEvaluatorDoes the actual evaluation of thePolyad.- Specified by:
dispatchin classAbstractEvaluator- Returns:
-
isFDef
protected boolean isFDef(Statement statement)
-
doJavaFunction
protected void doJavaFunction(Polyad polyad, State state, FR_WithState frs) throws Throwable
Executes a user-defined function, defined in Java as an implementation ofQDLFunction.- Parameters:
polyad-state-frs-- Throws:
Throwable
-
figureOutEvaluation
protected void figureOutEvaluation(Polyad polyad, State state, boolean checkForDuplicates) throws Throwable
- Throws:
Throwable
-
doFunctionEvaluation
protected void doFunctionEvaluation(Polyad polyad, State state, FR_WithState frs) throws Throwable
Executes a user-defined function, defined in QDL., E.g.f(x) → x;- Parameters:
polyad-state-frs-- Throws:
Throwable
-
resolveArguments
protected ArrayList<XThing> resolveArguments(FunctionRecordInterface functionRecord, Polyad polyad, State state, State localState)
This will take the function record and polyad and find the arguments that are requested in the function record vs. what's in the polyad and stash them in the correct state objects.- Parameters:
functionRecord-polyad-state-localState-
-
isFunctionReference
protected boolean isFunctionReference(String name)
-
-