nl.tudelft.simulation.event
Interface EventProducerInterface

All Known Subinterfaces:
RemoteEventProducerInterface
All Known Implementing Classes:
EventIterator, EventProducer, EventProducingCollection, EventProducingList, EventProducingMap, EventProducingSet, RemoteEventProducer

public interface EventProducerInterface

The EventProducerInterface defines the registration operations of an eventproducer. This behavior includes adding and removing listeners for a specific event type.

(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.0
Version:
$Revision: 1.1 $ $Date: 2007/01/06 13:24:35 $
Author:
Peter Jacobs

Field Summary
static short FIRST_POSITION
          The FIRST_POSITION in the queue
static short LAST_POSITION
          The LAST_POSITION in the queue
 
Method Summary
 boolean addListener(EventListenerInterface listener, EventType eventType)
          adds a listener as strong reference to the BEGINNING of a queue of listeners.
 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 a listener as strong reference to the specified position of a queue of listeners.
 boolean addListener(EventListenerInterface listener, EventType eventType, short position, boolean weak)
          adds a listener to the specified position of a queue of listeners.
 EventType[] getEventTypes()
          returns all the eventTypes for which a listener can subscribe.
 boolean removeListener(EventListenerInterface listener, EventType eventType)
          removes the subscription of a listener for a specific event.
 

Field Detail

FIRST_POSITION

static final short FIRST_POSITION
The FIRST_POSITION in the queue

See Also:
Constant Field Values

LAST_POSITION

static final short LAST_POSITION
The LAST_POSITION in the queue

See Also:
Constant Field Values
Method Detail

addListener

boolean addListener(EventListenerInterface listener,
                    EventType eventType)
                    throws RemoteException
adds a listener as strong reference to the BEGINNING of a queue of listeners.

Parameters:
listener - the listener which is interested at events of eventtype.
eventType - the events of interest.
Returns:
the success of adding the listener. If a listener was already added false is returned.
Throws:
RemoteException - If a network connection failure occurs.
See Also:
WeakReference

addListener

boolean addListener(EventListenerInterface listener,
                    EventType eventType,
                    boolean weak)
                    throws RemoteException
adds a listener to the BEGINNING of a queue of listeners.

Parameters:
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.
Returns:
the success of adding the listener. If a listener was already added false is returned.
Throws:
RemoteException - If a network connection failure occurs.
See Also:
WeakReference

addListener

boolean addListener(EventListenerInterface listener,
                    EventType eventType,
                    short position)
                    throws RemoteException
adds a listener as strong reference to the specified position of a queue of listeners.

Parameters:
listener - the listener which is interested at events of eventtype.
eventType - the events of interest.
position - the position of the listener in the queue.
Returns:
the success of adding the listener. If a listener was already added, or an illegal position is provided false is returned.
Throws:
RemoteException - If a network connection failure occurs.
See Also:
WeakReference

addListener

boolean addListener(EventListenerInterface listener,
                    EventType eventType,
                    short position,
                    boolean weak)
                    throws RemoteException
adds a listener to the specified position of a queue of listeners.

Parameters:
listener - which is interested at certain events,
eventType - the events of interest.
position - the position of the listener in the queue
weak - whether the reference should be weak or strong.
Returns:
the success of adding the listener. If a listener was already added or an illegal position is provided false is returned.
Throws:
RemoteException - If a network connection failure occurs.

getEventTypes

EventType[] getEventTypes()
                          throws RemoteException
returns all the eventTypes for which a listener can subscribe.

Returns:
EventType[] returns the eventTypes for which listeners can subscribe.
Throws:
RemoteException - If a network connection failure occurs.

removeListener

boolean removeListener(EventListenerInterface listener,
                       EventType eventType)
                       throws RemoteException
removes the subscription of a listener for a specific event.

Parameters:
listener - which is no longer interested.
eventType - the event which is of no interest any more.
Returns:
the success of removing the listener. If a listener was not subscribed false is returned.
Throws:
RemoteException - If a network connection failure occurs.


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