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

项目:boohee_v5.6    文件:RSSExpandedReader.java   
private boolean checkChecksum() {
    ExpandedPair firstPair = (ExpandedPair) this.pairs.get(0);
    DataCharacter checkCharacter = firstPair.getLeftChar();
    DataCharacter firstCharacter = firstPair.getRightChar();
    if (firstCharacter == null) {
        return false;
    }
    int checksum = firstCharacter.getChecksumPortion();
    int s = 2;
    for (int i = 1; i < this.pairs.size(); i++) {
        ExpandedPair currentPair = (ExpandedPair) this.pairs.get(i);
        checksum += currentPair.getLeftChar().getChecksumPortion();
        s++;
        DataCharacter currentRightChar = currentPair.getRightChar();
        if (currentRightChar != null) {
            checksum += currentRightChar.getChecksumPortion();
            s++;
        }
    }
    if (((s - 4) * Opcodes.DIV_INT_LIT16) + (checksum % Opcodes.DIV_INT_LIT16) ==
            checkCharacter.getValue()) {
        return true;
    }
    return false;
}
项目:sres-app    文件:RSSExpandedReader.java   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目:reacteu-app    文件:RSSExpandedReader.java   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目:CordovaDemo    文件:RSSExpandedReader.java   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目:MiBandDecompiled    文件:RSSExpandedReader.java   
private boolean a()
{
    b b1 = (b)o.get(0);
    DataCharacter datacharacter = b1.b();
    int i1 = b1.c().getChecksumPortion();
    int j1 = 2;
    int k1 = i1;
    for (int l1 = 1; l1 < o.size(); l1++)
    {
        b b2 = (b)o.get(l1);
        k1 += b2.b().getChecksumPortion();
        j1++;
        DataCharacter datacharacter1 = b2.c();
        if (datacharacter1 != null)
        {
            k1 += datacharacter1.getChecksumPortion();
            j1++;
        }
    }

    return k1 % 211 + 211 * (j1 - 4) == datacharacter.getValue();
}
项目:ng-cordova-demo    文件:RSSExpandedReader.java   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.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());
}
项目:ngCordova-demo    文件:RSSExpandedReader.java   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目:CordovaW8BarcodeDemo    文件:RSSExpandedReader.java   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目:cordova-template    文件:RSSExpandedReader.java   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目:oxPush    文件:RSSExpandedReader.java   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目:hive-ios    文件:RSSExpandedReader.java   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目:dev    文件:RSSExpandedReader.java   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目: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());
}
项目:BibSearch    文件:RSSExpandedReader.java   
private boolean checkChecksum(){
  ExpandedPair firstPair = (ExpandedPair)this.pairs.elementAt(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  int checksum = firstCharacter.getChecksumPortion();
  int S = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = (ExpandedPair)this.pairs.elementAt(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    S++;
    if(currentPair.getRightChar() != null){
      checksum += currentPair.getRightChar().getChecksumPortion();
      S++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (S - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目:weex-3d-map    文件:RSSExpandedReader.java   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  if (firstCharacter == null) {
    return false;
  }

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目: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   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  if (firstCharacter == null) {
    return false;
  }

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for (int i = 1; i < this.pairs.size(); ++i) {
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目: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    文件: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   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  if (firstCharacter == null) {
    return false;
  }

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for (int i = 1; i < this.pairs.size(); ++i) {
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目: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   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  if (firstCharacter == null) {
    return false;
  }

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for (int i = 1; i < this.pairs.size(); ++i) {
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目: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   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  if (firstCharacter == null) {
    return false;
  }

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目: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   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  if (firstCharacter == null) {
    return false;
  }

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目: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   
private boolean checkChecksum() {
  ExpandedPair firstPair = this.pairs.get(0);
  DataCharacter checkCharacter = firstPair.getLeftChar();
  DataCharacter firstCharacter = firstPair.getRightChar();

  if (firstCharacter == null) {
    return false;
  }

  int checksum = firstCharacter.getChecksumPortion();
  int s = 2;

  for(int i = 1; i < this.pairs.size(); ++i){
    ExpandedPair currentPair = this.pairs.get(i);
    checksum += currentPair.getLeftChar().getChecksumPortion();
    s++;
    DataCharacter currentRightChar = currentPair.getRightChar();
    if (currentRightChar != null) {
      checksum += currentRightChar.getChecksumPortion();
      s++;
    }
  }

  checksum %= 211;

  int checkCharacterValue = 211 * (s - 4) + checksum;

  return checkCharacterValue == checkCharacter.getValue();
}
项目: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;
}