T
- The sub-type of this AbstractGeomList.E
- The type of GeomElement contained in this list.public abstract class AbstractGeomList<T extends AbstractGeomList,E extends GeomElement> extends AbstractGeomElement<T> implements GeometryList<T,E>
GeomElement
objects. The list will not
accept the addition of null
elements.
WARNING: This list allows geometry to be stored in different units and with different physical dimensions. If consistent units or dimensions are required, then the user must specifically convert the list items.
Modified by: Joseph A. Huwaldt
RESOURCES
Constructor and Description |
---|
AbstractGeomList() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E... array)
Appends all of the elements in the specified list of arguments to this geometry
element list.
|
boolean |
add(E value)
Appends the specified
GeomElement to the end of this list. |
boolean |
add(int index,
E... array)
Inserts all of the
GeomElement objects in the specified list of arguments
into this list at the specified position. |
void |
add(int index,
E value)
Inserts the specified
GeomElement at the specified position in this list. |
boolean |
addAll(java.util.Collection<? extends E> c)
Adds all of the elements in the specified collection to this geometry element list.
|
boolean |
addAll(E[] arr)
Appends all of the elements in the specified array to this geometry element list.
|
boolean |
addAll(int index,
java.util.Collection<? extends E> c)
Inserts all of the
GeomElement objects in the specified collection into
this list at the specified position. |
boolean |
addAll(int index,
E[] arr)
Inserts all of the
GeomElement objects in the specified array into this
list at the specified position. |
void |
clear()
Removes all of the elements from this collection.
|
boolean |
contains(java.lang.Object o)
Returns true if this collection contains the specified element.
|
boolean |
containsAll(java.util.Collection<?> c)
Returns true if this collection contains all of the elements in the specified
collection.
|
boolean |
containsGeometry()
Returns
true if this list actually contains any geometry and
false if this list is empty or contains only non-geometry items such
as empty lists. |
boolean |
equals(java.lang.Object obj)
Compares the specified object with this list of
GeomElement objects
for equality. |
E |
get(int index)
Returns the element at the specified position in this list.
|
E |
get(java.lang.String name)
Returns the element with the specified name from this list.
|
GeomList<E> |
getAll()
Returns a new
GeomList with the elements in this list. |
Point |
getBoundsMax()
Return the coordinate point representing the maximum bounding box corner (e.g.: max
X, max Y, max Z).
|
Point |
getBoundsMin()
Return the coordinate point representing the minimum bounding box corner of this
geometry element (e.g.: min X, min Y, min Z).
|
E |
getFirst()
Returns the first element from this list.
|
int |
getIndexFromName(java.lang.String name)
Return the index to the 1st geometry element in this list with the specified name.
|
E |
getLast()
Returns the last element from this list.
|
GeomPoint |
getLimitPoint(int dim,
boolean max,
double tol)
Returns the most extreme point, either minimum or maximum, in the specified
coordinate direction for the geometry in this list.
|
int |
getParDimension()
Returns the number of parametric dimensions of the geometry element.
|
int |
getPhyDimension()
Returns the number of physical dimensions of the geometry element.
|
abstract T |
getRange(int first,
int last)
Returns the range of elements in this list from the specified start and ending
indexes.
|
Unit<Length> |
getUnit()
Returns the unit in which the first geometry element in this list is stated.
|
int |
hashCode()
Returns the hash code for this
AbstractGeomList . |
int |
indexOf(java.lang.Object element)
Returns the index in this list of the first occurrence of the specified element, or
-1 if the list does not contain this element.
|
boolean |
isEmpty()
Returns
true if this collection contains no elements. |
boolean |
isValid()
Return
true if this geometry list contains valid and finite numerical
components. |
java.util.Iterator<E> |
iterator()
Returns an iterator over the elements in this list.
|
int |
lastIndexOf(java.lang.Object element)
Returns the index in this list of the last occurrence of the specified element, or
-1 if the list does not contain this element.
|
java.util.ListIterator<E> |
listIterator()
Returns a list iterator over the elements in this list.
|
java.util.ListIterator<E> |
listIterator(int index)
Returns a list iterator from the specified position.
|
E |
remove(int index)
Removes the element at the specified position in this list.
|
boolean |
remove(java.lang.Object o)
Removes a single instance of the specified element from this collection, if it is
present (optional operation).
|
E |
remove(java.lang.String name)
Removes the element with the specified name from this list.
|
boolean |
removeAll(java.util.Collection<?> c)
Removes from this list all the elements that are contained in the specified
collection.
|
void |
reset()
Resets the internal state of this object to its default values.
|
boolean |
retainAll(java.util.Collection<?> c)
Retains only the elements in this list that are contained in the specified
collection.
|
abstract T |
reverse()
Returns an new
GeomList with the elements in this list in reverse order. |
E |
set(int index,
E element)
Replaces the <@link GeomElement> at the specified position in this list with the
specified element.
|
int |
size()
Returns the number of elements in this list.
|
java.util.List<E> |
subList(int fromIndex,
int toIndex)
Returns a view of the portion of this list between fromIndex, inclusive, and
toIndex, exclusive.
|
java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this collection.
|
<T> T[] |
toArray(T[] a)
Returns an array containing all of the elements in this collection.
|
javolution.text.Text |
toText()
Returns the text representation of this geometry element.
|
java.util.List<E> |
unmodifiableList()
Returns an unmodifiable list view associated to this list.
|
addChangeListener, clone, compareTo, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName, toString
to, toDimension
getTransformed
addChangeListener, copy, copyToReal, getAllUserData, getID, getName, getUserData, putAllUserData, putUserData, removeChangeListener, removeUserData, setName
public AbstractGeomList()
public int size()
size
in interface GeomElement<T extends AbstractGeomList>
size
in interface java.util.Collection<E extends GeomElement>
size
in interface java.util.List<E extends GeomElement>
public boolean isEmpty()
true
if this collection contains no elements.isEmpty
in interface java.util.Collection<E extends GeomElement>
isEmpty
in interface java.util.List<E extends GeomElement>
public boolean containsGeometry()
true
if this list actually contains any geometry and
false
if this list is empty or contains only non-geometry items such
as empty lists.containsGeometry
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
public E get(int index)
get
in interface java.util.List<E extends GeomElement>
index
- index of element to return (0 returns the 1st element, -1 returns the
last, -2 returns the 2nd from last, etc).java.lang.IndexOutOfBoundsException
- if the given index is out of range:
index > size()
public abstract T getRange(int first, int last)
getRange
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
first
- index of the first element to return (0 returns the 1st element, -1
returns the last, etc).last
- index of the last element to return (0 returns the 1st element, -1
returns the last, etc).java.lang.IndexOutOfBoundsException
- if the given index is out of range:
index > size()
public java.util.List<E> subList(int fromIndex, int toIndex)
list.subList(from, to).clear();
Similar idioms may be constructed for
indexOf
and lastIndexOf
, and all of the algorithms in the
Collections
class can be applied to a subList.
The semantics of the list returned by this method become undefined if the backing
list (i.e., this list) is structurally modified in any way other than via
the returned list (structural modifications are those that change the size of this
list, or otherwise perturb it in such a fashion that iterations in progress may
yield incorrect results).subList
in interface java.util.List<E extends GeomElement>
fromIndex
- low endpoint (inclusive) of the subList.toIndex
- high endpoint (exclusive) of the subList.java.lang.IndexOutOfBoundsException
- if the given index is out of range:
index > size()
public E getFirst()
getFirst
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
public E getLast()
getLast
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
public E get(java.lang.String name)
get
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
name
- The name of the element we are looking for in the list.null
is returned.public E set(int index, E element)
set
in interface java.util.List<E extends GeomElement>
index
- The index of the element to replace (0 returns the 1st element, -1
returns the last, -2 returns the 2nd from last, etc).element
- The element to be stored at the specified position.
May not be null.java.lang.IndexOutOfBoundsException
- - if index > size()
public void add(int index, E value)
GeomElement
at the specified position in this list.
Shifts the element currently at that position (if any) and any subsequent elements
to the right (adds one to their indices). Null values are ignored.
Note: If this method is used, concurrent access must be synchronized (the list is not thread-safe).
add
in interface java.util.List<E extends GeomElement>
index
- the index at which the specified element is to be inserted. (0 returns
the 1st element, -1 returns the last, -2 returns the 2nd from last,
etc).value
- the element to be inserted. May not be null.java.lang.IndexOutOfBoundsException
- if index > size()
public boolean add(E value)
GeomElement
to the end of this list. Null values are
ignored.
Note: If this method is used concurrent access must be synchronized (the table is not thread-safe).
add
in interface java.util.Collection<E extends GeomElement>
add
in interface java.util.List<E extends GeomElement>
value
- the element to be inserted. May not be null.true
if this collection changed as a result of the call.DimensionException
- if the input element's dimensions are different from
this list's dimensions.public boolean addAll(java.util.Collection<? extends E> c)
addAll
in interface java.util.Collection<E extends GeomElement>
addAll
in interface java.util.List<E extends GeomElement>
c
- elements to be inserted into this collection. May not be null.true
if this collection changed as a result of the call.public boolean addAll(int index, java.util.Collection<? extends E> c)
GeomElement
objects in the specified collection into
this list at the specified position. Shifts the element currently at that position
(if any) and any subsequent elements to the right (increases their indices). The
new elements will appear in this list in the order that they are returned by the
specified collection's iterator. The behavior of this operation is unspecified if
the specified collection is modified while the operation is in progress. (Note that
this will occur if the specified collection is this list, and it's nonempty.)addAll
in interface java.util.List<E extends GeomElement>
index
- index at which to insert first element from the specified collection.c
- elements to be inserted into this collection. May not be null.true
if this collection changed as a result of the call.public boolean addAll(E[] arr)
addAll
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
arr
- elements to be appended onto this collection. May not be null.true
if this collection changed as a result of the call.public boolean addAll(int index, E[] arr)
GeomElement
objects in the specified array into this
list at the specified position. Shifts the element currently at that position (if
any) and any subsequent elements to the right (increases their indices). The new
elements will appear in this list in the order that they are returned by the
specified collection's iterator.addAll
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
index
- index at which to insert first element from the specified array.arr
- elements to be inserted into this collection. May not be null.true
if this collection changed as a result of the call.public boolean add(E... array)
add
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
array
- elements to be inserted into this collection. May not be null.true
if this collection changed as a result of the call.public boolean add(int index, E... array)
GeomElement
objects in the specified list of arguments
into this list at the specified position. Shifts the element currently at that
position (if any) and any subsequent elements to the right (increases their
indices). The new elements will appear in this list in the order that they are
appeared in the array.add
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
index
- index at which to insert first element from the specified array.array
- elements to be inserted into this collection. May not be null.true
if this collection changed as a result of the call.public E remove(int index)
remove
in interface java.util.List<E extends GeomElement>
index
- the index of the element to remove. (0 returns the 1st element, -1
returns the last, -2 returns the 2nd from last, etc).public boolean remove(java.lang.Object o)
(o==null ? e==null : o.equals(e))
, if this collection contains one or
more such elements. Returns true if this collection contained the specified element
(or equivalently, if this collection changed as a result of the call).remove
in interface java.util.Collection<E extends GeomElement>
remove
in interface java.util.List<E extends GeomElement>
o
- element to be removed from this collection, if present.true
if this collection changed as a result of the call.public E remove(java.lang.String name)
remove
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
name
- the name of the element to remove.public void clear()
clear
in interface java.util.Collection<E extends GeomElement>
clear
in interface java.util.List<E extends GeomElement>
public java.util.Iterator<E> iterator()
iterator
in interface java.lang.Iterable<E extends GeomElement>
iterator
in interface java.util.Collection<E extends GeomElement>
iterator
in interface java.util.List<E extends GeomElement>
public java.util.ListIterator<E> listIterator()
listIterator
in interface java.util.List<E extends GeomElement>
public java.util.ListIterator<E> listIterator(int index)
listIterator
in interface java.util.List<E extends GeomElement>
index
- the index of first value to be returned from the list iterator (by a
call to the next method).public java.util.List<E> unmodifiableList()
unmodifiableList
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
public GeomList<E> getAll()
GeomList
with the elements in this list.getAll
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
public boolean removeAll(java.util.Collection<?> c)
removeAll
in interface java.util.Collection<E extends GeomElement>
removeAll
in interface java.util.List<E extends GeomElement>
c
- collection that defines which elements will be removed from this list.true
if this list changed as a result of the call.public boolean retainAll(java.util.Collection<?> c)
retainAll
in interface java.util.Collection<E extends GeomElement>
retainAll
in interface java.util.List<E extends GeomElement>
c
- collection that defines which elements this set will retain. May not be null.true
if this list changed as a result of the call.public abstract T reverse()
GeomList
with the elements in this list in reverse order.reverse
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
public int indexOf(java.lang.Object element)
indexOf
in interface java.util.List<E extends GeomElement>
element
- The element to search for.public int lastIndexOf(java.lang.Object element)
lastIndexOf
in interface java.util.List<E extends GeomElement>
element
- The element to search for.public int getIndexFromName(java.lang.String name)
null
names are ignored.getIndexFromName
in interface GeometryList<T extends AbstractGeomList,E extends GeomElement>
name
- The name of the geometry element to find in this listpublic boolean contains(java.lang.Object o)
contains
in interface java.util.Collection<E extends GeomElement>
contains
in interface java.util.List<E extends GeomElement>
o
- object to be checked for containment in this collection.true
if this collection contains the specified element.public boolean containsAll(java.util.Collection<?> c)
containsAll
in interface java.util.Collection<E extends GeomElement>
containsAll
in interface java.util.List<E extends GeomElement>
c
- collection to be checked for containment in this collection. May not be null.true
if this collection contains all of the elements in the
specified collection.public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<E extends GeomElement>
toArray
in interface java.util.List<E extends GeomElement>
public <T> T[] toArray(T[] a)
toArray
in interface java.util.Collection<E extends GeomElement>
toArray
in interface java.util.List<E extends GeomElement>
T
- The type of elements in this collection.a
- the array into which the elements of the collection are to be stored, if
it is big enough; otherwise, a new array of the same type is allocated
for this purpose.public boolean isValid()
true
if this geometry list contains valid and finite numerical
components. A value of false
will be returned if any of the elements
in this list are invalid.isValid
in interface GeomElement<T extends AbstractGeomList>
public Unit<Length> getUnit()
getUnit
in interface GeomElement<T extends AbstractGeomList>
public boolean equals(java.lang.Object obj)
GeomElement
objects
for equality. Returns true if and only if both collections are of the same type and
both collections contain equal elements in the same order.equals
in interface java.util.Collection<E extends GeomElement>
equals
in interface java.util.List<E extends GeomElement>
equals
in class AbstractGeomElement<T extends AbstractGeomList>
obj
- the object to compare with.true
if this list is identical to that list;
false
otherwise.public int hashCode()
AbstractGeomList
.hashCode
in interface java.util.Collection<E extends GeomElement>
hashCode
in interface java.util.List<E extends GeomElement>
hashCode
in class AbstractGeomElement<T extends AbstractGeomList>
public javolution.text.Text toText()
toText
in interface GeomElement<T extends AbstractGeomList>
toText
in class AbstractGeomElement<T extends AbstractGeomList>
public int getPhyDimension()
getPhyDimension
in interface GeomElement<T extends AbstractGeomList>
public int getParDimension()
getParDimension
in interface GeomElement<T extends AbstractGeomList>
public Point getBoundsMin()
getBoundsMin
in interface GeomElement<T extends AbstractGeomList>
java.lang.IndexOutOfBoundsException
- if this list contains no geometry.public Point getBoundsMax()
getBoundsMax
in interface GeomElement<T extends AbstractGeomList>
java.lang.IndexOutOfBoundsException
- if this list contains no elements.public GeomPoint getLimitPoint(int dim, boolean max, double tol)
getLimitPoint
in interface GeomElement<T extends AbstractGeomList>
dim
- An index indicating the dimension to find the min/max point for (0=X,
1=Y, 2=Z, etc).max
- Set to true
to return the maximum value, false
to return the minimum.tol
- Fractional tolerance to refine the min/max point position to if
necessary.GeomElement.getBoundsMin()
,
GeomElement.getBoundsMax()
public void reset()
super.reset();
to ensure that the state
is reset properly.reset
in interface javolution.lang.Reusable
reset
in class AbstractGeomElement<T extends AbstractGeomList>