Class BalkingThreshold
-
- All Implemented Interfaces:
-
java.io.Serializable
public class BalkingThreshold implements Serializable
Represents a balking threshold for queue-length based balking. A threshold specifies that when the queue length is within a certain range, the customer will balk (refuse to join) with a given probability. Example: BalkingThreshold(5, 10, 0.3) means: - When queue length is between 5 and 10 (inclusive) - Customer balks with 30% probability Thresholds are evaluated in order; the first matching range determines the probability.
-
-
Field Summary
Fields Modifier and Type Field Description public final intminJobspublic final intmaxJobspublic final doubleprobability
-
Constructor Summary
Constructors Constructor Description BalkingThreshold(int minJobs, int maxJobs, double probability)Creates a balking threshold for a queue length range. BalkingThreshold(int minJobs, double probability)Creates a balking threshold for all queue lengths >= minJobs.
-
Method Summary
Modifier and Type Method Description intgetMinJobs()Get the minimum queue length for this threshold. intgetMaxJobs()Get the maximum queue length for this threshold. doublegetProbability()Get the balking probability for this threshold. booleanmatches(int queueLength)Check if a given queue length falls within this threshold's range. StringtoString()-
-
Constructor Detail
-
BalkingThreshold
BalkingThreshold(int minJobs, int maxJobs, double probability)
Creates a balking threshold for a queue length range.- Parameters:
minJobs- minimum queue length (inclusive) for this thresholdmaxJobs- maximum queue length (inclusive), use Integer.probability- probability of balking when queue length is in range [0.0, 1.
-
BalkingThreshold
BalkingThreshold(int minJobs, double probability)
Creates a balking threshold for all queue lengths >= minJobs.- Parameters:
minJobs- minimum queue length (inclusive)probability- probability of balking
-
-
Method Detail
-
getMinJobs
int getMinJobs()
Get the minimum queue length for this threshold.
- Returns:
minimum queue length (inclusive)
-
getMaxJobs
int getMaxJobs()
Get the maximum queue length for this threshold.
- Returns:
maximum queue length (inclusive)
-
getProbability
double getProbability()
Get the balking probability for this threshold.
- Returns:
probability in [0.0, 1.0]
-
matches
boolean matches(int queueLength)
Check if a given queue length falls within this threshold's range.
- Parameters:
queueLength- the current queue length- Returns:
true if queueLength is in [minJobs, maxJobs]
-
-
-
-