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 class
NetworkActorBase.Timer
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.HashSet
_timersSet
The set for the timers to be processed when they are expired.protected static int
Ack
protected static java.lang.String[]
AckPacket
protected static int
appl_data_msg
protected static int
appl_interest_msg
protected static int
Busy
protected static java.lang.String[]
cNetwDataMessageFields
protected static java.lang.String[]
cNetwInterestMessageFields
protected static int
Cts
protected static int
Data
protected static java.lang.String[]
DataPacket
protected static int
Error
protected static int
Gilbert
protected static int
Idle
protected static int
netw_data_msg
protected static int
netw_interest_msg
protected static int
NoError
protected static java.lang.String[]
PCRequestMsgFields
protected static java.lang.String[]
PCResponseMsgFields
protected static int
Rts
protected static java.lang.String[]
RtsPacket
protected static int
RxData
protected static int
Rxdelay
protected static int
RxEnd
protected static int
RxStart
protected static java.lang.String[]
StartRspMsgFields
protected static int
Timeout
protected static int
Turnaround
protected static int
TxData
protected static int
TxEnd
protected static int
TxStart
protected static int
TxStartConfirm
protected static int
UNKNOWN
-
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 void
cancelTimer(NetworkActorBase.Timer timerToCancel)
Remove the timer that matches with the timerToCancel argument from the timers set.void
initialize()
Initialize the _timersSet variable.protected NetworkActorBase.Timer
setTimer(int kind, Time expirationTime)
Construct a timer object with the specified kind and expirationTime and add the timer to the timers set.protected int
whoTimeout()
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 IllegalActionException
Initialize the _timersSet variable.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in 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 IllegalActionException
Get 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().
-
-