This class is responsible for scope-related functionality of class Lox.
Public Fields | |
T | globalStore |
StringTree< T > | languageStore = new StringTree<T>() |
HashMap< Thread, ArrayList< T > > | threadInnerStore = new HashMap<Thread, ArrayList<T>>() |
HashMap< Thread, ArrayList< T > > | threadOuterStore = new HashMap<Thread, ArrayList<T>>() |
Public Methods | |
ScopeStore (ScopeInfo scopeInfo, boolean cfgSingleThreadValue) | |
void | clear () |
T | get () |
void | InitAccess (Scope scope, int packageLevel, Thread thread) |
void | initWalk (Scope startScope, T localObject) |
T | remove (T value) |
T | store (T value) |
T | walk () |
Protected Fields | |
int | actPackageLevel |
Scope | actScope |
StringTree< T >.Cursor | actStringTreeNode |
Thread | actThread |
boolean | cfgSingleThreadValue |
AString | languageKey = new AString(128) |
Substring | languageKeySubs = new Substring() |
boolean | lazyLanguageNode |
ScopeInfo | scopeInfo |
boolean | walking |
T | walkLocalObject |
int | walkNextThreadIdx |
ArrayList< T > | walkThreadValues |
Protected Methods | |
T | access (int cmd, T value) |
void | initCursor (boolean create) |
ScopeStore | ( | ScopeInfo | scopeInfo, |
boolean | cfgSingleThreadValue | ||
) |
|
protected |
Receives, inserts or removes a value.
cmd | 0= insert, 1= remove, 2= get. |
value | The new value or the one to be removed. |
void clear | ( | ) |
Clears all data stored, resets all values.
T get | ( | ) |
Retrieves the value for the given scope.
void InitAccess | ( | Scope | scope, |
int | packageLevel, | ||
Thread | thread | ||
) |
Initializes access methods store, get and remove and has to be invoked prior to using them
scope | Scope to use. |
packageLevel | Used with Scope.PACKAGE to determine outer level. |
thread | The associated thread (for thread-related scopes only). If 0 is given, the ID from scopeInfo is used. |
|
protected |
Retrieves and optionally creates an entry in the map that stores language-related scope information. The result is stored in field actStringTreeNode.
create | If true , a non-existing entry is created. |
void initWalk | ( | Scope | startScope, |
T | localObject | ||
) |
Initializes a scope 'walk' by storing the given scope information and setting fields of our walk 'state-machine' to proper start values.
startScope | The Scope to start searching for. |
localObject | The 'local object' returned by a walk after Scope.THREAD_INNER and before Scope.METHOD. |
T remove | ( | T | value | ) |
Removes a value for the given scope.
value | The value to remove (only used for thread-related Scopes). |
T store | ( | T | value | ) |
Stores a new value for the given scope.
value | The new value to set. |
T walk | ( | ) |
Searches value in the actual scope. While not found, moves walk state to next outer and continues there.
|
protected |
The next package level of a walk during scope 'PACKAGE'
|
protected |
The actual scope of a walk (array, because it is used as second return value)
|
protected |
The actual language related scopes' map node
|
protected |
The actual thread
|
protected |
T globalStore |
The value to the global scope
Flag used to lazily create the key to language-related scope values
Temporary substring for consuming the source key
StringTree<T> languageStore = new StringTree<T>() |
StringTree store for language-related scopes (path,source,method)
|
protected |
Flag used to lazily create the key to source-related scope values
HashMap<Thread, ArrayList<T> > threadInnerStore = new HashMap<Thread, ArrayList<T>>() |
A list of domain paths of Scope.THREAD_INNER
HashMap<Thread, ArrayList<T> > threadOuterStore = new HashMap<Thread, ArrayList<T>>() |
A list of domain paths of Scope.THREAD_OUTER
|
protected |
Indicates if currently a scope walk is active
|
protected |
The 'local object' returned by a walk after Scope. THREAD_INNER and before Scope.METHOD
|
protected |
The next value of a walk during Scope.THREAD_OUTER/INNER
|
protected |
The list of values of Scope.THREAD_OUTER/Inner during a walk