mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
llm mig 8to17 core
This commit is contained in:
parent
9598db91c7
commit
b4e0e54b6b
|
@ -42,8 +42,7 @@ public final class Dimension {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
if (other instanceof Dimension) {
|
if (other instanceof Dimension d) {
|
||||||
Dimension d = (Dimension) other;
|
|
||||||
return width == d.width && height == d.height;
|
return width == d.width && height == d.height;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -159,12 +159,10 @@ public final class MultiFormatReader implements Reader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
if (readers != null) {
|
|
||||||
for (Reader reader : readers) {
|
for (Reader reader : readers) {
|
||||||
reader.reset();
|
reader.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private Result decodeInternal(BinaryBitmap image) throws NotFoundException {
|
private Result decodeInternal(BinaryBitmap image) throws NotFoundException {
|
||||||
if (readers != null) {
|
if (readers != null) {
|
||||||
|
|
|
@ -89,9 +89,7 @@ public final class AztecReader implements Reader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hints != null) {
|
if (hints != null && hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK) instanceof ResultPointCallback rpcb) {
|
||||||
ResultPointCallback rpcb = (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
|
|
||||||
if (rpcb != null) {
|
|
||||||
for (ResultPoint point : points) {
|
for (ResultPoint point : points) {
|
||||||
rpcb.foundPossibleResultPoint(point);
|
rpcb.foundPossibleResultPoint(point);
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,8 +134,7 @@ public final class Encoder {
|
||||||
compact = userSpecifiedLayers < 0;
|
compact = userSpecifiedLayers < 0;
|
||||||
layers = Math.abs(userSpecifiedLayers);
|
layers = Math.abs(userSpecifiedLayers);
|
||||||
if (layers > (compact ? MAX_NB_BITS_COMPACT : MAX_NB_BITS)) {
|
if (layers > (compact ? MAX_NB_BITS_COMPACT : MAX_NB_BITS)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(String.format("Illegal value %s for layers", userSpecifiedLayers));
|
||||||
String.format("Illegal value %s for layers", userSpecifiedLayers));
|
|
||||||
}
|
}
|
||||||
totalBitsInLayer = totalBitsInLayer(layers, compact);
|
totalBitsInLayer = totalBitsInLayer(layers, compact);
|
||||||
wordSize = WORD_SIZE[layers];
|
wordSize = WORD_SIZE[layers];
|
||||||
|
|
|
@ -42,7 +42,7 @@ public final class AddressBookDoCoMoResultParser extends AbstractDoCoMoResultPar
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String[] rawName = matchDoCoMoPrefixedField("N:", rawText);
|
String[] rawName = matchDoCoMoPrefixedField("N:", rawText);
|
||||||
if (rawName == null) {
|
if (rawName == null || rawName.length == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String name = parseName(rawName[0]);
|
String name = parseName(rawName[0]);
|
||||||
|
|
|
@ -93,12 +93,7 @@ public final class ExpandedProductParsedResult extends ParsedResult {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (!(o instanceof ExpandedProductParsedResult)) {
|
if (o instanceof ExpandedProductParsedResult other) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExpandedProductParsedResult other = (ExpandedProductParsedResult) o;
|
|
||||||
|
|
||||||
return Objects.equals(productID, other.productID)
|
return Objects.equals(productID, other.productID)
|
||||||
&& Objects.equals(sscc, other.sscc)
|
&& Objects.equals(sscc, other.sscc)
|
||||||
&& Objects.equals(lotNumber, other.lotNumber)
|
&& Objects.equals(lotNumber, other.lotNumber)
|
||||||
|
@ -113,6 +108,8 @@ public final class ExpandedProductParsedResult extends ParsedResult {
|
||||||
&& Objects.equals(priceCurrency, other.priceCurrency)
|
&& Objects.equals(priceCurrency, other.priceCurrency)
|
||||||
&& Objects.equals(uncommonAIs, other.uncommonAIs);
|
&& Objects.equals(uncommonAIs, other.uncommonAIs);
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
|
|
|
@ -39,7 +39,6 @@ import java.util.regex.Pattern;
|
||||||
*/
|
*/
|
||||||
public abstract class ResultParser {
|
public abstract class ResultParser {
|
||||||
|
|
||||||
private static final ResultParser[] PARSERS = {
|
|
||||||
new BookmarkDoCoMoResultParser(),
|
new BookmarkDoCoMoResultParser(),
|
||||||
new AddressBookDoCoMoResultParser(),
|
new AddressBookDoCoMoResultParser(),
|
||||||
new EmailDoCoMoResultParser(),
|
new EmailDoCoMoResultParser(),
|
||||||
|
@ -61,9 +60,7 @@ public abstract class ResultParser {
|
||||||
new ExpandedProductResultParser(),
|
new ExpandedProductResultParser(),
|
||||||
new VINResultParser(),
|
new VINResultParser(),
|
||||||
};
|
};
|
||||||
|
private static final Pattern EQUALS = Pattern.compile("=");
|
||||||
private static final Pattern DIGITS = Pattern.compile("\\d+");
|
|
||||||
private static final Pattern AMPERSAND = Pattern.compile("&");
|
|
||||||
private static final Pattern EQUALS = Pattern.compile("=");
|
private static final Pattern EQUALS = Pattern.compile("=");
|
||||||
private static final String BYTE_ORDER_MARK = "\ufeff";
|
private static final String BYTE_ORDER_MARK = "\ufeff";
|
||||||
|
|
||||||
|
@ -152,7 +149,7 @@ public abstract class ResultParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean isStringOfDigits(CharSequence value, int length) {
|
protected static boolean isStringOfDigits(CharSequence value, int length) {
|
||||||
return value != null && length > 0 && length == value.length() && DIGITS.matcher(value).matches();
|
return value != null && length > 0 && length == value.length() && Pattern.matches("\\\\d+", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean isSubstringOfDigits(CharSequence value, int offset, int length) {
|
protected static boolean isSubstringOfDigits(CharSequence value, int offset, int length) {
|
||||||
|
@ -160,7 +157,7 @@ public abstract class ResultParser {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int max = offset + length;
|
int max = offset + length;
|
||||||
return value.length() >= max && DIGITS.matcher(value.subSequence(offset, max)).matches();
|
return value.length() >= max && Pattern.matches("\\\\d+", value.subSequence(offset, max));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<String,String> parseNameValuePairs(String uri) {
|
static Map<String,String> parseNameValuePairs(String uri) {
|
||||||
|
@ -169,7 +166,7 @@ public abstract class ResultParser {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Map<String,String> result = new HashMap<>(3);
|
Map<String,String> result = new HashMap<>(3);
|
||||||
for (String keyValue : AMPERSAND.split(uri.substring(paramStart + 1))) {
|
for (String keyValue : uri.substring(paramStart + 1).split("&")) {
|
||||||
appendKeyValue(keyValue, result);
|
appendKeyValue(keyValue, result);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -254,8 +251,7 @@ public abstract class ResultParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
static String matchSinglePrefixedField(String prefix, String rawText, char endChar, boolean trim) {
|
static String matchSinglePrefixedField(String prefix, String rawText, char endChar, boolean trim) {
|
||||||
String[] matches = matchPrefixedField(prefix, rawText, endChar, trim);
|
String[] matches = matchPrefixedField(prefix, rawText, endChar, trim);\n return matches == null ? null : matches[0];
|
||||||
return matches == null ? null : matches[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -80,7 +80,7 @@ public final class SMSParsedResult extends ParsedResult {
|
||||||
result.append('&');
|
result.append('&');
|
||||||
}
|
}
|
||||||
result.append("subject=");
|
result.append("subject=");
|
||||||
result.append(subject);
|
result.append(subject);\n }\n }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result.toString();
|
return result.toString();
|
||||||
|
|
|
@ -21,13 +21,13 @@ package com.google.zxing.client.result;
|
||||||
*
|
*
|
||||||
* @author Sean Owen
|
* @author Sean Owen
|
||||||
*/
|
*/
|
||||||
public final class TelParsedResult extends ParsedResult {
|
public final class TelResult extends ParsedResult {
|
||||||
|
|
||||||
private final String number;
|
private final String number;
|
||||||
private final String telURI;
|
private final String telURI;
|
||||||
private final String title;
|
private final String title;
|
||||||
|
|
||||||
public TelParsedResult(String number, String telURI, String title) {
|
public TelResult(String number, String telURI, String title) {
|
||||||
super(ParsedResultType.TEL);
|
super(ParsedResultType.TEL);
|
||||||
this.number = number;
|
this.number = number;
|
||||||
this.telURI = telURI;
|
this.telURI = telURI;
|
||||||
|
|
Loading…
Reference in a new issue