Class NetworkActorBase
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.InstantiableNamedObj
-
- ptolemy.kernel.Entity<T>
-
- ptolemy.kernel.ComponentEntity<T>
-
- ptolemy.actor.AtomicActor<TypedIOPort>
-
- ptolemy.actor.TypedAtomicActor
-
- ptolemy.domains.wireless.lib.network.NetworkActorBase
-
- All Implemented Interfaces:
java.lang.Cloneable,Actor,Executable,FiringsRecordable,Initializable,TypedActor,Changeable,Debuggable,DebugListener,Derivable,Instantiable,ModelErrorHandler,MoMLExportable,Moveable,Nameable
- Direct Known Subclasses:
MACActorBase,PHY
public class NetworkActorBase extends TypedAtomicActor
This is a base class designed for the Network actors. Currently, it mainly contains several methods for dealing with timers.- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Yang Zhao, Charlie Zhong
- Pt.AcceptedRating:
- Red (pjb2e)
- Pt.ProposedRating:
- Red (ellen_zh)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classNetworkActorBase.Timer-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashSet_timersSetThe set for the timers to be processed when they are expired.protected static intAckprotected static java.lang.String[]AckPacketprotected static intappl_data_msgprotected static intappl_interest_msgprotected static intBusyprotected static java.lang.String[]cNetwDataMessageFieldsprotected static java.lang.String[]cNetwInterestMessageFieldsprotected static intCtsprotected static intDataprotected static java.lang.String[]DataPacketprotected static intErrorprotected static intGilbertprotected static intIdleprotected static intnetw_data_msgprotected static intnetw_interest_msgprotected static intNoErrorprotected static java.lang.String[]PCRequestMsgFieldsprotected static java.lang.String[]PCResponseMsgFieldsprotected static intRtsprotected static java.lang.String[]RtsPacketprotected static intRxDataprotected static intRxdelayprotected static intRxEndprotected static intRxStartprotected static java.lang.String[]StartRspMsgFieldsprotected static intTimeoutprotected static intTurnaroundprotected static intTxDataprotected static intTxEndprotected static intTxStartprotected static intTxStartConfirmprotected static intUNKNOWN-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _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
Constructors Constructor Description NetworkActorBase(CompositeEntity container, java.lang.String name)Construct an actor with the specified name and container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcancelTimer(NetworkActorBase.Timer timerToCancel)Remove the timer that matches with the timerToCancel argument from the timers set.voidinitialize()Initialize the _timersSet variable.protected NetworkActorBase.TimersetTimer(int kind, Time expirationTime)Construct a timer object with the specified kind and expirationTime and add the timer to the timers set.protected intwhoTimeout()Get the timer with expiration time that matches the current time.-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, fire, getCausalityInterface, getDirector, getExecutiveDirector, getManager, 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
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, 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, 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.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
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
-
-
-
-
Field Detail
-
PCRequestMsgFields
protected static final java.lang.String[] PCRequestMsgFields
-
PCResponseMsgFields
protected static final java.lang.String[] PCResponseMsgFields
-
StartRspMsgFields
protected static final java.lang.String[] StartRspMsgFields
-
cNetwInterestMessageFields
protected static final java.lang.String[] cNetwInterestMessageFields
-
cNetwDataMessageFields
protected static final java.lang.String[] cNetwDataMessageFields
-
DataPacket
protected static final java.lang.String[] DataPacket
-
RtsPacket
protected static final java.lang.String[] RtsPacket
-
AckPacket
protected static final java.lang.String[] AckPacket
-
RxStart
protected static final int RxStart
- See Also:
- Constant Field Values
-
RxEnd
protected static final int RxEnd
- See Also:
- Constant Field Values
-
RxData
protected static final int RxData
- See Also:
- Constant Field Values
-
TxStart
protected static final int TxStart
- See Also:
- Constant Field Values
-
TxStartConfirm
protected static final int TxStartConfirm
- See Also:
- Constant Field Values
-
TxData
protected static final int TxData
- See Also:
- Constant Field Values
-
TxEnd
protected static final int TxEnd
- See Also:
- Constant Field Values
-
Idle
protected static final int Idle
- See Also:
- Constant Field Values
-
Busy
protected static final int Busy
- See Also:
- Constant Field Values
-
NoError
protected static final int NoError
- See Also:
- Constant Field Values
-
Error
protected static final int Error
- See Also:
- Constant Field Values
-
UNKNOWN
protected static final int UNKNOWN
- See Also:
- Constant Field Values
-
Timeout
protected static final int Timeout
- See Also:
- Constant Field Values
-
Gilbert
protected static final int Gilbert
- See Also:
- Constant Field Values
-
Turnaround
protected static final int Turnaround
- See Also:
- Constant Field Values
-
Rxdelay
protected static final int Rxdelay
- See Also:
- Constant Field Values
-
appl_interest_msg
protected static final int appl_interest_msg
- See Also:
- Constant Field Values
-
appl_data_msg
protected static final int appl_data_msg
- See Also:
- Constant Field Values
-
netw_interest_msg
protected static final int netw_interest_msg
- See Also:
- Constant Field Values
-
netw_data_msg
protected static final int netw_data_msg
- See Also:
- Constant Field Values
-
Cts
protected static final int Cts
- See Also:
- Constant Field Values
-
Data
protected static final int Data
- See Also:
- Constant Field Values
-
Rts
protected static final int Rts
- See Also:
- Constant Field Values
-
Ack
protected static final int Ack
- See Also:
- Constant Field Values
-
_timersSet
protected java.util.HashSet _timersSet
The set for the timers to be processed when they are expired.
-
-
Constructor Detail
-
NetworkActorBase
public NetworkActorBase(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Construct an actor with the specified name and container. The container argument must not be null, or a NullPointerException will be thrown. If the name argument is null, then the name is set to the empty string. This constructor write-synchronizes on the workspace.- Parameters:
container- The container.name- The name of the actor.- Throws:
IllegalActionException- If the container is incompatible with this actor.NameDuplicationException- If the name coincides with an actor already in the container.
-
-
Method Detail
-
initialize
public void initialize() throws IllegalActionExceptionInitialize the _timersSet variable.- Specified by:
initializein interfaceInitializable- Overrides:
initializein classAtomicActor<TypedIOPort>- Throws:
IllegalActionException- If thrown by the base class.
-
setTimer
protected NetworkActorBase.Timer setTimer(int kind, Time expirationTime) throws IllegalActionException
Construct a timer object with the specified kind and expirationTime and add the timer to the timers set.- Returns:
- return the created timer to the caller method (make it easy for it to cancel the timer).
- Throws:
IllegalActionException- If thrown by getDirector().fireAt().
-
cancelTimer
protected void cancelTimer(NetworkActorBase.Timer timerToCancel) throws IllegalActionException
Remove the timer that matches with the timerToCancel argument from the timers set. If no match is found, do nothing.- Throws:
IllegalActionException
-
whoTimeout
protected int whoTimeout() throws IllegalActionExceptionGet the timer with expiration time that matches the current time. Remove the timer from the timers set and return the kind parameter of the timer to the caller method. If there are multiple timers with expiration time matching the current time, return the first one from the iterator list.- Returns:
- return the kind parameter of the timeout timer.
- Throws:
IllegalActionException- If thrown by getDirector().getCurrentTime().
-
-