nl.tudelft.simulation.event.util
Class EventProducingMap<K,V>

java.lang.Object
  extended by nl.tudelft.simulation.event.EventProducer
      extended by nl.tudelft.simulation.event.util.EventProducingMap<K,V>
Type Parameters:
K - the key
V - the key
All Implemented Interfaces:
java.io.Serializable, java.util.Map<K,V>, EventProducerInterface

public class EventProducingMap<K,V>
extends EventProducer
implements java.util.Map<K,V>

The Event producing map provides a map to which one can subscribe interest in entry changes. This class does not keep track of changes which take place indirectly. One is for example not notified on map.iterator.remove(). A listener must subscribe to the iterator, key set, etc. individually.

(c) copyright 2002-2005 Delft University of Technology , the Netherlands.

See for project information www.simulation.tudelft.nl/event
License of use: Lesser General Public License (LGPL) , no warranty

Since:
1.5
Version:
$Revision: 1.5 $ $Date: 2005/07/04 12:23:01 $
Author:
Peter Jacobs
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static EventType OBJECT_ADDED_EVENT
          OBJECT_ADDED_EVENT is fired on new entries
static EventType OBJECT_REMOVED_EVENT
          OBJECT_REMOVED_EVENT is fired on removel of entries
 
Fields inherited from class nl.tudelft.simulation.event.EventProducer
listeners
 
Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface
FIRST_POSITION, LAST_POSITION
 
Constructor Summary
EventProducingMap(java.util.Map<K,V> parent)
          constructs a new EventProducingMap.
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object arg0)
           
 boolean containsValue(java.lang.Object arg0)
           
 java.util.Set<java.util.Map.Entry<K,V>> entrySet()
           
 V get(java.lang.Object arg0)
           
 boolean isEmpty()
           
 java.util.Set<K> keySet()
           
 V put(K arg0, V arg1)
           
 void putAll(java.util.Map<? extends K,? extends V> arg0)
           
 V remove(java.lang.Object arg0)
           
 int size()
           
 java.util.Collection<V> values()
           
 
Methods inherited from class nl.tudelft.simulation.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, getEventTypes, removeAllListeners, removeAllListeners, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

OBJECT_ADDED_EVENT

public static final EventType OBJECT_ADDED_EVENT
OBJECT_ADDED_EVENT is fired on new entries


OBJECT_REMOVED_EVENT

public static final EventType OBJECT_REMOVED_EVENT
OBJECT_REMOVED_EVENT is fired on removel of entries

Constructor Detail

EventProducingMap

public EventProducingMap(java.util.Map<K,V> parent)
constructs a new EventProducingMap.

Parameters:
parent - the parent map.
Method Detail

size

public int size()
Specified by:
size in interface java.util.Map<K,V>
See Also:
Map.size()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map<K,V>
See Also:
Map.isEmpty()

containsKey

public boolean containsKey(java.lang.Object arg0)
Specified by:
containsKey in interface java.util.Map<K,V>
See Also:
Map.containsKey(java.lang.Object)

containsValue

public boolean containsValue(java.lang.Object arg0)
Specified by:
containsValue in interface java.util.Map<K,V>
See Also:
Map.containsValue(java.lang.Object)

get

public V get(java.lang.Object arg0)
Specified by:
get in interface java.util.Map<K,V>
See Also:
Map.get(java.lang.Object)

put

public V put(K arg0,
             V arg1)
Specified by:
put in interface java.util.Map<K,V>
See Also:
Map.put(java.lang.Object, java.lang.Object)

remove

public V remove(java.lang.Object arg0)
Specified by:
remove in interface java.util.Map<K,V>
See Also:
Map.remove(java.lang.Object)

putAll

public void putAll(java.util.Map<? extends K,? extends V> arg0)
Specified by:
putAll in interface java.util.Map<K,V>
See Also:
Map.putAll(java.util.Map)

clear

public void clear()
Specified by:
clear in interface java.util.Map<K,V>
See Also:
Map.clear()

keySet

public java.util.Set<K> keySet()
Specified by:
keySet in interface java.util.Map<K,V>
See Also:
Map.keySet()

values

public java.util.Collection<V> values()
Specified by:
values in interface java.util.Map<K,V>
See Also:
Map.values()

entrySet

public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
Specified by:
entrySet in interface java.util.Map<K,V>
See Also:
Map.entrySet()


Copyright © 2002-2005 Delft University of Technology, the Netherlands. All Rights Reserved.