Class infixModel.ACalcState
- abstract class ACalcState
- extends Object
Represents the abstract state of the calculator (the context)

ErrorState
- An error state object for general use

enterDigit
(InfixCalc, char)
- Appends c to the string of digit collected so far
enterEqual
(InfixCalc)
- Computes the pending operation
enterOp
(InfixCalc, IBinOp)
- Performs the pending operation, and set op as the next pending operation
enterPoint
(InfixCalc)
- Enters a decimal point

ErrorState
static final ACalcState ErrorState = new ACalcState() { // state 3 is error state: null-object pattern, does nothing!
public void enterDigit(InfixCalc calc, char c) {
}
public void enterOp(InfixCalc calc, IBinOp op) {
}
public void enterEqual(InfixCalc calc) {
}
public void enterPoint(InfixCalc calc) {
}
}
- An error state object for general use
A null object, does nothing.

enterDigit
public abstract void enterDigit(InfixCalc calc, char c)
- Appends c to the string of digit collected so far.
- Parameters:
- calc - The calculator model (context)
- c - The digit being entered
enterOp
public abstract void enterOp(InfixCalc calc, IBinOp op)
- Performs the pending operation, and set op as the next pending operation
on whatever is computed so far to the operand that will be entered next.
- Parameters:
- calc - The calculator model (context)
- op - The new pendin operation
enterEqual
public abstract void enterEqual(InfixCalc calc)
- Computes the pending operation.
- Parameters:
- calc - The calculator model (context)
enterPoint
public abstract void enterPoint(InfixCalc calc)
- Enters a decimal point.
- Parameters:
- calc - The calculator model (context)