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 JmolScriptEvaluatorpublic JmolScriptEvaluator setViewer(Viewer viewer)
setViewer in interface JmolScriptEvaluatorpublic void setCompiler()
setCompiler in interface JmolScriptEvaluatorpublic boolean compileScriptString(String script, boolean tQuiet)
compileScriptString in interface JmolScriptEvaluatorpublic boolean compileScriptFile(String filename, boolean tQuiet)
compileScriptFile in interface JmolScriptEvaluatorpublic 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 JmolScriptEvaluatorpublic boolean useThreads()
private void startEval()
private void executeCommands(boolean isTry)
public void resumeEval(ScriptContext sc)
resumeEval in interface JmolScriptEvaluatorsc - public void runScript(String script) throws ScriptException
runScript in interface JmolScriptEvaluatorScriptExceptionpublic void runScriptBuffer(String script, javajs.util.SB outputBuffer) throws ScriptException
runScriptBuffer in interface JmolScriptEvaluatorscript - outputBuffer - ScriptExceptionpublic ScriptContext checkScriptSilent(String script)
checkScriptSilent in interface JmolScriptEvaluatorscript - static javajs.util.SB getContextTrace(Viewer viewer, ScriptContext sc, javajs.util.SB sb, boolean isTop)
public void setDebugging()
setDebugging in interface JmolScriptEvaluatorprivate int getExecutionWalltime()
public void haltExecution()
haltExecution in interface JmolScriptEvaluatorpublic void pauseExecution(boolean withDelay)
pauseExecution in interface JmolScriptEvaluatorpublic void stepPausedExecution()
stepPausedExecution in interface JmolScriptEvaluatorpublic void resumePausedExecution()
resumePausedExecution in interface JmolScriptEvaluatorpublic boolean isExecuting()
isExecuting in interface JmolScriptEvaluatorpublic boolean isPaused()
isPaused in interface JmolScriptEvaluatorpublic boolean isStepping()
isStepping in interface JmolScriptEvaluatorpublic boolean isStopped()
isStopped in interface JmolScriptEvaluatorpublic String getNextStatement()
getNextStatement in interface JmolScriptEvaluatorprivate 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 JmolScriptEvaluatorexpr - asVariable - public BS getAtomBitSet(Object atomExpression)
getAtomBitSet in interface JmolScriptEvaluatoratomExpression - public javajs.util.List<Integer> getAtomBitSetVector(int atomCount, Object atomExpression)
getAtomBitSetVector in interface JmolScriptEvaluatoratomCount - atomExpression - private javajs.util.List<SV> parameterExpressionList(int pt, int ptAtom, boolean isArrayItem) throws ScriptException
ScriptExceptionprivate String parameterExpressionString(int pt, int ptMax) throws ScriptException
ScriptExceptionprivate boolean parameterExpressionBoolean(int pt,
int ptMax)
throws ScriptException
ScriptExceptionprivate SV parameterExpressionToken(int pt) throws ScriptException
ScriptExceptionprivate 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
ScriptExceptionprivate SV getBitsetPropertySelector(int i, boolean mustBeSettable) throws ScriptException
ScriptExceptionpublic float[] getBitsetPropertyFloat(BS bs, int tok, float min, float max) throws ScriptException
ScriptExceptionpublic 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
ScriptExceptionprivate void setBitsetProperty(BS bs, int tok, int iValue, float fValue, T tokenValue) throws ScriptException
ScriptExceptionpublic Map<String,Object> getDefinedAtomSets()
getDefinedAtomSets in interface JmolScriptEvaluatorpublic Map<String,SV> getContextVariables()
getContextVariables in interface JmolScriptEvaluatorpublic String getScript()
getScript in interface JmolScriptEvaluatorpublic 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 JmolScriptEvaluatorpublic SV runFunctionRet(JmolScriptFunction function, String name, javajs.util.List<SV> params, SV tokenAtom, boolean getReturn, boolean setContextPath, boolean allowThreads) throws ScriptException
ScriptExceptionprivate void processTry(Map<String,SV> cv) throws ScriptException
ScriptExceptionprivate void restoreFunction(JmolScriptFunction f, javajs.util.List<SV> params, SV tokenAtom) throws ScriptException
f - params - tokenAtom - ScriptExceptionpublic void clearDefinedVariableAtomSets()
private void defineSets()
private void defineAtomSet(String script)
public BS lookupIdentifierValue(String identifier) throws ScriptException
ScriptExceptionprivate BS lookupValue(String setName, boolean plurals) throws ScriptException
ScriptExceptionpublic void deleteAtomsInVariables(BS bsDeleted)
deleteAtomsInVariables in interface JmolScriptEvaluatorprivate boolean setStatement(int pc)
throws ScriptException
pc - ScriptExceptionprivate void clearState(boolean tQuiet)
public ScriptContext getThisContext()
getThisContext in interface JmolScriptEvaluatorpublic void pushContextDown(String why)
pushContextDown in interface JmolScriptEvaluatorprivate void pushContext(ContextToken token, String why) throws ScriptException
ScriptExceptionprivate void pushContext2(ContextToken token, String why)
public ScriptContext getScriptContext(String why)
getScriptContext in interface JmolScriptEvaluatorvoid 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 JmolScriptEvaluatorpublic String getErrorMessage()
getErrorMessage in interface JmolScriptEvaluatorpublic String getErrorMessageUntranslated()
getErrorMessageUntranslated in interface JmolScriptEvaluatorprivate void setErrorMessage(String err)
private void planeExpected()
throws ScriptException
ScriptExceptionpublic void integerOutOfRange(int min,
int max)
throws ScriptException
ScriptExceptionprivate void numberOutOfRange(float min,
float max)
throws ScriptException
ScriptExceptionvoid errorAt(int iError,
int i)
throws ScriptException
ScriptExceptionprivate void invArg()
throws ScriptException
ScriptExceptionpublic void error(int iError)
throws ScriptException
ScriptExceptionpublic void errorStr(int iError,
String value)
throws ScriptException
ScriptExceptionpublic void errorStr2(int iError,
String value,
String more)
throws ScriptException
ScriptExceptionvoid errorMore(int iError,
String value,
String more,
String more2)
throws ScriptException
ScriptExceptionprivate void warning(int iError,
String value,
String more)
throws ScriptException
ScriptExceptionvoid errorOrWarn(int iError,
String value,
String more,
String more2,
boolean warningOnly)
throws ScriptException
ScriptExceptionpublic void evalError(String message, String strUntranslated) throws ScriptException
ScriptExceptionstatic 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
ScriptExceptionpublic 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 - IGNOREDScriptExceptionprivate 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
ScriptExceptionpublic BS compareInt(int tokWhat, int tokOperator, int comparisonValue)
private boolean compareStringValues(int tokOperator,
String propertyValue,
String comparisonValue)
throws ScriptException
ScriptExceptionprivate static boolean compareFloat(int tokOperator,
float propertyFloat,
float comparisonFloat)
private static int getSeqCode(T instruction)
public int checkLast(int i)
throws ScriptException
ScriptExceptionpublic int checkLength(int length)
throws ScriptException
ScriptExceptionprivate int checkLengthErrorPt(int length,
int errorPt)
throws ScriptException
ScriptExceptionpublic int checkLength23()
throws ScriptException
ScriptExceptionprivate int checkLength34()
throws ScriptException
ScriptExceptionpublic T getToken(int i) throws ScriptException
ScriptExceptionpublic int tokAt(int i)
private boolean checkToken(int i)
public int modelNumberParameter(int index)
throws ScriptException
ScriptExceptionpublic String optParameterAsString(int i) throws ScriptException
ScriptExceptionpublic String parameterAsString(int i) throws ScriptException
ScriptExceptionpublic int intParameter(int index)
throws ScriptException
ScriptExceptionpublic int intParameterRange(int i,
int min,
int max)
throws ScriptException
ScriptExceptionpublic boolean isFloatParameter(int index)
private float floatParameterRange(int i,
float min,
float max)
throws ScriptException
ScriptExceptionpublic float floatParameter(int index)
throws ScriptException
ScriptExceptionpublic javajs.util.List<Object> listParameter(int i, int nMin, int nMax) throws ScriptException
ScriptExceptionpublic float[] floatParameterSet(int i,
int nMin,
int nMax)
throws ScriptException
i - nMin - nMax - ScriptExceptionpublic boolean isArrayParameter(int i)
public javajs.util.P3[] getPointArray(int i,
int nPoints)
throws ScriptException
ScriptExceptionpublic String stringParameter(int index) throws ScriptException
ScriptExceptionpublic String[] stringParameterSet(int i) throws ScriptException
ScriptExceptionpublic String objectNameParameter(int index) throws ScriptException
ScriptExceptionprivate boolean booleanParameter(int i)
throws ScriptException
ScriptExceptionprivate javajs.util.P3 atomCenterOrCoordinateParameter(int i)
throws ScriptException
ScriptExceptionpublic boolean isCenterParameter(int i)
public javajs.util.P3 centerParameter(int i)
throws ScriptException
ScriptExceptionprivate javajs.util.P3 centerParameterForModel(int i,
int modelIndex)
throws ScriptException
ScriptExceptionpublic javajs.util.P4 planeParameter(int i)
throws ScriptException
ScriptExceptionpublic javajs.util.P4 hklParameter(int i)
throws ScriptException
ScriptExceptionpublic javajs.util.P4 getHklPlane(javajs.util.P3 pt)
public int getMadParameter()
throws ScriptException
ScriptExceptionprivate int getSetAxesTypeMad(int index)
throws ScriptException
ScriptExceptionpublic boolean isColorParam(int i)
public int getArgbParam(int index)
throws ScriptException
ScriptExceptionprivate int getArgbParamLast(int index,
boolean allowNone)
throws ScriptException
ScriptExceptionprivate int getArgbParamOrNone(int index,
boolean allowNone)
throws ScriptException
ScriptExceptionprivate int getColorTriad(int i)
throws ScriptException
ScriptExceptionpublic boolean isPoint3f(int i)
public javajs.util.P3 getPoint3f(int i,
boolean allowFractional)
throws ScriptException
ScriptExceptionpublic javajs.util.P4 getPoint4f(int i)
throws ScriptException
ScriptExceptionprivate Object getPointOrPlane(int index, boolean integerOnly, boolean allowFractional, boolean doConvert, boolean implicitFractional, int minDim, int maxDim) throws ScriptException
ScriptExceptionpublic javajs.util.P3 xypParameter(int index)
throws ScriptException
ScriptExceptionprivate boolean isCommandDisplayable(int i)
i - private boolean checkContinue()
throws ScriptException
ScriptExceptionpublic void notifyResumeStatus()
notifyResumeStatus in interface JmolScriptEvaluatorprivate void doDelay(int millis)
throws ScriptException
millis - negative here bypasses max checkScriptExceptionpublic boolean dispatchCommands(boolean isSpt,
boolean fromFunc)
throws ScriptException
isSpt - fromFunc - ScriptExceptionprivate void commandLoop(boolean fromFunc)
throws ScriptException
ScriptExceptionprivate void cache()
throws ScriptException
ScriptExceptionpublic void setCursorWait(boolean TF)
private void processShapeCommand(int tok)
throws ScriptException
ScriptExceptionJmolScriptExtension getExtension()
private boolean flowControl(int tok,
boolean isForCheck,
javajs.util.List<T[]> vProcess)
throws ScriptException
ScriptExceptionprivate void gotoCmd(String strTo) throws ScriptException
ScriptExceptionprivate 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
ScriptExceptionprivate boolean ifCmd()
throws ScriptException
ScriptExceptionprivate void returnCmd(SV tv) throws ScriptException
ScriptExceptionprivate void help()
throws ScriptException
ScriptExceptionprivate void move()
throws ScriptException
ScriptExceptionprivate void moveto()
throws ScriptException
ScriptExceptionprivate void bondorder()
throws ScriptException
ScriptExceptionprivate void console()
throws ScriptException
ScriptExceptionprivate void centerAt()
throws ScriptException
ScriptExceptionprivate void stereo()
throws ScriptException
ScriptExceptionprivate void connect(int index)
throws ScriptException
index - 0 is this is the hbond commandScriptExceptionprivate float getTranslucentLevel(int i)
throws ScriptException
ScriptExceptionprivate void getProperty()
throws ScriptException
ScriptExceptionprivate void background(int i)
throws ScriptException
ScriptExceptionprivate void center(int i)
throws ScriptException
ScriptExceptionpublic String setObjectProperty() throws ScriptException
ScriptExceptionpublic String setObjectPropSafe(String id, int tokCommand, int iTok)
setObjectPropSafe in interface JmolScriptEvaluatorpublic String setObjectProp(String id, int tokCommand, int iTok) throws ScriptException
ScriptExceptionprivate void color()
throws ScriptException
ScriptExceptionprivate boolean changeElementColor(String str, int argb)
private void colorShape(int shapeType,
int index,
boolean isBackground)
throws ScriptException
ScriptExceptionpublic void setShapeTranslucency(int shapeType,
String prefix,
String translucency,
float translucentLevel,
BS bs)
private void cd()
throws ScriptException
ScriptExceptionprivate void define()
throws ScriptException
ScriptExceptionprivate void echo(int index,
String id,
boolean isImage)
throws ScriptException
ScriptExceptionprivate void message()
throws ScriptException
ScriptExceptionprivate void log()
throws ScriptException
ScriptExceptionprivate void label(int index)
throws ScriptException
ScriptExceptionprivate void hover()
throws ScriptException
ScriptExceptionpublic void load()
throws ScriptException
ScriptExceptionpublic 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 typeScriptExceptionprivate void logLoadInfo(String msg)
public String getFullPathName() throws ScriptException
ScriptExceptionprivate boolean pause()
throws ScriptException
ScriptExceptionprivate void print()
throws ScriptException
ScriptExceptionprivate void prompt()
throws ScriptException
ScriptExceptionpublic void refresh()
private void reset()
throws ScriptException
ScriptExceptionprivate void restrict()
throws ScriptException
ScriptExceptionprivate void restrictSelected(boolean isBond,
boolean doInvert)
private void rotate(boolean isSpin,
boolean isSelected)
throws ScriptException
ScriptExceptionprivate Quaternion getQuaternionParameter(int i) throws ScriptException
ScriptExceptionpublic javajs.util.List<javajs.util.P3> getPointVector(T t, int i) throws ScriptException
ScriptExceptionprivate 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
ScriptExceptionprivate void function()
throws ScriptException
ScriptExceptionprivate void sync()
throws ScriptException
ScriptExceptionprivate void history(int pt)
throws ScriptException
ScriptExceptionprivate void display(boolean isDisplay)
throws ScriptException
ScriptExceptionprivate void delete()
throws ScriptException
ScriptExceptionprivate void select(int i)
throws ScriptException
ScriptExceptionprivate void subset()
throws ScriptException
ScriptExceptionprivate void invertSelected()
throws ScriptException
ScriptExceptionprivate void translate(boolean isSelected)
throws ScriptException
ScriptExceptionprivate void zap(boolean isZapCommand)
throws ScriptException
ScriptExceptionprivate void zoom(boolean isZoomTo)
throws ScriptException
ScriptExceptionprivate float getZoom(int ptCenter,
int i,
BS bs,
float currentZoom)
throws ScriptException
ScriptExceptionprivate void delay()
throws ScriptException
ScriptExceptionprivate void slab(boolean isDepth)
throws ScriptException
ScriptExceptionprivate void ellipsoid()
throws ScriptException
ScriptExceptionpublic String getShapeNameParameter(int i) throws ScriptException
ScriptExceptionpublic String setShapeId(int iShape, int i, boolean idSeen) throws ScriptException
ScriptExceptionprivate void setAtomShapeSize(int shape,
float scale)
throws ScriptException
ScriptExceptionpublic RadiusData encodeRadiusParameter(int index, boolean isOnly, boolean allowAbsolute) throws ScriptException
ScriptExceptionprivate void structure()
throws ScriptException
ScriptExceptionprivate void wireframe()
throws ScriptException
ScriptExceptionprivate void ssbond()
throws ScriptException
ScriptExceptionprivate void hbond()
throws ScriptException
ScriptExceptionprivate void vector()
throws ScriptException
ScriptExceptionprivate void vibration()
throws ScriptException
ScriptExceptionprivate void dots(int iShape)
throws ScriptException
ScriptExceptionprivate void proteinShape(int shapeType)
throws ScriptException
ScriptExceptionprivate void animation()
throws ScriptException
ScriptExceptionprivate void assign()
throws ScriptException
ScriptExceptionprivate void file()
throws ScriptException
ScriptExceptionprivate void fixed()
throws ScriptException
ScriptExceptionprivate void model(int offset)
throws ScriptException
ScriptExceptionBS bitSetForModelFileNumber(int m)
private void frameControl(int i)
throws ScriptException
ScriptExceptionprivate int getShapeType(int tok)
throws ScriptException
ScriptExceptionprivate void font(int shapeType,
float fontsize)
throws ScriptException
ScriptExceptionprivate void set()
throws ScriptException
ScriptExceptionprivate void setZslab()
throws ScriptException
ScriptExceptionprivate void setBondmode()
throws ScriptException
ScriptExceptionprivate void setEcho()
throws ScriptException
ScriptExceptionprivate int intSetting(int pt)
throws ScriptException
ScriptExceptionprivate float floatSetting(int pt)
throws ScriptException
ScriptExceptionprivate String stringSetting(int pt, boolean isJmolSet) throws ScriptException
ScriptExceptionprivate boolean setLabel(String str) throws ScriptException
ScriptExceptionprivate void setMonitor()
throws ScriptException
ScriptExceptionprivate boolean setUnits(String units, int tok) throws ScriptException
ScriptExceptionprivate void setSsbond()
throws ScriptException
ScriptExceptionprivate void setHbond()
throws ScriptException
ScriptExceptionprivate void setPicking()
throws ScriptException
ScriptExceptionprivate void setPickingStyle()
throws ScriptException
ScriptExceptionprivate void timeout(int index)
throws ScriptException
ScriptExceptionprivate void setUserColors()
throws ScriptException
ScriptExceptionprivate void setVariable(int pt,
int ptMax,
String key,
int setType)
throws ScriptException
pt - ptMax - key - setType - ScriptExceptionprivate void axes(int index)
throws ScriptException
ScriptExceptionprivate void boundbox(int index)
throws ScriptException
ScriptExceptionpublic TickInfo checkTicks(int index, boolean allowUnitCell, boolean allowScale, boolean allowFirst) throws ScriptException
index - allowUnitCell - IGNOREDallowScale - allowFirst - ScriptExceptionprivate void unitcell(int index)
throws ScriptException
ScriptExceptionprivate void frank(int index)
throws ScriptException
ScriptExceptionprivate void selectionHalo(int pt)
throws ScriptException
ScriptExceptionprivate void save()
throws ScriptException
ScriptExceptionprivate void restore()
throws ScriptException
ScriptExceptionpublic float getColorTrans(int i,
boolean allowNone)
throws ScriptException
i - allowNone - ScriptExceptionpublic void finalizeObject(int shapeID,
int colorArgb,
float translucentLevel,
int intScale,
boolean doSet,
Object data,
int iptDisplayProperty,
BS bs)
throws ScriptException
ScriptExceptionpublic String getColorRange(int i) throws ScriptException
ScriptExceptionpublic boolean setMeshDisplayProperty(int shape,
int i,
int tok)
throws ScriptException
shape - i - tok - ScriptExceptionprivate void bind()
throws ScriptException
ScriptExceptionprivate void unbind()
throws ScriptException
ScriptExceptionprivate void undoRedoMove()
throws ScriptException
ScriptExceptionstatic 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 JmolScriptEvaluatorExceptionpublic void stopScriptThreads()
stopScriptThreads in interface JmolScriptEvaluatorpublic void delayScript(int millis)
public String getErrorLineMessage2()
public boolean evaluateParallel(ScriptContext context, ShapeManager shapeManager)
evaluateParallel in interface JmolScriptEvaluator