How to de-encapsulate data in an elegant manner
Hi folks,
I'm sort of unfamiliar with the java String Class and the methods available to it,
But my first question. Does the Javelin support the Sqrt function? I need to utilize Pythagorean theorem to calculuate distances between GPS coordinates..
Anyhow, here's what I want to do.· I want to xmit a series Unit IDs and their associated GPS coordinates.
So for example, say we have:
ID··········· GPS COORD
1············· (2,4)
2············· (6,7)
3············· (5,2)
4············· (2,5)
I have encapsulated this in a string that looks like:
L!I1X2Y4I2X6Y7I3X5Y2I4X2Y2E
where the format is I,Unit ID,X,X Coord,Y,Y coord, E for End
This data is transmitted and received as a string on the other end.
What I'm confused on doing is coming up with an elegant way to unpack this data into a format that can be stored in an array.
Is there a way to search for Characters (I, !, etc)
Please help!
·
I'm sort of unfamiliar with the java String Class and the methods available to it,
But my first question. Does the Javelin support the Sqrt function? I need to utilize Pythagorean theorem to calculuate distances between GPS coordinates..
Anyhow, here's what I want to do.· I want to xmit a series Unit IDs and their associated GPS coordinates.
So for example, say we have:
ID··········· GPS COORD
1············· (2,4)
2············· (6,7)
3············· (5,2)
4············· (2,5)
I have encapsulated this in a string that looks like:
L!I1X2Y4I2X6Y7I3X5Y2I4X2Y2E
where the format is I,Unit ID,X,X Coord,Y,Y coord, E for End
This data is transmitted and received as a string on the other end.
What I'm confused on doing is coming up with an elegant way to unpack this data into a format that can be stored in an array.
Is there a way to search for Characters (I, !, etc)
Please help!
·
Comments
the root of an unsigned 16bits root in I.F format (I=highbyte, F=lowbyte representing F/256 fraction).
http://tech.groups.yahoo.com/group/JavelinCode/files/Javelin%20Stamp%20IDE/lib/stamp/math/
You can extract characters from strings using s.charAt(i)
and then use those characters in comparisons. That way you can
write your own search methods.
regards peter