ptolemy.vergil.debugger
Class DebugController

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.kernel.util.ConfigurableAttribute
              extended by ptolemy.kernel.util.SingletonConfigurableAttribute
                  extended by ptolemy.vergil.debugger.DebugController
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Changeable, Configurable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Settable, Singleton

public class DebugController
extends SingletonConfigurableAttribute

An execution listener that suspends execution based on breakpoints. Instances of this class should be contained by a director. This class keeps a DebugProfile for each actor that belongs to that director and is being debugged. This attribute is not persistent by default.

Since:
Ptolemy II 2.0
Version:
$Id: DebugController.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Elaine Cheong
See Also:
DebugProfile, Serialized Form
Accepted Rating:
Red (celaine)
Proposed Rating:
Red (celaine)

Nested Class Summary
 
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  DebugRenderer _debugRenderer
           
private  java.util.Hashtable _toDebug
           
 
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
DebugController(NamedObj container, java.lang.String name)
          Construct a debug listener with the given container and name.
 
Method Summary
 void clear()
          Clear the set of actors that are being debugged.
 void event(DebugEvent debugEvent)
          Respond to all FiringEvents.
 DebugProfile getDebugProfile(Executable actor)
          Get the profile for an actor that is being debugged.
 boolean isEnabled()
          Determine whether debugging is enabled on the set of actors.
 void message(java.lang.String string)
          React to a debug message from the director that we are listening to by ignoring the message.
 void putDebugProfile(Executable actor, DebugProfile profile)
          Add an actor to the set of actors that are being debugged.
 void removeDebugProfile(Executable actor)
          Remove an actor from the set of actors that are being debugged.
private  void render(Figure figure, Manager manager, java.lang.String message)
          Highlight the actor and wait for the user to select the Resume button before unhighlighting the actor.
 void setEnabled(boolean enabled)
          Enable/disable debugging on the set of actors.
 
Methods inherited from class ptolemy.kernel.util.SingletonConfigurableAttribute
setContainer
 
Methods inherited from class ptolemy.kernel.util.ConfigurableAttribute
_exportMoMLContents, _propagateValue, addValueListener, clone, configure, getBase, getConfigureSource, getConfigureText, getDefaultExpression, getDisplayName, getExpression, getValueAsString, getVisibility, removeValueListener, setDisplayName, setExpression, setVisibility, validate, value
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _description, _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, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, 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.Nameable
description, getContainer, getFullName, getName, getName, setName
 

Field Detail

_debugRenderer

private DebugRenderer _debugRenderer

_toDebug

private java.util.Hashtable _toDebug
Constructor Detail

DebugController

public DebugController(NamedObj container,
                       java.lang.String name)
                throws IllegalActionException,
                       NameDuplicationException
Construct a debug listener with the given container and name.

Parameters:
container - The container.
name - The name.
Throws:
IllegalActionException - If the container does not accept this entity (this should not occur).
NameDuplicationException - If the name coincides with an attribute already in the container.
Method Detail

clear

public void clear()
Clear the set of actors that are being debugged.


event

public void event(DebugEvent debugEvent)
Respond to all FiringEvents. If the DebugController has a DebugProfile containing a matching FiringEvent, then this method highlights the actor and invokes pauseOnBreakpoint() on the manager.

Specified by:
event in interface DebugListener
Overrides:
event in class NamedObj
Parameters:
debugEvent - The debug event.
See Also:
This is similar to doing animation., ActorViewerGraphController.event(ptolemy.kernel.util.DebugEvent)

getDebugProfile

public DebugProfile getDebugProfile(Executable actor)
Get the profile for an actor that is being debugged.

Parameters:
actor - The actor for which to retrieve the profile.
Returns:
The profile for the actor.

isEnabled

public boolean isEnabled()
Determine whether debugging is enabled on the set of actors.

Returns:
True if debugging is enabled.

message

public void message(java.lang.String string)
React to a debug message from the director that we are listening to by ignoring the message.

Specified by:
message in interface DebugListener
Overrides:
message in class NamedObj
Parameters:
string - Debug message.

putDebugProfile

public void putDebugProfile(Executable actor,
                            DebugProfile profile)
Add an actor to the set of actors that are being debugged.

Parameters:
actor - The actor to debug.
profile - The breakpoint configuration for this actor.

removeDebugProfile

public void removeDebugProfile(Executable actor)
Remove an actor from the set of actors that are being debugged.

Parameters:
actor - The actor to remove.

setEnabled

public void setEnabled(boolean enabled)
Enable/disable debugging on the set of actors.

Parameters:
enabled - True if debugging should be enabled.

render

private void render(Figure figure,
                    Manager manager,
                    java.lang.String message)
Highlight the actor and wait for the user to select the Resume button before unhighlighting the actor. This calls pauseOnBreakpoint() on the manager.

Parameters:
figure - The figure that we are highlighting.
manager - The manager for the figure.
message - The message to display in the Run window while pausing on the breakpoint.
See Also:
DebugRenderer