Aec.java and AecImpl.java:
We define the multi-step usage pattern of our arithmetic expressions calculator as follows:
The first step converts an input arithmetic expression rendered in an infix notation into its equivalent in a requested output notation - prefix or postfix:
public boolean infixTo( String infixae, int notationType )
The second step renders the contents of the output queue into a
human-readable and printable form with potentially useful auxiliary information:
public void mkOutputExpression( StringBuilder s )
The third step takes an output queue as its input and computes the numeric
value of the input arithmetic expression:
public boolean compute()
The fourth step retrieves the result of the computation process:
public int result()
A string containing the description of the last error can be retrieved
via:
public String error()
Aec.java:
Having settled on AEC's options we also implement its main() and usage().
We observe that all along the way we keep the whole in a compilable state
which exercises AEC's entire functionality developed
so far:
java -Ddbg -Dae="9-4+1" -jar aec.jar 0
Files
Modified: Aec.java, AecImpl.java
Aec.java AecImpl.java Postfix.java Prefix.java AeNotation.java AeItem.java IReader.java
\(\blacksquare\)