ALox  V. 2402 R. 0
Home ALox for C++ ALox for C# ALox for Java Download
Public Fields | Public Methods | Protected Fields | Protected Methods | List of all members
ScopeStore< T > Class Template Reference
Collaboration diagram for ScopeStore< T >:
[legend]

Class Description


This class is responsible for scope-related functionality of class Lox.

Note
This is a pure internal helper class. Documentation may be limited.

Public Fields

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 ()
 
get ()
 
void InitAccess (Scope scope, int packageLevel, Thread thread)
 
void initWalk (Scope startScope, T localObject)
 
remove (T value)
 
store (T value)
 
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
 
walkLocalObject
 
int walkNextThreadIdx
 
ArrayList< T > walkThreadValues
 

Protected Methods

access (int cmd, T value)
 
void initCursor (boolean create)
 

Constructor & Destructor Documentation

◆ ScopeStore()

ScopeStore ( ScopeInfo  scopeInfo,
boolean  cfgSingleThreadValue 
)

Constructor

Parameters
scopeInfoThe ScopeInfo singleton of 'our' Lox.
cfgSingleThreadValueDetermines if for thread-related scopes, a list of values is stored, or just one.

Member Function Documentation

◆ access()

T access ( int  cmd,
value 
)
protected

Receives, inserts or removes a value.

Parameters
cmd0= insert, 1= remove, 2= get.
valueThe new value or the one to be removed.
Returns
Returns the previous value stored.

◆ clear()

void clear ( )

Clears all data stored, resets all values.

◆ get()

T get ( )

Retrieves the value for the given scope.

Returns
Returns the current value stored.

◆ InitAccess()

void InitAccess ( Scope  scope,
int  packageLevel,
Thread  thread 
)

Initializes access methods store, get and remove and has to be invoked prior to using them

Parameters
scopeScope to use.
packageLevelUsed with Scope.PACKAGE to determine outer level.
threadThe associated thread (for thread-related scopes only). If 0 is given, the ID from scopeInfo is used.

◆ initCursor()

void initCursor ( boolean  create)
protected

Retrieves and optionally creates an entry in the map that stores language-related scope information. The result is stored in field actStringTreeNode.

Parameters
createIf true, a non-existing entry is created.

◆ initWalk()

void initWalk ( Scope  startScope,
localObject 
)

Initializes a scope 'walk' by storing the given scope information and setting fields of our walk 'state-machine' to proper start values.

Parameters
startScopeThe Scope to start searching for.
localObjectThe 'local object' returned by a walk after Scope.THREAD_INNER and before Scope.METHOD.

◆ remove()

T remove ( value)

Removes a value for the given scope.

Parameters
valueThe value to remove (only used for thread-related Scopes).
Returns
Returns the previous value stored.

◆ store()

T store ( value)

Stores a new value for the given scope.

Parameters
valueThe new value to set.
Returns
Returns the previous value stored.

◆ walk()

T walk ( )

Searches value in the actual scope. While not found, moves walk state to next outer and continues there.

Returns
The next object found in the current or any next outer scope.

Member Data Documentation

◆ actPackageLevel

int actPackageLevel
protected

The next package level of a walk during scope 'PACKAGE'

◆ actScope

Scope actScope
protected

The actual scope of a walk (array, because it is used as second return value)

◆ actStringTreeNode

StringTree<T>.Cursor actStringTreeNode
protected

The actual language related scopes' map node

◆ actThread

Thread actThread
protected

The actual thread

◆ cfgSingleThreadValue

boolean cfgSingleThreadValue
protected

If true, values stored for thread scopes will be always replaced instead of appended. This is for example true for Log Data and false for Scope Domains

◆ globalStore

T globalStore

The value to the global scope

◆ languageKey

AString languageKey = new AString(128)
protected

Flag used to lazily create the key to language-related scope values

◆ languageKeySubs

Substring languageKeySubs = new Substring()
protected

Temporary substring for consuming the source key

◆ languageStore

StringTree<T> languageStore = new StringTree<T>()

StringTree store for language-related scopes (path,source,method)

◆ lazyLanguageNode

boolean lazyLanguageNode
protected

Flag used to lazily create the key to source-related scope values

◆ scopeInfo

ScopeInfo scopeInfo
protected

The ScopeInfo singleton of our Lox

◆ threadInnerStore

HashMap<Thread, ArrayList<T> > threadInnerStore = new HashMap<Thread, ArrayList<T>>()

A list of domain paths of Scope.THREAD_INNER

◆ threadOuterStore

HashMap<Thread, ArrayList<T> > threadOuterStore = new HashMap<Thread, ArrayList<T>>()

A list of domain paths of Scope.THREAD_OUTER

◆ walking

boolean walking
protected

Indicates if currently a scope walk is active

◆ walkLocalObject

T walkLocalObject
protected

The 'local object' returned by a walk after Scope. THREAD_INNER and before Scope.METHOD

◆ walkNextThreadIdx

int walkNextThreadIdx
protected

The next value of a walk during Scope.THREAD_OUTER/INNER

◆ walkThreadValues

ArrayList<T> walkThreadValues
protected

The list of values of Scope.THREAD_OUTER/Inner during a walk


The documentation for this class was generated from the following file: