|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.batik.ext.awt.geom.RectListManager
public class RectListManager
RectListManager is a class to manage a list of rectangular regions. This class contains methods to add new rectangles to the List, to merge rectangles in the list (based on a cost function), and functions to subract one RectListManager from another. The main purpose of this class is to manage dirty regions on a display (for this reason it uses Rectangle not Rectangle2D).
| Field Summary | |
|---|---|
static Comparator |
comparator
The comparator used to sort the elements of this List. |
| Constructor Summary | |
|---|---|
RectListManager()
Construct an initially empty RectListManager. |
|
RectListManager(Collection rects)
Construct a RectListManager from a Collection of Rectangles |
|
RectListManager(int capacity)
Construct an initially empty RectListManager,
with initial capacity. |
|
RectListManager(Rectangle rect)
Construct a RectListManager with one rectangle |
|
RectListManager(Rectangle[] rects)
Construct a RectListManager from an Array of
Rectangles |
|
RectListManager(Rectangle[] rects,
int off,
int sz)
Construct a RectListManager from an Array of
Rectangles |
|
RectListManager(RectListManager rlm)
Construct a RectListManager from another
RectListManager (data is copied). |
|
| Method Summary | |
|---|---|
boolean |
add(Object o)
|
void |
add(Rectangle rect)
Ensures that this collection contains the specified element |
protected void |
add(Rectangle rect,
int l,
int r)
Ensures that this collection contains the specified element l is the lower bound index for insertion r is upper bound index for insertion. |
void |
add(RectListManager rlm)
Adds the contents of rlm to this RectListManager. |
boolean |
addAll(Collection c)
|
void |
clear()
|
Object |
clone()
Standard Object clone method. |
boolean |
contains(Object o)
|
boolean |
containsAll(Collection c)
Returns true if this collection contains all of the elements in the specified collection. |
boolean |
containsAll(RectListManager rlm)
|
RectListManager |
copy()
Similar to clone only strongly typed TODO Java 5: The use of covariant return types on clone() can eliminate this method. |
void |
dump()
|
void |
ensureCapacity(int sz)
|
Rectangle |
getBounds()
|
protected void |
insertRects(Rectangle[] rects,
int srcPos,
int dstPos,
int len)
|
boolean |
isEmpty()
Returns true if this collection contains no elements. |
Iterator |
iterator()
Returns an iterator over the elements in this collection |
ListIterator |
listIterator()
Returns a list iterator of the elements in this list (in proper sequence). |
void |
mergeRects(int overhead,
int lineOverhead)
|
boolean |
remove(Object o)
Removes a single instance of the specified element from this collection, if it is present. |
boolean |
remove(Rectangle rect)
Removes a single instance of the specified Rectangle from this collection, if it is present. |
boolean |
removeAll(Collection c)
|
boolean |
removeAll(RectListManager rlm)
|
boolean |
retainAll(Collection c)
|
boolean |
retainAll(RectListManager rlm)
|
int |
size()
Returns the number of elements currently stored in this collection. |
protected void |
splitRect(Rectangle r,
Rectangle sr,
Rectangle[] splits)
|
void |
subtract(RectListManager rlm,
int overhead,
int lineOverhead)
|
Object[] |
toArray()
|
Object[] |
toArray(Object[] a)
fill the given array a with values from my internal rects. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
|---|
equals, hashCode |
| Field Detail |
|---|
public static Comparator comparator
| Constructor Detail |
|---|
public RectListManager(Collection rects)
RectListManager from a Collection of Rectangles
rects - Collection that must only contain rectangles.public RectListManager(Rectangle[] rects)
RectListManager from an Array of
Rectangles
rects - Array of Rectangles, must not contain
any null entries.
public RectListManager(Rectangle[] rects,
int off,
int sz)
RectListManager from an Array of
Rectangles
rects - Array of Rectangles, must not contain
any null entries in the range [off, off+sz-1].off - The offset to start copying from in rects.sz - The number of entries to copy from rects.public RectListManager(RectListManager rlm)
RectListManager from another
RectListManager (data is copied).
rlm - RectListManager to copy.public RectListManager(Rectangle rect)
RectListManager with one rectangle
rect - The rectangle to put in this rlm.public RectListManager()
RectListManager.
public RectListManager(int capacity)
RectListManager,
with initial capacity.
capacity - The inital capacity for the list. Setting
this appropriately can save reallocations.| Method Detail |
|---|
public void dump()
public Rectangle getBounds()
public Object clone()
throws CloneNotSupportedException
Object clone method.
clone in class ObjectCloneNotSupportedExceptionpublic RectListManager copy()
public int size()
size in interface Collectionpublic boolean isEmpty()
isEmpty in interface Collectionpublic void clear()
clear in interface Collectionpublic Iterator iterator()
iterator in interface Iterableiterator in interface Collectionpublic ListIterator listIterator()
public Object[] toArray()
toArray in interface Collectionpublic Object[] toArray(Object[] a)
rects.
when a is not large enough, a new array is allocated, filled and returned.
the method works only, when a is a Object[] or a Rectange[].
When this is not the case, the a[] is just cleared.
toArray in interface Collectiona - array to fill (must not be null!)
public boolean add(Object o)
add in interface Collectionpublic void add(Rectangle rect)
rect - The rectangle to add
protected void add(Rectangle rect,
int l,
int r)
rect - The rectangle to addl - the lowest possible index for a rect with
greater 'x' coord.r - the highest possible index for a rect with
greater 'x' coord.public boolean addAll(Collection c)
addAll in interface Collectionpublic boolean contains(Object o)
contains in interface Collectionpublic boolean containsAll(Collection c)
containsAll in interface Collectionpublic boolean containsAll(RectListManager rlm)
public boolean remove(Object o)
remove in interface Collectiono - Object to remove an matching instance of.public boolean remove(Rectangle rect)
rect - Rectangle to remove an matching instance of.public boolean removeAll(Collection c)
removeAll in interface Collectionpublic boolean removeAll(RectListManager rlm)
public boolean retainAll(Collection c)
retainAll in interface Collectionpublic boolean retainAll(RectListManager rlm)
public void add(RectListManager rlm)
rlm to this RectListManager. No
collapsing of rectangles is done here the contents are simply
added (you should generally call 'mergeRects' some time after
this operation before using the contents of this
RectListManager.
rlm - The RectListManager to add the contents of.
public void mergeRects(int overhead,
int lineOverhead)
public void subtract(RectListManager rlm,
int overhead,
int lineOverhead)
protected void splitRect(Rectangle r,
Rectangle sr,
Rectangle[] splits)
protected void insertRects(Rectangle[] rects,
int srcPos,
int dstPos,
int len)
public void ensureCapacity(int sz)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||