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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final int minJobs
      public final int maxJobs
      public final double probability
    • 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.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      int getMinJobs() Get the minimum queue length for this threshold.
      int getMaxJobs() Get the maximum queue length for this threshold.
      double getProbability() Get the balking probability for this threshold.
      boolean matches(int queueLength) Check if a given queue length falls within this threshold's range.
      String toString()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 threshold
        maxJobs - 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]