Package ptolemy.actor

Examples of ptolemy.actor.CompositeActor


            removeGraphicalClasses.put(
                    "ptolemy.copernicus.gui.GeneratorTableauAttribute", null);
            MoMLParser.addMoMLFilter(removeGraphicalClasses);

            // Parse the model.
            CompositeActor toplevel = null;
            toplevel = (CompositeActor) parser
                    .parse(modelPathURL, modelPathURL);

            FileWriter writer = null;

            try {
                writer = new FileWriter(newModelFile);
                toplevel.exportMoML(writer);
            } finally {
                if (writer != null) {
                    writer.close();
                }
            }
View Full Code Here


    private FSMDirector _getDirector() {
        // Get the containing FSMActor.
        NamedObj container = getContainer();
        if (container != null) {
            // Get the containing modal model.
            CompositeActor modalModel = (CompositeActor) container
                    .getContainer();
            if (modalModel != null) {
                // Get the director for the modal model.
                Director director = modalModel.getDirector();
                if (director instanceof FSMDirector) {
                    return (FSMDirector) director;
                }
            }
        }
View Full Code Here

                _expectingClass = false;

                MoMLParser parser = new MoMLParser();
                String string = "<entity name=\"toplevel\" class=\"" + arg
                        + "\"/>";
                CompositeActor model = (CompositeActor) parser.parse(string);

                // Temporary hack because cloning doesn't properly clone
                // type constraints.
                CompositeActor modelClass = (CompositeActor) parser
                        .searchForClass(arg, model.getSource());

                if (modelClass != null) {
                    model = modelClass;
                }
View Full Code Here

            boolean match = false;
            Iterator models = _models.iterator();

            while (models.hasNext()) {
                CompositeActor model = (CompositeActor) models.next();
                Attribute attribute = model.getAttribute(name);

                if (attribute instanceof Variable) {
                    match = true;
                    ((Variable) attribute).setExpression(value);

                    // Force evaluation so that listeners are notified.
                    ((Variable) attribute).getToken();
                }

                Director director = model.getDirector();

                if (director != null) {
                    attribute = director.getAttribute(name);

                    if (attribute instanceof Variable) {
View Full Code Here

     @exception IllegalActionException If refiring can not be granted.
     */
    public boolean postfire() throws IllegalActionException {
        if (!_isTopLevel() && (getBreakPoints().size() > 0)) {
            Time time = (Time) getBreakPoints().first();
            CompositeActor container = (CompositeActor) getContainer();
            container.getExecutiveDirector().fireAt(container, time);
        }

        boolean postfireReturns = _postfireReturns && !_stopRequested;

        if (_debugging && _verbose) {
View Full Code Here

        if (!(nameable instanceof CompositeActor)) {
            throw new IllegalActionException(this,
                    "has no CompositeActor container.");
        }

        CompositeActor container = (CompositeActor) nameable;

        if (container.getContainer() != null) {
            if (!canBeInsideDirector()) {
                throw new IllegalActionException(this,
                        "cannot serve as an inside director.");
            }
        } else {
View Full Code Here

            Parameter modelName = (StringParameter) getAttribute("modelName");
            modelName.setExpression(modelNameValue);

            // Set the iterations parameter.
            CompositeActor compositeActor;

            try {
                compositeActor = (CompositeActor) toplevel;
            } catch (ClassCastException ex) {
                throw new InternalErrorException(this, ex,
                        "Failed to cast toplevel '" + toplevel
                                + "' to a CompositeActor");
            }

            Director director = compositeActor.getDirector();

            // If we save a blank model, then there might not be a director.
            Parameter iterations = (StringParameter) getAttribute("iterations");

            if (director == null) {
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

    /** Return a string describing the status of each receiver.
     *  @return A string describing the status of each receiver.
     */
    private String _receiverStatus() {
        StringBuffer result = new StringBuffer();
        CompositeActor container = (CompositeActor) getContainer();

        // Start with the input ports of the composite, which
        // may have forked connections on the inside.
        Iterator inputPorts = container.inputPortList().iterator();
        while (inputPorts.hasNext()) {
            IOPort inputPort = (IOPort) (inputPorts.next());
            result.append("Send inside from " + inputPort.getFullName() + "\n");
            Receiver[][] destinations = inputPort.deepGetReceivers();
            for (int channel = 0; channel < destinations.length; channel++) {
                if (destinations[channel] != null) {
                    result.append("   on channel " + channel + ":\n");
                    for (int copy = 0; copy < destinations[channel].length; copy++) {
                        result.append("-- to "
                                + _receiverStatus(destinations[channel][copy])
                                + "\n");
                    }
                }
            }
        }

        // Next do the output ports of all contained actors.
        Iterator actors = container.deepEntityList().iterator();
        while (actors.hasNext()) {
            Actor actor = (Actor) actors.next();
            Iterator outputPorts = actor.outputPortList().iterator();
            while (outputPorts.hasNext()) {
                IOPort outputPort = (IOPort) (outputPorts.next());
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.