Package ptolemy.domains.tcs.lib
Class AbstractStation
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,Rejecting
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
- Direct Known Subclasses:
InverseStation
,Station
public class AbstractStation extends StationWriter implements Rejecting
This abstract actor models a Station. It receives a train and send it out. If this station is in junction, it should have address of the next stations in form of "symbolId". If it has more than one output channel, then routes the train based on moving map of the train.- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Maryam Bagheri
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description Parameter
broken
True if this station is broken.Parameter
inJunction
True if this is an input junction.TypedIOPort
input
The input port, which is a multiport.Parameter
lineSymbol
The line symbol, which is a string.Parameter
neighbors
The neighbors of this station.TypedIOPort
output
The output port, which is a multiport consisting of RecordTokens.Parameter
settlingTime
The settling time.Parameter
stationId
The station ID.-
Fields inherited from class ptolemy.domains.tcs.lib.StationWriter
_flushValue, _writer, fileName
-
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 AbstractStation(CompositeEntity container, java.lang.String name)
Create a new actor in the specified container with the specified name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
_setIcon(int id)
Change the color of the inner box in station to show the moving train.void
attributeChanged(Attribute attribute)
This method handles changing in the broken and symbol parameter of the station.void
declareDelayDependency()
Set the dependency between all output ports and all input ports of this actor.void
fire()
Do nothing.void
initialize()
Initialize this actor.boolean
reject(Token token, IOPort port)
Return true if the token cannot be accepted at the specified port.-
Methods inherited from class ptolemy.domains.tcs.lib.StationWriter
_writeToken, _writingToFile, clone, preinitialize, wrapup
-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate
-
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, 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
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, removeInitializable
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
input
public TypedIOPort input
The input port, which is a multiport.
-
output
public TypedIOPort output
The output port, which is a multiport consisting of RecordTokens.
-
stationId
public Parameter stationId
The station ID. The initial value is an integer with value -1.
-
settlingTime
public Parameter settlingTime
The settling time. The initial value is an integer with the value 1.
-
lineSymbol
public Parameter lineSymbol
The line symbol, which is a string.
-
inJunction
public Parameter inJunction
True if this is an input junction.
-
broken
public Parameter broken
True if this station is broken.
-
neighbors
public Parameter neighbors
The neighbors of this station. The display name is "idOfNeighborStationOrJunction". The initial value of this parameter is a string consisting of the open curly bracket followed by the close curly bracket: "{}"
-
-
Constructor Detail
-
AbstractStation
public AbstractStation(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Create a new actor in the specified container with the specified name. The name must be unique within the container or an exception is thrown. The container argument must not be null, or a NullPointerException will be thrown.- Parameters:
container
- The container.name
- The name of this actor within the container.- Throws:
IllegalActionException
- If this actor cannot be contained by the proposed container (see the setContainer() method).NameDuplicationException
- If the name coincides with an entity already in the container.
-
-
Method Detail
-
reject
public boolean reject(Token token, IOPort port)
Description copied from interface:Rejecting
Return true if the token cannot be accepted at the specified port.
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
This method handles changing in the broken and symbol parameter of the station. Symbol is the symbol of the line.- Overrides:
attributeChanged
in classStationWriter
- Parameters:
attribute
- The attribute that has changed.- Throws:
IllegalActionException
- If the specified attribute is fileName and the previously opened file cannot be closed.
-
declareDelayDependency
public void declareDelayDependency() throws IllegalActionException
Description copied from class:AtomicActor
Set the dependency between all output ports and all input ports of this actor. By default, each output port is assumed to have a dependency on all input ports. Since this is the assumed behavior, this method does nothing by default. However, for subclasses such asTimeDelay
, where output ports depend on input ports with a time delay, this method should be overridden. Protected method _declareDelayDependency() should be used to declare dependency between input and output ports for this actor.- Overrides:
declareDelayDependency
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- Not thrown in this base class, derived classes should throw this exception if the delay dependency cannot be computed.- See Also:
AtomicActor.getCausalityInterface()
,AtomicActor._declareDelayDependency(IOPort, IOPort, double)
-
fire
public void fire() throws IllegalActionException
Description copied from class:AtomicActor
Do nothing. Derived classes override this method to define their primary run-time action.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classAtomicActor<TypedIOPort>
- Throws:
IllegalActionException
- Not thrown in this base class.
-
initialize
public void initialize() throws IllegalActionException
Description copied from class:StationWriter
Initialize this actor. Derived classes override this method to perform actions that should occur once at the beginning of an execution, but after type resolution. Derived classes can produce output data and schedule events.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classStationWriter
- Throws:
IllegalActionException
- If a derived class throws it.
-
_setIcon
protected void _setIcon(int id) throws IllegalActionException
Change the color of the inner box in station to show the moving train.- Parameters:
id
- The train ID or -1 to indicate no train.- Throws:
IllegalActionException
-
-