packageForL9L10
Class SimpleThreeDotModel_v2

java.lang.Object
  extended by packageForL9L10.SimpleThreeDotModel_v2

public class SimpleThreeDotModel_v2
extends java.lang.Object

The class encapsulates a data model that consists of an ordered list of three dots (the first, second and third dot).

Each dot is understood to have a diameter (of a certain number of units, where the actual physical size of the unit is left unspecified and is abstracted away). Each dot is understood to have a location, which is specified as an x, y coordinate in a two-dimensional plane that has its origin in the upper left corner. Each dot is understood to be associated with a color (the first with red, the second with blue, and the third with green).

This model is capable of having listeners installed upon it. Anytime this model changes, the listener's changed() method will be invoked.

Author:
mb

Constructor Summary
SimpleThreeDotModel_v2()
          Creates a default version of this data model in which the first dot is in location (20, 20), the second in location (30, 30), and the third in location (40, 40).
 
Method Summary
 void addListener(DotModelListener listener)
          Installs the passed listener on this model.
 void changeDiameterofDot2(int newDiameter)
          Causes the second dot to have a new diameter as specified by the passed value.
 java.awt.Color getColour1()
          Returns the colour associated with the first dot.
 java.awt.Color getColour2()
          Returns the colour associated with the second dot.
 java.awt.Color getColour3()
          Returns the colour associated with the third dot.
 java.awt.geom.Ellipse2D getDot1()
          Returns the circular shape that is associated with the first dot.
 java.awt.geom.Ellipse2D getDot2()
          Returns the circular shape that is associated with the second dot.
 java.awt.geom.Ellipse2D getDot3()
          Returns the circular shape that is associated with the third dot.
 void nudgeToRightDot1()
          Causes the first dot to be nudged to the right by a small amount.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleThreeDotModel_v2

public SimpleThreeDotModel_v2()
Creates a default version of this data model in which the first dot is in location (20, 20), the second in location (30, 30), and the third in location (40, 40). All dots are given diameter of size 100.

Method Detail

getColour1

public java.awt.Color getColour1()
Returns the colour associated with the first dot.

Returns:

getColour2

public java.awt.Color getColour2()
Returns the colour associated with the second dot.

Returns:

getColour3

public java.awt.Color getColour3()
Returns the colour associated with the third dot.

Returns:

getDot1

public java.awt.geom.Ellipse2D getDot1()
Returns the circular shape that is associated with the first dot.

Returns:

getDot2

public java.awt.geom.Ellipse2D getDot2()
Returns the circular shape that is associated with the second dot.

Returns:

getDot3

public java.awt.geom.Ellipse2D getDot3()
Returns the circular shape that is associated with the third dot.

Returns:

nudgeToRightDot1

public void nudgeToRightDot1()
Causes the first dot to be nudged to the right by a small amount. If any listeners are installed on this model, they will be informed that the model has changed.


changeDiameterofDot2

public void changeDiameterofDot2(int newDiameter)
Causes the second dot to have a new diameter as specified by the passed value. If any listeners are installed on this model, they will be informed that the model has changed.


addListener

public void addListener(DotModelListener listener)
Installs the passed listener on this model.

Parameters:
listener -