public class ScriptEvaluator extends Object implements JmolScriptEvaluator
Constructor and Description |
---|
ScriptEvaluator() |
Modifier and Type | Method and Description |
---|---|
BS |
addHydrogensInline(BS bsAtoms,
javajs.util.List<Atom> vConnections,
javajs.util.P3[] pts) |
private void |
addProcess(javajs.util.List<T[]> vProcess,
int pc,
int pt) |
private void |
animation() |
private void |
assign() |
private javajs.util.P3 |
atomCenterOrCoordinateParameter(int i) |
BS |
atomExpression(T[] code,
int pcStart,
int pcStop,
boolean allowRefresh,
boolean allowUnderflow,
boolean mustBeBitSet,
boolean andNotDeleted) |
BS |
atomExpressionAt(int index) |
private void |
axes(int index) |
private void |
background(int i) |
private void |
bind() |
(package private) BS |
bitSetForModelFileNumber(int m) |
(package private) javajs.util.List<SV> |
bitsetVariableVector(Object v) |
private void |
bondorder() |
private boolean |
booleanParameter(int i) |
private void |
boundbox(int index) |
private void |
breakCmd(int pt) |
private void |
cache() |
private void |
cd() |
private void |
center(int i) |
private void |
centerAt() |
javajs.util.P3 |
centerParameter(int i) |
private javajs.util.P3 |
centerParameterForModel(int i,
int modelIndex) |
private boolean |
changeElementColor(String str,
int argb) |
private boolean |
checkContinue()
checks to see if there is a pause condition, during which commands can
still be issued, but with the ! first.
|
int |
checkLast(int i) |
int |
checkLength(int length) |
int |
checkLength23() |
private int |
checkLength34() |
private int |
checkLengthErrorPt(int length,
int errorPt) |
ScriptContext |
checkScriptSilent(String script)
a method for just checking a script
|
TickInfo |
checkTicks(int index,
boolean allowUnitCell,
boolean allowScale,
boolean allowFirst) |
private boolean |
checkToken(int i) |
void |
clearDefinedVariableAtomSets() |
private void |
clearState(boolean tQuiet) |
private void |
color() |
private void |
colorShape(int shapeType,
int index,
boolean isBackground) |
private void |
commandLoop(boolean fromFunc) |
private static boolean |
compareFloat(int tokOperator,
float propertyFloat,
float comparisonFloat) |
private BS |
compareFloatData(int tokWhat,
float[] data,
int tokOperator,
float comparisonFloat) |
BS |
compareInt(int tokWhat,
int tokOperator,
int comparisonValue) |
private BS |
compareString(int tokWhat,
int tokOperator,
String comparisonString) |
private boolean |
compareStringValues(int tokOperator,
String propertyValue,
String comparisonValue) |
boolean |
compileScript(String filename,
String strScript,
boolean debugCompiler) |
boolean |
compileScriptFile(String filename,
boolean tQuiet) |
private boolean |
compileScriptFileInternal(String filename,
String localPath,
String remotePath,
String scriptPath) |
boolean |
compileScriptString(String script,
boolean tQuiet) |
private void |
connect(int index) |
private void |
console() |
private void |
define() |
private void |
defineAtomSet(String script) |
private void |
defineSets()
support for @xxx or define xxx commands
|
private void |
delay() |
void |
delayScript(int millis) |
private void |
delete() |
void |
deleteAtomsInVariables(BS bsDeleted) |
boolean |
dispatchCommands(boolean isSpt,
boolean fromFunc) |
private void |
display(boolean isDisplay) |
private void |
doDelay(int millis) |
private void |
dots(int iShape) |
private void |
echo(int index,
String id,
boolean isImage) |
private void |
ellipsoid() |
RadiusData |
encodeRadiusParameter(int index,
boolean isOnly,
boolean allowAbsolute) |
void |
error(int iError) |
(package private) void |
errorAt(int iError,
int i) |
(package private) void |
errorMore(int iError,
String value,
String more,
String more2) |
(package private) void |
errorOrWarn(int iError,
String value,
String more,
String more2,
boolean warningOnly) |
void |
errorStr(int iError,
String value) |
void |
errorStr2(int iError,
String value,
String more) |
(package private) static String |
errorString(int iError,
String value,
String more,
String more2,
boolean translated) |
void |
evalError(String message,
String strUntranslated) |
float |
evalFunctionFloat(Object func,
Object params,
float[] values) |
private Object |
evaluate(Object expr,
boolean asVariable) |
void |
evaluateCompiledScript(boolean isCmdLine_c_or_C_Option,
boolean isCmdLine_C_Option,
boolean historyDisabled,
boolean listCommands,
javajs.util.SB outputBuffer,
boolean allowThreads) |
Object |
evaluateExpression(Object expr,
boolean asVariable)
a general-use method to evaluate a "SET" type expression.
|
boolean |
evaluateParallel(ScriptContext context,
ShapeManager shapeManager) |
private void |
executeCommands(boolean isTry) |
private void |
file() |
void |
finalizeObject(int shapeID,
int colorArgb,
float translucentLevel,
int intScale,
boolean doSet,
Object data,
int iptDisplayProperty,
BS bs) |
private void |
fixed() |
private String |
fixScriptPath(String strScript,
String filename) |
float |
floatParameter(int index) |
private float |
floatParameterRange(int i,
float min,
float max) |
float[] |
floatParameterSet(int i,
int nMin,
int nMax)
process a general string or set of parameters as an array of floats,
allowing for relatively free form input
|
private float |
floatSetting(int pt) |
private boolean |
flowControl(int tok,
boolean isForCheck,
javajs.util.List<T[]> vProcess) |
private void |
font(int shapeType,
float fontsize) |
private void |
frameControl(int i) |
private void |
frank(int index) |
private void |
function() |
boolean |
getAllowJSThreads() |
int |
getArgbParam(int index) |
private int |
getArgbParamLast(int index,
boolean allowNone) |
private int |
getArgbParamOrNone(int index,
boolean allowNone) |
private BS |
getAtomBits(int tokType,
Object specInfo) |
BS |
getAtomBitSet(Object atomExpression)
a general method to evaluate a string representing an atom set.
|
javajs.util.List<Integer> |
getAtomBitSetVector(int atomCount,
Object atomExpression)
just provides a vector list of atoms in a string-based expression
|
Object |
getBitsetProperty(BS bs,
int tok,
javajs.util.P3 ptRef,
javajs.util.P4 planeRef,
Object tokenValue,
Object opValue,
boolean useAtomMap,
int index,
boolean asVectorIfAll) |
float[] |
getBitsetPropertyFloat(BS bs,
int tok,
float min,
float max) |
private SV |
getBitsetPropertySelector(int i,
boolean mustBeSettable) |
static int |
getBondOrderFromString(String s) |
String |
getColorRange(int i) |
float |
getColorTrans(int i,
boolean allowNone)
Checks color, translucent, opaque parameters.
|
private int |
getColorTriad(int i) |
private String |
getCommand(int pc,
boolean allThisLine,
boolean addSemi)
used for recall of commands in the application console
|
(package private) static javajs.util.SB |
getContextTrace(Viewer viewer,
ScriptContext sc,
javajs.util.SB sb,
boolean isTop) |
SV |
getContextVariableAsVariable(String var) |
Map<String,SV> |
getContextVariables() |
Map<String,Object> |
getDefinedAtomSets() |
private javajs.util.V3 |
getDrawObjectAxis(String axisID,
int index) |
static String |
getErrorLineMessage(String functionName,
String filename,
int lineCurrent,
int pcCurrent,
String lineInfo) |
String |
getErrorLineMessage2() |
String |
getErrorMessage() |
String |
getErrorMessageUntranslated() |
private int |
getExecutionWalltime() |
(package private) JmolScriptExtension |
getExtension() |
(package private) static int |
getFloatEncodedInt(String strDecimal)
Encodes a string such as "2.10" as an integer instead of a float so as to
distinguish "2.1" from "2.10" used for model numbers and partial bond
orders.
|
String |
getFullPathName() |
private Map<String,Object> |
getHash(int i) |
javajs.util.P4 |
getHklPlane(javajs.util.P3 pt) |
String |
getIsosurfaceDataRange(int iShape,
String sep) |
int |
getLinenumber(ScriptContext c) |
int |
getMadParameter() |
String |
getNextStatement()
when paused, indicates what statement will be next
|
private Object |
getNumericParameter(String var) |
private javajs.util.P3[] |
getObjectBoundingBox(String id) |
private javajs.util.P3 |
getObjectCenter(String axisID,
int index,
int modelIndex) |
Object |
getParameter(String key,
int tokType) |
(package private) static int |
getPartialBondOrderFromFloatEncodedInt(int bondOrderInteger)
reads standard n.m float-as-integer n*1000000 + m and returns (n % 6) << 5
+ (m % 0x1F)
|
private static int |
getPartialBondOrderFromString(String s) |
javajs.util.P3 |
getPoint3f(int i,
boolean allowFractional) |
javajs.util.P4 |
getPoint4f(int i) |
javajs.util.P3[] |
getPointArray(int i,
int nPoints) |
private Object |
getPointOrPlane(int index,
boolean integerOnly,
boolean allowFractional,
boolean doConvert,
boolean implicitFractional,
int minDim,
int maxDim) |
javajs.util.List<javajs.util.P3> |
getPointVector(T t,
int i) |
private void |
getProperty() |
private Quaternion |
getQuaternionParameter(int i) |
String |
getScript() |
ScriptContext |
getScriptContext(String why) |
private static int |
getSeqCode(T instruction) |
private int |
getSetAxesTypeMad(int index) |
String |
getShapeNameParameter(int i) |
Object |
getShapeProperty(int shapeType,
String propertyName) |
boolean |
getShapePropertyData(int shapeType,
String propertyName,
Object[] data) |
private int |
getShapeType(int tok) |
private Object |
getStringObjectAsVariable(String s,
String key) |
private String |
getStringParameter(String var,
boolean orReturnName) |
ScriptContext |
getThisContext() |
T |
getToken(int i) |
private float |
getTranslucentLevel(int i) |
private float |
getZoom(int ptCenter,
int i,
BS bs,
float currentZoom) |
private void |
gotoCmd(String strTo) |
void |
haltExecution() |
private void |
hbond() |
private void |
help() |
private void |
history(int pt) |
javajs.util.P4 |
hklParameter(int i) |
private void |
hover() |
private boolean |
ifCmd() |
void |
integerOutOfRange(int min,
int max) |
int |
intParameter(int index) |
int |
intParameterRange(int i,
int min,
int max) |
private int |
intSetting(int pt) |
private void |
invArg() |
private void |
invertSelected() |
boolean |
isArrayParameter(int i) |
boolean |
isCenterParameter(int i) |
boolean |
isColorParam(int i) |
private boolean |
isCommandDisplayable(int i)
provides support for the script editor
|
boolean |
isExecuting() |
boolean |
isFloatParameter(int index) |
boolean |
isPaused() |
boolean |
isPoint3f(int i) |
boolean |
isStepping() |
boolean |
isStopped() |
private void |
label(int index) |
javajs.util.List<Object> |
listParameter(int i,
int nMin,
int nMax) |
void |
load() |
String |
loadFileAsync(String prefix,
String filename,
int i,
boolean doClear)
Allows asynchronous file loading from the LOAD or SCRIPT command.
|
private void |
log() |
private void |
logDebugScript(int ifLevel) |
private void |
logLoadInfo(String msg) |
BS |
lookupIdentifierValue(String identifier) |
private BS |
lookupValue(String setName,
boolean plurals) |
private void |
message() |
private void |
model(int offset) |
int |
modelNumberParameter(int index) |
private void |
move() |
private void |
moveto() |
void |
notifyResumeStatus() |
private void |
numberOutOfRange(float min,
float max) |
String |
objectNameParameter(int index) |
String |
optParameterAsString(int i) |
String |
parameterAsString(int i) |
private Object |
parameterExpression(int pt,
int ptMax,
String key,
boolean ignoreComma,
boolean asVector,
int ptAtom,
boolean isArrayItem,
Map<String,SV> localVars,
String localVar)
This is the primary driver of the RPN (reverse Polish notation) expression
processor.
|
private boolean |
parameterExpressionBoolean(int pt,
int ptMax) |
private javajs.util.List<SV> |
parameterExpressionList(int pt,
int ptAtom,
boolean isArrayItem) |
private String |
parameterExpressionString(int pt,
int ptMax) |
private SV |
parameterExpressionToken(int pt) |
private boolean |
pause() |
void |
pauseExecution(boolean withDelay) |
private void |
planeExpected() |
javajs.util.P4 |
planeParameter(int i) |
(package private) void |
popContext(boolean isFlowCommand,
boolean statementOnly) |
private void |
print() |
private void |
processShapeCommand(int tok) |
private void |
processTry(Map<String,SV> cv) |
private void |
prompt() |
private void |
proteinShape(int shapeType) |
private void |
pushContext(ContextToken token,
String why) |
private void |
pushContext2(ContextToken token,
String why) |
void |
pushContextDown(String why) |
void |
refresh() |
private void |
reset() |
private void |
restore() |
private void |
restoreFunction(JmolScriptFunction f,
javajs.util.List<SV> params,
SV tokenAtom)
note that functions requiring motion cannot be run in JavaScript
|
void |
restoreScriptContext(ScriptContext context,
boolean isPopContext,
boolean isFlowCommand,
boolean statementOnly) |
private void |
restrict() |
private void |
restrictSelected(boolean isBond,
boolean doInvert) |
void |
resumeEval(ScriptContext sc)
From dispatchCommands and JmolThread resumeEval.
|
void |
resumePausedExecution() |
private void |
returnCmd(SV tv) |
private void |
rotate(boolean isSpin,
boolean isSelected) |
SV |
runFunctionRet(JmolScriptFunction function,
String name,
javajs.util.List<SV> params,
SV tokenAtom,
boolean getReturn,
boolean setContextPath,
boolean allowThreads) |
void |
runScript(String script) |
void |
runScriptBuffer(String script,
javajs.util.SB outputBuffer)
runs a script and sends selected output to a provided StringXBuilder
|
private void |
save() |
void |
script(int tok,
String filename,
String theScript) |
void |
scriptStatusOrBuffer(String s) |
private void |
select(int i) |
private void |
selectionHalo(int pt) |
private void |
set() |
private void |
setAtomShapeSize(int shape,
float scale) |
private void |
setBitsetProperty(BS bs,
int tok,
int iValue,
float fValue,
T tokenValue) |
private void |
setBondmode() |
void |
setBooleanProperty(String key,
boolean value) |
void |
setCompiler() |
void |
setCursorWait(boolean TF) |
void |
setDebugging() |
private void |
setEcho() |
private void |
setErrorMessage(String err) |
void |
setException(ScriptException sx,
String msg,
String untranslated) |
private boolean |
setFloatProperty(String key,
float value) |
private void |
setHbond() |
private boolean |
setIntProperty(String key,
int value) |
private boolean |
setLabel(String str) |
boolean |
setMeshDisplayProperty(int shape,
int i,
int tok) |
private void |
setMonitor() |
private void |
setObjectArgb(String str,
int argb) |
void |
setObjectMad(int iShape,
String name,
int mad) |
String |
setObjectProp(String id,
int tokCommand,
int iTok) |
String |
setObjectProperty() |
String |
setObjectPropSafe(String id,
int tokCommand,
int iTok) |
private void |
setPicking() |
private void |
setPickingStyle() |
private int |
setScriptExtensions() |
String |
setShapeId(int iShape,
int i,
boolean idSeen) |
void |
setShapeProperty(int shapeType,
String propertyName,
Object propertyValue) |
void |
setShapePropertyBs(int iShape,
String propertyName,
Object propertyValue,
BS bs) |
private void |
setShapeSize(int shapeType,
RadiusData rd) |
void |
setShapeSizeBs(int shapeType,
int size,
BS bs) |
void |
setShapeTranslucency(int shapeType,
String prefix,
String translucency,
float translucentLevel,
BS bs) |
private void |
setSsbond() |
private boolean |
setStatement(int pc)
provides support for @x and @{....} in statements.
|
private void |
setStringProperty(String key,
String value) |
private boolean |
setUnits(String units,
int tok) |
private void |
setUserColors() |
private void |
setVariable(int pt,
int ptMax,
String key,
int setType) |
JmolScriptEvaluator |
setViewer(Viewer viewer) |
private void |
setZslab() |
void |
showString(String str) |
void |
showStringPrint(String str,
boolean isPrint) |
private void |
slab(boolean isDepth) |
private void |
ssbond() |
private void |
startEval() |
static String |
statementAsString(Viewer viewer,
T[] statement,
int iTok,
boolean doLogMessages) |
void |
stepPausedExecution() |
private void |
stereo() |
void |
stopScriptThreads() |
String |
stringParameter(int index) |
String[] |
stringParameterSet(int i) |
private String |
stringSetting(int pt,
boolean isJmolSet) |
private void |
structure() |
private void |
subset() |
private int |
switchCmd(ContextToken c,
int tok) |
private void |
sync() |
private void |
timeout(int index) |
int |
tokAt(int i) |
String |
toString() |
private void |
translate(boolean isSelected) |
private void |
unbind() |
private void |
undoRedoMove() |
private void |
unitcell(int index) |
boolean |
useThreads() |
private void |
vector() |
private void |
vibration() |
private void |
warning(int iError,
String value,
String more) |
private void |
wireframe() |
javajs.util.P3 |
xypParameter(int index) |
private void |
zap(boolean isZapCommand) |
private void |
zoom(boolean isZoomTo) |
public boolean allowJSThreads
private boolean listCommands
public boolean isJS
public boolean tQuiet
public boolean chk
private boolean isCmdLine_C_Option
protected boolean isCmdLine_c_or_C_Option
public boolean historyDisabled
public boolean logMessages
private boolean debugScript
private boolean executionStopped
private boolean executionPaused
private boolean executionStepping
private boolean executing
private long timeBeginExecution
private long timeEndExecution
private boolean mustResumeEval
private static final String EXPRESSION_KEY
public ShapeManager sm
private static final int scriptLevelMax
private Thread currentThread
public Viewer viewer
public ScriptCompiler compiler
private javajs.util.SB outputBuffer
private String contextPath
public String scriptFileName
public String functionName
private boolean isStateScript
public int scriptLevel
private int scriptReportingLevel
public int commandHistoryLevelMax
public T[][] aatoken
private short[] lineNumbers
private int[][] lineIndices
private String script
protected int pc
public String thisCommand
public String fullCommand
public T[] st
public int slen
public int iToken
private int lineEnd
private int pcEnd
private String scriptExtensions
private boolean forceNoAddHydrogens
private JmolParallelProcessor parallelProcessor
static int tryPt
public ScriptContext thisContext
private boolean error
private String errorMessage
protected String errorMessageUntranslated
protected String errorType
protected int iCommandError
private boolean ignoreError
static final int ERROR_axisExpected
static final int ERROR_backgroundModelError
public static final int ERROR_badArgumentCount
static final int ERROR_badMillerIndices
public static final int ERROR_badRGBColor
static final int ERROR_booleanExpected
static final int ERROR_booleanOrNumberExpected
static final int ERROR_booleanOrWhateverExpected
static final int ERROR_colorExpected
static final int ERROR_colorOrPaletteRequired
static final int ERROR_commandExpected
static final int ERROR_coordinateOrNameOrExpressionRequired
static final int ERROR_drawObjectNotDefined
public static final int ERROR_endOfStatementUnexpected
public static final int ERROR_expressionExpected
public static final int ERROR_expressionOrIntegerExpected
static final int ERROR_filenameExpected
public static final int ERROR_fileNotFoundException
public static final int ERROR_incompatibleArguments
public static final int ERROR_insufficientArguments
static final int ERROR_integerExpected
static final int ERROR_integerOutOfRange
public static final int ERROR_invalidArgument
public static final int ERROR_invalidParameterOrder
public static final int ERROR_keywordExpected
public static final int ERROR_moCoefficients
public static final int ERROR_moIndex
public static final int ERROR_moModelError
public static final int ERROR_moOccupancy
public static final int ERROR_moOnlyOne
public static final int ERROR_multipleModelsDisplayedNotOK
public static final int ERROR_noData
public static final int ERROR_noPartialCharges
static final int ERROR_noUnitCell
public static final int ERROR_numberExpected
static final int ERROR_numberMustBe
static final int ERROR_numberOutOfRange
static final int ERROR_objectNameExpected
static final int ERROR_planeExpected
static final int ERROR_propertyNameExpected
static final int ERROR_spaceGroupNotFound
static final int ERROR_stringExpected
static final int ERROR_stringOrIdentifierExpected
static final int ERROR_tooManyPoints
static final int ERROR_tooManyScriptLevels
static final int ERROR_unrecognizedAtomProperty
static final int ERROR_unrecognizedBondProperty
static final int ERROR_unrecognizedCommand
static final int ERROR_unrecognizedExpression
static final int ERROR_unrecognizedObject
static final int ERROR_unrecognizedParameter
static final int ERROR_unrecognizedParameterWarning
static final int ERROR_unrecognizedShowParameter
public static final int ERROR_what
public static final int ERROR_writeWhat
static final int ERROR_multipleModelsNotOK
static final int ERROR_cannotSet
private T[] tempStatement
private boolean isBondSet
public Object expressionResult
public int theTok
public T theToken
private boolean coordinatesAreFractional
private javajs.util.P3 fractionalPoint
private JmolScriptExtension scriptExt
static int iProcess
public int[] colorArgb
private JmolThread scriptDelayThread
private JmolThread fileLoadThread
public boolean getAllowJSThreads()
getAllowJSThreads
in interface JmolScriptEvaluator
public JmolScriptEvaluator setViewer(Viewer viewer)
setViewer
in interface JmolScriptEvaluator
public void setCompiler()
setCompiler
in interface JmolScriptEvaluator
public boolean compileScriptString(String script, boolean tQuiet)
compileScriptString
in interface JmolScriptEvaluator
public boolean compileScriptFile(String filename, boolean tQuiet)
compileScriptFile
in interface JmolScriptEvaluator
public void evaluateCompiledScript(boolean isCmdLine_c_or_C_Option, boolean isCmdLine_C_Option, boolean historyDisabled, boolean listCommands, javajs.util.SB outputBuffer, boolean allowThreads)
evaluateCompiledScript
in interface JmolScriptEvaluator
public boolean useThreads()
private void startEval()
private void executeCommands(boolean isTry)
public void resumeEval(ScriptContext sc)
resumeEval
in interface JmolScriptEvaluator
sc
- public void runScript(String script) throws ScriptException
runScript
in interface JmolScriptEvaluator
ScriptException
public void runScriptBuffer(String script, javajs.util.SB outputBuffer) throws ScriptException
runScriptBuffer
in interface JmolScriptEvaluator
script
- outputBuffer
- ScriptException
public ScriptContext checkScriptSilent(String script)
checkScriptSilent
in interface JmolScriptEvaluator
script
- static javajs.util.SB getContextTrace(Viewer viewer, ScriptContext sc, javajs.util.SB sb, boolean isTop)
public void setDebugging()
setDebugging
in interface JmolScriptEvaluator
private int getExecutionWalltime()
public void haltExecution()
haltExecution
in interface JmolScriptEvaluator
public void pauseExecution(boolean withDelay)
pauseExecution
in interface JmolScriptEvaluator
public void stepPausedExecution()
stepPausedExecution
in interface JmolScriptEvaluator
public void resumePausedExecution()
resumePausedExecution
in interface JmolScriptEvaluator
public boolean isExecuting()
isExecuting
in interface JmolScriptEvaluator
public boolean isPaused()
isPaused
in interface JmolScriptEvaluator
public boolean isStepping()
isStepping
in interface JmolScriptEvaluator
public boolean isStopped()
isStopped
in interface JmolScriptEvaluator
public String getNextStatement()
getNextStatement
in interface JmolScriptEvaluator
private String getCommand(int pc, boolean allThisLine, boolean addSemi)
pc
- allThisLine
- addSemi
- private void logDebugScript(int ifLevel)
public Object evaluateExpression(Object expr, boolean asVariable)
evaluateExpression
in interface JmolScriptEvaluator
expr
- asVariable
- public BS getAtomBitSet(Object atomExpression)
getAtomBitSet
in interface JmolScriptEvaluator
atomExpression
- public javajs.util.List<Integer> getAtomBitSetVector(int atomCount, Object atomExpression)
getAtomBitSetVector
in interface JmolScriptEvaluator
atomCount
- atomExpression
- private javajs.util.List<SV> parameterExpressionList(int pt, int ptAtom, boolean isArrayItem) throws ScriptException
ScriptException
private String parameterExpressionString(int pt, int ptMax) throws ScriptException
ScriptException
private boolean parameterExpressionBoolean(int pt, int ptMax) throws ScriptException
ScriptException
private SV parameterExpressionToken(int pt) throws ScriptException
ScriptException
private Object parameterExpression(int pt, int ptMax, String key, boolean ignoreComma, boolean asVector, int ptAtom, boolean isArrayItem, Map<String,SV> localVars, String localVar) throws ScriptException
pt
- token index in statement start of expressionptMax
- token index in statement end of expressionkey
- variable name for debugging reference only -- null indicates return
Boolean -- "" indicates return StringignoreComma
- asVector
- a flag passed on to RPN;ptAtom
- this is a for() or select() function with a specific atom selectedisArrayItem
- we are storing A[x] = ... so we need to deliver "x" as welllocalVars
- see below -- lists all nested for(x, {exp}, select(y, {ex},...))
variableslocalVar
- x or y in above for(), select() examplesScriptException
- errors are thrown directly to the Eval error system.private Map<String,Object> getHash(int i) throws ScriptException
ScriptException
private SV getBitsetPropertySelector(int i, boolean mustBeSettable) throws ScriptException
ScriptException
public float[] getBitsetPropertyFloat(BS bs, int tok, float min, float max) throws ScriptException
ScriptException
public Object getBitsetProperty(BS bs, int tok, javajs.util.P3 ptRef, javajs.util.P4 planeRef, Object tokenValue, Object opValue, boolean useAtomMap, int index, boolean asVectorIfAll) throws ScriptException
ScriptException
private void setBitsetProperty(BS bs, int tok, int iValue, float fValue, T tokenValue) throws ScriptException
ScriptException
public Map<String,Object> getDefinedAtomSets()
getDefinedAtomSets
in interface JmolScriptEvaluator
public Map<String,SV> getContextVariables()
getContextVariables
in interface JmolScriptEvaluator
public String getScript()
getScript
in interface JmolScriptEvaluator
public boolean compileScript(String filename, String strScript, boolean debugCompiler)
private int setScriptExtensions()
private boolean compileScriptFileInternal(String filename, String localPath, String remotePath, String scriptPath)
public float evalFunctionFloat(Object func, Object params, float[] values)
evalFunctionFloat
in interface JmolScriptEvaluator
public SV runFunctionRet(JmolScriptFunction function, String name, javajs.util.List<SV> params, SV tokenAtom, boolean getReturn, boolean setContextPath, boolean allowThreads) throws ScriptException
ScriptException
private void processTry(Map<String,SV> cv) throws ScriptException
ScriptException
private void restoreFunction(JmolScriptFunction f, javajs.util.List<SV> params, SV tokenAtom) throws ScriptException
f
- params
- tokenAtom
- ScriptException
public void clearDefinedVariableAtomSets()
private void defineSets()
private void defineAtomSet(String script)
public BS lookupIdentifierValue(String identifier) throws ScriptException
ScriptException
private BS lookupValue(String setName, boolean plurals) throws ScriptException
ScriptException
public void deleteAtomsInVariables(BS bsDeleted)
deleteAtomsInVariables
in interface JmolScriptEvaluator
private boolean setStatement(int pc) throws ScriptException
pc
- ScriptException
private void clearState(boolean tQuiet)
public ScriptContext getThisContext()
getThisContext
in interface JmolScriptEvaluator
public void pushContextDown(String why)
pushContextDown
in interface JmolScriptEvaluator
private void pushContext(ContextToken token, String why) throws ScriptException
ScriptException
private void pushContext2(ContextToken token, String why)
public ScriptContext getScriptContext(String why)
getScriptContext
in interface JmolScriptEvaluator
void popContext(boolean isFlowCommand, boolean statementOnly)
public void restoreScriptContext(ScriptContext context, boolean isPopContext, boolean isFlowCommand, boolean statementOnly)
public int getLinenumber(ScriptContext c)
public void setException(ScriptException sx, String msg, String untranslated)
setException
in interface JmolScriptEvaluator
public String getErrorMessage()
getErrorMessage
in interface JmolScriptEvaluator
public String getErrorMessageUntranslated()
getErrorMessageUntranslated
in interface JmolScriptEvaluator
private void setErrorMessage(String err)
private void planeExpected() throws ScriptException
ScriptException
public void integerOutOfRange(int min, int max) throws ScriptException
ScriptException
private void numberOutOfRange(float min, float max) throws ScriptException
ScriptException
void errorAt(int iError, int i) throws ScriptException
ScriptException
private void invArg() throws ScriptException
ScriptException
public void error(int iError) throws ScriptException
ScriptException
public void errorStr(int iError, String value) throws ScriptException
ScriptException
public void errorStr2(int iError, String value, String more) throws ScriptException
ScriptException
void errorMore(int iError, String value, String more, String more2) throws ScriptException
ScriptException
private void warning(int iError, String value, String more) throws ScriptException
ScriptException
void errorOrWarn(int iError, String value, String more, String more2, boolean warningOnly) throws ScriptException
ScriptException
public void evalError(String message, String strUntranslated) throws ScriptException
ScriptException
static String errorString(int iError, String value, String more, String more2, boolean translated)
iError
- value
- more
- more2
- translated
- public static String getErrorLineMessage(String functionName, String filename, int lineCurrent, int pcCurrent, String lineInfo)
public static String statementAsString(Viewer viewer, T[] statement, int iTok, boolean doLogMessages)
public boolean getShapePropertyData(int shapeType, String propertyName, Object[] data)
public void setObjectMad(int iShape, String name, int mad)
private void setObjectArgb(String str, int argb)
public void setShapeProperty(int shapeType, String propertyName, Object propertyValue)
public void setShapePropertyBs(int iShape, String propertyName, Object propertyValue, BS bs)
public void setShapeSizeBs(int shapeType, int size, BS bs)
private void setShapeSize(int shapeType, RadiusData rd)
public void setBooleanProperty(String key, boolean value)
private boolean setIntProperty(String key, int value)
private boolean setFloatProperty(String key, float value)
public void showString(String str)
public void showStringPrint(String str, boolean isPrint)
public void scriptStatusOrBuffer(String s)
public BS atomExpressionAt(int index) throws ScriptException
ScriptException
public BS atomExpression(T[] code, int pcStart, int pcStop, boolean allowRefresh, boolean allowUnderflow, boolean mustBeBitSet, boolean andNotDeleted) throws ScriptException
code
- pcStart
- pcStop
- allowRefresh
- allowUnderflow
- mustBeBitSet
- andNotDeleted
- IGNOREDScriptException
private BS compareFloatData(int tokWhat, float[] data, int tokOperator, float comparisonFloat)
tokWhat
- data
- tokOperator
- comparisonFloat
- private BS compareString(int tokWhat, int tokOperator, String comparisonString) throws ScriptException
ScriptException
public BS compareInt(int tokWhat, int tokOperator, int comparisonValue)
private boolean compareStringValues(int tokOperator, String propertyValue, String comparisonValue) throws ScriptException
ScriptException
private static boolean compareFloat(int tokOperator, float propertyFloat, float comparisonFloat)
private static int getSeqCode(T instruction)
public int checkLast(int i) throws ScriptException
ScriptException
public int checkLength(int length) throws ScriptException
ScriptException
private int checkLengthErrorPt(int length, int errorPt) throws ScriptException
ScriptException
public int checkLength23() throws ScriptException
ScriptException
private int checkLength34() throws ScriptException
ScriptException
public T getToken(int i) throws ScriptException
ScriptException
public int tokAt(int i)
private boolean checkToken(int i)
public int modelNumberParameter(int index) throws ScriptException
ScriptException
public String optParameterAsString(int i) throws ScriptException
ScriptException
public String parameterAsString(int i) throws ScriptException
ScriptException
public int intParameter(int index) throws ScriptException
ScriptException
public int intParameterRange(int i, int min, int max) throws ScriptException
ScriptException
public boolean isFloatParameter(int index)
private float floatParameterRange(int i, float min, float max) throws ScriptException
ScriptException
public float floatParameter(int index) throws ScriptException
ScriptException
public javajs.util.List<Object> listParameter(int i, int nMin, int nMax) throws ScriptException
ScriptException
public float[] floatParameterSet(int i, int nMin, int nMax) throws ScriptException
i
- nMin
- nMax
- ScriptException
public boolean isArrayParameter(int i)
public javajs.util.P3[] getPointArray(int i, int nPoints) throws ScriptException
ScriptException
public String stringParameter(int index) throws ScriptException
ScriptException
public String[] stringParameterSet(int i) throws ScriptException
ScriptException
public String objectNameParameter(int index) throws ScriptException
ScriptException
private boolean booleanParameter(int i) throws ScriptException
ScriptException
private javajs.util.P3 atomCenterOrCoordinateParameter(int i) throws ScriptException
ScriptException
public boolean isCenterParameter(int i)
public javajs.util.P3 centerParameter(int i) throws ScriptException
ScriptException
private javajs.util.P3 centerParameterForModel(int i, int modelIndex) throws ScriptException
ScriptException
public javajs.util.P4 planeParameter(int i) throws ScriptException
ScriptException
public javajs.util.P4 hklParameter(int i) throws ScriptException
ScriptException
public javajs.util.P4 getHklPlane(javajs.util.P3 pt)
public int getMadParameter() throws ScriptException
ScriptException
private int getSetAxesTypeMad(int index) throws ScriptException
ScriptException
public boolean isColorParam(int i)
public int getArgbParam(int index) throws ScriptException
ScriptException
private int getArgbParamLast(int index, boolean allowNone) throws ScriptException
ScriptException
private int getArgbParamOrNone(int index, boolean allowNone) throws ScriptException
ScriptException
private int getColorTriad(int i) throws ScriptException
ScriptException
public boolean isPoint3f(int i)
public javajs.util.P3 getPoint3f(int i, boolean allowFractional) throws ScriptException
ScriptException
public javajs.util.P4 getPoint4f(int i) throws ScriptException
ScriptException
private Object getPointOrPlane(int index, boolean integerOnly, boolean allowFractional, boolean doConvert, boolean implicitFractional, int minDim, int maxDim) throws ScriptException
ScriptException
public javajs.util.P3 xypParameter(int index) throws ScriptException
ScriptException
private boolean isCommandDisplayable(int i)
i
- private boolean checkContinue() throws ScriptException
ScriptException
public void notifyResumeStatus()
notifyResumeStatus
in interface JmolScriptEvaluator
private void doDelay(int millis) throws ScriptException
millis
- negative here bypasses max checkScriptException
public boolean dispatchCommands(boolean isSpt, boolean fromFunc) throws ScriptException
isSpt
- fromFunc
- ScriptException
private void commandLoop(boolean fromFunc) throws ScriptException
ScriptException
private void cache() throws ScriptException
ScriptException
public void setCursorWait(boolean TF)
private void processShapeCommand(int tok) throws ScriptException
ScriptException
JmolScriptExtension getExtension()
private boolean flowControl(int tok, boolean isForCheck, javajs.util.List<T[]> vProcess) throws ScriptException
ScriptException
private void gotoCmd(String strTo) throws ScriptException
ScriptException
private void breakCmd(int pt)
private void addProcess(javajs.util.List<T[]> vProcess, int pc, int pt)
private int switchCmd(ContextToken c, int tok) throws ScriptException
ScriptException
private boolean ifCmd() throws ScriptException
ScriptException
private void returnCmd(SV tv) throws ScriptException
ScriptException
private void help() throws ScriptException
ScriptException
private void move() throws ScriptException
ScriptException
private void moveto() throws ScriptException
ScriptException
private void bondorder() throws ScriptException
ScriptException
private void console() throws ScriptException
ScriptException
private void centerAt() throws ScriptException
ScriptException
private void stereo() throws ScriptException
ScriptException
private void connect(int index) throws ScriptException
index
- 0 is this is the hbond commandScriptException
private float getTranslucentLevel(int i) throws ScriptException
ScriptException
private void getProperty() throws ScriptException
ScriptException
private void background(int i) throws ScriptException
ScriptException
private void center(int i) throws ScriptException
ScriptException
public String setObjectProperty() throws ScriptException
ScriptException
public String setObjectPropSafe(String id, int tokCommand, int iTok)
setObjectPropSafe
in interface JmolScriptEvaluator
public String setObjectProp(String id, int tokCommand, int iTok) throws ScriptException
ScriptException
private void color() throws ScriptException
ScriptException
private boolean changeElementColor(String str, int argb)
private void colorShape(int shapeType, int index, boolean isBackground) throws ScriptException
ScriptException
public void setShapeTranslucency(int shapeType, String prefix, String translucency, float translucentLevel, BS bs)
private void cd() throws ScriptException
ScriptException
private void define() throws ScriptException
ScriptException
private void echo(int index, String id, boolean isImage) throws ScriptException
ScriptException
private void message() throws ScriptException
ScriptException
private void log() throws ScriptException
ScriptException
private void label(int index) throws ScriptException
ScriptException
private void hover() throws ScriptException
ScriptException
public void load() throws ScriptException
ScriptException
public String loadFileAsync(String prefix, String filename, int i, boolean doClear) throws ScriptException
prefix
- filename
- or null if end of LOAD command and now just clearing out cachei
- doClear
- ensures only one file is in the cache for a given typeScriptException
private void logLoadInfo(String msg)
public String getFullPathName() throws ScriptException
ScriptException
private boolean pause() throws ScriptException
ScriptException
private void print() throws ScriptException
ScriptException
private void prompt() throws ScriptException
ScriptException
public void refresh()
private void reset() throws ScriptException
ScriptException
private void restrict() throws ScriptException
ScriptException
private void restrictSelected(boolean isBond, boolean doInvert)
private void rotate(boolean isSpin, boolean isSelected) throws ScriptException
ScriptException
private Quaternion getQuaternionParameter(int i) throws ScriptException
ScriptException
public javajs.util.List<javajs.util.P3> getPointVector(T t, int i) throws ScriptException
ScriptException
private javajs.util.P3 getObjectCenter(String axisID, int index, int modelIndex)
private javajs.util.P3[] getObjectBoundingBox(String id)
private javajs.util.V3 getDrawObjectAxis(String axisID, int index)
public void script(int tok, String filename, String theScript) throws ScriptException
ScriptException
private void function() throws ScriptException
ScriptException
private void sync() throws ScriptException
ScriptException
private void history(int pt) throws ScriptException
ScriptException
private void display(boolean isDisplay) throws ScriptException
ScriptException
private void delete() throws ScriptException
ScriptException
private void select(int i) throws ScriptException
ScriptException
private void subset() throws ScriptException
ScriptException
private void invertSelected() throws ScriptException
ScriptException
private void translate(boolean isSelected) throws ScriptException
ScriptException
private void zap(boolean isZapCommand) throws ScriptException
ScriptException
private void zoom(boolean isZoomTo) throws ScriptException
ScriptException
private float getZoom(int ptCenter, int i, BS bs, float currentZoom) throws ScriptException
ScriptException
private void delay() throws ScriptException
ScriptException
private void slab(boolean isDepth) throws ScriptException
ScriptException
private void ellipsoid() throws ScriptException
ScriptException
public String getShapeNameParameter(int i) throws ScriptException
ScriptException
public String setShapeId(int iShape, int i, boolean idSeen) throws ScriptException
ScriptException
private void setAtomShapeSize(int shape, float scale) throws ScriptException
ScriptException
public RadiusData encodeRadiusParameter(int index, boolean isOnly, boolean allowAbsolute) throws ScriptException
ScriptException
private void structure() throws ScriptException
ScriptException
private void wireframe() throws ScriptException
ScriptException
private void ssbond() throws ScriptException
ScriptException
private void hbond() throws ScriptException
ScriptException
private void vector() throws ScriptException
ScriptException
private void vibration() throws ScriptException
ScriptException
private void dots(int iShape) throws ScriptException
ScriptException
private void proteinShape(int shapeType) throws ScriptException
ScriptException
private void animation() throws ScriptException
ScriptException
private void assign() throws ScriptException
ScriptException
private void file() throws ScriptException
ScriptException
private void fixed() throws ScriptException
ScriptException
private void model(int offset) throws ScriptException
ScriptException
BS bitSetForModelFileNumber(int m)
private void frameControl(int i) throws ScriptException
ScriptException
private int getShapeType(int tok) throws ScriptException
ScriptException
private void font(int shapeType, float fontsize) throws ScriptException
ScriptException
private void set() throws ScriptException
ScriptException
private void setZslab() throws ScriptException
ScriptException
private void setBondmode() throws ScriptException
ScriptException
private void setEcho() throws ScriptException
ScriptException
private int intSetting(int pt) throws ScriptException
ScriptException
private float floatSetting(int pt) throws ScriptException
ScriptException
private String stringSetting(int pt, boolean isJmolSet) throws ScriptException
ScriptException
private boolean setLabel(String str) throws ScriptException
ScriptException
private void setMonitor() throws ScriptException
ScriptException
private boolean setUnits(String units, int tok) throws ScriptException
ScriptException
private void setSsbond() throws ScriptException
ScriptException
private void setHbond() throws ScriptException
ScriptException
private void setPicking() throws ScriptException
ScriptException
private void setPickingStyle() throws ScriptException
ScriptException
private void timeout(int index) throws ScriptException
ScriptException
private void setUserColors() throws ScriptException
ScriptException
private void setVariable(int pt, int ptMax, String key, int setType) throws ScriptException
pt
- ptMax
- key
- setType
- ScriptException
private void axes(int index) throws ScriptException
ScriptException
private void boundbox(int index) throws ScriptException
ScriptException
public TickInfo checkTicks(int index, boolean allowUnitCell, boolean allowScale, boolean allowFirst) throws ScriptException
index
- allowUnitCell
- IGNOREDallowScale
- allowFirst
- ScriptException
private void unitcell(int index) throws ScriptException
ScriptException
private void frank(int index) throws ScriptException
ScriptException
private void selectionHalo(int pt) throws ScriptException
ScriptException
private void save() throws ScriptException
ScriptException
private void restore() throws ScriptException
ScriptException
public float getColorTrans(int i, boolean allowNone) throws ScriptException
i
- allowNone
- ScriptException
public void finalizeObject(int shapeID, int colorArgb, float translucentLevel, int intScale, boolean doSet, Object data, int iptDisplayProperty, BS bs) throws ScriptException
ScriptException
public String getColorRange(int i) throws ScriptException
ScriptException
public boolean setMeshDisplayProperty(int shape, int i, int tok) throws ScriptException
shape
- i
- tok
- ScriptException
private void bind() throws ScriptException
ScriptException
private void unbind() throws ScriptException
ScriptException
private void undoRedoMove() throws ScriptException
ScriptException
static int getFloatEncodedInt(String strDecimal)
strDecimal
- static int getPartialBondOrderFromFloatEncodedInt(int bondOrderInteger)
bondOrderInteger
- public static int getBondOrderFromString(String s)
private static int getPartialBondOrderFromString(String s)
public BS addHydrogensInline(BS bsAtoms, javajs.util.List<Atom> vConnections, javajs.util.P3[] pts) throws Exception
addHydrogensInline
in interface JmolScriptEvaluator
Exception
public void stopScriptThreads()
stopScriptThreads
in interface JmolScriptEvaluator
public void delayScript(int millis)
public String getErrorLineMessage2()
public boolean evaluateParallel(ScriptContext context, ShapeManager shapeManager)
evaluateParallel
in interface JmolScriptEvaluator