Refactored control flow to reduce nesting.

This commit is contained in:
Project Nayuki 2018-08-25 23:16:49 +00:00
parent 78e234fb0d
commit cf0dbd4d0f
1 changed files with 16 additions and 16 deletions

View File

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