Class ComputedObservableMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
org.eclipse.core.databinding.observable.map.AbstractObservableMap<K,V>
org.eclipse.core.databinding.observable.map.ComputedObservableMap<K,V>
- Type Parameters:
K
- type of the keys to the mapV
- type of the values in the map
- All Implemented Interfaces:
Map<K,
,V> IObservable
,IObservableMap<K,
V>
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 class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
ConstructorDescriptionComputedObservableMap
(IObservableSet<K> keySet) ComputedObservableMap
(IObservableSet<K> keySet, Object valueType) -
Method Summary
Modifier and TypeMethodDescriptionboolean
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 V
protected abstract V
entrySet()
protected final void
fireSingleChange
(K key, V oldValue, V newValue) protected void
final V
Returns the element type for thekeyset
of this observable map, ornull
if the keyset is untyped.Returns the element type for thevalues
of this observable map, ornull
if the values collection is untyped.protected abstract void
hookListener
(K 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.keySet()
protected void
final V
protected abstract void
unhookListener
(K 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, compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
ComputedObservableMap
- Parameters:
keySet
- the key set
-
ComputedObservableMap
- Parameters:
keySet
- the key setvalueType
- the value type- Since:
- 1.2
-
-
Method Details
-
init
Deprecated.Subclasses are no longer required to call this method. -
firstListenerAdded
protected void firstListenerAdded()- Overrides:
firstListenerAdded
in classAbstractObservableMap<K,
V>
-
lastListenerRemoved
protected void lastListenerRemoved()- Overrides:
lastListenerRemoved
in classAbstractObservableMap<K,
V>
-
fireSingleChange
-
getKeyType
Description copied from interface:IObservableMap
Returns the element type for thekeyset
of this observable map, ornull
if the keyset is untyped.- Specified by:
getKeyType
in interfaceIObservableMap<K,
V> - Overrides:
getKeyType
in classAbstractObservableMap<K,
V> - Returns:
- the element type for the
keyset
of this observable map, ornull
if the keyset is untyped. - Since:
- 1.2
-
getValueType
Description copied from interface:IObservableMap
Returns the element type for thevalues
of this observable map, ornull
if the values collection is untyped.- Specified by:
getValueType
in interfaceIObservableMap<K,
V> - Overrides:
getValueType
in classAbstractObservableMap<K,
V> - Returns:
- the element type for the
values
of this observable map, ornull
if the values collection is untyped. - Since:
- 1.2
-
remove
-
containsKey
- Specified by:
containsKey
in interfaceIObservableMap<K,
V> - Specified by:
containsKey
in interfaceMap<K,
V> - Overrides:
containsKey
in classAbstractMap<K,
V> - Since:
- 1.3
-
entrySet
-
keySet
-
get
-
put
-
unhookListener
- Parameters:
removedKey
- element to remove listener from
-
hookListener
- Parameters:
addedKey
- element to add listener to
-
doGet
- Parameters:
key
- the key- Returns:
- the value for the given key
-
doPut
- Parameters:
key
- the keyvalue
- key's new 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 interfaceIObservable
- Overrides:
isStale
in classAbstractObservableMap<K,
V> - 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 interfaceIObservable
- Overrides:
dispose
in classAbstractObservableMap<K,
V>
-