001/* Generate discrete events at prespecified time instants.
002
003 Copyright (c) 1998-2014 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.domains.continuous.lib;
029
030import ptolemy.kernel.CompositeEntity;
031import ptolemy.kernel.util.IllegalActionException;
032import ptolemy.kernel.util.NameDuplicationException;
033
034//////////////////////////////////////////////////////////////////////////
035//// DiscreteClock
036
037/**
038 Produce a periodic signal, a sequence of events at regularly spaced
039 intervals.
040
041 <p>This actor is identical to {@link ptolemy.actor.lib.DiscreteClock},
042 except that for backward compatibility the default values of the parameters
043 are changed to</p>
044 <ul>
045 <li> period: 2.0</li>
046 <li> offsets: {0.0, 1.0}</li>
047 <li> values {1, 0}</li>
048 </ul>
049
050 @author Haiyang Zheng and Edward A. Lee
051 @version $Id$
052 @since Ptolemy II 6.0
053 @Pt.ProposedRating Yellow (hyzheng)
054 @Pt.AcceptedRating Yellow (hyzheng)
055 @deprecated Use ptolemy.actor.lib.DiscreteClock instead.
056 */
057@Deprecated
058public class DiscreteClock extends ptolemy.actor.lib.DiscreteClock {
059
060    // This actor only generates predictable events and that is why it does not
061    // implement the ContinuousStepSizeControlActor interface. This actor requests a
062    // refiring at its initialize method to produce events. During its postfire
063    // method, it requests further firings to produce more events if necessary.
064
065    /** Construct an actor in the specified container with the specified
066     *  name.  The name must be unique within the container or an exception
067     *  is thrown. The container argument must not be null, or a
068     *  NullPointerException will be thrown.
069     *  @param container The container.
070     *  @param name The actor's name
071     *  @exception IllegalActionException If the entity cannot be contained
072     *   by the proposed container.
073     *  @exception NameDuplicationException If name coincides with
074     *   an entity already in the container.
075     */
076    public DiscreteClock(CompositeEntity container, String name)
077            throws IllegalActionException, NameDuplicationException {
078        super(container, name);
079        period.setExpression("2.0");
080        offsets.setExpression("{0.0, 1.0}");
081        values.setExpression("{1, 0}");
082    }
083}