public interface NNCalcController
type NNCalcController is modeled by
(model: NNCalcModel,
view: NNCalcView)
(NNCalcModel model, NNCalcView view):
ensures
this.model = model and
this.view = view
Modifier and Type | Method and Description |
---|---|
void |
processAddEvent()
Processes event to do an add operation.
|
void |
processAddNewDigitEvent(int digit)
Processes event to add a new (low-order) digit to the bottom operand.
|
void |
processClearEvent()
Processes event to clear bottom operand.
|
void |
processDivideEvent()
Processes event to do a divide operation.
|
void |
processEnterEvent()
Processes event to enter bottom operand to top.
|
void |
processMultiplyEvent()
Processes event to do a multiply operation.
|
void |
processPowerEvent()
Processes event to do a power operation.
|
void |
processRootEvent()
Processes event to do a root operation.
|
void |
processSubtractEvent()
Processes event to do a subtract operation.
|
void |
processSwapEvent()
Processes event to swap operands.
|
void processClearEvent()
this.model.bottom, this.view
this.model.bottom = 0 and
[this.view has been updated to match this.model]
void processSwapEvent()
this.model, this.view
this.model.top = #this.model.bottom and
this.model.bottom = #this.model.top and
[this.view has been updated to match this.model]
void processEnterEvent()
this.model.top, this.view
this.model.top = this.model.bottom and
[this.view has been updated to match this.model]
void processAddEvent()
this.model, this.view
this.model.top = 0 and
this.model.bottom = #this.model.top + #this.model.bottom and
[this.view has been updated to match this.model]
void processSubtractEvent()
this.model, this.view
this.model.bottom <= this.model.top
this.model.top = 0 and
this.model.bottom = #this.model.top - #this.model.bottom and
[this.view has been updated to match this.model]
void processMultiplyEvent()
this.model, this.view
this.mode.top = 0 and
this.model.bottom = #this.model.top * #this.model.bottom and
[this.view has been updated to match this.model]
void processDivideEvent()
this.model, this.view
this.model.bottom > 0
#this.model.top =
this.model.bottom * #this.model.bottom + this.model.top and
0 <= this.model.top < #this.model.bottom and
[this.view has been updated to match this.model]
void processPowerEvent()
this.model, this.view
this.model.bottom <= INT_LIMIT
this.model.top = 0 and
this.model.bottom = #this.model.top ^ (#this.model.bottom) and
[this.view has been updated to match this.model]
void processRootEvent()
this.model, this.view
2 <= this.model.bottom <= INT_LIMIT
this.model.top = 0 and
this.model.bottom =
[the floor of the #this.model.bottom root of #this.model.top] and
[this.view has been updated to match this.model]
void processAddNewDigitEvent(int digit)
digit
- the low-order digit to be addedthis.model.bottom, this.view
0 <= digit < 10
this.model.bottom = #this.model.bottom * 10 + digit and
[this.view has been updated to match this.model]