public abstract class AbstractWrappingEList<W,T>
extends org.eclipse.emf.common.util.AbstractEList<W>
implements java.lang.Cloneable, java.io.Serializable
org.eclipse.emf.common.util.AbstractEList.BasicIndexOutOfBoundsException, org.eclipse.emf.common.util.AbstractEList.EIterator<E1>, org.eclipse.emf.common.util.AbstractEList.EListIterator<E1>, org.eclipse.emf.common.util.AbstractEList.NonResolvingEIterator<E1>, org.eclipse.emf.common.util.AbstractEList.NonResolvingEListIterator<E1>
Modifier and Type | Field and Description |
---|---|
protected java.lang.Class<T> |
targetType |
protected java.lang.Class<W> |
wrapperType |
Constructor and Description |
---|
AbstractWrappingEList(java.util.List<T> delegateList,
java.lang.Class<W> wrapperType,
java.lang.Class<T> targetType)
Creates an instance of the AbstractWrappingEList delegating list.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addAllUnique(java.util.Collection<? extends W> 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 W> 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(int index,
W object)
Adds the object at the given index in the list; it does no ranging checking or uniqueness checking.
|
void |
addUnique(W object)
Adds the object at the end of the list; it does no uniqueness checking.
|
protected W |
basicGet(int index)
Returns the object at the index without
resolving it. |
protected java.util.List<W> |
basicList()
Returns an unsafe list that provides a
non-resolving view of the underlying data storage. |
void |
clear()
Clears the list of all objects.
|
boolean |
contains(java.lang.Object object)
Returns whether the list contains the object.
|
boolean |
containsAll(java.util.Collection<?> collection)
Returns whether the list contains each object in the collection.
|
protected void |
delegateAdd(int index,
W object)
Adds the unwrapped object at the given index in the backing store list.
|
protected void |
delegateAdd(W object)
Adds the unwrapped object at the end of the backing store list.
|
protected void |
delegateClear()
Clears the backing store list of all objects.
|
protected boolean |
delegateContains(java.lang.Object object)
Returns whether the backing store list contains the object.
|
protected boolean |
delegateContainsAll(java.util.Collection<?> collection)
Returns whether the backing store list contains each object in the collection.
|
protected boolean |
delegateEquals(java.lang.Object object)
Returns whether the object is a list with corresponding equal objects to those in the backing store list.
|
protected W |
delegateGet(int index)
Returns the wrapped object at the index in the backing store list.
|
protected int |
delegateHashCode()
Returns the hash code of the backing store list.
|
protected int |
delegateIndexOf(java.lang.Object object)
Returns the position of the first occurrence of the object in the backing store list.
|
protected boolean |
delegateIsEmpty()
Returns whether the backing store list has zero size.
|
protected int |
delegateLastIndexOf(java.lang.Object object)
Returns the position of the last occurrence of the object in the backing store list.
|
protected java.util.List<T> |
delegateList()
Returns the list that acts as the backing store.
|
protected W |
delegateMove(int targetIndex,
int sourceIndex)
Moves the object at the source index in the backing store list by removing it and adding it at the new target
index.
|
protected W |
delegateRemove(int index)
Removes the object at the index from the backing store list and returns the wrapped object.
|
protected W |
delegateSet(int index,
W object)
Sets the unwrapped object at the index in the backing store list and returns the wrapped object at the index.
|
protected int |
delegateSize()
Returns the number of objects in the backing store list.
|
protected java.lang.Object[] |
delegateToArray()
Returns an array containing all the objects in the backing store list in sequence.
|
protected <E1> E1[] |
delegateToArray(E1[] array)
Returns an array containing all the objects in the backing store list in sequence.
|
protected java.lang.String |
delegateToString()
Returns a the string form of the backing store list.
|
protected void |
doClear(int oldSize,
java.lang.Object[] oldData)
Does the actual job of clearing all the objects.
|
boolean |
equals(java.lang.Object object)
Returns whether the object is a list with corresponding equal objects.
|
W |
get(int index)
Returns the object at the index.
|
int |
hashCode()
Returns a hash code computed from each object's hash code.
|
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.
|
W |
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 W |
primitiveGet(int index) |
W |
remove(int index)
Removes the object at the index from the list and returns it.
|
boolean |
remove(java.lang.Object object)
Removes the object from the list and returns whether the object was actually contained by the list.
|
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.
|
W |
setUnique(int index,
W 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.
|
<T1> T1[] |
toArray(T1[] array)
Returns an array containing all the objects in sequence.
|
java.lang.String |
toString()
Returns a string of the form
"[object1, object2]" . |
protected abstract T |
unwrap(W object)
Unwraps the given object.
|
protected abstract W |
wrap(T object)
Wraps the given object.
|
add, add, addAll, addAll, basicIterator, basicListIterator, basicListIterator, canContainNull, didAdd, didChange, didClear, didMove, didRemove, didSet, equalObjects, getDuplicates, getNonDuplicates, isUnique, iterator, listIterator, listIterator, move, resolve, set, useEquals, validate
protected java.lang.Class<T> targetType
protected java.lang.Class<W> wrapperType
protected abstract W wrap(T object) throws org.eclipse.core.runtime.CoreException
object
- object to be wrapped.org.eclipse.core.runtime.CoreException
protected abstract T unwrap(W object)
object
- object to be unwrapped.protected java.util.List<T> delegateList()
public int size()
protected int delegateSize()
public boolean isEmpty()
protected boolean delegateIsEmpty()
public boolean contains(java.lang.Object object)
protected boolean delegateContains(java.lang.Object object)
object
- the object in question.public boolean containsAll(java.util.Collection<?> collection)
containsAll
in interface java.util.Collection<W>
containsAll
in interface java.util.List<W>
containsAll
in class java.util.AbstractCollection<W>
contains(java.lang.Object)
,
AbstractEList.useEquals()
protected boolean delegateContainsAll(java.util.Collection<?> collection)
contains(java.lang.Object)
,
AbstractEList.useEquals()
public int indexOf(java.lang.Object object)
protected int delegateIndexOf(java.lang.Object object)
object
- the object in question.public int lastIndexOf(java.lang.Object object)
protected int delegateLastIndexOf(java.lang.Object object)
object
- the object in question.public java.lang.Object[] toArray()
protected java.lang.Object[] delegateToArray()
public <T1> T1[] toArray(T1[] array)
toArray
in interface java.util.Collection<W>
toArray
in interface java.util.List<W>
toArray
in class java.util.AbstractCollection<W>
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.protected <E1> E1[] delegateToArray(E1[] array)
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.public W get(int index)
resolve
so that clients may
transform the fetched object.get
in interface java.util.List<W>
get
in class java.util.AbstractList<W>
index
- the position in question.java.lang.IndexOutOfBoundsException
- if the index isn't within the size range.AbstractEList.resolve(int, E)
,
basicGet(int)
protected W delegateGet(int index)
index
- the position in question.java.lang.IndexOutOfBoundsException
- if the index isn't within the size range.protected W basicGet(int index)
resolving
it.protected W primitiveGet(int index)
primitiveGet
in class org.eclipse.emf.common.util.AbstractEList<W>
public W setUnique(int index, W object)
didSet
and didChange
.setUnique
in class org.eclipse.emf.common.util.AbstractEList<W>
index
- the position in question.object
- the object to set.AbstractEList.set(int, E)
protected W delegateSet(int index, W object)
object
- the object to set.public void addUnique(W object)
didAdd
and didChange
. after uniqueness checking.addUnique
in class org.eclipse.emf.common.util.AbstractEList<W>
object
- the object to be added.AbstractEList.add(Object)
protected void delegateAdd(W object)
object
- the object to be added.public void addUnique(int index, W object)
didAdd
and didChange
.addUnique
in class org.eclipse.emf.common.util.AbstractEList<W>
object
- the object to be added.AbstractEList.add(int, Object)
protected void delegateAdd(int index, W object)
object
- the object to be added.public boolean addAllUnique(java.util.Collection<? extends W> collection)
didAdd
and didChange
.addAllUnique
in class org.eclipse.emf.common.util.AbstractEList<W>
collection
- the collection of objects to be added.AbstractEList.addAll(Collection)
public boolean addAllUnique(int index, java.util.Collection<? extends W> collection)
didAdd
and didChange
.addAllUnique
in class org.eclipse.emf.common.util.AbstractEList<W>
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)
delegatedAdd
, didAdd
, and didChange
.addAllUnique
in class org.eclipse.emf.common.util.AbstractEList<W>
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(int, Object[], int, int)
public boolean addAllUnique(int index, java.lang.Object[] objects, int start, int end)
delegatedAdd
, didAdd
, and didChange
.addAllUnique
in class org.eclipse.emf.common.util.AbstractEList<W>
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 remove(java.lang.Object object)
indexOf
to find the object and delegates to remove(int)
in the case that it finds the object.public boolean removeAll(java.util.Collection<?> collection)
removeAll
in interface java.util.Collection<W>
removeAll
in interface java.util.List<W>
removeAll
in class org.eclipse.emf.common.util.AbstractEList<W>
collection
- the collection of objects to be removed.public W remove(int index)
didRemove
and didChange
.protected W delegateRemove(int index)
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<W>
retainAll
in interface java.util.List<W>
retainAll
in class org.eclipse.emf.common.util.AbstractEList<W>
collection
- the collection of objects to be retained.public void clear()
protected void doClear(int oldSize, java.lang.Object[] oldData)
oldSize
- the size of the list before it is cleared.oldData
- old values of the list before it is cleared.protected void delegateClear()
public W move(int targetIndex, int sourceIndex)
didMove
and didChange
.move
in interface org.eclipse.emf.common.util.EList<W>
move
in class org.eclipse.emf.common.util.AbstractEList<W>
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 W delegateMove(int targetIndex, int sourceIndex)
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.public boolean equals(java.lang.Object object)
equals
or "=="
depending on useEquals
.protected boolean delegateEquals(java.lang.Object object)
public int hashCode()
protected int delegateHashCode()
public java.lang.String toString()
"[object1, object2]"
.toString
in class org.eclipse.emf.common.util.AbstractEList<W>
"[object1, object2]"
.protected java.lang.String delegateToString()
protected java.util.List<W> basicList()
non-resolving
view of the underlying data storage.basicList
in class org.eclipse.emf.common.util.AbstractEList<W>