public abstract class EventProducer extends Object implements EventProducerInterface, Serializable
(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
| Modifier and Type | Field and Description |
|---|---|
protected Map |
listeners
listeners is the collection of interested listeners
|
FIRST_POSITION, LAST_POSITION| Constructor and Description |
|---|
EventProducer()
constructs a new EventProducer and checks for double values in events
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addListener(EventListenerInterface listener,
EventType eventType)
adds the listener as weak reference to the listener.
|
boolean |
addListener(EventListenerInterface listener,
EventType eventType,
boolean weak)
adds a listener to the BEGINNING of a queue of listeners.
|
boolean |
addListener(EventListenerInterface listener,
EventType eventType,
short position)
adds the listener as weak reference to the listener.
|
boolean |
addListener(EventListenerInterface listener,
EventType eventType,
short position,
boolean weak)
adds a listener to the specified position of a queue of listeners.
|
protected EventInterface |
fireEvent(EventInterface event)
fires an event to subscribed listeners.
|
protected EventInterface |
fireEvent(EventListenerInterface listener,
EventInterface event)
fires the event to the listener.
|
protected boolean |
fireEvent(EventType eventType,
boolean value)
fires a boolean value to subscribed listeners subscribed to eventType.
|
protected boolean |
fireEvent(EventType eventType,
boolean value,
double time)
fires a boolean value to subscribed listeners subscribed to eventType.
|
protected byte |
fireEvent(EventType eventType,
byte value)
fires a byte value to subscribed listeners subscribed to eventType.
|
protected byte |
fireEvent(EventType eventType,
byte value,
double time)
fires a byte value to subscribed listeners subscribed to eventType.
|
protected double |
fireEvent(EventType eventType,
double value)
fires a double value to subscribed listeners subscribed to eventType.
|
protected double |
fireEvent(EventType eventType,
double value,
double time)
fires a double value to subscribed listeners subscribed to eventType.
|
protected int |
fireEvent(EventType eventType,
int value)
fires an integer value to subscribed listeners subscribed to eventType.
|
protected int |
fireEvent(EventType eventType,
int value,
double time)
fires an integer value to subscribed listeners subscribed to eventType.
|
protected long |
fireEvent(EventType eventType,
long value)
fires a long value to subscribed listeners subscribed to eventType.
|
protected long |
fireEvent(EventType eventType,
long value,
double time)
fires a long value to subscribed listeners subscribed to eventType.
|
protected Object |
fireEvent(EventType eventType,
Object value)
fires a value to subscribed listeners subscribed to eventType.
|
protected Object |
fireEvent(EventType eventType,
Object value,
double time)
fires a Serializable value to subscribed listeners subscribed to
eventType.
|
protected short |
fireEvent(EventType eventType,
short value)
fires a short value to subscribed listeners subscribed to eventType.
|
protected short |
fireEvent(EventType eventType,
short value,
double time)
fires a short value to subscribed listeners subscribed to eventType.
|
EventType[] |
getEventTypes()
returns all the eventTypes for which a listener can subscribe.
|
protected int |
removeAllListeners()
removes all the listeners from the producer.
|
protected int |
removeAllListeners(Class ofClass)
removes all the listeners of a class.
|
boolean |
removeListener(EventListenerInterface listener,
EventType eventType)
removes the subscription of a listener for a specific event.
|
protected Map listeners
public EventProducer()
public boolean addListener(EventListenerInterface listener, EventType eventType)
addListener in interface EventProducerInterfacelistener - the listener which is interested at events of eventtype.eventType - the events of interest.#addListener(EventListenerInterface, EventType)public boolean addListener(EventListenerInterface listener, EventType eventType, boolean weak)
EventProducerInterfaceaddListener in interface EventProducerInterfacelistener - the listener which is interested at events of eventtype.eventType - the events of interest.weak - whether or not the listener is added as weak reference.#addListener(nl.tudelft.simulation.event.EventListenerInterface,
nl.tudelft.simulation.event.EventType, boolean)public boolean addListener(EventListenerInterface listener, EventType eventType, short position)
addListener in interface EventProducerInterfacelistener - the listener which is interested at events of eventtype.eventType - the events of interest.position - the position of the listener in the queue.#addListener(nl.tudelft.simulation.event.EventListenerInterface,
nl.tudelft.simulation.event.EventType, short)public boolean addListener(EventListenerInterface listener, EventType eventType, short position, boolean weak)
EventProducerInterfaceaddListener in interface EventProducerInterfacelistener - which is interested at certain events,eventType - the events of interest.position - the position of the listener in the queueweak - whether the reference should be weak or strong.#addListener(nl.tudelft.simulation.event.EventListenerInterface,
nl.tudelft.simulation.event.EventType, short, boolean)protected EventInterface fireEvent(EventListenerInterface listener, EventInterface event) throws RemoteException
listener - the listener for this eventevent - the event to fireRemoteException - on network failure.protected EventInterface fireEvent(EventInterface event)
event - the event.protected byte fireEvent(EventType eventType, byte value)
eventType - the eventType of the event.value - the value of the event.protected boolean fireEvent(EventType eventType, boolean value)
eventType - the eventType of the event.value - the value of the event.protected byte fireEvent(EventType eventType, byte value, double time)
eventType - the eventType of the event.value - the value of the event.time - a timestamp for the event.protected boolean fireEvent(EventType eventType, boolean value, double time)
eventType - the eventType of the event.value - the value of the event.time - a timestamp for the event.protected double fireEvent(EventType eventType, double value)
eventType - the eventType of the event.value - the value of the event.protected double fireEvent(EventType eventType, double value, double time)
eventType - the eventType of the event.value - the value of the event.time - a timestamp for the event.protected int fireEvent(EventType eventType, int value)
eventType - the eventType of the event.value - the value of the event.protected int fireEvent(EventType eventType, int value, double time)
eventType - the eventType of the event.value - the value of the event.time - a timestamp for the event.protected long fireEvent(EventType eventType, long value)
eventType - the eventType of the event.value - the value of the event.protected long fireEvent(EventType eventType, long value, double time)
eventType - the eventType of the event.value - the value of the event.time - a timestamp for the event.protected Object fireEvent(EventType eventType, Object value)
eventType - the eventType of the event.value - the value of the event.protected Object fireEvent(EventType eventType, Object value, double time)
eventType - the eventType of the event.value - the value of the event.time - a timestamp for the event.protected short fireEvent(EventType eventType, short value)
eventType - the eventType of the event.value - the value of the event.protected short fireEvent(EventType eventType, short value, double time)
eventType - the eventType of the event.value - the value of the event.time - a timestamp for the event.public EventType[] getEventTypes()
EventProducerInterfacegetEventTypes in interface EventProducerInterfaceEventProducerInterface.getEventTypes()protected int removeAllListeners()
protected int removeAllListeners(Class ofClass)
ofClass - the class or superclass.public boolean removeListener(EventListenerInterface listener, EventType eventType)
EventProducerInterfaceremoveListener in interface EventProducerInterfacelistener - which is no longer interested.eventType - the event which is of no interest any more.#removeListener(EventListenerInterface, EventType)Copyright © 2002-2012 Delft University of Technology, the Netherlands. All Rights Reserved.