public abstract class Environment extends PropertySet
EnvironmentKey
to Location
s.
An EnvironmentKey
is either a Symbol
or
a (Symbol
, property)-pair.Modifier and Type | Field and Description |
---|---|
protected static gnu.mapping.Environment.InheritedLocal |
curEnvironment |
static int |
INDIRECT_DEFINES
Newly defined locations are created in inherited parent environment.
|
nameKey
Constructor and Description |
---|
Environment() |
Modifier and Type | Method and Description |
---|---|
void |
addLocation(EnvironmentKey key,
Location loc) |
void |
addLocation(NamedLocation loc) |
abstract NamedLocation |
addLocation(Symbol name,
java.lang.Object prop,
Location loc) |
boolean |
containsKey(java.lang.Object key) |
static Environment |
current()
Deprecated.
|
Namespace |
defaultNamespace() |
abstract void |
define(Symbol key,
java.lang.Object property,
java.lang.Object newValue) |
abstract LocationEnumeration |
enumerateAllLocations()
Does enumerate inherited Locations.
|
abstract LocationEnumeration |
enumerateLocations()
Does not enumerate inherited Locations.
|
java.lang.Object |
get(EnvironmentKey key,
java.lang.Object defaultValue) |
java.lang.Object |
get(java.lang.Object key)
Get the value bound to the given name.
|
java.lang.Object |
get(java.lang.String key,
java.lang.Object defaultValue) |
java.lang.Object |
get(Symbol sym) |
java.lang.Object |
get(Symbol key,
java.lang.Object property,
java.lang.Object defaultValue) |
boolean |
getCanDefine()
True if new bindings (non-unbound Locations) can be added.
|
boolean |
getCanRedefine()
True if bindings can be removed or replaced by other kinds of Location.
|
java.lang.Object |
getChecked(java.lang.String name)
Get the value bound to the given name.
|
static Environment |
getCurrent() |
int |
getFlags() |
java.lang.Object |
getFunction(Symbol sym) |
java.lang.Object |
getFunction(Symbol key,
java.lang.Object defaultValue) |
static Environment |
getGlobal() |
static Environment |
getInstance(java.lang.String name) |
Location |
getLocation(java.lang.Object key,
boolean create) |
Location |
getLocation(Symbol key)
Return a location bound to key (and null property).
|
Location |
getLocation(Symbol key,
java.lang.Object property)
Return a location bound to (key, property).
|
NamedLocation |
getLocation(Symbol name,
java.lang.Object property,
boolean create) |
abstract NamedLocation |
getLocation(Symbol key,
java.lang.Object property,
int hash,
boolean create) |
Symbol |
getSymbol(java.lang.String name) |
protected abstract boolean |
hasMoreElements(LocationEnumeration it) |
boolean |
isBound(Symbol key) |
boolean |
isBound(Symbol key,
java.lang.Object property) |
boolean |
isLocked()
True if this environment is locked - bindings cannot be added or removed.
|
Location |
lookup(Symbol key) |
Location |
lookup(Symbol key,
java.lang.Object property)
Return a location bound to (key, property).
|
abstract NamedLocation |
lookup(Symbol name,
java.lang.Object property,
int hash) |
static SimpleEnvironment |
make() |
static SimpleEnvironment |
make(java.lang.String name) |
static InheritingEnvironment |
make(java.lang.String name,
Environment parent) |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object newValue) |
java.lang.Object |
put(java.lang.String key,
java.lang.Object value) |
void |
put(Symbol key,
java.lang.Object newValue) |
void |
put(Symbol key,
java.lang.Object property,
java.lang.Object newValue) |
void |
putFunction(Symbol key,
java.lang.Object newValue) |
java.lang.Object |
remove(EnvironmentKey key)
Remove and undefine binding.
|
java.lang.Object |
remove(java.lang.Object key) |
void |
remove(Symbol sym) |
java.lang.Object |
remove(Symbol symbol,
java.lang.Object property) |
java.lang.Object |
remove(Symbol key,
java.lang.Object property,
int hash)
Remove Location from this Environment and undefine it.
|
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) |
void |
setIndirectDefines() |
void |
setLocked() |
static Environment |
setSaveCurrent(Environment env) |
java.lang.String |
toString() |
java.lang.String |
toStringVerbose()
Overridden in sub-classes - useful for more verbose debug output.
|
Location |
unlink(Symbol key,
java.lang.Object property,
int hash)
Remove Location from this Environment.
|
static Environment |
user() |
getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol
public static final int INDIRECT_DEFINES
protected static final gnu.mapping.Environment.InheritedLocal curEnvironment
public static void setGlobal(Environment env)
public static Environment getGlobal()
public int getFlags()
public void setFlag(boolean setting, int flag)
public boolean getCanDefine()
public void setCanDefine(boolean canDefine)
public boolean getCanRedefine()
public void setCanRedefine(boolean canRedefine)
public final boolean isLocked()
public void setLocked()
public final void setIndirectDefines()
public final Location getLocation(Symbol key, java.lang.Object property)
public final Location getLocation(Symbol key)
public final Location lookup(Symbol key, java.lang.Object property)
public abstract NamedLocation lookup(Symbol name, java.lang.Object property, int hash)
public abstract NamedLocation getLocation(Symbol key, java.lang.Object property, int hash, boolean create)
public final NamedLocation getLocation(Symbol name, java.lang.Object property, boolean create)
public final Location getLocation(java.lang.Object key, boolean create)
public boolean isBound(Symbol key, java.lang.Object property)
public final boolean isBound(Symbol key)
public final boolean containsKey(java.lang.Object key)
public final java.lang.Object getChecked(java.lang.String name)
UnboundLocationException
- the name has no bindingget(Object)
public java.lang.Object get(Symbol key, java.lang.Object property, java.lang.Object defaultValue)
public final java.lang.Object get(EnvironmentKey key, java.lang.Object defaultValue)
public final java.lang.Object get(java.lang.String key, java.lang.Object defaultValue)
public java.lang.Object get(Symbol sym)
public final java.lang.Object getFunction(Symbol key, java.lang.Object defaultValue)
public final java.lang.Object getFunction(Symbol sym)
public final java.lang.Object get(java.lang.Object key)
getChecked(String)
public void put(Symbol key, java.lang.Object property, java.lang.Object newValue)
public abstract void define(Symbol key, java.lang.Object property, java.lang.Object newValue)
public final void put(Symbol key, java.lang.Object newValue)
public final java.lang.Object put(java.lang.Object key, java.lang.Object newValue)
public final void putFunction(Symbol key, java.lang.Object newValue)
public final java.lang.Object put(java.lang.String key, java.lang.Object value)
public Location unlink(Symbol key, java.lang.Object property, int hash)
public java.lang.Object remove(Symbol key, java.lang.Object property, int hash)
public final java.lang.Object remove(EnvironmentKey key)
public final java.lang.Object remove(Symbol symbol, java.lang.Object property)
public final void remove(Symbol sym)
public final void removeFunction(Symbol sym)
public final java.lang.Object remove(java.lang.Object key)
public Namespace defaultNamespace()
public Symbol getSymbol(java.lang.String name)
public static Environment getInstance(java.lang.String name)
public abstract LocationEnumeration enumerateLocations()
public abstract LocationEnumeration enumerateAllLocations()
protected abstract boolean hasMoreElements(LocationEnumeration it)
@Deprecated public static Environment current()
public static Environment getCurrent()
public static void setCurrent(Environment env)
public static Environment setSaveCurrent(Environment env)
public static void restoreCurrent(Environment saved)
public static Environment user()
public final void addLocation(NamedLocation loc)
public abstract NamedLocation addLocation(Symbol name, java.lang.Object prop, Location loc)
public final void addLocation(EnvironmentKey key, Location loc)
public static SimpleEnvironment make()
public static SimpleEnvironment make(java.lang.String name)
public static InheritingEnvironment make(java.lang.String name, Environment parent)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringVerbose()