public class BasicZList extends java.lang.Object implements ZList
Yellow |
Constructor and Description |
---|
BasicZList() |
Modifier and Type | Method and Description |
---|---|
void |
add(Figure f)
Add a figure to the container.
|
void |
add(int index,
Figure f)
Insert a figure at the given position.
|
void |
clear()
Removes all of the figures from this list.
|
boolean |
contains(Figure f)
Test if the z-list contains the given figure.
|
java.util.Iterator |
figures()
Return an iteration of the figures in this container.
|
java.util.Iterator |
figuresFromBack()
Return an iteration of the figures in this container, from
highest index to lowest index.
|
java.util.Iterator |
figuresFromFront()
Return an iteration of the figures in this container, from
lowest index to highest index.
|
Figure |
get(int index)
Get the figure at the given index.
|
java.awt.geom.Rectangle2D |
getBounds()
Get the bounding box of all the figures in this list.
|
GeometricSet |
getContainedFigures(java.awt.geom.Rectangle2D region)
Get the figures that are entirely contained by the given
region.
|
int |
getFigureCount()
Return the number of figures in this list.
|
GeometricSet |
getIntersectedFigures(java.awt.geom.Rectangle2D region)
Get the figures with bounding boxes that intersect the given
region.
|
int |
indexOf(Figure f)
Return the index of the given figure in the Z-list.
|
void |
remove(Figure f)
Remove the given figure from this container.
|
void |
remove(int index)
Remove the figure at the given position in the list.
|
void |
set(int index,
Figure f)
Replace the figure at the given index with the passed-in
figure.
|
void |
setIndex(int index,
Figure f)
Set the index of the given figure.
|
public void add(Figure f)
public void add(int index, Figure f)
public void clear()
public java.awt.geom.Rectangle2D getBounds()
public boolean contains(Figure f)
Clients should note that, in general, a much better way of making this same test is to check if the parent of the figure is the same object as this container.
public java.util.Iterator figures()
public java.util.Iterator figuresFromBack()
figuresFromBack
in interface FigureSet
public java.util.Iterator figuresFromFront()
figuresFromFront
in interface FigureSet
public Figure get(int index)
public int getFigureCount()
getFigureCount
in interface ZList
public GeometricSet getContainedFigures(java.awt.geom.Rectangle2D region)
getContainedFigures
in interface ZList
public GeometricSet getIntersectedFigures(java.awt.geom.Rectangle2D region)
getIntersectedFigures
in interface ZList
public int indexOf(Figure f)
public void remove(Figure f)
public void remove(int index)
public void set(int index, Figure f)