Package ptolemy.actor

Examples of ptolemy.actor.Director


                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 {
View Full Code Here


    /** Return a new receiver obtained from the director.
     *  @exception IllegalActionException If there is no director.
     *  @return A new object implementing the Receiver interface.
     */
    public Receiver newReceiver() throws IllegalActionException {
        Director director = getDirector();

        if (director == null) {
            throw new IllegalActionException(this,
                    "Cannot create a receiver without a director.");
        }

        return director.newReceiver();
    }
View Full Code Here

        // in the fire() method.
        FSMActor controller = getController();
        State currentState = controller.currentState();
        Transition lastChosenTransition = _getLastChosenTransition();
        TypedCompositeActor actor;
        Director refinementDir;
        boolean superPostfire;

        // Commit the transition.
        superPostfire = super.postfire();
        currentState = controller.currentState();

        TypedActor[] actors = currentState.getRefinement();

        if ((actors == null) || (actors.length != 1)) {
            throw new IllegalActionException(this,
                    "Current state is required to have exactly "
                            + "one refinement: " + currentState.getName());
        }

        actor = (TypedCompositeActor) (actors[0]);

        if (lastChosenTransition != null) {
            refinementDir = actor.getDirector();

            if (refinementDir instanceof MultirateFSMDirector) {
                refinementDir.postfire();
            } else if (refinementDir instanceof StaticSchedulingDirector) {
                // Get the refinement schedule so we can update the
                // external rates.
                refinementDir.invalidateSchedule();
                ((StaticSchedulingDirector) refinementDir).getScheduler()
                        .getSchedule();
            }
        }
View Full Code Here

            throws IllegalActionException {
        // Keep moving up towards the toplevel of the hierarchy until
        // we find an executive director that is not an instance of
        // MultirateFSMDirector or until we reach the toplevel composite actor.
        CompositeActor container = (CompositeActor) getContainer();
        Director director = container.getExecutiveDirector();

        while (director != null) {
            if (director instanceof MultirateFSMDirector) {
                // Move up another level in the hierarchy.
                container = (CompositeActor) (container.getContainer());
View Full Code Here

                    }

                    // ProcessThread associated with the actor might
                    // be blocked on a wait on the director.
                    // So we need to notify on the director also.
                    Director director = getExecutiveDirector();

                    // If there is no director, then the model cannot be running,
                    // so there is no need to notify.
                    if (director != null) {
                        synchronized (director) {
                            director.notifyAll();
                        }
                    }
                } else {
                    try {
                        Actor localActor = new ChannelActor(i, this);
View Full Code Here

        }

        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

    public void initialize() throws IllegalActionException {
        value = 0.0;
        count = 0;

        Director director = getDirector();
        director.fireAt(this, director.getModelTime());
    }
View Full Code Here

        // Determine the value of _domainJar, which is the
        // path to the domain specific jar, e.g. "ptolemy/domains/sdf/sdf.jar"
        System.out.println("AppletWriter: _model: " + _model);

        Director director = _model.getDirector();
        System.out.println("AppletWriter: director: " + director);

        String directorPackage = director.getClass().getPackage().getName();

        if (!directorPackage.endsWith(".kernel")) {
            System.out.println("Warning: the directorPackage does not end "
                    + "with '.kernel', it is :" + directorPackage);
        }
View Full Code Here

        /** Override the base class to delegate to the executive director.
         *  This director does not keep track of threads.
         *  @param thread The thread.
         */
        public synchronized void addThread(Thread thread) {
            Director director = getExecutiveDirector();

            if (director instanceof PNDirector) {
                ((PNDirector) director).addThread(thread);
            } else {
                throw new InternalErrorException(
View Full Code Here

        /** Override the base class to delegate to the executive director.
         *  This director does not keep track of threads.
         *  @param thread The thread.
         */
        public synchronized void removeThread(Thread thread) {
            Director director = getExecutiveDirector();

            if (director instanceof PNDirector) {
                ((PNDirector) director).removeThread(thread);
            } else {
                throw new InternalErrorException(
View Full Code Here

TOP

Related Classes of ptolemy.actor.Director

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.