Package ptolemy.graph.sched
Class Firing
- java.lang.Object
-
- ptolemy.graph.sched.ScheduleElement
-
- ptolemy.graph.sched.Firing
-
public class Firing extends ScheduleElement
This class is a ScheduleElement that contains a reference to a firing element. The firingElement could be any Object. This class is used together with the Schedule class to construct a Schedule. The setFiringElement() method is used to create the reference to a firing element. The getFiringElement() method will return a reference to this firing element.It is more efficient to use this class than to simply maintain a list of firing elements since firing elements will often firing multiple times consecutively. Using this class (and the Schedule data structure in general) greatly reduces the memory requirements of most large schedules.
- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Shahrooz Shahparnia, Mingyung Ko, University of Maryland at College Park based on a file by Brian K. Vogel, Steve Neuendorffer
- See Also:
Firing
,Schedule
,ScheduleElement
- Pt.AcceptedRating:
- red (ssb)
- Pt.ProposedRating:
- red (shahrooz)
-
-
Field Summary
-
Fields inherited from class ptolemy.graph.sched.ScheduleElement
_parent
-
-
Constructor Summary
Constructors Constructor Description Firing()
Construct a firing with a default iteration count equal to one and with no parent schedule.Firing(java.lang.Class firingElementClass)
Construct a firing with a given firing element type, an iteration count equal to one and no parent schedule.Firing(java.lang.Object firingElement)
Construct a firing with a firingElement, an iteration count equal to one and no parent schedule.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Iterator
firingElementIterator()
Return the firing element invocation sequence of the schedule in the form of a sequence of firing elements.java.util.Iterator
firingIterator()
Return the firing element invocation sequence in the form of a sequence of firings.java.lang.Object
getFiringElement()
Get the firing element associated with this Firing.void
setFiringElement(java.lang.Object firingElement)
Set the firing element associated with this firing.java.lang.String
toParenthesisString(java.util.Map nameMap, java.lang.String delimiter)
Print the firing in a parenthesis style.java.lang.String
toString()
Return a string representation of this Firing.-
Methods inherited from class ptolemy.graph.sched.ScheduleElement
_getVersion, _incrementVersion, firingElementClass, getIterationCount, getParent, setIterationCount, setParent, toParenthesisString
-
-
-
-
Constructor Detail
-
Firing
public Firing()
Construct a firing with a default iteration count equal to one and with no parent schedule.
-
Firing
public Firing(java.lang.Object firingElement)
Construct a firing with a firingElement, an iteration count equal to one and no parent schedule. A Firing constructed using this constructor, using the setFiringElement() method, will only accept firing elements with the same class type as the given firingElement, using the setFiringElement() method.- Parameters:
firingElement
- The firing element in the firing.
-
Firing
public Firing(java.lang.Class firingElementClass)
Construct a firing with a given firing element type, an iteration count equal to one and no parent schedule. In a Firing constructed using this constructor, the setFiringElement() method, will only accept firing elements with the same given class type, using the setFiringElement() method.- Parameters:
firingElementClass
- The class of the firing element in the firing.
-
-
Method Detail
-
firingElementIterator
public java.util.Iterator firingElementIterator()
Return the firing element invocation sequence of the schedule in the form of a sequence of firing elements. For a valid schedule, all of the lowest-level nodes should be an instance of Firing. If the schedule is not valid, then the returned iterator will contain null elements.A runtime exception is thrown if the underlying schedule structure is modified while the iterator is active.
- Specified by:
firingElementIterator
in classScheduleElement
- Returns:
- An iterator over a sequence of firing elements.
- Throws:
java.util.ConcurrentModificationException
- If the underlying schedule structure is modified while the iterator is active.
-
firingIterator
public java.util.Iterator firingIterator()
Return the firing element invocation sequence in the form of a sequence of firings. Since this ScheduleElement is a Firing, the iterator returned will contain exactly one Firing (this Firing).A runtime exception is thrown if the underlying schedule structure is modified while the iterator is active.
- Specified by:
firingIterator
in classScheduleElement
- Returns:
- An iterator over a sequence of firings.
- Throws:
java.util.ConcurrentModificationException
- If the underlying schedule structure is modified while the iterator is active.
-
getFiringElement
public java.lang.Object getFiringElement()
Get the firing element associated with this Firing. The setFiringElement() method is used to set the firing element that this method returns. If setFiringElement() was never called, then throw an exception.- Returns:
- The actor associated with this Firing.
- See Also:
setFiringElement(Object)
-
setFiringElement
public void setFiringElement(java.lang.Object firingElement)
Set the firing element associated with this firing. This firing element will then be returned when the getFiringElement() method is invoked. If this firing already contains a reference to a firing element, then the reference will overwritten.- Parameters:
firingElement
- The firing element to associate with this firing.- See Also:
getFiringElement()
-
toParenthesisString
public java.lang.String toParenthesisString(java.util.Map nameMap, java.lang.String delimiter)
Print the firing in a parenthesis style.- Specified by:
toParenthesisString
in classScheduleElement
- Parameters:
nameMap
- A mapping from firing element to its short name.delimiter
- The delimiter between iteration count and iterand.- Returns:
- The parenthesis expression for this firing.
-
toString
public java.lang.String toString()
Return a string representation of this Firing.- Overrides:
toString
in classjava.lang.Object
- Returns:
- Return a string representation of this Firing.
-
-