All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class programming101.calculBeanz.Calculator

java.lang.Object
    |
    +----FR.essi.sander.graphix.mvc.ModelImpl
            |
            +----programming101.calculBeanz.Calculator

public class Calculator
extends ModelImpl
implements ControlListener, Serializable
Defines a very simple calculator which combines a cumulative numeric value with a new numeric value according to some operation. The calculator as a whole rigorously applies the MVC (Model-View-Control) "design pattern", where the calculator state is the model (that's this component), the various buttons provide the control, and the display region is the display (really!). Communication is by way of events, e.g., the calculator (M component) registers itself as interested by button events (the C components), and when a button is pushed the appropriate event gets sent to the calculator which then calculates and posts an event to the display (the V component). This has the advantage of being modular, with each component in fact being a JavaBean.

This class

Since:
18/03/98
Version:
1.2 (6/04/98)
Author:
© 1998 Peter T. Sander

Constructor Index

 o Calculator()
No-args constructor (needed for JavaBeans).

Method Index

 o getCumulator()
Getter method for cumulator attribute.
 o update(ControlEvent)
Method guaranteed by implementing the ControlListener interface.

Constructors

 o Calculator
public Calculator()
No-args constructor (needed for JavaBeans).

Methods

 o update
public void update(ControlEvent ce)
Method guaranteed by implementing the ControlListener interface. Invoked by any controls which have registered this calculator as interested by their events.

Parameters:
ce - a control button event
Overrides:
update in class ModelImpl
 o getCumulator
public double getCumulator()
Getter method for cumulator attribute.

Returns:
cumulator value

All Packages  Class Hierarchy  This Package  Previous  Next  Index