@Test(expected = FormatException.class) public void testDecodeTooManyErrors() throws FormatException { BitMatrix matrix = BitMatrix.parse("" + "X X . X . . . X X . . . X . . X X X . X . X X X X X . \n" + "X X . . X X . . . . . X X . . . X X . . . X . X . . X \n" + "X . . . X X . . X X X . X X . X X X X . X X . . X . . \n" + ". . . . X . X X . . X X . X X . X . X X X X . X . . X \n" + "X X X . . X X X X X . . . . . X X . . . X . X . X . X \n" + "X X . . . . . . . . X . . . X . X X X . X . . X . . . \n" + "X X . . X . . . . . X X . . . . . X . . . . X . . X X \n" + ". . . X . X . X . . . . . X X X X X X . . . . . . X X \n" + "X . . . X . X X X X X X . . X X X . X . X X X X X X . \n" + "X . . X X X . X X X X X X X X X X X X X . . . X . X X \n" + ". . . . X X . . . X . . . . . . . X X . . . X X . X . \n" + ". . . X X X . . X X . X X X X X . X . . X . . . . . . \n" + "X . . . . X . X . X . X . . . X . X . X X . X X . X X \n" + "X . X . . X . X . X . X . X . X . X . . . . . X . X X \n" + "X . X X X . . X . X . X . . . X . X . X X X . . . X X \n" + "X X X X X X X X . X . X X X X X . X . X . X . X X X . \n" + ". . . . . . . X . X . . . . . . . X X X X . . . X X X \n" + "X X . . X . . X . X X X X X X X X X X X X X . . X . X \n" + "X X X . X X X X . . X X X X . . X . . . . X . . X X X \n" + ". . . . X . X X X . . . . X X X X . . X X X X . . . . \n" + ". . X . . X . X . . . X . X X . X X . X . . . X . X . \n" + "X X . . X . . X X X X X X X . . X . X X X X X X X . . \n" + "X . X X . . X X . . . . . X . . . . . . X X . X X X . \n" + "X . . X X . . X X . X . X . . . . X . X . . X . . X . \n" + "X . X . X . . X . X X X X X X X X . X X X X . . X X . \n" + "X X X X . . . X . . X X X . X X . . X . . . . X X X . \n" + "X X . X . X . . . X . X . . . . X X . X . . X X . . . \n", "X ", ". "); AztecDetectorResult r = new AztecDetectorResult(matrix, NO_POINTS, true, 16, 4); new Decoder().decode(r); }
public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException { ddata = detectorResult; BitMatrix matrix = detectorResult.getBits(); boolean[] rawbits = extractBits(matrix); boolean[] correctedBits = correctBits(rawbits); byte[] rawBytes = convertBoolArrayToByteArray(correctedBits); String result = getEncodedData(correctedBits); DecoderResult decoderResult = new DecoderResult(rawBytes, result, null, null); decoderResult.setNumBits(correctedBits.length); return decoderResult; }
Decoder { public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException { ddata = detectorResult; BitMatrix matrix = detectorResult.getBits(); boolean[] rawbits = extractBits(matrix); boolean[] correctedBits = correctBits(rawbits); byte[] rawBytes = convertBoolArrayToByteArray(correctedBits); String result = getEncodedData(correctedBits); DecoderResult decoderResult = new DecoderResult(rawBytes, result, null, null); decoderResult.setNumBits(correctedBits.length); return decoderResult; } }
Decoder { public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException { ddata = detectorResult; BitMatrix matrix = detectorResult.getBits(); boolean[] rawbits = extractBits(matrix); boolean[] correctedBits = correctBits(rawbits); byte[] rawBytes = convertBoolArrayToByteArray(correctedBits); String result = getEncodedData(correctedBits); DecoderResult decoderResult = new DecoderResult(rawBytes, result, null, null); decoderResult.setNumBits(correctedBits.length); return decoderResult; }  }
Decoder { public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException { ddata = detectorResult; BitMatrix matrix = detectorResult.getBits(); boolean[] rawbits = extractBits(matrix); boolean[] correctedBits = correctBits(rawbits); byte[] rawBytes = convertBoolArrayToByteArray(correctedBits); String result = getEncodedData(correctedBits); DecoderResult decoderResult = new DecoderResult(rawBytes, result, null, null); decoderResult.setNumBits(correctedBits.length); return decoderResult; }  DecoderResult decode(AztecDetectorResult detectorResult); static String highLevelDecode(boolean[] correctedBits); }
Decoder { public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException { ddata = detectorResult; BitMatrix matrix = detectorResult.getBits(); boolean[] rawbits = extractBits(matrix); boolean[] correctedBits = correctBits(rawbits); byte[] rawBytes = convertBoolArrayToByteArray(correctedBits); String result = getEncodedData(correctedBits); DecoderResult decoderResult = new DecoderResult(rawBytes, result, null, null); decoderResult.setNumBits(correctedBits.length); return decoderResult; }  DecoderResult decode(AztecDetectorResult detectorResult); static String highLevelDecode(boolean[] correctedBits);  }