gnu.mapping
Class ThreadLocation

java.lang.Object
  extended by gnu.mapping.Location
      extended by gnu.mapping.IndirectableLocation
          extended by gnu.mapping.NamedLocation
              extended by gnu.mapping.ThreadLocation
All Implemented Interfaces:
EnvironmentKey, Named, java.util.Map.Entry

public class ThreadLocation
extends NamedLocation
implements Named

A Location that forwards to a thread-specific Location.


Nested Class Summary
 class ThreadLocation.InheritingLocation
           
 
Field Summary
static java.lang.String ANONYMOUS
          Magic property value used for the "anonymous" ThreadLocations.
 
Fields inherited from class gnu.mapping.IndirectableLocation
base, DIRECT_ON_SET, INDIRECT_FLUIDS, value
 
Fields inherited from class gnu.mapping.Location
UNBOUND
 
Fields inherited from interface gnu.mapping.EnvironmentKey
FUNCTION
 
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, SharedLocation global)
           
 
Method Summary
 java.lang.Object get(java.lang.Object defaultValue)
           
static ThreadLocation getInstance(Symbol name, java.lang.Object property)
          For a given (Symbol.
 NamedLocation getLocation()
          Get the thread-specific Location for this Location.
 java.lang.String getName()
           
 java.lang.Object getSymbol()
           
static ThreadLocation makeAnonymous(java.lang.String name)
          Create a fresh ThreadLocation, independent of other ThreadLocations.
static ThreadLocation makeAnonymous(Symbol name)
          Create a fresh ThreadLocation, independent of other ThreadLocations.
 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)
          Restore an old value.
 java.lang.Object setWithSave(java.lang.Object newValue)
          Set a value, but return cookie so old value can be restored.
 
Methods inherited from class gnu.mapping.NamedLocation
entered, equals, getEnvironment, getKey, getKeyProperty, getKeySymbol, hashCode, matches, matches
 
Methods inherited from class gnu.mapping.IndirectableLocation
getBase, getBaseForce, isConstant, setAlias, setBase, undefine
 
Methods inherited from class gnu.mapping.Location
get, getValue, isBound, make, make, make, print, setValue, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map.Entry
getValue, setValue
 

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,
                      SharedLocation global)
Method Detail

makeAnonymous

public static ThreadLocation makeAnonymous(java.lang.String name)
Create a fresh ThreadLocation, independent of other ThreadLocations.

Parameters:
name - used for printing, but not identification.

makeAnonymous

public static ThreadLocation makeAnonymous(Symbol name)
Create a fresh ThreadLocation, independent of other ThreadLocations.

Parameters:
name - used for printing, but not identification.

setGlobal

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


getLocation

public NamedLocation 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)
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 NamedLocation

setRestore

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

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

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.