|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.contactcenters.contact.Contact
public class Contact
Represents a contact (phone call, fax, e-mail, etc.) into the contact center. A contact enters the system at a given time, and requires some form of service. If it cannot be served immediately, it joins a queue or leaves the system. In more complex contact centers, contacts can be served more than once and can join several queues sequentially. A contact object holds all the information about a single contact. The arrival time, the total time spent in queue, the total time spent in service, the last joined queue, and the last serving agent group can be obtained from any contact object. Information about the complete path of the contact into the system can also be stored, but this is disabled by default to reduce memory usage.
For easier indexing in skill-based routers, every contact
has a numerical type identifier. For waiting queues supporting
it, a contact object also holds a priority.
The Contact class implements the
Comparable
interface
which allows to define the default priorities when contacts are in
priority queues.
Extra information can be added to a contact object using two different
mechanisms: by adding attributes to the map
returned by getAttributes()
, or by
defining fields in a subclass. The getAttributes()
method returns
a Map
that can be used to define custom contact attributes
dynamically. This can be used for quick implementation of
user-defined attributes, but it can reduce performance
of the application since look-ups in a map are slower
than direct manipulation of fields.
Alternatively, this class can be extended to add new attributes
as fields.
However, the contact subclass will have to be used
for communication between parts of the program
needing the extra information, which involves casts.
By default, no trunk group is associated with contacts.
As a result, every contact can enter the system, since its capacity
is infinite. If a contact is associated with a trunk group using
setTrunkGroup(umontreal.iro.lecuyer.contactcenters.contact.TrunkGroup)
,
a line is allocated by the router at the time of its arrival. If
no line is available in the
associated trunk group, the contact is blocked. Otherwise, it is
processed and the channel is released when it exits.
Each contact has an associated simulator which is used to schedule
contact-related events such as abandonment or service termination.
This simulator is determined at the time of construction.
If a constructor accepting a Simulator
instance is called,
the given simulator is used.
Otherwise, the default simulator returned by Simulator.getDefaultSimulator()
is used.
Constructor Summary | |
---|---|
Contact()
Constructs a new contact object with type identifier 0, priority 1, and the default simulator. |
|
Contact(double priority,
int typeId)
Constructs a new contact object with a priority priority, type identifier typeId, and the default simulator. |
|
Contact(int typeId)
Constructs a new contact with priority 1, type identifier typeId, and the default simulator. |
|
Contact(Simulator sim)
Equivalent to constructor Contact() , with the
given simulator sim. |
|
Contact(Simulator sim,
double priority,
int typeId)
Equivalent to constructor Contact(double,int) , with
the given simulator sim. |
|
Contact(Simulator sim,
int typeId)
Equivalent to constructor Contact(int) , with
the given simulator sim. |
Method Summary | |
---|---|
void |
addToTotalQueueTime(double delta)
Adds delta to the currently recorded total queue time returned by getTotalQueueTime() . |
void |
addToTotalServiceTime(double delta)
Adds delta to the currently recorded total service time returned by getTotalServiceTime() for this contact. |
void |
beginService(EndServiceEvent ev)
This method is called when the service of this contact by an agent begins, the end-service event ev representing the contact being served. |
void |
blocked(int bType)
This method is called when the contact is blocked by its current router with blocking type bType. |
Contact |
clone()
Returns a copy of this contact object. |
int |
compareTo(Contact otherContact)
Compares this contact with otherContact. |
void |
dequeued(DequeueEvent ev)
This method is called when a contact leaves a queue, the dequeue event ev representing the queued contact. |
void |
enableStepsTracing()
Enables steps tracing for this contact object. |
void |
endContact(EndServiceEvent ev)
This method is called when the communication between this contact and an agent is terminated. |
void |
endService(EndServiceEvent ev)
This method is called when the service of this contact (communication and after-contact work) was terminated, ev containing information about the served contact. |
void |
enqueued(DequeueEvent ev)
This method is called by a waiting queue object when a contact is put in queue, the dequeue event ev representing the queued contact. |
void |
ensureCapacityForDefaultAfterContactTime(int capacity)
Makes sure that the array containing default after-contact times specific to each agent group contains at least capacity elements. |
void |
ensureCapacityForDefaultContactTime(int capacity)
Makes sure that the array containing default contact times specific to each agent group contains at least capacity elements. |
ServiceTimes |
getAfterContactTimes()
Returns the after-contact times for this contact. |
double |
getArrivalTime()
Returns the contact's arrival simulation time. |
Map<Object,Object> |
getAttributes()
Returns the map containing the attributes for this contact. |
ServiceTimes |
getContactTimes()
Returns the contact times for this contact. |
double |
getDefaultAfterContactTime()
Returns the default duration of after-contact work performed by an agent after this contact is served. |
double |
getDefaultAfterContactTime(int i)
Returns the default after-contact time if this contact is served by an agent in group i. |
double |
getDefaultContactTime()
Returns the default contact time with an agent. |
double |
getDefaultContactTime(int i)
Returns the default contact time if this contact is served by an agent in group i. |
double |
getDefaultPatienceTime()
Returns the default patience time for this contact object. |
double |
getDefaultServiceTime()
Returns the default service time for this contact object. |
double |
getDefaultServiceTime(int i)
Returns the default service time for this contact if served by an agent in group i. |
AgentGroup |
getLastAgentGroup()
Returns the last agent group who began serving this contact. |
WaitingQueue |
getLastWaitingQueue()
Returns the last waiting queue this contact entered in. |
String |
getName()
Returns the name associated with this object. |
int |
getNumAgentGroups()
Returns the number of agent groups serving this contact simultaneously at the current simulation time. |
int |
getNumWaitingQueues()
Returns the number of waiting queues this contact is waiting in simultaneously, at the current simulation time. |
double |
getPriority()
Returns the priority for this contact. |
Router |
getRouter()
Returns a reference to the router currently managing this contact, or null if the contact is not currently in a router. |
ContactSource |
getSource()
Returns the contact's primary source which has produced this contact object. |
List<ContactStepInfo> |
getSteps()
Returns the list containing the steps in the life cycle of this contact. |
double |
getTotalQueueTime()
Returns the total time the contact has spent waiting in queues. |
double |
getTotalServiceTime()
Returns the total time this contact has spent being served by agents. |
TrunkGroup |
getTrunkGroup()
Returns the trunk group this contact will take a trunk from. |
int |
getTypeId()
Returns the type identifier for this contact object. |
boolean |
hasExited()
Determines if the contact has exited the system. |
boolean |
isSetDefaultAfterContactTime(int i)
Determines if an after-contact time was set specifically for agent group i, by using setDefaultAfterContactTime(int,double) . |
boolean |
isSetDefaultContactTime(int i)
Determines if a contact time was set specifically for agent group i, by using setDefaultContactTime(int,double) . |
void |
setArrivalTime(double arrivalTime)
Sets the arrival time of this contact to arrivalTime. |
void |
setDefaultAfterContactTime(double afterContactTime)
Sets the default after-contact time to afterContactTime. |
void |
setDefaultAfterContactTime(int i,
double t)
Sets the default after-contact time for this contact to t, if served by an agent in group i. |
void |
setDefaultContactTime(double contactTime)
Sets the default contact time to contactTime. |
void |
setDefaultContactTime(int i,
double t)
Sets the default contact time for this contact if served by an agent in group i to t. |
void |
setDefaultPatienceTime(double patienceTime)
Sets the default patience time of this contact to patienceTime. |
void |
setDefaultServiceTime(double serviceTime)
Sets the default service time of this contact to serviceTime. |
void |
setExited(boolean b)
Sets the exited indicator to b. |
void |
setName(String name)
Sets the name of this object to name. |
void |
setPriority(double newPriority)
Changes the contact's priority to newPriority. |
void |
setRouter(Router router)
This should only be called by the router. |
void |
setSimulator(Simulator sim)
Sets the simulator attached to this contact to sim. |
void |
setSource(ContactSource src)
Sets the source of this contact to src. |
void |
setTrunkGroup(TrunkGroup tg)
Sets the trunk group for this contact to tg. |
void |
setTypeId(int newTypeId)
Changes the type identifier for this contact object to newTypeId. |
Simulator |
simulator()
Returns a reference to the simulator attached to this contact. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Contact()
public Contact(Simulator sim)
Contact()
, with the
given simulator sim.
sim
- the simulator attached to the new contact.
NullPointerException
- if sim is null.public Contact(int typeId)
typeId
- type identifier of the new contact.
IllegalArgumentException
- if the type identifier is negative.public Contact(Simulator sim, int typeId)
Contact(int)
, with
the given simulator sim.
sim
- the simulator attached to the new contact.typeId
- type identifier of the new contact.
NullPointerException
- if sim is null.
IllegalArgumentException
- if the type identifier is negative.public Contact(double priority, int typeId)
priority
- the contact's priority.typeId
- the type identifier of this contact.
IllegalArgumentException
- if the type identifier is negative.public Contact(Simulator sim, double priority, int typeId)
Contact(double,int)
, with
the given simulator sim.
sim
- the simulator attached to the new contact.priority
- the contact's priority.typeId
- type identifier of the new contact.
NullPointerException
- if sim is null.
IllegalArgumentException
- if the type identifier is negative.Method Detail |
---|
public final Simulator simulator()
public final void setSimulator(Simulator sim)
sim
- the new simulator.
NullPointerException
- if sim is
null.public double getArrivalTime()
public void setArrivalTime(double arrivalTime)
arrivalTime
- the new arrival time.
IllegalArgumentException
- if arrivalTime is negative.public double getDefaultPatienceTime()
public void setDefaultPatienceTime(double patienceTime)
patienceTime
- the new patience time of the contact.
IllegalArgumentException
- if the given patience time
is negative or NaN.public ServiceTimes getContactTimes()
public ServiceTimes getAfterContactTimes()
public double getDefaultServiceTime()
getDefaultContactTime()
, and
getDefaultAfterContactTime()
.
public void setDefaultServiceTime(double serviceTime)
serviceTime
- the new service time of the contact.
IllegalArgumentException
- if the given service
time is negative or NaN.public double getDefaultContactTime()
public void setDefaultContactTime(double contactTime)
contactTime
- the new contact time.
IllegalArgumentException
- if the contact time is negative or NaN.public double getDefaultAfterContactTime()
public void setDefaultAfterContactTime(double afterContactTime)
afterContactTime
- the new after-contact time.
IllegalArgumentException
- if the after-contact time is negative or NaN.public double getDefaultContactTime(int i)
getDefaultContactTime()
.
i
- the index of the agent group.
public boolean isSetDefaultContactTime(int i)
setDefaultContactTime(int,double)
.
i
- the tested agent group index.
public void setDefaultContactTime(int i, double t)
Double.NaN
unsets the contact time for the
specified agent group.
i
- the index of the agent group to set.t
- the new contact time.public void ensureCapacityForDefaultContactTime(int capacity)
setDefaultContactTime(int,double)
to avoid multiple array reallocation.
capacity
- the new capacity.public double getDefaultAfterContactTime(int i)
getDefaultAfterContactTime()
.
i
- the index of the agent group.
public boolean isSetDefaultAfterContactTime(int i)
setDefaultAfterContactTime(int,double)
.
i
- the tested agent group index.
public void setDefaultAfterContactTime(int i, double t)
Double.NaN
unsets the after-contact time for the
specified agent group.
i
- the index of the agent group to set.t
- the new after-contact time.public void ensureCapacityForDefaultAfterContactTime(int capacity)
setDefaultAfterContactTime(int,double)
to avoid multiple array reallocation.
capacity
- the new capacity.public double getDefaultServiceTime(int i)
getDefaultContactTime(int)
and getDefaultAfterContactTime(int)
.
i
- the tested agent group.
public String getName()
Named
getName
in interface Named
public void setName(String name)
Named
UnsupportedOperationException
if the name is read-only.
setName
in interface Named
name
- the new name of the object.public List<ContactStepInfo> getSteps()
ContactStepInfo
implementations only.
If steps tracing was not enabled for this
contact, this returns null.
public void enableStepsTracing()
public double getPriority()
public void setPriority(double newPriority)
newPriority
- the new contact's priority.public double getTotalQueueTime()
public void addToTotalQueueTime(double delta)
getTotalQueueTime()
.
This method can be used, e.g., to subtract
time passed in a virtual queue from the queue
time of a contact.
delta
- the amount to add.public WaitingQueue getLastWaitingQueue()
public double getTotalServiceTime()
public void addToTotalServiceTime(double delta)
getTotalServiceTime()
for this contact.
delta
- the amount to add.public AgentGroup getLastAgentGroup()
public int getTypeId()
public void setTypeId(int newTypeId)
newTypeId
- the contact's new type identifier.
IllegalArgumentException
- if the type identifier
is smaller than 0.public Map<Object,Object> getAttributes()
public ContactSource getSource()
public void setSource(ContactSource src)
IllegalStateException
is thrown.
src
- the new contact source.
IllegalStateException
- if one tries
to change the contact source.public TrunkGroup getTrunkGroup()
public void setTrunkGroup(TrunkGroup tg)
tg
- the new trunk group.public Router getRouter()
public void setRouter(Router router)
router
- the new router.public boolean hasExited()
public void setExited(boolean b)
b
- the exited indicator.public void enqueued(DequeueEvent ev)
ev
- the dequeue event associated with the contact.public void dequeued(DequeueEvent ev)
ev
- the dequeue event associated with the contact.public void blocked(int bType)
getRouter()
method can be used to access
the reference to the router which blocked this contact while
bType indicates the reason why the contact was blocked.
bType
- the contact blocking type.public void beginService(EndServiceEvent ev)
ev
- the event occurring at the end of the service.public void endContact(EndServiceEvent ev)
ev
- the end-service event associated with the contact.public void endService(EndServiceEvent ev)
ev
- the end-service event associated with the contact.public int getNumWaitingQueues()
public int getNumAgentGroups()
public int compareTo(Contact otherContact)
compareTo
in interface Comparable<Contact>
otherContact
- the other contact this contact is compared to.
public String toString()
toString
in class Object
public Contact clone()
getAttributes()
returns
a non-null value,
is cloned, but the elements in the
map are not cloned.
If contact steps tracing is enabled,
the list of steps as well as
the step objects are cloned.
clone
in class Object
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |