Package ptolemy.data.expr

Examples of ptolemy.data.expr.SingletonParameter


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

        // Create and configure the ports.
        message = new WirelessIOPort(this, "message", true, false);
        (new SingletonParameter(message, "_showName"))
                .setToken(BooleanToken.TRUE);

        power = new TypedIOPort(this, "power", true, false);
        power.setTypeEquals(BaseType.DOUBLE);
        (new SingletonParameter(power, "_showName"))
                .setToken(BooleanToken.TRUE);

        duration = new TypedIOPort(this, "duration", true, false);
        duration.setTypeEquals(BaseType.DOUBLE);
        (new SingletonParameter(duration, "_showName"))
                .setToken(BooleanToken.TRUE);

        received = new TypedIOPort(this, "received", false, true);
        received.setTypeSameAs(message);
        (new SingletonParameter(received, "_showName"))
                .setToken(BooleanToken.TRUE);

        collided = new TypedIOPort(this, "collided", false, true);
        collided.setTypeSameAs(message);
        (new SingletonParameter(collided, "_showName"))
                .setToken(BooleanToken.TRUE);

        // Configure parameters.
        SNRThresholdInDB = new Parameter(this, "SNRThresholdInDB");
        SNRThresholdInDB.setTypeEquals(BaseType.DOUBLE);
View Full Code Here


        outputRange.setTypeEquals(BaseType.DOUBLE);

        output.outsideTransmitProperties.setExpression("{range = outputRange}");

        // Hide the ports in Vergil.
        SingletonParameter hide = new SingletonParameter(output, "_hide");
        hide.setToken(BooleanToken.TRUE);
        hide = new SingletonParameter(input, "_hide");
        hide.setToken(BooleanToken.TRUE);

        // Create an icon for this sensor node.
        EditorIcon node_icon = new EditorIcon(this, "_icon");

        // The icon has two parts: a circle and an antenna.
        // Create a circle that indicates the signal radius.
        _circle = new EllipseAttribute(node_icon, "_circle");
        _circle.centered.setToken("true");
        _circle.width.setToken("outputRange*2");
        _circle.height.setToken("outputRange*2");
        _circle.fillColor.setToken("{0.0, 0.0, 1.0, 0.08}");
        _circle.lineColor.setToken("{0.0, 0.5, 0.5, 1.0}");

        // Create the green antenna shape.
        ResizablePolygonAttribute antenna = new ResizablePolygonAttribute(
                node_icon, "antenna2");
        antenna.vertices.setToken("{0, -5, -5, -15, 5, -15, 0, -5, 0, 15}");
        antenna.width.setToken("10");
        antenna.height.setToken("30");

        // Set the color to green.
        antenna.fillColor.setToken("{0.0, 1.0, 0.0, 1.0}");

        node_icon.setPersistent(false);

        // Hide the name of this sensor node.
        hide = new SingletonParameter(this, "_hideName");
        hide.setToken(BooleanToken.TRUE);
        hide.setVisibility(Settable.EXPERT);
    }
View Full Code Here

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

        properties = new TypedIOPort(this, "properties", false, true);
        (new SingletonParameter(properties, "_showName"))
                .setToken(BooleanToken.TRUE);

        // Create and configure the parameters.
        inputChannelName = new StringParameter(this, "inputChannelName");
        inputChannelName.setExpression("AtomicWirelessChannel");

        // Create and configure the ports.
        input = new WirelessIOPort(this, "input", true, false);
        input.outsideChannel.setExpression("$inputChannelName");

        payload = new TypedIOPort(this, "payload", false, true);
        payload.setTypeSameAs(input);
        (new SingletonParameter(payload, "_showName"))
                .setToken(BooleanToken.TRUE);

        _attachText("_iconDescription", "<svg>\n"
                + "<polygon points=\"-15,-15 15,15 15,-15 -15,15\" "
                + "style=\"fill:white\"/>\n" + "</svg>\n");
View Full Code Here

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

        payload = new TypedIOPort(this, "payload", true, false);
        (new SingletonParameter(payload, "_showName"))
                .setToken(BooleanToken.TRUE);

        properties = new TypedIOPort(this, "properties", true, false);
        (new SingletonParameter(properties, "_showName"))
                .setToken(BooleanToken.TRUE);

        // FIXME: This should be constrained to be a record token.
        // How to do that?
        // Create and configure the ports.
View Full Code Here

        _circle2.lineColor.setToken("{0.0, 0.5, 0.5, 1.0}");

        node_icon.setPersistent(false);

        // Hide the name of this sensor node.
        SingletonParameter hide = new SingletonParameter(this, "_hideName");
        hide.setToken(BooleanToken.TRUE);
        hide.setVisibility(Settable.EXPERT);

        // Hide the ports.
        (new SingletonParameter(output, "_hide")).setToken(BooleanToken.TRUE);
        (new SingletonParameter(input, "_hide")).setToken(BooleanToken.TRUE);
        (new SingletonParameter(signal, "_hide")).setToken(BooleanToken.TRUE);
    }
View Full Code Here

    public VisibleAttribute(NamedObj container, String name)
            throws IllegalActionException, NameDuplicationException {
        super(container, name);

        // Hide the name.
        SingletonParameter hide = new SingletonParameter(this, "_hideName");
        hide.setToken(BooleanToken.TRUE);
        hide.setVisibility(Settable.EXPERT);

        // No need to display any parameters when the "_showParameters"
        // preference asks for such display because presumably all the
        // parameters are reflected in the visual display already.
        Parameter hideAllParameters = new Parameter(this, "_hideAllParameters");
View Full Code Here

        icon
                .setText("NameIcon attribute: This sets the icon to be a box with the name.");
        icon.setPersistent(false);

        // Hide the name.
        SingletonParameter hide = new SingletonParameter(this, "_hideName");
        hide.setToken(BooleanToken.TRUE);
        hide.setVisibility(Settable.EXPERT);

        rounding = new Parameter(this, "rounding");
        rounding.setTypeEquals(BaseType.DOUBLE);
        rounding.setExpression("0.0");
View Full Code Here

     */
    public void setContainer(NamedObj container) throws IllegalActionException,
            NameDuplicationException {
        NamedObj previousContainer = getContainer();
        if (previousContainer != container && previousContainer != null) {
            SingletonParameter hide = (SingletonParameter) previousContainer
                    .getAttribute("_hideName", SingletonParameter.class);
            if (hide != null) {
                hide.setToken(BooleanToken.FALSE);
            }
        }
        super.setContainer(container);
        if (previousContainer != container && container != null) {
            // Hide the name.
            SingletonParameter hide = new SingletonParameter(container,
                    "_hideName");
            hide.setToken(BooleanToken.TRUE);
            hide.setVisibility(Settable.EXPERT);
        }
    }
View Full Code Here

            height = Math.floor(stringBounds.getHeight()) + 20;

            // If the container name exists, hide it.
            if (displayString.trim().length() > 0) {
                try {
                    SingletonParameter hideName = new SingletonParameter(this
                            .getContainer(), "_hideName");
                    hideName.setExpression("true");
                } catch (Exception e) {
                    // Do nothing.
                }
            }
        }
View Full Code Here

        since = new StringAttribute(this, "since");

        refreshParametersAndPorts();

        // Hide the name, if this gets instantiated in Vergil.
        SingletonParameter hide = new SingletonParameter(this, "_hideName");
        hide.setToken(BooleanToken.TRUE);
        hide.setVisibility(Settable.EXPERT);
    }
View Full Code Here

TOP

Related Classes of ptolemy.data.expr.SingletonParameter

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.