code: public double capOverbookRatio(int nIdx, double d) {
          if (d < 1) {
              return ratios.get(nIdx);
          }
          double v = Math.min(ratios.get(nIdx), d);
          ratios.set(nIdx, v);
          return v;
      }
docs: Cap the overbooking ratio for a given node.
  @param nIdx the node
  @param d the new ratio. {@code >= 1}
  @return the resulting ratio. Will be lower than {@code d} if a previous cap stated a lower value