ptolemy.domains.de.lib
Class UnionMerge
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.domains.de.kernel.DEActor
ptolemy.domains.de.lib.UnionMerge
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, SequenceActor, TimedActor, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
public class UnionMerge
- extends DEActor
A timed merge actor for the DE domain. Its operation is similar to
the Merge actor but the output type is the union of the inputs.
The labels for the output UnionToken are the names of the input
ports. To use this actor, instantiate it, and then add input ports
(instances of TypedIOPort).
There is a boolean parameter discardEvents associated
with this actor, which decides how to handle simultaneously
available inputs. Each time this actor fires, it reads the first
available tokens from an input port and sends them to the output
port. If the discardEvents parameter is configured to true,
then this actor discards all the remaining inputs in the rest of
ports. Otherwise, this actor requests refirings at the current
time until no more events are left in the ports. By default,
the discardEvents parameter is false.
- Since:
- Ptolemy II 5.2
- Version:
- $Id: UnionMerge.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Edward A. Lee, Haiyang Zheng, Yuhong Xiong
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
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 |
UnionMerge(CompositeEntity container,
java.lang.String name)
Construct an actor in the specified container with the specified
name. |
Method Summary |
void |
fire()
Read the first available tokens from an input port and
send them to the output port. |
java.util.Set<Inequality> |
typeConstraints()
Return the type constraints of this actor. |
Methods inherited from class ptolemy.actor.AtomicActor |
_actorFiring, _actorFiring, addActorFiringListener, addInitializable, clone, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup |
Methods inherited from class ptolemy.kernel.ComponentEntity |
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName |
Methods inherited from class ptolemy.kernel.Entity |
_description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName |
Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, 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, requestChange, 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 |
output
public TypedIOPort output
- The output port. The type of this port will be the union of the
type of the input ports.
discardEvents
public Parameter discardEvents
- A flag to indicate whether the input events can be discarded.
Its default value is false.
UnionMerge
public UnionMerge(CompositeEntity container,
java.lang.String name)
throws NameDuplicationException,
IllegalActionException
- Construct an actor in the specified container with the specified
name.
- 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.
fire
public void fire()
throws IllegalActionException
- Read the first available tokens from an input port and
send them to the output port. If the discardEvents parameter
is true, consume all the available tokens of the other ports
and discard them. Otherwise, if the other ports have tokens,
request a refiring at the current time to process them.
- Specified by:
fire
in interface Executable
- Overrides:
fire
in class AtomicActor
- Throws:
IllegalActionException
- If there is no director, or
the input can not be read, or the output can not be sent.
typeConstraints
public java.util.Set<Inequality> typeConstraints()
- Return the type constraints of this actor. The type constraint is
that the output type is the union of the types of input ports.
- Specified by:
typeConstraints
in interface TypedActor
- Overrides:
typeConstraints
in class TypedAtomicActor
- Returns:
- a list of Inequality.
- See Also:
Inequality