|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--calc.BaseCalc
This class is the base for all kind of calculations. It's subclasses represent the nodes in the Operational Tree constructed by ExprParser
Field Summary | |
protected boolean |
calculated
|
protected BaseCalc[] |
children
|
protected Complex |
result
|
Constructor Summary | |
BaseCalc()
|
Method Summary | |
void |
calculate()
Wrapper for doCalculate. |
void |
clear()
remove the calculated-flag |
protected abstract void |
doCalculate()
implemented by subclasses, does the real calculation by recursively calling it's children |
abstract int |
getArgsNr()
overridden by inheriting class, needed for consistency-checks |
abstract java.lang.String |
getArithmeticSymbol()
must be implemented for debugging purposes: returns "+" for AddCalc, etc. |
BaseCalc[] |
getChildren()
returns an array with the child-nodes |
void |
insertChildren(BaseCalc[] children)
connects the Object to another BaseCalc and uses it's output as input |
static void |
main(java.lang.String[] args)
for testing purposes |
Complex |
result()
return the result calculated by calculate() |
java.lang.String |
toString()
returns a string representing the arithmetic operation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Complex result
protected BaseCalc[] children
protected boolean calculated
Constructor Detail |
public BaseCalc()
Method Detail |
public abstract int getArgsNr()
public void insertChildren(BaseCalc[] children) throws calc.IllegalArgException
public BaseCalc[] getChildren()
public void calculate()
protected abstract void doCalculate()
public Complex result()
public void clear()
public java.lang.String toString()
toString
in class java.lang.Object
public abstract java.lang.String getArithmeticSymbol()
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |