ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.msk.conditions
Class ConditionUtil

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.msk.conditions.ConditionUtil

public class ConditionUtil
extends Object

Provides helper methods to construct condition objects using ConditionParams instances usually parsed from XML configuration files. The main method of this class is createCondition(CallCenter,int,ConditionParams) which uses other methods to make a Condition object out of the information provided by the parameters.


Method Summary
static boolean applies(double v1, double v2, Relationship rel)
          Returns true if and only if a condition comparing v1 and v2 based on relationship rel applies.
static AndCondition createAndCondition(CallCenter cc, int k, ConditionParamsList par)
          Similar to createOrCondition(CallCenter,int,ConditionParamsList), for an ``and'' condition.
static Condition createCondition(CallCenter cc, int k, ConditionParams par)
          Constructs a condition object for call center cc, and using parameters par.
static Condition createCondition(CallCenter cc, int k, JAXBElement<?> el)
          Similar to createCondition(CallCenter,int,ConditionParams), but from a JAXBElement instance.
static
<T> T
createCustom(Class<T> base, CallCenter cc, int k, Named par)
          Creates an object of base class base, from the parameter object par, and using the call center model cc.
static Condition createCustomCondition(CallCenter cc, int k, Named par)
          Calls createCustom (Condition.class, cc, k, par).
static FracBusyAgentsCondition createFracBusyAgentsCondition(CallCenter cc, TwoIndicesWithTypesParams par)
          Creates a new condition on the fraction of busy agents using the call center model cc, and the parameters in par.
static FracBusyAgentsThreshCondition createFracBusyAgentsThreshCondition(CallCenter cc, IndexThreshWithTypeParams par)
          Creates a new condition on the fraction of busy agents using the call center model cc, and the parameters in par.
static NumFreeAgentsCondition createNumFreeAgentsCondition(CallCenter cc, TwoIndicesParams par)
          Similar to createQueueSizeCondition(CallCenter,TwoIndicesWithTypesParams), for a condition on the number of free agents.
static NumFreeAgentsThreshCondition createNumFreeAgentsThreshCondition(CallCenter cc, IndexThreshIntParams par)
          Similar to createQueueSizeThreshCondition(CallCenter,IndexThreshIntWithTypeParams), for a condition on the number of free agents.
static OrCondition createOrCondition(CallCenter cc, int k, ConditionParamsList par)
          Creates an ``or'' condition from the call center model cc, and the parameters par.
static QueueSizesCondition createQueueSizeCondition(CallCenter cc, TwoIndicesWithTypesParams par)
          Creates a condition on the queue size from parameters par, and call center model cc.
static QueueSizeThreshCondition createQueueSizeThreshCondition(CallCenter cc, IndexThreshIntWithTypeParams par)
          Creates a condition on the queue size from parameters par, and call center model cc.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createCondition

public static Condition createCondition(CallCenter cc,
                                        int k,
                                        ConditionParams par)
Constructs a condition object for call center cc, and using parameters par. The type of the returned value depends on the parameters in par. If the either or all elements are set, the method calls createOrCondition(CallCenter,int,ConditionParamsList) or createAndCondition(CallCenter,int,ConditionParamsList), respectively, and returns the result. If the queueSizes element is set, the method returns the result of createQueueSizeCondition(CallCenter,TwoIndicesWithTypesParams). If the queueSizeThresh element is set, the method returns the result of createQueueSizeThreshCondition(CallCenter,IndexThreshIntWithTypeParams). If numFreeAgents is set, the method returns the result of createNumFreeAgentsCondition(CallCenter,TwoIndicesParams). If numFreeAgentsThresh is set, the method returns the result of createNumFreeAgentsThreshCondition(CallCenter,IndexThreshIntParams). If fracBusyAgents is set, the method returns the result of createFracBusyAgentsCondition(CallCenter,TwoIndicesWithTypesParams). If fracBusyAgentsThresh is set, the method returns the result of createFracBusyAgentsThreshCondition(CallCenter,IndexThreshWithTypeParams). The result of createCustomCondition(CallCenter,int,Named) is returned if custom is set.

Parameters:
cc - the call center model.
k - the index of the call type for which the condition concerns.
par - the parameters from which conditions are created.
Returns:
the condition obtained from parameters.
Throws:
IllegalArgumentException - if a problem occurs during the creation of the condition.

createCondition

public static Condition createCondition(CallCenter cc,
                                        int k,
                                        JAXBElement<?> el)
Similar to createCondition(CallCenter,int,ConditionParams), but from a JAXBElement instance. The type of the condition created depends on the name of the element, obtained using JAXBElement.getName(). The value of the element, obtained using JAXBElement.getValue(), is cast to the appropriate class, and needed creation method is called.

Parameters:
cc - the call center model.
k - the index of the call type for which the condition concerns.
el - the JAXB element corresponding to the condition.
Returns:
the created condition object.
Throws:
IllegalArgumentException - if a problem occurs during the creation of the condition.

createOrCondition

public static OrCondition createOrCondition(CallCenter cc,
                                            int k,
                                            ConditionParamsList par)
Creates an ``or'' condition from the call center model cc, and the parameters par. The parameter object encapsulates a list of JAXBElement representing parameters for a condition. The method uses createCondition(CallCenter,int,JAXBElement) to convert this element into a Condition object, and gathers the created objects into an array used to create the returned instance of OrCondition.

Parameters:
cc - the call center model.
k - the index of the call type for which the condition concerns.
par - the parameters for the condition.
Returns:
the condition object.
Throws:
IllegalArgumentException - if a problem occurs during the creation of one of the associated conditions.

createAndCondition

public static AndCondition createAndCondition(CallCenter cc,
                                              int k,
                                              ConditionParamsList par)
Similar to createOrCondition(CallCenter,int,ConditionParamsList), for an ``and'' condition.


createQueueSizeCondition

public static QueueSizesCondition createQueueSizeCondition(CallCenter cc,
                                                           TwoIndicesWithTypesParams par)
Creates a condition on the queue size from parameters par, and call center model cc. The method uses par to obtain the indices q1 and q2 as well as the relationship to compare with.

Parameters:
cc - the call center model.
par - the condition parameters.
Returns:
the new condition object.

createQueueSizeThreshCondition

public static QueueSizeThreshCondition createQueueSizeThreshCondition(CallCenter cc,
                                                                      IndexThreshIntWithTypeParams par)
Creates a condition on the queue size from parameters par, and call center model cc. The method uses par to obtain the index q, threshold η, and relationship to compare with.

Parameters:
cc - the call center model.
par - the condition parameters.
Returns:
the new condition object.

createNumFreeAgentsCondition

public static NumFreeAgentsCondition createNumFreeAgentsCondition(CallCenter cc,
                                                                  TwoIndicesParams par)
Similar to createQueueSizeCondition(CallCenter,TwoIndicesWithTypesParams), for a condition on the number of free agents.


createNumFreeAgentsThreshCondition

public static NumFreeAgentsThreshCondition createNumFreeAgentsThreshCondition(CallCenter cc,
                                                                              IndexThreshIntParams par)
Similar to createQueueSizeThreshCondition(CallCenter,IndexThreshIntWithTypeParams), for a condition on the number of free agents.


createFracBusyAgentsCondition

public static FracBusyAgentsCondition createFracBusyAgentsCondition(CallCenter cc,
                                                                    TwoIndicesWithTypesParams par)
Creates a new condition on the fraction of busy agents using the call center model cc, and the parameters in par.

Parameters:
cc - the call center model.
par - the condition parameters.
Returns:
the new condition object.

createFracBusyAgentsThreshCondition

public static FracBusyAgentsThreshCondition createFracBusyAgentsThreshCondition(CallCenter cc,
                                                                                IndexThreshWithTypeParams par)
Creates a new condition on the fraction of busy agents using the call center model cc, and the parameters in par.

Parameters:
cc - the call center model.
par - the condition parameters.
Returns:
the new condition object.

createCustomCondition

public static Condition createCustomCondition(CallCenter cc,
                                              int k,
                                              Named par)
Calls createCustom (Condition.class, cc, k, par).

Parameters:
cc - the call center model.
k - the index of the call type concerning the condition.
par - the parameters for the custom condition.
Returns:
an instance representing the custom condition.

createCustom

public static <T> T createCustom(Class<T> base,
                                 CallCenter cc,
                                 int k,
                                 Named par)
Creates an object of base class base, from the parameter object par, and using the call center model cc. The method first uses the name associated with par as a class name for Class.forName(String). It then checks that the corresponding class is a subclass of or implements base. If this is true, it searches for a constructor, and calls it to create an instance. The method looks for the following signatures, and the given order of priority: (CallCenter, int, Map), (CallCenter, int), (CallCenter, Map), (int, Map), (CallCenter), (int), (Map), and (). The last signature corresponds to the no-argument constructor. The instance of CallCenter is cc while the map is created by using ParamReadHelper.unmarshalProperties(PropertiesParams) on the properties associated with par.

Parameters:
base - the base class to be used.
cc - the call center model.
k - the index of the call type concerning the condition.
par - the parameters for the custom condition.
Returns:
an instance representing the custom object.

applies

public static boolean applies(double v1,
                              double v2,
                              Relationship rel)
Returns true if and only if a condition comparing v1 and v2 based on relationship rel applies.


ContactCenters
V. 0.9.9.

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