Package org.djutils.event.collection
Class EventProducingList<E>
java.lang.Object
org.djutils.event.LocalEventProducer
org.djutils.event.collection.EventProducingList<E>
- Type Parameters:
E- the type of elements in the list
- All Implemented Interfaces:
Iterable<E>,Collection<E>,EventListener,List<E>,EventListener,EventProducer
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.
Copyright (c) 2002-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html. This class was originally part of the DSOL project, see https://simulation.tudelft.nl/dsol/manual.
- Author:
- Peter Jacobs , Alexander Verbraeck
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EventTypeOBJECT_ADDED_EVENT is fired on new entries.static final EventTypeOBJECT_CHANGED_EVENT is fired on change of one or more entries.static final EventTypeOBJECT_REMOVED_EVENT is fired on removal of entries.Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION -
Constructor Summary
ConstructorsConstructorDescriptionEventProducingList(List<E> wrappedList) constructs a new EventProducingList. -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends E> c) booleanaddAll(Collection<? extends E> c) voidclear()booleanbooleancontainsAll(Collection<?> c) get(int index) intbooleanisEmpty()iterator()intlistIterator(int index) voidNotifies the event listener of an event.remove(int index) booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()subList(int fromIndex, int toIndex) Object[]toArray()<T> T[]toArray(T[] a) Methods inherited from class org.djutils.event.LocalEventProducer
getEventListenerMapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface org.djutils.event.EventProducer
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListenerMethods inherited from interface java.util.List
equals, hashCode, replaceAll, sort, spliterator
-
Field Details
-
OBJECT_ADDED_EVENT
OBJECT_ADDED_EVENT is fired on new entries. -
OBJECT_REMOVED_EVENT
OBJECT_REMOVED_EVENT is fired on removal of entries. -
OBJECT_CHANGED_EVENT
OBJECT_CHANGED_EVENT is fired on change of one or more entries.
-
-
Constructor Details
-
EventProducingList
constructs a new EventProducingList.- Parameters:
wrappedList- the embedded list.
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
clear
public void clear() -
add
-
add
-
addAll
-
addAll
-
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>
-
get
-
indexOf
-
iterator
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
notify
Description copied from interface:EventListenerNotifies the event listener of an event. This operation forms the callback method of the asynchronous communication protocol expressed in the event package.- Specified by:
notifyin interfaceEventListener- Parameters:
event- the event which is sent to the listener
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<E>
-
remove
-
remove
-
removeAll
-
retainAll
-
set
-
subList
-
toArray
-
toArray
public <T> T[] toArray(T[] a)
-