Merge pull request #542 from moving-bits/blockformatting

Unify brackets for opening blocks with comments
This commit is contained in:
afischerdev 2023-04-30 10:33:54 +02:00 committed by GitHub
commit 2c707c977b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 83 additions and 164 deletions

View file

@ -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

View file

@ -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<Long, Integer> idMap = new HashMap<Long, Integer>();
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();

View file

@ -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);
}