/// <summary> /// Creates a new <seealso cref="BytesRefHash"/> /// </summary> public BytesRefHash(ByteBlockPool pool, int capacity, BytesStartArray bytesStartArray) { HashSize = capacity; HashHalfSize = HashSize >> 1; HashMask = HashSize - 1; this.Pool = pool; Ids = new int[HashSize]; Arrays.Fill(Ids, -1); this.bytesStartArray = bytesStartArray; BytesStart = bytesStartArray.Init(); BytesUsed = bytesStartArray.BytesUsed() == null ? Counter.NewCounter() : bytesStartArray.BytesUsed(); BytesUsed.AddAndGet(HashSize * RamUsageEstimator.NUM_BYTES_INT); }
/// <summary> /// Creates a new <see cref="BytesRefHash"/> /// </summary> public BytesRefHash(ByteBlockPool pool, int capacity, BytesStartArray bytesStartArray) { hashSize = capacity; hashHalfSize = hashSize >> 1; hashMask = hashSize - 1; this.pool = pool; ids = new int[hashSize]; Arrays.Fill(ids, -1); this.bytesStartArray = bytesStartArray; bytesStart = bytesStartArray.Init(); bytesUsed = bytesStartArray.BytesUsed() ?? Counter.NewCounter(); bytesUsed.AddAndGet(hashSize * RamUsageEstimator.NUM_BYTES_INT32); }