001/* This is an interface for an execution aspect.
002
003@Copyright (c) 2008-2013 The Regents of the University of California.
004All rights reserved.
005
006Permission is hereby granted, without written agreement and without
007license or royalty fees, to use, copy, modify, and distribute this
008software and its documentation for any purpose, provided that the
009above copyright notice and the following two paragraphs appear in all
010copies of this software.
011
012IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
013FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
014ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
015THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
016SUCH DAMAGE.
017
018THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
019INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
020MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
021PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
022CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
023ENHANCEMENTS, OR MODIFICATIONS.
024
025                                                PT_COPYRIGHT_VERSION_2
026                                                COPYRIGHTENDKEY
027
028
029 */
030
031package ptolemy.actor;
032
033import java.util.List;
034
035import ptolemy.kernel.util.NamedObj;
036
037/** This is an interface for an execution aspect. Classes that implement
038 *  this interface are interested in schedule events created by
039 *  resource schedulers.
040 *
041 * @author Patricia Derler
042   @version $Id$
043   @since Ptolemy II 10.0
044
045   @Pt.ProposedRating Red (derler)
046   @Pt.AcceptedRating Red (derler)
047 */
048public interface ExecutionAspectListener {
049
050    ///////////////////////////////////////////////////////////////////
051    //                         public variables                      //
052
053    /** Execution time event types. */
054    public static enum ExecutionEventType {
055    /** Started the execution of an actor. */
056    START,
057    /** Stopped the execution of an actor. */
058    STOP,
059    /** Preempted the execution of an actor. */
060    PREEMPTED
061    }
062
063    /** Initialize listener.
064     * @param actors Actors to be scheduled.
065     * @param scheduler Resource scheduler scheduling actors.
066     */
067    public void initialize(List<NamedObj> actors,
068            ActorExecutionAspect scheduler);
069
070    /** Plot a new execution event for an actor (i.e. an actor
071     *  started/finished execution, was preempted or resumed).
072     * @param actor The actor.
073     * @param physicalTime The physical time when this scheduling event occurred.
074     * @param scheduleEvent The scheduling event.
075     */
076    public void event(final NamedObj actor, double physicalTime,
077            ExecutionEventType scheduleEvent);
078}