com.taco.data
Class ObservableMap.ValueElement

java.lang.Object
  extended by com.taco.data.ObservableMap.ValueElement
All Implemented Interfaces:
java.lang.Cloneable
Enclosing class:
ObservableMap

protected static class ObservableMap.ValueElement
extends java.lang.Object
implements java.lang.Cloneable

The data structure that is used for map values. It contains both the original value to be map, and a collection of listeners for the associated key.


Field Summary
protected  java.util.Collection _listeners
          A collection of instances of PropertyChangeListener that listen to changes to the value mapped from the associated key.
protected  java.lang.Object _value
          The value actually mapped to the associated key.
 
Constructor Summary
protected ObservableMap.ValueElement(java.lang.Object value)
           
 
Method Summary
 void addListener(java.beans.PropertyChangeListener listener)
          Add the listener to the listener list.
 java.lang.Object clone()
           
 java.util.Collection getListeners()
          Return the list of listeners of changes to the associated key.
 java.lang.Object getValue()
          Return the mapped value.
 void removeListener(java.beans.PropertyChangeListener listener)
          Try to remove the listener from the listener list.
 void setListeners(java.util.Collection c)
          Set the listeners of changes to the associated key.
 java.lang.Object setValue(java.lang.Object value)
          Set the mapped value to the argument, returning the old value.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_value

protected java.lang.Object _value
The value actually mapped to the associated key.


_listeners

protected java.util.Collection _listeners
A collection of instances of PropertyChangeListener that listen to changes to the value mapped from the associated key.

Constructor Detail

ObservableMap.ValueElement

protected ObservableMap.ValueElement(java.lang.Object value)
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getValue

public java.lang.Object getValue()
Return the mapped value.


setValue

public java.lang.Object setValue(java.lang.Object value)
Set the mapped value to the argument, returning the old value.


addListener

public void addListener(java.beans.PropertyChangeListener listener)
Add the listener to the listener list. Do no checking for duplicates.


removeListener

public void removeListener(java.beans.PropertyChangeListener listener)
Try to remove the listener from the listener list. If the listener is not present, fail silently.


getListeners

public java.util.Collection getListeners()
Return the list of listeners of changes to the associated key. This is actually a reference to the listeners for the key, not a copy.


setListeners

public void setListeners(java.util.Collection c)
Set the listeners of changes to the associated key. This method makes a copy of the argument, so the caller is free to modify the argument afterwards.