Examples of BooleanToken


Examples of ptolemy.data.BooleanToken

                        getDirector().stop();
                    }
                }

                if (typ.equals("boolean")) {
                    port.send(0, new BooleanToken(((Boolean) ret)
                            .booleanValue()));
                } else if (typ.equals("double")) {
                    port.send(0, new DoubleToken(((Double) ret).doubleValue()));
                } else if (typ.equals("int")) {
                    port.send(0, new IntToken(((Integer) ret).intValue()));
                } else if (typ.equals("char")) {
                    port.send(0,
                            new UnsignedByteToken(((Byte) ret).byteValue()));
                } else {
                    System.out.println("The return type is not convertible "
                            + "with Ptolemy II types.");
                }
            }
            //if the argument is output
            else if ((port != null)
                    && port.isOutput()
                    && (port.getName() != null)
                    && (getArgumentReturn() != null)
                    && !(port.getName().equals(this.getArgumentReturn()
                            .getName()))) {
                String typ = "";
                Field field = null;

                try {
                    field = _class.getDeclaredField("_" + port.getName());
                    typ = field.getType().toString();
                } catch (NoSuchFieldException ex) {
                    try {
                        field = _class.getDeclaredField("_"
                                + port.getName().substring(0,
                                        port.getName().length() - 3));
                        typ = field.getType().toString();
                    } catch (Throwable throwable) {
                        try {
                            throw new IllegalActionException(this, throwable,
                                    "No '+" + port.getName() + "' field !");
                        } catch (Throwable throwable2) {
                            getDirector().stop();
                        }
                    }
                }

                if (field == null) {
                    throw new InternalErrorException("Field '" + port.getName()
                            + "' in '" + _class + "' is null?");
                } else {
                    if (typ.equals("boolean")) {
                        try {
                            port.send(0,
                                    new BooleanToken(field.getBoolean(obj)));
                        } catch (IllegalAccessException ex) {
                            throw new IllegalActionException(this, ex, "Type '"
                                    + typ + "' is not castable");
                        }
                    } else if (typ.equals("double")) {
View Full Code Here

Examples of ptolemy.data.BooleanToken

        indexes.setExpression("{0, 1}");
        indexes.setTypeEquals(new ArrayType(BaseType.INT));
        attributeChanged(indexes);
        values = new Parameter(this, "values");
        values.setExpression("{1, 0}");
        repeat = new Parameter(this, "repeat", new BooleanToken(false));
        repeat.setTypeEquals(BaseType.BOOLEAN);
        attributeChanged(repeat);
        output.setTypeAtLeast(ArrayType.elementType(values));
        attributeChanged(values);
    }
View Full Code Here

Examples of ptolemy.data.BooleanToken

    public void fire() throws IllegalActionException  {
        super.fire();
        $ASSIGN$_latestSum(_sum);
        for (int i = 0; i < reset.getWidth(); i++) {
            if (reset.hasToken(i)) {
                BooleanToken r = (BooleanToken)reset.get(i);
                if (r.booleanValue()) {
                    $ASSIGN$_latestSum(output.getType().convert(init.getToken()));
                }
            }
        }
        for (int i = 0; i < input.getWidth(); i++) {
View Full Code Here

Examples of ptolemy.data.BooleanToken

        super.fire();
        $ASSIGN$_latestSum(_sum);
        $ASSIGN$_latestCount(_count);
        for (int i = 0; i < reset.getWidth(); i++) {
            if (reset.hasToken(i)) {
                BooleanToken r = (BooleanToken)reset.get(i);
                if (r.booleanValue()) {
                    $ASSIGN$_latestSum(null);
                    $ASSIGN$_latestCount(0);
                }
            }
        }
View Full Code Here

Examples of ptolemy.data.BooleanToken

     */
    public DB(CompositeEntity container, String name) throws IllegalActionException, NameDuplicationException  {
        super(container, name);
        input.setTypeEquals(BaseType.DOUBLE);
        output.setTypeEquals(BaseType.DOUBLE);
        inputIsPower = new Parameter(this, "inputIsPower", new BooleanToken(false));
        inputIsPower.setTypeEquals(BaseType.BOOLEAN);
        min = new Parameter(this, "min", new DoubleToken(-100.0));
        min.setTypeEquals(BaseType.DOUBLE);
    }
View Full Code Here

Examples of ptolemy.data.BooleanToken

        if (attribute instanceof Variable) {
            Token t = ((Variable) attribute).getToken();
            return ((BooleanToken) t).booleanValue();
        } else if (attribute instanceof Settable) {
            BooleanToken t = new BooleanToken(((Settable) attribute)
                    .getExpression());
            return t.booleanValue();
        } else {
            throw new IllegalActionException(this,
                    "The specified model does not have an evaluatedValue parameter.");
        }
    }
View Full Code Here

Examples of ptolemy.data.BooleanToken

        platformBufferLength = new Parameter(this, "platformBufferLength");
        platformBufferLength.setTypeEquals(BaseType.INT);
        platformBufferLength.setToken(new IntToken(64));

        setPlatformBufferLength = new Parameter(this,
                "setPlatformBufferLength", new BooleanToken(false));
        setPlatformBufferLength.setTypeEquals(BaseType.BOOLEAN);

        overwrite = new Parameter(this, "overwrite", new BooleanToken(true));
        overwrite.setTypeEquals(BaseType.BOOLEAN);

        blockAwaitingDatagram = new Parameter(this, "blockAwaitingDatagram");
        blockAwaitingDatagram.setTypeEquals(BaseType.BOOLEAN);
        blockAwaitingDatagram.setExpression("true");
View Full Code Here

Examples of ptolemy.data.BooleanToken

     */
    public PlotterBase(CompositeEntity container, String name)
            throws IllegalActionException, NameDuplicationException {
        super(container, name);

        fillOnWrapup = new Parameter(this, "fillOnWrapup", new BooleanToken(
                true));
        fillOnWrapup.setTypeEquals(BaseType.BOOLEAN);

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

View Full Code Here

Examples of ptolemy.data.BooleanToken

            modelString = new TypedIOPort(this, "modelString", true, false);
            modelString.setTypeEquals(BaseType.STRING);
            defaultValue = new Parameter(this, "defaultValue", new IntToken(0));
            output = new TypedIOPort(this, "output", false, true);
            output.setTypeAtLeast(defaultValue);
            refresh = new Parameter(this, "refresh", new BooleanToken(true));
            refresh.setTypeEquals(BaseType.BOOLEAN);
            connectPorts = new Parameter(this, "connectPorts",
                    new BooleanToken(true));
            connectPorts.setTypeEquals(BaseType.BOOLEAN);

            // create a defaultDirector. Without this director, it may get
            // an infinite loop when preinitialize, etc. is called in case the
            // specified director is not successfully constructed. Even when the
View Full Code Here

Examples of ptolemy.data.BooleanToken

        // absent discrete variables, such as x, we do not evaluate
        // the "x" after the "&&".
        if (_absentDiscreteVariables.contains(nodeName)) {
            // Set the result token to be false token
            // because the variable is discrete and has no value.
            _evaluatedChildToken = new BooleanToken(false);
            // If the current mode of the evaluator is the construction mode,
            // add a relation node into the relation list.
            if (_constructingRelationList) {
                _relationList.addRelation(RelationType.INVALID, 0.0);
            } else {
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.