Eclipse Platform
Release 3.6

org.eclipse.core.databinding.observable.map
Class ComputedObservableMap

java.lang.Object
  extended by java.util.AbstractMap
      extended by org.eclipse.core.databinding.observable.map.AbstractObservableMap
          extended by org.eclipse.core.databinding.observable.map.ComputedObservableMap
All Implemented Interfaces:
Map, IObservable, IObservableMap

public abstract class ComputedObservableMap
extends AbstractObservableMap

Maps objects to one of their attributes. Tracks changes to the underlying observable set of objects (keys), as well as changes to attribute values.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
ComputedObservableMap(IObservableSet keySet)
           
ComputedObservableMap(IObservableSet keySet, Object valueType)
           
 
Method Summary
 boolean containsKey(Object key)
           
 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.
protected abstract  Object doGet(Object key)
           
protected abstract  Object doPut(Object key, Object value)
           
 Set entrySet()
           
protected  void fireSingleChange(Object key, Object oldValue, Object newValue)
           
protected  void firstListenerAdded()
           
 Object get(Object key)
           
 Object getKeyType()
          Returns the element type for the keyset of this observable map, or null if the keyset is untyped.
 Object getValueType()
          Returns the element type for the values of this observable map, or null if the values collection is untyped.
protected abstract  void hookListener(Object addedKey)
           
protected  void init()
          Deprecated. Subclasses are no longer required to call this method.
 boolean isStale()
          Returns whether the state of this observable is stale and is expected to change soon.
 Set keySet()
           
protected  void lastListenerRemoved()
           
 Object put(Object key, Object value)
           
 Object remove(Object key)
           
protected abstract  void unhookListener(Object removedKey)
           
 
Methods inherited from class org.eclipse.core.databinding.observable.map.AbstractObservableMap
addChangeListener, addDisposeListener, addMapChangeListener, addStaleListener, checkRealm, fireChange, fireMapChange, fireStale, getRealm, hasListeners, isDisposed, removeChangeListener, removeDisposeListener, removeMapChangeListener, removeStaleListener, setStale
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsValue, equals, hashCode, isEmpty, putAll, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.databinding.observable.map.IObservableMap
containsValue, equals, hashCode, isEmpty, size, values
 
Methods inherited from interface java.util.Map
clear, putAll
 

Constructor Detail

ComputedObservableMap

public ComputedObservableMap(IObservableSet keySet)
Parameters:
keySet -

ComputedObservableMap

public ComputedObservableMap(IObservableSet keySet,
                             Object valueType)
Parameters:
keySet -
valueType -
Since:
1.2
Method Detail

init

protected void init()
Deprecated. Subclasses are no longer required to call this method.


firstListenerAdded

protected void firstListenerAdded()
Overrides:
firstListenerAdded in class AbstractObservableMap

lastListenerRemoved

protected void lastListenerRemoved()
Overrides:
lastListenerRemoved in class AbstractObservableMap

fireSingleChange

protected final void fireSingleChange(Object key,
                                      Object oldValue,
                                      Object newValue)

getKeyType

public Object getKeyType()
Description copied from interface: IObservableMap
Returns the element type for the keyset of this observable map, or null if the keyset is untyped.

Specified by:
getKeyType in interface IObservableMap
Overrides:
getKeyType in class AbstractObservableMap
Returns:
the element type for the keyset of this observable map, or null if the keyset is untyped.
Since:
1.2

getValueType

public Object getValueType()
Description copied from interface: IObservableMap
Returns the element type for the values of this observable map, or null if the values collection is untyped.

Specified by:
getValueType in interface IObservableMap
Overrides:
getValueType in class AbstractObservableMap
Returns:
the element type for the values of this observable map, or null if the values collection is untyped.
Since:
1.2

remove

public Object remove(Object key)
Specified by:
remove in interface Map
Specified by:
remove in interface IObservableMap
Overrides:
remove in class AbstractMap
Since:
1.3

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map
Specified by:
containsKey in interface IObservableMap
Overrides:
containsKey in class AbstractMap
Since:
1.3

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map
Specified by:
entrySet in interface IObservableMap
Specified by:
entrySet in class AbstractMap

keySet

public Set keySet()
Specified by:
keySet in interface Map
Specified by:
keySet in interface IObservableMap
Overrides:
keySet in class AbstractMap

get

public final Object get(Object key)
Specified by:
get in interface Map
Specified by:
get in interface IObservableMap
Overrides:
get in class AbstractMap

put

public final Object put(Object key,
                        Object value)
Specified by:
put in interface Map
Specified by:
put in interface IObservableMap
Overrides:
put in class AbstractMap

unhookListener

protected abstract void unhookListener(Object removedKey)
Parameters:
removedKey -

hookListener

protected abstract void hookListener(Object addedKey)
Parameters:
addedKey -

doGet

protected abstract Object doGet(Object key)
Parameters:
key -
Returns:
the value for the given key

doPut

protected abstract Object doPut(Object key,
                                Object value)
Parameters:
key -
value -
Returns:
the old value for the given key

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
Overrides:
isStale in class AbstractObservableMap
Returns:
true if this observable's state is stale and will change soon.

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 AbstractObservableMap

Eclipse Platform
Release 3.6

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.