Eclipse Platform
Release 3.3

org.eclipse.core.databinding.observable.set
Class ObservableSet

java.lang.Object
  extended byorg.eclipse.core.databinding.observable.ChangeManager
      extended byorg.eclipse.core.databinding.observable.AbstractObservable
          extended byorg.eclipse.core.databinding.observable.set.ObservableSet
All Implemented Interfaces:
Collection, IObservable, IObservableCollection, IObservableSet, Set
Direct Known Subclasses:
ListToSetAdapter, MappedSet, UnionSet, WritableSet

public abstract class ObservableSet
extends AbstractObservable
implements IObservableSet

Abstract implementation of IObservableSet.

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

Field Summary
protected  Object elementType
           
protected  Set wrappedSet
           
 
Constructor Summary
protected ObservableSet(Realm realm, Set wrappedSet, Object elementType)
           
protected ObservableSet(Set wrappedSet, Object elementType)
           
 
Method Summary
 boolean add(Object o)
           
 boolean addAll(Collection c)
           
 void addSetChangeListener(ISetChangeListener listener)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection c)
           
 void dispose()
          Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.
 boolean equals(Object o)
           
protected  void fireChange()
           
protected  void fireSetChange(SetDiff diff)
           
 Object getElementType()
           
protected  void getterCalled()
           
 int hashCode()
           
 boolean isEmpty()
           
 boolean isStale()
          Returns whether the state of this observable is stale and is expected to change soon.
 Iterator iterator()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection c)
           
 void removeSetChangeListener(ISetChangeListener listener)
           
 boolean retainAll(Collection c)
           
 void setStale(boolean stale)
           
protected  void setWrappedSet(Set wrappedSet)
           
 int size()
           
 Object[] toArray()
           
 Object[] toArray(Object[] a)
           
 String toString()
           
 
Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addListener, addStaleListener, checkRealm, fireEvent, fireStale, firstListenerAdded, getRealm, hasListeners, lastListenerRemoved, removeChangeListener, removeListener, removeStaleListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addStaleListener, getRealm, removeChangeListener, removeStaleListener
 

Field Detail

wrappedSet

protected Set wrappedSet

elementType

protected Object elementType
Constructor Detail

ObservableSet

protected ObservableSet(Set wrappedSet,
                        Object elementType)

ObservableSet

protected ObservableSet(Realm realm,
                        Set wrappedSet,
                        Object elementType)
Method Detail

addSetChangeListener

public void addSetChangeListener(ISetChangeListener listener)
Specified by:
addSetChangeListener in interface IObservableSet
Parameters:
listener -

removeSetChangeListener

public void removeSetChangeListener(ISetChangeListener listener)
Specified by:
removeSetChangeListener in interface IObservableSet
Parameters:
listener -

fireSetChange

protected void fireSetChange(SetDiff diff)

contains

public boolean contains(Object o)
Specified by:
contains in interface IObservableSet

containsAll

public boolean containsAll(Collection c)
Specified by:
containsAll in interface IObservableSet

equals

public boolean equals(Object o)
Specified by:
equals in interface IObservableSet

hashCode

public int hashCode()
Specified by:
hashCode in interface IObservableSet

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface IObservableSet

iterator

public Iterator iterator()
Specified by:
iterator in interface IObservableSet

size

public int size()
Specified by:
size in interface IObservableSet

toArray

public Object[] toArray()
Specified by:
toArray in interface IObservableSet

toArray

public Object[] toArray(Object[] a)
Specified by:
toArray in interface IObservableSet

toString

public String toString()

getterCalled

protected void getterCalled()

add

public boolean add(Object o)
Specified by:
add in interface IObservableSet

addAll

public boolean addAll(Collection c)
Specified by:
addAll in interface IObservableSet

remove

public boolean remove(Object o)
Specified by:
remove in interface IObservableSet

removeAll

public boolean removeAll(Collection c)
Specified by:
removeAll in interface IObservableSet

retainAll

public boolean retainAll(Collection c)
Specified by:
retainAll in interface IObservableSet

clear

public void clear()
Specified by:
clear in interface Set

isStale

public boolean isStale()
Description copied from interface: IObservable
Returns 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:
isStale in interface IObservable
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.

setWrappedSet

protected void setWrappedSet(Set wrappedSet)
Parameters:
wrappedSet - The wrappedSet to set.

fireChange

protected void fireChange()
Overrides:
fireChange in class AbstractObservable

dispose

public void dispose()
Description copied from interface: IObservable
Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.

Specified by:
dispose in interface IObservable
Overrides:
dispose in class AbstractObservable

getElementType

public Object getElementType()
Specified by:
getElementType in interface IObservableSet
Returns:
the element type or null if untyped

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.