Class MapStore<T>

  • Type Parameters:
    T - Representation object type
    All Implemented Interfaces:
    DataStore<T>, WritableDataStore<T>

    class MapStore<T>
    extends java.lang.Object
    implements WritableDataStore<T>
    A class to answer representation queries using a map. Basically, it is just a wrapper around a regular map. Rather than using this directly, use a WritableDataStore from the DataStoreFactory.
    Since:
    0.4.0
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<DBID,​T> data
      Storage Map.
    • Constructor Summary

      Constructors 
      Constructor Description
      MapStore()
      Constructor.
      MapStore​(java.util.Map<DBID,​T> data)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clear the storage (resetting it to the default value).
      void delete​(DBIDRef id)
      Delete the contents for a particular ID and notifies the registered listeners.
      void destroy()
      Deallocate the storage, freeing the memory and notifies the registered listeners.
      T get​(DBIDRef id)
      Retrieves an object from the storage.
      T put​(DBIDRef id, T value)
      Associates the specified value with the specified id in this storage.
      • Methods inherited from class java.lang.Object

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

      • data

        private java.util.Map<DBID,​T> data
        Storage Map.
    • Constructor Detail

      • MapStore

        public MapStore​(java.util.Map<DBID,​T> data)
        Constructor.
        Parameters:
        data - Existing map
      • MapStore

        public MapStore()
        Constructor.
    • Method Detail

      • get

        public T get​(DBIDRef id)
        Description copied from interface: DataStore
        Retrieves an object from the storage.
        Specified by:
        get in interface DataStore<T>
        Parameters:
        id - Database ID.
        Returns:
        Object or null
      • put

        public T put​(DBIDRef id,
                     T value)
        Description copied from interface: WritableDataStore
        Associates the specified value with the specified id in this storage. If the storage previously contained a value for the id, the previous value is replaced by the specified value.
        Specified by:
        put in interface WritableDataStore<T>
        Parameters:
        id - Database ID.
        value - Value to store.
        Returns:
        previous value
      • destroy

        public void destroy()
        Description copied from interface: WritableDataStore
        Deallocate the storage, freeing the memory and notifies the registered listeners.
        Specified by:
        destroy in interface WritableDataStore<T>
      • delete

        public void delete​(DBIDRef id)
        Description copied from interface: WritableDataStore
        Delete the contents for a particular ID and notifies the registered listeners.
        Specified by:
        delete in interface WritableDataStore<T>
        Parameters:
        id - Database ID.