Examples of FixedPointDirector


Examples of ptolemy.actor.sched.FixedPointDirector

     *   fireAt() method of the director throws it.
     */
    public synchronized void initialize() throws IllegalActionException {
        super.initialize();

        FixedPointDirector director = (FixedPointDirector) getDirector();

        _cycleStartTime = director.getModelTime();
        _nextOutputIndex = 1;
        _phase = 0;
        _readyToFire = true;

        // Schedule the first firing.
        _nextOutputTime = _cycleStartTime.add(_offsets[0]);
        director.fireAt(this, _nextOutputTime);
    }
View Full Code Here

Examples of ptolemy.actor.sched.FixedPointDirector

    public boolean postfire() throws IllegalActionException {
        if (!_readyToFire) {
            return true;
        }

        FixedPointDirector director = (FixedPointDirector) getDirector();
        double periodValue = ((DoubleToken) period.getToken()).doubleValue();

        // Increment to the next phase.
        _phase++;

        if (_phase >= _offsets.length) {
            _phase = 0;
            _cycleStartTime = _cycleStartTime.add(periodValue);
        }

        if (_offsets[_phase] >= periodValue) {
            throw new IllegalActionException(this, "Offset number " + _phase
                    + " with value " + _offsets[_phase]
                    + " must be less than the " + "period, which is "
                    + periodValue);
        }

        _nextOutputTime = _cycleStartTime.add(_offsets[_phase]);
        director.fireAt(this, _nextOutputTime);
        return true;
    }
View Full Code Here

Examples of ptolemy.actor.sched.FixedPointDirector

    /** Return true if this actor is scheduled to fire at the current time.
     *  @return True if this actor is scheduled to fire at the current time.
     *  @exception IllegalActionException If thrown by the super class.
     */
    public boolean prefire() throws IllegalActionException {
        FixedPointDirector director = (FixedPointDirector) getDirector();
        boolean rightIndex = _nextOutputIndex == director.getIndex();
        boolean rightTime = (director.getModelTime().compareTo(_nextOutputTime) == 0);
        _readyToFire = rightIndex && rightTime;
        return super.prefire();
    }
View Full Code Here

Examples of ptolemy.actor.sched.FixedPointDirector

    /** Return true if the current time is the right time for an output.
     *  @return True if the current time matches the _nextOutputTime.
     */
    protected boolean _isTimeForOutput() {
        FixedPointDirector director = (FixedPointDirector) getDirector();
        boolean rightIndex = _nextOutputIndex == director.getIndex();
        Time currentTime = director.getModelTime();
        return rightIndex && _tentativeNextOutputTime.equals(currentTime);
    }
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.