ptolemy.domains.petrinet.kernel
Class PetriNetActor

java.lang.Object
  extended byptolemy.kernel.util.NamedObj
      extended byptolemy.kernel.InstantiableNamedObj
          extended byptolemy.kernel.Entity
              extended byptolemy.kernel.ComponentEntity
                  extended byptolemy.kernel.CompositeEntity
                      extended byptolemy.actor.CompositeActor
                          extended byptolemy.actor.TypedCompositeActor
                              extended byptolemy.domains.petrinet.kernel.PetriNetActor
All Implemented Interfaces:
Actor, Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable, TypedActor

public class PetriNetActor
extends TypedCompositeActor

A Petri net Actor

As defined in the PetriNetDirector.java, a PetriNetActor is a directed and weighted graph G = (V, E) containing three kinds of nodes: Places p_i, Transitions t_i, and PetriNetActors PA_i, i.e., V = {p_i} union {t_i} union {PA_i} , where each PA_i itself is again defined as a PetriNetActor. Each node of V is called a component of the PetriNetActor G. A PetriNetActor is implemented as an extension of TypedCompositeActor. The current file contains two main methods: fire() and prefire(). More details of PetriNetActor can be found in PetriNetDirector.java.

Since:
Ptolemy II 2.0
Version:
$Id: PetriNetActor.java,v 1.35 2004/04/13 05:12:37 cxh Exp $
Author:
Yuke Wang
See Also:
Serialized Form
Accepted Rating:
Red (reviewmoderator)
Proposed Rating:
Red (yukewang)

Nested Class Summary
 
Nested classes inherited from class ptolemy.kernel.CompositeEntity
CompositeEntity.ContainedObjectsIterator
 
Field Summary
 
Fields inherited from class ptolemy.actor.CompositeActor
_stopRequested
 
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
 
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
 
Constructor Summary
PetriNetActor()
          Construct a PetriNetActor in the default workspace with an empty string as its name.
PetriNetActor(CompositeEntity container, java.lang.String name)
          Create a PetriNetActor in the specified container with the specified name.
PetriNetActor(Workspace workspace)
          Construct a PetriNetActor in the specified workspace with an empty string as its name.
 
Method Summary
 java.lang.Object clone(Workspace workspace)
          Clone the actor into the specified workspace.
 void fire()
          This method fires the PetriNetActor by calling the firing method of the director.
 boolean prefire()
          This method tests whether the PetriNetActor or its component contains any enabled Transitions or not.
 
Methods inherited from class ptolemy.actor.TypedCompositeActor
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _typeConstraintsFromTo, newPort, newRelation, resolveTypes, typeConstraintList
 
Methods inherited from class ptolemy.actor.CompositeActor
_finishedAddEntity, _setDirector, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, initialize, inputPortList, isOpaque, iterate, newInsideReceiver, newReceiver, outputPortList, postfire, preinitialize, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, wrapup
 
Methods inherited from class ptolemy.kernel.CompositeEntity
_adjustDeferrals, _description, _exportMoMLContents, _removeEntity, _removeRelation, allAtomicEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepEntityList, deepGetEntities, entityList, entityList, exportLinks, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, numberOfClassDefinitions, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, uniqueName, validateSettables
 
Methods inherited from class ptolemy.kernel.ComponentEntity
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, propagateExistence, setName
 
Methods inherited from class ptolemy.kernel.Entity
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition
 
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, attributeTypeChanged, clone, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, toplevel, toString, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.actor.Actor
getDirector, getExecutiveDirector, getFunctionDependency, getManager, inputPortList, newReceiver, outputPortList
 
Methods inherited from interface ptolemy.actor.Executable
initialize, iterate, postfire, preinitialize, stop, stopFire, terminate, wrapup
 
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getFullName, getName, getName
 

Constructor Detail

PetriNetActor

public PetriNetActor()
Construct a PetriNetActor in the default workspace with an empty string as its name. Add the actor to the workspace directory. Increment the version number of the workspace.


PetriNetActor

public PetriNetActor(Workspace workspace)
Construct a PetriNetActor in the specified workspace with an empty string as its name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace. Add the actor to the workspace directory. Increment the version number of the workspace.

Parameters:
workspace - The workspace that will list the actor.

PetriNetActor

public PetriNetActor(CompositeEntity container,
                     java.lang.String name)
              throws IllegalActionException,
                     NameDuplicationException
Create a PetriNetActor in the specified container with the specified name. The name must be unique within the container or an exception is thrown. The container argument must not be null, or a NullPointerException will be thrown.

Parameters:
container - The container.
name - The name of this actor within the container.
Throws:
IllegalActionException - If the entity cannot be contained by the proposed container.
NameDuplicationException - If the name coincides with an entity already in the container.
Method Detail

clone

public java.lang.Object clone(Workspace workspace)
                       throws java.lang.CloneNotSupportedException
Clone the actor into the specified workspace.

Overrides:
clone in class CompositeActor
Parameters:
workspace - The workspace for the new actor.
Returns:
A new PetriNetActor.
Throws:
java.lang.CloneNotSupportedException - If a derived class contains an attribute that cannot be cloned.

fire

public void fire()
          throws IllegalActionException
This method fires the PetriNetActor by calling the firing method of the director. It is assumed that the top level of the hierarchy is a PetriNetDirector.

Specified by:
fire in interface Executable
Overrides:
fire in class CompositeActor
Throws:
IllegalActionException - If director.fire() throws exception.

prefire

public boolean prefire()
                throws IllegalActionException
This method tests whether the PetriNetActor or its component contains any enabled Transitions or not. If any of the components is enabled, the method returns true, otherwise returns false.

Specified by:
prefire in interface Executable
Overrides:
prefire in class CompositeActor
Returns:
true or false, a PetriNetActor is ready to fire or not.
Throws:
IllegalActionException - If testReadyTransition throws exception.