gnu.mapping

Class ThreadLocation

Implemented Interfaces:
Named

public class ThreadLocation
extends Location
implements Named

A Location that forwards to a thread-specific Location.

Field Summary

static String
ANONYMOUS
Magic property value used for the "anonymous" ThreadLocations.

Fields inherited from class gnu.mapping.Location

UNBOUND

Constructor Summary

ThreadLocation()
A new anonymous fluid location.
ThreadLocation(String name)
A new anonymous fluid location but used a given name for printing.
ThreadLocation(Symbol name, Object property, Location global)

Method Summary

Object
get(Object defaultValue)
static ThreadLocation
getInstance(Symbol name, Object property)
For a given (Symbol.
Object
getKeyProperty()
Symbol
getKeySymbol()
Location
getLocation()
Get the thread-specific Location for this Location.
String
getName()
Object
getSymbol()
static ThreadLocation
makePrivate(String name)
Create a fresh ThreadLocation, independent of other ThreaDLocations.
static ThreadLocation
makePrivate(Symbol name)
void
set(Object value)
void
setGlobal(Object value)
Set the default/global value.
void
setName(String name)
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.Location

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

Field Details

ANONYMOUS

public static final String ANONYMOUS
Magic property value used for the "anonymous" ThreadLocations. These are thread-specific dynamic "parameters" (in the SRFI-39 sense) that are not tied to a specfic name.

Constructor Details

ThreadLocation

public ThreadLocation()
A new anonymous fluid location.

ThreadLocation

public ThreadLocation(String name)
A new anonymous fluid location but used a given name for printing. However, the binding is not bound to the name as a visible binding.

ThreadLocation

public ThreadLocation(Symbol name,
                      Object property,
                      Location global)

Method Details

get

public Object get(Object defaultValue)
Overrides:
get in interface Location

getInstance

public static ThreadLocation getInstance(Symbol name,
                                         Object property)
For a given (Symbol. property)-pair, find or create a matching ThreadLocation.

getKeyProperty

public Object getKeyProperty()
Overrides:
getKeyProperty in interface Location

getKeySymbol

public Symbol getKeySymbol()
Overrides:
getKeySymbol in interface Location

getLocation

public Location getLocation()
Get the thread-specific Location for this Location.

getName

public String getName()
Specified by:
getName in interface Named

getSymbol

public Object getSymbol()
Specified by:
getSymbol in interface Named

makePrivate

public static ThreadLocation makePrivate(String name)
Create a fresh ThreadLocation, independent of other ThreaDLocations. Creates new unique EnvironmentKey, using a unique property key.
Parameters:
name - used for printing, but not identification.

makePrivate

public static ThreadLocation makePrivate(Symbol name)

set

public void set(Object value)
Overrides:
set in interface Location

setGlobal

public void setGlobal(Object value)
Set the default/global value.

setName

public void setName(String name)
Specified by:
setName in interface Named

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