Class BaseExpression
java.lang.Object
com.googlecode.aviator.BaseExpression
- All Implemented Interfaces:
Expression, Serializable
- Direct Known Subclasses:
ClassExpression, InterpretExpression, LiteralExpression
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Envprivate Stringstatic final Stringprivate Map<Integer, List<FunctionArgument>> protected AviatorEvaluatorInstanceprotected Map<String, LambdaFunctionBootstrap> private static final longprotected Stringprotected SymbolTableprivate List<VariableMeta> -
Constructor Summary
ConstructorsConstructorDescriptionBaseExpression(AviatorEvaluatorInstance instance, List<VariableMeta> vars, SymbolTable symbolTable) -
Method Summary
Modifier and TypeMethodDescriptionAdds the specified symbol to the symbol table and returns a reference to the unique symbol.protected voidafterPopulateFullNames(Map<String, VariableMeta> fullNames, Set<String> parentVars) voidvoidcustomWriteObject(ObjectOutputStream output) execute()Execute an expression with an empty environment, returns the result.Execute an expression with an environment, returns the result.protected Objectabstract ObjectexecuteDirectly(Map<String, Object> env) protected Envprivate longgetExecutionStartNs(boolean checkExecutionTimeout) Returns the expression string when turn onOptions.TRACE_EVALoption, else returns null.Returns the function names in the expression when using AviatorEvaluator.EVAL mode, otherwise returns an empty list.Returns the source file name.getStringSegements(String lexeme, int lineNo) Returns this expression's all uninitialized global variable full names(contains dot) in order when using AviatorEvaluator.EVAL mode, otherwise returns an empty list.Returns this expression's all uninitialized global variable names in order when using AviatorEvaluator.EVAL mode, otherwise returns an empty list.getVars()Created a faster env map(compare variable names by reference).The arguments should be a sequence of pair invalid input: '<'String, Object>.protected Envprotected Envprivate voidprivate voidprivate voidprotected voidsetCompileEnv(Env compileEnv) protected voidsetExpression(String expression) protected voidsetFuncsArgs(Map<Integer, List<FunctionArgument>> funcsArgs) protected voidsetFunctionNames(List<String> functionNames) protected voidsetInstance(AviatorEvaluatorInstance instance) protected voidsetLambdaBootstraps(Map<String, LambdaFunctionBootstrap> lambdaBootstraps) protected voidsetSourceFile(String sourceFile)
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
FUNC_PARAMS_VAR
- See Also:
-
varNames
-
varFullNames
-
vars
-
expression
-
instance
-
compileEnv
-
funcsArgs
-
symbolTable
-
stringSegs
private transient ConcurrentHashMap<String, FutureTask<AviatorEvaluatorInstance.StringSegments>> stringSegs -
functionNames
-
filteredFunctionNames
-
sourceFile
-
lambdaBootstraps
-
-
Constructor Details
-
BaseExpression
public BaseExpression(AviatorEvaluatorInstance instance, List<VariableMeta> vars, SymbolTable symbolTable)
-
-
Method Details
-
getSourceFile
Description copied from interface:ExpressionReturns the source file name.- Specified by:
getSourceFilein interfaceExpression- Returns:
- the source file name
-
setSourceFile
-
setInstance
-
populateNames
private void populateNames() -
afterPopulateFullNames
-
populateFullNames
private void populateFullNames() -
getFullNameMetas
-
getStringSegements
-
newEnv
Description copied from interface:ExpressionCreated a faster env map(compare variable names by reference).The arguments should be a sequence of pair invalid input: '<'String, Object>.- Specified by:
newEnvin interfaceExpression- Parameters:
args-- Returns:
- an env map
-
executeDirectly
-
execute
Description copied from interface:ExpressionExecute an expression with an environment, returns the result.- Specified by:
executein interfaceExpression- Parameters:
map- Binding variable environment- Returns:
- the result of execution
-
execute
-
setFuncsArgs
-
getCompileEnv
-
setCompileEnv
-
getExpression
Returns the expression string when turn onOptions.TRACE_EVALoption, else returns null.- Returns:
- expression in string.
-
setExpression
-
addSymbol
Description copied from interface:ExpressionAdds the specified symbol to the symbol table and returns a reference to the unique symbol. If the symbol already exists, the previous symbol reference is returned instead, in order guarantee that symbol references remain unique.- Specified by:
addSymbolin interfaceExpression- Parameters:
name- The symbol name.
-
execute
Description copied from interface:ExpressionExecute an expression with an empty environment, returns the result.- Specified by:
executein interfaceExpression- Returns:
- the result of execution
-
getVariableFullNames
Description copied from interface:ExpressionReturns this expression's all uninitialized global variable full names(contains dot) in order when using AviatorEvaluator.EVAL mode, otherwise returns an empty list.- Specified by:
getVariableFullNamesin interfaceExpression- Returns:
-
getVars
-
getVariableNames
Description copied from interface:ExpressionReturns this expression's all uninitialized global variable names in order when using AviatorEvaluator.EVAL mode, otherwise returns an empty list.- Specified by:
getVariableNamesin interfaceExpression- Returns:
- See Also:
-
newEnv
-
genTopEnv
-
getExecutionStartNs
private long getExecutionStartNs(boolean checkExecutionTimeout) -
newEnv
-
getFunctionNames
Description copied from interface:ExpressionReturns the function names in the expression when using AviatorEvaluator.EVAL mode, otherwise returns an empty list.- Specified by:
getFunctionNamesin interfaceExpression- Returns:
- the function name list
-
populateFilteredFuncNames
private void populateFilteredFuncNames() -
setFunctionNames
-
getLambdaBootstraps
-
setLambdaBootstraps
-
newLambda
-
customReadObject
- Throws:
ClassNotFoundExceptionIOException
-
customWriteObject
- Throws:
IOException
-