Class PersistentEnvironment<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
net.cscott.jutil.PersistentEnvironment<K,V>
All Implemented Interfaces:
Map<K,V>, Environment<K,V>

public class PersistentEnvironment<K,V> extends AbstractMap<K,V> implements Environment<K,V>
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
  • Constructor Details

    • PersistentEnvironment

      public PersistentEnvironment()
      Creates a PersistentEnvironment with no mappings.
    • PersistentEnvironment

      public PersistentEnvironment(Map<K2,V2> m)
      Creates a PersistentEnvironment with the same mappings as the given Map.
  • Method Details

    • clear

      public void clear()
      Remove all mappings from this map.
      Specified by:
      clear in interface Map<K,V>
      Overrides:
      clear in class AbstractMap<K,V>
    • isEmpty

      public boolean isEmpty()
      Returns true if this map contains no key-value mappings.
      Specified by:
      isEmpty in interface Map<K,V>
      Overrides:
      isEmpty in class AbstractMap<K,V>
    • size

      public int size()
      Returns the numer of key-value mappings in this map.
      Specified by:
      size in interface Map<K,V>
      Overrides:
      size in class AbstractMap<K,V>
    • get

      public V get(Object key)
      Returns the value to which this map maps the specified key.
      Specified by:
      get in interface Map<K,V>
      Overrides:
      get in class AbstractMap<K,V>
    • put

      public V put(K key, V value)
      Associates the specified value with the specified key in this map.
      Specified by:
      put in interface Map<K,V>
      Overrides:
      put in class AbstractMap<K,V>
    • containsKey

      public boolean containsKey(Object key)
      Returns true if this map contains a mapping for the specified key.
      Specified by:
      containsKey in interface Map<K,V>
      Overrides:
      containsKey in class AbstractMap<K,V>
    • remove

      public V remove(Object key)
      Removes the mapping for this key from this map if present.
      Specified by:
      remove in interface Map<K,V>
      Overrides:
      remove in class AbstractMap<K,V>
    • getMark

      public Environment.Mark getMark()
      Get a mark that will allow you to restore the current state of this environment.
      Specified by:
      getMark in interface Environment<K,V>
    • undoToMark

      public void undoToMark(Environment.Mark m)
      Undo all changes since the supplied mark, restoring the map to its state at the time the mark was taken.
      Specified by:
      undoToMark in interface Environment<K,V>
    • entrySet

      public Set<Map.Entry<K,V>> entrySet()
      Returns a set view of the mappings contained in this map. The returned set is immutable.
      Specified by:
      entrySet in interface Map<K,V>
      Specified by:
      entrySet in class AbstractMap<K,V>