ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.server
Class EndServiceEvent

java.lang.Object
  extended by umontreal.iro.lecuyer.simevents.Event
      extended by umontreal.iro.lecuyer.contactcenters.server.EndServiceEvent
All Implemented Interfaces:
Cloneable, Comparable<Event>, ContactStepInfo
Direct Known Subclasses:
EndServiceEventDetailed

public class EndServiceEvent
extends Event
implements ContactStepInfo, Cloneable

Represents the simulation event for a contact's end of service. It is constructed and returned by the AgentGroup.serve(Contact) method and can be used to abort the service of a contact, dynamically modify its service time, or get information about the service. The event contains scheduled as well as effective information. A scheduled information is determined at the time the event is scheduled. For example, the schedule contact time is the contact time which was generated at the beginning of the service. An effective information is determined at the time the event occurs, or the service is aborted. It is different from the scheduled information only when the service is aborted.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.simevents.Event
eventTime, priority, sim
 
Constructor Summary
protected EndServiceEvent(AgentGroup group, Contact contact, double beginServiceTime)
          Constructs a new end-service event with contact contact served by an agent in group group, with service beginning at simulation time beginServiceTime.
 
Method Summary
 void actions()
           
 boolean afterContactDone()
          Determines if the after-contact work or service is terminated by the agent.
 EndServiceEvent clone()
          Returns a copy of this event.
 EndServiceEvent clone(Contact clonedContact)
          Similar to clone(), but initializes the contact of the cloned event with clonedContact instead of a clone of the contact returned by getContact().
 boolean contactDone()
          Determines if the communication is finished between the contact and the agent.
 boolean endContact(int ecType1)
          Terminates the communication part of the service represented by this event, with end-contact type ecType, and returns true if and only if the communication part was terminated successfully.
 boolean endService(int esType1)
          Terminates the after-contact part of the service represented by this event, with end-service type esType, and returns true if and only if the after-contact part was terminated successfully.
 AgentGroup getAgentGroup()
          Returns the agent group containing the agent serving the contact.
 double getBeginServiceTime()
          Returns the simulation time at which the service started.
 Contact getContact()
          Returns the contact being served.
 double getEffectiveAfterContactTime()
          Returns the effective after-contact time.
 double getEffectiveContactTime()
          Returns the effective contact time.
 int getEffectiveEndContactType()
          Returns the effective type of contact termination.
 int getEffectiveEndServiceType()
          Returns the effective type of the service termination.
 double getEndingTime()
          Returns the simulation time at which this step ended.
 double getScheduledAfterContactTime()
          Returns the scheduled after-contact time.
 double getScheduledContactTime()
          Returns the scheduled duration of the communication with the contact.
 int getScheduledEndContactType()
          Returns the type of contact termination that will occur when this event happens for the first time.
 int getScheduledEndServiceType()
          Returns the type of the service termination that will occur when this event happens for the second time.
 double getStartingTime()
          Returns the simulation time at which this step started.
 boolean isObsolete()
          Determines if this event is obsolete.
 void schedule(double delay)
           
 void setScheduledEndContactType(int ecType)
          Changes the type of contact termination that will occur when this event happens to ecType.
 void setScheduledEndServiceType(int esType)
          Changes the type of service termination that will occur when this event happens to esType.
 String toString()
           
 boolean wasGhostAgent()
          Determines if the agent ending the service of the contact disappears after the service is completed.
 
Methods inherited from class umontreal.iro.lecuyer.simevents.Event
cancel, cancel, compareTo, getRa, priority, reschedule, scheduleAfter, scheduleBefore, scheduleNext, setPriority, setRa, setSimulator, setTime, simulator, time
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EndServiceEvent

protected EndServiceEvent(AgentGroup group,
                          Contact contact,
                          double beginServiceTime)
Constructs a new end-service event with contact contact served by an agent in group group, with service beginning at simulation time beginServiceTime.

This constructor is rarely used directly; the recommended way to create end-service events is to use AgentGroup.serve(Contact).

Parameters:
group - the associated agent group.
contact - the contact being served.
beginServiceTime - the time at which the service begins.
Method Detail

getContact

public Contact getContact()
Returns the contact being served.

Specified by:
getContact in interface ContactStepInfo
Returns:
the contact being served.

getBeginServiceTime

public double getBeginServiceTime()
Returns the simulation time at which the service started.

Returns:
the time of beginning of service.

getStartingTime

public double getStartingTime()
Description copied from interface: ContactStepInfo
Returns the simulation time at which this step started.

Specified by:
getStartingTime in interface ContactStepInfo
Returns:
the start time of the step.

getEndingTime

public double getEndingTime()
Description copied from interface: ContactStepInfo
Returns the simulation time at which this step ended.

Specified by:
getEndingTime in interface ContactStepInfo
Returns:
the end time of the step.

getScheduledContactTime

public double getScheduledContactTime()
Returns the scheduled duration of the communication with the contact.

Returns:
the scheduled contact time.

getEffectiveContactTime

public double getEffectiveContactTime()
Returns the effective contact time. If the communication is not terminated, this throws an IllegalStateException.

Returns:
the effective contact time.
Throws:
IllegalStateException - if the communication is not terminated.

getScheduledAfterContactTime

public double getScheduledAfterContactTime()
Returns the scheduled after-contact time. If the communication is not terminated, an IllegalStateException is thrown.

Returns:
the scheduled after-contact time.
Throws:
IllegalStateException - if the communication is not terminated.

getEffectiveAfterContactTime

public double getEffectiveAfterContactTime()
Returns the effective after-contact time. If the service is not terminated, this throws an IllegalStateException.

Returns:
the effective after-contact time.
Throws:
IllegalStateException - if the service is not terminated.

getScheduledEndContactType

public int getScheduledEndContactType()
Returns the type of contact termination that will occur when this event happens for the first time. This scheduled end-contact type can be overridden by using the AgentGroup.endContact(EndServiceEvent,int) method.

Returns:
the scheduled end-contact type.

getScheduledEndServiceType

public int getScheduledEndServiceType()
Returns the type of the service termination that will occur when this event happens for the second time. This scheduled end-service type can be overridden by using the AgentGroup.endService(EndServiceEvent,int) method.

Returns:
the scheduled end-service type.

getEffectiveEndContactType

public int getEffectiveEndContactType()
Returns the effective type of contact termination. If the communication is not terminated, this throws an IllegalStateException.

Returns:
the effective end-contact type.
Throws:
IllegalStateException - if the communication is not terminated.

getEffectiveEndServiceType

public int getEffectiveEndServiceType()
Returns the effective type of the service termination. If the service is not terminated, this throws an IllegalStateException.

Returns:
the effective end-service type.
Throws:
IllegalStateException - if the service is not terminated.

setScheduledEndContactType

public void setScheduledEndContactType(int ecType)
Changes the type of contact termination that will occur when this event happens to ecType. If the communication is terminated, this throws an IllegalStateException.

Parameters:
ecType - the new end-contact type.
Throws:
IllegalStateException - if the communication is terminated.

setScheduledEndServiceType

public void setScheduledEndServiceType(int esType)
Changes the type of service termination that will occur when this event happens to esType. If the service is terminated, this throws an IllegalStateException.

Parameters:
esType - the new end-service type.
Throws:
IllegalStateException - if the service is terminated.

getAgentGroup

public AgentGroup getAgentGroup()
Returns the agent group containing the agent serving the contact.

Returns:
the agent group serving the contact.

endContact

public boolean endContact(int ecType1)
Terminates the communication part of the service represented by this event, with end-contact type ecType, and returns true if and only if the communication part was terminated successfully. This method calls getAgentGroup() AgentGroup.endContact(EndServiceEvent,int), and returns the result.

Parameters:
ecType1 - the end-contact type.
Returns:
the success indicator of the operation.

endService

public boolean endService(int esType1)
Terminates the after-contact part of the service represented by this event, with end-service type esType, and returns true if and only if the after-contact part was terminated successfully. This method calls getAgentGroup() AgentGroup.endService(EndServiceEvent,int), and returns the result.

Parameters:
esType1 - the end-service type.
Returns:
the success indicator of the operation.

contactDone

public boolean contactDone()
Determines if the communication is finished between the contact and the agent.

Returns:
true if the contact was served, false otherwise.

afterContactDone

public boolean afterContactDone()
Determines if the after-contact work or service is terminated by the agent.

Returns:
true if the after-contact work is done, false otherwise.

wasGhostAgent

public boolean wasGhostAgent()
Determines if the agent ending the service of the contact disappears after the service is completed.

Returns:
the ghost agent status.

isObsolete

public boolean isObsolete()
Determines if this event is obsolete. When calling AgentGroup.init(), some end-service events might still be in the simulator's event list. Since this agent group does not store every scheduled end-service event by default, one must use this method in actions() to test if this event is obsolete. If that returns true, one should return immediately.

Returns:
true for an obsolete event, false otherwise.

schedule

public void schedule(double delay)
Overrides:
schedule in class Event

actions

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

toString

public String toString()
Overrides:
toString in class Object

clone

public EndServiceEvent clone()
Returns a copy of this event. This method clones every field of the event, except the agent group which is not cloneable.

Overrides:
clone in class Object

clone

public EndServiceEvent clone(Contact clonedContact)
Similar to clone(), but initializes the contact of the cloned event with clonedContact instead of a clone of the contact returned by getContact(). This method can be useful when cloning a contact c for which c.getSteps() returns a non-empty list containing end-service events. In that case, the contact associated with the events included in c.getSteps() must correspond to c rather than clones of c.

Specified by:
clone in interface ContactStepInfo
Parameters:
clonedContact - the contact being cloned.
Returns:
the clone of this data object.

ContactCenters
V. 0.9.9.

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