|
|||||||||
| Home >> All >> org >> apache >> batik >> ext >> awt >> [ geom overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.batik.ext.awt.geom
Class RectListManager

java.lang.Objectorg.apache.batik.ext.awt.geom.RectListManager
- All Implemented Interfaces:
- java.util.Collection, java.lang.Iterable
- public class RectListManager
- extends java.lang.Object
- implements java.util.Collection
- extends java.lang.Object
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).
- Version:
- $Id: RectListManager.java,v 1.9 2004/08/18 07:13:47 vhardy Exp $
| Nested Class Summary | |
private static class |
RectListManager.RectXComparator
Comparator for ordering rects in X. |
private class |
RectListManager.RLMIterator
|
| Field Summary | |
(package private) java.awt.Rectangle |
bounds
|
static java.util.Comparator |
comparator
The comparator used to sort the elements of this List. |
(package private) java.awt.Rectangle[] |
rects
|
(package private) int |
size
|
| Constructor Summary | |
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). |
|
| Method Summary | |
boolean |
add(java.lang.Object o)
Add an element to this collection. |
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)
Add the contents of a given collection to this collection. |
void |
clear()
Clear the collection, such that a subsequent call to isEmpty() would return true. |
java.lang.Object |
clone()
Standard Object clone method. |
boolean |
contains(java.lang.Object o)
Test whether this collection contains a given object as one of its elements. |
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 |
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)
Remove all elements of a given collection from this collection. |
boolean |
removeAll(RectListManager rlm)
|
boolean |
retainAll(java.util.Collection c)
Remove all elements of this collection that are not contained in a given collection. |
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()
Copy the current contents of this collection into an array. |
java.lang.Object[] |
toArray(java.lang.Object[] a)
Copy the current contents of this collection into an array. |
| 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 |
rects
java.awt.Rectangle[] rects
size
int size
bounds
java.awt.Rectangle bounds
comparator
public static java.util.Comparator comparator
- The comparator used to sort the elements of this List.
Sorts on x value of Rectangle.
| Constructor Detail |
RectListManager
public RectListManager(java.util.Collection rects)
- Construct a RectListManager from a Collection of Rectangles
RectListManager
public RectListManager(java.awt.Rectangle[] rects)
- Construct a RectListManager from an Array of
Rectangles
RectListManager
public RectListManager(java.awt.Rectangle[] rects, int off, int sz)
- Construct a RectListManager from an Array of
Rectangles
RectListManager
public RectListManager(RectListManager rlm)
- Construct a RectListManager from another
RectListManager (data is copied).
RectListManager
public RectListManager(java.awt.Rectangle rect)
- Construct a RectListManager with one rectangle
RectListManager
public RectListManager()
- Construct an initially empty RectListManager.
RectListManager
public RectListManager(int capacity)
- Construct an initially empty RectListManager,
with initial capacity.
| Method Detail |
getBounds
public java.awt.Rectangle getBounds()
clone
public java.lang.Object clone()
- Standard Object clone method.
copy
public RectListManager copy()
- Similar to clone only strongly typed
size
public int size()
- Returns the number of elements currently stored in this collection.
- Specified by:
sizein interfacejava.util.Collection
isEmpty
public boolean isEmpty()
- Returns true if this collection contains no elements.
- Specified by:
isEmptyin interfacejava.util.Collection
clear
public void clear()
- Description copied from interface:
java.util.Collection - Clear the collection, such that a subsequent call to isEmpty() would
return true.
- Specified by:
clearin interfacejava.util.Collection
iterator
public java.util.Iterator iterator()
- Returns an iterator over the elements in this collection
- Specified by:
iteratorin interfacejava.util.Collection
listIterator
public java.util.ListIterator listIterator()
- Returns a list iterator of the elements in this list
(in proper sequence).
toArray
public java.lang.Object[] toArray()
- Description copied from interface:
java.util.Collection - Copy the current contents of this collection into an array.
- Specified by:
toArrayin interfacejava.util.Collection
toArray
public java.lang.Object[] toArray(java.lang.Object[] a)
- Description copied from interface:
java.util.Collection - Copy the current contents of this collection into an array. If the array
passed as an argument has length less than the size of this collection, an
array of the same run-time type as a, and length equal to the size of this
collection, is allocated using Reflection. Otherwise, a itself is used.
The elements of this collection are copied into it, and if there is space
in the array, the following element is set to null. The resultant array is
returned.
Note: The fact that the following element is set to null is only useful
if it is known that this collection does not contain any null elements.
- Specified by:
toArrayin interfacejava.util.Collection
add
public boolean add(java.lang.Object o)
- Description copied from interface:
java.util.Collection - Add an element to this collection.
- Specified by:
addin interfacejava.util.Collection
add
public void add(java.awt.Rectangle rect)
- Ensures that this collection contains the specified element
add
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.
addAll
public boolean addAll(java.util.Collection c)
- Description copied from interface:
java.util.Collection - Add the contents of a given collection to this collection.
- Specified by:
addAllin interfacejava.util.Collection
contains
public boolean contains(java.lang.Object o)
- Description copied from interface:
java.util.Collection - Test whether this collection contains a given object as one of its
elements.
- Specified by:
containsin interfacejava.util.Collection
containsAll
public boolean containsAll(java.util.Collection c)
- Returns true if this collection contains all of the elements in
the specified collection.
- Specified by:
containsAllin interfacejava.util.Collection
containsAll
public boolean containsAll(RectListManager rlm)
remove
public boolean remove(java.lang.Object o)
- Removes a single instance of the specified element from this
collection, if it is present.
- Specified by:
removein interfacejava.util.Collection
remove
public boolean remove(java.awt.Rectangle rect)
- Removes a single instance of the specified Rectangle from this
collection, if it is present.
removeAll
public boolean removeAll(java.util.Collection c)
- Description copied from interface:
java.util.Collection - Remove all elements of a given collection from this collection. That is,
remove every element e such that c.contains(e).
- Specified by:
removeAllin interfacejava.util.Collection
removeAll
public boolean removeAll(RectListManager rlm)
retainAll
public boolean retainAll(java.util.Collection c)
- Description copied from interface:
java.util.Collection - Remove all elements of this collection that are not contained in a given
collection. That is, remove every element e such that !c.contains(e).
- Specified by:
retainAllin interfacejava.util.Collection
retainAll
public boolean retainAll(RectListManager rlm)
add
public void add(RectListManager rlm)
- Adds the contents of 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.
mergeRects
public void mergeRects(int overhead,
int lineOverhead)
subtract
public void subtract(RectListManager rlm, int overhead, int lineOverhead)
splitRect
protected void splitRect(java.awt.Rectangle r, java.awt.Rectangle sr, java.awt.Rectangle[] splits)
insertRects
protected void insertRects(java.awt.Rectangle[] rects, int srcPos, int dstPos, int len)
ensureCapacity
public void ensureCapacity(int sz)
|
|||||||||
| Home >> All >> org >> apache >> batik >> ext >> awt >> [ geom overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.batik.ext.awt.geom.RectListManager