|
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.server.Agent
public class Agent
Represents an individual agent in a detailed agent group.
Note: the AgentListener
implementations
are notified in the order of the list returned by
getAgentListeners()
, and an agent listener
modifying the list of listeners by using addAgentListener(AgentListener)
or removeAgentListener(AgentListener)
could result in
unpredictable behavior.
Field Summary | |
---|---|
protected int |
ecType
The end-contact type associated with the contact time returned by getContactTime(Contact) . |
protected int |
esType
The end-service type associated with the after-contact time returned by getAfterContactTime(Contact) . |
Constructor Summary | |
---|---|
Agent()
|
Method Summary | |
---|---|
void |
addAgentListener(AgentListener listener)
Adds the agent listener listener to this object. |
void |
clearAgentListeners()
Removes all the agent listeners registered with this agent. |
protected double |
getAfterContactTime(Contact contact)
Generates and returns the after-contact time associated with the contact contact. |
ValueGenerator |
getAfterContactTimeGenerator(int esType1)
Returns the value generator used to generate after-contact times for end-service type esType. |
DetailedAgentGroup |
getAgentGroup()
Returns the detailed agent group this agent is part of, or null if the agent is not in a group. |
List<AgentListener> |
getAgentListeners()
Returns an unmodifiable list containing all the agent listeners registered with this agent. |
Map<Object,Object> |
getAttributes()
Returns the map containing the attributes for this agent. |
protected double |
getContactTime(Contact contact)
Generates and returns the contact time associated with the contact contact. |
ValueGenerator |
getContactTimeGenerator(int ecType1)
Returns the value generator used to generate contact times for end-contact type ecType. |
EndServiceEventDetailed |
getEndServiceEvent()
Returns the current end-service event for this agent, or null if the agent is not busy. |
double |
getFirstLoginTime()
Returns the first simulation time at which this agent was added to an agent group. |
int |
getId()
Returns the identifier associated with this agent. |
double |
getIdleSimTime()
Returns the last simulation time at which this agent became idle. |
double |
getIdleTime()
Returns the time elapsed since the last moment this agent became idle. |
double |
getLastLoginTime()
Returns the last simulation time at which this agent was added to an agent group. |
String |
getName()
Returns the name associated with this object. |
void |
init()
Initializes this agent for a new simulation replication. |
boolean |
isAvailable()
Determines if the agent is available, or is serving contacts. |
boolean |
isBusy()
Determines if this agent is busy. |
boolean |
isGhost()
Determines if this agent is a ghost, i.e., if it was removed from an agent group before it has ended the service of a contact. |
protected void |
notifyAdded(DetailedAgentGroup group1)
|
protected void |
notifyAvailable(boolean avail1)
|
protected void |
notifyBeginService(EndServiceEventDetailed es1)
|
protected void |
notifyEndContact(EndServiceEventDetailed es1)
|
protected void |
notifyEndService(EndServiceEventDetailed es1)
|
protected void |
notifyInit()
|
protected void |
notifyRemoved(DetailedAgentGroup group1)
|
void |
removeAgentListener(AgentListener listener)
Removes the agent listener listener from this object. |
void |
restore(AgentState state)
Restores the state of this agent by using the given state object state. |
AgentState |
save()
Constructs and returns a token object containing the state of this agent. |
EndServiceEventDetailed |
serve(Contact contact)
Instructs this agent to begin the service of the contact contact, and returns the constructed end-service event representing the service. |
void |
setAfterContactTimeGenerator(int esType,
ValueGenerator acgen)
Sets the after-contact time generator for end-service type esType to acgen. |
void |
setAvailable(boolean avail)
Sets the availability status of this agent to avail. |
void |
setContactTimeGenerator(int ecType,
ValueGenerator cgen)
Sets the contact time generator for end-contact type ecType to cgen. |
void |
setFirstLoginTime(double firstLoginTime)
|
void |
setId(int id)
Sets the identifier of this agent to id. |
void |
setIdleSimTime(double idleSimTime)
|
void |
setLastLoginTime(double lastLoginTime)
|
void |
setName(String n)
Sets the name of this object to name. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int ecType
getContactTime(Contact)
.
protected int esType
getAfterContactTime(Contact)
.
Constructor Detail |
---|
public Agent()
Method Detail |
---|
public String getName()
Named
getName
in interface Named
public void setName(String n)
Named
UnsupportedOperationException
if the name is read-only.
setName
in interface Named
n
- the new name of the object.public AgentState save()
public void restore(AgentState state)
state
- the state of the agent.public void addAgentListener(AgentListener listener)
listener
- the agent listener being added.
NullPointerException
- if listener is null.public void removeAgentListener(AgentListener listener)
listener
- the agent listener being removed.public void clearAgentListeners()
public List<AgentListener> getAgentListeners()
protected void notifyInit()
protected void notifyAvailable(boolean avail1)
protected void notifyAdded(DetailedAgentGroup group1)
protected void notifyRemoved(DetailedAgentGroup group1)
protected void notifyBeginService(EndServiceEventDetailed es1)
protected void notifyEndContact(EndServiceEventDetailed es1)
protected void notifyEndService(EndServiceEventDetailed es1)
public EndServiceEventDetailed serve(Contact contact)
getAgentGroup()
.serve (contact, this)
.
contact
- the contact to be served.
public ValueGenerator getContactTimeGenerator(int ecType1)
ecType1
- the queried end-contact type.
public ValueGenerator getAfterContactTimeGenerator(int esType1)
esType1
- the queried end-service type.
public void setContactTimeGenerator(int ecType, ValueGenerator cgen)
ecType
- the affected end-contact type.cgen
- the new contact time generator associated with this end-contact type.
IllegalArgumentException
- if the end-contact type is negative.public void setAfterContactTimeGenerator(int esType, ValueGenerator acgen)
esType
- the modified end-service type.acgen
- the new after-contact time generator associated with this
end-service type.
IllegalArgumentException
- if the end-service type is negative.public void init()
init
in interface Initializable
public boolean isAvailable()
public void setAvailable(boolean avail)
avail
- the new availability status of this agent.public boolean isGhost()
public boolean isBusy()
public EndServiceEventDetailed getEndServiceEvent()
public double getIdleSimTime()
IllegalStateException
- if this agent is not idle.public double getIdleTime()
getIdleSimTime()
.
public void setIdleSimTime(double idleSimTime)
public double getFirstLoginTime()
public void setFirstLoginTime(double firstLoginTime)
public double getLastLoginTime()
public void setLastLoginTime(double lastLoginTime)
public DetailedAgentGroup getAgentGroup()
protected double getContactTime(Contact contact)
ecType
if the default value
of 0 is not appropriate.
If this returns Double.NaN
, the contact time will
be generated by the parent agent group.
By default, a MinValueGenerator
is used.
For each end-contact type c with an associated value generator,
a contact time Cc is generated. The scheduled contact time is
Cc* = {Cc}, and the end-contact type is c*.
contact
- the contact being served.
protected double getAfterContactTime(Contact contact)
esType
if the default
value of 0 is not appropriate.
If this returns Double.NaN
, the after-contact time will
be generated by the parent agent group.
By default, a MinValueGenerator
is used.
For each end-service type c with an associated value generator,
an after-contact time Cc is generated. The scheduled after-contact time is
Cc* = {Cc}, and the end-service type is c*.
contact
- the contact being served.
public int getId()
public void setId(int id)
id
- the new identifier associated with the agent.
IllegalStateException
- if the identifier was already set.public Map<Object,Object> getAttributes()
public String toString()
toString
in class Object
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |