diff --git a/brouter-codec/src/main/java/btools/codec/MicroCache.java b/brouter-codec/src/main/java/btools/codec/MicroCache.java index a73893e..d6dd2ab 100644 --- a/brouter-codec/src/main/java/btools/codec/MicroCache.java +++ b/brouter-codec/src/main/java/btools/codec/MicroCache.java @@ -318,8 +318,7 @@ public class MicroCache extends ByteDataWriter { while (idx1 < mc1.size || idx2 < mc2.size) { int id1 = idx1 < mc1.size ? mc1.faid[idx1] : Integer.MAX_VALUE; int id2 = idx2 < mc2.size ? mc2.faid[idx2] : Integer.MAX_VALUE; - if (id1 >= id2) // data from diff file wins - { + if (id1 >= id2) { // data from diff file wins int start2 = idx2 > 0 ? mc2.fapos[idx2 - 1] : 0; int len2 = mc2.fapos[idx2++] - start2; if (keepEmptyNodes || len2 > 0) { @@ -327,8 +326,7 @@ public class MicroCache extends ByteDataWriter { fapos[size] = aboffset; faid[size++] = id2; } - if (id1 == id2) // // id exists in both caches - { + if (id1 == id2) { // // id exists in both caches idx1++; } } else // use data from base file diff --git a/brouter-codec/src/main/java/btools/codec/MicroCache2.java b/brouter-codec/src/main/java/btools/codec/MicroCache2.java index 5ad7872..bf7891e 100644 --- a/brouter-codec/src/main/java/btools/codec/MicroCache2.java +++ b/brouter-codec/src/main/java/btools/codec/MicroCache2.java @@ -75,8 +75,7 @@ public final class MicroCache2 extends MicroCache { LinkedListContainer reverseLinks = new LinkedListContainer(size, dataBuffers.ibuf1); int selev = 0; - for (int n = 0; n < size; n++) // loop over nodes - { + for (int n = 0; n < size; n++) { // loop over nodes int ilon = alon[n]; int ilat = alat[n]; @@ -91,11 +90,9 @@ public final class MicroCache2 extends MicroCache { while (featureId != 0) { int bitsize = bc.decodeNoisyNumber(5); - if (featureId == 2) // exceptions to turn-restriction - { + if (featureId == 2) { // exceptions to turn-restriction trExceptions = (short) bc.decodeBounded(1023); - } else if (featureId == 1) // turn-restriction - { + } else if (featureId == 1) { // turn-restriction writeBoolean(true); writeShort(trExceptions); // exceptions from previous feature trExceptions = 0; @@ -128,8 +125,7 @@ public final class MicroCache2 extends MicroCache { int dlat_remaining; boolean isReverse = false; - if (nodeIdx != n) // internal (forward-) link - { + if (nodeIdx != n) { // internal (forward-) link dlon_remaining = alon[nodeIdx] - ilon; dlat_remaining = alat[nodeIdx] - ilat; } else { @@ -151,8 +147,7 @@ public final class MicroCache2 extends MicroCache { writeVarLengthSigned(dlat_remaining); validBits[n >> 5] |= 1 << n; // mark source-node valid - if (nodeIdx != n) // valid internal (forward-) link - { + if (nodeIdx != n) { // valid internal (forward-) link reverseLinks.addDataElement(nodeIdx, n); // register reverse link finaldatasize += 1 + aboffset - startPointer; // reserve place for reverse validBits[nodeIdx >> 5] |= 1 << nodeIdx; // mark target-node valid @@ -160,8 +155,7 @@ public final class MicroCache2 extends MicroCache { writeModeAndDesc(isReverse, wayTags == null ? null : wayTags.data); } - if (!isReverse) // write geometry for forward links only - { + if (!isReverse) { // write geometry for forward links only WaypointMatcher matcher = wayTags == null || wayTags.accessType < 2 ? null : waypointMatcher; int ilontarget = ilon + dlon_remaining; int ilattarget = ilat + dlat_remaining; @@ -294,8 +288,7 @@ public final class MicroCache2 extends MicroCache { @Override public int encodeMicroCache(byte[] buffer) { HashMap idMap = new HashMap(); - for (int n = 0; n < size; n++) // loop over nodes - { + for (int n = 0; n < size; n++) { // loop over nodes idMap.put(Long.valueOf(expandId(faid[n])), Integer.valueOf(n)); } @@ -313,8 +306,7 @@ public final class MicroCache2 extends MicroCache { int netdatasize = 0; - for (int pass = 1; ; pass++) // 3 passes: counters, stat-collection, encoding - { + for (int pass = 1; ; pass++) { // 3 passes: counters, stat-collection, encoding boolean dostats = pass == 3; boolean dodebug = debug && pass == 3; @@ -345,8 +337,7 @@ public final class MicroCache2 extends MicroCache { if (dodebug) System.out.println("*** encoding cache of size=" + size); int lastSelev = 0; - for (int n = 0; n < size; n++) // loop over nodes - { + for (int n = 0; n < size; n++) { // loop over nodes aboffset = startPos(n); aboffsetEnd = fapos[n]; if (dodebug) @@ -395,8 +386,7 @@ public final class MicroCache2 extends MicroCache { if (dostats) bc.assignBits("link-counts"); nlinks = 0; - while (hasMoreData()) // loop over links - { + while (hasMoreData()) { // loop over links // read link data int startPointer = aboffset; int endPointer = getEndPointer(); diff --git a/brouter-codec/src/main/java/btools/codec/StatCoderContext.java b/brouter-codec/src/main/java/btools/codec/StatCoderContext.java index 29ec786..ca5f08a 100644 --- a/brouter-codec/src/main/java/btools/codec/StatCoderContext.java +++ b/brouter-codec/src/main/java/btools/codec/StatCoderContext.java @@ -184,8 +184,7 @@ public final class StatCoderContext extends BitCoderContext { * @param mask should be 0 */ public void encodeSortedArray(int[] values, int offset, int subsize, int nextbit, int mask) { - if (subsize == 1) // last-choice shortcut - { + if (subsize == 1) { // last-choice shortcut while (nextbit != 0) { encodeBit((values[offset] & nextbit) != 0); nextbit >>= 1; @@ -227,8 +226,7 @@ public final class StatCoderContext extends BitCoderContext { * @see #encodeSortedArray */ public void decodeSortedArray(int[] values, int offset, int subsize, int nextbitpos, int value) { - if (subsize == 1) // last-choice shortcut - { + if (subsize == 1) { // last-choice shortcut if (nextbitpos >= 0) { value |= decodeBitsReverse(nextbitpos + 1); } diff --git a/brouter-core/src/main/java/btools/router/KinematicPath.java b/brouter-core/src/main/java/btools/router/KinematicPath.java index 2d84c6c..8cda9a4 100644 --- a/brouter-core/src/main/java/btools/router/KinematicPath.java +++ b/brouter-core/src/main/java/btools/router/KinematicPath.java @@ -46,8 +46,7 @@ final class KinematicPath extends OsmPath { } else { double turnspeed = 999.; // just high - if (km.turnAngleDecayTime != 0.) // process turn-angle slowdown - { + if (km.turnAngleDecayTime != 0.) { // process turn-angle slowdown if (angle < 0) floatingAngleLeft -= (float) angle; else floatingAngleRight += (float) angle; float aa = Math.max(floatingAngleLeft, floatingAngleRight); @@ -63,8 +62,7 @@ final class KinematicPath extends OsmPath { } } - if (nsection == 0) // process slowdown by crossing geometry - { + if (nsection == 0) { // process slowdown by crossing geometry double junctionspeed = 999.; // just high int classifiermask = (int) rc.expctxWay.getClassifierMask(); @@ -76,13 +74,11 @@ final class KinematicPath extends OsmPath { for (OsmPrePath prePath = rc.firstPrePath; prePath != null; prePath = prePath.next) { KinematicPrePath pp = (KinematicPrePath) prePath; - if (((pp.classifiermask ^ classifiermask) & 8) != 0) // exactly one is linktype - { + if (((pp.classifiermask ^ classifiermask) & 8) != 0) { // exactly one is linktype continue; } - if ((pp.classifiermask & 32) != 0) // touching a residential? - { + if ((pp.classifiermask & 32) != 0) { // touching a residential? hasResidential = true; } diff --git a/brouter-core/src/main/java/btools/router/OsmNogoPolygon.java b/brouter-core/src/main/java/btools/router/OsmNogoPolygon.java index b033dbb..84663a3 100644 --- a/brouter-core/src/main/java/btools/router/OsmNogoPolygon.java +++ b/brouter-core/src/main/java/btools/router/OsmNogoPolygon.java @@ -182,22 +182,17 @@ public class OsmNogoPolygon extends OsmNodeNamed { final double v12x = p1x - p0x; final double v12y = p1y - p0y; - if (v10x == 0) // P0->P1 vertical? - { - if (v10y == 0) // P0 == P1? - { + if (v10x == 0) { // P0->P1 vertical? + if (v10y == 0) { // P0 == P1? return true; } - if (v12x != 0) // P1->P2 not vertical? - { + if (v12x != 0) { // P1->P2 not vertical? return false; } return (v12y / v10y) >= 1; // P1->P2 at least as long as P1->P0? } - if (v10y == 0) // P0->P1 horizontal? - { - if (v12y != 0) // P1->P2 not horizontal? - { + if (v10y == 0) { // P0->P1 horizontal? + if (v12y != 0) { // P1->P2 not horizontal? return false; } // if ( P10x == 0 ) // P0 == P1? already tested @@ -233,8 +228,7 @@ public class OsmNogoPolygon extends OsmNodeNamed { long p0x = p0.x; // need to use long to avoid overflow in products long p0y = p0.y; - for (int i = isClosed ? 0 : 1; i <= i_last; i++) // edge from v[i] to v[i+1] - { + for (int i = isClosed ? 0 : 1; i <= i_last; i++) { // edge from v[i] to v[i+1] final Point p1 = points.get(i); final long p1x = p1.x; @@ -246,16 +240,13 @@ public class OsmNogoPolygon extends OsmNodeNamed { if (p0y <= py) // start y <= p.y { - if (p1y > py) // an upward crossing - { // p left of edge + if (p1y > py) { // an upward crossing, p left of edge if (((p1x - p0x) * (py - p0y) - (px - p0x) * (p1y - p0y)) > 0) { ++wn; // have a valid up intersect } } - } else // start y > p.y (no test needed) - { - if (p1y <= py) // a downward crossing - { // p right of edge + } else { // start y > p.y (no test needed) + if (p1y <= py) { // a downward crossing, p right of edge if (((p1x - p0x) * (py - p0y) - (px - p0x) * (p1y - p0y)) < 0) { --wn; // have a valid down intersect } @@ -380,8 +371,7 @@ public class OsmNogoPolygon extends OsmNodeNamed { final int sp0x = seg_p0.x; final int sp1x = seg_p1.x; - if (sp0x != sp1x) // S is not vertical - { + if (sp0x != sp1x) { // S is not vertical final int px = p.x; if (sp0x <= px && px <= sp1x) { return true; diff --git a/brouter-core/src/main/java/btools/router/OsmTrack.java b/brouter-core/src/main/java/btools/router/OsmTrack.java index 84899da..c8fbed6 100644 --- a/brouter-core/src/main/java/btools/router/OsmTrack.java +++ b/brouter-core/src/main/java/btools/router/OsmTrack.java @@ -433,8 +433,7 @@ public final class OsmTrack { } } - if (turnInstructionMode == 4) // comment style - { + if (turnInstructionMode == 4) { // comment style sb.append("\n"); sb.append("\n"); sb.append("