Examples of Director


Examples of ptolemy.actor.Director

    public void initialize(CompositeActor toplevel)
            throws IllegalActionException, NameDuplicationException {
        _toplevel = toplevel;

        // Applet codegen works with all directors, not just SDF.
        Director topLevelDirector = toplevel.getDirector();

        // FIXME: nearly duplicate code in java/TestApplication.java
        if ((topLevelDirector != null)
                && topLevelDirector instanceof SDFDirector) {
            SDFDirector director = (SDFDirector) topLevelDirector;
View Full Code Here

Examples of ptolemy.actor.Director

                                + " Found multiple refinements in: "
                                + currentState.getName());
            }

            TypedCompositeActor currentRefinement = (TypedCompositeActor) (currentRefinements[0]);
            Director refinementDir = currentRefinement.getDirector();

            if (refinementDir instanceof MultirateFSMDirector) {
                refinementDir.initialize();
            }

            /*boolean inputRateChanged = */
            _updateInputTokenConsumptionRates(currentRefinement);

View Full Code Here

Examples of ptolemy.actor.Director

                //_isRed = true;
                test.send(0, new IntToken(hops + 1));

                //Call fireAt to set the color back to white after the delay time.
                Director director = getDirector();
                double delayTime = ((DoubleToken) delay.getToken())
                        .doubleValue();
                Time time = director.getModelTime().add(delayTime);
                director.fireAt(this, time);
            } else if (getName().equals(routeTo) || (hops == 0)) {
                // Change the color of the icon to green.
                _circle2.fillColor.setToken("{0.0, 1.0, 0.0, 1.0}");

                CompositeEntity container = (CompositeEntity) getContainer();
                Entity destNode = container.getEntity(destination);
                Locatable destLocation = (Locatable) destNode.getAttribute(
                        "_location", Locatable.class);
                Locatable myLocation = (Locatable) this.getAttribute(
                        "_location", Locatable.class);

                if ((destLocation == null) || (myLocation == null)) {
                    throw new IllegalActionException(
                            "Cannot determine location for node "
                                    + destNode.getName() + ".");
                }

                Iterator nodes = _connectedNodes.iterator();
                double minDistance = _distanceBetween(destLocation, myLocation);
                String to = " ";
                boolean multi = ((BooleanToken) doublePath.getToken())
                        .booleanValue();
                double nextMinDistance = _distanceBetween(destLocation,
                        myLocation);
                String to2 = " ";

                while (nodes.hasNext()) {
                    Entity node = (Entity) nodes.next();
                    Locatable location = (Locatable) node.getAttribute(
                            "_location", Locatable.class);

                    if (location == null) {
                        throw new IllegalActionException(
                                "Cannot determine location for node "
                                        + node.getName() + ".");
                    }

                    double d = _distanceBetween(destLocation, location);

                    if (multi) {
                        if (d < minDistance) {
                            nextMinDistance = minDistance;
                            to2 = to;
                            minDistance = d;
                            to = node.getName();
                        } else if (d < nextMinDistance) {
                            nextMinDistance = d;
                            to2 = node.getName();
                        }
                    } else {
                        if (d < minDistance) {
                            minDistance = d;
                            to = node.getName();
                        }
                    }
                }

                // Request refiring after a certain amount of time specified
                // by the <i>delay<i> parameter.
                Director director = getDirector();
                Token[] values = { new DoubleToken(data),
                        new StringToken(destination), new StringToken(to),
                        new IntToken(hops + 1) };
                double delayTime = ((DoubleToken) delay.getToken())
                        .doubleValue();
                Time time = director.getModelTime().add(delayTime);

                if (_receptions == null) {
                    _receptions = new HashMap();
                }

                Double timeDouble = Double.valueOf(time.getDoubleValue());
                String[] labels = { "data", "destination", "routeTo", "hops" };
                RecordToken result = new RecordToken(labels, values);
                _receptions.put(timeDouble, result);

                director.fireAt(this, time);

                if (multi) {
                    Token[] values2 = { new DoubleToken(data),
                            new StringToken(destination), new StringToken(to2),
                            new IntToken(hops + 1) };

                    if (_receptions == null) {
                        _receptions = new HashMap();
                    }

                    RecordToken result2 = new RecordToken(labels, values2);
                    _receptions.put(timeDouble, result2);

                    director.fireAt(this, time.add(delayTime));
                }

                //output.send(0, result);
            }
        } else {
View Full Code Here

Examples of ptolemy.actor.Director

        int inputRows = matrix.getRowCount();
        int inputColumns = matrix.getColumnCount();

        // If the director is an SDFDirector, check the dimensions
        // of the matrix.
        Director director = getDirector();

        if (director instanceof SDFDirector) {
            if ((inputRows * inputColumns) != (_rows * _columns)) {
                throw new IllegalActionException(this,
                        "Received a matrix whose dimension does not "
View Full Code Here

Examples of ptolemy.actor.Director

        // FIXME: This seems wrong.
        if (container instanceof CompositeActor) {
            // We need to check if the container is a CompositeActor
            // because the reference to SchedulePlotter in tmentities.xml
            // is not a CompositeActor
            Director director = ((CompositeActor) container).getDirector();

            if (!(director instanceof TMDirector)) {
                throw new IllegalActionException("Director '" + director
                        + "' is not a TMDirector, so adding a SchedulePlotter "
                        + "makes no sense");
View Full Code Here

Examples of ptolemy.actor.Director

        Actor container = (Actor) getContainer();
        while (viewScreen == null) {
            // Tolerate GR nested within GR, in which case
            // the view screen should be that of the enclosing composite.
            // There could be an intervening FSMDirector, etc.
            Director executiveDirector = container.getExecutiveDirector();
            if (executiveDirector instanceof GRDirector) {
                viewScreen = ((GRDirector)executiveDirector)._getViewScreen();
            } else {
                if (executiveDirector == null) {
                    throw new IllegalActionException(this,
View Full Code Here

Examples of ptolemy.actor.Director

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

Examples of ptolemy.actor.Director

                break;
            }
        }

        // Go through hierarchy to find the minimum step.
        Director executiveDirector = ((CompositeActor) getContainer())
                .getExecutiveDirector();
        if (executiveDirector != null) {
            Time aFutureTimeOfUpperLevel = executiveDirector
                    .getModelNextIterationTime();
            if (aFutureTime.compareTo(aFutureTimeOfUpperLevel) > 0) {
                aFutureTime = aFutureTimeOfUpperLevel;
            }
        }
View Full Code Here

Examples of ptolemy.actor.Director

            // Change the color of the icon to red.
            _circle.fillColor.setToken("{1.0, 0.0, 0.1, 0.7}");

            // Request refiring one second later to change
            // the icon back to blue.
            Director director = getDirector();
            director.fireAt(this, director.getModelTime().add(1.0));
        } else {
            // Set color to blue.
            _circle.fillColor.setToken("{0.0, 0.0, 1.0, 0.05}");
        }
View Full Code Here

Examples of ptolemy.actor.Director

     while transferring outputs
     */
    protected synchronized void _transferOutputs()
            throws IllegalActionException {
        // Use the executive director to transfer outputs.
        Director executiveDirector = getExecutiveDirector();

        if (executiveDirector != null) {
            Iterator outports = outputPortList().iterator();

            while (outports.hasNext()) {
                IOPort p = (IOPort) outports.next();
                executiveDirector.transferOutputs(p);
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.