Class Index | File Index

Classes


Class TraceManager

The TraceManager manages a sort of stack frame that is memoized on disk (using the JavaScript database associated with the current file). All stack frames are memoized, so the result is a sort of stack tree.

traceManager is a global instance of this class.


Defined in: TraceManager.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
You probably want to just use the global variable traceManager.
Method Summary
Method Attributes Method Name and Description
 
attempt(func, frameName)
Calls the function func in a new memoized stack frame, and catches the "stop" exception.
 
Gets the value of a "local variable" in the current memoized stack frame.
 
once(func, frameName)
Calls the function func only once; subsequent runs of the program will not call func if it returns successfully this time.
 
peekFrame(frameName)
Returns the frame we would see if we called pushFrame.
 
Pops the top stack frame off of the memoized stack.
 
pushFrame(frameName)
Pushes a new stack frame onto the memoized stack.
 
resetTrace(traceName)
Similar to TraceManager#setTrace, except that it clears the memoized stack frame data for all other trace versions.
 
setFrameValue(name, value)
Sets the value of a "local variable" in the current memoized stack frame.
 
setTrace(traceName)
Sets the root of the memoized stack frame tree.
 
stop()
Throws a "stop" exception.
Class Detail
TraceManager()
You probably want to just use the global variable traceManager.
Method Detail
attempt(func, frameName)
Calls the function func in a new memoized stack frame, and catches the "stop" exception. Returns true if the call succeeds. Returns false if func throws a "stop" exception (see TraceManager#stop).
Parameters:
func
frameName

getFrameValue(name)
Gets the value of a "local variable" in the current memoized stack frame.
Parameters:
name

once(func, frameName)
Calls the function func only once; subsequent runs of the program will not call func if it returns successfully this time. If func throws an exception, then it will be called again when the program is re-executed.

This function creates a new memoized stack frame before calling func. You can give this stack frame a name as an optional second parameter frameName.

Parameters:
func
frameName

peekFrame(frameName)
Returns the frame we would see if we called pushFrame.
Parameters:
frameName

popFrame()
Pops the top stack frame off of the memoized stack. Note that this does not remove anything from the memoized stack. The memoized stack is a tree which stores a trace of every stack frame that ever went onto the stack.

pushFrame(frameName)
Pushes a new stack frame onto the memoized stack.
Parameters:
frameName

resetTrace(traceName)
Similar to TraceManager#setTrace, except that it clears the memoized stack frame data for all other trace versions.
Parameters:
traceName

setFrameValue(name, value)
Sets the value of a "local variable" in the current memoized stack frame. This value is persisted in the memoized stack.
Parameters:
name
value

setTrace(traceName)
Sets the root of the memoized stack frame tree. Calling this method with a new value for traceName has the effect of reseting all calls to TraceManager#once, so that they re-execute their functions.
Parameters:
traceName

stop()
Throws a "stop" exception. This is the preferred way of stopping execution in order to wait on HITs on Mechanical Turk. Note that the "stop" exception is caught by TraceManager#attempt.

Documentation generated by JsDoc Toolkit 2.1.0 on Tue Jun 08 2010 19:53:20 GMT-0400 (EDT)