001/* This actor implements a Network Bus.
002
003@Copyright (c) 2010-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
033/** This interface defines a listener for communication aspects.
034 *
035 *  @author Patricia Derler
036 *  @version $Id$
037 *  @since Ptolemy II 10.0
038 *  @Pt.ProposedRating Yellow (derler)
039 *  @Pt.AcceptedRating Red (derler)
040 */
041public interface CommunicationAspectListener {
042
043    /** The event that is sent by the communication aspect and processed
044     *  by the listener.
045     *  @param communicationAspect The communication aspect that sent the event.
046     *  @param source The source actor that caused the event in the
047     *      communication aspect.
048     *  @param messageId The ID of the message that caused the event in
049     *      the communication aspect.
050     *  @param messageCnt The amount of messages currently being processed
051     *      by the communication aspect.
052     *  @param eventType The type of the event.
053     *  @param time The timestamp of the event.
054     */
055    public void event(CommunicationAspect communicationAspect, Actor source,
056            int messageId, int messageCnt, double time, EventType eventType);
057
058    /** Type of the event. */
059    public static enum EventType {
060                /** Token was received. */
061                RECEIVED,
062                /** Token was sent. */
063                SENT
064    }
065
066}