Class AbstractObservableSet<E>
- java.lang.Object
-
- org.eclipse.core.databinding.observable.AbstractObservable
-
- org.eclipse.core.databinding.observable.set.AbstractObservableSet<E>
-
- Type Parameters:
E- the type of the elements in this set
- All Implemented Interfaces:
Iterable<E>,Collection<E>,Set<E>,IObservable,IObservableCollection<E>,IObservableSet<E>
- Direct Known Subclasses:
ComputedSet
public abstract class AbstractObservableSet<E> extends AbstractObservable implements IObservableSet<E>
Abstract implementation ofIObservableSet.This class is thread safe. All state accessing methods must be invoked from the
current realm. Methods for adding and removing listeners may be invoked from any thread.- Since:
- 1.0
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractObservableSet()protectedAbstractObservableSet(Realm realm)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanadd(E o)booleanaddAll(Collection<? extends E> c)protected voidaddListener(Object listenerType, IObservablesListener listener)voidaddSetChangeListener(ISetChangeListener<? super E> listener)voidclear()protected Objectclone()booleancontains(Object o)booleancontainsAll(Collection<?> c)booleanequals(Object o)protected voidfireChange()protected voidfireEvent(ObservableEvent event)protected voidfireSetChange(SetDiff<E> diff)protected voidfirstListenerAdded()RealmgetRealm()protected voidgetterCalled()protected abstract Set<E>getWrappedSet()inthashCode()protected booleanhasListeners()booleanisEmpty()booleanisStale()Returns whether the state of this observable is stale and is expected to change soon.Iterator<E>iterator()protected voidlastListenerRemoved()booleanremove(Object o)booleanremoveAll(Collection<?> c)protected voidremoveListener(Object listenerType, IObservablesListener listener)voidremoveSetChangeListener(ISetChangeListener<? super E> listener)booleanretainAll(Collection<?> c)voidsetStale(boolean stale)intsize()Object[]toArray()<T> T[]toArray(T[] a)StringtoString()-
Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addDisposeListener, addStaleListener, checkRealm, dispose, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addDisposeListener, addStaleListener, dispose, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
-
Methods inherited from interface org.eclipse.core.databinding.observable.set.IObservableSet
getElementType
-
Methods inherited from interface java.util.Set
spliterator
-
-
-
-
Constructor Detail
-
AbstractObservableSet
protected AbstractObservableSet()
-
AbstractObservableSet
protected AbstractObservableSet(Realm realm)
-
-
Method Detail
-
firstListenerAdded
protected void firstListenerAdded()
-
lastListenerRemoved
protected void lastListenerRemoved()
-
addSetChangeListener
public void addSetChangeListener(ISetChangeListener<? super E> listener)
- Specified by:
addSetChangeListenerin interfaceIObservableSet<E>
-
removeSetChangeListener
public void removeSetChangeListener(ISetChangeListener<? super E> listener)
- Specified by:
removeSetChangeListenerin interfaceIObservableSet<E>
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceIObservableSet<E>- Specified by:
containsin interfaceSet<E>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceIObservableSet<E>- Specified by:
containsAllin interfaceSet<E>
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<E>- Specified by:
isEmptyin interfaceIObservableSet<E>- Specified by:
isEmptyin interfaceSet<E>
-
size
public int size()
- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceIObservableSet<E>- Specified by:
sizein interfaceSet<E>
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceCollection<E>- Specified by:
toArrayin interfaceIObservableSet<E>- Specified by:
toArrayin interfaceSet<E>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArrayin interfaceCollection<E>- Specified by:
toArrayin interfaceIObservableSet<E>- Specified by:
toArrayin interfaceSet<E>
-
getterCalled
protected void getterCalled()
-
add
public boolean add(E o)
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceIObservableSet<E>- Specified by:
addin interfaceSet<E>
-
addAll
public boolean addAll(Collection<? extends E> c)
- Specified by:
addAllin interfaceCollection<E>- Specified by:
addAllin interfaceIObservableSet<E>- Specified by:
addAllin interfaceSet<E>
-
remove
public boolean remove(Object o)
- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceIObservableSet<E>- Specified by:
removein interfaceSet<E>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<E>- Specified by:
removeAllin interfaceIObservableSet<E>- Specified by:
removeAllin interfaceSet<E>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<E>- Specified by:
retainAllin interfaceIObservableSet<E>- Specified by:
retainAllin interfaceSet<E>
-
clear
public void clear()
-
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- Returns:
- Returns the stale state.
-
setStale
public void setStale(boolean stale)
- Parameters:
stale- The stale state to set. This will fire a stale event if the given boolean is true and this observable set was not already stale.
-
fireChange
protected void fireChange()
- Overrides:
fireChangein classAbstractObservable
-
addListener
protected void addListener(Object listenerType, IObservablesListener listener)
- Parameters:
listenerType-listener-
-
removeListener
protected void removeListener(Object listenerType, IObservablesListener listener)
- Parameters:
listenerType-listener-
-
hasListeners
protected boolean hasListeners()
-
fireEvent
protected void fireEvent(ObservableEvent event)
-
getRealm
public Realm getRealm()
- Returns:
- Returns the realm.
-
clone
protected Object clone() throws CloneNotSupportedException
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
-