WorkspaceStats

public class WorkspaceStats extends Object

Tracks information about the Workspace that we want fast access to.

Public Constructor Summary

WorkspaceStats(NameManager variableManager, ProcedureManager procedureManager, ConnectionManager connectionManager)

Public Method Summary

String
addVariable(String requestedName, boolean allowRename)
Attempts to add a variable to the workspace.
void
cleanupStats(Block block)
Remove all the stats associated with this block and its descendents.
void
clear()
Clear state about variables, procedures, and connections.
void
collectStats(List<Block> blocks, boolean recursive)
Walks through a list of block and records all Connections, variable references, procedure definitions and procedure calls.
void
collectStats(Block block, boolean recursive)
Walks through a block and records all Connections, variable references, procedure definitions and procedure calls.
VariableInfo
getVariableInfo(String varName)
NameManager

Inherited Method Summary

Public Constructors

public WorkspaceStats (NameManager variableManager, ProcedureManager procedureManager, ConnectionManager connectionManager)

Parameters
variableManager
procedureManager
connectionManager

Public Methods

public String addVariable (String requestedName, boolean allowRename)

Attempts to add a variable to the workspace.

Parameters
requestedName The preferred variable name. Usually the user name.
allowRename Whether the variable name can be renamed.
Returns
  • The name that was added, if any. May be null if renaming is not allowed.

public void cleanupStats (Block block)

Remove all the stats associated with this block and its descendents. This will remove all connections from the ConnectionManager and dereference any variables in the tree.

Parameters
block The starting block to cleanup stats for.

public void clear ()

Clear state about variables, procedures, and connections. These changes will be reflected in the externally owned connection and procedure manager.

public void collectStats (List<Block> blocks, boolean recursive)

Walks through a list of block and records all Connections, variable references, procedure definitions and procedure calls.

Parameters
blocks The list of blocks to inspect.
recursive Whether to recursively collect stats for all descendants of the current block.

public void collectStats (Block block, boolean recursive)

Walks through a block and records all Connections, variable references, procedure definitions and procedure calls.

Parameters
block The block to inspect.
recursive Whether to recursively collect stats for all descendants of the current block.

public VariableInfo getVariableInfo (String varName)

Parameters
varName

public NameManager getVariableNameManager ()