public class RectListManager
extends java.lang.Object
implements java.util.Collection
| Modifier and Type | Field and Description |
|---|---|
static java.util.Comparator |
comparator
The comparator used to sort the elements of this List.
|
| Constructor and Description |
|---|
RectListManager()
Construct an initially empty RectListManager.
|
RectListManager(java.util.Collection rects)
Construct a RectListManager from a Collection of Rectangles
|
RectListManager(int capacity)
Construct an initially empty RectListManager,
with initial capacity.
|
RectListManager(java.awt.Rectangle rect)
Construct a RectListManager with one rectangle
|
RectListManager(java.awt.Rectangle[] rects)
Construct a RectListManager from an Array of
Rectangles
|
RectListManager(java.awt.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).
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(java.lang.Object o) |
void |
add(java.awt.Rectangle rect)
Ensures that this collection contains the specified element
|
protected void |
add(java.awt.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(java.util.Collection c) |
void |
clear() |
java.lang.Object |
clone()
Standard Object clone method.
|
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.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) |
java.awt.Rectangle |
getBounds() |
protected void |
insertRects(java.awt.Rectangle[] rects,
int srcPos,
int dstPos,
int len) |
boolean |
isEmpty()
Returns true if this collection contains no elements.
|
java.util.Iterator |
iterator()
Returns an iterator over the elements in this collection
|
java.util.ListIterator |
listIterator()
Returns a list iterator of the elements in this list
(in proper sequence).
|
void |
mergeRects(int overhead,
int lineOverhead) |
boolean |
remove(java.lang.Object o)
Removes a single instance of the specified element from this
collection, if it is present.
|
boolean |
remove(java.awt.Rectangle rect)
Removes a single instance of the specified Rectangle from this
collection, if it is present.
|
boolean |
removeAll(java.util.Collection c) |
boolean |
removeAll(RectListManager rlm) |
boolean |
retainAll(java.util.Collection c) |
boolean |
retainAll(RectListManager rlm) |
int |
size()
Returns the number of elements currently stored in this collection.
|
protected void |
splitRect(java.awt.Rectangle r,
java.awt.Rectangle sr,
java.awt.Rectangle[] splits) |
void |
subtract(RectListManager rlm,
int overhead,
int lineOverhead) |
java.lang.Object[] |
toArray() |
java.lang.Object[] |
toArray(java.lang.Object[] a)
fill the given array a with values from my internal
rects. |
public static java.util.Comparator comparator
public RectListManager(java.util.Collection rects)
rects - Collection that must only contain rectangles.public RectListManager(java.awt.Rectangle[] rects)
rects - Array of Rectangles, must not contain
any null entries.public RectListManager(java.awt.Rectangle[] rects,
int off,
int sz)
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)
rlm - RectListManager to copy.public RectListManager(java.awt.Rectangle rect)
rect - The rectangle to put in this rlm.public RectListManager()
public RectListManager(int capacity)
capacity - The inital capacity for the list. Setting
this appropriately can save reallocations.public void dump()
public java.awt.Rectangle getBounds()
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic RectListManager copy()
public int size()
size in interface java.util.Collectionpublic boolean isEmpty()
isEmpty in interface java.util.Collectionpublic void clear()
clear in interface java.util.Collectionpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectionpublic java.util.ListIterator listIterator()
public java.lang.Object[] toArray()
toArray in interface java.util.Collectionpublic java.lang.Object[] toArray(java.lang.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 java.util.Collectiona - array to fill (must not be null!)public boolean add(java.lang.Object o)
add in interface java.util.Collectionpublic void add(java.awt.Rectangle rect)
rect - The rectangle to addprotected void add(java.awt.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(java.util.Collection c)
addAll in interface java.util.Collectionpublic boolean contains(java.lang.Object o)
contains in interface java.util.Collectionpublic boolean containsAll(java.util.Collection c)
containsAll in interface java.util.Collectionpublic boolean containsAll(RectListManager rlm)
public boolean remove(java.lang.Object o)
remove in interface java.util.Collectiono - Object to remove an matching instance of.public boolean remove(java.awt.Rectangle rect)
rect - Rectangle to remove an matching instance of.public boolean removeAll(java.util.Collection c)
removeAll in interface java.util.Collectionpublic boolean removeAll(RectListManager rlm)
public boolean retainAll(java.util.Collection c)
retainAll in interface java.util.Collectionpublic boolean retainAll(RectListManager rlm)
public void add(RectListManager rlm)
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(java.awt.Rectangle r,
java.awt.Rectangle sr,
java.awt.Rectangle[] splits)
protected void insertRects(java.awt.Rectangle[] rects,
int srcPos,
int dstPos,
int len)
public void ensureCapacity(int sz)
Copyright ? 2009 Apache Software Foundation. All Rights Reserved.