|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.Relation
ptolemy.kernel.ComponentRelation
ptolemy.domains.modal.kernel.Transition
ptolemy.domains.ptera.kernel.SchedulingRelation
public class SchedulingRelation
A scheduling relation is an edge from one Ptera event to another. If it is not a cancelling edge, then processing the event at the starting point of the edge causes the one at the end point to be scheduled after a certain amount of model-time delay, if the guard of the scheduling relation is satisfied. If it is a cancelling edge, then processing the first event causes the second one to be cancelled if it is already scheduled in the containing Ptera controller's event queue.
A scheduling relation may carry argument values to be supplied to the event to be scheduled, who has parameters defined on it. The number and types of the evaluated arguments must match those of the parameters declared by the event.
If the guard of a scheduling relation is omitted, it is defaulted to true, which means the scheduling relation is unconditional.
A scheduling relation can be assigned a priority, which is an integer number. The default priority is 0. Priorities are used to order the scheduling relations from the same event. Scheduling relations with higher priorities (smaller priority numbers) are scheduled before those with lower priorities from the same event, if they are scheduled at exactly the same time in the future.
Red (tfeng) |
Yellow (tfeng) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
private ASTPtRootNode |
_argumentsTree
The parse tree of arguments. |
private long |
_argumentsTreeVersion
Version of _argumentsTree. |
private ASTPtRootNode |
_delayTree
The parse tree of delay. |
private long |
_delayTreeVersion
Version of _delayTree. |
private ParseTreeEvaluator |
_parseTreeEvaluator
The evaluated to evaluate all parse trees. |
private static java.lang.String[] |
_ZERO_CONSTS
An array of all recognizable constant values that equal to 0.0d. |
StringAttribute |
arguments
The attribute for arguments. |
Parameter |
canceling
A Boolean-valued parameter that defines whether this scheduling relation is cancelling. |
StringAttribute |
delay
The attribute for the model-time delay. |
Priority |
priority
The priority of this scheduling relation. |
StringParameter |
triggers
A comma-separated list of port names and variable names to be monitored. |
Fields inherited from class ptolemy.domains.modal.kernel.Transition |
---|
annotation, defaultTransition, exitAngle, gamma, guardExpression, nondeterministic, outputActions, preemptive, refinementName, reset, setActions |
Fields inherited from class ptolemy.kernel.Relation |
---|
_linkList |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Constructor Summary | |
---|---|
SchedulingRelation(PteraController container,
java.lang.String name)
Construct a scheduling relation with the given name contained by the specified entity. |
Method Summary | |
---|---|
private boolean |
_isZero(java.lang.String expression)
Return whether the given expression is statically equal to 0.0. |
private void |
_parseArguments()
Parse the arguments. |
private void |
_parseDelay()
Parse the delay. |
void |
attributeChanged(Attribute attribute)
React to a change in an attribute. |
java.lang.Object |
clone(Workspace workspace)
Clone the scheduling relation into the specified workspace. |
Token |
getArguments(ParserScope scope)
Evaluate the parse tree of the arguments and return an ArrayToken or RecordToken that contains the values of those arguments in the given parser scope. |
double |
getDelay(ParserScope scope)
Evaluate the delay parameter in the given parse scope and return its value. |
java.lang.String |
getLabel()
Return a string describing this scheduling relation. |
java.util.List<NamedObj> |
getTriggers()
Get the list of ports or variables referred to in the triggers attributes. |
boolean |
isCanceling()
Return whether this scheduling relation is cancelling. |
boolean |
isEnabled(ParserScope scope)
Evaluate the guard in the given parser scope, and return whether this scheduling relation is enabled (with its guard evaluated to true). |
Methods inherited from class ptolemy.domains.modal.kernel.Transition |
---|
_checkPort, choiceActionList, commitActionList, destinationState, getGuardExpression, getParseTreeEvaluator, getRefinement, isDefault, isEnabled, isNondeterministic, isPreemptive, setContainer, setGuardExpression, sourceState |
Methods inherited from class ptolemy.kernel.ComponentRelation |
---|
_checkContainer, _checkRelation, _propagateExistence, deepLinkedPortList, deepLinkedPorts, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, unlinkAll |
Methods inherited from class ptolemy.kernel.Relation |
---|
_description, _getContainedObject, link, linkedObjectsList, linkedPortList, linkedPortList, linkedPorts, linkedPorts, numLinks, relationGroupList, unlink |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public StringAttribute arguments
public Parameter canceling
public StringAttribute delay
public Priority priority
public StringParameter triggers
private static final java.lang.String[] _ZERO_CONSTS
private ASTPtRootNode _argumentsTree
private long _argumentsTreeVersion
private ASTPtRootNode _delayTree
private long _delayTreeVersion
private ParseTreeEvaluator _parseTreeEvaluator
Constructor Detail |
---|
public SchedulingRelation(PteraController container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of the scheduling relation.
IllegalActionException
- If the container is incompatible
with this scheduling relation.
NameDuplicationException
- If the name coincides with
any relation already in the container.Method Detail |
---|
public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class Transition
attribute
- The attribute that changed.
IllegalActionException
- If thrown by the superclass
attributeChanged() method, or the changed attribute is the
arguments parameter or the delay parameter and is given
an expression that does not evaluate to a boolean value, or this
scheduling relation is set to cancelling but the values of
arguments and delay are not acceptable.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class Transition
workspace
- The workspace for the new scheduling relation.
java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public Token getArguments(ParserScope scope) throws IllegalActionException
scope
- The parser scope in which the arguments are evaluated.
ArrayToken
or RecordToken
.
IllegalActionException
- If the evaluation is unsuccessful.public double getDelay(ParserScope scope) throws IllegalActionException
scope
- The parser scope in which the delay is evaluated.
IllegalActionException
- If the evaluation is unsuccessful.public java.lang.String getLabel()
getLabel
in class Transition
public java.util.List<NamedObj> getTriggers() throws IllegalActionException
IllegalActionException
- If the value of the triggers parameter
cannot be obtained.public boolean isCanceling()
public boolean isEnabled(ParserScope scope) throws IllegalActionException
isEnabled
in class Transition
scope
- The parser scope in which the guard is to be evaluated.
IllegalActionException
- If thrown when evaluating the guard.private boolean _isZero(java.lang.String expression)
expression
- The expression.
private void _parseArguments() throws IllegalActionException
IllegalActionException
- If thrown when when parsing the
arguments.private void _parseDelay() throws IllegalActionException
IllegalActionException
- If thrown when when parsing the delay.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |