L20_pkg
Class PolkaDotDataModel

java.lang.Object
  extended by L20_pkg.PolkaDotDataModel

public class PolkaDotDataModel
extends java.lang.Object

This class encapsulates a data model of a collection of polka dots. Duplicate polka dots are permitted.

Author:
mb

Constructor Summary
PolkaDotDataModel()
          Creates a collection and initialized it with three polka dots
 
Method Summary
 void addDot(PolkaDot theDot)
          Add the passed polka dot to this collection.
 void addListener(ModelListener listener)
          Add a listener to this model.
 java.util.List<PolkaDot> getDots()
          Return this collection as a List of PolkaDot objects.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolkaDotDataModel

public PolkaDotDataModel()
Creates a collection and initialized it with three polka dots

Method Detail

addListener

public void addListener(ModelListener listener)
Add a listener to this model.

Parameters:
listener -

getDots

public java.util.List<PolkaDot> getDots()
Return this collection as a List of PolkaDot objects.

Returns:
as described above

addDot

public void addDot(PolkaDot theDot)
Add the passed polka dot to this collection. The model notifies its listeners (if any) that it has changed. As well, a statement is printed to the console "Model is changing."

Parameters:
theDot - a non-null Polka Dot object