Examples of StringToken


Examples of ptolemy.data.StringToken

        if (modelString.getWidth() < 1) {
            throw new IllegalActionException(getName() + "need to have"
                    + "the modelString port be connected");
        } else if (modelString.hasToken(0)) {
            StringToken str = null;

            try {
                str = (StringToken) modelString.get(0);

                _parser.reset();

                CompositeActor model = (CompositeActor) _parser.parse(str
                        .stringValue());
                StringWriter writer = new StringWriter();

                try {
                    model.exportMoML(writer, 1);
                } catch (Exception ex) {
                    // FIXME: don't ignore?
                }

                String modelMoML = writer.toString();

                if (((BooleanToken) connectPorts.getToken()).booleanValue()) {
                    _moml = "<group>\n" + modelMoML
                            + "<relation name=\"newR1\" "
                            + "class=\"ptolemy.actor.TypedIORelation\">\n"
                            + "</relation>\n" + "<relation name=\"newR2\" "
                            + "class=\"ptolemy.actor.TypedIORelation\">\n"
                            + "</relation>\n"
                            + "<link port=\"input\" relation=\"newR1\"/>\n"
                            + "<link port=\"" + model.getName()
                            + ".input\" relation=\"newR1\"/>\n"
                            + "<link port=\"" + model.getName()
                            + ".output\" relation=\"newR2\"/>\n"
                            + "<link port=\"output\" relation=\"newR2\"/>\n"
                            + "</group>";
                } else {
                    _moml = "<group>\n" + modelMoML + "</group>";
                }
            } catch (Exception ex) {
                if (_debugging) {
                    _debug("Problem parsing " + str.stringValue());
                }

                throw new IllegalActionException(this, ex, "Problem parsing "
                        + str.stringValue());
            }
        }

        super.fire();
    }
View Full Code Here

Examples of ptolemy.data.StringToken

            //The default director may not work when we need multi tokens to fire
            //the inside model because the receiver it creates is an instance of
            //Mailbox, which can only hold one token. In this case, specify a proper
            //director using the <i>director<i> parameter.
            new Director(this, "defaultDirector");
            director = new Parameter(this, "director", new StringToken(
                    "ptolemy.actor.Director"));
            setClassName("ptolemy.actor.lib.hoc.MobileModel");
        } catch (NameDuplicationException e) {
            // This should not be thrown.
            throw new InternalErrorException(e);
View Full Code Here

Examples of ptolemy.data.StringToken

                    if (_debugging) {
                        _debug("** Transferring parameter as string to output: "
                                + port.getName());
                    }

                    port.send(0, new StringToken(((Settable) attribute)
                            .getExpression()));
                }
            }
        }
    }
View Full Code Here

Examples of ptolemy.data.StringToken

        start = new TypedIOPort(this, "start");
        start.setInput(true);

        // type is undeclared.
        // Annotate DISCRETE, for the benefit of CT.
        new Parameter(start, "signalType", new StringToken("DISCRETE"));

        // stop port.
        stop = new TypedIOPort(this, "stop");
        stop.setInput(true);

        // type is undeclared.
        // Annotate DISCRETE, for the benefit of CT.
        new Parameter(stop, "signalType", new StringToken("DISCRETE"));
    }
View Full Code Here

Examples of ptolemy.data.StringToken

     * @exception IllegalActionException If there was an internal problem.
     */
    public Integrator(CompositeEntity container, String name)
            throws NameDuplicationException, IllegalActionException {
        super(container, name);
        new Parameter(input, "signalType", new StringToken("CONTINUOUS"));

        //        new Parameter(discreteInput, "signalType", new StringToken("DISCRETE"));
        new Parameter(output, "signalType", new StringToken("CONTINUOUS"));
    }
View Full Code Here

Examples of ptolemy.data.StringToken

    public LevelCrossingDetector(CompositeEntity container, String name)
            throws IllegalActionException, NameDuplicationException {
        super(container, name);

        output = new TypedIOPort(this, "output", false, true);
        new Parameter(output, "signalType", new StringToken("DISCRETE"));

        trigger = new TypedIOPort(this, "trigger", true, false);
        trigger.setMultiport(false);
        trigger.setTypeEquals(BaseType.DOUBLE);
        new Parameter(trigger, "signalType", new StringToken("CONTINUOUS"));

        level = new Parameter(this, "level", new DoubleToken(0.0));
        level.setTypeEquals(BaseType.DOUBLE);

        // By default, this director detects both directions of leve crossings.
View Full Code Here

Examples of ptolemy.data.StringToken

     */
    public CTPeriodicSampler(CompositeEntity container, String name)
            throws IllegalActionException, NameDuplicationException {
        super(container, name);
        input.setMultiport(true);
        new Parameter(input, "signalType", new StringToken("CONTINUOUS"));
        output.setMultiport(true);
        new Parameter(output, "signalType", new StringToken("DISCRETE"));
        _samplePeriod = 0.1;
        samplePeriod = new Parameter(this, "samplePeriod", new DoubleToken(
                _samplePeriod));

        _attachText("_iconDescription", "<svg>\n"
View Full Code Here

Examples of ptolemy.data.StringToken

    public void fire() throws IllegalActionException {
        // Grab the packet before it gets thrown away, since it is not
        // connected to any actors on the inside.
        if (packetIn.getWidth() > 0) {
            if (packetIn.hasToken(0)) {
                StringToken token = (StringToken) packetIn.get(0);

                Director director = getDirector();
                if (director != null) {
                    if (director instanceof PtinyOSDirector) {
                        ((PtinyOSDirector)director).receivePacket(
                                token.stringValue());

                    } else {
                        throw new IllegalActionException(
                                "Local director was not of type "
                                + "PtinyOSDirector");
View Full Code Here

Examples of ptolemy.data.StringToken

            throws IllegalActionException, NameDuplicationException {
        super(container, name);
        input = new TypedIOPort(this, "input", true, false);
        input.setMultiport(false);
        input.setTypeEquals(BaseType.DOUBLE);
        new Parameter(input, "signalType", new StringToken("CONTINUOUS"));

        output = new TypedIOPort(this, "output", false, true);
        output.setMultiport(false);
        output.setTypeEquals(BaseType.BOOLEAN);
        new Parameter(output, "signalType", new StringToken("DISCRETE"));

        _thWidth = 1e-2;
        thresholdWidth = new Parameter(this, "thresholdWidth", new DoubleToken(
                _thWidth));
View Full Code Here

Examples of ptolemy.data.StringToken

            throws NameDuplicationException, IllegalActionException {
        super(container, name);

        StringToken[] empty = new StringToken[1];
        stateVariableNames = new Parameter(this, "stateVariableNames");
        empty[0] = new StringToken("");
        stateVariableNames.setToken(new ArrayToken(BaseType.STRING, empty));
        initialStates = new Parameter(this, "initialStates");
        initialStates.setTypeEquals(BaseType.DOUBLE_MATRIX);

        setClassName("ptolemy.domains.ct.lib.DifferentialSystem");
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.