test_class.declarator: SEARCH_TERM = toBuffer("searchTerm")
test_class.modifier: private static final
test_class.original_string: private static final ByteBuffer SEARCH_TERM = toBuffer("searchTerm");
test_class.type: ByteBuffer
test_class.var_name: SEARCH_TERM
test_class.declarator: ID = 17L
test_class.modifier: private static final
test_class.original_string: private static final long ID = 17L;
test_class.type: long
test_class.var_name: ID
test_class.declarator: INITIAL_SIZE = 16
test_class.modifier: private static final
test_class.original_string: private static final int INITIAL_SIZE = 16;
test_class.type: int
test_class.var_name: INITIAL_SIZE
test_class.declarator: MISSING_VALUE = Long.MIN_VALUE
test_class.modifier: private static final
test_class.original_string: private static final long MISSING_VALUE = Long.MIN_VALUE;
test_class.type: long
test_class.var_name: MISSING_VALUE
test_class.declarator: MAX_KEY_LENGTH = 64
test_class.modifier: private static final
test_class.original_string: private static final int MAX_KEY_LENGTH = 64;
test_class.type: int
test_class.var_name: MAX_KEY_LENGTH
test_class.declarator: map = new ByteSequenceMap(MAX_KEY_LENGTH, INITIAL_SIZE, MISSING_VALUE)
test_class.modifier: private final
test_class.original_string: private final ByteSequenceMap map = new ByteSequenceMap(MAX_KEY_LENGTH, INITIAL_SIZE, MISSING_VALUE);
test_class.type: ByteSequenceMap
test_class.var_name: map
test_class.declarator: receivedList = new ArrayList<>()
test_class.modifier: private final
test_class.original_string: private final List<Long> receivedList = new ArrayList<>();
test_class.type: List<Long>
test_class.var_name: receivedList
test_class.file: recall-store/src/test/java/com/aitusoftware/recall/map/ByteSequenceMapTest.java
test_class.identifier: ByteSequenceMapTest
test_case.body: @Test
      void shouldHaveCorrectIndexAfterResize()
      {
          final int doubleInitialSize = INITIAL_SIZE * 2;
          for (int i = 0; i < doubleInitialSize; i++)
          {
              map.put(toBuffer("searchTerm_" + i), i);
          }
  
          for (int i = 0; i < doubleInitialSize; i++)
          {
              receivedList.clear();
              assertSearchResult(map, toBuffer("searchTerm_" + i), i);
          }
      }
test_case.class_method_signature: ByteSequenceMapTest.shouldHaveCorrectIndexAfterResize()
test_case.full_signature: @Test void shouldHaveCorrectIndexAfterResize()
test_case.identifier: shouldHaveCorrectIndexAfterResize
test_case.invocations: put toBuffer clear assertSearchResult toBuffer
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void shouldHaveCorrectIndexAfterResize()
focal_class.declarator: ID_OFFSET = Integer.BYTES
focal_class.modifier: private static final
focal_class.original_string: private static final int ID_OFFSET = Integer.BYTES;
focal_class.type: int
focal_class.var_name: ID_OFFSET
focal_class.declarator: KEY_OFFSET = Integer.BYTES * 4
focal_class.modifier: private static final
focal_class.original_string: private static final int KEY_OFFSET = Integer.BYTES * 4;
focal_class.type: int
focal_class.var_name: KEY_OFFSET
focal_class.declarator: HASH_OFFSET = Integer.BYTES * 3
focal_class.modifier: private static final
focal_class.original_string: private static final int HASH_OFFSET = Integer.BYTES * 3;
focal_class.type: int
focal_class.var_name: HASH_OFFSET
focal_class.declarator: hash
focal_class.modifier: private final
focal_class.original_string: private final ToIntFunction<ByteBuffer> hash;
focal_class.type: ToIntFunction<ByteBuffer>
focal_class.var_name: hash
focal_class.declarator: loadFactor = 0.7f
focal_class.modifier: private final
focal_class.original_string: private final float loadFactor = 0.7f;
focal_class.type: float
focal_class.var_name: loadFactor
focal_class.declarator: bufferFactory
focal_class.modifier: private final
focal_class.original_string: private final IntFunction<ByteBuffer> bufferFactory;
focal_class.type: IntFunction<ByteBuffer>
focal_class.var_name: bufferFactory
focal_class.declarator: missingValue
focal_class.modifier: private final
focal_class.original_string: private final long missingValue;
focal_class.type: long
focal_class.var_name: missingValue
focal_class.declarator: maxKeyLength
focal_class.modifier: private final
focal_class.original_string: private final int maxKeyLength;
focal_class.type: int
focal_class.var_name: maxKeyLength
focal_class.declarator: getEntryHandler = (b, i) -> {}
focal_class.modifier: private final
focal_class.original_string: private final EntryHandler getEntryHandler = (b, i) -> {};
focal_class.type: EntryHandler
focal_class.var_name: getEntryHandler
focal_class.declarator: removeEntryHandler
focal_class.modifier: private final
focal_class.original_string: private final EntryHandler removeEntryHandler;
focal_class.type: EntryHandler
focal_class.var_name: removeEntryHandler
focal_class.declarator: dataBuffer
focal_class.modifier: private
focal_class.original_string: private ByteBuffer dataBuffer;
focal_class.type: ByteBuffer
focal_class.var_name: dataBuffer
focal_class.declarator: totalEntryCount
focal_class.modifier: private
focal_class.original_string: private int totalEntryCount;
focal_class.type: int
focal_class.var_name: totalEntryCount
focal_class.declarator: liveEntryCount
focal_class.modifier: private
focal_class.original_string: private int liveEntryCount;
focal_class.type: int
focal_class.var_name: liveEntryCount
focal_class.declarator: entryCountToTriggerRehash
focal_class.modifier: private
focal_class.original_string: private int entryCountToTriggerRehash;
focal_class.type: int
focal_class.var_name: entryCountToTriggerRehash
focal_class.declarator: entryMask
focal_class.modifier: private
focal_class.original_string: private int entryMask;
focal_class.type: int
focal_class.var_name: entryMask
focal_class.declarator: entrySizeInBytes
focal_class.modifier: private
focal_class.original_string: private int entrySizeInBytes;
focal_class.type: int
focal_class.var_name: entrySizeInBytes
focal_class.declarator: noDeletes = true
focal_class.modifier: private
focal_class.original_string: private boolean noDeletes = true;
focal_class.type: boolean
focal_class.var_name: noDeletes
focal_class.file: recall-store/src/main/java/com/aitusoftware/recall/map/ByteSequenceMap.java
focal_class.identifier: ByteSequenceMap
focal_class.interfaces: implements SequenceMap<ByteBuffer>
focal_class.class_method_signature: ByteSequenceMap.ByteSequenceMap(final int maxKeyLength, final int initialSize, final long missingValue)
focal_class.full_signature: public  ByteSequenceMap(final int maxKeyLength, final int initialSize, final long missingValue)
focal_class.identifier: ByteSequenceMap
focal_class.modifiers: public
focal_class.parameters: (final int maxKeyLength, final int initialSize, final long missingValue)
focal_class.signature:  ByteSequenceMap(final int maxKeyLength, final int initialSize, final long missingValue)
focal_class.class_method_signature: ByteSequenceMap.ByteSequenceMap(
          final int maxKeyLength, final int initialSize,
          final long missingValue, final IntFunction<ByteBuffer> bufferFactory)
focal_class.full_signature: public  ByteSequenceMap(
          final int maxKeyLength, final int initialSize,
          final long missingValue, final IntFunction<ByteBuffer> bufferFactory)
focal_class.identifier: ByteSequenceMap
focal_class.modifiers: public
focal_class.parameters: (
          final int maxKeyLength, final int initialSize,
          final long missingValue, final IntFunction<ByteBuffer> bufferFactory)
focal_class.signature:  ByteSequenceMap(
          final int maxKeyLength, final int initialSize,
          final long missingValue, final IntFunction<ByteBuffer> bufferFactory)
focal_class.class_method_signature: ByteSequenceMap.ByteSequenceMap(
          final int maxKeyLength, final int initialSize,
          final ToIntFunction<ByteBuffer> hash, final long missingValue,
          final IntFunction<ByteBuffer> bufferFactory)
focal_class.full_signature:   ByteSequenceMap(
          final int maxKeyLength, final int initialSize,
          final ToIntFunction<ByteBuffer> hash, final long missingValue,
          final IntFunction<ByteBuffer> bufferFactory)
focal_class.identifier: ByteSequenceMap
focal_class.parameters: (
          final int maxKeyLength, final int initialSize,
          final ToIntFunction<ByteBuffer> hash, final long missingValue,
          final IntFunction<ByteBuffer> bufferFactory)
focal_class.signature:  ByteSequenceMap(
          final int maxKeyLength, final int initialSize,
          final ToIntFunction<ByteBuffer> hash, final long missingValue,
          final IntFunction<ByteBuffer> bufferFactory)
focal_class.class_method_signature: ByteSequenceMap.put(final ByteBuffer value, final long id)
focal_class.full_signature: public void put(final ByteBuffer value, final long id)
focal_class.identifier: put
focal_class.modifiers: public
focal_class.parameters: (final ByteBuffer value, final long id)
focal_class.return: void
focal_class.signature: void put(final ByteBuffer value, final long id)
focal_class.class_method_signature: ByteSequenceMap.get(final ByteBuffer value)
focal_class.full_signature: public long get(final ByteBuffer value)
focal_class.identifier: get
focal_class.modifiers: public
focal_class.parameters: (final ByteBuffer value)
focal_class.return: long
focal_class.signature: long get(final ByteBuffer value)
focal_class.class_method_signature: ByteSequenceMap.remove(final ByteBuffer value)
focal_class.full_signature: public long remove(final ByteBuffer value)
focal_class.identifier: remove
focal_class.modifiers: public
focal_class.parameters: (final ByteBuffer value)
focal_class.return: long
focal_class.signature: long remove(final ByteBuffer value)
focal_class.class_method_signature: ByteSequenceMap.size()
focal_class.full_signature: public int size()
focal_class.identifier: size
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int size()
focal_class.class_method_signature: ByteSequenceMap.rehash()
focal_class.full_signature: public void rehash()
focal_class.identifier: rehash
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void rehash()
focal_class.class_method_signature: ByteSequenceMap.search(final ByteBuffer value, final EntryHandler entryHandler)
focal_class.full_signature: private long search(final ByteBuffer value, final EntryHandler entryHandler)
focal_class.identifier: search
focal_class.modifiers: private
focal_class.parameters: (final ByteBuffer value, final EntryHandler entryHandler)
focal_class.return: long
focal_class.signature: long search(final ByteBuffer value, final EntryHandler entryHandler)
focal_class.class_method_signature: ByteSequenceMap.rehash(final boolean shouldResize)
focal_class.full_signature: private void rehash(final boolean shouldResize)
focal_class.identifier: rehash
focal_class.modifiers: private
focal_class.parameters: (final boolean shouldResize)
focal_class.return: void
focal_class.signature: void rehash(final boolean shouldResize)
focal_class.class_method_signature: ByteSequenceMap.insertEntry(
          final ByteBuffer value, final long id,
          final int entryIndex, final boolean isInsert, final int hashValue)
focal_class.full_signature: private void insertEntry(
          final ByteBuffer value, final long id,
          final int entryIndex, final boolean isInsert, final int hashValue)
focal_class.identifier: insertEntry
focal_class.modifiers: private
focal_class.parameters: (
          final ByteBuffer value, final long id,
          final int entryIndex, final boolean isInsert, final int hashValue)
focal_class.return: void
focal_class.signature: void insertEntry(
          final ByteBuffer value, final long id,
          final int entryIndex, final boolean isInsert, final int hashValue)
focal_class.class_method_signature: ByteSequenceMap.isExistingEntryAt(final ByteBuffer value, final int entryIndex, final int hashValue)
focal_class.full_signature: private boolean isExistingEntryAt(final ByteBuffer value, final int entryIndex, final int hashValue)
focal_class.identifier: isExistingEntryAt
focal_class.modifiers: private
focal_class.parameters: (final ByteBuffer value, final int entryIndex, final int hashValue)
focal_class.return: boolean
focal_class.signature: boolean isExistingEntryAt(final ByteBuffer value, final int entryIndex, final int hashValue)
focal_class.class_method_signature: ByteSequenceMap.defaultHash(final ByteBuffer value)
focal_class.full_signature: private static int defaultHash(final ByteBuffer value)
focal_class.identifier: defaultHash
focal_class.modifiers: private static
focal_class.parameters: (final ByteBuffer value)
focal_class.return: int
focal_class.signature: int defaultHash(final ByteBuffer value)
focal_class.class_method_signature: ByteSequenceMap.byteOffset(final int entryIndex)
focal_class.full_signature: private int byteOffset(final int entryIndex)
focal_class.identifier: byteOffset
focal_class.modifiers: private
focal_class.parameters: (final int entryIndex)
focal_class.return: int
focal_class.signature: int byteOffset(final int entryIndex)
focal_class.class_method_signature: ByteSequenceMap.isValuePresent(final int entryIndex, final ByteBuffer dataBuffer)
focal_class.full_signature: private boolean isValuePresent(final int entryIndex, final ByteBuffer dataBuffer)
focal_class.identifier: isValuePresent
focal_class.modifiers: private
focal_class.parameters: (final int entryIndex, final ByteBuffer dataBuffer)
focal_class.return: boolean
focal_class.signature: boolean isValuePresent(final int entryIndex, final ByteBuffer dataBuffer)
focal_class.class_method_signature: ByteSequenceMap.setValueLength(final int entryIndex, final int valueLength, final ByteBuffer dataBuffer)
focal_class.full_signature: private void setValueLength(final int entryIndex, final int valueLength, final ByteBuffer dataBuffer)
focal_class.identifier: setValueLength
focal_class.modifiers: private
focal_class.parameters: (final int entryIndex, final int valueLength, final ByteBuffer dataBuffer)
focal_class.return: void
focal_class.signature: void setValueLength(final int entryIndex, final int valueLength, final ByteBuffer dataBuffer)
focal_class.class_method_signature: ByteSequenceMap.getValueLength(final int entryIndex, final ByteBuffer dataBuffer)
focal_class.full_signature: private int getValueLength(final int entryIndex, final ByteBuffer dataBuffer)
focal_class.identifier: getValueLength
focal_class.modifiers: private
focal_class.parameters: (final int entryIndex, final ByteBuffer dataBuffer)
focal_class.return: int
focal_class.signature: int getValueLength(final int entryIndex, final ByteBuffer dataBuffer)
focal_class.class_method_signature: ByteSequenceMap.setId(final int entryIndex, final long id, final ByteBuffer dataBuffer)
focal_class.full_signature: private void setId(final int entryIndex, final long id, final ByteBuffer dataBuffer)
focal_class.identifier: setId
focal_class.modifiers: private
focal_class.parameters: (final int entryIndex, final long id, final ByteBuffer dataBuffer)
focal_class.return: void
focal_class.signature: void setId(final int entryIndex, final long id, final ByteBuffer dataBuffer)
focal_class.class_method_signature: ByteSequenceMap.getId(final int entryIndex, final ByteBuffer dataBuffer)
focal_class.full_signature: private long getId(final int entryIndex, final ByteBuffer dataBuffer)
focal_class.identifier: getId
focal_class.modifiers: private
focal_class.parameters: (final int entryIndex, final ByteBuffer dataBuffer)
focal_class.return: long
focal_class.signature: long getId(final int entryIndex, final ByteBuffer dataBuffer)
focal_class.class_method_signature: ByteSequenceMap.setHash(final int entryIndex, final int hash, final ByteBuffer dataBuffer)
focal_class.full_signature: private void setHash(final int entryIndex, final int hash, final ByteBuffer dataBuffer)
focal_class.identifier: setHash
focal_class.modifiers: private
focal_class.parameters: (final int entryIndex, final int hash, final ByteBuffer dataBuffer)
focal_class.return: void
focal_class.signature: void setHash(final int entryIndex, final int hash, final ByteBuffer dataBuffer)
focal_class.class_method_signature: ByteSequenceMap.getHash(final int entryIndex, final ByteBuffer dataBuffer)
focal_class.full_signature: private int getHash(final int entryIndex, final ByteBuffer dataBuffer)
focal_class.identifier: getHash
focal_class.modifiers: private
focal_class.parameters: (final int entryIndex, final ByteBuffer dataBuffer)
focal_class.return: int
focal_class.signature: int getHash(final int entryIndex, final ByteBuffer dataBuffer)
focal_class.class_method_signature: ByteSequenceMap.keyOffset(final int entryIndex)
focal_class.full_signature: private int keyOffset(final int entryIndex)
focal_class.identifier: keyOffset
focal_class.modifiers: private
focal_class.parameters: (final int entryIndex)
focal_class.return: int
focal_class.signature: int keyOffset(final int entryIndex)
focal_method.body: public void put(final ByteBuffer value, final long id)
      {
          if (value.remaining() > maxKeyLength)
          {
              throw new IllegalArgumentException("Key too long");
          }
          if (liveEntryCount > entryCountToTriggerRehash)
          {
              rehash(true);
          }
          final int hashValue = hash.applyAsInt(value);
          final int entryIndex = (hashValue & entryMask);
          final boolean existingEntryAt = isExistingEntryAt(value, entryIndex, hashValue);
          if (!isValuePresent(entryIndex, dataBuffer) || existingEntryAt)
          {
              insertEntry(value, id, entryIndex, !existingEntryAt, hashValue);
          }
          else
          {
              for (int i = 1; i < totalEntryCount; i++)
              {
                  int candidateIndex = (entryIndex + (i));
                  if (candidateIndex >= totalEntryCount)
                  {
                      candidateIndex -= totalEntryCount;
                  }
                  final boolean innerExistingEntryAt = isExistingEntryAt(value, candidateIndex, hashValue);
                  if (!isValuePresent(candidateIndex, dataBuffer) || innerExistingEntryAt)
                  {
                      insertEntry(value, id, candidateIndex, !innerExistingEntryAt, hashValue);
                      return;
                  }
              }
  
              put(value, id);
          }
      }
focal_method.class_method_signature: ByteSequenceMap.put(final ByteBuffer value, final long id)
focal_method.full_signature: public void put(final ByteBuffer value, final long id)
focal_method.identifier: put
focal_method.invocations: remaining rehash applyAsInt isExistingEntryAt isValuePresent insertEntry isExistingEntryAt isValuePresent insertEntry put
focal_method.modifiers: public
focal_method.parameters: (final ByteBuffer value, final long id)
focal_method.return: void
focal_method.signature: void put(final ByteBuffer value, final long id)