mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 19:57:27 -08:00
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:
parent
49e2bca2aa
commit
da9d32846a
|
@ -26,7 +26,6 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.webkit.CookieManager;
|
import android.webkit.CookieManager;
|
||||||
import android.webkit.CookieSyncManager;
|
import android.webkit.CookieSyncManager;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -67,7 +66,7 @@ public final class SearchBookContentsActivity extends Activity {
|
||||||
private TextView headerView;
|
private TextView headerView;
|
||||||
private AsyncTask<String,?,?> networkTask;
|
private AsyncTask<String,?,?> networkTask;
|
||||||
|
|
||||||
private final Button.OnClickListener buttonListener = new Button.OnClickListener() {
|
private final View.OnClickListener buttonListener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
launchSearch();
|
launchSearch();
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package com.google.zxing.client.android.result;
|
package com.google.zxing.client.android.result;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the result of barcode decoding in the context of the Android platform, by dispatching the
|
* 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)
|
* @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 ResultHandler resultHandler;
|
||||||
private final int index;
|
private final int index;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ import android.provider.Browser;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import com.google.zxing.client.android.clipboard.ClipboardInterface;
|
import com.google.zxing.client.android.clipboard.ClipboardInterface;
|
||||||
|
|
||||||
|
@ -53,7 +52,7 @@ public final class ShareActivity extends Activity {
|
||||||
|
|
||||||
private View clipboardButton;
|
private View clipboardButton;
|
||||||
|
|
||||||
private final Button.OnClickListener contactListener = new Button.OnClickListener() {
|
private final View.OnClickListener contactListener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(Intent.ACTION_PICK);
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(Intent.ACTION_PICK);
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
// Should always be true, because we grey out the clipboard button in onResume() if it's empty
|
// Should always be true, because we grey out the clipboard button in onResume() if it's empty
|
||||||
|
|
|
@ -21,7 +21,6 @@ import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public final class BenchmarkActivity extends Activity {
|
public final class BenchmarkActivity extends Activity {
|
||||||
|
@ -30,7 +29,7 @@ public final class BenchmarkActivity extends Activity {
|
||||||
private TextView textView;
|
private TextView textView;
|
||||||
private AsyncTask<?,?,?> benchmarkTask;
|
private AsyncTask<?,?,?> benchmarkTask;
|
||||||
|
|
||||||
private final Button.OnClickListener runBenchmark = new Button.OnClickListener() {
|
private final View.OnClickListener runBenchmark = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (benchmarkTask == null) {
|
if (benchmarkTask == null) {
|
||||||
|
|
|
@ -31,7 +31,6 @@ import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
|
||||||
import com.google.zxing.integration.android.IntentIntegrator;
|
import com.google.zxing.integration.android.IntentIntegrator;
|
||||||
import com.google.zxing.integration.android.IntentResult;
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
String stats = collectStats();
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
IntentIntegrator integrator = new IntentIntegrator(ZXingTestActivity.this);
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
IntentIntegrator integrator = new IntentIntegrator(ZXingTestActivity.this);
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
IntentIntegrator integrator = new IntentIntegrator(ZXingTestActivity.this);
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent("com.google.zxing.client.android.SEARCH_BOOK_CONTENTS");
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
encodeBarcode("TEXT_TYPE", "http://www.nytimes.com");
|
encodeBarcode("TEXT_TYPE", "http://www.nytimes.com");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Button.OnClickListener encodeEmail = new Button.OnClickListener() {
|
private final View.OnClickListener encodeEmail = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
encodeBarcode("EMAIL_TYPE", "foo@example.com");
|
encodeBarcode("EMAIL_TYPE", "foo@example.com");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Button.OnClickListener encodePhone = new Button.OnClickListener() {
|
private final View.OnClickListener encodePhone = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
encodeBarcode("PHONE_TYPE", "2125551212");
|
encodeBarcode("PHONE_TYPE", "2125551212");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Button.OnClickListener encodeSMS = new Button.OnClickListener() {
|
private final View.OnClickListener encodeSMS = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
encodeBarcode("SMS_TYPE", "2125551212");
|
encodeBarcode("SMS_TYPE", "2125551212");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Button.OnClickListener encodeContact = new Button.OnClickListener() {
|
private final View.OnClickListener encodeContact = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Bundle bundle = new Bundle();
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Bundle bundle = new Bundle();
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
IntentIntegrator integrator = new IntentIntegrator(ZXingTestActivity.this);
|
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
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
encodeBarcode(null, "bar");
|
encodeBarcode(null, "bar");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Button.OnClickListener shareViaBarcode = new Button.OnClickListener() {
|
private final View.OnClickListener shareViaBarcode = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
startActivity(new Intent("com.google.zxing.client.android.SHARE"));
|
startActivity(new Intent("com.google.zxing.client.android.SHARE"));
|
||||||
|
|
|
@ -61,12 +61,12 @@ public final class GenericGF {
|
||||||
* In most cases it should be 1, but for QR code it is 0.
|
* In most cases it should be 1, but for QR code it is 0.
|
||||||
*/
|
*/
|
||||||
public GenericGF(int primitive, int size, int b) {
|
public GenericGF(int primitive, int size, int b) {
|
||||||
this.primitive = primitive;
|
this.primitive = primitive;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.generatorBase = b;
|
this.generatorBase = b;
|
||||||
|
|
||||||
if (size <= INITIALIZATION_THRESHOLD) {
|
if (size <= INITIALIZATION_THRESHOLD) {
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,20 +92,20 @@ public final class GenericGF {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkInit() {
|
private void checkInit() {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericGFPoly getZero() {
|
GenericGFPoly getZero() {
|
||||||
checkInit();
|
checkInit();
|
||||||
|
|
||||||
return zero;
|
return zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericGFPoly getOne() {
|
GenericGFPoly getOne() {
|
||||||
checkInit();
|
checkInit();
|
||||||
|
|
||||||
return one;
|
return one;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,8 +113,8 @@ public final class GenericGF {
|
||||||
* @return the monomial representing coefficient * x^degree
|
* @return the monomial representing coefficient * x^degree
|
||||||
*/
|
*/
|
||||||
GenericGFPoly buildMonomial(int degree, int coefficient) {
|
GenericGFPoly buildMonomial(int degree, int coefficient) {
|
||||||
checkInit();
|
checkInit();
|
||||||
|
|
||||||
if (degree < 0) {
|
if (degree < 0) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
@ -139,8 +139,8 @@ public final class GenericGF {
|
||||||
* @return 2 to the power of a in GF(size)
|
* @return 2 to the power of a in GF(size)
|
||||||
*/
|
*/
|
||||||
int exp(int a) {
|
int exp(int a) {
|
||||||
checkInit();
|
checkInit();
|
||||||
|
|
||||||
return expTable[a];
|
return expTable[a];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,8 +148,8 @@ public final class GenericGF {
|
||||||
* @return base 2 log of a in GF(size)
|
* @return base 2 log of a in GF(size)
|
||||||
*/
|
*/
|
||||||
int log(int a) {
|
int log(int a) {
|
||||||
checkInit();
|
checkInit();
|
||||||
|
|
||||||
if (a == 0) {
|
if (a == 0) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
@ -160,8 +160,8 @@ public final class GenericGF {
|
||||||
* @return multiplicative inverse of a
|
* @return multiplicative inverse of a
|
||||||
*/
|
*/
|
||||||
int inverse(int a) {
|
int inverse(int a) {
|
||||||
checkInit();
|
checkInit();
|
||||||
|
|
||||||
if (a == 0) {
|
if (a == 0) {
|
||||||
throw new ArithmeticException();
|
throw new ArithmeticException();
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ public final class GenericGF {
|
||||||
* @return product of a and b in GF(size)
|
* @return product of a and b in GF(size)
|
||||||
*/
|
*/
|
||||||
int multiply(int a, int b) {
|
int multiply(int a, int b) {
|
||||||
checkInit();
|
checkInit();
|
||||||
|
|
||||||
if (a == 0 || b == 0) {
|
if (a == 0 || b == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -181,7 +181,7 @@ public final class GenericGF {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getGeneratorBase() {
|
public int getGeneratorBase() {
|
||||||
|
|
|
@ -112,7 +112,7 @@ final class DecodedBitStreamParser {
|
||||||
}
|
}
|
||||||
} while (mode != Mode.PAD_ENCODE && bits.available() > 0);
|
} while (mode != Mode.PAD_ENCODE && bits.available() > 0);
|
||||||
if (resultTrailer.length() > 0) {
|
if (resultTrailer.length() > 0) {
|
||||||
result.append(resultTrailer.toString());
|
result.append(resultTrailer);
|
||||||
}
|
}
|
||||||
return new DecoderResult(bytes, result.toString(), byteSegments.isEmpty() ? null : byteSegments, null);
|
return new DecoderResult(bytes, result.toString(), byteSegments.isEmpty() ? null : byteSegments, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ final class ExpandedRow {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isEquivalent(List<ExpandedPair> otherPairs) {
|
boolean isEquivalent(List<ExpandedPair> otherPairs) {
|
||||||
return this.pairs.equals(otherPairs);
|
return this.pairs.equals(otherPairs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -359,7 +359,7 @@ public final class RSSExpandedReader extends AbstractRSSReader {
|
||||||
|
|
||||||
// Only used for unit testing
|
// Only used for unit testing
|
||||||
List<ExpandedRow> getRows() {
|
List<ExpandedRow> getRows() {
|
||||||
return this.rows;
|
return this.rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not private for unit testing
|
// Not private for unit testing
|
||||||
|
|
|
@ -74,7 +74,7 @@ public final class QRCode {
|
||||||
result.append("\n matrix: null\n");
|
result.append("\n matrix: null\n");
|
||||||
} else {
|
} else {
|
||||||
result.append("\n matrix:\n");
|
result.append("\n matrix:\n");
|
||||||
result.append(matrix.toString());
|
result.append(matrix);
|
||||||
}
|
}
|
||||||
result.append(">>\n");
|
result.append(">>\n");
|
||||||
return result.toString();
|
return result.toString();
|
||||||
|
|
|
@ -211,42 +211,42 @@ public final class EncoderTest extends Assert {
|
||||||
@Test
|
@Test
|
||||||
public void testEncodeDecode31() throws Exception {
|
public void testEncodeDecode31() throws Exception {
|
||||||
testEncodeDecode("In ut magna vel mauris malesuada dictum. Nulla ullamcorper metus quis diam" +
|
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" +
|
" cursus facilisis. Sed mollis quam id justo rutrum sagittis. Donec laoreet rutrum" +
|
||||||
" est, nec convallis mauris condimentum sit amet. Phasellus gravida, justo et congue" +
|
" est, nec convallis mauris condimentum sit amet. Phasellus gravida, justo et congue" +
|
||||||
" auctor, nisi ipsum viverra erat, eget hendrerit felis turpis nec lorem. Nulla" +
|
" auctor, nisi ipsum viverra erat, eget hendrerit felis turpis nec lorem. Nulla" +
|
||||||
" ultrices, elit pellentesque aliquet laoreet, justo erat pulvinar nisi, id" +
|
" ultrices, elit pellentesque aliquet laoreet, justo erat pulvinar nisi, id" +
|
||||||
" elementum sapien dolor et diam. Donec ac nunc sodales elit placerat eleifend." +
|
" elementum sapien dolor et diam. Donec ac nunc sodales elit placerat eleifend." +
|
||||||
" Sed ornare luctus ornare. Vestibulum vehicula, massa at pharetra fringilla, risus" +
|
" 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" +
|
" 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" +
|
" 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" +
|
" quis diam cursus facilisis. Sed mollis quam id justo rutrum sagittis. Donec" +
|
||||||
" laoreet rutrum est, nec convallis mauris condimentum sit amet. Phasellus gravida," +
|
" laoreet rutrum est, nec convallis mauris condimentum sit amet. Phasellus gravida," +
|
||||||
" justo et congue auctor, nisi ipsum viverra erat, eget hendrerit felis turpis nec" +
|
" justo et congue auctor, nisi ipsum viverra erat, eget hendrerit felis turpis nec" +
|
||||||
" lorem. Nulla ultrices, elit pellentesque aliquet laoreet, justo erat pulvinar" +
|
" lorem. Nulla ultrices, elit pellentesque aliquet laoreet, justo erat pulvinar" +
|
||||||
" nisi, id elementum sapien dolor et diam. Donec ac nunc sodales elit placerat" +
|
" nisi, id elementum sapien dolor et diam. Donec ac nunc sodales elit placerat" +
|
||||||
" eleifend. Sed ornare luctus ornare. Vestibulum vehicula, massa at pharetra" +
|
" eleifend. Sed ornare luctus ornare. Vestibulum vehicula, massa at pharetra" +
|
||||||
" fringilla, risus justo faucibus erat, nec porttitor nibh tellus sed est. Ut justo" +
|
" 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" +
|
" 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" +
|
" ullamcorper metus quis diam cursus facilisis. Sed mollis quam id justo rutrum" +
|
||||||
" sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum sit amet." +
|
" sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum sit amet." +
|
||||||
" Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat, eget hendrerit" +
|
" Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat, eget hendrerit" +
|
||||||
" felis turpis nec lorem. Nulla ultrices, elit pellentesque aliquet laoreet, justo" +
|
" 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" +
|
" erat pulvinar nisi, id elementum sapien dolor et diam. Donec ac nunc sodales elit" +
|
||||||
" placerat eleifend. Sed ornare luctus ornare. Vestibulum vehicula, massa at" +
|
" placerat eleifend. Sed ornare luctus ornare. Vestibulum vehicula, massa at" +
|
||||||
" pharetra fringilla, risus justo faucibus erat, nec porttitor nibh tellus sed est." +
|
" 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" +
|
" 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" +
|
" dictum. Nulla ullamcorper metus quis diam cursus facilisis. Sed mollis quam id" +
|
||||||
" justo rutrum sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum" +
|
" justo rutrum sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum" +
|
||||||
" sit amet. Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat," +
|
" sit amet. Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat," +
|
||||||
" eget hendrerit felis turpis nec lorem. Nulla ultrices, elit pellentesque aliquet" +
|
" eget hendrerit felis turpis nec lorem. Nulla ultrices, elit pellentesque aliquet" +
|
||||||
" laoreet, justo erat pulvinar nisi, id elementum sapien dolor et diam. Donec ac" +
|
" laoreet, justo erat pulvinar nisi, id elementum sapien dolor et diam. Donec ac" +
|
||||||
" nunc sodales elit placerat eleifend. Sed ornare luctus ornare. Vestibulum vehicula," +
|
" nunc sodales elit placerat eleifend. Sed ornare luctus ornare. Vestibulum vehicula," +
|
||||||
" massa at pharetra fringilla, risus justo faucibus erat, nec porttitor nibh tellus" +
|
" 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." +
|
" 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" +
|
" Nulla ullamcorper metus quis diam cursus facilisis. Sed mollis quam id justo rutrum" +
|
||||||
" sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum sit amet." +
|
" sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum sit amet." +
|
||||||
" Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat, eget" +
|
" Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat, eget" +
|
||||||
" hendrerit felis turpis nec lorem.", false, 31);
|
" hendrerit felis turpis nec lorem.", false, 31);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -38,9 +38,9 @@ import com.google.zxing.Result;
|
||||||
import com.google.zxing.common.BitArray;
|
import com.google.zxing.common.BitArray;
|
||||||
|
|
||||||
public final class RSSExpandedStackedInternalTestCase extends Assert {
|
public final class RSSExpandedStackedInternalTestCase extends Assert {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDecodingRowByRow() throws Exception {
|
public void testDecodingRowByRow() throws Exception {
|
||||||
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
RSSExpandedReader rssExpandedReader = new RSSExpandedReader();
|
||||||
|
|
||||||
BinaryBitmap binaryMap = TestCaseUtil.getBinaryBitmap("src/test/resources/blackbox/rssexpandedstacked-2/1000.png");
|
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);
|
Result result = RSSExpandedReader.constructResult(totalPairs);
|
||||||
assertEquals("(01)98898765432106(3202)012345(15)991231", result.getText());
|
assertEquals("(01)98898765432106(3202)012345(15)991231", result.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCompleteDecode() throws Exception {
|
public void testCompleteDecode() throws Exception {
|
||||||
OneDReader rssExpandedReader = new RSSExpandedReader();
|
OneDReader rssExpandedReader = new RSSExpandedReader();
|
||||||
|
|
||||||
BinaryBitmap binaryMap = TestCaseUtil.getBinaryBitmap("src/test/resources/blackbox/rssexpandedstacked-2/1000.png");
|
BinaryBitmap binaryMap = TestCaseUtil.getBinaryBitmap("src/test/resources/blackbox/rssexpandedstacked-2/1000.png");
|
||||||
|
|
||||||
Result result = rssExpandedReader.decode(binaryMap);
|
Result result = rssExpandedReader.decode(binaryMap);
|
||||||
assertEquals("(01)98898765432106(3202)012345(15)991231", result.getText());
|
assertEquals("(01)98898765432106(3202)012345(15)991231", result.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,12 +48,12 @@ final class TestCaseUtil {
|
||||||
file = new File("core", path);
|
file = new File("core", path);
|
||||||
}
|
}
|
||||||
return ImageIO.read(file);
|
return ImageIO.read(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BinaryBitmap getBinaryBitmap(String path) throws IOException {
|
static BinaryBitmap getBinaryBitmap(String path) throws IOException {
|
||||||
BufferedImage bufferedImage = getBufferedImage(path);
|
BufferedImage bufferedImage = getBufferedImage(path);
|
||||||
BufferedImageLuminanceSource luminanceSource = new BufferedImageLuminanceSource(bufferedImage);
|
BufferedImageLuminanceSource luminanceSource = new BufferedImageLuminanceSource(bufferedImage);
|
||||||
return new BinaryBitmap(new GlobalHistogramBinarizer(luminanceSource));
|
return new BinaryBitmap(new GlobalHistogramBinarizer(luminanceSource));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,26 +33,26 @@ import org.junit.Test;
|
||||||
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
|
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
|
||||||
*/
|
*/
|
||||||
public final class AI01_3103_DecoderTest extends AbstractDecoderTest {
|
public final class AI01_3103_DecoderTest extends AbstractDecoderTest {
|
||||||
|
|
||||||
private static final String header = "..X..";
|
private static final String header = "..X..";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_3103_1() throws Exception {
|
public void test01_3103_1() throws Exception {
|
||||||
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_1750;
|
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_1750;
|
||||||
String expected = "(01)90012345678908(3103)001750";
|
String expected = "(01)90012345678908(3103)001750";
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_3103_2() throws Exception {
|
public void test01_3103_2() throws Exception {
|
||||||
CharSequence data = header + compressedGtin_900000000000008 + compressed15bitWeight_0;
|
CharSequence data = header + compressedGtin_900000000000008 + compressed15bitWeight_0;
|
||||||
String expected = "(01)90000000000003(3103)000000";
|
String expected = "(01)90000000000003(3103)000000";
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NotFoundException.class)
|
@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 + "..";
|
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_1750 + "..";
|
||||||
assertCorrectBinaryString(data, "");
|
assertCorrectBinaryString(data, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,21 +33,21 @@ import org.junit.Test;
|
||||||
*/
|
*/
|
||||||
public final class AI01_3202_3203_DecoderTest extends AbstractDecoderTest {
|
public final class AI01_3202_3203_DecoderTest extends AbstractDecoderTest {
|
||||||
|
|
||||||
private static final String header = "..X.X";
|
private static final String header = "..X.X";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_3202_1() throws Exception {
|
public void test01_3202_1() throws Exception {
|
||||||
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_1750;
|
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_1750;
|
||||||
String expected = "(01)90012345678908(3202)001750";
|
String expected = "(01)90012345678908(3202)001750";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_3203_1() throws Exception {
|
public void test01_3203_1() throws Exception {
|
||||||
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_11750;
|
CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_11750;
|
||||||
String expected = "(01)90012345678908(3203)001750";
|
String expected = "(01)90012345678908(3203)001750";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,86 +32,86 @@ import org.junit.Test;
|
||||||
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
|
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
|
||||||
*/
|
*/
|
||||||
public final class AI01_3X0X_1X_DecoderTest extends AbstractDecoderTest {
|
public final class AI01_3X0X_1X_DecoderTest extends AbstractDecoderTest {
|
||||||
|
|
||||||
private static final String header_310x_11 = "..XXX...";
|
private static final String header_310x_11 = "..XXX...";
|
||||||
private static final String header_320x_11 = "..XXX..X";
|
private static final String header_320x_11 = "..XXX..X";
|
||||||
private static final String header_310x_13 = "..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_320x_13 = "..XXX.XX";
|
||||||
private static final String header_310x_15 = "..XXXX..";
|
private static final String header_310x_15 = "..XXXX..";
|
||||||
private static final String header_320x_15 = "..XXXX.X";
|
private static final String header_320x_15 = "..XXXX.X";
|
||||||
private static final String header_310x_17 = "..XXXXX.";
|
private static final String header_310x_17 = "..XXXXX.";
|
||||||
private static final String header_320x_17 = "..XXXXXX";
|
private static final String header_320x_17 = "..XXXXXX";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_310X_1X_endDate() throws Exception {
|
public void test01_310X_1X_endDate() throws Exception {
|
||||||
CharSequence data = header_310x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_End;
|
CharSequence data = header_310x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_End;
|
||||||
String expected = "(01)90012345678908(3100)001750";
|
String expected = "(01)90012345678908(3100)001750";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_310X_11_1() throws Exception {
|
public void test01_310X_11_1() throws Exception {
|
||||||
CharSequence data = header_310x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
CharSequence data = header_310x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
||||||
String expected = "(01)90012345678908(3100)001750(11)100312";
|
String expected = "(01)90012345678908(3100)001750(11)100312";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_320X_11_1() throws Exception {
|
public void test01_320X_11_1() throws Exception {
|
||||||
CharSequence data = header_320x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
CharSequence data = header_320x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
||||||
String expected = "(01)90012345678908(3200)001750(11)100312";
|
String expected = "(01)90012345678908(3200)001750(11)100312";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_310X_13_1() throws Exception {
|
public void test01_310X_13_1() throws Exception {
|
||||||
CharSequence data = header_310x_13 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
CharSequence data = header_310x_13 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
||||||
String expected = "(01)90012345678908(3100)001750(13)100312";
|
String expected = "(01)90012345678908(3100)001750(13)100312";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_320X_13_1() throws Exception {
|
public void test01_320X_13_1() throws Exception {
|
||||||
CharSequence data = header_320x_13 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
CharSequence data = header_320x_13 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
||||||
String expected = "(01)90012345678908(3200)001750(13)100312";
|
String expected = "(01)90012345678908(3200)001750(13)100312";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_310X_15_1() throws Exception {
|
public void test01_310X_15_1() throws Exception {
|
||||||
CharSequence data = header_310x_15 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
CharSequence data = header_310x_15 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
||||||
String expected = "(01)90012345678908(3100)001750(15)100312";
|
String expected = "(01)90012345678908(3100)001750(15)100312";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_320X_15_1() throws Exception {
|
public void test01_320X_15_1() throws Exception {
|
||||||
CharSequence data = header_320x_15 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
CharSequence data = header_320x_15 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
||||||
String expected = "(01)90012345678908(3200)001750(15)100312";
|
String expected = "(01)90012345678908(3200)001750(15)100312";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_310X_17_1() throws Exception {
|
public void test01_310X_17_1() throws Exception {
|
||||||
CharSequence data = header_310x_17 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
CharSequence data = header_310x_17 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
||||||
String expected = "(01)90012345678908(3100)001750(17)100312";
|
String expected = "(01)90012345678908(3100)001750(17)100312";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test01_320X_17_1() throws Exception {
|
public void test01_320X_17_1() throws Exception {
|
||||||
CharSequence data = header_320x_17 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
CharSequence data = header_320x_17 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010;
|
||||||
String expected = "(01)90012345678908(3200)001750(17)100312";
|
String expected = "(01)90012345678908(3200)001750(17)100312";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,40 +38,40 @@ import org.junit.Assert;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractDecoderTest extends Assert {
|
public abstract class AbstractDecoderTest extends Assert {
|
||||||
|
|
||||||
protected static final String numeric_10 = "..X..XX";
|
protected static final String numeric_10 = "..X..XX";
|
||||||
protected static final String numeric_12 = "..X.X.X";
|
protected static final String numeric_12 = "..X.X.X";
|
||||||
protected static final String numeric_1FNC1 = "..XXX.X";
|
protected static final String numeric_1FNC1 = "..XXX.X";
|
||||||
//protected static final String numeric_FNC11 = "XXX.XXX";
|
//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 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 {
|
String expectedNumber) throws NotFoundException, FormatException {
|
||||||
BitArray binary = BinaryUtil.buildBitArrayFromStringWithoutSpaces(binaryString);
|
BitArray binary = BinaryUtil.buildBitArrayFromStringWithoutSpaces(binaryString);
|
||||||
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
|
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
|
||||||
String result = decoder.parseInformation();
|
String result = decoder.parseInformation();
|
||||||
assertEquals(expectedNumber, result);
|
assertEquals(expectedNumber, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,54 +32,54 @@ import org.junit.Test;
|
||||||
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
|
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
|
||||||
*/
|
*/
|
||||||
public final class AnyAIDecoderTest extends AbstractDecoderTest {
|
public final class AnyAIDecoderTest extends AbstractDecoderTest {
|
||||||
|
|
||||||
private static final String header = ".....";
|
private static final String header = ".....";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAnyAIDecoder_1() throws Exception {
|
public void testAnyAIDecoder_1() throws Exception {
|
||||||
CharSequence data = header + numeric_10 + numeric_12 + numeric2alpha + alpha_A + alpha2numeric + numeric_12;
|
CharSequence data = header + numeric_10 + numeric_12 + numeric2alpha + alpha_A + alpha2numeric + numeric_12;
|
||||||
String expected = "(10)12A12";
|
String expected = "(10)12A12";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAnyAIDecoder_2() throws Exception {
|
public void testAnyAIDecoder_2() throws Exception {
|
||||||
CharSequence data = header + numeric_10 + numeric_12 + numeric2alpha + alpha_A + alpha2isoiec646 + i646_B;
|
CharSequence data = header + numeric_10 + numeric_12 + numeric2alpha + alpha_A + alpha2isoiec646 + i646_B;
|
||||||
String expected = "(10)12AB";
|
String expected = "(10)12AB";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAnyAIDecoder_3() throws Exception {
|
public void testAnyAIDecoder_3() throws Exception {
|
||||||
CharSequence data = header + numeric_10 + numeric2alpha + alpha2isoiec646 + i646_B + i646_C + isoiec646_2alpha + alpha_A + alpha2numeric + numeric_10;
|
CharSequence data = header + numeric_10 + numeric2alpha + alpha2isoiec646 + i646_B + i646_C + isoiec646_2alpha + alpha_A + alpha2numeric + numeric_10;
|
||||||
String expected = "(10)BCA10";
|
String expected = "(10)BCA10";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
assertCorrectBinaryString(data, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAnyAIDecoder_numericFNC1_secondDigit() throws Exception {
|
public void testAnyAIDecoder_numericFNC1_secondDigit() throws Exception {
|
||||||
CharSequence data = header + numeric_10 + numeric_1FNC1;
|
CharSequence data = header + numeric_10 + numeric_1FNC1;
|
||||||
String expected = "(10)1";
|
String expected = "(10)1";
|
||||||
|
|
||||||
assertCorrectBinaryString(data, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
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
|
@Test
|
||||||
public void testAnyAIDecoder_646FNC1() throws Exception {
|
public void testAnyAIDecoder_alphaFNC1() throws Exception {
|
||||||
CharSequence data = header + numeric_10 + numeric2alpha + alpha_A + isoiec646_2alpha + i646_B + i646_FNC1;
|
CharSequence data = header + numeric_10 + numeric2alpha + alpha_A + alpha_FNC1;
|
||||||
String expected = "(10)AB";
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,20 +35,20 @@ import org.junit.Test;
|
||||||
* @author Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es)
|
* @author Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es)
|
||||||
*/
|
*/
|
||||||
public final class FieldParserTest extends Assert {
|
public final class FieldParserTest extends Assert {
|
||||||
|
|
||||||
private static void checkFields(String expected) throws NotFoundException {
|
private static void checkFields(String expected) throws NotFoundException {
|
||||||
String field = expected.replace("(", "").replace(")","");
|
String field = expected.replace("(", "").replace(")","");
|
||||||
String actual = FieldParser.parseFieldsInGeneralPurpose(field);
|
String actual = FieldParser.parseFieldsInGeneralPurpose(field);
|
||||||
assertEquals(expected, actual);
|
assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseField() throws Exception{
|
public void testParseField() throws Exception{
|
||||||
checkFields("(15)991231(3103)001750(10)12A");
|
checkFields("(15)991231(3103)001750(10)12A");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseField2() throws Exception{
|
public void testParseField2() throws Exception{
|
||||||
checkFields("(15)991231(15)991231(3103)001750(10)12A");
|
checkFields("(15)991231(15)991231(3103)001750(10)12A");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,10 +147,10 @@ final class DecodeWorker implements Callable<Integer> {
|
||||||
}
|
}
|
||||||
Result result = new MultiFormatReader().decode(bitmap, hints);
|
Result result = new MultiFormatReader().decode(bitmap, hints);
|
||||||
if (config.isBrief()) {
|
if (config.isBrief()) {
|
||||||
System.out.println(uri.toString() + ": Success");
|
System.out.println(uri + ": Success");
|
||||||
} else {
|
} else {
|
||||||
ParsedResult parsedResult = ResultParser.parseResult(result);
|
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.getType() + "):\nRaw result:\n" + result.getText() + "\nParsed result:\n" +
|
||||||
parsedResult.getDisplayResult());
|
parsedResult.getDisplayResult());
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ final class DecodeWorker implements Callable<Integer> {
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
} catch (NotFoundException ignored) {
|
} catch (NotFoundException ignored) {
|
||||||
System.out.println(uri.toString() + ": No barcode found");
|
System.out.println(uri + ": No barcode found");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,11 +191,11 @@ final class DecodeWorker implements Callable<Integer> {
|
||||||
Result[] results = reader.decodeMultiple(bitmap, hints);
|
Result[] results = reader.decodeMultiple(bitmap, hints);
|
||||||
|
|
||||||
if (config.isBrief()) {
|
if (config.isBrief()) {
|
||||||
System.out.println(uri.toString() + ": Success");
|
System.out.println(uri + ": Success");
|
||||||
} else {
|
} else {
|
||||||
for (Result result : results) {
|
for (Result result : results) {
|
||||||
ParsedResult parsedResult = ResultParser.parseResult(result);
|
ParsedResult parsedResult = ResultParser.parseResult(result);
|
||||||
System.out.println(uri.toString() + " (format: "
|
System.out.println(uri + " (format: "
|
||||||
+ result.getBarcodeFormat() + ", type: "
|
+ result.getBarcodeFormat() + ", type: "
|
||||||
+ parsedResult.getType() + "):\nRaw result:\n"
|
+ parsedResult.getType() + "):\nRaw result:\n"
|
||||||
+ result.getText() + "\nParsed result:\n"
|
+ result.getText() + "\nParsed result:\n"
|
||||||
|
@ -209,7 +209,7 @@ final class DecodeWorker implements Callable<Integer> {
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
} catch (NotFoundException ignored) {
|
} catch (NotFoundException ignored) {
|
||||||
System.out.println(uri.toString() + ": No barcode found");
|
System.out.println(uri + ": No barcode found");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ public final class WifiGenerator implements GeneratorSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getPasswordField() throws GeneratorException {
|
private String getPasswordField() throws GeneratorException {
|
||||||
return parseTextField("Password", password);
|
return parseTextField("Password", password);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getNetworkTypeField() {
|
private String getNetworkTypeField() {
|
||||||
|
|
Loading…
Reference in a new issue