コード例 #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) {
      int key = in.readInt();
      int val = in.readInt();
      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.writeInt(_set[i]);
        out.writeInt(_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);
 }