gnu.expr
Class NameLookup

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by gnu.kawa.util.AbstractHashTable<HashNode<K,V>,K,V>
          extended by gnu.kawa.util.GeneralHashTable<java.lang.Object,Declaration>
              extended by gnu.expr.NameLookup
All Implemented Interfaces:
java.util.Map<java.lang.Object,Declaration>

public class NameLookup
extends GeneralHashTable<java.lang.Object,Declaration>

Manages the set of declarations "currently" in scope.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class gnu.kawa.util.AbstractHashTable
DEFAULT_INITIAL_SIZE, mask, num_bindings, table
 
Constructor Summary
NameLookup(Language language)
           
 
Method Summary
static NameLookup getInstance(Environment env, Language language)
          Get or create a NameLookup instance for a given Environment.
 Language getLanguage()
           
 Declaration lookup(java.lang.Object symbol, boolean function)
           
 Declaration lookup(java.lang.Object symbol, int namespace)
           
 boolean pop(Declaration decl)
           
 void pop(ScopeExp exp)
           
 void push(Declaration decl)
           
 void push(ScopeExp exp)
           
 void removeSubsumed(Declaration decl)
          Remove visible declarations subsumed (hidden) by a given declaration.
static void setInstance(Environment env, NameLookup instance)
           
 void setLanguage(Language language)
           
protected  boolean subsumedBy(Declaration decl, Declaration other)
          True if decl subsumes (hides) other.
 
Methods inherited from class gnu.kawa.util.GeneralHashTable
allocEntries, getEntryHashCode, getEntryNext, getNode, makeEntry, setEntryNext
 
Methods inherited from class gnu.kawa.util.AbstractHashTable
clear, entrySet, get, get, hash, hashToIndex, matches, matches, put, put, rehash, remove, size
 
Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NameLookup

public NameLookup(Language language)
Method Detail

getLanguage

public Language getLanguage()

setLanguage

public void setLanguage(Language language)

getInstance

public static NameLookup getInstance(Environment env,
                                     Language language)
Get or create a NameLookup instance for a given Environment. We want the same NameLookup instance to be used for multiple interactive commands in the same "session", to preserve top-level declarations. We do that by registering it in the Environment.


setInstance

public static void setInstance(Environment env,
                               NameLookup instance)

push

public void push(Declaration decl)

pop

public boolean pop(Declaration decl)

push

public void push(ScopeExp exp)

pop

public void pop(ScopeExp exp)

removeSubsumed

public void removeSubsumed(Declaration decl)
Remove visible declarations subsumed (hidden) by a given declaration. This is primarily used to avoid memory leaks.


subsumedBy

protected boolean subsumedBy(Declaration decl,
                             Declaration other)
True if decl subsumes (hides) other.


lookup

public Declaration lookup(java.lang.Object symbol,
                          int namespace)

lookup

public Declaration lookup(java.lang.Object symbol,
                          boolean function)