|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.tudelft.simulation.event.EventProducer
public abstract class EventProducer
The EventProducer forms the reference implementation of the EventProducerInterface. Objects extending this class are provided all the functionalities for registration and event firering.
(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
Field Summary | |
---|---|
protected Map |
listeners
listeners is the collection of interested listeners |
Fields inherited from interface nl.tudelft.simulation.event.EventProducerInterface |
---|
FIRST_POSITION, LAST_POSITION |
Constructor Summary | |
---|---|
EventProducer()
constructs a new EventProducer and checks for double values in events |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Map listeners
Constructor Detail |
---|
public EventProducer()
Method Detail |
---|
public boolean addListener(EventListenerInterface listener, EventType eventType)
addListener
in interface EventProducerInterface
listener
- 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)
EventProducerInterface
addListener
in interface EventProducerInterface
listener
- 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 EventProducerInterface
listener
- 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)
EventProducerInterface
addListener
in interface EventProducerInterface
listener
- 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 fire
RemoteException
- 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()
EventProducerInterface
getEventTypes
in interface EventProducerInterface
EventProducerInterface.getEventTypes()
protected int removeAllListeners()
protected int removeAllListeners(Class ofClass)
ofClass
- the class or superclass.
public boolean removeListener(EventListenerInterface listener, EventType eventType)
EventProducerInterface
removeListener
in interface EventProducerInterface
listener
- which is no longer interested.eventType
- the event which is of no interest any more.
#removeListener(EventListenerInterface, EventType)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |