public void simulOneDay() {
   Sim.init();
   new OneDay().schedule(9.75);
   Sim.start();
   statServed.update(nbServed);
   avWait.update(tellers.waitList().statSize().sum());
 }
Пример #2
0
 /**
  * Gives a new observation @f$x@f$ to the statistical collectors. Increases by 1 the bin counter
  * in which value @f$x@f$ falls. Values that fall outside the interval @f$[a,b]@f$ are added in
  * extra bin counter bin[0] if @f$x < a@f$, and in bin[@f$s+1@f$] if @f$x > b@f$.
  *
  * @param x observation value
  */
 public void add(double x) {
   super.add(x);
   if (x < m_a) ++co[0];
   else if (x > m_b) ++co[1 + numBins];
   else {
     int i = 1 + (int) ((x - m_a) / m_h);
     ++co[i];
   }
 }
Пример #3
0
  /**
   * Initializes this object. Divide the interval @f$[a,b]@f$ into
   *
   * @f$s@f$ bins of equal width and initializes all counters to 0.
   * @param s number of bins
   * @param a left boundary of interval
   * @param b right boundary of interval
   */
  public void init(double a, double b, int s) {
    /* The counters co[1] to co[s] contains the number of observations
       falling in the interval [a, b].
       co[0] is the number of observations < a,
       and co[s+1] is the number of observations > b.
    */

    super.init();
    if (b <= a) throw new IllegalArgumentException("   b <= a");
    co = new int[s + 2];
    numBins = s;
    m_h = (b - a) / s;
    m_a = a;
    m_b = b;
    for (int i = 0; i <= s + 1; i++) co[i] = 0;
  }
 public BankProc() {
   tellers.waitList().collectStat(true);
   for (int i = 1; i <= 100; i++) simulOneDay();
   statServed.report();
   avWait.report();
 }