ptolemy.domains.pn.kernel
Class NondeterministicMerge

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.InstantiableNamedObj
          extended by ptolemy.kernel.Entity
              extended by ptolemy.kernel.ComponentEntity
                  extended by ptolemy.kernel.CompositeEntity
                      extended by ptolemy.actor.CompositeActor
                          extended by ptolemy.actor.TypedCompositeActor
                              extended by ptolemy.domains.pn.kernel.NondeterministicMerge
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class NondeterministicMerge
extends TypedCompositeActor

This actor takes any number of input streams and merges them nondeterministically. This actor is intended for use in the PN domain. It is a composite actor that creates its own contents. It contains an instance of PNDirector and one actor for each input channel (it creates these actors automatically when a connection is created to the input multiport). The contained actors are special actors (implemented as an instance of an inner class) that read from the port of this actor and write to the port of this actor. They have no ports of their own. The lifecycle of the contained actors (when they are started or stopped) is handled by the PNDirector in the usual way.

Since:
Ptolemy II 4.1
Version:
$Id: NondeterministicMerge.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Edward A. Lee, Haibo Zeng
See Also:
Serialized Form
Accepted Rating:
Red (eal)
Proposed Rating:
Yellow (eal)

Nested Class Summary
private  class NondeterministicMerge.ChannelActor
          Actor to handle an input channel.
private  class NondeterministicMerge.MergeDirector
          Variant of the PNDirector for the NondeterministicMerge actor.
 
Nested classes/interfaces inherited from class ptolemy.kernel.CompositeEntity
CompositeEntity.ContainedObjectsIterator
 
Field Summary
 TypedIOPort channel
          Output port used to indicate which input channel the current output came from.
 TypedIOPort input
          The input port.
 TypedIOPort output
          The output port.
 
Fields inherited from class ptolemy.actor.CompositeActor
_actorFiringListeners, _causalityInterface, _initializables, _notifyingActorFiring, _publishedPorts, _publisherRelations, _stopRequested
 
Fields inherited from class ptolemy.kernel.CompositeEntity
_levelCrossingLinks
 
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.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
 
Constructor Summary
NondeterministicMerge(CompositeEntity container, java.lang.String name)
          Construct an actor in the specified container with the specified name.
NondeterministicMerge(Workspace workspace)
          Construct a TypedCompositeActor in the specified workspace with no container and an empty string as a name.
 
Method Summary
private  void _constructor()
          Construct a NondeterministicMerge.
private  void _reinitializeInnerActors()
          Create the contained actors to handle the inputs.
 void connectionsChanged(Port port)
          Override the base class to adjust the number of contained actors, if the number is no longer correct.
 void initialize()
          Initialize this actor.
 
Methods inherited from class ptolemy.actor.TypedCompositeActor
_addEntity, _addPort, _addRelation, _checkTypesFromTo, _typeConstraintsFromTo, newPort, newRelation, resolveTypes, typeConstraintList, typeConstraints
 
Methods inherited from class ptolemy.actor.CompositeActor
_actorFiring, _actorFiring, _finishedAddEntity, _getPublishedPort, _setDirector, addActorFiringListener, addInitializable, addPiggyback, clone, createReceivers, createSchedule, fire, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inferringWidths, inferWidths, inputPortList, isFireFunctional, isOpaque, isStrict, iterate, linkToPublishedPort, linkToPublishedPort, needsWidthInference, newInsideReceiver, newReceiver, notifyConnectivityChange, outputPortList, postfire, prefire, preinitialize, recordFiring, registerPublisherPort, removeActorFiringListener, removeInitializable, removePiggyback, requestChange, setContainer, setDirector, setManager, stop, stopFire, terminate, unlinkToPublishedPort, unlinkToPublishedPort, unregisterPublisherPort, wrapup
 
Methods inherited from class ptolemy.kernel.CompositeEntity
_adjustDeferrals, _deepOpaqueEntityList, _description, _exportMoMLContents, _recordDecoratedAttributes, _removeEntity, _removeRelation, _validateSettables, allAtomicEntityList, allCompositeEntityList, allowLevelCrossingConnect, classDefinitionList, connect, connect, containedObjectsIterator, deepEntityList, deepGetEntities, deepOpaqueEntityList, deepRelationSet, entityList, entityList, exportLinks, exportMoML, getAttribute, getEntities, getEntity, getPort, getRelation, getRelations, isAtomic, lazyAllAtomicEntityList, lazyAllCompositeEntityList, lazyClassDefinitionList, lazyDeepEntityList, lazyEntityList, lazyRelationList, numberOfEntities, numberOfRelations, numEntities, numRelations, relationList, removeAllEntities, removeAllRelations, setClassDefinition, statistics, uniqueName
 
Methods inherited from class ptolemy.kernel.ComponentEntity
_checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
 
Methods inherited from class ptolemy.kernel.Entity
_removePort, connectedPortList, connectedPorts, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts
 
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _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, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
 
Methods inherited from interface ptolemy.actor.Executable
fire, isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
 
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable, wrapup
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
 
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
 

Field Detail

input

public TypedIOPort input
The input port. This base class imposes no type constraints except that the type of the input cannot be greater than the type of the output.


output

public TypedIOPort output
The output port. By default, the type of this output is constrained to be at least that of the input.


channel

public TypedIOPort channel
Output port used to indicate which input channel the current output came from. This has type int.

Constructor Detail

NondeterministicMerge

public NondeterministicMerge(CompositeEntity container,
                             java.lang.String name)
                      throws NameDuplicationException,
                             IllegalActionException
Construct an actor in the specified container with the specified name. Create ports and make the input port a multiport.

Parameters:
container - The container.
name - The name.
Throws:
NameDuplicationException - If an actor with an identical name already exists in the container.
IllegalActionException - If the actor cannot be contained by the proposed container.

NondeterministicMerge

public NondeterministicMerge(Workspace workspace)
                      throws NameDuplicationException,
                             IllegalActionException
Construct a TypedCompositeActor in the specified workspace with no container and an empty string as a name. You can then change the name with setName(). If the workspace argument is null, then use the default workspace. You should set the local director or executive director before attempting to send data to the actor or to execute it. Add the actor to the workspace directory. Increment the version number of the workspace.

Parameters:
workspace - The workspace that will list the actor.
Throws:
NameDuplicationException - If an actor with an identical name already exists in the container.
IllegalActionException - If the actor cannot be contained by the proposed container.
Method Detail

connectionsChanged

public void connectionsChanged(Port port)
Override the base class to adjust the number of contained actors, if the number is no longer correct.

Overrides:
connectionsChanged in class CompositeActor
Parameters:
port - The port that has connection changes.

initialize

public void initialize()
                throws IllegalActionException
Initialize this actor.

Specified by:
initialize in interface Initializable
Overrides:
initialize in class CompositeActor
Throws:
IllegalActionException - If the parent class throws it.

_constructor

private void _constructor()
                   throws NameDuplicationException,
                          IllegalActionException
Construct a NondeterministicMerge.

Throws:
NameDuplicationException
IllegalActionException

_reinitializeInnerActors

private void _reinitializeInnerActors()
Create the contained actors to handle the inputs.