From a1b2112264c9a1ed67322cc8c6ff9d7a956565d5 Mon Sep 17 00:00:00 2001 From: Scott Crosby Date: Wed, 8 Sep 2010 07:48:54 -0500 Subject: [PATCH] Document more of the API for BinaryParser. --- src.java/crosby/binary/BinaryParser.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src.java/crosby/binary/BinaryParser.java b/src.java/crosby/binary/BinaryParser.java index ccd1cf3..9da9469 100644 --- a/src.java/crosby/binary/BinaryParser.java +++ b/src.java/crosby/binary/BinaryParser.java @@ -18,6 +18,7 @@ public abstract class BinaryParser implements BlockReaderAdapter { protected int date_granularity; private String strings[]; + /** Take a Info protocol buffer containing a date and convert it into a java Date object */ protected Date getDate(Osmformat.Info info) { if (info.hasTimestamp()) { return new Date(date_granularity * (long) info.getTimestamp()); @@ -70,18 +71,19 @@ public abstract class BinaryParser implements BlockReaderAdapter { } - + /** Convert a latitude value stored in a protobuf into a double, compensating for granularity and latitude offset */ public double parseLat(long degree) { // Support non-zero offsets. (We don't currently generate them) return (granularity * degree + lat_offset) * .000000001; } + /** Convert a longitude value stored in a protobuf into a double, compensating for granularity and longitude offset */ public double parseLon(long degree) { // Support non-zero offsets. (We don't currently generate them) return (granularity * degree + lon_offset) * .000000001; } - + /** Parse a Primitive block (containing a string table, other paramaters, and PrimitiveGroups */ public void parse(Osmformat.PrimitiveBlock block) { Osmformat.StringTable stablemessage = block.getStringtable(); strings = new String[stablemessage.getSCount()]; @@ -106,10 +108,15 @@ public abstract class BinaryParser implements BlockReaderAdapter { } } + /** Parse a list of Relation protocol buffers and send the resulting relations to a sink. */ protected abstract void parseRelations(List rels); + /** Parse a DenseNode protocol buffer and send the resulting nodes to a sink. */ protected abstract void parseDense(Osmformat.DenseNodes nodes); + /** Parse a list of Node protocol buffers and send the resulting nodes to a sink. */ protected abstract void parseNodes(List nodes); + /** Parse a list of Way protocol buffers and send the resulting ways to a sink. */ protected abstract void parseWays(List ways); + /** Parse a header message. */ protected abstract void parse(Osmformat.HeaderBlock header); } \ No newline at end of file