|
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.RandomTypeContactFactory
public class RandomTypeContactFactory
Represents a contact factory that can create contacts of random types. Any instance of this class encapsulates an array of contact factories, and a probability of selection for each factory. Each time a new contact is needed, an internal factory is selected randomly based on the selection probabilities, and used to instantiate the contact.
Constructor Summary | |
---|---|
RandomTypeContactFactory(ContactFactory[] factories,
double[] prob,
RandomStream stream)
Constructs a random-type contact factory selecting contact factories from the array factories, with probabilities given by prob, and using the random stream stream. |
Method Summary | |
---|---|
ContactFactory[] |
getContactFactories()
Returns an array giving each internal contact factory that can be selected. |
double[] |
getProbabilities()
Returns an array giving the probability of selection for each internal contact factory. |
RandomStream |
getStream()
Returns the random stream used for performing the selection. |
Contact |
newInstance()
Constructs and returns a new Contact object. |
void |
setStream(RandomStream stream)
Sets the random stream for performing further selections to stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomTypeContactFactory(ContactFactory[] factories, double[] prob, RandomStream stream)
factories
- the array of contact factories.prob
- the array of probabilities of selection.stream
- the random stream.
NullPointerException
- if any of the above argument is null,
or if at least one given contact factory is null.
IllegalArgumentException
- if factories and
prob do not share the same length, or if
prob contains at least one negative value.Method Detail |
---|
public ContactFactory[] getContactFactories()
public double[] getProbabilities()
public RandomStream getStream()
public void setStream(RandomStream stream)
stream
- the new random stream for selection.
NullPointerException
- if stream is null.public Contact newInstance()
ContactFactory
Contact
object.
If a contact cannot be instantiated, a
ContactInstantiationException
is thrown.
newInstance
in interface ContactFactory
|
ContactCenters V. 0.9.9. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |