Issue 249, fix references to methods not in MIDP 2

git-svn-id: https://zxing.googlecode.com/svn/trunk@1073 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2009-10-13 17:16:19 +00:00
parent 16c8ded299
commit fbcafd74c8
3 changed files with 8 additions and 7 deletions

View file

@ -67,13 +67,13 @@ public final class CharacterSetECI extends ECI {
private static void addCharacterSet(int value, String encodingName) {
CharacterSetECI eci = new CharacterSetECI(value, encodingName);
VALUE_TO_ECI.put(Integer.valueOf(value), eci);
VALUE_TO_ECI.put(new Integer(value), eci); // can't use valueOf
NAME_TO_ECI.put(encodingName, eci);
}
private static void addCharacterSet(int value, String[] encodingNames) {
CharacterSetECI eci = new CharacterSetECI(value, encodingNames[0]);
VALUE_TO_ECI.put(Integer.valueOf(value), eci);
VALUE_TO_ECI.put(new Integer(value), eci); // can't use valueOf
for (int i = 0; i < encodingNames.length; i++) {
NAME_TO_ECI.put(encodingNames[i], eci);
}
@ -92,7 +92,7 @@ public final class CharacterSetECI extends ECI {
if (value < 0 || value >= 900) {
throw new IllegalArgumentException("Bad ECI value: " + value);
}
return (CharacterSetECI) VALUE_TO_ECI.get(Integer.valueOf(value));
return (CharacterSetECI) VALUE_TO_ECI.get(new Integer(value));
}
/**

View file

@ -42,7 +42,8 @@ public final class Detector {
// Trick to avoid creating new Integer objects below -- a sort of crude copy of
// the Integer.valueOf(int) optimization added in Java 5, not in J2ME
private static final Integer[] INTEGERS =
{ Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3), Integer.valueOf(4) };
{ new Integer(0), new Integer(1), new Integer(2), new Integer(3), new Integer(4) };
// No, can't use valueOf()
private final BitMatrix image;
private final MonochromeRectangleDetector rectangleDetector;

View file

@ -492,13 +492,13 @@ public class FinderPatternFinder {
// But we can only afford to do so if we have at least 4 possibilities to choose from
float totalModuleSize = 0.0f;
for (int i = 0; i < startSize; i++) {
totalModuleSize += ((FinderPattern) possibleCenters.get(i)).getEstimatedModuleSize();
totalModuleSize += ((FinderPattern) possibleCenters.elementAt(i)).getEstimatedModuleSize();
}
float average = totalModuleSize / (float) startSize;
for (int i = 0; i < possibleCenters.size() && possibleCenters.size() > 3; i++) {
FinderPattern pattern = (FinderPattern) possibleCenters.get(i);
FinderPattern pattern = (FinderPattern) possibleCenters.elementAt(i);
if (Math.abs(pattern.getEstimatedModuleSize() - average) > 0.2f * average) {
possibleCenters.remove(i);
possibleCenters.removeElementAt(i);
i--;
}
}