Package ptolemy.actor

Examples of ptolemy.actor.FiringEvent$FiringEventType


                while (result != Executable.NOT_READY) {
                    iterationCount++;
                    _iterationCount.setToken(new IntToken(iterationCount));

                    if (_debugging) {
                        _debug(new FiringEvent(this, actor,
                                FiringEvent.BEFORE_ITERATE, iterationCount));
                    }

                    result = actor.iterate(1);

                    if (_debugging) {
                        _debug(new FiringEvent(this, actor,
                                FiringEvent.AFTER_ITERATE, iterationCount));
                    }

                    // Should return if there is no more input data,
                    // irrespective of return value of prefire() of
View Full Code Here


            }

            // If an actor returns true to prefire(), fire() and postfire()
            // will be called.
            if (_debugging) {
                _debug(new FiringEvent(this, actor, FiringEvent.BEFORE_PREFIRE,
                        1));
            }

            if (actor instanceof CompositeActor) {
                CompositeActor compositeActor = (CompositeActor) actor;
                Director insideDirector = compositeActor.getDirector();
                // FIXME: This is bogus.  This is assuming there is no
                // more than one inside director, and is delegating the
                // incrementing of time to that inside director.
                _insideDirector = insideDirector;
                _pseudoTimeEnabled = true;
            }

            boolean flag = actor.prefire();

            if (_debugging) {
                _debug(new FiringEvent(this, actor, FiringEvent.AFTER_PREFIRE,
                        1));
            }

            if (flag) {
                if (_debugging) {
                    _debug(new FiringEvent(this, actor,
                            FiringEvent.BEFORE_FIRE, 1));
                }

                actor.fire();

                if (_debugging) {
                    _debug(new FiringEvent(this, actor, FiringEvent.AFTER_FIRE,
                            1));
                    _debug(new FiringEvent(this, actor,
                            FiringEvent.BEFORE_POSTFIRE, 1));
                }

                if (!actor.postfire()) {
                    _disabledActors.add(actor);
                }

                if (_debugging) {
                    _debug(new FiringEvent(this, actor,
                            FiringEvent.AFTER_POSTFIRE, 1));
                }
            }

            // Make sure we reset the pseudotime flag.
View Full Code Here

                        _debug("Actor has no container. Disabling actor.");
                        _disableActor(actorToFire);
                        break;
                    }

                    _debug(new FiringEvent(this, actorToFire,
                            FiringEvent.BEFORE_PREFIRE));

                    if (!actorToFire.prefire()) {
                        _debug("*** Prefire returned false.");
                        break;
                    }

                    _debug(new FiringEvent(this, actorToFire,
                            FiringEvent.AFTER_PREFIRE));

                    _debug(new FiringEvent(this, actorToFire,
                            FiringEvent.BEFORE_FIRE));
                    actorToFire.fire();
                    _debug(new FiringEvent(this, actorToFire,
                            FiringEvent.AFTER_FIRE));

                    _debug(new FiringEvent(this, actorToFire,
                            FiringEvent.BEFORE_POSTFIRE));

                    if (!actorToFire.postfire()) {
                        _debug("*** Postfire returned false:",
                                ((Nameable) actorToFire).getName());

                        // This actor requests not to be fired again.
                        _disableActor(actorToFire);
                        break;
                    }

                    _debug(new FiringEvent(this, actorToFire,
                            FiringEvent.AFTER_POSTFIRE));
                } else {
                    // No debugging.
                    if (((Nameable) actorToFire).getContainer() == null) {
                        // If the actor to be fired does not have a container,
View Full Code Here

            Firing firing = (Firing) firings.next();
            Actor actor = firing.getActor();
            int iterationCount = firing.getIterationCount();

            if (_debugging) {
                _debug(new FiringEvent(this, actor, FiringEvent.BEFORE_ITERATE,
                        iterationCount));
            }

            int returnValue = actor.iterate(iterationCount);

            if (returnValue == STOP_ITERATING) {
                _postfireReturns = false;
            } else if (returnValue == NOT_READY) {
                throw new IllegalActionException(this, actor, "Actor "
                        + "is not ready to fire.");
            }

            if (_debugging) {
                _debug(new FiringEvent(this, actor, FiringEvent.AFTER_ITERATE,
                        iterationCount));
            }
        }
    }
View Full Code Here

    public void event(DebugEvent debugEvent) {
        // FIXME: this method is called every time the director gets a
        // firing event for any actor...is this ok?
        // Ignore debug events that aren't firing events.
        if (debugEvent instanceof FiringEvent) {
            FiringEvent event = (FiringEvent) debugEvent;

            NamedObj objToHighlight = (NamedObj) event.getActor();

            if (_toDebug.containsKey(objToHighlight)) {
                // The actor associated with this firing event is in
                // the set of actors to be debugged.
                // If the object is not contained by the associated
                // composite, then find an object above it in the hierarchy
                // that is.
                DebugProfile debugProfile = getDebugProfile((Executable) objToHighlight);
                BasicGraphController graphController = debugProfile
                        .getGraphController();
                AbstractBasicGraphModel graphModel = (AbstractBasicGraphModel) graphController
                        .getGraphModel();
                NamedObj toplevel = graphModel.getPtolemyModel();

                while ((objToHighlight != null)
                        && (objToHighlight.getContainer() != toplevel)) {
                    objToHighlight = objToHighlight.getContainer();
                }

                if (objToHighlight == null) {
                    return;
                }

                Object location = objToHighlight.getAttribute("_location");

                if (location != null) {
                    Figure figure = graphController.getFigure(location);

                    if (figure != null) {
                        // If the user has chosen to break on one of
                        // the firing events, highlight the actor and
                        // wait for the user to press the Resume
                        // button.
                        if (debugProfile.isListening(event.getType())) {
                            String message = objToHighlight.getName() + " "
                                    + event.getType().getName();
                            Manager manager = ((Actor) objToHighlight)
                                    .getManager();
                            render(figure, manager, message);
                        }
                    }
View Full Code Here

     @exception IllegalActionException If any called method throws
     *   IllegalActionException or the actor is not ready.
     */
    protected boolean _fireActor(Actor actor) throws IllegalActionException {
        if (_debugging) {
            _debug(new FiringEvent(this, actor, FiringEvent.BEFORE_ITERATE));
        }

        // Iterate once.
        int returnValue = actor.iterate(1);

        if (_debugging) {
            _debug(new FiringEvent(this, actor, FiringEvent.AFTER_ITERATE));
        }

        _updateConnectedActorsStatus(actor);

        if (returnValue == STOP_ITERATING) {
View Full Code Here

TOP

Related Classes of ptolemy.actor.FiringEvent$FiringEventType

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.