gnu.mapping

Class NamedLocation

Implemented Interfaces:
java.util.Map.Entry, EnvironmentKey
Known Direct Subclasses:
PlainLocation, SharedLocation

public abstract class NamedLocation
extends IndirectableLocation
implements java.util.Map.Entry, EnvironmentKey

A Location that can be used as an entry in an Environment.

Field Summary

Fields inherited from class gnu.mapping.IndirectableLocation

DIRECT_ON_SET, INDIRECT_FLUIDS, base, value

Fields inherited from class gnu.mapping.Location

UNBOUND

Fields inherited from interface gnu.mapping.EnvironmentKey

FUNCTION

Constructor Summary

NamedLocation(NamedLocation loc)
NamedLocation(Symbol name, Object property)

Method Summary

boolean
entered()
True if directly entered in an Environment.
boolean
equals(Object x)
Environment
getEnvironment()
Object
getKey()
Object
getKeyProperty()
Symbol
getKeySymbol()
int
hashCode()
boolean
matches(EnvironmentKey key)
boolean
matches(Symbol symbol, Object property)
void
setRestore(Object oldValue, CallContext ctx)
Restore an old value.
Object
setWithSave(Object newValue, CallContext ctx)
Set a value, but return cookie so old value can be restored.

Methods inherited from class gnu.mapping.IndirectableLocation

getBase, getBaseForce, getEnvironment, getKeyProperty, getKeySymbol, isConstant, setAlias, setBase, undefine

Methods inherited from class gnu.mapping.Location

entered, get, get, getBase, getKeyProperty, getKeySymbol, getValue, isBound, isConstant, make, make, make, print, set, setRestore, setValue, setWithSave, toString, undefine

Constructor Details

NamedLocation

public NamedLocation(NamedLocation loc)

NamedLocation

public NamedLocation(Symbol name,
                     Object property)

Method Details

entered

public boolean entered()
True if directly entered in an Environment. (Only if NamedLocation.)
Overrides:
entered in interface Location

equals

public boolean equals(Object x)

getEnvironment

public Environment getEnvironment()
Overrides:
getEnvironment in interface IndirectableLocation

getKey

public final Object getKey()

getKeyProperty

public final Object getKeyProperty()
Specified by:
getKeyProperty in interface EnvironmentKey
Overrides:
getKeyProperty in interface IndirectableLocation

getKeySymbol

public final Symbol getKeySymbol()
Specified by:
getKeySymbol in interface EnvironmentKey
Overrides:
getKeySymbol in interface IndirectableLocation

hashCode

public int hashCode()

matches

public final boolean matches(EnvironmentKey key)
Specified by:
matches in interface EnvironmentKey

matches

public final boolean matches(Symbol symbol,
                             Object property)
Specified by:
matches in interface EnvironmentKey

setRestore

public void setRestore(Object oldValue,
                       CallContext ctx)
Restore an old value.
Overrides:
setRestore in interface Location
Parameters:
oldValue - the return value from a prior setWithSave.

setWithSave

public Object setWithSave(Object newValue,
                          CallContext ctx)
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 interface Location