Whitespace cleanup and other inspections from IDEA 13

git-svn-id: https://zxing.googlecode.com/svn/trunk@2989 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2013-12-06 11:17:57 +00:00
parent 49e2bca2aa
commit da9d32846a
21 changed files with 278 additions and 283 deletions

View file

@ -26,7 +26,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
@ -67,7 +66,7 @@ public final class SearchBookContentsActivity extends Activity {
private TextView headerView;
private AsyncTask<String,?,?> networkTask;
private final Button.OnClickListener buttonListener = new Button.OnClickListener() {
private final View.OnClickListener buttonListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
launchSearch();

View file

@ -17,7 +17,6 @@
package com.google.zxing.client.android.result;
import android.view.View;
import android.widget.Button;
/**
* Handles the result of barcode decoding in the context of the Android platform, by dispatching the
@ -25,7 +24,7 @@ import android.widget.Button;
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class ResultButtonListener implements Button.OnClickListener {
public final class ResultButtonListener implements View.OnClickListener {
private final ResultHandler resultHandler;
private final int index;

View file

@ -33,7 +33,6 @@ import android.provider.Browser;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.google.zxing.client.android.clipboard.ClipboardInterface;
@ -53,7 +52,7 @@ public final class ShareActivity extends Activity {
private View clipboardButton;
private final Button.OnClickListener contactListener = new Button.OnClickListener() {
private final View.OnClickListener contactListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
@ -62,7 +61,7 @@ public final class ShareActivity extends Activity {
}
};
private final Button.OnClickListener bookmarkListener = new Button.OnClickListener() {
private final View.OnClickListener bookmarkListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_PICK);
@ -72,7 +71,7 @@ public final class ShareActivity extends Activity {
}
};
private final Button.OnClickListener appListener = new Button.OnClickListener() {
private final View.OnClickListener appListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_PICK);
@ -82,7 +81,7 @@ public final class ShareActivity extends Activity {
}
};
private final Button.OnClickListener clipboardListener = new Button.OnClickListener() {
private final View.OnClickListener clipboardListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
// Should always be true, because we grey out the clipboard button in onResume() if it's empty

View file

@ -21,7 +21,6 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public final class BenchmarkActivity extends Activity {
@ -30,7 +29,7 @@ public final class BenchmarkActivity extends Activity {
private TextView textView;
private AsyncTask<?,?,?> benchmarkTask;
private final Button.OnClickListener runBenchmark = new Button.OnClickListener() {
private final View.OnClickListener runBenchmark = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (benchmarkTask == null) {

View file

@ -31,7 +31,6 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;
@ -116,7 +115,7 @@ public final class ZXingTestActivity extends Activity {
}
private final Button.OnClickListener getCameraParameters = new Button.OnClickListener() {
private final View.OnClickListener getCameraParameters = new View.OnClickListener() {
@Override
public void onClick(View v) {
String stats = collectStats();
@ -129,7 +128,7 @@ public final class ZXingTestActivity extends Activity {
}
};
private final Button.OnClickListener runBenchmark = new Button.OnClickListener() {
private final View.OnClickListener runBenchmark = new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW);
@ -138,7 +137,7 @@ public final class ZXingTestActivity extends Activity {
}
};
private final Button.OnClickListener scanProduct = new Button.OnClickListener() {
private final View.OnClickListener scanProduct = new View.OnClickListener() {
@Override
public void onClick(View v) {
IntentIntegrator integrator = new IntentIntegrator(ZXingTestActivity.this);
@ -150,7 +149,7 @@ public final class ZXingTestActivity extends Activity {
}
};
private final Button.OnClickListener scanQRCode = new Button.OnClickListener() {
private final View.OnClickListener scanQRCode = new View.OnClickListener() {
@Override
public void onClick(View v) {
IntentIntegrator integrator = new IntentIntegrator(ZXingTestActivity.this);
@ -158,7 +157,7 @@ public final class ZXingTestActivity extends Activity {
}
};
private final Button.OnClickListener scanAnything = new Button.OnClickListener() {
private final View.OnClickListener scanAnything = new View.OnClickListener() {
@Override
public void onClick(View v) {
IntentIntegrator integrator = new IntentIntegrator(ZXingTestActivity.this);
@ -166,7 +165,7 @@ public final class ZXingTestActivity extends Activity {
}
};
private final Button.OnClickListener searchBookContents = new Button.OnClickListener() {
private final View.OnClickListener searchBookContents = new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent("com.google.zxing.client.android.SEARCH_BOOK_CONTENTS");
@ -176,35 +175,35 @@ public final class ZXingTestActivity extends Activity {
}
};
private final Button.OnClickListener encodeURL = new Button.OnClickListener() {
private final View.OnClickListener encodeURL = new View.OnClickListener() {
@Override
public void onClick(View v) {
encodeBarcode("TEXT_TYPE", "http://www.nytimes.com");
}
};
private final Button.OnClickListener encodeEmail = new Button.OnClickListener() {
private final View.OnClickListener encodeEmail = new View.OnClickListener() {
@Override
public void onClick(View v) {
encodeBarcode("EMAIL_TYPE", "foo@example.com");
}
};
private final Button.OnClickListener encodePhone = new Button.OnClickListener() {
private final View.OnClickListener encodePhone = new View.OnClickListener() {
@Override
public void onClick(View v) {
encodeBarcode("PHONE_TYPE", "2125551212");
}
};
private final Button.OnClickListener encodeSMS = new Button.OnClickListener() {
private final View.OnClickListener encodeSMS = new View.OnClickListener() {
@Override
public void onClick(View v) {
encodeBarcode("SMS_TYPE", "2125551212");
}
};
private final Button.OnClickListener encodeContact = new Button.OnClickListener() {
private final View.OnClickListener encodeContact = new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle bundle = new Bundle();
@ -216,7 +215,7 @@ public final class ZXingTestActivity extends Activity {
}
};
private final Button.OnClickListener encodeLocation = new Button.OnClickListener() {
private final View.OnClickListener encodeLocation = new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle bundle = new Bundle();
@ -226,7 +225,7 @@ public final class ZXingTestActivity extends Activity {
}
};
private final Button.OnClickListener encodeHiddenData = new Button.OnClickListener() {
private final View.OnClickListener encodeHiddenData = new View.OnClickListener() {
@Override
public void onClick(View v) {
IntentIntegrator integrator = new IntentIntegrator(ZXingTestActivity.this);
@ -235,14 +234,14 @@ public final class ZXingTestActivity extends Activity {
}
};
private final Button.OnClickListener encodeBadData = new Button.OnClickListener() {
private final View.OnClickListener encodeBadData = new View.OnClickListener() {
@Override
public void onClick(View v) {
encodeBarcode(null, "bar");
}
};
private final Button.OnClickListener shareViaBarcode = new Button.OnClickListener() {
private final View.OnClickListener shareViaBarcode = new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent("com.google.zxing.client.android.SHARE"));

View file

@ -61,12 +61,12 @@ public final class GenericGF {
* In most cases it should be 1, but for QR code it is 0.
*/
public GenericGF(int primitive, int size, int b) {
this.primitive = primitive;
this.primitive = primitive;
this.size = size;
this.generatorBase = b;
if (size <= INITIALIZATION_THRESHOLD) {
initialize();
initialize();
}
}
@ -92,20 +92,20 @@ public final class GenericGF {
}
private void checkInit() {
if (!initialized) {
if (!initialized) {
initialize();
}
}
GenericGFPoly getZero() {
checkInit();
checkInit();
return zero;
}
GenericGFPoly getOne() {
checkInit();
checkInit();
return one;
}
@ -113,8 +113,8 @@ public final class GenericGF {
* @return the monomial representing coefficient * x^degree
*/
GenericGFPoly buildMonomial(int degree, int coefficient) {
checkInit();
checkInit();
if (degree < 0) {
throw new IllegalArgumentException();
}
@ -139,8 +139,8 @@ public final class GenericGF {
* @return 2 to the power of a in GF(size)
*/
int exp(int a) {
checkInit();
checkInit();
return expTable[a];
}
@ -148,8 +148,8 @@ public final class GenericGF {
* @return base 2 log of a in GF(size)
*/
int log(int a) {
checkInit();
checkInit();
if (a == 0) {
throw new IllegalArgumentException();
}
@ -160,8 +160,8 @@ public final class GenericGF {
* @return multiplicative inverse of a
*/
int inverse(int a) {
checkInit();
checkInit();
if (a == 0) {
throw new ArithmeticException();
}
@ -172,7 +172,7 @@ public final class GenericGF {
* @return product of a and b in GF(size)
*/
int multiply(int a, int b) {
checkInit();
checkInit();
if (a == 0 || b == 0) {
return 0;
@ -181,7 +181,7 @@ public final class GenericGF {
}
public int getSize() {
return size;
return size;
}
public int getGeneratorBase() {

View file

@ -112,7 +112,7 @@ final class DecodedBitStreamParser {
}
} while (mode != Mode.PAD_ENCODE && bits.available() > 0);
if (resultTrailer.length() > 0) {
result.append(resultTrailer.toString());
result.append(resultTrailer);
}
return new DecoderResult(bytes, result.toString(), byteSegments.isEmpty() ? null : byteSegments, null);
}

View file

@ -48,7 +48,7 @@ final class ExpandedRow {
}
boolean isEquivalent(List<ExpandedPair> otherPairs) {
return this.pairs.equals(otherPairs);
return this.pairs.equals(otherPairs);
}
@Override

View file

@ -359,7 +359,7 @@ public final class RSSExpandedReader extends AbstractRSSReader {
// Only used for unit testing
List<ExpandedRow> getRows() {
return this.rows;
return this.rows;
}
// Not private for unit testing

View file

@ -74,7 +74,7 @@ public final class QRCode {
result.append("\n matrix: null\n");
} else {
result.append("\n matrix:\n");
result.append(matrix.toString());
result.append(matrix);
}
result.append(">>\n");
return result.toString();

View file

@ -211,42 +211,42 @@ public final class EncoderTest extends Assert {
@Test
public void testEncodeDecode31() throws Exception {
testEncodeDecode("In ut magna vel mauris malesuada dictum. Nulla ullamcorper metus quis diam" +
" cursus facilisis. Sed mollis quam id justo rutrum sagittis. Donec laoreet rutrum" +
" est, nec convallis mauris condimentum sit amet. Phasellus gravida, justo et congue" +
" auctor, nisi ipsum viverra erat, eget hendrerit felis turpis nec lorem. Nulla" +
" ultrices, elit pellentesque aliquet laoreet, justo erat pulvinar nisi, id" +
" elementum sapien dolor et diam. Donec ac nunc sodales elit placerat eleifend." +
" Sed ornare luctus ornare. Vestibulum vehicula, massa at pharetra fringilla, risus" +
" justo faucibus erat, nec porttitor nibh tellus sed est. Ut justo diam, lobortis eu" +
" tristique ac, p.In ut magna vel mauris malesuada dictum. Nulla ullamcorper metus" +
" quis diam cursus facilisis. Sed mollis quam id justo rutrum sagittis. Donec" +
" laoreet rutrum est, nec convallis mauris condimentum sit amet. Phasellus gravida," +
" justo et congue auctor, nisi ipsum viverra erat, eget hendrerit felis turpis nec" +
" lorem. Nulla ultrices, elit pellentesque aliquet laoreet, justo erat pulvinar" +
" nisi, id elementum sapien dolor et diam. Donec ac nunc sodales elit placerat" +
" eleifend. Sed ornare luctus ornare. Vestibulum vehicula, massa at pharetra" +
" fringilla, risus justo faucibus erat, nec porttitor nibh tellus sed est. Ut justo" +
" diam, lobortis eu tristique ac, p. In ut magna vel mauris malesuada dictum. Nulla" +
" ullamcorper metus quis diam cursus facilisis. Sed mollis quam id justo rutrum" +
" sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum sit amet." +
" Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat, eget hendrerit" +
" felis turpis nec lorem. Nulla ultrices, elit pellentesque aliquet laoreet, justo" +
" erat pulvinar nisi, id elementum sapien dolor et diam. Donec ac nunc sodales elit" +
" placerat eleifend. Sed ornare luctus ornare. Vestibulum vehicula, massa at" +
" pharetra fringilla, risus justo faucibus erat, nec porttitor nibh tellus sed est." +
" Ut justo diam, lobortis eu tristique ac, p.In ut magna vel mauris malesuada" +
" dictum. Nulla ullamcorper metus quis diam cursus facilisis. Sed mollis quam id" +
" justo rutrum sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum" +
" sit amet. Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat," +
" eget hendrerit felis turpis nec lorem. Nulla ultrices, elit pellentesque aliquet" +
" laoreet, justo erat pulvinar nisi, id elementum sapien dolor et diam. Donec ac" +
" nunc sodales elit placerat eleifend. Sed ornare luctus ornare. Vestibulum vehicula," +
" massa at pharetra fringilla, risus justo faucibus erat, nec porttitor nibh tellus" +
" sed est. Ut justo diam, lobortis eu tris. In ut magna vel mauris malesuada dictum." +
" Nulla ullamcorper metus quis diam cursus facilisis. Sed mollis quam id justo rutrum" +
" sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum sit amet." +
" Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat, eget" +
" hendrerit felis turpis nec lorem.", false, 31);
" cursus facilisis. Sed mollis quam id justo rutrum sagittis. Donec laoreet rutrum" +
" est, nec convallis mauris condimentum sit amet. Phasellus gravida, justo et congue" +
" auctor, nisi ipsum viverra erat, eget hendrerit felis turpis nec lorem. Nulla" +
" ultrices, elit pellentesque aliquet laoreet, justo erat pulvinar nisi, id" +
" elementum sapien dolor et diam. Donec ac nunc sodales elit placerat eleifend." +
" Sed ornare luctus ornare. Vestibulum vehicula, massa at pharetra fringilla, risus" +
" justo faucibus erat, nec porttitor nibh tellus sed est. Ut justo diam, lobortis eu" +
" tristique ac, p.In ut magna vel mauris malesuada dictum. Nulla ullamcorper metus" +
" quis diam cursus facilisis. Sed mollis quam id justo rutrum sagittis. Donec" +
" laoreet rutrum est, nec convallis mauris condimentum sit amet. Phasellus gravida," +
" justo et congue auctor, nisi ipsum viverra erat, eget hendrerit felis turpis nec" +
" lorem. Nulla ultrices, elit pellentesque aliquet laoreet, justo erat pulvinar" +
" nisi, id elementum sapien dolor et diam. Donec ac nunc sodales elit placerat" +
" eleifend. Sed ornare luctus ornare. Vestibulum vehicula, massa at pharetra" +
" fringilla, risus justo faucibus erat, nec porttitor nibh tellus sed est. Ut justo" +
" diam, lobortis eu tristique ac, p. In ut magna vel mauris malesuada dictum. Nulla" +
" ullamcorper metus quis diam cursus facilisis. Sed mollis quam id justo rutrum" +
" sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum sit amet." +
" Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat, eget hendrerit" +
" felis turpis nec lorem. Nulla ultrices, elit pellentesque aliquet laoreet, justo" +
" erat pulvinar nisi, id elementum sapien dolor et diam. Donec ac nunc sodales elit" +
" placerat eleifend. Sed ornare luctus ornare. Vestibulum vehicula, massa at" +
" pharetra fringilla, risus justo faucibus erat, nec porttitor nibh tellus sed est." +
" Ut justo diam, lobortis eu tristique ac, p.In ut magna vel mauris malesuada" +
" dictum. Nulla ullamcorper metus quis diam cursus facilisis. Sed mollis quam id" +
" justo rutrum sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum" +
" sit amet. Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat," +
" eget hendrerit felis turpis nec lorem. Nulla ultrices, elit pellentesque aliquet" +
" laoreet, justo erat pulvinar nisi, id elementum sapien dolor et diam. Donec ac" +
" nunc sodales elit placerat eleifend. Sed ornare luctus ornare. Vestibulum vehicula," +
" massa at pharetra fringilla, risus justo faucibus erat, nec porttitor nibh tellus" +
" sed est. Ut justo diam, lobortis eu tris. In ut magna vel mauris malesuada dictum." +
" Nulla ullamcorper metus quis diam cursus facilisis. Sed mollis quam id justo rutrum" +
" sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum sit amet." +
" Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat, eget" +
" hendrerit felis turpis nec lorem.", false, 31);
}
@Test

View file

@ -38,9 +38,9 @@ import com.google.zxing.Result;
import com.google.zxing.common.BitArray;
public final class RSSExpandedStackedInternalTestCase extends Assert {
@Test
public void testDecodingRowByRow() throws Exception {
@Test
public void testDecodingRowByRow() throws Exception {
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
BinaryBitmap binaryMap = TestCaseUtil.getBinaryBitmap("src/test/resources/blackbox/rssexpandedstacked-2/1000.png");
@ -70,17 +70,17 @@ public final class RSSExpandedStackedInternalTestCase extends Assert {
Result result = RSSExpandedReader.constructResult(totalPairs);
assertEquals("(01)98898765432106(3202)012345(15)991231", result.getText());
}
@Test
public void testCompleteDecode() throws Exception {
}
@Test
public void testCompleteDecode() throws Exception {
OneDReader rssExpandedReader = new RSSExpandedReader();
BinaryBitmap binaryMap = TestCaseUtil.getBinaryBitmap("src/test/resources/blackbox/rssexpandedstacked-2/1000.png");
Result result = rssExpandedReader.decode(binaryMap);
assertEquals("(01)98898765432106(3202)012345(15)991231", result.getText());
}
}
}

View file

@ -48,12 +48,12 @@ final class TestCaseUtil {
file = new File("core", path);
}
return ImageIO.read(file);
}
}
static BinaryBitmap getBinaryBitmap(String path) throws IOException {
BufferedImage bufferedImage = getBufferedImage(path);
BufferedImageLuminanceSource luminanceSource = new BufferedImageLuminanceSource(bufferedImage);
return new BinaryBitmap(new GlobalHistogramBinarizer(luminanceSource));
}
BufferedImage bufferedImage = getBufferedImage(path);
BufferedImageLuminanceSource luminanceSource = new BufferedImageLuminanceSource(bufferedImage);
return new BinaryBitmap(new GlobalHistogramBinarizer(luminanceSource));
}
}

View file

@ -33,26 +33,26 @@ import org.junit.Test;
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
*/
public final class AI01_3103_DecoderTest extends AbstractDecoderTest {
private static final String header = "..X..";
private static final String header = "..X..";
@Test
public void test01_3103_1() throws Exception {
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_1750;
String expected = "(01)90012345678908(3103)001750";
assertCorrectBinaryString(data, expected);
}
public void test01_3103_1() throws Exception {
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_1750;
String expected = "(01)90012345678908(3103)001750";
assertCorrectBinaryString(data, expected);
}
@Test
public void test01_3103_2() throws Exception {
CharSequence data = header + compressedGtin_900000000000008 + compressed15bitWeight_0;
String expected = "(01)90000000000003(3103)000000";
assertCorrectBinaryString(data, expected);
}
public void test01_3103_2() throws Exception {
CharSequence data = header + compressedGtin_900000000000008 + compressed15bitWeight_0;
String expected = "(01)90000000000003(3103)000000";
assertCorrectBinaryString(data, expected);
}
@Test(expected = NotFoundException.class)
public void test01_3103_invalid() throws Exception {
public void test01_3103_invalid() throws Exception {
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_1750 + "..";
assertCorrectBinaryString(data, "");
}
}
}

View file

@ -33,21 +33,21 @@ import org.junit.Test;
*/
public final class AI01_3202_3203_DecoderTest extends AbstractDecoderTest {
private static final String header = "..X.X";
private static final String header = "..X.X";
@Test
public void test01_3202_1() throws Exception {
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_1750;
String expected = "(01)90012345678908(3202)001750";
assertCorrectBinaryString(data, expected);
}
public void test01_3202_1() throws Exception {
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_1750;
String expected = "(01)90012345678908(3202)001750";
assertCorrectBinaryString(data, expected);
}
@Test
public void test01_3203_1() throws Exception {
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_11750;
String expected = "(01)90012345678908(3203)001750";
assertCorrectBinaryString(data, expected);
}
public void test01_3203_1() throws Exception {
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_11750;
String expected = "(01)90012345678908(3203)001750";
assertCorrectBinaryString(data, expected);
}
}

View file

@ -32,86 +32,86 @@ import org.junit.Test;
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
*/
public final class AI01_3X0X_1X_DecoderTest extends AbstractDecoderTest {
private static final String header_310x_11 = "..XXX...";
private static final String header_320x_11 = "..XXX..X";
private static final String header_310x_13 = "..XXX.X.";
private static final String header_320x_13 = "..XXX.XX";
private static final String header_310x_15 = "..XXXX..";
private static final String header_320x_15 = "..XXXX.X";
private static final String header_310x_17 = "..XXXXX.";
private static final String header_320x_17 = "..XXXXXX";
private static final String header_310x_11 = "..XXX...";
private static final String header_320x_11 = "..XXX..X";
private static final String header_310x_13 = "..XXX.X.";
private static final String header_320x_13 = "..XXX.XX";
private static final String header_310x_15 = "..XXXX..";
private static final String header_320x_15 = "..XXXX.X";
private static final String header_310x_17 = "..XXXXX.";
private static final String header_320x_17 = "..XXXXXX";
@Test
public void test01_310X_1X_endDate() throws Exception {
CharSequence data = header_310x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_End;
String expected = "(01)90012345678908(3100)001750";
assertCorrectBinaryString(data, expected);
}
public void test01_310X_1X_endDate() throws Exception {
CharSequence data = header_310x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_End;
String expected = "(01)90012345678908(3100)001750";
assertCorrectBinaryString(data, expected);
}
@Test
public void test01_310X_11_1() throws Exception {
CharSequence data = header_310x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3100)001750(11)100312";
assertCorrectBinaryString(data, expected);
}
public void test01_310X_11_1() throws Exception {
CharSequence data = header_310x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3100)001750(11)100312";
assertCorrectBinaryString(data, expected);
}
@Test
public void test01_320X_11_1() throws Exception {
CharSequence data = header_320x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3200)001750(11)100312";
assertCorrectBinaryString(data, expected);
}
public void test01_320X_11_1() throws Exception {
CharSequence data = header_320x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3200)001750(11)100312";
assertCorrectBinaryString(data, expected);
}
@Test
public void test01_310X_13_1() throws Exception {
CharSequence data = header_310x_13 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3100)001750(13)100312";
assertCorrectBinaryString(data, expected);
}
public void test01_310X_13_1() throws Exception {
CharSequence data = header_310x_13 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3100)001750(13)100312";
assertCorrectBinaryString(data, expected);
}
@Test
public void test01_320X_13_1() throws Exception {
CharSequence data = header_320x_13 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3200)001750(13)100312";
assertCorrectBinaryString(data, expected);
}
public void test01_320X_13_1() throws Exception {
CharSequence data = header_320x_13 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3200)001750(13)100312";
assertCorrectBinaryString(data, expected);
}
@Test
public void test01_310X_15_1() throws Exception {
CharSequence data = header_310x_15 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3100)001750(15)100312";
assertCorrectBinaryString(data, expected);
}
public void test01_310X_15_1() throws Exception {
CharSequence data = header_310x_15 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3100)001750(15)100312";
assertCorrectBinaryString(data, expected);
}
@Test
public void test01_320X_15_1() throws Exception {
CharSequence data = header_320x_15 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3200)001750(15)100312";
assertCorrectBinaryString(data, expected);
}
public void test01_320X_15_1() throws Exception {
CharSequence data = header_320x_15 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3200)001750(15)100312";
assertCorrectBinaryString(data, expected);
}
@Test
public void test01_310X_17_1() throws Exception {
CharSequence data = header_310x_17 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3100)001750(17)100312";
assertCorrectBinaryString(data, expected);
}
public void test01_310X_17_1() throws Exception {
CharSequence data = header_310x_17 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3100)001750(17)100312";
assertCorrectBinaryString(data, expected);
}
@Test
public void test01_320X_17_1() throws Exception {
CharSequence data = header_320x_17 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3200)001750(17)100312";
assertCorrectBinaryString(data, expected);
}
public void test01_320X_17_1() throws Exception {
CharSequence data = header_320x_17 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
String expected = "(01)90012345678908(3200)001750(17)100312";
assertCorrectBinaryString(data, expected);
}
}

View file

@ -38,40 +38,40 @@ import org.junit.Assert;
*/
public abstract class AbstractDecoderTest extends Assert {
protected static final String numeric_10 = "..X..XX";
protected static final String numeric_12 = "..X.X.X";
protected static final String numeric_1FNC1 = "..XXX.X";
//protected static final String numeric_FNC11 = "XXX.XXX";
protected static final String numeric2alpha = "....";
protected static final String alpha_A = "X.....";
protected static final String alpha_FNC1 = ".XXXX";
protected static final String alpha2numeric = "...";
protected static final String alpha2isoiec646 = "..X..";
protected static final String i646_B = "X.....X";
protected static final String i646_C = "X....X.";
protected static final String i646_FNC1 = ".XXXX";
protected static final String isoiec646_2alpha = "..X..";
protected static final String compressedGtin_900123456798908 = ".........X..XXX.X.X.X...XX.XXXXX.XXXX.X.";
protected static final String compressedGtin_900000000000008 = "........................................";
protected static final String compressed15bitWeight_1750 = "....XX.XX.X.XX.";
protected static final String compressed15bitWeight_11750 = ".X.XX.XXXX..XX.";
protected static final String compressed15bitWeight_0 = "...............";
protected static final String compressed20bitWeight_1750 = ".........XX.XX.X.XX.";
protected static final String compressedDate_March_12th_2010 = "....XXXX.X..XX..";
protected static final String compressedDate_End = "X..X.XX.........";
protected static final String numeric_10 = "..X..XX";
protected static final String numeric_12 = "..X.X.X";
protected static final String numeric_1FNC1 = "..XXX.X";
//protected static final String numeric_FNC11 = "XXX.XXX";
protected static void assertCorrectBinaryString(CharSequence binaryString,
protected static final String numeric2alpha = "....";
protected static final String alpha_A = "X.....";
protected static final String alpha_FNC1 = ".XXXX";
protected static final String alpha2numeric = "...";
protected static final String alpha2isoiec646 = "..X..";
protected static final String i646_B = "X.....X";
protected static final String i646_C = "X....X.";
protected static final String i646_FNC1 = ".XXXX";
protected static final String isoiec646_2alpha = "..X..";
protected static final String compressedGtin_900123456798908 = ".........X..XXX.X.X.X...XX.XXXXX.XXXX.X.";
protected static final String compressedGtin_900000000000008 = "........................................";
protected static final String compressed15bitWeight_1750 = "....XX.XX.X.XX.";
protected static final String compressed15bitWeight_11750 = ".X.XX.XXXX..XX.";
protected static final String compressed15bitWeight_0 = "...............";
protected static final String compressed20bitWeight_1750 = ".........XX.XX.X.XX.";
protected static final String compressedDate_March_12th_2010 = "....XXXX.X..XX..";
protected static final String compressedDate_End = "X..X.XX.........";
protected static void assertCorrectBinaryString(CharSequence binaryString,
String expectedNumber) throws NotFoundException, FormatException {
BitArray binary = BinaryUtil.buildBitArrayFromStringWithoutSpaces(binaryString);
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
String result = decoder.parseInformation();
assertEquals(expectedNumber, result);
}
BitArray binary = BinaryUtil.buildBitArrayFromStringWithoutSpaces(binaryString);
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
String result = decoder.parseInformation();
assertEquals(expectedNumber, result);
}
}

View file

@ -32,54 +32,54 @@ import org.junit.Test;
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
*/
public final class AnyAIDecoderTest extends AbstractDecoderTest {
private static final String header = ".....";
private static final String header = ".....";
@Test
public void testAnyAIDecoder_1() throws Exception {
CharSequence data = header + numeric_10 + numeric_12 + numeric2alpha + alpha_A + alpha2numeric + numeric_12;
String expected = "(10)12A12";
assertCorrectBinaryString(data, expected);
}
public void testAnyAIDecoder_1() throws Exception {
CharSequence data = header + numeric_10 + numeric_12 + numeric2alpha + alpha_A + alpha2numeric + numeric_12;
String expected = "(10)12A12";
assertCorrectBinaryString(data, expected);
}
@Test
public void testAnyAIDecoder_2() throws Exception {
CharSequence data = header + numeric_10 + numeric_12 + numeric2alpha + alpha_A + alpha2isoiec646 + i646_B;
String expected = "(10)12AB";
assertCorrectBinaryString(data, expected);
}
public void testAnyAIDecoder_2() throws Exception {
CharSequence data = header + numeric_10 + numeric_12 + numeric2alpha + alpha_A + alpha2isoiec646 + i646_B;
String expected = "(10)12AB";
assertCorrectBinaryString(data, expected);
}
@Test
public void testAnyAIDecoder_3() throws Exception {
CharSequence data = header + numeric_10 + numeric2alpha + alpha2isoiec646 + i646_B + i646_C + isoiec646_2alpha + alpha_A + alpha2numeric + numeric_10;
String expected = "(10)BCA10";
assertCorrectBinaryString(data, expected);
}
public void testAnyAIDecoder_3() throws Exception {
CharSequence data = header + numeric_10 + numeric2alpha + alpha2isoiec646 + i646_B + i646_C + isoiec646_2alpha + alpha_A + alpha2numeric + numeric_10;
String expected = "(10)BCA10";
assertCorrectBinaryString(data, expected);
}
@Test
public void testAnyAIDecoder_numericFNC1_secondDigit() throws Exception {
CharSequence data = header + numeric_10 + numeric_1FNC1;
String expected = "(10)1";
assertCorrectBinaryString(data, expected);
}
public void testAnyAIDecoder_numericFNC1_secondDigit() throws Exception {
CharSequence data = header + numeric_10 + numeric_1FNC1;
String expected = "(10)1";
@Test
public void testAnyAIDecoder_alphaFNC1() throws Exception {
CharSequence data = header + numeric_10 + numeric2alpha + alpha_A + alpha_FNC1;
String expected = "(10)A";
assertCorrectBinaryString(data, expected);
}
assertCorrectBinaryString(data, expected);
}
@Test
public void testAnyAIDecoder_646FNC1() throws Exception {
CharSequence data = header + numeric_10 + numeric2alpha + alpha_A + isoiec646_2alpha + i646_B + i646_FNC1;
String expected = "(10)AB";
assertCorrectBinaryString(data, expected);
}
public void testAnyAIDecoder_alphaFNC1() throws Exception {
CharSequence data = header + numeric_10 + numeric2alpha + alpha_A + alpha_FNC1;
String expected = "(10)A";
assertCorrectBinaryString(data, expected);
}
@Test
public void testAnyAIDecoder_646FNC1() throws Exception {
CharSequence data = header + numeric_10 + numeric2alpha + alpha_A + isoiec646_2alpha + i646_B + i646_FNC1;
String expected = "(10)AB";
assertCorrectBinaryString(data, expected);
}
}

View file

@ -35,20 +35,20 @@ import org.junit.Test;
* @author Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es)
*/
public final class FieldParserTest extends Assert {
private static void checkFields(String expected) throws NotFoundException {
String field = expected.replace("(", "").replace(")","");
String actual = FieldParser.parseFieldsInGeneralPurpose(field);
assertEquals(expected, actual);
}
private static void checkFields(String expected) throws NotFoundException {
String field = expected.replace("(", "").replace(")","");
String actual = FieldParser.parseFieldsInGeneralPurpose(field);
assertEquals(expected, actual);
}
@Test
public void testParseField() throws Exception{
checkFields("(15)991231(3103)001750(10)12A");
}
public void testParseField() throws Exception{
checkFields("(15)991231(3103)001750(10)12A");
}
@Test
public void testParseField2() throws Exception{
checkFields("(15)991231(15)991231(3103)001750(10)12A");
}
public void testParseField2() throws Exception{
checkFields("(15)991231(15)991231(3103)001750(10)12A");
}
}

View file

@ -147,10 +147,10 @@ final class DecodeWorker implements Callable<Integer> {
}
Result result = new MultiFormatReader().decode(bitmap, hints);
if (config.isBrief()) {
System.out.println(uri.toString() + ": Success");
System.out.println(uri + ": Success");
} else {
ParsedResult parsedResult = ResultParser.parseResult(result);
System.out.println(uri.toString() + " (format: " + result.getBarcodeFormat() + ", type: " +
System.out.println(uri + " (format: " + result.getBarcodeFormat() + ", type: " +
parsedResult.getType() + "):\nRaw result:\n" + result.getText() + "\nParsed result:\n" +
parsedResult.getDisplayResult());
@ -165,7 +165,7 @@ final class DecodeWorker implements Callable<Integer> {
return result;
} catch (NotFoundException ignored) {
System.out.println(uri.toString() + ": No barcode found");
System.out.println(uri + ": No barcode found");
return null;
}
}
@ -191,11 +191,11 @@ final class DecodeWorker implements Callable<Integer> {
Result[] results = reader.decodeMultiple(bitmap, hints);
if (config.isBrief()) {
System.out.println(uri.toString() + ": Success");
System.out.println(uri + ": Success");
} else {
for (Result result : results) {
ParsedResult parsedResult = ResultParser.parseResult(result);
System.out.println(uri.toString() + " (format: "
System.out.println(uri + " (format: "
+ result.getBarcodeFormat() + ", type: "
+ parsedResult.getType() + "):\nRaw result:\n"
+ result.getText() + "\nParsed result:\n"
@ -209,7 +209,7 @@ final class DecodeWorker implements Callable<Integer> {
}
return results;
} catch (NotFoundException ignored) {
System.out.println(uri.toString() + ": No barcode found");
System.out.println(uri + ": No barcode found");
return null;
}
}

View file

@ -107,7 +107,7 @@ public final class WifiGenerator implements GeneratorSource {
}
private String getPasswordField() throws GeneratorException {
return parseTextField("Password", password);
return parseTextField("Password", password);
}
private String getNetworkTypeField() {