ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.contact
Interface ContactSource

All Superinterfaces:
Initializable, Named, ToggleElement
All Known Implementing Classes:
ContactArrivalProcess, Dialer, DirichletArrivalProcess, DirichletCompoundArrivalProcess, FixedCountsArrivalProcess, NORTADrivenArrivalProcess, PiecewiseConstantPoissonArrivalProcess, PoissonArrivalProcess, PoissonArrivalProcessWithInversion, PoissonArrivalProcessWithRandomRates, PoissonArrivalProcessWithThinning, PoissonArrivalProcessWithTimeIntervals, PoissonGammaArrivalProcess, PoissonGammaNortaRatesArrivalProcess, PoissonUniformArrivalProcess, StationaryContactArrivalProcess

public interface ContactSource
extends ToggleElement, Initializable, Named

Represents a contact source which produces contacts during a simulation. Before any simulation replication, any contact source needs to be initialized. Since initialization disables the source, the source must be enabled to produce contacts. When a contact is produced, the contact source should instantiate a Contact object using a user-specified ContactFactory implementation, or pick an instance from an internal list. It should then notify the new contact to any registered NewContactListener implementation.


Method Summary
 void addNewContactListener(NewContactListener listener)
          Adds the listener listener to be notified when a new contact is produced.
 void clearNewContactListeners()
          Clears the list of new-contact listeners associated with this contact source.
 List<NewContactListener> getNewContactListeners()
          Returns an unmodifiable list containing all the new-contact listeners registered with this contact source.
 void init()
          Initializes the contact source for a new replication of a simulation.
 void removeNewContactListener(NewContactListener listener)
          Removes the new-contact listener listener from the list associated with this contact source.
 void setSimulator(Simulator sim)
          Sets the simulator attached to this contact source to sim.
 Simulator simulator()
          Returns a reference to the simulator associated with this contact source.
 
Methods inherited from interface umontreal.iro.lecuyer.contactcenters.ToggleElement
isStarted, start, stop
 
Methods inherited from interface umontreal.iro.lecuyer.contactcenters.Named
getName, setName
 

Method Detail

init

void init()
Initializes the contact source for a new replication of a simulation. This method should disable the contact source if it is enabled, and cancel any scheduled event. One can assume this method will be called before any simulation replication starts.

Specified by:
init in interface Initializable

addNewContactListener

void addNewContactListener(NewContactListener listener)
Adds the listener listener to be notified when a new contact is produced. If the listener was already registered, nothing happens, because the listener cannot be notified more than once.

Parameters:
listener - the new-contact listener being added.
Throws:
NullPointerException - if listener is null.

removeNewContactListener

void removeNewContactListener(NewContactListener listener)
Removes the new-contact listener listener from the list associated with this contact source. If the listener was not previously registered with this contact source, nothing happens.

Parameters:
listener - the new-contact listener being removed.

clearNewContactListeners

void clearNewContactListeners()
Clears the list of new-contact listeners associated with this contact source.


getNewContactListeners

List<NewContactListener> getNewContactListeners()
Returns an unmodifiable list containing all the new-contact listeners registered with this contact source.

Returns:
the list of all registered new-contact listeners.

simulator

Simulator simulator()
Returns a reference to the simulator associated with this contact source. The simulator is used to schedule any event required by the contact source to produce contacts.

Any implementation of this interface should provide a constructor accepting the simulator as an argument. Constructors not receiving a simulator should use the default simulator returned by Simulator.getDefaultSimulator().

Returns:
the associated simulator.

setSimulator

void setSimulator(Simulator sim)
Sets the simulator attached to this contact source to sim. This method should not be called while the contact source is started.

Parameters:
sim - the new simulator.
Throws:
NullPointerException - if sim is null.

ContactCenters
V. 0.9.9.

To submit a bug or ask questions, send an e-mail to Richard Simard.