Class BidiObservableMap<K,V>

Type Parameters:
K - type of the keys in the map
V - type of the values in the map
All Implemented Interfaces:
Map<K,V>, IDecoratingObservable, IObservable, IObservableMap<K,V>

public class BidiObservableMap<K,V> extends DecoratingObservableMap<K,V>
An

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.2
  • Constructor Details

    • BidiObservableMap

      public BidiObservableMap(IObservableMap<K,V> wrappedMap)
      Constructs a BidirectionalMap tracking the given observable map.
      Parameters:
      wrappedMap - the observable map to track
  • Method Details

    • firstListenerAdded

      protected void firstListenerAdded()
      Overrides:
      firstListenerAdded in class DecoratingObservableMap<K,V>
    • lastListenerRemoved

      protected void lastListenerRemoved()
      Overrides:
      lastListenerRemoved in class DecoratingObservableMap<K,V>
    • handleMapChange

      protected void handleMapChange(MapChangeEvent<? extends K,? extends V> event)
      Description copied from class: DecoratingObservableMap
      Called whenever a MapChangeEvent is received from the decorated observable. By default, this method fires the map change event again, with the decorating observable as the event source. Subclasses may override to provide different behavior.
      Overrides:
      handleMapChange in class DecoratingObservableMap<K,V>
      Parameters:
      event - the change event received from the decorated observable
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface IObservableMap<K,V>
      Specified by:
      containsValue in interface Map<K,V>
      Overrides:
      containsValue in class DecoratingObservableMap<K,V>
    • getKeys

      public Set<K> getKeys(Object value)
      Returns the Set of keys that currently map to the given value.
      Parameters:
      value - the value associated with the keys in the returned Set.
      Returns:
      the Set of keys that map to the given value. If no keys map to the given value, an empty set is returned.
    • 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 DecoratingObservableMap<K,V>
    • addListener

      protected void addListener(Object listenerType, IObservablesListener listener)
      Parameters:
      listenerType - arbitrary object to identify a type of the listener
      listener - the listener to add; not null
    • removeListener

      protected void removeListener(Object listenerType, IObservablesListener listener)
      Parameters:
      listenerType - arbitrary object to identify a type of the listener
      listener - the listener to remove; not null
    • 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:
      clone in class Object
      Throws:
      CloneNotSupportedException