Package gnu.mapping
Class Environment
java.lang.Object
gnu.mapping.PropertySet
gnu.mapping.Environment
- All Implemented Interfaces:
Named
- Direct Known Subclasses:
BuiltinEnvironment,SimpleEnvironment
A mapping from
EnvironmentKey to Locations.
An EnvironmentKey is either a Symbol or
a (Symbol, property)-pair.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final gnu.mapping.Environment.InheritedLocalstatic final intNewly defined locations are created in inherited parent environment.Fields inherited from class gnu.mapping.PropertySet
nameKey -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddLocation(EnvironmentKey key, Location loc) final voidaddLocation(NamedLocation loc) abstract NamedLocationaddLocation(Symbol name, Object prop, Location loc) final booleancontainsKey(Object key) static Environmentcurrent()Deprecated.abstract voidabstract LocationEnumerationDoes enumerate inherited Locations.abstract LocationEnumerationDoes not enumerate inherited Locations.final Objectget(EnvironmentKey key, Object defaultValue) final ObjectGet the value bound to the given name.final ObjectbooleanTrue if new bindings (non-unbound Locations) can be added.booleanTrue if bindings can be removed or replaced by other kinds of Location.final ObjectgetChecked(String name) Get the value bound to the given name.static EnvironmentintgetFlags()final ObjectgetFunction(Symbol sym) final ObjectgetFunction(Symbol key, Object defaultValue) static Environmentstatic EnvironmentgetInstance(String name) final LocationgetLocation(Symbol key) Return a location bound to key (and null property).final LocationgetLocation(Symbol key, Object property) Return a location bound to (key, property).final NamedLocationgetLocation(Symbol name, Object property, boolean create) abstract NamedLocationgetLocation(Symbol key, Object property, int hash, boolean create) final LocationgetLocation(Object key, boolean create) protected abstract booleanfinal booleanbooleanfinal booleanisLocked()True if this environment is locked - bindings cannot be added or removed.final Locationfinal LocationReturn a location bound to (key, property).abstract NamedLocationstatic SimpleEnvironmentmake()static SimpleEnvironmentstatic InheritingEnvironmentmake(String name, Environment parent) final voidvoidfinal Objectfinal Objectfinal voidputFunction(Symbol key, Object newValue) final Objectremove(EnvironmentKey key) Remove and undefine binding.final voidfinal ObjectRemove Location from this Environment and undefine it.final Objectfinal voidremoveFunction(Symbol sym) static voidrestoreCurrent(Environment saved) voidsetCanDefine(boolean canDefine) voidsetCanRedefine(boolean canRedefine) static voidsetCurrent(Environment env) voidsetFlag(boolean setting, int flag) static voidsetGlobal(Environment env) final voidvoidstatic EnvironmenttoString()Overridden in sub-classes - useful for more verbose debug output.Remove Location from this Environment.static Environmentuser()Methods inherited from class gnu.mapping.PropertySet
getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol
-
Field Details
-
INDIRECT_DEFINES
public static final int INDIRECT_DEFINESNewly defined locations are created in inherited parent environment.- See Also:
-
curEnvironment
protected static final gnu.mapping.Environment.InheritedLocal curEnvironment
-
-
Constructor Details
-
Environment
public Environment()
-
-
Method Details
-
setGlobal
-
getGlobal
-
getFlags
public int getFlags() -
setFlag
public void setFlag(boolean setting, int flag) -
getCanDefine
public boolean getCanDefine()True if new bindings (non-unbound Locations) can be added. -
setCanDefine
public void setCanDefine(boolean canDefine) -
getCanRedefine
public boolean getCanRedefine()True if bindings can be removed or replaced by other kinds of Location. -
setCanRedefine
public void setCanRedefine(boolean canRedefine) -
isLocked
public final boolean isLocked()True if this environment is locked - bindings cannot be added or removed. -
setLocked
public void setLocked() -
setIndirectDefines
public final void setIndirectDefines() -
getLocation
Return a location bound to (key, property). Create new unbound Location if no such Location exists. -
getLocation
Return a location bound to key (and null property). Create new unbound Location if no such Location exists. -
lookup
Return a location bound to (key, property). Return null if no such Location exists. -
lookup
-
lookup
-
getLocation
-
getLocation
-
getLocation
-
isBound
-
isBound
-
containsKey
-
getChecked
Get the value bound to the given name.- Throws:
UnboundLocationException- the name has no binding- See Also:
-
get
-
get
-
get
-
get
-
getFunction
-
getFunction
-
get
Get the value bound to the given name. Returns null if the name has no binding (for compatibility with Java2 Collections framework).- See Also:
-
put
-
define
-
put
-
put
-
putFunction
-
put
-
unlink
Remove Location from this Environment. Does not explicitly undefine the location itself. -
remove
Remove Location from this Environment and undefine it. -
remove
Remove and undefine binding.- Returns:
- Old value
-
remove
-
remove
-
removeFunction
-
remove
-
defaultNamespace
-
getSymbol
-
getInstance
-
enumerateLocations
Does not enumerate inherited Locations. -
enumerateAllLocations
Does enumerate inherited Locations. -
hasMoreElements
-
current
Deprecated. -
getCurrent
-
setCurrent
-
setSaveCurrent
-
restoreCurrent
-
user
-
addLocation
-
addLocation
-
addLocation
-
make
-
make
-
make
-
toString
-
toStringVerbose
Overridden in sub-classes - useful for more verbose debug output.
-