本文整理汇总了Java中com.google.zxing.common.BitArray.reverse方法的典型用法代码示例。如果您正苦于以下问题:Java BitArray.reverse方法的具体用法?Java BitArray.reverse怎么用?Java BitArray.reverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.zxing.common.BitArray
的用法示例。
在下文中一共展示了BitArray.reverse方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodeRow
import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
@Override
public Result decodeRow(int rowNumber,
BitArray row,
Map<DecodeHintType,?> hints) throws NotFoundException {
Pair leftPair = decodePair(row, false, rowNumber, hints);
addOrTally(possibleLeftPairs, leftPair);
row.reverse();
Pair rightPair = decodePair(row, true, rowNumber, hints);
addOrTally(possibleRightPairs, rightPair);
row.reverse();
for (Pair left : possibleLeftPairs) {
if (left.getCount() > 1) {
for (Pair right : possibleRightPairs) {
if (right.getCount() > 1) {
if (checkChecksum(left, right)) {
return constructResult(left, right);
}
}
}
}
}
throw NotFoundException.getNotFoundInstance();
}
示例2: decodeRow
import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
public Result decodeRow(int rowNumber, BitArray row, Map<DecodeHintType, ?> hints) throws
NotFoundException {
addOrTally(this.possibleLeftPairs, decodePair(row, false, rowNumber, hints));
row.reverse();
addOrTally(this.possibleRightPairs, decodePair(row, true, rowNumber, hints));
row.reverse();
int lefSize = this.possibleLeftPairs.size();
for (int i = 0; i < lefSize; i++) {
Pair left = (Pair) this.possibleLeftPairs.get(i);
if (left.getCount() > 1) {
int rightSize = this.possibleRightPairs.size();
for (int j = 0; j < rightSize; j++) {
Pair right = (Pair) this.possibleRightPairs.get(j);
if (right.getCount() > 1 && checkChecksum(left, right)) {
return constructResult(left, right);
}
}
continue;
}
}
throw NotFoundException.getNotFoundInstance();
}
示例3: decodeRow
import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
@Override
public Result decodeRow(int rowNumber,
BitArray row,
Map<DecodeHintType,?> hints) throws NotFoundException {
Pair leftPair = decodePair(row, false, rowNumber, hints);
addOrTally(possibleLeftPairs, leftPair);
row.reverse();
Pair rightPair = decodePair(row, true, rowNumber, hints);
addOrTally(possibleRightPairs, rightPair);
row.reverse();
for (Pair left : possibleLeftPairs) {
if (left.getCount() > 1) {
for (Pair right : possibleRightPairs) {
if (right.getCount() > 1 && checkChecksum(left, right)) {
return constructResult(left, right);
}
}
}
}
throw NotFoundException.getNotFoundInstance();
}
示例4: decodeEnd
import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
/**
* Identify where the end of the middle / payload section ends.
*
* @param row row of black/white values to search
* @return Array, containing index of start of 'end block' and end of 'end
* block'
* @throws NotFoundException
*/
int[] decodeEnd(BitArray row) throws NotFoundException {
// For convenience, reverse the row and then
// search from 'the start' for the end block
row.reverse();
try {
int endStart = skipWhiteSpace(row);
int[] endPattern = findGuardPattern(row, endStart, END_PATTERN_REVERSED);
// The start & end patterns must be pre/post fixed by a quiet zone. This
// zone must be at least 10 times the width of a narrow line.
// ref: http://www.barcode-1.net/i25code.html
validateQuietZone(row, endPattern[0]);
// Now recalculate the indices of where the 'endblock' starts & stops to
// accommodate
// the reversed nature of the search
int temp = endPattern[0];
endPattern[0] = row.getSize() - endPattern[1];
endPattern[1] = row.getSize() - temp;
return endPattern;
} finally {
// Put the row back the right way.
row.reverse();
}
}
示例5: decodeRow
import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
@Override
public Result decodeRow(int rowNumber,
BitArray row,
Map<DecodeHintType,?> hints) throws NotFoundException {
Pair leftPair = decodePair(row, false, rowNumber, hints);
addOrTally(possibleLeftPairs, leftPair);
row.reverse();
Pair rightPair = decodePair(row, true, rowNumber, hints);
addOrTally(possibleRightPairs, rightPair);
row.reverse();
int lefSize = possibleLeftPairs.size();
for (int i = 0; i < lefSize; i++) {
Pair left = possibleLeftPairs.get(i);
if (left.getCount() > 1) {
int rightSize = possibleRightPairs.size();
for (int j = 0; j < rightSize; j++) {
Pair right = possibleRightPairs.get(j);
if (right.getCount() > 1) {
if (checkChecksum(left, right)) {
return constructResult(left, right);
}
}
}
}
}
throw NotFoundException.getNotFoundInstance();
}
示例6: decodeEnd
import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
/**
* Identify where the end of the middle / payload section ends.
*
* @param row row of black/white values to search
* @return Array, containing index of start of 'end block' and end of 'end
* block'
*/
private int[] decodeEnd(BitArray row) throws NotFoundException {
// For convenience, reverse the row and then
// search from 'the start' for the end block
row.reverse();
try {
int endStart = skipWhiteSpace(row);
int[] endPattern = findGuardPattern(row, endStart, END_PATTERN_REVERSED);
// The start & end patterns must be pre/post fixed by a quiet zone. This
// zone must be at least 10 times the width of a narrow line.
// ref: http://www.barcode-1.net/i25code.html
validateQuietZone(row, endPattern[0]);
// Now recalculate the indices of where the 'endblock' starts & stops to
// accommodate
// the reversed nature of the search
int temp = endPattern[0];
endPattern[0] = row.getSize() - endPattern[1];
endPattern[1] = row.getSize() - temp;
return endPattern;
} finally {
// Put the row back the right way.
row.reverse();
}
}
示例7: decodeEnd
import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
int[] decodeEnd(BitArray row) throws NotFoundException {
row.reverse();
try {
int[] endPattern = findGuardPattern(row, skipWhiteSpace(row), END_PATTERN_REVERSED);
validateQuietZone(row, endPattern[0]);
int temp = endPattern[0];
endPattern[0] = row.getSize() - endPattern[1];
endPattern[1] = row.getSize() - temp;
return endPattern;
} finally {
row.reverse();
}
}
示例8: doDecode
import com.google.zxing.common.BitArray; //导入方法依赖的package包/类
private Result doDecode(BinaryBitmap image, Map<DecodeHintType, ?> hints) throws
NotFoundException {
int maxLines;
int width = image.getWidth();
int height = image.getHeight();
BitArray row = new BitArray(width);
int middle = height >> 1;
boolean tryHarder = hints != null && hints.containsKey(DecodeHintType.TRY_HARDER);
int rowStep = Math.max(1, height >> (tryHarder ? 8 : 5));
if (tryHarder) {
maxLines = height;
} else {
maxLines = 15;
}
for (int x = 0; x < maxLines; x++) {
int rowStepsAboveOrBelow = (x + 1) / 2;
if (!((x & 1) == 0)) {
rowStepsAboveOrBelow = -rowStepsAboveOrBelow;
}
int rowNumber = middle + (rowStep * rowStepsAboveOrBelow);
if (rowNumber < 0 || rowNumber >= height) {
break;
}
try {
row = image.getBlackRow(rowNumber, row);
int attempt = 0;
while (attempt < 2) {
if (attempt == 1) {
row.reverse();
if (hints != null && hints.containsKey(DecodeHintType
.NEED_RESULT_POINT_CALLBACK)) {
Map<DecodeHintType, Object> newHints = new EnumMap(DecodeHintType
.class);
newHints.putAll(hints);
newHints.remove(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
hints = newHints;
}
}
try {
Result result = decodeRow(rowNumber, row, hints);
if (attempt == 1) {
result.putMetadata(ResultMetadataType.ORIENTATION, Integer.valueOf
(180));
ResultPoint[] points = result.getResultPoints();
if (points != null) {
points[0] = new ResultPoint((((float) width) - points[0].getX())
- 1.0f, points[0].getY());
points[1] = new ResultPoint((((float) width) - points[1].getX())
- 1.0f, points[1].getY());
}
}
return result;
} catch (ReaderException e) {
attempt++;
}
}
continue;
} catch (NotFoundException e2) {
}
}
throw NotFoundException.getNotFoundInstance();
}