llm mig 8to17 core

This commit is contained in:
Anjali Sridhar 2024-10-14 16:37:16 -07:00
parent 9598db91c7
commit b4e0e54b6b
10 changed files with 39 additions and 52 deletions

View file

@ -42,8 +42,7 @@ public final class Dimension {
@Override
public boolean equals(Object other) {
if (other instanceof Dimension) {
Dimension d = (Dimension) other;
if (other instanceof Dimension d) {
return width == d.width && height == d.height;
}
return false;
@ -59,4 +58,4 @@ public final class Dimension {
return width + "x" + height;
}
}
}

View file

@ -159,10 +159,8 @@ public final class MultiFormatReader implements Reader {
@Override
public void reset() {
if (readers != null) {
for (Reader reader : readers) {
reader.reset();
}
for (Reader reader : readers) {
reader.reset();
}
}
@ -196,4 +194,4 @@ public final class MultiFormatReader implements Reader {
throw NotFoundException.getNotFoundInstance();
}
}
}

View file

@ -89,9 +89,7 @@ public final class AztecReader implements Reader {
}
}
if (hints != null) {
ResultPointCallback rpcb = (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
if (rpcb != null) {
if (hints != null && hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK) instanceof ResultPointCallback rpcb) {
for (ResultPoint point : points) {
rpcb.foundPossibleResultPoint(point);
}
@ -125,4 +123,4 @@ public final class AztecReader implements Reader {
// do nothing
}
}
}

View file

@ -134,8 +134,7 @@ public final class Encoder {
compact = userSpecifiedLayers < 0;
layers = Math.abs(userSpecifiedLayers);
if (layers > (compact ? MAX_NB_BITS_COMPACT : MAX_NB_BITS)) {
throw new IllegalArgumentException(
String.format("Illegal value %s for layers", userSpecifiedLayers));
throw new IllegalArgumentException(String.format("Illegal value %s for layers", userSpecifiedLayers));
}
totalBitsInLayer = totalBitsInLayer(layers, compact);
wordSize = WORD_SIZE[layers];
@ -401,4 +400,4 @@ public final class Encoder {
private static int totalBitsInLayer(int layers, boolean compact) {
return ((compact ? 88 : 112) + 16 * layers) * layers;
}
}
}

View file

@ -42,7 +42,7 @@ public final class AddressBookDoCoMoResultParser extends AbstractDoCoMoResultPar
return null;
}
String[] rawName = matchDoCoMoPrefixedField("N:", rawText);
if (rawName == null) {
if (rawName == null || rawName.length == 0) {
return null;
}
String name = parseName(rawName[0]);
@ -89,4 +89,4 @@ public final class AddressBookDoCoMoResultParser extends AbstractDoCoMoResultPar
return name;
}
}
}

View file

@ -93,25 +93,22 @@ public final class ExpandedProductParsedResult extends ParsedResult {
@Override
public boolean equals(Object o) {
if (!(o instanceof ExpandedProductParsedResult)) {
return false;
if (o instanceof ExpandedProductParsedResult other) {
return Objects.equals(productID, other.productID)
&& Objects.equals(sscc, other.sscc)
&& Objects.equals(lotNumber, other.lotNumber)
&& Objects.equals(productionDate, other.productionDate)
&& Objects.equals(bestBeforeDate, other.bestBeforeDate)
&& Objects.equals(expirationDate, other.expirationDate)
&& Objects.equals(weight, other.weight)
&& Objects.equals(weightType, other.weightType)
&& Objects.equals(weightIncrement, other.weightIncrement)
&& Objects.equals(price, other.price)
&& Objects.equals(priceIncrement, other.priceIncrement)
&& Objects.equals(priceCurrency, other.priceCurrency)
&& Objects.equals(uncommonAIs, other.uncommonAIs);
}
ExpandedProductParsedResult other = (ExpandedProductParsedResult) o;
return Objects.equals(productID, other.productID)
&& Objects.equals(sscc, other.sscc)
&& Objects.equals(lotNumber, other.lotNumber)
&& Objects.equals(productionDate, other.productionDate)
&& Objects.equals(bestBeforeDate, other.bestBeforeDate)
&& Objects.equals(expirationDate, other.expirationDate)
&& Objects.equals(weight, other.weight)
&& Objects.equals(weightType, other.weightType)
&& Objects.equals(weightIncrement, other.weightIncrement)
&& Objects.equals(price, other.price)
&& Objects.equals(priceIncrement, other.priceIncrement)
&& Objects.equals(priceCurrency, other.priceCurrency)
&& Objects.equals(uncommonAIs, other.uncommonAIs);
return false;
}
@Override
@ -196,4 +193,4 @@ public final class ExpandedProductParsedResult extends ParsedResult {
public String getDisplayResult() {
return String.valueOf(rawText);
}
}
}

View file

@ -174,7 +174,7 @@ public final class ExpandedProductResultParser extends ResultParser {
private static String findAIvalue(int i, String rawText) {
char c = rawText.charAt(i);
// First character must be a open parenthesis.If not, ERROR
// First character must be a open parenthesis. If not, ERROR
if (c != '(') {
return null;
}
@ -214,4 +214,4 @@ public final class ExpandedProductResultParser extends ResultParser {
}
return buf.toString();
}
}
}

View file

@ -39,7 +39,6 @@ import java.util.regex.Pattern;
*/
public abstract class ResultParser {
private static final ResultParser[] PARSERS = {
new BookmarkDoCoMoResultParser(),
new AddressBookDoCoMoResultParser(),
new EmailDoCoMoResultParser(),
@ -61,9 +60,7 @@ public abstract class ResultParser {
new ExpandedProductResultParser(),
new VINResultParser(),
};
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";
@ -114,7 +111,7 @@ public abstract class ResultParser {
}
protected static String[] maybeWrap(String value) {
return value == null ? null : new String[] { value };
return value == null ? null : new String[] {value};
}
protected static String unescapeBackslash(String escaped) {
@ -152,7 +149,7 @@ public abstract class ResultParser {
}
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) {
@ -160,7 +157,7 @@ public abstract class ResultParser {
return false;
}
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) {
@ -169,7 +166,7 @@ public abstract class ResultParser {
return null;
}
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);
}
return result;
@ -254,8 +251,7 @@ public abstract class ResultParser {
}
static String matchSinglePrefixedField(String prefix, String rawText, char endChar, boolean trim) {
String[] matches = matchPrefixedField(prefix, rawText, endChar, trim);
return matches == null ? null : matches[0];
String[] matches = matchPrefixedField(prefix, rawText, endChar, trim);\n return matches == null ? null : matches[0];
}
}
}

View file

@ -80,7 +80,7 @@ public final class SMSParsedResult extends ParsedResult {
result.append('&');
}
result.append("subject=");
result.append(subject);
result.append(subject);\n }\n }
}
}
return result.toString();

View file

@ -21,13 +21,13 @@ package com.google.zxing.client.result;
*
* @author Sean Owen
*/
public final class TelParsedResult extends ParsedResult {
public final class TelResult extends ParsedResult {
private final String number;
private final String telURI;
private final String title;
public TelParsedResult(String number, String telURI, String title) {
public TelResult(String number, String telURI, String title) {
super(ParsedResultType.TEL);
this.number = number;
this.telURI = telURI;