Class MultiList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- org.eclipse.core.databinding.observable.list.AbstractObservableList<E>
-
- org.eclipse.core.databinding.observable.list.MultiList<E>
-
- Type Parameters:
E- the type of the elements in the list
- All Implemented Interfaces:
java.lang.Iterable<E>,java.util.Collection<E>,java.util.List<E>,IObservable,IObservableCollection<E>,IObservableList<E>
public class MultiList<E> extends AbstractObservableList<E>
An observable list backed by an array of observable lists. This class supports all removal methods (includingclear()), as well as theset(int, Object)method. All other mutator methods (addition methods andmove(int, int)) throw anUnsupportedOperationException.- Since:
- 1.2
-
-
Constructor Summary
Constructors Constructor Description MultiList(java.util.List<IObservableList<E>> lists)Constructs a MultiList in the default realm, and backed by the given observable lists.MultiList(java.util.List<IObservableList<E>> lists, java.lang.Object elementType)Constructs a MultiList in the default realm backed by the given observable lists.MultiList(IObservableList<E>[] lists)Deprecated.useMultiList(List)insteadMultiList(IObservableList<E>[] lists, java.lang.Object elementType)Deprecated.useMultiList(List, Object)insteadMultiList(Realm realm, java.util.List<IObservableList<E>> lists, java.lang.Object elementType)Constructs a MultiList belonging to the given realm, and backed by the given observable lists.MultiList(Realm realm, IObservableList<E>[] lists)Constructs a MultiList belonging to the given realm, and backed by the given observable lists.MultiList(Realm realm, IObservableList<E>[] lists, java.lang.Object elementType)Deprecated.useMultiList(Realm, List, Object)instead
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, java.lang.Object o)booleanadd(java.lang.Object o)booleanaddAll(int index, java.util.Collection<? extends E> c)booleanaddAll(java.util.Collection<? extends E> c)voidclear()booleancontains(java.lang.Object o)voiddispose()Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.protected intdoGetSize()booleanequals(java.lang.Object o)protected voidfirstListenerAdded()Eget(int index)java.lang.ObjectgetElementType()Returns the element type of this observable collection, ornullif this observable collection is untyped.inthashCode()intindexOf(java.lang.Object o)booleanisEmpty()booleanisStale()Returns whether the state of this observable is stale and is expected to change soon.java.util.Iterator<E>iterator()intlastIndexOf(java.lang.Object o)protected voidlastListenerRemoved()java.util.ListIterator<E>listIterator(int index)Emove(int oldIndex, int newIndex)Moves the element located atoldIndextonewIndex.Eremove(int index)booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)Eset(int index, E o)-
Methods inherited from class org.eclipse.core.databinding.observable.list.AbstractObservableList
addChangeListener, addDisposeListener, addListChangeListener, addStaleListener, checkRealm, containsAll, fireChange, fireListChange, fireStale, getRealm, hasListeners, isDisposed, removeChangeListener, removeDisposeListener, removeListChangeListener, removeStaleListener, size, toArray, toArray
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.core.databinding.observable.list.IObservableList
listIterator, subList
-
-
-
-
Constructor Detail
-
MultiList
@Deprecated public MultiList(IObservableList<E>[] lists)
Deprecated.useMultiList(List)insteadConstructs a MultiList in the default realm, and backed by the given observable lists.- Parameters:
lists- the array of observable lists backing this MultiList.
-
MultiList
public MultiList(java.util.List<IObservableList<E>> lists)
Constructs a MultiList in the default realm, and backed by the given observable lists.- Parameters:
lists- the array of observable lists backing this MultiList.- Since:
- 1.6
-
MultiList
@Deprecated public MultiList(IObservableList<E>[] lists, java.lang.Object elementType)
Deprecated.useMultiList(List, Object)insteadConstructs a MultiList in the default realm backed by the given observable lists.- Parameters:
lists- the array of observable lists backing this MultiList.elementType- element type of the constructed list.
-
MultiList
public MultiList(java.util.List<IObservableList<E>> lists, java.lang.Object elementType)
Constructs a MultiList in the default realm backed by the given observable lists.- Parameters:
lists- the array of observable lists backing this MultiList.elementType- element type of the constructed list.- Since:
- 1.6
-
MultiList
public MultiList(Realm realm, IObservableList<E>[] lists)
Constructs a MultiList belonging to the given realm, and backed by the given observable lists.- Parameters:
realm- the observable's realmlists- the array of observable lists backing this MultiList
-
MultiList
@Deprecated public MultiList(Realm realm, IObservableList<E>[] lists, java.lang.Object elementType)
Deprecated.useMultiList(Realm, List, Object)insteadConstructs a MultiList belonging to the given realm, and backed by the given observable lists.- Parameters:
realm- the observable's realmlists- the array of observable lists backing this MultiListelementType- element type of the constructed list.
-
MultiList
public MultiList(Realm realm, java.util.List<IObservableList<E>> lists, java.lang.Object elementType)
Constructs a MultiList belonging to the given realm, and backed by the given observable lists.- Parameters:
realm- the observable's realmlists- the array of observable lists backing this MultiListelementType- element type of the constructed list.- Since:
- 1.6
-
-
Method Detail
-
firstListenerAdded
protected void firstListenerAdded()
- Overrides:
firstListenerAddedin classAbstractObservableList<E>
-
lastListenerRemoved
protected void lastListenerRemoved()
- Overrides:
lastListenerRemovedin classAbstractObservableList<E>
-
doGetSize
protected int doGetSize()
- Specified by:
doGetSizein classAbstractObservableList<E>- Returns:
- the size
-
getElementType
public java.lang.Object getElementType()
Description copied from interface:IObservableCollectionReturns the element type of this observable collection, ornullif this observable collection is untyped.- Returns:
- the type of the elements or
nullif untyped
-
add
public boolean add(java.lang.Object o)
- Specified by:
addin interfacejava.util.Collection<E>- Specified by:
addin interfaceIObservableList<E>- Specified by:
addin interfacejava.util.List<E>- Overrides:
addin classAbstractObservableList<E>
-
add
public void add(int index, java.lang.Object o)
-
addAll
public boolean addAll(java.util.Collection<? extends E> c)
- Specified by:
addAllin interfacejava.util.Collection<E>- Specified by:
addAllin interfaceIObservableList<E>- Specified by:
addAllin interfacejava.util.List<E>- Overrides:
addAllin classAbstractObservableList<E>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends E> c)- Specified by:
addAllin interfaceIObservableList<E>- Specified by:
addAllin interfacejava.util.List<E>- Overrides:
addAllin classAbstractObservableList<E>
-
clear
public void clear()
-
get
public E get(int index)
- Specified by:
getin interfaceIObservableList<E>- Specified by:
getin interfacejava.util.List<E>- Specified by:
getin classjava.util.AbstractList<E>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
containsin interfacejava.util.Collection<E>- Specified by:
containsin interfaceIObservableList<E>- Specified by:
containsin interfacejava.util.List<E>- Overrides:
containsin classAbstractObservableList<E>
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equalsin interfacejava.util.Collection<E>- Specified by:
equalsin interfaceIObservableList<E>- Specified by:
equalsin interfacejava.util.List<E>- Overrides:
equalsin classAbstractObservableList<E>
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfacejava.util.Collection<E>- Specified by:
hashCodein interfaceIObservableList<E>- Specified by:
hashCodein interfacejava.util.List<E>- Overrides:
hashCodein classAbstractObservableList<E>
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOfin interfaceIObservableList<E>- Specified by:
indexOfin interfacejava.util.List<E>- Overrides:
indexOfin classAbstractObservableList<E>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Collection<E>- Specified by:
isEmptyin interfaceIObservableList<E>- Specified by:
isEmptyin interfacejava.util.List<E>- Overrides:
isEmptyin classAbstractObservableList<E>
-
iterator
public java.util.Iterator<E> iterator()
- Specified by:
iteratorin interfacejava.util.Collection<E>- Specified by:
iteratorin interfaceIObservableList<E>- Specified by:
iteratorin interfacejava.lang.Iterable<E>- Specified by:
iteratorin interfacejava.util.List<E>- Overrides:
iteratorin classAbstractObservableList<E>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOfin interfaceIObservableList<E>- Specified by:
lastIndexOfin interfacejava.util.List<E>- Overrides:
lastIndexOfin classAbstractObservableList<E>
-
listIterator
public java.util.ListIterator<E> listIterator(int index)
- Specified by:
listIteratorin interfaceIObservableList<E>- Specified by:
listIteratorin interfacejava.util.List<E>- Overrides:
listIteratorin classjava.util.AbstractList<E>
-
move
public E move(int oldIndex, int newIndex)
Description copied from class:AbstractObservableListMoves the element located atoldIndextonewIndex. This method is equivalent to callingadd(newIndex, remove(oldIndex)).Subclasses should override this method to deliver list change notification for the remove and add operations in the same ListChangeEvent, as this allows
ListDiff.accept(ListDiffVisitor)to recognize the operation as a move.- Specified by:
movein interfaceIObservableList<E>- Overrides:
movein classAbstractObservableList<E>- Parameters:
oldIndex- the element's position before the move. Must be within the range0 <= oldIndex < size().newIndex- the element's position after the move. Must be within the range0 <= newIndex < size().- Returns:
- the element that was moved.
- See Also:
ListDiffVisitor.handleMove(int, int, Object),ListDiff.accept(ListDiffVisitor)
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
removein interfacejava.util.Collection<E>- Specified by:
removein interfaceIObservableList<E>- Specified by:
removein interfacejava.util.List<E>- Overrides:
removein classAbstractObservableList<E>
-
remove
public E remove(int index)
- Specified by:
removein interfaceIObservableList<E>- Specified by:
removein interfacejava.util.List<E>- Overrides:
removein classjava.util.AbstractList<E>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAllin interfacejava.util.Collection<E>- Specified by:
removeAllin interfaceIObservableList<E>- Specified by:
removeAllin interfacejava.util.List<E>- Overrides:
removeAllin classAbstractObservableList<E>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAllin interfacejava.util.Collection<E>- Specified by:
retainAllin interfaceIObservableList<E>- Specified by:
retainAllin interfacejava.util.List<E>- Overrides:
retainAllin classAbstractObservableList<E>
-
set
public E set(int index, E o)
- Specified by:
setin interfaceIObservableList<E>- Specified by:
setin interfacejava.util.List<E>- Overrides:
setin classjava.util.AbstractList<E>
-
isStale
public boolean isStale()
Description copied from interface:IObservableReturns whether the state of this observable is stale and is expected to change soon. A non-stale observable that becomes stale will notify its stale listeners. A stale object that becomes non-stale does so by changing its state and notifying its change listeners, it does not notify its stale listeners about becoming non-stale. Clients that do not expect asynchronous changes may ignore staleness of observable objects.- Specified by:
isStalein interfaceIObservable- Overrides:
isStalein classAbstractObservableList<E>- Returns:
- true if this observable's state is stale and will change soon.
-
dispose
public void dispose()
Description copied from interface:IObservableDisposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.- Specified by:
disposein interfaceIObservable- Overrides:
disposein classAbstractObservableList<E>
-
-