nl.tudelft.simulation.event.util
Class EventProducingList<T>

java.lang.Object
  extended by nl.tudelft.simulation.event.EventProducer
      extended by nl.tudelft.simulation.event.util.EventProducingList<T>
Type Parameters:
T - the type of the list
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<T>, java.util.Collection<T>, java.util.List<T>, EventProducerInterface

public class EventProducingList<T>
extends EventProducer
implements java.util.List<T>

The Event producing list provides a list 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 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

(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:00 $
Author:
Peter Jacobs
See Also:
Serialized Form

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
EventProducingList(java.util.List<T> parent)
          constructs a new EventProducingList.
 
Method Summary
 void add(int index, T element)
           
 boolean add(T o)
           
 boolean addAll(java.util.Collection<? extends T> c)
           
 boolean addAll(int index, java.util.Collection<? extends T> c)
           
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection c)
           
 T get(int index)
           
 int indexOf(java.lang.Object o)
           
 boolean isEmpty()
           
 java.util.Iterator<T> iterator()
           
 int lastIndexOf(java.lang.Object o)
           
 java.util.ListIterator<T> listIterator()
           
 java.util.ListIterator<T> listIterator(int index)
           
 T remove(int index)
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
 boolean retainAll(java.util.Collection c)
           
 T set(int index, T element)
           
 int size()
           
 java.util.List<T> subList(int fromIndex, int toIndex)
           
 java.lang.Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 
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.List
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

EventProducingList

public EventProducingList(java.util.List<T> parent)
constructs a new EventProducingList.

Parameters:
parent - the parent list.
Method Detail

size

public int size()
Specified by:
size in interface java.util.Collection<T>
Specified by:
size in interface java.util.List<T>
See Also:
List.size()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<T>
Specified by:
isEmpty in interface java.util.List<T>
See Also:
List.isEmpty()

clear

public void clear()
Specified by:
clear in interface java.util.Collection<T>
Specified by:
clear in interface java.util.List<T>
See Also:
List.clear()

add

public void add(int index,
                T element)
Specified by:
add in interface java.util.List<T>
See Also:
List.add(int, java.lang.Object)

add

public boolean add(T o)
Specified by:
add in interface java.util.Collection<T>
Specified by:
add in interface java.util.List<T>
See Also:
Collection.add(java.lang.Object)

addAll

public boolean addAll(java.util.Collection<? extends T> c)
Specified by:
addAll in interface java.util.Collection<T>
Specified by:
addAll in interface java.util.List<T>
See Also:
Collection.addAll(java.util.Collection)

addAll

public boolean addAll(int index,
                      java.util.Collection<? extends T> c)
Specified by:
addAll in interface java.util.List<T>
See Also:
List.addAll(int, java.util.Collection)

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection<T>
Specified by:
contains in interface java.util.List<T>
See Also:
Collection.contains(java.lang.Object)

containsAll

public boolean containsAll(java.util.Collection c)
Specified by:
containsAll in interface java.util.Collection<T>
Specified by:
containsAll in interface java.util.List<T>
See Also:
Collection.containsAll(java.util.Collection)

get

public T get(int index)
Specified by:
get in interface java.util.List<T>
See Also:
List.get(int)

indexOf

public int indexOf(java.lang.Object o)
Specified by:
indexOf in interface java.util.List<T>
See Also:
List.indexOf(java.lang.Object)

iterator

public java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T>
Specified by:
iterator in interface java.util.Collection<T>
Specified by:
iterator in interface java.util.List<T>
See Also:
Collection.iterator()

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Specified by:
lastIndexOf in interface java.util.List<T>
See Also:
List.lastIndexOf(java.lang.Object)

listIterator

public java.util.ListIterator<T> listIterator()
Specified by:
listIterator in interface java.util.List<T>
See Also:
List.listIterator()

listIterator

public java.util.ListIterator<T> listIterator(int index)
Specified by:
listIterator in interface java.util.List<T>
See Also:
List.listIterator(int)

remove

public T remove(int index)
Specified by:
remove in interface java.util.List<T>
See Also:
List.remove(int)

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection<T>
Specified by:
remove in interface java.util.List<T>
See Also:
Collection.remove(java.lang.Object)

removeAll

public boolean removeAll(java.util.Collection c)
Specified by:
removeAll in interface java.util.Collection<T>
Specified by:
removeAll in interface java.util.List<T>
See Also:
Collection.removeAll(java.util.Collection)

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.Collection<T>
Specified by:
retainAll in interface java.util.List<T>
See Also:
Collection.retainAll(java.util.Collection)

set

public T set(int index,
             T element)
Specified by:
set in interface java.util.List<T>
See Also:
List.set(int, java.lang.Object)

subList

public java.util.List<T> subList(int fromIndex,
                                 int toIndex)
Specified by:
subList in interface java.util.List<T>
See Also:
List.subList(int, int)

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<T>
Specified by:
toArray in interface java.util.List<T>
See Also:
Collection.toArray()

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface java.util.Collection<T>
Specified by:
toArray in interface java.util.List<T>
See Also:
Collection.toArray(java.lang.Object[])


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