Class BalkingThreshold

java.lang.Object
jline.lang.constant.BalkingThreshold
All Implemented Interfaces:
Serializable

public class BalkingThreshold extends Object 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.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    BalkingThreshold(int minJobs, double probability)
    Creates a balking threshold for all queue lengths >= minJobs.
    BalkingThreshold(int minJobs, int maxJobs, double probability)
    Creates a balking threshold for a queue length range.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get the maximum queue length for this threshold.
    int
    Get the minimum queue length for this threshold.
    double
    Get the balking probability for this threshold.
    boolean
    matches(int queueLength)
    Check if a given queue length falls within this threshold's range.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • BalkingThreshold

      public BalkingThreshold(int minJobs, int maxJobs, double probability)
      Creates a balking threshold for a queue length range.
      Parameters:
      minJobs - minimum queue length (inclusive) for this threshold
      maxJobs - maximum queue length (inclusive), use Integer.MAX_VALUE for unbounded
      probability - probability of balking when queue length is in range [0.0, 1.0]
      Throws:
      IllegalArgumentException - if probability is not in [0, 1] or minJobs > maxJobs
    • BalkingThreshold

      public 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 Details

    • getMinJobs

      public int getMinJobs()
      Get the minimum queue length for this threshold.
      Returns:
      minimum queue length (inclusive)
    • getMaxJobs

      public int getMaxJobs()
      Get the maximum queue length for this threshold.
      Returns:
      maximum queue length (inclusive)
    • getProbability

      public double getProbability()
      Get the balking probability for this threshold.
      Returns:
      probability in [0.0, 1.0]
    • matches

      public 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]
    • toString

      public String toString()
      Overrides:
      toString in class Object