Package ptolemy.data

Examples of ptolemy.data.IntToken


            _current = _current + (inputValue ? "1" : "0");

            int index = _codeBook.indexOf(_current);

            if (index == -1) {
                output.send(0, new IntToken(_previousIndex));
                output.send(0, new IntToken(inputValue ? 1 : 0));
                _codeBook.add(_current);
                _current = "";
                _previousIndex = 0;
            } else {
                _previousIndex = index;
View Full Code Here


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

        // Declare port types.
        input.setTypeEquals(BaseType.INT);
        new Parameter(input, "tokenConsumptionRate", new IntToken(2));
        output.setTypeEquals(BaseType.BOOLEAN);
    }
View Full Code Here

        if (type == BaseType.INT) {

            int[][] tokens = (int[][]) outputTokens;
            for (int i = 0; i < port.getWidthInside(); i++) {
                for (int k = 0; k < rate; k++) {
                    Token token = new IntToken(tokens[i][k]);
                    port.send(i, token);
                }
            }

        } else if (type == BaseType.DOUBLE) {
View Full Code Here

        blockSize.setTypeEquals(BaseType.INT);
        blockSize.setExpression("1");

        // These parameters are required for SDF
        input_tokenConsumptionRate = new Parameter(input,
                "tokenConsumptionRate", new IntToken(0));
        input_tokenConsumptionRate.setVisibility(Settable.NOT_EDITABLE);
        input_tokenConsumptionRate.setTypeEquals(BaseType.INT);
        input_tokenConsumptionRate.setPersistent(false);

        output_tokenProductionRate = new Parameter(output,
View Full Code Here

            // _inputNumber is invalid, but do not compute
            // the value until all parameters have been set.
            _inputNumberInvalid = true;

            // Set the input consumption rate.
            _inputRate.setToken(new IntToken(_inputNumber));
        } else if (attribute == polynomialArray) {
            ArrayToken maskToken = ((ArrayToken) polynomialArray.getToken());
            _maskNumber = maskToken.length();
            _mask = new int[_maskNumber];
            _maxPolyValue = 0;

            for (int i = 0; i < _maskNumber; i++) {
                _mask[i] = ((IntToken) maskToken.getElement(i)).intValue();

                if (_mask[i] <= 0) {
                    throw new IllegalActionException(this,
                            "Polynomial is required to be strictly positive.");
                }

                if (_mask[i] > _maxPolyValue) {
                    _maxPolyValue = _mask[i];
                }
            }

            _inputNumberInvalid = true;

            // Set the output production rate.
            _outputRate.setToken(new IntToken(_maskNumber));
        } else {
            super.attributeChanged(attribute);
        }
    }
View Full Code Here

        input = new TypedIOPort(this, "input", true, false);
        input.setMultiport(true);
        input.setTypeEquals(BaseType.GENERAL);

        numTokens = new Parameter(this, "numTokens", new IntToken(-1));
    }
View Full Code Here

            }
        } else {
            output.broadcast((Token) _queue.removeFirst());
        }

        IntToken t = new IntToken(_queue.size());
        length.broadcast(t);
    }
View Full Code Here

            }
        } else {
            output.broadcast((Token) _queue.removeFirst());
        }

        IntToken t = new IntToken(_queue.size());
        length.broadcast(t);
    }
View Full Code Here

        /** Return the current iteration count of this firing.
         */
        public int getIterationCount() {
            try {
                IntToken token = (IntToken) _evaluateExpressionInModelScope(_parseTree);
                _debug("firing " + getActor() + " " + token.intValue()
                        + " times");
                return token.intValue();
            } catch (Exception ex) {
                // FIXME: this isn't very nice.
                throw new RuntimeException(
                        "Error evaluating parse tree for expression" + ": "
                                + expression(), ex);
View Full Code Here

        Location location = new Location(director, "_location");
        location.setExpression("[65.0, 35.0]");

        // Set the port orientation so that input ports are on top
        // edge of the icon.
        rotatePorts = new Parameter(this, "_rotatePorts", new IntToken(90));
    }
View Full Code Here

TOP

Related Classes of ptolemy.data.IntToken

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.