Package org.djutils.event.collection
Class EventProducingCollection<T>
java.lang.Object
org.djutils.event.LocalEventProducer
org.djutils.event.collection.EventProducingCollection<T>
- Type Parameters:
- T- The type of the event producing Collection.
- All Implemented Interfaces:
- Iterable<T>,- Collection<T>,- EventListener,- EventListener,- EventProducer
public class EventProducingCollection<T>
extends LocalEventProducer
implements EventListener, Collection<T>
The Event producing collection provides a set 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 SummaryFieldsModifier 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.EventProducerFIRST_POSITION, LAST_POSITION
- 
Constructor SummaryConstructorsConstructorDescriptionEventProducingCollection(Collection<T> wrappedCollection) constructs a new EventProducingCollection with a local EventProducer.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends T> c) voidclear()booleanbooleancontainsAll(Collection<?> c) booleanisEmpty()iterator()voidNotifies the event listener of an event.booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()Object[]toArray()<E> E[]toArray(E[] a) Methods inherited from class org.djutils.event.LocalEventProducergetEventListenerMapMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collectionequals, hashCode, parallelStream, removeIf, spliterator, stream, toArrayMethods inherited from interface org.djutils.event.EventProduceraddListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
- 
Field Details- 
OBJECT_ADDED_EVENTOBJECT_ADDED_EVENT is fired on new entries.
- 
OBJECT_REMOVED_EVENTOBJECT_REMOVED_EVENT is fired on removal of entries.
- 
OBJECT_CHANGED_EVENTOBJECT_CHANGED_EVENT is fired on change of one or more entries.
 
- 
- 
Constructor Details- 
EventProducingCollectionconstructs a new EventProducingCollection with a local EventProducer.- Parameters:
- wrappedCollection- the wrapped collection.
 
 
- 
- 
Method Details- 
sizepublic int size()- Specified by:
- sizein interface- Collection<T>
 
- 
isEmptypublic boolean isEmpty()- Specified by:
- isEmptyin interface- Collection<T>
 
- 
clearpublic void clear()- Specified by:
- clearin interface- Collection<T>
 
- 
add- Specified by:
- addin interface- Collection<T>
 
- 
addAll- Specified by:
- addAllin interface- Collection<T>
 
- 
contains- Specified by:
- containsin interface- Collection<T>
 
- 
containsAll- Specified by:
- containsAllin interface- Collection<T>
 
- 
iterator
- 
notifyDescription 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 interface- EventListener
- Parameters:
- event- the event which is sent to the listener
 
- 
remove- Specified by:
- removein interface- Collection<T>
 
- 
removeAll- Specified by:
- removeAllin interface- Collection<T>
 
- 
retainAll- Specified by:
- retainAllin interface- Collection<T>
 
- 
toArray- Specified by:
- toArrayin interface- Collection<T>
 
- 
toArraypublic <E> E[] toArray(E[] a) - Specified by:
- toArrayin interface- Collection<T>
 
 
-