Refactored control flow to reduce nesting.

pull/39/merge
Project Nayuki 6 years ago
parent 78e234fb0d
commit cf0dbd4d0f

@ -182,7 +182,8 @@ public final class QrSegmentAdvanced {
QrSegment.Mode curMode = charModes[0]; QrSegment.Mode curMode = charModes[0];
int start = 0; int start = 0;
for (int i = 1; ; i++) { for (int i = 1; ; i++) {
if (i >= data.length || charModes[i] != curMode) { if (i < data.length && charModes[i] == curMode)
continue;
if (curMode == BYTE) if (curMode == BYTE)
result.add(QrSegment.makeBytes(Arrays.copyOfRange(data, start, i))); result.add(QrSegment.makeBytes(Arrays.copyOfRange(data, start, i)));
else { else {
@ -200,7 +201,6 @@ public final class QrSegmentAdvanced {
start = i; start = i;
} }
} }
}
private static boolean isAlphanumeric(char c) { private static boolean isAlphanumeric(char c) {

Loading…
Cancel
Save