|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.ksu.cis.projects.bogor.module.state.DefaultState
public class DefaultState
The default implementation of IState
.
Field Summary | |
---|---|
protected IValueArray |
globalValues
Holds the global values. |
protected IStateFactory |
sf
Holds the state factory of this state. |
protected SymbolTable |
st
Holds the symbol table for the BIR model. |
protected IntObjectTable<IntList> |
threadLocationStackMap
Holds the mapping of thread id (int) to its location stack (TIntArrayList). |
protected IntIntTable |
threadLockCountMap
Holds the mapping of thread id (int) to its lock count (int) when waiting. |
protected IntObjectTable<DefaultThreadStore> |
threadStoreMap
Holds the mapping of thread id (int) to thread store (DefaultThreadStore). |
protected IntObjectTable<IntList> |
threadTransformationIndexStackMap
Holds the mapping of thread id (int) to its transformation index stack (TIntArrayList). |
Constructor Summary | |
---|---|
protected |
DefaultState()
Private constructor for cloning purposes. |
protected |
DefaultState(SymbolTable st,
IStateFactory sf,
IValueArray globalValues)
Default constructor. |
Method Summary | |
---|---|
protected boolean |
checkCurrentInvokeTransformation(int threadId,
int transformationIndex)
|
IState |
clone(Map<Object,Object> cloneMap)
Deep clone this state. |
void |
dispose()
Remove references. |
void |
enterFunction(int threadId,
IValueArray localValues,
int beginLocationDesc,
int transformationIndex)
Enters a function for a particular thread. |
IValueArray |
exitFunction(int threadId)
Exits a function for particular thread. |
IValueArray |
exitThread(int threadId)
Kills a thread. |
int |
getGlobalCount()
Gets the number of globals. |
IValue |
getGlobalValue(int globalIndex)
Gets a global's value. |
IValueArray |
getGlobalValues()
Gets all global values. |
int |
getLocalCount(int threadId)
Gets the number of locals for a particular thread. |
IValue |
getLocalValue(int threadId,
int localIndex)
Gets a local's value. |
IValueArray |
getLocalValues(int threadId)
Gets local values for a particular thread. |
IValueArray[] |
getLocalValuesStack(int threadId)
Gets local values stack for a particular thread. |
int |
getLocation(int threadId)
Gets a thread's location. |
int[] |
getLocationStack(int threadId)
Gets the location stack for a particular thread. |
int |
getLockCount(int threadId)
Gets the lock count for a particular thread when waiting. |
int |
getStackHeight(int threadId)
Gets the stack height for a particular thread. |
int[] |
getThreadIds()
Gets all the thread ids in this state. |
int |
getTransformationIndex(int threadId)
Gets a thread's transformation index. |
int[] |
getTransformationIndexStack(int threadId)
Gets the transformation index stack for a particular thread. |
boolean |
isThreadAlive(int threadId)
Determines whether a thread is still alive. |
void |
newThread(int threadId,
IValueArray localValues,
int beginLocationDesc)
Creates a new thread. |
int |
removeLockCount(int threadId)
Removes the lock count for a particular thread when waiting. |
void |
setGlobalValue(int globalIndex,
IValue value)
Sets a global's value. |
void |
setLocalValue(int threadId,
int localIndex,
IValue value)
Sets a local's value. |
void |
setLocation(int threadId,
int locationDesc,
int transformationIndex)
Sets a thread's location. |
void |
storeLockCount(int threadId,
int lockCount)
Stores the lock count for a particular thread when waiting. |
void |
validate(IBogorConfiguration bc)
Validates this state wrt. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient SymbolTable st
protected transient IStateFactory sf
protected IntIntTable threadLockCountMap
protected IntObjectTable<IntList> threadLocationStackMap
protected IntObjectTable<IntList> threadTransformationIndexStackMap
protected IntObjectTable<DefaultThreadStore> threadStoreMap
protected IValueArray globalValues
Constructor Detail |
---|
protected DefaultState(SymbolTable st, IStateFactory sf, IValueArray globalValues)
sf
- The state factory of this state. Must be non-null.globalValues
- The global values for this state. Must be non-null.protected DefaultState()
Method Detail |
---|
public int getGlobalCount()
IState
getGlobalCount
in interface IState
public void setGlobalValue(int globalIndex, IValue value)
IState
setGlobalValue
in interface IState
globalIndex
- The index of the global. Must be at least zero and at most
less than the number of globals.value
- The new value of the global. Must be non-null.SymbolTable.getGlobalIndexTable()
public IValue getGlobalValue(int globalIndex)
IState
getGlobalValue
in interface IState
globalIndex
- The index of the global. Must be at least zero and at most
less than the number of globals.
SymbolTable.getGlobalIndexTable()
public IValueArray getGlobalValues()
IState
getGlobalValues
in interface IState
public int getLocalCount(int threadId)
IState
getLocalCount
in interface IState
threadId
- The thread id that is associated to the local. The thread id
must be a valid thread id in this state.
public void setLocalValue(int threadId, int localIndex, IValue value)
IState
setLocalValue
in interface IState
threadId
- The thread id that is associated to the local. The thread id
must be a valid thread id in this state.localIndex
- The index of the local. Must be at least zero and at most less
than the number of locals.value
- The new value of the local. Must be non-null.FSMSymbolTable.getLocalIndexTable()
public IValue getLocalValue(int threadId, int localIndex)
IState
getLocalValue
in interface IState
threadId
- The thread id that is associated to the local. The thread id
must be a valid thread id in this state.localIndex
- The index of the local. Must be at least zero and at most less
than the number of locals.
FSMSymbolTable.getLocalIndexTable()
public IValueArray getLocalValues(int threadId)
IState
getLocalValues
in interface IState
threadId
- The thread id that is associated to the locals. The thread id
must be a valid thread id in this state.
public IValueArray[] getLocalValuesStack(int threadId)
IState
getLocalValuesStack
in interface IState
threadId
- The thread id that is associated to the locals. The thread id
must be a valid thread id in this state.
public void setLocation(int threadId, int locationDesc, int transformationIndex)
IState
setLocation
in interface IState
threadId
- The thread id that its location to be set. The thread id must
be a valid thread id in this state.locationDesc
- The new location of the thread.transformationIndex
- The transformation index causing the move. It must be a
transformation index of the old location desc.FSMSymbolTable.getLocationDescTable()
public int getLocation(int threadId)
IState
getLocation
in interface IState
threadId
- The thread id that its location is queried. The thread id must
be a valid thread id in this state.
FSMSymbolTable.getLocationDescTable()
public int[] getLocationStack(int threadId)
IState
getLocationStack
in interface IState
threadId
- The thread id that is associated to the location stack. The
thread id must be a valid thread id in this state.
public int getLockCount(int threadId)
IState
getLockCount
in interface IState
threadId
- The thread id that is (must be) waiting.
public int getStackHeight(int threadId)
IState
getStackHeight
in interface IState
threadId
- The thread id that is associated to the stack. The thread id
must be a valid thread id in this state.
public boolean isThreadAlive(int threadId)
IState
isThreadAlive
in interface IState
threadId
- The thread to be determined.
public int[] getThreadIds()
IState
getThreadIds
in interface IState
public int getTransformationIndex(int threadId)
IState
getTransformationIndex
in interface IState
threadId
- The thread id that its transformation index is queried. The
thread id must be a valid thread id in this state.
public int[] getTransformationIndexStack(int threadId)
IState
getTransformationIndexStack
in interface IState
threadId
- The thread id that is associated to the transformation index
stack. The thread id must be a valid thread id in this state.
public IState clone(Map<Object,Object> cloneMap)
IState
clone
in interface IState
cloneMap
- Original values (IValue
) to their clones (
IValue
) mapping. The clone map to solve
circular references in values.
public void dispose()
Disposable
dispose
in interface Disposable
public void enterFunction(int threadId, IValueArray localValues, int beginLocationDesc, int transformationIndex)
IState
enterFunction
in interface IState
threadId
- The thread id of the thread that enters a function. The thread
id must be a valid thread id in this state.localValues
- The local values of the function to be entered. Must be
non-null.beginLocationDesc
- The function initial location.FSMSymbolTable.getLocationDescTable()
public IValueArray exitFunction(int threadId)
IState
exitFunction
in interface IState
threadId
- The thread id of the thread that enters a function. The thread
id must be a valid thread id in this state.
FSMSymbolTable.getLocationDescTable()
public IValueArray exitThread(int threadId)
IState
exitThread
in interface IState
threadId
- The thread id to be killed. The thread id must be a valid
thread id in this state.
public void newThread(int threadId, IValueArray localValues, int beginLocationDesc)
IState
newThread
in interface IState
threadId
- The thread id for the new thread. The thread id must not
already be in this state.localValues
- The local values of the new thread. Must be non-null.beginLocationDesc
- The initial location of the new thread.FSMSymbolTable.getLocationDescTable()
public int removeLockCount(int threadId)
IState
removeLockCount
in interface IState
threadId
- The thread id that is (must be) waiting.
public void storeLockCount(int threadId, int lockCount)
IState
storeLockCount
in interface IState
threadId
- The thread id that is waiting. The thread id must be a valid
thread id in this state.lockCount
- The number of locks operations. At least zero.public void validate(IBogorConfiguration bc)
IState
validate
in interface IState
bc
- The Bogor configuration to validate to.protected boolean checkCurrentInvokeTransformation(int threadId, int transformationIndex)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |