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
| Methods inherited from class java.util.HashSet |
,
add,
clear,
clone,
contains,
isEmpty,
iterator,
readObject,
remove,
size,
writeObject |
ColoredPointSet
public ColoredPointSet(ColoredPointSet s)
ColoredPointSet
public ColoredPointSet()
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.