001/* Interface for attributes that regulate the passage of time.
002
003 Copyright (c) 2007-2015 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 */
027package ptolemy.actor;
028
029import ptolemy.actor.util.Time;
030import ptolemy.kernel.util.IllegalActionException;
031
032///////////////////////////////////////////////////////////////////
033//// TimeRegulator
034
035/**
036 This interface is implemented by attributes that wish to be consulted
037 when a director advances time. In particular, the director will call
038 the one method in this interface, passing it a proposed time to advance to,
039 and the method will return either the same proposed time or
040 a smaller time. The method may not return immediately. For example,
041 it might wait for real time to advance to the proposed time, and then
042 simply return the proposed time.
043
044 @author Edward A. Lee, Gilles Lasnier, Patricia Derler
045 @version $Id$
046 @since Ptolemy II 10.0
047 @Pt.ProposedRating Yellow (eal)
048 @Pt.AcceptedRating Red (cxh)
049 */
050public interface TimeRegulator {
051
052    ///////////////////////////////////////////////////////////////////
053    ////                         public methods                    ////
054
055    /** Propose a time to advance to.
056     *  @param proposedTime The proposed time.
057     *  @return The proposed time or a smaller time.
058     *  @exception IllegalActionException If the time regulator is being misused.
059     */
060    public Time proposeTime(Time proposedTime) throws IllegalActionException;
061
062    /** Return false if change requests have been posted while
063        during the call to proposeTime.
064    * @return false is ChangeRequest has been queued for a new actor
065    */
066    public boolean noNewActors();
067}