001/* DummyDisplay is a simple sink implementing the BufferingProfile interface.
002It is used for testing the OptimizingSDFDirector.
003
004 Copyright (c) 1997-2014 The Regents of the University of California.
005 All rights reserved.
006 Permission is hereby granted, without written agreement and without
007 license or royalty fees, to use, copy, modify, and distribute this
008 software and its documentation for any purpose, provided that the above
009 copyright notice and the following two paragraphs appear in all copies
010 of this software.
011
012 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
013 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
014 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
015 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
016 SUCH DAMAGE.
017
018 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
019 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
020 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
021 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
022 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
023 ENHANCEMENTS, OR MODIFICATIONS.
024 PT_COPYRIGHT_VERSION_2
025 COPYRIGHTENDKEY
026
027 */
028
029package ptolemy.domains.sdf.optimize.lib;
030
031import ptolemy.actor.lib.Sink;
032import ptolemy.domains.sdf.optimize.BufferingProfile;
033import ptolemy.kernel.CompositeEntity;
034import ptolemy.kernel.util.IllegalActionException;
035import ptolemy.kernel.util.NameDuplicationException;
036
037/**
038<h1>Class comments</h1>
039A DummyDisplay is a simple sink implementing the BufferingProfile interface.
040It is used for testing the OptimizingSDFDirector.
041<p>
042See {@link ptolemy.domains.sdf.optimize.OptimizingSDFDirector},
043{@link ptolemy.domains.sdf.optimize.OptimizingSDFScheduler} and
044{@link ptolemy.domains.sdf.optimize.BufferingProfile} for more information.
045</p>
046@see ptolemy.domains.sdf.optimize.OptimizingSDFDirector
047@see ptolemy.domains.sdf.optimize.OptimizingSDFScheduler
048@see ptolemy.domains.sdf.optimize.BufferingProfile
049
050@author Marc Geilen
051@version $Id$
052@since Ptolemy II 10.0
053@Pt.ProposedRating Red (mgeilen)
054@Pt.AcceptedRating Red ()
055 */
056
057public class DummyDisplay extends Sink implements BufferingProfile {
058
059    /**
060     * Create an instance of a testing actor to mimic a display sink actor.
061     *
062     * @param container The container.
063     * @param name The name of this actor.
064     * @exception IllegalActionException If the entity cannot be contained
065     *  by the proposed container.
066     * @exception NameDuplicationException If the container already has an
067     *  actor with this name.
068     */
069    public DummyDisplay(CompositeEntity container, String name)
070            throws NameDuplicationException, IllegalActionException {
071        super(container, name);
072    }
073
074    /**
075     *  Iterates the dummy display actor.
076     *  @param iterationCount The number of iterations to perform.
077     *  @param fireExclusive Indicates whether firing is exclusive.
078     *  @return NOT_READY, STOP_ITERATING, or COMPLETED.
079     *  @exception IllegalActionException If iterating is not
080     *   permitted, or if prefire(), fire(), or postfire() throw it.
081     */
082    @Override
083    public int iterate(int iterationCount, boolean fireExclusive)
084            throws IllegalActionException {
085        return super.iterate(iterationCount);
086    }
087
088    /**
089     * Provides the buffering profile, number of buffers required for a shared firing.
090     * @return number of buffers for shared firing
091     */
092    @Override
093    public int sharedBuffers() {
094        return 0;
095    }
096
097    /**
098     * Provides the buffering profile, number of buffers required for an exclusive firing.
099     * @return number of buffers for exclusive firing
100     */
101    @Override
102    public int exclusiveBuffers() {
103        return 0;
104    }
105
106    /**
107     * Provides the buffering profile, execution time estimate required for a shared firing.
108     * @return execution time for shared firing
109     */
110    @Override
111    public int sharedExecutionTime() {
112        return 1;
113    }
114
115    /**
116     * Provides the buffering profile, execution time estimate required for an exclusive
117     * firing.
118     * @return execution time for exclusive firing
119     */
120    @Override
121    public int exclusiveExecutionTime() {
122        return 1;
123    }
124
125}