SetsApplet
Class ColoredPointSet

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractSet
              |
              +--java.util.HashSet
                    |
                    +--SetsApplet.ColoredPointSet

class ColoredPointSet
extends HashSet

A set of ColoredPoints. You need to modify the containedIn() and colorAll() methods Note: a complete implementation would need to ensure that only ColoredPoint objects are added to the set.

See Also:
Serialized Form

Fields inherited from class java.util.HashSet
map, PRESENT
 
Constructor Summary
ColoredPointSet()
           
ColoredPointSet(ColoredPointSet s)
           
 
Method Summary
 void colorAll(Color c)
          Sets all points to be a particular color.
 ColoredPointSet containedIn(Rectangle r)
          Returns a subset view of Points contained in the given Rectangle.
 
Methods inherited from class java.util.HashSet
, add, clear, clone, contains, isEmpty, iterator, readObject, remove, size, writeObject
 
Methods inherited from class java.util.AbstractSet
equals, hashCode
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Constructor Detail

ColoredPointSet

public ColoredPointSet(ColoredPointSet s)

ColoredPointSet

public ColoredPointSet()
Method Detail

containedIn

public ColoredPointSet containedIn(Rectangle r)
Returns a subset view of Points contained in the given Rectangle. Add code to return a new ColoredPointSet consisting of the points contained in Rectangle r. Look at the Rectangle.contains(Point p) method

You need to modify this method.


colorAll

public void colorAll(Color c)
Sets all points to be a particular color. Add code to iterate through the points, setting the color.

You need to modify this method.