Class RSSExpandedReader
- java.lang.Object
-
- com.google.zxing.oned.OneDReader
-
- com.google.zxing.oned.rss.AbstractRSSReader
-
- com.google.zxing.oned.rss.expanded.RSSExpandedReader
-
- All Implemented Interfaces:
Reader
public final class RSSExpandedReader extends AbstractRSSReader
-
-
Field Summary
Fields Modifier and Type Field Description private static floatDATA_CHARACTER_MODULESprivate static int[]EVEN_TOTAL_SUBSETprivate static intFINDER_PAT_Aprivate static intFINDER_PAT_Bprivate static intFINDER_PAT_Cprivate static intFINDER_PAT_Dprivate static intFINDER_PAT_Eprivate static intFINDER_PAT_Fprivate static floatFINDER_PATTERN_MODULESprivate static int[][]FINDER_PATTERN_SEQUENCESThe possible finder pattern sequences, from section 7.2.7 of ISO/IEC 24724:2006.private static int[][]FINDER_PATTERNSFinder pattern element widths, from section 7.2.7 of ISO/IEC 24724:2006.private static int[]GSUMprivate static floatMAX_FINDER_PATTERN_DISTANCE_VARIANCEprivate static intMAX_PAIRSprivate java.util.List<ExpandedPair>pairsprivate java.util.List<ExpandedRow>rowsprivate int[]startEndprivate booleanstartFromEvenprivate static int[]SYMBOL_WIDESTprivate static int[][]WEIGHTSThe element weights used in the checksum calculation, from section 7.2.6 of ISO/IEC 24724:2006.
-
Constructor Summary
Constructors Constructor Description RSSExpandedReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidadjustOddEvenCounts(int numModules)private booleancheckChecksum()private java.util.List<ExpandedPair>checkRows(boolean reverse)private java.util.List<ExpandedPair>checkRows(java.util.List<ExpandedRow> collectedRows, int currentRow)(package private) static ResultconstructResult(java.util.List<ExpandedPair> pairs)(package private) DataCharacterdecodeDataCharacter(BitArray row, FinderPattern pattern, boolean isOddPattern, boolean leftChar)ResultdecodeRow(int rowNumber, BitArray row, java.util.Map<DecodeHintType,?> hints)Attempts to decode a one-dimensional barcode format given a single row of an image.(package private) java.util.List<ExpandedPair>decodeRow2pairs(int rowNumber, BitArray row)private voidfindNextPair(BitArray row, java.util.List<ExpandedPair> previousPairs, int forcedOffset)private static intgetNextSecondBar(BitArray row, int initialPos)(package private) java.util.List<ExpandedRow>getRows()private static booleanisNotA1left(FinderPattern pattern, boolean isOddPattern, boolean leftChar)private static booleanisPartialRow(java.lang.Iterable<ExpandedPair> pairs, java.lang.Iterable<ExpandedRow> rows)private static booleanisValidSequence(java.util.List<ExpandedPair> pairs, boolean complete)private static booleanmayFollow(java.util.List<ExpandedPair> pairs, int value)private FinderPatternparseFoundFinderPattern(BitArray row, int rowNumber, boolean oddPattern, java.util.List<ExpandedPair> previousPairs)private static voidremovePartialRows(java.util.Collection<ExpandedPair> pairs, java.util.Collection<ExpandedRow> rows)voidreset()Resets any internal state the implementation has after a decode, to prepare it for reuse.(package private) ExpandedPairretrieveNextPair(BitArray row, java.util.List<ExpandedPair> previousPairs, int rowNumber)private static voidreverseCounters(int[] counters)private voidstoreRow(int rowNumber)-
Methods inherited from class com.google.zxing.oned.rss.AbstractRSSReader
count, decrement, getDataCharacterCounters, getDecodeFinderCounters, getEvenCounts, getEvenRoundingErrors, getOddCounts, getOddRoundingErrors, increment, isFinderPattern, parseFinderValue
-
Methods inherited from class com.google.zxing.oned.OneDReader
decode, decode, patternMatchVariance, recordPattern, recordPatternInReverse
-
-
-
-
Field Detail
-
SYMBOL_WIDEST
private static final int[] SYMBOL_WIDEST
-
EVEN_TOTAL_SUBSET
private static final int[] EVEN_TOTAL_SUBSET
-
GSUM
private static final int[] GSUM
-
FINDER_PATTERNS
private static final int[][] FINDER_PATTERNS
Finder pattern element widths, from section 7.2.7 of ISO/IEC 24724:2006.
-
WEIGHTS
private static final int[][] WEIGHTS
The element weights used in the checksum calculation, from section 7.2.6 of ISO/IEC 24724:2006.
-
FINDER_PAT_A
private static final int FINDER_PAT_A
- See Also:
- Constant Field Values
-
FINDER_PAT_B
private static final int FINDER_PAT_B
- See Also:
- Constant Field Values
-
FINDER_PAT_C
private static final int FINDER_PAT_C
- See Also:
- Constant Field Values
-
FINDER_PAT_D
private static final int FINDER_PAT_D
- See Also:
- Constant Field Values
-
FINDER_PAT_E
private static final int FINDER_PAT_E
- See Also:
- Constant Field Values
-
FINDER_PAT_F
private static final int FINDER_PAT_F
- See Also:
- Constant Field Values
-
FINDER_PATTERN_SEQUENCES
private static final int[][] FINDER_PATTERN_SEQUENCES
The possible finder pattern sequences, from section 7.2.7 of ISO/IEC 24724:2006.
-
MAX_PAIRS
private static final int MAX_PAIRS
- See Also:
- Constant Field Values
-
FINDER_PATTERN_MODULES
private static final float FINDER_PATTERN_MODULES
- See Also:
- Constant Field Values
-
DATA_CHARACTER_MODULES
private static final float DATA_CHARACTER_MODULES
- See Also:
- Constant Field Values
-
MAX_FINDER_PATTERN_DISTANCE_VARIANCE
private static final float MAX_FINDER_PATTERN_DISTANCE_VARIANCE
- See Also:
- Constant Field Values
-
pairs
private final java.util.List<ExpandedPair> pairs
-
rows
private final java.util.List<ExpandedRow> rows
-
startEnd
private final int[] startEnd
-
startFromEven
private boolean startFromEven
-
-
Method Detail
-
decodeRow
public Result decodeRow(int rowNumber, BitArray row, java.util.Map<DecodeHintType,?> hints) throws NotFoundException, FormatException
Description copied from class:OneDReaderAttempts to decode a one-dimensional barcode format given a single row of an image.
- Specified by:
decodeRowin classOneDReader- Parameters:
rowNumber- row number from top of the rowrow- the black/white pixel data of the rowhints- decode hints- Returns:
Resultcontaining encoded string and start/end of barcode- Throws:
NotFoundException- if no potential barcode is foundFormatException- if a potential barcode is found but format is invalid
-
reset
public void reset()
Description copied from interface:ReaderResets any internal state the implementation has after a decode, to prepare it for reuse.- Specified by:
resetin interfaceReader- Overrides:
resetin classOneDReader
-
decodeRow2pairs
java.util.List<ExpandedPair> decodeRow2pairs(int rowNumber, BitArray row) throws NotFoundException
- Throws:
NotFoundException
-
checkRows
private java.util.List<ExpandedPair> checkRows(boolean reverse)
-
checkRows
private java.util.List<ExpandedPair> checkRows(java.util.List<ExpandedRow> collectedRows, int currentRow) throws NotFoundException
- Throws:
NotFoundException
-
isValidSequence
private static boolean isValidSequence(java.util.List<ExpandedPair> pairs, boolean complete)
-
mayFollow
private static boolean mayFollow(java.util.List<ExpandedPair> pairs, int value)
-
storeRow
private void storeRow(int rowNumber)
-
removePartialRows
private static void removePartialRows(java.util.Collection<ExpandedPair> pairs, java.util.Collection<ExpandedRow> rows)
-
isPartialRow
private static boolean isPartialRow(java.lang.Iterable<ExpandedPair> pairs, java.lang.Iterable<ExpandedRow> rows)
-
getRows
java.util.List<ExpandedRow> getRows()
-
constructResult
static Result constructResult(java.util.List<ExpandedPair> pairs) throws NotFoundException, FormatException
- Throws:
NotFoundExceptionFormatException
-
checkChecksum
private boolean checkChecksum()
-
getNextSecondBar
private static int getNextSecondBar(BitArray row, int initialPos)
-
retrieveNextPair
ExpandedPair retrieveNextPair(BitArray row, java.util.List<ExpandedPair> previousPairs, int rowNumber) throws NotFoundException
- Throws:
NotFoundException
-
findNextPair
private void findNextPair(BitArray row, java.util.List<ExpandedPair> previousPairs, int forcedOffset) throws NotFoundException
- Throws:
NotFoundException
-
reverseCounters
private static void reverseCounters(int[] counters)
-
parseFoundFinderPattern
private FinderPattern parseFoundFinderPattern(BitArray row, int rowNumber, boolean oddPattern, java.util.List<ExpandedPair> previousPairs)
-
decodeDataCharacter
DataCharacter decodeDataCharacter(BitArray row, FinderPattern pattern, boolean isOddPattern, boolean leftChar) throws NotFoundException
- Throws:
NotFoundException
-
isNotA1left
private static boolean isNotA1left(FinderPattern pattern, boolean isOddPattern, boolean leftChar)
-
adjustOddEvenCounts
private void adjustOddEvenCounts(int numModules) throws NotFoundException- Throws:
NotFoundException
-
-