001/* Base class for simple sink actors.
002
003 Copyright (c) 1998-2016 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//// Sink
038
039/**
040 Base class for simple data sinks.  This class provides an input port,
041 exposed as a public variable, and a clone method that ensures that the
042 public variable is correctly set in the clone.  The main reason for this
043 class to ensure that the input ports of all sinks have the same name
044 and are correctly handled in cloned actors.
045
046 @author Edward A. Lee
047 @version $Id$
048 @since Ptolemy II 0.3
049 @Pt.ProposedRating Green (eal)
050 @Pt.AcceptedRating Green (bilung)
051 */
052public abstract class Sink extends TypedAtomicActor {
053    /** Construct an actor with an input multiport.
054     *  @param container The container.
055     *  @param name The name of this actor.
056     *  @exception IllegalActionException If the entity cannot be contained
057     *   by the proposed container.
058     *  @exception NameDuplicationException If the container already has an
059     *   actor with this name.
060     */
061    public Sink(CompositeEntity container, String name)
062            throws NameDuplicationException, IllegalActionException {
063        super(container, name);
064        input = new TypedIOPort(this, "input", true, false);
065        input.setMultiport(true);
066    }
067
068    ///////////////////////////////////////////////////////////////////
069    ////                     ports and parameters                  ////
070
071    /** The input port, which is a multiport.
072     */
073    public TypedIOPort input;
074
075    ///////////////////////////////////////////////////////////////////
076    ////                         protected methods                 ////
077
078    // /** Set the input port greater than or equal to
079    //  *  <code>BaseType.GENERAL</code> in case backward type inference is
080    //  *  enabled and the input port has no type declared.
081    //  *
082    //  *  @return A set of inequalities.
083    //  */
084    // @Override
085    // protected Set<Inequality> _customTypeConstraints() {
086    //     HashSet<Inequality> result = new HashSet<Inequality>();
087    //     if (isBackwardTypeInferenceEnabled()
088    //             && input.getTypeTerm().isSettable()) {
089    //         result.add(new Inequality(new TypeConstant(BaseType.GENERAL), input
090    //                 .getTypeTerm()));
091    //     }
092    //     return result;
093    // }
094}