se.datadosen.util
Class Scope

java.lang.Object
  extended by se.datadosen.util.Scope
All Implemented Interfaces:
java.io.Serializable, java.util.Map

public class Scope
extends java.lang.Object
implements java.util.Map, java.io.Serializable

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
protected  java.util.Map map
           
protected  Scope outer
           
 
Constructor Summary
Scope()
           
Scope(java.util.Map map)
           
Scope(java.util.Map map, Scope outer)
           
Scope(Scope outer)
           
 
Method Summary
 void clear()
          clear
 boolean containsKey(java.lang.Object key)
          containsKey
 boolean containsValue(java.lang.Object value)
          containsValue
 java.util.Set entrySet()
          entrySet
 boolean equals(java.lang.Object o)
          equals
 java.util.Map flatten()
           
protected  java.util.Map flatten2()
           
 java.lang.Object get(java.lang.Object key)
           
 java.util.Map getMap()
           
 Scope getOuter()
           
 int hashCode()
          Returns the hash code value for this map.
 boolean isEmpty()
          isEmpty
 java.util.Set keySet()
          keySet
 Scope push(java.util.Map map)
          Make a new scope where the passed Map is put before (inner) the existing scope This scope is left untouched.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map more)
           
 Scope remove(java.util.Map map)
          Remove map from this scope or any outer scope Return this scope or outer scope if map == this scope
 java.lang.Object remove(java.lang.Object key)
           
 void setOuter(Scope outer)
           
 int size()
          DOCUMENT ME!
 java.lang.String toString()
           
 java.util.Collection values()
          values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

outer

protected Scope outer

map

protected java.util.Map map
Constructor Detail

Scope

public Scope()

Scope

public Scope(Scope outer)

Scope

public Scope(java.util.Map map)

Scope

public Scope(java.util.Map map,
             Scope outer)
Method Detail

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface java.util.Map

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map

putAll

public void putAll(java.util.Map more)
Specified by:
putAll in interface java.util.Map

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map

getOuter

public Scope getOuter()

setOuter

public void setOuter(Scope outer)

getMap

public java.util.Map getMap()

flatten2

protected java.util.Map flatten2()

flatten

public java.util.Map flatten()

push

public Scope push(java.util.Map map)
Make a new scope where the passed Map is put before (inner) the existing scope This scope is left untouched.

Parameters:
map - Map to be added to the inner scope. If null, the existing scope will be used.
Returns:

remove

public Scope remove(java.util.Map map)
Remove map from this scope or any outer scope Return this scope or outer scope if map == this scope

Parameters:
map -
Returns:

size

public int size()
DOCUMENT ME!

Specified by:
size in interface java.util.Map
Returns:
size of this scope + any outer scope(s)

isEmpty

public boolean isEmpty()
isEmpty

Specified by:
isEmpty in interface java.util.Map
Returns:
boolean

containsKey

public boolean containsKey(java.lang.Object key)
containsKey

Specified by:
containsKey in interface java.util.Map
Parameters:
key - Object
Returns:
boolean

containsValue

public boolean containsValue(java.lang.Object value)
containsValue

Specified by:
containsValue in interface java.util.Map
Parameters:
value - Object
Returns:
boolean

clear

public void clear()
clear

Specified by:
clear in interface java.util.Map

keySet

public java.util.Set keySet()
keySet

Specified by:
keySet in interface java.util.Map
Returns:
Set

values

public java.util.Collection values()
values

Specified by:
values in interface java.util.Map
Returns:
Collection

entrySet

public java.util.Set entrySet()
entrySet

Specified by:
entrySet in interface java.util.Map
Returns:
Set

equals

public boolean equals(java.lang.Object o)
equals

Specified by:
equals in interface java.util.Map
Overrides:
equals in class java.lang.Object
Parameters:
o - Object
Returns:
boolean

hashCode

public int hashCode()
Returns the hash code value for this map. The hash code of a map is defined to be the sum of the hash codes of each entry in the map's entrySet() view. This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode() for any two maps t1 and t2, as required by the general contract of Object.hashCode.

This implementation iterates over entrySet(), calling hashCode on each element (entry) in the Collection, and adding up the results.

Specified by:
hashCode in interface java.util.Map
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code value for this map.
See Also:
Map.Entry#hashCode(), Object.hashCode(), Object.equals(Object), Set.equals(Object)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object