|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ScopedMap<K,V>
public class ScopedMap<K,V>
A ScopedMap is similar to a Map, but with nested scopes.
Constructor Summary | |
---|---|
ScopedMap()
makes a ScopedMap that maps no keys to values and is set to the global scope (nesting level 0) |
Method Summary | |
---|---|
void |
enterScope()
sets the ScopedMap to a new scope nested inside the previous one; the nesting level increases by one |
void |
exitScope()
exits from the current scope back to the containing one; the nesting level, which must have been positive, decreases by one |
V |
get(K key)
gets the value corresponding to the key, at the innermost scope for which there is one; if there is none, returns null |
int |
getNestingLevel()
returns the current nesting level |
boolean |
isLocal(K key)
returns true if the key has a value at the current scope (ignoring surrounding ones) |
void |
put(K key,
V value)
puts the key/value pair in at the current scope; if the key is already in at the current nesting level, the new value replaces the old one; neither the key nor the value may be null |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScopedMap()
Method Detail |
---|
public void enterScope()
public void exitScope()
public void put(K key, V value)
public V get(K key)
public boolean isLocal(K key)
public int getNestingLevel()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |