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
The ScriptParam class holds methods used to parse parameters
in Jmol scripts.
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanset in getPointOrPlanejavajs.util.P3set in getPointOrPlanebooleanintstatic final intprotected static final intprotected static final intprotected static final intprotected static final intstatic final intstatic final intprotected static final intintT[]intFields 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 -
Method Summary
Modifier and TypeMethodDescriptionjavajs.util.P3atomCenterOrCoordinateParameter(int i, Object[] ret) javajs.util.P3centerParameter(int i, Object[] ret) protected javajs.util.P3centerParameterForModel(int i, int modelIndex, Object[] ret) javajs.util.T3checkHKL(javajs.util.T3 pt) Note - this check does not allow a 0 for h, k, or l.intcheckLast(int i) intcheckLength(int length) intprotected intintcheckLengthErrorPt(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) intgetArgbParamOrNone(int index, boolean allowNone) javajs.util.BSgetAtomsStartingAt(int i) private intgetColorTriad(int i) getContextVariableAsVariable(String var, boolean isLocal) javajs.util.T3getFractionalPoint(int i) Could return a P4 for large 1100100100 type indicatorsjavajs.util.P4getHklPlane(javajs.util.T3 pt, float offset, javajs.util.Lst<javajs.util.P3> pts) intgetParameter(String key, int tokType, boolean nullAsString) javajs.util.P3getPoint3f(int i, boolean allowFractional, boolean throwE) Get an {x,y,z} value, possibly fractional, with option to throw an error.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>javajs.util.T3getPointOrPlane(int index, int mode) Get the point or plane at an indexjavajs.util.Lst<javajs.util.P3>getPointVector(T t, int i) javajs.util.QuatgetQuaternionParameter(int i, javajs.util.BS bsAtoms, boolean divideByCurrent) getToken(int i) protected ObjectgetVarParameter(String var, boolean orReturnName) javajs.util.P4hklParameter(int i, javajs.util.Lst<javajs.util.P3> pts, boolean allowOffset) 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<Object>listParameter(int i, int nMin, int nMax) javajs.util.Lst<Object>listParameter4(int i, int nMin, int nMax, boolean allowString) intmodelNumberParameter(int index) objectNameParameter(int index) optParameterAsString(int i) paramAsStr(int i) javajs.util.P4planeParameter(int i, boolean isBest) javajs.util.P4planeValue(T x) voidsetBooleanProperty(String key, boolean value) protected booleansetFloatProperty(String key, float value) protected booleansetIntProperty(String key, int value) protected voidsetStringProperty(String key, String value) stringParameter(int index) String[]stringParameterSet(int i) tickParamAsStr(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, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 Details
-
contextVariables
-
contextFunctions
-
thisContext
-
iToken
public int iToken -
theTok
public int theTok -
theToken
-
st
-
slen
public int slen -
fractionalPoint
public javajs.util.P3 fractionalPointset in getPointOrPlane -
coordinatesAreFractional
public boolean coordinatesAreFractionalset in getPointOrPlane -
isBondSet
public boolean isBondSet -
MODE_P3
public static final int MODE_P3- See Also:
-
MODE_P4
protected static final int MODE_P4- See Also:
-
MODE_P34
public static final int MODE_P34- See Also:
-
MODE_P_INT_ONLY
protected static final int MODE_P_INT_ONLY- See Also:
-
MODE_P_ALLOW_FRACTIONAL
public static final int MODE_P_ALLOW_FRACTIONAL- See Also:
-
MODE_P_CONVERT_TO_CARTESIAN
protected static final int MODE_P_CONVERT_TO_CARTESIAN- See Also:
-
MODE_P_IMPLICIT_FRACTIONAL
protected static final int MODE_P_IMPLICIT_FRACTIONAL- See Also:
-
MODE_P_NULL_ON_ERROR
protected static final int MODE_P_NULL_ON_ERROR- See Also:
-
-
Constructor Details
-
ScriptParam
public ScriptParam()
-
-
Method Details
-
getToken
- Throws:
ScriptException
-
tokAt
public int tokAt(int i) -
checkToken
protected boolean checkToken(int i) -
getParameter
-
getVarParameter
-
getContextVariableAsVariable
-
paramAsStr
- Throws:
ScriptException
-
stringParameter
- Throws:
ScriptException
-
stringParameterSet
- Throws:
ScriptException
-
objectNameParameter
- Throws:
ScriptException
-
atomCenterOrCoordinateParameter
- 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
- Throws:
ScriptException
-
centerParameterForModel
protected javajs.util.P3 centerParameterForModel(int i, int modelIndex, Object[] ret) throws ScriptException - Throws:
ScriptException
-
planeParameter
- Throws:
ScriptException
-
getAtomsStartingAt
- Throws:
ScriptException
-
getPointOrCenterVector
- Throws:
ScriptException
-
hklParameter
public javajs.util.P4 hklParameter(int i, javajs.util.Lst<javajs.util.P3> pts, boolean allowOffset) throws ScriptException - Throws:
ScriptException
-
getHklPlane
public javajs.util.P4 getHklPlane(javajs.util.T3 pt, float offset, javajs.util.Lst<javajs.util.P3> pts) -
getPointOrPlane
Get the point or plane at an index- Parameters:
index-mode- some combination of MODE_P options- Returns:
- P3 or P4 or null
- Throws:
ScriptException
-
isPoint3f
public boolean isPoint3f(int i) -
getPoint3f
public javajs.util.P3 getPoint3f(int i, boolean allowFractional, boolean throwE) throws ScriptException Get an {x,y,z} value, possibly fractional, with option to throw an error. Will set fractionalCoords and coordinatesAreFractional- Parameters:
i-allowFractional-throwE-- Returns:
- P3
- Throws:
ScriptException
-
getFractionalPoint
Could return a P4 for large 1100100100 type indicators- Parameters:
i-- Returns:
- P3 or P4
- Throws:
ScriptException
-
getPoint4f
- Throws:
ScriptException
-
xypParameter
- Throws:
ScriptException
-
xyzpParameter
- Throws:
ScriptException
-
optParameterAsString
- Throws:
ScriptException
-
intParameter
- Throws:
ScriptException
-
isFloatParameter
public boolean isFloatParameter(int index) -
floatParameter
- Throws:
ScriptException
-
getPointArray
may 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
- Throws:
ScriptException
-
listParameter4
public javajs.util.Lst<Object> listParameter4(int i, int nMin, int nMax, boolean allowString) throws ScriptException - Throws:
ScriptException
-
floatParameterSet
process 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
- Throws:
ScriptException
-
checkLength
- Throws:
ScriptException
-
checkLengthErrorPt
- Throws:
ScriptException
-
checkLength23
- Throws:
ScriptException
-
checkLength34
- Throws:
ScriptException
-
modelNumberParameter
- Throws:
ScriptException
-
getMadParameter
- Throws:
ScriptException
-
intParameterRange
- Throws:
ScriptException
-
floatParameterRange
- Throws:
ScriptException
-
getPointVector
- Throws:
ScriptException
-
isColorParam
public boolean isColorParam(int i) -
getArgbParam
- Throws:
ScriptException
-
getArgbParamLast
- Throws:
ScriptException
-
getArgbParamOrNone
- Throws:
ScriptException
-
getColorTriad
- 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
-
setIntProperty
-
setFloatProperty
-
setStringProperty
-
checkHKL
Note - this check does not allow a 0 for h, k, or l.- Parameters:
pt-- Returns:
- pt or throw invArg
- Throws:
ScriptException
-
planeValue
-