Interface Lookback<K extends Comparable<K>>

Type Parameters:
K - the key type.
All Known Implementing Classes:
Buffer, LastKey, None

public interface Lookback<K extends Comparable<K>>
Defines the strategy for providing the next key for the client to search for.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(K key)
    Adds a key to the lookback tracking.
    boolean
    contains(K key)
    Determines if the key is in the lookback.
    get()
    Gets the key to query for.
    static <T extends Comparable<T>>
    Lookback<T>
    ofSize(int size)
    Creates a Lookback of the specified size.
    default Lookback<K>
    resize(int size)
    Resize the lookback.
    int
    Gets the number of keys this Lookback can store.
  • Method Details

    • ofSize

      static <T extends Comparable<T>> Lookback<T> ofSize(int size)
      Creates a Lookback of the specified size.
      Type Parameters:
      T - the key type.
      Parameters:
      size - the size of the lookback.
      Returns:
      a lookback of the specified size;
    • add

      void add(K key)
      Adds a key to the lookback tracking.
      Parameters:
      key - the key to add.
    • get

      K get()
      Gets the key to query for.
      Returns:
      the key to query for.
    • contains

      boolean contains(K key)
      Determines if the key is in the lookback.
      Parameters:
      key - the key to search for.
      Returns:
      true if this lookback holds the key.
    • size

      int size()
      Gets the number of keys this Lookback can store.
      Returns:
      the number of keys this Lookback can store.
    • resize

      default Lookback<K> resize(int size)
      Resize the lookback. May resize this lookback or create new one. The resulting lookback will contain as much of the latest data from this lookback as possible in the new configuration.
      Parameters:
      size - the desired size of the lookback. If size < 0 then 0 is used.
      Returns:
      a Lookback instance of the desired size.