Package org.jmol.script
Class ScriptMathProcessor
java.lang.Object
org.jmol.script.ScriptMathProcessor
Reverse Polish Notation Engine for IF, SET, and @{...}
Just a (not so simple?) RPN processor that can handle boolean, int, float,
String, Point3f, BitSet, Array, Hashtable, Matrix3f, Matrix4f
-- Bob Hanson 2/16/2007
- Author:
- hansonr
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionboolean
addOp The primary driver of the Reverse Polish Notation evaluation engine.boolean
boolean
addXAD
(double[] x) boolean
addXAF
(float[] x) boolean
addXAFF
(float[][] x) boolean
addXAI
(int[] x) boolean
addXAII
(int[][] x) boolean
boolean
boolean
addXBool
(boolean x) boolean
boolean
boolean
addXFloat
(float x) boolean
addXInt
(int x) boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
static M4
getMatrix4f
(M3 matRotate, T3 vTranslate) getX()
int
getXTok()
-
Field Details
-
wasX
public boolean wasX -
asBitSet
public boolean asBitSet -
oPt
public int oPt
-
-
Method Details
-
endAssignment
public boolean endAssignment() -
addXCopy
-
addX
-
addXObj
-
addXStr
-
addXBool
public boolean addXBool(boolean x) -
addXInt
public boolean addXInt(int x) -
addXList
-
addXMap
-
addXM3
-
addXM4
-
addXFloat
public boolean addXFloat(float x) -
addXBs
-
addXPt
-
addXPt4
-
addXNum
- Throws:
ScriptException
-
addXAV
-
addXAD
public boolean addXAD(double[] x) -
addXAS
-
addXAI
public boolean addXAI(int[] x) -
addXAII
public boolean addXAII(int[][] x) -
addXAF
public boolean addXAF(float[] x) -
addXAFF
public boolean addXAFF(float[][] x) -
addOp
addOp The primary driver of the Reverse Polish Notation evaluation engine. This method loads operators onto the oStack[] and processes them based on a precedence system. Operands are added by addX() onto the xStack[]. We check here for syntax issues that were not caught in the compiler. I suppose that should be done at compilation stage, but this is how it is for now. The processing of functional arguments and (___?___:___) constructs is carried out by pushing markers onto the stacks that later can be used to fill argument lists or turn "skipping" on or off. Note that in the case of skipped sections of ( ? : ) no attempt is made to do syntax checking. [That's not entirely true -- when syntaxChecking is true, that is, when the user is typing at the Jmol application console, then this code is being traversed with dummy variables. That could be improved, for sure. Actually, there's plenty of room for improvement here. I did this based on what I learned in High School in 1974 -- 35 years ago! -- when I managed to build a mini FORTRAN compiler from scratch in machine code. That was fun. (This was fun, too.) -- Bob Hanson, hansonr@stolaf.edu 6/9/2009- Parameters:
op
-- Returns:
- false if an error condition arises
- Throws:
ScriptException
-
getX
- Throws:
ScriptException
-
getXTok
public int getXTok() -
binaryOp
- Throws:
ScriptException
-
ptValue
- Throws:
ScriptException
-
getMatrix4f
-