Search in sources :

Example 1 with AbstractExpandedDecoder

use of com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder in project weex-example by KalicyZhou.

the class RSSExpandedReader method constructResult.

// Not private for unit testing
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
    BitArray binary = BitArrayBuilder.buildBitArray(pairs);
    AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
    String resultingString = decoder.parseInformation();
    ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
    ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();
    return new Result(resultingString, null, new ResultPoint[] { firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1] }, BarcodeFormat.RSS_EXPANDED);
}
Also used : ResultPoint(com.google.zxing.ResultPoint) AbstractExpandedDecoder(com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder) BitArray(com.google.zxing.common.BitArray) Result(com.google.zxing.Result)

Example 2 with AbstractExpandedDecoder

use of com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder in project zxing by zxing.

the class ExpandedInformationDecoderTest method testNoAi.

@Test
public void testNoAi() throws Exception {
    BitArray information = BinaryUtil.buildBitArrayFromString(" .......X ..XX..X. X.X....X .......X ....");
    AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(information);
    String decoded = decoder.parseInformation();
    assertEquals("(10)12A", decoded);
}
Also used : AbstractExpandedDecoder(com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder) BitArray(com.google.zxing.common.BitArray) Test(org.junit.Test)

Example 3 with AbstractExpandedDecoder

use of com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder in project zxing by zxing.

the class RSSExpandedReader method constructResult.

// Not private for unit testing
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
    BitArray binary = BitArrayBuilder.buildBitArray(pairs);
    AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
    String resultingString = decoder.parseInformation();
    ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
    ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();
    return new Result(resultingString, null, new ResultPoint[] { firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1] }, BarcodeFormat.RSS_EXPANDED);
}
Also used : ResultPoint(com.google.zxing.ResultPoint) AbstractExpandedDecoder(com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder) BitArray(com.google.zxing.common.BitArray) Result(com.google.zxing.Result)

Aggregations

BitArray (com.google.zxing.common.BitArray)3 AbstractExpandedDecoder (com.google.zxing.oned.rss.expanded.decoders.AbstractExpandedDecoder)3 Result (com.google.zxing.Result)2 ResultPoint (com.google.zxing.ResultPoint)2 Test (org.junit.Test)1