From 6f79d4c68e42321b603ed9749cd61f0eaaa45a73 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Sun, 7 Oct 2018 05:51:10 +0000 Subject: [PATCH] Tweaked comments and statement order in QrCode constructor. --- src/io/nayuki/fastqrcodegen/QrCode.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/io/nayuki/fastqrcodegen/QrCode.java b/src/io/nayuki/fastqrcodegen/QrCode.java index ff0ebaf..bd6e51a 100644 --- a/src/io/nayuki/fastqrcodegen/QrCode.java +++ b/src/io/nayuki/fastqrcodegen/QrCode.java @@ -128,20 +128,20 @@ public final class QrCode { /*---- Constructor ----*/ public QrCode(int ver, Ecc ecl, byte[] dataCodewords, int mask) { - // Check arguments - errorCorrectionLevel = Objects.requireNonNull(ecl); - if (ver < MIN_VERSION || ver > MAX_VERSION || mask < -1 || mask > 7) - throw new IllegalArgumentException("Value out of range"); - Objects.requireNonNull(dataCodewords); - - // Initialize fields + // Check arguments and initialize fields + if (ver < MIN_VERSION || ver > MAX_VERSION) + throw new IllegalArgumentException("Version value out of range"); + if (mask < -1 || mask > 7) + throw new IllegalArgumentException("Mask value out of range"); version = ver; size = ver * 4 + 17; + errorCorrectionLevel = Objects.requireNonNull(ecl); + Objects.requireNonNull(dataCodewords); QrTemplate tpl = QrTemplate.getInstance(ver); modules = tpl.template.clone(); - // Draw function patterns, draw all codewords, do masking + // Compute ECC, draw modules, do masking byte[] allCodewords = addEccAndInterleave(dataCodewords); drawCodewords(tpl.dataOutputBitIndexes, allCodewords); this.mask = handleConstructorMasking(tpl.masks, mask);