Package ptolemy.actor

Examples of ptolemy.actor.CompositeActor


    private LinkedList getActors() {
        if (VERBOSE) {
            System.out.println("Getting actors");
        }

        CompositeActor container = (CompositeActor) getContainer();

        // A linked list containing all the actors.
        LinkedList allActorList = new LinkedList();

        // Populate it.
        for (Iterator entities = container.deepEntityList().iterator(); entities
                .hasNext();) {
            ComponentEntity entity = (ComponentEntity) entities.next();

            // Fill allActorList with the list of things that we can schedule
            if (entity instanceof Actor) {
View Full Code Here


    /** Return error tolerance used for detecting enabled transitions.
     *  @return The error tolerance used for detecting enabled transitions.
     */
    public final double getErrorTolerance() {
        // modal models.
        CompositeActor container = (CompositeActor) getContainer();
        Director executiveDirector = container.getExecutiveDirector();

        if (executiveDirector instanceof CTGeneralDirector) {
            return ((CTGeneralDirector) executiveDirector).getErrorTolerance();
        } else {
            // This should never happen because a modal model with
View Full Code Here

     *
     *  @return The executive CT general director of this director, if there
     *  is any.
     */
    public CTGeneralDirector getExecutiveCTGeneralDirector() {
        CompositeActor container = (CompositeActor) getContainer();
        Director executiveDirector = container.getExecutiveDirector();

        if (executiveDirector instanceof CTGeneralDirector) {
            return (CTGeneralDirector) executiveDirector;
        } else {
            return null;
View Full Code Here

    /** Return the current time obtained from the executive director, if
     *  there is one, and otherwise return the local view of current time.
     *  @return The current time.
     */
    public Time getModelTime() {
        CompositeActor cont = (CompositeActor) getContainer();
        Director execDir = cont.getExecutiveDirector();

        if (execDir != null) {
            return execDir.getModelTime();
        } else {
            return super.getModelTime();
View Full Code Here

        boolean postfireReturns = true;

        FSMActor ctrl = getController();
        State currentState = ctrl.currentState();

        CompositeActor container = (CompositeActor) getContainer();
        Director executiveDirector = container.getExecutiveDirector();
        Iterator refinements = _enabledRefinements.iterator();

        while (refinements.hasNext()) {
            Actor refinement = (Actor) refinements.next();
            postfireReturns = postfireReturns && refinement.postfire();
View Full Code Here

        Iterator models = _models.iterator();

        while (models.hasNext()) {
            Runtime runtime = Runtime.getRuntime();

            CompositeActor model = (CompositeActor) models.next();
            String modelName = model.getName();

            // Allocate string buffers before hand, so that it is
            // not counted as allocated memory.
            StringBuffer buffer1 = new StringBuffer(5000);
            StringBuffer buffer2 = new StringBuffer(5000);
View Full Code Here

     *  external ports are not correct.
     */
    protected Schedule _getParallelSchedule() throws NotSchedulableException,
            IllegalActionException {
        SDFDirector director = (SDFDirector) getContainer();
        CompositeActor model = (CompositeActor) director.getContainer();

        _checkDynamicRateVariables(model, _rateVariables);

        int vectorizationFactor = 1;

        //if (director instanceof SDFDirector) {
        Token token = director.vectorizationFactor.getToken();
        vectorizationFactor = ((IntToken) token).intValue();
        //}

        if (vectorizationFactor < 1) {
            throw new NotSchedulableException(this,
                    "The supplied vectorizationFactor must be "
                            + "a positive integer. " + "The given value was: "
                            + vectorizationFactor);
        }

        CompositeActor container = (CompositeActor) director.getContainer();

        // A linked list containing all the actors.
        LinkedList allActorList = new LinkedList();

        // Populate it.
        for (Iterator entities = container.deepEntityList().iterator(); entities
                .hasNext();) {
            ComponentEntity entity = (ComponentEntity) entities.next();

            // Fill allActorList with the list of things that we can schedule
            // FIXME: What if other things can be scheduled than actors?
            if (entity instanceof Actor) {
                allActorList.addLast(entity);
            }
        }

        // externalRates maps from external
        // ports to the number of tokens that that port
        // will produce or consume in each firing.
        // It gets populated with the fractional production ratios
        // and is used in the end to set final rates on external ports.
        // This map is initialized to zero.
        Map externalRates = new TreeMap(new DFUtilities.NamedObjComparator());

        // Initialize externalRates to zero.
        for (Iterator ports = container.portList().iterator(); ports.hasNext();) {
            IOPort port = (IOPort) ports.next();
            externalRates.put(port, Fraction.ZERO);
        }

        // An association between all the relations in a simulation and
        // and array of the maximum number of tokens that are ever
        // waiting on that relation.
        Map minimumBufferSize = new TreeMap(
                new DFUtilities.NamedObjComparator());

        // Initialize the buffer size of each relation to zero.
        for (Iterator relations = container.relationList().iterator(); relations
                .hasNext();) {
            Relation relation = (Relation) relations.next();
            minimumBufferSize.put(relation, Integer.valueOf(0));
        }

View Full Code Here

    /** Return the executive CT general director of this director.
     *  @return The executive CT general director of this director.
     */
    public CTGeneralDirector getExecutiveCTGeneralDirector() {
        CompositeActor container = (CompositeActor) getContainer();
        Director executiveDirector = container.getExecutiveDirector();

        if (executiveDirector instanceof CTGeneralDirector) {
            return (CTGeneralDirector) executiveDirector;
        } else {
            // This should never happen because a CT model with
View Full Code Here

                    + "arguments.\nRun 'copernicus -help' for information "
                    + "on command line arguments.");
        }

        // Parse the model.
        CompositeActor toplevel = readInModel(_modelPath);

        _generatorAttribute = (GeneratorAttribute) toplevel
                .getAttribute(GENERATOR_NAME);

        if (_generatorAttribute == null) {
            _generatorAttribute = new GeneratorAttribute(toplevel,
                    GENERATOR_NAME);
View Full Code Here

        //                 "ptolemy.data.expr.Parameter");
        //         directorClassChanges.put("ptolemy.domains.sdf.kernel.SDFDirector",
        //                 directorClassChanges);
        //         _parser.addMoMLFilter(propertyClassChanges);
        // Parse the model.
        CompositeActor toplevel = null;

        try {
            toplevel = (CompositeActor) _parser.parse(modelURL, modelURL);
        } catch (Exception ex) {
            throw new IllegalActionException(null, ex, "Failed to parse '"
                    + modelPathOrURL + "' as a top level model in \n"
                    + modelURL + "!");
        }

        // If the name of the toplevel is the empty string, change it to
        // the basename of the file.
        // FIXME: is this correct for filenames?
        if (toplevel.getName().length() == 0) {
            String baseName = (new File(modelPathOrURL)).getName();

            if (baseName.lastIndexOf('.') != -1) {
                baseName = baseName.substring(0, baseName.lastIndexOf('.'));
            }

            toplevel.setName(baseName);
        }

        // Make the name follow Java initializer naming conventions.
        toplevel.setName(StringUtilities.sanitizeName(toplevel.getName()));

        return toplevel;
    }
View Full Code Here

TOP

Related Classes of ptolemy.actor.CompositeActor

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.