public class Server extends DETransformer
The service time and priority used for a job are the most recently arrived values prior to or simultaneous with the arrival of the job (not with the time at which service begins). Thus, if you want each job to have an independent service time or priority, you should provide each parameter as an input synchronized with each new job arrival.
TimeDelayEntity.ContainedObjectsIterator| Modifier and Type | Field and Description |
|---|---|
protected Time |
_nextTimeFree
Next time the server becomes free.
|
protected long |
_queueCounter
The counter for tie-breaking the queue by insertion order.
|
protected java.util.TreeMap<java.lang.Double,java.util.PriorityQueue<ptolemy.domains.de.lib.Server.Job>> |
_queues |
protected int |
_queueSize |
Parameter |
capacity
The capacity of the queue.
|
PortParameter |
priority
The priority.
|
PortParameter |
serviceTime
The service time.
|
TypedIOPort |
size
The current size of the queue.
|
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 |
|---|
Server(CompositeEntity container,
java.lang.String name)
Construct an actor with the specified container and name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
attributeChanged(Attribute attribute)
If the attribute is serviceTime, then ensure that the value
is non-negative, and if the attribute is
capacity, then change the capacity of the queue.
|
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace.
|
void |
declareDelayDependency()
Declare that the output does not depend on
the input, serviceTime, and priority, in a firing.
|
void |
fire()
If there is input, read it and put it in the queue.
|
void |
initialize()
Reset the states of the server to indicate that the server is ready
to serve.
|
boolean |
postfire()
If the server is free and there is at least one token in the queue,
request a firing at the current time plus the service time.
|
protected int |
queueSize() |
void |
wrapup()
Clear the queue so that the capacity can be changed.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate_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, prefire, stop, stopFire, terminateaddInitializable, preinitialize, removeInitializabledescription, getContainer, getDisplayName, getFullName, getName, getName, setNamegetDerivedLevel, getDerivedList, propagateValuepublic Parameter capacity
public TypedIOPort size
public PortParameter serviceTime
public PortParameter priority
protected Time _nextTimeFree
protected java.util.TreeMap<java.lang.Double,java.util.PriorityQueue<ptolemy.domains.de.lib.Server.Job>> _queues
protected int _queueSize
protected long _queueCounter
public Server(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container - The composite entity to contain this one.name - The name of this actor.IllegalActionException - If the entity 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 service time is negative.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone in class TypedAtomicActorworkspace - The workspace for the new object.java.lang.CloneNotSupportedException - If a derived class has
has an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String),
NamedObj.setDeferringChangeRequests(boolean)public void declareDelayDependency() throws IllegalActionException
declareDelayDependency in class AtomicActor<TypedIOPort>IllegalActionException - If the causality interface
cannot be computed.AtomicActor.getCausalityInterface()public void fire() throws IllegalActionException
fire in interface Executablefire in class AtomicActor<TypedIOPort>IllegalActionException - If the serviceTime
or priority is invalid, or if an error occurs sending
the output token.protected int queueSize()
public void initialize() throws IllegalActionException
initialize in interface Initializableinitialize in class AtomicActor<TypedIOPort>IllegalActionException - If the base class throws it.public boolean postfire() throws IllegalActionException
postfire in interface Executablepostfire in class AtomicActor<TypedIOPort>IllegalActionException - If there is no director.public void wrapup() throws IllegalActionException
wrapup in interface Initializablewrapup in class AtomicActor<TypedIOPort>IllegalActionException - If the superclass throws it.