# Class ScriptMathProcessor

java.lang.Object
org.jmol.script.ScriptMathProcessor

public class ScriptMathProcessor extends Object
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
Modifier and Type
Field
Description
`boolean`
`asBitSet`
`int`
`oPt`
`boolean`
`wasX`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`addOp(T op)`
addOp The primary driver of the Reverse Polish Notation evaluation engine.
`boolean`
`addX(SV x)`
`boolean`
`addXAD(double[] x)`
`boolean`
`addXAF(float[] x)`
`boolean`
`addXAFF(float[][] x)`
`boolean`
`addXAI(int[] x)`
`boolean`
`addXAII(int[][] x)`
`boolean`
`addXAS(String[] x)`
`boolean`
`addXAV(SV[] x)`
`boolean`
`addXBool(boolean x)`
`boolean`
`addXBs(BS bs)`
`boolean`
`addXCopy(SV x)`
`boolean`
`addXFloat(float x)`
`boolean`
`addXInt(int x)`
`boolean`
`addXList(Lst<?> x)`
`boolean`
`addXM3(M3 x)`
`boolean`
`addXM4(M4 x)`
`boolean`
`addXMap(Map<String,?> x)`
`boolean`
`addXNum(T x)`
`boolean`
`addXObj(Object x)`
`boolean`
`addXPt(P3 pt)`
`boolean`
`addXPt4(P4 pt)`
`boolean`
`addXStr(String x)`
`boolean`
`binaryOp(T op, SV x1, SV x2)`
`boolean`
`endAssignment()`
`static M4`
`getMatrix4f(M3 matRotate, T3 vTranslate)`
`SV`
`getX()`
`int`
`getXTok()`
`boolean`
`propOp(T op, SV x2)`
`P3`
`ptValue(SV x, BS bsRestrict)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### wasX

public boolean wasX

### asBitSet

public boolean asBitSet

### oPt

public int oPt

## Method Details

### endAssignment

public boolean endAssignment()

### addXCopy

public boolean addXCopy(SV x)

### addX

public boolean addX(SV x)

### addXObj

public boolean addXObj(Object x)

### addXStr

public boolean addXStr(String x)

### addXBool

public boolean addXBool(boolean x)

### addXInt

public boolean addXInt(int x)

### addXList

public boolean addXList(Lst<?> x)

### addXMap

public boolean addXMap(Map<String,?> x)

### addXM3

public boolean addXM3(M3 x)

### addXM4

public boolean addXM4(M4 x)

### addXFloat

public boolean addXFloat(float x)

### addXBs

public boolean addXBs(BS bs)

### addXPt

public boolean addXPt(P3 pt)

### addXPt4

public boolean addXPt4(P4 pt)

### addXNum

public boolean addXNum(T x) throws ScriptException

Throws:
  `ScriptException`

### addXAV

public boolean addXAV(SV[] x)

### addXAD

public boolean addXAD(double[] x)

### addXAS

public boolean addXAS(String[] x)

### 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

public boolean addOp(T op) throws ScriptException
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

public SV getX() throws ScriptException

Throws:
  `ScriptException`

### getXTok

public int getXTok()

### propOp

public boolean propOp(T op, SV x2) throws ScriptException

Throws:
  `ScriptException`

### binaryOp

public boolean binaryOp(T op, SV x1, SV x2) throws ScriptException

Throws:
  `ScriptException`

### ptValue

public P3 ptValue(SV x, BS bsRestrict) throws ScriptException

Throws:
  `ScriptException`

### getMatrix4f

public static M4 getMatrix4f(M3 matRotate, T3 vTranslate)