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 Modifier and Type Field Description T[][]aatokenbooleanallowJSThreadsstatic intcommandHistoryLevelMaxScriptCompilercompilerprivate static intcontextDepthMaxprivate java.lang.StringcontextPathprivate java.lang.ThreadcurrentThreadprivate booleandebugScriptprivate booleanexecutingprivate booleanexecutionPausedprivate booleanexecutionSteppingprivate booleanexecutionStoppedprivate JmolThreadfileLoadThreadprivate booleanforceNoAddHydrogensjava.lang.StringfullCommandjava.lang.StringfunctionNamebooleanhistoryDisabledprivate static intiProcessprivate booleanisCmdLine_C_Optionprivate booleanisCmdLine_c_or_C_Optionprivate booleanisFuncReturnbooleanisJSbooleanisStateScriptprivate intlineEndprivate int[][]lineIndicesprivate short[]lineNumbersprivate booleanlistCommandsprivate booleanmustResumeEvaljavajs.util.SBoutputBufferprivate JmolParallelProcessorparallelProcessorprotected intpcprivate intpcEndprivate intpcResumeprivate static java.lang.StringsaveListprivate java.lang.Stringscriptprivate JmolThreadscriptDelayThreadprivate java.lang.StringscriptExtensionsjava.lang.StringscriptFileNameintscriptLevelprivate static intscriptReportingLevelShapeManagersmjava.lang.StringthisCommandprivate longtimeBeginExecutionprivate longtimeEndExecutionbooleantQuiet-
Fields inherited from class org.jmol.script.ScriptExpr
debugHigh, tempStatement
-
Fields inherited from class org.jmol.script.ScriptParam
contextVariables, coordinatesAreFractional, fractionalPoint, isBondSet, iToken, 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 intaddLoadData(javajs.util.SB loadScript, java.lang.String key, java.util.Map<java.lang.String,java.lang.Object> htParams, int i)private voidaddProcess(javajs.util.Lst<T[]> vProcess, int pc, int pt)private voidappendBuffer(java.lang.String str, boolean mustDo)private voidbreakAt(int pt)private booleancheckContinue()checks to see if there is a pause condition, during which commands can still be issued, but with the ! first.private voidcheckExtension(int tok)ScriptContextcheckScriptSilent(java.lang.String script)a method for just checking a scriptbooleancheckSelect(java.util.Map<java.lang.String,SV> h, T[] where)Check a map for a WHERE phrasevoidclearDefinedVariableAtomSets()private voidclearState(boolean tQuiet)private voidcmdAnimation()private voidcmdAxes(int index)private voidcmdBackground(int i)private voidcmdBind()private voidcmdBondorder()private voidcmdBoundbox(int index)private voidcmdCD()private voidcmdCenter(int i)private voidcmdColor()private voidcmdDefine()private voidcmdDelay()private voidcmdDelete()private voidcmdDisplay(boolean isDisplay)private voidcmdDots(int iShape)private voidcmdEcho(int index)private voidcmdFile()private voidcmdFixed()private booleancmdFlow(int tok, boolean isForCheck, javajs.util.Lst<T[]> vProcess)private intcmdFlowSwitch(ContextToken c, int tok)private voidcmdFont(int shapeType, float fontsize)private booleancmdFor(int tok, boolean isForCheck)private voidcmdFrank(int i)private voidcmdFunc()private voidcmdGetProperty()private voidcmdGoto(boolean isCmd)private voidcmdHbond()private voidcmdHelp()private voidcmdHistory(int pt)private voidcmdHover()private voidcmdInvertSelected()private voidcmdLabel(int index)voidcmdLoad()private voidcmdLog()private voidcmdLoop()private voidcmdMessage()private voidcmdModel(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 voidcmdMove()private voidcmdMoveto()private booleancmdPause()private voidcmdPrint()private voidcmdPrompt()private voidcmdReset()private voidcmdRestore()private voidcmdRestrict()private voidcmdReturn(SV tv)private voidcmdRotate(boolean isSpin, boolean isSelected)private voidcmdSave()voidcmdScript(int tok, java.lang.String filename, java.lang.String theScript)private voidcmdSelect(int i)private voidcmdSelectionHalos(int pt)private voidcmdSet()private voidcmdSetEcho()private booleancmdSetLabel(java.lang.String str)private voidcmdSetPicking()private voidcmdSetPickingStyle()private voidcmdSlab(boolean isDepth)private voidcmdSsbond()private voidcmdStructure()private voidcmdSubset()private voidcmdSync()private voidcmdThrow()private voidcmdTimeout(int index)private voidcmdTranslate(boolean isSelected)private voidcmdUnbind()private voidcmdUndoRedoMove()private voidcmdUnitcell(int i)private voidcmdVector()private voidcmdVibration()private voidcmdWireframe()private voidcmdZap(boolean isZapCommand)private voidcmdZoom(boolean isZoomTo)private voidcolorShape(int shapeType, int index, boolean isBackground)private voidcommandLoop(boolean allowJSInterrupt)booleancompileScript(java.lang.String filename, java.lang.String strScript, boolean debugCompiler)booleancompileScriptFile(java.lang.String filename, boolean tQuiet)private booleancompileScriptFileInternal(java.lang.String filename, java.lang.String localPath, java.lang.String remotePath, java.lang.String scriptPath)booleancompileScriptString(java.lang.String script, boolean tQuiet)private voiddefineAtomSet(java.lang.String script)private voiddefineSets()support for @xxx or define xxx commandsvoiddelayScript(int millis)voiddeleteAtomsInVariables(BS bsDeleted)booleandispatchCommands(boolean isSpt, boolean fromFunc, boolean isTry)private voiddoDelay(int millis)booleandoReport()RadiusDataencodeRadiusParameter(int index, boolean isOnly, boolean allowAbsolute)floatevalFunctionFloat(java.lang.Object func, java.lang.Object params, float[] values)booleanevalParallel(ScriptContext context, ShapeManager shapeManager)private java.lang.Objectevaluate(java.lang.Object expr, boolean asVariable, boolean compileOnly)voidevaluateCompiledScript(boolean isCmdLine_c_or_C_Option, boolean isCmdLine_C_Option, boolean historyDisabled, boolean listCommands, javajs.util.SB outputBuffer, boolean allowThreads)java.lang.ObjectevaluateExpression(java.lang.Object expr, boolean asVariable, boolean compileOnly)a general-use method to evaluate a "SET" type expression.private voidexecuteCommands(boolean isTry, boolean reportCompletion)private int[]expandFloatArray(float[] a, int min)Accepts a float array and expands [1 -3] to [1 2 3], for example.private voidfinalizeLoad(boolean isAppend, boolean appendNew, boolean isConcat, boolean doOrient, int nFiles, int ac0, int modelCount0)private java.lang.StringfixScriptPath(java.lang.String strScript, java.lang.String filename)private voidframeControl(int i)booleangetAllowJSThreads()BSgetAtomBitSet(java.lang.Object atomExpression)A general method to evaluate a string representing an atom set.java.lang.StringgetColorRange(int i)private java.lang.StringgetCommand(int pc, boolean allThisLine, boolean addSemi)used for recall of commands in the application console(package private) static javajs.util.SBgetContextTrace(Viewer vwr, ScriptContext sc, javajs.util.SB sb, boolean isTop)java.lang.StringgetErrorLineMessage2()java.lang.StringgetFullPathName()intgetLinenumber(ScriptContext c)private java.lang.StringgetLoadFilesList(int i, javajs.util.SB loadScript, javajs.util.SB sOptions, java.util.Map<java.lang.String,java.lang.Object> htParams, javajs.util.Lst<java.lang.String> fNames)private intgetLoadModelIndex(int i, javajs.util.SB sOptions, java.util.Map<java.lang.String,java.lang.Object> htParams)java.lang.StringgetNextStatement()when paused, indicates what statement will be nextprivate javajs.util.P3[]getObjectBoundingBox(java.lang.String id)protected javajs.util.P3getObjectCenter(java.lang.String axisID, int index, int modelIndex)voidgetPartialCharges(BS bs)protected javajs.util.P4getPlaneForObject(java.lang.String id, javajs.util.V3 vAB)javajs.util.Quat[]getQuaternionArray(java.lang.Object quaternionOrSVData, int itype)java.lang.StringgetScript()ScriptContextgetScriptContext(java.lang.String why)intgetSetAxesTypeMad10(int index)private floatgetSettingFloat(int pt)private intgetSettingInt(int pt)private java.lang.StringgetSettingStr(int pt, boolean isJmolSet)Accept an unquoted string if there is just one parameter regardless of its type.java.lang.ObjectgetShapeProperty(int shapeType, java.lang.String propertyName)booleangetShapePropertyData(int shapeType, java.lang.String propertyName, java.lang.Object[] data)private intgetShapeType(int tok)ScriptContextgetThisContext()floatgetTranslucentLevel(int i)SVgetUserFunctionResult(java.lang.String name, javajs.util.Lst<SV> params, SV tokenAtom)private floatgetZoom(int ptCenter, int i, BS bs, float currentZoom)voidhaltExecution()private booleanisCommandDisplayable(int i)provides support for the script editorbooleanisExecuting()private booleanisLoadOption(int tok)booleanisPaused()booleanisStateScript()booleanisStepping()booleanisStopped()private voidloadDssr(int modelIndex, java.lang.String data)java.lang.StringloadFileAsync(java.lang.String prefix, java.lang.String filename, int i, boolean doClear)Allows asynchronous file loading from the LOAD or SCRIPT command.voidloadFileResourceAsync(java.lang.String fileName)load a static file asynchronouslyprivate voidloadPNGJVar(java.lang.String varName, java.lang.Object o, java.util.Map<java.lang.String,java.lang.Object> htParams)private voidlogDebugScript(T[] st, int ifLevel)private voidlogLoadInfo(java.lang.String msg)BSlookupIdentifierValue(java.lang.String identifier)private BSlookupValue(java.lang.String setName, boolean plurals)voidnotifyResumeStatus()voidpauseExecution(boolean withDelay)(package private) voidpopContext(boolean isFlowCommand, boolean statementOnly)private voidprocessCommand(int tok)private voidprocessShapeCommand(int tok)private voidprocessTry(java.util.Map<java.lang.String,SV> cv)private voidpushContext(ContextToken token, java.lang.String why)private voidpushContext2(ContextToken token, java.lang.String why)voidpushContextDown(java.lang.String why)voidrefresh(boolean doDelay)Refresh the display NOWvoidreport(java.lang.String s, boolean isError)private voidresetError()private voidrestoreFunction(JmolScriptFunction f, javajs.util.Lst<SV> params, SV tokenAtom)note that functions requiring motion cannot be run in JavaScriptvoidrestoreScriptContext(ScriptContext context, boolean isPopContext, boolean isFlowCommand, boolean statementOnly)voidrestrictSelected(boolean isBond, boolean doInvert)voidresumeEval(ScriptContext sc)From dispatchCommands and JmolThread resumeEval.voidresumePausedExecution()private voidresumeViewer(java.lang.String why)private SVrunFunctionAndRet(JmolScriptFunction function, java.lang.String name, javajs.util.Lst<SV> params, SV tokenAtom, boolean getReturn, boolean setContextPath, boolean allowThreads)voidrunScript(java.lang.String script)voidrunScriptBuffer(java.lang.String script, javajs.util.SB outputBuffer, boolean isFuncReturn)runs a script immediately and sends selected output to a provided SBprivate ScriptContextsaveContext(java.lang.String saveName)protected voidsetAtomProp(java.lang.String prop, java.lang.Object value, BS bs)voidsetCompiler()voidsetCurrentCagePts(javajs.util.T3[] originABC, java.lang.String name)voidsetDebugging()private booleansetElementColor(java.lang.String str, int argb)voidsetException(ScriptException sx, java.lang.String msg, java.lang.String untranslated)private voidsetFrameSet(int i)booleansetMeshDisplayProperty(int shape, int i, int tok)private voidsetObjectArgb(java.lang.String str, int argb)voidsetObjectMad10(int iShape, java.lang.String name, int mad10)private java.lang.StringsetObjectProp(java.lang.String id, int tokCommand, int ptColor)java.lang.StringsetObjectProperty()java.lang.StringsetObjectPropSafe(java.lang.String id, int tokCommand)called by Viewer in setting up a PyMOL scene.private intsetScriptExtensions()java.lang.StringsetShapeNameParameter(int i)voidsetShapeProperty(int shapeType, java.lang.String propertyName, java.lang.Object propertyValue)voidsetShapePropertyBs(int iShape, java.lang.String propertyName, java.lang.Object propertyValue, BS bs)private voidsetShapeSize(int shapeType, RadiusData rd)voidsetShapeSizeBs(int shapeType, int size, BS bs)voidsetShapeTranslucency(int shapeType, java.lang.String prefix, java.lang.String translucency, float translucentLevel, BS bs)private voidsetSize(int shape, float scale)private voidsetSizeBio(int iShape)intsetStatic(int tok, int ival)set a static variable, with checking for rangeprivate booleansetUnits(java.lang.String units, int tok)ScriptEvalsetViewer(Viewer vwr)voidshowString(java.lang.String str)voidshowStringPrint(java.lang.String s, boolean mustDo)static java.lang.StringstatementAsString(Viewer vwr, T[] statement, int iTok, boolean doLogMessages)voidstepPausedExecution()voidstopScriptThreads()java.lang.StringtoString()booleanuseThreads()-
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, getPointOrPlane, getPointVector, getQuaternionParameter, getToken, getVarParameter, hklParameter, intParameter, intParameterRange, isArrayParameter, isCenterParameter, isColorParam, isFloatParameter, isPoint3f, listParameter, 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 java.lang.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
public 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 java.lang.Thread currentThread
-
compiler
public ScriptCompiler compiler
-
outputBuffer
public javajs.util.SB outputBuffer
-
contextPath
private java.lang.String contextPath
-
scriptFileName
public java.lang.String scriptFileName
-
functionName
public java.lang.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 java.lang.String script
-
scriptExtensions
private java.lang.String scriptExtensions
-
pc
protected int pc
-
thisCommand
public java.lang.String thisCommand
-
fullCommand
public java.lang.String fullCommand
-
lineEnd
private int lineEnd
-
pcEnd
private int pcEnd
-
forceNoAddHydrogens
private boolean forceNoAddHydrogens
-
parallelProcessor
private JmolParallelProcessor parallelProcessor
-
pcResume
private int pcResume
-
-
Method Detail
-
getAllowJSThreads
public boolean getAllowJSThreads()
-
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 java.lang.String getScript()
-
setViewer
public ScriptEval setViewer(Viewer vwr)
-
setCompiler
public void setCompiler()
-
compileScriptString
public boolean compileScriptString(java.lang.String script, boolean tQuiet)
-
compileScriptFile
public boolean compileScriptFile(java.lang.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(ScriptContext sc)
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:
sc-
-
resumeViewer
private void resumeViewer(java.lang.String why)
-
runScript
public void runScript(java.lang.String script) throws ScriptException- Throws:
ScriptException
-
runScriptBuffer
public void runScriptBuffer(java.lang.String script, javajs.util.SB outputBuffer, boolean isFuncReturn) throws ScriptExceptionruns a script immediately and sends selected output to a provided SB- Parameters:
outputBuffer-script-- Throws:
ScriptException
-
checkScriptSilent
public ScriptContext checkScriptSilent(java.lang.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 java.lang.String getNextStatement()
when paused, indicates what statement will be next- Returns:
- a string indicating the statement
-
getCommand
private java.lang.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 java.lang.Object evaluateExpression(java.lang.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
-
evaluate
private java.lang.Object evaluate(java.lang.Object expr, boolean asVariable, boolean compileOnly)
-
checkSelect
public boolean checkSelect(java.util.Map<java.lang.String,SV> h, T[] where)
Check a map for a WHERE phrase
-
getAtomBitSet
public BS getAtomBitSet(java.lang.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(java.lang.String filename, java.lang.String strScript, boolean debugCompiler)
-
fixScriptPath
private java.lang.String fixScriptPath(java.lang.String strScript, java.lang.String filename)
-
setScriptExtensions
private int setScriptExtensions()
-
compileScriptFileInternal
private boolean compileScriptFileInternal(java.lang.String filename, java.lang.String localPath, java.lang.String remotePath, java.lang.String scriptPath)
-
evalFunctionFloat
public float evalFunctionFloat(java.lang.Object func, java.lang.Object params, float[] values)
-
getUserFunctionResult
public SV getUserFunctionResult(java.lang.String name, javajs.util.Lst<SV> params, SV tokenAtom) throws ScriptException
- Throws:
ScriptException
-
runFunctionAndRet
private SV runFunctionAndRet(JmolScriptFunction function, java.lang.String name, javajs.util.Lst<SV> params, SV tokenAtom, boolean getReturn, boolean setContextPath, boolean allowThreads) throws ScriptException
- Throws:
ScriptException
-
processTry
private void processTry(java.util.Map<java.lang.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(java.lang.String script)
-
lookupIdentifierValue
public BS lookupIdentifierValue(java.lang.String identifier) throws ScriptException
- Throws:
ScriptException
-
lookupValue
private BS lookupValue(java.lang.String setName, boolean plurals) throws ScriptException
- Throws:
ScriptException
-
deleteAtomsInVariables
public void deleteAtomsInVariables(BS bsDeleted)
-
getThisContext
public ScriptContext getThisContext()
-
clearState
private void clearState(boolean tQuiet)
-
pushContextDown
public void pushContextDown(java.lang.String why)
-
pushContext
private void pushContext(ContextToken token, java.lang.String why) throws ScriptException
- Throws:
ScriptException
-
pushContext2
private void pushContext2(ContextToken token, java.lang.String why)
-
getScriptContext
public ScriptContext getScriptContext(java.lang.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, java.lang.String msg, java.lang.String untranslated)
-
statementAsString
public static java.lang.String statementAsString(Viewer vwr, T[] statement, int iTok, boolean doLogMessages)
-
setObjectPropSafe
public java.lang.String setObjectPropSafe(java.lang.String id, int tokCommand)called by Viewer in setting up a PyMOL scene.
-
setAtomProp
protected void setAtomProp(java.lang.String prop, java.lang.Object value, BS bs)
-
restrictSelected
public void restrictSelected(boolean isBond, boolean doInvert)
-
showString
public void showString(java.lang.String str)
-
showStringPrint
public void showStringPrint(java.lang.String s, boolean mustDo)- Specified by:
showStringPrintin classScriptError
-
report
public void report(java.lang.String s, boolean isError)
-
appendBuffer
private void appendBuffer(java.lang.String str, boolean mustDo)
-
addProcess
private void addProcess(javajs.util.Lst<T[]> vProcess, int pc, int pt)
-
checkContinue
private boolean checkContinue() throws ScriptExceptionchecks 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(java.lang.String fileName) throws ScriptExceptionload a static file asynchronously- Throws:
ScriptException
-
loadFileAsync
public java.lang.String loadFileAsync(java.lang.String prefix, java.lang.String filename, int i, boolean doClear) throws ScriptExceptionAllows 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(java.lang.String msg)
-
notifyResumeStatus
public void notifyResumeStatus()
-
refresh
public void refresh(boolean doDelay) throws ScriptExceptionRefresh the display NOW- Parameters:
doDelay-- Throws:
ScriptException
-
stopScriptThreads
public void stopScriptThreads()
-
getErrorLineMessage2
public java.lang.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
-
cmdInvertSelected
private void cmdInvertSelected() throws ScriptException- Throws:
ScriptException
-
cmdLabel
private void cmdLabel(int index) throws ScriptException- Throws:
ScriptException
-
cmdLoad
public void cmdLoad() throws ScriptException- Throws:
ScriptException
-
addLoadData
private int addLoadData(javajs.util.SB loadScript, java.lang.String key, java.util.Map<java.lang.String,java.lang.Object> htParams, int i) throws ScriptException- Throws:
ScriptException
-
loadPNGJVar
private void loadPNGJVar(java.lang.String varName, java.lang.Object o, java.util.Map<java.lang.String,java.lang.Object> htParams) throws ScriptException- Throws:
ScriptException
-
getLoadFilesList
private java.lang.String getLoadFilesList(int i, javajs.util.SB loadScript, javajs.util.SB sOptions, java.util.Map<java.lang.String,java.lang.Object> htParams, javajs.util.Lst<java.lang.String> fNames) throws ScriptException- Throws:
ScriptException
-
isLoadOption
private boolean isLoadOption(int tok)
-
getLoadModelIndex
private int getLoadModelIndex(int i, javajs.util.SB sOptions, java.util.Map<java.lang.String,java.lang.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 ScriptExceptionONE 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, java.lang.String data) throws ScriptException- Throws:
ScriptException
-
cmdMove
private void cmdMove() throws ScriptException- Throws:
ScriptException
-
cmdMoveto
private void cmdMoveto() throws ScriptException- Throws:
ScriptException
-
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
private 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, java.lang.String filename, java.lang.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(java.lang.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(java.lang.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, java.lang.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(BS bs) throws ScriptException
- Throws:
ScriptException
-
encodeRadiusParameter
public RadiusData encodeRadiusParameter(int index, boolean isOnly, boolean allowAbsolute) throws ScriptException
- Throws:
ScriptException
-
expandFloatArray
private int[] expandFloatArray(float[] a, int min) throws ScriptExceptionAccepts 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 java.lang.String getColorRange(int i) throws ScriptException- Throws:
ScriptException
-
getFullPathName
public java.lang.String getFullPathName() throws ScriptException- Throws:
ScriptException
-
getObjectBoundingBox
private javajs.util.P3[] getObjectBoundingBox(java.lang.String id)
-
getObjectCenter
protected javajs.util.P3 getObjectCenter(java.lang.String axisID, int index, int modelIndex)
-
getPlaneForObject
protected javajs.util.P4 getPlaneForObject(java.lang.String id, javajs.util.V3 vAB)
-
getQuaternionArray
public javajs.util.Quat[] getQuaternionArray(java.lang.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 java.lang.String getSettingStr(int pt, boolean isJmolSet) throws ScriptExceptionAccept 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
-
getShapeProperty
public java.lang.Object getShapeProperty(int shapeType, java.lang.String propertyName)
-
getShapePropertyData
public boolean getShapePropertyData(int shapeType, java.lang.String propertyName, java.lang.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, BS bs, float currentZoom) throws ScriptException- Throws:
ScriptException
-
setElementColor
private boolean setElementColor(java.lang.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(java.lang.String str, int argb)
-
setObjectMad10
public void setObjectMad10(int iShape, java.lang.String name, int mad10)
-
setObjectProp
private java.lang.String setObjectProp(java.lang.String id, int tokCommand, int ptColor) throws ScriptException- Throws:
ScriptException
-
setObjectProperty
public java.lang.String setObjectProperty() throws ScriptException- Throws:
ScriptException
-
setShapeNameParameter
public java.lang.String setShapeNameParameter(int i) throws ScriptException- Throws:
ScriptException
-
setShapeProperty
public void setShapeProperty(int shapeType, java.lang.String propertyName, java.lang.Object propertyValue)
-
setShapePropertyBs
public void setShapePropertyBs(int iShape, java.lang.String propertyName, java.lang.Object propertyValue, BS bs)
-
setShapeSize
private void setShapeSize(int shapeType, RadiusData rd)
-
setShapeSizeBs
public void setShapeSizeBs(int shapeType, int size, BS bs)
-
setShapeTranslucency
public void setShapeTranslucency(int shapeType, java.lang.String prefix, java.lang.String translucency, float translucentLevel, 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(java.lang.String units, int tok) throws ScriptException- Throws:
ScriptException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-