More small changes from code inspection

git-svn-id: https://zxing.googlecode.com/svn/trunk@800 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2008-12-21 18:54:58 +00:00
parent fa59c4e093
commit d242b00126
9 changed files with 17 additions and 15 deletions

View file

@ -45,6 +45,8 @@ public final class ReaderException extends Exception {
}
// Prevent stack traces from being taken
// srowen says: huh, my IDE is saying this is not an override. native methods can't be overridden?
// This, at least, does not hurt. Because we use a singleton pattern here, it doesn't matter anyhow.
public Throwable fillInStackTrace() {
return null;
}

View file

@ -57,7 +57,7 @@ final class SMSMMSResultParser extends ResultParser {
String subject = null;
String body = null;
boolean querySyntax = false;
if (nameValuePairs != null && nameValuePairs.size() > 0) {
if (nameValuePairs != null && !nameValuePairs.isEmpty()) {
subject = (String) nameValuePairs.get("subject");
body = (String) nameValuePairs.get("body");
querySyntax = true;

View file

@ -66,7 +66,7 @@ public final class ByteArray {
public void appendByte(int value) {
if (size == 0 || size >= bytes.length) {
int newSize = Math.max(INITIAL_SIZE, size * 2);
int newSize = Math.max(INITIAL_SIZE, size << 1);
reserve(newSize);
}
bytes[size] = (byte) value;

View file

@ -87,7 +87,7 @@ public final class ByteMatrix {
break;
}
}
result.append("\n");
result.append('\n');
}
return result.toString();
}

View file

@ -26,7 +26,7 @@ final class BitMatrixParser {
private final BitMatrix mappingBitMatrix;
private final BitMatrix readMappingMatrix;
private Version version;
private final Version version;
/**
* @param bitMatrix {@link BitMatrix} to parse

View file

@ -86,7 +86,7 @@ public abstract class AbstractUPCEANReader extends AbstractOneDReader implements
private final StringBuffer decodeRowStringBuffer;
public AbstractUPCEANReader() {
protected AbstractUPCEANReader() {
decodeRowStringBuffer = new StringBuffer(20);
}

View file

@ -60,7 +60,7 @@ public final class ITFReader extends AbstractOneDReader {
/**
* Patterns of Wide / Narrow lines to indicate each digit
*/
static final int[][] PATTERNS = {
private static final int[][] PATTERNS = {
{N, N, W, W, N}, // 0
{W, N, N, N, W}, // 1
{N, W, N, N, W}, // 2
@ -106,7 +106,7 @@ public final class ITFReader extends AbstractOneDReader {
* @param resultString {@link StringBuffer} to append decoded chars to
* @throws ReaderException if decoding could not complete successfully
*/
protected void decodeMiddle(BitArray row, int payloadStart, int payloadEnd, StringBuffer resultString) throws ReaderException {
static void decodeMiddle(BitArray row, int payloadStart, int payloadEnd, StringBuffer resultString) throws ReaderException {
// Digits are interleaved in pairs - 5 black lines for one digit, and the
// 5
@ -129,9 +129,9 @@ public final class ITFReader extends AbstractOneDReader {
}
int bestMatch = decodeDigit(counterBlack);
resultString.append((char) ('0' + bestMatch % 10));
resultString.append((char) ('0' + bestMatch));
bestMatch = decodeDigit(counterWhite);
resultString.append((char) ('0' + bestMatch % 10));
resultString.append((char) ('0' + bestMatch));
for (int i = 0; i < counterDigitPair.length; i++) {
payloadStart += counterDigitPair[i];
@ -312,7 +312,7 @@ public final class ITFReader extends AbstractOneDReader {
* @return The decoded digit
* @throws ReaderException if digit cannot be decoded
*/
static int decodeDigit(int[] counters) throws ReaderException {
private static int decodeDigit(int[] counters) throws ReaderException {
int bestVariance = MAX_AVG_VARIANCE; // worst variance we'll accept
int bestMatch = -1;

View file

@ -54,7 +54,7 @@ public final class QRCodeWriter implements Writer {
}
if (width < 0 || height < 0) {
throw new IllegalArgumentException("Requested dimensions are too small: " + width + "x" +
throw new IllegalArgumentException("Requested dimensions are too small: " + width + 'x' +
height);
}
@ -73,12 +73,12 @@ public final class QRCodeWriter implements Writer {
// Note that the input matrix uses 0 == white, 1 == black, while the output matrix uses
// 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).
private ByteMatrix renderResult(QRCode code, int width, int height) {
private static ByteMatrix renderResult(QRCode code, int width, int height) {
ByteMatrix input = code.getMatrix();
int inputWidth = input.width();
int inputHeight = input.height();
int qrWidth = inputWidth + (QUIET_ZONE_SIZE * 2);
int qrHeight = inputHeight + (QUIET_ZONE_SIZE * 2);
int qrWidth = inputWidth + (QUIET_ZONE_SIZE << 1);
int qrHeight = inputHeight + (QUIET_ZONE_SIZE << 1);
int outputWidth = Math.max(width, qrWidth);
int outputHeight = Math.max(height, qrHeight);

View file

@ -77,7 +77,7 @@ final class FormatInformation {
private final ErrorCorrectionLevel errorCorrectionLevel;
private final byte dataMask;
private FormatInformation(int formatInfo) throws ReaderException {
private FormatInformation(int formatInfo) {
// Bits 3,4
errorCorrectionLevel = ErrorCorrectionLevel.forBits((formatInfo >> 3) & 0x03);
// Bottom 3 bits