Class FullKeySet

  • All Implemented Interfaces:
    ShortKeySet, java.io.Serializable

    public class FullKeySet
    extends java.lang.Object
    implements ShortKeySet, java.io.Serializable
    Implementation of the ShortKeySet interface that always contains all the possible keys. Used to save storage when sets are full.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      FullKeySet​(int numKeys)
      Construct a new FullKeySet
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsKey​(short key)
      Determines if a given key is in the set.
      short getFirst()
      Returns the first (lowest) key in the set.
      short getLast()
      Returns the last (highest) key in the set.
      short getNext​(short key)
      finds the next key that is in the set that is greater than the given key.
      short getPrevious​(short key)
      finds the previous key that is in the set that is less than the given key.
      boolean isEmpty()
      Checks if the set is empty.
      void put​(short key)
      Adds a key to the set.
      boolean remove​(short key)
      Removes the key from the set.
      void removeAll()
      Removes all keys from the set.
      int size()
      Returns the number of keys currently in the set.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FullKeySet

        public FullKeySet​(int numKeys)
        Construct a new FullKeySet
        Parameters:
        numKeys - the number of keys in the set.