org.eclipse.emf.common.notify.impl
Class BasicNotifierImpl.EAdapterList<E extends java.lang.Object & Adapter>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by org.eclipse.emf.common.util.BasicEList<E>
              extended by org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EAdapterList<E>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.RandomAccess, EList<E>
Enclosing class:
BasicNotifierImpl

public static class BasicNotifierImpl.EAdapterList<E extends java.lang.Object & Adapter>
extends BasicEList<E>

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.util.BasicEList
BasicEList.BasicIndexOutOfBoundsException, BasicEList.EIterator<E1>, BasicEList.EListIterator<E1>, BasicEList.FastCompare<E>, BasicEList.NonResolvingEIterator<E1>, BasicEList.NonResolvingEListIterator<E1>, BasicEList.UnmodifiableEList<E>
 
Field Summary
protected  Notifier notifier
           
protected  boolean safe
           
 
Fields inherited from class org.eclipse.emf.common.util.BasicEList
data, size
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
BasicNotifierImpl.EAdapterList(Notifier notifier)
           
 
Method Summary
 boolean add(E object)
          Adds the object at the end of the list and returns whether the object was added; if uniqueness is required, duplicates will be ignored and false will be returned.
 void add(int index, E object)
          Adds the object at the given index in the list.
 boolean addAll(java.util.Collection<? extends E> collection)
          Adds each object of the collection to the end of the list.
protected  boolean canContainNull()
          Returns whether null is a valid object for the list.
 void clear()
          Clears the list of all objects.
 java.lang.Object[] data()
          Returns direct unsafe access to the underlying data storage.
protected  void didAdd(int index, E newObject)
          Called to indicate that an object has been added to the data storage.
protected  void didRemove(int index, E oldObject)
          Called to indicate that an object has been removed from the data storage.
protected  void ensureSafety()
           
 void move(int newPosition, E object)
          Moves the object to the index of the list.
 E move(int newPosition, int oldPosition)
          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.
 E 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.
 E set(int index, E object)
          Sets the object at the index and returns the old object at the index.
protected  boolean useEquals()
          Returns whether equals rather than == should be used to compare members.
 
Methods inherited from class org.eclipse.emf.common.util.BasicEList
addAll, addAllUnique, addAllUnique, addAllUnique, addAllUnique, addUnique, addUnique, assign, basicGet, basicIterator, basicList, basicListIterator, basicListIterator, clone, contains, containsAll, didChange, didClear, didMove, didSet, equalObjects, equals, get, getDuplicates, getNonDuplicates, grow, hashCode, indexOf, isEmpty, isUnique, iterator, lastIndexOf, listIterator, listIterator, resolve, setData, setUnique, shrink, size, toArray, toArray, toString, validate
 
Methods inherited from class java.util.AbstractList
removeRange, subList
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
subList
 

Field Detail

notifier

protected Notifier notifier

safe

protected boolean safe
Constructor Detail

BasicNotifierImpl.EAdapterList

public BasicNotifierImpl.EAdapterList(Notifier notifier)
Method Detail

canContainNull

protected boolean canContainNull()
Description copied from class: BasicEList
Returns whether null is a valid object for the list. The default is to return true, but clients can override this to exclude null.

Overrides:
canContainNull in class BasicEList<E extends java.lang.Object & Adapter>
Returns:
whether null is a valid object for the list.

useEquals

protected boolean useEquals()
Description copied from class: BasicEList
Returns whether equals rather than == should be used to compare members. The default is to return true but clients can optimize performance by returning false. The performance difference is highly significant.

Overrides:
useEquals in class BasicEList<E extends java.lang.Object & Adapter>
Returns:
whether equals rather than == should be used.

newData

protected java.lang.Object[] newData(int capacity)
Description copied from class: BasicEList
Returns new allocated data storage. Clients may override this to create typed storage. The cost of type checking via a typed array is negligible.

Overrides:
newData in class BasicEList<E extends java.lang.Object & Adapter>
Returns:
new data storage.

didAdd

protected void didAdd(int index,
                      E newObject)
Description copied from class: BasicEList
Called to indicate that an object has been added to the data storage. This implementation does nothing; clients can use this to monitor additions to the data storage.

Overrides:
didAdd in class BasicEList<E extends java.lang.Object & Adapter>
Parameters:
index - the position object the new object.
newObject - the new object at the position.

didRemove

protected void didRemove(int index,
                         E oldObject)
Description copied from class: BasicEList
Called to indicate that an object has been removed from the data storage. This implementation does nothing; clients can use this to monitor removals from the data storage.

Overrides:
didRemove in class BasicEList<E extends java.lang.Object & Adapter>
Parameters:
index - the position of the old object.
oldObject - the old object at the position.

data

public java.lang.Object[] data()
Description copied from class: BasicEList
Returns direct unsafe access to the underlying data storage. Clients may not modify this and may not assume that the array remains valid as the list is modified.

Overrides:
data in class BasicEList<E extends java.lang.Object & Adapter>
Returns:
direct unsafe access to the underlying data storage.

ensureSafety

protected void ensureSafety()

add

public boolean add(E object)
Description copied from class: BasicEList
Adds the object at the end of the list and returns whether the object was added; if uniqueness is required, duplicates will be ignored and false will be returned. This implementation delegates to addUnique(E) after uniqueness checking.

Specified by:
add in interface java.util.Collection<E extends java.lang.Object & Adapter>
Specified by:
add in interface java.util.List<E extends java.lang.Object & Adapter>
Overrides:
add in class BasicEList<E extends java.lang.Object & Adapter>
Parameters:
object - the object to be added.
Returns:
whether the object was added.
See Also:
BasicEList.addUnique(Object)

add

public void add(int index,
                E object)
Description copied from class: BasicEList
Adds the object at the given index in the list. If uniqueness is required, duplicates will be ignored. This implementation delegates to addUnique(int, E) after uniqueness checking.

Specified by:
add in interface java.util.List<E extends java.lang.Object & Adapter>
Overrides:
add in class BasicEList<E extends java.lang.Object & Adapter>
object - the object to be added.
See Also:
BasicEList.addUnique(int, Object)

addAll

public boolean addAll(java.util.Collection<? extends E> collection)
Description copied from class: BasicEList
Adds each object of the collection to the end of the list. If uniqueness is required, duplicates will be removed from the collection, which could even result in an empty collection. This implementation delegates to addAllUnique(Collection) after uniqueness checking.

Specified by:
addAll in interface java.util.Collection<E extends java.lang.Object & Adapter>
Specified by:
addAll in interface java.util.List<E extends java.lang.Object & Adapter>
Overrides:
addAll in class BasicEList<E extends java.lang.Object & Adapter>
Parameters:
collection - the collection of objects to be added.
See Also:
BasicEList.addAllUnique(Collection)

remove

public boolean remove(java.lang.Object object)
Description copied from class: BasicEList
Removes the object from the list and returns whether the object was actually contained by the list. This implementation uses indexOf to find the object and delegates to remove(int) in the case that it finds the object.

Specified by:
remove in interface java.util.Collection<E extends java.lang.Object & Adapter>
Specified by:
remove in interface java.util.List<E extends java.lang.Object & Adapter>
Overrides:
remove in class BasicEList<E extends java.lang.Object & Adapter>
Parameters:
object - the object to be removed.
Returns:
whether the object was actually contained by the list.

remove

public E remove(int index)
Description copied from class: BasicEList
Removes the object at the index from the list and returns it. This implementation delegates to didRemove and didChange.

Specified by:
remove in interface java.util.List<E extends java.lang.Object & Adapter>
Overrides:
remove in class BasicEList<E extends java.lang.Object & Adapter>
Parameters:
index - the position of the object to remove.
Returns:
the removed object.

removeAll

public boolean removeAll(java.util.Collection<?> collection)
Description copied from class: BasicEList
Removes each object of the collection from the list and returns whether any object was actually contained by the list.

Specified by:
removeAll in interface java.util.Collection<E extends java.lang.Object & Adapter>
Specified by:
removeAll in interface java.util.List<E extends java.lang.Object & Adapter>
Overrides:
removeAll in class BasicEList<E extends java.lang.Object & Adapter>
Parameters:
collection - the collection of objects to be removed.
Returns:
whether any object was actually contained by the list.

clear

public void clear()
Description copied from class: BasicEList
Clears the list of all objects. This implementation discards the data storage without modifying it and delegates to didClear and didChange.

Specified by:
clear in interface java.util.Collection<E extends java.lang.Object & Adapter>
Specified by:
clear in interface java.util.List<E extends java.lang.Object & Adapter>
Overrides:
clear in class BasicEList<E extends java.lang.Object & Adapter>

retainAll

public boolean retainAll(java.util.Collection<?> collection)
Description copied from class: BasicEList
Removes from the list each object not contained by the collection and returns whether any object was actually removed. This delegates to remove(int) in the case that it finds an object that isn't retained.

Specified by:
retainAll in interface java.util.Collection<E extends java.lang.Object & Adapter>
Specified by:
retainAll in interface java.util.List<E extends java.lang.Object & Adapter>
Overrides:
retainAll in class BasicEList<E extends java.lang.Object & Adapter>
Parameters:
collection - the collection of objects to be retained.
Returns:
whether any object was actually removed.

set

public E set(int index,
             E object)
Description copied from class: BasicEList
Sets the object at the index and returns the old object at the index. This implementation delegates to setUnique after range checking and after uniqueness checking.

Specified by:
set in interface java.util.List<E extends java.lang.Object & Adapter>
Overrides:
set in class BasicEList<E extends java.lang.Object & Adapter>
Parameters:
index - the position in question.
object - the object to set.
Returns:
the old object at the index.
See Also:
BasicEList.setUnique(int, E)

move

public void move(int newPosition,
                 E object)
Description copied from class: BasicEList
Moves the object to the index of the list. This implementation uses BasicEList.indexOf(java.lang.Object) of find the object and delegates to move(int, int).

Specified by:
move in interface EList<E extends java.lang.Object & Adapter>
Overrides:
move in class BasicEList<E extends java.lang.Object & Adapter>
Parameters:
newPosition - the new position for the object in the list.
object - the object to be moved.

move

public E move(int newPosition,
              int oldPosition)
Description copied from class: BasicEList
Moves the object at the source index of the list to the target index of the list and returns the moved object. This implementation delegates to assign, didMove, and didChange.

Specified by:
move in interface EList<E extends java.lang.Object & Adapter>
Overrides:
move in class BasicEList<E extends java.lang.Object & Adapter>
Parameters:
newPosition - the new position for the object in the list.
oldPosition - the old position of the object in the list.
Returns:
the moved object.

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.