Package gnu.mapping
Class NamedLocation<T>
- java.lang.Object
-
- gnu.mapping.Location<T>
-
- gnu.mapping.IndirectableLocation<T>
-
- gnu.mapping.NamedLocation<T>
-
- All Implemented Interfaces:
EnvironmentKey
,Map.Entry<EnvironmentKey,T>
- Direct Known Subclasses:
AbstractScriptEngineFactory.BindingsLocation
,DynamicLocation
,PlainLocation
,SharedLocation
,ThreadLocation
public abstract class NamedLocation<T> extends IndirectableLocation<T> implements Map.Entry<EnvironmentKey,T>, EnvironmentKey
A Location that can be used as an entry in an Environment.
-
-
Field Summary
-
Fields inherited from class gnu.mapping.IndirectableLocation
base, DIRECT_ON_SET, INDIRECT_FLUIDS, value
-
Fields inherited from interface gnu.mapping.EnvironmentKey
FUNCTION
-
-
Constructor Summary
Constructors Constructor Description NamedLocation(NamedLocation loc)
NamedLocation(Symbol name, Object property)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
entered()
True if directly entered in an Environment.boolean
equals(Object x)
Environment
getEnvironment()
EnvironmentKey
getKey()
Object
getKeyProperty()
Symbol
getKeySymbol()
int
hashCode()
boolean
matches(EnvironmentKey key)
boolean
matches(Symbol symbol, Object property)
void
setRestore(Object oldValue)
Restore an old value.Object
setWithSave(T newValue)
Set a value, but return cookie so old value can be restored.-
Methods inherited from class gnu.mapping.IndirectableLocation
getBase, getBaseForce, isConstant, setAlias, setBase, undefine
-
Methods inherited from class gnu.mapping.Location
define, get, get, getValue, isBound, make, make, make, print, set, setValue, toString
-
-
-
-
Constructor Detail
-
NamedLocation
public NamedLocation(NamedLocation loc)
-
-
Method Detail
-
entered
public boolean entered()
Description copied from class:Location
True if directly entered in an Environment. (Only if NamedLocation.)
-
getEnvironment
public Environment getEnvironment()
- Overrides:
getEnvironment
in classIndirectableLocation<T>
-
getKeySymbol
public final Symbol getKeySymbol()
- Specified by:
getKeySymbol
in interfaceEnvironmentKey
- Overrides:
getKeySymbol
in classIndirectableLocation<T>
-
getKeyProperty
public final Object getKeyProperty()
- Specified by:
getKeyProperty
in interfaceEnvironmentKey
- Overrides:
getKeyProperty
in classIndirectableLocation<T>
-
matches
public final boolean matches(EnvironmentKey key)
- Specified by:
matches
in interfaceEnvironmentKey
-
matches
public final boolean matches(Symbol symbol, Object property)
- Specified by:
matches
in interfaceEnvironmentKey
-
getKey
public final EnvironmentKey getKey()
- Specified by:
getKey
in interfaceMap.Entry<EnvironmentKey,T>
-
equals
public boolean equals(Object x)
-
hashCode
public int hashCode()
-
setWithSave
public Object setWithSave(T newValue)
Description copied from class:Location
Set a value, but return cookie so old value can be restored. This is intended for fluid-let where (in the case of multiple threads) a simple save-restore isn't always the right thing.- Overrides:
setWithSave
in classLocation<T>
-
setRestore
public void setRestore(Object oldValue)
Description copied from class:Location
Restore an old value.- Overrides:
setRestore
in classLocation<T>
- Parameters:
oldValue
- the return value from a prior setWithSave.
-
-