Package ptolemy.data

Examples of ptolemy.data.BooleanToken


        // set values parameter
        values = new Parameter(this, "values");
        values.setExpression("{1, 0}");

        // Set the Repeat Flag.
        repeat = new Parameter(this, "repeat", new BooleanToken(false));
        repeat.setTypeEquals(BaseType.BOOLEAN);
        attributeChanged(repeat);

        // set type constraint
        output.setTypeAtLeast(ArrayType.elementType(values));
View Full Code Here


        if (object instanceof ptolemy.data.Token) {
            returnValue = (ptolemy.data.Token) object;
        } else if (object instanceof ptolemy.data.Token[]) {
            returnValue = new ArrayToken((ptolemy.data.Token[]) object);
        } else if (object instanceof Boolean) {
            returnValue = new BooleanToken(((Boolean) object).booleanValue());
        } else if (object instanceof Byte) {
            // Note: This is technically not quite right, because of
            // the sign involved...  In lieu of a signed byte token,
            // we assume that methods that return byte should be
            // interpreted unsigned.
            returnValue = new UnsignedByteToken(((Byte) object).byteValue());
        } else if (object instanceof Short) {
            returnValue = new ShortToken(((Short) object).shortValue());
        } else if (object instanceof Integer) {
            returnValue = new IntToken(((Integer) object).intValue());
        } else if (object instanceof Long) {
            returnValue = new LongToken(((Long) object).longValue());
        } else if (object instanceof Double) {
            returnValue = new DoubleToken(((Double) object).doubleValue());
        } else if (object instanceof Float) {
            returnValue = new FloatToken(((Float) object).floatValue());
        } else if (object instanceof Complex) {
            returnValue = new ComplexToken((Complex) object);
        } else if (object instanceof FixPoint) {
            returnValue = new FixToken((FixPoint) object);
        } else if (object instanceof String) {
            returnValue = new StringToken((String) object);
        } else if (object instanceof boolean[][]) {
            returnValue = new BooleanMatrixToken((boolean[][]) object);
        } else if (object instanceof int[][]) {
            returnValue = new IntMatrixToken((int[][]) object);
        } else if (object instanceof long[][]) {
            returnValue = new LongMatrixToken((long[][]) object);
        } else if (object instanceof double[][]) {
            returnValue = new DoubleMatrixToken((double[][]) object);
        } else if (object instanceof Complex[][]) {
            returnValue = new ComplexMatrixToken((Complex[][]) object);
        } else if (object instanceof FixPoint[][]) {
            returnValue = new FixMatrixToken((FixPoint[][]) object);
        } else if (object instanceof double[]) {
            DoubleToken[] temp = new DoubleToken[((double[]) object).length];

            for (int j = 0; j < temp.length; j++) {
                temp[j] = new DoubleToken(((double[]) object)[j]);
            }

            returnValue = new ArrayToken(temp);
        } else if (object instanceof Complex[]) {
            ComplexToken[] temp = new ComplexToken[((Complex[]) object).length];

            for (int j = 0; j < temp.length; j++) {
                temp[j] = new ComplexToken(((Complex[]) object)[j]);
            }

            returnValue = new ArrayToken(temp);
        } else if (object instanceof int[]) {
            IntToken[] temp = new IntToken[((int[]) object).length];

            for (int j = 0; j < temp.length; j++) {
                temp[j] = new IntToken(((int[]) object)[j]);
            }

            returnValue = new ArrayToken(temp);
        } else if (object instanceof long[]) {
            LongToken[] temp = new LongToken[((long[]) object).length];

            for (int j = 0; j < temp.length; j++) {
                temp[j] = new LongToken(((long[]) object)[j]);
            }

            returnValue = new ArrayToken(temp);
        } else if (object instanceof boolean[]) {
            BooleanToken[] temp = new BooleanToken[((boolean[]) object).length];

            for (int j = 0; j < temp.length; j++) {
                temp[j] = new BooleanToken(((boolean[]) object)[j]);
            }

            returnValue = new ArrayToken(temp);
        } else if (object instanceof String[]) {
            StringToken[] temp = new StringToken[((String[]) object).length];
View Full Code Here

        (new SingletonParameter(inText.getPort(), "_showName"))
                .setToken(BooleanToken.TRUE);

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

        startIndex = new PortParameter(this, "startIndex");
        startIndex.setTypeEquals(BaseType.INT);
        startIndex.setExpression("0");
        (new SingletonParameter(startIndex.getPort(), "_showName"))
View Full Code Here

        // set values parameter
        values = new Parameter(this, "values");
        values.setExpression("{1}");

        // Set the Repeat Flag.
        repeat = new Parameter(this, "repeat", new BooleanToken(false));
        repeat.setTypeEquals(BaseType.BOOLEAN);

        enable = new TypedIOPort(this, "enable", true, false);
        enable.setTypeEquals(BaseType.BOOLEAN);
View Full Code Here

                    input.get(i);
                }
            }

            // Indicate that the test has passed.
            output.send(0, new BooleanToken(true));
            return;
        }

        output.send(0, new BooleanToken(false));

        Token referenceToken = ((ArrayToken) (correctValues.getToken()))
                .getElement(_numberOfInputTokensSeen);
        Token[] reference;
View Full Code Here

                    output.send(i, token);
                }
            }

            // Indicate that the test has passed.
            output.send(0, new BooleanToken(true));
            return;
        }

        Token referenceToken = ((ArrayToken) (correctValues.getToken()))
                .getElement(_numberOfInputTokensSeen);
View Full Code Here

        input_tokenConsumptionRate.setExpression("numberOfInputs");
        numberOfInputs = new Parameter(this, "numberOfInputs", new IntToken(256));
        numberOfInputs.setTypeEquals(BaseType.INT);
        numberOfLags = new Parameter(this, "numberOfLags", new IntToken(64));
        numberOfLags.setTypeEquals(BaseType.INT);
        biased = new Parameter(this, "biased", new BooleanToken(false));
        biased.setTypeEquals(BaseType.BOOLEAN);
        symmetricOutput = new Parameter(this, "symmetricOutput", new BooleanToken(false));
        symmetricOutput.setTypeEquals(BaseType.BOOLEAN);
        input.setTypeAtLeast(new FunctionTerm(input));
        output.setTypeAtLeast(new OutputTypeTerm());
        attributeChanged(numberOfInputs);
    }
View Full Code Here

     *   supported by the derived class.
     *  @return A BooleanToken which contains the result of the test.
     */
    public BooleanToken isEqualTo(Token token) throws IllegalActionException {
        if (token instanceof TestToken) {
            return new BooleanToken(this == token);
        } else {
            throw new IllegalActionException(
                    "Equality test not supported between "
                            + this.getClass().getName() + " and "
                            + token.getClass().getName() + ".");
View Full Code Here

                    emptyBuffers = false;
                    break;
                }
            }
            if (emptyBuffers) {
                doneEmitting.send(0, new BooleanToken(true));
            } else {
                doneEmitting.send(0, new BooleanToken(false));
            }
        } else {
            doneEmitting.send(0, new BooleanToken(false));
        }
    }
View Full Code Here

        _latestCount = _count;

        // Check whether to reset.
        for (int i = 0; i < reset.getWidth(); i++) {
            if (reset.hasToken(i)) {
                BooleanToken r = (BooleanToken) reset.get(i);

                if (r.booleanValue()) {
                    // Being reset at this firing.
                    _latestSum = null;
                    _latestCount = 0;
                }
            }
View Full Code Here

TOP

Related Classes of ptolemy.data.BooleanToken

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.