@Override public int intoByteArray(byte[] array, int offset) { int numBytesNeeded = numBytesToSerialize(); if (array.length - offset < numBytesNeeded) { throw new IllegalArgumentException( String.format("array too small[%,d] < [%,d]", array.length - offset, numBytesNeeded)); } array[offset] = Fields.HASH_SPARSE_VERSION; return hasher.intoByteArray(array, offset + 1); }
@Override public Fields updateBucket(int key, byte val, UpdateCallback callback) { hasher.updateBucket(key, val, callback); if (hasher.getNumElements() >= growthBound) { int[] fields = hasher.getFields(); this.growthBound = 3 * (fields.length >>> 2); if (fields.length == switchToDenseSize) { Fields retVal = denseFactory.make(preamble); BucketIterator iter = getBucketIterator(); while (iter.next()) { retVal.updateBucket(iter.getKey(), iter.getValue(), NOOP_CB); } return retVal; } else { hasher.resetFields(fields.length << 1); hasher.boostrap(fields); } } return this; }
@Override public BucketIterator getBucketIterator() { return hasher.getBucketIterator(); }
@Override public int numBytesToSerialize() { return 1 + hasher.numBytesToSerialize(); }