Esempio n. 1
0
  /** {@inheritDoc} */
  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    // VERSION
    in.readByte();

    // SUPER
    super.readExternal(in);

    // NUMBER OF ENTRIES
    int size = in.readInt();
    setUp(size);

    // ENTRIES
    while (size-- > 0) {
      double key = in.readDouble();
      int val = in.readInt();
      put(key, val);
    }
  }
Esempio n. 2
0
  /** {@inheritDoc} */
  public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION
    out.writeByte(0);

    // SUPER
    super.writeExternal(out);

    // NUMBER OF ENTRIES
    out.writeInt(_size);

    // ENTRIES
    for (int i = _states.length; i-- > 0; ) {
      if (_states[i] == FULL) {
        out.writeDouble(_set[i]);
        out.writeInt(_values[i]);
      }
    }
  }
Esempio n. 3
0
 /** {@inheritDoc} */
 protected void removeAt(int index) {
   _values[index] = no_entry_value;
   super.removeAt(index); // clear key, state; adjust size
 }
Esempio n. 4
0
 /** {@inheritDoc} */
 public void clear() {
   super.clear();
   Arrays.fill(_set, 0, _set.length, no_entry_key);
   Arrays.fill(_values, 0, _values.length, no_entry_value);
   Arrays.fill(_states, 0, _states.length, FREE);
 }