Small style stuff

git-svn-id: https://zxing.googlecode.com/svn/trunk@1622 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2010-10-12 11:38:43 +00:00
parent 78e1460bfd
commit eaecf26bf6
4 changed files with 13 additions and 17 deletions

View file

@ -43,6 +43,10 @@ final class BitMatrixParser {
this.readMappingMatrix = new BitMatrix(this.mappingBitMatrix.getWidth(), this.mappingBitMatrix.getHeight());
}
Version getVersion() {
return version;
}
/**
* <p>Creates the version object based on the dimension of the original bit matrix from
* the datamatrix code.</p>
@ -54,15 +58,9 @@ final class BitMatrixParser {
* @throws FormatException if the dimensions of the mapping matrix are not valid
* Data Matrix dimensions.
*/
Version readVersion(BitMatrix bitMatrix) throws FormatException {
if (version != null) {
return version;
}
private static Version readVersion(BitMatrix bitMatrix) throws FormatException {
int numRows = bitMatrix.getHeight();
int numColumns = bitMatrix.getWidth();
return Version.getVersionForDimensions(numRows, numColumns);
}

View file

@ -73,7 +73,7 @@ public final class Decoder {
// Construct a parser and read version, error-correction level
BitMatrixParser parser = new BitMatrixParser(bits);
Version version = parser.readVersion(bits);
Version version = parser.getVersion();
// Read codewords
byte[] codewords = parser.readCodewords();

View file

@ -52,12 +52,10 @@ public final class Decoder {
*
* @param image booleans representing white/black QR Code modules
* @return text and bytes encoded within the QR Code
* @throws NotFoundException if the QR Code cannot be found
* @throws FormatException if the QR Code cannot be decoded
* @throws ChecksumException if error correction fails
*/
public DecoderResult decode(boolean[][] image, Hashtable hints)
throws ChecksumException, FormatException, NotFoundException {
public DecoderResult decode(boolean[][] image, Hashtable hints) throws ChecksumException, FormatException {
int dimension = image.length;
BitMatrix bits = new BitMatrix(dimension);
for (int i = 0; i < dimension; i++) {
@ -70,7 +68,7 @@ public final class Decoder {
return decode(bits, hints);
}
public DecoderResult decode(BitMatrix bits) throws ChecksumException, FormatException, NotFoundException {
public DecoderResult decode(BitMatrix bits) throws ChecksumException, FormatException {
return decode(bits, null);
}

View file

@ -553,7 +553,7 @@ public class FinderPatternFinder {
*/
private static class FurthestFromAverageComparator implements Comparator {
private final float average;
public FurthestFromAverageComparator(float f) {
private FurthestFromAverageComparator(float f) {
average = f;
}
public int compare(Object center1, Object center2) {
@ -568,16 +568,16 @@ public class FinderPatternFinder {
*/
private static class CenterComparator implements Comparator {
private final float average;
public CenterComparator(float f) {
private CenterComparator(float f) {
average = f;
}
public int compare(Object center1, Object center2) {
if (((FinderPattern) center2).getCount() != ((FinderPattern) center1).getCount()) {
return ((FinderPattern) center2).getCount() - ((FinderPattern) center1).getCount();
} else {
if (((FinderPattern) center2).getCount() == ((FinderPattern) center1).getCount()) {
float dA = Math.abs(((FinderPattern) center2).getEstimatedModuleSize() - average);
float dB = Math.abs(((FinderPattern) center1).getEstimatedModuleSize() - average);
return dA < dB ? 1 : (dA == dB ? 0 : -1);
} else {
return ((FinderPattern) center2).getCount() - ((FinderPattern) center1).getCount();
}
}
}