Package ptolemy.data

Examples of ptolemy.data.BooleanToken


     */
    public static Constant convertArgumentToConstantValue(Object object) {
        if (object == null) {
            return NullConstant.v();
        } else if (object instanceof BooleanToken) {
            BooleanToken flag = (BooleanToken) object;

            if (flag.booleanValue()) {
                return IntConstant.v(1);
            } else {
                return IntConstant.v(0);
            }
        } else if (object instanceof IntToken) {
            return IntConstant.v(((IntToken) object).intValue());
        } else if (object instanceof LongToken) {
            return LongConstant.v(((LongToken) object).longValue());
        } else if (object instanceof StringToken) {
            return StringConstant.v(((StringToken) object).stringValue());
        } else if (object instanceof DoubleToken) {
            return DoubleConstant.v(((DoubleToken) object).doubleValue());
        } else if (object instanceof Boolean) {
            Boolean flag = (Boolean) object;

            if (flag.booleanValue()) {
                return IntConstant.v(1);
            } else {
                return IntConstant.v(0);
            }
        } else if (object instanceof Integer) {
View Full Code Here


        expression = new StringParameter(this, "expression");

        _dataParameters = new Engine.ConversionParameters();

        get1x1asScalars = new Parameter(this, "get1x1asScalars",
                new BooleanToken(_dataParameters.getScalarMatrices));
        new CheckBoxStyle(get1x1asScalars, "style");

        getIntegerMatrices = new Parameter(this, "getIntegerMatrices",
                new BooleanToken(_dataParameters.getIntMatrices));
        new CheckBoxStyle(getIntegerMatrices, "style");

        // _time is not needed, fire() sets a matlab variable directly
        _iteration = new Variable(this, "iteration", new IntToken(1));
    }
View Full Code Here

        /*DistributedSDFScheduler scheduler = */new DistributedSDFScheduler(
                this, uniqueName("Scheduler"));

        // We create the new parameter here.
        parallelSchedule = new Parameter(this, "parallelSchedule",
                new BooleanToken(true));
        parallelSchedule.setTypeEquals(BaseType.BOOLEAN);

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

        parallelExecution = new Parameter(this, "parallelExecution",
                new BooleanToken(true));
        parallelExecution.setTypeEquals(BaseType.BOOLEAN);
    }
View Full Code Here

     */
    protected boolean _ignoreRelation(Relation relation) {
        Attribute hideAttribute = relation.getAttribute("_hide");
        if (hideAttribute != null) {
            try {
                BooleanToken token = (BooleanToken) ((Parameter) hideAttribute)
                        .getToken();
                boolean hide = token.booleanValue();
                return hide;
            } catch (IllegalActionException e) {
            }
        }
        return false;
View Full Code Here

        bitsPerSample.setTypeEquals(BaseType.INT);
        channels = new Parameter(this, "channels", new IntToken(1));
        channels.setTypeEquals(BaseType.INT);
        attributeChanged(channels);
        bufferLength = new Parameter(this, "bufferLength", new IntToken(8000));
        overwrite = new Parameter(this, "overwrite", new BooleanToken(true));
    }
View Full Code Here

        _latestSum = _sum;

        // 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 = output.getType().convert(init.getToken());
                }
            }
        }
View Full Code Here

        Token elementToken = element.getToken();
        if (array.hasToken(0)) {
            ArrayToken token = (ArrayToken) array.get(0);
            boolean contained = false;
            for (int i = 0; i < token.length(); i++) {
                BooleanToken bt = elementToken.isEqualTo(token.getElement(i));
                if (bt.booleanValue()) {
                    contained = true;
                    break;
                }
            }
            output.broadcast(new BooleanToken(contained));
        }
    }
View Full Code Here

     *  that both ports have an input, as checked by prefire().
     *  @exception IllegalActionException If there is no director.
     */
    public void fire() throws IllegalActionException {
        super.fire();
        BooleanToken result = BooleanToken.FALSE;
        double leftIn = ((DoubleToken) (left.get(0))).doubleValue();
        double rightIn = ((DoubleToken) (right.get(0))).doubleValue();

        switch (_comparison) {
        case _GT:
View Full Code Here

     *  no input tokens available, then no output is produced.
     *  @exception IllegalActionException If there is no director.
     */
    public void fire() throws IllegalActionException {
        super.fire();
        BooleanToken result = BooleanToken.TRUE;
        Token reference = null;
        boolean foundOne = false;

        for (int i = 0; i < input.getWidth(); i++) {
            if (!input.hasToken(i)) {
View Full Code Here

     *  input on any channel, then produce no output.
     *  @exception IllegalActionException If there is no director.
     */
    public void fire() throws IllegalActionException {
        super.fire();
        BooleanToken value = null;
        BooleanToken in = null;

        for (int i = 0; i < input.getWidth(); i++) {
            if (input.hasToken(i)) {
                in = (BooleanToken) (input.get(i));

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.