Package org.jmol.script
Class ScriptParam
- java.lang.Object
-
- org.jmol.script.ScriptError
-
- org.jmol.script.ScriptParam
-
- All Implemented Interfaces:
JmolScriptEvaluator
- Direct Known Subclasses:
ScriptExpr
public abstract class ScriptParam extends ScriptError
The ScriptParam class holds methods used to parse parameters in Jmol scripts.
-
-
Field Summary
Fields Modifier and Type Field Description java.util.Map<java.lang.String,ScriptFunction>contextFunctionsjava.util.Map<java.lang.String,SV>contextVariablesbooleancoordinatesAreFractionaljavajs.util.P3fractionalPointbooleanisBondSetintiTokenjavajs.util.P3pt1javajs.util.P3pt2javajs.util.P3pt3intslenT[]stinttheTokTtheTokenScriptContextthisContext-
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 ScriptParam()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javajs.util.P3atomCenterOrCoordinateParameter(int i, java.lang.Object[] ret)javajs.util.P3centerParameter(int i, java.lang.Object[] ret)protected javajs.util.P3centerParameterForModel(int i, int modelIndex, java.lang.Object[] ret)intcheckLast(int i)intcheckLength(int length)intcheckLength23()protected intcheckLength34()intcheckLengthErrorPt(int length, int errorPt)protected booleancheckToken(int i)floatfloatParameter(int index)protected floatfloatParameterRange(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 inputintgetArgbParam(int index)protected intgetArgbParamLast(int index, boolean allowNone)protected intgetArgbParamOrNone(int index, boolean allowNone)static intgetBondOrderFromString(java.lang.String s)private intgetColorTriad(int i)SVgetContextVariableAsVariable(java.lang.String var, boolean isLocal)(package private) static intgetFloatEncodedInt(java.lang.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.javajs.util.P4getHklPlane(javajs.util.P3 pt, float offset, boolean getPts)intgetMadParameter()java.lang.ObjectgetParameter(java.lang.String key, int tokType, boolean nullAsString)static intgetPartialBondOrderFromFloatEncodedInt(int bondOrderInteger)reads standard n.m float-as-integer n*1000000 + m and returns (n % 7) << 5 + (m % 0x1F)private static intgetPartialBondOrderFromString(java.lang.String s)javajs.util.P3getPoint3f(int i, boolean allowFractional, boolean throwE)javajs.util.P4getPoint4f(int i)javajs.util.P3[]getPointArray(int i, int nPoints, boolean allowNull)may return null values in some casesjavajs.util.Lst<javajs.util.P3>getPointOrCenterVector(T t)java.lang.ObjectgetPointOrPlane(int index, boolean integerOnly, boolean allowFractional, boolean doConvert, boolean implicitFractional, int minDim, int maxDim, boolean throwE)javajs.util.Lst<javajs.util.P3>getPointVector(T t, int i)javajs.util.QuatgetQuaternionParameter(int i, javajs.util.BS bsAtoms, boolean divideByCurrent)TgetToken(int i)protected java.lang.ObjectgetVarParameter(java.lang.String var, boolean orReturnName)javajs.util.P4hklParameter(int i, boolean getPts)intintParameter(int index)intintParameterRange(int i, int min, int max)booleanisArrayParameter(int i)booleanisCenterParameter(int i)booleanisColorParam(int i)booleanisFloatParameter(int index)booleanisPoint3f(int i)javajs.util.Lst<java.lang.Object>listParameter(int i, int nMin, int nMax)javajs.util.Lst<java.lang.Object>listParameter4(int i, int nMin, int nMax, boolean allowString)intmodelNumberParameter(int index)java.lang.StringobjectNameParameter(int index)java.lang.StringoptParameterAsString(int i)java.lang.StringparamAsStr(int i)javajs.util.P4planeParameter(int i)voidsetBooleanProperty(java.lang.String key, boolean value)protected booleansetFloatProperty(java.lang.String key, float value)protected booleansetIntProperty(java.lang.String key, int value)protected voidsetStringProperty(java.lang.String key, java.lang.String value)java.lang.StringstringParameter(int index)java.lang.String[]stringParameterSet(int i)TickInfotickParamAsStr(int index, boolean allowUnitCell, boolean allowScale, boolean allowFirst)inttokAt(int i)javajs.util.P3xypParameter(int index)javajs.util.P4xyzpParameter(int index)-
Methods inherited from class org.jmol.script.ScriptError
bad, error, errorMore, errorStr, errorStr2, errorString, evalError, getErrorLineMessage, getErrorMessage, getErrorMessageUntranslated, integerOutOfRange, invArg, numberOutOfRange, setCursorWait, setErrorMessage, showStringPrint, warning
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jmol.api.JmolScriptEvaluator
checkScriptSilent, checkSelect, compileScriptFile, compileScriptString, deleteAtomsInVariables, evalFunctionFloat, evalParallel, evaluateCompiledScript, evaluateExpression, getAllowJSThreads, getAtomBitSet, getNextStatement, getScript, getScriptContext, getThisContext, haltExecution, isExecuting, isPaused, isStateScript, isStepping, isStopped, loadFileResourceAsync, notifyResumeStatus, pauseExecution, pushContextDown, resumeEval, resumePausedExecution, runScript, runScriptBuffer, setCompiler, setDebugging, setObjectPropSafe, setStatic, setViewer, stepPausedExecution, stopScriptThreads
-
-
-
-
Field Detail
-
contextVariables
public java.util.Map<java.lang.String,SV> contextVariables
-
contextFunctions
public java.util.Map<java.lang.String,ScriptFunction> contextFunctions
-
thisContext
public ScriptContext thisContext
-
iToken
public int iToken
-
theTok
public int theTok
-
theToken
public T theToken
-
st
public T[] st
-
slen
public int slen
-
fractionalPoint
public javajs.util.P3 fractionalPoint
-
coordinatesAreFractional
public boolean coordinatesAreFractional
-
isBondSet
public boolean isBondSet
-
pt1
public javajs.util.P3 pt1
-
pt2
public javajs.util.P3 pt2
-
pt3
public javajs.util.P3 pt3
-
-
Method Detail
-
getToken
public T getToken(int i) throws ScriptException
- Throws:
ScriptException
-
tokAt
public int tokAt(int i)
-
checkToken
protected boolean checkToken(int i)
-
getParameter
public java.lang.Object getParameter(java.lang.String key, int tokType, boolean nullAsString)
-
getVarParameter
protected java.lang.Object getVarParameter(java.lang.String var, boolean orReturnName)
-
getContextVariableAsVariable
public SV getContextVariableAsVariable(java.lang.String var, boolean isLocal)
-
paramAsStr
public java.lang.String paramAsStr(int i) throws ScriptException- Throws:
ScriptException
-
stringParameter
public java.lang.String stringParameter(int index) throws ScriptException- Throws:
ScriptException
-
stringParameterSet
public java.lang.String[] stringParameterSet(int i) throws ScriptException- Throws:
ScriptException
-
objectNameParameter
public java.lang.String objectNameParameter(int index) throws ScriptException- Throws:
ScriptException
-
atomCenterOrCoordinateParameter
public javajs.util.P3 atomCenterOrCoordinateParameter(int i, java.lang.Object[] ret) throws ScriptException- Parameters:
i-ret- return P3 or BS to ret[0]; on input, passing a BS as ret[1] indicates that it should be ANDED with this BS prior to calculation (SHOW/DRAW SYMOP)- Returns:
- point -- ORIGINAL, non-copied atom, if a single atom
- Throws:
ScriptException
-
isCenterParameter
public boolean isCenterParameter(int i)
-
centerParameter
public javajs.util.P3 centerParameter(int i, java.lang.Object[] ret) throws ScriptException- Throws:
ScriptException
-
centerParameterForModel
protected javajs.util.P3 centerParameterForModel(int i, int modelIndex, java.lang.Object[] ret) throws ScriptException- Throws:
ScriptException
-
planeParameter
public javajs.util.P4 planeParameter(int i) throws ScriptException- Throws:
ScriptException
-
getPointOrCenterVector
public javajs.util.Lst<javajs.util.P3> getPointOrCenterVector(T t) throws ScriptException
- Throws:
ScriptException
-
hklParameter
public javajs.util.P4 hklParameter(int i, boolean getPts) throws ScriptException- Throws:
ScriptException
-
getHklPlane
public javajs.util.P4 getHklPlane(javajs.util.P3 pt, float offset, boolean getPts)
-
getPointOrPlane
public java.lang.Object getPointOrPlane(int index, boolean integerOnly, boolean allowFractional, boolean doConvert, boolean implicitFractional, int minDim, int maxDim, boolean throwE) throws ScriptException- Throws:
ScriptException
-
isPoint3f
public boolean isPoint3f(int i)
-
getPoint3f
public javajs.util.P3 getPoint3f(int i, boolean allowFractional, boolean throwE) throws ScriptException- Throws:
ScriptException
-
getPoint4f
public javajs.util.P4 getPoint4f(int i) throws ScriptException- Throws:
ScriptException
-
xypParameter
public javajs.util.P3 xypParameter(int index) throws ScriptException- Throws:
ScriptException
-
xyzpParameter
public javajs.util.P4 xyzpParameter(int index) throws ScriptException- Throws:
ScriptException
-
optParameterAsString
public java.lang.String optParameterAsString(int i) throws ScriptException- Throws:
ScriptException
-
intParameter
public int intParameter(int index) throws ScriptException- Throws:
ScriptException
-
isFloatParameter
public boolean isFloatParameter(int index)
-
floatParameter
public float floatParameter(int index) throws ScriptException- Throws:
ScriptException
-
getPointArray
public javajs.util.P3[] getPointArray(int i, int nPoints, boolean allowNull) throws ScriptExceptionmay return null values in some cases- Parameters:
i-nPoints- -1 for unspecified number of pointsallowNull- if allowing null values (as in setting atom properties such as vxyz or xyz)- Returns:
- array of P3, with possible null values
- Throws:
ScriptException
-
listParameter
public javajs.util.Lst<java.lang.Object> listParameter(int i, int nMin, int nMax) throws ScriptException- Throws:
ScriptException
-
listParameter4
public javajs.util.Lst<java.lang.Object> listParameter4(int i, int nMin, int nMax, boolean allowString) throws ScriptException- Throws:
ScriptException
-
floatParameterSet
public float[] floatParameterSet(int i, int nMin, int nMax) throws ScriptExceptionprocess a general string or set of parameters as an array of floats, allowing for relatively free form input- Parameters:
i-nMin-nMax-- Returns:
- array of floats
- Throws:
ScriptException
-
isArrayParameter
public boolean isArrayParameter(int i)
-
getQuaternionParameter
public javajs.util.Quat getQuaternionParameter(int i, javajs.util.BS bsAtoms, boolean divideByCurrent) throws ScriptException- Throws:
ScriptException
-
checkLast
public int checkLast(int i) throws ScriptException- Throws:
ScriptException
-
checkLength
public int checkLength(int length) throws ScriptException- Throws:
ScriptException
-
checkLengthErrorPt
public int checkLengthErrorPt(int length, int errorPt) throws ScriptException- Throws:
ScriptException
-
checkLength23
public int checkLength23() throws ScriptException- Throws:
ScriptException
-
checkLength34
protected int checkLength34() throws ScriptException- Throws:
ScriptException
-
modelNumberParameter
public int modelNumberParameter(int index) throws ScriptException- Throws:
ScriptException
-
getMadParameter
public int getMadParameter() throws ScriptException- Throws:
ScriptException
-
intParameterRange
public int intParameterRange(int i, int min, int max) throws ScriptException- Throws:
ScriptException
-
floatParameterRange
protected float floatParameterRange(int i, float min, float max) throws ScriptException- Throws:
ScriptException
-
getPointVector
public javajs.util.Lst<javajs.util.P3> getPointVector(T t, int i) throws ScriptException
- Throws:
ScriptException
-
getFloatEncodedInt
static int getFloatEncodedInt(java.lang.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. 2147483647 is maxvalue, so this allows loading simultaneously up to 2147 files, each with 999999 models (or trajectories)- Parameters:
strDecimal-- Returns:
- float encoded as an integer
-
getPartialBondOrderFromFloatEncodedInt
public static int getPartialBondOrderFromFloatEncodedInt(int bondOrderInteger)
reads standard n.m float-as-integer n*1000000 + m and returns (n % 7) << 5 + (m % 0x1F)- Parameters:
bondOrderInteger-- Returns:
- Bond order partial mask
-
getBondOrderFromString
public static int getBondOrderFromString(java.lang.String s)
-
getPartialBondOrderFromString
private static int getPartialBondOrderFromString(java.lang.String s)
-
isColorParam
public boolean isColorParam(int i)
-
getArgbParam
public int getArgbParam(int index) throws ScriptException- Throws:
ScriptException
-
getArgbParamLast
protected int getArgbParamLast(int index, boolean allowNone) throws ScriptException- Throws:
ScriptException
-
getArgbParamOrNone
protected int getArgbParamOrNone(int index, boolean allowNone) throws ScriptException- Throws:
ScriptException
-
getColorTriad
private int getColorTriad(int i) throws ScriptException- Throws:
ScriptException
-
tickParamAsStr
public TickInfo tickParamAsStr(int index, boolean allowUnitCell, boolean allowScale, boolean allowFirst) throws ScriptException
- Parameters:
index-allowUnitCell- IGNOREDallowScale-allowFirst-- Returns:
- TickInfo
- Throws:
ScriptException
-
setBooleanProperty
public void setBooleanProperty(java.lang.String key, boolean value)
-
setIntProperty
protected boolean setIntProperty(java.lang.String key, int value)
-
setFloatProperty
protected boolean setFloatProperty(java.lang.String key, float value)
-
setStringProperty
protected void setStringProperty(java.lang.String key, java.lang.String value)
-
-