ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters
Class ToggleEvent

java.lang.Object
  extended by umontreal.iro.lecuyer.simevents.Event
      extended by umontreal.iro.lecuyer.contactcenters.ToggleEvent
All Implemented Interfaces:
Comparable<Event>

public class ToggleEvent
extends Event

This event instructs a toggle element, i.e., any object implementing ToggleElement, to be started or stopped during the simulation. It can be useful to toggle some elements of a contact center, e.g., arrival processes, at determined moments during simulation. After the event is constructed and scheduled, when the simulation clock reaches the scheduled time, the event starts or stops the associated toggle element. Note that for the event to have a meaningful name when printing the event list, the target toggle element should override its toString method.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.simevents.Event
eventTime, priority, sim
 
Constructor Summary
ToggleEvent(Simulator sim, ToggleElement element, boolean start)
          Equivalent to ToggleEvent(ToggleElement,boolean), with a user-defined simulator sim.
ToggleEvent(ToggleElement element, boolean start)
          Constructs a new toggle event that will, at the time of its execution, start the toggle element element if start is true, or stop it if enabled is false.
 
Method Summary
 void actions()
           
 boolean getStart()
          Returns the status of the toggle element associated with this object after this event has occurred.
 ToggleElement getToggleElement()
          Returns the toggle element affected by this event.
 void setStart(boolean start)
          When the event occurs, the activity status of the toggle element will be set to start.
 void setToggleElement(ToggleElement element)
          Changes the associated toggle element to element.
 String toString()
           
 
Methods inherited from class umontreal.iro.lecuyer.simevents.Event
cancel, cancel, compareTo, getRa, priority, reschedule, schedule, scheduleAfter, scheduleBefore, scheduleNext, setPriority, setRa, setSimulator, setTime, simulator, time
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ToggleEvent

public ToggleEvent(ToggleElement element,
                   boolean start)
Constructs a new toggle event that will, at the time of its execution, start the toggle element element if start is true, or stop it if enabled is false.

Parameters:
element - the toggle element affected by the event.
start - the status of the toggle element after the event occurs.
Throws:
NullPointerException - if element is null.

ToggleEvent

public ToggleEvent(Simulator sim,
                   ToggleElement element,
                   boolean start)
Equivalent to ToggleEvent(ToggleElement,boolean), with a user-defined simulator sim.

Parameters:
sim - the simulator associated with the toggle event.
element - the toggle element affected by the event.
start - the status of the toggle element after the event occurs.
Throws:
NullPointerException - if sim or element are null.
Method Detail

getToggleElement

public ToggleElement getToggleElement()
Returns the toggle element affected by this event.

Returns:
the toggle element affected by this event.

setToggleElement

public void setToggleElement(ToggleElement element)
Changes the associated toggle element to element.

Parameters:
element - the new toggle element.
Throws:
NullPointerException - if element is null.

getStart

public boolean getStart()
Returns the status of the toggle element associated with this object after this event has occurred.

Returns:
the status of the associated toggle element after this event has occurred.

setStart

public void setStart(boolean start)
When the event occurs, the activity status of the toggle element will be set to start.

Parameters:
start - true if the toggle element will be started, false if it will be stopped.

actions

public void actions()
Specified by:
actions in class Event

toString

public String toString()
Overrides:
toString in class Object

ContactCenters
V. 0.9.9.

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