Java 类com.google.zxing.client.result.ExpandedProductParsedResult 实例源码

项目:Discounty    文件:ProductResultHandler.java   
@Override
public void handleButtonPress(int index) {
    ParsedResult rawResult = getResult();
    String productID;
    if (rawResult instanceof ProductParsedResult) {
        productID = ((ProductParsedResult) rawResult).getNormalizedProductID();
    } else if (rawResult instanceof ExpandedProductParsedResult) {
        productID = ((ExpandedProductParsedResult) rawResult).getRawText();
    } else {
        throw new IllegalArgumentException(rawResult.getClass().toString());
    }
    switch (index) {
        case 0:
            openProductSearch(productID);
            break;
        case 1:
            webSearch(productID);
            break;
        case 2:
            openURL(fillInCustomSearchURL(productID));
            break;
    }
}
项目:zxing-bsplus    文件:RSSExpandedImage2resultTestCase.java   
private static void assertCorrectImage2result(String fileName, ExpandedProductParsedResult expected)
    throws IOException, NotFoundException {
  Path path = AbstractBlackBoxTestCase.buildTestBase("src/test/resources/blackbox/rssexpanded-1/").resolve(fileName);

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

  Result theResult;
  try {
    RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
    theResult = rssExpandedReader.decodeRow(rowNumber, row, null);
  } catch (ReaderException re) {
    fail(re.toString());
    return;
  }

  assertSame(BarcodeFormat.RSS_EXPANDED, theResult.getBarcodeFormat());

  ParsedResult result = ResultParser.parseResult(theResult);

  assertEquals(expected, result);
}
项目:dev    文件:RSSExpandedImage2resultTestCase.java   
private static void assertCorrectImage2result(String path, ExpandedProductParsedResult expected)
    throws IOException, NotFoundException {
  RSSExpandedReader rssExpandedReader = new RSSExpandedReader();

  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)));
  int rowNumber = binaryMap.getHeight() / 2;
  BitArray row = binaryMap.getBlackRow(rowNumber, null);

  Result theResult = rssExpandedReader.decodeRow(rowNumber, row, null);

  assertSame(BarcodeFormat.RSS_EXPANDED, theResult.getBarcodeFormat());

  ParsedResult result = ResultParser.parseResult(theResult);

  assertEquals(expected, result);
}
项目:keepass2android    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:weex-3d-map    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:ZXingAndroidExt    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
    if (rawResult instanceof ProductParsedResult) {
        return ((ProductParsedResult) rawResult).getNormalizedProductID();
    }
    if (rawResult instanceof ExpandedProductParsedResult) {
        return ((ExpandedProductParsedResult) rawResult).getRawText();
    }
    throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:tvConnect_android    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:tvConnect_android    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:KeePass2Android    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:PortraitZXing    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
    if (rawResult instanceof ProductParsedResult) {
        return ((ProductParsedResult) rawResult).getNormalizedProductID();
    }
    if (rawResult instanceof ExpandedProductParsedResult) {
        return ((ExpandedProductParsedResult) rawResult).getRawText();
    }
    throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:PortraitZXing    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
    if (rawResult instanceof ProductParsedResult) {
        return ((ProductParsedResult) rawResult).getNormalizedProductID();
    }
    if (rawResult instanceof ExpandedProductParsedResult) {
        return ((ExpandedProductParsedResult) rawResult).getRawText();
    }
    throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:PortraitZXing    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
    if (rawResult instanceof ProductParsedResult) {
        return ((ProductParsedResult) rawResult).getNormalizedProductID();
    }
    if (rawResult instanceof ExpandedProductParsedResult) {
        return ((ExpandedProductParsedResult) rawResult).getRawText();
    }
    throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:PortraitZXing    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
    if (rawResult instanceof ProductParsedResult) {
        return ((ProductParsedResult) rawResult).getNormalizedProductID();
    }
    if (rawResult instanceof ExpandedProductParsedResult) {
        return ((ExpandedProductParsedResult) rawResult).getRawText();
    }
    throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:weex-analyzer-android    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:weex-3d-map    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:Weex-TestDemo    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:weex    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:faims-android    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:zxing-bsplus    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:zxing-bsplus    文件:RSSExpandedImage2resultTestCase.java   
@Test
public void testDecodeRow2result_2() throws Exception {
  // (01)90012345678908(3103)001750
  ExpandedProductParsedResult expected =
      new ExpandedProductParsedResult("(01)90012345678908(3103)001750",
                                      "90012345678908",
                                      null, null, null, null, null, null,
                                      "001750",
                                      ExpandedProductParsedResult.KILOGRAM,
                                      "3", null, null, null, new HashMap<String,String>());

  assertCorrectImage2result("2.png", expected);
}
项目:zxing-android-portrait    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}
项目:dev    文件:RSSExpandedImage2resultTestCase.java   
@Test
public void testDecodeRow2result_2() throws Exception {
  // (01)90012345678908(3103)001750
  String path = "test/data/blackbox/rssexpanded-1/2.jpg";
  ExpandedProductParsedResult expected =
      new ExpandedProductParsedResult("90012345678908",
                                      null, null, null, null, null, null,
                                      "001750",
                                      ExpandedProductParsedResult.KILOGRAM,
                                      "3", null, null, null, new HashMap<String,String>());

  assertCorrectImage2result(path, expected);
}
项目:ZxingCore    文件:RSSExpandedImage2resultTestCase.java   
@Test
public void testDecodeRow2result_2() throws Exception {
  // (01)90012345678908(3103)001750
  String path = "test/data/blackbox/rssexpanded-1/2.png";
  ExpandedProductParsedResult expected =
      new ExpandedProductParsedResult("(01)90012345678908(3103)001750",
                                      "90012345678908",
                                      null, null, null, null, null, null,
                                      "001750",
                                      ExpandedProductParsedResult.KILOGRAM,
                                      "3", null, null, null, new HashMap<String,String>());

  assertCorrectImage2result(path, expected);
}
项目:ZxingCore    文件:RSSExpandedImage2resultTestCase.java   
private static void assertCorrectImage2result(String path, ExpandedProductParsedResult expected)
    throws IOException, NotFoundException {

  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)));
  int rowNumber = binaryMap.getHeight() / 2;
  BitArray row = binaryMap.getBlackRow(rowNumber, null);

  Result theResult;
  try {
    RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
    theResult = rssExpandedReader.decodeRow(rowNumber, row, null);
  } catch (ReaderException re) {
    fail(re.toString());
    return;
  }

  assertSame(BarcodeFormat.RSS_EXPANDED, theResult.getBarcodeFormat());

  ParsedResult result = ResultParser.parseResult(theResult);

  assertEquals(expected, result);
}
项目:zxingfragmentlib    文件:ProductResultHandler.java   
private static String getProductIDFromResult(ParsedResult rawResult) {
  if (rawResult instanceof ProductParsedResult) {
    return ((ProductParsedResult) rawResult).getNormalizedProductID();
  }
  if (rawResult instanceof ExpandedProductParsedResult) {
    return ((ExpandedProductParsedResult) rawResult).getRawText();
  }
  throw new IllegalArgumentException(rawResult.getClass().toString());
}