001/* A base class for actors that transform an input stream into an output stream.
002
003 Copyright (c) 1998-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.lib;
029
030import ptolemy.actor.TypedAtomicActor;
031import ptolemy.actor.TypedIOPort;
032import ptolemy.kernel.CompositeEntity;
033import ptolemy.kernel.util.IllegalActionException;
034import ptolemy.kernel.util.NameDuplicationException;
035
036///////////////////////////////////////////////////////////////////
037//// Transformer
038
039/**
040 This is an abstract base class for actors that transform
041 an input stream into an output stream.  It provides an input
042 and an output port, and manages the cloning of these ports.
043
044 @author Edward A. Lee
045 @version $Id$
046 @since Ptolemy II 0.3
047 @Pt.ProposedRating Green (eal)
048 @Pt.AcceptedRating Green (bilung)
049 */
050public class Transformer extends TypedAtomicActor {
051    /** Construct an actor with the given container and name.
052     *  @param container The container.
053     *  @param name The name of this actor.
054     *  @exception IllegalActionException If the actor cannot be contained
055     *   by the proposed container.
056     *  @exception NameDuplicationException If the container already has an
057     *   actor with this name.
058     */
059    public Transformer(CompositeEntity container, String name)
060            throws NameDuplicationException, IllegalActionException {
061        super(container, name);
062
063        input = new TypedIOPort(this, "input", true, false);
064        output = new TypedIOPort(this, "output", false, true);
065    }
066
067    ///////////////////////////////////////////////////////////////////
068    ////                     ports and parameters                  ////
069
070    /** The input port.  This base class imposes no type constraints except
071     *  that the type of the input cannot be greater than the type of the
072     *  output.
073     */
074    public TypedIOPort input;
075
076    /** The output port. By default, the type of this output is constrained
077     *  to be at least that of the input.
078     */
079    public TypedIOPort output;
080}