ptolemy.domains.sr.lib
Class NonStrictThreeBitAdder
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.domains.sr.lib.NonStrictThreeBitAdder
- All Implemented Interfaces:
- Actor, Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable, TypedActor
- public class NonStrictThreeBitAdder
- extends TypedAtomicActor
A nonstrict three-bit adder. This adder has one input port, which is a
multiport, and two output ports, which are single ports. All of the ports
are of type int, and inputs are outputs are single bits. An exception is
thrown if a number other than 0 or 1 is received as an input, or if there
are not exactly three three channels connected to the input port. This actor
adds the three input bits, and outputs the result to the lowBit and highBit
ports. Only two of the inputs must be known for highBit to be determined.
All inputs are necessary for lowBit to be determined. An absence of a token
is considered to have no contribution to the sum (same as value the zero).
If no input tokens are available at all, then no output is produced.
- Since:
- Ptolemy II 2.0
- Version:
- $Id: NonStrictThreeBitAdder.java,v 1.14.2.1 2004/06/20 03:10:45 cxh Exp $
- Author:
- Paul Whitaker
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
|
Method Summary |
void |
fire()
Add the bits from the input port and output the high bit and low
bit if they can be determined. |
void |
pruneDependencies()
Override the base class to declare that the highBit
and lowBit output ports do not depend on the
inputBits port in a firing. |
| Methods inherited from class ptolemy.actor.AtomicActor |
_createReceivers, clone, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, initialize, inputPortList, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, removeDependency, setContainer, stop, stopFire, terminate, wrapup |
| Methods inherited from class ptolemy.kernel.Entity |
_description, _exportMoMLContents, _removePort, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName, validateSettables |
| 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, 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, requestChange, 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 |
inputBits
public TypedIOPort inputBits
- Inputs for bits to be added. The types are integer, and only
ones and zeros are expected.
highBit
public TypedIOPort highBit
- Output for the high bit. The type is integer, and only ones and
zeros will be sent.
lowBit
public TypedIOPort lowBit
- Output for the low bit. The type is integer, and only ones and
zeros will be sent.
NonStrictThreeBitAdder
public NonStrictThreeBitAdder(CompositeEntity container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
- Construct an actor in the specified container with the specified
name.
- Parameters:
container - The container.name - The name of this adder within the container.
- Throws:
IllegalActionException - If the actor cannot be contained
by the proposed container.
NameDuplicationException - If the name coincides with
an actor already in the container.
fire
public void fire()
throws IllegalActionException
- Add the bits from the input port and output the high bit and low
bit if they can be determined.
- Specified by:
fire in interface Executable- Overrides:
fire in class AtomicActor
- Throws:
IllegalActionException - If there is no director,
if there are not exactly three channels connected to the input,
or if invalid inputs are received.
pruneDependencies
public void pruneDependencies()
- Override the base class to declare that the highBit
and lowBit output ports do not depend on the
inputBits port in a firing.
- Overrides:
pruneDependencies in class AtomicActor
- See Also:
TimedDelay,
AtomicActor.removeDependency(IOPort, IOPort),
FunctionDependencyOfAtomicActor