/**
   * Initializes the receiver.
   *
   * @param initialCapacity the initial capacity of the receiver.
   * @param minLoadFactor the minLoadFactor of the receiver.
   * @param maxLoadFactor the maxLoadFactor of the receiver.
   * @throws IllegalArgumentException if <tt>initialCapacity < 0 || (minLoadFactor < 0.0 ||
   *     minLoadFactor >= 1.0) || (maxLoadFactor <= 0.0 || maxLoadFactor >= 1.0) || (minLoadFactor
   *     >= maxLoadFactor)</tt> .
   */
  protected void setUp(int initialCapacity, double minLoadFactor, double maxLoadFactor) {
    int capacity = initialCapacity;
    super.setUp(capacity, minLoadFactor, maxLoadFactor);
    capacity = nextPrime(capacity);
    if (capacity == 0) capacity = 1; // open addressing needs at least one FREE slot at any time.

    this.table = new int[capacity];
    this.values = new double[capacity];
    this.state = new byte[capacity];

    // memory will be exhausted long before this pathological case happens, anyway.
    this.minLoadFactor = minLoadFactor;
    if (capacity == PrimeFinder.largestPrime) this.maxLoadFactor = 1.0;
    else this.maxLoadFactor = maxLoadFactor;

    this.distinct = 0;
    this.freeEntries = capacity; // delta

    // lowWaterMark will be established upon first expansion.
    // establishing it now (upon instance construction) would immediately make the table shrink upon
    // first put(...).
    // After all the idea of an "initialCapacity" implies violating lowWaterMarks when an object is
    // young.
    // See ensureCapacity(...)
    this.lowWaterMark = 0;
    this.highWaterMark = chooseHighWaterMark(capacity, this.maxLoadFactor);
  }
 /**
  * Clears the receiver, then adds all (key,value) pairs of <tt>other</tt>values to it.
  *
  * @param other the other map to be copied into the receiver.
  */
 public void assign(AbstractIntHashMap other) {
   if (!(other instanceof SparseOpenIntDoubleHashMap)) {
     super.assign(other);
     return;
   }
   SparseOpenIntDoubleHashMap source = (SparseOpenIntDoubleHashMap) other;
   SparseOpenIntDoubleHashMap copy = (SparseOpenIntDoubleHashMap) source.copy();
   this.values = copy.values;
   this.table = copy.table;
   this.state = copy.state;
   this.freeEntries = copy.freeEntries;
   this.distinct = copy.distinct;
   this.lowWaterMark = copy.lowWaterMark;
   this.highWaterMark = copy.highWaterMark;
   this.minLoadFactor = copy.minLoadFactor;
   this.maxLoadFactor = copy.maxLoadFactor;
 }