Package org.qdl_lang.evaluate
Class SystemEvaluator
- java.lang.Object
-
- org.qdl_lang.evaluate.AbstractEvaluator
-
- org.qdl_lang.evaluate.SystemEvaluator
-
- All Implemented Interfaces:
Serializable
,EvaluatorInterface
public class SystemEvaluator extends AbstractEvaluator
For control structure in loops, conditionals etc.Created by Jeff Gaynor
on 1/18/20 at 11:49 AM- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
SystemEvaluator.AxisExpand
class
SystemEvaluator.AxisReduce
-
Nested classes/interfaces inherited from class org.qdl_lang.evaluate.AbstractEvaluator
AbstractEvaluator.CommonKeyIterator, AbstractEvaluator.fPointer, AbstractEvaluator.fpResult
-
-
Field Summary
-
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 SystemEvaluator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
checkDefined(ExpressionInterface exp, State state)
boolean
dispatch(Polyad polyad, State state)
Does the actual evaluation of thePolyad
.protected void
doConstants(Polyad polyad, State state)
protected void
doFork(Polyad polyad, State state)
Run a script in its own thread.protected void
doInterpret(Polyad polyad, State state)
protected void
doInterrupt(Polyad polyad, State state)
protected void
doKillProcess(Polyad polyad, State state)
protected void
doLoadModule(Polyad polyad, State state)
protected void
doModuleImport(Polyad polyad, State state)
The general contract for import.protected void
doModulePaths(Polyad polyad, State state)
protected void
doNewLoadModule(Polyad polyad, State state)
protected void
doOSEnv(Polyad polyad, State state)
protected void
doRaiseError(Polyad polyad, State state)
protected void
doReturn(Polyad polyad, State state)
protected void
doSay(Polyad polyad, State state, boolean printIt)
Does print, say and to_string commands.protected void
doScriptArgs(Polyad polyad, State state)
This will return a given script arg for a given index.protected void
doScriptArgs2(Polyad polyad, State state)
New function for script arguments.protected void
doScriptPaths(Polyad polyad, State state)
This accepts either a stem of paths or a single string that is parsed.protected void
doSysInfo(Polyad polyad, State state)
void
doVarType(Polyad polyad, State state)
Get the type of the argument.protected void
getConst(Polyad polyad, State state, QDLStem values)
String[]
getFunctionNames()
protected int
getMyLogLevel(Level level)
String
getNamespace()
int
getType(String name)
protected void
isDefined(Polyad polyad, State state)
protected void
loadScript(Polyad polyad, State state)
static QDLScript
resolveScript(String name, List<String> paths, State state)
This will use the path information and try to resolve the script based on that.static int
runnit(Polyad polyad, State state, boolean hasNewState)
static int
runnit(Polyad polyad, State state, List<String> paths, boolean hasNewState, boolean newThread)
protected void
runScript(Polyad polyad, State state)
Run an external qdl script with its own state.-
Methods inherited from class org.qdl_lang.evaluate.AbstractEvaluator
areAllBigDecimals, areAllBoolean, areAllLongs, areAllNumbers, areAllSets, areAllStems, areAllStrings, areAnyBigDecimals, areNoneStems, bdEquals, checkNull, checkNull, convertArgsToStem, evaluate, evaluate, finishExpr, getBigArgList, getBigArgList0, getCommonKeys, getFQFunctionNames, getFunctionReferenceNode, getFunctionReferenceNode, getOperator, getOrCreateStem, isBigDecimal, isBoolean, isBuiltInFunction, isFunctionRef, isLong, isNumber, isScalar, isSet, isStem, isStemList, isString, listFunctions, process1, process2, process2, process3, processSet1, processSet2, processSet2, processStem1, processStem2, processStem3, resolveResourceToFile, tempFname, toBD, toConstants, toStem
-
-
-
-
Field Detail
-
SYS_NAMESPACE
public static final String SYS_NAMESPACE
- See Also:
- Constant Field Values
-
SYS_FQ
public static final String SYS_FQ
- See Also:
- Constant Field Values
-
SYSTEM_BASE_VALUE
public static final int SYSTEM_BASE_VALUE
- See Also:
- Constant Field Values
-
DEBUGGER_PROPERTY_NAME_LEVEL
public static final String DEBUGGER_PROPERTY_NAME_LEVEL
- See Also:
- Constant Field Values
-
DEBUGGER_PROPERTY_NAME_DELIMITER
public static final String DEBUGGER_PROPERTY_NAME_DELIMITER
- See Also:
- Constant Field Values
-
DEBUGGER_PROPERTY_NAME_TS_ON
public static final String DEBUGGER_PROPERTY_NAME_TS_ON
- See Also:
- Constant Field Values
-
DEBUGGER_PROPERTY_NAME_TITLE
public static final String DEBUGGER_PROPERTY_NAME_TITLE
- See Also:
- Constant Field Values
-
DEBUGGER_PROPERTY_NAME_HOST
public static final String DEBUGGER_PROPERTY_NAME_HOST
- See Also:
- Constant Field Values
-
CONTINUE
public static final String CONTINUE
- See Also:
- Constant Field Values
-
CONTINUE_TYPE
public static final int CONTINUE_TYPE
- See Also:
- Constant Field Values
-
BREAK
public static final String BREAK
- See Also:
- Constant Field Values
-
BREAK_TYPE
public static final int BREAK_TYPE
- See Also:
- Constant Field Values
-
FOR_KEYS
public static final String FOR_KEYS
- See Also:
- Constant Field Values
-
FOR_KEYS_TYPE
public static final int FOR_KEYS_TYPE
- See Also:
- Constant Field Values
-
FOR_NEXT
public static final String FOR_NEXT
- See Also:
- Constant Field Values
-
FOR_NEXT_TYPE
public static final int FOR_NEXT_TYPE
- See Also:
- Constant Field Values
-
CHECK_AFTER
public static final String CHECK_AFTER
- See Also:
- Constant Field Values
-
CHECK_AFTER_TYPE
public static final int CHECK_AFTER_TYPE
- See Also:
- Constant Field Values
-
INTERRUPT
public static final String INTERRUPT
- See Also:
- Constant Field Values
-
INTERRUPT_TYPE
public static final int INTERRUPT_TYPE
- See Also:
- Constant Field Values
-
VAR_TYPE
public static final String VAR_TYPE
- See Also:
- Constant Field Values
-
VAR_TYPE_TYPE
public static final int VAR_TYPE_TYPE
- See Also:
- Constant Field Values
-
IS_DEFINED
public static final String IS_DEFINED
- See Also:
- Constant Field Values
-
IS_DEFINED_TYPE
public static final int IS_DEFINED_TYPE
- See Also:
- Constant Field Values
-
INTERPRET
public static final String INTERPRET
- See Also:
- Constant Field Values
-
INTERPRET_TYPE
public static final int INTERPRET_TYPE
- See Also:
- Constant Field Values
-
CHECK_SYNTAX
public static final String CHECK_SYNTAX
- See Also:
- Constant Field Values
-
CHECK_SYNTAX_TYPE
public static final int CHECK_SYNTAX_TYPE
- See Also:
- Constant Field Values
-
INPUT_FORM
public static final String INPUT_FORM
- See Also:
- Constant Field Values
-
INPUT_FORM_TYPE
public static final int INPUT_FORM_TYPE
- See Also:
- Constant Field Values
-
REDUCE
public static final String REDUCE
- See Also:
- Constant Field Values
-
REDUCE_TYPE
public static final int REDUCE_TYPE
- See Also:
- Constant Field Values
-
EXPAND
public static final String EXPAND
- See Also:
- Constant Field Values
-
EXPAND_TYPE
public static final int EXPAND_TYPE
- See Also:
- Constant Field Values
-
SAY_FUNCTION
public static final String SAY_FUNCTION
- See Also:
- Constant Field Values
-
SAY_TYPE
public static final int SAY_TYPE
- See Also:
- Constant Field Values
-
TO_STRING
public static final String TO_STRING
- See Also:
- Constant Field Values
-
TO_STRING_TYPE
public static final int TO_STRING_TYPE
- See Also:
- Constant Field Values
-
IS_NULL
public static final String IS_NULL
- See Also:
- Constant Field Values
-
IS_NULL_TYPE
public static final int IS_NULL_TYPE
- See Also:
- Constant Field Values
-
TO_NUMBER
public static final String TO_NUMBER
- See Also:
- Constant Field Values
-
TO_NUMBER_TYPE
public static final int TO_NUMBER_TYPE
- See Also:
- Constant Field Values
-
TO_BOOLEAN
public static final String TO_BOOLEAN
- See Also:
- Constant Field Values
-
TO_BOOLEAN_TYPE
public static final int TO_BOOLEAN_TYPE
- See Also:
- Constant Field Values
-
FOR_LINES
public static final String FOR_LINES
- See Also:
- Constant Field Values
-
FOR_LINES_TYPE
public static final int FOR_LINES_TYPE
- See Also:
- Constant Field Values
-
RETURN
public static final String RETURN
- See Also:
- Constant Field Values
-
RETURN_TYPE
public static final int RETURN_TYPE
- See Also:
- Constant Field Values
-
SLEEP
public static final String SLEEP
- See Also:
- Constant Field Values
-
SLEEP_TYPE
public static final int SLEEP_TYPE
- See Also:
- Constant Field Values
-
MODULE_IMPORT
public static final String MODULE_IMPORT
- See Also:
- Constant Field Values
-
IMPORT_TYPE
public static final int IMPORT_TYPE
- See Also:
- Constant Field Values
-
MODULE_LOAD
public static final String MODULE_LOAD
- See Also:
- Constant Field Values
-
LOAD_MODULE_TYPE
public static final int LOAD_MODULE_TYPE
- See Also:
- Constant Field Values
-
MODULE_PATH
public static final String MODULE_PATH
- See Also:
- Constant Field Values
-
MODULE_PATH_TYPE
public static final int MODULE_PATH_TYPE
- See Also:
- Constant Field Values
-
MODULE_REMOVE
public static final String MODULE_REMOVE
- See Also:
- Constant Field Values
-
MODULE_REMOVE_TYPE
public static final int MODULE_REMOVE_TYPE
- See Also:
- Constant Field Values
-
CONSTANTS
public static final String CONSTANTS
- See Also:
- Constant Field Values
-
CONSTANTS_TYPE
public static final int CONSTANTS_TYPE
- See Also:
- Constant Field Values
-
SYS_INFO
public static final String SYS_INFO
- See Also:
- Constant Field Values
-
SYS_INFO_TYPE
public static final int SYS_INFO_TYPE
- See Also:
- Constant Field Values
-
OS_ENV
public static final String OS_ENV
- See Also:
- Constant Field Values
-
OS_ENV_TYPE
public static final int OS_ENV_TYPE
- See Also:
- Constant Field Values
-
SYSTEM_LOG
public static final String SYSTEM_LOG
- See Also:
- Constant Field Values
-
SYSTEM_LOG_TYPE
public static final int SYSTEM_LOG_TYPE
- See Also:
- Constant Field Values
-
DEBUG
public static final String DEBUG
- See Also:
- Constant Field Values
-
DEBUG_TYPE
public static final int DEBUG_TYPE
- See Also:
- Constant Field Values
-
RAISE_ERROR
public static final String RAISE_ERROR
- See Also:
- Constant Field Values
-
RAISE_ERROR_TYPE
public static final int RAISE_ERROR_TYPE
- See Also:
- Constant Field Values
-
RUN_COMMAND
public static final String RUN_COMMAND
- See Also:
- Constant Field Values
-
RUN_COMMAND_TYPE
public static final int RUN_COMMAND_TYPE
- See Also:
- Constant Field Values
-
LOAD_COMMAND
public static final String LOAD_COMMAND
- See Also:
- Constant Field Values
-
LOAD_COMMAND_TYPE
public static final int LOAD_COMMAND_TYPE
- See Also:
- Constant Field Values
-
SCRIPT_ARGS_COMMAND
public static final String SCRIPT_ARGS_COMMAND
- See Also:
- Constant Field Values
-
SCRIPT_ARGS_COMMAND_TYPE
public static final int SCRIPT_ARGS_COMMAND_TYPE
- See Also:
- Constant Field Values
-
SCRIPT_PATH_COMMAND
public static final String SCRIPT_PATH_COMMAND
- See Also:
- Constant Field Values
-
SCRIPT_PATH_COMMAND_TYPE
public static final int SCRIPT_PATH_COMMAND_TYPE
- See Also:
- Constant Field Values
-
FORK
public static final String FORK
- See Also:
- Constant Field Values
-
FORK_TYPE
public static final int FORK_TYPE
- See Also:
- Constant Field Values
-
KILL_PROCESS
public static final String KILL_PROCESS
- See Also:
- Constant Field Values
-
KILL_PROCESS_TYPE
public static final int KILL_PROCESS_TYPE
- See Also:
- Constant Field Values
-
WS_MACRO
public static final String WS_MACRO
- See Also:
- Constant Field Values
-
WS_MACRO_COMMAND_TYPE
public static final int WS_MACRO_COMMAND_TYPE
- See Also:
- Constant Field Values
-
HAS_CLIPBOARD
public static final String HAS_CLIPBOARD
- See Also:
- Constant Field Values
-
HAS_CLIPBOARD_COMMAND_TYPE
public static final int HAS_CLIPBOARD_COMMAND_TYPE
- See Also:
- Constant Field Values
-
CLIPBOARD_COPY
public static final String CLIPBOARD_COPY
- See Also:
- Constant Field Values
-
CLIPBOARD_COPY_COMMAND_TYPE
public static final int CLIPBOARD_COPY_COMMAND_TYPE
- See Also:
- Constant Field Values
-
CLIPBOARD_PASTE
public static final String CLIPBOARD_PASTE
- See Also:
- Constant Field Values
-
CLIPBOARD_PASTE_COMMAND_TYPE
public static final int CLIPBOARD_PASTE_COMMAND_TYPE
- See Also:
- Constant Field Values
-
SCRIPT_ARGS2_COMMAND
public static final String SCRIPT_ARGS2_COMMAND
- See Also:
- Constant Field Values
-
SCRIPT_NAME_COMMAND
public static final String SCRIPT_NAME_COMMAND
- See Also:
- Constant Field Values
-
SCRIPT_NAME_COMMAND_TYPE
public static final int SCRIPT_NAME_COMMAND_TYPE
- See Also:
- Constant Field Values
-
SHEBANG
public static final String SHEBANG
- See Also:
- Constant Field Values
-
LOG_LEVEL_UNKNOWN
public static final int LOG_LEVEL_UNKNOWN
- See Also:
- Constant Field Values
-
LOG_LEVEL_NONE
public static final int LOG_LEVEL_NONE
- See Also:
- Constant Field Values
-
LOG_LEVEL_INFO
public static final int LOG_LEVEL_INFO
- See Also:
- Constant Field Values
-
LOG_LEVEL_WARN
public static final int LOG_LEVEL_WARN
- See Also:
- Constant Field Values
-
LOG_LEVEL_ERROR
public static final int LOG_LEVEL_ERROR
- See Also:
- Constant Field Values
-
LOG_LEVEL_SEVERE
public static final int LOG_LEVEL_SEVERE
- See Also:
- Constant Field Values
-
LOG_LEVEL_TRACE
public static final int LOG_LEVEL_TRACE
- See Also:
- Constant Field Values
-
MODULE_TYPE_JAVA
public static final String MODULE_TYPE_JAVA
- See Also:
- Constant Field Values
-
MODULE_DEFAULT_EXTENSION
public static final String MODULE_DEFAULT_EXTENSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
getNamespace
public String getNamespace()
-
getFunctionNames
public String[] getFunctionNames()
- Specified by:
getFunctionNames
in classAbstractEvaluator
-
getType
public int getType(String name)
-
dispatch
public boolean dispatch(Polyad polyad, State state)
Description copied from class:AbstractEvaluator
Does the actual evaluation of thePolyad
.- Specified by:
dispatch
in classAbstractEvaluator
- Returns:
-
doFork
protected void doFork(Polyad polyad, State state)
Run a script in its own thread. Passed variables are shared.- Parameters:
polyad
-state
-
-
getMyLogLevel
protected int getMyLogLevel(Level level)
-
doScriptPaths
protected void doScriptPaths(Polyad polyad, State state)
This accepts either a stem of paths or a single string that is parsed.- Parameters:
polyad
-state
-
-
doScriptArgs
protected void doScriptArgs(Polyad polyad, State state)
This will return a given script arg for a given index. No arg returns then number of arguments;- Parameters:
polyad
-state
-
-
doScriptArgs2
protected void doScriptArgs2(Polyad polyad, State state)
New function for script arguments. Better contract.Fixes github issue 3.
- Parameters:
polyad
-state
-
-
runScript
protected void runScript(Polyad polyad, State state)
Run an external qdl script with its own state. Ouput goes to the current console.- Parameters:
polyad
-state
-
-
resolveScript
public static QDLScript resolveScript(String name, List<String> paths, State state) throws Throwable
This will use the path information and try to resolve the script based on that. Contract is- name start with a # ==> this is a file. If server mode, fail. if abs, do it, if rel resolve against file path
- name is scheme qualified: if absolute, just get it, if relative, resolve against same scheme
- no qualification: if absolute path and server mode, fail, if relative, try against each path
NOTE: If this returns a null, then there is no such script anywhere.- Parameters:
name
-state
-- Returns:
- Throws:
Throwable
-
runnit
public static int runnit(Polyad polyad, State state, List<String> paths, boolean hasNewState, boolean newThread)
-
doModuleImport
protected void doModuleImport(Polyad polyad, State state)
The general contract for import. You may import everything in a module by using the uri. You may import items using the FQ name (uri + # + name).
Imported items are added to the current stack only. it is not possible to un-import items since it is impossible to track down references to them and it is dangerous to have programs be able to unload things willy-nilly since that can cause hard to track down failures.
If you need to unload, your best bet is to clear the workspace.- Parameters:
polyad
-
-
doSay
protected void doSay(Polyad polyad, State state, boolean printIt)
Does print, say and to_string commands.- Parameters:
polyad
-state
-printIt
-
-
doVarType
public void doVarType(Polyad polyad, State state)
Get the type of the argument.- Parameters:
polyad
-state
-
-
checkDefined
protected boolean checkDefined(ExpressionInterface exp, State state)
-
-