コード例 #1
0
  /** {@inheritDoc} */
  @Override
  public short set(int offset, short val) {
    if (offset >= _pos) {
      throw new ArrayIndexOutOfBoundsException(offset);
    }

    short prev_val = _data.get(offset);
    _data.put(offset, val);
    return prev_val;
  }
コード例 #2
0
  @Override
  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {

    // VERSION
    in.readByte();

    // POSITION
    _pos = in.readInt();

    // NO_ENTRY_VALUE
    no_entry_value = in.readShort();

    // ENTRIES
    int len = in.readInt();
    _data = new TShortOffheapArray(len);
    for (int i = 0; i < len; i++) {
      _data.put(i, in.readShort());
    }
  }
コード例 #3
0
 /** {@inheritDoc} */
 @Override
 public void transformValues(TShortFunction function) {
   for (int i = _pos; i-- > 0; ) {
     _data.put(i, function.execute(_data.get(i)));
   }
 }
コード例 #4
0
 /** Sets the value at the specified offset without doing any bounds checking. */
 public void setQuick(int offset, short val) {
   _data.put(offset, val);
 }
コード例 #5
0
 /** {@inheritDoc} */
 @Override
 public boolean add(short val) {
   ensureCapacity(_pos + 1);
   _data.put(_pos++, val);
   return true;
 }