Package bm.core.tools

Examples of bm.core.tools.StringTokenizer


            final char oldLongitude = longitude;
            final short oldQuality = quality;
            final short oldSatellites = satellites;
            final FixedPoint oldAltitude = altitude.clone();

            final StringTokenizer stk = new StringTokenizer( command, "," );
            stk.nextToken(); // Skip GPGGA
            stk.nextToken(); // Skip time
            parseGpsLatitude( stk.nextToken() );
            latitude = stk.nextToken().charAt( 0 );
            parseGpsLongitude( stk.nextToken() );
            longitude = stk.nextToken().charAt( 0 );
            quality = Short.parseShort( stk.nextToken() );
            satellites = Short.parseShort( stk.nextToken() );
            stk.nextToken(); // Skip dilution
            altitude = FixedPoint.parse( stk.nextToken(), '.' );

            final boolean changed =
                    oldLatitude != latitude ||
                    oldLatitudeDegree != latitudeDegree ||
                    !oldLatitudeMinutes.equals( latitudeMinutes ) ||
View Full Code Here


        super( string );
    }

    public void test()
    {
        final StringTokenizer stk = new StringTokenizer(
                "GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47",
                ","
        );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "GPGGA", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "123519", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "4807.038", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "N", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "01131.000", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "E", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "1", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "08", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "0.9", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "545.4", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "M", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "46.9", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "M", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "", stk.nextToken() );
        assertTrue( stk.hasMoreTokens() );
        assertEquals( "*47", stk.nextToken() );
        assertFalse( stk.hasMoreTokens() );
    }
View Full Code Here

TOP

Related Classes of bm.core.tools.StringTokenizer

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.