Class infixModel.PointState


class PointState
extends infixModel.ACalcState
State where a decimal point has been entered. Decorating AccumState! Delegates to an accumulating state object for operations that are identical.


Variable Index

 o AccState
Reference to accumulating state for delegation purposes
 o Singleton
Singleton instance

Constructor Index

 o PointState ()
Hidden constructor

Method Index

 o enterDigit (InfixCalc, char)
Keeps on accumulating c
 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)
Does nothing because a decimal point has already been entered

Variables

 o AccState
static final AccumState AccState = AccumState.Singleton
Reference to accumulating state for delegation purposes.

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

Constructors

 o PointState
private  PointState()
Hidden constructor

Methods

 o enterDigit
public void enterDigit(InfixCalc calc, char c)
Keeps on accumulating c. Same as accumlating state.

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. Same as accumulating state.

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

Parameters:
calc - The calculator model (context)
 o enterPoint
public void enterPoint(InfixCalc calc)
Does nothing because a decimal point has already been entered.

Parameters:
calc - The calculator model (context)