| java.lang.Object org.geotools.feature.collection.AbstractResourceCollection org.geotools.feature.collection.AbstractResourceList
All known Subclasses: org.geotools.feature.collection.SubResourceList, org.geotools.feature.collection.AbstractFeatureList,
AbstractResourceList | abstract public class AbstractResourceList extends AbstractResourceCollection implements ResourceList(Code) | | Starter for resource based list implementations.
Same deal as ResouceCollections - iterators that need to be closed. This
implementation is set up for random access happy content, like an array list.
Read-only:
For read/write:
set(index, element) - for fixed length
add(index, element) and remove(index) for dynamic length
As usual override anything if you have a faster implementation, say based
on a shapefile index.
author: Jody Garnett, Refractions Research, Inc. See Also: AbstractList since: GeoTools 2.2 |
Field Summary | |
protected transient int | modCount The number of times this list has been modified. |
Method Summary | |
public boolean | add(Object item) Appends element.
This implementation calls add(size(), o).
Note that this implementation throws an
UnsupportedOperationException unless add(int, Object)
is overridden.
Parameters: item - the Object element to be appended to this list. | public void | add(int index, Object element) Inserts the specified element at the specified position in this list
(optional operation). | public boolean | addAll(int index, Collection c) Inserts all of the elements in the specified collection into this list at
the specified position (optional operation). | public void | clear() Removes all of the elements from this collection (optional operation). | protected void | closeIterator(Iterator close) | public boolean | equals(Object o) Compares the specified object with this list for equality. | abstract public Object | get(int index) item at the specified index. | public int | hashCode() Returns the hash code value for this list. | public int | indexOf(Object o) Returns the index in this list of the first occurence of the specified
element, or -1 if the list does not contain this element. | public int | lastIndexOf(Object o) Returns the index in this list of the last occurence of the specified
element, or -1 if the list does not contain this element. | public ListIterator | listIterator() Returns listIterator(0). | public ListIterator | listIterator(int index) Returns a list iterator of the elements in this list from index on. | public ListIterator | openIterator(int index) | protected Iterator | openIterator() Returns a quick iterator that uses get and size methods. | public Object | remove(int index) Removes the element at the specified position in this list (optional
operation). | public void | removeRange(int fromIndex, int toIndex) | public Object | set(int index, Object item) Replaces item in position index (optional operation).
This implementation always throws an
UnsupportedOperationException.
Parameters: index - index of element to replace. Parameters: item - the Object element to be stored at the specified position. | public List | subList(int fromIndex, int toIndex) view of the portion of this list between fromIndex up to toIndex. |
modCount | protected transient int modCount(Code) | | The number of times this list has been modified.
|
AbstractResourceList | protected AbstractResourceList()(Code) | | |
add | public boolean add(Object item)(Code) | | Appends element.
This implementation calls add(size(), o).
Note that this implementation throws an
UnsupportedOperationException unless add(int, Object)
is overridden.
Parameters: item - the Object element to be appended to this list. true (as per the general contract ofCollection.add). throws: UnsupportedOperationException - if the add method is not supported by this Set. throws: ClassCastException - if the class of the specified element prevents it from beingadded to this set. throws: IllegalArgumentException - some aspect of this element prevents it from being added tothis collection. |
add | public void add(int index, Object element)(Code) | | Inserts the specified element at the specified position in this list
(optional operation). Shifts the element currently at that position (if
any) and any subsequent elements to the right (adds one to their
indices).
This implementation always throws an UnsupportedOperationException.
Parameters: index - index at which the specified element is to be inserted. Parameters: element - element to be inserted. throws: UnsupportedOperationException - if the add method is not supported by this list. throws: ClassCastException - if the class of the specified element prevents it from beingadded to this list. throws: IllegalArgumentException - if some aspect of the specified element prevents it frombeing added to this list. throws: IndexOutOfBoundsException - index is out of range (index <0 || index > size()). |
addAll | public boolean addAll(int index, Collection c)(Code) | | Inserts all of the elements in the specified collection into this list at
the specified position (optional operation).
Note that this implementation throws an
UnsupportedOperationException unless add(int, Object)
is overridden.
true if this list changed as a result of the call. Parameters: index - index at which to insert the first element from the specifiedcollection. Parameters: c - elements to be inserted into this List. throws: UnsupportedOperationException - if the addAll method is not supported by thislist. throws: ClassCastException - if the class of an element of the specified collectionprevents it from being added to this List. throws: IllegalArgumentException - some aspect an element of the specified collection preventsit from being added to this List. throws: IndexOutOfBoundsException - index out of range (index < 0|| index > size()). throws: NullPointerException - if the specified collection is null. |
clear | public void clear()(Code) | | Removes all of the elements from this collection (optional operation).
This implementation calls removeRange(0, size()).
Note that this implementation throws an
UnsupportedOperationException unless remove(int
index)
or removeRange(int fromIndex, int toIndex) is overridden.
throws: UnsupportedOperationException - if the clear method is not supported by thisCollection. |
equals | public boolean equals(Object o)(Code) | | Compares the specified object with this list for equality. Returns
true if and only if the specified object is also a list, both
lists have the same size, and all corresponding pairs of elements in the
two lists are equal. (Two elements e1 and e2
are equal if (e1==null ? e2==null :
e1.equals(e2)).)
In other words, two lists are defined to be equal if they contain the
same elements in the same order.
This implementation first checks if the specified object is this list. If
so, it returns true; if not, it checks if the specified
object is a list. If not, it returns false; if so, it
iterates over both lists, comparing corresponding pairs of elements. If
any comparison returns false, this method returns
false. If either iterator runs out of elements before the
other it returns false (as the lists are of unequal length);
otherwise it returns true when the iterations complete.
Parameters: o - the object to be compared for equality with this list. true if the specified object is equal to this list. |
get | abstract public Object get(int index)(Code) | | item at the specified index.
Parameters: index - index of item the item at the specified index. throws: IndexOutOfBoundsException - if index is not between 0 and size |
hashCode | public int hashCode()(Code) | | Returns the hash code value for this list.
This implementation uses exactly the code that is used to define the list
hash function in the documentation for the List.hashCode
method.
the hash code value for this list. |
indexOf | public int indexOf(Object o)(Code) | | Returns the index in this list of the first occurence of the specified
element, or -1 if the list does not contain this element. More formally,
returns the lowest index i such that (o==null ?
get(i)==null : o.equals(get(i))),
or -1 if there is no such index.
This implementation first gets a list iterator (with
listIterator()). Then, it iterates over the list until the
specified element is found or the end of the list is reached.
Parameters: o - element to search for. the index in this List of the first occurence of the specifiedelement, or -1 if the List does not contain this element. |
lastIndexOf | public int lastIndexOf(Object o)(Code) | | Returns the index in this list of the last occurence of the specified
element, or -1 if the list does not contain this element. More formally,
returns the highest index i such that (o==null ?
get(i)==null : o.equals(get(i))),
or -1 if there is no such index.
This implementation first gets a list iterator that points to the end of
the list (with listIterator(size())). Then, it iterates backwards over
the list until the specified element is found, or the beginning of the
list is reached.
Parameters: o - element to search for. the index in this list of the last occurence of the specifiedelement, or -1 if the list does not contain this element. |
openIterator | protected Iterator openIterator()(Code) | | Returns a quick iterator that uses get and size methods.
As with all resource collections it is assumed that the iterator will be
closed after use.
an iterator over the elements in this list in proper sequence. See Also: AbstractResourceList.modCount |
remove | public Object remove(int index)(Code) | | Removes the element at the specified position in this list (optional
operation). Shifts any subsequent elements to the left (subtracts one
from their indices). Returns the element that was removed from the list.
This implementation always throws an
UnsupportedOperationException.
Parameters: index - the index of the element to remove. the element previously at the specified position. throws: UnsupportedOperationException - if the remove method is not supported by thislist. throws: IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index >= size()). |
removeRange | public void removeRange(int fromIndex, int toIndex)(Code) | | Removes from this list all of the elements whose index is between
fromIndex upto toIndex
Parameters: fromIndex - index of first element to be removed. Parameters: toIndex - index after last element to be removed. |
set | public Object set(int index, Object item)(Code) | | Replaces item in position index (optional operation).
This implementation always throws an
UnsupportedOperationException.
Parameters: index - index of element to replace. Parameters: item - the Object element to be stored at the specified position. the element previously at the specified position. throws: UnsupportedOperationException - if the set method is not supported by this List. throws: ClassCastException - if the class of the specified element prevents it from beingadded to this list. throws: IllegalArgumentException - if some aspect of the specified element prevents it frombeing added to this list. throws: IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index >= size()). |
subList | public List subList(int fromIndex, int toIndex)(Code) | | view of the portion of this list between fromIndex up to toIndex.
Parameters: fromIndex - Parameters: toIndex - a view of the specified range within this list. throws: IndexOutOfBoundsException - throws: IllegalArgumentException - endpoint indices out of order |
Fields inherited from org.geotools.feature.collection.AbstractResourceCollection | final protected Set open(Code)(Java Doc)
|
|
|