Package ptolemy.actor

Examples of ptolemy.actor.Actor


        super.setContainer(port);

        if (port == null) {
            _director = null;
        } else {
            Actor actor = (Actor) port.getContainer();
            Director director;

            // For a composite actor,
            // the receiver type of an input port is decided by
            // the executive director.
            // While the receiver type of an output is decided by the director.
            // NOTE: getExecutiveDirector() and getDirector() yield the same
            // result for actors that do not contain directors.
            if (port.isInput()) {
                director = actor.getExecutiveDirector();
            } else {
                director = actor.getDirector();
            }

            if (!(director instanceof DDEDirector)) {
                throw new IllegalActionException(port,
                        "Cannot use an instance of PNQueueReceiver "
View Full Code Here


    public void fireAt(Actor actor, Time time) throws IllegalActionException {
        // Note that the actor parameter is ignored, because it does not
        // matter which actor requests firing.
        Nameable container = getContainer();
        if (container instanceof Actor) {
            Actor modalModel = (Actor) container;
            Director executiveDirector = modalModel.getExecutiveDirector();
            if (executiveDirector != null) {
                executiveDirector.fireAt(modalModel, time);
            } else {
                // FIXME: This does not look right!
                setModelTime(time);
View Full Code Here

            // Cache is invalid.  Reconstruct it.
            try {
                port.workspace().getReadAccess();

                Actor actor = (Actor) port.getContainer();

                if (actor != null) {
                    Director dir;

                    if (!port.isInput() && (actor instanceof CompositeActor)
                            && ((CompositeActor) actor).isOpaque()) {
                        dir = actor.getDirector();
                    } else {
                        dir = actor.getExecutiveDirector();
                    }

                    if (dir != null) {
                        if (dir instanceof DEDirector) {
                            _director = (DEDirector) dir;
View Full Code Here

            CTSchedule schedule = (CTSchedule) getScheduler().getSchedule();
            Iterator eventGenerators = schedule
                    .get(CTSchedule.EVENT_GENERATORS).actorIterator();

            while (eventGenerators.hasNext() && !_stopRequested) {
                Actor actor = (Actor) eventGenerators.next();

                if (_debugging && _verbose) {
                    _debug("Prefire event generator: "
                            + ((Nameable) actor).getName() + " at time "
                            + getModelTime());
                }

                if (!actor.prefire()) {
                    _setExecutionPhase(CTExecutionPhase.UNKNOWN_PHASE);
                    throw new IllegalActionException(
                            actor,
                            "Actor is not ready to fire. In the CT domain, "
                                    + "all event generators should be ready to fire"
                                    + " at all times.\n"
                                    + "Does the actor only operate on sequence "
                                    + "of tokens?");
                } else {
                    if (_debugging) {
                        _debug("Fire event generator : "
                                + ((Nameable) actor).getName() + " at time "
                                + getModelTime());
                    }
                    actor.fire();
                }
            }
        } finally {
            _setExecutionPhase(CTExecutionPhase.UNKNOWN_PHASE);
        }
View Full Code Here

        CTSchedule schedule = (CTSchedule) getScheduler().getSchedule();
        Iterator outputActors = schedule.get(CTSchedule.OUTPUT_ACTORS)
                .actorIterator();

        while (outputActors.hasNext() && !_stopRequested) {
            Actor actor = (Actor) outputActors.next();

            if (_debugging && _verbose) {
                _debug("Prefire output actor: " + ((Nameable) actor).getName()
                        + " at time " + getModelTime());
            }

            if (!actor.prefire()) {
                throw new IllegalActionException(
                        actor,
                        "Actor is not ready to fire. In the CT domain, "
                                + "all continuous actors should be ready to fire "
                                + "at all times.\n"
                                + "Does the actor only operate on sequence "
                                + "of tokens?");
            } else {
                if (_debugging) {
                    _debug("Fire output actor: " + ((Nameable) actor).getName()
                            + " at time " + getModelTime());
                }
                actor.fire();
            }
        }

        _setExecutionPhase(CTExecutionPhase.UNKNOWN_PHASE);
    }
View Full Code Here

                .actorIterator();

        boolean postfireReturns = true;

        while (eventGenerators.hasNext() && !_stopRequested) {
            Actor actor = (Actor) eventGenerators.next();
            postfireReturns = actor.postfire();
            _postfireReturns = _postfireReturns && postfireReturns;

            if (_debugging) {
                _debug("Postfire event generator : "
                        + ((Nameable) actor).getName() + " at time "
View Full Code Here

        CTSchedule schedule = (CTSchedule) getScheduler().getSchedule();
        Iterator actors = schedule.get(CTSchedule.CONTINUOUS_ACTORS)
                .actorIterator();

        while (actors.hasNext()) {
            Actor actor = (Actor) actors.next();

            if (_debugging) {
                _debug("Postfire " + actor);
            }

            boolean postfireReturns = actor.postfire();
            _postfireReturns = _postfireReturns && postfireReturns;
        }

        _setExecutionPhase(CTExecutionPhase.UNKNOWN_PHASE);
    }
View Full Code Here

    private void _iterateSchedule(ScheduleElement schedule)
            throws IllegalActionException {
        Iterator actors = schedule.actorIterator();

        while (actors.hasNext()) {
            Actor actor = (Actor) actors.next();

            if (_debugging && _verbose) {
                _debug("Prefire actor: " + ((Nameable) actor).getName()
                        + " at time " + getModelTime());
            }

            if (actor.prefire()) {
                if (_debugging && _verbose) {
                    _debug("Fire actor: " + ((Nameable) actor).getName()
                            + " at time " + getModelTime());
                }

                actor.fire();

                if (_debugging && _verbose) {
                    _debug("Postfire actor: " + ((Nameable) actor).getName()
                            + " at time " + getModelTime());
                }

                _postfireReturns = actor.postfire() && _postfireReturns;
            }
        }
    }
View Full Code Here

                            director.notifyAll();
                        }
                    }
                } else {
                    try {
                        Actor localActor = new ChannelActor(i, this);

                        // Tell the manager to initialize the actor.
                        // NOTE: If the manager is null, then we can't
                        // possibly be executing, so we don't need to do
                        // this.
View Full Code Here

                    //If queue is not empty, then determine the resumption
                    //time of the next process.
                    if (!_eventQueue.isEmpty()) {
                        //Remove the first process from the queue.
                        TimedEvent event = (TimedEvent) _eventQueue.take();
                        Actor actor = (Actor) event.contents;

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

TOP

Related Classes of ptolemy.actor.Actor

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.