Package org.jmol.script
Class ScriptEval
- java.lang.Object
-
- org.jmol.script.ScriptError
-
- org.jmol.script.ScriptParam
-
- org.jmol.script.ScriptExpr
-
- org.jmol.script.ScriptEval
-
- All Implemented Interfaces:
JmolScriptEvaluator
public class ScriptEval extends ScriptExpr
-
-
Field Summary
-
Fields inherited from class org.jmol.script.ScriptExpr
debugHigh, tempStatement
-
Fields inherited from class org.jmol.script.ScriptParam
contextVariables, coordinatesAreFractional, fractionalPoint, isBondSet, iToken, pt1, pt2, pt3, slen, st, theTok, theToken, thisContext
-
Fields inherited from class org.jmol.script.ScriptError
chk, error, ERROR_axisExpected, ERROR_backgroundModelError, ERROR_badArgumentCount, ERROR_badMillerIndices, ERROR_badRGBColor, ERROR_booleanExpected, ERROR_booleanOrNumberExpected, ERROR_booleanOrWhateverExpected, ERROR_cannotSet, ERROR_colorExpected, ERROR_colorOrPaletteRequired, ERROR_commandExpected, ERROR_coordinateOrNameOrExpressionRequired, ERROR_drawObjectNotDefined, ERROR_endOfStatementUnexpected, ERROR_expressionExpected, ERROR_expressionOrIntegerExpected, ERROR_filenameExpected, ERROR_fileNotFoundException, ERROR_incompatibleArguments, ERROR_insufficientArguments, ERROR_integerExpected, ERROR_integerOutOfRange, ERROR_invalidArgument, ERROR_invalidParameterOrder, ERROR_keywordExpected, ERROR_moCoefficients, ERROR_moIndex, ERROR_moModelError, ERROR_moOccupancy, ERROR_moOnlyOne, ERROR_multipleModelsDisplayedNotOK, ERROR_multipleModelsNotOK, ERROR_noData, ERROR_noPartialCharges, ERROR_noUnitCell, ERROR_numberExpected, ERROR_numberMustBe, ERROR_numberOutOfRange, ERROR_objectNameExpected, ERROR_planeExpected, ERROR_propertyNameExpected, ERROR_spaceGroupNotFound, ERROR_stringExpected, ERROR_stringOrIdentifierExpected, ERROR_tooManyPoints, ERROR_tooManyScriptLevels, ERROR_unrecognizedAtomProperty, ERROR_unrecognizedBondProperty, ERROR_unrecognizedCommand, ERROR_unrecognizedExpression, ERROR_unrecognizedObject, ERROR_unrecognizedParameter, ERROR_unrecognizedParameterWarning, ERROR_unrecognizedShowParameter, ERROR_what, ERROR_writeWhat, errorMessage, errorMessageUntranslated, errorType, iCommandError, ignoreError, vwr
-
-
Constructor Summary
Constructors Constructor Description ScriptEval()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addFilterAttribute(Map<String,Object> htParams, String filter, String key)
private int
addLoadData(javajs.util.SB loadScript, String key, Map<String,Object> htParams, int i)
private void
addProcess(javajs.util.Lst<T[]> vProcess, int pc, int pt)
private void
appendBuffer(String str, boolean mustDo)
private void
breakAt(int pt)
private boolean
checkContinue()
checks to see if there is a pause condition, during which commands can still be issued, but with the ! first.private void
checkExtension(int tok)
String
checkFileExists(String prefix, boolean isAsync, String filename, int i, boolean doClear)
ScriptContext
checkScriptSilent(String script)
a method for just checking a scriptboolean
checkSelect(Map<String,SV> h, T[] where)
Check a map for a WHERE phrasevoid
clearDefinedVariableAtomSets()
private void
clearState(boolean tQuiet)
private void
cmdAnimation()
private void
cmdAxes(int index)
private void
cmdBackground(int i)
private void
cmdBind()
private void
cmdBondorder()
private void
cmdBoundbox(int index)
private void
cmdCD()
private void
cmdCenter(int i)
private void
cmdColor()
private void
cmdDefine()
private void
cmdDelay()
private void
cmdDelete()
private void
cmdDisplay(boolean isDisplay)
private void
cmdDots(int iShape)
private void
cmdEcho(int index)
private void
cmdFile()
private void
cmdFixed()
private boolean
cmdFlow(int tok, boolean isForCheck, javajs.util.Lst<T[]> vProcess)
private int
cmdFlowSwitch(ContextToken c, int tok)
private void
cmdFont(int shapeType, float fontsize)
private boolean
cmdFor(int tok, boolean isForCheck)
private void
cmdFrank(int i)
private void
cmdFunc()
private void
cmdGetProperty()
private void
cmdGoto(boolean isCmd)
private void
cmdHbond()
private void
cmdHelp()
private void
cmdHistory(int pt)
private void
cmdHover()
private void
cmdLabel(int index, javajs.util.BS bs)
void
cmdLoad()
private void
cmdLog()
private void
cmdLoop()
private void
cmdMessage()
private void
cmdModel(int offset)
ONE difference between FRAME and MODEL: model 1 sets model NAMED one in the case of PDB frame 1 always sets the first modelprivate void
cmdMove()
private void
cmdMoveto()
private boolean
cmdPause()
private void
cmdPrint()
private void
cmdPrompt()
private void
cmdReset()
private void
cmdRestore()
private void
cmdRestrict()
private void
cmdReturn(SV tv)
void
cmdRotate(boolean isSpin, boolean isSelected)
private void
cmdSave()
void
cmdScript(int tok, String filename, String theScript)
private void
cmdSelect(int i)
private void
cmdSelectionHalos(int pt)
private void
cmdSet()
private void
cmdSetEcho()
private boolean
cmdSetLabel(String str)
private void
cmdSetPicking()
private void
cmdSetPickingStyle()
private void
cmdSlab(boolean isDepth)
private void
cmdSsbond()
private void
cmdStructure()
private void
cmdSubset()
private void
cmdSync()
private void
cmdThrow()
private void
cmdTimeout(int index)
private void
cmdTranslate(boolean isSelected)
private void
cmdUnbind()
private void
cmdUndoRedoMove()
private void
cmdUnitcell(int i)
private void
cmdVector()
private void
cmdVibration()
private void
cmdWireframe()
private void
cmdZap(boolean isZapCommand)
private void
cmdZoom(boolean isZoomTo)
private void
colorShape(int shapeType, int index, boolean isBackground)
private void
commandLoop(boolean allowJSInterrupt)
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
defineAtomSet(String script)
private void
defineSets()
support for @xxx or define xxx commandsvoid
delayScript(int millis)
void
deleteAtomsInVariables(javajs.util.BS bsDeleted)
boolean
dispatchCommands(boolean isSpt, boolean fromFunc, boolean isTry)
private void
doDelay(int millis)
boolean
doReport()
RadiusData
encodeRadiusParameter(int index, boolean isOnly, boolean allowAbsolute)
float
evalFunctionFloat(Object func, Object params, float[] values)
boolean
evalParallel(ScriptContext context, ShapeManager shapeManager)
private Object
evaluate(Object expr, boolean asVariable, boolean compileOnly)
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, boolean compileOnly)
a general-use method to evaluate a "SET" type expression.private void
executeCommands(boolean isTry, boolean reportCompletion)
int[]
expandFloatArray(float[] a, int min)
Accepts a float array and expands [1 -3] to [1 2 3], for example.private void
finalizeLoad(boolean isAppend, boolean appendNew, boolean isConcat, boolean doOrient, int nFiles, int ac0, int modelCount0)
private String
fixScriptPath(String strScript, String filename)
private void
frameControl(int i)
boolean
getAllowJSThreads()
javajs.util.BS
getAtomBitSet(Object atomExpression)
A general method to evaluate a string representing an atom set.String
getColorRange(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 vwr, ScriptContext sc, javajs.util.SB sb, boolean isTop)
String
getErrorLineMessage2()
String
getFullPathName()
int
getLinenumber(ScriptContext c)
private String
getLoadFilesList(int i, javajs.util.SB loadScript, javajs.util.SB sOptions, Map<String,Object> htParams, javajs.util.Lst<String> fNames)
private int
getLoadModelIndex(int i, javajs.util.SB sOptions, Map<String,Object> htParams)
String
getNextStatement()
when paused, indicates what statement will be nextprivate javajs.util.P3[]
getObjectBoundingBox(String id)
protected javajs.util.P3
getObjectCenter(String axisID, int index, int modelIndex)
void
getPartialCharges(javajs.util.BS bs)
protected javajs.util.P4
getPlaneForObject(String id, javajs.util.V3 vAB)
javajs.util.Quat[]
getQuaternionArray(Object quaternionOrSVData, int itype)
String
getScript()
ScriptContext
getScriptContext(String why)
int
getSetAxesTypeMad10(int index)
private float
getSettingFloat(int pt)
private int
getSettingInt(int pt)
private String
getSettingStr(int pt, boolean isJmolSet)
Accept an unquoted string if there is just one parameter regardless of its type.Object
getShapeProperty(int shapeType, String propertyName)
boolean
getShapePropertyData(int shapeType, String propertyName, Object[] data)
private int
getShapeType(int tok)
ScriptContext
getThisContext()
float
getTranslucentLevel(int i)
SV
getUserFunctionResult(String name, javajs.util.Lst<SV> params, SV tokenAtom)
private float
getZoom(int ptCenter, int i, javajs.util.BS bs, float currentZoom)
void
haltExecution()
boolean
isAtomExpression(int i)
private boolean
isCommandDisplayable(int i)
provides support for the script editorboolean
isExecuting()
private boolean
isLoadOption(int tok)
boolean
isPaused()
boolean
isStateScript()
boolean
isStepping()
boolean
isStopped()
private void
loadDssr(int modelIndex, String data)
String
loadFileAsync(String prefix, String filename, int i, boolean doClear)
Allows asynchronous file loading from the LOAD or SCRIPT command.void
loadFileResourceAsync(String fileName)
load a static file asynchronouslyprivate void
loadPNGJVar(String varName, Object o, Map<String,Object> htParams)
private void
logDebugScript(T[] st, int ifLevel)
private void
logLoadInfo(String msg)
javajs.util.BS
lookupIdentifierValue(String identifier)
private javajs.util.BS
lookupValue(String setName, boolean plurals)
void
notifyResumeStatus()
void
pauseExecution(boolean withDelay)
(package private) void
popContext(boolean isFlowCommand, boolean statementOnly)
private void
processCommand(int tok)
private void
processShapeCommand(int tok)
private void
processTry(Map<String,SV> cv)
private void
pushContext(ContextToken token, String why)
private void
pushContext2(ContextToken token, String why)
void
pushContextDown(String why)
void
refresh(boolean doDelay)
Refresh the display NOWvoid
report(String s, boolean isError)
private void
resetError()
private void
restoreFunction(JmolScriptFunction f, javajs.util.Lst<SV> params, SV tokenAtom)
note that functions requiring motion cannot be run in JavaScriptvoid
restoreScriptContext(ScriptContext context, boolean isPopContext, boolean isFlowCommand, boolean statementOnly)
void
restrictSelected(boolean isBond, boolean doInvert)
void
resumeEval(Object sco)
From dispatchCommands and JmolThread resumeEval.void
resumePausedExecution()
private void
resumeViewer(String why)
void
runBufferedSafely(String script, javajs.util.SB outputBuffer)
private SV
runFunctionAndRet(JmolScriptFunction function, String name, javajs.util.Lst<SV> params, SV tokenAtom, boolean getReturn, boolean setContextPath, boolean allowThreads)
void
runScript(String script)
void
runScriptBuffer(String script, javajs.util.SB outputBuffer, boolean isFuncReturn)
runs a script immediately and sends selected output to a provided SBstatic SV
runUserAction(String functionName, Object[] params, Viewer vwr)
private ScriptContext
saveContext(String saveName)
void
setAllowJSThreads(boolean b)
protected void
setAtomProp(String prop, Object value, javajs.util.BS bs)
void
setCompiler()
void
setCurrentCagePts(javajs.util.T3[] originABC, String name)
void
setDebugging()
private boolean
setElementColor(String str, int argb)
void
setException(ScriptException sx, String msg, String untranslated)
private void
setFrameSet(int i)
boolean
setMeshDisplayProperty(int shape, int i, int tok)
private void
setObjectArgb(String str, int argb)
void
setObjectMad10(int iShape, String name, int mad10)
private String
setObjectProp(String id, int tokCommand, int ptColor)
String
setObjectProperty()
String
setObjectPropSafe(String id, int tokCommand)
called by Viewer in setting up a PyMOL scene.private int
setScriptExtensions()
String
setShapeNameParameter(int i)
void
setShapeProperty(int shapeType, String propertyName, Object propertyValue)
void
setShapePropertyBs(int iShape, String propertyName, Object propertyValue, javajs.util.BS bs)
private void
setShapeSize(int shapeType, RadiusData rd)
void
setShapeSizeBs(int shapeType, int size, javajs.util.BS bs)
void
setShapeTranslucency(int shapeType, String prefix, String translucency, float translucentLevel, javajs.util.BS bs)
private void
setSize(int shape, float scale)
private void
setSizeBio(int iShape)
int
setStatic(int tok, int ival)
set a static variable, with checking for rangeprivate boolean
setUnits(String units, int tok)
ScriptEval
setViewer(Viewer vwr)
void
showString(String str)
void
showStringPrint(String s, boolean mustDo)
static String
statementAsString(Viewer vwr, T[] statement, int iTok, boolean doLogMessages)
void
stepPausedExecution()
void
stopScriptThreads()
String
toString()
boolean
useThreads()
-
Methods inherited from class org.jmol.script.ScriptExpr
atomExpression, atomExpressionAt, compareFloat, compareFloatData, getAssocArray, getAtomBits, getBitsetProperty, getCmdExt, getIsoExt, getMathExt, getSeqCode, getSmilesExt, listBS, noCopy, parameterExpressionBoolean, parameterExpressionList, parameterExpressionSelect, parameterExpressionString, parameterExpressionToken, setStatement, setVariable
-
Methods inherited from class org.jmol.script.ScriptParam
atomCenterOrCoordinateParameter, centerParameter, centerParameterForModel, checkLast, checkLength, checkLength23, checkLength34, checkLengthErrorPt, checkToken, floatParameter, floatParameterRange, floatParameterSet, getArgbParam, getArgbParamLast, getArgbParamOrNone, getBondOrderFromString, getContextVariableAsVariable, getFloatEncodedInt, getHklPlane, getMadParameter, getParameter, getPartialBondOrderFromFloatEncodedInt, getPoint3f, getPoint4f, getPointArray, getPointOrCenterVector, getPointOrPlane, getPointVector, getQuaternionParameter, getToken, getVarParameter, hklParameter, intParameter, intParameterRange, isArrayParameter, isCenterParameter, isColorParam, isFloatParameter, isPoint3f, listParameter, listParameter4, modelNumberParameter, objectNameParameter, optParameterAsString, paramAsStr, planeParameter, setBooleanProperty, setFloatProperty, setIntProperty, setStringProperty, stringParameter, stringParameterSet, tickParamAsStr, tokAt, xypParameter, xyzpParameter
-
Methods inherited from class org.jmol.script.ScriptError
bad, error, errorMore, errorStr, errorStr2, errorString, evalError, getErrorLineMessage, getErrorMessage, getErrorMessageUntranslated, integerOutOfRange, invArg, numberOutOfRange, setCursorWait, setErrorMessage, warning
-
-
-
-
Field Detail
-
saveList
private static final String saveList
- See Also:
- Constant Field Values
-
iProcess
private static int iProcess
-
sm
public ShapeManager sm
-
isJS
public boolean isJS
-
scriptDelayThread
private JmolThread scriptDelayThread
-
fileLoadThread
private JmolThread fileLoadThread
-
allowJSThreads
private boolean allowJSThreads
-
isFuncReturn
private boolean isFuncReturn
-
historyDisabled
public boolean historyDisabled
-
debugScript
private boolean debugScript
-
isCmdLine_C_Option
private boolean isCmdLine_C_Option
-
isCmdLine_c_or_C_Option
private boolean isCmdLine_c_or_C_Option
-
listCommands
private boolean listCommands
-
tQuiet
public boolean tQuiet
-
executionStopped
private boolean executionStopped
-
executionPaused
private boolean executionPaused
-
executionStepping
private boolean executionStepping
-
executing
private boolean executing
-
timeBeginExecution
private long timeBeginExecution
-
timeEndExecution
private long timeEndExecution
-
mustResumeEval
private boolean mustResumeEval
-
currentThread
private Thread currentThread
-
compiler
public ScriptCompiler compiler
-
outputBuffer
public javajs.util.SB outputBuffer
-
contextPath
private String contextPath
-
scriptFileName
public String scriptFileName
-
functionName
public String functionName
-
isStateScript
public boolean isStateScript
-
scriptLevel
public int scriptLevel
-
commandHistoryLevelMax
public static int commandHistoryLevelMax
-
contextDepthMax
private static int contextDepthMax
-
scriptReportingLevel
private static int scriptReportingLevel
-
aatoken
public T[][] aatoken
-
lineNumbers
private short[] lineNumbers
-
lineIndices
private int[][] lineIndices
-
script
private String script
-
scriptExtensions
private String scriptExtensions
-
pc
public int pc
-
thisCommand
public String thisCommand
-
fullCommand
public String fullCommand
-
lineEnd
private int lineEnd
-
pcEnd
private int pcEnd
-
forceNoAddHydrogens
private boolean forceNoAddHydrogens
-
parallelProcessor
private JmolParallelProcessor parallelProcessor
-
pcResume
public int pcResume
-
isEmbedded
private boolean isEmbedded
-
-
Method Detail
-
getAllowJSThreads
public boolean getAllowJSThreads()
-
setAllowJSThreads
public void setAllowJSThreads(boolean b)
-
doReport
public boolean doReport()
-
isStateScript
public boolean isStateScript()
-
setStatic
public int setStatic(int tok, int ival)
set a static variable, with checking for range
-
getScript
public String getScript()
-
setViewer
public ScriptEval setViewer(Viewer vwr)
-
setCompiler
public void setCompiler()
-
compileScriptString
public boolean compileScriptString(String script, boolean tQuiet)
-
compileScriptFile
public boolean compileScriptFile(String filename, boolean tQuiet)
-
evaluateCompiledScript
public void evaluateCompiledScript(boolean isCmdLine_c_or_C_Option, boolean isCmdLine_C_Option, boolean historyDisabled, boolean listCommands, javajs.util.SB outputBuffer, boolean allowThreads)
-
useThreads
public boolean useThreads()
-
executeCommands
private void executeCommands(boolean isTry, boolean reportCompletion)
-
resumeEval
public void resumeEval(Object sco)
From dispatchCommands and JmolThread resumeEval. After throwing a ScriptInterruption, all statements following the current one are lost. When a JavaScript timeout returns from a DELAY, MOVE, MOVETO, or other sleep-requiring command, it is the ScriptContext that contains all have to worry about this, because the current thread is just put to sleep, not stopped, but in JavaScript, where we only have one thread, we need to manage this more carefully. We re-enter the halted script here, using a saved script context. The program counter is incremented to skip the initiating statement, and all parent contexts up the line are set with mustResumeEval = true.- Parameters:
sco
-
-
resumeViewer
private void resumeViewer(String why)
-
runScript
public void runScript(String script) throws ScriptException
- Throws:
ScriptException
-
runScriptBuffer
public void runScriptBuffer(String script, javajs.util.SB outputBuffer, boolean isFuncReturn) throws ScriptException
runs a script immediately and sends selected output to a provided SB- Parameters:
outputBuffer
-script
-- Throws:
ScriptException
-
checkScriptSilent
public ScriptContext checkScriptSilent(String script)
a method for just checking a script- Parameters:
script
-- Returns:
- a ScriptContext that indicates errors and provides a tokenized version of the script that has passed all syntax checking, both in the compiler and the evaluator
-
getContextTrace
static javajs.util.SB getContextTrace(Viewer vwr, ScriptContext sc, javajs.util.SB sb, boolean isTop)
-
setDebugging
public void setDebugging()
-
haltExecution
public void haltExecution()
-
pauseExecution
public void pauseExecution(boolean withDelay)
-
stepPausedExecution
public void stepPausedExecution()
-
resumePausedExecution
public void resumePausedExecution()
-
isExecuting
public boolean isExecuting()
-
isPaused
public boolean isPaused()
-
isStepping
public boolean isStepping()
-
isStopped
public boolean isStopped()
-
getNextStatement
public String getNextStatement()
when paused, indicates what statement will be next- Returns:
- a string indicating the statement
-
getCommand
private String getCommand(int pc, boolean allThisLine, boolean addSemi)
used for recall of commands in the application console- Parameters:
pc
-allThisLine
-addSemi
-- Returns:
- a string representation of the command
-
logDebugScript
private void logDebugScript(T[] st, int ifLevel)
-
evaluateExpression
public Object evaluateExpression(Object expr, boolean asVariable, boolean compileOnly)
a general-use method to evaluate a "SET" type expression.- Parameters:
asVariable
-expr
-- Returns:
- an object of one of the following types: Boolean, Integer, Float, String, Point3f, BitSet
-
runBufferedSafely
public void runBufferedSafely(String script, javajs.util.SB outputBuffer)
-
checkSelect
public boolean checkSelect(Map<String,SV> h, T[] where)
Check a map for a WHERE phrase
-
getAtomBitSet
public javajs.util.BS getAtomBitSet(Object atomExpression)
A general method to evaluate a string representing an atom set. Excepts one atom expression or one per line as "OR". Excepts "()" as "none".- Parameters:
atomExpression
-- Returns:
- is a bitset indicating the selected atoms
-
compileScript
public boolean compileScript(String filename, String strScript, boolean debugCompiler)
-
setScriptExtensions
private int setScriptExtensions()
-
compileScriptFileInternal
private boolean compileScriptFileInternal(String filename, String localPath, String remotePath, String scriptPath)
-
getUserFunctionResult
public SV getUserFunctionResult(String name, javajs.util.Lst<SV> params, SV tokenAtom) throws ScriptException
- Throws:
ScriptException
-
runFunctionAndRet
private SV runFunctionAndRet(JmolScriptFunction function, String name, javajs.util.Lst<SV> params, SV tokenAtom, boolean getReturn, boolean setContextPath, boolean allowThreads) throws ScriptException
- Throws:
ScriptException
-
processTry
private void processTry(Map<String,SV> cv) throws ScriptException
- Throws:
ScriptException
-
breakAt
private void breakAt(int pt)
-
restoreFunction
private void restoreFunction(JmolScriptFunction f, javajs.util.Lst<SV> params, SV tokenAtom) throws ScriptException
note that functions requiring motion cannot be run in JavaScript- Parameters:
f
-params
-tokenAtom
-- Throws:
ScriptException
-
clearDefinedVariableAtomSets
public void clearDefinedVariableAtomSets()
-
defineSets
private void defineSets()
support for @xxx or define xxx commands
-
defineAtomSet
private void defineAtomSet(String script)
-
lookupIdentifierValue
public javajs.util.BS lookupIdentifierValue(String identifier) throws ScriptException
- Throws:
ScriptException
-
lookupValue
private javajs.util.BS lookupValue(String setName, boolean plurals) throws ScriptException
- Throws:
ScriptException
-
deleteAtomsInVariables
public void deleteAtomsInVariables(javajs.util.BS bsDeleted)
-
getThisContext
public ScriptContext getThisContext()
-
clearState
private void clearState(boolean tQuiet)
-
pushContextDown
public void pushContextDown(String why)
-
pushContext
private void pushContext(ContextToken token, String why) throws ScriptException
- Throws:
ScriptException
-
pushContext2
private void pushContext2(ContextToken token, String why)
-
getScriptContext
public ScriptContext getScriptContext(String why)
-
popContext
void popContext(boolean isFlowCommand, boolean statementOnly)
-
restoreScriptContext
public void restoreScriptContext(ScriptContext context, boolean isPopContext, boolean isFlowCommand, boolean statementOnly)
-
setException
public void setException(ScriptException sx, String msg, String untranslated)
-
statementAsString
public static String statementAsString(Viewer vwr, T[] statement, int iTok, boolean doLogMessages)
-
setObjectPropSafe
public String setObjectPropSafe(String id, int tokCommand)
called by Viewer in setting up a PyMOL scene.
-
restrictSelected
public void restrictSelected(boolean isBond, boolean doInvert)
-
showString
public void showString(String str)
-
showStringPrint
public void showStringPrint(String s, boolean mustDo)
- Specified by:
showStringPrint
in classScriptError
-
report
public void report(String s, boolean isError)
-
appendBuffer
private void appendBuffer(String str, boolean mustDo)
-
addProcess
private void addProcess(javajs.util.Lst<T[]> vProcess, int pc, int pt)
-
checkContinue
private boolean checkContinue() throws ScriptException
checks to see if there is a pause condition, during which commands can still be issued, but with the ! first.- Returns:
- false if there was a problem
- Throws:
ScriptException
-
delayScript
public void delayScript(int millis)
-
doDelay
private void doDelay(int millis) throws ScriptException
- Parameters:
millis
- negative here bypasses max check- Throws:
ScriptException
-
evalParallel
public boolean evalParallel(ScriptContext context, ShapeManager shapeManager)
-
isCommandDisplayable
private boolean isCommandDisplayable(int i)
provides support for the script editor- Parameters:
i
-- Returns:
- true if displayable
-
loadFileResourceAsync
public void loadFileResourceAsync(String fileName) throws ScriptException
load a static file asynchronously- Throws:
ScriptException
-
loadFileAsync
public String loadFileAsync(String prefix, String filename, int i, boolean doClear) throws ScriptException
Allows asynchronous file loading from the LOAD or SCRIPT command. Saves the context, initiates a FileLoadThread instance. When the file loading completes, the file data (sans filename) is saved in the FileManager cache under cache://localLoad_xxxxx. Context is resumed at this command in the script, and the file is then retrieved from the cache. Only run from JSmol/HTML5 when vwr.isJS; Incompatibilities: LOAD and SCRIPT commands, load() function only; only one "?" per LOAD command- Parameters:
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 type- Returns:
- cached file name if it exists
- Throws:
ScriptException
-
logLoadInfo
private void logLoadInfo(String msg)
-
notifyResumeStatus
public void notifyResumeStatus()
-
refresh
public void refresh(boolean doDelay) throws ScriptException
Refresh the display NOW- Parameters:
doDelay
-- Throws:
ScriptException
-
stopScriptThreads
public void stopScriptThreads()
-
getErrorLineMessage2
public String getErrorLineMessage2()
-
getLinenumber
public int getLinenumber(ScriptContext c)
-
dispatchCommands
public boolean dispatchCommands(boolean isSpt, boolean fromFunc, boolean isTry) throws ScriptException
- Parameters:
isSpt
-fromFunc
-isTry
-- Returns:
- false only when still working through resumeEval
- Throws:
ScriptException
-
commandLoop
private void commandLoop(boolean allowJSInterrupt) throws ScriptException
- Throws:
ScriptException
-
processCommand
private void processCommand(int tok) throws ScriptException
- Throws:
ScriptException
-
checkExtension
private void checkExtension(int tok) throws ScriptException
- Throws:
ScriptException
-
processShapeCommand
private void processShapeCommand(int tok) throws ScriptException
- Throws:
ScriptException
-
cmdAnimation
private void cmdAnimation() throws ScriptException
- Throws:
ScriptException
-
setFrameSet
private void setFrameSet(int i) throws ScriptException
- Throws:
ScriptException
-
cmdAxes
private void cmdAxes(int index) throws ScriptException
- Throws:
ScriptException
-
cmdBackground
private void cmdBackground(int i) throws ScriptException
- Throws:
ScriptException
-
cmdBind
private void cmdBind() throws ScriptException
- Throws:
ScriptException
-
cmdBondorder
private void cmdBondorder() throws ScriptException
- Throws:
ScriptException
-
cmdBoundbox
private void cmdBoundbox(int index) throws ScriptException
- Throws:
ScriptException
-
cmdCD
private void cmdCD() throws ScriptException
- Throws:
ScriptException
-
cmdCenter
private void cmdCenter(int i) throws ScriptException
- Throws:
ScriptException
-
cmdColor
private void cmdColor() throws ScriptException
- Throws:
ScriptException
-
cmdDefine
private void cmdDefine() throws ScriptException
- Throws:
ScriptException
-
cmdDelay
private void cmdDelay() throws ScriptException
- Throws:
ScriptException
-
cmdDelete
private void cmdDelete() throws ScriptException
- Throws:
ScriptException
-
cmdDisplay
private void cmdDisplay(boolean isDisplay) throws ScriptException
- Throws:
ScriptException
-
cmdDots
private void cmdDots(int iShape) throws ScriptException
- Throws:
ScriptException
-
cmdEcho
private void cmdEcho(int index) throws ScriptException
- Throws:
ScriptException
-
cmdFile
private void cmdFile() throws ScriptException
- Throws:
ScriptException
-
cmdFixed
private void cmdFixed() throws ScriptException
- Throws:
ScriptException
-
cmdFor
private boolean cmdFor(int tok, boolean isForCheck) throws ScriptException
- Throws:
ScriptException
-
cmdFlow
private boolean cmdFlow(int tok, boolean isForCheck, javajs.util.Lst<T[]> vProcess) throws ScriptException
- Throws:
ScriptException
-
cmdFlowSwitch
private int cmdFlowSwitch(ContextToken c, int tok) throws ScriptException
- Throws:
ScriptException
-
cmdFont
private void cmdFont(int shapeType, float fontsize) throws ScriptException
- Throws:
ScriptException
-
cmdFrank
private void cmdFrank(int i) throws ScriptException
- Throws:
ScriptException
-
cmdFunc
private void cmdFunc() throws ScriptException
- Throws:
ScriptException
-
cmdGetProperty
private void cmdGetProperty() throws ScriptException
- Throws:
ScriptException
-
cmdGoto
private void cmdGoto(boolean isCmd) throws ScriptException
- Throws:
ScriptException
-
cmdHbond
private void cmdHbond() throws ScriptException
- Throws:
ScriptException
-
cmdHelp
private void cmdHelp() throws ScriptException
- Throws:
ScriptException
-
cmdHistory
private void cmdHistory(int pt) throws ScriptException
- Throws:
ScriptException
-
cmdHover
private void cmdHover() throws ScriptException
- Throws:
ScriptException
-
cmdLabel
private void cmdLabel(int index, javajs.util.BS bs) throws ScriptException
- Throws:
ScriptException
-
cmdLoad
public void cmdLoad() throws ScriptException
- Throws:
ScriptException
-
checkFileExists
public String checkFileExists(String prefix, boolean isAsync, String filename, int i, boolean doClear) throws ScriptException
- Throws:
ScriptException
-
addFilterAttribute
private void addFilterAttribute(Map<String,Object> htParams, String filter, String key)
-
addLoadData
private int addLoadData(javajs.util.SB loadScript, String key, Map<String,Object> htParams, int i) throws ScriptException
- Throws:
ScriptException
-
loadPNGJVar
private void loadPNGJVar(String varName, Object o, Map<String,Object> htParams) throws ScriptException
- Throws:
ScriptException
-
getLoadFilesList
private String getLoadFilesList(int i, javajs.util.SB loadScript, javajs.util.SB sOptions, Map<String,Object> htParams, javajs.util.Lst<String> fNames) throws ScriptException
- Throws:
ScriptException
-
isLoadOption
private boolean isLoadOption(int tok)
-
getLoadModelIndex
private int getLoadModelIndex(int i, javajs.util.SB sOptions, Map<String,Object> htParams) throws ScriptException
- Throws:
ScriptException
-
finalizeLoad
private void finalizeLoad(boolean isAppend, boolean appendNew, boolean isConcat, boolean doOrient, int nFiles, int ac0, int modelCount0) throws ScriptException
- Throws:
ScriptException
-
cmdLog
private void cmdLog() throws ScriptException
- Throws:
ScriptException
-
cmdLoop
private void cmdLoop() throws ScriptException
- Throws:
ScriptException
-
cmdMessage
private void cmdMessage() throws ScriptException
- Throws:
ScriptException
-
cmdModel
private void cmdModel(int offset) throws ScriptException
ONE difference between FRAME and MODEL: model 1 sets model NAMED one in the case of PDB frame 1 always sets the first model- Parameters:
offset
- will be 2 for "anim frame ..."- Throws:
ScriptException
-
loadDssr
private void loadDssr(int modelIndex, String data) throws ScriptException
- Throws:
ScriptException
-
cmdMove
private void cmdMove() throws ScriptException
- Throws:
ScriptException
-
cmdMoveto
private void cmdMoveto() throws ScriptException
- Throws:
ScriptException
-
isAtomExpression
public boolean isAtomExpression(int i)
-
cmdPause
private boolean cmdPause() throws ScriptException
- Throws:
ScriptException
-
cmdPrint
private void cmdPrint() throws ScriptException
- Throws:
ScriptException
-
cmdPrompt
private void cmdPrompt() throws ScriptException
- Throws:
ScriptException
-
cmdReset
private void cmdReset() throws ScriptException
- Throws:
ScriptException
-
resetError
private void resetError()
-
cmdRestrict
private void cmdRestrict() throws ScriptException
- Throws:
ScriptException
-
cmdReturn
private void cmdReturn(SV tv) throws ScriptException
- Throws:
ScriptException
-
cmdRotate
public void cmdRotate(boolean isSpin, boolean isSelected) throws ScriptException
- Throws:
ScriptException
-
cmdRestore
private void cmdRestore() throws ScriptException
- Throws:
ScriptException
-
cmdSave
private void cmdSave() throws ScriptException
- Throws:
ScriptException
-
cmdScript
public void cmdScript(int tok, String filename, String theScript) throws ScriptException
- Throws:
ScriptException
-
cmdSelect
private void cmdSelect(int i) throws ScriptException
- Throws:
ScriptException
-
cmdSelectionHalos
private void cmdSelectionHalos(int pt) throws ScriptException
- Throws:
ScriptException
-
cmdSet
private void cmdSet() throws ScriptException
- Throws:
ScriptException
-
cmdSetEcho
private void cmdSetEcho() throws ScriptException
- Throws:
ScriptException
-
cmdSetLabel
private boolean cmdSetLabel(String str) throws ScriptException
- Throws:
ScriptException
-
cmdSetPicking
private void cmdSetPicking() throws ScriptException
- Throws:
ScriptException
-
cmdSetPickingStyle
private void cmdSetPickingStyle() throws ScriptException
- Throws:
ScriptException
-
cmdSlab
private void cmdSlab(boolean isDepth) throws ScriptException
- Throws:
ScriptException
-
cmdSsbond
private void cmdSsbond() throws ScriptException
- Throws:
ScriptException
-
cmdStructure
private void cmdStructure() throws ScriptException
- Throws:
ScriptException
-
cmdSubset
private void cmdSubset() throws ScriptException
- Throws:
ScriptException
-
cmdSync
private void cmdSync() throws ScriptException
- Throws:
ScriptException
-
cmdThrow
private void cmdThrow() throws ScriptException
- Throws:
ScriptException
-
saveContext
private ScriptContext saveContext(String saveName)
-
cmdTimeout
private void cmdTimeout(int index) throws ScriptException
- Throws:
ScriptException
-
cmdTranslate
private void cmdTranslate(boolean isSelected) throws ScriptException
- Throws:
ScriptException
-
cmdUnbind
private void cmdUnbind() throws ScriptException
- Throws:
ScriptException
-
cmdUndoRedoMove
private void cmdUndoRedoMove() throws ScriptException
- Throws:
ScriptException
-
setCurrentCagePts
public void setCurrentCagePts(javajs.util.T3[] originABC, String name)
-
cmdUnitcell
private void cmdUnitcell(int i) throws ScriptException
- Throws:
ScriptException
-
cmdVector
private void cmdVector() throws ScriptException
- Throws:
ScriptException
-
cmdVibration
private void cmdVibration() throws ScriptException
- Throws:
ScriptException
-
cmdWireframe
private void cmdWireframe() throws ScriptException
- Throws:
ScriptException
-
cmdZap
private void cmdZap(boolean isZapCommand) throws ScriptException
- Throws:
ScriptException
-
cmdZoom
private void cmdZoom(boolean isZoomTo) throws ScriptException
- Throws:
ScriptException
-
colorShape
private void colorShape(int shapeType, int index, boolean isBackground) throws ScriptException
- Throws:
ScriptException
-
getPartialCharges
public void getPartialCharges(javajs.util.BS bs) throws ScriptException
- Throws:
ScriptException
-
encodeRadiusParameter
public RadiusData encodeRadiusParameter(int index, boolean isOnly, boolean allowAbsolute) throws ScriptException
- Throws:
ScriptException
-
expandFloatArray
public int[] expandFloatArray(float[] a, int min) throws ScriptException
Accepts a float array and expands [1 -3] to [1 2 3], for example.- Parameters:
a
-min
-- Returns:
- int array
- Throws:
ScriptException
-
frameControl
private void frameControl(int i) throws ScriptException
- Throws:
ScriptException
-
getColorRange
public String getColorRange(int i) throws ScriptException
- Throws:
ScriptException
-
getFullPathName
public String getFullPathName() throws ScriptException
- Throws:
ScriptException
-
getObjectBoundingBox
private javajs.util.P3[] getObjectBoundingBox(String id)
-
getObjectCenter
protected javajs.util.P3 getObjectCenter(String axisID, int index, int modelIndex)
-
getPlaneForObject
protected javajs.util.P4 getPlaneForObject(String id, javajs.util.V3 vAB)
-
getQuaternionArray
public javajs.util.Quat[] getQuaternionArray(Object quaternionOrSVData, int itype)
-
getSetAxesTypeMad10
public int getSetAxesTypeMad10(int index) throws ScriptException
- Throws:
ScriptException
-
getSettingFloat
private float getSettingFloat(int pt) throws ScriptException
- Throws:
ScriptException
-
getSettingInt
private int getSettingInt(int pt) throws ScriptException
- Throws:
ScriptException
-
getSettingStr
private String getSettingStr(int pt, boolean isJmolSet) throws ScriptException
Accept an unquoted string if there is just one parameter regardless of its type. In other words, these commands cannot accept a variable name by itself.- Parameters:
pt
-isJmolSet
-- Returns:
- string parameter
- Throws:
ScriptException
-
getShapePropertyData
public boolean getShapePropertyData(int shapeType, String propertyName, Object[] data)
-
getShapeType
private int getShapeType(int tok) throws ScriptException
- Throws:
ScriptException
-
getTranslucentLevel
public float getTranslucentLevel(int i) throws ScriptException
- Throws:
ScriptException
-
getZoom
private float getZoom(int ptCenter, int i, javajs.util.BS bs, float currentZoom) throws ScriptException
- Throws:
ScriptException
-
setElementColor
private boolean setElementColor(String str, int argb)
-
setMeshDisplayProperty
public boolean setMeshDisplayProperty(int shape, int i, int tok) throws ScriptException
- Parameters:
shape
-i
-tok
-- Returns:
- true if successful
- Throws:
ScriptException
-
setObjectArgb
private void setObjectArgb(String str, int argb)
-
setObjectMad10
public void setObjectMad10(int iShape, String name, int mad10)
-
setObjectProp
private String setObjectProp(String id, int tokCommand, int ptColor) throws ScriptException
- Throws:
ScriptException
-
setObjectProperty
public String setObjectProperty() throws ScriptException
- Throws:
ScriptException
-
setShapeNameParameter
public String setShapeNameParameter(int i) throws ScriptException
- Throws:
ScriptException
-
setShapeProperty
public void setShapeProperty(int shapeType, String propertyName, Object propertyValue)
-
setShapePropertyBs
public void setShapePropertyBs(int iShape, String propertyName, Object propertyValue, javajs.util.BS bs)
-
setShapeSize
private void setShapeSize(int shapeType, RadiusData rd)
-
setShapeSizeBs
public void setShapeSizeBs(int shapeType, int size, javajs.util.BS bs)
-
setShapeTranslucency
public void setShapeTranslucency(int shapeType, String prefix, String translucency, float translucentLevel, javajs.util.BS bs)
-
setSize
private void setSize(int shape, float scale) throws ScriptException
- Throws:
ScriptException
-
setSizeBio
private void setSizeBio(int iShape) throws ScriptException
- Throws:
ScriptException
-
setUnits
private boolean setUnits(String units, int tok) throws ScriptException
- Throws:
ScriptException
-
-