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 Location
s.
An EnvironmentKey
is either a Symbol
or
a (Symbol
, property)-pair.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final gnu.mapping.Environment.InheritedLocal
static final int
Newly defined locations are created in inherited parent environment.Fields inherited from class gnu.mapping.PropertySet
nameKey
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addLocation
(EnvironmentKey key, Location loc) final void
addLocation
(NamedLocation loc) abstract NamedLocation
addLocation
(Symbol name, Object prop, Location loc) final boolean
containsKey
(Object key) static Environment
current()
Deprecated.abstract void
abstract LocationEnumeration
Does enumerate inherited Locations.abstract LocationEnumeration
Does not enumerate inherited Locations.final Object
get
(EnvironmentKey key, Object defaultValue) final Object
Get the value bound to the given name.final Object
boolean
True if new bindings (non-unbound Locations) can be added.boolean
True if bindings can be removed or replaced by other kinds of Location.final Object
getChecked
(String name) Get the value bound to the given name.static Environment
int
getFlags()
final Object
getFunction
(Symbol sym) final Object
getFunction
(Symbol key, Object defaultValue) static Environment
static Environment
getInstance
(String name) final Location
getLocation
(Symbol key) Return a location bound to key (and null property).final Location
getLocation
(Symbol key, Object property) Return a location bound to (key, property).final NamedLocation
getLocation
(Symbol name, Object property, boolean create) abstract NamedLocation
getLocation
(Symbol key, Object property, int hash, boolean create) final Location
getLocation
(Object key, boolean create) protected abstract boolean
final boolean
boolean
final boolean
isLocked()
True if this environment is locked - bindings cannot be added or removed.final Location
final Location
Return a location bound to (key, property).abstract NamedLocation
static SimpleEnvironment
make()
static SimpleEnvironment
static InheritingEnvironment
make
(String name, Environment parent) final void
void
final Object
final Object
final void
putFunction
(Symbol key, Object newValue) final Object
remove
(EnvironmentKey key) Remove and undefine binding.final void
final Object
Remove Location from this Environment and undefine it.final Object
final void
removeFunction
(Symbol sym) static void
restoreCurrent
(Environment saved) void
setCanDefine
(boolean canDefine) void
setCanRedefine
(boolean canRedefine) static void
setCurrent
(Environment env) void
setFlag
(boolean setting, int flag) static void
setGlobal
(Environment env) final void
void
static Environment
toString()
Overridden in sub-classes - useful for more verbose debug output.Remove Location from this Environment.static Environment
user()
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.
-