예제 #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) {
      short key = in.readShort();
      short val = in.readShort();
      put(key, val);
    }
  }
예제 #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.writeShort(_set[i]);
        out.writeShort(_values[i]);
      }
    }
  }
예제 #3
0
 /** {@inheritDoc} */
 protected void removeAt(int index) {
   _values[index] = no_entry_value;
   super.removeAt(index); // clear key, state; adjust size
 }
예제 #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);
 }