Java 类com.google.zxing.oned.rss.FinderPattern 实例源码

项目:zxing-bsplus    文件:RSSExpandedInternalTestCase.java   
@Test
public void testRetrieveNextPairPatterns() throws Exception {
  BufferedImage image = readImage("3.png");
  BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image)));
  int rowNumber = binaryMap.getHeight() / 2;
  BitArray row = binaryMap.getBlackRow(rowNumber, null);
  List<ExpandedPair> previousPairs = new ArrayList<>();

  RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
  ExpandedPair pair1 = rssExpandedReader.retrieveNextPair(row, previousPairs, rowNumber);
  previousPairs.add(pair1);
  FinderPattern finderPattern = pair1.getFinderPattern();
  assertNotNull(finderPattern);
  assertEquals(0, finderPattern.getValue());

  ExpandedPair pair2 = rssExpandedReader.retrieveNextPair(row, previousPairs, rowNumber);
  previousPairs.add(pair2);
  finderPattern = pair2.getFinderPattern();
  assertNotNull(finderPattern);
  assertEquals(0, finderPattern.getValue());
}
项目:zxing-bsplus    文件:RSSExpandedInternalTestCase.java   
@Test
public void testDecodeDataCharacter() throws Exception {
  BufferedImage image = readImage("3.png");
  BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image)));
  BitArray row = binaryMap.getBlackRow(binaryMap.getHeight() / 2, null);

  int[] startEnd = {145, 243};//image pixels where the A1 pattern starts (at 124) and ends (at 214)
  int value = 0; // A
  FinderPattern finderPatternA1 = new FinderPattern(value, startEnd, startEnd[0], startEnd[1], image.getHeight() / 2);
  //{1, 8, 4, 1, 1};
  RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
  DataCharacter dataCharacter = rssExpandedReader.decodeDataCharacter(row, finderPatternA1, true, false);

  assertEquals(19, dataCharacter.getValue());
  assertEquals(1007, dataCharacter.getChecksumPortion());
}
项目:dev    文件:RSSExpandedInternalTestCase.java   
@Test
public void testDecodeCheckCharacter() throws Exception {
  RSSExpandedReader rssExpandedReader = new RSSExpandedReader();

  String path = "test/data/blackbox/rssexpanded-1/3.jpg";
  File file = new File(path);
  if (!file.exists()) {
    // Support running from project root too
    file = new File("core", path);
  }

  BufferedImage image = ImageIO.read(file);
  BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image)));
  BitArray row = binaryMap.getBlackRow(binaryMap.getHeight() / 2, null);

  int[] startEnd = {145, 243};//image pixels where the A1 pattern starts (at 124) and ends (at 214)
  int value = 0;// A
  FinderPattern finderPatternA1 = new FinderPattern(value, startEnd, startEnd[0], startEnd[1], image.getHeight() / 2);
  //{1, 8, 4, 1, 1};
  DataCharacter dataCharacter = rssExpandedReader.decodeDataCharacter(row, finderPatternA1, true, true);

  assertEquals(98, dataCharacter.getValue());
}
项目:dev    文件:RSSExpandedInternalTestCase.java   
@Test
public void testDecodeDataCharacter() throws Exception {
  RSSExpandedReader rssExpandedReader = new RSSExpandedReader();

  String path = "test/data/blackbox/rssexpanded-1/3.jpg";
  File file = new File(path);
  if (!file.exists()) {
    // Support running from project root too
    file = new File("core", path);
  }

  BufferedImage image = ImageIO.read(file);
  BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image)));
  BitArray row = binaryMap.getBlackRow(binaryMap.getHeight() / 2, null);

  int[] startEnd = {145, 243};//image pixels where the A1 pattern starts (at 124) and ends (at 214)
  int value = 0; // A
  FinderPattern finderPatternA1 = new FinderPattern(value, startEnd, startEnd[0], startEnd[1], image.getHeight() / 2);
  //{1, 8, 4, 1, 1};
  DataCharacter dataCharacter = rssExpandedReader.decodeDataCharacter(row, finderPatternA1, true, false);

  assertEquals(19, dataCharacter.getValue());
  assertEquals(1007, dataCharacter.getChecksumPortion());
}
项目:ZxingCore    文件:RSSExpandedInternalTestCase.java   
@Test
public void testDecodeCheckCharacter() throws Exception {

  String path = "test/data/blackbox/rssexpanded-1/3.png";
  File file = new File(path);
  if (!file.exists()) {
    // Support running from project root too
    file = new File("core", path);
  }

  BufferedImage image = ImageIO.read(file);
  BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image)));
  BitArray row = binaryMap.getBlackRow(binaryMap.getHeight() / 2, null);

  int[] startEnd = {145, 243};//image pixels where the A1 pattern starts (at 124) and ends (at 214)
  int value = 0;// A
  FinderPattern finderPatternA1 = new FinderPattern(value, startEnd, startEnd[0], startEnd[1], image.getHeight() / 2);
  //{1, 8, 4, 1, 1};
  RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
  DataCharacter dataCharacter = rssExpandedReader.decodeDataCharacter(row, finderPatternA1, true, true);

  assertEquals(98, dataCharacter.getValue());
}
项目:ZxingCore    文件:RSSExpandedInternalTestCase.java   
@Test
public void testDecodeDataCharacter() throws Exception {

  String path = "test/data/blackbox/rssexpanded-1/3.png";
  File file = new File(path);
  if (!file.exists()) {
    // Support running from project root too
    file = new File("core", path);
  }

  BufferedImage image = ImageIO.read(file);
  BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image)));
  BitArray row = binaryMap.getBlackRow(binaryMap.getHeight() / 2, null);

  int[] startEnd = {145, 243};//image pixels where the A1 pattern starts (at 124) and ends (at 214)
  int value = 0; // A
  FinderPattern finderPatternA1 = new FinderPattern(value, startEnd, startEnd[0], startEnd[1], image.getHeight() / 2);
  //{1, 8, 4, 1, 1};
  RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
  DataCharacter dataCharacter = rssExpandedReader.decodeDataCharacter(row, finderPatternA1, true, false);

  assertEquals(19, dataCharacter.getValue());
  assertEquals(1007, dataCharacter.getChecksumPortion());
}
项目:weex-3d-map    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;
  if (startFromEven) {
    isOddPattern = !isOddPattern;
  }

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do{
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null){
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  }while(keepFinding);

  // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);

  if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size()-1).mustBeLast()) {
    throw NotFoundException.getNotFoundInstance();
  }

  DataCharacter rightChar;
  try {
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  } catch(NotFoundException ignored) {
    rightChar = null;
  }
  boolean mayBeLast = true;
  return new ExpandedPair(leftChar, rightChar, pattern, mayBeLast);
}
项目:weex-3d-map    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar = leftChar;
  this.rightChar = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast = mayBeLast;
}
项目:QrCode    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;
  if (startFromEven) {
    isOddPattern = !isOddPattern;
  }

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do {
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null) {
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  } while (keepFinding);

  // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);

  if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size() - 1).mustBeLast()) {
    throw NotFoundException.getNotFoundInstance();
  }

  DataCharacter rightChar;
  try {
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  } catch (NotFoundException ignored) {
    rightChar = null;
  }
  return new ExpandedPair(leftChar, rightChar, pattern, true);
}
项目:QrCode    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar = leftChar;
  this.rightChar = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast = mayBeLast;
}
项目:boohee_v5.6    文件:RSSExpandedReader.java   
private FinderPattern parseFoundFinderPattern(BitArray row, int rowNumber, boolean oddPattern) {
    int firstCounter;
    int start;
    int end;
    if (oddPattern) {
        int firstElementStart = this.startEnd[0] - 1;
        while (firstElementStart >= 0 && !row.get(firstElementStart)) {
            firstElementStart--;
        }
        firstElementStart++;
        firstCounter = this.startEnd[0] - firstElementStart;
        start = firstElementStart;
        end = this.startEnd[1];
    } else {
        start = this.startEnd[0];
        end = row.getNextUnset(this.startEnd[1] + 1);
        firstCounter = end - this.startEnd[1];
    }
    int[] counters = getDecodeFinderCounters();
    System.arraycopy(counters, 0, counters, 1, counters.length - 1);
    counters[0] = firstCounter;
    try {
        return new FinderPattern(AbstractRSSReader.parseFinderValue(counters,
                FINDER_PATTERNS), new int[]{start, end}, start, end, rowNumber);
    } catch (NotFoundException e) {
        return null;
    }
}
项目:boohee_v5.6    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar, DataCharacter rightChar, FinderPattern finderPattern,
             boolean mayBeLast) {
    this.leftChar = leftChar;
    this.rightChar = rightChar;
    this.finderPattern = finderPattern;
    this.mayBeLast = mayBeLast;
}
项目:Tesseract-OCR-Scanner    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;
  if (startFromEven) {
    isOddPattern = !isOddPattern;
  }

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do {
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null) {
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  } while (keepFinding);

  // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);

  if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size() - 1).mustBeLast()) {
    throw NotFoundException.getNotFoundInstance();
  }

  DataCharacter rightChar;
  try {
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  } catch (NotFoundException ignored) {
    rightChar = null;
  }
  return new ExpandedPair(leftChar, rightChar, pattern, true);
}
项目:Tesseract-OCR-Scanner    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar = leftChar;
  this.rightChar = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast = mayBeLast;
}
项目:QrCodeScanner    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;
  if (startFromEven) {
    isOddPattern = !isOddPattern;
  }

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do {
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null) {
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  } while (keepFinding);

  // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);

  if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size() - 1).mustBeLast()) {
    throw NotFoundException.getNotFoundInstance();
  }

  DataCharacter rightChar;
  try {
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  } catch (NotFoundException ignored) {
    rightChar = null;
  }
  return new ExpandedPair(leftChar, rightChar, pattern, true);
}
项目:QrCodeScanner    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar = leftChar;
  this.rightChar = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast = mayBeLast;
}
项目:PortraitZXing    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;
  if (startFromEven) {
    isOddPattern = !isOddPattern;
  }

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do{
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null){
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  }while(keepFinding);

  // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);

  if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size()-1).mustBeLast()) {
    throw NotFoundException.getNotFoundInstance();
  }

  DataCharacter rightChar;
  try {
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  } catch(NotFoundException ignored) {
    rightChar = null;
  }
  boolean mayBeLast = true;
  return new ExpandedPair(leftChar, rightChar, pattern, mayBeLast);
}
项目:PortraitZXing    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar = leftChar;
  this.rightChar = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast = mayBeLast;
}
项目:PortraitZXing    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;
  if (startFromEven) {
    isOddPattern = !isOddPattern;
  }

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do{
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null){
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  }while(keepFinding);

  // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);

  if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size()-1).mustBeLast()) {
    throw NotFoundException.getNotFoundInstance();
  }

  DataCharacter rightChar;
  try {
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  } catch(NotFoundException ignored) {
    rightChar = null;
  }
  boolean mayBeLast = true;
  return new ExpandedPair(leftChar, rightChar, pattern, mayBeLast);
}
项目:PortraitZXing    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar = leftChar;
  this.rightChar = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast = mayBeLast;
}
项目:ZXing-Orient    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;
  if (startFromEven) {
    isOddPattern = !isOddPattern;
  }

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do{
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null){
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  }while(keepFinding);

  // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);

  if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size()-1).mustBeLast()) {
    throw NotFoundException.getNotFoundInstance();
  }

  DataCharacter rightChar;
  try {
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  } catch(NotFoundException ignored) {
    rightChar = null;
  }
  boolean mayBeLast = true;
  return new ExpandedPair(leftChar, rightChar, pattern, mayBeLast);
}
项目:ZXing-Orient    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar = leftChar;
  this.rightChar = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast = mayBeLast;
}
项目:event-app    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;
  if (startFromEven) {
    isOddPattern = !isOddPattern;
  }

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do{
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null){
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  }while(keepFinding);

  // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);

  if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size()-1).mustBeLast()) {
    throw NotFoundException.getNotFoundInstance();
  }

  DataCharacter rightChar;
  try {
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  } catch(NotFoundException ignored) {
    rightChar = null;
  }
  boolean mayBeLast = true;
  return new ExpandedPair(leftChar, rightChar, pattern, mayBeLast);
}
项目:event-app    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar = leftChar;
  this.rightChar = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast = mayBeLast;
}
项目:weex-analyzer-android    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;
  if (startFromEven) {
    isOddPattern = !isOddPattern;
  }

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do{
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null){
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  }while(keepFinding);

  // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);

  if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size()-1).mustBeLast()) {
    throw NotFoundException.getNotFoundInstance();
  }

  DataCharacter rightChar;
  try {
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  } catch(NotFoundException ignored) {
    rightChar = null;
  }
  boolean mayBeLast = true;
  return new ExpandedPair(leftChar, rightChar, pattern, mayBeLast);
}
项目:weex-analyzer-android    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar = leftChar;
  this.rightChar = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast = mayBeLast;
}
项目:weex-3d-map    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;
  if (startFromEven) {
    isOddPattern = !isOddPattern;
  }

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do{
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null){
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  }while(keepFinding);

  // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);

  if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size()-1).mustBeLast()) {
    throw NotFoundException.getNotFoundInstance();
  }

  DataCharacter rightChar;
  try {
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  } catch(NotFoundException ignored) {
    rightChar = null;
  }
  boolean mayBeLast = true;
  return new ExpandedPair(leftChar, rightChar, pattern, mayBeLast);
}
项目:weex-3d-map    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar = leftChar;
  this.rightChar = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast = mayBeLast;
}
项目:Weex-TestDemo    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;
  if (startFromEven) {
    isOddPattern = !isOddPattern;
  }

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do{
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null){
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  }while(keepFinding);

  // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);

  if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size()-1).mustBeLast()) {
    throw NotFoundException.getNotFoundInstance();
  }

  DataCharacter rightChar;
  try {
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  } catch(NotFoundException ignored) {
    rightChar = null;
  }
  boolean mayBeLast = true;
  return new ExpandedPair(leftChar, rightChar, pattern, mayBeLast);
}
项目:Weex-TestDemo    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar = leftChar;
  this.rightChar = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast = mayBeLast;
}
项目:QrScan_Demo    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;
  if (startFromEven) {
    isOddPattern = !isOddPattern;
  }

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do{
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null){
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  }while(keepFinding);

  // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);

  if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size()-1).mustBeLast()) {
    throw NotFoundException.getNotFoundInstance();
  }

  DataCharacter rightChar;
  try {
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  } catch(NotFoundException ignored) {
    rightChar = null;
  }
  boolean mayBeLast = true;
  return new ExpandedPair(leftChar, rightChar, pattern, mayBeLast);
}
项目:QrScan_Demo    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar = leftChar;
  this.rightChar = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast = mayBeLast;
}
项目:weex    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;
  if (startFromEven) {
    isOddPattern = !isOddPattern;
  }

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do{
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null){
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  }while(keepFinding);

  // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
  // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);

  if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size()-1).mustBeLast()) {
    throw NotFoundException.getNotFoundInstance();
  }

  DataCharacter rightChar;
  try {
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  } catch(NotFoundException ignored) {
    rightChar = null;
  }
  boolean mayBeLast = true;
  return new ExpandedPair(leftChar, rightChar, pattern, mayBeLast);
}
项目:weex    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar = leftChar;
  this.rightChar = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast = mayBeLast;
}
项目:sres-app    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
    throws NotFoundException {
  boolean isOddPattern  = previousPairs.size() % 2 == 0;

  FinderPattern pattern;

  boolean keepFinding = true;
  int forcedOffset = -1;
  do{
    this.findNextPair(row, previousPairs, forcedOffset);
    pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
    if (pattern == null){
      forcedOffset = getNextSecondBar(row, this.startEnd[0]);
    } else {
      keepFinding = false;
    }
  }while(keepFinding);

  boolean mayBeLast = checkPairSequence(previousPairs, pattern);

  DataCharacter leftChar  = this.decodeDataCharacter(row, pattern, isOddPattern, true);
  DataCharacter rightChar;
  try{
    rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
  }catch(NotFoundException nfe){
    if(mayBeLast) {
      rightChar = null;
    } else {
      throw nfe;
    }
  }
  return new ExpandedPair(leftChar, rightChar, pattern, mayBeLast);
}
项目:sres-app    文件:RSSExpandedReader.java   
private boolean checkPairSequence(List<ExpandedPair> previousPairs, FinderPattern pattern)
    throws NotFoundException {
  int currentSequenceLength = previousPairs.size() + 1;
  if(currentSequenceLength > this.currentSequence.length) {
    throw NotFoundException.getNotFoundInstance();
  }

  for(int pos = 0; pos < previousPairs.size(); ++pos) {
    this.currentSequence[pos] = previousPairs.get(pos).getFinderPattern().getValue();
  }

  this.currentSequence[currentSequenceLength - 1] = pattern.getValue();

  for (int[] validSequence : FINDER_PATTERN_SEQUENCES) {
    if (validSequence.length >= currentSequenceLength) {
      boolean valid = true;
      for (int pos = 0; pos < currentSequenceLength; ++pos) {
        if (this.currentSequence[pos] != validSequence[pos]) {
          valid = false;
          break;
        }
      }

      if (valid) {
        return currentSequenceLength == validSequence.length;
      }
    }
  }

  throw NotFoundException.getNotFoundInstance();
}
项目:sres-app    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
  this.leftChar      = leftChar;
  this.rightChar     = rightChar;
  this.finderPattern = finderPattern;
  this.mayBeLast     = mayBeLast;
}
项目:TrueTone    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
        throws NotFoundException {
    boolean isOddPattern = previousPairs.size() % 2 == 0;
    if (startFromEven) {
        isOddPattern = !isOddPattern;
    }

    FinderPattern pattern;

    boolean keepFinding = true;
    int forcedOffset = -1;
    do {
        this.findNextPair(row, previousPairs, forcedOffset);
        pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
        if (pattern == null) {
            forcedOffset = getNextSecondBar(row, this.startEnd[0]);
        } else {
            keepFinding = false;
        }
    } while (keepFinding);

    // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
    // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

    DataCharacter leftChar = this.decodeDataCharacter(row, pattern, isOddPattern, true);

    if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size() - 1).mustBeLast()) {
        throw NotFoundException.getNotFoundInstance();
    }

    DataCharacter rightChar;
    try {
        rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
    } catch (NotFoundException ignored) {
        rightChar = null;
    }
    boolean mayBeLast = true;
    return new ExpandedPair(leftChar, rightChar, pattern, mayBeLast);
}
项目:TrueTone    文件:ExpandedPair.java   
ExpandedPair(DataCharacter leftChar,
             DataCharacter rightChar,
             FinderPattern finderPattern,
             boolean mayBeLast) {
    this.leftChar = leftChar;
    this.rightChar = rightChar;
    this.finderPattern = finderPattern;
    this.mayBeLast = mayBeLast;
}
项目:Discounty    文件:RSSExpandedReader.java   
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber)
        throws NotFoundException {
    boolean isOddPattern = previousPairs.size() % 2 == 0;
    if (startFromEven) {
        isOddPattern = !isOddPattern;
    }

    FinderPattern pattern;

    boolean keepFinding = true;
    int forcedOffset = -1;
    do {
        this.findNextPair(row, previousPairs, forcedOffset);
        pattern = parseFoundFinderPattern(row, rowNumber, isOddPattern);
        if (pattern == null) {
            forcedOffset = getNextSecondBar(row, this.startEnd[0]);
        } else {
            keepFinding = false;
        }
    } while (keepFinding);

    // When stacked symbol is split over multiple rows, there's no way to guess if this pair can be last or not.
    // boolean mayBeLast = checkPairSequence(previousPairs, pattern);

    DataCharacter leftChar = this.decodeDataCharacter(row, pattern, isOddPattern, true);

    if (!previousPairs.isEmpty() && previousPairs.get(previousPairs.size() - 1).mustBeLast()) {
        throw NotFoundException.getNotFoundInstance();
    }

    DataCharacter rightChar;
    try {
        rightChar = this.decodeDataCharacter(row, pattern, isOddPattern, false);
    } catch (NotFoundException ignored) {
        rightChar = null;
    }
    boolean mayBeLast = true;
    return new ExpandedPair(leftChar, rightChar, pattern, mayBeLast);
}