Class infixModel.AccumState


class AccumState
extends infixModel.ACalcState
State where the calculator has accumulated digits of a number into the display.


Variable Index

 o Singleton
Singleton instance

Constructor Index

 o AccumState ()
Hidden constructor

Method Index

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

Variables

 o Singleton
static final AccumState Singleton = new AccumState()
Singleton instance

Constructors

 o AccumState
private  AccumState()
Hidden constructor

Methods

 o enterDigit
public 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
 o enterOp
public 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. Go to error if the number in the display does not parse properly into a floating point number.

Parameters:
calc - The calculator model (context)
op - The new pending operation
 o enterEqual
public void enterEqual(InfixCalc calc)
Computes the pending operation.

Parameters:
calc - The calculator model (context)
 o enterPoint
public void enterPoint(InfixCalc calc)
Enter a decimal point. Go to point state.

Parameters:
calc - The calculator model (context)