net.cscott.jutil

Class PersistentEnvironment<K,V>

public class PersistentEnvironment<K,V> extends AbstractMap<K,V> implements Environment<K,V>

PersistentEnvironment is an Environment built on a PersistentMap.

Version: $Id: PersistentEnvironment.java,v 1.2 2004/01/13 21:57:14 cananian Exp $

Author: C. Scott Ananian

Constructor Summary
PersistentEnvironment()
Creates a PersistentEnvironment with no mappings.
<K2 extends K,V2 extends V>PersistentEnvironment(Map<K2,V2> m)
Creates a PersistentEnvironment with the same mappings as the given Map.
Method Summary
voidclear()
Remove all mappings from this map.
booleancontainsKey(Object key)
Returns true if this map contains a mapping for the specified key.
Set<Entry<K,V>>entrySet()
Returns a set view of the mappings contained in this map.
Vget(Object key)
Returns the value to which this map maps the specified key.
Environment.MarkgetMark()
Get a mark that will allow you to restore the current state of this environment.
booleanisEmpty()
Returns true if this map contains no key-value mappings.
Vput(K key, V value)
Associates the specified value with the specified key in this map.
Vremove(Object key)
Removes the mapping for this key from this map if present.
intsize()
Returns the numer of key-value mappings in this map.
voidundoToMark(Environment.Mark m)
Undo all changes since the supplied mark, restoring the map to its state at the time the mark was taken.

Constructor Detail

PersistentEnvironment

public PersistentEnvironment()
Creates a PersistentEnvironment with no mappings.

PersistentEnvironment

public <K2 extends K,V2 extends V> PersistentEnvironment(Map<K2,V2> m)
Creates a PersistentEnvironment with the same mappings as the given Map.

Method Detail

clear

public void clear()
Remove all mappings from this map.

containsKey

public boolean containsKey(Object key)
Returns true if this map contains a mapping for the specified key.

entrySet

public Set<Entry<K,V>> entrySet()
Returns a set view of the mappings contained in this map. The returned set is immutable.

get

public V get(Object key)
Returns the value to which this map maps the specified key.

getMark

public Environment.Mark getMark()
Get a mark that will allow you to restore the current state of this environment.

isEmpty

public boolean isEmpty()
Returns true if this map contains no key-value mappings.

put

public V put(K key, V value)
Associates the specified value with the specified key in this map.

remove

public V remove(Object key)
Removes the mapping for this key from this map if present.

size

public int size()
Returns the numer of key-value mappings in this map.

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.
Copyright © 2003 C. Scott Ananian