Interface BPlusKeys<KeyType,KeyBufferType>

Type Parameters:
KeyType -
All Known Implementing Classes:
BPlusKeysFixedLong, BPlusKeysVariableBytes

public interface BPlusKeys<KeyType,KeyBufferType>
Describes an interface to the keys of a bplus node
Author:
angele
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    append key at end
    int
    how many keys can be contained?
    boolean
    checkSanity(String message, KeyType minKey, KeyType maxKey)
    check the correct sorting sequence of keys
    void
    remove all keys
    int
    compare(KeyType key, int index)
    compare key with key at index index
    int
    compare(KeyType key1, KeyType key2)
    compare two keys
    int
    compareBuffer(KeyBufferType key, int index)
     
    void
    copy(BPlusKeys<KeyType,KeyBufferType> b, int numKeys)
    copy numKeys keys into key container b, starting at left most key
    void
    ensureCapacity(int n, int totalLengthInBytes)
    ensures the capacity for n keys (variable number of keys)
    get(int i)
    return key with index i
    void
     
    int
    inserts key
    void
    insertAtIndex(KeyType key, int indexToInsert)
    inserts key at indexToInsert
    int
    returns the size of a key in bytes if it is fix
    otherwise -1 is returned in addition if key is added
    int
    returns the number of bytes needed in addition if key is added
    int
    return the current number of keys
    int
    readFileData(byte[] fileData, int start, int numKeys)
    read numkey keys from array of bytes starting at start returns start+number of read bytes
    void
    remove(int indexToSkip)
    remove key at indexToSkip from set of keys
    void
    replace(KeyType replacement, int index)
    replaces key by replacement at index
    void
    replace(KeyType key, KeyType replacement, int numKeys)
    replaces key by replacement
    void
    replaceByBuffer(KeyBufferType replacement, int index)
    replaces key by replacement at index
    int
    search(KeyType key, boolean indicateNotContained, boolean indicateContained)
    search for key if indicateNodContained==true results -1 if key has not been found otherwise results the index where the key has to be added
    int
    search(KeyType key, int begin, boolean indicateNotContained)
    search for key beginning from a start index if indicateNodContained==true results -1 if key has not been found otherwise results the index where the key has to be added
    int
    searchBuffer(KeyBufferType key, boolean indicateNotContained, boolean indicateContained)
     
    int
    searchBuffer(KeyBufferType key, int begin, boolean indicateNotContained)
     
    void
    set(int i, KeyType key)
    set key with index i
    int
    returns the size in bytes for writing the keys to a file
    int
    where to split
    splitLeft(int number, int n)
    returns left number keys n is the resulting capacity for keys
    splitRight(int index, int n)
    returns right keys starting at index n is the resulting capacity for keys
     
    int
    writeFileData(byte[] fileData, int start)
    write key data to byte array starting at start Returns start + number of written bytes
  • Method Details

    • clear

      void clear()
      remove all keys
    • capacity

      int capacity()
      how many keys can be contained?
      Returns:
    • split

      int split()
      where to split
      Returns:
    • numKeys

      int numKeys()
      return the current number of keys
      Returns:
    • sizeInBytes

      int sizeInBytes()
      returns the size in bytes for writing the keys to a file
      Returns:
    • keySizeInBytes

      int keySizeInBytes(KeyType key)
      returns the number of bytes needed in addition if key is added
      Parameters:
      key -
      Returns:
    • keySizeInBytes

      int keySizeInBytes()
      returns the size of a key in bytes if it is fix
      otherwise -1 is returned in addition if key is added
      Returns:
    • get

      KeyType get(int i)
      return key with index i
      Parameters:
      i -
      Returns:
    • getBuffer

      void getBuffer(int i, KeyBufferType result, BPlusNode<KeyType,KeyBufferType> node)
    • set

      void set(int i, KeyType key)
      set key with index i
      Parameters:
      i -
      key -
    • compare

      int compare(KeyType key, int index)
      compare key with key at index index
      Parameters:
      key -
      index -
      Returns:
    • compareBuffer

      int compareBuffer(KeyBufferType key, int index)
    • compare

      int compare(KeyType key1, KeyType key2)
      compare two keys
      Parameters:
      key1 -
      key2 -
      Returns:
    • search

      int search(KeyType key, boolean indicateNotContained, boolean indicateContained)
      search for key if indicateNodContained==true results -1 if key has not been found otherwise results the index where the key has to be added
      Parameters:
      key -
      indicateNotContained - , if key is not contained returns -1
      indicateContained - , if key is contained returns -1
      Returns:
    • searchBuffer

      int searchBuffer(KeyBufferType key, boolean indicateNotContained, boolean indicateContained)
    • search

      int search(KeyType key, int begin, boolean indicateNotContained)
      search for key beginning from a start index if indicateNodContained==true results -1 if key has not been found otherwise results the index where the key has to be added
      Parameters:
      key -
      begin -
      indicateNotContained -
      Returns:
    • searchBuffer

      int searchBuffer(KeyBufferType key, int begin, boolean indicateNotContained)
    • remove

      void remove(int indexToSkip)
      remove key at indexToSkip from set of keys
      Parameters:
      indexToSkip -
    • insert

      int insert(KeyType key)
      inserts key
      Parameters:
      key -
      Returns:
    • replace

      void replace(KeyType key, KeyType replacement, int numKeys)
      replaces key by replacement
      Parameters:
      key -
      replacement -
      numKeys -
    • replace

      void replace(KeyType replacement, int index)
      replaces key by replacement at index
      Parameters:
      replacement -
      index -
    • replaceByBuffer

      void replaceByBuffer(KeyBufferType replacement, int index)
      replaces key by replacement at index
      Parameters:
      replacement -
      index -
    • insertAtIndex

      void insertAtIndex(KeyType key, int indexToInsert)
      inserts key at indexToInsert
      Parameters:
      key -
      indexToInsert -
    • append

      void append(KeyType key)
      append key at end
      Parameters:
      key -
    • splitLeft

      BPlusKeys<KeyType,KeyBufferType> splitLeft(int number, int n)
      returns left number keys n is the resulting capacity for keys
      Parameters:
      number -
      n -
      Returns:
    • splitRight

      BPlusKeys<KeyType,KeyBufferType> splitRight(int index, int n)
      returns right keys starting at index n is the resulting capacity for keys
      Parameters:
      index -
      n -
      Returns:
    • copy

      void copy(BPlusKeys<KeyType,KeyBufferType> b, int numKeys)
      copy numKeys keys into key container b, starting at left most key
      Parameters:
      b -
      numKeys -
    • readFileData

      int readFileData(byte[] fileData, int start, int numKeys)
      read numkey keys from array of bytes starting at start returns start+number of read bytes
      Parameters:
      fileData -
      start -
      numKeys -
      Returns:
    • writeFileData

      int writeFileData(byte[] fileData, int start)
      write key data to byte array starting at start Returns start + number of written bytes
      Parameters:
      fileData -
      start -
      Returns:
    • ensureCapacity

      void ensureCapacity(int n, int totalLengthInBytes)
      ensures the capacity for n keys (variable number of keys)
      Parameters:
      n -
      totalLengthInBytes - , the whole length in bytes for all keys
    • checkSanity

      boolean checkSanity(String message, KeyType minKey, KeyType maxKey)
      check the correct sorting sequence of keys
      Returns:
    • toString

      String toString()
      Overrides:
      toString in class Object