id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
125,300
zxing/zxing
core/src/main/java/com/google/zxing/datamatrix/encoder/HighLevelEncoder.java
HighLevelEncoder.determineConsecutiveDigitCount
public static int determineConsecutiveDigitCount(CharSequence msg, int startpos) { int count = 0; int len = msg.length(); int idx = startpos; if (idx < len) { char ch = msg.charAt(idx); while (isDigit(ch) && idx < len) { count++; idx++; if (idx < len) { ch =...
java
public static int determineConsecutiveDigitCount(CharSequence msg, int startpos) { int count = 0; int len = msg.length(); int idx = startpos; if (idx < len) { char ch = msg.charAt(idx); while (isDigit(ch) && idx < len) { count++; idx++; if (idx < len) { ch =...
[ "public", "static", "int", "determineConsecutiveDigitCount", "(", "CharSequence", "msg", ",", "int", "startpos", ")", "{", "int", "count", "=", "0", ";", "int", "len", "=", "msg", ".", "length", "(", ")", ";", "int", "idx", "=", "startpos", ";", "if", ...
Determines the number of consecutive characters that are encodable using numeric compaction. @param msg the message @param startpos the start position within the message @return the requested character count
[ "Determines", "the", "number", "of", "consecutive", "characters", "that", "are", "encodable", "using", "numeric", "compaction", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/datamatrix/encoder/HighLevelEncoder.java#L426-L441
125,301
zxing/zxing
android/src/com/google/zxing/client/android/result/ResultHandler.java
ResultHandler.searchMap
final void searchMap(String address) { launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + Uri.encode(address)))); }
java
final void searchMap(String address) { launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=" + Uri.encode(address)))); }
[ "final", "void", "searchMap", "(", "String", "address", ")", "{", "launchIntent", "(", "new", "Intent", "(", "Intent", ".", "ACTION_VIEW", ",", "Uri", ".", "parse", "(", "\"geo:0,0?q=\"", "+", "Uri", ".", "encode", "(", "address", ")", ")", ")", ")", "...
Do a geo search using the address as the query. @param address The address to find
[ "Do", "a", "geo", "search", "using", "the", "address", "as", "the", "query", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/result/ResultHandler.java#L405-L407
125,302
zxing/zxing
android/src/com/google/zxing/client/android/result/ResultHandler.java
ResultHandler.openProductSearch
final void openProductSearch(String upc) { Uri uri = Uri.parse("http://www.google." + LocaleManager.getProductSearchCountryTLD(activity) + "/m/products?q=" + upc + "&source=zxing"); launchIntent(new Intent(Intent.ACTION_VIEW, uri)); }
java
final void openProductSearch(String upc) { Uri uri = Uri.parse("http://www.google." + LocaleManager.getProductSearchCountryTLD(activity) + "/m/products?q=" + upc + "&source=zxing"); launchIntent(new Intent(Intent.ACTION_VIEW, uri)); }
[ "final", "void", "openProductSearch", "(", "String", "upc", ")", "{", "Uri", "uri", "=", "Uri", ".", "parse", "(", "\"http://www.google.\"", "+", "LocaleManager", ".", "getProductSearchCountryTLD", "(", "activity", ")", "+", "\"/m/products?q=\"", "+", "upc", "+"...
Uses the mobile-specific version of Product Search, which is formatted for small screens.
[ "Uses", "the", "mobile", "-", "specific", "version", "of", "Product", "Search", "which", "is", "formatted", "for", "small", "screens", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/result/ResultHandler.java#L415-L419
125,303
zxing/zxing
android/src/com/google/zxing/client/android/DecodeHandler.java
DecodeHandler.decode
private void decode(byte[] data, int width, int height) { long start = System.nanoTime(); Result rawResult = null; PlanarYUVLuminanceSource source = activity.getCameraManager().buildLuminanceSource(data, width, height); if (source != null) { BinaryBitmap bitmap = new BinaryBitmap(new HybridBinariz...
java
private void decode(byte[] data, int width, int height) { long start = System.nanoTime(); Result rawResult = null; PlanarYUVLuminanceSource source = activity.getCameraManager().buildLuminanceSource(data, width, height); if (source != null) { BinaryBitmap bitmap = new BinaryBitmap(new HybridBinariz...
[ "private", "void", "decode", "(", "byte", "[", "]", "data", ",", "int", "width", ",", "int", "height", ")", "{", "long", "start", "=", "System", ".", "nanoTime", "(", ")", ";", "Result", "rawResult", "=", "null", ";", "PlanarYUVLuminanceSource", "source"...
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 The height of the preview frame.
[ "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", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/DecodeHandler.java#L76-L109
125,304
zxing/zxing
core/src/main/java/com/google/zxing/datamatrix/detector/Detector.java
Detector.detectSolid1
private ResultPoint[] detectSolid1(ResultPoint[] cornerPoints) { // 0 2 // 1 3 ResultPoint pointA = cornerPoints[0]; ResultPoint pointB = cornerPoints[1]; ResultPoint pointC = cornerPoints[3]; ResultPoint pointD = cornerPoints[2]; int trAB = transitionsBetween(pointA, pointB); int trB...
java
private ResultPoint[] detectSolid1(ResultPoint[] cornerPoints) { // 0 2 // 1 3 ResultPoint pointA = cornerPoints[0]; ResultPoint pointB = cornerPoints[1]; ResultPoint pointC = cornerPoints[3]; ResultPoint pointD = cornerPoints[2]; int trAB = transitionsBetween(pointA, pointB); int trB...
[ "private", "ResultPoint", "[", "]", "detectSolid1", "(", "ResultPoint", "[", "]", "cornerPoints", ")", "{", "// 0 2", "// 1 3", "ResultPoint", "pointA", "=", "cornerPoints", "[", "0", "]", ";", "ResultPoint", "pointB", "=", "cornerPoints", "[", "1", "]", "...
Detect a solid side which has minimum transition.
[ "Detect", "a", "solid", "side", "which", "has", "minimum", "transition", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/datamatrix/detector/Detector.java#L118-L158
125,305
zxing/zxing
core/src/main/java/com/google/zxing/datamatrix/detector/Detector.java
Detector.detectSolid2
private ResultPoint[] detectSolid2(ResultPoint[] points) { // A..D // : : // B--C ResultPoint pointA = points[0]; ResultPoint pointB = points[1]; ResultPoint pointC = points[2]; ResultPoint pointD = points[3]; // Transition detection on the edge is not stable. // To safely detect, ...
java
private ResultPoint[] detectSolid2(ResultPoint[] points) { // A..D // : : // B--C ResultPoint pointA = points[0]; ResultPoint pointB = points[1]; ResultPoint pointC = points[2]; ResultPoint pointD = points[3]; // Transition detection on the edge is not stable. // To safely detect, ...
[ "private", "ResultPoint", "[", "]", "detectSolid2", "(", "ResultPoint", "[", "]", "points", ")", "{", "// A..D", "// : :", "// B--C", "ResultPoint", "pointA", "=", "points", "[", "0", "]", ";", "ResultPoint", "pointB", "=", "points", "[", "1", "]", ";", ...
Detect a second solid side next to first solid side.
[ "Detect", "a", "second", "solid", "side", "next", "to", "first", "solid", "side", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/datamatrix/detector/Detector.java#L163-L198
125,306
zxing/zxing
core/src/main/java/com/google/zxing/datamatrix/detector/Detector.java
Detector.correctTopRight
private ResultPoint correctTopRight(ResultPoint[] points) { // A..D // | : // B--C ResultPoint pointA = points[0]; ResultPoint pointB = points[1]; ResultPoint pointC = points[2]; ResultPoint pointD = points[3]; // shift points for safe transition detection. int trTop = transitionsB...
java
private ResultPoint correctTopRight(ResultPoint[] points) { // A..D // | : // B--C ResultPoint pointA = points[0]; ResultPoint pointB = points[1]; ResultPoint pointC = points[2]; ResultPoint pointD = points[3]; // shift points for safe transition detection. int trTop = transitionsB...
[ "private", "ResultPoint", "correctTopRight", "(", "ResultPoint", "[", "]", "points", ")", "{", "// A..D", "// | :", "// B--C", "ResultPoint", "pointA", "=", "points", "[", "0", "]", ";", "ResultPoint", "pointB", "=", "points", "[", "1", "]", ";", "ResultPoi...
Calculates the corner position of the white top right module.
[ "Calculates", "the", "corner", "position", "of", "the", "white", "top", "right", "module", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/datamatrix/detector/Detector.java#L203-L246
125,307
zxing/zxing
core/src/main/java/com/google/zxing/datamatrix/detector/Detector.java
Detector.shiftToModuleCenter
private ResultPoint[] shiftToModuleCenter(ResultPoint[] points) { // A..D // | : // B--C ResultPoint pointA = points[0]; ResultPoint pointB = points[1]; ResultPoint pointC = points[2]; ResultPoint pointD = points[3]; // calculate pseudo dimensions int dimH = transitionsBetween(poin...
java
private ResultPoint[] shiftToModuleCenter(ResultPoint[] points) { // A..D // | : // B--C ResultPoint pointA = points[0]; ResultPoint pointB = points[1]; ResultPoint pointC = points[2]; ResultPoint pointD = points[3]; // calculate pseudo dimensions int dimH = transitionsBetween(poin...
[ "private", "ResultPoint", "[", "]", "shiftToModuleCenter", "(", "ResultPoint", "[", "]", "points", ")", "{", "// A..D", "// | :", "// B--C", "ResultPoint", "pointA", "=", "points", "[", "0", "]", ";", "ResultPoint", "pointB", "=", "points", "[", "1", "]", ...
Shift the edge points to the module center.
[ "Shift", "the", "edge", "points", "to", "the", "module", "center", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/datamatrix/detector/Detector.java#L251-L301
125,308
zxing/zxing
android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java
IntentIntegrator.startActivityForResult
protected void startActivityForResult(Intent intent, int code) { if (fragment == null) { activity.startActivityForResult(intent, code); } else { fragment.startActivityForResult(intent, code); } }
java
protected void startActivityForResult(Intent intent, int code) { if (fragment == null) { activity.startActivityForResult(intent, code); } else { fragment.startActivityForResult(intent, code); } }
[ "protected", "void", "startActivityForResult", "(", "Intent", "intent", ",", "int", "code", ")", "{", "if", "(", "fragment", "==", "null", ")", "{", "activity", ".", "startActivityForResult", "(", "intent", ",", "code", ")", ";", "}", "else", "{", "fragmen...
Start an activity. This method is defined to allow different methods of activity starting for newer versions of Android and for compatibility library. @param intent Intent to start. @param code Request code for the activity @see Activity#startActivityForResult(Intent, int) @see Fragment#startActivityForResult(Intent, ...
[ "Start", "an", "activity", ".", "This", "method", "is", "defined", "to", "allow", "different", "methods", "of", "activity", "starting", "for", "newer", "versions", "of", "Android", "and", "for", "compatibility", "library", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java#L342-L348
125,309
zxing/zxing
android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java
IntentIntegrator.shareText
public final AlertDialog shareText(CharSequence text, CharSequence type) { Intent intent = new Intent(); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setAction(BS_PACKAGE + ".ENCODE"); intent.putExtra("ENCODE_TYPE", type); intent.putExtra("ENCODE_DATA", text); String targetAppPackage = fi...
java
public final AlertDialog shareText(CharSequence text, CharSequence type) { Intent intent = new Intent(); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setAction(BS_PACKAGE + ".ENCODE"); intent.putExtra("ENCODE_TYPE", type); intent.putExtra("ENCODE_DATA", text); String targetAppPackage = fi...
[ "public", "final", "AlertDialog", "shareText", "(", "CharSequence", "text", ",", "CharSequence", "type", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", ")", ";", "intent", ".", "addCategory", "(", "Intent", ".", "CATEGORY_DEFAULT", ")", ";", "inten...
Shares the given text by encoding it as a barcode, such that another user can scan the text off the screen of the device. @param text the text string to encode as a barcode @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type} constants. @return the {@link AlertDialog} that was ...
[ "Shares", "the", "given", "text", "by", "encoding", "it", "as", "a", "barcode", "such", "that", "another", "user", "can", "scan", "the", "text", "off", "the", "screen", "of", "the", "device", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java#L461-L481
125,310
zxing/zxing
core/src/main/java/com/google/zxing/common/GlobalHistogramBinarizer.java
GlobalHistogramBinarizer.getBlackRow
@Override public BitArray getBlackRow(int y, BitArray row) throws NotFoundException { LuminanceSource source = getLuminanceSource(); int width = source.getWidth(); if (row == null || row.getSize() < width) { row = new BitArray(width); } else { row.clear(); } initArrays(width); ...
java
@Override public BitArray getBlackRow(int y, BitArray row) throws NotFoundException { LuminanceSource source = getLuminanceSource(); int width = source.getWidth(); if (row == null || row.getSize() < width) { row = new BitArray(width); } else { row.clear(); } initArrays(width); ...
[ "@", "Override", "public", "BitArray", "getBlackRow", "(", "int", "y", ",", "BitArray", "row", ")", "throws", "NotFoundException", "{", "LuminanceSource", "source", "=", "getLuminanceSource", "(", ")", ";", "int", "width", "=", "source", ".", "getWidth", "(", ...
Applies simple sharpening to the row data to improve performance of the 1D Readers.
[ "Applies", "simple", "sharpening", "to", "the", "row", "data", "to", "improve", "performance", "of", "the", "1D", "Readers", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/GlobalHistogramBinarizer.java#L51-L90
125,311
zxing/zxing
core/src/main/java/com/google/zxing/common/GlobalHistogramBinarizer.java
GlobalHistogramBinarizer.getBlackMatrix
@Override public BitMatrix getBlackMatrix() throws NotFoundException { LuminanceSource source = getLuminanceSource(); int width = source.getWidth(); int height = source.getHeight(); BitMatrix matrix = new BitMatrix(width, height); // Quickly calculates the histogram by sampling four rows from the...
java
@Override public BitMatrix getBlackMatrix() throws NotFoundException { LuminanceSource source = getLuminanceSource(); int width = source.getWidth(); int height = source.getHeight(); BitMatrix matrix = new BitMatrix(width, height); // Quickly calculates the histogram by sampling four rows from the...
[ "@", "Override", "public", "BitMatrix", "getBlackMatrix", "(", ")", "throws", "NotFoundException", "{", "LuminanceSource", "source", "=", "getLuminanceSource", "(", ")", ";", "int", "width", "=", "source", ".", "getWidth", "(", ")", ";", "int", "height", "=", ...
Does not sharpen the data, as this call is intended to only be used by 2D Readers.
[ "Does", "not", "sharpen", "the", "data", "as", "this", "call", "is", "intended", "to", "only", "be", "used", "by", "2D", "Readers", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/GlobalHistogramBinarizer.java#L93-L130
125,312
zxing/zxing
core/src/main/java/com/google/zxing/aztec/encoder/State.java
State.latchAndAppend
State latchAndAppend(int mode, int value) { //assert binaryShiftByteCount == 0; int bitCount = this.bitCount; Token token = this.token; if (mode != this.mode) { int latch = HighLevelEncoder.LATCH_TABLE[this.mode][mode]; token = token.add(latch & 0xFFFF, latch >> 16); bitCount += latch ...
java
State latchAndAppend(int mode, int value) { //assert binaryShiftByteCount == 0; int bitCount = this.bitCount; Token token = this.token; if (mode != this.mode) { int latch = HighLevelEncoder.LATCH_TABLE[this.mode][mode]; token = token.add(latch & 0xFFFF, latch >> 16); bitCount += latch ...
[ "State", "latchAndAppend", "(", "int", "mode", ",", "int", "value", ")", "{", "//assert binaryShiftByteCount == 0;", "int", "bitCount", "=", "this", ".", "bitCount", ";", "Token", "token", "=", "this", ".", "token", ";", "if", "(", "mode", "!=", "this", "....
necessary different) mode, and then a code.
[ "necessary", "different", ")", "mode", "and", "then", "a", "code", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/encoder/State.java#L75-L87
125,313
zxing/zxing
core/src/main/java/com/google/zxing/aztec/encoder/State.java
State.shiftAndAppend
State shiftAndAppend(int mode, int value) { //assert binaryShiftByteCount == 0 && this.mode != mode; Token token = this.token; int thisModeBitCount = this.mode == HighLevelEncoder.MODE_DIGIT ? 4 : 5; // Shifts exist only to UPPER and PUNCT, both with tokens size 5. token = token.add(HighLevelEncoder...
java
State shiftAndAppend(int mode, int value) { //assert binaryShiftByteCount == 0 && this.mode != mode; Token token = this.token; int thisModeBitCount = this.mode == HighLevelEncoder.MODE_DIGIT ? 4 : 5; // Shifts exist only to UPPER and PUNCT, both with tokens size 5. token = token.add(HighLevelEncoder...
[ "State", "shiftAndAppend", "(", "int", "mode", ",", "int", "value", ")", "{", "//assert binaryShiftByteCount == 0 && this.mode != mode;", "Token", "token", "=", "this", ".", "token", ";", "int", "thisModeBitCount", "=", "this", ".", "mode", "==", "HighLevelEncoder",...
to a different mode to output a single value.
[ "to", "a", "different", "mode", "to", "output", "a", "single", "value", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/encoder/State.java#L91-L99
125,314
zxing/zxing
core/src/main/java/com/google/zxing/aztec/encoder/State.java
State.addBinaryShiftChar
State addBinaryShiftChar(int index) { Token token = this.token; int mode = this.mode; int bitCount = this.bitCount; if (this.mode == HighLevelEncoder.MODE_PUNCT || this.mode == HighLevelEncoder.MODE_DIGIT) { //assert binaryShiftByteCount == 0; int latch = HighLevelEncoder.LATCH_TABLE[mode][H...
java
State addBinaryShiftChar(int index) { Token token = this.token; int mode = this.mode; int bitCount = this.bitCount; if (this.mode == HighLevelEncoder.MODE_PUNCT || this.mode == HighLevelEncoder.MODE_DIGIT) { //assert binaryShiftByteCount == 0; int latch = HighLevelEncoder.LATCH_TABLE[mode][H...
[ "State", "addBinaryShiftChar", "(", "int", "index", ")", "{", "Token", "token", "=", "this", ".", "token", ";", "int", "mode", "=", "this", ".", "mode", ";", "int", "bitCount", "=", "this", ".", "bitCount", ";", "if", "(", "this", ".", "mode", "==", ...
output in Binary Shift mode.
[ "output", "in", "Binary", "Shift", "mode", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/encoder/State.java#L103-L123
125,315
zxing/zxing
core/src/main/java/com/google/zxing/aztec/encoder/State.java
State.endBinaryShift
State endBinaryShift(int index) { if (binaryShiftByteCount == 0) { return this; } Token token = this.token; token = token.addBinaryShift(index - binaryShiftByteCount, binaryShiftByteCount); //assert token.getTotalBitCount() == this.bitCount; return new State(token, mode, 0, this.bitCount);...
java
State endBinaryShift(int index) { if (binaryShiftByteCount == 0) { return this; } Token token = this.token; token = token.addBinaryShift(index - binaryShiftByteCount, binaryShiftByteCount); //assert token.getTotalBitCount() == this.bitCount; return new State(token, mode, 0, this.bitCount);...
[ "State", "endBinaryShift", "(", "int", "index", ")", "{", "if", "(", "binaryShiftByteCount", "==", "0", ")", "{", "return", "this", ";", "}", "Token", "token", "=", "this", ".", "token", ";", "token", "=", "token", ".", "addBinaryShift", "(", "index", ...
Binary Shift mode.
[ "Binary", "Shift", "mode", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/encoder/State.java#L127-L135
125,316
zxing/zxing
core/src/main/java/com/google/zxing/aztec/encoder/State.java
State.isBetterThanOrEqualTo
boolean isBetterThanOrEqualTo(State other) { int newModeBitCount = this.bitCount + (HighLevelEncoder.LATCH_TABLE[this.mode][other.mode] >> 16); if (this.binaryShiftByteCount < other.binaryShiftByteCount) { // add additional B/S encoding cost of other, if any newModeBitCount += calculateBinaryShiftCo...
java
boolean isBetterThanOrEqualTo(State other) { int newModeBitCount = this.bitCount + (HighLevelEncoder.LATCH_TABLE[this.mode][other.mode] >> 16); if (this.binaryShiftByteCount < other.binaryShiftByteCount) { // add additional B/S encoding cost of other, if any newModeBitCount += calculateBinaryShiftCo...
[ "boolean", "isBetterThanOrEqualTo", "(", "State", "other", ")", "{", "int", "newModeBitCount", "=", "this", ".", "bitCount", "+", "(", "HighLevelEncoder", ".", "LATCH_TABLE", "[", "this", ".", "mode", "]", "[", "other", ".", "mode", "]", ">>", "16", ")", ...
state under all possible circumstances.
[ "state", "under", "all", "possible", "circumstances", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/encoder/State.java#L139-L149
125,317
zxing/zxing
core/src/main/java/com/google/zxing/datamatrix/DataMatrixWriter.java
DataMatrixWriter.encodeLowLevel
private static BitMatrix encodeLowLevel(DefaultPlacement placement, SymbolInfo symbolInfo, int width, int height) { int symbolWidth = symbolInfo.getSymbolDataWidth(); int symbolHeight = symbolInfo.getSymbolDataHeight(); ByteMatrix matrix = new ByteMatrix(symbolInfo.getSymbolWidth(), symbolInfo.getSymbolHei...
java
private static BitMatrix encodeLowLevel(DefaultPlacement placement, SymbolInfo symbolInfo, int width, int height) { int symbolWidth = symbolInfo.getSymbolDataWidth(); int symbolHeight = symbolInfo.getSymbolDataHeight(); ByteMatrix matrix = new ByteMatrix(symbolInfo.getSymbolWidth(), symbolInfo.getSymbolHei...
[ "private", "static", "BitMatrix", "encodeLowLevel", "(", "DefaultPlacement", "placement", ",", "SymbolInfo", "symbolInfo", ",", "int", "width", ",", "int", "height", ")", "{", "int", "symbolWidth", "=", "symbolInfo", ".", "getSymbolDataWidth", "(", ")", ";", "in...
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.
[ "Encode", "the", "given", "symbol", "info", "to", "a", "bit", "matrix", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/datamatrix/DataMatrixWriter.java#L106-L153
125,318
zxing/zxing
core/src/main/java/com/google/zxing/datamatrix/DataMatrixWriter.java
DataMatrixWriter.convertByteMatrixToBitMatrix
private static BitMatrix convertByteMatrixToBitMatrix(ByteMatrix matrix, int reqWidth, int reqHeight) { int matrixWidth = matrix.getWidth(); int matrixHeight = matrix.getHeight(); int outputWidth = Math.max(reqWidth, matrixWidth); int outputHeight = Math.max(reqHeight, matrixHeight); int multiple =...
java
private static BitMatrix convertByteMatrixToBitMatrix(ByteMatrix matrix, int reqWidth, int reqHeight) { int matrixWidth = matrix.getWidth(); int matrixHeight = matrix.getHeight(); int outputWidth = Math.max(reqWidth, matrixWidth); int outputHeight = Math.max(reqHeight, matrixHeight); int multiple =...
[ "private", "static", "BitMatrix", "convertByteMatrixToBitMatrix", "(", "ByteMatrix", "matrix", ",", "int", "reqWidth", ",", "int", "reqHeight", ")", "{", "int", "matrixWidth", "=", "matrix", ".", "getWidth", "(", ")", ";", "int", "matrixHeight", "=", "matrix", ...
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 The input matrix. @return The output matrix.
[ "Convert", "the", "ByteMatrix", "to", "BitMatrix", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/datamatrix/DataMatrixWriter.java#L163-L196
125,319
zxing/zxing
core/src/main/java/com/google/zxing/oned/ITFReader.java
ITFReader.skipWhiteSpace
private static int skipWhiteSpace(BitArray row) throws NotFoundException { int width = row.getSize(); int endStart = row.getNextSet(0); if (endStart == width) { throw NotFoundException.getNotFoundInstance(); } return endStart; }
java
private static int skipWhiteSpace(BitArray row) throws NotFoundException { int width = row.getSize(); int endStart = row.getNextSet(0); if (endStart == width) { throw NotFoundException.getNotFoundInstance(); } return endStart; }
[ "private", "static", "int", "skipWhiteSpace", "(", "BitArray", "row", ")", "throws", "NotFoundException", "{", "int", "width", "=", "row", ".", "getSize", "(", ")", ";", "int", "endStart", "=", "row", ".", "getNextSet", "(", "0", ")", ";", "if", "(", "...
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
[ "Skip", "all", "whitespace", "until", "we", "get", "to", "the", "first", "black", "line", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/ITFReader.java#L254-L262
125,320
zxing/zxing
core/src/main/java/com/google/zxing/common/BitMatrix.java
BitMatrix.getRow
public BitArray getRow(int y, BitArray row) { if (row == null || row.getSize() < width) { row = new BitArray(width); } else { row.clear(); } int offset = y * rowSize; for (int x = 0; x < rowSize; x++) { row.setBulk(x * 32, bits[offset + x]); } return row; }
java
public BitArray getRow(int y, BitArray row) { if (row == null || row.getSize() < width) { row = new BitArray(width); } else { row.clear(); } int offset = y * rowSize; for (int x = 0; x < rowSize; x++) { row.setBulk(x * 32, bits[offset + x]); } return row; }
[ "public", "BitArray", "getRow", "(", "int", "y", ",", "BitArray", "row", ")", "{", "if", "(", "row", "==", "null", "||", "row", ".", "getSize", "(", ")", "<", "width", ")", "{", "row", "=", "new", "BitArray", "(", "width", ")", ";", "}", "else", ...
A fast method to retrieve one row of data from the matrix as a BitArray. @param y The row to retrieve @param row An optional caller-allocated BitArray, will be allocated if null or too small @return The resulting BitArray - this reference should always be used even when passing your own row
[ "A", "fast", "method", "to", "retrieve", "one", "row", "of", "data", "from", "the", "matrix", "as", "a", "BitArray", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/BitMatrix.java#L259-L270
125,321
zxing/zxing
core/src/main/java/com/google/zxing/common/BitMatrix.java
BitMatrix.getEnclosingRectangle
public int[] getEnclosingRectangle() { int left = width; int top = height; int right = -1; int bottom = -1; for (int y = 0; y < height; y++) { for (int x32 = 0; x32 < rowSize; x32++) { int theBits = bits[y * rowSize + x32]; if (theBits != 0) { if (y < top) { ...
java
public int[] getEnclosingRectangle() { int left = width; int top = height; int right = -1; int bottom = -1; for (int y = 0; y < height; y++) { for (int x32 = 0; x32 < rowSize; x32++) { int theBits = bits[y * rowSize + x32]; if (theBits != 0) { if (y < top) { ...
[ "public", "int", "[", "]", "getEnclosingRectangle", "(", ")", "{", "int", "left", "=", "width", ";", "int", "top", "=", "height", ";", "int", "right", "=", "-", "1", ";", "int", "bottom", "=", "-", "1", ";", "for", "(", "int", "y", "=", "0", ";...
This is useful in detecting the enclosing rectangle of a 'pure' barcode. @return {@code left,top,width,height} enclosing rectangle of all 1 bits, or null if it is all white
[ "This", "is", "useful", "in", "detecting", "the", "enclosing", "rectangle", "of", "a", "pure", "barcode", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/BitMatrix.java#L303-L346
125,322
zxing/zxing
core/src/main/java/com/google/zxing/common/BitMatrix.java
BitMatrix.getTopLeftOnBit
public int[] getTopLeftOnBit() { int bitsOffset = 0; while (bitsOffset < bits.length && bits[bitsOffset] == 0) { bitsOffset++; } if (bitsOffset == bits.length) { return null; } int y = bitsOffset / rowSize; int x = (bitsOffset % rowSize) * 32; int theBits = bits[bitsOffset];...
java
public int[] getTopLeftOnBit() { int bitsOffset = 0; while (bitsOffset < bits.length && bits[bitsOffset] == 0) { bitsOffset++; } if (bitsOffset == bits.length) { return null; } int y = bitsOffset / rowSize; int x = (bitsOffset % rowSize) * 32; int theBits = bits[bitsOffset];...
[ "public", "int", "[", "]", "getTopLeftOnBit", "(", ")", "{", "int", "bitsOffset", "=", "0", ";", "while", "(", "bitsOffset", "<", "bits", ".", "length", "&&", "bits", "[", "bitsOffset", "]", "==", "0", ")", "{", "bitsOffset", "++", ";", "}", "if", ...
This is useful in detecting a corner of a 'pure' barcode. @return {@code x,y} coordinate of top-left-most 1 bit, or null if it is all white
[ "This", "is", "useful", "in", "detecting", "a", "corner", "of", "a", "pure", "barcode", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/BitMatrix.java#L353-L371
125,323
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/encoder/MatrixUtil.java
MatrixUtil.buildMatrix
static void buildMatrix(BitArray dataBits, ErrorCorrectionLevel ecLevel, Version version, int maskPattern, ByteMatrix matrix) throws WriterException { clearMatrix(matrix); embedBasicPatterns(version, matrix);...
java
static void buildMatrix(BitArray dataBits, ErrorCorrectionLevel ecLevel, Version version, int maskPattern, ByteMatrix matrix) throws WriterException { clearMatrix(matrix); embedBasicPatterns(version, matrix);...
[ "static", "void", "buildMatrix", "(", "BitArray", "dataBits", ",", "ErrorCorrectionLevel", "ecLevel", ",", "Version", "version", ",", "int", "maskPattern", ",", "ByteMatrix", "matrix", ")", "throws", "WriterException", "{", "clearMatrix", "(", "matrix", ")", ";", ...
success, store the result in "matrix" and return true.
[ "success", "store", "the", "result", "in", "matrix", "and", "return", "true", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/encoder/MatrixUtil.java#L132-L145
125,324
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/encoder/MatrixUtil.java
MatrixUtil.embedBasicPatterns
static void embedBasicPatterns(Version version, ByteMatrix matrix) throws WriterException { // Let's get started with embedding big squares at corners. embedPositionDetectionPatternsAndSeparators(matrix); // Then, embed the dark dot at the left bottom corner. embedDarkDotAtLeftBottomCorner(matrix); ...
java
static void embedBasicPatterns(Version version, ByteMatrix matrix) throws WriterException { // Let's get started with embedding big squares at corners. embedPositionDetectionPatternsAndSeparators(matrix); // Then, embed the dark dot at the left bottom corner. embedDarkDotAtLeftBottomCorner(matrix); ...
[ "static", "void", "embedBasicPatterns", "(", "Version", "version", ",", "ByteMatrix", "matrix", ")", "throws", "WriterException", "{", "// Let's get started with embedding big squares at corners.", "embedPositionDetectionPatternsAndSeparators", "(", "matrix", ")", ";", "// Then...
- Position adjustment patterns, if need be
[ "-", "Position", "adjustment", "patterns", "if", "need", "be" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/encoder/MatrixUtil.java#L153-L163
125,325
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/encoder/MatrixUtil.java
MatrixUtil.embedTypeInfo
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.getSize(); ++i) { // Place bits in LSB to MSB order...
java
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.getSize(); ++i) { // Place bits in LSB to MSB order...
[ "static", "void", "embedTypeInfo", "(", "ErrorCorrectionLevel", "ecLevel", ",", "int", "maskPattern", ",", "ByteMatrix", "matrix", ")", "throws", "WriterException", "{", "BitArray", "typeInfoBits", "=", "new", "BitArray", "(", ")", ";", "makeTypeInfoBits", "(", "e...
Embed type information. On success, modify the matrix.
[ "Embed", "type", "information", ".", "On", "success", "modify", "the", "matrix", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/encoder/MatrixUtil.java#L166-L194
125,326
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/encoder/MatrixUtil.java
MatrixUtil.calculateBCHCode
static int calculateBCHCode(int value, int poly) { if (poly == 0) { throw new IllegalArgumentException("0 polynomial"); } // If poly is "1 1111 0010 0101" (version info poly), msbSetInPoly is 13. We'll subtract 1 // from 13 to make it 12. int msbSetInPoly = findMSBSet(poly); value <<= msbS...
java
static int calculateBCHCode(int value, int poly) { if (poly == 0) { throw new IllegalArgumentException("0 polynomial"); } // If poly is "1 1111 0010 0101" (version info poly), msbSetInPoly is 13. We'll subtract 1 // from 13 to make it 12. int msbSetInPoly = findMSBSet(poly); value <<= msbS...
[ "static", "int", "calculateBCHCode", "(", "int", "value", ",", "int", "poly", ")", "{", "if", "(", "poly", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"0 polynomial\"", ")", ";", "}", "// If poly is \"1 1111 0010 0101\" (version info po...
operations. We don't care if coefficients are positive or negative.
[ "operations", ".", "We", "don", "t", "care", "if", "coefficients", "are", "positive", "or", "negative", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/encoder/MatrixUtil.java#L303-L317
125,327
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/encoder/MatrixUtil.java
MatrixUtil.maybeEmbedPositionAdjustmentPatterns
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 = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index]...
java
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 = POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[index]...
[ "private", "static", "void", "maybeEmbedPositionAdjustmentPatterns", "(", "Version", "version", ",", "ByteMatrix", "matrix", ")", "{", "if", "(", "version", ".", "getVersionNumber", "(", ")", "<", "2", ")", "{", "// The patterns appear if version >= 2", "return", ";...
Embed position adjustment patterns if need be.
[ "Embed", "position", "adjustment", "patterns", "if", "need", "be", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/encoder/MatrixUtil.java#L456-L474
125,328
zxing/zxing
core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java
RSSExpandedReader.decodeRow2pairs
List<ExpandedPair> decodeRow2pairs(int rowNumber, BitArray row) throws NotFoundException { boolean done = false; while (!done) { try { this.pairs.add(retrieveNextPair(row, this.pairs, rowNumber)); } catch (NotFoundException nfe) { if (this.pairs.isEmpty()) { throw nfe; ...
java
List<ExpandedPair> decodeRow2pairs(int rowNumber, BitArray row) throws NotFoundException { boolean done = false; while (!done) { try { this.pairs.add(retrieveNextPair(row, this.pairs, rowNumber)); } catch (NotFoundException nfe) { if (this.pairs.isEmpty()) { throw nfe; ...
[ "List", "<", "ExpandedPair", ">", "decodeRow2pairs", "(", "int", "rowNumber", ",", "BitArray", "row", ")", "throws", "NotFoundException", "{", "boolean", "done", "=", "false", ";", "while", "(", "!", "done", ")", "{", "try", "{", "this", ".", "pairs", "....
Not private for testing
[ "Not", "private", "for", "testing" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java#L147-L182
125,329
zxing/zxing
core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java
RSSExpandedReader.checkRows
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(); for (ExpandedRow collectedRow : collectedRows) { this.pairs.addAll(collectedR...
java
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(); for (ExpandedRow collectedRow : collectedRows) { this.pairs.addAll(collectedR...
[ "private", "List", "<", "ExpandedPair", ">", "checkRows", "(", "List", "<", "ExpandedRow", ">", "collectedRows", ",", "int", "currentRow", ")", "throws", "NotFoundException", "{", "for", "(", "int", "i", "=", "currentRow", ";", "i", "<", "rows", ".", "size...
Recursion is used to implement backtracking
[ "Recursion", "is", "used", "to", "implement", "backtracking" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java#L214-L242
125,330
zxing/zxing
core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java
RSSExpandedReader.isValidSequence
private static boolean isValidSequence(List<ExpandedPair> pairs) { for (int[] sequence : FINDER_PATTERN_SEQUENCES) { if (pairs.size() > sequence.length) { continue; } boolean stop = true; for (int j = 0; j < pairs.size(); j++) { if (pairs.get(j).getFinderPattern().getValue()...
java
private static boolean isValidSequence(List<ExpandedPair> pairs) { for (int[] sequence : FINDER_PATTERN_SEQUENCES) { if (pairs.size() > sequence.length) { continue; } boolean stop = true; for (int j = 0; j < pairs.size(); j++) { if (pairs.get(j).getFinderPattern().getValue()...
[ "private", "static", "boolean", "isValidSequence", "(", "List", "<", "ExpandedPair", ">", "pairs", ")", "{", "for", "(", "int", "[", "]", "sequence", ":", "FINDER_PATTERN_SEQUENCES", ")", "{", "if", "(", "pairs", ".", "size", "(", ")", ">", "sequence", "...
either complete or a prefix
[ "either", "complete", "or", "a", "prefix" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java#L246-L266
125,331
zxing/zxing
core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java
RSSExpandedReader.removePartialRows
private static void removePartialRows(List<ExpandedPair> pairs, List<ExpandedRow> rows) { for (Iterator<ExpandedRow> iterator = rows.iterator(); iterator.hasNext();) { ExpandedRow r = iterator.next(); if (r.getPairs().size() == pairs.size()) { continue; } boolean allFound = true; ...
java
private static void removePartialRows(List<ExpandedPair> pairs, List<ExpandedRow> rows) { for (Iterator<ExpandedRow> iterator = rows.iterator(); iterator.hasNext();) { ExpandedRow r = iterator.next(); if (r.getPairs().size() == pairs.size()) { continue; } boolean allFound = true; ...
[ "private", "static", "void", "removePartialRows", "(", "List", "<", "ExpandedPair", ">", "pairs", ",", "List", "<", "ExpandedRow", ">", "rows", ")", "{", "for", "(", "Iterator", "<", "ExpandedRow", ">", "iterator", "=", "rows", ".", "iterator", "(", ")", ...
Remove all the rows that contains only specified pairs
[ "Remove", "all", "the", "rows", "that", "contains", "only", "specified", "pairs" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java#L301-L326
125,332
zxing/zxing
core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java
RSSExpandedReader.isPartialRow
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 (ExpandedPair pp : r.getPairs()) { if (p.equals(pp)) { fou...
java
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 (ExpandedPair pp : r.getPairs()) { if (p.equals(pp)) { fou...
[ "private", "static", "boolean", "isPartialRow", "(", "Iterable", "<", "ExpandedPair", ">", "pairs", ",", "Iterable", "<", "ExpandedRow", ">", "rows", ")", "{", "for", "(", "ExpandedRow", "r", ":", "rows", ")", "{", "boolean", "allFound", "=", "true", ";", ...
Returns true when one of the rows already contains all the pairs
[ "Returns", "true", "when", "one", "of", "the", "rows", "already", "contains", "all", "the", "pairs" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java#L329-L351
125,333
zxing/zxing
core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java
RSSExpandedReader.constructResult
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException { BitArray binary = BitArrayBuilder.buildBitArray(pairs); AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary); String resultingString = decoder.parseInformation(); ResultPoint[...
java
static Result constructResult(List<ExpandedPair> pairs) throws NotFoundException, FormatException { BitArray binary = BitArrayBuilder.buildBitArray(pairs); AbstractExpandedDecoder decoder = AbstractExpandedDecoder.createDecoder(binary); String resultingString = decoder.parseInformation(); ResultPoint[...
[ "static", "Result", "constructResult", "(", "List", "<", "ExpandedPair", ">", "pairs", ")", "throws", "NotFoundException", ",", "FormatException", "{", "BitArray", "binary", "=", "BitArrayBuilder", ".", "buildBitArray", "(", "pairs", ")", ";", "AbstractExpandedDecod...
Not private for unit testing
[ "Not", "private", "for", "unit", "testing" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java#L359-L374
125,334
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/encoder/Encoder.java
Encoder.calculateMaskPenalty
private static int calculateMaskPenalty(ByteMatrix matrix) { return MaskUtil.applyMaskPenaltyRule1(matrix) + MaskUtil.applyMaskPenaltyRule2(matrix) + MaskUtil.applyMaskPenaltyRule3(matrix) + MaskUtil.applyMaskPenaltyRule4(matrix); }
java
private static int calculateMaskPenalty(ByteMatrix matrix) { return MaskUtil.applyMaskPenaltyRule1(matrix) + MaskUtil.applyMaskPenaltyRule2(matrix) + MaskUtil.applyMaskPenaltyRule3(matrix) + MaskUtil.applyMaskPenaltyRule4(matrix); }
[ "private", "static", "int", "calculateMaskPenalty", "(", "ByteMatrix", "matrix", ")", "{", "return", "MaskUtil", ".", "applyMaskPenaltyRule1", "(", "matrix", ")", "+", "MaskUtil", ".", "applyMaskPenaltyRule2", "(", "matrix", ")", "+", "MaskUtil", ".", "applyMaskPe...
Basically it applies four rules and summate all penalties.
[ "Basically", "it", "applies", "four", "rules", "and", "summate", "all", "penalties", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/encoder/Encoder.java#L57-L62
125,335
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/encoder/Encoder.java
Encoder.recommendVersion
private static Version recommendVersion(ErrorCorrectionLevel ecLevel, Mode mode, BitArray headerBits, BitArray dataBits) throws WriterException { // Hard part: need to know version to know h...
java
private static Version recommendVersion(ErrorCorrectionLevel ecLevel, Mode mode, BitArray headerBits, BitArray dataBits) throws WriterException { // Hard part: need to know version to know h...
[ "private", "static", "Version", "recommendVersion", "(", "ErrorCorrectionLevel", "ecLevel", ",", "Mode", "mode", ",", "BitArray", "headerBits", ",", "BitArray", "dataBits", ")", "throws", "WriterException", "{", "// Hard part: need to know version to know how many bits length...
Decides the smallest version of QR code that will contain all of the provided data. @throws WriterException if the data cannot fit in any version
[ "Decides", "the", "smallest", "version", "of", "QR", "code", "that", "will", "contain", "all", "of", "the", "provided", "data", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/encoder/Encoder.java#L173-L186
125,336
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/encoder/Encoder.java
Encoder.appendLengthInfo
static void appendLengthInfo(int numLetters, Version version, Mode mode, BitArray bits) throws WriterException { int numBits = mode.getCharacterCountBits(version); if (numLetters >= (1 << numBits)) { throw new WriterException(numLetters + " is bigger than " + ((1 << numBits) - 1)); } bits.appendBi...
java
static void appendLengthInfo(int numLetters, Version version, Mode mode, BitArray bits) throws WriterException { int numBits = mode.getCharacterCountBits(version); if (numLetters >= (1 << numBits)) { throw new WriterException(numLetters + " is bigger than " + ((1 << numBits) - 1)); } bits.appendBi...
[ "static", "void", "appendLengthInfo", "(", "int", "numLetters", ",", "Version", "version", ",", "Mode", "mode", ",", "BitArray", "bits", ")", "throws", "WriterException", "{", "int", "numBits", "=", "mode", ".", "getCharacterCountBits", "(", "version", ")", ";...
Append length info. On success, store the result in "bits".
[ "Append", "length", "info", ".", "On", "success", "store", "the", "result", "in", "bits", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/encoder/Encoder.java#L491-L497
125,337
zxing/zxing
core/src/main/java/com/google/zxing/client/result/ProductResultParser.java
ProductResultParser.parse
@Override public ProductParsedResult parse(Result result) { BarcodeFormat format = result.getBarcodeFormat(); if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E || format == BarcodeFormat.EAN_8 || format == BarcodeFormat.EAN_13)) { return null; } String rawText = getM...
java
@Override public ProductParsedResult parse(Result result) { BarcodeFormat format = result.getBarcodeFormat(); if (!(format == BarcodeFormat.UPC_A || format == BarcodeFormat.UPC_E || format == BarcodeFormat.EAN_8 || format == BarcodeFormat.EAN_13)) { return null; } String rawText = getM...
[ "@", "Override", "public", "ProductParsedResult", "parse", "(", "Result", "result", ")", "{", "BarcodeFormat", "format", "=", "result", ".", "getBarcodeFormat", "(", ")", ";", "if", "(", "!", "(", "format", "==", "BarcodeFormat", ".", "UPC_A", "||", "format"...
Treat all UPC and EAN variants as UPCs, in the sense that they are all product barcodes.
[ "Treat", "all", "UPC", "and", "EAN", "variants", "as", "UPCs", "in", "the", "sense", "that", "they", "are", "all", "product", "barcodes", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/client/result/ProductResultParser.java#L31-L53
125,338
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/encoder/PDF417.java
PDF417.determineDimensions
private int[] determineDimensions(int sourceCodeWords, int errorCorrectionCodeWords) throws WriterException { float ratio = 0.0f; int[] dimension = null; for (int cols = minCols; cols <= maxCols; cols++) { int rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols); if (...
java
private int[] determineDimensions(int sourceCodeWords, int errorCorrectionCodeWords) throws WriterException { float ratio = 0.0f; int[] dimension = null; for (int cols = minCols; cols <= maxCols; cols++) { int rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols); if (...
[ "private", "int", "[", "]", "determineDimensions", "(", "int", "sourceCodeWords", ",", "int", "errorCorrectionCodeWords", ")", "throws", "WriterException", "{", "float", "ratio", "=", "0.0f", ";", "int", "[", "]", "dimension", "=", "null", ";", "for", "(", "...
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
[ "Determine", "optimal", "nr", "of", "columns", "and", "rows", "for", "the", "specified", "number", "of", "codewords", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/encoder/PDF417.java#L689-L729
125,339
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/decoder/QRCodeDecoderMetaData.java
QRCodeDecoderMetaData.applyMirroredCorrection
public void applyMirroredCorrection(ResultPoint[] points) { if (!mirrored || points == null || points.length < 3) { return; } ResultPoint bottomLeft = points[0]; points[0] = points[2]; points[2] = bottomLeft; // No need to 'fix' top-left and alignment pattern. }
java
public void applyMirroredCorrection(ResultPoint[] points) { if (!mirrored || points == null || points.length < 3) { return; } ResultPoint bottomLeft = points[0]; points[0] = points[2]; points[2] = bottomLeft; // No need to 'fix' top-left and alignment pattern. }
[ "public", "void", "applyMirroredCorrection", "(", "ResultPoint", "[", "]", "points", ")", "{", "if", "(", "!", "mirrored", "||", "points", "==", "null", "||", "points", ".", "length", "<", "3", ")", "{", "return", ";", "}", "ResultPoint", "bottomLeft", "...
Apply the result points' order correction due to mirroring. @param points Array of points to apply mirror correction to.
[ "Apply", "the", "result", "points", "order", "correction", "due", "to", "mirroring", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/decoder/QRCodeDecoderMetaData.java#L47-L55
125,340
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/decoder/BarcodeValue.java
BarcodeValue.setValue
void setValue(int value) { Integer confidence = values.get(value); if (confidence == null) { confidence = 0; } confidence++; values.put(value, confidence); }
java
void setValue(int value) { Integer confidence = values.get(value); if (confidence == null) { confidence = 0; } confidence++; values.put(value, confidence); }
[ "void", "setValue", "(", "int", "value", ")", "{", "Integer", "confidence", "=", "values", ".", "get", "(", "value", ")", ";", "if", "(", "confidence", "==", "null", ")", "{", "confidence", "=", "0", ";", "}", "confidence", "++", ";", "values", ".", ...
Add an occurrence of a value
[ "Add", "an", "occurrence", "of", "a", "value" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/decoder/BarcodeValue.java#L36-L43
125,341
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/decoder/BarcodeValue.java
BarcodeValue.getValue
int[] getValue() { int maxConfidence = -1; Collection<Integer> result = new ArrayList<>(); for (Entry<Integer,Integer> entry : values.entrySet()) { if (entry.getValue() > maxConfidence) { maxConfidence = entry.getValue(); result.clear(); result.add(entry.getKey()); } else...
java
int[] getValue() { int maxConfidence = -1; Collection<Integer> result = new ArrayList<>(); for (Entry<Integer,Integer> entry : values.entrySet()) { if (entry.getValue() > maxConfidence) { maxConfidence = entry.getValue(); result.clear(); result.add(entry.getKey()); } else...
[ "int", "[", "]", "getValue", "(", ")", "{", "int", "maxConfidence", "=", "-", "1", ";", "Collection", "<", "Integer", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Entry", "<", "Integer", ",", "Integer", ">", "entry", ":...
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
[ "Determines", "the", "maximum", "occurrence", "of", "a", "set", "value", "and", "returns", "all", "values", "which", "were", "set", "with", "this", "occurrence", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/decoder/BarcodeValue.java#L49-L62
125,342
zxing/zxing
core/src/main/java/com/google/zxing/aztec/encoder/HighLevelEncoder.java
HighLevelEncoder.updateStateListForChar
private Collection<State> updateStateListForChar(Iterable<State> states, int index) { Collection<State> result = new LinkedList<>(); for (State state : states) { updateStateForChar(state, index, result); } return simplifyStates(result); }
java
private Collection<State> updateStateListForChar(Iterable<State> states, int index) { Collection<State> result = new LinkedList<>(); for (State state : states) { updateStateForChar(state, index, result); } return simplifyStates(result); }
[ "private", "Collection", "<", "State", ">", "updateStateListForChar", "(", "Iterable", "<", "State", ">", "states", ",", "int", "index", ")", "{", "Collection", "<", "State", ">", "result", "=", "new", "LinkedList", "<>", "(", ")", ";", "for", "(", "Stat...
non-optimal states.
[ "non", "-", "optimal", "states", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/encoder/HighLevelEncoder.java#L204-L210
125,343
zxing/zxing
core/src/main/java/com/google/zxing/aztec/encoder/HighLevelEncoder.java
HighLevelEncoder.updateStateForChar
private void updateStateForChar(State state, int index, Collection<State> result) { char ch = (char) (text[index] & 0xFF); boolean charInCurrentTable = CHAR_MAP[state.getMode()][ch] > 0; State stateNoBinary = null; for (int mode = 0; mode <= MODE_PUNCT; mode++) { int charInMode = CHAR_MAP[mode][ch...
java
private void updateStateForChar(State state, int index, Collection<State> result) { char ch = (char) (text[index] & 0xFF); boolean charInCurrentTable = CHAR_MAP[state.getMode()][ch] > 0; State stateNoBinary = null; for (int mode = 0; mode <= MODE_PUNCT; mode++) { int charInMode = CHAR_MAP[mode][ch...
[ "private", "void", "updateStateForChar", "(", "State", "state", ",", "int", "index", ",", "Collection", "<", "State", ">", "result", ")", "{", "char", "ch", "=", "(", "char", ")", "(", "text", "[", "index", "]", "&", "0xFF", ")", ";", "boolean", "cha...
the "result" list.
[ "the", "result", "list", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/encoder/HighLevelEncoder.java#L215-L251
125,344
zxing/zxing
android/src/com/google/zxing/client/android/result/TelResultHandler.java
TelResultHandler.getDisplayContents
@Override public CharSequence getDisplayContents() { String contents = getResult().getDisplayResult(); contents = contents.replace("\r", ""); return formatPhone(contents); }
java
@Override public CharSequence getDisplayContents() { String contents = getResult().getDisplayResult(); contents = contents.replace("\r", ""); return formatPhone(contents); }
[ "@", "Override", "public", "CharSequence", "getDisplayContents", "(", ")", "{", "String", "contents", "=", "getResult", "(", ")", ".", "getDisplayResult", "(", ")", ";", "contents", "=", "contents", ".", "replace", "(", "\"\\r\"", ",", "\"\"", ")", ";", "r...
Overriden so we can take advantage of Android's phone number hyphenation routines.
[ "Overriden", "so", "we", "can", "take", "advantage", "of", "Android", "s", "phone", "number", "hyphenation", "routines", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/result/TelResultHandler.java#L70-L75
125,345
zxing/zxing
android/src/com/google/zxing/client/android/CaptureActivity.java
CaptureActivity.drawResultPoints
private void drawResultPoints(Bitmap barcode, float scaleFactor, Result rawResult) { ResultPoint[] points = rawResult.getResultPoints(); if (points != null && points.length > 0) { Canvas canvas = new Canvas(barcode); Paint paint = new Paint(); paint.setColor(getResources().getColor(R.color.res...
java
private void drawResultPoints(Bitmap barcode, float scaleFactor, Result rawResult) { ResultPoint[] points = rawResult.getResultPoints(); if (points != null && points.length > 0) { Canvas canvas = new Canvas(barcode); Paint paint = new Paint(); paint.setColor(getResources().getColor(R.color.res...
[ "private", "void", "drawResultPoints", "(", "Bitmap", "barcode", ",", "float", "scaleFactor", ",", "Result", "rawResult", ")", "{", "ResultPoint", "[", "]", "points", "=", "rawResult", ".", "getResultPoints", "(", ")", ";", "if", "(", "points", "!=", "null",...
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 decoded results which contains the points to draw.
[ "Superimpose", "a", "line", "for", "1D", "or", "dots", "for", "2D", "to", "highlight", "the", "key", "features", "of", "the", "barcode", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/CaptureActivity.java#L491-L515
125,346
zxing/zxing
core/src/main/java/com/google/zxing/common/detector/WhiteRectangleDetector.java
WhiteRectangleDetector.centerEdges
private ResultPoint[] centerEdges(ResultPoint y, ResultPoint z, ResultPoint x, ResultPoint t) { // // t t // z x // x OR z // y y // float yi = y.getX(); float yj = y.getY(); ...
java
private ResultPoint[] centerEdges(ResultPoint y, ResultPoint z, ResultPoint x, ResultPoint t) { // // t t // z x // x OR z // y y // float yi = y.getX(); float yj = y.getY(); ...
[ "private", "ResultPoint", "[", "]", "centerEdges", "(", "ResultPoint", "y", ",", "ResultPoint", "z", ",", "ResultPoint", "x", ",", "ResultPoint", "t", ")", "{", "//", "// t t", "// z x", "// x OR z", "// y ...
recenters the points of a constant distance towards the center @param y bottom most point @param z left most point @param x right most point @param t top most point @return {@link ResultPoint}[] describing the corners of the rectangular region. The first and last points are opposed on the diagonal, as are the second a...
[ "recenters", "the", "points", "of", "a", "constant", "distance", "towards", "the", "center" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/detector/WhiteRectangleDetector.java#L263-L295
125,347
zxing/zxing
core/src/main/java/com/google/zxing/common/detector/WhiteRectangleDetector.java
WhiteRectangleDetector.containsBlackPoint
private boolean containsBlackPoint(int a, int b, int fixed, boolean horizontal) { if (horizontal) { for (int x = a; x <= b; x++) { if (image.get(x, fixed)) { return true; } } } else { for (int y = a; y <= b; y++) { if (image.get(fixed, y)) { return ...
java
private boolean containsBlackPoint(int a, int b, int fixed, boolean horizontal) { if (horizontal) { for (int x = a; x <= b; x++) { if (image.get(x, fixed)) { return true; } } } else { for (int y = a; y <= b; y++) { if (image.get(fixed, y)) { return ...
[ "private", "boolean", "containsBlackPoint", "(", "int", "a", ",", "int", "b", ",", "int", "fixed", ",", "boolean", "horizontal", ")", "{", "if", "(", "horizontal", ")", "{", "for", "(", "int", "x", "=", "a", ";", "x", "<=", "b", ";", "x", "++", "...
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 black point has been ...
[ "Determines", "whether", "a", "segment", "contains", "a", "black", "point" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/detector/WhiteRectangleDetector.java#L306-L323
125,348
zxing/zxing
android/src/com/google/zxing/client/android/result/CalendarResultHandler.java
CalendarResultHandler.addCalendarEvent
private void addCalendarEvent(String summary, long start, boolean allDay, long end, String location, String description, String[...
java
private void addCalendarEvent(String summary, long start, boolean allDay, long end, String location, String description, String[...
[ "private", "void", "addCalendarEvent", "(", "String", "summary", ",", "long", "start", ",", "boolean", "allDay", ",", "long", "end", ",", "String", "location", ",", "String", "description", ",", "String", "[", "]", "attendees", ")", "{", "Intent", "intent", ...
Sends an intent to create a new calendar event by prepopulating the Add Event UI. Older versions of the system have a bug where the event title will not be filled out. @param summary A description of the event @param start The start time @param allDay if true, event is considered to be all day starting from start t...
[ "Sends", "an", "intent", "to", "create", "a", "new", "calendar", "event", "by", "prepopulating", "the", "Add", "Event", "UI", ".", "Older", "versions", "of", "the", "system", "have", "a", "bug", "where", "the", "event", "title", "will", "not", "be", "fil...
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/result/CalendarResultHandler.java#L95-L134
125,349
zxing/zxing
core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java
Decoder.getEncodedData
private static String getEncodedData(boolean[] correctedBits) { int endIndex = correctedBits.length; Table latchTable = Table.UPPER; // table most recently latched to Table shiftTable = Table.UPPER; // table to use for the next read StringBuilder result = new StringBuilder(20); int index = 0; wh...
java
private static String getEncodedData(boolean[] correctedBits) { int endIndex = correctedBits.length; Table latchTable = Table.UPPER; // table most recently latched to Table shiftTable = Table.UPPER; // table to use for the next read StringBuilder result = new StringBuilder(20); int index = 0; wh...
[ "private", "static", "String", "getEncodedData", "(", "boolean", "[", "]", "correctedBits", ")", "{", "int", "endIndex", "=", "correctedBits", ".", "length", ";", "Table", "latchTable", "=", "Table", ".", "UPPER", ";", "// table most recently latched to", "Table",...
Gets the string encoded in the aztec code bits @return the decoded string
[ "Gets", "the", "string", "encoded", "in", "the", "aztec", "code", "bits" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java#L95-L152
125,350
zxing/zxing
core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java
Decoder.getTable
private static Table getTable(char t) { switch (t) { case 'L': return Table.LOWER; case 'P': return Table.PUNCT; case 'M': return Table.MIXED; case 'D': return Table.DIGIT; case 'B': return Table.BINARY; case 'U': default: ret...
java
private static Table getTable(char t) { switch (t) { case 'L': return Table.LOWER; case 'P': return Table.PUNCT; case 'M': return Table.MIXED; case 'D': return Table.DIGIT; case 'B': return Table.BINARY; case 'U': default: ret...
[ "private", "static", "Table", "getTable", "(", "char", "t", ")", "{", "switch", "(", "t", ")", "{", "case", "'", "'", ":", "return", "Table", ".", "LOWER", ";", "case", "'", "'", ":", "return", "Table", ".", "PUNCT", ";", "case", "'", "'", ":", ...
gets the table corresponding to the char passed
[ "gets", "the", "table", "corresponding", "to", "the", "char", "passed" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java#L157-L173
125,351
zxing/zxing
core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java
Decoder.extractBits
private boolean[] extractBits(BitMatrix matrix) { boolean compact = ddata.isCompact(); int layers = ddata.getNbLayers(); int baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines int[] alignmentMap = new int[baseMatrixSize]; boolean[] rawbits = new boolean[totalBitsInLa...
java
private boolean[] extractBits(BitMatrix matrix) { boolean compact = ddata.isCompact(); int layers = ddata.getNbLayers(); int baseMatrixSize = (compact ? 11 : 14) + layers * 4; // not including alignment lines int[] alignmentMap = new int[baseMatrixSize]; boolean[] rawbits = new boolean[totalBitsInLa...
[ "private", "boolean", "[", "]", "extractBits", "(", "BitMatrix", "matrix", ")", "{", "boolean", "compact", "=", "ddata", ".", "isCompact", "(", ")", ";", "int", "layers", "=", "ddata", ".", "getNbLayers", "(", ")", ";", "int", "baseMatrixSize", "=", "(",...
Gets the array of bits from an Aztec Code matrix @return the array of bits
[ "Gets", "the", "array", "of", "bits", "from", "an", "Aztec", "Code", "matrix" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java#L277-L325
125,352
zxing/zxing
core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java
Decoder.readCode
private static int readCode(boolean[] rawbits, int startIndex, int length) { int res = 0; for (int i = startIndex; i < startIndex + length; i++) { res <<= 1; if (rawbits[i]) { res |= 0x01; } } return res; }
java
private static int readCode(boolean[] rawbits, int startIndex, int length) { int res = 0; for (int i = startIndex; i < startIndex + length; i++) { res <<= 1; if (rawbits[i]) { res |= 0x01; } } return res; }
[ "private", "static", "int", "readCode", "(", "boolean", "[", "]", "rawbits", ",", "int", "startIndex", ",", "int", "length", ")", "{", "int", "res", "=", "0", ";", "for", "(", "int", "i", "=", "startIndex", ";", "i", "<", "startIndex", "+", "length",...
Reads a code of given length and at given index in an array of bits
[ "Reads", "a", "code", "of", "given", "length", "and", "at", "given", "index", "in", "an", "array", "of", "bits" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java#L330-L339
125,353
zxing/zxing
core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java
Decoder.readByte
private static byte readByte(boolean[] rawbits, int startIndex) { int n = rawbits.length - startIndex; if (n >= 8) { return (byte) readCode(rawbits, startIndex, 8); } return (byte) (readCode(rawbits, startIndex, n) << (8 - n)); }
java
private static byte readByte(boolean[] rawbits, int startIndex) { int n = rawbits.length - startIndex; if (n >= 8) { return (byte) readCode(rawbits, startIndex, 8); } return (byte) (readCode(rawbits, startIndex, n) << (8 - n)); }
[ "private", "static", "byte", "readByte", "(", "boolean", "[", "]", "rawbits", ",", "int", "startIndex", ")", "{", "int", "n", "=", "rawbits", ".", "length", "-", "startIndex", ";", "if", "(", "n", ">=", "8", ")", "{", "return", "(", "byte", ")", "r...
Reads a code of length 8 in an array of bits, padding with zeros
[ "Reads", "a", "code", "of", "length", "8", "in", "an", "array", "of", "bits", "padding", "with", "zeros" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java#L344-L350
125,354
zxing/zxing
core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java
Decoder.convertBoolArrayToByteArray
static byte[] convertBoolArrayToByteArray(boolean[] boolArr) { byte[] byteArr = new byte[(boolArr.length + 7) / 8]; for (int i = 0; i < byteArr.length; i++) { byteArr[i] = readByte(boolArr, 8 * i); } return byteArr; }
java
static byte[] convertBoolArrayToByteArray(boolean[] boolArr) { byte[] byteArr = new byte[(boolArr.length + 7) / 8]; for (int i = 0; i < byteArr.length; i++) { byteArr[i] = readByte(boolArr, 8 * i); } return byteArr; }
[ "static", "byte", "[", "]", "convertBoolArrayToByteArray", "(", "boolean", "[", "]", "boolArr", ")", "{", "byte", "[", "]", "byteArr", "=", "new", "byte", "[", "(", "boolArr", ".", "length", "+", "7", ")", "/", "8", "]", ";", "for", "(", "int", "i"...
Packs a bit array into bytes, most significant bit first
[ "Packs", "a", "bit", "array", "into", "bytes", "most", "significant", "bit", "first" ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java#L355-L361
125,355
zxing/zxing
core/src/main/java/com/google/zxing/oned/UPCEReader.java
UPCEReader.convertUPCEtoUPCA
public static String convertUPCEtoUPCA(String upce) { char[] upceChars = new char[6]; upce.getChars(1, 7, upceChars, 0); StringBuilder result = new StringBuilder(12); result.append(upce.charAt(0)); char lastChar = upceChars[5]; switch (lastChar) { case '0': case '1': case '2': ...
java
public static String convertUPCEtoUPCA(String upce) { char[] upceChars = new char[6]; upce.getChars(1, 7, upceChars, 0); StringBuilder result = new StringBuilder(12); result.append(upce.charAt(0)); char lastChar = upceChars[5]; switch (lastChar) { case '0': case '1': case '2': ...
[ "public", "static", "String", "convertUPCEtoUPCA", "(", "String", "upce", ")", "{", "char", "[", "]", "upceChars", "=", "new", "char", "[", "6", "]", ";", "upce", ".", "getChars", "(", "1", ",", "7", ",", "upceChars", ",", "0", ")", ";", "StringBuild...
Expands a UPC-E value back into its full, equivalent UPC-A code value. @param upce UPC-E code as string of digits @return equivalent UPC-A code as string of digits
[ "Expands", "a", "UPC", "-", "E", "value", "back", "into", "its", "full", "equivalent", "UPC", "-", "A", "code", "value", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/UPCEReader.java#L144-L180
125,356
zxing/zxing
core/src/main/java/com/google/zxing/MultiFormatReader.java
MultiFormatReader.decode
@Override public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException { setHints(hints); return decodeInternal(image); }
java
@Override public Result decode(BinaryBitmap image, Map<DecodeHintType,?> hints) throws NotFoundException { setHints(hints); return decodeInternal(image); }
[ "@", "Override", "public", "Result", "decode", "(", "BinaryBitmap", "image", ",", "Map", "<", "DecodeHintType", ",", "?", ">", "hints", ")", "throws", "NotFoundException", "{", "setHints", "(", "hints", ")", ";", "return", "decodeInternal", "(", "image", ")"...
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
[ "Decode", "an", "image", "using", "the", "hints", "provided", ".", "Does", "not", "honor", "existing", "state", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/MultiFormatReader.java#L68-L72
125,357
zxing/zxing
core/src/main/java/com/google/zxing/datamatrix/encoder/DefaultPlacement.java
DefaultPlacement.utah
private void utah(int row, int col, int pos) { module(row - 2, col - 2, pos, 1); module(row - 2, col - 1, pos, 2); module(row - 1, col - 2, pos, 3); module(row - 1, col - 1, pos, 4); module(row - 1, col, pos, 5); module(row, col - 2, pos, 6); module(row, col - 1, pos, 7); module(row, col...
java
private void utah(int row, int col, int pos) { module(row - 2, col - 2, pos, 1); module(row - 2, col - 1, pos, 2); module(row - 1, col - 2, pos, 3); module(row - 1, col - 1, pos, 4); module(row - 1, col, pos, 5); module(row, col - 2, pos, 6); module(row, col - 1, pos, 7); module(row, col...
[ "private", "void", "utah", "(", "int", "row", ",", "int", "col", ",", "int", "pos", ")", "{", "module", "(", "row", "-", "2", ",", "col", "-", "2", ",", "pos", ",", "1", ")", ";", "module", "(", "row", "-", "2", ",", "col", "-", "1", ",", ...
Places the 8 bits of a utah-shaped symbol character in ECC200. @param row the row @param col the column @param pos character position
[ "Places", "the", "8", "bits", "of", "a", "utah", "-", "shaped", "symbol", "character", "in", "ECC200", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/datamatrix/encoder/DefaultPlacement.java#L143-L152
125,358
zxing/zxing
core/src/main/java/com/google/zxing/client/result/URIParsedResult.java
URIParsedResult.massageURI
private static String massageURI(String uri) { uri = uri.trim(); int protocolEnd = uri.indexOf(':'); if (protocolEnd < 0 || isColonFollowedByPortNumber(uri, protocolEnd)) { // No protocol, or found a colon, but it looks like it is after the host, so the protocol is still missing, // so assume ht...
java
private static String massageURI(String uri) { uri = uri.trim(); int protocolEnd = uri.indexOf(':'); if (protocolEnd < 0 || isColonFollowedByPortNumber(uri, protocolEnd)) { // No protocol, or found a colon, but it looks like it is after the host, so the protocol is still missing, // so assume ht...
[ "private", "static", "String", "massageURI", "(", "String", "uri", ")", "{", "uri", "=", "uri", ".", "trim", "(", ")", ";", "int", "protocolEnd", "=", "uri", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "protocolEnd", "<", "0", "||", "isColo...
Transforms a string that represents a URI into something more proper, by adding or canonicalizing the protocol.
[ "Transforms", "a", "string", "that", "represents", "a", "URI", "into", "something", "more", "proper", "by", "adding", "or", "canonicalizing", "the", "protocol", "." ]
653ac2a3beb11481eff82e7d5f2bab8a745f7fac
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/client/result/URIParsedResult.java#L65-L74
125,359
jenkinsci/jenkins
core/src/main/java/jenkins/model/SimplePageDecorator.java
SimplePageDecorator.first
public static SimplePageDecorator first(){ List<SimplePageDecorator> decorators = all(); return decorators.isEmpty() ? null : decorators.get(0); }
java
public static SimplePageDecorator first(){ List<SimplePageDecorator> decorators = all(); return decorators.isEmpty() ? null : decorators.get(0); }
[ "public", "static", "SimplePageDecorator", "first", "(", ")", "{", "List", "<", "SimplePageDecorator", ">", "decorators", "=", "all", "(", ")", ";", "return", "decorators", ".", "isEmpty", "(", ")", "?", "null", ":", "decorators", ".", "get", "(", "0", "...
The first found LoginDecarator, there can only be one. @return the first found {@link SimplePageDecorator}
[ "The", "first", "found", "LoginDecarator", "there", "can", "only", "be", "one", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/SimplePageDecorator.java#L73-L76
125,360
jenkinsci/jenkins
core/src/main/java/hudson/node_monitors/AbstractNodeMonitorDescriptor.java
AbstractNodeMonitorDescriptor.monitor
protected Map<Computer,T> monitor() throws InterruptedException { Map<Computer,T> data = new HashMap<>(); for( Computer c : Jenkins.getInstance().getComputers() ) { try { Thread.currentThread().setName("Monitoring "+c.getDisplayName()+" for "+getDisplayName()); ...
java
protected Map<Computer,T> monitor() throws InterruptedException { Map<Computer,T> data = new HashMap<>(); for( Computer c : Jenkins.getInstance().getComputers() ) { try { Thread.currentThread().setName("Monitoring "+c.getDisplayName()+" for "+getDisplayName()); ...
[ "protected", "Map", "<", "Computer", ",", "T", ">", "monitor", "(", ")", "throws", "InterruptedException", "{", "Map", "<", "Computer", ",", "T", ">", "data", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "Computer", "c", ":", "Jenkins", "....
Performs monitoring across the board. @return For all the computers, report the monitored values.
[ "Performs", "monitoring", "across", "the", "board", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/node_monitors/AbstractNodeMonitorDescriptor.java#L142-L159
125,361
jenkinsci/jenkins
core/src/main/java/hudson/node_monitors/AbstractNodeMonitorDescriptor.java
AbstractNodeMonitorDescriptor.get
public T get(Computer c) { if(record==null || !record.data.containsKey(c)) { // if we don't have the data, schedule the check now triggerUpdate(); return null; } return record.data.get(c); }
java
public T get(Computer c) { if(record==null || !record.data.containsKey(c)) { // if we don't have the data, schedule the check now triggerUpdate(); return null; } return record.data.get(c); }
[ "public", "T", "get", "(", "Computer", "c", ")", "{", "if", "(", "record", "==", "null", "||", "!", "record", ".", "data", ".", "containsKey", "(", "c", ")", ")", "{", "// if we don't have the data, schedule the check now", "triggerUpdate", "(", ")", ";", ...
Obtains the monitoring result currently available, or null if no data is available. <p> If no data is available, a background task to collect data will be started.
[ "Obtains", "the", "monitoring", "result", "currently", "available", "or", "null", "if", "no", "data", "is", "available", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/node_monitors/AbstractNodeMonitorDescriptor.java#L167-L174
125,362
jenkinsci/jenkins
core/src/main/java/hudson/node_monitors/AbstractNodeMonitorDescriptor.java
AbstractNodeMonitorDescriptor.isIgnored
public boolean isIgnored() { NodeMonitor m = ComputerSet.getMonitors().get(this); return m==null || m.isIgnored(); }
java
public boolean isIgnored() { NodeMonitor m = ComputerSet.getMonitors().get(this); return m==null || m.isIgnored(); }
[ "public", "boolean", "isIgnored", "(", ")", "{", "NodeMonitor", "m", "=", "ComputerSet", ".", "getMonitors", "(", ")", ".", "get", "(", "this", ")", ";", "return", "m", "==", "null", "||", "m", ".", "isIgnored", "(", ")", ";", "}" ]
Is this monitor currently ignored?
[ "Is", "this", "monitor", "currently", "ignored?" ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/node_monitors/AbstractNodeMonitorDescriptor.java#L201-L204
125,363
jenkinsci/jenkins
core/src/main/java/hudson/node_monitors/AbstractNodeMonitorDescriptor.java
AbstractNodeMonitorDescriptor.markOnline
protected boolean markOnline(Computer c) { if(isIgnored() || c.isOnline()) return false; // noop c.setTemporarilyOffline(false,null); return true; }
java
protected boolean markOnline(Computer c) { if(isIgnored() || c.isOnline()) return false; // noop c.setTemporarilyOffline(false,null); return true; }
[ "protected", "boolean", "markOnline", "(", "Computer", "c", ")", "{", "if", "(", "isIgnored", "(", ")", "||", "c", ".", "isOnline", "(", ")", ")", "return", "false", ";", "// noop", "c", ".", "setTemporarilyOffline", "(", "false", ",", "null", ")", ";"...
Utility method to mark the computer online for derived classes. @return true if the node was actually taken online by this act (as opposed to us deciding not to do it, or the computer was already online.)
[ "Utility", "method", "to", "mark", "the", "computer", "online", "for", "derived", "classes", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/node_monitors/AbstractNodeMonitorDescriptor.java#L213-L217
125,364
jenkinsci/jenkins
core/src/main/java/hudson/node_monitors/AbstractNodeMonitorDescriptor.java
AbstractNodeMonitorDescriptor.markOffline
protected boolean markOffline(Computer c, OfflineCause oc) { if(isIgnored() || c.isTemporarilyOffline()) return false; // noop c.setTemporarilyOffline(true, oc); // notify the admin MonitorMarkedNodeOffline no = AdministrativeMonitor.all().get(MonitorMarkedNodeOffline.class); i...
java
protected boolean markOffline(Computer c, OfflineCause oc) { if(isIgnored() || c.isTemporarilyOffline()) return false; // noop c.setTemporarilyOffline(true, oc); // notify the admin MonitorMarkedNodeOffline no = AdministrativeMonitor.all().get(MonitorMarkedNodeOffline.class); i...
[ "protected", "boolean", "markOffline", "(", "Computer", "c", ",", "OfflineCause", "oc", ")", "{", "if", "(", "isIgnored", "(", ")", "||", "c", ".", "isTemporarilyOffline", "(", ")", ")", "return", "false", ";", "// noop", "c", ".", "setTemporarilyOffline", ...
Utility method to mark the computer offline for derived classes. @return true if the node was actually taken offline by this act (as opposed to us deciding not to do it, or the computer already marked offline.)
[ "Utility", "method", "to", "mark", "the", "computer", "offline", "for", "derived", "classes", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/node_monitors/AbstractNodeMonitorDescriptor.java#L226-L236
125,365
jenkinsci/jenkins
core/src/main/java/hudson/security/csrf/CrumbIssuer.java
CrumbIssuer.getCrumb
public String getCrumb(ServletRequest request) { String crumb = null; if (request != null) { crumb = (String) request.getAttribute(CRUMB_ATTRIBUTE); } if (crumb == null) { crumb = issueCrumb(request, getDescriptor().getCrumbSalt()); if (request != null...
java
public String getCrumb(ServletRequest request) { String crumb = null; if (request != null) { crumb = (String) request.getAttribute(CRUMB_ATTRIBUTE); } if (crumb == null) { crumb = issueCrumb(request, getDescriptor().getCrumbSalt()); if (request != null...
[ "public", "String", "getCrumb", "(", "ServletRequest", "request", ")", "{", "String", "crumb", "=", "null", ";", "if", "(", "request", "!=", "null", ")", "{", "crumb", "=", "(", "String", ")", "request", ".", "getAttribute", "(", "CRUMB_ATTRIBUTE", ")", ...
Get a crumb value based on user specific information in the request. @param request
[ "Get", "a", "crumb", "value", "based", "on", "user", "specific", "information", "in", "the", "request", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/csrf/CrumbIssuer.java#L75-L92
125,366
jenkinsci/jenkins
core/src/main/java/hudson/security/csrf/CrumbIssuer.java
CrumbIssuer.validateCrumb
public boolean validateCrumb(ServletRequest request) { CrumbIssuerDescriptor<CrumbIssuer> desc = getDescriptor(); String crumbField = desc.getCrumbRequestField(); String crumbSalt = desc.getCrumbSalt(); return validateCrumb(request, crumbSalt, request.getParameter(crumbField)); }
java
public boolean validateCrumb(ServletRequest request) { CrumbIssuerDescriptor<CrumbIssuer> desc = getDescriptor(); String crumbField = desc.getCrumbRequestField(); String crumbSalt = desc.getCrumbSalt(); return validateCrumb(request, crumbSalt, request.getParameter(crumbField)); }
[ "public", "boolean", "validateCrumb", "(", "ServletRequest", "request", ")", "{", "CrumbIssuerDescriptor", "<", "CrumbIssuer", ">", "desc", "=", "getDescriptor", "(", ")", ";", "String", "crumbField", "=", "desc", ".", "getCrumbRequestField", "(", ")", ";", "Str...
Get a crumb from a request parameter and validate it against other data in the current request. The salt and request parameter that is used is defined by the current configuration. @param request
[ "Get", "a", "crumb", "from", "a", "request", "parameter", "and", "validate", "it", "against", "other", "data", "in", "the", "current", "request", ".", "The", "salt", "and", "request", "parameter", "that", "is", "used", "is", "defined", "by", "the", "curren...
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/csrf/CrumbIssuer.java#L115-L121
125,367
jenkinsci/jenkins
core/src/main/java/hudson/security/csrf/CrumbIssuer.java
CrumbIssuer.validateCrumb
public boolean validateCrumb(ServletRequest request, MultipartFormDataParser parser) { CrumbIssuerDescriptor<CrumbIssuer> desc = getDescriptor(); String crumbField = desc.getCrumbRequestField(); String crumbSalt = desc.getCrumbSalt(); return validateCrumb(request, crumbSalt, parser.get(...
java
public boolean validateCrumb(ServletRequest request, MultipartFormDataParser parser) { CrumbIssuerDescriptor<CrumbIssuer> desc = getDescriptor(); String crumbField = desc.getCrumbRequestField(); String crumbSalt = desc.getCrumbSalt(); return validateCrumb(request, crumbSalt, parser.get(...
[ "public", "boolean", "validateCrumb", "(", "ServletRequest", "request", ",", "MultipartFormDataParser", "parser", ")", "{", "CrumbIssuerDescriptor", "<", "CrumbIssuer", ">", "desc", "=", "getDescriptor", "(", ")", ";", "String", "crumbField", "=", "desc", ".", "ge...
Get a crumb from multipart form data and validate it against other data in the current request. The salt and request parameter that is used is defined by the current configuration. @param request @param parser
[ "Get", "a", "crumb", "from", "multipart", "form", "data", "and", "validate", "it", "against", "other", "data", "in", "the", "current", "request", ".", "The", "salt", "and", "request", "parameter", "that", "is", "used", "is", "defined", "by", "the", "curren...
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/csrf/CrumbIssuer.java#L131-L137
125,368
jenkinsci/jenkins
core/src/main/java/hudson/security/csrf/CrumbIssuer.java
CrumbIssuer.initStaplerCrumbIssuer
@Initializer public static void initStaplerCrumbIssuer() { WebApp.get(Jenkins.getInstance().servletContext).setCrumbIssuer(new org.kohsuke.stapler.CrumbIssuer() { @Override public String issueCrumb(StaplerRequest request) { CrumbIssuer ci = Jenkins.getInstance().getCr...
java
@Initializer public static void initStaplerCrumbIssuer() { WebApp.get(Jenkins.getInstance().servletContext).setCrumbIssuer(new org.kohsuke.stapler.CrumbIssuer() { @Override public String issueCrumb(StaplerRequest request) { CrumbIssuer ci = Jenkins.getInstance().getCr...
[ "@", "Initializer", "public", "static", "void", "initStaplerCrumbIssuer", "(", ")", "{", "WebApp", ".", "get", "(", "Jenkins", ".", "getInstance", "(", ")", ".", "servletContext", ")", ".", "setCrumbIssuer", "(", "new", "org", ".", "kohsuke", ".", "stapler",...
Sets up Stapler to use our crumb issuer.
[ "Sets", "up", "Stapler", "to", "use", "our", "crumb", "issuer", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/csrf/CrumbIssuer.java#L169-L189
125,369
jenkinsci/jenkins
core/src/main/java/jenkins/model/identity/IdentityRootAction.java
IdentityRootAction.getPublicKey
public String getPublicKey() { RSAPublicKey key = InstanceIdentityProvider.RSA.getPublicKey(); if (key == null) { return null; } byte[] encoded = Base64.encodeBase64(key.getEncoded()); int index = 0; StringBuilder buf = new StringBuilder(encoded.length + 20); ...
java
public String getPublicKey() { RSAPublicKey key = InstanceIdentityProvider.RSA.getPublicKey(); if (key == null) { return null; } byte[] encoded = Base64.encodeBase64(key.getEncoded()); int index = 0; StringBuilder buf = new StringBuilder(encoded.length + 20); ...
[ "public", "String", "getPublicKey", "(", ")", "{", "RSAPublicKey", "key", "=", "InstanceIdentityProvider", ".", "RSA", ".", "getPublicKey", "(", ")", ";", "if", "(", "key", "==", "null", ")", "{", "return", "null", ";", "}", "byte", "[", "]", "encoded", ...
Returns the PEM encoded public key. @return the PEM encoded public key.
[ "Returns", "the", "PEM", "encoded", "public", "key", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/identity/IdentityRootAction.java#L49-L66
125,370
jenkinsci/jenkins
core/src/main/java/jenkins/model/identity/IdentityRootAction.java
IdentityRootAction.getFingerprint
public String getFingerprint() { RSAPublicKey key = InstanceIdentityProvider.RSA.getPublicKey(); if (key == null) { return null; } // TODO replace with org.jenkinsci.remoting.util.KeyUtils once JENKINS-36871 changes are merged try { MessageDigest digest = ...
java
public String getFingerprint() { RSAPublicKey key = InstanceIdentityProvider.RSA.getPublicKey(); if (key == null) { return null; } // TODO replace with org.jenkinsci.remoting.util.KeyUtils once JENKINS-36871 changes are merged try { MessageDigest digest = ...
[ "public", "String", "getFingerprint", "(", ")", "{", "RSAPublicKey", "key", "=", "InstanceIdentityProvider", ".", "RSA", ".", "getPublicKey", "(", ")", ";", "if", "(", "key", "==", "null", ")", "{", "return", "null", ";", "}", "// TODO replace with org.jenkins...
Returns the fingerprint of the public key. @return the fingerprint of the public key.
[ "Returns", "the", "fingerprint", "of", "the", "public", "key", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/identity/IdentityRootAction.java#L73-L95
125,371
jenkinsci/jenkins
core/src/main/java/hudson/model/Api.java
Api.doJson
public void doJson(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { if (req.getParameter("jsonp") == null || permit(req)) { setHeaders(rsp); rsp.serveExposedBean(req,bean, req.getParameter("jsonp") == null ? Flavor.JSON : Flavor.JSONP); } else { ...
java
public void doJson(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { if (req.getParameter("jsonp") == null || permit(req)) { setHeaders(rsp); rsp.serveExposedBean(req,bean, req.getParameter("jsonp") == null ? Flavor.JSON : Flavor.JSONP); } else { ...
[ "public", "void", "doJson", "(", "StaplerRequest", "req", ",", "StaplerResponse", "rsp", ")", "throws", "IOException", ",", "ServletException", "{", "if", "(", "req", ".", "getParameter", "(", "\"jsonp\"", ")", "==", "null", "||", "permit", "(", "req", ")", ...
Exposes the bean as JSON.
[ "Exposes", "the", "bean", "as", "JSON", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Api.java#L220-L227
125,372
jenkinsci/jenkins
core/src/main/java/hudson/model/Api.java
Api.doPython
public void doPython(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { setHeaders(rsp); rsp.serveExposedBean(req,bean, Flavor.PYTHON); }
java
public void doPython(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { setHeaders(rsp); rsp.serveExposedBean(req,bean, Flavor.PYTHON); }
[ "public", "void", "doPython", "(", "StaplerRequest", "req", ",", "StaplerResponse", "rsp", ")", "throws", "IOException", ",", "ServletException", "{", "setHeaders", "(", "rsp", ")", ";", "rsp", ".", "serveExposedBean", "(", "req", ",", "bean", ",", "Flavor", ...
Exposes the bean as Python literal.
[ "Exposes", "the", "bean", "as", "Python", "literal", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Api.java#L232-L235
125,373
jenkinsci/jenkins
core/src/main/java/jenkins/model/ParameterizedJobMixIn.java
ParameterizedJobMixIn.getBuildCause
@Restricted(NoExternalUse.class) public static CauseAction getBuildCause(ParameterizedJob job, StaplerRequest req) { Cause cause; @SuppressWarnings("deprecation") hudson.model.BuildAuthorizationToken authToken = job.getAuthToken(); if (authToken != null && authToken.getToken() != nul...
java
@Restricted(NoExternalUse.class) public static CauseAction getBuildCause(ParameterizedJob job, StaplerRequest req) { Cause cause; @SuppressWarnings("deprecation") hudson.model.BuildAuthorizationToken authToken = job.getAuthToken(); if (authToken != null && authToken.getToken() != nul...
[ "@", "Restricted", "(", "NoExternalUse", ".", "class", ")", "public", "static", "CauseAction", "getBuildCause", "(", "ParameterizedJob", "job", ",", "StaplerRequest", "req", ")", "{", "Cause", "cause", ";", "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "...
Computes the build cause, using RemoteCause or UserCause as appropriate.
[ "Computes", "the", "build", "cause", "using", "RemoteCause", "or", "UserCause", "as", "appropriate", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java#L268-L281
125,374
jenkinsci/jenkins
core/src/main/java/jenkins/model/ParameterizedJobMixIn.java
ParameterizedJobMixIn.getTrigger
public static @CheckForNull <T extends Trigger<?>> T getTrigger(Job<?,?> job, Class<T> clazz) { if (!(job instanceof ParameterizedJob)) { return null; } for (Trigger<?> t : ((ParameterizedJob<?, ?>) job).getTriggers().values()) { if (clazz.isInstance(t)) { ...
java
public static @CheckForNull <T extends Trigger<?>> T getTrigger(Job<?,?> job, Class<T> clazz) { if (!(job instanceof ParameterizedJob)) { return null; } for (Trigger<?> t : ((ParameterizedJob<?, ?>) job).getTriggers().values()) { if (clazz.isInstance(t)) { ...
[ "public", "static", "@", "CheckForNull", "<", "T", "extends", "Trigger", "<", "?", ">", ">", "T", "getTrigger", "(", "Job", "<", "?", ",", "?", ">", "job", ",", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "!", "(", "job", "instanceof", ...
Checks for the existence of a specific trigger on a job. @param <T> a trigger type @param job a job @param clazz the type of the trigger @return a configured trigger of the requested type, or null if there is none such, or {@code job} is not a {@link ParameterizedJob} @since 1.621
[ "Checks", "for", "the", "existence", "of", "a", "specific", "trigger", "on", "a", "job", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java#L306-L316
125,375
jenkinsci/jenkins
core/src/main/java/jenkins/security/HexStringConfidentialKey.java
HexStringConfidentialKey.get
public synchronized String get() { ConfidentialStore cs = ConfidentialStore.get(); if (secret == null || cs != lastCS) { lastCS = cs; try { byte[] payload = load(); if (payload == null) { payload = cs.randomBytes(length / 2); ...
java
public synchronized String get() { ConfidentialStore cs = ConfidentialStore.get(); if (secret == null || cs != lastCS) { lastCS = cs; try { byte[] payload = load(); if (payload == null) { payload = cs.randomBytes(length / 2); ...
[ "public", "synchronized", "String", "get", "(", ")", "{", "ConfidentialStore", "cs", "=", "ConfidentialStore", ".", "get", "(", ")", ";", "if", "(", "secret", "==", "null", "||", "cs", "!=", "lastCS", ")", "{", "lastCS", "=", "cs", ";", "try", "{", "...
Returns the persisted hex string value. If the value isn't persisted, a new random value is created. @throws Error If the secret fails to load. Not throwing a checked exception is for the convenience of the caller.
[ "Returns", "the", "persisted", "hex", "string", "value", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/security/HexStringConfidentialKey.java#L47-L63
125,376
jenkinsci/jenkins
core/src/main/java/hudson/util/CopyOnWriteMap.java
CopyOnWriteMap.replaceBy
public void replaceBy(Map<? extends K, ? extends V> data) { Map<K, V> d = copy(); d.clear(); d.putAll(data); update(d); }
java
public void replaceBy(Map<? extends K, ? extends V> data) { Map<K, V> d = copy(); d.clear(); d.putAll(data); update(d); }
[ "public", "void", "replaceBy", "(", "Map", "<", "?", "extends", "K", ",", "?", "extends", "V", ">", "data", ")", "{", "Map", "<", "K", ",", "V", ">", "d", "=", "copy", "(", ")", ";", "d", ".", "clear", "(", ")", ";", "d", ".", "putAll", "("...
Atomically replaces the entire map by the copy of the specified map.
[ "Atomically", "replaces", "the", "entire", "map", "by", "the", "copy", "of", "the", "specified", "map", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/CopyOnWriteMap.java#L75-L80
125,377
jenkinsci/jenkins
core/src/main/java/hudson/model/Slave.java
Slave.getWorkspaceRoot
public @CheckForNull FilePath getWorkspaceRoot() { FilePath r = getRootPath(); if(r==null) return null; return r.child(WORKSPACE_ROOT); }
java
public @CheckForNull FilePath getWorkspaceRoot() { FilePath r = getRootPath(); if(r==null) return null; return r.child(WORKSPACE_ROOT); }
[ "public", "@", "CheckForNull", "FilePath", "getWorkspaceRoot", "(", ")", "{", "FilePath", "r", "=", "getRootPath", "(", ")", ";", "if", "(", "r", "==", "null", ")", "return", "null", ";", "return", "r", ".", "child", "(", "WORKSPACE_ROOT", ")", ";", "}...
Root directory on this agent where all the job workspaces are laid out. @return null if not connected.
[ "Root", "directory", "on", "this", "agent", "where", "all", "the", "job", "workspaces", "are", "laid", "out", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Slave.java#L362-L366
125,378
jenkinsci/jenkins
core/src/main/java/hudson/model/Slave.java
Slave.createLauncher
@Nonnull public Launcher createLauncher(TaskListener listener) { SlaveComputer c = getComputer(); if (c == null) { listener.error("Issue with creating launcher for agent " + name + ". Computer has been disconnected"); return new Launcher.DummyLauncher(listener); } els...
java
@Nonnull public Launcher createLauncher(TaskListener listener) { SlaveComputer c = getComputer(); if (c == null) { listener.error("Issue with creating launcher for agent " + name + ". Computer has been disconnected"); return new Launcher.DummyLauncher(listener); } els...
[ "@", "Nonnull", "public", "Launcher", "createLauncher", "(", "TaskListener", "listener", ")", "{", "SlaveComputer", "c", "=", "getComputer", "(", ")", ";", "if", "(", "c", "==", "null", ")", "{", "listener", ".", "error", "(", "\"Issue with creating launcher f...
Creates a launcher for the agent. @return If there is no computer it will return a {@link hudson.Launcher.DummyLauncher}, otherwise it will return a {@link hudson.Launcher.RemoteLauncher} instead.
[ "Creates", "a", "launcher", "for", "the", "agent", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Slave.java#L473-L518
125,379
jenkinsci/jenkins
core/src/main/java/hudson/console/ConsoleNote.java
ConsoleNote.skip
public static void skip(DataInputStream in) throws IOException { byte[] preamble = new byte[PREAMBLE.length]; in.readFully(preamble); if (!Arrays.equals(preamble,PREAMBLE)) return; // not a valid preamble DataInputStream decoded = new DataInputStream(new UnbufferedBase64I...
java
public static void skip(DataInputStream in) throws IOException { byte[] preamble = new byte[PREAMBLE.length]; in.readFully(preamble); if (!Arrays.equals(preamble,PREAMBLE)) return; // not a valid preamble DataInputStream decoded = new DataInputStream(new UnbufferedBase64I...
[ "public", "static", "void", "skip", "(", "DataInputStream", "in", ")", "throws", "IOException", "{", "byte", "[", "]", "preamble", "=", "new", "byte", "[", "PREAMBLE", ".", "length", "]", ";", "in", ".", "readFully", "(", "preamble", ")", ";", "if", "(...
Skips the encoded console note.
[ "Skips", "the", "encoded", "console", "note", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/console/ConsoleNote.java#L289-L308
125,380
jenkinsci/jenkins
core/src/main/java/hudson/console/ConsoleNote.java
ConsoleNote.findPreamble
public static int findPreamble(byte[] buf, int start, int len) { int e = start + len - PREAMBLE.length + 1; OUTER: for (int i=start; i<e; i++) { if (buf[i]==PREAMBLE[0]) { // check for the rest of the match for (int j=1; j<PREAMBLE.length; j++) { ...
java
public static int findPreamble(byte[] buf, int start, int len) { int e = start + len - PREAMBLE.length + 1; OUTER: for (int i=start; i<e; i++) { if (buf[i]==PREAMBLE[0]) { // check for the rest of the match for (int j=1; j<PREAMBLE.length; j++) { ...
[ "public", "static", "int", "findPreamble", "(", "byte", "[", "]", "buf", ",", "int", "start", ",", "int", "len", ")", "{", "int", "e", "=", "start", "+", "len", "-", "PREAMBLE", ".", "length", "+", "1", ";", "OUTER", ":", "for", "(", "int", "i", ...
Locates the preamble in the given buffer.
[ "Locates", "the", "preamble", "in", "the", "given", "buffer", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/console/ConsoleNote.java#L328-L343
125,381
jenkinsci/jenkins
core/src/main/java/hudson/console/ConsoleNote.java
ConsoleNote.removeNotes
public static List<String> removeNotes(Collection<String> logLines) { List<String> r = new ArrayList<>(logLines.size()); for (String l : logLines) r.add(removeNotes(l)); return r; }
java
public static List<String> removeNotes(Collection<String> logLines) { List<String> r = new ArrayList<>(logLines.size()); for (String l : logLines) r.add(removeNotes(l)); return r; }
[ "public", "static", "List", "<", "String", ">", "removeNotes", "(", "Collection", "<", "String", ">", "logLines", ")", "{", "List", "<", "String", ">", "r", "=", "new", "ArrayList", "<>", "(", "logLines", ".", "size", "(", ")", ")", ";", "for", "(", ...
Removes the embedded console notes in the given log lines. @since 1.350
[ "Removes", "the", "embedded", "console", "notes", "in", "the", "given", "log", "lines", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/console/ConsoleNote.java#L350-L355
125,382
jenkinsci/jenkins
core/src/main/java/hudson/console/ConsoleNote.java
ConsoleNote.removeNotes
public static String removeNotes(String line) { while (true) { int idx = line.indexOf(PREAMBLE_STR); if (idx<0) return line; int e = line.indexOf(POSTAMBLE_STR,idx); if (e<0) return line; line = line.substring(0,idx)+line.substring(e+POSTAMBLE_STR....
java
public static String removeNotes(String line) { while (true) { int idx = line.indexOf(PREAMBLE_STR); if (idx<0) return line; int e = line.indexOf(POSTAMBLE_STR,idx); if (e<0) return line; line = line.substring(0,idx)+line.substring(e+POSTAMBLE_STR....
[ "public", "static", "String", "removeNotes", "(", "String", "line", ")", "{", "while", "(", "true", ")", "{", "int", "idx", "=", "line", ".", "indexOf", "(", "PREAMBLE_STR", ")", ";", "if", "(", "idx", "<", "0", ")", "return", "line", ";", "int", "...
Removes the embedded console notes in the given log line. @since 1.350
[ "Removes", "the", "embedded", "console", "notes", "in", "the", "given", "log", "line", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/console/ConsoleNote.java#L362-L370
125,383
jenkinsci/jenkins
core/src/main/java/hudson/init/TaskMethodFinder.java
TaskMethodFinder.getDisplayNameOf
protected String getDisplayNameOf(Method e, T i) { Class<?> c = e.getDeclaringClass(); String key = displayNameOf(i); if (key.length()==0) return c.getSimpleName()+"."+e.getName(); try { ResourceBundleHolder rb = ResourceBundleHolder.get( c.getClassLoader...
java
protected String getDisplayNameOf(Method e, T i) { Class<?> c = e.getDeclaringClass(); String key = displayNameOf(i); if (key.length()==0) return c.getSimpleName()+"."+e.getName(); try { ResourceBundleHolder rb = ResourceBundleHolder.get( c.getClassLoader...
[ "protected", "String", "getDisplayNameOf", "(", "Method", "e", ",", "T", "i", ")", "{", "Class", "<", "?", ">", "c", "=", "e", ".", "getDeclaringClass", "(", ")", ";", "String", "key", "=", "displayNameOf", "(", "i", ")", ";", "if", "(", "key", "."...
Obtains the display name of the given initialization task
[ "Obtains", "the", "display", "name", "of", "the", "given", "initialization", "task" ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/init/TaskMethodFinder.java#L77-L92
125,384
jenkinsci/jenkins
core/src/main/java/hudson/init/TaskMethodFinder.java
TaskMethodFinder.invoke
protected void invoke(Method e) { try { Class<?>[] pt = e.getParameterTypes(); Object[] args = new Object[pt.length]; for (int i=0; i<args.length; i++) args[i] = lookUp(pt[i]); e.invoke( Modifier.isStatic(e.getModifiers()) ? null :...
java
protected void invoke(Method e) { try { Class<?>[] pt = e.getParameterTypes(); Object[] args = new Object[pt.length]; for (int i=0; i<args.length; i++) args[i] = lookUp(pt[i]); e.invoke( Modifier.isStatic(e.getModifiers()) ? null :...
[ "protected", "void", "invoke", "(", "Method", "e", ")", "{", "try", "{", "Class", "<", "?", ">", "[", "]", "pt", "=", "e", ".", "getParameterTypes", "(", ")", ";", "Object", "[", "]", "args", "=", "new", "Object", "[", "pt", ".", "length", "]", ...
Invokes the given initialization method.
[ "Invokes", "the", "given", "initialization", "method", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/init/TaskMethodFinder.java#L97-L112
125,385
jenkinsci/jenkins
core/src/main/java/hudson/init/TaskMethodFinder.java
TaskMethodFinder.lookUp
private Object lookUp(Class<?> type) { Jenkins j = Jenkins.getInstance(); assert j != null : "This method is only invoked after the Jenkins singleton instance has been set"; if (type==Jenkins.class || type==Hudson.class) return j; Injector i = j.getInjector(); if (i!=...
java
private Object lookUp(Class<?> type) { Jenkins j = Jenkins.getInstance(); assert j != null : "This method is only invoked after the Jenkins singleton instance has been set"; if (type==Jenkins.class || type==Hudson.class) return j; Injector i = j.getInjector(); if (i!=...
[ "private", "Object", "lookUp", "(", "Class", "<", "?", ">", "type", ")", "{", "Jenkins", "j", "=", "Jenkins", ".", "getInstance", "(", ")", ";", "assert", "j", "!=", "null", ":", "\"This method is only invoked after the Jenkins singleton instance has been set\"", ...
Determines the parameter injection of the initialization method.
[ "Determines", "the", "parameter", "injection", "of", "the", "initialization", "method", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/init/TaskMethodFinder.java#L117-L126
125,386
jenkinsci/jenkins
core/src/main/java/hudson/model/TopLevelItemDescriptor.java
TopLevelItemDescriptor.getDescription
@Nonnull public String getDescription() { Stapler stapler = Stapler.getCurrent(); if (stapler != null) { try { WebApp webapp = WebApp.getCurrent(); MetaClass meta = webapp.getMetaClass(this); Script s = meta.loadTearOff(JellyClassTearOff.cl...
java
@Nonnull public String getDescription() { Stapler stapler = Stapler.getCurrent(); if (stapler != null) { try { WebApp webapp = WebApp.getCurrent(); MetaClass meta = webapp.getMetaClass(this); Script s = meta.loadTearOff(JellyClassTearOff.cl...
[ "@", "Nonnull", "public", "String", "getDescription", "(", ")", "{", "Stapler", "stapler", "=", "Stapler", ".", "getCurrent", "(", ")", ";", "if", "(", "stapler", "!=", "null", ")", "{", "try", "{", "WebApp", "webapp", "=", "WebApp", ".", "getCurrent", ...
A description of this kind of item type. This description can contain HTML code but it is recommended that you use plain text in order to be consistent with the rest of Jenkins. This method should be called from a thread where Stapler is handling an HTTP request, otherwise it will return an empty string. @return A st...
[ "A", "description", "of", "this", "kind", "of", "item", "type", ".", "This", "description", "can", "contain", "HTML", "code", "but", "it", "is", "recommended", "that", "you", "use", "plain", "text", "in", "order", "to", "be", "consistent", "with", "the", ...
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/TopLevelItemDescriptor.java#L148-L171
125,387
jenkinsci/jenkins
core/src/main/java/hudson/model/TopLevelItemDescriptor.java
TopLevelItemDescriptor.getIconFilePath
@CheckForNull @Deprecated public String getIconFilePath(String size) { if (!StringUtils.isBlank(getIconFilePathPattern())) { return getIconFilePathPattern().replace(":size", size); } return null; }
java
@CheckForNull @Deprecated public String getIconFilePath(String size) { if (!StringUtils.isBlank(getIconFilePathPattern())) { return getIconFilePathPattern().replace(":size", size); } return null; }
[ "@", "CheckForNull", "@", "Deprecated", "public", "String", "getIconFilePath", "(", "String", "size", ")", "{", "if", "(", "!", "StringUtils", ".", "isBlank", "(", "getIconFilePathPattern", "(", ")", ")", ")", "{", "return", "getIconFilePathPattern", "(", ")",...
An icon file path associated to a specific size. @param size A string with values that represent the common sizes: 16x16, 24x24, 32x32 or 48x48 @return A string or null if it is not defined. @since 2.0 @deprecated prefer {@link #getIconClassName()}
[ "An", "icon", "file", "path", "associated", "to", "a", "specific", "size", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/TopLevelItemDescriptor.java#L214-L221
125,388
jenkinsci/jenkins
core/src/main/java/hudson/tasks/Maven.java
Maven.getMaven
public MavenInstallation getMaven() { for( MavenInstallation i : getDescriptor().getInstallations() ) { if(mavenName !=null && mavenName.equals(i.getName())) return i; } return null; }
java
public MavenInstallation getMaven() { for( MavenInstallation i : getDescriptor().getInstallations() ) { if(mavenName !=null && mavenName.equals(i.getName())) return i; } return null; }
[ "public", "MavenInstallation", "getMaven", "(", ")", "{", "for", "(", "MavenInstallation", "i", ":", "getDescriptor", "(", ")", ".", "getInstallations", "(", ")", ")", "{", "if", "(", "mavenName", "!=", "null", "&&", "mavenName", ".", "equals", "(", "i", ...
Gets the Maven to invoke, or null to invoke the default one.
[ "Gets", "the", "Maven", "to", "invoke", "or", "null", "to", "invoke", "the", "default", "one", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/tasks/Maven.java#L233-L239
125,389
jenkinsci/jenkins
core/src/main/java/hudson/tasks/Maven.java
Maven.buildEnvVars
protected void buildEnvVars(EnvVars env, MavenInstallation mi) throws IOException, InterruptedException { if(mi!=null) { // if somebody has use M2_HOME they will get a classloading error // when M2_HOME points to a different version of Maven2 from // MAVEN_HOME (as Maven 2 gi...
java
protected void buildEnvVars(EnvVars env, MavenInstallation mi) throws IOException, InterruptedException { if(mi!=null) { // if somebody has use M2_HOME they will get a classloading error // when M2_HOME points to a different version of Maven2 from // MAVEN_HOME (as Maven 2 gi...
[ "protected", "void", "buildEnvVars", "(", "EnvVars", "env", ",", "MavenInstallation", "mi", ")", "throws", "IOException", ",", "InterruptedException", "{", "if", "(", "mi", "!=", "null", ")", "{", "// if somebody has use M2_HOME they will get a classloading error", "// ...
Build up the environment variables toward the Maven launch.
[ "Build", "up", "the", "environment", "variables", "toward", "the", "Maven", "launch", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/tasks/Maven.java#L393-L411
125,390
jenkinsci/jenkins
core/src/main/java/hudson/model/ComputerPinger.java
ComputerPinger.checkIsReachable
public static boolean checkIsReachable(InetAddress ia, int timeout) throws IOException { for (ComputerPinger pinger : ComputerPinger.all()) { try { if (pinger.isReachable(ia, timeout)) { return true; } } catch (IOException e) { ...
java
public static boolean checkIsReachable(InetAddress ia, int timeout) throws IOException { for (ComputerPinger pinger : ComputerPinger.all()) { try { if (pinger.isReachable(ia, timeout)) { return true; } } catch (IOException e) { ...
[ "public", "static", "boolean", "checkIsReachable", "(", "InetAddress", "ia", ",", "int", "timeout", ")", "throws", "IOException", "{", "for", "(", "ComputerPinger", "pinger", ":", "ComputerPinger", ".", "all", "(", ")", ")", "{", "try", "{", "if", "(", "pi...
Is this computer reachable via the given address? @param ia The address to check. @param timeout Timeout in seconds.
[ "Is", "this", "computer", "reachable", "via", "the", "given", "address?" ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/ComputerPinger.java#L39-L51
125,391
jenkinsci/jenkins
core/src/main/java/hudson/PluginManager.java
PluginManager.createPluginStrategy
protected PluginStrategy createPluginStrategy() { String strategyName = SystemProperties.getString(PluginStrategy.class.getName()); if (strategyName != null) { try { Class<?> klazz = getClass().getClassLoader().loadClass(strategyName); Object strategy = klazz.getConstructor(PluginManager.class) .ne...
java
protected PluginStrategy createPluginStrategy() { String strategyName = SystemProperties.getString(PluginStrategy.class.getName()); if (strategyName != null) { try { Class<?> klazz = getClass().getClassLoader().loadClass(strategyName); Object strategy = klazz.getConstructor(PluginManager.class) .ne...
[ "protected", "PluginStrategy", "createPluginStrategy", "(", ")", "{", "String", "strategyName", "=", "SystemProperties", ".", "getString", "(", "PluginStrategy", ".", "class", ".", "getName", "(", ")", ")", ";", "if", "(", "strategyName", "!=", "null", ")", "{...
Creates a hudson.PluginStrategy, looking at the corresponding system property.
[ "Creates", "a", "hudson", ".", "PluginStrategy", "looking", "at", "the", "corresponding", "system", "property", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginManager.java#L1153-L1179
125,392
jenkinsci/jenkins
core/src/main/java/hudson/PluginManager.java
PluginManager.getPlugin
@CheckForNull public PluginWrapper getPlugin(String shortName) { for (PluginWrapper p : getPlugins()) { if(p.getShortName().equals(shortName)) return p; } return null; }
java
@CheckForNull public PluginWrapper getPlugin(String shortName) { for (PluginWrapper p : getPlugins()) { if(p.getShortName().equals(shortName)) return p; } return null; }
[ "@", "CheckForNull", "public", "PluginWrapper", "getPlugin", "(", "String", "shortName", ")", "{", "for", "(", "PluginWrapper", "p", ":", "getPlugins", "(", ")", ")", "{", "if", "(", "p", ".", "getShortName", "(", ")", ".", "equals", "(", "shortName", ")...
Get the plugin instance with the given short name. @param shortName the short name of the plugin @return The plugin singleton or {@code null} if a plugin with the given short name does not exist. The fact the plugin is loaded does not mean it is enabled and fully initialized for the current Jenkins session. Use {@link ...
[ "Get", "the", "plugin", "instance", "with", "the", "given", "short", "name", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginManager.java#L1211-L1218
125,393
jenkinsci/jenkins
core/src/main/java/hudson/PluginManager.java
PluginManager.stop
public void stop() { for (PluginWrapper p : activePlugins) { p.stop(); p.releaseClassLoader(); } activePlugins.clear(); // Work around a bug in commons-logging. // See http://www.szegedi.org/articles/memleak.html LogFactory.release(uberClassLoader)...
java
public void stop() { for (PluginWrapper p : activePlugins) { p.stop(); p.releaseClassLoader(); } activePlugins.clear(); // Work around a bug in commons-logging. // See http://www.szegedi.org/articles/memleak.html LogFactory.release(uberClassLoader)...
[ "public", "void", "stop", "(", ")", "{", "for", "(", "PluginWrapper", "p", ":", "activePlugins", ")", "{", "p", ".", "stop", "(", ")", ";", "p", ".", "releaseClassLoader", "(", ")", ";", "}", "activePlugins", ".", "clear", "(", ")", ";", "// Work aro...
Orderly terminates all the plugins.
[ "Orderly", "terminates", "all", "the", "plugins", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginManager.java#L1297-L1306
125,394
jenkinsci/jenkins
core/src/main/java/hudson/PluginManager.java
PluginManager.doPlugins
@Restricted(DoNotUse.class) // WebOnly public HttpResponse doPlugins() { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); JSONArray response = new JSONArray(); Map<String,JSONObject> allPlugins = new HashMap<>(); for (PluginWrapper plugin : plugins) { JSONObject...
java
@Restricted(DoNotUse.class) // WebOnly public HttpResponse doPlugins() { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); JSONArray response = new JSONArray(); Map<String,JSONObject> allPlugins = new HashMap<>(); for (PluginWrapper plugin : plugins) { JSONObject...
[ "@", "Restricted", "(", "DoNotUse", ".", "class", ")", "// WebOnly", "public", "HttpResponse", "doPlugins", "(", ")", "{", "Jenkins", ".", "getInstance", "(", ")", ".", "checkPermission", "(", "Jenkins", ".", "ADMINISTER", ")", ";", "JSONArray", "response", ...
Get the list of all plugins - available and installed. @return The list of all plugins - available and installed.
[ "Get", "the", "list", "of", "all", "plugins", "-", "available", "and", "installed", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginManager.java#L1312-L1357
125,395
jenkinsci/jenkins
core/src/main/java/hudson/PluginManager.java
PluginManager.doInstallPlugins
@RequirePOST @Restricted(DoNotUse.class) // WebOnly public HttpResponse doInstallPlugins(StaplerRequest req) throws IOException { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); String payload = IOUtils.toString(req.getInputStream(), req.getCharacterEncoding()); JSONObject req...
java
@RequirePOST @Restricted(DoNotUse.class) // WebOnly public HttpResponse doInstallPlugins(StaplerRequest req) throws IOException { Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER); String payload = IOUtils.toString(req.getInputStream(), req.getCharacterEncoding()); JSONObject req...
[ "@", "RequirePOST", "@", "Restricted", "(", "DoNotUse", ".", "class", ")", "// WebOnly", "public", "HttpResponse", "doInstallPlugins", "(", "StaplerRequest", "req", ")", "throws", "IOException", "{", "Jenkins", ".", "getInstance", "(", ")", ".", "checkPermission",...
Installs a list of plugins from a JSON POST. @param req The request object. @return A JSON response that includes a "correlationId" in the "data" element. That "correlationId" can then be used in calls to {@link UpdateCenter#doInstallStatus(org.kohsuke.stapler.StaplerRequest)}. @throws IOException Error reading JSON pa...
[ "Installs", "a", "list", "of", "plugins", "from", "a", "JSON", "POST", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginManager.java#L1422-L1447
125,396
jenkinsci/jenkins
core/src/main/java/hudson/PluginManager.java
PluginManager.doUploadPlugin
@RequirePOST public HttpResponse doUploadPlugin(StaplerRequest req) throws IOException, ServletException { try { Jenkins.getInstance().checkPermission(UPLOAD_PLUGINS); ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory()); // Parse the request ...
java
@RequirePOST public HttpResponse doUploadPlugin(StaplerRequest req) throws IOException, ServletException { try { Jenkins.getInstance().checkPermission(UPLOAD_PLUGINS); ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory()); // Parse the request ...
[ "@", "RequirePOST", "public", "HttpResponse", "doUploadPlugin", "(", "StaplerRequest", "req", ")", "throws", "IOException", ",", "ServletException", "{", "try", "{", "Jenkins", ".", "getInstance", "(", ")", ".", "checkPermission", "(", "UPLOAD_PLUGINS", ")", ";", ...
Uploads a plugin.
[ "Uploads", "a", "plugin", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginManager.java#L1619-L1684
125,397
jenkinsci/jenkins
core/src/main/java/hudson/PluginManager.java
PluginManager.parseRequestedPlugins
public Map<String,VersionNumber> parseRequestedPlugins(InputStream configXml) throws IOException { final Map<String,VersionNumber> requestedPlugins = new TreeMap<>(); try { SAXParserFactory.newInstance().newSAXParser().parse(configXml, new DefaultHandler() { @Override public ...
java
public Map<String,VersionNumber> parseRequestedPlugins(InputStream configXml) throws IOException { final Map<String,VersionNumber> requestedPlugins = new TreeMap<>(); try { SAXParserFactory.newInstance().newSAXParser().parse(configXml, new DefaultHandler() { @Override public ...
[ "public", "Map", "<", "String", ",", "VersionNumber", ">", "parseRequestedPlugins", "(", "InputStream", "configXml", ")", "throws", "IOException", "{", "final", "Map", "<", "String", ",", "VersionNumber", ">", "requestedPlugins", "=", "new", "TreeMap", "<>", "("...
Parses configuration XML files and picks up references to XML files.
[ "Parses", "configuration", "XML", "files", "and", "picks", "up", "references", "to", "XML", "files", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginManager.java#L1900-L1933
125,398
jenkinsci/jenkins
core/src/main/java/hudson/model/LoadStatistics.java
LoadStatistics.createChart
public JFreeChart createChart(CategoryDataset ds) { final JFreeChart chart = ChartFactory.createLineChart(null, // chart title null, // unused null, // range axis label ds, // data PlotOrientation.VERTICAL, // orientation true, // i...
java
public JFreeChart createChart(CategoryDataset ds) { final JFreeChart chart = ChartFactory.createLineChart(null, // chart title null, // unused null, // range axis label ds, // data PlotOrientation.VERTICAL, // orientation true, // i...
[ "public", "JFreeChart", "createChart", "(", "CategoryDataset", "ds", ")", "{", "final", "JFreeChart", "chart", "=", "ChartFactory", ".", "createLineChart", "(", "null", ",", "// chart title", "null", ",", "// unused", "null", ",", "// range axis label", "ds", ",",...
Creates a trend chart.
[ "Creates", "a", "trend", "chart", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/LoadStatistics.java#L218-L255
125,399
jenkinsci/jenkins
core/src/main/java/hudson/model/LoadStatistics.java
LoadStatistics.updateCounts
protected void updateCounts(LoadStatisticsSnapshot current) { definedExecutors.update(current.getDefinedExecutors()); onlineExecutors.update(current.getOnlineExecutors()); connectingExecutors.update(current.getConnectingExecutors()); busyExecutors.update(current.getBusyExecutors()); ...
java
protected void updateCounts(LoadStatisticsSnapshot current) { definedExecutors.update(current.getDefinedExecutors()); onlineExecutors.update(current.getOnlineExecutors()); connectingExecutors.update(current.getConnectingExecutors()); busyExecutors.update(current.getBusyExecutors()); ...
[ "protected", "void", "updateCounts", "(", "LoadStatisticsSnapshot", "current", ")", "{", "definedExecutors", ".", "update", "(", "current", ".", "getDefinedExecutors", "(", ")", ")", ";", "onlineExecutors", ".", "update", "(", "current", ".", "getOnlineExecutors", ...
Updates all the series from the current snapshot. @param current the current snapshot. @since 1.607
[ "Updates", "all", "the", "series", "from", "the", "current", "snapshot", "." ]
44c4d3989232082c254d27ae360aa810669f44b7
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/LoadStatistics.java#L296-L304