public class LogicGate extends Transformer
Produce an output token on each firing with a value that is equal to the specified logic operator of the input(s). The functions are:
NOTE: All operators have a single input port, which is a multiport, and a single output port, which is not a multiport. All ports have type boolean.
This actor does not require that each input channel have a token upon firing. As long as one channel contains a token, output will be produced. If no input tokens are available at all, then no output is produced. At most one token is consumed on each input channel.
| Green (pwhitake) |
| Green (pwhitake) |
Entity.ContainedObjectsIterator| Modifier and Type | Field and Description |
|---|---|
protected static int |
_AND
Perform a logical AND.
|
protected int |
_function
An indicator for the function to compute.
|
protected boolean |
_negate
True if the intermediate results should be negated.
|
protected static int |
_OR
Perform a logical OR.
|
protected static int |
_XOR
Perform a logical XOR.
|
StringParameter |
logic
The function to compute.
|
input, output_typesValid_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKSCOMPLETED, NOT_READY, STOP_ITERATING| Constructor and Description |
|---|
LogicGate(CompositeEntity container,
java.lang.String name)
Construct an actor with the given container and name.
|
| Modifier and Type | Method and Description |
|---|---|
protected BooleanToken |
_updateFunction(BooleanToken in,
BooleanToken old)
Calculate the function on the given arguments.
|
void |
attributeChanged(Attribute attribute)
Override the base class to determine which function is being
specified.
|
void |
fire()
Consume at most one input token from each input channel,
and produce a token on the output port.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, 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_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, decorators, 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, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspaceequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreateReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortListisFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminateaddInitializable, initialize, preinitialize, removeInitializable, wrapupdescription, getContainer, getDisplayName, getFullName, getName, getName, setNamegetDerivedLevel, getDerivedList, propagateValuepublic StringParameter logic
protected int _function
protected boolean _negate
protected static final int _AND
protected static final int _OR
protected static final int _XOR
public LogicGate(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container - The container.name - The name of this actor.IllegalActionException - If the actor cannot be contained
by the proposed container.NameDuplicationException - If the container already has an
actor with this name.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged in class NamedObjattribute - The attribute that changed.IllegalActionException - If the function is not recognized.public void fire()
throws IllegalActionException
fire in interface Executablefire in class AtomicActor<TypedIOPort>IllegalActionException - If there is no director.protected BooleanToken _updateFunction(BooleanToken in, BooleanToken old) throws IllegalActionException
in - The new input value. Should never be null.old - The old result value, or null if there is none.IllegalActionException - If thrown by BooleanToken operations.