|
||||||||||
| 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.BasicEList<E>
public class BasicEList<E>
A highly extensible list implementation.
| Nested Class Summary | |
|---|---|
protected static class |
BasicEList.BasicIndexOutOfBoundsException
An IndexOutOfBoundsException that constructs a message from the argument data. |
protected class |
BasicEList.EIterator<E1>
Deprecated. |
protected class |
BasicEList.EListIterator<E1>
Deprecated. |
static class |
BasicEList.FastCompare<E>
A BasicEList that uses == instead of equals to compare members. |
protected class |
BasicEList.NonResolvingEIterator<E1>
Deprecated. |
protected class |
BasicEList.NonResolvingEListIterator<E1>
Deprecated. |
static class |
BasicEList.UnmodifiableEList<E>
An unmodifiable version of BasicEList. |
| Field Summary | |
|---|---|
protected java.lang.Object[] |
data
The underlying data storage of the list. |
protected int |
size
The size of the list. |
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
|
BasicEList()
Creates an empty instance with no initial capacity. |
|
BasicEList(java.util.Collection<? extends E> collection)
Creates an instance that is a copy of the collection. |
|
BasicEList(int initialCapacity)
Creates an empty instance with the given capacity. |
protected |
BasicEList(int size,
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(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.List<E> |
basicList()
Returns an unsafe list that provides a non-resolving view of the underlying data storage. |
|
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. |
|
java.lang.Object[] |
data()
Returns direct unsafe access to the underlying data storage. |
|
E |
get(int index)
Returns the object at the index. |
|
void |
grow(int minimumCapacity)
Grows the capacity of the list to ensure that no additional growth is needed until the size exceeds the specified minimum capacity. |
|
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. |
|
int |
lastIndexOf(java.lang.Object object)
Returns the position of the last occurrence of the object in the list. |
|
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. |
|
void |
setData(int size,
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. |
|
void |
shrink()
Shrinks the capacity of the list to the minimal requirements. |
|
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, basicIterator, basicListIterator, basicListIterator, canContainNull, didAdd, didChange, didClear, didMove, didRemove, didSet, equalObjects, equals, getDuplicates, getNonDuplicates, hashCode, isUnique, iterator, listIterator, listIterator, move, remove, removeAll, resolve, retainAll, 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 |
| Field Detail |
|---|
protected int size
protected transient java.lang.Object[] data
| Constructor Detail |
|---|
public BasicEList()
public BasicEList(int initialCapacity)
initialCapacity - the initial capacity of the list before it must grow.
java.lang.IllegalArgumentException - if the initialCapacity is negative.public BasicEList(java.util.Collection<? extends E> collection)
collection - the initial contents of the list.
protected BasicEList(int size,
java.lang.Object[] data)
size - the size of the list.data - the underlying storage of the list.| Method Detail |
|---|
protected java.lang.Object[] newData(int capacity)
protected E assign(int index,
E object)
index - the position of the new content.object - the new content.
public 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 java.lang.Object[] data()
public void setData(int size,
java.lang.Object[] data)
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.
BasicEList.BasicIndexOutOfBoundsException - 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.
BasicEList.BasicIndexOutOfBoundsException - if the index isn't within the size range.AbstractEList.resolve(int, E),
get(int)protected E primitiveGet(int index)
resolving it and without range checking the index.
primitiveGet in class AbstractEList<E>index - the position in question.
AbstractEList.resolve(int, E),
get(int),
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 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.
BasicEList.BasicIndexOutOfBoundsException - if the index isn't within the size range.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.
BasicEList.BasicIndexOutOfBoundsException - if either index isn't within the size range.public void shrink()
grow(int)public void grow(int minimumCapacity)
shrink()public java.lang.Object clone()
clone in class java.lang.Objectprotected 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 | |||||||||