Class infixModel.StartState


class StartState
extends infixModel.ACalcState
State at the start up or after the calculator has been cleared. No digits or operations input yet.


Variable Index

 o Singleton
Singleton instance

Constructor Index

 o StartState ()
Hidden constructor

Method Index

 o enterDigit (InfixCalc, char)
Appends c to the string of digit collected so far
 o enterEqual (InfixCalc)
Performs the pending operation, which may be a no-op, displays the result and updates the pending op to no-op.
 o enterOp (InfixCalc, IBinOp)
Performs the pending operation, and set op as the next pending operation
 o enterPoint (InfixCalc)
Enters a "0

Variables

 o Singleton
public static final StartState Singleton = new StartState()
Singleton instance

Constructors

 o StartState
private  StartState()
Hidden constructor

Methods

 o enterDigit
public void enterDigit(InfixCalc calc, char c)
Appends c to the string of digit collected so far if c is not "0" which is ignored. Go to accumulating 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 computation state. 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)
Does nothing as there is nothing to do yet.

Parameters:
calc - The calculator model (context)
 o enterPoint
public void enterPoint(InfixCalc calc)
Enters a "0." into the display string. Go to point state.

Parameters:
calc - The calculator model (context)