Package ptolemy.actor

Examples of ptolemy.actor.Manager$State


            } catch (Exception ex) {
                System.out.println("startRun: " + ex);
            }
        }

        Manager manager = model.getManager();

        if (manager != null) {
            try {
                manager.startRun();
            } catch (IllegalActionException ex) {
                // Model is already running.  Ignore.
            }
        } else {
            report("Model " + model.getFullName() + " cannot be executed "
View Full Code Here


     *  stop execution by calling the stop() method of the manager.
     *  If there is no manager, do nothing.
     *  @param model The model to stop.
     */
    public void stopRun(CompositeActor model) {
        Manager manager = model.getManager();

        if (manager != null) {
            manager.stop();
        }
    }
View Full Code Here

                }

                _models.add(model);

                // Create a manager.
                Manager manager = model.getManager();

                if (manager == null) {
                    model.setManager(new Manager(model.workspace(), "manager"));
                }
            } else {
                // Argument not recognized.
                return false;
            }
View Full Code Here

        } else if (toplevel instanceof CompositeActor) {
            CompositeActor result = (CompositeActor) toplevel;
            _manager = result.getManager();

            if (_manager == null) {
                _manager = new Manager(_workspace, "manager");
                result.setManager(_manager);
            }

            _manager.addExecutionListener(this);
        }
View Full Code Here

            System.out.println("TestApplication: Setting Iterations to "
                    + iterations.getToken());
        }

        Manager manager = new Manager(toplevel.workspace(), "TestApplication");
        toplevel.setManager(manager);
        toplevel.addChangeListener(this);

        String modelName = toplevel.getName();

        long startTime = System.currentTimeMillis();
        long totalMemory1 = runtime.totalMemory() / 1024;
        long freeMemory1 = runtime.freeMemory() / 1024;
        System.out.println("Spent " + (startTime - _parseStartTime)
                + " ms. creating the model.");
        System.out.println(modelName + ": Stats before execution:    "
                + Manager.timeAndMemory(startTime, totalMemory1, freeMemory1));

        // Second, we run and print memory stats.
        manager.execute();

        long totalMemory2 = runtime.totalMemory() / 1024;
        long freeMemory2 = runtime.freeMemory() / 1024;
        String standardStats = Manager.timeAndMemory(startTime, totalMemory2,
                freeMemory2);
View Full Code Here

        super(model, tableau);

        _pane = pane;
        getContentPane().add(_pane, BorderLayout.CENTER);

        Manager manager = model.getManager();

        if (manager != null) {
            manager.addExecutionListener(this);
        }

        // Make the go button the default.
        _pane.setDefaultButton();
View Full Code Here

        if (model != null) {
            if (_pane != null) {
                _pane.setModel(model);
            }

            Manager manager = model.getManager();

            if (manager != null) {
                manager.addExecutionListener(this);
            }
        }
    }
View Full Code Here

        // FIXME: Shouldn't the following only be done if the
        // above returns true.
        NamedObj model = getModel();

        if (model instanceof CompositeActor) {
            Manager manager = ((CompositeActor) model).getManager();

            if (manager != null) {
                manager.removeExecutionListener(this);
            }
        }

        if (_pane != null) {
            _pane.stopRun();
View Full Code Here

        // because parseFile() works best on relative pathnames and
        // has problems finding resources like files specified in
        // parameters if the xml file was specified as an absolute path.
        //CompositeActor toplevel = (CompositeActor) parser.parse(null,
        //        new File(xmlFilename).toURL());
        Manager manager = new Manager(_toplevel.workspace(),
                "MoMLSimpleStatisticalApplication");
        _toplevel.setManager(manager);
        _toplevel.addChangeListener(this);

        Runtime runtime = Runtime.getRuntime();

        // Get the memory stats before we get the model name
        // just to be sure that getting the model name does
        // not skew are data too much
        long totalMemory1 = runtime.totalMemory() / 1024;
        long freeMemory1 = runtime.freeMemory() / 1024;

        String modelName = _toplevel.getName();

        System.out.println(modelName + ": Stats before execution:    "
                + Manager.timeAndMemory(startTime, totalMemory1, freeMemory1));

        // Second, we run and print memory stats.
        manager.execute();

        long totalMemory2 = runtime.totalMemory() / 1024;
        long freeMemory2 = runtime.freeMemory() / 1024;
        String standardStats = Manager.timeAndMemory(startTime, totalMemory2,
                freeMemory2);
View Full Code Here

        // and then preinitialize and resolve types.
        if (isTopLevel()) {

            // If necessary, create a manager.
            Actor container = ((Actor) getContainer());
            Manager manager = container.getManager();

            if (manager == null) {
                CompositeActor toplevel = (CompositeActor) ((NamedObj) container)
                        .toplevel();
                manager = new Manager(toplevel.workspace(), "Manager");
                toplevel.setManager(manager);
            }

            try {
                manager.preinitializeAndResolveTypes();
                returnValue = _generateCode(code);
            } finally {
                // We call wrapup here so that the state gets set to idle.
                // This makes it difficult to test the Exit actor.
                try {
                    long startTime = (new Date()).getTime();
                    manager.wrapup();
                    _printTimeAndMemory(startTime,
                            "StaticSchedulingCodeGenerator: "
                                    + "wrapup consumed: ");
                } catch (RuntimeException ex) {
                    // The Exit actor causes Manager.wrapup() to throw this.
                    if (!manager.isExitingAfterWrapup()) {
                        throw ex;
                    }
                }
            }
            // If the container is not in the top level, we are generating code
View Full Code Here

TOP

Related Classes of ptolemy.actor.Manager$State

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.