Package ptolemy.actor.util

Examples of ptolemy.actor.util.Time


        output.broadcast(new DoubleToken(value + increment));
        value += 1.0;

        Director director = getDirector();
        Time time = director.getModelTime();
        count++;

        if (count >= 5) {
            director.fireAt(this, time.add(1.0));
            count = 0;
        } else {
            director.fireAt(this, time);
        }
    }
View Full Code Here


                        TimedEvent event = (TimedEvent) _eventQueue.take();
                        Actor actor = (Actor) event.contents;

                        //Get the resumption time of the newly removed
                        //process.
                        Time newTime = event.timeStamp;

                        //If the resumption time of the newly removed
                        //process is the same as the newly advanced time
                        //then unblock it. Else put the newly removed
                        //process back on the event queue.
                        if (newTime.equals(getModelTime())) {
                            _informOfDelayUnblock();
                        } else {
                            _eventQueue.put(new TimedEvent(newTime, actor));
                            sameTime = false;
                        }
View Full Code Here

     @exception IllegalActionException If the time is earlier than
     *  the current time, or the breakpoint table is null.
     */
    public void fireAt(Actor actor, Time time) throws IllegalActionException {
        // Check if the request time is earlier than the current time.
        Time currentTime = getModelTime();

        if (time.compareTo(currentTime) < 0) {
            throw new IllegalActionException(actor, "Requested fire time: "
                    + time + " is earlier than" + " the current time."
                    + currentTime);
View Full Code Here

     @return True if the Director wants to be fired again in the future.
     *  @exception IllegalActionException If refiring can not be granted.
     */
    public boolean postfire() throws IllegalActionException {
        if (!_isTopLevel() && (getBreakPoints().size() > 0)) {
            Time time = (Time) getBreakPoints().first();
            CompositeActor container = (CompositeActor) getContainer();
            container.getExecutiveDirector().fireAt(container, time);
        }

        boolean postfireReturns = _postfireReturns && !_stopRequested;
View Full Code Here

        // the super class (Director). So, this method must be called
        // after the super.preinitialize() is called.
        // NOTE: _timeBase is not initialized here but in the initialize()
        // method instead in order to provide more accurate real-time
        // information.
        _startTime = new Time(this, _startTimeValue);
        _stopTime = new Time(this, _stopTimeValue);
        _iterationBeginTime = _startTime;
    }
View Full Code Here

     @deprecated Instead of using double as time argument, use a
     *  time object instead. As of Ptolemy 4.1, replaced by
     *  {@link #fireAt(Actor, Time)}
     */
    public void fireAt(Actor actor, double time) throws IllegalActionException {
        fireAt(actor, new Time(this, time));
    }
View Full Code Here

     @return The start time of the model.
     *  @exception IllegalActionException If the specified start time
     *   is invalid.
     */
    public Time getModelStartTime() throws IllegalActionException {
        return new Time(this);
    }
View Full Code Here

     @return The stop time of the model.
     *  @exception IllegalActionException If the specified stop time
     *   is invalid.
     */
    public Time getModelStopTime() throws IllegalActionException {
        return new Time(this, Double.POSITIVE_INFINITY);
    }
View Full Code Here

            Nameable containersContainer = container.getContainer();

            // Initialize the current time.
            if (containersContainer instanceof CompositeActor) {
                // The container is an embedded model.
                Time currentTime = ((CompositeActor) containersContainer)
                        .getDirector().getModelTime();
                _currentTime = currentTime;
            } else {
                // The container is at the top level.
                // There is no reason to set the current time to 0.0.
View Full Code Here

        if (container instanceof Actor) {
            Director executiveDirector = ((Actor) container)
                    .getExecutiveDirector();

            if (executiveDirector != null) {
                Time outTime = executiveDirector.getModelTime();

                if (_currentTime.compareTo(outTime) < 0) {
                    setModelTime(outTime);
                }
            }
View Full Code Here

TOP

Related Classes of ptolemy.actor.util.Time

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.