diff --git a/java_test/java/com/google/zxing/aztec/decoder/DecoderTest.java b/java_test/java/com/google/zxing/aztec/decoder/DecoderTest.java
index e7cafa2..dc4681f 100644
--- a/java_test/java/com/google/zxing/aztec/decoder/DecoderTest.java
+++ b/java_test/java/com/google/zxing/aztec/decoder/DecoderTest.java
@@ -18,11 +18,11 @@ package com.google.zxing.aztec.decoder;
import com.google.zxing.aztec.encoder.EncoderTest;
import com.google.zxing.FormatException;
-import com.google.zxing.ResultPoint;
-import com.google.zxing.aztec.AztecDetectorResult;
+import com.google.zxing.RXingResultPoint;
+import com.google.zxing.aztec.AztecDetectorRXingResult;
import com.google.zxing.common.BitArray;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.common.DecoderRXingResult;
import org.junit.Test;
import org.junit.Assert;
@@ -31,7 +31,7 @@ import org.junit.Assert;
*/
public final class DecoderTest extends Assert {
- private static final ResultPoint[] NO_POINTS = new ResultPoint[0];
+ private static final RXingResultPoint[] NO_POINTS = new RXingResultPoint[0];
@Test
public void testHighLevelDecode() throws FormatException {
@@ -64,7 +64,7 @@ public final class DecoderTest extends Assert {
}
@Test
- public void testAztecResult() throws FormatException {
+ public void testAztecRXingResult() throws FormatException {
BitMatrix matrix = BitMatrix.parse(
"X X X X X X X X X X X X X X \n" +
"X X X X X X X X X X X X X X X \n" +
@@ -90,8 +90,8 @@ public final class DecoderTest extends Assert {
"X X X X X X X X X X X X X X \n" +
" X X X X X X X X X X X X X \n",
"X ", " ");
- AztecDetectorResult r = new AztecDetectorResult(matrix, NO_POINTS, false, 30, 2);
- DecoderResult result = new Decoder().decode(r);
+ AztecDetectorRXingResult r = new AztecDetectorRXingResult(matrix, NO_POINTS, false, 30, 2);
+ DecoderRXingResult result = new Decoder().decode(r);
assertEquals("88888TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT", result.getText());
assertArrayEquals(
new byte[] {-11, 85, 85, 117, 107, 90, -42, -75, -83, 107,
@@ -102,7 +102,7 @@ public final class DecoderTest extends Assert {
}
@Test
- public void testAztecResultECI() throws FormatException {
+ public void testAztecRXingResultECI() throws FormatException {
BitMatrix matrix = BitMatrix.parse(
" X X X X X X \n" +
" X X X X X X X X X X X X \n" +
@@ -124,8 +124,8 @@ public final class DecoderTest extends Assert {
" X X X X X X X X X X X \n" +
"X X X X X X X X \n",
"X ", " ");
- AztecDetectorResult r = new AztecDetectorResult(matrix, NO_POINTS, false, 15, 1);
- DecoderResult result = new Decoder().decode(r);
+ AztecDetectorRXingResult r = new AztecDetectorRXingResult(matrix, NO_POINTS, false, 15, 1);
+ DecoderRXingResult result = new Decoder().decode(r);
assertEquals("Français", result.getText());
}
@@ -160,7 +160,7 @@ public final class DecoderTest extends Assert {
+ "X X X X . . . X . . X X X . X X . . X . . . . X X X . \n"
+ "X X . X . X . . . X . X . . . . X X . X . . X X . . . \n",
"X ", ". ");
- AztecDetectorResult r = new AztecDetectorResult(matrix, NO_POINTS, true, 16, 4);
+ AztecDetectorRXingResult r = new AztecDetectorRXingResult(matrix, NO_POINTS, true, 16, 4);
new Decoder().decode(r);
}
@@ -195,7 +195,7 @@ public final class DecoderTest extends Assert {
+ ". X X X X . . X . . X X X . X X . . X . . . . X X X . \n"
+ "X X . . . X X . . X . X . . . . X X . X . . X . X . X \n",
"X ", ". ");
- AztecDetectorResult r = new AztecDetectorResult(matrix, NO_POINTS, true, 16, 4);
+ AztecDetectorRXingResult r = new AztecDetectorRXingResult(matrix, NO_POINTS, true, 16, 4);
new Decoder().decode(r);
}
diff --git a/java_test/java/com/google/zxing/aztec/detector/DetectorTest.java b/java_test/java/com/google/zxing/aztec/detector/DetectorTest.java
index 6d3afa6..0521da6 100644
--- a/java_test/java/com/google/zxing/aztec/detector/DetectorTest.java
+++ b/java_test/java/com/google/zxing/aztec/detector/DetectorTest.java
@@ -17,13 +17,13 @@
package com.google.zxing.aztec.detector;
import com.google.zxing.NotFoundException;
-import com.google.zxing.aztec.AztecDetectorResult;
+import com.google.zxing.aztec.AztecDetectorRXingResult;
import com.google.zxing.aztec.decoder.Decoder;
import com.google.zxing.aztec.detector.Detector.Point;
import com.google.zxing.aztec.encoder.AztecCode;
import com.google.zxing.aztec.encoder.Encoder;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.common.DecoderRXingResult;
import org.junit.Assert;
import org.junit.Test;
@@ -78,11 +78,11 @@ public final class DetectorTest extends Assert {
copy.flip(orientationPoints.get(error2).getX(), orientationPoints.get(error2).getY());
}
// The detector doesn't seem to work when matrix bits are only 1x1. So magnify.
- AztecDetectorResult r = new Detector(makeLarger(copy, 3)).detect(isMirror);
+ AztecDetectorRXingResult r = new Detector(makeLarger(copy, 3)).detect(isMirror);
assertNotNull(r);
assertEquals(r.getNbLayers(), layers);
assertEquals(r.isCompact(), compact);
- DecoderResult res = new Decoder().decode(r);
+ DecoderRXingResult res = new Decoder().decode(r);
assertEquals(data, res.getText());
}
}
diff --git a/java_test/java/com/google/zxing/aztec/encoder/EncoderTest.java b/java_test/java/com/google/zxing/aztec/encoder/EncoderTest.java
index b8aa838..5952f0a 100644
--- a/java_test/java/com/google/zxing/aztec/encoder/EncoderTest.java
+++ b/java_test/java/com/google/zxing/aztec/encoder/EncoderTest.java
@@ -19,13 +19,13 @@ package com.google.zxing.aztec.encoder;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.FormatException;
-import com.google.zxing.ResultPoint;
-import com.google.zxing.aztec.AztecDetectorResult;
+import com.google.zxing.RXingResultPoint;
+import com.google.zxing.aztec.AztecDetectorRXingResult;
import com.google.zxing.aztec.AztecWriter;
import com.google.zxing.aztec.decoder.Decoder;
import com.google.zxing.common.BitArray;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.common.DecoderRXingResult;
import org.junit.Assert;
import org.junit.Test;
@@ -52,7 +52,7 @@ public final class EncoderTest extends Assert {
private static final Pattern DOTX = Pattern.compile("[^.X]");
private static final Pattern SPACES = Pattern.compile("\\s+");
- private static final ResultPoint[] NO_POINTS = new ResultPoint[0];
+ private static final RXingResultPoint[] NO_POINTS = new RXingResultPoint[0];
// real life tests
@@ -492,9 +492,9 @@ public final class EncoderTest extends Assert {
assertEquals("Unexpected symbol format (compact)", compact, aztec.isCompact());
assertEquals("Unexpected nr. of layers", layers, aztec.getLayers());
BitMatrix matrix = aztec.getMatrix();
- AztecDetectorResult r =
- new AztecDetectorResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
- DecoderResult res = new Decoder().decode(r);
+ AztecDetectorRXingResult r =
+ new AztecDetectorRXingResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
+ DecoderRXingResult res = new Decoder().decode(r);
assertEquals(data, res.getText());
// Check error correction by introducing a few minor errors
Random random = getPseudoRandom();
@@ -502,7 +502,7 @@ public final class EncoderTest extends Assert {
matrix.flip(random.nextInt(matrix.getWidth()), matrix.getHeight() - 2 + random.nextInt(2));
matrix.flip(random.nextInt(2), random.nextInt(matrix.getHeight()));
matrix.flip(matrix.getWidth() - 2 + random.nextInt(2), random.nextInt(matrix.getHeight()));
- r = new AztecDetectorResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
+ r = new AztecDetectorRXingResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
res = new Decoder().decode(r);
assertEquals(data, res.getText());
}
@@ -526,9 +526,9 @@ public final class EncoderTest extends Assert {
assertEquals("Unexpected nr. of layers", layers, aztec.getLayers());
BitMatrix matrix2 = aztec.getMatrix();
assertEquals(matrix, matrix2);
- AztecDetectorResult r =
- new AztecDetectorResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
- DecoderResult res = new Decoder().decode(r);
+ AztecDetectorRXingResult r =
+ new AztecDetectorRXingResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
+ DecoderRXingResult res = new Decoder().decode(r);
assertEquals(data, res.getText());
// Check error correction by introducing up to eccPercent/2 errors
int ecWords = aztec.getCodeWords() * eccPercent / 100 / 2;
@@ -543,7 +543,7 @@ public final class EncoderTest extends Assert {
: matrix.getHeight() - 1 - random.nextInt(aztec.getLayers() * 2);
matrix.flip(x, y);
}
- r = new AztecDetectorResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
+ r = new AztecDetectorRXingResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
res = new Decoder().decode(r);
assertEquals(data, res.getText());
}
diff --git a/java_test/java/com/google/zxing/client/result/AddressBookParsedResultTestCase.java b/java_test/java/com/google/zxing/client/result/AddressBookParsedResultTestCase.java
index 2e090a5..a2b734e 100644
--- a/java_test/java/com/google/zxing/client/result/AddressBookParsedResultTestCase.java
+++ b/java_test/java/com/google/zxing/client/result/AddressBookParsedResultTestCase.java
@@ -17,16 +17,16 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Assert;
import org.junit.Test;
/**
- * Tests {@link AddressBookParsedResult}.
+ * Tests {@link AddressBookParsedRXingResult}.
*
* @author Sean Owen
*/
-public final class AddressBookParsedResultTestCase extends Assert {
+public final class AddressBookParsedRXingResultTestCase extends Assert {
@Test
public void testAddressBookDocomo() {
@@ -149,21 +149,21 @@ public final class AddressBookParsedResultTestCase extends Assert {
String[] urls,
String birthday,
String note) {
- Result fakeResult = new Result(contents, null, null, BarcodeFormat.QR_CODE);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertSame(ParsedResultType.ADDRESSBOOK, result.getType());
- AddressBookParsedResult addressResult = (AddressBookParsedResult) result;
- assertEquals(title, addressResult.getTitle());
- assertArrayEquals(names, addressResult.getNames());
- assertEquals(pronunciation, addressResult.getPronunciation());
- assertArrayEquals(addresses, addressResult.getAddresses());
- assertArrayEquals(emails, addressResult.getEmails());
- assertArrayEquals(phoneNumbers, addressResult.getPhoneNumbers());
- assertArrayEquals(phoneTypes, addressResult.getPhoneTypes());
- assertEquals(org, addressResult.getOrg());
- assertArrayEquals(urls, addressResult.getURLs());
- assertEquals(birthday, addressResult.getBirthday());
- assertEquals(note, addressResult.getNote());
+ RXingResult fakeRXingResult = new RXingResult(contents, null, null, BarcodeFormat.QR_CODE);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertSame(ParsedRXingResultType.ADDRESSBOOK, result.getType());
+ AddressBookParsedRXingResult addressRXingResult = (AddressBookParsedRXingResult) result;
+ assertEquals(title, addressRXingResult.getTitle());
+ assertArrayEquals(names, addressRXingResult.getNames());
+ assertEquals(pronunciation, addressRXingResult.getPronunciation());
+ assertArrayEquals(addresses, addressRXingResult.getAddresses());
+ assertArrayEquals(emails, addressRXingResult.getEmails());
+ assertArrayEquals(phoneNumbers, addressRXingResult.getPhoneNumbers());
+ assertArrayEquals(phoneTypes, addressRXingResult.getPhoneTypes());
+ assertEquals(org, addressRXingResult.getOrg());
+ assertArrayEquals(urls, addressRXingResult.getURLs());
+ assertEquals(birthday, addressRXingResult.getBirthday());
+ assertEquals(note, addressRXingResult.getNote());
}
}
diff --git a/java_test/java/com/google/zxing/client/result/CalendarParsedResultTestCase.java b/java_test/java/com/google/zxing/client/result/CalendarParsedResultTestCase.java
index 2b79107..9c91cdd 100644
--- a/java_test/java/com/google/zxing/client/result/CalendarParsedResultTestCase.java
+++ b/java_test/java/com/google/zxing/client/result/CalendarParsedResultTestCase.java
@@ -17,7 +17,7 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -28,11 +28,11 @@ import java.util.Locale;
import java.util.TimeZone;
/**
- * Tests {@link CalendarParsedResult}.
+ * Tests {@link CalendarParsedRXingResult}.
*
* @author Sean Owen
*/
-public final class CalendarParsedResultTestCase extends Assert {
+public final class CalendarParsedRXingResultTestCase extends Assert {
private static final double EPSILON = 1.0E-10;
@@ -142,11 +142,11 @@ public final class CalendarParsedResultTestCase extends Assert {
@Test
public void testBadGeo() {
// Not parsed as VEVENT
- Result fakeResult = new Result("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\n" +
+ RXingResult fakeRXingResult = new RXingResult("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\n" +
"GEO:-12.345\r\n" +
"END:VEVENT\r\nEND:VCALENDAR", null, null, BarcodeFormat.QR_CODE);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertSame(ParsedResultType.TEXT, result.getType());
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertSame(ParsedRXingResultType.TEXT, result.getType());
}
@Test
@@ -223,20 +223,20 @@ public final class CalendarParsedResultTestCase extends Assert {
String[] attendees,
double latitude,
double longitude) {
- Result fakeResult = new Result(contents, null, null, BarcodeFormat.QR_CODE);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertSame(ParsedResultType.CALENDAR, result.getType());
- CalendarParsedResult calResult = (CalendarParsedResult) result;
- assertEquals(description, calResult.getDescription());
- assertEquals(summary, calResult.getSummary());
- assertEquals(location, calResult.getLocation());
+ RXingResult fakeRXingResult = new RXingResult(contents, null, null, BarcodeFormat.QR_CODE);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertSame(ParsedRXingResultType.CALENDAR, result.getType());
+ CalendarParsedRXingResult calRXingResult = (CalendarParsedRXingResult) result;
+ assertEquals(description, calRXingResult.getDescription());
+ assertEquals(summary, calRXingResult.getSummary());
+ assertEquals(location, calRXingResult.getLocation());
DateFormat dateFormat = makeGMTFormat();
- assertEquals(startString, dateFormat.format(calResult.getStartTimestamp()));
- assertEquals(endString, calResult.getEndTimestamp() < 0L ? null : dateFormat.format(calResult.getEndTimestamp()));
- assertEquals(organizer, calResult.getOrganizer());
- assertArrayEquals(attendees, calResult.getAttendees());
- assertEqualOrNaN(latitude, calResult.getLatitude());
- assertEqualOrNaN(longitude, calResult.getLongitude());
+ assertEquals(startString, dateFormat.format(calRXingResult.getStartTimestamp()));
+ assertEquals(endString, calRXingResult.getEndTimestamp() < 0L ? null : dateFormat.format(calRXingResult.getEndTimestamp()));
+ assertEquals(organizer, calRXingResult.getOrganizer());
+ assertArrayEquals(attendees, calRXingResult.getAttendees());
+ assertEqualOrNaN(latitude, calRXingResult.getLatitude());
+ assertEqualOrNaN(longitude, calRXingResult.getLongitude());
}
private static void assertEqualOrNaN(double expected, double actual) {
diff --git a/java_test/java/com/google/zxing/client/result/EmailAddressParsedResultTestCase.java b/java_test/java/com/google/zxing/client/result/EmailAddressParsedResultTestCase.java
index 28e5da7..6509879 100644
--- a/java_test/java/com/google/zxing/client/result/EmailAddressParsedResultTestCase.java
+++ b/java_test/java/com/google/zxing/client/result/EmailAddressParsedResultTestCase.java
@@ -17,16 +17,16 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Assert;
import org.junit.Test;
/**
- * Tests {@link EmailAddressParsedResult}.
+ * Tests {@link EmailAddressParsedRXingResult}.
*
* @author Sean Owen
*/
-public final class EmailAddressParsedResultTestCase extends Assert {
+public final class EmailAddressParsedRXingResultTestCase extends Assert {
@Test
public void testEmailAddress() {
@@ -107,15 +107,15 @@ public final class EmailAddressParsedResultTestCase extends Assert {
String[] bccs,
String subject,
String body) {
- Result fakeResult = new Result(contents, null, null, BarcodeFormat.QR_CODE);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertSame(ParsedResultType.EMAIL_ADDRESS, result.getType());
- EmailAddressParsedResult emailResult = (EmailAddressParsedResult) result;
- assertArrayEquals(tos, emailResult.getTos());
- assertArrayEquals(ccs, emailResult.getCCs());
- assertArrayEquals(bccs, emailResult.getBCCs());
- assertEquals(subject, emailResult.getSubject());
- assertEquals(body, emailResult.getBody());
+ RXingResult fakeRXingResult = new RXingResult(contents, null, null, BarcodeFormat.QR_CODE);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertSame(ParsedRXingResultType.EMAIL_ADDRESS, result.getType());
+ EmailAddressParsedRXingResult emailRXingResult = (EmailAddressParsedRXingResult) result;
+ assertArrayEquals(tos, emailRXingResult.getTos());
+ assertArrayEquals(ccs, emailRXingResult.getCCs());
+ assertArrayEquals(bccs, emailRXingResult.getBCCs());
+ assertEquals(subject, emailRXingResult.getSubject());
+ assertEquals(body, emailRXingResult.getBody());
}
}
\ No newline at end of file
diff --git a/java_test/java/com/google/zxing/client/result/ExpandedProductParsedResultTestCase.java b/java_test/java/com/google/zxing/client/result/ExpandedProductParsedResultTestCase.java
index 861e663..dbe9f9c 100644
--- a/java_test/java/com/google/zxing/client/result/ExpandedProductParsedResultTestCase.java
+++ b/java_test/java/com/google/zxing/client/result/ExpandedProductParsedResultTestCase.java
@@ -27,7 +27,7 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Assert;
import org.junit.Test;
@@ -38,15 +38,15 @@ import java.util.Map;
* @author Antonio Manuel Benjumea Conde, Servinform, S.A.
* @author Agustín Delgado, Servinform, S.A.
*/
-public final class ExpandedProductParsedResultTestCase extends Assert {
+public final class ExpandedProductParsedRXingResultTestCase extends Assert {
@Test
public void testRSSExpanded() {
Map uncommonAIs = new HashMap<>();
uncommonAIs.put("123", "544654");
- Result result =
- new Result("(01)66546(13)001205(3932)4455(3102)6544(123)544654", null, null, BarcodeFormat.RSS_EXPANDED);
- ExpandedProductParsedResult o = new ExpandedProductResultParser().parse(result);
+ RXingResult result =
+ new RXingResult("(01)66546(13)001205(3932)4455(3102)6544(123)544654", null, null, BarcodeFormat.RSS_EXPANDED);
+ ExpandedProductParsedRXingResult o = new ExpandedProductRXingResultParser().parse(result);
assertNotNull(o);
assertEquals("66546", o.getProductID());
assertNull(o.getSscc());
diff --git a/java_test/java/com/google/zxing/client/result/GeoParsedResultTestCase.java b/java_test/java/com/google/zxing/client/result/GeoParsedResultTestCase.java
index 5280f4c..e048cbd 100644
--- a/java_test/java/com/google/zxing/client/result/GeoParsedResultTestCase.java
+++ b/java_test/java/com/google/zxing/client/result/GeoParsedResultTestCase.java
@@ -19,16 +19,16 @@ package com.google.zxing.client.result;
import java.util.Locale;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Assert;
import org.junit.Test;
/**
- * Tests {@link GeoParsedResult}.
+ * Tests {@link GeoParsedRXingResult}.
*
* @author Sean Owen
*/
-public final class GeoParsedResultTestCase extends Assert {
+public final class GeoParsedRXingResultTestCase extends Assert {
private static final double EPSILON = 1.0E-10;
@@ -47,15 +47,15 @@ public final class GeoParsedResultTestCase extends Assert {
double altitude,
String query,
String uri) {
- Result fakeResult = new Result(contents, null, null, BarcodeFormat.QR_CODE);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertSame(ParsedResultType.GEO, result.getType());
- GeoParsedResult geoResult = (GeoParsedResult) result;
- assertEquals(latitude, geoResult.getLatitude(), EPSILON);
- assertEquals(longitude, geoResult.getLongitude(), EPSILON);
- assertEquals(altitude, geoResult.getAltitude(), EPSILON);
- assertEquals(query, geoResult.getQuery());
- assertEquals(uri == null ? contents.toLowerCase(Locale.ENGLISH) : uri, geoResult.getGeoURI());
+ RXingResult fakeRXingResult = new RXingResult(contents, null, null, BarcodeFormat.QR_CODE);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertSame(ParsedRXingResultType.GEO, result.getType());
+ GeoParsedRXingResult geoRXingResult = (GeoParsedRXingResult) result;
+ assertEquals(latitude, geoRXingResult.getLatitude(), EPSILON);
+ assertEquals(longitude, geoRXingResult.getLongitude(), EPSILON);
+ assertEquals(altitude, geoRXingResult.getAltitude(), EPSILON);
+ assertEquals(query, geoRXingResult.getQuery());
+ assertEquals(uri == null ? contents.toLowerCase(Locale.ENGLISH) : uri, geoRXingResult.getGeoURI());
}
}
\ No newline at end of file
diff --git a/java_test/java/com/google/zxing/client/result/ISBNParsedResultTestCase.java b/java_test/java/com/google/zxing/client/result/ISBNParsedResultTestCase.java
index 76d096b..47c99d5 100644
--- a/java_test/java/com/google/zxing/client/result/ISBNParsedResultTestCase.java
+++ b/java_test/java/com/google/zxing/client/result/ISBNParsedResultTestCase.java
@@ -17,16 +17,16 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Assert;
import org.junit.Test;
/**
- * Tests {@link ISBNParsedResult}.
+ * Tests {@link ISBNParsedRXingResult}.
*
* @author Sean Owen
*/
-public final class ISBNParsedResultTestCase extends Assert {
+public final class ISBNParsedRXingResultTestCase extends Assert {
@Test
public void testISBN() {
@@ -34,11 +34,11 @@ public final class ISBNParsedResultTestCase extends Assert {
}
private static void doTest(String contents) {
- Result fakeResult = new Result(contents, null, null, BarcodeFormat.EAN_13);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertSame(ParsedResultType.ISBN, result.getType());
- ISBNParsedResult isbnResult = (ISBNParsedResult) result;
- assertEquals(contents, isbnResult.getISBN());
+ RXingResult fakeRXingResult = new RXingResult(contents, null, null, BarcodeFormat.EAN_13);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertSame(ParsedRXingResultType.ISBN, result.getType());
+ ISBNParsedRXingResult isbnRXingResult = (ISBNParsedRXingResult) result;
+ assertEquals(contents, isbnRXingResult.getISBN());
}
}
\ No newline at end of file
diff --git a/java_test/java/com/google/zxing/client/result/ParsedReaderResultTestCase.java b/java_test/java/com/google/zxing/client/result/ParsedReaderResultTestCase.java
index 1363aee..d23fd08 100644
--- a/java_test/java/com/google/zxing/client/result/ParsedReaderResultTestCase.java
+++ b/java_test/java/com/google/zxing/client/result/ParsedReaderResultTestCase.java
@@ -17,7 +17,7 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -28,12 +28,12 @@ import java.util.Locale;
import java.util.TimeZone;
/**
- * Tests {@link ParsedResult}.
+ * Tests {@link ParsedRXingResult}.
*
* @author Sean Owen
* @author dswitkin@google.com (Daniel Switkin)
*/
-public final class ParsedReaderResultTestCase extends Assert {
+public final class ParsedReaderRXingResultTestCase extends Assert {
@Before
public void setUp() {
@@ -43,208 +43,208 @@ public final class ParsedReaderResultTestCase extends Assert {
@Test
public void testTextType() {
- doTestResult("", "", ParsedResultType.TEXT);
- doTestResult("foo", "foo", ParsedResultType.TEXT);
- doTestResult("Hi.", "Hi.", ParsedResultType.TEXT);
- doTestResult("This is a test", "This is a test", ParsedResultType.TEXT);
- doTestResult("This is a test\nwith newlines", "This is a test\nwith newlines",
- ParsedResultType.TEXT);
- doTestResult("This: a test with lots of @ nearly-random punctuation! No? OK then.",
+ doTestRXingResult("", "", ParsedRXingResultType.TEXT);
+ doTestRXingResult("foo", "foo", ParsedRXingResultType.TEXT);
+ doTestRXingResult("Hi.", "Hi.", ParsedRXingResultType.TEXT);
+ doTestRXingResult("This is a test", "This is a test", ParsedRXingResultType.TEXT);
+ doTestRXingResult("This is a test\nwith newlines", "This is a test\nwith newlines",
+ ParsedRXingResultType.TEXT);
+ doTestRXingResult("This: a test with lots of @ nearly-random punctuation! No? OK then.",
"This: a test with lots of @ nearly-random punctuation! No? OK then.",
- ParsedResultType.TEXT);
+ ParsedRXingResultType.TEXT);
}
@Test
public void testBookmarkType() {
- doTestResult("MEBKM:URL:google.com;;", "http://google.com", ParsedResultType.URI);
- doTestResult("MEBKM:URL:google.com;TITLE:Google;;", "Google\nhttp://google.com",
- ParsedResultType.URI);
- doTestResult("MEBKM:TITLE:Google;URL:google.com;;", "Google\nhttp://google.com",
- ParsedResultType.URI);
- doTestResult("MEBKM:URL:http://google.com;;", "http://google.com", ParsedResultType.URI);
- doTestResult("MEBKM:URL:HTTPS://google.com;;", "HTTPS://google.com", ParsedResultType.URI);
+ doTestRXingResult("MEBKM:URL:google.com;;", "http://google.com", ParsedRXingResultType.URI);
+ doTestRXingResult("MEBKM:URL:google.com;TITLE:Google;;", "Google\nhttp://google.com",
+ ParsedRXingResultType.URI);
+ doTestRXingResult("MEBKM:TITLE:Google;URL:google.com;;", "Google\nhttp://google.com",
+ ParsedRXingResultType.URI);
+ doTestRXingResult("MEBKM:URL:http://google.com;;", "http://google.com", ParsedRXingResultType.URI);
+ doTestRXingResult("MEBKM:URL:HTTPS://google.com;;", "HTTPS://google.com", ParsedRXingResultType.URI);
}
@Test
public void testURLTOType() {
- doTestResult("urlto:foo:bar.com", "foo\nhttp://bar.com", ParsedResultType.URI);
- doTestResult("URLTO:foo:bar.com", "foo\nhttp://bar.com", ParsedResultType.URI);
- doTestResult("URLTO::bar.com", "http://bar.com", ParsedResultType.URI);
- doTestResult("URLTO::http://bar.com", "http://bar.com", ParsedResultType.URI);
+ doTestRXingResult("urlto:foo:bar.com", "foo\nhttp://bar.com", ParsedRXingResultType.URI);
+ doTestRXingResult("URLTO:foo:bar.com", "foo\nhttp://bar.com", ParsedRXingResultType.URI);
+ doTestRXingResult("URLTO::bar.com", "http://bar.com", ParsedRXingResultType.URI);
+ doTestRXingResult("URLTO::http://bar.com", "http://bar.com", ParsedRXingResultType.URI);
}
@Test
public void testEmailType() {
- doTestResult("MATMSG:TO:srowen@example.org;;",
- "srowen@example.org", ParsedResultType.EMAIL_ADDRESS);
- doTestResult("MATMSG:TO:srowen@example.org;SUB:Stuff;;", "srowen@example.org\nStuff",
- ParsedResultType.EMAIL_ADDRESS);
- doTestResult("MATMSG:TO:srowen@example.org;SUB:Stuff;BODY:This is some text;;",
- "srowen@example.org\nStuff\nThis is some text", ParsedResultType.EMAIL_ADDRESS);
- doTestResult("MATMSG:SUB:Stuff;BODY:This is some text;TO:srowen@example.org;;",
- "srowen@example.org\nStuff\nThis is some text", ParsedResultType.EMAIL_ADDRESS);
- doTestResult("TO:srowen@example.org;SUB:Stuff;BODY:This is some text;;",
- "TO:srowen@example.org;SUB:Stuff;BODY:This is some text;;", ParsedResultType.TEXT);
+ doTestRXingResult("MATMSG:TO:srowen@example.org;;",
+ "srowen@example.org", ParsedRXingResultType.EMAIL_ADDRESS);
+ doTestRXingResult("MATMSG:TO:srowen@example.org;SUB:Stuff;;", "srowen@example.org\nStuff",
+ ParsedRXingResultType.EMAIL_ADDRESS);
+ doTestRXingResult("MATMSG:TO:srowen@example.org;SUB:Stuff;BODY:This is some text;;",
+ "srowen@example.org\nStuff\nThis is some text", ParsedRXingResultType.EMAIL_ADDRESS);
+ doTestRXingResult("MATMSG:SUB:Stuff;BODY:This is some text;TO:srowen@example.org;;",
+ "srowen@example.org\nStuff\nThis is some text", ParsedRXingResultType.EMAIL_ADDRESS);
+ doTestRXingResult("TO:srowen@example.org;SUB:Stuff;BODY:This is some text;;",
+ "TO:srowen@example.org;SUB:Stuff;BODY:This is some text;;", ParsedRXingResultType.TEXT);
}
@Test
public void testEmailAddressType() {
- doTestResult("srowen@example.org", "srowen@example.org", ParsedResultType.EMAIL_ADDRESS);
- doTestResult("mailto:srowen@example.org", "srowen@example.org", ParsedResultType.EMAIL_ADDRESS);
- doTestResult("MAILTO:srowen@example.org", "srowen@example.org", ParsedResultType.EMAIL_ADDRESS);
- doTestResult("srowen@example", "srowen@example", ParsedResultType.EMAIL_ADDRESS);
- doTestResult("srowen", "srowen", ParsedResultType.TEXT);
- doTestResult("Let's meet @ 2", "Let's meet @ 2", ParsedResultType.TEXT);
+ doTestRXingResult("srowen@example.org", "srowen@example.org", ParsedRXingResultType.EMAIL_ADDRESS);
+ doTestRXingResult("mailto:srowen@example.org", "srowen@example.org", ParsedRXingResultType.EMAIL_ADDRESS);
+ doTestRXingResult("MAILTO:srowen@example.org", "srowen@example.org", ParsedRXingResultType.EMAIL_ADDRESS);
+ doTestRXingResult("srowen@example", "srowen@example", ParsedRXingResultType.EMAIL_ADDRESS);
+ doTestRXingResult("srowen", "srowen", ParsedRXingResultType.TEXT);
+ doTestRXingResult("Let's meet @ 2", "Let's meet @ 2", ParsedRXingResultType.TEXT);
}
@Test
public void testAddressBookType() {
- doTestResult("MECARD:N:Sean Owen;;", "Sean Owen", ParsedResultType.ADDRESSBOOK);
- doTestResult("MECARD:TEL:+12125551212;N:Sean Owen;;", "Sean Owen\n+12125551212",
- ParsedResultType.ADDRESSBOOK);
- doTestResult("MECARD:TEL:+12125551212;N:Sean Owen;URL:google.com;;",
- "Sean Owen\n+12125551212\ngoogle.com", ParsedResultType.ADDRESSBOOK);
- doTestResult("MECARD:TEL:+12125551212;N:Sean Owen;URL:google.com;EMAIL:srowen@example.org;",
- "Sean Owen\n+12125551212\nsrowen@example.org\ngoogle.com", ParsedResultType.ADDRESSBOOK);
- doTestResult("MECARD:ADR:76 9th Ave;N:Sean Owen;URL:google.com;EMAIL:srowen@example.org;",
- "Sean Owen\n76 9th Ave\nsrowen@example.org\ngoogle.com", ParsedResultType.ADDRESSBOOK);
- doTestResult("MECARD:BDAY:19760520;N:Sean Owen;URL:google.com;EMAIL:srowen@example.org;",
- "Sean Owen\nsrowen@example.org\ngoogle.com\n19760520", ParsedResultType.ADDRESSBOOK);
- doTestResult("MECARD:ORG:Google;N:Sean Owen;URL:google.com;EMAIL:srowen@example.org;",
- "Sean Owen\nGoogle\nsrowen@example.org\ngoogle.com", ParsedResultType.ADDRESSBOOK);
- doTestResult("MECARD:NOTE:ZXing Team;N:Sean Owen;URL:google.com;EMAIL:srowen@example.org;",
- "Sean Owen\nsrowen@example.org\ngoogle.com\nZXing Team", ParsedResultType.ADDRESSBOOK);
- doTestResult("N:Sean Owen;TEL:+12125551212;;", "N:Sean Owen;TEL:+12125551212;;",
- ParsedResultType.TEXT);
+ doTestRXingResult("MECARD:N:Sean Owen;;", "Sean Owen", ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("MECARD:TEL:+12125551212;N:Sean Owen;;", "Sean Owen\n+12125551212",
+ ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("MECARD:TEL:+12125551212;N:Sean Owen;URL:google.com;;",
+ "Sean Owen\n+12125551212\ngoogle.com", ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("MECARD:TEL:+12125551212;N:Sean Owen;URL:google.com;EMAIL:srowen@example.org;",
+ "Sean Owen\n+12125551212\nsrowen@example.org\ngoogle.com", ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("MECARD:ADR:76 9th Ave;N:Sean Owen;URL:google.com;EMAIL:srowen@example.org;",
+ "Sean Owen\n76 9th Ave\nsrowen@example.org\ngoogle.com", ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("MECARD:BDAY:19760520;N:Sean Owen;URL:google.com;EMAIL:srowen@example.org;",
+ "Sean Owen\nsrowen@example.org\ngoogle.com\n19760520", ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("MECARD:ORG:Google;N:Sean Owen;URL:google.com;EMAIL:srowen@example.org;",
+ "Sean Owen\nGoogle\nsrowen@example.org\ngoogle.com", ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("MECARD:NOTE:ZXing Team;N:Sean Owen;URL:google.com;EMAIL:srowen@example.org;",
+ "Sean Owen\nsrowen@example.org\ngoogle.com\nZXing Team", ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("N:Sean Owen;TEL:+12125551212;;", "N:Sean Owen;TEL:+12125551212;;",
+ ParsedRXingResultType.TEXT);
}
@Test
public void testAddressBookAUType() {
- doTestResult("MEMORY:\r\n", "", ParsedResultType.ADDRESSBOOK);
- doTestResult("MEMORY:foo\r\nNAME1:Sean\r\n", "Sean\nfoo", ParsedResultType.ADDRESSBOOK);
- doTestResult("TEL1:+12125551212\r\nMEMORY:\r\n", "+12125551212", ParsedResultType.ADDRESSBOOK);
+ doTestRXingResult("MEMORY:\r\n", "", ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("MEMORY:foo\r\nNAME1:Sean\r\n", "Sean\nfoo", ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("TEL1:+12125551212\r\nMEMORY:\r\n", "+12125551212", ParsedRXingResultType.ADDRESSBOOK);
}
@Test
public void testBizcard() {
- doTestResult("BIZCARD:N:Sean;X:Owen;C:Google;A:123 Main St;M:+12225551212;E:srowen@example.org;",
- "Sean Owen\nGoogle\n123 Main St\n+12225551212\nsrowen@example.org", ParsedResultType.ADDRESSBOOK);
+ doTestRXingResult("BIZCARD:N:Sean;X:Owen;C:Google;A:123 Main St;M:+12225551212;E:srowen@example.org;",
+ "Sean Owen\nGoogle\n123 Main St\n+12225551212\nsrowen@example.org", ParsedRXingResultType.ADDRESSBOOK);
}
@Test
public void testUPCA() {
- doTestResult("123456789012", "123456789012", ParsedResultType.PRODUCT, BarcodeFormat.UPC_A);
- doTestResult("1234567890123", "1234567890123", ParsedResultType.PRODUCT, BarcodeFormat.UPC_A);
- doTestResult("12345678901", "12345678901", ParsedResultType.TEXT);
+ doTestRXingResult("123456789012", "123456789012", ParsedRXingResultType.PRODUCT, BarcodeFormat.UPC_A);
+ doTestRXingResult("1234567890123", "1234567890123", ParsedRXingResultType.PRODUCT, BarcodeFormat.UPC_A);
+ doTestRXingResult("12345678901", "12345678901", ParsedRXingResultType.TEXT);
}
@Test
public void testUPCE() {
- doTestResult("01234565", "01234565", ParsedResultType.PRODUCT, BarcodeFormat.UPC_E);
+ doTestRXingResult("01234565", "01234565", ParsedRXingResultType.PRODUCT, BarcodeFormat.UPC_E);
}
@Test
public void testEAN() {
- doTestResult("00393157", "00393157", ParsedResultType.PRODUCT, BarcodeFormat.EAN_8);
- doTestResult("00393158", "00393158", ParsedResultType.TEXT);
- doTestResult("5051140178499", "5051140178499", ParsedResultType.PRODUCT, BarcodeFormat.EAN_13);
- doTestResult("5051140178490", "5051140178490", ParsedResultType.TEXT);
+ doTestRXingResult("00393157", "00393157", ParsedRXingResultType.PRODUCT, BarcodeFormat.EAN_8);
+ doTestRXingResult("00393158", "00393158", ParsedRXingResultType.TEXT);
+ doTestRXingResult("5051140178499", "5051140178499", ParsedRXingResultType.PRODUCT, BarcodeFormat.EAN_13);
+ doTestRXingResult("5051140178490", "5051140178490", ParsedRXingResultType.TEXT);
}
@Test
public void testISBN() {
- doTestResult("9784567890123", "9784567890123", ParsedResultType.ISBN, BarcodeFormat.EAN_13);
- doTestResult("9794567890123", "9794567890123", ParsedResultType.ISBN, BarcodeFormat.EAN_13);
- doTestResult("97845678901", "97845678901", ParsedResultType.TEXT);
- doTestResult("97945678901", "97945678901", ParsedResultType.TEXT);
+ doTestRXingResult("9784567890123", "9784567890123", ParsedRXingResultType.ISBN, BarcodeFormat.EAN_13);
+ doTestRXingResult("9794567890123", "9794567890123", ParsedRXingResultType.ISBN, BarcodeFormat.EAN_13);
+ doTestRXingResult("97845678901", "97845678901", ParsedRXingResultType.TEXT);
+ doTestRXingResult("97945678901", "97945678901", ParsedRXingResultType.TEXT);
}
@Test
public void testURI() {
- doTestResult("http://google.com", "http://google.com", ParsedResultType.URI);
- doTestResult("google.com", "http://google.com", ParsedResultType.URI);
- doTestResult("https://google.com", "https://google.com", ParsedResultType.URI);
- doTestResult("HTTP://google.com", "HTTP://google.com", ParsedResultType.URI);
- doTestResult("http://google.com/foobar", "http://google.com/foobar", ParsedResultType.URI);
- doTestResult("https://google.com:443/foobar", "https://google.com:443/foobar", ParsedResultType.URI);
- doTestResult("google.com:443", "http://google.com:443", ParsedResultType.URI);
- doTestResult("google.com:443/", "http://google.com:443/", ParsedResultType.URI);
- doTestResult("google.com:443/foobar", "http://google.com:443/foobar", ParsedResultType.URI);
- doTestResult("http://google.com:443/foobar", "http://google.com:443/foobar", ParsedResultType.URI);
- doTestResult("https://google.com:443/foobar", "https://google.com:443/foobar", ParsedResultType.URI);
- doTestResult("ftp://google.com/fake", "ftp://google.com/fake", ParsedResultType.URI);
- doTestResult("gopher://google.com/obsolete", "gopher://google.com/obsolete", ParsedResultType.URI);
+ doTestRXingResult("http://google.com", "http://google.com", ParsedRXingResultType.URI);
+ doTestRXingResult("google.com", "http://google.com", ParsedRXingResultType.URI);
+ doTestRXingResult("https://google.com", "https://google.com", ParsedRXingResultType.URI);
+ doTestRXingResult("HTTP://google.com", "HTTP://google.com", ParsedRXingResultType.URI);
+ doTestRXingResult("http://google.com/foobar", "http://google.com/foobar", ParsedRXingResultType.URI);
+ doTestRXingResult("https://google.com:443/foobar", "https://google.com:443/foobar", ParsedRXingResultType.URI);
+ doTestRXingResult("google.com:443", "http://google.com:443", ParsedRXingResultType.URI);
+ doTestRXingResult("google.com:443/", "http://google.com:443/", ParsedRXingResultType.URI);
+ doTestRXingResult("google.com:443/foobar", "http://google.com:443/foobar", ParsedRXingResultType.URI);
+ doTestRXingResult("http://google.com:443/foobar", "http://google.com:443/foobar", ParsedRXingResultType.URI);
+ doTestRXingResult("https://google.com:443/foobar", "https://google.com:443/foobar", ParsedRXingResultType.URI);
+ doTestRXingResult("ftp://google.com/fake", "ftp://google.com/fake", ParsedRXingResultType.URI);
+ doTestRXingResult("gopher://google.com/obsolete", "gopher://google.com/obsolete", ParsedRXingResultType.URI);
}
@Test
public void testGeo() {
- doTestResult("geo:1,2", "1.0, 2.0", ParsedResultType.GEO);
- doTestResult("GEO:1,2", "1.0, 2.0", ParsedResultType.GEO);
- doTestResult("geo:1,2,3", "1.0, 2.0, 3.0m", ParsedResultType.GEO);
- doTestResult("geo:80.33,-32.3344,3.35", "80.33, -32.3344, 3.35m", ParsedResultType.GEO);
- doTestResult("geo", "geo", ParsedResultType.TEXT);
- doTestResult("geography", "geography", ParsedResultType.TEXT);
+ doTestRXingResult("geo:1,2", "1.0, 2.0", ParsedRXingResultType.GEO);
+ doTestRXingResult("GEO:1,2", "1.0, 2.0", ParsedRXingResultType.GEO);
+ doTestRXingResult("geo:1,2,3", "1.0, 2.0, 3.0m", ParsedRXingResultType.GEO);
+ doTestRXingResult("geo:80.33,-32.3344,3.35", "80.33, -32.3344, 3.35m", ParsedRXingResultType.GEO);
+ doTestRXingResult("geo", "geo", ParsedRXingResultType.TEXT);
+ doTestRXingResult("geography", "geography", ParsedRXingResultType.TEXT);
}
@Test
public void testTel() {
- doTestResult("tel:+15551212", "+15551212", ParsedResultType.TEL);
- doTestResult("TEL:+15551212", "+15551212", ParsedResultType.TEL);
- doTestResult("tel:212 555 1212", "212 555 1212", ParsedResultType.TEL);
- doTestResult("tel:2125551212", "2125551212", ParsedResultType.TEL);
- doTestResult("tel:212-555-1212", "212-555-1212", ParsedResultType.TEL);
- doTestResult("tel", "tel", ParsedResultType.TEXT);
- doTestResult("telephone", "telephone", ParsedResultType.TEXT);
+ doTestRXingResult("tel:+15551212", "+15551212", ParsedRXingResultType.TEL);
+ doTestRXingResult("TEL:+15551212", "+15551212", ParsedRXingResultType.TEL);
+ doTestRXingResult("tel:212 555 1212", "212 555 1212", ParsedRXingResultType.TEL);
+ doTestRXingResult("tel:2125551212", "2125551212", ParsedRXingResultType.TEL);
+ doTestRXingResult("tel:212-555-1212", "212-555-1212", ParsedRXingResultType.TEL);
+ doTestRXingResult("tel", "tel", ParsedRXingResultType.TEXT);
+ doTestRXingResult("telephone", "telephone", ParsedRXingResultType.TEXT);
}
@Test
public void testVCard() {
- doTestResult("BEGIN:VCARD\r\nEND:VCARD", "", ParsedResultType.ADDRESSBOOK);
- doTestResult("BEGIN:VCARD\r\nN:Owen;Sean\r\nEND:VCARD", "Sean Owen",
- ParsedResultType.ADDRESSBOOK);
- doTestResult("BEGIN:VCARD\r\nVERSION:2.1\r\nN:Owen;Sean\r\nEND:VCARD", "Sean Owen",
- ParsedResultType.ADDRESSBOOK);
- doTestResult("BEGIN:VCARD\r\nADR;HOME:123 Main St\r\nVERSION:2.1\r\nN:Owen;Sean\r\nEND:VCARD",
- "Sean Owen\n123 Main St", ParsedResultType.ADDRESSBOOK);
- doTestResult("BEGIN:VCARD", "", ParsedResultType.ADDRESSBOOK);
+ doTestRXingResult("BEGIN:VCARD\r\nEND:VCARD", "", ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("BEGIN:VCARD\r\nN:Owen;Sean\r\nEND:VCARD", "Sean Owen",
+ ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("BEGIN:VCARD\r\nVERSION:2.1\r\nN:Owen;Sean\r\nEND:VCARD", "Sean Owen",
+ ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("BEGIN:VCARD\r\nADR;HOME:123 Main St\r\nVERSION:2.1\r\nN:Owen;Sean\r\nEND:VCARD",
+ "Sean Owen\n123 Main St", ParsedRXingResultType.ADDRESSBOOK);
+ doTestRXingResult("BEGIN:VCARD", "", ParsedRXingResultType.ADDRESSBOOK);
}
@Test
public void testVEvent() {
// UTC times
- doTestResult("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456Z\r\n" +
+ doTestRXingResult("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456Z\r\n" +
"DTEND:20080505T234555Z\r\nEND:VEVENT\r\nEND:VCALENDAR",
"foo\n" + formatTime(2008, 5, 4, 12, 34, 56) + "\n" + formatTime(2008, 5, 5, 23, 45, 55),
- ParsedResultType.CALENDAR);
- doTestResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456Z\r\n" +
+ ParsedRXingResultType.CALENDAR);
+ doTestRXingResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456Z\r\n" +
"DTEND:20080505T234555Z\r\nEND:VEVENT", "foo\n" + formatTime(2008, 5, 4, 12, 34, 56) + "\n" +
formatTime(2008, 5, 5, 23, 45, 55),
- ParsedResultType.CALENDAR);
+ ParsedRXingResultType.CALENDAR);
// Local times
- doTestResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456\r\n" +
+ doTestRXingResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456\r\n" +
"DTEND:20080505T234555\r\nEND:VEVENT", "foo\n" + formatTime(2008, 5, 4, 12, 34, 56) + "\n" +
formatTime(2008, 5, 5, 23, 45, 55),
- ParsedResultType.CALENDAR);
+ ParsedRXingResultType.CALENDAR);
// Date only (all day event)
- doTestResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504\r\n" +
+ doTestRXingResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504\r\n" +
"DTEND:20080505\r\nEND:VEVENT", "foo\n" + formatDate(2008, 5, 4) + "\n" +
formatDate(2008, 5, 5),
- ParsedResultType.CALENDAR);
+ ParsedRXingResultType.CALENDAR);
// Start time only
- doTestResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456Z\r\nEND:VEVENT",
- "foo\n" + formatTime(2008, 5, 4, 12, 34, 56), ParsedResultType.CALENDAR);
- doTestResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456\r\nEND:VEVENT",
- "foo\n" + formatTime(2008, 5, 4, 12, 34, 56), ParsedResultType.CALENDAR);
- doTestResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504\r\nEND:VEVENT",
- "foo\n" + formatDate(2008, 5, 4), ParsedResultType.CALENDAR);
- doTestResult("BEGIN:VEVENT\r\nDTEND:20080505T\r\nEND:VEVENT",
- "BEGIN:VEVENT\r\nDTEND:20080505T\r\nEND:VEVENT", ParsedResultType.TEXT);
+ doTestRXingResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456Z\r\nEND:VEVENT",
+ "foo\n" + formatTime(2008, 5, 4, 12, 34, 56), ParsedRXingResultType.CALENDAR);
+ doTestRXingResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456\r\nEND:VEVENT",
+ "foo\n" + formatTime(2008, 5, 4, 12, 34, 56), ParsedRXingResultType.CALENDAR);
+ doTestRXingResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504\r\nEND:VEVENT",
+ "foo\n" + formatDate(2008, 5, 4), ParsedRXingResultType.CALENDAR);
+ doTestRXingResult("BEGIN:VEVENT\r\nDTEND:20080505T\r\nEND:VEVENT",
+ "BEGIN:VEVENT\r\nDTEND:20080505T\r\nEND:VEVENT", ParsedRXingResultType.TEXT);
// Yeah, it's OK that this is thought of as maybe a URI as long as it's not CALENDAR
// Make sure illegal entries without newlines don't crash
- doTestResult(
+ doTestRXingResult(
"BEGIN:VEVENTSUMMARY:EventDTSTART:20081030T122030ZDTEND:20081030T132030ZEND:VEVENT",
"BEGIN:VEVENTSUMMARY:EventDTSTART:20081030T122030ZDTEND:20081030T132030ZEND:VEVENT",
- ParsedResultType.URI);
+ ParsedRXingResultType.URI);
}
private static String formatDate(int year, int month, int day) {
@@ -263,68 +263,68 @@ public final class ParsedReaderResultTestCase extends Assert {
@Test
public void testSMS() {
- doTestResult("sms:+15551212", "+15551212", ParsedResultType.SMS);
- doTestResult("SMS:+15551212", "+15551212", ParsedResultType.SMS);
- doTestResult("sms:+15551212;via=999333", "+15551212", ParsedResultType.SMS);
- doTestResult("sms:+15551212?subject=foo&body=bar", "+15551212\nfoo\nbar", ParsedResultType.SMS);
- doTestResult("sms:+15551212,+12124440101", "+15551212\n+12124440101", ParsedResultType.SMS);
+ doTestRXingResult("sms:+15551212", "+15551212", ParsedRXingResultType.SMS);
+ doTestRXingResult("SMS:+15551212", "+15551212", ParsedRXingResultType.SMS);
+ doTestRXingResult("sms:+15551212;via=999333", "+15551212", ParsedRXingResultType.SMS);
+ doTestRXingResult("sms:+15551212?subject=foo&body=bar", "+15551212\nfoo\nbar", ParsedRXingResultType.SMS);
+ doTestRXingResult("sms:+15551212,+12124440101", "+15551212\n+12124440101", ParsedRXingResultType.SMS);
}
@Test
public void testSMSTO() {
- doTestResult("SMSTO:+15551212", "+15551212", ParsedResultType.SMS);
- doTestResult("smsto:+15551212", "+15551212", ParsedResultType.SMS);
- doTestResult("smsto:+15551212:subject", "+15551212\nsubject", ParsedResultType.SMS);
- doTestResult("smsto:+15551212:My message", "+15551212\nMy message", ParsedResultType.SMS);
+ doTestRXingResult("SMSTO:+15551212", "+15551212", ParsedRXingResultType.SMS);
+ doTestRXingResult("smsto:+15551212", "+15551212", ParsedRXingResultType.SMS);
+ doTestRXingResult("smsto:+15551212:subject", "+15551212\nsubject", ParsedRXingResultType.SMS);
+ doTestRXingResult("smsto:+15551212:My message", "+15551212\nMy message", ParsedRXingResultType.SMS);
// Need to handle question mark in the subject
- doTestResult("smsto:+15551212:What's up?", "+15551212\nWhat's up?", ParsedResultType.SMS);
+ doTestRXingResult("smsto:+15551212:What's up?", "+15551212\nWhat's up?", ParsedRXingResultType.SMS);
// Need to handle colon in the subject
- doTestResult("smsto:+15551212:Directions: Do this", "+15551212\nDirections: Do this",
- ParsedResultType.SMS);
- doTestResult("smsto:212-555-1212:Here's a longer message. Should be fine.",
+ doTestRXingResult("smsto:+15551212:Directions: Do this", "+15551212\nDirections: Do this",
+ ParsedRXingResultType.SMS);
+ doTestRXingResult("smsto:212-555-1212:Here's a longer message. Should be fine.",
"212-555-1212\nHere's a longer message. Should be fine.",
- ParsedResultType.SMS);
+ ParsedRXingResultType.SMS);
}
@Test
public void testMMS() {
- doTestResult("mms:+15551212", "+15551212", ParsedResultType.SMS);
- doTestResult("MMS:+15551212", "+15551212", ParsedResultType.SMS);
- doTestResult("mms:+15551212;via=999333", "+15551212", ParsedResultType.SMS);
- doTestResult("mms:+15551212?subject=foo&body=bar", "+15551212\nfoo\nbar", ParsedResultType.SMS);
- doTestResult("mms:+15551212,+12124440101", "+15551212\n+12124440101", ParsedResultType.SMS);
+ doTestRXingResult("mms:+15551212", "+15551212", ParsedRXingResultType.SMS);
+ doTestRXingResult("MMS:+15551212", "+15551212", ParsedRXingResultType.SMS);
+ doTestRXingResult("mms:+15551212;via=999333", "+15551212", ParsedRXingResultType.SMS);
+ doTestRXingResult("mms:+15551212?subject=foo&body=bar", "+15551212\nfoo\nbar", ParsedRXingResultType.SMS);
+ doTestRXingResult("mms:+15551212,+12124440101", "+15551212\n+12124440101", ParsedRXingResultType.SMS);
}
@Test
public void testMMSTO() {
- doTestResult("MMSTO:+15551212", "+15551212", ParsedResultType.SMS);
- doTestResult("mmsto:+15551212", "+15551212", ParsedResultType.SMS);
- doTestResult("mmsto:+15551212:subject", "+15551212\nsubject", ParsedResultType.SMS);
- doTestResult("mmsto:+15551212:My message", "+15551212\nMy message", ParsedResultType.SMS);
- doTestResult("mmsto:+15551212:What's up?", "+15551212\nWhat's up?", ParsedResultType.SMS);
- doTestResult("mmsto:+15551212:Directions: Do this", "+15551212\nDirections: Do this",
- ParsedResultType.SMS);
- doTestResult("mmsto:212-555-1212:Here's a longer message. Should be fine.",
- "212-555-1212\nHere's a longer message. Should be fine.", ParsedResultType.SMS);
+ doTestRXingResult("MMSTO:+15551212", "+15551212", ParsedRXingResultType.SMS);
+ doTestRXingResult("mmsto:+15551212", "+15551212", ParsedRXingResultType.SMS);
+ doTestRXingResult("mmsto:+15551212:subject", "+15551212\nsubject", ParsedRXingResultType.SMS);
+ doTestRXingResult("mmsto:+15551212:My message", "+15551212\nMy message", ParsedRXingResultType.SMS);
+ doTestRXingResult("mmsto:+15551212:What's up?", "+15551212\nWhat's up?", ParsedRXingResultType.SMS);
+ doTestRXingResult("mmsto:+15551212:Directions: Do this", "+15551212\nDirections: Do this",
+ ParsedRXingResultType.SMS);
+ doTestRXingResult("mmsto:212-555-1212:Here's a longer message. Should be fine.",
+ "212-555-1212\nHere's a longer message. Should be fine.", ParsedRXingResultType.SMS);
}
- private static void doTestResult(String contents,
- String goldenResult,
- ParsedResultType type) {
- doTestResult(contents, goldenResult, type, BarcodeFormat.QR_CODE); // QR code is arbitrary
+ private static void doTestRXingResult(String contents,
+ String goldenRXingResult,
+ ParsedRXingResultType type) {
+ doTestRXingResult(contents, goldenRXingResult, type, BarcodeFormat.QR_CODE); // QR code is arbitrary
}
- private static void doTestResult(String contents,
- String goldenResult,
- ParsedResultType type,
+ private static void doTestRXingResult(String contents,
+ String goldenRXingResult,
+ ParsedRXingResultType type,
BarcodeFormat format) {
- Result fakeResult = new Result(contents, null, null, format);
- ParsedResult result = ResultParser.parseResult(fakeResult);
+ RXingResult fakeRXingResult = new RXingResult(contents, null, null, format);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
assertNotNull(result);
assertSame(type, result.getType());
- String displayResult = result.getDisplayResult();
- assertEquals(goldenResult, displayResult);
+ String displayRXingResult = result.getDisplayRXingResult();
+ assertEquals(goldenRXingResult, displayRXingResult);
}
}
diff --git a/java_test/java/com/google/zxing/client/result/ProductParsedResultTestCase.java b/java_test/java/com/google/zxing/client/result/ProductParsedResultTestCase.java
index b11bae6..a1928b1 100644
--- a/java_test/java/com/google/zxing/client/result/ProductParsedResultTestCase.java
+++ b/java_test/java/com/google/zxing/client/result/ProductParsedResultTestCase.java
@@ -17,16 +17,16 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Assert;
import org.junit.Test;
/**
- * Tests {@link ProductParsedResult}.
+ * Tests {@link ProductParsedRXingResult}.
*
* @author Sean Owen
*/
-public final class ProductParsedResultTestCase extends Assert {
+public final class ProductParsedRXingResultTestCase extends Assert {
@Test
public void testProduct() {
@@ -37,12 +37,12 @@ public final class ProductParsedResultTestCase extends Assert {
}
private static void doTest(String contents, String normalized, BarcodeFormat format) {
- Result fakeResult = new Result(contents, null, null, format);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertSame(ParsedResultType.PRODUCT, result.getType());
- ProductParsedResult productResult = (ProductParsedResult) result;
- assertEquals(contents, productResult.getProductID());
- assertEquals(normalized, productResult.getNormalizedProductID());
+ RXingResult fakeRXingResult = new RXingResult(contents, null, null, format);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertSame(ParsedRXingResultType.PRODUCT, result.getType());
+ ProductParsedRXingResult productRXingResult = (ProductParsedRXingResult) result;
+ assertEquals(contents, productRXingResult.getProductID());
+ assertEquals(normalized, productRXingResult.getNormalizedProductID());
}
}
\ No newline at end of file
diff --git a/java_test/java/com/google/zxing/client/result/SMSMMSParsedResultTestCase.java b/java_test/java/com/google/zxing/client/result/SMSMMSParsedResultTestCase.java
index 34354b1..91c1cc1 100644
--- a/java_test/java/com/google/zxing/client/result/SMSMMSParsedResultTestCase.java
+++ b/java_test/java/com/google/zxing/client/result/SMSMMSParsedResultTestCase.java
@@ -17,16 +17,16 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Assert;
import org.junit.Test;
/**
- * Tests {@link SMSParsedResult}.
+ * Tests {@link SMSParsedRXingResult}.
*
* @author Sean Owen
*/
-public final class SMSMMSParsedResultTestCase extends Assert {
+public final class SMSMMSParsedRXingResultTestCase extends Assert {
@Test
public void testSMS() {
@@ -52,15 +52,15 @@ public final class SMSMMSParsedResultTestCase extends Assert {
String body,
String via,
String parsedURI) {
- Result fakeResult = new Result(contents, null, null, BarcodeFormat.QR_CODE);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertSame(ParsedResultType.SMS, result.getType());
- SMSParsedResult smsResult = (SMSParsedResult) result;
- assertArrayEquals(new String[] { number }, smsResult.getNumbers());
- assertEquals(subject, smsResult.getSubject());
- assertEquals(body, smsResult.getBody());
- assertArrayEquals(new String[] { via }, smsResult.getVias());
- assertEquals(parsedURI, smsResult.getSMSURI());
+ RXingResult fakeRXingResult = new RXingResult(contents, null, null, BarcodeFormat.QR_CODE);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertSame(ParsedRXingResultType.SMS, result.getType());
+ SMSParsedRXingResult smsRXingResult = (SMSParsedRXingResult) result;
+ assertArrayEquals(new String[] { number }, smsRXingResult.getNumbers());
+ assertEquals(subject, smsRXingResult.getSubject());
+ assertEquals(body, smsRXingResult.getBody());
+ assertArrayEquals(new String[] { via }, smsRXingResult.getVias());
+ assertEquals(parsedURI, smsRXingResult.getSMSURI());
}
}
diff --git a/java_test/java/com/google/zxing/client/result/TelParsedResultTestCase.java b/java_test/java/com/google/zxing/client/result/TelParsedResultTestCase.java
index e7508fb..a558da2 100644
--- a/java_test/java/com/google/zxing/client/result/TelParsedResultTestCase.java
+++ b/java_test/java/com/google/zxing/client/result/TelParsedResultTestCase.java
@@ -17,16 +17,16 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Assert;
import org.junit.Test;
/**
- * Tests {@link TelParsedResult}.
+ * Tests {@link TelParsedRXingResult}.
*
* @author Sean Owen
*/
-public final class TelParsedResultTestCase extends Assert {
+public final class TelParsedRXingResultTestCase extends Assert {
@Test
public void testTel() {
@@ -35,13 +35,13 @@ public final class TelParsedResultTestCase extends Assert {
}
private static void doTest(String contents, String number, String title) {
- Result fakeResult = new Result(contents, null, null, BarcodeFormat.QR_CODE);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertSame(ParsedResultType.TEL, result.getType());
- TelParsedResult telResult = (TelParsedResult) result;
- assertEquals(number, telResult.getNumber());
- assertEquals(title, telResult.getTitle());
- assertEquals("tel:" + number, telResult.getTelURI());
+ RXingResult fakeRXingResult = new RXingResult(contents, null, null, BarcodeFormat.QR_CODE);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertSame(ParsedRXingResultType.TEL, result.getType());
+ TelParsedRXingResult telRXingResult = (TelParsedRXingResult) result;
+ assertEquals(number, telRXingResult.getNumber());
+ assertEquals(title, telRXingResult.getTitle());
+ assertEquals("tel:" + number, telRXingResult.getTelURI());
}
}
\ No newline at end of file
diff --git a/java_test/java/com/google/zxing/client/result/URIParsedResultTestCase.java b/java_test/java/com/google/zxing/client/result/URIParsedResultTestCase.java
index 168acbf..bbaf302 100644
--- a/java_test/java/com/google/zxing/client/result/URIParsedResultTestCase.java
+++ b/java_test/java/com/google/zxing/client/result/URIParsedResultTestCase.java
@@ -17,16 +17,16 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Assert;
import org.junit.Test;
/**
- * Tests {@link URIParsedResult}.
+ * Tests {@link URIParsedRXingResult}.
*
* @author Sean Owen
*/
-public final class URIParsedResultTestCase extends Assert {
+public final class URIParsedRXingResultTestCase extends Assert {
@Test
public void testBookmarkDocomo() {
@@ -116,25 +116,25 @@ public final class URIParsedResultTestCase extends Assert {
}
private static void doTest(String contents, String uri, String title) {
- Result fakeResult = new Result(contents, null, null, BarcodeFormat.QR_CODE);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertSame(ParsedResultType.URI, result.getType());
- URIParsedResult uriResult = (URIParsedResult) result;
- assertEquals(uri, uriResult.getURI());
- assertEquals(title, uriResult.getTitle());
+ RXingResult fakeRXingResult = new RXingResult(contents, null, null, BarcodeFormat.QR_CODE);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertSame(ParsedRXingResultType.URI, result.getType());
+ URIParsedRXingResult uriRXingResult = (URIParsedRXingResult) result;
+ assertEquals(uri, uriRXingResult.getURI());
+ assertEquals(title, uriRXingResult.getTitle());
}
private static void doTestNotUri(String text) {
- Result fakeResult = new Result(text, null, null, BarcodeFormat.QR_CODE);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertSame(ParsedResultType.TEXT, result.getType());
- assertEquals(text, result.getDisplayResult());
+ RXingResult fakeRXingResult = new RXingResult(text, null, null, BarcodeFormat.QR_CODE);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertSame(ParsedRXingResultType.TEXT, result.getType());
+ assertEquals(text, result.getDisplayRXingResult());
}
private static void doTestIsPossiblyMalicious(String uri, boolean malicious) {
- Result fakeResult = new Result(uri, null, null, BarcodeFormat.QR_CODE);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertSame(malicious ? ParsedResultType.TEXT : ParsedResultType.URI, result.getType());
+ RXingResult fakeRXingResult = new RXingResult(uri, null, null, BarcodeFormat.QR_CODE);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertSame(malicious ? ParsedRXingResultType.TEXT : ParsedRXingResultType.URI, result.getType());
}
}
diff --git a/java_test/java/com/google/zxing/client/result/VINParsedResultTestCase.java b/java_test/java/com/google/zxing/client/result/VINParsedResultTestCase.java
index 1897736..5dd2c3f 100644
--- a/java_test/java/com/google/zxing/client/result/VINParsedResultTestCase.java
+++ b/java_test/java/com/google/zxing/client/result/VINParsedResultTestCase.java
@@ -18,23 +18,23 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Assert;
import org.junit.Test;
/**
- * Tests {@link VINParsedResult}.
+ * Tests {@link VINParsedRXingResult}.
*/
-public final class VINParsedResultTestCase extends Assert {
+public final class VINParsedRXingResultTestCase extends Assert {
@Test
public void testNotVIN() {
- Result fakeResult = new Result("1M8GDM9A1KP042788", null, null, BarcodeFormat.CODE_39);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertEquals(ParsedResultType.TEXT, result.getType());
- fakeResult = new Result("1M8GDM9AXKP042788", null, null, BarcodeFormat.CODE_128);
- result = ResultParser.parseResult(fakeResult);
- assertEquals(ParsedResultType.TEXT, result.getType());
+ RXingResult fakeRXingResult = new RXingResult("1M8GDM9A1KP042788", null, null, BarcodeFormat.CODE_39);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertEquals(ParsedRXingResultType.TEXT, result.getType());
+ fakeRXingResult = new RXingResult("1M8GDM9AXKP042788", null, null, BarcodeFormat.CODE_128);
+ result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertEquals(ParsedRXingResultType.TEXT, result.getType());
}
@Test
@@ -53,18 +53,18 @@ public final class VINParsedResultTestCase extends Assert {
int year,
char plant,
String sequential) {
- Result fakeResult = new Result(contents, null, null, BarcodeFormat.CODE_39);
- ParsedResult result = ResultParser.parseResult(fakeResult);
- assertSame(ParsedResultType.VIN, result.getType());
- VINParsedResult vinResult = (VINParsedResult) result;
- assertEquals(wmi, vinResult.getWorldManufacturerID());
- assertEquals(vds, vinResult.getVehicleDescriptorSection());
- assertEquals(vis, vinResult.getVehicleIdentifierSection());
- assertEquals(country, vinResult.getCountryCode());
- assertEquals(attributes, vinResult.getVehicleAttributes());
- assertEquals(year, vinResult.getModelYear());
- assertEquals(plant, vinResult.getPlantCode());
- assertEquals(sequential, vinResult.getSequentialNumber());
+ RXingResult fakeRXingResult = new RXingResult(contents, null, null, BarcodeFormat.CODE_39);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
+ assertSame(ParsedRXingResultType.VIN, result.getType());
+ VINParsedRXingResult vinRXingResult = (VINParsedRXingResult) result;
+ assertEquals(wmi, vinRXingResult.getWorldManufacturerID());
+ assertEquals(vds, vinRXingResult.getVehicleDescriptorSection());
+ assertEquals(vis, vinRXingResult.getVehicleIdentifierSection());
+ assertEquals(country, vinRXingResult.getCountryCode());
+ assertEquals(attributes, vinRXingResult.getVehicleAttributes());
+ assertEquals(year, vinRXingResult.getModelYear());
+ assertEquals(plant, vinRXingResult.getPlantCode());
+ assertEquals(sequential, vinRXingResult.getSequentialNumber());
}
}
\ No newline at end of file
diff --git a/java_test/java/com/google/zxing/client/result/WifiParsedResultTestCase.java b/java_test/java/com/google/zxing/client/result/WifiParsedResultTestCase.java
index 66642d4..bda48fb 100644
--- a/java_test/java/com/google/zxing/client/result/WifiParsedResultTestCase.java
+++ b/java_test/java/com/google/zxing/client/result/WifiParsedResultTestCase.java
@@ -17,16 +17,16 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Assert;
import org.junit.Test;
/**
- * Tests {@link WifiParsedResult}.
+ * Tests {@link WifiParsedRXingResult}.
*
* @author Vikram Aggarwal
*/
-public final class WifiParsedResultTestCase extends Assert {
+public final class WifiParsedRXingResultTestCase extends Assert {
@Test
public void testNoPassword() {
@@ -79,15 +79,15 @@ public final class WifiParsedResultTestCase extends Assert {
String ssid,
String password,
String type) {
- Result fakeResult = new Result(contents, null, null, BarcodeFormat.QR_CODE);
- ParsedResult result = ResultParser.parseResult(fakeResult);
+ RXingResult fakeRXingResult = new RXingResult(contents, null, null, BarcodeFormat.QR_CODE);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(fakeRXingResult);
// Ensure it is a wifi code
- assertSame(ParsedResultType.WIFI, result.getType());
- WifiParsedResult wifiResult = (WifiParsedResult) result;
+ assertSame(ParsedRXingResultType.WIFI, result.getType());
+ WifiParsedRXingResult wifiRXingResult = (WifiParsedRXingResult) result;
- assertEquals(ssid, wifiResult.getSsid());
- assertEquals(password, wifiResult.getPassword());
- assertEquals(type, wifiResult.getNetworkEncryption());
+ assertEquals(ssid, wifiRXingResult.getSsid());
+ assertEquals(password, wifiRXingResult.getPassword());
+ assertEquals(type, wifiRXingResult.getNetworkEncryption());
}
}
diff --git a/java_test/java/com/google/zxing/common/AbstractBlackBoxTestCase.java b/java_test/java/com/google/zxing/common/AbstractBlackBoxTestCase.java
index f295f31..eefbe43 100644
--- a/java_test/java/com/google/zxing/common/AbstractBlackBoxTestCase.java
+++ b/java_test/java/com/google/zxing/common/AbstractBlackBoxTestCase.java
@@ -23,8 +23,8 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.LuminanceSource;
import com.google.zxing.Reader;
import com.google.zxing.ReaderException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
import org.junit.Assert;
import org.junit.Test;
@@ -61,7 +61,7 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
private final Path testBase;
private final Reader barcodeReader;
private final BarcodeFormat expectedFormat;
- private final List testResults;
+ private final List testRXingResults;
private final EnumMap hints = new EnumMap<>(DecodeHintType.class);
public static Path buildTestBase(String testBasePathSuffix) {
@@ -80,7 +80,7 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
this.testBase = buildTestBase(testBasePathSuffix);
this.barcodeReader = barcodeReader;
this.expectedFormat = expectedFormat;
- testResults = new ArrayList<>();
+ testRXingResults = new ArrayList<>();
System.setProperty("java.util.logging.SimpleFormatter.format", "%4$s: %5$s%6$s%n");
}
@@ -112,7 +112,7 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
int maxMisreads,
int maxTryHarderMisreads,
float rotation) {
- testResults.add(new TestResult(mustPassCount, tryHarderCount, maxMisreads, maxTryHarderMisreads, rotation));
+ testRXingResults.add(new TestRXingResult(mustPassCount, tryHarderCount, maxMisreads, maxTryHarderMisreads, rotation));
}
protected final List getImageFiles() throws IOException {
@@ -132,10 +132,10 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
@Test
public void testBlackBox() throws IOException {
- assertFalse(testResults.isEmpty());
+ assertFalse(testRXingResults.isEmpty());
List imageFiles = getImageFiles();
- int testCount = testResults.size();
+ int testCount = testRXingResults.size();
int[] passedCounts = new int[testCount];
int[] misreadCounts = new int[testCount];
@@ -168,7 +168,7 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
}
for (int x = 0; x < testCount; x++) {
- float rotation = testResults.get(x).getRotation();
+ float rotation = testRXingResults.get(x).getRotation();
BufferedImage rotatedImage = rotateImage(image, rotation);
LuminanceSource source = new BufferedImageLuminanceSource(rotatedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
@@ -199,23 +199,23 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
int totalMisread = 0;
int totalMaxMisread = 0;
- for (int x = 0; x < testResults.size(); x++) {
- TestResult testResult = testResults.get(x);
- log.info(String.format("Rotation %d degrees:", (int) testResult.getRotation()));
+ for (int x = 0; x < testRXingResults.size(); x++) {
+ TestRXingResult testRXingResult = testRXingResults.get(x);
+ log.info(String.format("Rotation %d degrees:", (int) testRXingResult.getRotation()));
log.info(String.format(" %d of %d images passed (%d required)",
- passedCounts[x], imageFiles.size(), testResult.getMustPassCount()));
+ passedCounts[x], imageFiles.size(), testRXingResult.getMustPassCount()));
int failed = imageFiles.size() - passedCounts[x];
log.info(String.format(" %d failed due to misreads, %d not detected",
misreadCounts[x], failed - misreadCounts[x]));
log.info(String.format(" %d of %d images passed with try harder (%d required)",
- tryHarderCounts[x], imageFiles.size(), testResult.getTryHarderCount()));
+ tryHarderCounts[x], imageFiles.size(), testRXingResult.getTryHarderCount()));
failed = imageFiles.size() - tryHarderCounts[x];
log.info(String.format(" %d failed due to misreads, %d not detected",
tryHarderMisreadCounts[x], failed - tryHarderMisreadCounts[x]));
totalFound += passedCounts[x] + tryHarderCounts[x];
- totalMustPass += testResult.getMustPassCount() + testResult.getTryHarderCount();
+ totalMustPass += testRXingResult.getMustPassCount() + testRXingResult.getTryHarderCount();
totalMisread += misreadCounts[x] + tryHarderMisreadCounts[x];
- totalMaxMisread += testResult.getMaxMisreads() + testResult.getMaxTryHarderMisreads();
+ totalMaxMisread += testRXingResult.getMaxMisreads() + testRXingResult.getMaxTryHarderMisreads();
}
int totalTests = imageFiles.size() * testCount * 2;
@@ -235,17 +235,17 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
// Then run through again and assert if any failed
for (int x = 0; x < testCount; x++) {
- TestResult testResult = testResults.get(x);
- String label = "Rotation " + testResult.getRotation() + " degrees: Too many images failed";
+ TestRXingResult testRXingResult = testRXingResults.get(x);
+ String label = "Rotation " + testRXingResult.getRotation() + " degrees: Too many images failed";
assertTrue(label,
- passedCounts[x] >= testResult.getMustPassCount());
+ passedCounts[x] >= testRXingResult.getMustPassCount());
assertTrue("Try harder, " + label,
- tryHarderCounts[x] >= testResult.getTryHarderCount());
- label = "Rotation " + testResult.getRotation() + " degrees: Too many images misread";
+ tryHarderCounts[x] >= testRXingResult.getTryHarderCount());
+ label = "Rotation " + testRXingResult.getRotation() + " degrees: Too many images misread";
assertTrue(label,
- misreadCounts[x] <= testResult.getMaxMisreads());
+ misreadCounts[x] <= testRXingResult.getMaxMisreads());
assertTrue("Try harder, " + label,
- tryHarderMisreadCounts[x] <= testResult.getMaxTryHarderMisreads());
+ tryHarderMisreadCounts[x] <= testRXingResult.getMaxTryHarderMisreads());
}
}
@@ -264,7 +264,7 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
// Try in 'pure' mode mostly to exercise PURE_BARCODE code paths for exceptions;
// not expected to pass, generally
- Result result = null;
+ RXingResult result = null;
try {
Map pureHints = new EnumMap<>(hints);
pureHints.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE);
@@ -290,9 +290,9 @@ public abstract class AbstractBlackBoxTestCase extends Assert {
return false;
}
- Map resultMetadata = result.getResultMetadata();
+ Map resultMetadata = result.getRXingResultMetadata();
for (Map.Entry,?> metadatum : expectedMetadata.entrySet()) {
- ResultMetadataType key = ResultMetadataType.valueOf(metadatum.getKey().toString());
+ RXingResultMetadataType key = RXingResultMetadataType.valueOf(metadatum.getKey().toString());
Object expectedValue = metadatum.getValue();
Object actualValue = resultMetadata == null ? null : resultMetadata.get(key);
if (!expectedValue.equals(actualValue)) {
diff --git a/java_test/java/com/google/zxing/common/AbstractNegativeBlackBoxTestCase.java b/java_test/java/com/google/zxing/common/AbstractNegativeBlackBoxTestCase.java
index ba37a9b..0b734cc 100644
--- a/java_test/java/com/google/zxing/common/AbstractNegativeBlackBoxTestCase.java
+++ b/java_test/java/com/google/zxing/common/AbstractNegativeBlackBoxTestCase.java
@@ -22,7 +22,7 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.LuminanceSource;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.ReaderException;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import org.junit.Test;
import javax.imageio.ImageIO;
@@ -45,13 +45,13 @@ public abstract class AbstractNegativeBlackBoxTestCase extends AbstractBlackBoxT
private static final Logger log = Logger.getLogger(AbstractNegativeBlackBoxTestCase.class.getSimpleName());
- private final List testResults;
+ private final List testRXingResults;
- private static final class TestResult {
+ private static final class TestRXingResult {
private final int falsePositivesAllowed;
private final float rotation;
- TestResult(int falsePositivesAllowed, float rotation) {
+ TestRXingResult(int falsePositivesAllowed, float rotation) {
this.falsePositivesAllowed = falsePositivesAllowed;
this.rotation = rotation;
}
@@ -68,29 +68,29 @@ public abstract class AbstractNegativeBlackBoxTestCase extends AbstractBlackBoxT
// Use the multiformat reader to evaluate all decoders in the system.
protected AbstractNegativeBlackBoxTestCase(String testBasePathSuffix) {
super(testBasePathSuffix, new MultiFormatReader(), null);
- testResults = new ArrayList<>();
+ testRXingResults = new ArrayList<>();
}
protected final void addTest(int falsePositivesAllowed, float rotation) {
- testResults.add(new TestResult(falsePositivesAllowed, rotation));
+ testRXingResults.add(new TestRXingResult(falsePositivesAllowed, rotation));
}
@Override
@Test
public void testBlackBox() throws IOException {
- assertFalse(testResults.isEmpty());
+ assertFalse(testRXingResults.isEmpty());
List imageFiles = getImageFiles();
- int[] falsePositives = new int[testResults.size()];
+ int[] falsePositives = new int[testRXingResults.size()];
for (Path testImage : imageFiles) {
log.info(String.format("Starting %s", testImage));
BufferedImage image = ImageIO.read(testImage.toFile());
if (image == null) {
throw new IOException("Could not read image: " + testImage);
}
- for (int x = 0; x < testResults.size(); x++) {
- TestResult testResult = testResults.get(x);
- if (!checkForFalsePositives(image, testResult.getRotation())) {
+ for (int x = 0; x < testRXingResults.size(); x++) {
+ TestRXingResult testRXingResult = testRXingResults.get(x);
+ if (!checkForFalsePositives(image, testRXingResult.getRotation())) {
falsePositives[x]++;
}
}
@@ -99,10 +99,10 @@ public abstract class AbstractNegativeBlackBoxTestCase extends AbstractBlackBoxT
int totalFalsePositives = 0;
int totalAllowed = 0;
- for (int x = 0; x < testResults.size(); x++) {
- TestResult testResult = testResults.get(x);
+ for (int x = 0; x < testRXingResults.size(); x++) {
+ TestRXingResult testRXingResult = testRXingResults.get(x);
totalFalsePositives += falsePositives[x];
- totalAllowed += testResult.getFalsePositivesAllowed();
+ totalAllowed += testRXingResult.getFalsePositivesAllowed();
}
if (totalFalsePositives < totalAllowed) {
@@ -111,13 +111,13 @@ public abstract class AbstractNegativeBlackBoxTestCase extends AbstractBlackBoxT
log.warning(String.format("--- Test failed by %d images", totalFalsePositives - totalAllowed));
}
- for (int x = 0; x < testResults.size(); x++) {
- TestResult testResult = testResults.get(x);
+ for (int x = 0; x < testRXingResults.size(); x++) {
+ TestRXingResult testRXingResult = testRXingResults.get(x);
log.info(String.format("Rotation %d degrees: %d of %d images were false positives (%d allowed)",
- (int) testResult.getRotation(), falsePositives[x], imageFiles.size(),
- testResult.getFalsePositivesAllowed()));
- assertTrue("Rotation " + testResult.getRotation() + " degrees: Too many false positives found",
- falsePositives[x] <= testResult.getFalsePositivesAllowed());
+ (int) testRXingResult.getRotation(), falsePositives[x], imageFiles.size(),
+ testRXingResult.getFalsePositivesAllowed()));
+ assertTrue("Rotation " + testRXingResult.getRotation() + " degrees: Too many false positives found",
+ falsePositives[x] <= testRXingResult.getFalsePositivesAllowed());
}
}
@@ -132,7 +132,7 @@ public abstract class AbstractNegativeBlackBoxTestCase extends AbstractBlackBoxT
BufferedImage rotatedImage = rotateImage(image, rotationInDegrees);
LuminanceSource source = new BufferedImageLuminanceSource(rotatedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
- Result result;
+ RXingResult result;
try {
result = getReader().decode(bitmap);
log.info(String.format("Found false positive: '%s' with format '%s' (rotation: %d)",
diff --git a/java_test/java/com/google/zxing/common/TestResult.java b/java_test/java/com/google/zxing/common/TestResult.java
index cc1ad52..b689343 100644
--- a/java_test/java/com/google/zxing/common/TestResult.java
+++ b/java_test/java/com/google/zxing/common/TestResult.java
@@ -19,7 +19,7 @@ package com.google.zxing.common;
/**
* Encapsulates the result of one test over a batch of black-box images.
*/
-public final class TestResult {
+public final class TestRXingResult {
private final int mustPassCount;
private final int tryHarderCount;
@@ -27,7 +27,7 @@ public final class TestResult {
private final int maxTryHarderMisreads;
private final float rotation;
- public TestResult(int mustPassCount, int tryHarderCount, int maxMisreads, int maxTryHarderMisreads, float rotation) {
+ public TestRXingResult(int mustPassCount, int tryHarderCount, int maxMisreads, int maxTryHarderMisreads, float rotation) {
this.mustPassCount = mustPassCount;
this.tryHarderCount = tryHarderCount;
this.maxMisreads = maxMisreads;
diff --git a/java_test/java/com/google/zxing/multi/MultiTestCase.java b/java_test/java/com/google/zxing/multi/MultiTestCase.java
index 58be12b..12aa067 100644
--- a/java_test/java/com/google/zxing/multi/MultiTestCase.java
+++ b/java_test/java/com/google/zxing/multi/MultiTestCase.java
@@ -25,7 +25,7 @@ import com.google.zxing.BinaryBitmap;
import com.google.zxing.BufferedImageLuminanceSource;
import com.google.zxing.LuminanceSource;
import com.google.zxing.MultiFormatReader;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import com.google.zxing.common.AbstractBlackBoxTestCase;
import com.google.zxing.common.HybridBinarizer;
import org.junit.Assert;
@@ -47,7 +47,7 @@ public final class MultiTestCase extends Assert {
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
MultipleBarcodeReader reader = new GenericMultipleBarcodeReader(new MultiFormatReader());
- Result[] results = reader.decodeMultiple(bitmap);
+ RXingResult[] results = reader.decodeMultiple(bitmap);
assertNotNull(results);
assertEquals(2, results.length);
diff --git a/java_test/java/com/google/zxing/multi/qrcode/MultiQRCodeTestCase.java b/java_test/java/com/google/zxing/multi/qrcode/MultiQRCodeTestCase.java
index 711362f..eb8b902 100644
--- a/java_test/java/com/google/zxing/multi/qrcode/MultiQRCodeTestCase.java
+++ b/java_test/java/com/google/zxing/multi/qrcode/MultiQRCodeTestCase.java
@@ -28,9 +28,9 @@ import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.BufferedImageLuminanceSource;
import com.google.zxing.LuminanceSource;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.AbstractBlackBoxTestCase;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.multi.MultipleBarcodeReader;
@@ -53,15 +53,15 @@ public final class MultiQRCodeTestCase extends Assert {
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
MultipleBarcodeReader reader = new QRCodeMultiReader();
- Result[] results = reader.decodeMultiple(bitmap);
+ RXingResult[] results = reader.decodeMultiple(bitmap);
assertNotNull(results);
assertEquals(4, results.length);
Collection barcodeContents = new HashSet<>();
- for (Result result : results) {
+ for (RXingResult result : results) {
barcodeContents.add(result.getText());
assertEquals(BarcodeFormat.QR_CODE, result.getBarcodeFormat());
- assertNotNull(result.getResultMetadata());
+ assertNotNull(result.getRXingResultMetadata());
}
Collection expectedContents = new HashSet<>();
expectedContents.add("You earned the class a 5 MINUTE DANCE PARTY!! Awesome! Way to go! Let's boogie!");
@@ -74,27 +74,27 @@ public final class MultiQRCodeTestCase extends Assert {
@Test
public void testProcessStructuredAppend() {
- Result sa1 = new Result("SA1", new byte[]{}, new ResultPoint[]{}, BarcodeFormat.QR_CODE);
- Result sa2 = new Result("SA2", new byte[]{}, new ResultPoint[]{}, BarcodeFormat.QR_CODE);
- Result sa3 = new Result("SA3", new byte[]{}, new ResultPoint[]{}, BarcodeFormat.QR_CODE);
- sa1.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE, 2);
- sa1.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, "L");
- sa2.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE, (1 << 4) + 2);
- sa2.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, "L");
- sa3.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE, (2 << 4) + 2);
- sa3.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, "L");
+ RXingResult sa1 = new RXingResult("SA1", new byte[]{}, new RXingResultPoint[]{}, BarcodeFormat.QR_CODE);
+ RXingResult sa2 = new RXingResult("SA2", new byte[]{}, new RXingResultPoint[]{}, BarcodeFormat.QR_CODE);
+ RXingResult sa3 = new RXingResult("SA3", new byte[]{}, new RXingResultPoint[]{}, BarcodeFormat.QR_CODE);
+ sa1.putMetadata(RXingResultMetadataType.STRUCTURED_APPEND_SEQUENCE, 2);
+ sa1.putMetadata(RXingResultMetadataType.ERROR_CORRECTION_LEVEL, "L");
+ sa2.putMetadata(RXingResultMetadataType.STRUCTURED_APPEND_SEQUENCE, (1 << 4) + 2);
+ sa2.putMetadata(RXingResultMetadataType.ERROR_CORRECTION_LEVEL, "L");
+ sa3.putMetadata(RXingResultMetadataType.STRUCTURED_APPEND_SEQUENCE, (2 << 4) + 2);
+ sa3.putMetadata(RXingResultMetadataType.ERROR_CORRECTION_LEVEL, "L");
- Result nsa = new Result("NotSA", new byte[]{}, new ResultPoint[]{}, BarcodeFormat.QR_CODE);
- nsa.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, "L");
+ RXingResult nsa = new RXingResult("NotSA", new byte[]{}, new RXingResultPoint[]{}, BarcodeFormat.QR_CODE);
+ nsa.putMetadata(RXingResultMetadataType.ERROR_CORRECTION_LEVEL, "L");
- List inputs = Arrays.asList(sa3, sa1, nsa, sa2);
+ List inputs = Arrays.asList(sa3, sa1, nsa, sa2);
- List results = QRCodeMultiReader.processStructuredAppend(inputs);
+ List results = QRCodeMultiReader.processStructuredAppend(inputs);
assertNotNull(results);
assertEquals(2, results.size());
Collection barcodeContents = new HashSet<>();
- for (Result result : results) {
+ for (RXingResult result : results) {
barcodeContents.add(result.getText());
}
Collection expectedContents = new HashSet<>();
diff --git a/java_test/java/com/google/zxing/oned/Code128WriterTestCase.java b/java_test/java/com/google/zxing/oned/Code128WriterTestCase.java
index c2a5b04..fa1433d 100644
--- a/java_test/java/com/google/zxing/oned/Code128WriterTestCase.java
+++ b/java_test/java/com/google/zxing/oned/Code128WriterTestCase.java
@@ -23,7 +23,7 @@ import org.junit.Test;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import com.google.zxing.Writer;
import com.google.zxing.common.BitArray;
import com.google.zxing.common.BitMatrix;
@@ -118,12 +118,12 @@ public class Code128WriterTestCase extends Assert {
String toEncode = "\u00f1" + "10958" + "\u00f1" + "17160526";
String expected = "1095817160526";
- BitMatrix encResult = encode(toEncode, false, expected);
+ BitMatrix encRXingResult = encode(toEncode, false, expected);
- int width = encResult.getWidth();
- encResult = encode(toEncode, true, expected);
+ int width = encRXingResult.getWidth();
+ encRXingResult = encode(toEncode, true, expected);
//Compact encoding has one latch less and encodes as STARTA,FNC1,1,CODEC,09,58,FNC1,17,16,05,26
- assertEquals(width, encResult.getWidth() + 11);
+ assertEquals(width, encRXingResult.getWidth() + 11);
}
@Test
@@ -337,23 +337,23 @@ public class Code128WriterTestCase extends Assert {
if (compact) {
hints.put(EncodeHintType.CODE128_COMPACT, Boolean.TRUE);
}
- BitMatrix encResult = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0, hints);
+ BitMatrix encRXingResult = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0, hints);
if (expectedLoopback != null) {
- BitArray row = encResult.getRow(0, null);
- Result rtResult = reader.decodeRow(0, row, null);
- String actual = rtResult.getText();
+ BitArray row = encRXingResult.getRow(0, null);
+ RXingResult rtRXingResult = reader.decodeRow(0, row, null);
+ String actual = rtRXingResult.getText();
assertEquals(expectedLoopback, actual);
}
if (compact) {
//check that what is encoded compactly yields the same on loopback as what was encoded fast.
- BitArray row = encResult.getRow(0, null);
- Result rtResult = reader.decodeRow(0, row, null);
- String actual = rtResult.getText();
- BitMatrix encResultFast = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0);
- row = encResultFast.getRow(0, null);
- rtResult = reader.decodeRow(0, row, null);
- assertEquals(rtResult.getText(), actual);
+ BitArray row = encRXingResult.getRow(0, null);
+ RXingResult rtRXingResult = reader.decodeRow(0, row, null);
+ String actual = rtRXingResult.getText();
+ BitMatrix encRXingResultFast = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0);
+ row = encRXingResultFast.getRow(0, null);
+ rtRXingResult = reader.decodeRow(0, row, null);
+ assertEquals(rtRXingResult.getText(), actual);
}
- return encResult;
+ return encRXingResult;
}
}
diff --git a/java_test/java/com/google/zxing/oned/Code39ExtendedModeTestCase.java b/java_test/java/com/google/zxing/oned/Code39ExtendedModeTestCase.java
index 1a931f9..a56fe8e 100644
--- a/java_test/java/com/google/zxing/oned/Code39ExtendedModeTestCase.java
+++ b/java_test/java/com/google/zxing/oned/Code39ExtendedModeTestCase.java
@@ -24,7 +24,7 @@ import com.google.zxing.common.BitArray;
import com.google.zxing.ChecksumException;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
/**
* @author Michael Jahn
@@ -44,14 +44,14 @@ public final class Code39ExtendedModeTestCase extends Assert {
"000001001011011010101001001001011001101010101001010010010110101001011010010100100101011010010110100101001001011011010010101001010010010101011001011010010100100101101011001010100101001001010110110010101001010010010101010011011010010100100101101010011010100101001001010110100110101001010010010101011001101010010100100101101010100110100101001001010110101001101001010010010110110101001010010100100101010110100110100101001001011010110100101001010010010101101101001010010100100101010101100110100101001001011010101100101001010010010101101011001010010100100101010110110010100101001001011001010101101001010010010100110101011010010100100101100110101010100101001001010010110101101001010010010110010110101010010100100101001101101010101001001001010110110100101010010010010101010110011010100100100101101010110010101001001001010110101100101010010010010101011011001010010110110100000");
}
- private static void doTest(String expectedResult, String encodedResult)
+ private static void doTest(String expectedRXingResult, String encodedRXingResult)
throws FormatException, ChecksumException, NotFoundException {
Code39Reader sut = new Code39Reader(false, true);
- BitMatrix matrix = BitMatrix.parse(encodedResult, "1", "0");
+ BitMatrix matrix = BitMatrix.parse(encodedRXingResult, "1", "0");
BitArray row = new BitArray(matrix.getWidth());
matrix.getRow(0, row);
- Result result = sut.decodeRow(0, row, null);
- assertEquals(expectedResult, result.getText());
+ RXingResult result = sut.decodeRow(0, row, null);
+ assertEquals(expectedRXingResult, result.getText());
}
}
diff --git a/java_test/java/com/google/zxing/oned/Code93ReaderTestCase.java b/java_test/java/com/google/zxing/oned/Code93ReaderTestCase.java
index 1a6538b..ae5ef31 100644
--- a/java_test/java/com/google/zxing/oned/Code93ReaderTestCase.java
+++ b/java_test/java/com/google/zxing/oned/Code93ReaderTestCase.java
@@ -24,7 +24,7 @@ import com.google.zxing.common.BitArray;
import com.google.zxing.ChecksumException;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
/**
* @author Daisuke Makiuchi
@@ -38,14 +38,14 @@ public final class Code93ReaderTestCase extends Assert {
"0000001010111101101000101001100101001011001001100101100101001001100101100100101000010101010000101110101101101010001001001101001101001110010101101011101011011101011101101110100101110101101001110101110110101101010001110110101100010101110110101000110101110110101000101101110110101101001101110110101100101101110110101100110101110110101011011001110110101011001101110110101001101101110110101001110101001100101101010001010111101111");
}
- private static void doTest(String expectedResult, String encodedResult)
+ private static void doTest(String expectedRXingResult, String encodedRXingResult)
throws FormatException, ChecksumException, NotFoundException {
Code93Reader sut = new Code93Reader();
- BitMatrix matrix = BitMatrix.parse(encodedResult, "1", "0");
+ BitMatrix matrix = BitMatrix.parse(encodedRXingResult, "1", "0");
BitArray row = new BitArray(matrix.getWidth());
matrix.getRow(0, row);
- Result result = sut.decodeRow(0, row, null);
- assertEquals(expectedResult, result.getText());
+ RXingResult result = sut.decodeRow(0, row, null);
+ assertEquals(expectedRXingResult, result.getText());
}
}
diff --git a/java_test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2resultTestCase.java b/java_test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2resultTestCase.java
index b0f9b21..56aa228 100644
--- a/java_test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2resultTestCase.java
+++ b/java_test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2resultTestCase.java
@@ -43,10 +43,10 @@ import com.google.zxing.BinaryBitmap;
import com.google.zxing.BufferedImageLuminanceSource;
import com.google.zxing.NotFoundException;
import com.google.zxing.ReaderException;
-import com.google.zxing.Result;
-import com.google.zxing.client.result.ExpandedProductParsedResult;
-import com.google.zxing.client.result.ParsedResult;
-import com.google.zxing.client.result.ResultParser;
+import com.google.zxing.RXingResult;
+import com.google.zxing.client.result.ExpandedProductParsedRXingResult;
+import com.google.zxing.client.result.ParsedRXingResult;
+import com.google.zxing.client.result.RXingResultParser;
import com.google.zxing.common.AbstractBlackBoxTestCase;
import com.google.zxing.common.BitArray;
import com.google.zxing.common.GlobalHistogramBinarizer;
@@ -63,18 +63,18 @@ public final class RSSExpandedImage2resultTestCase extends Assert {
@Test
public void testDecodeRow2result2() throws Exception {
// (01)90012345678908(3103)001750
- ExpandedProductParsedResult expected =
- new ExpandedProductParsedResult("(01)90012345678908(3103)001750",
+ ExpandedProductParsedRXingResult expected =
+ new ExpandedProductParsedRXingResult("(01)90012345678908(3103)001750",
"90012345678908",
null, null, null, null, null, null,
"001750",
- ExpandedProductParsedResult.KILOGRAM,
+ ExpandedProductParsedRXingResult.KILOGRAM,
"3", null, null, null, new HashMap<>());
assertCorrectImage2result("2.png", expected);
}
- private static void assertCorrectImage2result(String fileName, ExpandedProductParsedResult expected)
+ private static void assertCorrectImage2result(String fileName, ExpandedProductParsedRXingResult expected)
throws IOException, NotFoundException {
Path path = AbstractBlackBoxTestCase.buildTestBase("src/test/resources/blackbox/rssexpanded-1/").resolve(fileName);
@@ -83,18 +83,18 @@ public final class RSSExpandedImage2resultTestCase extends Assert {
int rowNumber = binaryMap.getHeight() / 2;
BitArray row = binaryMap.getBlackRow(rowNumber, null);
- Result theResult;
+ RXingResult theRXingResult;
try {
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
- theResult = rssExpandedReader.decodeRow(rowNumber, row, null);
+ theRXingResult = rssExpandedReader.decodeRow(rowNumber, row, null);
} catch (ReaderException re) {
fail(re.toString());
return;
}
- assertSame(BarcodeFormat.RSS_EXPANDED, theResult.getBarcodeFormat());
+ assertSame(BarcodeFormat.RSS_EXPANDED, theRXingResult.getBarcodeFormat());
- ParsedResult result = ResultParser.parseResult(theResult);
+ ParsedRXingResult result = RXingResultParser.parseRXingResult(theRXingResult);
assertEquals(expected, result);
}
diff --git a/java_test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2stringTestCase.java b/java_test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2stringTestCase.java
index 5a0656e..915b321 100644
--- a/java_test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2stringTestCase.java
+++ b/java_test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2stringTestCase.java
@@ -37,7 +37,7 @@ import com.google.zxing.BinaryBitmap;
import com.google.zxing.BufferedImageLuminanceSource;
import com.google.zxing.NotFoundException;
import com.google.zxing.ReaderException;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import com.google.zxing.common.AbstractBlackBoxTestCase;
import com.google.zxing.common.BitArray;
import com.google.zxing.common.GlobalHistogramBinarizer;
@@ -196,7 +196,7 @@ public final class RSSExpandedImage2stringTestCase extends Assert {
int rowNumber = binaryMap.getHeight() / 2;
BitArray row = binaryMap.getBlackRow(rowNumber, null);
- Result result;
+ RXingResult result;
try {
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
result = rssExpandedReader.decodeRow(rowNumber, row, null);
diff --git a/java_test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedInternalTestCase.java b/java_test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedInternalTestCase.java
index 7b18046..86c0a6d 100644
--- a/java_test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedInternalTestCase.java
+++ b/java_test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedInternalTestCase.java
@@ -34,7 +34,7 @@ import org.junit.Test;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import com.google.zxing.common.BitArray;
/**
@@ -71,7 +71,7 @@ public final class RSSExpandedStackedInternalTestCase extends Assert {
List totalPairs = rssExpandedReader.decodeRow2pairs(secondRowNumber, secondRow);
- Result result = RSSExpandedReader.constructResult(totalPairs);
+ RXingResult result = RSSExpandedReader.constructRXingResult(totalPairs);
assertEquals("(01)98898765432106(3202)012345(15)991231", result.getText());
}
@@ -81,7 +81,7 @@ public final class RSSExpandedStackedInternalTestCase extends Assert {
BinaryBitmap binaryMap = TestCaseUtil.getBinaryBitmap("src/test/resources/blackbox/rssexpandedstacked-2/1000.png");
- Result result = rssExpandedReader.decode(binaryMap);
+ RXingResult result = rssExpandedReader.decode(binaryMap);
assertEquals("(01)98898765432106(3202)012345(15)991231", result.getText());
}
diff --git a/java_test/java/com/google/zxing/pdf417/PDF417BlackBox4TestCase.java b/java_test/java/com/google/zxing/pdf417/PDF417BlackBox4TestCase.java
index de4952a..6314aba 100644
--- a/java_test/java/com/google/zxing/pdf417/PDF417BlackBox4TestCase.java
+++ b/java_test/java/com/google/zxing/pdf417/PDF417BlackBox4TestCase.java
@@ -22,11 +22,11 @@ import com.google.zxing.BufferedImageLuminanceSource;
import com.google.zxing.DecodeHintType;
import com.google.zxing.LuminanceSource;
import com.google.zxing.ReaderException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
import com.google.zxing.common.AbstractBlackBoxTestCase;
import com.google.zxing.common.HybridBinarizer;
-import com.google.zxing.common.TestResult;
+import com.google.zxing.common.TestRXingResult;
import com.google.zxing.multi.MultipleBarcodeReader;
import org.junit.Test;
@@ -59,20 +59,20 @@ public final class PDF417BlackBox4TestCase extends AbstractBlackBoxTestCase {
private final MultipleBarcodeReader barcodeReader = new PDF417Reader();
- private final List testResults = new ArrayList<>();
+ private final List testRXingResults = new ArrayList<>();
public PDF417BlackBox4TestCase() {
super("src/test/resources/blackbox/pdf417-4", null, BarcodeFormat.PDF_417);
- testResults.add(new TestResult(3, 3, 0, 0, 0.0f));
+ testRXingResults.add(new TestRXingResult(3, 3, 0, 0, 0.0f));
}
@Test
@Override
public void testBlackBox() throws IOException {
- assertFalse(testResults.isEmpty());
+ assertFalse(testRXingResults.isEmpty());
Map> imageFiles = getImageFileLists();
- int testCount = testResults.size();
+ int testCount = testRXingResults.size();
int[] passedCounts = new int[testCount];
int[] tryHarderCounts = new int[testCount];
@@ -94,10 +94,10 @@ public final class PDF417BlackBox4TestCase extends AbstractBlackBoxTestCase {
}
for (int x = 0; x < testCount; x++) {
- List results = new ArrayList<>();
+ List results = new ArrayList<>();
for (Path imageFile : testImageGroup.getValue()) {
BufferedImage image = ImageIO.read(imageFile.toFile());
- float rotation = testResults.get(x).getRotation();
+ float rotation = testRXingResults.get(x).getRotation();
BufferedImage rotatedImage = rotateImage(image, rotation);
LuminanceSource source = new BufferedImageLuminanceSource(rotatedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
@@ -108,11 +108,11 @@ public final class PDF417BlackBox4TestCase extends AbstractBlackBoxTestCase {
// ignore
}
}
- results.sort(Comparator.comparingInt((Result r) -> getMeta(r).getSegmentIndex()));
+ results.sort(Comparator.comparingInt((RXingResult r) -> getMeta(r).getSegmentIndex()));
StringBuilder resultText = new StringBuilder();
String fileId = null;
- for (Result result : results) {
- PDF417ResultMetadata resultMetadata = getMeta(result);
+ for (RXingResult result : results) {
+ PDF417RXingResultMetadata resultMetadata = getMeta(result);
assertNotNull("resultMetadata", resultMetadata);
if (fileId == null) {
fileId = resultMetadata.getFileId();
@@ -131,15 +131,15 @@ public final class PDF417BlackBox4TestCase extends AbstractBlackBoxTestCase {
int totalMustPass = 0;
int numberOfTests = imageFiles.keySet().size();
- for (int x = 0; x < testResults.size(); x++) {
- TestResult testResult = testResults.get(x);
- log.info(String.format("Rotation %d degrees:", (int) testResult.getRotation()));
+ for (int x = 0; x < testRXingResults.size(); x++) {
+ TestRXingResult testRXingResult = testRXingResults.get(x);
+ log.info(String.format("Rotation %d degrees:", (int) testRXingResult.getRotation()));
log.info(String.format(" %d of %d images passed (%d required)", passedCounts[x], numberOfTests,
- testResult.getMustPassCount()));
+ testRXingResult.getMustPassCount()));
log.info(String.format(" %d of %d images passed with try harder (%d required)", tryHarderCounts[x],
- numberOfTests, testResult.getTryHarderCount()));
+ numberOfTests, testRXingResult.getTryHarderCount()));
totalFound += passedCounts[x] + tryHarderCounts[x];
- totalMustPass += testResult.getMustPassCount() + testResult.getTryHarderCount();
+ totalMustPass += testRXingResult.getMustPassCount() + testRXingResult.getTryHarderCount();
}
int totalTests = numberOfTests * testCount * 2;
@@ -154,19 +154,19 @@ public final class PDF417BlackBox4TestCase extends AbstractBlackBoxTestCase {
// Then run through again and assert if any failed
for (int x = 0; x < testCount; x++) {
- TestResult testResult = testResults.get(x);
- String label = "Rotation " + testResult.getRotation() + " degrees: Too many images failed";
- assertTrue(label, passedCounts[x] >= testResult.getMustPassCount());
- assertTrue("Try harder, " + label, tryHarderCounts[x] >= testResult.getTryHarderCount());
+ TestRXingResult testRXingResult = testRXingResults.get(x);
+ String label = "Rotation " + testRXingResult.getRotation() + " degrees: Too many images failed";
+ assertTrue(label, passedCounts[x] >= testRXingResult.getMustPassCount());
+ assertTrue("Try harder, " + label, tryHarderCounts[x] >= testRXingResult.getTryHarderCount());
}
}
- private static PDF417ResultMetadata getMeta(Result result) {
- return result.getResultMetadata() == null ? null : (PDF417ResultMetadata) result.getResultMetadata().get(
- ResultMetadataType.PDF417_EXTRA_METADATA);
+ private static PDF417RXingResultMetadata getMeta(RXingResult result) {
+ return result.getRXingResultMetadata() == null ? null : (PDF417RXingResultMetadata) result.getRXingResultMetadata().get(
+ RXingResultMetadataType.PDF417_EXTRA_METADATA);
}
- private Result[] decode(BinaryBitmap source, boolean tryHarder) throws ReaderException {
+ private RXingResult[] decode(BinaryBitmap source, boolean tryHarder) throws ReaderException {
Map hints = new EnumMap<>(DecodeHintType.class);
if (tryHarder) {
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
diff --git a/java_test/java/com/google/zxing/pdf417/decoder/PDF417DecoderTestCase.java b/java_test/java/com/google/zxing/pdf417/decoder/PDF417DecoderTestCase.java
index e384178..86672c7 100644
--- a/java_test/java/com/google/zxing/pdf417/decoder/PDF417DecoderTestCase.java
+++ b/java_test/java/com/google/zxing/pdf417/decoder/PDF417DecoderTestCase.java
@@ -18,8 +18,8 @@ package com.google.zxing.pdf417.decoder;
import com.google.zxing.FormatException;
import com.google.zxing.WriterException;
-import com.google.zxing.pdf417.PDF417ResultMetadata;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.pdf417.PDF417RXingResultMetadata;
+import com.google.zxing.common.DecoderRXingResult;
import com.google.zxing.pdf417.encoder.Compaction;
import com.google.zxing.pdf417.encoder.PDF417HighLevelEncoderTestAdapter;
@@ -39,7 +39,7 @@ public class PDF417DecoderTestCase extends Assert {
*/
@Test
public void testStandardSample1() throws FormatException {
- PDF417ResultMetadata resultMetadata = new PDF417ResultMetadata();
+ PDF417RXingResultMetadata resultMetadata = new PDF417RXingResultMetadata();
int[] sampleCodes = {20, 928, 111, 100, 17, 53, 923, 1, 111, 104, 923, 3, 64, 416, 34, 923, 4, 258, 446, 67,
// we should never reach these
1000, 1000, 1000};
@@ -66,7 +66,7 @@ public class PDF417DecoderTestCase extends Assert {
*/
@Test
public void testStandardSample2() throws FormatException {
- PDF417ResultMetadata resultMetadata = new PDF417ResultMetadata();
+ PDF417RXingResultMetadata resultMetadata = new PDF417RXingResultMetadata();
int[] sampleCodes = {11, 928, 111, 103, 17, 53, 923, 1, 111, 104, 922,
// we should never reach these
1000, 1000, 1000};
@@ -93,7 +93,7 @@ public class PDF417DecoderTestCase extends Assert {
*/
@Test
public void testStandardSample3() throws FormatException {
- PDF417ResultMetadata resultMetadata = new PDF417ResultMetadata();
+ PDF417RXingResultMetadata resultMetadata = new PDF417RXingResultMetadata();
int[] sampleCodes = {7, 928, 111, 100, 100, 200, 300,
0}; // Final dummy ECC codeword required to avoid ArrayIndexOutOfBounds
@@ -108,9 +108,9 @@ public class PDF417DecoderTestCase extends Assert {
assertNull(resultMetadata.getOptionalData());
// Check that symbol containing no data except Macro is accepted (see note in Annex H.2)
- DecoderResult decoderResult = DecodedBitStreamParser.decode(sampleCodes, "0");
- assertEquals("", decoderResult.getText());
- assertNotNull(decoderResult.getOther());
+ DecoderRXingResult decoderRXingResult = DecodedBitStreamParser.decode(sampleCodes, "0");
+ assertEquals("", decoderRXingResult.getText());
+ assertNotNull(decoderRXingResult.getOther());
}
@Test
@@ -118,7 +118,7 @@ public class PDF417DecoderTestCase extends Assert {
int[] sampleCodes = {23, 477, 928, 111, 100, 0, 252, 21, 86, 923, 0, 815, 251, 133, 12, 148, 537, 593,
599, 923, 1, 111, 102, 98, 311, 355, 522, 920, 779, 40, 628, 33, 749, 267, 506, 213, 928, 465, 248,
493, 72, 780, 699, 780, 493, 755, 84, 198, 628, 368, 156, 198, 809, 19, 113};
- PDF417ResultMetadata resultMetadata = new PDF417ResultMetadata();
+ PDF417RXingResultMetadata resultMetadata = new PDF417RXingResultMetadata();
DecodedBitStreamParser.decodeMacroBlock(sampleCodes, 3, resultMetadata);
@@ -135,7 +135,7 @@ public class PDF417DecoderTestCase extends Assert {
public void testSampleWithNumericValues() throws FormatException {
int[] sampleCodes = {25, 477, 928, 111, 100, 0, 252, 21, 86, 923, 2, 2, 0, 1, 0, 0, 0, 923, 5, 130, 923,
6, 1, 500, 13, 0};
- PDF417ResultMetadata resultMetadata = new PDF417ResultMetadata();
+ PDF417RXingResultMetadata resultMetadata = new PDF417RXingResultMetadata();
DecodedBitStreamParser.decodeMacroBlock(sampleCodes, 3, resultMetadata);
@@ -151,7 +151,7 @@ public class PDF417DecoderTestCase extends Assert {
@Test
public void testSampleWithMacroTerminatorOnly() throws FormatException {
int[] sampleCodes = {7, 477, 928, 222, 198, 0, 922};
- PDF417ResultMetadata resultMetadata = new PDF417ResultMetadata();
+ PDF417RXingResultMetadata resultMetadata = new PDF417RXingResultMetadata();
DecodedBitStreamParser.decodeMacroBlock(sampleCodes, 3, resultMetadata);
@@ -165,14 +165,14 @@ public class PDF417DecoderTestCase extends Assert {
@Test(expected = FormatException.class)
public void testSampleWithBadSequenceIndexMacro() throws FormatException {
int[] sampleCodes = {3, 928, 222, 0};
- PDF417ResultMetadata resultMetadata = new PDF417ResultMetadata();
+ PDF417RXingResultMetadata resultMetadata = new PDF417RXingResultMetadata();
DecodedBitStreamParser.decodeMacroBlock(sampleCodes, 2, resultMetadata);
}
@Test(expected = FormatException.class)
public void testSampleWithNoFileIdMacro() throws FormatException {
int[] sampleCodes = {4, 928, 222, 198, 0};
- PDF417ResultMetadata resultMetadata = new PDF417ResultMetadata();
+ PDF417RXingResultMetadata resultMetadata = new PDF417RXingResultMetadata();
DecodedBitStreamParser.decodeMacroBlock(sampleCodes, 2, resultMetadata);
}
@@ -405,9 +405,9 @@ public class PDF417DecoderTestCase extends Assert {
}
}
- private static void performDecodeTest(int[] codewords, String expectedResult) throws FormatException {
- DecoderResult result = DecodedBitStreamParser.decode(codewords, "0");
- assertEquals(expectedResult, result.getText());
+ private static void performDecodeTest(int[] codewords, String expectedRXingResult) throws FormatException {
+ DecoderRXingResult result = DecodedBitStreamParser.decode(codewords, "0");
+ assertEquals(expectedRXingResult, result.getText());
}
private static void performECITest(char[] chars,
diff --git a/java_test/java/com/google/zxing/qrcode/QRCodeWriterTestCase.java b/java_test/java/com/google/zxing/qrcode/QRCodeWriterTestCase.java
index c16d295..5a5abbc 100644
--- a/java_test/java/com/google/zxing/qrcode/QRCodeWriterTestCase.java
+++ b/java_test/java/com/google/zxing/qrcode/QRCodeWriterTestCase.java
@@ -110,18 +110,18 @@ public final class QRCodeWriterTestCase extends Assert {
BufferedImage image = loadImage(fileName);
assertNotNull(image);
- BitMatrix goldenResult = createMatrixFromImage(image);
- assertNotNull(goldenResult);
+ BitMatrix goldenRXingResult = createMatrixFromImage(image);
+ assertNotNull(goldenRXingResult);
Map hints = new EnumMap<>(EncodeHintType.class);
hints.put(EncodeHintType.ERROR_CORRECTION, ecLevel);
Writer writer = new QRCodeWriter();
- BitMatrix generatedResult = writer.encode(contents, BarcodeFormat.QR_CODE, resolution,
+ BitMatrix generatedRXingResult = writer.encode(contents, BarcodeFormat.QR_CODE, resolution,
resolution, hints);
- assertEquals(resolution, generatedResult.getWidth());
- assertEquals(resolution, generatedResult.getHeight());
- assertEquals(goldenResult, generatedResult);
+ assertEquals(resolution, generatedRXingResult.getWidth());
+ assertEquals(resolution, generatedRXingResult.getHeight());
+ assertEquals(goldenRXingResult, generatedRXingResult);
}
// Golden images are generated with "qrcode_sample.cc". The images are checked with both eye balls
diff --git a/java_test/java/com/google/zxing/qrcode/encoder/EncoderTestCase.java b/java_test/java/com/google/zxing/qrcode/encoder/EncoderTestCase.java
index b76ef38..fbac2b1 100644
--- a/java_test/java/com/google/zxing/qrcode/encoder/EncoderTestCase.java
+++ b/java_test/java/com/google/zxing/qrcode/encoder/EncoderTestCase.java
@@ -905,11 +905,11 @@ public final class EncoderTestCase extends Assert {
".a.a.)", null, false);
}
- static void verifyMinimalEncoding(String input, String expectedResult, Charset priorityCharset, boolean isGS1)
+ static void verifyMinimalEncoding(String input, String expectedRXingResult, Charset priorityCharset, boolean isGS1)
throws Exception {
- MinimalEncoder.ResultList result = MinimalEncoder.encode(input, null, priorityCharset, isGS1,
+ MinimalEncoder.RXingResultList result = MinimalEncoder.encode(input, null, priorityCharset, isGS1,
ErrorCorrectionLevel.L);
- assertEquals(result.toString(), expectedResult);
+ assertEquals(result.toString(), expectedRXingResult);
}
private static void verifyGS1EncodedData(QRCode qrCode) {
diff --git a/java_test/resources/blackbox/aztec-2/16.txt b/java_test/resources/blackbox/aztec-2/16.txt
index 8399dfe..6834741 100644
--- a/java_test/resources/blackbox/aztec-2/16.txt
+++ b/java_test/resources/blackbox/aztec-2/16.txt
@@ -1 +1 @@
-http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIResultHandler.java
\ No newline at end of file
+http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIRXingResultHandler.java
\ No newline at end of file
diff --git a/java_test/resources/blackbox/aztec-2/17.txt b/java_test/resources/blackbox/aztec-2/17.txt
index 8399dfe..6834741 100644
--- a/java_test/resources/blackbox/aztec-2/17.txt
+++ b/java_test/resources/blackbox/aztec-2/17.txt
@@ -1 +1 @@
-http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIResultHandler.java
\ No newline at end of file
+http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIRXingResultHandler.java
\ No newline at end of file
diff --git a/java_test/resources/blackbox/aztec-2/18.txt b/java_test/resources/blackbox/aztec-2/18.txt
index 8399dfe..6834741 100644
--- a/java_test/resources/blackbox/aztec-2/18.txt
+++ b/java_test/resources/blackbox/aztec-2/18.txt
@@ -1 +1 @@
-http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIResultHandler.java
\ No newline at end of file
+http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIRXingResultHandler.java
\ No newline at end of file
diff --git a/java_test/resources/blackbox/aztec-2/19.txt b/java_test/resources/blackbox/aztec-2/19.txt
index 8399dfe..6834741 100644
--- a/java_test/resources/blackbox/aztec-2/19.txt
+++ b/java_test/resources/blackbox/aztec-2/19.txt
@@ -1 +1 @@
-http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIResultHandler.java
\ No newline at end of file
+http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIRXingResultHandler.java
\ No newline at end of file
diff --git a/java_test/resources/blackbox/aztec-2/20.txt b/java_test/resources/blackbox/aztec-2/20.txt
index 8399dfe..6834741 100644
--- a/java_test/resources/blackbox/aztec-2/20.txt
+++ b/java_test/resources/blackbox/aztec-2/20.txt
@@ -1 +1 @@
-http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIResultHandler.java
\ No newline at end of file
+http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIRXingResultHandler.java
\ No newline at end of file
diff --git a/java_test/resources/blackbox/aztec-2/21.txt b/java_test/resources/blackbox/aztec-2/21.txt
index 8399dfe..6834741 100644
--- a/java_test/resources/blackbox/aztec-2/21.txt
+++ b/java_test/resources/blackbox/aztec-2/21.txt
@@ -1 +1 @@
-http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIResultHandler.java
\ No newline at end of file
+http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIRXingResultHandler.java
\ No newline at end of file
diff --git a/java_test/resources/blackbox/aztec-2/22.txt b/java_test/resources/blackbox/aztec-2/22.txt
index 8399dfe..6834741 100644
--- a/java_test/resources/blackbox/aztec-2/22.txt
+++ b/java_test/resources/blackbox/aztec-2/22.txt
@@ -1 +1 @@
-http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIResultHandler.java
\ No newline at end of file
+http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIRXingResultHandler.java
\ No newline at end of file
diff --git a/src/DecodeHintType.java b/src/DecodeHintType.java
index a532750..d86738f 100644
--- a/src/DecodeHintType.java
+++ b/src/DecodeHintType.java
@@ -83,10 +83,10 @@ public enum DecodeHintType {
RETURN_CODABAR_START_END(Void.class),
/**
- * The caller needs to be notified via callback when a possible {@link ResultPoint}
- * is found. Maps to a {@link ResultPointCallback}.
+ * The caller needs to be notified via callback when a possible {@link RXingResultPoint}
+ * is found. Maps to a {@link RXingResultPointCallback}.
*/
- NEED_RESULT_POINT_CALLBACK(ResultPointCallback.class),
+ NEED_RESULT_POINT_CALLBACK(RXingResultPointCallback.class),
/**
diff --git a/src/MultiFormatReader.java b/src/MultiFormatReader.java
index 5814729..fd95d9c 100644
--- a/src/MultiFormatReader.java
+++ b/src/MultiFormatReader.java
@@ -52,7 +52,7 @@ public final class MultiFormatReader implements Reader {
* @throws NotFoundException Any errors which occurred
*/
@Override
- public Result decode(BinaryBitmap image) throws NotFoundException {
+ public RXingResult decode(BinaryBitmap image) throws NotFoundException {
setHints(null);
return decodeInternal(image);
}
@@ -66,7 +66,7 @@ public final class MultiFormatReader implements Reader {
* @throws NotFoundException Any errors which occurred
*/
@Override
- public Result decode(BinaryBitmap image, Map hints) throws NotFoundException {
+ public RXingResult decode(BinaryBitmap image, Map hints) throws NotFoundException {
setHints(hints);
return decodeInternal(image);
}
@@ -79,7 +79,7 @@ public final class MultiFormatReader implements Reader {
* @return The contents of the image
* @throws NotFoundException Any errors which occurred
*/
- public Result decodeWithState(BinaryBitmap image) throws NotFoundException {
+ public RXingResult decodeWithState(BinaryBitmap image) throws NotFoundException {
// Make sure to set up the default state so we don't crash
if (readers == null) {
setHints(null);
@@ -166,7 +166,7 @@ public final class MultiFormatReader implements Reader {
}
}
- private Result decodeInternal(BinaryBitmap image) throws NotFoundException {
+ private RXingResult decodeInternal(BinaryBitmap image) throws NotFoundException {
if (readers != null) {
for (Reader reader : readers) {
if (Thread.currentThread().isInterrupted()) {
diff --git a/src/Reader.java b/src/Reader.java
index 0e6af10..20851d5 100644
--- a/src/Reader.java
+++ b/src/Reader.java
@@ -41,7 +41,7 @@ public interface Reader {
* @throws ChecksumException if a potential barcode is found but does not pass its checksum
* @throws FormatException if a potential barcode is found but format is invalid
*/
- Result decode(BinaryBitmap image) throws NotFoundException, ChecksumException, FormatException;
+ RXingResult decode(BinaryBitmap image) throws NotFoundException, ChecksumException, FormatException;
/**
* Locates and decodes a barcode in some format within an image. This method also accepts
@@ -57,7 +57,7 @@ public interface Reader {
* @throws ChecksumException if a potential barcode is found but does not pass its checksum
* @throws FormatException if a potential barcode is found but format is invalid
*/
- Result decode(BinaryBitmap image, Map hints)
+ RXingResult decode(BinaryBitmap image, Map hints)
throws NotFoundException, ChecksumException, FormatException;
/**
diff --git a/src/Result.java b/src/Result.java
index 3df435f..456a285 100644
--- a/src/Result.java
+++ b/src/Result.java
@@ -24,36 +24,36 @@ import java.util.Map;
*
* @author Sean Owen
*/
-public final class Result {
+public final class RXingResult {
private final String text;
private final byte[] rawBytes;
private final int numBits;
- private ResultPoint[] resultPoints;
+ private RXingResultPoint[] resultPoints;
private final BarcodeFormat format;
- private Map resultMetadata;
+ private Map resultMetadata;
private final long timestamp;
- public Result(String text,
+ public RXingResult(String text,
byte[] rawBytes,
- ResultPoint[] resultPoints,
+ RXingResultPoint[] resultPoints,
BarcodeFormat format) {
this(text, rawBytes, resultPoints, format, System.currentTimeMillis());
}
- public Result(String text,
+ public RXingResult(String text,
byte[] rawBytes,
- ResultPoint[] resultPoints,
+ RXingResultPoint[] resultPoints,
BarcodeFormat format,
long timestamp) {
this(text, rawBytes, rawBytes == null ? 0 : 8 * rawBytes.length,
resultPoints, format, timestamp);
}
- public Result(String text,
+ public RXingResult(String text,
byte[] rawBytes,
int numBits,
- ResultPoint[] resultPoints,
+ RXingResultPoint[] resultPoints,
BarcodeFormat format,
long timestamp) {
this.text = text;
@@ -92,7 +92,7 @@ public final class Result {
* identifying finder patterns or the corners of the barcode. The exact meaning is
* specific to the type of barcode that was decoded.
*/
- public ResultPoint[] getResultPoints() {
+ public RXingResultPoint[] getRXingResultPoints() {
return resultPoints;
}
@@ -104,22 +104,22 @@ public final class Result {
}
/**
- * @return {@link Map} mapping {@link ResultMetadataType} keys to values. May be
+ * @return {@link Map} mapping {@link RXingResultMetadataType} keys to values. May be
* {@code null}. This contains optional metadata about what was detected about the barcode,
* like orientation.
*/
- public Map getResultMetadata() {
+ public Map getRXingResultMetadata() {
return resultMetadata;
}
- public void putMetadata(ResultMetadataType type, Object value) {
+ public void putMetadata(RXingResultMetadataType type, Object value) {
if (resultMetadata == null) {
- resultMetadata = new EnumMap<>(ResultMetadataType.class);
+ resultMetadata = new EnumMap<>(RXingResultMetadataType.class);
}
resultMetadata.put(type, value);
}
- public void putAllMetadata(Map metadata) {
+ public void putAllMetadata(Map metadata) {
if (metadata != null) {
if (resultMetadata == null) {
resultMetadata = metadata;
@@ -129,12 +129,12 @@ public final class Result {
}
}
- public void addResultPoints(ResultPoint[] newPoints) {
- ResultPoint[] oldPoints = resultPoints;
+ public void addRXingResultPoints(RXingResultPoint[] newPoints) {
+ RXingResultPoint[] oldPoints = resultPoints;
if (oldPoints == null) {
resultPoints = newPoints;
} else if (newPoints != null && newPoints.length > 0) {
- ResultPoint[] allPoints = new ResultPoint[oldPoints.length + newPoints.length];
+ RXingResultPoint[] allPoints = new RXingResultPoint[oldPoints.length + newPoints.length];
System.arraycopy(oldPoints, 0, allPoints, 0, oldPoints.length);
System.arraycopy(newPoints, 0, allPoints, oldPoints.length, newPoints.length);
resultPoints = allPoints;
diff --git a/src/ResultMetadataType.java b/src/ResultMetadataType.java
index 0869170..4e7dc33 100644
--- a/src/ResultMetadataType.java
+++ b/src/ResultMetadataType.java
@@ -22,7 +22,7 @@ package com.google.zxing;
*
* @author Sean Owen
*/
-public enum ResultMetadataType {
+public enum RXingResultMetadataType {
/**
* Unspecified, application-specific metadata. Maps to an unspecified {@link Object}.
@@ -40,7 +40,7 @@ public enum ResultMetadataType {
/**
* 2D barcode formats typically encode text, but allow for a sort of 'byte mode'
- * which is sometimes used to encode binary data. While {@link Result} makes available
+ * which is sometimes used to encode binary data. While {@link RXingResult} makes available
* the complete raw bytes in the barcode for these formats, it does not offer the bytes
* from the byte segments alone.
*
diff --git a/src/ResultPoint.java b/src/ResultPoint.java
index 9bd8cd2..24d81fd 100644
--- a/src/ResultPoint.java
+++ b/src/ResultPoint.java
@@ -24,12 +24,12 @@ import com.google.zxing.common.detector.MathUtils;
*
* @author Sean Owen
*/
-public class ResultPoint {
+public class RXingResultPoint {
private final float x;
private final float y;
- public ResultPoint(float x, float y) {
+ public RXingResultPoint(float x, float y) {
this.x = x;
this.y = y;
}
@@ -44,8 +44,8 @@ public class ResultPoint {
@Override
public final boolean equals(Object other) {
- if (other instanceof ResultPoint) {
- ResultPoint otherPoint = (ResultPoint) other;
+ if (other instanceof RXingResultPoint) {
+ RXingResultPoint otherPoint = (RXingResultPoint) other;
return x == otherPoint.x && y == otherPoint.y;
}
return false;
@@ -62,21 +62,21 @@ public class ResultPoint {
}
/**
- * Orders an array of three ResultPoints in an order [A,B,C] such that AB is less than AC
+ * Orders an array of three RXingResultPoints in an order [A,B,C] such that AB is less than AC
* and BC is less than AC, and the angle between BC and BA is less than 180 degrees.
*
- * @param patterns array of three {@code ResultPoint} to order
+ * @param patterns array of three {@code RXingResultPoint} to order
*/
- public static void orderBestPatterns(ResultPoint[] patterns) {
+ public static void orderBestPatterns(RXingResultPoint[] patterns) {
// Find distances between pattern centers
float zeroOneDistance = distance(patterns[0], patterns[1]);
float oneTwoDistance = distance(patterns[1], patterns[2]);
float zeroTwoDistance = distance(patterns[0], patterns[2]);
- ResultPoint pointA;
- ResultPoint pointB;
- ResultPoint pointC;
+ RXingResultPoint pointA;
+ RXingResultPoint pointB;
+ RXingResultPoint pointC;
// Assume one closest to other two is B; A and C will just be guesses at first
if (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance) {
pointB = patterns[0];
@@ -97,7 +97,7 @@ public class ResultPoint {
// we want for A, B, C. If it's negative, then we've got it flipped around and
// should swap A and C.
if (crossProductZ(pointA, pointB, pointC) < 0.0f) {
- ResultPoint temp = pointA;
+ RXingResultPoint temp = pointA;
pointA = pointC;
pointC = temp;
}
@@ -112,16 +112,16 @@ public class ResultPoint {
* @param pattern2 second pattern
* @return distance between two points
*/
- public static float distance(ResultPoint pattern1, ResultPoint pattern2) {
+ public static float distance(RXingResultPoint pattern1, RXingResultPoint pattern2) {
return MathUtils.distance(pattern1.x, pattern1.y, pattern2.x, pattern2.y);
}
/**
* Returns the z component of the cross product between vectors BC and BA.
*/
- private static float crossProductZ(ResultPoint pointA,
- ResultPoint pointB,
- ResultPoint pointC) {
+ private static float crossProductZ(RXingResultPoint pointA,
+ RXingResultPoint pointB,
+ RXingResultPoint pointC) {
float bX = pointB.x;
float bY = pointB.y;
return ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX));
diff --git a/src/ResultPointCallback.java b/src/ResultPointCallback.java
index 0c85410..e3c0074 100644
--- a/src/ResultPointCallback.java
+++ b/src/ResultPointCallback.java
@@ -22,8 +22,8 @@ package com.google.zxing;
*
* @see DecodeHintType#NEED_RESULT_POINT_CALLBACK
*/
-public interface ResultPointCallback {
+public interface RXingResultPointCallback {
- void foundPossibleResultPoint(ResultPoint point);
+ void foundPossibleRXingResultPoint(RXingResultPoint point);
}
diff --git a/src/aztec/AztecDetectorResult.java b/src/aztec/AztecDetectorResult.java
index 8341578..c1c427d 100644
--- a/src/aztec/AztecDetectorResult.java
+++ b/src/aztec/AztecDetectorResult.java
@@ -16,24 +16,24 @@
package com.google.zxing.aztec;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DetectorResult;
+import com.google.zxing.common.DetectorRXingResult;
/**
- * Extends {@link DetectorResult} with more information specific to the Aztec format,
+ *
Extends {@link DetectorRXingResult} with more information specific to the Aztec format,
* like the number of layers and whether it's compact.
*
* @author Sean Owen
*/
-public final class AztecDetectorResult extends DetectorResult {
+public final class AztecDetectorRXingResult extends DetectorRXingResult {
private final boolean compact;
private final int nbDatablocks;
private final int nbLayers;
- public AztecDetectorResult(BitMatrix bits,
- ResultPoint[] points,
+ public AztecDetectorRXingResult(BitMatrix bits,
+ RXingResultPoint[] points,
boolean compact,
int nbDatablocks,
int nbLayers) {
diff --git a/src/aztec/AztecReader.java b/src/aztec/AztecReader.java
index f3a3e21..a0c1dfe 100644
--- a/src/aztec/AztecReader.java
+++ b/src/aztec/AztecReader.java
@@ -22,13 +22,13 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.Reader;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
-import com.google.zxing.ResultPointCallback;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
+import com.google.zxing.RXingResultPointCallback;
import com.google.zxing.aztec.decoder.Decoder;
import com.google.zxing.aztec.detector.Detector;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.common.DecoderRXingResult;
import java.util.List;
import java.util.Map;
@@ -48,33 +48,33 @@ public final class AztecReader implements Reader {
* @throws FormatException if a Data Matrix code cannot be decoded
*/
@Override
- public Result decode(BinaryBitmap image) throws NotFoundException, FormatException {
+ public RXingResult decode(BinaryBitmap image) throws NotFoundException, FormatException {
return decode(image, null);
}
@Override
- public Result decode(BinaryBitmap image, Map hints)
+ public RXingResult decode(BinaryBitmap image, Map hints)
throws NotFoundException, FormatException {
NotFoundException notFoundException = null;
FormatException formatException = null;
Detector detector = new Detector(image.getBlackMatrix());
- ResultPoint[] points = null;
- DecoderResult decoderResult = null;
+ RXingResultPoint[] points = null;
+ DecoderRXingResult decoderRXingResult = null;
try {
- AztecDetectorResult detectorResult = detector.detect(false);
- points = detectorResult.getPoints();
- decoderResult = new Decoder().decode(detectorResult);
+ AztecDetectorRXingResult detectorRXingResult = detector.detect(false);
+ points = detectorRXingResult.getPoints();
+ decoderRXingResult = new Decoder().decode(detectorRXingResult);
} catch (NotFoundException e) {
notFoundException = e;
} catch (FormatException e) {
formatException = e;
}
- if (decoderResult == null) {
+ if (decoderRXingResult == null) {
try {
- AztecDetectorResult detectorResult = detector.detect(true);
- points = detectorResult.getPoints();
- decoderResult = new Decoder().decode(detectorResult);
+ AztecDetectorRXingResult detectorRXingResult = detector.detect(true);
+ points = detectorRXingResult.getPoints();
+ decoderRXingResult = new Decoder().decode(detectorRXingResult);
} catch (NotFoundException | FormatException e) {
if (notFoundException != null) {
throw notFoundException;
@@ -87,30 +87,30 @@ public final class AztecReader implements Reader {
}
if (hints != null) {
- ResultPointCallback rpcb = (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
+ RXingResultPointCallback rpcb = (RXingResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
if (rpcb != null) {
- for (ResultPoint point : points) {
- rpcb.foundPossibleResultPoint(point);
+ for (RXingResultPoint point : points) {
+ rpcb.foundPossibleRXingResultPoint(point);
}
}
}
- Result result = new Result(decoderResult.getText(),
- decoderResult.getRawBytes(),
- decoderResult.getNumBits(),
+ RXingResult result = new RXingResult(decoderRXingResult.getText(),
+ decoderRXingResult.getRawBytes(),
+ decoderRXingResult.getNumBits(),
points,
BarcodeFormat.AZTEC,
System.currentTimeMillis());
- List byteSegments = decoderResult.getByteSegments();
+ List byteSegments = decoderRXingResult.getByteSegments();
if (byteSegments != null) {
- result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);
+ result.putMetadata(RXingResultMetadataType.BYTE_SEGMENTS, byteSegments);
}
- String ecLevel = decoderResult.getECLevel();
+ String ecLevel = decoderRXingResult.getECLevel();
if (ecLevel != null) {
- result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
+ result.putMetadata(RXingResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
}
- result.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]z" + decoderResult.getSymbologyModifier());
+ result.putMetadata(RXingResultMetadataType.SYMBOLOGY_IDENTIFIER, "]z" + decoderRXingResult.getSymbologyModifier());
return result;
}
diff --git a/src/aztec/AztecWriter.java b/src/aztec/AztecWriter.java
index e5cb7e6..01d6135 100644
--- a/src/aztec/AztecWriter.java
+++ b/src/aztec/AztecWriter.java
@@ -62,10 +62,10 @@ public final class AztecWriter implements Writer {
throw new IllegalArgumentException("Can only encode AZTEC, but got " + format);
}
AztecCode aztec = Encoder.encode(contents, eccPercent, layers, charset);
- return renderResult(aztec, width, height);
+ return renderRXingResult(aztec, width, height);
}
- private static BitMatrix renderResult(AztecCode code, int width, int height) {
+ private static BitMatrix renderRXingResult(AztecCode code, int width, int height) {
BitMatrix input = code.getMatrix();
if (input == null) {
throw new IllegalStateException();
diff --git a/src/aztec/decoder/Decoder.java b/src/aztec/decoder/Decoder.java
index 6f6ac42..92a5033 100644
--- a/src/aztec/decoder/Decoder.java
+++ b/src/aztec/decoder/Decoder.java
@@ -17,10 +17,10 @@
package com.google.zxing.aztec.decoder;
import com.google.zxing.FormatException;
-import com.google.zxing.aztec.AztecDetectorResult;
+import com.google.zxing.aztec.AztecDetectorRXingResult;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.CharacterSetECI;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.common.DecoderRXingResult;
import com.google.zxing.common.reedsolomon.GenericGF;
import com.google.zxing.common.reedsolomon.ReedSolomonDecoder;
import com.google.zxing.common.reedsolomon.ReedSolomonException;
@@ -75,19 +75,19 @@ public final class Decoder {
private static final Charset DEFAULT_ENCODING = StandardCharsets.ISO_8859_1;
- private AztecDetectorResult ddata;
+ private AztecDetectorRXingResult ddata;
- public DecoderResult decode(AztecDetectorResult detectorResult) throws FormatException {
- ddata = detectorResult;
- BitMatrix matrix = detectorResult.getBits();
+ public DecoderRXingResult decode(AztecDetectorRXingResult detectorRXingResult) throws FormatException {
+ ddata = detectorRXingResult;
+ BitMatrix matrix = detectorRXingResult.getBits();
boolean[] rawbits = extractBits(matrix);
- CorrectedBitsResult correctedBits = correctBits(rawbits);
+ CorrectedBitsRXingResult correctedBits = correctBits(rawbits);
byte[] rawBytes = convertBoolArrayToByteArray(correctedBits.correctBits);
String result = getEncodedData(correctedBits.correctBits);
- DecoderResult decoderResult =
- new DecoderResult(rawBytes, result, null, String.format("%d%%", correctedBits.ecLevel));
- decoderResult.setNumBits(correctedBits.correctBits.length);
- return decoderResult;
+ DecoderRXingResult decoderRXingResult =
+ new DecoderRXingResult(rawBytes, result, null, String.format("%d%%", correctedBits.ecLevel));
+ decoderRXingResult.setNumBits(correctedBits.correctBits.length);
+ return decoderRXingResult;
}
// This method is used for testing the high-level encoder
@@ -262,11 +262,11 @@ public final class Decoder {
}
}
- static final class CorrectedBitsResult {
+ static final class CorrectedBitsRXingResult {
private final boolean[] correctBits;
private final int ecLevel;
- CorrectedBitsResult(boolean[] correctBits, int ecLevel) {
+ CorrectedBitsRXingResult(boolean[] correctBits, int ecLevel) {
this.correctBits = correctBits;
this.ecLevel = ecLevel;
}
@@ -278,7 +278,7 @@ public final class Decoder {
* @return the corrected array
* @throws FormatException if the input contains too many errors
*/
- private CorrectedBitsResult correctBits(boolean[] rawbits) throws FormatException {
+ private CorrectedBitsRXingResult correctBits(boolean[] rawbits) throws FormatException {
GenericGF gf;
int codewordSize;
@@ -343,7 +343,7 @@ public final class Decoder {
}
}
- return new CorrectedBitsResult(correctedBits, 100 * (numCodewords - numDataCodewords) / numCodewords);
+ return new CorrectedBitsRXingResult(correctedBits, 100 * (numCodewords - numDataCodewords) / numCodewords);
}
/**
diff --git a/src/aztec/detector/Detector.java b/src/aztec/detector/Detector.java
index c078a94..b5e5dbd 100644
--- a/src/aztec/detector/Detector.java
+++ b/src/aztec/detector/Detector.java
@@ -17,8 +17,8 @@
package com.google.zxing.aztec.detector;
import com.google.zxing.NotFoundException;
-import com.google.zxing.ResultPoint;
-import com.google.zxing.aztec.AztecDetectorResult;
+import com.google.zxing.RXingResultPoint;
+import com.google.zxing.aztec.AztecDetectorRXingResult;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.GridSampler;
import com.google.zxing.common.detector.MathUtils;
@@ -55,7 +55,7 @@ public final class Detector {
this.image = image;
}
- public AztecDetectorResult detect() throws NotFoundException {
+ public AztecDetectorRXingResult detect() throws NotFoundException {
return detect(false);
}
@@ -63,20 +63,20 @@ public final class Detector {
* Detects an Aztec Code in an image.
*
* @param isMirror if true, image is a mirror-image of original
- * @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code
+ * @return {@link AztecDetectorRXingResult} encapsulating results of detecting an Aztec Code
* @throws NotFoundException if no Aztec Code can be found
*/
- public AztecDetectorResult detect(boolean isMirror) throws NotFoundException {
+ public AztecDetectorRXingResult detect(boolean isMirror) throws NotFoundException {
// 1. Get the center of the aztec matrix
Point pCenter = getMatrixCenter();
// 2. Get the center points of the four diagonal points just outside the bull's eye
// [topRight, bottomRight, bottomLeft, topLeft]
- ResultPoint[] bullsEyeCorners = getBullsEyeCorners(pCenter);
+ RXingResultPoint[] bullsEyeCorners = getBullsEyeCorners(pCenter);
if (isMirror) {
- ResultPoint temp = bullsEyeCorners[0];
+ RXingResultPoint temp = bullsEyeCorners[0];
bullsEyeCorners[0] = bullsEyeCorners[2];
bullsEyeCorners[2] = temp;
}
@@ -92,9 +92,9 @@ public final class Detector {
bullsEyeCorners[(shift + 3) % 4]);
// 5. Get the corners of the matrix.
- ResultPoint[] corners = getMatrixCornerPoints(bullsEyeCorners);
+ RXingResultPoint[] corners = getMatrixCornerPoints(bullsEyeCorners);
- return new AztecDetectorResult(bits, corners, compact, nbDataBlocks, nbLayers);
+ return new AztecDetectorRXingResult(bits, corners, compact, nbDataBlocks, nbLayers);
}
/**
@@ -103,7 +103,7 @@ public final class Detector {
* @param bullsEyeCorners the array of bull's eye corners
* @throws NotFoundException in case of too many errors or invalid parameters
*/
- private void extractParameters(ResultPoint[] bullsEyeCorners) throws NotFoundException {
+ private void extractParameters(RXingResultPoint[] bullsEyeCorners) throws NotFoundException {
if (!isValid(bullsEyeCorners[0]) || !isValid(bullsEyeCorners[1]) ||
!isValid(bullsEyeCorners[2]) || !isValid(bullsEyeCorners[3])) {
throw NotFoundException.getNotFoundInstance();
@@ -232,7 +232,7 @@ public final class Detector {
* @return The corners of the bull-eye
* @throws NotFoundException If no valid bull-eye can be found
*/
- private ResultPoint[] getBullsEyeCorners(Point pCenter) throws NotFoundException {
+ private RXingResultPoint[] getBullsEyeCorners(Point pCenter) throws NotFoundException {
Point pina = pCenter;
Point pinb = pCenter;
@@ -274,14 +274,14 @@ public final class Detector {
// Expand the square by .5 pixel in each direction so that we're on the border
// between the white square and the black square
- ResultPoint pinax = new ResultPoint(pina.getX() + 0.5f, pina.getY() - 0.5f);
- ResultPoint pinbx = new ResultPoint(pinb.getX() + 0.5f, pinb.getY() + 0.5f);
- ResultPoint pincx = new ResultPoint(pinc.getX() - 0.5f, pinc.getY() + 0.5f);
- ResultPoint pindx = new ResultPoint(pind.getX() - 0.5f, pind.getY() - 0.5f);
+ RXingResultPoint pinax = new RXingResultPoint(pina.getX() + 0.5f, pina.getY() - 0.5f);
+ RXingResultPoint pinbx = new RXingResultPoint(pinb.getX() + 0.5f, pinb.getY() + 0.5f);
+ RXingResultPoint pincx = new RXingResultPoint(pinc.getX() - 0.5f, pinc.getY() + 0.5f);
+ RXingResultPoint pindx = new RXingResultPoint(pind.getX() - 0.5f, pind.getY() - 0.5f);
// Expand the square so that its corners are the centers of the points
// just outside the bull's eye.
- return expandSquare(new ResultPoint[]{pinax, pinbx, pincx, pindx},
+ return expandSquare(new RXingResultPoint[]{pinax, pinbx, pincx, pindx},
2 * nbCenterLayers - 3,
2 * nbCenterLayers);
}
@@ -293,15 +293,15 @@ public final class Detector {
*/
private Point getMatrixCenter() {
- ResultPoint pointA;
- ResultPoint pointB;
- ResultPoint pointC;
- ResultPoint pointD;
+ RXingResultPoint pointA;
+ RXingResultPoint pointB;
+ RXingResultPoint pointC;
+ RXingResultPoint pointD;
//Get a white rectangle that can be the border of the matrix in center bull's eye or
try {
- ResultPoint[] cornerPoints = new WhiteRectangleDetector(image).detect();
+ RXingResultPoint[] cornerPoints = new WhiteRectangleDetector(image).detect();
pointA = cornerPoints[0];
pointB = cornerPoints[1];
pointC = cornerPoints[2];
@@ -313,10 +313,10 @@ public final class Detector {
// In that case, surely in the bull's eye, we try to expand the rectangle.
int cx = image.getWidth() / 2;
int cy = image.getHeight() / 2;
- pointA = getFirstDifferent(new Point(cx + 7, cy - 7), false, 1, -1).toResultPoint();
- pointB = getFirstDifferent(new Point(cx + 7, cy + 7), false, 1, 1).toResultPoint();
- pointC = getFirstDifferent(new Point(cx - 7, cy + 7), false, -1, 1).toResultPoint();
- pointD = getFirstDifferent(new Point(cx - 7, cy - 7), false, -1, -1).toResultPoint();
+ pointA = getFirstDifferent(new Point(cx + 7, cy - 7), false, 1, -1).toRXingResultPoint();
+ pointB = getFirstDifferent(new Point(cx + 7, cy + 7), false, 1, 1).toRXingResultPoint();
+ pointC = getFirstDifferent(new Point(cx - 7, cy + 7), false, -1, 1).toRXingResultPoint();
+ pointD = getFirstDifferent(new Point(cx - 7, cy - 7), false, -1, -1).toRXingResultPoint();
}
@@ -328,7 +328,7 @@ public final class Detector {
// This will ensure that we end up with a white rectangle in center bull's eye
// in order to compute a more accurate center.
try {
- ResultPoint[] cornerPoints = new WhiteRectangleDetector(image, 15, cx, cy).detect();
+ RXingResultPoint[] cornerPoints = new WhiteRectangleDetector(image, 15, cx, cy).detect();
pointA = cornerPoints[0];
pointB = cornerPoints[1];
pointC = cornerPoints[2];
@@ -336,10 +336,10 @@ public final class Detector {
} catch (NotFoundException e) {
// This exception can be in case the initial rectangle is white
// In that case we try to expand the rectangle.
- pointA = getFirstDifferent(new Point(cx + 7, cy - 7), false, 1, -1).toResultPoint();
- pointB = getFirstDifferent(new Point(cx + 7, cy + 7), false, 1, 1).toResultPoint();
- pointC = getFirstDifferent(new Point(cx - 7, cy + 7), false, -1, 1).toResultPoint();
- pointD = getFirstDifferent(new Point(cx - 7, cy - 7), false, -1, -1).toResultPoint();
+ pointA = getFirstDifferent(new Point(cx + 7, cy - 7), false, 1, -1).toRXingResultPoint();
+ pointB = getFirstDifferent(new Point(cx + 7, cy + 7), false, 1, 1).toRXingResultPoint();
+ pointC = getFirstDifferent(new Point(cx - 7, cy + 7), false, -1, 1).toRXingResultPoint();
+ pointD = getFirstDifferent(new Point(cx - 7, cy - 7), false, -1, -1).toRXingResultPoint();
}
// Recompute the center of the rectangle
@@ -355,7 +355,7 @@ public final class Detector {
* @param bullsEyeCorners the array of bull's eye corners
* @return the array of aztec code corners
*/
- private ResultPoint[] getMatrixCornerPoints(ResultPoint[] bullsEyeCorners) {
+ private RXingResultPoint[] getMatrixCornerPoints(RXingResultPoint[] bullsEyeCorners) {
return expandSquare(bullsEyeCorners, 2 * nbCenterLayers, getDimension());
}
@@ -365,10 +365,10 @@ public final class Detector {
* diagonal just outside the bull's eye.
*/
private BitMatrix sampleGrid(BitMatrix image,
- ResultPoint topLeft,
- ResultPoint topRight,
- ResultPoint bottomRight,
- ResultPoint bottomLeft) throws NotFoundException {
+ RXingResultPoint topLeft,
+ RXingResultPoint topRight,
+ RXingResultPoint bottomRight,
+ RXingResultPoint bottomLeft) throws NotFoundException {
GridSampler sampler = GridSampler.getInstance();
int dimension = getDimension();
@@ -397,7 +397,7 @@ public final class Detector {
* @param size number of bits
* @return the array of bits as an int (first bit is high-order bit of result)
*/
- private int sampleLine(ResultPoint p1, ResultPoint p2, int size) {
+ private int sampleLine(RXingResultPoint p1, RXingResultPoint p2, int size) {
int result = 0;
float d = distance(p1, p2);
@@ -529,31 +529,31 @@ public final class Detector {
* @param newSide the new length of the size of the square in the target bit matrix
* @return the corners of the expanded square
*/
- private static ResultPoint[] expandSquare(ResultPoint[] cornerPoints, int oldSide, int newSide) {
+ private static RXingResultPoint[] expandSquare(RXingResultPoint[] cornerPoints, int oldSide, int newSide) {
float ratio = newSide / (2.0f * oldSide);
float dx = cornerPoints[0].getX() - cornerPoints[2].getX();
float dy = cornerPoints[0].getY() - cornerPoints[2].getY();
float centerx = (cornerPoints[0].getX() + cornerPoints[2].getX()) / 2.0f;
float centery = (cornerPoints[0].getY() + cornerPoints[2].getY()) / 2.0f;
- ResultPoint result0 = new ResultPoint(centerx + ratio * dx, centery + ratio * dy);
- ResultPoint result2 = new ResultPoint(centerx - ratio * dx, centery - ratio * dy);
+ RXingResultPoint result0 = new RXingResultPoint(centerx + ratio * dx, centery + ratio * dy);
+ RXingResultPoint result2 = new RXingResultPoint(centerx - ratio * dx, centery - ratio * dy);
dx = cornerPoints[1].getX() - cornerPoints[3].getX();
dy = cornerPoints[1].getY() - cornerPoints[3].getY();
centerx = (cornerPoints[1].getX() + cornerPoints[3].getX()) / 2.0f;
centery = (cornerPoints[1].getY() + cornerPoints[3].getY()) / 2.0f;
- ResultPoint result1 = new ResultPoint(centerx + ratio * dx, centery + ratio * dy);
- ResultPoint result3 = new ResultPoint(centerx - ratio * dx, centery - ratio * dy);
+ RXingResultPoint result1 = new RXingResultPoint(centerx + ratio * dx, centery + ratio * dy);
+ RXingResultPoint result3 = new RXingResultPoint(centerx - ratio * dx, centery - ratio * dy);
- return new ResultPoint[]{result0, result1, result2, result3};
+ return new RXingResultPoint[]{result0, result1, result2, result3};
}
private boolean isValid(int x, int y) {
return x >= 0 && x < image.getWidth() && y >= 0 && y < image.getHeight();
}
- private boolean isValid(ResultPoint point) {
+ private boolean isValid(RXingResultPoint point) {
int x = MathUtils.round(point.getX());
int y = MathUtils.round(point.getY());
return isValid(x, y);
@@ -563,7 +563,7 @@ public final class Detector {
return MathUtils.distance(a.getX(), a.getY(), b.getX(), b.getY());
}
- private static float distance(ResultPoint a, ResultPoint b) {
+ private static float distance(RXingResultPoint a, RXingResultPoint b) {
return MathUtils.distance(a.getX(), a.getY(), b.getX(), b.getY());
}
@@ -578,8 +578,8 @@ public final class Detector {
private final int x;
private final int y;
- ResultPoint toResultPoint() {
- return new ResultPoint(x, y);
+ RXingResultPoint toRXingResultPoint() {
+ return new RXingResultPoint(x, y);
}
Point(int x, int y) {
diff --git a/src/client/result/AbstractDoCoMoResultParser.java b/src/client/result/AbstractDoCoMoResultParser.java
index bf5c190..caf7541 100644
--- a/src/client/result/AbstractDoCoMoResultParser.java
+++ b/src/client/result/AbstractDoCoMoResultParser.java
@@ -26,7 +26,7 @@ package com.google.zxing.client.result;
*
* @author Sean Owen
*/
-abstract class AbstractDoCoMoResultParser extends ResultParser {
+abstract class AbstractDoCoMoRXingResultParser extends RXingResultParser {
static String[] matchDoCoMoPrefixedField(String prefix, String rawText) {
return matchPrefixedField(prefix, rawText, ';', true);
diff --git a/src/client/result/AddressBookAUResultParser.java b/src/client/result/AddressBookAUResultParser.java
index b601955..5edc94a 100644
--- a/src/client/result/AddressBookAUResultParser.java
+++ b/src/client/result/AddressBookAUResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import java.util.ArrayList;
import java.util.List;
@@ -29,10 +29,10 @@ import java.util.List;
*
* @author Sean Owen
*/
-public final class AddressBookAUResultParser extends ResultParser {
+public final class AddressBookAURXingResultParser extends RXingResultParser {
@Override
- public AddressBookParsedResult parse(Result result) {
+ public AddressBookParsedRXingResult parse(RXingResult result) {
String rawText = getMassagedText(result);
// MEMORY is mandatory; seems like a decent indicator, as does end-of-record separator CR/LF
if (!rawText.contains("MEMORY") || !rawText.contains("\r\n")) {
@@ -49,7 +49,7 @@ public final class AddressBookAUResultParser extends ResultParser {
String note = matchSinglePrefixedField("MEMORY:", rawText, '\r', false);
String address = matchSinglePrefixedField("ADD:", rawText, '\r', true);
String[] addresses = address == null ? null : new String[] {address};
- return new AddressBookParsedResult(maybeWrap(name),
+ return new AddressBookParsedRXingResult(maybeWrap(name),
null,
pronunciation,
phoneNumbers,
diff --git a/src/client/result/AddressBookDoCoMoResultParser.java b/src/client/result/AddressBookDoCoMoResultParser.java
index 4e6e11f..c44cfb4 100644
--- a/src/client/result/AddressBookDoCoMoResultParser.java
+++ b/src/client/result/AddressBookDoCoMoResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
/**
* Implements the "MECARD" address book entry format.
@@ -33,10 +33,10 @@ import com.google.zxing.Result;
*
* @author Sean Owen
*/
-public final class AddressBookDoCoMoResultParser extends AbstractDoCoMoResultParser {
+public final class AddressBookDoCoMoRXingResultParser extends AbstractDoCoMoRXingResultParser {
@Override
- public AddressBookParsedResult parse(Result result) {
+ public AddressBookParsedRXingResult parse(RXingResult result) {
String rawText = getMassagedText(result);
if (!rawText.startsWith("MECARD:")) {
return null;
@@ -62,7 +62,7 @@ public final class AddressBookDoCoMoResultParser extends AbstractDoCoMoResultPar
// honor it when found in the wild.
String org = matchSingleDoCoMoPrefixedField("ORG:", rawText, true);
- return new AddressBookParsedResult(maybeWrap(name),
+ return new AddressBookParsedRXingResult(maybeWrap(name),
null,
pronunciation,
phoneNumbers,
diff --git a/src/client/result/AddressBookParsedResult.java b/src/client/result/AddressBookParsedResult.java
index 0738339..c1ea2ba 100644
--- a/src/client/result/AddressBookParsedResult.java
+++ b/src/client/result/AddressBookParsedResult.java
@@ -22,7 +22,7 @@ package com.google.zxing.client.result;
*
* @author Sean Owen
*/
-public final class AddressBookParsedResult extends ParsedResult {
+public final class AddressBookParsedRXingResult extends ParsedRXingResult {
private final String[] names;
private final String[] nicknames;
@@ -41,7 +41,7 @@ public final class AddressBookParsedResult extends ParsedResult {
private final String[] urls;
private final String[] geo;
- public AddressBookParsedResult(String[] names,
+ public AddressBookParsedRXingResult(String[] names,
String[] phoneNumbers,
String[] phoneTypes,
String[] emails,
@@ -66,7 +66,7 @@ public final class AddressBookParsedResult extends ParsedResult {
null);
}
- public AddressBookParsedResult(String[] names,
+ public AddressBookParsedRXingResult(String[] names,
String[] nicknames,
String pronunciation,
String[] phoneNumbers,
@@ -82,7 +82,7 @@ public final class AddressBookParsedResult extends ParsedResult {
String title,
String[] urls,
String[] geo) {
- super(ParsedResultType.ADDRESSBOOK);
+ super(ParsedRXingResultType.ADDRESSBOOK);
if (phoneNumbers != null && phoneTypes != null && phoneNumbers.length != phoneTypes.length) {
throw new IllegalArgumentException("Phone numbers and types lengths differ");
}
@@ -199,7 +199,7 @@ public final class AddressBookParsedResult extends ParsedResult {
}
@Override
- public String getDisplayResult() {
+ public String getDisplayRXingResult() {
StringBuilder result = new StringBuilder(100);
maybeAppend(names, result);
maybeAppend(nicknames, result);
diff --git a/src/client/result/BizcardResultParser.java b/src/client/result/BizcardResultParser.java
index f12e80b..f59f60c 100644
--- a/src/client/result/BizcardResultParser.java
+++ b/src/client/result/BizcardResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import java.util.ArrayList;
import java.util.List;
@@ -28,14 +28,14 @@ import java.util.List;
*
* @author Sean Owen
*/
-public final class BizcardResultParser extends AbstractDoCoMoResultParser {
+public final class BizcardRXingResultParser extends AbstractDoCoMoRXingResultParser {
- // Yes, we extend AbstractDoCoMoResultParser since the format is very much
+ // Yes, we extend AbstractDoCoMoRXingResultParser since the format is very much
// like the DoCoMo MECARD format, but this is not technically one of
// DoCoMo's proposed formats
@Override
- public AddressBookParsedResult parse(Result result) {
+ public AddressBookParsedRXingResult parse(RXingResult result) {
String rawText = getMassagedText(result);
if (!rawText.startsWith("BIZCARD:")) {
return null;
@@ -51,7 +51,7 @@ public final class BizcardResultParser extends AbstractDoCoMoResultParser {
String phoneNumber3 = matchSingleDoCoMoPrefixedField("F:", rawText, true);
String email = matchSingleDoCoMoPrefixedField("E:", rawText, true);
- return new AddressBookParsedResult(maybeWrap(fullName),
+ return new AddressBookParsedRXingResult(maybeWrap(fullName),
null,
null,
buildPhoneNumbers(phoneNumber1, phoneNumber2, phoneNumber3),
diff --git a/src/client/result/BookmarkDoCoMoResultParser.java b/src/client/result/BookmarkDoCoMoResultParser.java
index 1f1f485..5e68175 100644
--- a/src/client/result/BookmarkDoCoMoResultParser.java
+++ b/src/client/result/BookmarkDoCoMoResultParser.java
@@ -16,15 +16,15 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
/**
* @author Sean Owen
*/
-public final class BookmarkDoCoMoResultParser extends AbstractDoCoMoResultParser {
+public final class BookmarkDoCoMoRXingResultParser extends AbstractDoCoMoRXingResultParser {
@Override
- public URIParsedResult parse(Result result) {
+ public URIParsedRXingResult parse(RXingResult result) {
String rawText = result.getText();
if (!rawText.startsWith("MEBKM:")) {
return null;
@@ -35,7 +35,7 @@ public final class BookmarkDoCoMoResultParser extends AbstractDoCoMoResultParser
return null;
}
String uri = rawUri[0];
- return URIResultParser.isBasicallyValidURI(uri) ? new URIParsedResult(uri, title) : null;
+ return URIRXingResultParser.isBasicallyValidURI(uri) ? new URIParsedRXingResult(uri, title) : null;
}
}
diff --git a/src/client/result/CalendarParsedResult.java b/src/client/result/CalendarParsedResult.java
index 7b478a3..93ef6bd 100644
--- a/src/client/result/CalendarParsedResult.java
+++ b/src/client/result/CalendarParsedResult.java
@@ -33,7 +33,7 @@ import java.util.regex.Pattern;
*
* @author Sean Owen
*/
-public final class CalendarParsedResult extends ParsedResult {
+public final class CalendarParsedRXingResult extends ParsedRXingResult {
private static final Pattern RFC2445_DURATION =
Pattern.compile("P(?:(\\d+)W)?(?:(\\d+)D)?(?:T(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)S)?)?");
@@ -59,7 +59,7 @@ public final class CalendarParsedResult extends ParsedResult {
private final double latitude;
private final double longitude;
- public CalendarParsedResult(String summary,
+ public CalendarParsedRXingResult(String summary,
String startString,
String endString,
String durationString,
@@ -69,7 +69,7 @@ public final class CalendarParsedResult extends ParsedResult {
String description,
double latitude,
double longitude) {
- super(ParsedResultType.CALENDAR);
+ super(ParsedRXingResultType.CALENDAR);
this.summary = summary;
try {
@@ -177,7 +177,7 @@ public final class CalendarParsedResult extends ParsedResult {
}
@Override
- public String getDisplayResult() {
+ public String getDisplayRXingResult() {
StringBuilder result = new StringBuilder(100);
maybeAppend(summary, result);
maybeAppend(format(startAllDay, start), result);
diff --git a/src/client/result/EmailAddressParsedResult.java b/src/client/result/EmailAddressParsedResult.java
index a5bcd44..f76c70b 100644
--- a/src/client/result/EmailAddressParsedResult.java
+++ b/src/client/result/EmailAddressParsedResult.java
@@ -22,7 +22,7 @@ package com.google.zxing.client.result;
*
* @author Sean Owen
*/
-public final class EmailAddressParsedResult extends ParsedResult {
+public final class EmailAddressParsedRXingResult extends ParsedRXingResult {
private final String[] tos;
private final String[] ccs;
@@ -30,16 +30,16 @@ public final class EmailAddressParsedResult extends ParsedResult {
private final String subject;
private final String body;
- EmailAddressParsedResult(String to) {
+ EmailAddressParsedRXingResult(String to) {
this(new String[] {to}, null, null, null, null);
}
- EmailAddressParsedResult(String[] tos,
+ EmailAddressParsedRXingResult(String[] tos,
String[] ccs,
String[] bccs,
String subject,
String body) {
- super(ParsedResultType.EMAIL_ADDRESS);
+ super(ParsedRXingResultType.EMAIL_ADDRESS);
this.tos = tos;
this.ccs = ccs;
this.bccs = bccs;
@@ -86,7 +86,7 @@ public final class EmailAddressParsedResult extends ParsedResult {
}
@Override
- public String getDisplayResult() {
+ public String getDisplayRXingResult() {
StringBuilder result = new StringBuilder(30);
maybeAppend(tos, result);
maybeAppend(ccs, result);
diff --git a/src/client/result/EmailAddressResultParser.java b/src/client/result/EmailAddressResultParser.java
index 18c4f7a..5a380f8 100644
--- a/src/client/result/EmailAddressResultParser.java
+++ b/src/client/result/EmailAddressResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import java.util.Map;
import java.util.regex.Pattern;
@@ -27,12 +27,12 @@ import java.util.regex.Pattern;
*
* @author Sean Owen
*/
-public final class EmailAddressResultParser extends ResultParser {
+public final class EmailAddressRXingResultParser extends RXingResultParser {
private static final Pattern COMMA = Pattern.compile(",");
@Override
- public EmailAddressParsedResult parse(Result result) {
+ public EmailAddressParsedRXingResult parse(RXingResult result) {
String rawText = getMassagedText(result);
if (rawText.startsWith("mailto:") || rawText.startsWith("MAILTO:")) {
// If it starts with mailto:, assume it is definitely trying to be an email address
@@ -73,12 +73,12 @@ public final class EmailAddressResultParser extends ResultParser {
subject = nameValues.get("subject");
body = nameValues.get("body");
}
- return new EmailAddressParsedResult(tos, ccs, bccs, subject, body);
+ return new EmailAddressParsedRXingResult(tos, ccs, bccs, subject, body);
} else {
- if (!EmailDoCoMoResultParser.isBasicallyValidEmailAddress(rawText)) {
+ if (!EmailDoCoMoRXingResultParser.isBasicallyValidEmailAddress(rawText)) {
return null;
}
- return new EmailAddressParsedResult(rawText);
+ return new EmailAddressParsedRXingResult(rawText);
}
}
diff --git a/src/client/result/EmailDoCoMoResultParser.java b/src/client/result/EmailDoCoMoResultParser.java
index ab301f4..d5ac692 100644
--- a/src/client/result/EmailDoCoMoResultParser.java
+++ b/src/client/result/EmailDoCoMoResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import java.util.regex.Pattern;
@@ -27,12 +27,12 @@ import java.util.regex.Pattern;
*
* @author Sean Owen
*/
-public final class EmailDoCoMoResultParser extends AbstractDoCoMoResultParser {
+public final class EmailDoCoMoRXingResultParser extends AbstractDoCoMoRXingResultParser {
private static final Pattern ATEXT_ALPHANUMERIC = Pattern.compile("[a-zA-Z0-9@.!#$%&'*+\\-/=?^_`{|}~]+");
@Override
- public EmailAddressParsedResult parse(Result result) {
+ public EmailAddressParsedRXingResult parse(RXingResult result) {
String rawText = getMassagedText(result);
if (!rawText.startsWith("MATMSG:")) {
return null;
@@ -48,7 +48,7 @@ public final class EmailDoCoMoResultParser extends AbstractDoCoMoResultParser {
}
String subject = matchSingleDoCoMoPrefixedField("SUB:", rawText, false);
String body = matchSingleDoCoMoPrefixedField("BODY:", rawText, false);
- return new EmailAddressParsedResult(tos, null, null, subject, body);
+ return new EmailAddressParsedRXingResult(tos, null, null, subject, body);
}
/**
diff --git a/src/client/result/ExpandedProductParsedResult.java b/src/client/result/ExpandedProductParsedResult.java
index 13b93f8..3b6b30a 100644
--- a/src/client/result/ExpandedProductParsedResult.java
+++ b/src/client/result/ExpandedProductParsedResult.java
@@ -36,7 +36,7 @@ import java.util.Objects;
* @author Antonio Manuel Benjumea Conde, Servinform, S.A.
* @author Agustín Delgado, Servinform, S.A.
*/
-public final class ExpandedProductParsedResult extends ParsedResult {
+public final class ExpandedProductParsedRXingResult extends ParsedRXingResult {
public static final String KILOGRAM = "KG";
public static final String POUND = "LB";
@@ -58,7 +58,7 @@ public final class ExpandedProductParsedResult extends ParsedResult {
// For AIS that not exist in this object
private final Map uncommonAIs;
- public ExpandedProductParsedResult(String rawText,
+ public ExpandedProductParsedRXingResult(String rawText,
String productID,
String sscc,
String lotNumber,
@@ -73,7 +73,7 @@ public final class ExpandedProductParsedResult extends ParsedResult {
String priceIncrement,
String priceCurrency,
Map uncommonAIs) {
- super(ParsedResultType.PRODUCT);
+ super(ParsedRXingResultType.PRODUCT);
this.rawText = rawText;
this.productID = productID;
this.sscc = sscc;
@@ -93,11 +93,11 @@ public final class ExpandedProductParsedResult extends ParsedResult {
@Override
public boolean equals(Object o) {
- if (!(o instanceof ExpandedProductParsedResult)) {
+ if (!(o instanceof ExpandedProductParsedRXingResult)) {
return false;
}
- ExpandedProductParsedResult other = (ExpandedProductParsedResult) o;
+ ExpandedProductParsedRXingResult other = (ExpandedProductParsedRXingResult) o;
return Objects.equals(productID, other.productID)
&& Objects.equals(sscc, other.sscc)
@@ -193,7 +193,7 @@ public final class ExpandedProductParsedResult extends ParsedResult {
}
@Override
- public String getDisplayResult() {
+ public String getDisplayRXingResult() {
return String.valueOf(rawText);
}
}
diff --git a/src/client/result/ExpandedProductResultParser.java b/src/client/result/ExpandedProductResultParser.java
index c021587..7ddd101 100644
--- a/src/client/result/ExpandedProductResultParser.java
+++ b/src/client/result/ExpandedProductResultParser.java
@@ -30,7 +30,7 @@ import java.util.HashMap;
import java.util.Map;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
/**
* Parses strings of digits that represent a RSS Extended code.
@@ -38,13 +38,13 @@ import com.google.zxing.Result;
* @author Antonio Manuel Benjumea Conde, Servinform, S.A.
* @author Agustín Delgado, Servinform, S.A.
*/
-public final class ExpandedProductResultParser extends ResultParser {
+public final class ExpandedProductRXingResultParser extends RXingResultParser {
@Override
- public ExpandedProductParsedResult parse(Result result) {
+ public ExpandedProductParsedRXingResult parse(RXingResult result) {
BarcodeFormat format = result.getBarcodeFormat();
if (format != BarcodeFormat.RSS_EXPANDED) {
- // ExtendedProductParsedResult NOT created. Not a RSS Expanded barcode
+ // ExtendedProductParsedRXingResult NOT created. Not a RSS Expanded barcode
return null;
}
String rawText = getMassagedText(result);
@@ -70,7 +70,7 @@ public final class ExpandedProductResultParser extends ResultParser {
String ai = findAIvalue(i, rawText);
if (ai == null) {
// Error. Code doesn't match with RSS expanded pattern
- // ExtendedProductParsedResult NOT created. Not match with RSS Expanded pattern
+ // ExtendedProductParsedRXingResult NOT created. Not match with RSS Expanded pattern
return null;
}
i += ai.length() + 2;
@@ -110,7 +110,7 @@ public final class ExpandedProductResultParser extends ResultParser {
case "3108":
case "3109":
weight = value;
- weightType = ExpandedProductParsedResult.KILOGRAM;
+ weightType = ExpandedProductParsedRXingResult.KILOGRAM;
weightIncrement = ai.substring(3);
break;
case "3200":
@@ -124,7 +124,7 @@ public final class ExpandedProductResultParser extends ResultParser {
case "3208":
case "3209":
weight = value;
- weightType = ExpandedProductParsedResult.POUND;
+ weightType = ExpandedProductParsedRXingResult.POUND;
weightIncrement = ai.substring(3);
break;
case "3920":
@@ -141,7 +141,7 @@ public final class ExpandedProductResultParser extends ResultParser {
if (value.length() < 4) {
// The value must have more of 3 symbols (3 for currency and
// 1 at least for the price)
- // ExtendedProductParsedResult NOT created. Not match with RSS Expanded pattern
+ // ExtendedProductParsedRXingResult NOT created. Not match with RSS Expanded pattern
return null;
}
price = value.substring(3);
@@ -155,7 +155,7 @@ public final class ExpandedProductResultParser extends ResultParser {
}
}
- return new ExpandedProductParsedResult(rawText,
+ return new ExpandedProductParsedRXingResult(rawText,
productID,
sscc,
lotNumber,
diff --git a/src/client/result/GeoParsedResult.java b/src/client/result/GeoParsedResult.java
index 3a2cae6..ccbee6d 100644
--- a/src/client/result/GeoParsedResult.java
+++ b/src/client/result/GeoParsedResult.java
@@ -22,15 +22,15 @@ package com.google.zxing.client.result;
*
* @author Sean Owen
*/
-public final class GeoParsedResult extends ParsedResult {
+public final class GeoParsedRXingResult extends ParsedRXingResult {
private final double latitude;
private final double longitude;
private final double altitude;
private final String query;
- GeoParsedResult(double latitude, double longitude, double altitude, String query) {
- super(ParsedResultType.GEO);
+ GeoParsedRXingResult(double latitude, double longitude, double altitude, String query) {
+ super(ParsedRXingResultType.GEO);
this.latitude = latitude;
this.longitude = longitude;
this.altitude = altitude;
@@ -83,7 +83,7 @@ public final class GeoParsedResult extends ParsedResult {
}
@Override
- public String getDisplayResult() {
+ public String getDisplayRXingResult() {
StringBuilder result = new StringBuilder(20);
result.append(latitude);
result.append(", ");
diff --git a/src/client/result/GeoResultParser.java b/src/client/result/GeoResultParser.java
index fb9cb07..4901d1e 100644
--- a/src/client/result/GeoResultParser.java
+++ b/src/client/result/GeoResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -29,13 +29,13 @@ import java.util.regex.Pattern;
*
* @author Sean Owen
*/
-public final class GeoResultParser extends ResultParser {
+public final class GeoRXingResultParser extends RXingResultParser {
private static final Pattern GEO_URL_PATTERN =
Pattern.compile("geo:([\\-0-9.]+),([\\-0-9.]+)(?:,([\\-0-9.]+))?(?:\\?(.*))?", Pattern.CASE_INSENSITIVE);
@Override
- public GeoParsedResult parse(Result result) {
+ public GeoParsedRXingResult parse(RXingResult result) {
CharSequence rawText = getMassagedText(result);
Matcher matcher = GEO_URL_PATTERN.matcher(rawText);
if (!matcher.matches()) {
@@ -67,7 +67,7 @@ public final class GeoResultParser extends ResultParser {
} catch (NumberFormatException ignored) {
return null;
}
- return new GeoParsedResult(latitude, longitude, altitude, query);
+ return new GeoParsedRXingResult(latitude, longitude, altitude, query);
}
}
\ No newline at end of file
diff --git a/src/client/result/ISBNParsedResult.java b/src/client/result/ISBNParsedResult.java
index ebf11c5..293e0ea 100644
--- a/src/client/result/ISBNParsedResult.java
+++ b/src/client/result/ISBNParsedResult.java
@@ -21,12 +21,12 @@ package com.google.zxing.client.result;
*
* @author jbreiden@google.com (Jeff Breidenbach)
*/
-public final class ISBNParsedResult extends ParsedResult {
+public final class ISBNParsedRXingResult extends ParsedRXingResult {
private final String isbn;
- ISBNParsedResult(String isbn) {
- super(ParsedResultType.ISBN);
+ ISBNParsedRXingResult(String isbn) {
+ super(ParsedRXingResultType.ISBN);
this.isbn = isbn;
}
@@ -35,7 +35,7 @@ public final class ISBNParsedResult extends ParsedResult {
}
@Override
- public String getDisplayResult() {
+ public String getDisplayRXingResult() {
return isbn;
}
diff --git a/src/client/result/ISBNResultParser.java b/src/client/result/ISBNResultParser.java
index e957dd0..ce1b3da 100644
--- a/src/client/result/ISBNResultParser.java
+++ b/src/client/result/ISBNResultParser.java
@@ -17,20 +17,20 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
/**
* Parses strings of digits that represent a ISBN.
*
* @author jbreiden@google.com (Jeff Breidenbach)
*/
-public final class ISBNResultParser extends ResultParser {
+public final class ISBNRXingResultParser extends RXingResultParser {
/**
* See ISBN-13 For Dummies
*/
@Override
- public ISBNParsedResult parse(Result result) {
+ public ISBNParsedRXingResult parse(RXingResult result) {
BarcodeFormat format = result.getBarcodeFormat();
if (format != BarcodeFormat.EAN_13) {
return null;
@@ -44,7 +44,7 @@ public final class ISBNResultParser extends ResultParser {
return null;
}
- return new ISBNParsedResult(rawText);
+ return new ISBNParsedRXingResult(rawText);
}
}
diff --git a/src/client/result/ParsedResult.java b/src/client/result/ParsedResult.java
index 17660e2..6f56dfb 100644
--- a/src/client/result/ParsedResult.java
+++ b/src/client/result/ParsedResult.java
@@ -19,7 +19,7 @@ package com.google.zxing.client.result;
/**
* Abstract class representing the result of decoding a barcode, as more than
* a String -- as some type of structured data. This might be a subclass which represents
- * a URL, or an e-mail address. {@link ResultParser#parseResult(com.google.zxing.Result)} will turn a raw
+ * a URL, or an e-mail address. {@link RXingResultParser#parseRXingResult(com.google.zxing.RXingResult)} will turn a raw
* decoded string into the most appropriate type of structured representation.
*
* Thanks to Jeff Griffin for proposing rewrite of these classes that relies less
@@ -27,23 +27,23 @@ package com.google.zxing.client.result;
*
* @author Sean Owen
*/
-public abstract class ParsedResult {
+public abstract class ParsedRXingResult {
- private final ParsedResultType type;
+ private final ParsedRXingResultType type;
- protected ParsedResult(ParsedResultType type) {
+ protected ParsedRXingResult(ParsedRXingResultType type) {
this.type = type;
}
- public final ParsedResultType getType() {
+ public final ParsedRXingResultType getType() {
return type;
}
- public abstract String getDisplayResult();
+ public abstract String getDisplayRXingResult();
@Override
public final String toString() {
- return getDisplayResult();
+ return getDisplayRXingResult();
}
public static void maybeAppend(String value, StringBuilder result) {
diff --git a/src/client/result/ParsedResultType.java b/src/client/result/ParsedResultType.java
index c74d545..7fba320 100644
--- a/src/client/result/ParsedResultType.java
+++ b/src/client/result/ParsedResultType.java
@@ -22,7 +22,7 @@ package com.google.zxing.client.result;
*
* @author Sean Owen
*/
-public enum ParsedResultType {
+public enum ParsedRXingResultType {
ADDRESSBOOK,
EMAIL_ADDRESS,
diff --git a/src/client/result/ProductParsedResult.java b/src/client/result/ProductParsedResult.java
index 66a5c9b..cf6293e 100644
--- a/src/client/result/ProductParsedResult.java
+++ b/src/client/result/ProductParsedResult.java
@@ -21,17 +21,17 @@ package com.google.zxing.client.result;
*
* @author dswitkin@google.com (Daniel Switkin)
*/
-public final class ProductParsedResult extends ParsedResult {
+public final class ProductParsedRXingResult extends ParsedRXingResult {
private final String productID;
private final String normalizedProductID;
- ProductParsedResult(String productID) {
+ ProductParsedRXingResult(String productID) {
this(productID, productID);
}
- ProductParsedResult(String productID, String normalizedProductID) {
- super(ParsedResultType.PRODUCT);
+ ProductParsedRXingResult(String productID, String normalizedProductID) {
+ super(ParsedRXingResultType.PRODUCT);
this.productID = productID;
this.normalizedProductID = normalizedProductID;
}
@@ -45,7 +45,7 @@ public final class ProductParsedResult extends ParsedResult {
}
@Override
- public String getDisplayResult() {
+ public String getDisplayRXingResult() {
return productID;
}
diff --git a/src/client/result/ProductResultParser.java b/src/client/result/ProductResultParser.java
index bed1a7d..947079b 100644
--- a/src/client/result/ProductResultParser.java
+++ b/src/client/result/ProductResultParser.java
@@ -17,7 +17,7 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import com.google.zxing.oned.UPCEReader;
/**
@@ -25,11 +25,11 @@ import com.google.zxing.oned.UPCEReader;
*
* @author dswitkin@google.com (Daniel Switkin)
*/
-public final class ProductResultParser extends ResultParser {
+public final class ProductRXingResultParser extends RXingResultParser {
// Treat all UPC and EAN variants as UPCs, in the sense that they are all product barcodes.
@Override
- public ProductParsedResult parse(Result result) {
+ public ProductParsedRXingResult parse(RXingResult result) {
BarcodeFormat format = result.getBarcodeFormat();
if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E ||
format == BarcodeFormat.EAN_8 || format == BarcodeFormat.EAN_13)) {
@@ -49,7 +49,7 @@ public final class ProductResultParser extends ResultParser {
normalizedProductID = rawText;
}
- return new ProductParsedResult(rawText, normalizedProductID);
+ return new ProductParsedRXingResult(rawText, normalizedProductID);
}
}
\ No newline at end of file
diff --git a/src/client/result/ResultParser.java b/src/client/result/ResultParser.java
index ecf3c20..d755d0c 100644
--- a/src/client/result/ResultParser.java
+++ b/src/client/result/ResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
@@ -29,7 +29,7 @@ import java.util.regex.Pattern;
/**
*
Abstract class representing the result of decoding a barcode, as more than
* a String -- as some type of structured data. This might be a subclass which represents
- * a URL, or an e-mail address. {@link #parseResult(Result)} will turn a raw
+ * a URL, or an e-mail address. {@link #parseRXingResult(RXingResult)} will turn a raw
* decoded string into the most appropriate type of structured representation.
*
* Thanks to Jeff Griffin for proposing rewrite of these classes that relies less
@@ -37,29 +37,29 @@ import java.util.regex.Pattern;
*
* @author Sean Owen
*/
-public abstract class ResultParser {
+public abstract class RXingResultParser {
- private static final ResultParser[] PARSERS = {
- new BookmarkDoCoMoResultParser(),
- new AddressBookDoCoMoResultParser(),
- new EmailDoCoMoResultParser(),
- new AddressBookAUResultParser(),
- new VCardResultParser(),
- new BizcardResultParser(),
- new VEventResultParser(),
- new EmailAddressResultParser(),
- new SMTPResultParser(),
- new TelResultParser(),
- new SMSMMSResultParser(),
- new SMSTOMMSTOResultParser(),
- new GeoResultParser(),
- new WifiResultParser(),
- new URLTOResultParser(),
- new URIResultParser(),
- new ISBNResultParser(),
- new ProductResultParser(),
- new ExpandedProductResultParser(),
- new VINResultParser(),
+ private static final RXingResultParser[] PARSERS = {
+ new BookmarkDoCoMoRXingResultParser(),
+ new AddressBookDoCoMoRXingResultParser(),
+ new EmailDoCoMoRXingResultParser(),
+ new AddressBookAURXingResultParser(),
+ new VCardRXingResultParser(),
+ new BizcardRXingResultParser(),
+ new VEventRXingResultParser(),
+ new EmailAddressRXingResultParser(),
+ new SMTPRXingResultParser(),
+ new TelRXingResultParser(),
+ new SMSMMSRXingResultParser(),
+ new SMSTOMMSTORXingResultParser(),
+ new GeoRXingResultParser(),
+ new WifiRXingResultParser(),
+ new URLTORXingResultParser(),
+ new URIRXingResultParser(),
+ new ISBNRXingResultParser(),
+ new ProductRXingResultParser(),
+ new ExpandedProductRXingResultParser(),
+ new VINRXingResultParser(),
};
private static final Pattern DIGITS = Pattern.compile("\\d+");
@@ -70,16 +70,16 @@ public abstract class ResultParser {
static final String[] EMPTY_STR_ARRAY = new String[0];
/**
- * Attempts to parse the raw {@link Result}'s contents as a particular type
- * of information (email, URL, etc.) and return a {@link ParsedResult} encapsulating
+ * Attempts to parse the raw {@link RXingResult}'s contents as a particular type
+ * of information (email, URL, etc.) and return a {@link ParsedRXingResult} encapsulating
* the result of parsing.
*
- * @param theResult the raw {@link Result} to parse
- * @return {@link ParsedResult} encapsulating the parsing result
+ * @param theRXingResult the raw {@link RXingResult} to parse
+ * @return {@link ParsedRXingResult} encapsulating the parsing result
*/
- public abstract ParsedResult parse(Result theResult);
+ public abstract ParsedRXingResult parse(RXingResult theRXingResult);
- protected static String getMassagedText(Result result) {
+ protected static String getMassagedText(RXingResult result) {
String text = result.getText();
if (text.startsWith(BYTE_ORDER_MARK)) {
text = text.substring(1);
@@ -87,14 +87,14 @@ public abstract class ResultParser {
return text;
}
- public static ParsedResult parseResult(Result theResult) {
- for (ResultParser parser : PARSERS) {
- ParsedResult result = parser.parse(theResult);
+ public static ParsedRXingResult parseRXingResult(RXingResult theRXingResult) {
+ for (RXingResultParser parser : PARSERS) {
+ ParsedRXingResult result = parser.parse(theRXingResult);
if (result != null) {
return result;
}
}
- return new TextParsedResult(theResult.getText(), null);
+ return new TextParsedRXingResult(theRXingResult.getText(), null);
}
protected static void maybeAppend(String value, StringBuilder result) {
diff --git a/src/client/result/SMSMMSResultParser.java b/src/client/result/SMSMMSResultParser.java
index 2d0840b..414b789 100644
--- a/src/client/result/SMSMMSResultParser.java
+++ b/src/client/result/SMSMMSResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import java.util.ArrayList;
import java.util.Collection;
@@ -38,10 +38,10 @@ import java.util.Map;
*
* @author Sean Owen
*/
-public final class SMSMMSResultParser extends ResultParser {
+public final class SMSMMSRXingResultParser extends RXingResultParser {
@Override
- public SMSParsedResult parse(Result result) {
+ public SMSParsedRXingResult parse(RXingResult result) {
String rawText = getMassagedText(result);
if (!(rawText.startsWith("sms:") || rawText.startsWith("SMS:") ||
rawText.startsWith("mms:") || rawText.startsWith("MMS:"))) {
@@ -80,7 +80,7 @@ public final class SMSMMSResultParser extends ResultParser {
}
addNumberVia(numbers, vias, smsURIWithoutQuery.substring(lastComma + 1));
- return new SMSParsedResult(numbers.toArray(EMPTY_STR_ARRAY),
+ return new SMSParsedRXingResult(numbers.toArray(EMPTY_STR_ARRAY),
vias.toArray(EMPTY_STR_ARRAY),
subject,
body);
diff --git a/src/client/result/SMSParsedResult.java b/src/client/result/SMSParsedResult.java
index 176078e..0cc51ef 100644
--- a/src/client/result/SMSParsedResult.java
+++ b/src/client/result/SMSParsedResult.java
@@ -22,29 +22,29 @@ package com.google.zxing.client.result;
*
* @author Sean Owen
*/
-public final class SMSParsedResult extends ParsedResult {
+public final class SMSParsedRXingResult extends ParsedRXingResult {
private final String[] numbers;
private final String[] vias;
private final String subject;
private final String body;
- public SMSParsedResult(String number,
+ public SMSParsedRXingResult(String number,
String via,
String subject,
String body) {
- super(ParsedResultType.SMS);
+ super(ParsedRXingResultType.SMS);
this.numbers = new String[] {number};
this.vias = new String[] {via};
this.subject = subject;
this.body = body;
}
- public SMSParsedResult(String[] numbers,
+ public SMSParsedRXingResult(String[] numbers,
String[] vias,
String subject,
String body) {
- super(ParsedResultType.SMS);
+ super(ParsedRXingResultType.SMS);
this.numbers = numbers;
this.vias = vias;
this.subject = subject;
@@ -103,7 +103,7 @@ public final class SMSParsedResult extends ParsedResult {
}
@Override
- public String getDisplayResult() {
+ public String getDisplayRXingResult() {
StringBuilder result = new StringBuilder(100);
maybeAppend(numbers, result);
maybeAppend(subject, result);
diff --git a/src/client/result/SMSTOMMSTOResultParser.java b/src/client/result/SMSTOMMSTOResultParser.java
index 0760565..77d97bc 100644
--- a/src/client/result/SMSTOMMSTOResultParser.java
+++ b/src/client/result/SMSTOMMSTOResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
/**
*
Parses an "smsto:" URI result, whose format is not standardized but appears to be like:
@@ -28,10 +28,10 @@ import com.google.zxing.Result;
*
* @author Sean Owen
*/
-public final class SMSTOMMSTOResultParser extends ResultParser {
+public final class SMSTOMMSTORXingResultParser extends RXingResultParser {
@Override
- public SMSParsedResult parse(Result result) {
+ public SMSParsedRXingResult parse(RXingResult result) {
String rawText = getMassagedText(result);
if (!(rawText.startsWith("smsto:") || rawText.startsWith("SMSTO:") ||
rawText.startsWith("mmsto:") || rawText.startsWith("MMSTO:"))) {
@@ -46,7 +46,7 @@ public final class SMSTOMMSTOResultParser extends ResultParser {
body = number.substring(bodyStart + 1);
number = number.substring(0, bodyStart);
}
- return new SMSParsedResult(number, null, null, body);
+ return new SMSParsedRXingResult(number, null, null, body);
}
}
\ No newline at end of file
diff --git a/src/client/result/SMTPResultParser.java b/src/client/result/SMTPResultParser.java
index 3279ceb..7f83a95 100644
--- a/src/client/result/SMTPResultParser.java
+++ b/src/client/result/SMTPResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
/**
*
Parses an "smtp:" URI result, whose format is not standardized but appears to be like:
@@ -24,10 +24,10 @@ import com.google.zxing.Result;
*
* @author Sean Owen
*/
-public final class SMTPResultParser extends ResultParser {
+public final class SMTPRXingResultParser extends RXingResultParser {
@Override
- public EmailAddressParsedResult parse(Result result) {
+ public EmailAddressParsedRXingResult parse(RXingResult result) {
String rawText = getMassagedText(result);
if (!(rawText.startsWith("smtp:") || rawText.startsWith("SMTP:"))) {
return null;
@@ -45,7 +45,7 @@ public final class SMTPResultParser extends ResultParser {
subject = subject.substring(0, colon);
}
}
- return new EmailAddressParsedResult(new String[] {emailAddress},
+ return new EmailAddressParsedRXingResult(new String[] {emailAddress},
null,
null,
subject,
diff --git a/src/client/result/TelParsedResult.java b/src/client/result/TelParsedResult.java
index fb606f2..d5f2ac8 100644
--- a/src/client/result/TelParsedResult.java
+++ b/src/client/result/TelParsedResult.java
@@ -21,14 +21,14 @@ package com.google.zxing.client.result;
*
* @author Sean Owen
*/
-public final class TelParsedResult extends ParsedResult {
+public final class TelParsedRXingResult extends ParsedRXingResult {
private final String number;
private final String telURI;
private final String title;
- public TelParsedResult(String number, String telURI, String title) {
- super(ParsedResultType.TEL);
+ public TelParsedRXingResult(String number, String telURI, String title) {
+ super(ParsedRXingResultType.TEL);
this.number = number;
this.telURI = telURI;
this.title = title;
@@ -47,7 +47,7 @@ public final class TelParsedResult extends ParsedResult {
}
@Override
- public String getDisplayResult() {
+ public String getDisplayRXingResult() {
StringBuilder result = new StringBuilder(20);
maybeAppend(number, result);
maybeAppend(title, result);
diff --git a/src/client/result/TelResultParser.java b/src/client/result/TelResultParser.java
index e4bca1f..ab83723 100644
--- a/src/client/result/TelResultParser.java
+++ b/src/client/result/TelResultParser.java
@@ -16,17 +16,17 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
/**
* Parses a "tel:" URI result, which specifies a phone number.
*
* @author Sean Owen
*/
-public final class TelResultParser extends ResultParser {
+public final class TelRXingResultParser extends RXingResultParser {
@Override
- public TelParsedResult parse(Result result) {
+ public TelParsedRXingResult parse(RXingResult result) {
String rawText = getMassagedText(result);
if (!rawText.startsWith("tel:") && !rawText.startsWith("TEL:")) {
return null;
@@ -36,7 +36,7 @@ public final class TelResultParser extends ResultParser {
// Drop tel, query portion
int queryStart = rawText.indexOf('?', 4);
String number = queryStart < 0 ? rawText.substring(4) : rawText.substring(4, queryStart);
- return new TelParsedResult(number, telURI, null);
+ return new TelParsedRXingResult(number, telURI, null);
}
}
\ No newline at end of file
diff --git a/src/client/result/TextParsedResult.java b/src/client/result/TextParsedResult.java
index 9cc408e..5b1e214 100644
--- a/src/client/result/TextParsedResult.java
+++ b/src/client/result/TextParsedResult.java
@@ -22,13 +22,13 @@ package com.google.zxing.client.result;
*
* @author Sean Owen
*/
-public final class TextParsedResult extends ParsedResult {
+public final class TextParsedRXingResult extends ParsedRXingResult {
private final String text;
private final String language;
- public TextParsedResult(String text, String language) {
- super(ParsedResultType.TEXT);
+ public TextParsedRXingResult(String text, String language) {
+ super(ParsedRXingResultType.TEXT);
this.text = text;
this.language = language;
}
@@ -42,7 +42,7 @@ public final class TextParsedResult extends ParsedResult {
}
@Override
- public String getDisplayResult() {
+ public String getDisplayRXingResult() {
return text;
}
diff --git a/src/client/result/URIParsedResult.java b/src/client/result/URIParsedResult.java
index 7601e79..bf1f0d4 100644
--- a/src/client/result/URIParsedResult.java
+++ b/src/client/result/URIParsedResult.java
@@ -21,13 +21,13 @@ package com.google.zxing.client.result;
*
* @author Sean Owen
*/
-public final class URIParsedResult extends ParsedResult {
+public final class URIParsedRXingResult extends ParsedRXingResult {
private final String uri;
private final String title;
- public URIParsedResult(String uri, String title) {
- super(ParsedResultType.URI);
+ public URIParsedRXingResult(String uri, String title) {
+ super(ParsedRXingResultType.URI);
this.uri = massageURI(uri);
this.title = title;
}
@@ -43,15 +43,15 @@ public final class URIParsedResult extends ParsedResult {
/**
* @return true if the URI contains suspicious patterns that may suggest it intends to
* mislead the user about its true nature
- * @deprecated see {@link URIResultParser#isPossiblyMaliciousURI(String)}
+ * @deprecated see {@link URIRXingResultParser#isPossiblyMaliciousURI(String)}
*/
@Deprecated
public boolean isPossiblyMaliciousURI() {
- return URIResultParser.isPossiblyMaliciousURI(uri);
+ return URIRXingResultParser.isPossiblyMaliciousURI(uri);
}
@Override
- public String getDisplayResult() {
+ public String getDisplayRXingResult() {
StringBuilder result = new StringBuilder(30);
maybeAppend(title, result);
maybeAppend(uri, result);
@@ -79,7 +79,7 @@ public final class URIParsedResult extends ParsedResult {
if (nextSlash < 0) {
nextSlash = uri.length();
}
- return ResultParser.isSubstringOfDigits(uri, start, nextSlash - start);
+ return RXingResultParser.isSubstringOfDigits(uri, start, nextSlash - start);
}
diff --git a/src/client/result/URIResultParser.java b/src/client/result/URIResultParser.java
index 21adc34..2527f01 100644
--- a/src/client/result/URIResultParser.java
+++ b/src/client/result/URIResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -26,7 +26,7 @@ import java.util.regex.Pattern;
*
* @author Sean Owen
*/
-public final class URIResultParser extends ResultParser {
+public final class URIRXingResultParser extends RXingResultParser {
private static final Pattern ALLOWED_URI_CHARS_PATTERN =
Pattern.compile("[-._~:/?#\\[\\]@!$&'()*+,;=%A-Za-z0-9]+");
@@ -39,18 +39,18 @@ public final class URIResultParser extends ResultParser {
"(/|\\?|$)"); // query, path or nothing
@Override
- public URIParsedResult parse(Result result) {
+ public URIParsedRXingResult parse(RXingResult result) {
String rawText = getMassagedText(result);
// We specifically handle the odd "URL" scheme here for simplicity and add "URI" for fun
// Assume anything starting this way really means to be a URI
if (rawText.startsWith("URL:") || rawText.startsWith("URI:")) {
- return new URIParsedResult(rawText.substring(4).trim(), null);
+ return new URIParsedRXingResult(rawText.substring(4).trim(), null);
}
rawText = rawText.trim();
if (!isBasicallyValidURI(rawText) || isPossiblyMaliciousURI(rawText)) {
return null;
}
- return new URIParsedResult(rawText, null);
+ return new URIParsedRXingResult(rawText, null);
}
/**
diff --git a/src/client/result/URLTOResultParser.java b/src/client/result/URLTOResultParser.java
index fd25900..1177b6b 100644
--- a/src/client/result/URLTOResultParser.java
+++ b/src/client/result/URLTOResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
/**
* Parses the "URLTO" result format, which is of the form "URLTO:[title]:[url]".
@@ -25,10 +25,10 @@ import com.google.zxing.Result;
*
* @author Sean Owen
*/
-public final class URLTOResultParser extends ResultParser {
+public final class URLTORXingResultParser extends RXingResultParser {
@Override
- public URIParsedResult parse(Result result) {
+ public URIParsedRXingResult parse(RXingResult result) {
String rawText = getMassagedText(result);
if (!rawText.startsWith("urlto:") && !rawText.startsWith("URLTO:")) {
return null;
@@ -39,7 +39,7 @@ public final class URLTOResultParser extends ResultParser {
}
String title = titleEnd <= 6 ? null : rawText.substring(6, titleEnd);
String uri = rawText.substring(titleEnd + 1);
- return new URIParsedResult(uri, title);
+ return new URIParsedRXingResult(uri, title);
}
}
\ No newline at end of file
diff --git a/src/client/result/VCardResultParser.java b/src/client/result/VCardResultParser.java
index 5155c6f..8a185bb 100644
--- a/src/client/result/VCardResultParser.java
+++ b/src/client/result/VCardResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
@@ -34,7 +34,7 @@ import java.util.regex.Pattern;
*
* @author Sean Owen
*/
-public final class VCardResultParser extends ResultParser {
+public final class VCardRXingResultParser extends RXingResultParser {
private static final Pattern BEGIN_VCARD = Pattern.compile("BEGIN:VCARD", Pattern.CASE_INSENSITIVE);
private static final Pattern VCARD_LIKE_DATE = Pattern.compile("\\d{4}-?\\d{2}-?\\d{2}");
@@ -48,7 +48,7 @@ public final class VCardResultParser extends ResultParser {
private static final Pattern SEMICOLON_OR_COMMA = Pattern.compile("[;,]");
@Override
- public AddressBookParsedResult parse(Result result) {
+ public AddressBookParsedRXingResult parse(RXingResult result) {
// Although we should insist on the raw text ending with "END:VCARD", there's no reason
// to throw out everything else we parsed just because this was omitted. In fact, Eclair
// is doing just that, and we can't parse its contacts without this leniency.
@@ -82,7 +82,7 @@ public final class VCardResultParser extends ResultParser {
if (geo != null && geo.length != 2) {
geo = null;
}
- return new AddressBookParsedResult(toPrimaryValues(names),
+ return new AddressBookParsedRXingResult(toPrimaryValues(names),
nicknames,
null,
toPrimaryValues(phoneNumbers),
diff --git a/src/client/result/VEventResultParser.java b/src/client/result/VEventResultParser.java
index 36ef588..8bd2682 100644
--- a/src/client/result/VEventResultParser.java
+++ b/src/client/result/VEventResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import java.util.List;
@@ -26,10 +26,10 @@ import java.util.List;
*
* @author Sean Owen
*/
-public final class VEventResultParser extends ResultParser {
+public final class VEventRXingResultParser extends RXingResultParser {
@Override
- public CalendarParsedResult parse(Result result) {
+ public CalendarParsedRXingResult parse(RXingResult result) {
String rawText = getMassagedText(result);
int vEventStart = rawText.indexOf("BEGIN:VEVENT");
if (vEventStart < 0) {
@@ -74,7 +74,7 @@ public final class VEventResultParser extends ResultParser {
}
try {
- return new CalendarParsedResult(summary,
+ return new CalendarParsedRXingResult(summary,
start,
end,
duration,
@@ -91,12 +91,12 @@ public final class VEventResultParser extends ResultParser {
private static String matchSingleVCardPrefixedField(CharSequence prefix,
String rawText) {
- List values = VCardResultParser.matchSingleVCardPrefixedField(prefix, rawText, true, false);
+ List values = VCardRXingResultParser.matchSingleVCardPrefixedField(prefix, rawText, true, false);
return values == null || values.isEmpty() ? null : values.get(0);
}
private static String[] matchVCardPrefixedField(CharSequence prefix, String rawText) {
- List> values = VCardResultParser.matchVCardPrefixedField(prefix, rawText, true, false);
+ List> values = VCardRXingResultParser.matchVCardPrefixedField(prefix, rawText, true, false);
if (values == null || values.isEmpty()) {
return null;
}
diff --git a/src/client/result/VINParsedResult.java b/src/client/result/VINParsedResult.java
index 79f722d..56392ae 100644
--- a/src/client/result/VINParsedResult.java
+++ b/src/client/result/VINParsedResult.java
@@ -20,7 +20,7 @@ package com.google.zxing.client.result;
/**
* Represents a parsed result that encodes a Vehicle Identification Number (VIN).
*/
-public final class VINParsedResult extends ParsedResult {
+public final class VINParsedRXingResult extends ParsedRXingResult {
private final String vin;
private final String worldManufacturerID;
@@ -32,7 +32,7 @@ public final class VINParsedResult extends ParsedResult {
private final char plantCode;
private final String sequentialNumber;
- public VINParsedResult(String vin,
+ public VINParsedRXingResult(String vin,
String worldManufacturerID,
String vehicleDescriptorSection,
String vehicleIdentifierSection,
@@ -41,7 +41,7 @@ public final class VINParsedResult extends ParsedResult {
int modelYear,
char plantCode,
String sequentialNumber) {
- super(ParsedResultType.VIN);
+ super(ParsedRXingResultType.VIN);
this.vin = vin;
this.worldManufacturerID = worldManufacturerID;
this.vehicleDescriptorSection = vehicleDescriptorSection;
@@ -90,7 +90,7 @@ public final class VINParsedResult extends ParsedResult {
}
@Override
- public String getDisplayResult() {
+ public String getDisplayRXingResult() {
StringBuilder result = new StringBuilder(50);
result.append(worldManufacturerID).append(' ');
result.append(vehicleDescriptorSection).append(' ');
diff --git a/src/client/result/VINResultParser.java b/src/client/result/VINResultParser.java
index 0d1314c..77aaf2b 100644
--- a/src/client/result/VINResultParser.java
+++ b/src/client/result/VINResultParser.java
@@ -17,7 +17,7 @@
package com.google.zxing.client.result;
import com.google.zxing.BarcodeFormat;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import java.util.regex.Pattern;
@@ -26,13 +26,13 @@ import java.util.regex.Pattern;
*
* @author Sean Owen
*/
-public final class VINResultParser extends ResultParser {
+public final class VINRXingResultParser extends RXingResultParser {
private static final Pattern IOQ = Pattern.compile("[IOQ]");
private static final Pattern AZ09 = Pattern.compile("[A-Z0-9]{17}");
@Override
- public VINParsedResult parse(Result result) {
+ public VINParsedRXingResult parse(RXingResult result) {
if (result.getBarcodeFormat() != BarcodeFormat.CODE_39) {
return null;
}
@@ -46,7 +46,7 @@ public final class VINResultParser extends ResultParser {
return null;
}
String wmi = rawText.substring(0, 3);
- return new VINParsedResult(rawText,
+ return new VINParsedRXingResult(rawText,
wmi,
rawText.substring(3, 9),
rawText.substring(9, 17),
diff --git a/src/client/result/WifiParsedResult.java b/src/client/result/WifiParsedResult.java
index c88b6aa..4677fc0 100644
--- a/src/client/result/WifiParsedResult.java
+++ b/src/client/result/WifiParsedResult.java
@@ -21,7 +21,7 @@ package com.google.zxing.client.result;
*
* @author Vikram Aggarwal
*/
-public final class WifiParsedResult extends ParsedResult {
+public final class WifiParsedRXingResult extends ParsedRXingResult {
private final String ssid;
private final String networkEncryption;
@@ -32,15 +32,15 @@ public final class WifiParsedResult extends ParsedResult {
private final String eapMethod;
private final String phase2Method;
- public WifiParsedResult(String networkEncryption, String ssid, String password) {
+ public WifiParsedRXingResult(String networkEncryption, String ssid, String password) {
this(networkEncryption, ssid, password, false);
}
- public WifiParsedResult(String networkEncryption, String ssid, String password, boolean hidden) {
+ public WifiParsedRXingResult(String networkEncryption, String ssid, String password, boolean hidden) {
this(networkEncryption, ssid, password, hidden, null, null, null, null);
}
- public WifiParsedResult(String networkEncryption,
+ public WifiParsedRXingResult(String networkEncryption,
String ssid,
String password,
boolean hidden,
@@ -48,7 +48,7 @@ public final class WifiParsedResult extends ParsedResult {
String anonymousIdentity,
String eapMethod,
String phase2Method) {
- super(ParsedResultType.WIFI);
+ super(ParsedRXingResultType.WIFI);
this.ssid = ssid;
this.networkEncryption = networkEncryption;
this.password = password;
@@ -92,7 +92,7 @@ public final class WifiParsedResult extends ParsedResult {
}
@Override
- public String getDisplayResult() {
+ public String getDisplayRXingResult() {
StringBuilder result = new StringBuilder(80);
maybeAppend(ssid, result);
maybeAppend(networkEncryption, result);
diff --git a/src/client/result/WifiResultParser.java b/src/client/result/WifiResultParser.java
index a35f28d..89df370 100644
--- a/src/client/result/WifiResultParser.java
+++ b/src/client/result/WifiResultParser.java
@@ -16,7 +16,7 @@
package com.google.zxing.client.result;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
@SuppressWarnings("checkstyle:lineLength")
/**
@@ -36,10 +36,10 @@ import com.google.zxing.Result;
* @author Sean Owen
* @author Steffen Kieß
*/
-public final class WifiResultParser extends ResultParser {
+public final class WifiRXingResultParser extends RXingResultParser {
@Override
- public WifiParsedResult parse(Result result) {
+ public WifiParsedRXingResult parse(RXingResult result) {
String rawText = getMassagedText(result);
if (!rawText.startsWith("WIFI:")) {
return null;
@@ -74,6 +74,6 @@ public final class WifiResultParser extends ResultParser {
String anonymousIdentity = matchSinglePrefixedField("A:", rawText, ';', false);
String eapMethod = matchSinglePrefixedField("E:", rawText, ';', false);
- return new WifiParsedResult(type, ssid, pass, hidden, identity, anonymousIdentity, eapMethod, phase2Method);
+ return new WifiParsedRXingResult(type, ssid, pass, hidden, identity, anonymousIdentity, eapMethod, phase2Method);
}
}
diff --git a/src/common/DecoderResult.java b/src/common/DecoderResult.java
index db2e7e0..8dcd2bd 100644
--- a/src/common/DecoderResult.java
+++ b/src/common/DecoderResult.java
@@ -25,7 +25,7 @@ import java.util.List;
*
* @author Sean Owen
*/
-public final class DecoderResult {
+public final class DecoderRXingResult {
private final byte[] rawBytes;
private int numBits;
@@ -39,14 +39,14 @@ public final class DecoderResult {
private final int structuredAppendSequenceNumber;
private final int symbologyModifier;
- public DecoderResult(byte[] rawBytes,
+ public DecoderRXingResult(byte[] rawBytes,
String text,
List byteSegments,
String ecLevel) {
this(rawBytes, text, byteSegments, ecLevel, -1, -1, 0);
}
- public DecoderResult(byte[] rawBytes,
+ public DecoderRXingResult(byte[] rawBytes,
String text,
List byteSegments,
String ecLevel,
@@ -54,7 +54,7 @@ public final class DecoderResult {
this(rawBytes, text, byteSegments, ecLevel, -1, -1, symbologyModifier);
}
- public DecoderResult(byte[] rawBytes,
+ public DecoderRXingResult(byte[] rawBytes,
String text,
List byteSegments,
String ecLevel,
@@ -63,7 +63,7 @@ public final class DecoderResult {
this(rawBytes, text, byteSegments, ecLevel, saSequence, saParity, 0);
}
- public DecoderResult(byte[] rawBytes,
+ public DecoderRXingResult(byte[] rawBytes,
String text,
List byteSegments,
String ecLevel,
diff --git a/src/common/DetectorResult.java b/src/common/DetectorResult.java
index 0f3cf15..005ae38 100644
--- a/src/common/DetectorResult.java
+++ b/src/common/DetectorResult.java
@@ -16,7 +16,7 @@
package com.google.zxing.common;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResultPoint;
/**
* Encapsulates the result of detecting a barcode in an image. This includes the raw
@@ -25,12 +25,12 @@ import com.google.zxing.ResultPoint;
*
* @author Sean Owen
*/
-public class DetectorResult {
+public class DetectorRXingResult {
private final BitMatrix bits;
- private final ResultPoint[] points;
+ private final RXingResultPoint[] points;
- public DetectorResult(BitMatrix bits, ResultPoint[] points) {
+ public DetectorRXingResult(BitMatrix bits, RXingResultPoint[] points) {
this.bits = bits;
this.points = points;
}
@@ -39,7 +39,7 @@ public class DetectorResult {
return bits;
}
- public final ResultPoint[] getPoints() {
+ public final RXingResultPoint[] getPoints() {
return points;
}
diff --git a/src/common/detector/MonochromeRectangleDetector.rs b/src/common/detector/MonochromeRectangleDetector.rs
index e3503ee..7a0eec9 100644
--- a/src/common/detector/MonochromeRectangleDetector.rs
+++ b/src/common/detector/MonochromeRectangleDetector.rs
@@ -15,7 +15,7 @@
*/
//package com.google.zxing.common.detector;
-use crate::{NotFoundException,ResultPoint};
+use crate::{NotFoundException,RXingResultPoint};
use crate::common::BitMatrix;
@@ -42,13 +42,13 @@ public final class MonochromeRectangleDetector {
*
Detects a rectangular region of black and white -- mostly black -- with a region of mostly
* white, in an image.
*
- * @return {@link ResultPoint}[] describing the corners of the rectangular region. The first and
+ * @return {@link RXingResultPoint}[] describing the corners of the rectangular region. The first and
* last points are opposed on the diagonal, as are the second and third. The first point will be
* the topmost point and the last, the bottommost. The second point will be leftmost and the
* third, the rightmost
* @throws NotFoundException if no Data Matrix Code can be found
*/
- public ResultPoint[] detect() throws NotFoundException {
+ public RXingResultPoint[] detect() throws NotFoundException {
int height = image.getHeight();
int width = image.getWidth();
int halfHeight = height / 2;
@@ -60,16 +60,16 @@ public final class MonochromeRectangleDetector {
int bottom = height;
int left = 0;
int right = width;
- ResultPoint pointA = findCornerFromCenter(halfWidth, 0, left, right,
+ RXingResultPoint pointA = findCornerFromCenter(halfWidth, 0, left, right,
halfHeight, -deltaY, top, bottom, halfWidth / 2);
top = (int) pointA.getY() - 1;
- ResultPoint pointB = findCornerFromCenter(halfWidth, -deltaX, left, right,
+ RXingResultPoint pointB = findCornerFromCenter(halfWidth, -deltaX, left, right,
halfHeight, 0, top, bottom, halfHeight / 2);
left = (int) pointB.getX() - 1;
- ResultPoint pointC = findCornerFromCenter(halfWidth, deltaX, left, right,
+ RXingResultPoint pointC = findCornerFromCenter(halfWidth, deltaX, left, right,
halfHeight, 0, top, bottom, halfHeight / 2);
right = (int) pointC.getX() + 1;
- ResultPoint pointD = findCornerFromCenter(halfWidth, 0, left, right,
+ RXingResultPoint pointD = findCornerFromCenter(halfWidth, 0, left, right,
halfHeight, deltaY, top, bottom, halfWidth / 2);
bottom = (int) pointD.getY() + 1;
@@ -77,7 +77,7 @@ public final class MonochromeRectangleDetector {
pointA = findCornerFromCenter(halfWidth, 0, left, right,
halfHeight, -deltaY, top, bottom, halfWidth / 4);
- return new ResultPoint[] { pointA, pointB, pointC, pointD };
+ return new RXingResultPoint[] { pointA, pointB, pointC, pointD };
}
/**
@@ -95,10 +95,10 @@ public final class MonochromeRectangleDetector {
* @param bottom maximum value of y
* @param maxWhiteRun maximum run of white pixels that can still be considered to be within
* the barcode
- * @return a {@link ResultPoint} encapsulating the corner that was found
+ * @return a {@link RXingResultPoint} encapsulating the corner that was found
* @throws NotFoundException if such a point cannot be found
*/
- private ResultPoint findCornerFromCenter(int centerX,
+ private RXingResultPoint findCornerFromCenter(int centerX,
int deltaX,
int left,
int right,
@@ -129,21 +129,21 @@ public final class MonochromeRectangleDetector {
if (lastRange[0] < centerX) {
if (lastRange[1] > centerX) {
// straddle, choose one or the other based on direction
- return new ResultPoint(lastRange[deltaY > 0 ? 0 : 1], lastY);
+ return new RXingResultPoint(lastRange[deltaY > 0 ? 0 : 1], lastY);
}
- return new ResultPoint(lastRange[0], lastY);
+ return new RXingResultPoint(lastRange[0], lastY);
} else {
- return new ResultPoint(lastRange[1], lastY);
+ return new RXingResultPoint(lastRange[1], lastY);
}
} else {
int lastX = x - deltaX;
if (lastRange[0] < centerY) {
if (lastRange[1] > centerY) {
- return new ResultPoint(lastX, lastRange[deltaX < 0 ? 0 : 1]);
+ return new RXingResultPoint(lastX, lastRange[deltaX < 0 ? 0 : 1]);
}
- return new ResultPoint(lastX, lastRange[0]);
+ return new RXingResultPoint(lastX, lastRange[0]);
} else {
- return new ResultPoint(lastX, lastRange[1]);
+ return new RXingResultPoint(lastX, lastRange[1]);
}
}
}
diff --git a/src/common/detector/WhiteRectangleDetector.java b/src/common/detector/WhiteRectangleDetector.java
index 8d77b0d..eec9fe2 100644
--- a/src/common/detector/WhiteRectangleDetector.java
+++ b/src/common/detector/WhiteRectangleDetector.java
@@ -17,7 +17,7 @@
package com.google.zxing.common.detector;
import com.google.zxing.NotFoundException;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitMatrix;
/**
@@ -75,14 +75,14 @@ public final class WhiteRectangleDetector {
* region until it finds a white rectangular region.
*
*
- * @return {@link ResultPoint}[] describing the corners of the rectangular
+ * @return {@link RXingResultPoint}[] describing the corners of the rectangular
* region. The first and last points are opposed on the diagonal, as
* are the second and third. The first point will be the topmost
* point and the last, the bottommost. The second point will be
* leftmost and the third, the rightmost
* @throws NotFoundException if no Data Matrix Code can be found
*/
- public ResultPoint[] detect() throws NotFoundException {
+ public RXingResultPoint[] detect() throws NotFoundException {
int left = leftInit;
int right = rightInit;
@@ -186,7 +186,7 @@ public final class WhiteRectangleDetector {
int maxSize = right - left;
- ResultPoint z = null;
+ RXingResultPoint z = null;
for (int i = 1; z == null && i < maxSize; i++) {
z = getBlackPointOnSegment(left, down - i, left + i, down);
}
@@ -195,7 +195,7 @@ public final class WhiteRectangleDetector {
throw NotFoundException.getNotFoundInstance();
}
- ResultPoint t = null;
+ RXingResultPoint t = null;
//go down right
for (int i = 1; t == null && i < maxSize; i++) {
t = getBlackPointOnSegment(left, up + i, left + i, up);
@@ -205,7 +205,7 @@ public final class WhiteRectangleDetector {
throw NotFoundException.getNotFoundInstance();
}
- ResultPoint x = null;
+ RXingResultPoint x = null;
//go down left
for (int i = 1; x == null && i < maxSize; i++) {
x = getBlackPointOnSegment(right, up + i, right - i, up);
@@ -215,7 +215,7 @@ public final class WhiteRectangleDetector {
throw NotFoundException.getNotFoundInstance();
}
- ResultPoint y = null;
+ RXingResultPoint y = null;
//go up left
for (int i = 1; y == null && i < maxSize; i++) {
y = getBlackPointOnSegment(right, down - i, right - i, down);
@@ -232,7 +232,7 @@ public final class WhiteRectangleDetector {
}
}
- private ResultPoint getBlackPointOnSegment(float aX, float aY, float bX, float bY) {
+ private RXingResultPoint getBlackPointOnSegment(float aX, float aY, float bX, float bY) {
int dist = MathUtils.round(MathUtils.distance(aX, aY, bX, bY));
float xStep = (bX - aX) / dist;
float yStep = (bY - aY) / dist;
@@ -241,7 +241,7 @@ public final class WhiteRectangleDetector {
int x = MathUtils.round(aX + i * xStep);
int y = MathUtils.round(aY + i * yStep);
if (image.get(x, y)) {
- return new ResultPoint(x, y);
+ return new RXingResultPoint(x, y);
}
}
return null;
@@ -254,14 +254,14 @@ public final class WhiteRectangleDetector {
* @param z left most point
* @param x right most point
* @param t top most point
- * @return {@link ResultPoint}[] describing the corners of the rectangular
+ * @return {@link RXingResultPoint}[] describing the corners of the rectangular
* region. The first and last points are opposed on the diagonal, as
* are the second and third. The first point will be the topmost
* point and the last, the bottommost. The second point will be
* leftmost and the third, the rightmost
*/
- private ResultPoint[] centerEdges(ResultPoint y, ResultPoint z,
- ResultPoint x, ResultPoint t) {
+ private RXingResultPoint[] centerEdges(RXingResultPoint y, RXingResultPoint z,
+ RXingResultPoint x, RXingResultPoint t) {
//
// t t
@@ -280,17 +280,17 @@ public final class WhiteRectangleDetector {
float tj = t.getY();
if (yi < width / 2.0f) {
- return new ResultPoint[]{
- new ResultPoint(ti - CORR, tj + CORR),
- new ResultPoint(zi + CORR, zj + CORR),
- new ResultPoint(xi - CORR, xj - CORR),
- new ResultPoint(yi + CORR, yj - CORR)};
+ return new RXingResultPoint[]{
+ new RXingResultPoint(ti - CORR, tj + CORR),
+ new RXingResultPoint(zi + CORR, zj + CORR),
+ new RXingResultPoint(xi - CORR, xj - CORR),
+ new RXingResultPoint(yi + CORR, yj - CORR)};
} else {
- return new ResultPoint[]{
- new ResultPoint(ti + CORR, tj + CORR),
- new ResultPoint(zi + CORR, zj - CORR),
- new ResultPoint(xi - CORR, xj + CORR),
- new ResultPoint(yi - CORR, yj - CORR)};
+ return new RXingResultPoint[]{
+ new RXingResultPoint(ti + CORR, tj + CORR),
+ new RXingResultPoint(zi + CORR, zj - CORR),
+ new RXingResultPoint(xi - CORR, xj + CORR),
+ new RXingResultPoint(yi - CORR, yj - CORR)};
}
}
diff --git a/src/datamatrix/DataMatrixReader.java b/src/datamatrix/DataMatrixReader.java
index f596fd1..890cf9f 100644
--- a/src/datamatrix/DataMatrixReader.java
+++ b/src/datamatrix/DataMatrixReader.java
@@ -23,12 +23,12 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.Reader;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DecoderResult;
-import com.google.zxing.common.DetectorResult;
+import com.google.zxing.common.DecoderRXingResult;
+import com.google.zxing.common.DetectorRXingResult;
import com.google.zxing.datamatrix.decoder.Decoder;
import com.google.zxing.datamatrix.detector.Detector;
@@ -42,7 +42,7 @@ import java.util.Map;
*/
public final class DataMatrixReader implements Reader {
- private static final ResultPoint[] NO_POINTS = new ResultPoint[0];
+ private static final RXingResultPoint[] NO_POINTS = new RXingResultPoint[0];
private final Decoder decoder = new Decoder();
@@ -55,35 +55,35 @@ public final class DataMatrixReader implements Reader {
* @throws ChecksumException if error correction fails
*/
@Override
- public Result decode(BinaryBitmap image) throws NotFoundException, ChecksumException, FormatException {
+ public RXingResult decode(BinaryBitmap image) throws NotFoundException, ChecksumException, FormatException {
return decode(image, null);
}
@Override
- public Result decode(BinaryBitmap image, Map hints)
+ public RXingResult decode(BinaryBitmap image, Map hints)
throws NotFoundException, ChecksumException, FormatException {
- DecoderResult decoderResult;
- ResultPoint[] points;
+ DecoderRXingResult decoderRXingResult;
+ RXingResultPoint[] points;
if (hints != null && hints.containsKey(DecodeHintType.PURE_BARCODE)) {
BitMatrix bits = extractPureBits(image.getBlackMatrix());
- decoderResult = decoder.decode(bits);
+ decoderRXingResult = decoder.decode(bits);
points = NO_POINTS;
} else {
- DetectorResult detectorResult = new Detector(image.getBlackMatrix()).detect();
- decoderResult = decoder.decode(detectorResult.getBits());
- points = detectorResult.getPoints();
+ DetectorRXingResult detectorRXingResult = new Detector(image.getBlackMatrix()).detect();
+ decoderRXingResult = decoder.decode(detectorRXingResult.getBits());
+ points = detectorRXingResult.getPoints();
}
- Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points,
+ RXingResult result = new RXingResult(decoderRXingResult.getText(), decoderRXingResult.getRawBytes(), points,
BarcodeFormat.DATA_MATRIX);
- List byteSegments = decoderResult.getByteSegments();
+ List byteSegments = decoderRXingResult.getByteSegments();
if (byteSegments != null) {
- result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);
+ result.putMetadata(RXingResultMetadataType.BYTE_SEGMENTS, byteSegments);
}
- String ecLevel = decoderResult.getECLevel();
+ String ecLevel = decoderRXingResult.getECLevel();
if (ecLevel != null) {
- result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
+ result.putMetadata(RXingResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
}
- result.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]d" + decoderResult.getSymbologyModifier());
+ result.putMetadata(RXingResultMetadataType.SYMBOLOGY_IDENTIFIER, "]d" + decoderRXingResult.getSymbologyModifier());
return result;
}
diff --git a/src/datamatrix/decoder/DataBlock.java b/src/datamatrix/decoder/DataBlock.java
index fd64b26..95b4b30 100644
--- a/src/datamatrix/decoder/DataBlock.java
+++ b/src/datamatrix/decoder/DataBlock.java
@@ -57,12 +57,12 @@ final class DataBlock {
// Now establish DataBlocks of the appropriate size and number of data codewords
DataBlock[] result = new DataBlock[totalBlocks];
- int numResultBlocks = 0;
+ int numRXingResultBlocks = 0;
for (Version.ECB ecBlock : ecBlockArray) {
for (int i = 0; i < ecBlock.getCount(); i++) {
int numDataCodewords = ecBlock.getDataCodewords();
int numBlockCodewords = ecBlocks.getECCodewords() + numDataCodewords;
- result[numResultBlocks++] = new DataBlock(numDataCodewords, new byte[numBlockCodewords]);
+ result[numRXingResultBlocks++] = new DataBlock(numDataCodewords, new byte[numBlockCodewords]);
}
}
@@ -78,14 +78,14 @@ final class DataBlock {
// first fill out as many elements as all of them have minus 1
int rawCodewordsOffset = 0;
for (int i = 0; i < shorterBlocksNumDataCodewords; i++) {
- for (int j = 0; j < numResultBlocks; j++) {
+ for (int j = 0; j < numRXingResultBlocks; j++) {
result[j].codewords[i] = rawCodewords[rawCodewordsOffset++];
}
}
// Fill out the last data block in the longer ones
boolean specialVersion = version.getVersionNumber() == 24;
- int numLongerBlocks = specialVersion ? 8 : numResultBlocks;
+ int numLongerBlocks = specialVersion ? 8 : numRXingResultBlocks;
for (int j = 0; j < numLongerBlocks; j++) {
result[j].codewords[longerBlocksNumDataCodewords - 1] = rawCodewords[rawCodewordsOffset++];
}
@@ -93,8 +93,8 @@ final class DataBlock {
// Now add in error correction blocks
int max = result[0].codewords.length;
for (int i = longerBlocksNumDataCodewords; i < max; i++) {
- for (int j = 0; j < numResultBlocks; j++) {
- int jOffset = specialVersion ? (j + 8) % numResultBlocks : j;
+ for (int j = 0; j < numRXingResultBlocks; j++) {
+ int jOffset = specialVersion ? (j + 8) % numRXingResultBlocks : j;
int iOffset = specialVersion && jOffset > 7 ? i - 1 : i;
result[jOffset].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];
}
diff --git a/src/datamatrix/decoder/DecodedBitStreamParser.java b/src/datamatrix/decoder/DecodedBitStreamParser.java
index 497b8c3..37fb692 100644
--- a/src/datamatrix/decoder/DecodedBitStreamParser.java
+++ b/src/datamatrix/decoder/DecodedBitStreamParser.java
@@ -18,7 +18,7 @@ package com.google.zxing.datamatrix.decoder;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitSource;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.common.DecoderRXingResult;
import com.google.zxing.common.ECIStringBuilder;
import java.nio.charset.StandardCharsets;
@@ -86,7 +86,7 @@ final class DecodedBitStreamParser {
private DecodedBitStreamParser() {
}
- static DecoderResult decode(byte[] bytes) throws FormatException {
+ static DecoderRXingResult decode(byte[] bytes) throws FormatException {
BitSource bits = new BitSource(bytes);
ECIStringBuilder result = new ECIStringBuilder(100);
StringBuilder resultTrailer = new StringBuilder(0);
@@ -149,7 +149,7 @@ final class DecodedBitStreamParser {
}
}
- return new DecoderResult(bytes,
+ return new DecoderRXingResult(bytes,
result.toString(),
byteSegments.isEmpty() ? null : byteSegments,
null,
diff --git a/src/datamatrix/decoder/Decoder.java b/src/datamatrix/decoder/Decoder.java
index 8711e70..0a62d28 100644
--- a/src/datamatrix/decoder/Decoder.java
+++ b/src/datamatrix/decoder/Decoder.java
@@ -19,7 +19,7 @@ package com.google.zxing.datamatrix.decoder;
import com.google.zxing.ChecksumException;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.common.DecoderRXingResult;
import com.google.zxing.common.reedsolomon.GenericGF;
import com.google.zxing.common.reedsolomon.ReedSolomonDecoder;
import com.google.zxing.common.reedsolomon.ReedSolomonException;
@@ -47,7 +47,7 @@ public final class Decoder {
* @throws FormatException if the Data Matrix Code cannot be decoded
* @throws ChecksumException if error correction fails
*/
- public DecoderResult decode(boolean[][] image) throws FormatException, ChecksumException {
+ public DecoderRXingResult decode(boolean[][] image) throws FormatException, ChecksumException {
return decode(BitMatrix.parse(image));
}
@@ -60,7 +60,7 @@ public final class Decoder {
* @throws FormatException if the Data Matrix Code cannot be decoded
* @throws ChecksumException if error correction fails
*/
- public DecoderResult decode(BitMatrix bits) throws FormatException, ChecksumException {
+ public DecoderRXingResult decode(BitMatrix bits) throws FormatException, ChecksumException {
// Construct a parser and read version, error-correction level
BitMatrixParser parser = new BitMatrixParser(bits);
diff --git a/src/datamatrix/detector/Detector.java b/src/datamatrix/detector/Detector.java
index 283ca7c..a10ce46 100644
--- a/src/datamatrix/detector/Detector.java
+++ b/src/datamatrix/detector/Detector.java
@@ -17,9 +17,9 @@
package com.google.zxing.datamatrix.detector;
import com.google.zxing.NotFoundException;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DetectorResult;
+import com.google.zxing.common.DetectorRXingResult;
import com.google.zxing.common.GridSampler;
import com.google.zxing.common.detector.WhiteRectangleDetector;
@@ -42,14 +42,14 @@ public final class Detector {
/**
* Detects a Data Matrix Code in an image.
*
- * @return {@link DetectorResult} encapsulating results of detecting a Data Matrix Code
+ * @return {@link DetectorRXingResult} encapsulating results of detecting a Data Matrix Code
* @throws NotFoundException if no Data Matrix Code can be found
*/
- public DetectorResult detect() throws NotFoundException {
+ public DetectorRXingResult detect() throws NotFoundException {
- ResultPoint[] cornerPoints = rectangleDetector.detect();
+ RXingResultPoint[] cornerPoints = rectangleDetector.detect();
- ResultPoint[] points = detectSolid1(cornerPoints);
+ RXingResultPoint[] points = detectSolid1(cornerPoints);
points = detectSolid2(points);
points[3] = correctTopRight(points);
if (points[3] == null) {
@@ -57,10 +57,10 @@ public final class Detector {
}
points = shiftToModuleCenter(points);
- ResultPoint topLeft = points[0];
- ResultPoint bottomLeft = points[1];
- ResultPoint bottomRight = points[2];
- ResultPoint topRight = points[3];
+ RXingResultPoint topLeft = points[0];
+ RXingResultPoint bottomLeft = points[1];
+ RXingResultPoint bottomRight = points[2];
+ RXingResultPoint topRight = points[3];
int dimensionTop = transitionsBetween(topLeft, topRight) + 1;
int dimensionRight = transitionsBetween(bottomRight, topRight) + 1;
@@ -84,16 +84,16 @@ public final class Detector {
dimensionTop,
dimensionRight);
- return new DetectorResult(bits, new ResultPoint[]{topLeft, bottomLeft, bottomRight, topRight});
+ return new DetectorRXingResult(bits, new RXingResultPoint[]{topLeft, bottomLeft, bottomRight, topRight});
}
- private static ResultPoint shiftPoint(ResultPoint point, ResultPoint to, int div) {
+ private static RXingResultPoint shiftPoint(RXingResultPoint point, RXingResultPoint to, int div) {
float x = (to.getX() - point.getX()) / (div + 1);
float y = (to.getY() - point.getY()) / (div + 1);
- return new ResultPoint(point.getX() + x, point.getY() + y);
+ return new RXingResultPoint(point.getX() + x, point.getY() + y);
}
- private static ResultPoint moveAway(ResultPoint point, float fromX, float fromY) {
+ private static RXingResultPoint moveAway(RXingResultPoint point, float fromX, float fromY) {
float x = point.getX();
float y = point.getY();
@@ -109,19 +109,19 @@ public final class Detector {
y += 1;
}
- return new ResultPoint(x, y);
+ return new RXingResultPoint(x, y);
}
/**
* Detect a solid side which has minimum transition.
*/
- private ResultPoint[] detectSolid1(ResultPoint[] cornerPoints) {
+ private RXingResultPoint[] detectSolid1(RXingResultPoint[] cornerPoints) {
// 0 2
// 1 3
- ResultPoint pointA = cornerPoints[0];
- ResultPoint pointB = cornerPoints[1];
- ResultPoint pointC = cornerPoints[3];
- ResultPoint pointD = cornerPoints[2];
+ RXingResultPoint pointA = cornerPoints[0];
+ RXingResultPoint pointB = cornerPoints[1];
+ RXingResultPoint pointC = cornerPoints[3];
+ RXingResultPoint pointD = cornerPoints[2];
int trAB = transitionsBetween(pointA, pointB);
int trBC = transitionsBetween(pointB, pointC);
@@ -132,7 +132,7 @@ public final class Detector {
// : :
// 1--2
int min = trAB;
- ResultPoint[] points = {pointD, pointA, pointB, pointC};
+ RXingResultPoint[] points = {pointD, pointA, pointB, pointC};
if (min > trBC) {
min = trBC;
points[0] = pointA;
@@ -160,20 +160,20 @@ public final class Detector {
/**
* Detect a second solid side next to first solid side.
*/
- private ResultPoint[] detectSolid2(ResultPoint[] points) {
+ private RXingResultPoint[] detectSolid2(RXingResultPoint[] points) {
// A..D
// : :
// B--C
- ResultPoint pointA = points[0];
- ResultPoint pointB = points[1];
- ResultPoint pointC = points[2];
- ResultPoint pointD = points[3];
+ RXingResultPoint pointA = points[0];
+ RXingResultPoint pointB = points[1];
+ RXingResultPoint pointC = points[2];
+ RXingResultPoint pointD = points[3];
// Transition detection on the edge is not stable.
// To safely detect, shift the points to the module center.
int tr = transitionsBetween(pointA, pointD);
- ResultPoint pointBs = shiftPoint(pointB, pointC, (tr + 1) * 4);
- ResultPoint pointCs = shiftPoint(pointC, pointB, (tr + 1) * 4);
+ RXingResultPoint pointBs = shiftPoint(pointB, pointC, (tr + 1) * 4);
+ RXingResultPoint pointCs = shiftPoint(pointC, pointB, (tr + 1) * 4);
int trBA = transitionsBetween(pointBs, pointA);
int trCD = transitionsBetween(pointCs, pointD);
@@ -200,28 +200,28 @@ public final class Detector {
/**
* Calculates the corner position of the white top right module.
*/
- private ResultPoint correctTopRight(ResultPoint[] points) {
+ private RXingResultPoint correctTopRight(RXingResultPoint[] points) {
// A..D
// | :
// B--C
- ResultPoint pointA = points[0];
- ResultPoint pointB = points[1];
- ResultPoint pointC = points[2];
- ResultPoint pointD = points[3];
+ RXingResultPoint pointA = points[0];
+ RXingResultPoint pointB = points[1];
+ RXingResultPoint pointC = points[2];
+ RXingResultPoint pointD = points[3];
// shift points for safe transition detection.
int trTop = transitionsBetween(pointA, pointD);
int trRight = transitionsBetween(pointB, pointD);
- ResultPoint pointAs = shiftPoint(pointA, pointB, (trRight + 1) * 4);
- ResultPoint pointCs = shiftPoint(pointC, pointB, (trTop + 1) * 4);
+ RXingResultPoint pointAs = shiftPoint(pointA, pointB, (trRight + 1) * 4);
+ RXingResultPoint pointCs = shiftPoint(pointC, pointB, (trTop + 1) * 4);
trTop = transitionsBetween(pointAs, pointD);
trRight = transitionsBetween(pointCs, pointD);
- ResultPoint candidate1 = new ResultPoint(
+ RXingResultPoint candidate1 = new RXingResultPoint(
pointD.getX() + (pointC.getX() - pointB.getX()) / (trTop + 1),
pointD.getY() + (pointC.getY() - pointB.getY()) / (trTop + 1));
- ResultPoint candidate2 = new ResultPoint(
+ RXingResultPoint candidate2 = new RXingResultPoint(
pointD.getX() + (pointA.getX() - pointB.getX()) / (trRight + 1),
pointD.getY() + (pointA.getY() - pointB.getY()) / (trRight + 1));
@@ -248,22 +248,22 @@ public final class Detector {
/**
* Shift the edge points to the module center.
*/
- private ResultPoint[] shiftToModuleCenter(ResultPoint[] points) {
+ private RXingResultPoint[] shiftToModuleCenter(RXingResultPoint[] points) {
// A..D
// | :
// B--C
- ResultPoint pointA = points[0];
- ResultPoint pointB = points[1];
- ResultPoint pointC = points[2];
- ResultPoint pointD = points[3];
+ RXingResultPoint pointA = points[0];
+ RXingResultPoint pointB = points[1];
+ RXingResultPoint pointC = points[2];
+ RXingResultPoint pointD = points[3];
// calculate pseudo dimensions
int dimH = transitionsBetween(pointA, pointD) + 1;
int dimV = transitionsBetween(pointC, pointD) + 1;
// shift points for safe dimension detection
- ResultPoint pointAs = shiftPoint(pointA, pointB, dimV * 4);
- ResultPoint pointCs = shiftPoint(pointC, pointB, dimH * 4);
+ RXingResultPoint pointAs = shiftPoint(pointA, pointB, dimV * 4);
+ RXingResultPoint pointCs = shiftPoint(pointC, pointB, dimH * 4);
// calculate more precise dimensions
dimH = transitionsBetween(pointAs, pointD) + 1;
@@ -284,8 +284,8 @@ public final class Detector {
pointC = moveAway(pointC, centerX, centerY);
pointD = moveAway(pointD, centerX, centerY);
- ResultPoint pointBs;
- ResultPoint pointDs;
+ RXingResultPoint pointBs;
+ RXingResultPoint pointDs;
// shift points to the center of each modules
pointAs = shiftPoint(pointA, pointB, dimV * 4);
@@ -297,18 +297,18 @@ public final class Detector {
pointDs = shiftPoint(pointD, pointC, dimV * 4);
pointDs = shiftPoint(pointDs, pointA, dimH * 4);
- return new ResultPoint[]{pointAs, pointBs, pointCs, pointDs};
+ return new RXingResultPoint[]{pointAs, pointBs, pointCs, pointDs};
}
- private boolean isValid(ResultPoint p) {
+ private boolean isValid(RXingResultPoint p) {
return p.getX() >= 0 && p.getX() <= image.getWidth() - 1 && p.getY() > 0 && p.getY() <= image.getHeight() - 1;
}
private static BitMatrix sampleGrid(BitMatrix image,
- ResultPoint topLeft,
- ResultPoint bottomLeft,
- ResultPoint bottomRight,
- ResultPoint topRight,
+ RXingResultPoint topLeft,
+ RXingResultPoint bottomLeft,
+ RXingResultPoint bottomRight,
+ RXingResultPoint topRight,
int dimensionX,
int dimensionY) throws NotFoundException {
@@ -338,7 +338,7 @@ public final class Detector {
/**
* Counts the number of black/white transitions between two points, using something like Bresenham's algorithm.
*/
- private int transitionsBetween(ResultPoint from, ResultPoint to) {
+ private int transitionsBetween(RXingResultPoint from, RXingResultPoint to) {
// See QR Code Detector, sizeOfBlackWhiteBlackRun()
int fromX = (int) from.getX();
int fromY = (int) from.getY();
diff --git a/src/datamatrix/encoder/MinimalEncoder.java b/src/datamatrix/encoder/MinimalEncoder.java
index 4d3dd8d..76055d6 100755
--- a/src/datamatrix/encoder/MinimalEncoder.java
+++ b/src/datamatrix/encoder/MinimalEncoder.java
@@ -251,7 +251,7 @@ public final class MinimalEncoder {
addEdge(edges, new Edge(input, Mode.EDF, from, 4, previous));
}
}
- static Result encodeMinimally(Input input) {
+ static RXingResult encodeMinimally(Input input) {
@SuppressWarnings("checkstyle:lineLength")
/* The minimal encoding is computed by Dijkstra. The acyclic graph is modeled as follows:
@@ -474,7 +474,7 @@ public final class MinimalEncoder {
if (minimalJ < 0) {
throw new RuntimeException("Internal error: failed to encode \"" + input + "\"");
}
- return new Result(edges[inputLength][minimalJ]);
+ return new RXingResult(edges[inputLength][minimalJ]);
}
private static final class Edge {
@@ -926,11 +926,11 @@ public final class MinimalEncoder {
}
}
- private static final class Result {
+ private static final class RXingResult {
private final byte[] bytes;
- Result(Edge solution) {
+ RXingResult(Edge solution) {
Input input = solution.input;
int size = 0;
List bytesAL = new ArrayList<>();
diff --git a/src/maxicode/MaxiCodeReader.java b/src/maxicode/MaxiCodeReader.java
index 0cb32ff..7c7887f 100644
--- a/src/maxicode/MaxiCodeReader.java
+++ b/src/maxicode/MaxiCodeReader.java
@@ -23,11 +23,11 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.Reader;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.common.DecoderRXingResult;
import com.google.zxing.maxicode.decoder.Decoder;
import java.util.Map;
@@ -37,7 +37,7 @@ import java.util.Map;
*/
public final class MaxiCodeReader implements Reader {
- private static final ResultPoint[] NO_POINTS = new ResultPoint[0];
+ private static final RXingResultPoint[] NO_POINTS = new RXingResultPoint[0];
private static final int MATRIX_WIDTH = 30;
private static final int MATRIX_HEIGHT = 33;
@@ -52,22 +52,22 @@ public final class MaxiCodeReader implements Reader {
* @throws ChecksumException if error correction fails
*/
@Override
- public Result decode(BinaryBitmap image) throws NotFoundException, ChecksumException, FormatException {
+ public RXingResult decode(BinaryBitmap image) throws NotFoundException, ChecksumException, FormatException {
return decode(image, null);
}
@Override
- public Result decode(BinaryBitmap image, Map hints)
+ public RXingResult decode(BinaryBitmap image, Map hints)
throws NotFoundException, ChecksumException, FormatException {
// Note that MaxiCode reader effectively always assumes PURE_BARCODE mode
// and can't detect it in an image
BitMatrix bits = extractPureBits(image.getBlackMatrix());
- DecoderResult decoderResult = decoder.decode(bits, hints);
- Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), NO_POINTS, BarcodeFormat.MAXICODE);
+ DecoderRXingResult decoderRXingResult = decoder.decode(bits, hints);
+ RXingResult result = new RXingResult(decoderRXingResult.getText(), decoderRXingResult.getRawBytes(), NO_POINTS, BarcodeFormat.MAXICODE);
- String ecLevel = decoderResult.getECLevel();
+ String ecLevel = decoderRXingResult.getECLevel();
if (ecLevel != null) {
- result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
+ result.putMetadata(RXingResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
}
return result;
}
diff --git a/src/maxicode/decoder/DecodedBitStreamParser.java b/src/maxicode/decoder/DecodedBitStreamParser.java
index 9ebf7e8..486b838 100644
--- a/src/maxicode/decoder/DecodedBitStreamParser.java
+++ b/src/maxicode/decoder/DecodedBitStreamParser.java
@@ -17,7 +17,7 @@
package com.google.zxing.maxicode.decoder;
import com.google.zxing.FormatException;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.common.DecoderRXingResult;
import java.text.DecimalFormat;
import java.text.NumberFormat;
@@ -84,7 +84,7 @@ final class DecodedBitStreamParser {
private DecodedBitStreamParser() {
}
- static DecoderResult decode(byte[] bytes, int mode) throws FormatException {
+ static DecoderRXingResult decode(byte[] bytes, int mode) throws FormatException {
StringBuilder result = new StringBuilder(144);
switch (mode) {
case 2:
@@ -118,7 +118,7 @@ final class DecodedBitStreamParser {
result.append(getMessage(bytes, 1, 77));
break;
}
- return new DecoderResult(bytes, result.toString(), null, String.valueOf(mode));
+ return new DecoderRXingResult(bytes, result.toString(), null, String.valueOf(mode));
}
private static int getBit(int bit, byte[] bytes) {
diff --git a/src/maxicode/decoder/Decoder.java b/src/maxicode/decoder/Decoder.java
index f7836f4..fd214f3 100644
--- a/src/maxicode/decoder/Decoder.java
+++ b/src/maxicode/decoder/Decoder.java
@@ -20,7 +20,7 @@ import com.google.zxing.ChecksumException;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.common.DecoderRXingResult;
import com.google.zxing.common.reedsolomon.GenericGF;
import com.google.zxing.common.reedsolomon.ReedSolomonDecoder;
import com.google.zxing.common.reedsolomon.ReedSolomonException;
@@ -45,11 +45,11 @@ public final class Decoder {
rsDecoder = new ReedSolomonDecoder(GenericGF.MAXICODE_FIELD_64);
}
- public DecoderResult decode(BitMatrix bits) throws ChecksumException, FormatException {
+ public DecoderRXingResult decode(BitMatrix bits) throws ChecksumException, FormatException {
return decode(bits, null);
}
- public DecoderResult decode(BitMatrix bits,
+ public DecoderRXingResult decode(BitMatrix bits,
Map hints) throws FormatException, ChecksumException {
BitMatrixParser parser = new BitMatrixParser(bits);
byte[] codewords = parser.readCodewords();
diff --git a/src/multi/ByQuadrantReader.java b/src/multi/ByQuadrantReader.java
index 6674c8f..8013df6 100644
--- a/src/multi/ByQuadrantReader.java
+++ b/src/multi/ByQuadrantReader.java
@@ -22,8 +22,8 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.Reader;
-import com.google.zxing.Result;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultPoint;
import java.util.Map;
@@ -45,13 +45,13 @@ public final class ByQuadrantReader implements Reader {
}
@Override
- public Result decode(BinaryBitmap image)
+ public RXingResult decode(BinaryBitmap image)
throws NotFoundException, ChecksumException, FormatException {
return decode(image, null);
}
@Override
- public Result decode(BinaryBitmap image, Map hints)
+ public RXingResult decode(BinaryBitmap image, Map hints)
throws NotFoundException, ChecksumException, FormatException {
int width = image.getWidth();
@@ -67,24 +67,24 @@ public final class ByQuadrantReader implements Reader {
}
try {
- Result result = delegate.decode(image.crop(halfWidth, 0, halfWidth, halfHeight), hints);
- makeAbsolute(result.getResultPoints(), halfWidth, 0);
+ RXingResult result = delegate.decode(image.crop(halfWidth, 0, halfWidth, halfHeight), hints);
+ makeAbsolute(result.getRXingResultPoints(), halfWidth, 0);
return result;
} catch (NotFoundException re) {
// continue
}
try {
- Result result = delegate.decode(image.crop(0, halfHeight, halfWidth, halfHeight), hints);
- makeAbsolute(result.getResultPoints(), 0, halfHeight);
+ RXingResult result = delegate.decode(image.crop(0, halfHeight, halfWidth, halfHeight), hints);
+ makeAbsolute(result.getRXingResultPoints(), 0, halfHeight);
return result;
} catch (NotFoundException re) {
// continue
}
try {
- Result result = delegate.decode(image.crop(halfWidth, halfHeight, halfWidth, halfHeight), hints);
- makeAbsolute(result.getResultPoints(), halfWidth, halfHeight);
+ RXingResult result = delegate.decode(image.crop(halfWidth, halfHeight, halfWidth, halfHeight), hints);
+ makeAbsolute(result.getRXingResultPoints(), halfWidth, halfHeight);
return result;
} catch (NotFoundException re) {
// continue
@@ -93,8 +93,8 @@ public final class ByQuadrantReader implements Reader {
int quarterWidth = halfWidth / 2;
int quarterHeight = halfHeight / 2;
BinaryBitmap center = image.crop(quarterWidth, quarterHeight, halfWidth, halfHeight);
- Result result = delegate.decode(center, hints);
- makeAbsolute(result.getResultPoints(), quarterWidth, quarterHeight);
+ RXingResult result = delegate.decode(center, hints);
+ makeAbsolute(result.getRXingResultPoints(), quarterWidth, quarterHeight);
return result;
}
@@ -103,12 +103,12 @@ public final class ByQuadrantReader implements Reader {
delegate.reset();
}
- private static void makeAbsolute(ResultPoint[] points, int leftOffset, int topOffset) {
+ private static void makeAbsolute(RXingResultPoint[] points, int leftOffset, int topOffset) {
if (points != null) {
for (int i = 0; i < points.length; i++) {
- ResultPoint relative = points[i];
+ RXingResultPoint relative = points[i];
if (relative != null) {
- points[i] = new ResultPoint(relative.getX() + leftOffset, relative.getY() + topOffset);
+ points[i] = new RXingResultPoint(relative.getX() + leftOffset, relative.getY() + topOffset);
}
}
}
diff --git a/src/multi/GenericMultipleBarcodeReader.java b/src/multi/GenericMultipleBarcodeReader.java
index 5e53419..962f7a4 100644
--- a/src/multi/GenericMultipleBarcodeReader.java
+++ b/src/multi/GenericMultipleBarcodeReader.java
@@ -21,8 +21,8 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
import com.google.zxing.Reader;
import com.google.zxing.ReaderException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultPoint;
import java.util.ArrayList;
import java.util.List;
@@ -31,7 +31,7 @@ import java.util.Map;
/**
* Attempts to locate multiple barcodes in an image by repeatedly decoding portion of the image.
* After one barcode is found, the areas left, above, right and below the barcode's
- * {@link ResultPoint}s are scanned, recursively.
+ * {@link RXingResultPoint}s are scanned, recursively.
*
* A caller may want to also employ {@link ByQuadrantReader} when attempting to find multiple
* 2D barcodes, like QR Codes, in an image, where the presence of multiple barcodes might prevent
@@ -47,7 +47,7 @@ public final class GenericMultipleBarcodeReader implements MultipleBarcodeReader
private static final int MIN_DIMENSION_TO_RECUR = 100;
private static final int MAX_DEPTH = 4;
- static final Result[] EMPTY_RESULT_ARRAY = new Result[0];
+ static final RXingResult[] EMPTY_RESULT_ARRAY = new RXingResult[0];
private final Reader delegate;
@@ -56,14 +56,14 @@ public final class GenericMultipleBarcodeReader implements MultipleBarcodeReader
}
@Override
- public Result[] decodeMultiple(BinaryBitmap image) throws NotFoundException {
+ public RXingResult[] decodeMultiple(BinaryBitmap image) throws NotFoundException {
return decodeMultiple(image, null);
}
@Override
- public Result[] decodeMultiple(BinaryBitmap image, Map hints)
+ public RXingResult[] decodeMultiple(BinaryBitmap image, Map hints)
throws NotFoundException {
- List results = new ArrayList<>();
+ List results = new ArrayList<>();
doDecodeMultiple(image, hints, results, 0, 0, 0);
if (results.isEmpty()) {
throw NotFoundException.getNotFoundInstance();
@@ -73,7 +73,7 @@ public final class GenericMultipleBarcodeReader implements MultipleBarcodeReader
private void doDecodeMultiple(BinaryBitmap image,
Map hints,
- List results,
+ List results,
int xOffset,
int yOffset,
int currentDepth) {
@@ -81,23 +81,23 @@ public final class GenericMultipleBarcodeReader implements MultipleBarcodeReader
return;
}
- Result result;
+ RXingResult result;
try {
result = delegate.decode(image, hints);
} catch (ReaderException ignored) {
return;
}
boolean alreadyFound = false;
- for (Result existingResult : results) {
- if (existingResult.getText().equals(result.getText())) {
+ for (RXingResult existingRXingResult : results) {
+ if (existingRXingResult.getText().equals(result.getText())) {
alreadyFound = true;
break;
}
}
if (!alreadyFound) {
- results.add(translateResultPoints(result, xOffset, yOffset));
+ results.add(translateRXingResultPoints(result, xOffset, yOffset));
}
- ResultPoint[] resultPoints = result.getResultPoints();
+ RXingResultPoint[] resultPoints = result.getRXingResultPoints();
if (resultPoints == null || resultPoints.length == 0) {
return;
}
@@ -107,7 +107,7 @@ public final class GenericMultipleBarcodeReader implements MultipleBarcodeReader
float minY = height;
float maxX = 0.0f;
float maxY = 0.0f;
- for (ResultPoint point : resultPoints) {
+ for (RXingResultPoint point : resultPoints) {
if (point == null) {
continue;
}
@@ -157,26 +157,26 @@ public final class GenericMultipleBarcodeReader implements MultipleBarcodeReader
}
}
- private static Result translateResultPoints(Result result, int xOffset, int yOffset) {
- ResultPoint[] oldResultPoints = result.getResultPoints();
- if (oldResultPoints == null) {
+ private static RXingResult translateRXingResultPoints(RXingResult result, int xOffset, int yOffset) {
+ RXingResultPoint[] oldRXingResultPoints = result.getRXingResultPoints();
+ if (oldRXingResultPoints == null) {
return result;
}
- ResultPoint[] newResultPoints = new ResultPoint[oldResultPoints.length];
- for (int i = 0; i < oldResultPoints.length; i++) {
- ResultPoint oldPoint = oldResultPoints[i];
+ RXingResultPoint[] newRXingResultPoints = new RXingResultPoint[oldRXingResultPoints.length];
+ for (int i = 0; i < oldRXingResultPoints.length; i++) {
+ RXingResultPoint oldPoint = oldRXingResultPoints[i];
if (oldPoint != null) {
- newResultPoints[i] = new ResultPoint(oldPoint.getX() + xOffset, oldPoint.getY() + yOffset);
+ newRXingResultPoints[i] = new RXingResultPoint(oldPoint.getX() + xOffset, oldPoint.getY() + yOffset);
}
}
- Result newResult = new Result(result.getText(),
+ RXingResult newRXingResult = new RXingResult(result.getText(),
result.getRawBytes(),
result.getNumBits(),
- newResultPoints,
+ newRXingResultPoints,
result.getBarcodeFormat(),
result.getTimestamp());
- newResult.putAllMetadata(result.getResultMetadata());
- return newResult;
+ newRXingResult.putAllMetadata(result.getRXingResultMetadata());
+ return newRXingResult;
}
}
diff --git a/src/multi/MultipleBarcodeReader.java b/src/multi/MultipleBarcodeReader.java
index a358727..65c89a8 100644
--- a/src/multi/MultipleBarcodeReader.java
+++ b/src/multi/MultipleBarcodeReader.java
@@ -19,7 +19,7 @@ package com.google.zxing.multi;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import java.util.Map;
@@ -31,9 +31,9 @@ import java.util.Map;
*/
public interface MultipleBarcodeReader {
- Result[] decodeMultiple(BinaryBitmap image) throws NotFoundException;
+ RXingResult[] decodeMultiple(BinaryBitmap image) throws NotFoundException;
- Result[] decodeMultiple(BinaryBitmap image,
+ RXingResult[] decodeMultiple(BinaryBitmap image,
Map hints) throws NotFoundException;
}
diff --git a/src/multi/qrcode/QRCodeMultiReader.java b/src/multi/qrcode/QRCodeMultiReader.java
index c366349..cd760fe 100644
--- a/src/multi/qrcode/QRCodeMultiReader.java
+++ b/src/multi/qrcode/QRCodeMultiReader.java
@@ -21,11 +21,11 @@ import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
import com.google.zxing.ReaderException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
-import com.google.zxing.common.DecoderResult;
-import com.google.zxing.common.DetectorResult;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
+import com.google.zxing.common.DecoderRXingResult;
+import com.google.zxing.common.DetectorRXingResult;
import com.google.zxing.multi.MultipleBarcodeReader;
import com.google.zxing.multi.qrcode.detector.MultiDetector;
import com.google.zxing.qrcode.QRCodeReader;
@@ -47,41 +47,41 @@ import java.util.Comparator;
*/
public final class QRCodeMultiReader extends QRCodeReader implements MultipleBarcodeReader {
- private static final Result[] EMPTY_RESULT_ARRAY = new Result[0];
- private static final ResultPoint[] NO_POINTS = new ResultPoint[0];
+ private static final RXingResult[] EMPTY_RESULT_ARRAY = new RXingResult[0];
+ private static final RXingResultPoint[] NO_POINTS = new RXingResultPoint[0];
@Override
- public Result[] decodeMultiple(BinaryBitmap image) throws NotFoundException {
+ public RXingResult[] decodeMultiple(BinaryBitmap image) throws NotFoundException {
return decodeMultiple(image, null);
}
@Override
- public Result[] decodeMultiple(BinaryBitmap image, Map hints) throws NotFoundException {
- List results = new ArrayList<>();
- DetectorResult[] detectorResults = new MultiDetector(image.getBlackMatrix()).detectMulti(hints);
- for (DetectorResult detectorResult : detectorResults) {
+ public RXingResult[] decodeMultiple(BinaryBitmap image, Map hints) throws NotFoundException {
+ List results = new ArrayList<>();
+ DetectorRXingResult[] detectorRXingResults = new MultiDetector(image.getBlackMatrix()).detectMulti(hints);
+ for (DetectorRXingResult detectorRXingResult : detectorRXingResults) {
try {
- DecoderResult decoderResult = getDecoder().decode(detectorResult.getBits(), hints);
- ResultPoint[] points = detectorResult.getPoints();
+ DecoderRXingResult decoderRXingResult = getDecoder().decode(detectorRXingResult.getBits(), hints);
+ RXingResultPoint[] points = detectorRXingResult.getPoints();
// If the code was mirrored: swap the bottom-left and the top-right points.
- if (decoderResult.getOther() instanceof QRCodeDecoderMetaData) {
- ((QRCodeDecoderMetaData) decoderResult.getOther()).applyMirroredCorrection(points);
+ if (decoderRXingResult.getOther() instanceof QRCodeDecoderMetaData) {
+ ((QRCodeDecoderMetaData) decoderRXingResult.getOther()).applyMirroredCorrection(points);
}
- Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points,
+ RXingResult result = new RXingResult(decoderRXingResult.getText(), decoderRXingResult.getRawBytes(), points,
BarcodeFormat.QR_CODE);
- List byteSegments = decoderResult.getByteSegments();
+ List byteSegments = decoderRXingResult.getByteSegments();
if (byteSegments != null) {
- result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);
+ result.putMetadata(RXingResultMetadataType.BYTE_SEGMENTS, byteSegments);
}
- String ecLevel = decoderResult.getECLevel();
+ String ecLevel = decoderRXingResult.getECLevel();
if (ecLevel != null) {
- result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
+ result.putMetadata(RXingResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
}
- if (decoderResult.hasStructuredAppend()) {
- result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE,
- decoderResult.getStructuredAppendSequenceNumber());
- result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_PARITY,
- decoderResult.getStructuredAppendParity());
+ if (decoderRXingResult.hasStructuredAppend()) {
+ result.putMetadata(RXingResultMetadataType.STRUCTURED_APPEND_SEQUENCE,
+ decoderRXingResult.getStructuredAppendSequenceNumber());
+ result.putMetadata(RXingResultMetadataType.STRUCTURED_APPEND_PARITY,
+ decoderRXingResult.getStructuredAppendParity());
}
results.add(result);
} catch (ReaderException re) {
@@ -96,32 +96,32 @@ public final class QRCodeMultiReader extends QRCodeReader implements MultipleBar
}
}
- static List processStructuredAppend(List results) {
- List newResults = new ArrayList<>();
- List saResults = new ArrayList<>();
- for (Result result : results) {
- if (result.getResultMetadata().containsKey(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE)) {
- saResults.add(result);
+ static List processStructuredAppend(List results) {
+ List newRXingResults = new ArrayList<>();
+ List saRXingResults = new ArrayList<>();
+ for (RXingResult result : results) {
+ if (result.getRXingResultMetadata().containsKey(RXingResultMetadataType.STRUCTURED_APPEND_SEQUENCE)) {
+ saRXingResults.add(result);
} else {
- newResults.add(result);
+ newRXingResults.add(result);
}
}
- if (saResults.isEmpty()) {
+ if (saRXingResults.isEmpty()) {
return results;
}
// sort and concatenate the SA list items
- Collections.sort(saResults, new SAComparator());
+ Collections.sort(saRXingResults, new SAComparator());
StringBuilder newText = new StringBuilder();
ByteArrayOutputStream newRawBytes = new ByteArrayOutputStream();
ByteArrayOutputStream newByteSegment = new ByteArrayOutputStream();
- for (Result saResult : saResults) {
- newText.append(saResult.getText());
- byte[] saBytes = saResult.getRawBytes();
+ for (RXingResult saRXingResult : saRXingResults) {
+ newText.append(saRXingResult.getText());
+ byte[] saBytes = saRXingResult.getRawBytes();
newRawBytes.write(saBytes, 0, saBytes.length);
@SuppressWarnings("unchecked")
Iterable byteSegments =
- (Iterable) saResult.getResultMetadata().get(ResultMetadataType.BYTE_SEGMENTS);
+ (Iterable) saRXingResult.getRXingResultMetadata().get(RXingResultMetadataType.BYTE_SEGMENTS);
if (byteSegments != null) {
for (byte[] segment : byteSegments) {
newByteSegment.write(segment, 0, segment.length);
@@ -129,19 +129,19 @@ public final class QRCodeMultiReader extends QRCodeReader implements MultipleBar
}
}
- Result newResult = new Result(newText.toString(), newRawBytes.toByteArray(), NO_POINTS, BarcodeFormat.QR_CODE);
+ RXingResult newRXingResult = new RXingResult(newText.toString(), newRawBytes.toByteArray(), NO_POINTS, BarcodeFormat.QR_CODE);
if (newByteSegment.size() > 0) {
- newResult.putMetadata(ResultMetadataType.BYTE_SEGMENTS, Collections.singletonList(newByteSegment.toByteArray()));
+ newRXingResult.putMetadata(RXingResultMetadataType.BYTE_SEGMENTS, Collections.singletonList(newByteSegment.toByteArray()));
}
- newResults.add(newResult);
- return newResults;
+ newRXingResults.add(newRXingResult);
+ return newRXingResults;
}
- private static final class SAComparator implements Comparator, Serializable {
+ private static final class SAComparator implements Comparator, Serializable {
@Override
- public int compare(Result a, Result b) {
- int aNumber = (int) a.getResultMetadata().get(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE);
- int bNumber = (int) b.getResultMetadata().get(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE);
+ public int compare(RXingResult a, RXingResult b) {
+ int aNumber = (int) a.getRXingResultMetadata().get(RXingResultMetadataType.STRUCTURED_APPEND_SEQUENCE);
+ int bNumber = (int) b.getRXingResultMetadata().get(RXingResultMetadataType.STRUCTURED_APPEND_SEQUENCE);
return Integer.compare(aNumber, bNumber);
}
}
diff --git a/src/multi/qrcode/detector/MultiDetector.java b/src/multi/qrcode/detector/MultiDetector.java
index 512b452..7d16c62 100644
--- a/src/multi/qrcode/detector/MultiDetector.java
+++ b/src/multi/qrcode/detector/MultiDetector.java
@@ -19,9 +19,9 @@ package com.google.zxing.multi.qrcode.detector;
import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
import com.google.zxing.ReaderException;
-import com.google.zxing.ResultPointCallback;
+import com.google.zxing.RXingResultPointCallback;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DetectorResult;
+import com.google.zxing.common.DetectorRXingResult;
import com.google.zxing.qrcode.detector.Detector;
import com.google.zxing.qrcode.detector.FinderPatternInfo;
@@ -38,16 +38,16 @@ import java.util.Map;
*/
public final class MultiDetector extends Detector {
- private static final DetectorResult[] EMPTY_DETECTOR_RESULTS = new DetectorResult[0];
+ private static final DetectorRXingResult[] EMPTY_DETECTOR_RESULTS = new DetectorRXingResult[0];
public MultiDetector(BitMatrix image) {
super(image);
}
- public DetectorResult[] detectMulti(Map hints) throws NotFoundException {
+ public DetectorRXingResult[] detectMulti(Map hints) throws NotFoundException {
BitMatrix image = getImage();
- ResultPointCallback resultPointCallback =
- hints == null ? null : (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
+ RXingResultPointCallback resultPointCallback =
+ hints == null ? null : (RXingResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
MultiFinderPatternFinder finder = new MultiFinderPatternFinder(image, resultPointCallback);
FinderPatternInfo[] infos = finder.findMulti(hints);
@@ -55,7 +55,7 @@ public final class MultiDetector extends Detector {
throw NotFoundException.getNotFoundInstance();
}
- List result = new ArrayList<>();
+ List result = new ArrayList<>();
for (FinderPatternInfo info : infos) {
try {
result.add(processFinderPatternInfo(info));
diff --git a/src/multi/qrcode/detector/MultiFinderPatternFinder.java b/src/multi/qrcode/detector/MultiFinderPatternFinder.java
index b4e96a6..00fde7d 100644
--- a/src/multi/qrcode/detector/MultiFinderPatternFinder.java
+++ b/src/multi/qrcode/detector/MultiFinderPatternFinder.java
@@ -18,8 +18,8 @@ package com.google.zxing.multi.qrcode.detector;
import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
-import com.google.zxing.ResultPoint;
-import com.google.zxing.ResultPointCallback;
+import com.google.zxing.RXingResultPoint;
+import com.google.zxing.RXingResultPointCallback;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.detector.FinderPattern;
import com.google.zxing.qrcode.detector.FinderPatternFinder;
@@ -86,7 +86,7 @@ public final class MultiFinderPatternFinder extends FinderPatternFinder {
}
}
- public MultiFinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback) {
+ public MultiFinderPatternFinder(BitMatrix image, RXingResultPointCallback resultPointCallback) {
super(image, resultPointCallback);
}
@@ -176,13 +176,13 @@ public final class MultiFinderPatternFinder extends FinderPatternFinder {
}
FinderPattern[] test = {p1, p2, p3};
- ResultPoint.orderBestPatterns(test);
+ RXingResultPoint.orderBestPatterns(test);
// Calculate the distances: a = topleft-bottomleft, b=topleft-topright, c = diagonal
FinderPatternInfo info = new FinderPatternInfo(test);
- float dA = ResultPoint.distance(info.getTopLeft(), info.getBottomLeft());
- float dC = ResultPoint.distance(info.getTopRight(), info.getBottomLeft());
- float dB = ResultPoint.distance(info.getTopLeft(), info.getTopRight());
+ float dA = RXingResultPoint.distance(info.getTopLeft(), info.getBottomLeft());
+ float dC = RXingResultPoint.distance(info.getTopRight(), info.getBottomLeft());
+ float dB = RXingResultPoint.distance(info.getTopLeft(), info.getTopRight());
// Check the sizes
float estimatedModuleCount = (dA + dB) / (p1.getEstimatedModuleSize() * 2.0f);
@@ -276,7 +276,7 @@ public final class MultiFinderPatternFinder extends FinderPatternFinder {
FinderPattern[][] patternInfo = selectMultipleBestPatterns();
List result = new ArrayList<>();
for (FinderPattern[] pattern : patternInfo) {
- ResultPoint.orderBestPatterns(pattern);
+ RXingResultPoint.orderBestPatterns(pattern);
result.add(new FinderPatternInfo(pattern));
}
diff --git a/src/oned/CodaBarReader.java b/src/oned/CodaBarReader.java
index a5e230d..404bc71 100644
--- a/src/oned/CodaBarReader.java
+++ b/src/oned/CodaBarReader.java
@@ -19,9 +19,9 @@ package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitArray;
import java.util.Arrays;
@@ -67,25 +67,25 @@ public final class CodaBarReader extends OneDReader {
// for more information see : http://www.mecsw.com/specs/codabar.html
// Keep some instance variables to avoid reallocations
- private final StringBuilder decodeRowResult;
+ private final StringBuilder decodeRowRXingResult;
private int[] counters;
private int counterLength;
public CodaBarReader() {
- decodeRowResult = new StringBuilder(20);
+ decodeRowRXingResult = new StringBuilder(20);
counters = new int[80];
counterLength = 0;
}
@Override
- public Result decodeRow(int rowNumber, BitArray row, Map hints) throws NotFoundException {
+ public RXingResult decodeRow(int rowNumber, BitArray row, Map hints) throws NotFoundException {
Arrays.fill(counters, 0);
setCounters(row);
int startOffset = findStartPattern();
int nextStart = startOffset;
- decodeRowResult.setLength(0);
+ decodeRowRXingResult.setLength(0);
do {
int charOffset = toNarrowWidePattern(nextStart);
if (charOffset == -1) {
@@ -94,10 +94,10 @@ public final class CodaBarReader extends OneDReader {
// Hack: We store the position in the alphabet table into a
// StringBuilder, so that we can access the decoded patterns in
// validatePattern. We'll translate to the actual characters later.
- decodeRowResult.append((char) charOffset);
+ decodeRowRXingResult.append((char) charOffset);
nextStart += 8;
// Stop as soon as we see the end character.
- if (decodeRowResult.length() > 1 &&
+ if (decodeRowRXingResult.length() > 1 &&
arrayContains(STARTEND_ENCODING, ALPHABET[charOffset])) {
break;
}
@@ -120,28 +120,28 @@ public final class CodaBarReader extends OneDReader {
validatePattern(startOffset);
// Translate character table offsets to actual characters.
- for (int i = 0; i < decodeRowResult.length(); i++) {
- decodeRowResult.setCharAt(i, ALPHABET[decodeRowResult.charAt(i)]);
+ for (int i = 0; i < decodeRowRXingResult.length(); i++) {
+ decodeRowRXingResult.setCharAt(i, ALPHABET[decodeRowRXingResult.charAt(i)]);
}
// Ensure a valid start and end character
- char startchar = decodeRowResult.charAt(0);
+ char startchar = decodeRowRXingResult.charAt(0);
if (!arrayContains(STARTEND_ENCODING, startchar)) {
throw NotFoundException.getNotFoundInstance();
}
- char endchar = decodeRowResult.charAt(decodeRowResult.length() - 1);
+ char endchar = decodeRowRXingResult.charAt(decodeRowRXingResult.length() - 1);
if (!arrayContains(STARTEND_ENCODING, endchar)) {
throw NotFoundException.getNotFoundInstance();
}
// remove stop/start characters character and check if a long enough string is contained
- if (decodeRowResult.length() <= MIN_CHARACTER_LENGTH) {
+ if (decodeRowRXingResult.length() <= MIN_CHARACTER_LENGTH) {
// Almost surely a false positive ( start + stop + at least 1 character)
throw NotFoundException.getNotFoundInstance();
}
if (hints == null || !hints.containsKey(DecodeHintType.RETURN_CODABAR_START_END)) {
- decodeRowResult.deleteCharAt(decodeRowResult.length() - 1);
- decodeRowResult.deleteCharAt(0);
+ decodeRowRXingResult.deleteCharAt(decodeRowRXingResult.length() - 1);
+ decodeRowRXingResult.deleteCharAt(0);
}
int runningCount = 0;
@@ -154,14 +154,14 @@ public final class CodaBarReader extends OneDReader {
}
float right = runningCount;
- Result result = new Result(
- decodeRowResult.toString(),
+ RXingResult result = new RXingResult(
+ decodeRowRXingResult.toString(),
null,
- new ResultPoint[]{
- new ResultPoint(left, rowNumber),
- new ResultPoint(right, rowNumber)},
+ new RXingResultPoint[]{
+ new RXingResultPoint(left, rowNumber),
+ new RXingResultPoint(right, rowNumber)},
BarcodeFormat.CODABAR);
- result.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]F0");
+ result.putMetadata(RXingResultMetadataType.SYMBOLOGY_IDENTIFIER, "]F0");
return result;
}
@@ -169,13 +169,13 @@ public final class CodaBarReader extends OneDReader {
// First, sum up the total size of our four categories of stripe sizes;
int[] sizes = {0, 0, 0, 0};
int[] counts = {0, 0, 0, 0};
- int end = decodeRowResult.length() - 1;
+ int end = decodeRowRXingResult.length() - 1;
// We break out of this loop in the middle, in order to handle
// inter-character spaces properly.
int pos = start;
for (int i = 0; i <= end; i++) {
- int pattern = CHARACTER_ENCODINGS[decodeRowResult.charAt(i)];
+ int pattern = CHARACTER_ENCODINGS[decodeRowRXingResult.charAt(i)];
for (int j = 6; j >= 0; j--) {
// Even j = bars, while odd j = spaces. Categories 2 and 3 are for
// long stripes, while 0 and 1 are for short stripes.
@@ -204,7 +204,7 @@ public final class CodaBarReader extends OneDReader {
// Now verify that all of the stripes are within the thresholds.
pos = start;
for (int i = 0; i <= end; i++) {
- int pattern = CHARACTER_ENCODINGS[decodeRowResult.charAt(i)];
+ int pattern = CHARACTER_ENCODINGS[decodeRowRXingResult.charAt(i)];
for (int j = 6; j >= 0; j--) {
// Even j = bars, while odd j = spaces. Categories 2 and 3 are for
// long stripes, while 0 and 1 are for short stripes.
diff --git a/src/oned/Code128Reader.java b/src/oned/Code128Reader.java
index a6322a3..a5da0fb 100644
--- a/src/oned/Code128Reader.java
+++ b/src/oned/Code128Reader.java
@@ -21,9 +21,9 @@ import com.google.zxing.ChecksumException;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitArray;
import java.util.ArrayList;
@@ -234,7 +234,7 @@ public final class Code128Reader extends OneDReader {
}
@Override
- public Result decodeRow(int rowNumber, BitArray row, Map hints)
+ public RXingResult decodeRow(int rowNumber, BitArray row, Map hints)
throws NotFoundException, FormatException, ChecksumException {
boolean convertFNC1 = hints != null && hints.containsKey(DecodeHintType.ASSUME_GS1);
@@ -547,14 +547,14 @@ public final class Code128Reader extends OneDReader {
for (int i = 0; i < rawCodesSize; i++) {
rawBytes[i] = rawCodes.get(i);
}
- Result resultObject = new Result(
+ RXingResult resultObject = new RXingResult(
result.toString(),
rawBytes,
- new ResultPoint[]{
- new ResultPoint(left, rowNumber),
- new ResultPoint(right, rowNumber)},
+ new RXingResultPoint[]{
+ new RXingResultPoint(left, rowNumber),
+ new RXingResultPoint(right, rowNumber)},
BarcodeFormat.CODE_128);
- resultObject.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]C" + symbologyModifier);
+ resultObject.putMetadata(RXingResultMetadataType.SYMBOLOGY_IDENTIFIER, "]C" + symbologyModifier);
return resultObject;
}
diff --git a/src/oned/Code128Writer.java b/src/oned/Code128Writer.java
index 27628ed..6f9f0fb 100644
--- a/src/oned/Code128Writer.java
+++ b/src/oned/Code128Writer.java
@@ -52,7 +52,7 @@ public final class Code128Writer extends OneDimensionalCodeWriter {
private static final int CODE_FNC_4_A = 101; // Code A
private static final int CODE_FNC_4_B = 100; // Code B
- // Results of minimal lookahead for code C
+ // RXingResults of minimal lookahead for code C
private enum CType {
UNCODABLE,
ONE_DIGIT,
@@ -249,10 +249,10 @@ public final class Code128Writer extends OneDimensionalCodeWriter {
checkWeight++;
}
}
- return produceResult(patterns, checkSum);
+ return produceRXingResult(patterns, checkSum);
}
- static boolean[] produceResult(Collection patterns, int checkSum) {
+ static boolean[] produceRXingResult(Collection patterns, int checkSum) {
// Compute and append checksum
checkSum %= 103;
patterns.add(Code128Reader.CODE_PATTERNS[checkSum]);
@@ -456,7 +456,7 @@ public final class Code128Writer extends OneDimensionalCodeWriter {
}
memoizedCost = null;
minPath = null;
- return produceResult(patterns, checkSum[0]);
+ return produceRXingResult(patterns, checkSum[0]);
}
private static void addPattern(Collection patterns,
diff --git a/src/oned/Code39Reader.java b/src/oned/Code39Reader.java
index 35dfb7a..a74ae93 100644
--- a/src/oned/Code39Reader.java
+++ b/src/oned/Code39Reader.java
@@ -21,9 +21,9 @@ import com.google.zxing.ChecksumException;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitArray;
import java.util.Arrays;
@@ -56,7 +56,7 @@ public final class Code39Reader extends OneDReader {
private final boolean usingCheckDigit;
private final boolean extendedMode;
- private final StringBuilder decodeRowResult;
+ private final StringBuilder decodeRowRXingResult;
private final int[] counters;
/**
@@ -91,17 +91,17 @@ public final class Code39Reader extends OneDReader {
public Code39Reader(boolean usingCheckDigit, boolean extendedMode) {
this.usingCheckDigit = usingCheckDigit;
this.extendedMode = extendedMode;
- decodeRowResult = new StringBuilder(20);
+ decodeRowRXingResult = new StringBuilder(20);
counters = new int[9];
}
@Override
- public Result decodeRow(int rowNumber, BitArray row, Map hints)
+ public RXingResult decodeRow(int rowNumber, BitArray row, Map hints)
throws NotFoundException, ChecksumException, FormatException {
int[] theCounters = counters;
Arrays.fill(theCounters, 0);
- StringBuilder result = decodeRowResult;
+ StringBuilder result = decodeRowRXingResult;
result.setLength(0);
int[] start = findAsteriskPattern(row, theCounters);
@@ -144,7 +144,7 @@ public final class Code39Reader extends OneDReader {
int max = result.length() - 1;
int total = 0;
for (int i = 0; i < max; i++) {
- total += ALPHABET_STRING.indexOf(decodeRowResult.charAt(i));
+ total += ALPHABET_STRING.indexOf(decodeRowRXingResult.charAt(i));
}
if (result.charAt(max) != ALPHABET_STRING.charAt(total % 43)) {
throw ChecksumException.getChecksumInstance();
@@ -167,14 +167,14 @@ public final class Code39Reader extends OneDReader {
float left = (start[1] + start[0]) / 2.0f;
float right = lastStart + lastPatternSize / 2.0f;
- Result resultObject = new Result(
+ RXingResult resultObject = new RXingResult(
resultString,
null,
- new ResultPoint[]{
- new ResultPoint(left, rowNumber),
- new ResultPoint(right, rowNumber)},
+ new RXingResultPoint[]{
+ new RXingResultPoint(left, rowNumber),
+ new RXingResultPoint(right, rowNumber)},
BarcodeFormat.CODE_39);
- resultObject.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]A0");
+ resultObject.putMetadata(RXingResultMetadataType.SYMBOLOGY_IDENTIFIER, "]A0");
return resultObject;
}
diff --git a/src/oned/Code93Reader.java b/src/oned/Code93Reader.java
index 5aa203f..a96839c 100644
--- a/src/oned/Code93Reader.java
+++ b/src/oned/Code93Reader.java
@@ -21,9 +21,9 @@ import com.google.zxing.ChecksumException;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitArray;
import java.util.Arrays;
@@ -55,16 +55,16 @@ public final class Code93Reader extends OneDReader {
};
static final int ASTERISK_ENCODING = CHARACTER_ENCODINGS[47];
- private final StringBuilder decodeRowResult;
+ private final StringBuilder decodeRowRXingResult;
private final int[] counters;
public Code93Reader() {
- decodeRowResult = new StringBuilder(20);
+ decodeRowRXingResult = new StringBuilder(20);
counters = new int[6];
}
@Override
- public Result decodeRow(int rowNumber, BitArray row, Map hints)
+ public RXingResult decodeRow(int rowNumber, BitArray row, Map hints)
throws NotFoundException, ChecksumException, FormatException {
int[] start = findAsteriskPattern(row);
@@ -74,7 +74,7 @@ public final class Code93Reader extends OneDReader {
int[] theCounters = counters;
Arrays.fill(theCounters, 0);
- StringBuilder result = decodeRowResult;
+ StringBuilder result = decodeRowRXingResult;
result.setLength(0);
char decodedChar;
@@ -120,14 +120,14 @@ public final class Code93Reader extends OneDReader {
float left = (start[1] + start[0]) / 2.0f;
float right = lastStart + lastPatternSize / 2.0f;
- Result resultObject = new Result(
+ RXingResult resultObject = new RXingResult(
resultString,
null,
- new ResultPoint[]{
- new ResultPoint(left, rowNumber),
- new ResultPoint(right, rowNumber)},
+ new RXingResultPoint[]{
+ new RXingResultPoint(left, rowNumber),
+ new RXingResultPoint(right, rowNumber)},
BarcodeFormat.CODE_93);
- resultObject.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]G0");
+ resultObject.putMetadata(RXingResultMetadataType.SYMBOLOGY_IDENTIFIER, "]G0");
return resultObject;
}
diff --git a/src/oned/ITFReader.java b/src/oned/ITFReader.java
index a4e6ec3..a957d9c 100644
--- a/src/oned/ITFReader.java
+++ b/src/oned/ITFReader.java
@@ -20,9 +20,9 @@ import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitArray;
import java.util.Map;
@@ -99,7 +99,7 @@ public final class ITFReader extends OneDReader {
};
@Override
- public Result decodeRow(int rowNumber, BitArray row, Map hints)
+ public RXingResult decodeRow(int rowNumber, BitArray row, Map hints)
throws FormatException, NotFoundException {
// Find out where the Middle section (payload) starts & ends
@@ -140,13 +140,13 @@ public final class ITFReader extends OneDReader {
throw FormatException.getFormatInstance();
}
- Result resultObject = new Result(
+ RXingResult resultObject = new RXingResult(
resultString,
null, // no natural byte representation for these barcodes
- new ResultPoint[] {new ResultPoint(startRange[1], rowNumber),
- new ResultPoint(endRange[0], rowNumber)},
+ new RXingResultPoint[] {new RXingResultPoint(startRange[1], rowNumber),
+ new RXingResultPoint(endRange[0], rowNumber)},
BarcodeFormat.ITF);
- resultObject.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]I0");
+ resultObject.putMetadata(RXingResultMetadataType.SYMBOLOGY_IDENTIFIER, "]I0");
return resultObject;
}
diff --git a/src/oned/MultiFormatOneDReader.java b/src/oned/MultiFormatOneDReader.java
index 1dd3394..66d45de 100644
--- a/src/oned/MultiFormatOneDReader.java
+++ b/src/oned/MultiFormatOneDReader.java
@@ -21,7 +21,7 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
import com.google.zxing.Reader;
import com.google.zxing.ReaderException;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import com.google.zxing.common.BitArray;
import com.google.zxing.oned.rss.RSS14Reader;
import com.google.zxing.oned.rss.expanded.RSSExpandedReader;
@@ -90,7 +90,7 @@ public final class MultiFormatOneDReader extends OneDReader {
}
@Override
- public Result decodeRow(int rowNumber,
+ public RXingResult decodeRow(int rowNumber,
BitArray row,
Map hints) throws NotFoundException {
for (OneDReader reader : readers) {
diff --git a/src/oned/MultiFormatUPCEANReader.java b/src/oned/MultiFormatUPCEANReader.java
index bb82603..36beb07 100644
--- a/src/oned/MultiFormatUPCEANReader.java
+++ b/src/oned/MultiFormatUPCEANReader.java
@@ -21,7 +21,7 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
import com.google.zxing.Reader;
import com.google.zxing.ReaderException;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import com.google.zxing.common.BitArray;
import java.util.ArrayList;
@@ -69,14 +69,14 @@ public final class MultiFormatUPCEANReader extends OneDReader {
}
@Override
- public Result decodeRow(int rowNumber,
+ public RXingResult decodeRow(int rowNumber,
BitArray row,
Map hints) throws NotFoundException {
// Compute this location once and reuse it on multiple implementations
int[] startGuardPattern = UPCEANReader.findStartGuardPattern(row);
for (UPCEANReader reader : readers) {
try {
- Result result = reader.decodeRow(rowNumber, row, startGuardPattern, hints);
+ RXingResult result = reader.decodeRow(rowNumber, row, startGuardPattern, hints);
// Special case: a 12-digit code encoded in UPC-A is identical to a "0"
// followed by those 12 digits encoded as EAN-13. Each will recognize such a code,
// UPC-A as a 12-digit string and EAN-13 as a 13-digit string starting with "0".
@@ -99,11 +99,11 @@ public final class MultiFormatUPCEANReader extends OneDReader {
if (ean13MayBeUPCA && canReturnUPCA) {
// Transfer the metadata across
- Result resultUPCA = new Result(result.getText().substring(1),
+ RXingResult resultUPCA = new RXingResult(result.getText().substring(1),
result.getRawBytes(),
- result.getResultPoints(),
+ result.getRXingResultPoints(),
BarcodeFormat.UPC_A);
- resultUPCA.putAllMetadata(result.getResultMetadata());
+ resultUPCA.putAllMetadata(result.getRXingResultMetadata());
return resultUPCA;
}
return result;
diff --git a/src/oned/OneDReader.java b/src/oned/OneDReader.java
index 7941e6f..1f68102 100644
--- a/src/oned/OneDReader.java
+++ b/src/oned/OneDReader.java
@@ -23,9 +23,9 @@ import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.Reader;
import com.google.zxing.ReaderException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitArray;
import java.util.Arrays;
@@ -42,13 +42,13 @@ import java.util.Map;
public abstract class OneDReader implements Reader {
@Override
- public Result decode(BinaryBitmap image) throws NotFoundException, FormatException {
+ public RXingResult decode(BinaryBitmap image) throws NotFoundException, FormatException {
return decode(image, null);
}
// Note that we don't try rotation without the try harder flag, even if rotation was supported.
@Override
- public Result decode(BinaryBitmap image,
+ public RXingResult decode(BinaryBitmap image,
Map hints) throws NotFoundException, FormatException {
try {
return doDecode(image, hints);
@@ -56,22 +56,22 @@ public abstract class OneDReader implements Reader {
boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);
if (tryHarder && image.isRotateSupported()) {
BinaryBitmap rotatedImage = image.rotateCounterClockwise();
- Result result = doDecode(rotatedImage, hints);
+ RXingResult result = doDecode(rotatedImage, hints);
// Record that we found it rotated 90 degrees CCW / 270 degrees CW
- Map metadata = result.getResultMetadata();
+ Map metadata = result.getRXingResultMetadata();
int orientation = 270;
- if (metadata != null && metadata.containsKey(ResultMetadataType.ORIENTATION)) {
+ if (metadata != null && metadata.containsKey(RXingResultMetadataType.ORIENTATION)) {
// But if we found it reversed in doDecode(), add in that result here:
orientation = (orientation +
- (Integer) metadata.get(ResultMetadataType.ORIENTATION)) % 360;
+ (Integer) metadata.get(RXingResultMetadataType.ORIENTATION)) % 360;
}
- result.putMetadata(ResultMetadataType.ORIENTATION, orientation);
+ result.putMetadata(RXingResultMetadataType.ORIENTATION, orientation);
// Update result points
- ResultPoint[] points = result.getResultPoints();
+ RXingResultPoint[] points = result.getRXingResultPoints();
if (points != null) {
int height = rotatedImage.getHeight();
for (int i = 0; i < points.length; i++) {
- points[i] = new ResultPoint(height - points[i].getY() - 1, points[i].getX());
+ points[i] = new RXingResultPoint(height - points[i].getY() - 1, points[i].getX());
}
}
return result;
@@ -100,7 +100,7 @@ public abstract class OneDReader implements Reader {
* @return The contents of the decoded barcode
* @throws NotFoundException Any spontaneous errors which occur
*/
- private Result doDecode(BinaryBitmap image,
+ private RXingResult doDecode(BinaryBitmap image,
Map hints) throws NotFoundException {
int width = image.getWidth();
int height = image.getHeight();
@@ -152,16 +152,16 @@ public abstract class OneDReader implements Reader {
}
try {
// Look for a barcode
- Result result = decodeRow(rowNumber, row, hints);
+ RXingResult result = decodeRow(rowNumber, row, hints);
// We found our barcode
if (attempt == 1) {
// But it was upside down, so note that
- result.putMetadata(ResultMetadataType.ORIENTATION, 180);
+ result.putMetadata(RXingResultMetadataType.ORIENTATION, 180);
// And remember to flip the result points horizontally.
- ResultPoint[] points = result.getResultPoints();
+ RXingResultPoint[] points = result.getRXingResultPoints();
if (points != null) {
- points[0] = new ResultPoint(width - points[0].getX() - 1, points[0].getY());
- points[1] = new ResultPoint(width - points[1].getX() - 1, points[1].getY());
+ points[0] = new RXingResultPoint(width - points[0].getX() - 1, points[0].getY());
+ points[1] = new RXingResultPoint(width - points[1].getX() - 1, points[1].getY());
}
}
return result;
@@ -285,12 +285,12 @@ public abstract class OneDReader implements Reader {
* @param rowNumber row number from top of the row
* @param row the black/white pixel data of the row
* @param hints decode hints
- * @return {@link Result} containing encoded string and start/end of barcode
+ * @return {@link RXingResult} containing encoded string and start/end of barcode
* @throws NotFoundException if no potential barcode is found
* @throws ChecksumException if a potential barcode is found but does not pass its checksum
* @throws FormatException if a potential barcode is found but format is invalid
*/
- public abstract Result decodeRow(int rowNumber, BitArray row, Map hints)
+ public abstract RXingResult decodeRow(int rowNumber, BitArray row, Map hints)
throws NotFoundException, ChecksumException, FormatException;
}
diff --git a/src/oned/OneDimensionalCodeWriter.java b/src/oned/OneDimensionalCodeWriter.java
index d277d2e..97759f9 100644
--- a/src/oned/OneDimensionalCodeWriter.java
+++ b/src/oned/OneDimensionalCodeWriter.java
@@ -90,7 +90,7 @@ public abstract class OneDimensionalCodeWriter implements Writer {
}
boolean[] code = encode(contents, hints);
- return renderResult(code, width, height, sidesMargin);
+ return renderRXingResult(code, width, height, sidesMargin);
}
protected Collection getSupportedWriteFormats() {
@@ -100,7 +100,7 @@ public abstract class OneDimensionalCodeWriter implements Writer {
/**
* @return a byte array of horizontal pixels (0 = white, 1 = black)
*/
- private static BitMatrix renderResult(boolean[] code, int width, int height, int sidesMargin) {
+ private static BitMatrix renderRXingResult(boolean[] code, int width, int height, int sidesMargin) {
int inputWidth = code.length;
// Add quiet zone on both sides.
int fullWidth = inputWidth + sidesMargin;
diff --git a/src/oned/UPCAReader.java b/src/oned/UPCAReader.java
index c66a76c..1163b57 100644
--- a/src/oned/UPCAReader.java
+++ b/src/oned/UPCAReader.java
@@ -22,7 +22,7 @@ import com.google.zxing.ChecksumException;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import com.google.zxing.common.BitArray;
import java.util.Map;
@@ -38,29 +38,29 @@ public final class UPCAReader extends UPCEANReader {
private final UPCEANReader ean13Reader = new EAN13Reader();
@Override
- public Result decodeRow(int rowNumber,
+ public RXingResult decodeRow(int rowNumber,
BitArray row,
int[] startGuardRange,
Map hints)
throws NotFoundException, FormatException, ChecksumException {
- return maybeReturnResult(ean13Reader.decodeRow(rowNumber, row, startGuardRange, hints));
+ return maybeReturnRXingResult(ean13Reader.decodeRow(rowNumber, row, startGuardRange, hints));
}
@Override
- public Result decodeRow(int rowNumber, BitArray row, Map hints)
+ public RXingResult decodeRow(int rowNumber, BitArray row, Map hints)
throws NotFoundException, FormatException, ChecksumException {
- return maybeReturnResult(ean13Reader.decodeRow(rowNumber, row, hints));
+ return maybeReturnRXingResult(ean13Reader.decodeRow(rowNumber, row, hints));
}
@Override
- public Result decode(BinaryBitmap image) throws NotFoundException, FormatException {
- return maybeReturnResult(ean13Reader.decode(image));
+ public RXingResult decode(BinaryBitmap image) throws NotFoundException, FormatException {
+ return maybeReturnRXingResult(ean13Reader.decode(image));
}
@Override
- public Result decode(BinaryBitmap image, Map hints)
+ public RXingResult decode(BinaryBitmap image, Map hints)
throws NotFoundException, FormatException {
- return maybeReturnResult(ean13Reader.decode(image, hints));
+ return maybeReturnRXingResult(ean13Reader.decode(image, hints));
}
@Override
@@ -74,14 +74,14 @@ public final class UPCAReader extends UPCEANReader {
return ean13Reader.decodeMiddle(row, startRange, resultString);
}
- private static Result maybeReturnResult(Result result) throws FormatException {
+ private static RXingResult maybeReturnRXingResult(RXingResult result) throws FormatException {
String text = result.getText();
if (text.charAt(0) == '0') {
- Result upcaResult = new Result(text.substring(1), null, result.getResultPoints(), BarcodeFormat.UPC_A);
- if (result.getResultMetadata() != null) {
- upcaResult.putAllMetadata(result.getResultMetadata());
+ RXingResult upcaRXingResult = new RXingResult(text.substring(1), null, result.getRXingResultPoints(), BarcodeFormat.UPC_A);
+ if (result.getRXingResultMetadata() != null) {
+ upcaRXingResult.putAllMetadata(result.getRXingResultMetadata());
}
- return upcaResult;
+ return upcaRXingResult;
} else {
throw FormatException.getFormatInstance();
}
diff --git a/src/oned/UPCEANExtension2Support.java b/src/oned/UPCEANExtension2Support.java
index 8a1c627..b1dd000 100644
--- a/src/oned/UPCEANExtension2Support.java
+++ b/src/oned/UPCEANExtension2Support.java
@@ -18,9 +18,9 @@ package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitArray;
import java.util.EnumMap;
@@ -34,27 +34,27 @@ final class UPCEANExtension2Support {
private final int[] decodeMiddleCounters = new int[4];
private final StringBuilder decodeRowStringBuffer = new StringBuilder();
- Result decodeRow(int rowNumber, BitArray row, int[] extensionStartRange) throws NotFoundException {
+ RXingResult decodeRow(int rowNumber, BitArray row, int[] extensionStartRange) throws NotFoundException {
StringBuilder result = decodeRowStringBuffer;
result.setLength(0);
int end = decodeMiddle(row, extensionStartRange, result);
String resultString = result.toString();
- Map extensionData = parseExtensionString(resultString);
+ Map extensionData = parseExtensionString(resultString);
- Result extensionResult =
- new Result(resultString,
+ RXingResult extensionRXingResult =
+ new RXingResult(resultString,
null,
- new ResultPoint[] {
- new ResultPoint((extensionStartRange[0] + extensionStartRange[1]) / 2.0f, rowNumber),
- new ResultPoint(end, rowNumber),
+ new RXingResultPoint[] {
+ new RXingResultPoint((extensionStartRange[0] + extensionStartRange[1]) / 2.0f, rowNumber),
+ new RXingResultPoint(end, rowNumber),
},
BarcodeFormat.UPC_EAN_EXTENSION);
if (extensionData != null) {
- extensionResult.putAllMetadata(extensionData);
+ extensionRXingResult.putAllMetadata(extensionData);
}
- return extensionResult;
+ return extensionRXingResult;
}
private int decodeMiddle(BitArray row, int[] startRange, StringBuilder resultString) throws NotFoundException {
@@ -98,14 +98,14 @@ final class UPCEANExtension2Support {
/**
* @param raw raw content of extension
* @return formatted interpretation of raw content as a {@link Map} mapping
- * one {@link ResultMetadataType} to appropriate value, or {@code null} if not known
+ * one {@link RXingResultMetadataType} to appropriate value, or {@code null} if not known
*/
- private static Map parseExtensionString(String raw) {
+ private static Map parseExtensionString(String raw) {
if (raw.length() != 2) {
return null;
}
- Map result = new EnumMap<>(ResultMetadataType.class);
- result.put(ResultMetadataType.ISSUE_NUMBER, Integer.valueOf(raw));
+ Map result = new EnumMap<>(RXingResultMetadataType.class);
+ result.put(RXingResultMetadataType.ISSUE_NUMBER, Integer.valueOf(raw));
return result;
}
diff --git a/src/oned/UPCEANExtension5Support.java b/src/oned/UPCEANExtension5Support.java
index cb55eeb..dff97c8 100644
--- a/src/oned/UPCEANExtension5Support.java
+++ b/src/oned/UPCEANExtension5Support.java
@@ -18,9 +18,9 @@ package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitArray;
import java.util.EnumMap;
@@ -38,27 +38,27 @@ final class UPCEANExtension5Support {
private final int[] decodeMiddleCounters = new int[4];
private final StringBuilder decodeRowStringBuffer = new StringBuilder();
- Result decodeRow(int rowNumber, BitArray row, int[] extensionStartRange) throws NotFoundException {
+ RXingResult decodeRow(int rowNumber, BitArray row, int[] extensionStartRange) throws NotFoundException {
StringBuilder result = decodeRowStringBuffer;
result.setLength(0);
int end = decodeMiddle(row, extensionStartRange, result);
String resultString = result.toString();
- Map extensionData = parseExtensionString(resultString);
+ Map extensionData = parseExtensionString(resultString);
- Result extensionResult =
- new Result(resultString,
+ RXingResult extensionRXingResult =
+ new RXingResult(resultString,
null,
- new ResultPoint[] {
- new ResultPoint((extensionStartRange[0] + extensionStartRange[1]) / 2.0f, rowNumber),
- new ResultPoint(end, rowNumber),
+ new RXingResultPoint[] {
+ new RXingResultPoint((extensionStartRange[0] + extensionStartRange[1]) / 2.0f, rowNumber),
+ new RXingResultPoint(end, rowNumber),
},
BarcodeFormat.UPC_EAN_EXTENSION);
if (extensionData != null) {
- extensionResult.putAllMetadata(extensionData);
+ extensionRXingResult.putAllMetadata(extensionData);
}
- return extensionResult;
+ return extensionRXingResult;
}
private int decodeMiddle(BitArray row, int[] startRange, StringBuilder resultString) throws NotFoundException {
@@ -127,9 +127,9 @@ final class UPCEANExtension5Support {
/**
* @param raw raw content of extension
* @return formatted interpretation of raw content as a {@link Map} mapping
- * one {@link ResultMetadataType} to appropriate value, or {@code null} if not known
+ * one {@link RXingResultMetadataType} to appropriate value, or {@code null} if not known
*/
- private static Map parseExtensionString(String raw) {
+ private static Map parseExtensionString(String raw) {
if (raw.length() != 5) {
return null;
}
@@ -137,8 +137,8 @@ final class UPCEANExtension5Support {
if (value == null) {
return null;
}
- Map result = new EnumMap<>(ResultMetadataType.class);
- result.put(ResultMetadataType.SUGGESTED_PRICE, value);
+ Map result = new EnumMap<>(RXingResultMetadataType.class);
+ result.put(RXingResultMetadataType.SUGGESTED_PRICE, value);
return result;
}
diff --git a/src/oned/UPCEANExtensionSupport.java b/src/oned/UPCEANExtensionSupport.java
index b36a581..9493584 100644
--- a/src/oned/UPCEANExtensionSupport.java
+++ b/src/oned/UPCEANExtensionSupport.java
@@ -18,7 +18,7 @@ package com.google.zxing.oned;
import com.google.zxing.NotFoundException;
import com.google.zxing.ReaderException;
-import com.google.zxing.Result;
+import com.google.zxing.RXingResult;
import com.google.zxing.common.BitArray;
final class UPCEANExtensionSupport {
@@ -28,7 +28,7 @@ final class UPCEANExtensionSupport {
private final UPCEANExtension2Support twoSupport = new UPCEANExtension2Support();
private final UPCEANExtension5Support fiveSupport = new UPCEANExtension5Support();
- Result decodeRow(int rowNumber, BitArray row, int rowOffset) throws NotFoundException {
+ RXingResult decodeRow(int rowNumber, BitArray row, int rowOffset) throws NotFoundException {
int[] extensionStartRange = UPCEANReader.findGuardPattern(row, rowOffset, false, EXTENSION_START_PATTERN);
try {
return fiveSupport.decodeRow(rowNumber, row, extensionStartRange);
diff --git a/src/oned/UPCEANReader.java b/src/oned/UPCEANReader.java
index f2a00bb..b8f6301 100644
--- a/src/oned/UPCEANReader.java
+++ b/src/oned/UPCEANReader.java
@@ -22,10 +22,10 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.ReaderException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
-import com.google.zxing.ResultPointCallback;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
+import com.google.zxing.RXingResultPointCallback;
import com.google.zxing.common.BitArray;
import java.util.Arrays;
@@ -126,7 +126,7 @@ public abstract class UPCEANReader extends OneDReader {
}
@Override
- public Result decodeRow(int rowNumber, BitArray row, Map hints)
+ public RXingResult decodeRow(int rowNumber, BitArray row, Map hints)
throws NotFoundException, ChecksumException, FormatException {
return decodeRow(rowNumber, row, findStartGuardPattern(row), hints);
}
@@ -140,23 +140,23 @@ public abstract class UPCEANReader extends OneDReader {
* @param row encoding of the row of the barcode image
* @param startGuardRange start/end column where the opening start pattern was found
* @param hints optional hints that influence decoding
- * @return {@link Result} encapsulating the result of decoding a barcode in the row
+ * @return {@link RXingResult} encapsulating the result of decoding a barcode in the row
* @throws NotFoundException if no potential barcode is found
* @throws ChecksumException if a potential barcode is found but does not pass its checksum
* @throws FormatException if a potential barcode is found but format is invalid
*/
- public Result decodeRow(int rowNumber,
+ public RXingResult decodeRow(int rowNumber,
BitArray row,
int[] startGuardRange,
Map hints)
throws NotFoundException, ChecksumException, FormatException {
- ResultPointCallback resultPointCallback = hints == null ? null :
- (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
+ RXingResultPointCallback resultPointCallback = hints == null ? null :
+ (RXingResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
int symbologyIdentifier = 0;
if (resultPointCallback != null) {
- resultPointCallback.foundPossibleResultPoint(new ResultPoint(
+ resultPointCallback.foundPossibleRXingResultPoint(new RXingResultPoint(
(startGuardRange[0] + startGuardRange[1]) / 2.0f, rowNumber
));
}
@@ -166,7 +166,7 @@ public abstract class UPCEANReader extends OneDReader {
int endStart = decodeMiddle(row, startGuardRange, result);
if (resultPointCallback != null) {
- resultPointCallback.foundPossibleResultPoint(new ResultPoint(
+ resultPointCallback.foundPossibleRXingResultPoint(new RXingResultPoint(
endStart, rowNumber
));
}
@@ -174,7 +174,7 @@ public abstract class UPCEANReader extends OneDReader {
int[] endRange = decodeEnd(row, endStart);
if (resultPointCallback != null) {
- resultPointCallback.foundPossibleResultPoint(new ResultPoint(
+ resultPointCallback.foundPossibleRXingResultPoint(new RXingResultPoint(
(endRange[0] + endRange[1]) / 2.0f, rowNumber
));
}
@@ -200,21 +200,21 @@ public abstract class UPCEANReader extends OneDReader {
float left = (startGuardRange[1] + startGuardRange[0]) / 2.0f;
float right = (endRange[1] + endRange[0]) / 2.0f;
BarcodeFormat format = getBarcodeFormat();
- Result decodeResult = new Result(resultString,
+ RXingResult decodeRXingResult = new RXingResult(resultString,
null, // no natural byte representation for these barcodes
- new ResultPoint[]{
- new ResultPoint(left, rowNumber),
- new ResultPoint(right, rowNumber)},
+ new RXingResultPoint[]{
+ new RXingResultPoint(left, rowNumber),
+ new RXingResultPoint(right, rowNumber)},
format);
int extensionLength = 0;
try {
- Result extensionResult = extensionReader.decodeRow(rowNumber, row, endRange[1]);
- decodeResult.putMetadata(ResultMetadataType.UPC_EAN_EXTENSION, extensionResult.getText());
- decodeResult.putAllMetadata(extensionResult.getResultMetadata());
- decodeResult.addResultPoints(extensionResult.getResultPoints());
- extensionLength = extensionResult.getText().length();
+ RXingResult extensionRXingResult = extensionReader.decodeRow(rowNumber, row, endRange[1]);
+ decodeRXingResult.putMetadata(RXingResultMetadataType.UPC_EAN_EXTENSION, extensionRXingResult.getText());
+ decodeRXingResult.putAllMetadata(extensionRXingResult.getRXingResultMetadata());
+ decodeRXingResult.addRXingResultPoints(extensionRXingResult.getRXingResultPoints());
+ extensionLength = extensionRXingResult.getText().length();
} catch (ReaderException re) {
// continue
}
@@ -237,16 +237,16 @@ public abstract class UPCEANReader extends OneDReader {
if (format == BarcodeFormat.EAN_13 || format == BarcodeFormat.UPC_A) {
String countryID = eanManSupport.lookupCountryIdentifier(resultString);
if (countryID != null) {
- decodeResult.putMetadata(ResultMetadataType.POSSIBLE_COUNTRY, countryID);
+ decodeRXingResult.putMetadata(RXingResultMetadataType.POSSIBLE_COUNTRY, countryID);
}
}
if (format == BarcodeFormat.EAN_8) {
symbologyIdentifier = 4;
}
- decodeResult.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]E" + symbologyIdentifier);
+ decodeRXingResult.putMetadata(RXingResultMetadataType.SYMBOLOGY_IDENTIFIER, "]E" + symbologyIdentifier);
- return decodeResult;
+ return decodeRXingResult;
}
/**
diff --git a/src/oned/rss/FinderPattern.java b/src/oned/rss/FinderPattern.java
index 56a8d72..25d6b68 100644
--- a/src/oned/rss/FinderPattern.java
+++ b/src/oned/rss/FinderPattern.java
@@ -16,7 +16,7 @@
package com.google.zxing.oned.rss;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResultPoint;
/**
* Encapsulates an RSS barcode finder pattern, including its start/end position and row.
@@ -25,14 +25,14 @@ public final class FinderPattern {
private final int value;
private final int[] startEnd;
- private final ResultPoint[] resultPoints;
+ private final RXingResultPoint[] resultPoints;
public FinderPattern(int value, int[] startEnd, int start, int end, int rowNumber) {
this.value = value;
this.startEnd = startEnd;
- this.resultPoints = new ResultPoint[] {
- new ResultPoint(start, rowNumber),
- new ResultPoint(end, rowNumber),
+ this.resultPoints = new RXingResultPoint[] {
+ new RXingResultPoint(start, rowNumber),
+ new RXingResultPoint(end, rowNumber),
};
}
@@ -44,7 +44,7 @@ public final class FinderPattern {
return startEnd;
}
- public ResultPoint[] getResultPoints() {
+ public RXingResultPoint[] getRXingResultPoints() {
return resultPoints;
}
diff --git a/src/oned/rss/RSS14Reader.java b/src/oned/rss/RSS14Reader.java
index 4042244..0111d62 100644
--- a/src/oned/rss/RSS14Reader.java
+++ b/src/oned/rss/RSS14Reader.java
@@ -19,10 +19,10 @@ package com.google.zxing.oned.rss;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
-import com.google.zxing.ResultPointCallback;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
+import com.google.zxing.RXingResultPointCallback;
import com.google.zxing.common.BitArray;
import com.google.zxing.common.detector.MathUtils;
@@ -65,7 +65,7 @@ public final class RSS14Reader extends AbstractRSSReader {
}
@Override
- public Result decodeRow(int rowNumber,
+ public RXingResult decodeRow(int rowNumber,
BitArray row,
Map hints) throws NotFoundException {
Pair leftPair = decodePair(row, false, rowNumber, hints);
@@ -78,7 +78,7 @@ public final class RSS14Reader extends AbstractRSSReader {
if (left.getCount() > 1) {
for (Pair right : possibleRightPairs) {
if (right.getCount() > 1 && checkChecksum(left, right)) {
- return constructResult(left, right);
+ return constructRXingResult(left, right);
}
}
}
@@ -109,7 +109,7 @@ public final class RSS14Reader extends AbstractRSSReader {
possibleRightPairs.clear();
}
- private static Result constructResult(Pair leftPair, Pair rightPair) {
+ private static RXingResult constructRXingResult(Pair leftPair, Pair rightPair) {
long symbolValue = 4537077L * leftPair.getValue() + rightPair.getValue();
String text = String.valueOf(symbolValue);
@@ -130,14 +130,14 @@ public final class RSS14Reader extends AbstractRSSReader {
}
buffer.append(checkDigit);
- ResultPoint[] leftPoints = leftPair.getFinderPattern().getResultPoints();
- ResultPoint[] rightPoints = rightPair.getFinderPattern().getResultPoints();
- Result result = new Result(
+ RXingResultPoint[] leftPoints = leftPair.getFinderPattern().getRXingResultPoints();
+ RXingResultPoint[] rightPoints = rightPair.getFinderPattern().getRXingResultPoints();
+ RXingResult result = new RXingResult(
buffer.toString(),
null,
- new ResultPoint[] { leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1], },
+ new RXingResultPoint[] { leftPoints[0], leftPoints[1], rightPoints[0], rightPoints[1], },
BarcodeFormat.RSS_14);
- result.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]e0");
+ result.putMetadata(RXingResultMetadataType.SYMBOLOGY_IDENTIFIER, "]e0");
return result;
}
@@ -159,8 +159,8 @@ public final class RSS14Reader extends AbstractRSSReader {
int[] startEnd = findFinderPattern(row, right);
FinderPattern pattern = parseFoundFinderPattern(row, rowNumber, right, startEnd);
- ResultPointCallback resultPointCallback = hints == null ? null :
- (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
+ RXingResultPointCallback resultPointCallback = hints == null ? null :
+ (RXingResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
if (resultPointCallback != null) {
startEnd = pattern.getStartEnd();
@@ -169,7 +169,7 @@ public final class RSS14Reader extends AbstractRSSReader {
// row is actually reversed
center = row.getSize() - 1 - center;
}
- resultPointCallback.foundPossibleResultPoint(new ResultPoint(center, rowNumber));
+ resultPointCallback.foundPossibleRXingResultPoint(new RXingResultPoint(center, rowNumber));
}
DataCharacter outside = decodeDataCharacter(row, pattern, true);
diff --git a/src/oned/rss/expanded/RSSExpandedReader.java b/src/oned/rss/expanded/RSSExpandedReader.java
index 6171885..44bdcfc 100644
--- a/src/oned/rss/expanded/RSSExpandedReader.java
+++ b/src/oned/rss/expanded/RSSExpandedReader.java
@@ -30,9 +30,9 @@ import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitArray;
import com.google.zxing.common.detector.MathUtils;
import com.google.zxing.oned.rss.AbstractRSSReader;
@@ -123,7 +123,7 @@ public final class RSSExpandedReader extends AbstractRSSReader {
private boolean startFromEven;
@Override
- public Result decodeRow(int rowNumber,
+ public RXingResult decodeRow(int rowNumber,
BitArray row,
Map hints) throws NotFoundException, FormatException {
// Rows can start with even pattern in case in prev rows there where odd number of patters.
@@ -131,14 +131,14 @@ public final class RSSExpandedReader extends AbstractRSSReader {
this.pairs.clear();
this.startFromEven = false;
try {
- return constructResult(decodeRow2pairs(rowNumber, row));
+ return constructRXingResult(decodeRow2pairs(rowNumber, row));
} catch (NotFoundException e) {
// OK
}
this.pairs.clear();
this.startFromEven = true;
- return constructResult(decodeRow2pairs(rowNumber, row));
+ return constructRXingResult(decodeRow2pairs(rowNumber, row));
}
@Override
@@ -348,22 +348,22 @@ public final class RSSExpandedReader extends AbstractRSSReader {
}
// Not private for unit testing
- static Result constructResult(List pairs) throws NotFoundException, FormatException {
+ static RXingResult constructRXingResult(List pairs) throws NotFoundException, FormatException {
BitArray binary = BitArrayBuilder.buildBitArray(pairs);
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
String resultingString = decoder.parseInformation();
- ResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getResultPoints();
- ResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getResultPoints();
+ RXingResultPoint[] firstPoints = pairs.get(0).getFinderPattern().getRXingResultPoints();
+ RXingResultPoint[] lastPoints = pairs.get(pairs.size() - 1).getFinderPattern().getRXingResultPoints();
- Result result = new Result(
+ RXingResult result = new RXingResult(
resultingString,
null,
- new ResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
+ new RXingResultPoint[]{firstPoints[0], firstPoints[1], lastPoints[0], lastPoints[1]},
BarcodeFormat.RSS_EXPANDED
);
- result.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]e0");
+ result.putMetadata(RXingResultMetadataType.SYMBOLOGY_IDENTIFIER, "]e0");
return result;
}
diff --git a/src/oned/rss/expanded/decoders/BlockParsedResult.java b/src/oned/rss/expanded/decoders/BlockParsedResult.java
index bff40b4..c6744ac 100644
--- a/src/oned/rss/expanded/decoders/BlockParsedResult.java
+++ b/src/oned/rss/expanded/decoders/BlockParsedResult.java
@@ -30,16 +30,16 @@ package com.google.zxing.oned.rss.expanded.decoders;
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
* @author Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es)
*/
-final class BlockParsedResult {
+final class BlockParsedRXingResult {
private final DecodedInformation decodedInformation;
private final boolean finished;
- BlockParsedResult() {
+ BlockParsedRXingResult() {
this(null, false);
}
- BlockParsedResult(DecodedInformation information, boolean finished) {
+ BlockParsedRXingResult(DecodedInformation information, boolean finished) {
this.finished = finished;
this.decodedInformation = information;
}
diff --git a/src/oned/rss/expanded/decoders/GeneralAppIdDecoder.java b/src/oned/rss/expanded/decoders/GeneralAppIdDecoder.java
index a128860..477684b 100644
--- a/src/oned/rss/expanded/decoders/GeneralAppIdDecoder.java
+++ b/src/oned/rss/expanded/decoders/GeneralAppIdDecoder.java
@@ -134,7 +134,7 @@ final class GeneralAppIdDecoder {
private DecodedInformation parseBlocks() throws FormatException {
boolean isFinished;
- BlockParsedResult result;
+ BlockParsedRXingResult result;
do {
int initialPosition = current.getPosition();
@@ -158,7 +158,7 @@ final class GeneralAppIdDecoder {
return result.getDecodedInformation();
}
- private BlockParsedResult parseNumericBlock() throws FormatException {
+ private BlockParsedRXingResult parseNumericBlock() throws FormatException {
while (isStillNumeric(current.getPosition())) {
DecodedNumeric numeric = decodeNumeric(current.getPosition());
current.setPosition(numeric.getNewPosition());
@@ -170,13 +170,13 @@ final class GeneralAppIdDecoder {
} else {
information = new DecodedInformation(current.getPosition(), buffer.toString(), numeric.getSecondDigit());
}
- return new BlockParsedResult(information, true);
+ return new BlockParsedRXingResult(information, true);
}
buffer.append(numeric.getFirstDigit());
if (numeric.isSecondDigitFNC1()) {
DecodedInformation information = new DecodedInformation(current.getPosition(), buffer.toString());
- return new BlockParsedResult(information, true);
+ return new BlockParsedRXingResult(information, true);
}
buffer.append(numeric.getSecondDigit());
}
@@ -185,17 +185,17 @@ final class GeneralAppIdDecoder {
current.setAlpha();
current.incrementPosition(4);
}
- return new BlockParsedResult();
+ return new BlockParsedRXingResult();
}
- private BlockParsedResult parseIsoIec646Block() throws FormatException {
+ private BlockParsedRXingResult parseIsoIec646Block() throws FormatException {
while (isStillIsoIec646(current.getPosition())) {
DecodedChar iso = decodeIsoIec646(current.getPosition());
current.setPosition(iso.getNewPosition());
if (iso.isFNC1()) {
DecodedInformation information = new DecodedInformation(current.getPosition(), buffer.toString());
- return new BlockParsedResult(information, true);
+ return new BlockParsedRXingResult(information, true);
}
buffer.append(iso.getValue());
}
@@ -212,17 +212,17 @@ final class GeneralAppIdDecoder {
current.setAlpha();
}
- return new BlockParsedResult();
+ return new BlockParsedRXingResult();
}
- private BlockParsedResult parseAlphaBlock() {
+ private BlockParsedRXingResult parseAlphaBlock() {
while (isStillAlpha(current.getPosition())) {
DecodedChar alpha = decodeAlphanumeric(current.getPosition());
current.setPosition(alpha.getNewPosition());
if (alpha.isFNC1()) {
DecodedInformation information = new DecodedInformation(current.getPosition(), buffer.toString());
- return new BlockParsedResult(information, true); //end of the char block
+ return new BlockParsedRXingResult(information, true); //end of the char block
}
buffer.append(alpha.getValue());
@@ -240,7 +240,7 @@ final class GeneralAppIdDecoder {
current.setIsoIec646();
}
- return new BlockParsedResult();
+ return new BlockParsedRXingResult();
}
private boolean isStillIsoIec646(int pos) {
diff --git a/src/pdf417/PDF417Reader.java b/src/pdf417/PDF417Reader.java
index 142e3be..0de9d55 100644
--- a/src/pdf417/PDF417Reader.java
+++ b/src/pdf417/PDF417Reader.java
@@ -23,14 +23,14 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.Reader;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
+import com.google.zxing.common.DecoderRXingResult;
import com.google.zxing.multi.MultipleBarcodeReader;
import com.google.zxing.pdf417.decoder.PDF417ScanningDecoder;
import com.google.zxing.pdf417.detector.Detector;
-import com.google.zxing.pdf417.detector.PDF417DetectorResult;
+import com.google.zxing.pdf417.detector.PDF417DetectorRXingResult;
import java.util.ArrayList;
import java.util.List;
@@ -43,7 +43,7 @@ import java.util.Map;
*/
public final class PDF417Reader implements Reader, MultipleBarcodeReader {
- private static final Result[] EMPTY_RESULT_ARRAY = new Result[0];
+ private static final RXingResult[] EMPTY_RESULT_ARRAY = new RXingResult[0];
/**
* Locates and decodes a PDF417 code in an image.
@@ -53,14 +53,14 @@ public final class PDF417Reader implements Reader, MultipleBarcodeReader {
* @throws FormatException if a PDF417 cannot be decoded
*/
@Override
- public Result decode(BinaryBitmap image) throws NotFoundException, FormatException, ChecksumException {
+ public RXingResult decode(BinaryBitmap image) throws NotFoundException, FormatException, ChecksumException {
return decode(image, null);
}
@Override
- public Result decode(BinaryBitmap image, Map hints) throws NotFoundException, FormatException,
+ public RXingResult decode(BinaryBitmap image, Map hints) throws NotFoundException, FormatException,
ChecksumException {
- Result[] result = decode(image, hints, false);
+ RXingResult[] result = decode(image, hints, false);
if (result.length == 0 || result[0] == null) {
throw NotFoundException.getNotFoundInstance();
}
@@ -68,12 +68,12 @@ public final class PDF417Reader implements Reader, MultipleBarcodeReader {
}
@Override
- public Result[] decodeMultiple(BinaryBitmap image) throws NotFoundException {
+ public RXingResult[] decodeMultiple(BinaryBitmap image) throws NotFoundException {
return decodeMultiple(image, null);
}
@Override
- public Result[] decodeMultiple(BinaryBitmap image, Map hints) throws NotFoundException {
+ public RXingResult[] decodeMultiple(BinaryBitmap image, Map hints) throws NotFoundException {
try {
return decode(image, hints, true);
} catch (FormatException | ChecksumException ignored) {
@@ -81,41 +81,41 @@ public final class PDF417Reader implements Reader, MultipleBarcodeReader {
}
}
- private static Result[] decode(BinaryBitmap image, Map hints, boolean multiple)
+ private static RXingResult[] decode(BinaryBitmap image, Map hints, boolean multiple)
throws NotFoundException, FormatException, ChecksumException {
- List results = new ArrayList<>();
- PDF417DetectorResult detectorResult = Detector.detect(image, hints, multiple);
- for (ResultPoint[] points : detectorResult.getPoints()) {
- DecoderResult decoderResult = PDF417ScanningDecoder.decode(detectorResult.getBits(), points[4], points[5],
+ List results = new ArrayList<>();
+ PDF417DetectorRXingResult detectorRXingResult = Detector.detect(image, hints, multiple);
+ for (RXingResultPoint[] points : detectorRXingResult.getPoints()) {
+ DecoderRXingResult decoderRXingResult = PDF417ScanningDecoder.decode(detectorRXingResult.getBits(), points[4], points[5],
points[6], points[7], getMinCodewordWidth(points), getMaxCodewordWidth(points));
- Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.PDF_417);
- result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, decoderResult.getECLevel());
- PDF417ResultMetadata pdf417ResultMetadata = (PDF417ResultMetadata) decoderResult.getOther();
- if (pdf417ResultMetadata != null) {
- result.putMetadata(ResultMetadataType.PDF417_EXTRA_METADATA, pdf417ResultMetadata);
+ RXingResult result = new RXingResult(decoderRXingResult.getText(), decoderRXingResult.getRawBytes(), points, BarcodeFormat.PDF_417);
+ result.putMetadata(RXingResultMetadataType.ERROR_CORRECTION_LEVEL, decoderRXingResult.getECLevel());
+ PDF417RXingResultMetadata pdf417RXingResultMetadata = (PDF417RXingResultMetadata) decoderRXingResult.getOther();
+ if (pdf417RXingResultMetadata != null) {
+ result.putMetadata(RXingResultMetadataType.PDF417_EXTRA_METADATA, pdf417RXingResultMetadata);
}
- result.putMetadata(ResultMetadataType.ORIENTATION, detectorResult.getRotation());
- result.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]L" + decoderResult.getSymbologyModifier());
+ result.putMetadata(RXingResultMetadataType.ORIENTATION, detectorRXingResult.getRotation());
+ result.putMetadata(RXingResultMetadataType.SYMBOLOGY_IDENTIFIER, "]L" + decoderRXingResult.getSymbologyModifier());
results.add(result);
}
return results.toArray(EMPTY_RESULT_ARRAY);
}
- private static int getMaxWidth(ResultPoint p1, ResultPoint p2) {
+ private static int getMaxWidth(RXingResultPoint p1, RXingResultPoint p2) {
if (p1 == null || p2 == null) {
return 0;
}
return (int) Math.abs(p1.getX() - p2.getX());
}
- private static int getMinWidth(ResultPoint p1, ResultPoint p2) {
+ private static int getMinWidth(RXingResultPoint p1, RXingResultPoint p2) {
if (p1 == null || p2 == null) {
return Integer.MAX_VALUE;
}
return (int) Math.abs(p1.getX() - p2.getX());
}
- private static int getMaxCodewordWidth(ResultPoint[] p) {
+ private static int getMaxCodewordWidth(RXingResultPoint[] p) {
return Math.max(
Math.max(getMaxWidth(p[0], p[4]), getMaxWidth(p[6], p[2]) * PDF417Common.MODULES_IN_CODEWORD /
PDF417Common.MODULES_IN_STOP_PATTERN),
@@ -123,7 +123,7 @@ public final class PDF417Reader implements Reader, MultipleBarcodeReader {
PDF417Common.MODULES_IN_STOP_PATTERN));
}
- private static int getMinCodewordWidth(ResultPoint[] p) {
+ private static int getMinCodewordWidth(RXingResultPoint[] p) {
return Math.min(
Math.min(getMinWidth(p[0], p[4]), getMinWidth(p[6], p[2]) * PDF417Common.MODULES_IN_CODEWORD /
PDF417Common.MODULES_IN_STOP_PATTERN),
diff --git a/src/pdf417/PDF417ResultMetadata.java b/src/pdf417/PDF417ResultMetadata.java
index 5684c33..5265d52 100644
--- a/src/pdf417/PDF417ResultMetadata.java
+++ b/src/pdf417/PDF417ResultMetadata.java
@@ -19,7 +19,7 @@ package com.google.zxing.pdf417;
/**
* @author Guenther Grau
*/
-public final class PDF417ResultMetadata {
+public final class PDF417RXingResultMetadata {
private int segmentIndex;
private String fileId;
diff --git a/src/pdf417/decoder/BoundingBox.java b/src/pdf417/decoder/BoundingBox.java
index 624a539..2d30885 100644
--- a/src/pdf417/decoder/BoundingBox.java
+++ b/src/pdf417/decoder/BoundingBox.java
@@ -17,7 +17,7 @@
package com.google.zxing.pdf417.decoder;
import com.google.zxing.NotFoundException;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitMatrix;
/**
@@ -26,31 +26,31 @@ import com.google.zxing.common.BitMatrix;
final class BoundingBox {
private final BitMatrix image;
- private final ResultPoint topLeft;
- private final ResultPoint bottomLeft;
- private final ResultPoint topRight;
- private final ResultPoint bottomRight;
+ private final RXingResultPoint topLeft;
+ private final RXingResultPoint bottomLeft;
+ private final RXingResultPoint topRight;
+ private final RXingResultPoint bottomRight;
private final int minX;
private final int maxX;
private final int minY;
private final int maxY;
BoundingBox(BitMatrix image,
- ResultPoint topLeft,
- ResultPoint bottomLeft,
- ResultPoint topRight,
- ResultPoint bottomRight) throws NotFoundException {
+ RXingResultPoint topLeft,
+ RXingResultPoint bottomLeft,
+ RXingResultPoint topRight,
+ RXingResultPoint bottomRight) throws NotFoundException {
boolean leftUnspecified = topLeft == null || bottomLeft == null;
boolean rightUnspecified = topRight == null || bottomRight == null;
if (leftUnspecified && rightUnspecified) {
throw NotFoundException.getNotFoundInstance();
}
if (leftUnspecified) {
- topLeft = new ResultPoint(0, topRight.getY());
- bottomLeft = new ResultPoint(0, bottomRight.getY());
+ topLeft = new RXingResultPoint(0, topRight.getY());
+ bottomLeft = new RXingResultPoint(0, bottomRight.getY());
} else if (rightUnspecified) {
- topRight = new ResultPoint(image.getWidth() - 1, topLeft.getY());
- bottomRight = new ResultPoint(image.getWidth() - 1, bottomLeft.getY());
+ topRight = new RXingResultPoint(image.getWidth() - 1, topLeft.getY());
+ bottomRight = new RXingResultPoint(image.getWidth() - 1, bottomLeft.getY());
}
this.image = image;
this.topLeft = topLeft;
@@ -86,18 +86,18 @@ final class BoundingBox {
}
BoundingBox addMissingRows(int missingStartRows, int missingEndRows, boolean isLeft) throws NotFoundException {
- ResultPoint newTopLeft = topLeft;
- ResultPoint newBottomLeft = bottomLeft;
- ResultPoint newTopRight = topRight;
- ResultPoint newBottomRight = bottomRight;
+ RXingResultPoint newTopLeft = topLeft;
+ RXingResultPoint newBottomLeft = bottomLeft;
+ RXingResultPoint newTopRight = topRight;
+ RXingResultPoint newBottomRight = bottomRight;
if (missingStartRows > 0) {
- ResultPoint top = isLeft ? topLeft : topRight;
+ RXingResultPoint top = isLeft ? topLeft : topRight;
int newMinY = (int) top.getY() - missingStartRows;
if (newMinY < 0) {
newMinY = 0;
}
- ResultPoint newTop = new ResultPoint(top.getX(), newMinY);
+ RXingResultPoint newTop = new RXingResultPoint(top.getX(), newMinY);
if (isLeft) {
newTopLeft = newTop;
} else {
@@ -106,12 +106,12 @@ final class BoundingBox {
}
if (missingEndRows > 0) {
- ResultPoint bottom = isLeft ? bottomLeft : bottomRight;
+ RXingResultPoint bottom = isLeft ? bottomLeft : bottomRight;
int newMaxY = (int) bottom.getY() + missingEndRows;
if (newMaxY >= image.getHeight()) {
newMaxY = image.getHeight() - 1;
}
- ResultPoint newBottom = new ResultPoint(bottom.getX(), newMaxY);
+ RXingResultPoint newBottom = new RXingResultPoint(bottom.getX(), newMaxY);
if (isLeft) {
newBottomLeft = newBottom;
} else {
@@ -138,19 +138,19 @@ final class BoundingBox {
return maxY;
}
- ResultPoint getTopLeft() {
+ RXingResultPoint getTopLeft() {
return topLeft;
}
- ResultPoint getTopRight() {
+ RXingResultPoint getTopRight() {
return topRight;
}
- ResultPoint getBottomLeft() {
+ RXingResultPoint getBottomLeft() {
return bottomLeft;
}
- ResultPoint getBottomRight() {
+ RXingResultPoint getBottomRight() {
return bottomRight;
}
diff --git a/src/pdf417/decoder/DecodedBitStreamParser.java b/src/pdf417/decoder/DecodedBitStreamParser.java
index 56a7e2e..fcf790a 100644
--- a/src/pdf417/decoder/DecodedBitStreamParser.java
+++ b/src/pdf417/decoder/DecodedBitStreamParser.java
@@ -18,8 +18,8 @@ package com.google.zxing.pdf417.decoder;
import com.google.zxing.FormatException;
import com.google.zxing.common.ECIStringBuilder;
-import com.google.zxing.common.DecoderResult;
-import com.google.zxing.pdf417.PDF417ResultMetadata;
+import com.google.zxing.common.DecoderRXingResult;
+import com.google.zxing.pdf417.PDF417RXingResultMetadata;
import java.math.BigInteger;
import java.util.Arrays;
@@ -97,10 +97,10 @@ final class DecodedBitStreamParser {
private DecodedBitStreamParser() {
}
- static DecoderResult decode(int[] codewords, String ecLevel) throws FormatException {
+ static DecoderRXingResult decode(int[] codewords, String ecLevel) throws FormatException {
ECIStringBuilder result = new ECIStringBuilder(codewords.length * 2);
int codeIndex = textCompaction(codewords, 1, result);
- PDF417ResultMetadata resultMetadata = new PDF417ResultMetadata();
+ PDF417RXingResultMetadata resultMetadata = new PDF417RXingResultMetadata();
while (codeIndex < codewords[0]) {
int code = codewords[codeIndex++];
switch (code) {
@@ -147,13 +147,13 @@ final class DecodedBitStreamParser {
if (result.isEmpty() && resultMetadata.getFileId() == null) {
throw FormatException.getFormatInstance();
}
- DecoderResult decoderResult = new DecoderResult(null, result.toString(), null, ecLevel);
- decoderResult.setOther(resultMetadata);
- return decoderResult;
+ DecoderRXingResult decoderRXingResult = new DecoderRXingResult(null, result.toString(), null, ecLevel);
+ decoderRXingResult.setOther(resultMetadata);
+ return decoderRXingResult;
}
@SuppressWarnings("deprecation")
- static int decodeMacroBlock(int[] codewords, int codeIndex, PDF417ResultMetadata resultMetadata)
+ static int decodeMacroBlock(int[] codewords, int codeIndex, PDF417RXingResultMetadata resultMetadata)
throws FormatException {
if (codeIndex + NUMBER_OF_SEQUENCE_CODEWORDS > codewords[0]) {
// we must have at least two bytes left for the segment index
@@ -681,7 +681,7 @@ final class DecodedBitStreamParser {
1 x 900 power of 5 + 624 x 900 power of 4 + 434 x 900 power of 3 +
632 x 900 power of 2 + 282 x 900 power of 1 + 200 x 900 power of 0 = 1000213298174000
- Remove leading 1 => Result is 000213298174000
+ Remove leading 1 => RXingResult is 000213298174000
*/
private static String decodeBase900toBase10(int[] codewords, int count) throws FormatException {
BigInteger result = BigInteger.ZERO;
diff --git a/src/pdf417/decoder/DetectionResult.java b/src/pdf417/decoder/DetectionResult.java
index 685475b..33179d2 100644
--- a/src/pdf417/decoder/DetectionResult.java
+++ b/src/pdf417/decoder/DetectionResult.java
@@ -23,37 +23,37 @@ import java.util.Formatter;
/**
* @author Guenther Grau
*/
-final class DetectionResult {
+final class DetectionRXingResult {
private static final int ADJUST_ROW_NUMBER_SKIP = 2;
private final BarcodeMetadata barcodeMetadata;
- private final DetectionResultColumn[] detectionResultColumns;
+ private final DetectionRXingResultColumn[] detectionRXingResultColumns;
private BoundingBox boundingBox;
private final int barcodeColumnCount;
- DetectionResult(BarcodeMetadata barcodeMetadata, BoundingBox boundingBox) {
+ DetectionRXingResult(BarcodeMetadata barcodeMetadata, BoundingBox boundingBox) {
this.barcodeMetadata = barcodeMetadata;
this.barcodeColumnCount = barcodeMetadata.getColumnCount();
this.boundingBox = boundingBox;
- detectionResultColumns = new DetectionResultColumn[barcodeColumnCount + 2];
+ detectionRXingResultColumns = new DetectionRXingResultColumn[barcodeColumnCount + 2];
}
- DetectionResultColumn[] getDetectionResultColumns() {
- adjustIndicatorColumnRowNumbers(detectionResultColumns[0]);
- adjustIndicatorColumnRowNumbers(detectionResultColumns[barcodeColumnCount + 1]);
+ DetectionRXingResultColumn[] getDetectionRXingResultColumns() {
+ adjustIndicatorColumnRowNumbers(detectionRXingResultColumns[0]);
+ adjustIndicatorColumnRowNumbers(detectionRXingResultColumns[barcodeColumnCount + 1]);
int unadjustedCodewordCount = PDF417Common.MAX_CODEWORDS_IN_BARCODE;
int previousUnadjustedCount;
do {
previousUnadjustedCount = unadjustedCodewordCount;
unadjustedCodewordCount = adjustRowNumbers();
} while (unadjustedCodewordCount > 0 && unadjustedCodewordCount < previousUnadjustedCount);
- return detectionResultColumns;
+ return detectionRXingResultColumns;
}
- private void adjustIndicatorColumnRowNumbers(DetectionResultColumn detectionResultColumn) {
- if (detectionResultColumn != null) {
- ((DetectionResultRowIndicatorColumn) detectionResultColumn)
+ private void adjustIndicatorColumnRowNumbers(DetectionRXingResultColumn detectionRXingResultColumn) {
+ if (detectionRXingResultColumn != null) {
+ ((DetectionRXingResultRowIndicatorColumn) detectionRXingResultColumn)
.adjustCompleteIndicatorColumnRowNumbers(barcodeMetadata);
}
}
@@ -71,7 +71,7 @@ final class DetectionResult {
return 0;
}
for (int barcodeColumn = 1; barcodeColumn < barcodeColumnCount + 1; barcodeColumn++) {
- Codeword[] codewords = detectionResultColumns[barcodeColumn].getCodewords();
+ Codeword[] codewords = detectionRXingResultColumns[barcodeColumn].getCodewords();
for (int codewordsRow = 0; codewordsRow < codewords.length; codewordsRow++) {
if (codewords[codewordsRow] == null) {
continue;
@@ -95,23 +95,23 @@ final class DetectionResult {
}
private void adjustRowNumbersFromBothRI() {
- if (detectionResultColumns[0] == null || detectionResultColumns[barcodeColumnCount + 1] == null) {
+ if (detectionRXingResultColumns[0] == null || detectionRXingResultColumns[barcodeColumnCount + 1] == null) {
return;
}
- Codeword[] LRIcodewords = detectionResultColumns[0].getCodewords();
- Codeword[] RRIcodewords = detectionResultColumns[barcodeColumnCount + 1].getCodewords();
+ Codeword[] LRIcodewords = detectionRXingResultColumns[0].getCodewords();
+ Codeword[] RRIcodewords = detectionRXingResultColumns[barcodeColumnCount + 1].getCodewords();
for (int codewordsRow = 0; codewordsRow < LRIcodewords.length; codewordsRow++) {
if (LRIcodewords[codewordsRow] != null &&
RRIcodewords[codewordsRow] != null &&
LRIcodewords[codewordsRow].getRowNumber() == RRIcodewords[codewordsRow].getRowNumber()) {
for (int barcodeColumn = 1; barcodeColumn <= barcodeColumnCount; barcodeColumn++) {
- Codeword codeword = detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
+ Codeword codeword = detectionRXingResultColumns[barcodeColumn].getCodewords()[codewordsRow];
if (codeword == null) {
continue;
}
codeword.setRowNumber(LRIcodewords[codewordsRow].getRowNumber());
if (!codeword.hasValidRowNumber()) {
- detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow] = null;
+ detectionRXingResultColumns[barcodeColumn].getCodewords()[codewordsRow] = null;
}
}
}
@@ -119,11 +119,11 @@ final class DetectionResult {
}
private int adjustRowNumbersFromRRI() {
- if (detectionResultColumns[barcodeColumnCount + 1] == null) {
+ if (detectionRXingResultColumns[barcodeColumnCount + 1] == null) {
return 0;
}
int unadjustedCount = 0;
- Codeword[] codewords = detectionResultColumns[barcodeColumnCount + 1].getCodewords();
+ Codeword[] codewords = detectionRXingResultColumns[barcodeColumnCount + 1].getCodewords();
for (int codewordsRow = 0; codewordsRow < codewords.length; codewordsRow++) {
if (codewords[codewordsRow] == null) {
continue;
@@ -133,7 +133,7 @@ final class DetectionResult {
for (int barcodeColumn = barcodeColumnCount + 1;
barcodeColumn > 0 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP;
barcodeColumn--) {
- Codeword codeword = detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
+ Codeword codeword = detectionRXingResultColumns[barcodeColumn].getCodewords()[codewordsRow];
if (codeword != null) {
invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);
if (!codeword.hasValidRowNumber()) {
@@ -146,11 +146,11 @@ final class DetectionResult {
}
private int adjustRowNumbersFromLRI() {
- if (detectionResultColumns[0] == null) {
+ if (detectionRXingResultColumns[0] == null) {
return 0;
}
int unadjustedCount = 0;
- Codeword[] codewords = detectionResultColumns[0].getCodewords();
+ Codeword[] codewords = detectionRXingResultColumns[0].getCodewords();
for (int codewordsRow = 0; codewordsRow < codewords.length; codewordsRow++) {
if (codewords[codewordsRow] == null) {
continue;
@@ -160,7 +160,7 @@ final class DetectionResult {
for (int barcodeColumn = 1;
barcodeColumn < barcodeColumnCount + 1 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP;
barcodeColumn++) {
- Codeword codeword = detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
+ Codeword codeword = detectionRXingResultColumns[barcodeColumn].getCodewords()[codewordsRow];
if (codeword != null) {
invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);
if (!codeword.hasValidRowNumber()) {
@@ -189,10 +189,10 @@ final class DetectionResult {
private void adjustRowNumbers(int barcodeColumn, int codewordsRow, Codeword[] codewords) {
Codeword codeword = codewords[codewordsRow];
- Codeword[] previousColumnCodewords = detectionResultColumns[barcodeColumn - 1].getCodewords();
+ Codeword[] previousColumnCodewords = detectionRXingResultColumns[barcodeColumn - 1].getCodewords();
Codeword[] nextColumnCodewords = previousColumnCodewords;
- if (detectionResultColumns[barcodeColumn + 1] != null) {
- nextColumnCodewords = detectionResultColumns[barcodeColumn + 1].getCodewords();
+ if (detectionRXingResultColumns[barcodeColumn + 1] != null) {
+ nextColumnCodewords = detectionRXingResultColumns[barcodeColumn + 1].getCodewords();
}
Codeword[] otherCodewords = new Codeword[14];
@@ -261,29 +261,29 @@ final class DetectionResult {
return boundingBox;
}
- void setDetectionResultColumn(int barcodeColumn, DetectionResultColumn detectionResultColumn) {
- detectionResultColumns[barcodeColumn] = detectionResultColumn;
+ void setDetectionRXingResultColumn(int barcodeColumn, DetectionRXingResultColumn detectionRXingResultColumn) {
+ detectionRXingResultColumns[barcodeColumn] = detectionRXingResultColumn;
}
- DetectionResultColumn getDetectionResultColumn(int barcodeColumn) {
- return detectionResultColumns[barcodeColumn];
+ DetectionRXingResultColumn getDetectionRXingResultColumn(int barcodeColumn) {
+ return detectionRXingResultColumns[barcodeColumn];
}
@Override
public String toString() {
- DetectionResultColumn rowIndicatorColumn = detectionResultColumns[0];
+ DetectionRXingResultColumn rowIndicatorColumn = detectionRXingResultColumns[0];
if (rowIndicatorColumn == null) {
- rowIndicatorColumn = detectionResultColumns[barcodeColumnCount + 1];
+ rowIndicatorColumn = detectionRXingResultColumns[barcodeColumnCount + 1];
}
try (Formatter formatter = new Formatter()) {
for (int codewordsRow = 0; codewordsRow < rowIndicatorColumn.getCodewords().length; codewordsRow++) {
formatter.format("CW %3d:", codewordsRow);
for (int barcodeColumn = 0; barcodeColumn < barcodeColumnCount + 2; barcodeColumn++) {
- if (detectionResultColumns[barcodeColumn] == null) {
+ if (detectionRXingResultColumns[barcodeColumn] == null) {
formatter.format(" | ");
continue;
}
- Codeword codeword = detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
+ Codeword codeword = detectionRXingResultColumns[barcodeColumn].getCodewords()[codewordsRow];
if (codeword == null) {
formatter.format(" | ");
continue;
diff --git a/src/pdf417/decoder/DetectionResultColumn.java b/src/pdf417/decoder/DetectionResultColumn.java
index bcf5119..f4f62ad 100644
--- a/src/pdf417/decoder/DetectionResultColumn.java
+++ b/src/pdf417/decoder/DetectionResultColumn.java
@@ -21,14 +21,14 @@ import java.util.Formatter;
/**
* @author Guenther Grau
*/
-class DetectionResultColumn {
+class DetectionRXingResultColumn {
private static final int MAX_NEARBY_DISTANCE = 5;
private final BoundingBox boundingBox;
private final Codeword[] codewords;
- DetectionResultColumn(BoundingBox boundingBox) {
+ DetectionRXingResultColumn(BoundingBox boundingBox) {
this.boundingBox = new BoundingBox(boundingBox);
codewords = new Codeword[boundingBox.getMaxY() - boundingBox.getMinY() + 1];
}
diff --git a/src/pdf417/decoder/DetectionResultRowIndicatorColumn.java b/src/pdf417/decoder/DetectionResultRowIndicatorColumn.java
index becaf37..002d75c 100644
--- a/src/pdf417/decoder/DetectionResultRowIndicatorColumn.java
+++ b/src/pdf417/decoder/DetectionResultRowIndicatorColumn.java
@@ -16,17 +16,17 @@
package com.google.zxing.pdf417.decoder;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.pdf417.PDF417Common;
/**
* @author Guenther Grau
*/
-final class DetectionResultRowIndicatorColumn extends DetectionResultColumn {
+final class DetectionRXingResultRowIndicatorColumn extends DetectionRXingResultColumn {
private final boolean isLeft;
- DetectionResultRowIndicatorColumn(BoundingBox boundingBox, boolean isLeft) {
+ DetectionRXingResultRowIndicatorColumn(BoundingBox boundingBox, boolean isLeft) {
super(boundingBox);
this.isLeft = isLeft;
}
@@ -48,8 +48,8 @@ final class DetectionResultRowIndicatorColumn extends DetectionResultColumn {
setRowNumbers();
removeIncorrectCodewords(codewords, barcodeMetadata);
BoundingBox boundingBox = getBoundingBox();
- ResultPoint top = isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
- ResultPoint bottom = isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
+ RXingResultPoint top = isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
+ RXingResultPoint bottom = isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
int firstRow = imageRowToCodewordIndex((int) top.getY());
int lastRow = imageRowToCodewordIndex((int) bottom.getY());
// We need to be careful using the average row height. Barcode could be skewed so that we have smaller and
@@ -127,8 +127,8 @@ final class DetectionResultRowIndicatorColumn extends DetectionResultColumn {
// use row height count to make detection of invalid row numbers more reliable
private void adjustIncompleteIndicatorColumnRowNumbers(BarcodeMetadata barcodeMetadata) {
BoundingBox boundingBox = getBoundingBox();
- ResultPoint top = isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
- ResultPoint bottom = isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
+ RXingResultPoint top = isLeft ? boundingBox.getTopLeft() : boundingBox.getTopRight();
+ RXingResultPoint bottom = isLeft ? boundingBox.getBottomLeft() : boundingBox.getBottomRight();
int firstRow = imageRowToCodewordIndex((int) top.getY());
int lastRow = imageRowToCodewordIndex((int) bottom.getY());
//float averageRowHeight = (lastRow - firstRow) / (float) barcodeMetadata.getRowCount();
diff --git a/src/pdf417/decoder/PDF417ScanningDecoder.java b/src/pdf417/decoder/PDF417ScanningDecoder.java
index 9248193..70796c9 100644
--- a/src/pdf417/decoder/PDF417ScanningDecoder.java
+++ b/src/pdf417/decoder/PDF417ScanningDecoder.java
@@ -19,9 +19,9 @@ package com.google.zxing.pdf417.decoder;
import com.google.zxing.ChecksumException;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.common.DecoderRXingResult;
import com.google.zxing.common.detector.MathUtils;
import com.google.zxing.pdf417.PDF417Common;
import com.google.zxing.pdf417.decoder.ec.ErrorCorrection;
@@ -49,18 +49,18 @@ public final class PDF417ScanningDecoder {
// columns. That way width can be deducted from the pattern column.
// This approach also allows to detect more details about the barcode, e.g. if a bar type (white or black) is wider
// than it should be. This can happen if the scanner used a bad blackpoint.
- public static DecoderResult decode(BitMatrix image,
- ResultPoint imageTopLeft,
- ResultPoint imageBottomLeft,
- ResultPoint imageTopRight,
- ResultPoint imageBottomRight,
+ public static DecoderRXingResult decode(BitMatrix image,
+ RXingResultPoint imageTopLeft,
+ RXingResultPoint imageBottomLeft,
+ RXingResultPoint imageTopRight,
+ RXingResultPoint imageBottomRight,
int minCodewordWidth,
int maxCodewordWidth)
throws NotFoundException, FormatException, ChecksumException {
BoundingBox boundingBox = new BoundingBox(image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight);
- DetectionResultRowIndicatorColumn leftRowIndicatorColumn = null;
- DetectionResultRowIndicatorColumn rightRowIndicatorColumn = null;
- DetectionResult detectionResult;
+ DetectionRXingResultRowIndicatorColumn leftRowIndicatorColumn = null;
+ DetectionRXingResultRowIndicatorColumn rightRowIndicatorColumn = null;
+ DetectionRXingResult detectionRXingResult;
for (boolean firstPass = true; ; firstPass = false) {
if (imageTopLeft != null) {
leftRowIndicatorColumn = getRowIndicatorColumn(image, boundingBox, imageTopLeft, true, minCodewordWidth,
@@ -70,11 +70,11 @@ public final class PDF417ScanningDecoder {
rightRowIndicatorColumn = getRowIndicatorColumn(image, boundingBox, imageTopRight, false, minCodewordWidth,
maxCodewordWidth);
}
- detectionResult = merge(leftRowIndicatorColumn, rightRowIndicatorColumn);
- if (detectionResult == null) {
+ detectionRXingResult = merge(leftRowIndicatorColumn, rightRowIndicatorColumn);
+ if (detectionRXingResult == null) {
throw NotFoundException.getNotFoundInstance();
}
- BoundingBox resultBox = detectionResult.getBoundingBox();
+ BoundingBox resultBox = detectionRXingResult.getBoundingBox();
if (firstPass && resultBox != null &&
(resultBox.getMinY() < boundingBox.getMinY() || resultBox.getMaxY() > boundingBox.getMaxY())) {
boundingBox = resultBox;
@@ -82,30 +82,30 @@ public final class PDF417ScanningDecoder {
break;
}
}
- detectionResult.setBoundingBox(boundingBox);
- int maxBarcodeColumn = detectionResult.getBarcodeColumnCount() + 1;
- detectionResult.setDetectionResultColumn(0, leftRowIndicatorColumn);
- detectionResult.setDetectionResultColumn(maxBarcodeColumn, rightRowIndicatorColumn);
+ detectionRXingResult.setBoundingBox(boundingBox);
+ int maxBarcodeColumn = detectionRXingResult.getBarcodeColumnCount() + 1;
+ detectionRXingResult.setDetectionRXingResultColumn(0, leftRowIndicatorColumn);
+ detectionRXingResult.setDetectionRXingResultColumn(maxBarcodeColumn, rightRowIndicatorColumn);
boolean leftToRight = leftRowIndicatorColumn != null;
for (int barcodeColumnCount = 1; barcodeColumnCount <= maxBarcodeColumn; barcodeColumnCount++) {
int barcodeColumn = leftToRight ? barcodeColumnCount : maxBarcodeColumn - barcodeColumnCount;
- if (detectionResult.getDetectionResultColumn(barcodeColumn) != null) {
+ if (detectionRXingResult.getDetectionRXingResultColumn(barcodeColumn) != null) {
// This will be the case for the opposite row indicator column, which doesn't need to be decoded again.
continue;
}
- DetectionResultColumn detectionResultColumn;
+ DetectionRXingResultColumn detectionRXingResultColumn;
if (barcodeColumn == 0 || barcodeColumn == maxBarcodeColumn) {
- detectionResultColumn = new DetectionResultRowIndicatorColumn(boundingBox, barcodeColumn == 0);
+ detectionRXingResultColumn = new DetectionRXingResultRowIndicatorColumn(boundingBox, barcodeColumn == 0);
} else {
- detectionResultColumn = new DetectionResultColumn(boundingBox);
+ detectionRXingResultColumn = new DetectionRXingResultColumn(boundingBox);
}
- detectionResult.setDetectionResultColumn(barcodeColumn, detectionResultColumn);
+ detectionRXingResult.setDetectionRXingResultColumn(barcodeColumn, detectionRXingResultColumn);
int startColumn = -1;
int previousStartColumn = startColumn;
// TODO start at a row for which we know the start position, then detect upwards and downwards from there.
for (int imageRow = boundingBox.getMinY(); imageRow <= boundingBox.getMaxY(); imageRow++) {
- startColumn = getStartColumn(detectionResult, barcodeColumn, imageRow, leftToRight);
+ startColumn = getStartColumn(detectionRXingResult, barcodeColumn, imageRow, leftToRight);
if (startColumn < 0 || startColumn > boundingBox.getMaxX()) {
if (previousStartColumn == -1) {
continue;
@@ -115,18 +115,18 @@ public final class PDF417ScanningDecoder {
Codeword codeword = detectCodeword(image, boundingBox.getMinX(), boundingBox.getMaxX(), leftToRight,
startColumn, imageRow, minCodewordWidth, maxCodewordWidth);
if (codeword != null) {
- detectionResultColumn.setCodeword(imageRow, codeword);
+ detectionRXingResultColumn.setCodeword(imageRow, codeword);
previousStartColumn = startColumn;
minCodewordWidth = Math.min(minCodewordWidth, codeword.getWidth());
maxCodewordWidth = Math.max(maxCodewordWidth, codeword.getWidth());
}
}
}
- return createDecoderResult(detectionResult);
+ return createDecoderRXingResult(detectionRXingResult);
}
- private static DetectionResult merge(DetectionResultRowIndicatorColumn leftRowIndicatorColumn,
- DetectionResultRowIndicatorColumn rightRowIndicatorColumn)
+ private static DetectionRXingResult merge(DetectionRXingResultRowIndicatorColumn leftRowIndicatorColumn,
+ DetectionRXingResultRowIndicatorColumn rightRowIndicatorColumn)
throws NotFoundException {
if (leftRowIndicatorColumn == null && rightRowIndicatorColumn == null) {
return null;
@@ -137,10 +137,10 @@ public final class PDF417ScanningDecoder {
}
BoundingBox boundingBox = BoundingBox.merge(adjustBoundingBox(leftRowIndicatorColumn),
adjustBoundingBox(rightRowIndicatorColumn));
- return new DetectionResult(barcodeMetadata, boundingBox);
+ return new DetectionRXingResult(barcodeMetadata, boundingBox);
}
- private static BoundingBox adjustBoundingBox(DetectionResultRowIndicatorColumn rowIndicatorColumn)
+ private static BoundingBox adjustBoundingBox(DetectionRXingResultRowIndicatorColumn rowIndicatorColumn)
throws NotFoundException {
if (rowIndicatorColumn == null) {
return null;
@@ -183,8 +183,8 @@ public final class PDF417ScanningDecoder {
return maxValue;
}
- private static BarcodeMetadata getBarcodeMetadata(DetectionResultRowIndicatorColumn leftRowIndicatorColumn,
- DetectionResultRowIndicatorColumn rightRowIndicatorColumn) {
+ private static BarcodeMetadata getBarcodeMetadata(DetectionRXingResultRowIndicatorColumn leftRowIndicatorColumn,
+ DetectionRXingResultRowIndicatorColumn rightRowIndicatorColumn) {
BarcodeMetadata leftBarcodeMetadata;
if (leftRowIndicatorColumn == null ||
(leftBarcodeMetadata = leftRowIndicatorColumn.getBarcodeMetadata()) == null) {
@@ -204,13 +204,13 @@ public final class PDF417ScanningDecoder {
return leftBarcodeMetadata;
}
- private static DetectionResultRowIndicatorColumn getRowIndicatorColumn(BitMatrix image,
+ private static DetectionRXingResultRowIndicatorColumn getRowIndicatorColumn(BitMatrix image,
BoundingBox boundingBox,
- ResultPoint startPoint,
+ RXingResultPoint startPoint,
boolean leftToRight,
int minCodewordWidth,
int maxCodewordWidth) {
- DetectionResultRowIndicatorColumn rowIndicatorColumn = new DetectionResultRowIndicatorColumn(boundingBox,
+ DetectionRXingResultRowIndicatorColumn rowIndicatorColumn = new DetectionRXingResultRowIndicatorColumn(boundingBox,
leftToRight);
for (int i = 0; i < 2; i++) {
int increment = i == 0 ? 1 : -1;
@@ -232,13 +232,13 @@ public final class PDF417ScanningDecoder {
return rowIndicatorColumn;
}
- private static void adjustCodewordCount(DetectionResult detectionResult, BarcodeValue[][] barcodeMatrix)
+ private static void adjustCodewordCount(DetectionRXingResult detectionRXingResult, BarcodeValue[][] barcodeMatrix)
throws NotFoundException {
BarcodeValue barcodeMatrix01 = barcodeMatrix[0][1];
int[] numberOfCodewords = barcodeMatrix01.getValue();
- int calculatedNumberOfCodewords = detectionResult.getBarcodeColumnCount() *
- detectionResult.getBarcodeRowCount() -
- getNumberOfECCodeWords(detectionResult.getBarcodeECLevel());
+ int calculatedNumberOfCodewords = detectionRXingResult.getBarcodeColumnCount() *
+ detectionRXingResult.getBarcodeRowCount() -
+ getNumberOfECCodeWords(detectionRXingResult.getBarcodeECLevel());
if (numberOfCodewords.length == 0) {
if (calculatedNumberOfCodewords < 1 || calculatedNumberOfCodewords > PDF417Common.MAX_CODEWORDS_IN_BARCODE) {
throw NotFoundException.getNotFoundInstance();
@@ -252,18 +252,18 @@ public final class PDF417ScanningDecoder {
}
}
- private static DecoderResult createDecoderResult(DetectionResult detectionResult) throws FormatException,
+ private static DecoderRXingResult createDecoderRXingResult(DetectionRXingResult detectionRXingResult) throws FormatException,
ChecksumException, NotFoundException {
- BarcodeValue[][] barcodeMatrix = createBarcodeMatrix(detectionResult);
- adjustCodewordCount(detectionResult, barcodeMatrix);
+ BarcodeValue[][] barcodeMatrix = createBarcodeMatrix(detectionRXingResult);
+ adjustCodewordCount(detectionRXingResult, barcodeMatrix);
Collection erasures = new ArrayList<>();
- int[] codewords = new int[detectionResult.getBarcodeRowCount() * detectionResult.getBarcodeColumnCount()];
+ int[] codewords = new int[detectionRXingResult.getBarcodeRowCount() * detectionRXingResult.getBarcodeColumnCount()];
List ambiguousIndexValuesList = new ArrayList<>();
Collection ambiguousIndexesList = new ArrayList<>();
- for (int row = 0; row < detectionResult.getBarcodeRowCount(); row++) {
- for (int column = 0; column < detectionResult.getBarcodeColumnCount(); column++) {
+ for (int row = 0; row < detectionRXingResult.getBarcodeRowCount(); row++) {
+ for (int column = 0; column < detectionRXingResult.getBarcodeColumnCount(); column++) {
int[] values = barcodeMatrix[row][column + 1].getValue();
- int codewordIndex = row * detectionResult.getBarcodeColumnCount() + column;
+ int codewordIndex = row * detectionRXingResult.getBarcodeColumnCount() + column;
if (values.length == 0) {
erasures.add(codewordIndex);
} else if (values.length == 1) {
@@ -278,7 +278,7 @@ public final class PDF417ScanningDecoder {
for (int i = 0; i < ambiguousIndexValues.length; i++) {
ambiguousIndexValues[i] = ambiguousIndexValuesList.get(i);
}
- return createDecoderResultFromAmbiguousValues(detectionResult.getBarcodeECLevel(), codewords,
+ return createDecoderRXingResultFromAmbiguousValues(detectionRXingResult.getBarcodeECLevel(), codewords,
PDF417Common.toIntArray(erasures), PDF417Common.toIntArray(ambiguousIndexesList), ambiguousIndexValues);
}
@@ -295,7 +295,7 @@ public final class PDF417ScanningDecoder {
* @param ambiguousIndexValues two dimensional array that contains the ambiguous values. The first dimension must
* be the same length as the ambiguousIndexes array
*/
- private static DecoderResult createDecoderResultFromAmbiguousValues(int ecLevel,
+ private static DecoderRXingResult createDecoderRXingResultFromAmbiguousValues(int ecLevel,
int[] codewords,
int[] erasureArray,
int[] ambiguousIndexes,
@@ -331,9 +331,9 @@ public final class PDF417ScanningDecoder {
throw ChecksumException.getChecksumInstance();
}
- private static BarcodeValue[][] createBarcodeMatrix(DetectionResult detectionResult) {
+ private static BarcodeValue[][] createBarcodeMatrix(DetectionRXingResult detectionRXingResult) {
BarcodeValue[][] barcodeMatrix =
- new BarcodeValue[detectionResult.getBarcodeRowCount()][detectionResult.getBarcodeColumnCount() + 2];
+ new BarcodeValue[detectionRXingResult.getBarcodeRowCount()][detectionRXingResult.getBarcodeColumnCount() + 2];
for (int row = 0; row < barcodeMatrix.length; row++) {
for (int column = 0; column < barcodeMatrix[row].length; column++) {
barcodeMatrix[row][column] = new BarcodeValue();
@@ -341,9 +341,9 @@ public final class PDF417ScanningDecoder {
}
int column = 0;
- for (DetectionResultColumn detectionResultColumn : detectionResult.getDetectionResultColumns()) {
- if (detectionResultColumn != null) {
- for (Codeword codeword : detectionResultColumn.getCodewords()) {
+ for (DetectionRXingResultColumn detectionRXingResultColumn : detectionRXingResult.getDetectionRXingResultColumns()) {
+ if (detectionRXingResultColumn != null) {
+ for (Codeword codeword : detectionRXingResultColumn.getCodewords()) {
if (codeword != null) {
int rowNumber = codeword.getRowNumber();
if (rowNumber >= 0) {
@@ -361,37 +361,37 @@ public final class PDF417ScanningDecoder {
return barcodeMatrix;
}
- private static boolean isValidBarcodeColumn(DetectionResult detectionResult, int barcodeColumn) {
- return barcodeColumn >= 0 && barcodeColumn <= detectionResult.getBarcodeColumnCount() + 1;
+ private static boolean isValidBarcodeColumn(DetectionRXingResult detectionRXingResult, int barcodeColumn) {
+ return barcodeColumn >= 0 && barcodeColumn <= detectionRXingResult.getBarcodeColumnCount() + 1;
}
- private static int getStartColumn(DetectionResult detectionResult,
+ private static int getStartColumn(DetectionRXingResult detectionRXingResult,
int barcodeColumn,
int imageRow,
boolean leftToRight) {
int offset = leftToRight ? 1 : -1;
Codeword codeword = null;
- if (isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {
- codeword = detectionResult.getDetectionResultColumn(barcodeColumn - offset).getCodeword(imageRow);
+ if (isValidBarcodeColumn(detectionRXingResult, barcodeColumn - offset)) {
+ codeword = detectionRXingResult.getDetectionRXingResultColumn(barcodeColumn - offset).getCodeword(imageRow);
}
if (codeword != null) {
return leftToRight ? codeword.getEndX() : codeword.getStartX();
}
- codeword = detectionResult.getDetectionResultColumn(barcodeColumn).getCodewordNearby(imageRow);
+ codeword = detectionRXingResult.getDetectionRXingResultColumn(barcodeColumn).getCodewordNearby(imageRow);
if (codeword != null) {
return leftToRight ? codeword.getStartX() : codeword.getEndX();
}
- if (isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {
- codeword = detectionResult.getDetectionResultColumn(barcodeColumn - offset).getCodewordNearby(imageRow);
+ if (isValidBarcodeColumn(detectionRXingResult, barcodeColumn - offset)) {
+ codeword = detectionRXingResult.getDetectionRXingResultColumn(barcodeColumn - offset).getCodewordNearby(imageRow);
}
if (codeword != null) {
return leftToRight ? codeword.getEndX() : codeword.getStartX();
}
int skippedColumns = 0;
- while (isValidBarcodeColumn(detectionResult, barcodeColumn - offset)) {
+ while (isValidBarcodeColumn(detectionRXingResult, barcodeColumn - offset)) {
barcodeColumn -= offset;
- for (Codeword previousRowCodeword : detectionResult.getDetectionResultColumn(barcodeColumn).getCodewords()) {
+ for (Codeword previousRowCodeword : detectionRXingResult.getDetectionRXingResultColumn(barcodeColumn).getCodewords()) {
if (previousRowCodeword != null) {
return (leftToRight ? previousRowCodeword.getEndX() : previousRowCodeword.getStartX()) +
offset *
@@ -401,7 +401,7 @@ public final class PDF417ScanningDecoder {
}
skippedColumns++;
}
- return leftToRight ? detectionResult.getBoundingBox().getMinX() : detectionResult.getBoundingBox().getMaxX();
+ return leftToRight ? detectionRXingResult.getBoundingBox().getMinX() : detectionRXingResult.getBoundingBox().getMaxX();
}
private static Codeword detectCodeword(BitMatrix image,
@@ -523,7 +523,7 @@ public final class PDF417ScanningDecoder {
codewordSize <= maxCodewordWidth + CODEWORD_SKEW_SIZE;
}
- private static DecoderResult decodeCodewords(int[] codewords, int ecLevel, int[] erasures) throws FormatException,
+ private static DecoderRXingResult decodeCodewords(int[] codewords, int ecLevel, int[] erasures) throws FormatException,
ChecksumException {
if (codewords.length == 0) {
throw FormatException.getFormatInstance();
@@ -534,10 +534,10 @@ public final class PDF417ScanningDecoder {
verifyCodewordCount(codewords, numECCodewords);
// Decode the codewords
- DecoderResult decoderResult = DecodedBitStreamParser.decode(codewords, String.valueOf(ecLevel));
- decoderResult.setErrorsCorrected(correctedErrorsCount);
- decoderResult.setErasures(erasures.length);
- return decoderResult;
+ DecoderRXingResult decoderRXingResult = DecodedBitStreamParser.decode(codewords, String.valueOf(ecLevel));
+ decoderRXingResult.setErrorsCorrected(correctedErrorsCount);
+ decoderRXingResult.setErasures(erasures.length);
+ return decoderRXingResult;
}
/**
diff --git a/src/pdf417/detector/Detector.java b/src/pdf417/detector/Detector.java
index 8b771a5..b82415f 100644
--- a/src/pdf417/detector/Detector.java
+++ b/src/pdf417/detector/Detector.java
@@ -19,7 +19,7 @@ package com.google.zxing.pdf417.detector;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitMatrix;
import java.util.ArrayList;
@@ -69,10 +69,10 @@ public final class Detector {
* @param hints optional hints to detector
* @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will
* be found and returned
- * @return {@link PDF417DetectorResult} encapsulating results of detecting a PDF417 code
+ * @return {@link PDF417DetectorRXingResult} encapsulating results of detecting a PDF417 code
* @throws NotFoundException if no PDF417 Code can be found
*/
- public static PDF417DetectorResult detect(BinaryBitmap image, Map hints, boolean multiple)
+ public static PDF417DetectorRXingResult detect(BinaryBitmap image, Map hints, boolean multiple)
throws NotFoundException {
// TODO detection improvement, tryHarder could try several different luminance thresholds/blackpoints or even
// different binarizers
@@ -81,12 +81,12 @@ public final class Detector {
BitMatrix originalMatrix = image.getBlackMatrix();
for (int rotation : ROTATIONS) {
BitMatrix bitMatrix = applyRotation(originalMatrix, rotation);
- List barcodeCoordinates = detect(multiple, bitMatrix);
+ List barcodeCoordinates = detect(multiple, bitMatrix);
if (!barcodeCoordinates.isEmpty()) {
- return new PDF417DetectorResult(bitMatrix, barcodeCoordinates, rotation);
+ return new PDF417DetectorRXingResult(bitMatrix, barcodeCoordinates, rotation);
}
}
- return new PDF417DetectorResult(originalMatrix, new ArrayList<>(), 0);
+ return new PDF417DetectorRXingResult(originalMatrix, new ArrayList<>(), 0);
}
/**
@@ -110,15 +110,15 @@ public final class Detector {
* @param multiple if true, then the image is searched for multiple codes. If false, then at most one code will
* be found and returned
* @param bitMatrix bit matrix to detect barcodes in
- * @return List of ResultPoint arrays containing the coordinates of found barcodes
+ * @return List of RXingResultPoint arrays containing the coordinates of found barcodes
*/
- private static List detect(boolean multiple, BitMatrix bitMatrix) {
- List barcodeCoordinates = new ArrayList<>();
+ private static List detect(boolean multiple, BitMatrix bitMatrix) {
+ List barcodeCoordinates = new ArrayList<>();
int row = 0;
int column = 0;
boolean foundBarcodeInRow = false;
while (row < bitMatrix.getHeight()) {
- ResultPoint[] vertices = findVertices(bitMatrix, row, column);
+ RXingResultPoint[] vertices = findVertices(bitMatrix, row, column);
if (vertices[0] == null && vertices[3] == null) {
if (!foundBarcodeInRow) {
@@ -129,7 +129,7 @@ public final class Detector {
// below the lowest barcode we found so far.
foundBarcodeInRow = false;
column = 0;
- for (ResultPoint[] barcodeCoordinate : barcodeCoordinates) {
+ for (RXingResultPoint[] barcodeCoordinate : barcodeCoordinates) {
if (barcodeCoordinate[1] != null) {
row = (int) Math.max(row, barcodeCoordinate[1].getY());
}
@@ -173,36 +173,36 @@ public final class Detector {
* vertices[6] x, y top right codeword area
* vertices[7] x, y bottom right codeword area
*/
- private static ResultPoint[] findVertices(BitMatrix matrix, int startRow, int startColumn) {
+ private static RXingResultPoint[] findVertices(BitMatrix matrix, int startRow, int startColumn) {
int height = matrix.getHeight();
int width = matrix.getWidth();
- ResultPoint[] result = new ResultPoint[8];
- copyToResult(result, findRowsWithPattern(matrix, height, width, startRow, startColumn, START_PATTERN),
+ RXingResultPoint[] result = new RXingResultPoint[8];
+ copyToRXingResult(result, findRowsWithPattern(matrix, height, width, startRow, startColumn, START_PATTERN),
INDEXES_START_PATTERN);
if (result[4] != null) {
startColumn = (int) result[4].getX();
startRow = (int) result[4].getY();
}
- copyToResult(result, findRowsWithPattern(matrix, height, width, startRow, startColumn, STOP_PATTERN),
+ copyToRXingResult(result, findRowsWithPattern(matrix, height, width, startRow, startColumn, STOP_PATTERN),
INDEXES_STOP_PATTERN);
return result;
}
- private static void copyToResult(ResultPoint[] result, ResultPoint[] tmpResult, int[] destinationIndexes) {
+ private static void copyToRXingResult(RXingResultPoint[] result, RXingResultPoint[] tmpRXingResult, int[] destinationIndexes) {
for (int i = 0; i < destinationIndexes.length; i++) {
- result[destinationIndexes[i]] = tmpResult[i];
+ result[destinationIndexes[i]] = tmpRXingResult[i];
}
}
- private static ResultPoint[] findRowsWithPattern(BitMatrix matrix,
+ private static RXingResultPoint[] findRowsWithPattern(BitMatrix matrix,
int height,
int width,
int startRow,
int startColumn,
int[] pattern) {
- ResultPoint[] result = new ResultPoint[4];
+ RXingResultPoint[] result = new RXingResultPoint[4];
boolean found = false;
int[] counters = new int[pattern.length];
for (; startRow < height; startRow += ROW_STEP) {
@@ -217,8 +217,8 @@ public final class Detector {
break;
}
}
- result[0] = new ResultPoint(loc[0], startRow);
- result[1] = new ResultPoint(loc[1], startRow);
+ result[0] = new RXingResultPoint(loc[0], startRow);
+ result[1] = new RXingResultPoint(loc[1], startRow);
found = true;
break;
}
@@ -248,8 +248,8 @@ public final class Detector {
}
}
stopRow -= skippedRowCount + 1;
- result[2] = new ResultPoint(previousRowLoc[0], stopRow);
- result[3] = new ResultPoint(previousRowLoc[1], stopRow);
+ result[2] = new RXingResultPoint(previousRowLoc[0], stopRow);
+ result[3] = new RXingResultPoint(previousRowLoc[1], stopRow);
}
if (stopRow - startRow < BARCODE_MIN_HEIGHT) {
Arrays.fill(result, null);
diff --git a/src/pdf417/detector/PDF417DetectorResult.java b/src/pdf417/detector/PDF417DetectorResult.java
index 7aa82c5..f4893b3 100644
--- a/src/pdf417/detector/PDF417DetectorResult.java
+++ b/src/pdf417/detector/PDF417DetectorResult.java
@@ -16,7 +16,7 @@
package com.google.zxing.pdf417.detector;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitMatrix;
import java.util.List;
@@ -24,19 +24,19 @@ import java.util.List;
/**
* @author Guenther Grau
*/
-public final class PDF417DetectorResult {
+public final class PDF417DetectorRXingResult {
private final BitMatrix bits;
- private final List points;
+ private final List points;
private final int rotation;
- public PDF417DetectorResult(BitMatrix bits, List points, int rotation) {
+ public PDF417DetectorRXingResult(BitMatrix bits, List points, int rotation) {
this.bits = bits;
this.points = points;
this.rotation = rotation;
}
- public PDF417DetectorResult(BitMatrix bits, List points) {
+ public PDF417DetectorRXingResult(BitMatrix bits, List points) {
this(bits, points, 0);
}
@@ -44,7 +44,7 @@ public final class PDF417DetectorResult {
return bits;
}
- public List getPoints() {
+ public List getPoints() {
return points;
}
diff --git a/src/qrcode/QRCodeReader.java b/src/qrcode/QRCodeReader.java
index f6a765f..9165266 100644
--- a/src/qrcode/QRCodeReader.java
+++ b/src/qrcode/QRCodeReader.java
@@ -23,12 +23,12 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.Reader;
-import com.google.zxing.Result;
-import com.google.zxing.ResultMetadataType;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResult;
+import com.google.zxing.RXingResultMetadataType;
+import com.google.zxing.RXingResultPoint;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DecoderResult;
-import com.google.zxing.common.DetectorResult;
+import com.google.zxing.common.DecoderRXingResult;
+import com.google.zxing.common.DetectorRXingResult;
import com.google.zxing.qrcode.decoder.Decoder;
import com.google.zxing.qrcode.decoder.QRCodeDecoderMetaData;
import com.google.zxing.qrcode.detector.Detector;
@@ -43,7 +43,7 @@ import java.util.Map;
*/
public class QRCodeReader implements Reader {
- private static final ResultPoint[] NO_POINTS = new ResultPoint[0];
+ private static final RXingResultPoint[] NO_POINTS = new RXingResultPoint[0];
private final Decoder decoder = new Decoder();
@@ -60,46 +60,46 @@ public class QRCodeReader implements Reader {
* @throws ChecksumException if error correction fails
*/
@Override
- public Result decode(BinaryBitmap image) throws NotFoundException, ChecksumException, FormatException {
+ public RXingResult decode(BinaryBitmap image) throws NotFoundException, ChecksumException, FormatException {
return decode(image, null);
}
@Override
- public final Result decode(BinaryBitmap image, Map hints)
+ public final RXingResult decode(BinaryBitmap image, Map hints)
throws NotFoundException, ChecksumException, FormatException {
- DecoderResult decoderResult;
- ResultPoint[] points;
+ DecoderRXingResult decoderRXingResult;
+ RXingResultPoint[] points;
if (hints != null && hints.containsKey(DecodeHintType.PURE_BARCODE)) {
BitMatrix bits = extractPureBits(image.getBlackMatrix());
- decoderResult = decoder.decode(bits, hints);
+ decoderRXingResult = decoder.decode(bits, hints);
points = NO_POINTS;
} else {
- DetectorResult detectorResult = new Detector(image.getBlackMatrix()).detect(hints);
- decoderResult = decoder.decode(detectorResult.getBits(), hints);
- points = detectorResult.getPoints();
+ DetectorRXingResult detectorRXingResult = new Detector(image.getBlackMatrix()).detect(hints);
+ decoderRXingResult = decoder.decode(detectorRXingResult.getBits(), hints);
+ points = detectorRXingResult.getPoints();
}
// If the code was mirrored: swap the bottom-left and the top-right points.
- if (decoderResult.getOther() instanceof QRCodeDecoderMetaData) {
- ((QRCodeDecoderMetaData) decoderResult.getOther()).applyMirroredCorrection(points);
+ if (decoderRXingResult.getOther() instanceof QRCodeDecoderMetaData) {
+ ((QRCodeDecoderMetaData) decoderRXingResult.getOther()).applyMirroredCorrection(points);
}
- Result result = new Result(decoderResult.getText(), decoderResult.getRawBytes(), points, BarcodeFormat.QR_CODE);
- List byteSegments = decoderResult.getByteSegments();
+ RXingResult result = new RXingResult(decoderRXingResult.getText(), decoderRXingResult.getRawBytes(), points, BarcodeFormat.QR_CODE);
+ List byteSegments = decoderRXingResult.getByteSegments();
if (byteSegments != null) {
- result.putMetadata(ResultMetadataType.BYTE_SEGMENTS, byteSegments);
+ result.putMetadata(RXingResultMetadataType.BYTE_SEGMENTS, byteSegments);
}
- String ecLevel = decoderResult.getECLevel();
+ String ecLevel = decoderRXingResult.getECLevel();
if (ecLevel != null) {
- result.putMetadata(ResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
+ result.putMetadata(RXingResultMetadataType.ERROR_CORRECTION_LEVEL, ecLevel);
}
- if (decoderResult.hasStructuredAppend()) {
- result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_SEQUENCE,
- decoderResult.getStructuredAppendSequenceNumber());
- result.putMetadata(ResultMetadataType.STRUCTURED_APPEND_PARITY,
- decoderResult.getStructuredAppendParity());
+ if (decoderRXingResult.hasStructuredAppend()) {
+ result.putMetadata(RXingResultMetadataType.STRUCTURED_APPEND_SEQUENCE,
+ decoderRXingResult.getStructuredAppendSequenceNumber());
+ result.putMetadata(RXingResultMetadataType.STRUCTURED_APPEND_PARITY,
+ decoderRXingResult.getStructuredAppendParity());
}
- result.putMetadata(ResultMetadataType.SYMBOLOGY_IDENTIFIER, "]Q" + decoderResult.getSymbologyModifier());
+ result.putMetadata(RXingResultMetadataType.SYMBOLOGY_IDENTIFIER, "]Q" + decoderRXingResult.getSymbologyModifier());
return result;
}
diff --git a/src/qrcode/QRCodeWriter.java b/src/qrcode/QRCodeWriter.java
index ce7ee07..50fccc6 100644
--- a/src/qrcode/QRCodeWriter.java
+++ b/src/qrcode/QRCodeWriter.java
@@ -76,12 +76,12 @@ public final class QRCodeWriter implements Writer {
}
QRCode code = Encoder.encode(contents, errorCorrectionLevel, hints);
- return renderResult(code, width, height, quietZone);
+ return renderRXingResult(code, width, height, quietZone);
}
// Note that the input matrix uses 0 == white, 1 == black, while the output matrix uses
// 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).
- private static BitMatrix renderResult(QRCode code, int width, int height, int quietZone) {
+ private static BitMatrix renderRXingResult(QRCode code, int width, int height, int quietZone) {
ByteMatrix input = code.getMatrix();
if (input == null) {
throw new IllegalStateException();
diff --git a/src/qrcode/decoder/DataBlock.java b/src/qrcode/decoder/DataBlock.java
index 8f5cdcb..05f4726 100755
--- a/src/qrcode/decoder/DataBlock.java
+++ b/src/qrcode/decoder/DataBlock.java
@@ -65,12 +65,12 @@ final class DataBlock {
// Now establish DataBlocks of the appropriate size and number of data codewords
DataBlock[] result = new DataBlock[totalBlocks];
- int numResultBlocks = 0;
+ int numRXingResultBlocks = 0;
for (Version.ECB ecBlock : ecBlockArray) {
for (int i = 0; i < ecBlock.getCount(); i++) {
int numDataCodewords = ecBlock.getDataCodewords();
int numBlockCodewords = ecBlocks.getECCodewordsPerBlock() + numDataCodewords;
- result[numResultBlocks++] = new DataBlock(numDataCodewords, new byte[numBlockCodewords]);
+ result[numRXingResultBlocks++] = new DataBlock(numDataCodewords, new byte[numBlockCodewords]);
}
}
@@ -92,18 +92,18 @@ final class DataBlock {
// first fill out as many elements as all of them have
int rawCodewordsOffset = 0;
for (int i = 0; i < shorterBlocksNumDataCodewords; i++) {
- for (int j = 0; j < numResultBlocks; j++) {
+ for (int j = 0; j < numRXingResultBlocks; j++) {
result[j].codewords[i] = rawCodewords[rawCodewordsOffset++];
}
}
// Fill out the last data block in the longer ones
- for (int j = longerBlocksStartAt; j < numResultBlocks; j++) {
+ for (int j = longerBlocksStartAt; j < numRXingResultBlocks; j++) {
result[j].codewords[shorterBlocksNumDataCodewords] = rawCodewords[rawCodewordsOffset++];
}
// Now add in error correction blocks
int max = result[0].codewords.length;
for (int i = shorterBlocksNumDataCodewords; i < max; i++) {
- for (int j = 0; j < numResultBlocks; j++) {
+ for (int j = 0; j < numRXingResultBlocks; j++) {
int iOffset = j < longerBlocksStartAt ? i : i + 1;
result[j].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];
}
diff --git a/src/qrcode/decoder/DecodedBitStreamParser.java b/src/qrcode/decoder/DecodedBitStreamParser.java
index bba9e44..56ef3f3 100644
--- a/src/qrcode/decoder/DecodedBitStreamParser.java
+++ b/src/qrcode/decoder/DecodedBitStreamParser.java
@@ -20,7 +20,7 @@ import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitSource;
import com.google.zxing.common.CharacterSetECI;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.common.DecoderRXingResult;
import com.google.zxing.common.StringUtils;
import java.nio.charset.Charset;
@@ -49,7 +49,7 @@ final class DecodedBitStreamParser {
private DecodedBitStreamParser() {
}
- static DecoderResult decode(byte[] bytes,
+ static DecoderRXingResult decode(byte[] bytes,
Version version,
ErrorCorrectionLevel ecLevel,
Map hints) throws FormatException {
@@ -160,7 +160,7 @@ final class DecodedBitStreamParser {
throw FormatException.getFormatInstance();
}
- return new DecoderResult(bytes,
+ return new DecoderRXingResult(bytes,
result.toString(),
byteSegments.isEmpty() ? null : byteSegments,
ecLevel == null ? null : ecLevel.toString(),
diff --git a/src/qrcode/decoder/Decoder.java b/src/qrcode/decoder/Decoder.java
index 7fcb7d2..65396b2 100644
--- a/src/qrcode/decoder/Decoder.java
+++ b/src/qrcode/decoder/Decoder.java
@@ -20,7 +20,7 @@ import com.google.zxing.ChecksumException;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DecoderResult;
+import com.google.zxing.common.DecoderRXingResult;
import com.google.zxing.common.reedsolomon.GenericGF;
import com.google.zxing.common.reedsolomon.ReedSolomonDecoder;
import com.google.zxing.common.reedsolomon.ReedSolomonException;
@@ -41,7 +41,7 @@ public final class Decoder {
rsDecoder = new ReedSolomonDecoder(GenericGF.QR_CODE_FIELD_256);
}
- public DecoderResult decode(boolean[][] image) throws ChecksumException, FormatException {
+ public DecoderRXingResult decode(boolean[][] image) throws ChecksumException, FormatException {
return decode(image, null);
}
@@ -55,12 +55,12 @@ public final class Decoder {
* @throws FormatException if the QR Code cannot be decoded
* @throws ChecksumException if error correction fails
*/
- public DecoderResult decode(boolean[][] image, Map hints)
+ public DecoderRXingResult decode(boolean[][] image, Map hints)
throws ChecksumException, FormatException {
return decode(BitMatrix.parse(image), hints);
}
- public DecoderResult decode(BitMatrix bits) throws ChecksumException, FormatException {
+ public DecoderRXingResult decode(BitMatrix bits) throws ChecksumException, FormatException {
return decode(bits, null);
}
@@ -73,7 +73,7 @@ public final class Decoder {
* @throws FormatException if the QR Code cannot be decoded
* @throws ChecksumException if error correction fails
*/
- public DecoderResult decode(BitMatrix bits, Map hints)
+ public DecoderRXingResult decode(BitMatrix bits, Map hints)
throws FormatException, ChecksumException {
// Construct a parser and read version, error-correction level
@@ -111,7 +111,7 @@ public final class Decoder {
// Prepare for a mirrored reading.
parser.mirror();
- DecoderResult result = decode(parser, hints);
+ DecoderRXingResult result = decode(parser, hints);
// Success! Notify the caller that the code was mirrored.
result.setOther(new QRCodeDecoderMetaData(true));
@@ -127,7 +127,7 @@ public final class Decoder {
}
}
- private DecoderResult decode(BitMatrixParser parser, Map hints)
+ private DecoderRXingResult decode(BitMatrixParser parser, Map hints)
throws FormatException, ChecksumException {
Version version = parser.readVersion();
ErrorCorrectionLevel ecLevel = parser.readFormatInformation().getErrorCorrectionLevel();
diff --git a/src/qrcode/decoder/QRCodeDecoderMetaData.java b/src/qrcode/decoder/QRCodeDecoderMetaData.java
index 299bb65..600b9be 100644
--- a/src/qrcode/decoder/QRCodeDecoderMetaData.java
+++ b/src/qrcode/decoder/QRCodeDecoderMetaData.java
@@ -16,13 +16,13 @@
package com.google.zxing.qrcode.decoder;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResultPoint;
/**
* Meta-data container for QR Code decoding. Instances of this class may be used to convey information back to the
* decoding caller. Callers are expected to process this.
*
- * @see com.google.zxing.common.DecoderResult#getOther()
+ * @see com.google.zxing.common.DecoderRXingResult#getOther()
*/
public final class QRCodeDecoderMetaData {
@@ -44,11 +44,11 @@ public final class QRCodeDecoderMetaData {
*
* @param points Array of points to apply mirror correction to.
*/
- public void applyMirroredCorrection(ResultPoint[] points) {
+ public void applyMirroredCorrection(RXingResultPoint[] points) {
if (!mirrored || points == null || points.length < 3) {
return;
}
- ResultPoint bottomLeft = points[0];
+ RXingResultPoint bottomLeft = points[0];
points[0] = points[2];
points[2] = bottomLeft;
// No need to 'fix' top-left and alignment pattern.
diff --git a/src/qrcode/detector/AlignmentPattern.java b/src/qrcode/detector/AlignmentPattern.java
index 96d9194..90b6889 100644
--- a/src/qrcode/detector/AlignmentPattern.java
+++ b/src/qrcode/detector/AlignmentPattern.java
@@ -16,7 +16,7 @@
package com.google.zxing.qrcode.detector;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResultPoint;
/**
* Encapsulates an alignment pattern, which are the smaller square patterns found in
@@ -24,7 +24,7 @@ import com.google.zxing.ResultPoint;
*
* @author Sean Owen
*/
-public final class AlignmentPattern extends ResultPoint {
+public final class AlignmentPattern extends RXingResultPoint {
private final float estimatedModuleSize;
diff --git a/src/qrcode/detector/AlignmentPatternFinder.java b/src/qrcode/detector/AlignmentPatternFinder.java
index c4f9aa0..bace252 100644
--- a/src/qrcode/detector/AlignmentPatternFinder.java
+++ b/src/qrcode/detector/AlignmentPatternFinder.java
@@ -17,7 +17,7 @@
package com.google.zxing.qrcode.detector;
import com.google.zxing.NotFoundException;
-import com.google.zxing.ResultPointCallback;
+import com.google.zxing.RXingResultPointCallback;
import com.google.zxing.common.BitMatrix;
import java.util.ArrayList;
@@ -47,7 +47,7 @@ final class AlignmentPatternFinder {
private final int height;
private final float moduleSize;
private final int[] crossCheckStateCount;
- private final ResultPointCallback resultPointCallback;
+ private final RXingResultPointCallback resultPointCallback;
/**
*
Creates a finder that will look in a portion of the whole image.
@@ -65,7 +65,7 @@ final class AlignmentPatternFinder {
int width,
int height,
float moduleSize,
- ResultPointCallback resultPointCallback) {
+ RXingResultPointCallback resultPointCallback) {
this.image = image;
this.possibleCenters = new ArrayList<>(5);
this.startX = startX;
@@ -268,7 +268,7 @@ final class AlignmentPatternFinder {
AlignmentPattern point = new AlignmentPattern(centerJ, centerI, estimatedModuleSize);
possibleCenters.add(point);
if (resultPointCallback != null) {
- resultPointCallback.foundPossibleResultPoint(point);
+ resultPointCallback.foundPossibleRXingResultPoint(point);
}
}
return null;
diff --git a/src/qrcode/detector/Detector.java b/src/qrcode/detector/Detector.java
index 9648883..0ad67ea 100644
--- a/src/qrcode/detector/Detector.java
+++ b/src/qrcode/detector/Detector.java
@@ -19,10 +19,10 @@ package com.google.zxing.qrcode.detector;
import com.google.zxing.DecodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
-import com.google.zxing.ResultPoint;
-import com.google.zxing.ResultPointCallback;
+import com.google.zxing.RXingResultPoint;
+import com.google.zxing.RXingResultPointCallback;
import com.google.zxing.common.BitMatrix;
-import com.google.zxing.common.DetectorResult;
+import com.google.zxing.common.DetectorRXingResult;
import com.google.zxing.common.GridSampler;
import com.google.zxing.common.PerspectiveTransform;
import com.google.zxing.common.detector.MathUtils;
@@ -39,7 +39,7 @@ import java.util.Map;
public class Detector {
private final BitMatrix image;
- private ResultPointCallback resultPointCallback;
+ private RXingResultPointCallback resultPointCallback;
public Detector(BitMatrix image) {
this.image = image;
@@ -49,18 +49,18 @@ public class Detector {
return image;
}
- protected final ResultPointCallback getResultPointCallback() {
+ protected final RXingResultPointCallback getRXingResultPointCallback() {
return resultPointCallback;
}
/**
* Detects a QR Code in an image.
*
- * @return {@link DetectorResult} encapsulating results of detecting a QR Code
+ * @return {@link DetectorRXingResult} encapsulating results of detecting a QR Code
* @throws NotFoundException if QR Code cannot be found
* @throws FormatException if a QR Code cannot be decoded
*/
- public DetectorResult detect() throws NotFoundException, FormatException {
+ public DetectorRXingResult detect() throws NotFoundException, FormatException {
return detect(null);
}
@@ -68,14 +68,14 @@ public class Detector {
* Detects a QR Code in an image.
*
* @param hints optional hints to detector
- * @return {@link DetectorResult} encapsulating results of detecting a QR Code
+ * @return {@link DetectorRXingResult} encapsulating results of detecting a QR Code
* @throws NotFoundException if QR Code cannot be found
* @throws FormatException if a QR Code cannot be decoded
*/
- public final DetectorResult detect(Map hints) throws NotFoundException, FormatException {
+ public final DetectorRXingResult detect(Map hints) throws NotFoundException, FormatException {
resultPointCallback = hints == null ? null :
- (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
+ (RXingResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
FinderPatternFinder finder = new FinderPatternFinder(image, resultPointCallback);
FinderPatternInfo info = finder.find(hints);
@@ -83,7 +83,7 @@ public class Detector {
return processFinderPatternInfo(info);
}
- protected final DetectorResult processFinderPatternInfo(FinderPatternInfo info)
+ protected final DetectorRXingResult processFinderPatternInfo(FinderPatternInfo info)
throws NotFoundException, FormatException {
FinderPattern topLeft = info.getTopLeft();
@@ -132,19 +132,19 @@ public class Detector {
BitMatrix bits = sampleGrid(image, transform, dimension);
- ResultPoint[] points;
+ RXingResultPoint[] points;
if (alignmentPattern == null) {
- points = new ResultPoint[]{bottomLeft, topLeft, topRight};
+ points = new RXingResultPoint[]{bottomLeft, topLeft, topRight};
} else {
- points = new ResultPoint[]{bottomLeft, topLeft, topRight, alignmentPattern};
+ points = new RXingResultPoint[]{bottomLeft, topLeft, topRight, alignmentPattern};
}
- return new DetectorResult(bits, points);
+ return new DetectorRXingResult(bits, points);
}
- private static PerspectiveTransform createTransform(ResultPoint topLeft,
- ResultPoint topRight,
- ResultPoint bottomLeft,
- ResultPoint alignmentPattern,
+ private static PerspectiveTransform createTransform(RXingResultPoint topLeft,
+ RXingResultPoint topRight,
+ RXingResultPoint bottomLeft,
+ RXingResultPoint alignmentPattern,
int dimension) {
float dimMinusThree = dimension - 3.5f;
float bottomRightX;
@@ -195,12 +195,12 @@ public class Detector {
* Computes the dimension (number of modules on a size) of the QR Code based on the position
* of the finder patterns and estimated module size.
*/
- private static int computeDimension(ResultPoint topLeft,
- ResultPoint topRight,
- ResultPoint bottomLeft,
+ private static int computeDimension(RXingResultPoint topLeft,
+ RXingResultPoint topRight,
+ RXingResultPoint bottomLeft,
float moduleSize) throws NotFoundException {
- int tltrCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, topRight) / moduleSize);
- int tlblCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, bottomLeft) / moduleSize);
+ int tltrCentersDimension = MathUtils.round(RXingResultPoint.distance(topLeft, topRight) / moduleSize);
+ int tlblCentersDimension = MathUtils.round(RXingResultPoint.distance(topLeft, bottomLeft) / moduleSize);
int dimension = ((tltrCentersDimension + tlblCentersDimension) / 2) + 7;
switch (dimension & 0x03) { // mod 4
case 0:
@@ -225,9 +225,9 @@ public class Detector {
* @param bottomLeft detected bottom-left finder pattern center
* @return estimated module size
*/
- protected final float calculateModuleSize(ResultPoint topLeft,
- ResultPoint topRight,
- ResultPoint bottomLeft) {
+ protected final float calculateModuleSize(RXingResultPoint topLeft,
+ RXingResultPoint topRight,
+ RXingResultPoint bottomLeft) {
// Take the average
return (calculateModuleSizeOneWay(topLeft, topRight) +
calculateModuleSizeOneWay(topLeft, bottomLeft)) / 2.0f;
@@ -238,7 +238,7 @@ public class Detector {
* {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the
* width of each, measuring along the axis between their centers.
*/
- private float calculateModuleSizeOneWay(ResultPoint pattern, ResultPoint otherPattern) {
+ private float calculateModuleSizeOneWay(RXingResultPoint pattern, RXingResultPoint otherPattern) {
float moduleSizeEst1 = sizeOfBlackWhiteBlackRunBothWays((int) pattern.getX(),
(int) pattern.getY(),
(int) otherPattern.getX(),
diff --git a/src/qrcode/detector/FinderPattern.java b/src/qrcode/detector/FinderPattern.java
index 7d43833..2c256fa 100644
--- a/src/qrcode/detector/FinderPattern.java
+++ b/src/qrcode/detector/FinderPattern.java
@@ -16,7 +16,7 @@
package com.google.zxing.qrcode.detector;
-import com.google.zxing.ResultPoint;
+import com.google.zxing.RXingResultPoint;
/**
* Encapsulates a finder pattern, which are the three square patterns found in
@@ -25,7 +25,7 @@ import com.google.zxing.ResultPoint;
*
* @author Sean Owen
*/
-public final class FinderPattern extends ResultPoint {
+public final class FinderPattern extends RXingResultPoint {
private final float estimatedModuleSize;
private final int count;
diff --git a/src/qrcode/detector/FinderPatternFinder.java b/src/qrcode/detector/FinderPatternFinder.java
index 2ab3e86..c722fb8 100755
--- a/src/qrcode/detector/FinderPatternFinder.java
+++ b/src/qrcode/detector/FinderPatternFinder.java
@@ -18,8 +18,8 @@ package com.google.zxing.qrcode.detector;
import com.google.zxing.DecodeHintType;
import com.google.zxing.NotFoundException;
-import com.google.zxing.ResultPoint;
-import com.google.zxing.ResultPointCallback;
+import com.google.zxing.RXingResultPoint;
+import com.google.zxing.RXingResultPointCallback;
import com.google.zxing.common.BitMatrix;
import java.io.Serializable;
@@ -48,7 +48,7 @@ public class FinderPatternFinder {
private final List possibleCenters;
private boolean hasSkipped;
private final int[] crossCheckStateCount;
- private final ResultPointCallback resultPointCallback;
+ private final RXingResultPointCallback resultPointCallback;
/**
* Creates a finder that will search the image for three finder patterns.
@@ -59,7 +59,7 @@ public class FinderPatternFinder {
this(image, null);
}
- public FinderPatternFinder(BitMatrix image, ResultPointCallback resultPointCallback) {
+ public FinderPatternFinder(BitMatrix image, RXingResultPointCallback resultPointCallback) {
this.image = image;
this.possibleCenters = new ArrayList<>();
this.crossCheckStateCount = new int[5];
@@ -162,7 +162,7 @@ public class FinderPatternFinder {
}
FinderPattern[] patternInfo = selectBestPatterns();
- ResultPoint.orderBestPatterns(patternInfo);
+ RXingResultPoint.orderBestPatterns(patternInfo);
return new FinderPatternInfo(patternInfo);
}
@@ -529,7 +529,7 @@ public class FinderPatternFinder {
FinderPattern point = new FinderPattern(centerJ, centerI, estimatedModuleSize);
possibleCenters.add(point);
if (resultPointCallback != null) {
- resultPointCallback.foundPossibleResultPoint(point);
+ resultPointCallback.foundPossibleRXingResultPoint(point);
}
}
return true;
@@ -549,7 +549,7 @@ public class FinderPatternFinder {
if (max <= 1) {
return 0;
}
- ResultPoint firstConfirmedCenter = null;
+ RXingResultPoint firstConfirmedCenter = null;
for (FinderPattern center : possibleCenters) {
if (center.getCount() >= CENTER_QUORUM) {
if (firstConfirmedCenter == null) {
diff --git a/src/qrcode/encoder/Encoder.java b/src/qrcode/encoder/Encoder.java
index cc09320..c0f9f58 100644
--- a/src/qrcode/encoder/Encoder.java
+++ b/src/qrcode/encoder/Encoder.java
@@ -98,7 +98,7 @@ public final class Encoder {
mode = Mode.BYTE;
Charset priorityEncoding = encoding.equals(DEFAULT_BYTE_MODE_ENCODING) ? null : encoding;
- MinimalEncoder.ResultList rn = MinimalEncoder.encode(content, null, priorityEncoding, hasGS1FormatHint, ecLevel);
+ MinimalEncoder.RXingResultList rn = MinimalEncoder.encode(content, null, priorityEncoding, hasGS1FormatHint, ecLevel);
headerAndDataBits = new BitArray();
rn.getBits(headerAndDataBits);
diff --git a/src/qrcode/encoder/MinimalEncoder.java b/src/qrcode/encoder/MinimalEncoder.java
index 4de1d0b..3f97fc6 100644
--- a/src/qrcode/encoder/MinimalEncoder.java
+++ b/src/qrcode/encoder/MinimalEncoder.java
@@ -88,7 +88,7 @@ final class MinimalEncoder {
* supported charsets.
* @param isGS1 {@code true} if a FNC1 is to be prepended; {@code false} otherwise
* @param ecLevel The error correction level.
- * @see ResultList#getVersion
+ * @see RXingResultList#getVersion
*/
MinimalEncoder(String stringToEncode, Charset priorityCharset, boolean isGS1, ErrorCorrectionLevel ecLevel) {
this.stringToEncode = stringToEncode;
@@ -102,46 +102,46 @@ final class MinimalEncoder {
*
* @param stringToEncode The string to encode
* @param version The preferred {@link Version}. A minimal version is computed (see
- * {@link ResultList#getVersion method} when the value of the argument is null
+ * {@link RXingResultList#getVersion method} when the value of the argument is null
* @param priorityCharset The preferred {@link Charset}. When the value of the argument is null, the algorithm
* chooses charsets that leads to a minimal representation. Otherwise the algorithm will use the priority
* charset to encode any character in the input that can be encoded by it if the charset is among the
* supported charsets.
* @param isGS1 {@code true} if a FNC1 is to be prepended; {@code false} otherwise
* @param ecLevel The error correction level.
- * @return An instance of {@code ResultList} representing the minimal solution.
- * @see ResultList#getBits
- * @see ResultList#getVersion
- * @see ResultList#getSize
+ * @return An instance of {@code RXingResultList} representing the minimal solution.
+ * @see RXingResultList#getBits
+ * @see RXingResultList#getVersion
+ * @see RXingResultList#getSize
*/
- static ResultList encode(String stringToEncode, Version version, Charset priorityCharset, boolean isGS1,
+ static RXingResultList encode(String stringToEncode, Version version, Charset priorityCharset, boolean isGS1,
ErrorCorrectionLevel ecLevel) throws WriterException {
return new MinimalEncoder(stringToEncode, priorityCharset, isGS1, ecLevel).encode(version);
}
- ResultList encode(Version version) throws WriterException {
+ RXingResultList encode(Version version) throws WriterException {
if (version == null) { // compute minimal encoding trying the three version sizes.
Version[] versions = { getVersion(VersionSize.SMALL),
getVersion(VersionSize.MEDIUM),
getVersion(VersionSize.LARGE) };
- ResultList[] results = { encodeSpecificVersion(versions[0]),
+ RXingResultList[] results = { encodeSpecificVersion(versions[0]),
encodeSpecificVersion(versions[1]),
encodeSpecificVersion(versions[2]) };
int smallestSize = Integer.MAX_VALUE;
- int smallestResult = -1;
+ int smallestRXingResult = -1;
for (int i = 0; i < 3; i++) {
int size = results[i].getSize();
if (Encoder.willFit(size, versions[i], ecLevel) && size < smallestSize) {
smallestSize = size;
- smallestResult = i;
+ smallestRXingResult = i;
}
}
- if (smallestResult < 0) {
+ if (smallestRXingResult < 0) {
throw new WriterException("Data too big for any version");
}
- return results[smallestResult];
+ return results[smallestRXingResult];
} else { // compute minimal encoding for a given version
- ResultList result = encodeSpecificVersion(version);
+ RXingResultList result = encodeSpecificVersion(version);
if (!Encoder.willFit(result.getSize(), getVersion(getVersionSize(result.getVersion())), ecLevel)) {
throw new WriterException("Data too big for version" + version);
}
@@ -248,7 +248,7 @@ final class MinimalEncoder {
!canEncode(Mode.NUMERIC, stringToEncode.charAt(from + 2)) ? 2 : 3, previous, version));
}
}
- ResultList encodeSpecificVersion(Version version) throws WriterException {
+ RXingResultList encodeSpecificVersion(Version version) throws WriterException {
@SuppressWarnings("checkstyle:lineLength")
/* A vertex represents a tuple of a position in the input, a mode and a character encoding where position 0
@@ -399,7 +399,7 @@ final class MinimalEncoder {
if (minimalJ < 0) {
throw new WriterException("Internal error: failed to encode \"" + stringToEncode + "\"");
}
- return new ResultList(version, edges[inputLength][minimalJ][minimalK]);
+ return new RXingResultList(version, edges[inputLength][minimalJ][minimalK]);
}
private final class Edge {
@@ -450,12 +450,12 @@ final class MinimalEncoder {
}
}
- final class ResultList {
+ final class RXingResultList {
- private final List list = new ArrayList<>();
+ private final List list = new ArrayList<>();
private final Version version;
- ResultList(Version version, Edge solution) {
+ RXingResultList(Version version, Edge solution) {
int length = 0;
Edge current = solution;
boolean containsECI = false;
@@ -473,12 +473,12 @@ final class MinimalEncoder {
}
if (previous == null || previous.mode != current.mode || needECI) {
- list.add(0, new ResultNode(current.mode, current.fromPosition, current.charsetEncoderIndex, length));
+ list.add(0, new RXingResultNode(current.mode, current.fromPosition, current.charsetEncoderIndex, length));
length = 0;
}
if (needECI) {
- list.add(0, new ResultNode(Mode.ECI, current.fromPosition, current.charsetEncoderIndex, 0));
+ list.add(0, new RXingResultNode(Mode.ECI, current.fromPosition, current.charsetEncoderIndex, 0));
}
current = previous;
}
@@ -486,14 +486,14 @@ final class MinimalEncoder {
// prepend FNC1 if needed. If the bits contain an ECI then the FNC1 must be preceeded by an ECI.
// If there is no ECI at the beginning then we put an ECI to the default charset (ISO-8859-1)
if (isGS1) {
- ResultNode first = list.get(0);
+ RXingResultNode first = list.get(0);
if (first != null && first.mode != Mode.ECI && containsECI) {
// prepend a default character set ECI
- list.add(0, new ResultNode(Mode.ECI, 0, 0, 0));
+ list.add(0, new RXingResultNode(Mode.ECI, 0, 0, 0));
}
first = list.get(0);
// prepend or insert a FNC1_FIRST_POSITION after the ECI (if any)
- list.add(first.mode != Mode.ECI ? 0 : 1, new ResultNode(Mode.FNC1_FIRST_POSITION, 0, 0, 0));
+ list.add(first.mode != Mode.ECI ? 0 : 1, new RXingResultNode(Mode.FNC1_FIRST_POSITION, 0, 0, 0));
}
// set version to smallest version into which the bits fit.
@@ -538,7 +538,7 @@ final class MinimalEncoder {
private int getSize(Version version) {
int result = 0;
- for (ResultNode resultNode : list) {
+ for (RXingResultNode resultNode : list) {
result += resultNode.getSize(version);
}
return result;
@@ -548,7 +548,7 @@ final class MinimalEncoder {
* appends the bits
*/
void getBits(BitArray bits) throws WriterException {
- for (ResultNode resultNode : list) {
+ for (RXingResultNode resultNode : list) {
resultNode.getBits(bits);
}
}
@@ -559,8 +559,8 @@ final class MinimalEncoder {
public String toString() {
StringBuilder result = new StringBuilder();
- ResultNode previous = null;
- for (ResultNode current : list) {
+ RXingResultNode previous = null;
+ for (RXingResultNode current : list) {
if (previous != null) {
result.append(",");
}
@@ -570,14 +570,14 @@ final class MinimalEncoder {
return result.toString();
}
- final class ResultNode {
+ final class RXingResultNode {
private final Mode mode;
private final int fromPosition;
private final int charsetEncoderIndex;
private final int characterLength;
- ResultNode(Mode mode, int fromPosition, int charsetEncoderIndex, int characterLength) {
+ RXingResultNode(Mode mode, int fromPosition, int charsetEncoderIndex, int characterLength) {
this.mode = mode;
this.fromPosition = fromPosition;
this.charsetEncoderIndex = charsetEncoderIndex;