ptolemy.domains.ptera.lib
Class EventQueueDebugger

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.kernel.util.SingletonAttribute
              extended by ptolemy.domains.ptera.lib.EventQueueDebugger
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Initializable, EventQueueDebugListener, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Singleton

public class EventQueueDebugger
extends SingletonAttribute
implements EventQueueDebugListener, Initializable

An attribute to debug the event queue of a Ptera model.

Since:
Ptolemy II 8.0
Version:
$Id: EventQueueDebugger.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
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
private static java.lang.String _ICON_DESCRIPTION
          The icon of the event queue debugger attribute.
 Parameter active
          A Boolean parameter that determines whether this debugger is active.
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Constructor Summary
EventQueueDebugger(NamedObj container, java.lang.String name)
          Construct an attribute with the given container and name.
 
Method Summary
 void addInitializable(Initializable initializable)
          Do nothing.
 void initialize()
          Do nothing.
 void insertActor(int position, Time time, Actor actor, Token arguments)
          Invoked when an actor is inserted into the event queue.
 void insertEvent(int position, Time time, Event event, Token arguments)
          Invoked when an event is inserted into the event queue.
 void preinitialize()
          Add this attribute as a debug listener to the director.
 void removeEvent(int position, boolean isCancelled)
          Invoked when an event or actor is removed from the event queue.
 void removeInitializable(Initializable initializable)
          Do nothing.
 void setContainer(NamedObj container)
          Set the container and register this as an initializable in the container.
 void wrapup()
          Remove this attribute from the list of debug listeners in the director.
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, clone, 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, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, 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, 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.DebugListener
event, message
 

Field Detail

active

public Parameter active
A Boolean parameter that determines whether this debugger is active.


_ICON_DESCRIPTION

private static final java.lang.String _ICON_DESCRIPTION
The icon of the event queue debugger attribute.

See Also:
Constant Field Values
Constructor Detail

EventQueueDebugger

public EventQueueDebugger(NamedObj container,
                          java.lang.String name)
                   throws NameDuplicationException,
                          IllegalActionException
Construct an attribute with the given container and name. If an attribute already exists with the same name as the one specified here, that is an instance of class SingletonAttribute (or a derived class), then that attribute is removed before this one is inserted in the container.

Parameters:
container - The container.
name - The name of this attribute.
Throws:
IllegalActionException - If the attribute cannot be contained by the proposed container.
NameDuplicationException - If the container already has an attribute with this name, and the class of that container is not SingletonAttribute.
Method Detail

addInitializable

public void addInitializable(Initializable initializable)
Do nothing.

Specified by:
addInitializable in interface Initializable
Parameters:
initializable - Not used.
See Also:
Initializable.removeInitializable(Initializable)

initialize

public void initialize()
                throws IllegalActionException
Do nothing.

Specified by:
initialize in interface Initializable
Throws:
IllegalActionException - Not thrown in this class.

insertActor

public void insertActor(int position,
                        Time time,
                        Actor actor,
                        Token arguments)
Invoked when an actor is inserted into the event queue.

Specified by:
insertActor in interface EventQueueDebugListener
Parameters:
position - The position at which the actor is inserted.
time - The time at which the actor is scheduled to fire.
actor - The actor.
arguments - Arguments to the actor, which must be either an ArrayToken or a RecordToken, or null.

insertEvent

public void insertEvent(int position,
                        Time time,
                        Event event,
                        Token arguments)
Invoked when an event is inserted into the event queue.

Specified by:
insertEvent in interface EventQueueDebugListener
Parameters:
position - The position at which the event is inserted.
time - The time at which the event is scheduled to fire.
event - The event.
arguments - Arguments to the event, which must be either an ArrayToken or a RecordToken, or null.

preinitialize

public void preinitialize()
                   throws IllegalActionException
Add this attribute as a debug listener to the director.

Specified by:
preinitialize in interface Initializable
Throws:
IllegalActionException - Not thrown in this class.

removeEvent

public void removeEvent(int position,
                        boolean isCancelled)
Invoked when an event or actor is removed from the event queue.

Specified by:
removeEvent in interface EventQueueDebugListener
Parameters:
position - The position of the event or actor.
isCancelled - Whether the removal is due to cancelation or successful processing.

removeInitializable

public void removeInitializable(Initializable initializable)
Do nothing.

Specified by:
removeInitializable in interface Initializable
Parameters:
initializable - Not used.
See Also:
Initializable.addInitializable(Initializable)

setContainer

public void setContainer(NamedObj container)
                  throws IllegalActionException,
                         NameDuplicationException
Set the container and register this as an initializable in the container.

Overrides:
setContainer in class SingletonAttribute
Parameters:
container - The container
Throws:
IllegalActionException - If this attribute is not of the expected class for the container, or it has no name, or the attribute and container are not in the same workspace, or the proposed container would result in recursive containment.
NameDuplicationException - If the container already has an attribute with the name of this attribute that is of class SingletonConfigurableAttribute.
See Also:
Attribute.getContainer()

wrapup

public void wrapup()
            throws IllegalActionException
Remove this attribute from the list of debug listeners in the director.

Specified by:
wrapup in interface Initializable
Throws:
IllegalActionException - Not thrown in this class.