edu.ksu.cis.projects.bogor.module.state
Class DefaultThreadStore

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.module.state.DefaultThreadStore
All Implemented Interfaces:
Disposable, Serializable

public class DefaultThreadStore
extends Object
implements Disposable, Serializable

A class that is used as a thread store.

Version:
CVS $Revision: 1.8 $ $Date: 2004/12/18 22:36:34 $
Author:
Robby
See Also:
Serialized Form

Field Summary
protected  IValueArray localValues
          Holds the local values of this thread store.
protected  ArrayList<IValueArray> valueStack
          Holds the stack of local values of this thread store ArrayList<IValueArray>.
 
Constructor Summary
protected DefaultThreadStore()
          Private constructor for cloning purposes.
protected DefaultThreadStore(IValueArray localValues)
          Default constructor.
 
Method Summary
 DefaultThreadStore clone(Map<Object,Object> cloneMap)
          Deep clone this thread store.
 void dispose()
          Remove references.
 void enterFunction(IValueArray localValues)
          Enters a function.
 IValueArray exitFunction()
          Exits a function for particular thread.
 int getLocalCount()
          Gets the number of locals.
 IValue getLocalValue(int localIndex)
          Gets a local's value.
 IValueArray getLocalValues()
          Gets the local values of this thread store.
 IValueArray[] getLocalValuesStack()
          Gets local values stack.
 int getStackHeight()
          Gets local values stack height.
 void setLocalValue(int localIndex, IValue value)
          Gets a local's value.
 void validate(IBogorConfiguration bc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

valueStack

protected ArrayList<IValueArray> valueStack
Holds the stack of local values of this thread store ArrayList<IValueArray>. Non-null.


localValues

protected IValueArray localValues
Holds the local values of this thread store. Non-null.

Constructor Detail

DefaultThreadStore

protected DefaultThreadStore(IValueArray localValues)
Default constructor.


DefaultThreadStore

protected DefaultThreadStore()
Private constructor for cloning purposes.

Method Detail

getLocalCount

public int getLocalCount()
Gets the number of locals.

Returns:
The number of locals.

setLocalValue

public void setLocalValue(int localIndex,
                          IValue value)
Gets a local's value.

Parameters:
localIndex - The index of the local. Must be at least zero and at most less than the number of locals.
value - The local's value.
See Also:
FSMSymbolTable.getLocalIndexTable()

getLocalValue

public IValue getLocalValue(int localIndex)
Gets a local's value.

Parameters:
localIndex - The index of the local. Must be at least zero and at most less than the number of locals.
Returns:
The local's value. Non-null.
See Also:
FSMSymbolTable.getLocalIndexTable()

getLocalValues

public IValueArray getLocalValues()
Gets the local values of this thread store.

Returns:
The local values of this thread store. Non-null. Each element is non-null.

getLocalValuesStack

public IValueArray[] getLocalValuesStack()
Gets local values stack.

Returns:
The local values stack. Non-null. Each element is non-null. Top most (current) local values is at index zero.

getStackHeight

public int getStackHeight()
Gets local values stack height.

Returns:
The local values stack height. At least one.

clone

public DefaultThreadStore clone(Map<Object,Object> cloneMap)
Deep clone this thread store.

Parameters:
cloneMap - Original values (IValue) to their clones ( IValue) mapping. The clone map to solve circular references in values.
Returns:
The clone of this thread store. Non-null.

dispose

public void dispose()
Description copied from interface: Disposable
Remove references. Once called, avoid using this object.

Specified by:
dispose in interface Disposable

enterFunction

public void enterFunction(IValueArray localValues)
Enters a function. The current thread local values are pushed to a stack. Sets the local values to the new ones.

Parameters:
localValues - The local values of the function to be entered. Must be non-null. Each element must be non-null.

exitFunction

public IValueArray exitFunction()
Exits a function for particular thread. The stack must not be empty. Sets the local values from top of the stack.

Returns:
The local values of the exited function. Non-null. Each element is non-null.

validate

public void validate(IBogorConfiguration bc)