ptolemy.domains.ptera.lib
Class DebuggerParameter

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.kernel.util.AbstractSettableAttribute
              extended by ptolemy.data.expr.Variable
                  extended by ptolemy.data.expr.Parameter
                      extended by ptolemy.domains.ptera.lib.TableauParameter
                          extended by ptolemy.domains.ptera.lib.DebuggerParameter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Initializable, HasTypeConstraints, Typeable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Settable, ValueListener

public class DebuggerParameter
extends TableauParameter
implements DebugListener

A parameter that represents a debugger for event debugging. It receives debugging messages from the events at the current level of the model hierarchy, and also the levels below if the hierarchical parameter is set to true.

Since:
Ptolemy II 8.0
Version:
$Id: DebuggerParameter.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Thomas Huining Feng
See Also:
Serialized Form
Accepted Rating:
Red (tfeng)
Proposed Rating:
Yellow (tfeng)

Nested Class Summary
static class DebuggerParameter.Mode
          The modes.
 
Nested classes/interfaces inherited from class ptolemy.data.expr.Variable
Variable.VariableScope
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Nested classes/interfaces inherited from interface ptolemy.kernel.util.Settable
Settable.Visibility
 
Field Summary
private  int _lineNumber
          The current line number in the "check log" mode.
private  java.lang.String[] _lines
          The lines of the recorded messages in the "check log" mode.
 Parameter columnsDisplayed
          The horizontal size of the display, in columns.
 Parameter hierarchical
          Whether debugging messages from lower levels of the model hierarchy should be displayed.
 StringParameter log
          The recorded messages.
 ChoiceParameter mode
          The mode of this debugger, which is either "check log", "display", or "record log".
 Parameter rowsDisplayed
          The vertical size of the display, in rows.
 
Fields inherited from class ptolemy.data.expr.Variable
_currentExpression, _needsEvaluation, _parserScope, _parseTreeValid, _valueListeners
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Fields inherited from interface ptolemy.kernel.util.Settable
EXPERT, FULL, NONE, NOT_EDITABLE
 
Constructor Summary
DebuggerParameter(NamedObj container, java.lang.String name)
          Construct a parameter with the given name contained by the specified entity.
 
Method Summary
private  Tableau _createTableau()
          Create a tableau for displaying the debugging messages received from the events.
private  void _registerDebugListener(boolean register)
          Register or unregister this object as a debug listener for the events.
 void event(DebugEvent event)
          React to the given event.
 void initialize()
          Begin execution of the actor.
 void wrapup()
          This method is invoked exactly once per execution of an application.
 
Methods inherited from class ptolemy.domains.ptera.lib.TableauParameter
addInitializable, clone, getExpression, preinitialize, removeInitializable, setContainer, setExpression
 
Methods inherited from class ptolemy.data.expr.Parameter
addChoice, exportMoML, getChoices, removeAllChoices, removeChoice
 
Methods inherited from class ptolemy.data.expr.Variable
_description, _evaluate, _notifyValueListeners, _parseIfNecessary, _propagate, _propagateToValueListeners, _propagateValue, _setToken, _setTokenAndNotify, addValueListener, getDeclaredType, getFreeIdentifiers, getParserScope, getScope, getScope, getToken, getType, getTypeTerm, getValueAsString, getVariable, getVisibility, invalidate, isKnown, isLazy, isStringMode, isTypeAcceptable, removeValueListener, reset, setLazy, setName, setParseTreeEvaluator, setStringMode, setToken, setToken, setTypeAtLeast, setTypeAtLeast, setTypeAtMost, setTypeEquals, setTypeSameAs, setUnknown, setVisibility, stringRepresentation, toString, typeConstraintList, typeConstraints, validate, valueChanged
 
Methods inherited from class ptolemy.kernel.util.AbstractSettableAttribute
getDefaultExpression
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.kernel.util.DebugListener
message
 
Methods inherited from interface ptolemy.kernel.util.Settable
getDisplayName
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getFullName, getName, getName
 

Field Detail

columnsDisplayed

public Parameter columnsDisplayed
The horizontal size of the display, in columns. This contains an integer, and defaults to 40.


hierarchical

public Parameter hierarchical
Whether debugging messages from lower levels of the model hierarchy should be displayed.


log

public StringParameter log
The recorded messages.


mode

public ChoiceParameter mode
The mode of this debugger, which is either "check log", "display", or "record log".


rowsDisplayed

public Parameter rowsDisplayed
The vertical size of the display, in rows. This contains an integer, and defaults to 10.


_lineNumber

private int _lineNumber
The current line number in the "check log" mode.


_lines

private java.lang.String[] _lines
The lines of the recorded messages in the "check log" mode.

Constructor Detail

DebuggerParameter

public DebuggerParameter(NamedObj container,
                         java.lang.String name)
                  throws IllegalActionException,
                         NameDuplicationException
Construct a parameter with the given name contained by the specified entity. The container argument must not be null, or a NullPointerException will be thrown. This parameter will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. The object is not added to the list of objects in the workspace unless the container is null. Increment the version of the workspace.

Parameters:
container - The container.
name - The name of the parameter.
Throws:
IllegalActionException - If the parameter is not of an acceptable class for the container.
NameDuplicationException - If the name coincides with a parameter already in the container.
Method Detail

event

public void event(DebugEvent event)
React to the given event.

Specified by:
event in interface DebugListener
Overrides:
event in class NamedObj
Parameters:
event - The event.

initialize

public void initialize()
                throws IllegalActionException
Begin execution of the actor. This is invoked exactly once after the preinitialization phase. Since type resolution is done in the preinitialization phase, along with topology changes that may be requested by higher-order function actors, an actor can produce output data and schedule events in the initialize() method.

Specified by:
initialize in interface Initializable
Overrides:
initialize in class TableauParameter
Throws:
IllegalActionException - If execution is not permitted.

wrapup

public void wrapup()
            throws IllegalActionException
This method is invoked exactly once per execution of an application. None of the other action methods should be be invoked after it. It finalizes an execution, typically closing files, displaying final results, etc. When this method is called, no further execution should occur.

Specified by:
wrapup in interface Initializable
Overrides:
wrapup in class TableauParameter
Throws:
IllegalActionException - If wrapup is not permitted.

_createTableau

private Tableau _createTableau()
                        throws IllegalActionException
Create a tableau for displaying the debugging messages received from the events.

Returns:
The tableau.
Throws:
IllegalActionException - If a text effigy cannot be created.

_registerDebugListener

private void _registerDebugListener(boolean register)
                             throws IllegalActionException
Register or unregister this object as a debug listener for the events.

Parameters:
register - Whether the operation is registering.
Throws:
IllegalActionException - If the refinements of an event cannot be obtained.