com.sun.electric.database.variable
Class EvalSpice.SimpleEq
java.lang.Object
com.sun.electric.database.variable.EvalSpice.SimpleEq
- Enclosing class:
- EvalSpice
public static class EvalSpice.SimpleEq
- extends java.lang.Object
A simple equation consists of two Identifiers (operands)
that are Doubles, Strings, or other SimpleEq,
and an operator *,/,+,-.
For a simple equation to be valid, it must define
both operands and an operator. However, if the
operator is '-', then the left hand operand may
be null, to indicate a unary minus. Additionally,
if only the left hand operator is defined, then it
is simply one operand.
Field Summary |
protected java.lang.Object |
lhop
|
protected java.lang.Object |
rhop
|
Method Summary |
void |
addIdentifier(java.lang.Object id)
|
boolean |
addIdentifierOk()
|
void |
addOp(EvalSpice.Op operator)
|
java.lang.Object |
eval()
Return either a Double, if the equation can be
resolved numerically, or a String representing
the equation after any numerical resolution can be done. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
lhop
protected java.lang.Object lhop
rhop
protected java.lang.Object rhop
EvalSpice.SimpleEq
public EvalSpice.SimpleEq()
EvalSpice.SimpleEq
public EvalSpice.SimpleEq(java.lang.Object lhop,
EvalSpice.Op op,
java.lang.Object rhop)
addIdentifierOk
public boolean addIdentifierOk()
addIdentifier
public void addIdentifier(java.lang.Object id)
throws EvalSpice.ParseException
- Throws:
EvalSpice.ParseException
addOp
public void addOp(EvalSpice.Op operator)
throws EvalSpice.ParseException
- Throws:
EvalSpice.ParseException
eval
public java.lang.Object eval()
throws EvalSpice.ParseException
- Return either a Double, if the equation can be
resolved numerically, or a String representing
the equation after any numerical resolution can be done.
- Returns:
- a Double or a String
- Throws:
EvalSpice.ParseException