001/* Interface for actors.
002
003 Copyright (c) 1997-2013 The Regents of the University of California.
004 All rights reserved.
005 Permission is hereby granted, without written agreement and without
006 license or royalty fees, to use, copy, modify, and distribute this
007 software and its documentation for any purpose, provided that the above
008 copyright notice and the following two paragraphs appear in all copies
009 of this software.
010
011 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
012 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
013 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
014 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
015 SUCH DAMAGE.
016
017 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
018 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
019 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
020 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
021 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
022 ENHANCEMENTS, OR MODIFICATIONS.
023
024 PT_COPYRIGHT_VERSION_2
025 COPYRIGHTENDKEY
026
027 */
028package ptolemy.actor;
029
030import java.util.List;
031
032import ptolemy.actor.util.CausalityInterface;
033import ptolemy.kernel.util.IllegalActionException;
034import ptolemy.kernel.util.Nameable;
035
036///////////////////////////////////////////////////////////////////
037//// Actor
038
039/**
040 An Actor is an executable entity. This interface defines the common
041 functionality in AtomicActor and CompositeActor.
042
043 @author Edward A. Lee
044 @version $Id$
045 @since Ptolemy II 0.2
046 @Pt.ProposedRating Green (eal)
047 @Pt.AcceptedRating Green (davisj)
048 @see ptolemy.actor.CompositeActor
049 @see ptolemy.actor.AtomicActor
050 */
051public interface Actor extends Executable, Nameable { // FIXME: parameterize Actor<T extends IOPort>
052    ///////////////////////////////////////////////////////////////////
053    ////                         public methods                    ////
054
055    /** Create receivers for all necessary ports.
056     *  For Atomic Actors this is done for each input port, for
057     *  Composite Actors for both the input and the output ports.
058     *  @exception IllegalActionException If any port throws it.
059     *  @see AtomicActor#createReceivers
060     *  @see CompositeActor#createReceivers
061     */
062    public void createReceivers() throws IllegalActionException;
063
064    /** Return the local director, if there is one, otherwise the executive
065     *  director, if there is one, otherwise null.
066     *  @return The director.
067     */
068    public Director getDirector();
069
070    /** Return the executive director, if there is one, otherwise return null.
071     *  @return The executive director.
072     */
073    public Director getExecutiveDirector();
074
075    /** Return a causality interface for this actor.
076     *  @return A representation of the dependencies between input ports
077     *   and output ports.
078     * @exception IllegalActionException Thrown if causality interface cannot be computed.
079     */
080    public CausalityInterface getCausalityInterface()
081            throws IllegalActionException;
082
083    /** Return the Manager, if there is one. Otherwise, return null.
084     *  @return The Manager.
085     */
086    public Manager getManager();
087
088    /** Return a list of the input ports of this actor.
089     *  Note that implementations should return ports directly
090     *  contained by this actor, whether they are transparent or not.
091     *  @return A list of input IOPort objects.
092     */
093    public List inputPortList();
094
095    /** Return a new receiver of a type compatible with the executive director.
096     *  This is the receiver that should be used by ports of this actor.
097     *  @exception IllegalActionException If there is no director.
098     *  @return A new object implementing the Receiver interface.
099     */
100    public Receiver newReceiver() throws IllegalActionException;
101
102    /** Return a list of the output ports of this actor.
103     *  Note that implementations should return ports directly
104     *  contained by this actor, whether they are transparent or not.
105     *  @return A list of output IOPort objects.
106     */
107    public List outputPortList();
108}