public class CachedPnutsImpl extends PnutsImpl
PnutsImpl
Modifier and Type | Class and Description |
---|---|
static class |
CachedPnutsImpl.ScriptCacheEntry |
Runtime.Accessor, Runtime.Break, Runtime.Continue, Runtime.FunctionSerializer, Runtime.TypeMap
properties
BOOLEAN_SYMBOL, BYTE_SYMBOL, CHAR_SYMBOL, CLONE, DOUBLE_SYMBOL, EXCEPTOIN_FIELD_SYMBOL, FLOAT_SYMBOL, INT_SYMBOL, LONG_SYMBOL, SHORT_SYMBOL, VOID_SYMBOL
Constructor and Description |
---|
CachedPnutsImpl() |
CachedPnutsImpl(boolean useCompiler) |
CachedPnutsImpl(boolean useCompiler,
boolean useDynamicProxy,
boolean includeLineNo) |
CachedPnutsImpl(boolean useCompiler,
boolean useDynamicProxy,
boolean includeLineNo,
org.pnuts.util.Cache cache) |
Modifier and Type | Method and Description |
---|---|
protected static org.pnuts.util.Cache |
createCache() |
java.lang.Object |
eval(java.lang.String script,
Context context)
Evaluate an expreesion
|
protected CachedPnutsImpl.ScriptCacheEntry |
getCachedCode(java.lang.Object key) |
void |
includeLineNo(boolean flag) |
java.lang.Object |
load(java.net.URL scriptURL,
Context context)
Load a script file from a URL
|
protected void |
putCachedCode(java.lang.Object key,
CachedPnutsImpl.ScriptCacheEntry entry) |
void |
reset()
Reset the cache entries
|
accept, getDefault, load, loadFile, popFile, provide, pushFile, queryProperty, revoke, setProperties, setProperty
_callConstructor, _callMethod, add, add, add1, add1, addImport, addStaticMembers, and, and, applyGenerator, arraydim, arrayType, call, call, callConstructor, callFunction, callMethod, cast, catchException, checkException, checkException, compareObjects, compareTo, compareTo, createList, createMap, defineTopLevelFunction, defineUnboundFunction, divide, divide, eq, eq, escape, exec, execute, fileToURL, findCallableMethod, format, format, ge, ge, getArrayLength, getBeanProperty, getBeanProperty, getBeanProperty, getBeanPropertyType, getBeginColumn, getBeginLine, getBottomType, getCompiledScript, getConstructors, getElement, getElementAt, getEndLine, getField, getField, getFunction, getFunction, getFunctions, getMessage, getMethods, getProperty, getRange, getRuntime, getScriptReader, getScriptSource, getScriptURL, getStaticField, getThreadContext, gt, gt, isArray, isGenerator, jump, le, le, loadNode, lt, lt, makeArray, matchType, mod, mod, multiply, multiply, ne, ne, negate, negate, newInstance, not, not, or, or, parseChar, parseFloat, parseInt, parseString, primitive, printError, putField, putStaticField, quantity, replaceChar, run, saveNode, setBeanProperty, setBeanProperty, setBeanProperty, setElement, setExitHook, setLine, setLine, setPackage, setRange, setThreadContext, shiftArithmetic, shiftArithmetic, shiftLeft, shiftLeft, shiftRight, shiftRight, subtract, subtract, subtract1, subtract1, throwException, toBoolean, toEnumeration, transform, transform, unparse, xor, xor
public CachedPnutsImpl()
public CachedPnutsImpl(boolean useCompiler)
useCompiler
- true if compiler is used (default)public CachedPnutsImpl(boolean useCompiler, boolean useDynamicProxy, boolean includeLineNo)
useCompiler
- true if the compiler is used (default)useDynamicProxy
- true if the compiler generates dynamic proxy.includeLineNo
- true if the compiler generates line number information.public CachedPnutsImpl(boolean useCompiler, boolean useDynamicProxy, boolean includeLineNo, org.pnuts.util.Cache cache)
useCompiler
- true if the compiler is used (default)useDynamicProxy
- true if the compiler generates dynamic proxy.includeLineNo
- true if the compiler generates line number information.cache
- a cache object to reuse compiled codepublic void includeLineNo(boolean flag)
protected static org.pnuts.util.Cache createCache()
public void reset()
protected CachedPnutsImpl.ScriptCacheEntry getCachedCode(java.lang.Object key)
protected void putCachedCode(java.lang.Object key, CachedPnutsImpl.ScriptCacheEntry entry)
public java.lang.Object load(java.net.URL scriptURL, Context context)
load
in interface Implementation
load
in class PnutsImpl
scriptURL
- the URL of the scriptcontext
- the context in which the script is executedpublic java.lang.Object eval(java.lang.String script, Context context)
PnutsImpl
eval
in interface Implementation
eval
in class PnutsImpl
script
- the expression to be evaluatedcontext
- the context in which the expression is evaluated