|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ZList
A ZList is an interface for objects that contain an ordered list of figures in z-order. In addition to the methods inherited from FigureChildren, ZList has methods for reordering figures in the list, and in the future may have methods for locating objects in 2D space. This interface is used to isolate the implementation of figure containers from the z-list, to allow future optimization of the z-list implementation. This interface tries to mimic the AWT Container and Swing JLayerPane interfaces where possible. Unfortunately, these two classes differ on the relation between list ordering and display ordering, so we have chosen to use the AWT Container order (high-numbered elements are displayed below lower-numbered elements), since we thought it would make using the add method less error-prone.
Yellow |
Method Summary | |
---|---|
void |
add(Figure f)
Add a figure to the list. |
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 this list contains the given figure. |
Figure |
get(int index)
Return 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 elements 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 list. |
void |
remove(int index)
Remove the figure at the given index from this 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. |
Methods inherited from interface diva.canvas.FigureSet |
---|
figures, figuresFromBack, figuresFromFront |
Method Detail |
---|
void add(Figure f)
void add(int index, Figure f)
Clients should assume that an implementation of this method does not check if the figure is already contained.
void clear()
boolean contains(Figure f)
contains
in interface FigureSet
Figure get(int index)
java.lang.IndexOutOfBoundsException
- The index is out of range.java.awt.geom.Rectangle2D getBounds()
GeometricSet getContainedFigures(java.awt.geom.Rectangle2D region)
GeometricSet getIntersectedFigures(java.awt.geom.Rectangle2D region)
int indexOf(Figure f)
void remove(Figure f)
void remove(int index)
java.lang.IndexOutOfBoundsException
- The index is out of range.void set(int index, Figure f)
void setIndex(int index, Figure f)
Clients should assume that an implementation of this method does not check if the figure is already contained -- clients are therefore responsible for being bug-free.
java.lang.IndexOutOfBoundsException
- The new index is out of range.int getFigureCount()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |