gnu.mapping

Class SimpleEnvironment

Implemented Interfaces:
HasSetter, Named
Known Direct Subclasses:
InheritingEnvironment

public class SimpleEnvironment
extends Environment

Concrete implementation of Environment.

Field Summary

Fields inherited from class gnu.mapping.Environment

INDIRECT_DEFINES

Constructor Summary

SimpleEnvironment()
SimpleEnvironment(String name)
SimpleEnvironment(int capacity)

Method Summary

NamedLocation
addLocation(Symbol name, Object property, Location loc)
protected NamedLocation
addUnboundLocation(Symbol name, Object property, int hash)
void
define(Symbol sym, Object property, Object newValue)
NamedLocation
define(Symbol sym, Object property, int hash, Object newValue)
java.util.Set
entrySet()
LocationEnumeration
enumerateAllLocations()
Does enumerate inherited Locations.
LocationEnumeration
enumerateLocations()
Does not enumerate inherited Locations.
static Location
getCurrentLocation(String name)
NamedLocation
getLocation(Symbol name, Object property, int hash, boolean create)
protected boolean
hasMoreElements(LocationEnumeration it)
NamedLocation
lookup(Symbol name, Object property, int hash)
NamedLocation
lookupDirect(Symbol name, Object property, int hash)
static Object
lookup_global(Symbol name)
void
put(Symbol key, Object property, Object newValue)
void
readExternal(ObjectInput in)
Object
readResolve()
protected void
redefineError(Symbol name, Object property, Location loc)
Object
remove(EnvironmentKey key)
Remove and undefine binding.
int
size()
Size does not include inherited Locations.
protected void
toStringBase(StringBuffer sbuf)
String
toStringVerbose()
Overridden in sub-classes - useful for more verbose debug output.
Location
unlink(Symbol symbol, Object property, int hash)
Remove Location from this Environment.
void
writeExternal(ObjectOutput out)

Methods inherited from class gnu.mapping.Environment

addLocation, addLocation, addLocation, containsKey, current, defaultNamespace, define, enumerateAllLocations, enumerateLocations, get, get, get, get, get, getCanDefine, getCanRedefine, getCurrent, getFlags, getFunction, getFunction, getGlobal, getInstance, getLocation, getLocation, getLocation, getLocation, getLocation, getSymbol, hasMoreElements, isBound, isBound, isLocked, lookup, lookup, lookup, make, make, make, put, put, put, put, putFunction, remove, remove, remove, remove, remove, removeFunction, setCanDefine, setCanRedefine, setCurrent, setFlag, setGlobal, setIndirectDefines, setLocked, toString, toStringVerbose, unlink, user

Methods inherited from class gnu.mapping.NameMap

apply1, get, get, getChecked, put, set1

Methods inherited from class gnu.mapping.Procedure1

apply0, apply1, apply2, apply3, apply4, applyN, numArgs

Methods inherited from class gnu.mapping.Procedure

apply, apply, apply0, apply1, apply2, apply3, apply4, applyN, check0, check1, check2, check3, check4, checkArgCount, checkN, getName, getProperty, getSetter, getSymbol, match0, match1, match2, match3, match4, matchN, maxArgs, minArgs, name, numArgs, removeProperty, set0, set1, setN, setName, setProperty, setProperty, setSetter, setSymbol, toString

Constructor Details

SimpleEnvironment

public SimpleEnvironment()

SimpleEnvironment

public SimpleEnvironment(String name)

SimpleEnvironment

public SimpleEnvironment(int capacity)

Method Details

addLocation

public NamedLocation addLocation(Symbol name,
                                 Object property,
                                 Location loc)
Overrides:
addLocation in interface Environment

addUnboundLocation

protected NamedLocation addUnboundLocation(Symbol name,
                                           Object property,
                                           int hash)

define

public void define(Symbol sym,
                   Object property,
                   Object newValue)
Overrides:
define in interface Environment

define

public NamedLocation define(Symbol sym,
                            Object property,
                            int hash,
                            Object newValue)

entrySet

public java.util.Set entrySet()

enumerateAllLocations

public LocationEnumeration enumerateAllLocations()
Does enumerate inherited Locations.
Overrides:
enumerateAllLocations in interface Environment

enumerateLocations

public LocationEnumeration enumerateLocations()
Does not enumerate inherited Locations.
Overrides:
enumerateLocations in interface Environment

getCurrentLocation

public static Location getCurrentLocation(String name)

getLocation

public NamedLocation getLocation(Symbol name,
                                 Object property,
                                 int hash,
                                 boolean create)
Overrides:
getLocation in interface Environment

hasMoreElements

protected boolean hasMoreElements(LocationEnumeration it)
Overrides:
hasMoreElements in interface Environment

lookup

public NamedLocation lookup(Symbol name,
                            Object property,
                            int hash)
Overrides:
lookup in interface Environment

lookupDirect

public NamedLocation lookupDirect(Symbol name,
                                  Object property,
                                  int hash)

lookup_global

public static Object lookup_global(Symbol name)
            throws UnboundLocationException

put

public void put(Symbol key,
                Object property,
                Object newValue)
Overrides:
put in interface Environment

readExternal

public void readExternal(ObjectInput in)
            throws IOException,
                   ClassNotFoundException

readResolve

public Object readResolve()
            throws ObjectStreamException

redefineError

protected void redefineError(Symbol name,
                             Object property,
                             Location loc)

remove

public Object remove(EnvironmentKey key)
Remove and undefine binding. (A more type-specific version of gnu.util.mape.remove.)
Overrides:
remove in interface Environment
Returns:
Old value

size

public int size()
Size does not include inherited Locations.

toStringBase

protected void toStringBase(StringBuffer sbuf)

toStringVerbose

public String toStringVerbose()
Overridden in sub-classes - useful for more verbose debug output.
Overrides:
toStringVerbose in interface Environment

unlink

public Location unlink(Symbol symbol,
                       Object property,
                       int hash)
Remove Location from this Environment. Does not explicitly undefine the location itself.
Overrides:
unlink in interface Environment

writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException