Package ptolemy.actor.util

Examples of ptolemy.actor.util.Time.compareTo()


            _queue.put(input.get(0));
            size.send(0, new IntToken(_queue.size()));
        }

        // If appropriate, produce output.
        if (_queue.size() > 0 && currentTime.compareTo(_nextTimeFree) == 0) {
            Token outputToken = (Token) _queue.take();
            output.send(0, outputToken);
            size.send(0, new IntToken(_queue.size()));
            // Indicate that the server is free.
            _nextTimeFree = Time.NEGATIVE_INFINITY;
View Full Code Here


        Object[] events = _eventQueue.toArray();
        for (int i = 0; i < events.length; i++) {
            DEEvent event = (DEEvent) events[i];
            Time eventTime = event.timeStamp();
            int eventMicrostep = event.microstep();
            if (eventTime.compareTo(getModelTime()) > 0
                    || eventMicrostep > _microstep) {
                aFutureTime = eventTime;
                break;
            }
        }
View Full Code Here

                            // the DE domain has an upper limit on running
                            // time of Double.MAX_VALUE milliseconds.
                            double elapsedTimeInSeconds = elapsedTime / 1000.0;
                            ptolemy.actor.util.Time elapsed
                                    = new ptolemy.actor.util.Time(this, elapsedTimeInSeconds);
                            if (currentTime.compareTo(elapsed) <= 0) {
                                break;
                            }

                            // NOTE: We used to do the following, but it had a limitation.
                            // In particular, if any user code also calculated the elapsed
View Full Code Here

                    _microstep = lastFoundEvent.microstep();
                }

                // Exceeding stop time means the current time is strictly
                // bigger than the model stop time.
                if (currentTime.compareTo(getModelStopTime()) > 0) {
                    if (_debugging) {
                        _debug("Current time has passed the stop time.");
                    }

                    _exceedStopTime = true;
View Full Code Here

        Time currentTime = getDirector().getModelTime();
        _currentOutput = null;

        if (_delayedOutputTokens.size() > 0) {
            if (currentTime.compareTo(_nextTimeFree) == 0) {
                TimedEvent earliestEvent = (TimedEvent) _delayedOutputTokens
                        .get();
                Time eventTime = earliestEvent.timeStamp;

                if (!eventTime.equals(currentTime)) {
View Full Code Here

                // The current time is a break point.
                currentTimeIsABreakpoint = true;

                Time time = (Time) breakPoints.removeFirst();

                if (time.compareTo(now) < 0) {
                    // This should not happen for CTMultisolverDirector,
                    // but it is possible for CTEmbeddedDirector.
                    // When a CT refinement is made inactive for a long time
                    // and reentered, the previously stored breakpoints may
                    // be in the past... The same thing happens in the
View Full Code Here

                                + outsideNextIterationTime,
                        "\nThe current time of this director is " + localTime);
            }

            // Now, check the next iteration time.
            if (outsideNextIterationTime.compareTo(_outsideTime) < 0) {
                // NOTE: This check is redundant. The outside director should
                // guarantee that this never happen.
                throw new IllegalActionException(this, "Outside domain"
                        + " time is going backward."
                        + " Current outside time = " + _outsideTime
View Full Code Here

                    // been updated to the start of the new cycle, which
                    // is too far in the future.
                    if (_phase == 0 && _firstOutputProduced) {
                        Time potentialNextOutputTime = _tentativeCycleStartTime
                                .subtract(_previousPeriod).add(periodValue);
                        if (potentialNextOutputTime.compareTo(getDirector()
                                .getModelTime()) >= 0) {
                            _tentativeNextOutputTime = potentialNextOutputTime;
                            _tentativeCycleStartTime = potentialNextOutputTime;
                            // If this occurs outside fire(), e.g. in a modal
                            // model state transition, we also need to set the _cycleStartTime
View Full Code Here

        // have been disabled in a modal model, or we could have
        // skipped cycles due to not being triggered.
        double periodValue = ((DoubleToken) period.getToken()).doubleValue();
        Time phaseStartTime = _tentativeCycleStartTime
                .add(_offsets[_tentativePhase]);
        while (phaseStartTime.compareTo(currentTime) < 0) {
            _tentativePhase++;
            if (_tentativePhase >= _offsets.length) {
                _tentativePhase = 0;
                _tentativeCycleStartTime = _tentativeCycleStartTime
                        .add(periodValue);
View Full Code Here

        if (_isEmbedded()) {
            CompositeActor container = (CompositeActor) getContainer();
            Time outsideCurrentTime = ((Actor) container)
                    .getExecutiveDirector().getModelTime();

            if (outsideCurrentTime.compareTo(_expectedNextIterationTime) < 0) {
                // not the scheduled time to fire.
                _readyToFire = false;
            } else if (outsideCurrentTime.compareTo(_expectedNextIterationTime) == 0) {
                // the outside time is equal to the expected
                // next iteration time...
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.