|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
org.eclipse.emf.common.util.AbstractEList<E>
org.eclipse.emf.common.util.ArrayDelegatingEList<E>
public abstract class ArrayDelegatingEList<E>
A highly extensible abstract list implementation logically backed by an array
that is never modified.
Nested Class Summary | |
---|---|
protected class |
ArrayDelegatingEList.EIterator<E1>
An extensible iterator implementation. |
protected class |
ArrayDelegatingEList.EListIterator<E1>
An extensible list iterator implementation. |
protected class |
ArrayDelegatingEList.NonResolvingEIterator<E1>
An extended read-only iterator that does not resolve objects. |
protected class |
ArrayDelegatingEList.NonResolvingEListIterator<E1>
An extended read-only list iterator that does not resolve objects. |
Nested classes/interfaces inherited from class org.eclipse.emf.common.util.AbstractEList |
---|
AbstractEList.BasicIndexOutOfBoundsException |
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
|
ArrayDelegatingEList()
Creates an empty instance with no initial capacity. |
|
ArrayDelegatingEList(java.util.Collection<? extends E> collection)
Creates an instance that is a copy of the collection. |
protected |
ArrayDelegatingEList(java.lang.Object[] data)
Creates an initialized instance that directly uses the given arguments. |
Method Summary | ||
---|---|---|
boolean |
addAllUnique(java.util.Collection<? extends E> collection)
Adds each object of the collection to the end of the list; it does no uniqueness checking. |
|
boolean |
addAllUnique(int index,
java.util.Collection<? extends E> collection)
Adds each object of the collection at each successive index in the list and returns whether any objects were added; it does no ranging checking or uniqueness checking. |
|
boolean |
addAllUnique(int index,
java.lang.Object[] objects,
int start,
int end)
Adds each object from start to end of the array at each successive index in the list and returns whether any objects were added; it does no ranging checking or uniqueness checking. |
|
boolean |
addAllUnique(java.lang.Object[] objects,
int start,
int end)
Adds each object from start to end of the array at the index of list and returns whether any objects were added; it does no ranging checking or uniqueness checking. |
|
void |
addUnique(E object)
Adds the object at the end of the list; it does no uniqueness checking. |
|
void |
addUnique(int index,
E object)
Adds the object at the given index in the list; it does no ranging checking or uniqueness checking. |
|
protected E |
assign(java.lang.Object[] data,
int index,
E object)
Assigns the object into the data storage at the given index and returns the object that's been stored. |
|
E |
basicGet(int index)
Returns the object at the index without resolving it. |
|
protected java.util.Iterator<E> |
basicIterator()
Returns a read-only iterator that does not resolve objects. |
|
protected java.util.List<E> |
basicList()
Returns an unsafe list that provides a non-resolving view of the underlying data storage. |
|
protected java.util.ListIterator<E> |
basicListIterator()
Returns a read-only list iterator that does not resolve objects. |
|
protected java.util.ListIterator<E> |
basicListIterator(int index)
Returns a read-only list iterator advanced to the given index that does not resolve objects. |
|
void |
clear()
Clears the list of all objects. |
|
java.lang.Object |
clone()
Returns a shallow copy of this list. |
|
boolean |
contains(java.lang.Object object)
Returns whether the list contains the object. |
|
protected java.lang.Object[] |
copy()
Returns a copy of the existing data array. |
|
abstract java.lang.Object[] |
data()
Returns direct unsafe access to the underlying data storage. |
|
E |
get(int index)
Returns the object at the index. |
|
protected java.lang.Object[] |
grow(int size)
Grows the capacity of the list to exactly the new size. |
|
int |
indexOf(java.lang.Object object)
Returns the position of the first occurrence of the object in the list. |
|
boolean |
isEmpty()
Returns whether the list has zero size. |
|
java.util.Iterator<E> |
iterator()
Returns an iterator. |
|
int |
lastIndexOf(java.lang.Object object)
Returns the position of the last occurrence of the object in the list. |
|
java.util.ListIterator<E> |
listIterator()
Returns a list iterator. |
|
java.util.ListIterator<E> |
listIterator(int index)
Returns a list iterator advanced to the given index. |
|
E |
move(int targetIndex,
int sourceIndex)
Moves the object at the source index of the list to the target index of the list and returns the moved object. |
|
protected java.lang.Object[] |
newData(int capacity)
Returns new allocated data storage. |
|
protected E |
primitiveGet(int index)
Returns the object at the index without resolving it and without range checking the index. |
|
E |
remove(int index)
Removes the object at the index from the list and returns it. |
|
boolean |
removeAll(java.util.Collection<?> collection)
Removes each object of the collection from the list and returns whether any object was actually contained by the list. |
|
boolean |
retainAll(java.util.Collection<?> collection)
Removes from the list each object not contained by the collection and returns whether any object was actually removed. |
|
void |
setData(java.lang.Object[] data)
Updates directly and unsafely the underlying data storage. |
|
E |
setUnique(int index,
E object)
Sets the object at the index and returns the old object at the index; it does no ranging checking or uniqueness checking. |
|
int |
size()
Returns the number of objects in the list. |
|
java.lang.Object[] |
toArray()
Returns an array containing all the objects in sequence. |
|
|
toArray(T[] array)
Returns an array containing all the objects in sequence. |
Methods inherited from class org.eclipse.emf.common.util.AbstractEList |
---|
add, add, addAll, addAll, canContainNull, didAdd, didChange, didClear, didMove, didRemove, didSet, equalObjects, equals, getDuplicates, getNonDuplicates, hashCode, isUnique, move, remove, resolve, set, toString, useEquals, validate |
Methods inherited from class java.util.AbstractList |
---|
removeRange, subList |
Methods inherited from class java.util.AbstractCollection |
---|
containsAll |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
containsAll, subList |
Constructor Detail |
---|
public ArrayDelegatingEList()
public ArrayDelegatingEList(java.util.Collection<? extends E> collection)
collection
- the initial contents of the list.protected ArrayDelegatingEList(java.lang.Object[] data)
data
- the underlying storage of the list.Method Detail |
---|
protected java.lang.Object[] newData(int capacity)
protected E assign(java.lang.Object[] data, int index, E object)
index
- the position of the new content.object
- the new content.
public final int size()
size
in interface java.util.Collection<E>
size
in interface java.util.List<E>
size
in class java.util.AbstractCollection<E>
public boolean isEmpty()
isEmpty
in interface java.util.Collection<E>
isEmpty
in interface java.util.List<E>
isEmpty
in class java.util.AbstractCollection<E>
public boolean contains(java.lang.Object object)
equals
or "=="
depending on useEquals
.
contains
in interface java.util.Collection<E>
contains
in interface java.util.List<E>
contains
in class java.util.AbstractCollection<E>
object
- the object in question.
AbstractEList.useEquals()
public int indexOf(java.lang.Object object)
equals
or "=="
depending on useEquals
.
indexOf
in interface java.util.List<E>
indexOf
in class java.util.AbstractList<E>
object
- the object in question.
public int lastIndexOf(java.lang.Object object)
equals
or "=="
depending on useEquals
.
lastIndexOf
in interface java.util.List<E>
lastIndexOf
in class java.util.AbstractList<E>
object
- the object in question.
public java.lang.Object[] toArray()
newData
to create typed storage in this case.
toArray
in interface java.util.Collection<E>
toArray
in interface java.util.List<E>
toArray
in class java.util.AbstractCollection<E>
newData(int)
public <T> T[] toArray(T[] array)
toArray
in interface java.util.Collection<E>
toArray
in interface java.util.List<E>
toArray
in class java.util.AbstractCollection<E>
array
- the array that will be filled and returned, if it's big enough;
otherwise, a suitably large array of the same type will be allocated and used instead.
newData(int)
public abstract java.lang.Object[] data()
size
;
null
is used to represent the empty list.
public void setData(java.lang.Object[] data)
data
- the new underlying data storage.public E get(int index)
resolve
so that clients may transform the fetched object.
get
in interface java.util.List<E>
get
in class java.util.AbstractList<E>
index
- the position in question.
java.lang.IndexOutOfBoundsException
- if the index isn't within the size range.AbstractEList.resolve(int, E)
,
basicGet(int)
public E basicGet(int index)
resolving
it.
basicGet
in class AbstractEList<E>
index
- the position in question.
java.lang.IndexOutOfBoundsException
- if the index isn't within the size range.AbstractEList.resolve(int, E)
,
get(int)
protected E primitiveGet(int index)
AbstractEList
resolving
it and without range checking the index.
primitiveGet
in class AbstractEList<E>
index
- the position in question.
AbstractEList.resolve(int, E)
,
AbstractList.get(int)
,
AbstractEList.basicGet(int)
public E setUnique(int index, E object)
assign
, didSet
, and didChange
.
setUnique
in class AbstractEList<E>
index
- the position in question.object
- the object to set.
AbstractEList.set(int, E)
public void addUnique(E object)
assign
, didAdd
, and didChange
.
after uniqueness checking.
addUnique
in class AbstractEList<E>
object
- the object to be added.AbstractEList.add(Object)
public void addUnique(int index, E object)
assign
, didAdd
, and didChange
.
addUnique
in class AbstractEList<E>
object
- the object to be added.AbstractEList.add(int, Object)
public boolean addAllUnique(java.util.Collection<? extends E> collection)
assign
, didAdd
, and didChange
.
addAllUnique
in class AbstractEList<E>
collection
- the collection of objects to be added.AbstractEList.addAll(Collection)
public boolean addAllUnique(int index, java.util.Collection<? extends E> collection)
assign
, didAdd
, and didChange
.
addAllUnique
in class AbstractEList<E>
index
- the index at which to add.collection
- the collection of objects to be added.
AbstractEList.addAll(int, Collection)
public boolean addAllUnique(java.lang.Object[] objects, int start, int end)
assign
, didAdd
, and didChange
.
addAllUnique
in class AbstractEList<E>
objects
- the objects to be added.start
- the index of first object to be added.end
- the index past the last object to be added.
addAllUnique(Object[], int, int)
public boolean addAllUnique(int index, java.lang.Object[] objects, int start, int end)
assign
, didAdd
, and didChange
.
addAllUnique
in class AbstractEList<E>
index
- the index at which to add.objects
- the objects to be added.start
- the index of first object to be added.end
- the index past the last object to be added.
addAllUnique(Object[], int, int)
public boolean removeAll(java.util.Collection<?> collection)
removeAll
in interface java.util.Collection<E>
removeAll
in interface java.util.List<E>
removeAll
in class AbstractEList<E>
collection
- the collection of objects to be removed.
public E remove(int index)
didRemove
and didChange
.
remove
in interface java.util.List<E>
remove
in class AbstractEList<E>
index
- the position of the object to remove.
java.lang.IndexOutOfBoundsException
- if the index isn't within the size range.public boolean retainAll(java.util.Collection<?> collection)
remove(int)
in the case that it finds an object that isn't retained.
retainAll
in interface java.util.Collection<E>
retainAll
in interface java.util.List<E>
retainAll
in class AbstractEList<E>
collection
- the collection of objects to be retained.
public void clear()
didClear
and didChange
.
clear
in interface java.util.Collection<E>
clear
in interface java.util.List<E>
clear
in class java.util.AbstractList<E>
public E move(int targetIndex, int sourceIndex)
assign
, didMove
, and didChange
.
move
in interface EList<E>
move
in class AbstractEList<E>
targetIndex
- the new position for the object in the list.sourceIndex
- the old position of the object in the list.
java.lang.IndexOutOfBoundsException
- if either index isn't within the size range.protected java.lang.Object[] grow(int size)
protected java.lang.Object[] copy()
public java.lang.Object clone()
clone
in class java.lang.Object
public java.util.Iterator<E> iterator()
ArrayDelegatingEList.EIterator
.
iterator
in interface java.lang.Iterable<E>
iterator
in interface java.util.Collection<E>
iterator
in interface java.util.List<E>
iterator
in class AbstractEList<E>
ArrayDelegatingEList.EIterator
protected java.util.Iterator<E> basicIterator()
resolve
objects.
This implementation allocates a ArrayDelegatingEList.NonResolvingEIterator
.
basicIterator
in class AbstractEList<E>
public java.util.ListIterator<E> listIterator()
ArrayDelegatingEList.EListIterator
.
listIterator
in interface java.util.List<E>
listIterator
in class AbstractEList<E>
ArrayDelegatingEList.EListIterator
public java.util.ListIterator<E> listIterator(int index)
ArrayDelegatingEList.EListIterator
.
listIterator
in interface java.util.List<E>
listIterator
in class AbstractEList<E>
index
- the starting index.
java.lang.IndexOutOfBoundsException
- if the index isn't within the size range.ArrayDelegatingEList.EListIterator
protected java.util.ListIterator<E> basicListIterator()
resolve
objects.
This implementation allocates a ArrayDelegatingEList.NonResolvingEListIterator
.
basicListIterator
in class AbstractEList<E>
protected java.util.ListIterator<E> basicListIterator(int index)
resolve
objects.
This implementation allocates a ArrayDelegatingEList.NonResolvingEListIterator
.
basicListIterator
in class AbstractEList<E>
index
- the starting index.
java.lang.IndexOutOfBoundsException
- if the index isn't within the size range.protected java.util.List<E> basicList()
non-resolving
view of the underlying data storage.
basicList
in class AbstractEList<E>
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |