name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
zxing_PDF417ScanningDecoder_decode_rdh | // TODO don't pass in minCodewordWidth and maxCodewordWidth, pass in barcode columns for start and stop pattern
// columns. That way width can be deducted from the pattern column.
// This approach also allows to detect more details about the barcode, e.g. if a bar type (white or black) is wider
// than it should be. Th... | 3.26 |
zxing_PDF417ScanningDecoder_verifyCodewordCount_rdh | /**
* Verify that all is OK with the codeword array.
*/
private static void verifyCodewordCount(int[] codewords, int numECCodewords) throws FormatException {
if (codewords.length < 4) {
// Codeword array size should be at least 4 allowing for
// Count CW, At least one Data CW, Error Correction CW,... | 3.26 |
zxing_BizcardResultParser_parse_rdh | // Yes, we extend AbstractDoCoMoResultParser since the format is very much
// like the DoCoMo MECARD format, but this is not technically one of
// DoCoMo's proposed formats
@Override
public AddressBookParsedResult parse(Result result) {
String rawText = getMassagedText(result);
if (!rawText.startsWith("BIZCARD:... | 3.26 |
zxing_MaskUtil_applyMaskPenaltyRule3_rdh | /**
* Apply mask penalty rule 3 and return the penalty. Find consecutive runs of 1:1:3:1:1:4
* starting with black, or 4:1:1:3:1:1 starting with white, and give penalty to them. If we
* find patterns like 000010111010000, we give penalty once.
*/
static int applyMaskPenaltyRule3(ByteMatrix ... | 3.26 |
zxing_MaskUtil_applyMaskPenaltyRule1Internal_rdh | /**
* Helper function for applyMaskPenaltyRule1. We need this for doing this calculation in both
* vertical and horizontal orders respectively.
*/ private static int applyMaskPenaltyRule1Internal(ByteMatrix matrix, boolean isHorizontal) {
int penalty = 0;
int iLimit = (isHorizontal) ? matrix.getHeight() : ... | 3.26 |
zxing_MaskUtil_getDataMaskBit_rdh | /**
* Return the mask bit for "getMaskPattern" at "x" and "y". See 8.8 of JISX0510:2004 for mask
* pattern conditions.
*/
static boolean getDataMaskBit(int maskPattern, int x, int y) {
int intermediate;
int temp;
switch (maskPattern) {
case 0 :
intermediate = (y + x) & 0x1;
... | 3.26 |
zxing_MaskUtil_applyMaskPenaltyRule4_rdh | /**
* Apply mask penalty rule 4 and return the penalty. Calculate the ratio of dark cells and give
* penalty if the ratio is far from 50%. It gives 10 penalty for 5% distance.
*/
static int applyMaskPenaltyRule4(ByteMatrix matrix) {
int numDarkCells = 0;
byte[][]
array = matrix.getArray();
int width = matrix.getWi... | 3.26 |
zxing_WifiResultHandler_getDisplayContents_rdh | // Display the name of the network and the network type to the user.
@Override
public CharSequence getDisplayContents() {
WifiParsedResult wifiResult = ((WifiParsedResult) (getResult()));
return ((wifiResult.getSsid() + " (") + wifiResult.getNetworkEncryption()) + ')';
} | 3.26 |
zxing_CalendarParsedResult_isStartAllDay_rdh | /**
*
* @return true if start time was specified as a whole day
*/
public boolean isStartAllDay() {
return startAllDay;
} | 3.26 |
zxing_CalendarParsedResult_getStart_rdh | /**
*
* @return start time
* @deprecated use {@link #getStartTimestamp()}
*/@Deprecated
public Date getStart() {
return new Date(start);
} | 3.26 |
zxing_CalendarParsedResult_parseDate_rdh | /**
* Parses a string as a date. RFC 2445 allows the start and end fields to be of type DATE (e.g. 20081021)
* or DATE-TIME (e.g. 20081021T123000 for local time, or 20081021T123000Z for UTC).
*
* @param when
* The string to parse
* @throws ParseException
* if not able to parse as a date
*/
private static lo... | 3.26 |
zxing_CalendarParsedResult_getEnd_rdh | /**
*
* @return event end {@link Date}, or {@code null} if event has no duration
* @deprecated use {@link #getEndTimestamp()}
*/@Deprecated
public Date getEnd() {
return end < 0L ? null : new Date(end);
} | 3.26 |
zxing_CalendarParsedResult_getEndTimestamp_rdh | /**
*
* @return event end {@link Date}, or -1 if event has no duration
* @see #getStartTimestamp()
*/
public long getEndTimestamp() {
return end;
} | 3.26 |
zxing_CalendarParsedResult_isEndAllDay_rdh | /**
*
* @return true if end time was specified as a whole day
*/
public boolean isEndAllDay() {
return endAllDay;
} | 3.26 |
zxing_CalendarParsedResult_getStartTimestamp_rdh | /**
*
* @return start time
* @see #getEndTimestamp()
*/
public long getStartTimestamp() {
return start;
} | 3.26 |
zxing_RSSExpandedReader_checkRows_rdh | // Try to construct a valid rows sequence
// Recursion is used to implement backtracking
private List<ExpandedPair> checkRows(List<ExpandedRow> collectedRows, int currentRow) throws NotFoundException {
for (int i = currentRow; i < rows.size(); i++) {
ExpandedRow row = rows.get(i);
this.pairs.clear();
fo... | 3.26 |
zxing_RSSExpandedReader_getRows_rdh | // Only used for unit testing
List<ExpandedRow> getRows() {
return this.rows;
} | 3.26 |
zxing_RSSExpandedReader_isPartialRow_rdh | // Returns true when one of the rows already contains all the pairs
private static boolean isPartialRow(Iterable<ExpandedPair> pairs, Iterable<ExpandedRow> rows) {
for (ExpandedRow r : rows) {
boolean allFound = true;
for (ExpandedPair p : pairs) {
boolean found = false;for (ExpandedPai... | 3.26 |
zxing_RSSExpandedReader_isValidSequence_rdh | // Whether the pairs form a valid finder pattern sequence, either complete or a prefix
private static boolean isValidSequence(List<ExpandedPair> pairs, boolean complete) {
for (int[] sequence : FINDER_PATTERN_SEQUENCES) {
boolean sizeOk = (complete) ? pairs.size() == sequence.length : pairs.size() <= sequence.l... | 3.26 |
zxing_RSSExpandedReader_mayFollow_rdh | // Whether the pairs, plus another pair of the specified type, would together
// form a valid finder pattern sequence, either complete or partial
private static boolean mayFollow(List<ExpandedPair> pairs, int value) {
if (pairs.isEmpty()) {
return true;
}
for (int[] sequence : FINDER_PATTERN_SEQUEN... | 3.26 |
zxing_RSSExpandedReader_removePartialRows_rdh | // Remove all the rows that contains only specified pairs
private static void removePartialRows(Collection<ExpandedPair> pairs, Collection<ExpandedRow> rows) {
for (Iterator<ExpandedRow> iterator = rows.iterator(); iterator.hasNext();) {
ExpandedRow v23 = iterator.next();
if (v23.getPairs().size() !... | 3.26 |
zxing_RSSExpandedReader_constructResult_rdh | // Not private for unit testing
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException {
BitArray binary = BitArrayBuilder.buildBitArray(pairs);
AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary);
String resultingString = decoder.parse... | 3.26 |
zxing_RSSExpandedReader_retrieveNextPair_rdh | // not private for testing
ExpandedPair retrieveNextPair(BitArray row, List<ExpandedPair> previousPairs, int rowNumber) throws NotFoundException {
boolean isOddPattern = (previousPairs.size() % 2) == 0;
if (startFromEven) {
isOddPattern = !isOddPattern;
}
FinderPattern pattern;
DataCharacter... | 3.26 |
zxing_RSSExpandedReader_decodeRow2pairs_rdh | // Not private for testing
List<ExpandedPair> decodeRow2pairs(int rowNumber, BitArray row) throws NotFoundException {
this.pairs.clear();
boolean done = false;
while (!done) {
try {
this.pairs.add(retrieveNextPair(row, this.pairs, rowNumber));
} catch (NotFoundException nfe) {... | 3.26 |
zxing_GeoParsedResult_getLongitude_rdh | /**
*
* @return longitude in degrees
*/
public double getLongitude() {
return longitude;
} | 3.26 |
zxing_GeoParsedResult_getLatitude_rdh | /**
*
* @return latitude in degrees
*/
public double getLatitude() {
return latitude;
} | 3.26 |
zxing_GeoParsedResult_m0_rdh | /**
*
* @return query string associated with geo URI or null if none exists
*/
public String m0() {
return query;
} | 3.26 |
zxing_GeoParsedResult_getAltitude_rdh | /**
*
* @return altitude in meters. If not specified, in the geo URI, returns 0.0
*/
public double getAltitude() {
return altitude;
} | 3.26 |
zxing_PDF417Reader_decode_rdh | /**
* Locates and decodes a PDF417 code in an image.
*
* @return a String representing the content encoded by the PDF417 code
* @throws NotFoundException
* if a PDF417 code cannot be found,
* @throws FormatException
* if a PDF417 cannot be decoded
*/
@Override
public Result decode(BinaryBitmap
image) throws... | 3.26 |
zxing_C40Encoder_handleEOD_rdh | /**
* Handle "end of data" situations
*
* @param context
* the encoder context
* @param buffer
* the buffer with the remaining encoded characters
*/
void handleEOD(EncoderContext context, StringBuilder buffer) {
int unwritten... | 3.26 |
zxing_DataMask_unmaskBitMatrix_rdh | // End of enum constants.
/**
* <p>Implementations of this method reverse the data masking process applied to a QR Code and
* make its bits ready to read.</p>
*
* @param bits
* representation of QR Code bits
* @param dimension
* dimension of QR Code, represented by bits, being unmasked
*/
final void unmaskB... | 3.26 |
zxing_DataMask_isMasked_rdh | /**
* 100: mask bits for which (x/2 + y/3) mod 2 == 0
*/DATA_MASK_100() {@Override
boolean isMasked(int i, int j) {
return (((i / 2) + (j / 3)) & 0x1) == 0;
} | 3.26 |
zxing_LuminanceSource_crop_rdh | /**
* Returns a new object with cropped image data. Implementations may keep a reference to the
* original data rather than a copy. Only callable if isCropSupported() is true.
*
* @param left
* The left coordinate, which must be in [0,getWidth())
* @param top
* The top coordinate, which must be in [0,getHeig... | 3.26 |
zxing_LuminanceSource_rotateCounterClockwise45_rdh | /**
* Returns a new object with rotated image data by 45 degrees counterclockwise.
* Only callable if {@link #isRotateSupported()} is true.
*
* @return A rotated version of this object.
*/
public LuminanceSource rotateCounterClockwise45() {
throw new UnsupportedOperationException("This luminance source does not su... | 3.26 |
zxing_LuminanceSource_isCropSupported_rdh | /**
*
* @return Whether this subclass supports cropping.
*/
public boolean isCropSupported() {
return false;
} | 3.26 |
zxing_LuminanceSource_isRotateSupported_rdh | /**
*
* @return Whether this subclass supports counter-clockwise rotation.
*/
public boolean isRotateSupported() {
return false;
}
/**
*
* @return a wrapper of this {@code LuminanceSource} | 3.26 |
zxing_LuminanceSource_rotateCounterClockwise_rdh | /**
* Returns a new object with rotated image data by 90 degrees counterclockwise.
* Only callable if {@link #isRotateSupported()} is true.
*
* @return A rotated version of this object.
*/
public LuminanceSource rotateCounterClockwise() {
throw new UnsupportedOperationException("This luminance source does not su... | 3.26 |
zxing_LuminanceSource_getWidth_rdh | /**
*
* @return The width of the bitmap.
*/
public final int getWidth() {
return width;
} | 3.26 |
zxing_LuminanceSource_getHeight_rdh | /**
*
* @return The height of the bitmap.
*/
public final int getHeight() {
return height;
} | 3.26 |
zxing_ShareActivity_showContactAsBarcode_rdh | /**
* Takes a contact Uri and does the necessary database lookups to retrieve that person's info,
* then sends an Encode intent to render it as a QR Code.
*
* @param contactUri
* A Uri of the form content://contacts/people/17
*/private void showContactAsBarcode(Uri contactUri) {
if (contactUri == null) {
... | 3.26 |
zxing_GlobalHistogramBinarizer_getBlackRow_rdh | // Applies simple sharpening to the row data to improve performance of the 1D Readers.
@Override
public BitArray getBlackRow(int y, BitArray row) throws NotFoundException {
LuminanceSource source = getLuminanceSource();
int v1 = source.getWidth();
if ((row
== null) || (row.getSize() < v1)) {
row... | 3.26 |
zxing_GlobalHistogramBinarizer_getBlackMatrix_rdh | // Does not sharpen the data, as this call is intended to only be used by 2D Readers.
@Override
public BitMatrix getBlackMatrix() throws NotFoundException {
LuminanceSource source = getLuminanceSource();
int width = source.getWidth();
int height = source.getHeight();
BitMatrix matrix = new BitMatrix(w... | 3.26 |
zxing_ReedSolomonDecoder_decode_rdh | /**
* <p>Decodes given set of received codewords, which include both data and error-correction
* codewords. Really, this means it uses Reed-Solomon to detect and correct errors, in-place,
* in the input.</p>
*
* @param received
* data and error-correction codewords
* @param twoS... | 3.26 |
zxing_ReedSolomonDecoder_decodeWithECCount_rdh | /**
* <p>Decodes given set of received codewords, which include both data and error-correction
* codewords. Really, this means it uses Reed-Solomon to detect and correct errors, in-place,
* in the input.</p>
*
* @param received
* data and error-correction codewords
* @param twoS
* number of error-correction... | 3.26 |
zxing_MaxiCodeReader_extractPureBits_rdh | /**
* This method detects a code in a "pure" image -- that is, pure monochrome image
* which contains only an unrotated, unskewed, image of a code, with some white border
* around it. This is a specialized method that works exceptionally fast in this special
* case.
*/
private static BitMatrix extractPureBits(BitM... | 3.26 |
zxing_MaxiCodeReader_decode_rdh | /**
* Locates and decodes a MaxiCode in an image.
*
* @return a String representing the content encoded by the MaxiCode
* @throws NotFoundException
* if a MaxiCode cannot be found
* @throws FormatException
* if a MaxiCode cannot be decoded
* @throws ChecksumException
* if error correction fails
*/
@Over... | 3.26 |
zxing_QRCodeReader_extractPureBits_rdh | /**
* This method detects a code in a "pure" image -- that is, pure monochrome image
* which contains only an unrotated, unskewed, image of a code, with some white border
* around it. This is a specialized method that works exceptionally fast in this special
* case.
*/
private static Bi... | 3.26 |
zxing_QRCodeReader_decode_rdh | /**
* Locates and decodes a QR code in an image.
*
* @return a String representing the content encoded by the QR code
* @throws NotFoundException
* if a QR code cannot be found
* @throws FormatException
* if a QR code cannot be decoded
* @throws ChecksumException
* if error correction fails
*/
@Override... | 3.26 |
zxing_MinimalECIInput_isECI_rdh | /**
* Determines if a value is an ECI
*
* @param index
* the index of the value
* @return true if the value at position {@code index} is an ECI
* @throws IndexOutOfBoundsException
* if the {@code index} argument is negative or not less than
* {@code length()}
*/
public boolean isECI(int index) {
if (... | 3.26 |
zxing_MinimalECIInput_length_rdh | /**
* Returns the length of this input. The length is the number
* of {@code byte}s, FNC1 characters or ECIs in the sequence.
*
* @return the number of {@code char}s in this sequence
*/
public int length() {
return bytes.length;
} | 3.26 |
zxing_MinimalECIInput_charAt_rdh | /**
* Returns the {@code byte} value at the specified index. An index ranges from zero
* to {@code length() - 1}. The first {@code byte} value of the sequence is at
* index zero, the next at index one, and so on, as for array
* indexing.
*
... | 3.26 |
zxing_MinimalECIInput_isFNC1_rdh | /**
* Determines if a value is the FNC1 character
*
* @param index
* the index of the value
* @return true if the value at position {@code index} is the FNC1 character
* @throws IndexOutOfBoundsException
* if the {@code index} argument is negati... | 3.26 |
zxing_MinimalECIInput_subSequence_rdh | /**
* Returns a {@code CharSequence} that is a subsequence of this sequence.
* The subsequence starts with the {@code char} value at the specified index and
* ends with the {@code char} value at index {@code end - 1}. The length
* (in {@code char}s) of the
* returned sequence is {@code end - start}, so if {@code ... | 3.26 |
zxing_PlanarYUVLuminanceSource_getThumbnailHeight_rdh | /**
*
* @return height of image from {@link #renderThumbnail()}
*/
public int getThumbnailHeight() {
return getHeight() / THUMBNAIL_SCALE_FACTOR;
} | 3.26 |
zxing_PlanarYUVLuminanceSource_getThumbnailWidth_rdh | /**
*
* @return width of image from {@link #renderThumbnail()}
*/
public int getThumbnailWidth() {
return getWidth() / THUMBNAIL_SCALE_FACTOR;} | 3.26 |
zxing_ModulusPoly_getDegree_rdh | /**
*
* @return degree of this polynomial
*/
int getDegree() {
return coefficients.length - 1;
} | 3.26 |
zxing_ModulusPoly_evaluateAt_rdh | /**
*
* @return evaluation of this polynomial at a given point
*/
int evaluateAt(int a) {
if (a == 0) {
// Just return the x^0 coefficient
return getCoefficient(0);
}
if (a == 1) {// Just the sum of the coefficients
int result = 0;
for (int coefficient : coefficients) {
... | 3.26 |
zxing_ModulusPoly_getCoefficient_rdh | /**
*
* @return coefficient of x^degree term in this polynomial
*/
int getCoefficient(int degree) {
return coefficients[(coefficients.length -
1) - degree];
} | 3.26 |
zxing_MathUtils_sum_rdh | /**
*
* @param array
* values to sum
* @return sum of values in array
*/
public static int sum(int[] array) {
int count = 0;
for (int a : array) {count += a;
}
return count;
} | 3.26 |
zxing_MathUtils_distance_rdh | /**
*
* @param aX
* point A x coordinate
* @param aY
* point A y coordinate
* @param bX
* point B x coordinate
* @param bY
* point B y coordinate
* @return Euclidean distance between points A and B
*/
public static float distance(int aX, int aY, int bX, int bY) {
double xDiff = aX - bX;
doubl... | 3.26 |
zxing_MathUtils_round_rdh | /**
* Ends up being a bit faster than {@link Math#round(float)}. This merely rounds its
* argument to the nearest int, where x.5 rounds up to x+1. Semantics of this shortcut
* differ slightly from {@link Math#round(float)} in that half rounds down for negative
* values. -2.5 rounds to -3, not -2. For purposes here ... | 3.26 |
zxing_DataMatrixReader_decode_rdh | /**
* Locates and decodes a Data Matrix code in an image.
*
* @return a String representing the content encoded by the Data Matrix code
* @throws NotFoundException
* if a Data Matrix code cannot be found
* @throws FormatException
* if a Data Matrix code cannot be decoded
* @throws ChecksumException
* if ... | 3.26 |
zxing_DataMatrixReader_extractPureBits_rdh | /**
* This method detects a code in a "pure" image -- that is, pure monochrome image
* which contains only an unrotated, unskewed, image of a code, with some white border
* around it. This is a specialized method that works exceptionally fast in this special
* case.
*/
private static Bi... | 3.26 |
zxing_PDF417HighLevelEncoder_determineConsecutiveTextCount_rdh | /**
* Determines the number of consecutive characters that are encodable using text compaction.
*
* @param input
* the input
* @param startpos
* the start position within the input
* @return the requested character count
*/
private static int determineConsecutiveTextCount(ECIInput input, int startpos) {
... | 3.26 |
zxing_PDF417HighLevelEncoder_encodeHighLevel_rdh | /**
* Performs high-level encoding of a PDF417 message using the algorithm described in annex P
* of ISO/IEC 15438:2001(E). If byte compaction has been selected, then only byte compaction
* is used.
*
* @param msg
* the message
* @param compaction
* compaction mode to use
* @param encoding
* character e... | 3.26 |
zxing_PDF417HighLevelEncoder_determineConsecutiveDigitCount_rdh | /**
* Determines the number of consecutive characters that are encodable using numeric compaction.
*
* @param input
* the input
* @param startpos
* the start position within the input
* @return the requested character count
*/
private static int determineConsecutiveDigitCount(ECIInput input, int startpos) {... | 3.26 |
zxing_PDF417HighLevelEncoder_determineConsecutiveBinaryCount_rdh | /**
* Determines the number of consecutive characters that are encodable using binary compaction.
*
* @param input
* the input
* @param startpos
* the start position within the message
* @param encoding
* the charset used to convert the message to a byte array
* @return the requested character count
*/
... | 3.26 |
zxing_PDF417HighLevelEncoder_encodeBinary_rdh | /**
* Encode parts of the message using Byte Compaction as described in ISO/IEC 15438:2001(E),
* chapter 4.4.3. The Unicode characters will be converted to binary using the cp437
* codepage.
*
* @param bytes
* the message converted to a byte array
* @param startpos
* the start position within the message
*... | 3.26 |
zxing_PDF417HighLevelEncoder_encodeMultiECIBinary_rdh | /**
* Encode all of the message using Byte Compaction as described in ISO/IEC 15438:2001(E)
*
* @param input
* the input
* @param startpos
* the start position within the message
* @param count
* the number of bytes to encode
* @param startmode
* the mode from which this method starts
* @param sb
* ... | 3.26 |
zxing_PDF417HighLevelEncoder_encodeText_rdh | /**
* Encode parts of the message using Text Compaction as described in ISO/IEC 15438:2001(E),
* chapter 4.4.2.
*
* @param input
* the input
* @param startpos
* the start position within the message
* @param count
* the number of characters to encode
* @param ... | 3.26 |
zxing_SymbolInfo_overrideSymbolSet_rdh | /**
* Overrides the symbol info set used by this class. Used for testing purposes.
*
* @param override
* the symbol info set to use
*/
public static void overrideSymbolSet(SymbolInfo[] override) {
symbols = override;
} | 3.26 |
zxing_ExpandedRow_equals_rdh | /**
* Two rows are equal if they contain the same pairs in the same order.
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof ExpandedRow)) {
return false;
}
ExpandedRow that = ((ExpandedRow) (o));
return this.pairs.equals(that.pairs);
} | 3.26 |
zxing_Encoder_encode_rdh | /**
* Encodes the given binary content as an Aztec symbol
*
* @param data
* input data string
* @param minECCPercent
* minimal percentage of error check words (According to ISO/IEC 24778:2008,
* a minimum of 23%... | 3.26 |
zxing_Encoder_m0_rdh | /**
* Encodes the given string content as an Aztec symbol
*
* @param data
* input data string
* @param minECCPercent
* minimal percentage of error check words (According to ISO/IEC 24778:2008,
* a minimum of 23% + 3 words is recommended)
* @param userSpecifiedLayers
* if non-zero, a user-specified valu... | 3.26 |
zxing_BarcodeValue_setValue_rdh | /**
* Add an occurrence of a value
*/
void setValue(int value) {
Integer confidence = values.get(value);
if (confidence == null)
{
confidence = 0;
}
confidence++;
values.put(value, confidence);
} | 3.26 |
zxing_BarcodeValue_getValue_rdh | /**
* Determines the maximum occurrence of a set value and returns all values which were set with this occurrence.
*
* @return an array of int, containing the values with the highest occurrence, or null, if no value was set
*/
int[] getValue() {
int maxConfidence = -1;
Collection<Integer> result = new Arra... | 3.26 |
zxing_LocaleManager_getBookSearchCountryTLD_rdh | /**
* The same as above, but specifically for Google Book Search.
*
* @param context
* application's {@link Context}
* @return The top-level domain to use.
*/
public static String getBookSearchCountryTLD(Context context) {
return doGetTLD(GOOGLE_BOOK_SEARCH_COUNTRY_TLD, context);
} | 3.26 |
zxing_LocaleManager_isBookSearchUrl_rdh | /**
* Does a given URL point to Google Book Search, regardless of domain.
*
* @param url
* The address to check.
* @return True if this is a Book Search URL.
*/
public static boolean isBookSearchUrl(String url) {
return url.startsWith("http://google.com/books") || url.startsWith("http://books.google.");
... | 3.26 |
zxing_Mode_forBits_rdh | /**
*
* @param bits
* four bits encoding a QR Code data mode
* @return Mode encoded by these bits
* @throws IllegalArgumentException
* if bits do not correspond to a known mode
*/
public static Mode forBits(int bits) {
switch
(bits) {
case 0x0 :
return TERMINATOR;
case 0x1... | 3.26 |
zxing_GridSampler_checkAndNudgePoints_rdh | /**
* <p>Checks a set of points that have been transformed to sample points on an image against
* the image's dimensions to see if the point are even within the image.</p>
*
* <p>This method will actually "nudge" the endpoints back onto the image if they are found to be
* barely (less than 1 pixel) off the image. ... | 3.26 |
zxing_GridSampler_getInstance_rdh | /**
*
* @return the current implementation of GridSampler
*/
public static GridSampler getInstance() {
return gridSampler;
}
/**
* Samples an image for a rectangular matrix of bits of the given dimension. The sampling
* transformation is determined by the coordinates of 4 points, in the original and transform... | 3.26 |
zxing_GridSampler_setGridSampler_rdh | /**
* Sets the implementation of GridSampler used by the library. One global
* instance is stored, which may sound problematic. But, the implementation provided
* ought to be appropriate for the entire platform, and all uses of this library
* in the whole lifetime of the JVM. For instance, an Android activity can s... | 3.26 |
zxing_AlignmentPatternFinder_crossCheckVertical_rdh | /**
* <p>After a horizontal scan finds a potential alignment pattern, this method
* "cross-checks" by scanning down vertically through the center of the possible
* alignment pattern to see if the same proportion is detected.</p>
*
* @param startI
* row where an alignment pattern was detected
* @param centerJ
... | 3.26 |
zxing_AlignmentPatternFinder_find_rdh | /**
* <p>This method attempts to find the bottom-right alignment pattern in the image. It is a bit messy since
* it's pretty performance-critical and so is written to be fast foremost.</p>
*
* @return {@link AlignmentPattern} if found
* @throws NotFoundException
* if not found
*... | 3.26 |
zxing_AlignmentPatternFinder_centerFromEnd_rdh | /**
* Given a count of black/white/black pixels just seen and an end position,
* figures the location of the center of this black/white/black run.
*/
private static float centerFromEnd(int[] stateCount, int end) {
return (end - stateCount[2]) - (stateCount[1] / 2.0F);
} | 3.26 |
zxing_AlignmentPatternFinder_handlePossibleCenter_rdh | /**
* <p>This is called when a horizontal scan finds a possible alignment pattern. It will
* cross check with a vertical scan, and if successful, will see if this pattern had been
* found on a previous horizontal scan. If so, we consider it confirmed and conclude we have
* found the alignment pattern.</p>
*
* @pa... | 3.26 |
zxing_AddressBookParsedResult_getBirthday_rdh | /**
*
* @return birthday formatted as yyyyMMdd (e.g. 19780917)
*/
public String getBirthday() {
return birthday;
} | 3.26 |
zxing_AddressBookParsedResult_getPronunciation_rdh | /**
* In Japanese, the name is written in kanji, which can have multiple readings. Therefore a hint
* is often provided, called furigana, which spells the name phonetically.
*
* @return The pronunciation of the getNames() field, often in hiragana or katakana.
*/
public String getPronunciation() {
return pr... | 3.26 |
zxing_AddressBookParsedResult_getGeo_rdh | /**
*
* @return a location as a latitude/longitude pair
*/
public String[] getGeo() {
return geo;
} | 3.26 |
zxing_SearchBookContentsActivity_parseResult_rdh | // Available fields: page_id, page_number, snippet_text
private SearchBookContentsResult parseResult(JSONObject json) {
String pageId;
String pageNumber;
String snippet;
try {
pageId = json.getString("page_id");
pageNumber = json.optString("page_number");
snippet = json.optS... | 3.26 |
zxing_SearchBookContentsActivity_handleSearchResults_rdh | // Currently there is no way to distinguish between a query which had no results and a book
// which is not searchable - both return zero results.
private void handleSearchResults(JSONObject
json) {
try {
int count = json.getInt("number_of_results");
headerView.setText((getString(string.msg_sbc_resu... | 3.26 |
zxing_Code39Reader_toNarrowWidePattern_rdh | // For efficiency, returns -1 on failure. Not throwing here saved as many as 700 exceptions
// per image when using some of our blackbox images.
private static int toNarrowWidePattern(int[] counters) {
int numCounters = counters.length;
int maxNarrowCounter = 0;
int wideCounters;
do {
int minCou... | 3.26 |
zxing_ReaderException_fillInStackTrace_rdh | // Prevent stack traces from being taken
@Override
public synchronized final Throwable fillInStackTrace() {
return null;
} | 3.26 |
zxing_CaptureActivity_drawResultPoints_rdh | /**
* Superimpose a line for 1D or dots for 2D to highlight the key features of the barcode.
*
* @param barcode
* A bitmap of the captured image.
* @param scaleFactor
* amount by which thumbnail was scaled
* @param rawResult
* The dec... | 3.26 |
zxing_CaptureActivity_handleDecode_rdh | /**
* A valid barcode has been found, so give an indication of success and show the results.
*
* @param rawResult
* The contents of the barcode.
* @param scaleFactor
* amount by which thumbnail was scaled
* @param barcode
* A greyscale bitmap of the camera data which was decoded.
*/
public void handleDec... | 3.26 |
zxing_CaptureActivity_handleDecodeExternally_rdh | // Briefly show the contents of the barcode, then handle the result outside Barcode Scanner.
private void handleDecodeExternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) {
if (barcode != null) {
viewfinderView.drawResultBitmap(barcode);
}
long resultDurationMS;
if (getInten... | 3.26 |
zxing_CaptureActivity_handleDecodeInternally_rdh | // Put up our own UI for how to handle the decoded contents.
private void handleDecodeInternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) {
m0(resultHandler);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if ((resultHandler.getDefaultButtonID()
!= n... | 3.26 |
zxing_ECIEncoderSet_getPriorityEncoderIndex_rdh | /* returns -1 if no priority charset was defined */public int getPriorityEncoderIndex() {
return priorityEncoderIndex;
} | 3.26 |
zxing_WhiteRectangleDetector_containsBlackPoint_rdh | /**
* Determines whether a segment contains a black point
*
* @param a
* min value of the scanned coordinate
* @param b
* max value of the scanned coordinate
* @param fixed
* value of fixed coordinate
* @param horizontal
* set to true if scan must be horizontal, false if vertical
* @return true if a ... | 3.26 |
zxing_DecodeWorker_dumpBlackPoint_rdh | /**
* Writes out a single PNG which is three times the width of the input image, containing from left
* to right: the original image, the row sampling monochrome version, and the 2D sampling
* monochrome version.
*/
private static void dumpBlackPoint(URI uri, BufferedImage image, BinaryBitmap bitmap) throws IOExce... | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.