Package ptolemy.data

Examples of ptolemy.data.LongToken


     */
    public VariableSleep(CompositeEntity container, String name)
            throws NameDuplicationException, IllegalActionException {
        super(container, name);
        defaultSleepTime = new Parameter(this, "defaultSleepTime",
                new LongToken(0));
        defaultSleepTime.setTypeEquals(BaseType.LONG);

        // Data type polymorphic, multiports.
        input.setMultiport(true);
        output.setMultiport(true);
View Full Code Here


            checkpointTrigger =
                ((BooleanToken) _checkpoint.get(0)).booleanValue();
        }

        if (_rollback.getWidth() > 0 && _rollback.hasToken(0)) {
            LongToken rollbackHandle = (LongToken) _rollback.get(0);
            _rollbackHandle = rollbackHandle.longValue();
        } else {
            _rollbackHandle = -1;
        }

        if (checkpointTrigger) {
            HashMap<Checkpoint, Long> handles = new HashMap<Checkpoint, Long>();
            _checkpoint(handles, (CompositeActor) getContainer());
            _currentHandle++;
            _handleMap.put(Long.valueOf(_currentHandle), handles);
            _handle.send(0, new LongToken(_currentHandle));
        }
    }
View Full Code Here

        } else if (value instanceof Integer) {
            tmp = new IntToken(((Integer) value).intValue());
        } else if (value instanceof Double) {
            tmp = new DoubleToken(((Double) value).doubleValue());
        } else if (value instanceof Long) {
            tmp = new LongToken(((Long) value).longValue());
        } else if (value instanceof String) {
            tmp = new StringToken((String) value);
        } else if (value instanceof Boolean) {
            tmp = new BooleanToken(((Boolean) value).booleanValue());
        } else if (value instanceof Complex) {
View Full Code Here

                    // Strip off the radix prefix and the length suffix.
                    x = x.substring(prefixLength, len - suffixLength);

                    if (mustBeLong) {
                        // If the size was specified as long, then create a long.
                        jjtn003._ptToken = new LongToken(Long.parseLong(x,
                                radix));
                    } else if (mustBeShort) {
                        // If the size was specified as short, then create a short.
                        jjtn003._ptToken = new ShortToken(Integer.parseInt(x,
                                radix));
                    } else if (mustBeUnsignedByte) {
                        // If the size was specified as unsignedbyte,
                        // then create an unsigned byte, truncating if necessary.
                        jjtn003._ptToken = new UnsignedByteToken(Integer
                                .parseInt(x, radix));
                    } else {
                        // Try to infer the size.  Inferred sizes are at least
                        // integer.
                        try {
                            jjtn003._ptToken = new IntToken(Integer.parseInt(x,
                                    radix));
                        } catch (NumberFormatException nfe) {
                            jjtn003._ptToken = new LongToken(Long.parseLong(x,
                                    radix));
                        }
                    }
                    jjtn003._isConstant = true;
                } catch (NumberFormatException ee) {
View Full Code Here

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

        delay = new Parameter(this, "delay", new DoubleToken(1.0));
        delay.setTypeEquals(BaseType.DOUBLE);

        seed = new Parameter(this, "seed", new LongToken(0));
        seed.setTypeEquals(BaseType.LONG);

        doublePath = new Parameter(this, "doublePath", new LongToken(0));
        doublePath.setToken("false");
        doublePath.setTypeEquals(BaseType.BOOLEAN);

        _distance = new Variable(this, "distance");
        _distance.setExpression("Infinity");
View Full Code Here

                            .notSupportedConversionMessage(token, toString()));
                }
                // Try to create a new [long] type with just one member.
                // The following conversion will fail if the member cannot
                // be converted to an int.
                LongToken singleMember = LongToken.convert(token);
                long[] matrix = new long[1];
                matrix[0] = singleMember.longValue();
                return new LongMatrixToken(matrix, 1, 1);
            }
        }
View Full Code Here

        } 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];
View Full Code Here

     *  may change this value.
     *  @return The approximate number of bytes available.
     *  @see #totalMemory()
     */
    public static LongToken freeMemory() {
        return new LongToken(Runtime.getRuntime().freeMemory());
    }
View Full Code Here

     *  and available for future object allocation.
     *  @return The total number of bytes used by the JVM.
     *  @see #freeMemory()
     */
    public static LongToken totalMemory() {
        return new LongToken(Runtime.getRuntime().totalMemory());
    }
View Full Code Here

     *  value.
     *  @exception IllegalActionException If there is no director.
     */
    public void fire() throws IllegalActionException {
        super.fire();
        LongToken inputToken = (LongToken) input.get(0);
        Long inputValue = Long.valueOf(inputToken.longValue());
        DoubleToken result = new DoubleToken(inputValue.doubleValue());

        output.send(0, result);
    }
View Full Code Here

TOP

Related Classes of ptolemy.data.LongToken

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.