gnu.mapping
Class ThreadLocation

java.lang.Object
  extended by gnu.mapping.Location
      extended by gnu.mapping.ThreadLocation
All Implemented Interfaces:
Named

public class ThreadLocation
extends Location
implements Named

A Location that forwards to a thread-specific Location.


Field Summary
static java.lang.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(java.lang.String name)
          A new anonymous fluid location but used a given name for printing.
ThreadLocation(Symbol name, java.lang.Object property, Location global)
           
 
Method Summary
 java.lang.Object get(java.lang.Object defaultValue)
           
static ThreadLocation getInstance(Symbol name, java.lang.Object property)
          For a given (Symbol.
 java.lang.Object getKeyProperty()
           
 Symbol getKeySymbol()
           
 Location getLocation()
          Get the thread-specific Location for this Location.
 java.lang.String getName()
           
 java.lang.Object getSymbol()
           
static ThreadLocation makePrivate(java.lang.String name)
          Create a fresh ThreadLocation, independent of other ThreaDLocations.
static ThreadLocation makePrivate(Symbol name)
           
 void set(java.lang.Object value)
           
 void setGlobal(java.lang.Object value)
          Set the default/global value.
 void setName(java.lang.String name)
           
 void setRestore(java.lang.Object oldValue, CallContext ctx)
          Restore an old value.
 java.lang.Object setWithSave(java.lang.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, getBase, getValue, isBound, isConstant, make, make, make, print, setValue, toString, undefine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ANONYMOUS

public static final java.lang.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 Detail

ThreadLocation

public ThreadLocation()
A new anonymous fluid location.


ThreadLocation

public ThreadLocation(java.lang.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,
                      java.lang.Object property,
                      Location global)
Method Detail

makePrivate

public static ThreadLocation makePrivate(java.lang.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)

setGlobal

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


getLocation

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


get

public java.lang.Object get(java.lang.Object defaultValue)
Specified by:
get in class Location

set

public void set(java.lang.Object value)
Specified by:
set in class Location

setWithSave

public java.lang.Object setWithSave(java.lang.Object newValue,
                                    CallContext ctx)
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 class Location

setRestore

public void setRestore(java.lang.Object oldValue,
                       CallContext ctx)
Description copied from class: Location
Restore an old value.

Overrides:
setRestore in class Location
Parameters:
oldValue - the return value from a prior setWithSave.

getKeySymbol

public Symbol getKeySymbol()
Overrides:
getKeySymbol in class Location

getKeyProperty

public java.lang.Object getKeyProperty()
Overrides:
getKeyProperty in class Location

getName

public java.lang.String getName()
Specified by:
getName in interface Named

getSymbol

public java.lang.Object getSymbol()
Specified by:
getSymbol in interface Named

setName

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

getInstance

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