name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
zxing_GenericGFPoly_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 : coef... | 3.26 |
zxing_GenericGFPoly_isZero_rdh | /**
*
* @return true iff this polynomial is the monomial "0"
*/
boolean isZero() {
return coefficients[0] == 0;
} | 3.26 |
zxing_GenericGFPoly_getDegree_rdh | /**
*
* @return degree of this polynomial
*/
int getDegree() {
return coefficients.length - 1;
} | 3.26 |
zxing_GenericGF_multiply_rdh | /**
*
* @return product of a and b in GF(size)
*/
int multiply(int a, int b) {
if ((a == 0) || (b == 0)) {
return 0;
}
return expTable[(logTable[a] + logTable[b]) % (size - 1)];
} | 3.26 |
zxing_GenericGF_addOrSubtract_rdh | /**
* Implements both addition and subtraction -- they are the same in GF(size).
*
* @return sum/difference of a and b
*/
static int addOrSubtract(int a, int b) {return a ^ b; } | 3.26 |
zxing_GenericGF_exp_rdh | /**
*
* @return 2 to the power of a in GF(size)
*/
int exp(int a) { return
expTable[a];
} | 3.26 |
zxing_GenericGF_log_rdh | /**
*
* @return base 2 log of a in GF(size)
*/
int log(int a) {
if (a == 0) {
throw new IllegalArgumentException();
}
return logTable[a];
} | 3.26 |
zxing_GenericGF_inverse_rdh | /**
*
* @return multiplicative inverse of a
*/
int inverse(int a) {
if (a == 0) {
throw new ArithmeticException();
}
return expTable[(size - logTable[a]) - 1];
} | 3.26 |
zxing_GenericGF_buildMonomial_rdh | /**
*
* @return the monomial representing coefficient * x^degree
*/
GenericGFPoly buildMonomial(int degree, int coefficient) {
if (degree < 0) {
throw new IllegalArgumentException();
}
if (coefficient == 0) {
return zero;
}
int[] coefficients = new int[degree + 1];
coefficient... | 3.26 |
zxing_ContactEncoder_trim_rdh | /**
*
* @return null if s is null or empty, or result of s.trim() otherwise
*/
static String trim(String s) {
if (s == null) {
return null;
}
String v0 = s.trim();
return v0.isEmpty() ? null : v0;
} | 3.26 |
zxing_EAN8Writer_encode_rdh | /**
*
* @return a byte array of horizontal pixels (false = white, true = black)
*/
@Override
public boolean[] encode(String contents) {
int v0 = contents.length();
switch (v0)
{
case 7
:
// No check digit present, calculate it and add it
int check;try {
... | 3.26 |
zxing_ResultPoint_crossProductZ_rdh | /**
* Returns the z component of the cross product between vectors BC and BA.
*/
private static float crossProductZ(ResultPoint pointA, ResultPoint pointB, ResultPoint pointC) {
float bX
= pointB.x;
float bY = pointB.y;
return ((pointC.x - bX) * (pointA.y - bY)) - ((pointC.y - bY) * (pointA.x - bX... | 3.26 |
zxing_ResultPoint_orderBestPatterns_rdh | /**
* Orders an array of three ResultPoints in an order [A,B,C] such that AB is less than AC
* and BC is less than AC, and the angle between BC and BA is less than 180 degrees.
*
* @param patterns
* array of three {@code ResultPoint} to order
*/
public static void orderBestPatterns(ResultPoint[] patterns) {
... | 3.26 |
zxing_ResultPoint_distance_rdh | /**
*
* @param pattern1
* first pattern
* @param pattern2
* second pattern
* @return distance between two points
*/
public static float distance(ResultPoint pattern1, ResultPoint pattern2) {return MathUtils.distance(pattern1.x, pattern1.y, pattern2.x, pattern2.y);
} | 3.26 |
zxing_QRCode_isValidMaskPattern_rdh | // Check if "mask_pattern" is valid.
public static boolean isValidMaskPattern(int maskPattern) {
return (maskPattern >= 0) && (maskPattern < NUM_MASK_PATTERNS);
} | 3.26 |
zxing_QRCode_getMode_rdh | /**
*
* @return the mode. Not relevant if {@link com.google.zxing.EncodeHintType#QR_COMPACT} is selected.
*/
public Mode getMode() {
return mode;
} | 3.26 |
zxing_EdifactEncoder_handleEOD_rdh | /**
* Handle "end of data" situations
*
* @param context
* the encoder context
* @param buffer
* the buffer with the remaining encoded characters
*/
private static void handleEOD(EncoderContext context, CharSequence buffer)
{
... | 3.26 |
zxing_CodaBarReader_toNarrowWidePattern_rdh | // Assumes that counters[position] is a bar.
private int toNarrowWidePattern(int position) {
int end = position + 7;
if (end >= counterLength) {
return
-1;
}
int[] theCounters = counters;
int maxBar = 0;
int minBar = Integer.MAX_VALUE;
for (int j = position;
j < end; j +=... | 3.26 |
zxing_CodaBarReader_setCounters_rdh | /**
* Records the size of all runs of white and black pixels, starting with white.
* This is just like recordPattern, except it records all the counters, and
* uses our builtin "counters" member for storage.
*
* @param row
* row to count from
*/
private void setCounters(BitArray row) throws NotFoundException {... | 3.26 |
zxing_CameraManager_requestPreviewFrame_rdh | /**
* A single preview frame will be returned to the handler supplied. The data will arrive as byte[]
* in the message.obj field, with width and height encoded as message.arg1 and message.arg2,
* respectively.
*
* @param handler
* The handler to send the message to.
* @param message
* The what field of the ... | 3.26 |
zxing_CameraManager_setManualCameraId_rdh | /**
* Allows third party apps to specify the camera ID, rather than determine
* it automatically based on available cameras and their orientation.
*
* @param cameraId
* camera ID of the camera to use. A negative value means "no preference".
*/
public synchronized void setManualCameraId(int cameraId) {
requeste... | 3.26 |
zxing_CameraManager_openDriver_rdh | /**
* Opens the camera driver and initializes the hardware parameters.
*
* @param holder
* The surface object which the camera will draw preview frames into.
* @throws IOException
* Indicates the camera driver failed to open.
*/
public synchronized void openDriver(SurfaceHolder holder) throws IOException {
... | 3.26 |
zxing_CameraManager_stopPreview_rdh | /**
* Tells the camera to stop drawing preview frames.
*/
public synchronized void stopPreview() {
if (autoFocusManager != null) {
autoFocusManager.stop();
autoFocusManager = null;
}
if ((camera != null) && previewing) {
camera.getCamera().stopPreview();
previewCallback.s... | 3.26 |
zxing_CameraManager_closeDriver_rdh | /**
* Closes the camera driver if still in use.
*/
public synchronized void closeDriver() {
if (camera != null) {
camera.getCamera().release();
camera = null;
// Make sure to clear these each time we close the camera, so that any scanning rect
// requested by intent is forgotten.
... | 3.26 |
zxing_CameraManager_buildLuminanceSource_rdh | /**
* A factory method to build the appropriate LuminanceSource object based on the format
* of the preview buffers, as described by Camera.Parameters.
*
* @param data
* A preview frame.
* @param width
* The width of the image.
* @param height
* The height of the image.
* @return A PlanarYUVLuminanceSou... | 3.26 |
zxing_CameraManager_startPreview_rdh | /**
* Asks the camera hardware to begin drawing preview frames to the screen.
*/
public synchronized void startPreview() {
OpenCamera theCamera = camera;
if ((theCamera != null) && (!previewing)) {
theCamera.getCamera().startPreview();
previewing = true;
autoFocusManager = new
... | 3.26 |
zxing_CameraManager_setTorch_rdh | /**
* Convenience method for {@link com.google.zxing.client.android.CaptureActivity}
*
* @param newSetting
* if {@code true}, light should be turned on if currently off. And vice versa.
*/
public synchronized void setTorch(boolean newSetting) {
OpenCamera theCamera = camera;
if ((theCamera != nul... | 3.26 |
zxing_CameraManager_getFramingRect_rdh | /**
* Calculates the framing rect which the UI should draw to show the user where to place the
* barcode. This target helps with alignment as well as forces the user to hold the device
* far enough away to ensure the image will be in focus.
*
* @return The rectangle to draw on screen in window coordinates.
*/
pub... | 3.26 |
zxing_CameraManager_setManualFramingRect_rdh | /**
* Allows third party apps to specify the scanning rectangle dimensions, rather than determine
* them automatically based on screen resolution.
*
* @param width
* The width in pixels to scan.
* @param height
* The height in pixels to scan.
*/
public synchronized void setManualFramingRect(int width, int h... | 3.26 |
zxing_CameraManager_getFramingRectInPreview_rdh | /**
* Like {@link #getFramingRect} but coordinates are in terms of the preview frame,
* not UI / screen.
*
* @return {@link Rect} expressing barcode scan area in terms of the preview size
*/
public synchronized Rect getFramingRectInPreview() {
if (framingRectInPreview == null) ... | 3.26 |
zxing_HistoryManager_buildHistory_rdh | /**
* <p>Builds a text representation of the scanning history. Each scan is encoded on one
* line, terminated by a line break (\r\n). The values in each line are comma-separated,
* and double-quoted. Double-quotes within values are escaped with a sequence of two
* double-quotes. The fields output are:</p>
*
* <ol... | 3.26 |
zxing_DetectionResultRowIndicatorColumn_adjustCompleteIndicatorColumnRowNumbers_rdh | // TODO implement properly
// TODO maybe we should add missing codewords to store the correct row number to make
// finding row numbers for other columns easier
// use row height count to make detection of invalid row numbers more reliable
void adjustCompleteIndicatorColumnRowNumbers(BarcodeMetadata barcodeMetadata) {
... | 3.26 |
zxing_DetectionResultRowIndicatorColumn_m0_rdh | // TODO maybe we should add missing codewords to store the correct row number to make
// finding row numbers for other columns easier
// use row height count to make detection of invalid row numbers more reliable
private void m0(BarcodeMetadata barcodeMetadata) {
BoundingBox ... | 3.26 |
zxing_DecodeHandler_decode_rdh | /**
* Decode the data within the viewfinder rectangle, and time how long it took. For efficiency,
* reuse the same reader objects from one decode to the next.
*
* @param data
* The YUV preview frame.
* @param width
* The width of the preview frame.
* @param height
* ... | 3.26 |
zxing_IntentResult_m0_rdh | /**
*
* @return name of format, like "QR_CODE", "UPC_A". See {@code BarcodeFormat} for more format names.
*/
public String m0() {
return formatName;
} | 3.26 |
zxing_IntentResult_getRawBytes_rdh | /**
*
* @return raw bytes of the barcode content, if applicable, or null otherwise
*/
public byte[] getRawBytes() {return rawBytes;
} | 3.26 |
zxing_IntentResult_getOrientation_rdh | /**
*
* @return rotation of the image, in degrees, which resulted in a successful scan. May be null.
*/
public Integer getOrientation() {
return orientation;
} | 3.26 |
zxing_IntentResult_getContents_rdh | /**
*
* @return raw content of barcode
*/
public String getContents() {
return contents;
} | 3.26 |
zxing_MatrixUtil_isEmpty_rdh | // Check if "value" is empty.
private static boolean isEmpty(int value) {
return value == (-1);
} | 3.26 |
zxing_MatrixUtil_findMSBSet_rdh | // Return the position of the most significant bit set (to one) in the "value". The most
// significant bit is position 32. If there is no bit set, return 0. Examples:
// - findMSBSet(0) => 0
// - findMSBSet(1) => 1
// - findMSBSet(255) => 8
static int findMSBSet(int value) {
return 32 - Integer.numberOfLeadingZero... | 3.26 |
zxing_MatrixUtil_clearMatrix_rdh | // Set all cells to -1. -1 means that the cell is empty (not set yet).
//
// JAVAPORT: We shouldn't need to do this at all. The code should be rewritten to begin encoding
// with the ByteMatrix initialized all to zero.
static void clearMatrix(ByteMatrix matrix) {matrix.clear(((byte) (-1)));
} | 3.26 |
zxing_MatrixUtil_embedDataBits_rdh | // Embed "dataBits" using "getMaskPattern". On success, modify the matrix and return true.
// For debugging purposes, it skips masking process if "getMaskPattern" is -1.
// See 8.7 of JISX0510:2004 (p.38) for how to embed data bits.
static void embedDataBits(BitArray dataBits, int maskPattern,
ByteMatrix matrix) throw... | 3.26 |
zxing_MatrixUtil_makeTypeInfoBits_rdh | // Make bit vector of type information. On success, store the result in "bits" and return true.
// Encode error correction level and mask pattern. See 8.9 of
// JISX0510:2004 (p.45) for details.
static void makeTypeInfoBits(ErrorCorrectionLevel ecLevel, int maskPattern, BitArray bits) throws WriterException {
if (!... | 3.26 |
zxing_MatrixUtil_embedBasicPatterns_rdh | // - Position detection patterns
// - Timing patterns
// - Dark dot at the left bottom corner
// - Position adjustment patterns, if need be
static void embedBasicPatterns(Version version, ByteMatrix matrix) throws WriterException {
// Let's get started with embedding big squares at corners.
m1(matrix);
// T... | 3.26 |
zxing_MatrixUtil_maybeEmbedPositionAdjustmentPatterns_rdh | // Embed position adjustment patterns if need be.
private static void maybeEmbedPositionAdjustmentPatterns(Version version, ByteMatrix matrix) {
if (version.getVersionNumber() < 2) {
// The patterns appear if version >= 2
return;
}
int index = version.getVersionNumber() - 1;int[] coordinates... | 3.26 |
zxing_MatrixUtil_buildMatrix_rdh | // Build 2D matrix of QR Code from "dataBits" with "ecLevel", "version" and "getMaskPattern". On
// success, store the result in "matrix" and return true.
static void buildMatrix(BitArray dataBits, ErrorCorrectionLevel ecLevel, Version version, int maskPattern, ByteMatrix matrix) throws WriterException {
clearMa... | 3.26 |
zxing_MatrixUtil_maybeEmbedVersionInfo_rdh | // Embed version information if need be. On success, modify the matrix and return true.
// See 8.10 of JISX0510:2004 (p.47) for how to embed version information.
static void maybeEmbedVersionInfo(Version version, ByteMatrix matrix) throws WriterException {
if (version.getVersionNumber() < 7) {
... | 3.26 |
zxing_MatrixUtil_makeVersionInfoBits_rdh | // Make bit vector of version information. On success, store the result in "bits" and return true.
// See 8.10 of JISX0510:2004 (p.45) for details.
static void makeVersionInfoBits(Version version, BitArray bits) throws WriterException {
bits.appendBits(version.getVersionNumber(), 6);
int bchCode = m0(version.ge... | 3.26 |
zxing_MatrixUtil_embedTypeInfo_rdh | // Embed type information. On success, modify the matrix.
static void embedTypeInfo(ErrorCorrectionLevel ecLevel, int maskPattern, ByteMatrix matrix) throws WriterException {
BitArray typeInfoBits = new BitArray();
makeTypeInfoBits(ecLevel, maskPattern, typeInfoBits);
for (int i = 0; i < typeInfoBits.get... | 3.26 |
zxing_MatrixUtil_m0_rdh | // The return value is 0xc94 (1100 1001 0100)
//
// Since all coefficients in the polynomials are 1 or 0, we can do the calculation by bit
// operations. We don't care if coefficients are positive or negative.
static int m0(int value, int poly) {
if (poly == 0) {
throw new IllegalArgumentException("0 polyn... | 3.26 |
zxing_MultiFormatReader_decode_rdh | /**
* Decode an image using the hints provided. Does not honor existing state.
*
* @param image
* The pixel data to decode
* @param hints
* The hints to use, clearing the previous state.
* @return The contents of the image
* @throws NotFoundException
* Any errors which occurred
*/
@Override
public Resul... | 3.26 |
zxing_MultiFormatReader_setHints_rdh | /**
* This method adds state to the MultiFormatReader. By setting the hints once, subsequent calls
* to decodeWithState(image) can reuse the same set of readers without reallocating memory. This
* is important for performance in continuous scan clients.
*
* @param hints
* The set of hints to use for subsequent ... | 3.26 |
zxing_MultiFormatReader_decodeWithState_rdh | /**
* Decode an image using the state set up by calling setHints() previously. Continuous scan
* clients will get a <b>large</b> speed increase by using this instead of decode().
*
* @param image
* The pixel data to decode
* @return The contents of the image
* @throws NotFoundException
* Any errors which oc... | 3.26 |
zxing_VCardResultParser_formatNames_rdh | /**
* Formats name fields of the form "Public;John;Q.;Reverend;III" into a form like
* "Reverend John Q. Public III".
*
* @param names
* name values to format, in place
*/
private static void formatNames(Iterable<List<String>> names) {
if (names != null) {
for (List<String> v54 : names) {
String name = v54.get(... | 3.26 |
zxing_DecodeHintManager_splitQuery_rdh | /**
* <p>Split a query string into a list of name-value pairs.</p>
*
* <p>This is an alternative to the {@link Uri#getQueryParameterNames()} and
* {@link Uri#getQueryParameters(String)}, which are quirky and not suitable
* for exist-only Uri parameters.</p>
*
* <p>This method ignores multiple parameters with the... | 3.26 |
zxing_AztecCode_getLayers_rdh | /**
*
* @return number of levels
*/
public int getLayers() {
return layers;
} | 3.26 |
zxing_AztecCode_isCompact_rdh | /**
*
* @return {@code true} if compact instead of full mode
*/
public boolean isCompact() {
return compact;
} | 3.26 |
zxing_AztecCode_getCodeWords_rdh | /**
*
* @return number of data codewords
*/ public int getCodeWords()
{
return codeWords;
} | 3.26 |
zxing_AztecCode_getSize_rdh | /**
*
* @return size in pixels (width and height)
*/
public int getSize() {
return size;
} | 3.26 |
zxing_AztecCode_m0_rdh | /**
*
* @return the symbol image
*/
public BitMatrix m0()
{
return matrix;
} | 3.26 |
zxing_ViewfinderView_drawResultBitmap_rdh | /**
* Draw a bitmap with the result points highlighted instead of the live scanning display.
*
* @param barcode
* An image of the decoded barcode.
*/
public void drawResultBitmap(Bitmap barcode) {
resultBitmap = barcode;
invalidate();
} | 3.26 |
zxing_AlignmentPattern_combineEstimate_rdh | /**
* Combines this object's current estimate of a finder pattern position and module size
* with a new estimate. It returns a new {@code FinderPattern} containing an average of the two.
*/
AlignmentPattern combineEstimate(float i, float j, float newModuleSize) {
float combinedX = (getX() + j) / 2.0F;
float... | 3.26 |
zxing_AlignmentPattern_aboutEquals_rdh | /**
* <p>Determines if this alignment pattern "about equals" an alignment pattern at the stated
* position and size -- meaning, it is at nearly the same center with nearly the same size.</p>
*/
boolean aboutEquals(float moduleSize, float i, float j) {
if ((Math.abs(i - getY()) <= moduleSize) && (Math.abs(j - ge... | 3.26 |
zxing_URIParsedResult_massageURI_rdh | /**
* Transforms a string that represents a URI into something more proper, by adding or canonicalizing
* the protocol.
*/
private static String massageURI(String uri) {
uri = uri.trim();
int protocolEnd = uri.indexOf(':');
if ((protocolEnd < 0) || isColonFollowedByPortNumber(uri, protocolEnd)) {
... | 3.26 |
zxing_ErrorCorrectionLevel_forBits_rdh | /**
*
* @param bits
* int containing the two bits encoding a QR Code's error correction level
* @return ErrorCorrectionLevel representing the encoded error correction level
*/
public static ErrorCorrectionLevel forBits(int bits) {
if ((bits < 0) || (bits >= FOR_BITS.length)) {
throw new IllegalArgumentExcep... | 3.26 |
zxing_BinaryBitmap_getHeight_rdh | /**
*
* @return The height of the bitmap.
*/
public int
getHeight() {
return binarizer.getHeight();
} | 3.26 |
zxing_BinaryBitmap_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 BinaryBitmap rotateCounterClockwise45() {
LuminanceSource newSource = binarizer.getLuminanceSource().rotateCounterC... | 3.26 |
zxing_BinaryBitmap_isCropSupported_rdh | /**
*
* @return Whether this bitmap can be cropped.
*/
public boolean isCropSupported() {
return binarizer.getLuminanceSource().isCropSupported();
} | 3.26 |
zxing_BinaryBitmap_getBlackRow_rdh | /**
* Converts one row of luminance data to 1 bit data. May actually do the conversion, or return
* cached data. Callers should assume this method is expensive and call it as seldom as possible.
* This method is intended for decoding 1D barcodes and may choose to apply sharpening.
*
* @param y
* The row to fetc... | 3.26 |
zxing_BinaryBitmap_isRotateSupported_rdh | /**
*
* @return Whether this bitmap supports counter-clockwise rotation.
*/
public boolean isRotateSupported() {
return binarizer.getLuminanceSource().isRotateSupported();
} | 3.26 |
zxing_BinaryBitmap_getBlackMatrix_rdh | /**
* Converts a 2D array of luminance data to 1 bit. As above, assume this method is expensive
* and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or
* may not apply sharpening. Therefore, a row from this matrix may not be identical to one
* fetched using getBlackRow(), so don... | 3.26 |
zxing_BinaryBitmap_getWidth_rdh | /**
*
* @return The width of the bitmap.
*/
public int
getWidth() {
return binarizer.getWidth();
} | 3.26 |
zxing_BinaryBitmap_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 BinaryBitmap rotateCounterClockwise() {
LuminanceSource newSource = binarizer.getLuminanceSource().rotateCounterClo... | 3.26 |
zxing_BinaryBitmap_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_AddressBookResultHandler_mapIndexToAction_rdh | // This takes all the work out of figuring out which buttons/actions should be in which
// positions, based on which fields are present in this barcode.
private int mapIndexToAction(int index) {
if (index < buttonCount) {
int count = -1;
for (int x = 0; x < MAX_BUTTON_COUNT; x++) {
if... | 3.26 |
zxing_AbstractRSSReader_count_rdh | /**
*
* @param array
* values to sum
* @return sum of values
* @deprecated call {@link MathUtils#sum(int[])}
*/
@Deprecated
protected static int count(int[] array) {
return MathUtils.sum(array);
} | 3.26 |
zxing_PDF417_m1_rdh | /**
*
* @param compact
* if true, enables compaction
*/
public void m1(boolean compact) {
this.compact = compact;
} | 3.26 |
zxing_PDF417_generateBarcodeLogic_rdh | /**
*
* @param msg
* message to encode
* @param errorCorrectionLevel
* PDF417 error correction level to use
* @param autoECI
* automatically insert ECIs if needed
* @throws WriterException
* if the contents cannot be encoded in this format
*/
public void generateBarcodeLogic(String msg, int errorCorr... | 3.26 |
zxing_PDF417_setDimensions_rdh | /**
* Sets max/min row/col values
*
* @param maxCols
* maximum allowed columns
* @param minCols
* minimum allowed columns
* @param maxRows
* maximum allowed rows
* @param minRows
* minimum allowed rows
*/public void setDimensions(int maxCols, int minCols, int maxRows, int minRows) {
this.maxCols = ... | 3.26 |
zxing_PDF417_setCompaction_rdh | /**
*
* @param compaction
* compaction mode to use
*/
public void setCompaction(Compaction compaction) {
this.compaction = compaction;
} | 3.26 |
zxing_PDF417_determineDimensions_rdh | /**
* Determine optimal nr of columns and rows for the specified number of
* codewords.
*
* @param sourceCodeWords
* number of code words
* @param errorCorrectionCodeWords
* number of error correction code words
* @return dimension object containing cols as width and rows as height
*/
private int[] determi... | 3.26 |
zxing_PDF417_setEncoding_rdh | /**
*
* @param encoding
* sets character encoding to use
*/
public void
setEncoding(Charset encoding) {
this.encoding = encoding;
} | 3.26 |
zxing_PDF417_calculateNumberOfRows_rdh | /**
* Calculates the necessary number of rows as described in annex Q of ISO/IEC 15438:2001(E).
*
* @param m
* the number of source codewords prior to the additional of the Symbol Length
* Descriptor and any pad codewords
* @param k
* the number of error correction codewords... | 3.26 |
zxing_PDF417_getNumberOfPadCodewords_rdh | /**
* Calculates the number of pad codewords as described in 4.9.2 of ISO/IEC 15438:2001(E).
*
* @param m
* the number of source codewords prior to the additional of the Symbol Length
* Descriptor and any pad codewords
* @param k
* the number of error correction codewords
* @param c
* the number of col... | 3.26 |
zxing_DataMatrixWriter_convertByteMatrixToBitMatrix_rdh | /**
* Convert the ByteMatrix to BitMatrix.
*
* @param reqHeight
* The requested height of the image (in pixels) with the Datamatrix code
* @param reqWidth
* The requested width of the image (in pixels) with the Datamatrix code
* @param matrix
... | 3.26 |
zxing_DataMatrixWriter_encodeLowLevel_rdh | /**
* Encode the given symbol info to a bit matrix.
*
* @param placement
* The DataMatrix placement.
* @param symbolInfo
* The symbol info to encode.
* @return The bit matrix generated.
*/private static BitMatrix encodeLowLevel(DefaultPlacement placement, SymbolInfo symbolInfo, int width, int height) {
... | 3.26 |
zxing_WifiConfigManager_changeNetworkUnEncrypted_rdh | // Adding an open, unsecured network
private static void changeNetworkUnEncrypted(WifiManager wifiManager, WifiParsedResult wifiResult) {
WifiConfiguration config = changeNetworkCommon(wifiResult);
config.allowedKeyManagement.set(KeyMgmt.NONE);
updateNetwork(wifiManager, config);
} | 3.26 |
zxing_WifiConfigManager_changeNetworkWPA_rdh | // Adding a WPA or WPA2 network
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
WifiConfiguration config = changeNetworkCommon(wifiResult);
// Hex passwords that are 64 bits long are not to be quoted.
... | 3.26 |
zxing_WifiConfigManager_changeNetworkWEP_rdh | // Adding a WEP network
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
WifiConfiguration config = changeNetworkCommon(wifiResult);
config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
config.wepTxKeyIndex = 0;
config.allowedAuthAlgorithms.... | 3.26 |
zxing_ITFReader_m0_rdh | /**
* Attempts to decode a sequence of ITF black/white lines into single
* digit.
*
* @param counters
* the counts of runs of observed black/white/black/... values
* @return The decoded digit
* @throws NotFoundException
* if digit cannot be decoded
*/
private static int m0(int[] counters)
throws NotFoundEx... | 3.26 |
zxing_ITFReader_skipWhiteSpace_rdh | /**
* Skip all whitespace until we get to the first black line.
*
* @param row
* row of black/white values to search
* @return index of the first black line.
* @throws NotFoundException
* Throws exception if no black lines are found in the row
*/
private static int skipWhiteSpace(BitArray row) throws NotFou... | 3.26 |
zxing_ITFReader_decodeMiddle_rdh | /**
*
* @param row
* row of black/white values to search
* @param payloadStart
* offset of start pattern
* @param resultString
* {@link StringBuilder} to append decoded chars to
* @throws NotFoundException
* if decoding could not complete successfully
*/private
static void decodeMiddle(BitArray row, i... | 3.26 |
zxing_ITFReader_validateQuietZone_rdh | /**
* 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. Scan back until
* we either get to the start of the barcode or match the necessary number of
* quiet zone pixels.
*
* Note: Its assumed the row is reversed when using this meth... | 3.26 |
zxing_ISBNResultParser_parse_rdh | /**
* See <a href="http://www.bisg.org/isbn-13/for.dummies.html">ISBN-13 For Dummies</a>
*/
@Override
public ISBNParsedResult parse(Result result) {
BarcodeFormat format = result.getBarcodeFormat();
if (format != BarcodeFormat.EAN_13) {
return null;
}
String rawText = getMassagedText(result)... | 3.26 |
zxing_State_isBetterThanOrEqualTo_rdh | // Returns true if "this" state is better (or equal) to be in than "that"
// state under all possible circumstances.
boolean isBetterThanOrEqualTo(State other) {
int newModeBitCount = this.f1 + (HighLevelEncoder.LATCH_TABLE[this.mode][other.mode] >> 16);
if (this.f0 < other.f0) {
// add additional B/... | 3.26 |
zxing_State_endBinaryShift_rdh | // Create the state identical to this one, but we are no longer in
// Binary Shift mode.
State endBinaryShift(int index) {
if (f0 == 0) {
return this;
}
Token token = this.token;
token = token.addBinaryShift(index - f0, f0);return new State(token, mode, 0, this.f1);
} | 3.26 |
zxing_State_latchAndAppend_rdh | // Create a new state representing this state with a latch to a (not
// necessary different) mode, and then a code.
State latchAndAppend(int mode, int value) {
int bitCount
= this.f1;Token token = this.token;
if (mode != this.mode) {
int latch = HighLevelEncoder.LATCH_TABLE[this.mode][mode];
... | 3.26 |
zxing_State_shiftAndAppend_rdh | // Create a new state representing this state, with a temporary shift
// to a different mode to output a single value.
State shiftAndAppend(int mode, int value) {
Token token = this.token;
int thisModeBitCount = (this.mode == HighLevelEncoder.MODE_DIGIT) ? 4 : 5;
// Shifts exist only to UPPER and PUNCT,... | 3.26 |
zxing_State_addBinaryShiftChar_rdh | // Create a new state representing this state, but an additional character
// output in Binary Shift mode.
State addBinaryShiftChar(int index) {
Token token = this.token;
int mode = this.mode;
int bitCount = this.f1;
if ((this.mode == HighLevelEncoder.MODE_PUNCT) || (this.mode == HighLevelEncoder.MODE... | 3.26 |
zxing_QRCodeWriter_renderResult_rdh | // Note that the input matrix uses 0 == white, 1 == black, while the output matrix uses
// 0 == black, 255 == white (i.e. an 8 bit greyscale bitmap).
private static BitMatrix renderResult(QRCode code, int width, int height, int quietZone) {
ByteMatrix input = code.getMatrix();
if (input == null) {
thr... | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.