repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java | ExcelWriter.merge | public ExcelWriter merge(int firstRow, int lastRow, int firstColumn, int lastColumn, Object content, boolean isSetHeaderStyle) {
Assert.isFalse(this.isClosed, "ExcelWriter has been closed!");
final CellStyle style = (isSetHeaderStyle && null != this.styleSet && null != this.styleSet.headCellStyle) ? this.styleSet.headCellStyle : this.styleSet.cellStyle;
CellUtil.mergingCells(this.sheet, firstRow, lastRow, firstColumn, lastColumn, style);
// 设置内容
if (null != content) {
final Cell cell = getOrCreateCell(firstColumn, firstRow);
CellUtil.setCellValue(cell, content, this.styleSet, isSetHeaderStyle);
}
return this;
} | java | public ExcelWriter merge(int firstRow, int lastRow, int firstColumn, int lastColumn, Object content, boolean isSetHeaderStyle) {
Assert.isFalse(this.isClosed, "ExcelWriter has been closed!");
final CellStyle style = (isSetHeaderStyle && null != this.styleSet && null != this.styleSet.headCellStyle) ? this.styleSet.headCellStyle : this.styleSet.cellStyle;
CellUtil.mergingCells(this.sheet, firstRow, lastRow, firstColumn, lastColumn, style);
// 设置内容
if (null != content) {
final Cell cell = getOrCreateCell(firstColumn, firstRow);
CellUtil.setCellValue(cell, content, this.styleSet, isSetHeaderStyle);
}
return this;
} | [
"public",
"ExcelWriter",
"merge",
"(",
"int",
"firstRow",
",",
"int",
"lastRow",
",",
"int",
"firstColumn",
",",
"int",
"lastColumn",
",",
"Object",
"content",
",",
"boolean",
"isSetHeaderStyle",
")",
"{",
"Assert",
".",
"isFalse",
"(",
"this",
".",
"isClose... | 合并某行的单元格,并写入对象到单元格<br>
如果写到单元格中的内容非null,行号自动+1,否则当前行号不变<br>
样式为默认标题样式,可使用{@link #getHeadCellStyle()}方法调用后自定义默认样式
@param lastColumn 合并到的最后一个列号
@param content 合并单元格后的内容
@param isSetHeaderStyle 是否为合并后的单元格设置默认标题样式
@return this
@since 4.0.10 | [
"合并某行的单元格,并写入对象到单元格<br",
">",
"如果写到单元格中的内容非null,行号自动",
"+",
"1,否则当前行号不变<br",
">",
"样式为默认标题样式,可使用",
"{",
"@link",
"#getHeadCellStyle",
"()",
"}",
"方法调用后自定义默认样式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L542-L554 | train | Merges two cells into one cell. | [
30522,
2270,
24970,
15994,
13590,
1006,
20014,
2034,
10524,
1010,
20014,
2197,
10524,
1010,
20014,
2034,
25778,
2819,
2078,
1010,
20014,
2197,
25778,
2819,
2078,
1010,
4874,
4180,
1010,
22017,
20898,
26354,
11031,
13775,
2545,
27983,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java | EnvironmentInformation.getOpenFileHandlesLimit | public static long getOpenFileHandlesLimit() {
if (OperatingSystem.isWindows()) { // getMaxFileDescriptorCount method is not available on Windows
return -1L;
}
Class<?> sunBeanClass;
try {
sunBeanClass = Class.forName("com.sun.management.UnixOperatingSystemMXBean");
}
catch (ClassNotFoundException e) {
return -1L;
}
try {
Method fhLimitMethod = sunBeanClass.getMethod("getMaxFileDescriptorCount");
Object result = fhLimitMethod.invoke(ManagementFactory.getOperatingSystemMXBean());
return (Long) result;
}
catch (Throwable t) {
LOG.warn("Unexpected error when accessing file handle limit", t);
return -1L;
}
} | java | public static long getOpenFileHandlesLimit() {
if (OperatingSystem.isWindows()) { // getMaxFileDescriptorCount method is not available on Windows
return -1L;
}
Class<?> sunBeanClass;
try {
sunBeanClass = Class.forName("com.sun.management.UnixOperatingSystemMXBean");
}
catch (ClassNotFoundException e) {
return -1L;
}
try {
Method fhLimitMethod = sunBeanClass.getMethod("getMaxFileDescriptorCount");
Object result = fhLimitMethod.invoke(ManagementFactory.getOperatingSystemMXBean());
return (Long) result;
}
catch (Throwable t) {
LOG.warn("Unexpected error when accessing file handle limit", t);
return -1L;
}
} | [
"public",
"static",
"long",
"getOpenFileHandlesLimit",
"(",
")",
"{",
"if",
"(",
"OperatingSystem",
".",
"isWindows",
"(",
")",
")",
"{",
"// getMaxFileDescriptorCount method is not available on Windows",
"return",
"-",
"1L",
";",
"}",
"Class",
"<",
"?",
">",
"sun... | Tries to retrieve the maximum number of open file handles. This method will only work on
UNIX-based operating systems with Sun/Oracle Java versions.
<p>If the number of max open file handles cannot be determined, this method returns {@code -1}.</p>
@return The limit of open file handles, or {@code -1}, if the limit could not be determined. | [
"Tries",
"to",
"retrieve",
"the",
"maximum",
"number",
"of",
"open",
"file",
"handles",
".",
"This",
"method",
"will",
"only",
"work",
"on",
"UNIX",
"-",
"based",
"operating",
"systems",
"with",
"Sun",
"/",
"Oracle",
"Java",
"versions",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java#L238-L259 | train | Returns the limit of the number of open file handles. | [
30522,
2270,
10763,
2146,
2131,
26915,
8873,
2571,
11774,
4244,
17960,
4183,
1006,
1007,
1063,
2065,
1006,
4082,
6508,
13473,
2213,
1012,
2003,
11101,
15568,
1006,
1007,
1007,
1063,
1013,
1013,
2131,
17848,
8873,
3709,
2229,
23235,
2953,
35... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/ErrorPageFilter.java | ErrorPageFilter.getDescription | protected String getDescription(HttpServletRequest request) {
String pathInfo = (request.getPathInfo() != null) ? request.getPathInfo() : "";
return "[" + request.getServletPath() + pathInfo + "]";
} | java | protected String getDescription(HttpServletRequest request) {
String pathInfo = (request.getPathInfo() != null) ? request.getPathInfo() : "";
return "[" + request.getServletPath() + pathInfo + "]";
} | [
"protected",
"String",
"getDescription",
"(",
"HttpServletRequest",
"request",
")",
"{",
"String",
"pathInfo",
"=",
"(",
"request",
".",
"getPathInfo",
"(",
")",
"!=",
"null",
")",
"?",
"request",
".",
"getPathInfo",
"(",
")",
":",
"\"\"",
";",
"return",
"... | Return the description for the given request. By default this method will return a
description based on the request {@code servletPath} and {@code pathInfo}.
@param request the source request
@return the description
@since 1.5.0 | [
"Return",
"the",
"description",
"for",
"the",
"given",
"request",
".",
"By",
"default",
"this",
"method",
"will",
"return",
"a",
"description",
"based",
"on",
"the",
"request",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/support/ErrorPageFilter.java#L209-L212 | train | Get the description of the request. | [
30522,
5123,
5164,
2131,
6155,
23235,
3258,
1006,
16770,
2121,
2615,
7485,
2890,
15500,
5227,
1007,
1063,
5164,
4130,
2378,
14876,
1027,
1006,
5227,
1012,
2131,
15069,
2378,
14876,
1006,
1007,
999,
1027,
19701,
1007,
1029,
5227,
1012,
2131,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/types/Record.java | Record.getFieldsInto | public boolean getFieldsInto(int[] positions, Value[] targets) {
for (int i = 0; i < positions.length; i++) {
if (!getFieldInto(positions[i], targets[i])) {
return false;
}
}
return true;
} | java | public boolean getFieldsInto(int[] positions, Value[] targets) {
for (int i = 0; i < positions.length; i++) {
if (!getFieldInto(positions[i], targets[i])) {
return false;
}
}
return true;
} | [
"public",
"boolean",
"getFieldsInto",
"(",
"int",
"[",
"]",
"positions",
",",
"Value",
"[",
"]",
"targets",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"positions",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"getField... | Gets the fields at the given positions into an array.
If at any position a field is null, then this method returns false.
All fields that have been successfully read until the failing read are correctly contained in the record.
All other fields are not set.
@param positions The positions of the fields to get.
@param targets The values into which the content of the fields is put.
@return True if all fields were successfully read, false if some read failed. | [
"Gets",
"the",
"fields",
"at",
"the",
"given",
"positions",
"into",
"an",
"array",
".",
"If",
"at",
"any",
"position",
"a",
"field",
"is",
"null",
"then",
"this",
"method",
"returns",
"false",
".",
"All",
"fields",
"that",
"have",
"been",
"successfully",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/Record.java#L337-L344 | train | Gets the fields into the given array of values. | [
30522,
2270,
22017,
20898,
2131,
15155,
18447,
2080,
1006,
20014,
1031,
1033,
4460,
1010,
3643,
1031,
1033,
7889,
1007,
1063,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
4460,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
2065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | http-url/src/main/java/com/networknt/url/URLNormalizer.java | URLNormalizer.lowerCaseSchemeHost | public URLNormalizer lowerCaseSchemeHost() {
URL u = toURL();
url = Pattern.compile(u.getProtocol(),
Pattern.CASE_INSENSITIVE).matcher(url).replaceFirst(
u.getProtocol().toLowerCase());
url = Pattern.compile(u.getHost(),
Pattern.CASE_INSENSITIVE).matcher(url).replaceFirst(
u.getHost().toLowerCase());
return this;
} | java | public URLNormalizer lowerCaseSchemeHost() {
URL u = toURL();
url = Pattern.compile(u.getProtocol(),
Pattern.CASE_INSENSITIVE).matcher(url).replaceFirst(
u.getProtocol().toLowerCase());
url = Pattern.compile(u.getHost(),
Pattern.CASE_INSENSITIVE).matcher(url).replaceFirst(
u.getHost().toLowerCase());
return this;
} | [
"public",
"URLNormalizer",
"lowerCaseSchemeHost",
"(",
")",
"{",
"URL",
"u",
"=",
"toURL",
"(",
")",
";",
"url",
"=",
"Pattern",
".",
"compile",
"(",
"u",
".",
"getProtocol",
"(",
")",
",",
"Pattern",
".",
"CASE_INSENSITIVE",
")",
".",
"matcher",
"(",
... | Converts the scheme and host to lower case.<p>
<code>HTTP://www.Example.com/ → http://www.example.com/</code>
@return this instance | [
"Converts",
"the",
"scheme",
"and",
"host",
"to",
"lower",
"case",
".",
"<p",
">",
"<code",
">",
"HTTP",
":",
"//",
"www",
".",
"Example",
".",
"com",
"/",
"&rarr",
";",
"http",
":",
"//",
"www",
".",
"example",
".",
"com",
"/",
"<",
"/",
"code",... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/URLNormalizer.java#L188-L197 | train | Returns a URLNormalizer that normalizes scheme host names to lowercase. | [
30522,
2270,
24471,
19666,
2953,
9067,
17629,
2896,
18382,
22842,
4168,
15006,
2102,
1006,
1007,
1063,
24471,
2140,
1057,
1027,
2778,
2140,
1006,
1007,
1025,
24471,
2140,
1027,
5418,
1012,
4012,
22090,
1006,
1057,
1012,
2131,
21572,
3406,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/MurmurHash.java | MurmurHash.hash | public int hash() {
hash ^= 4 * count;
hash ^= hash >>> 16;
hash *= 0x85ebca6b;
hash ^= hash >>> 13;
hash *= 0xc2b2ae35;
hash ^= hash >>> 16;
return hash;
} | java | public int hash() {
hash ^= 4 * count;
hash ^= hash >>> 16;
hash *= 0x85ebca6b;
hash ^= hash >>> 13;
hash *= 0xc2b2ae35;
hash ^= hash >>> 16;
return hash;
} | [
"public",
"int",
"hash",
"(",
")",
"{",
"hash",
"^=",
"4",
"*",
"count",
";",
"hash",
"^=",
"hash",
">>>",
"16",
";",
"hash",
"*=",
"0x85ebca6b",
";",
"hash",
"^=",
"hash",
">>>",
"13",
";",
"hash",
"*=",
"0xc2b2ae35",
";",
"hash",
"^=",
"hash",
... | Finalize and return the MurmurHash output.
@return 32-bit hash | [
"Finalize",
"and",
"return",
"the",
"MurmurHash",
"output",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/MurmurHash.java#L119-L128 | train | Returns the hash value of the object. | [
30522,
2270,
20014,
23325,
1006,
1007,
1063,
23325,
1034,
1027,
1018,
1008,
4175,
1025,
23325,
1034,
1027,
23325,
1028,
1028,
1028,
2385,
1025,
23325,
1008,
1027,
1014,
2595,
27531,
15878,
3540,
2575,
2497,
1025,
23325,
1034,
1027,
23325,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java | EpollSocketChannelConfig.setTcpQuickAck | public EpollSocketChannelConfig setTcpQuickAck(boolean quickAck) {
try {
((EpollSocketChannel) channel).socket.setTcpQuickAck(quickAck);
return this;
} catch (IOException e) {
throw new ChannelException(e);
}
} | java | public EpollSocketChannelConfig setTcpQuickAck(boolean quickAck) {
try {
((EpollSocketChannel) channel).socket.setTcpQuickAck(quickAck);
return this;
} catch (IOException e) {
throw new ChannelException(e);
}
} | [
"public",
"EpollSocketChannelConfig",
"setTcpQuickAck",
"(",
"boolean",
"quickAck",
")",
"{",
"try",
"{",
"(",
"(",
"EpollSocketChannel",
")",
"channel",
")",
".",
"socket",
".",
"setTcpQuickAck",
"(",
"quickAck",
")",
";",
"return",
"this",
";",
"}",
"catch",... | Set the {@code TCP_QUICKACK} option on the socket. See <a href="http://linux.die.net/man/7/tcp">TCP_QUICKACK</a>
for more details. | [
"Set",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java#L531-L538 | train | Sets the TCP quick ack flag. | [
30522,
2270,
4958,
14511,
6499,
19869,
10649,
20147,
22499,
2078,
8873,
2290,
2275,
13535,
2361,
15549,
3600,
8684,
1006,
22017,
20898,
4248,
8684,
1007,
1063,
3046,
1063,
1006,
1006,
4958,
14511,
6499,
19869,
10649,
20147,
2140,
1007,
3149,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/py/String2PinyinConverter.java | String2PinyinConverter.convert2Pair | public static Pair<List<Pinyin>, List<Boolean>> convert2Pair(String complexText, boolean removeTone)
{
List<Pinyin> pinyinList = new LinkedList<Pinyin>();
List<Boolean> booleanList = new LinkedList<Boolean>();
Collection<Token> tokenize = trie.tokenize(complexText);
for (Token token : tokenize)
{
String fragment = token.getFragment();
if (token.isMatch())
{
// 是拼音或拼音的一部分,用map转
Pinyin pinyin = convertSingle(fragment);
pinyinList.add(pinyin);
if (fragment.length() == pinyin.getPinyinWithoutTone().length())
{
booleanList.add(true);
}
else
{
booleanList.add(false);
}
}
else
{
List<Pinyin> pinyinListFragment = PinyinDictionary.convertToPinyin(fragment);
pinyinList.addAll(pinyinListFragment);
for (int i = 0; i < pinyinListFragment.size(); ++i)
{
booleanList.add(true);
}
}
}
makeToneToTheSame(pinyinList);
return new Pair<List<Pinyin>, List<Boolean>>(pinyinList, booleanList);
} | java | public static Pair<List<Pinyin>, List<Boolean>> convert2Pair(String complexText, boolean removeTone)
{
List<Pinyin> pinyinList = new LinkedList<Pinyin>();
List<Boolean> booleanList = new LinkedList<Boolean>();
Collection<Token> tokenize = trie.tokenize(complexText);
for (Token token : tokenize)
{
String fragment = token.getFragment();
if (token.isMatch())
{
// 是拼音或拼音的一部分,用map转
Pinyin pinyin = convertSingle(fragment);
pinyinList.add(pinyin);
if (fragment.length() == pinyin.getPinyinWithoutTone().length())
{
booleanList.add(true);
}
else
{
booleanList.add(false);
}
}
else
{
List<Pinyin> pinyinListFragment = PinyinDictionary.convertToPinyin(fragment);
pinyinList.addAll(pinyinListFragment);
for (int i = 0; i < pinyinListFragment.size(); ++i)
{
booleanList.add(true);
}
}
}
makeToneToTheSame(pinyinList);
return new Pair<List<Pinyin>, List<Boolean>>(pinyinList, booleanList);
} | [
"public",
"static",
"Pair",
"<",
"List",
"<",
"Pinyin",
">",
",",
"List",
"<",
"Boolean",
">",
">",
"convert2Pair",
"(",
"String",
"complexText",
",",
"boolean",
"removeTone",
")",
"{",
"List",
"<",
"Pinyin",
">",
"pinyinList",
"=",
"new",
"LinkedList",
... | 将混合文本转为拼音
@param complexText 混合汉字、拼音、输入法头的文本,比如“飞流zh下sqianch”
@param removeTone
@return 一个键值对,键为拼音列表,值为类型(true表示这是一个拼音,false表示这是一个输入法头) | [
"将混合文本转为拼音"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/py/String2PinyinConverter.java#L113-L147 | train | Convert a text to a pair of Pinyin objects. | [
30522,
2270,
10763,
3940,
1026,
2862,
1026,
9973,
1028,
1010,
2862,
1026,
22017,
20898,
1028,
1028,
10463,
2475,
4502,
4313,
1006,
5164,
3375,
18209,
1010,
22017,
20898,
6366,
5524,
1007,
1063,
2862,
1026,
9973,
1028,
9973,
9863,
1027,
2047... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java | ExcelWriter.flush | public ExcelWriter flush(File destFile) throws IORuntimeException {
Assert.notNull(destFile, "[destFile] is null, and you must call setDestFile(File) first or call flush(OutputStream).");
return flush(FileUtil.getOutputStream(destFile), true);
} | java | public ExcelWriter flush(File destFile) throws IORuntimeException {
Assert.notNull(destFile, "[destFile] is null, and you must call setDestFile(File) first or call flush(OutputStream).");
return flush(FileUtil.getOutputStream(destFile), true);
} | [
"public",
"ExcelWriter",
"flush",
"(",
"File",
"destFile",
")",
"throws",
"IORuntimeException",
"{",
"Assert",
".",
"notNull",
"(",
"destFile",
",",
"\"[destFile] is null, and you must call setDestFile(File) first or call flush(OutputStream).\"",
")",
";",
"return",
"flush",
... | 将Excel Workbook刷出到文件<br>
如果用户未自定义输出的文件,将抛出{@link NullPointerException}
@param destFile 写出到的文件
@return this
@throws IORuntimeException IO异常
@since 4.0.6 | [
"将Excel",
"Workbook刷出到文件<br",
">",
"如果用户未自定义输出的文件,将抛出",
"{",
"@link",
"NullPointerException",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L805-L808 | train | Flushes the Excel file to the specified destination file. | [
30522,
2270,
24970,
15994,
13862,
1006,
5371,
4078,
24475,
9463,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
4078,
24475,
9463,
1010,
1000,
1031,
4078,
24475,
9463,
1033,
2003,
19701,
1010,
1998,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.setOrAppend | public static <T> List<T> setOrAppend(List<T> list, int index, T element) {
if (index < list.size()) {
list.set(index, element);
} else {
list.add(element);
}
return list;
} | java | public static <T> List<T> setOrAppend(List<T> list, int index, T element) {
if (index < list.size()) {
list.set(index, element);
} else {
list.add(element);
}
return list;
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"setOrAppend",
"(",
"List",
"<",
"T",
">",
"list",
",",
"int",
"index",
",",
"T",
"element",
")",
"{",
"if",
"(",
"index",
"<",
"list",
".",
"size",
"(",
")",
")",
"{",
"list",
".",
"s... | 设置或增加元素。当index小于List的长度时,替换指定位置的值,否则在尾部追加
@param list List列表
@param index 位置
@param element 新元素
@return 原List
@since 4.1.2 | [
"设置或增加元素。当index小于List的长度时,替换指定位置的值,否则在尾部追加"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2387-L2394 | train | Appends the specified element to the end of the list if the index is greater than the list size. | [
30522,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
2275,
6525,
21512,
4859,
1006,
2862,
1026,
1056,
1028,
2862,
1010,
20014,
5950,
1010,
1056,
5783,
1007,
1063,
2065,
1006,
5950,
1026,
2862,
1012,
2946,
1006,
1007,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java | PackagedProgram.extractContainedLibraries | public static List<File> extractContainedLibraries(URL jarFile) throws ProgramInvocationException {
Random rnd = new Random();
JarFile jar = null;
try {
jar = new JarFile(new File(jarFile.toURI()));
final List<JarEntry> containedJarFileEntries = new ArrayList<JarEntry>();
Enumeration<JarEntry> entries = jar.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
String name = entry.getName();
if (name.length() > 8 && name.startsWith("lib/") && name.endsWith(".jar")) {
containedJarFileEntries.add(entry);
}
}
if (containedJarFileEntries.isEmpty()) {
return Collections.emptyList();
}
else {
// go over all contained jar files
final List<File> extractedTempLibraries = new ArrayList<File>(containedJarFileEntries.size());
final byte[] buffer = new byte[4096];
boolean incomplete = true;
try {
for (int i = 0; i < containedJarFileEntries.size(); i++) {
final JarEntry entry = containedJarFileEntries.get(i);
String name = entry.getName();
// '/' as in case of zip, jar
// java.util.zip.ZipEntry#isDirectory always looks only for '/' not for File.separator
name = name.replace('/', '_');
File tempFile;
try {
tempFile = File.createTempFile(rnd.nextInt(Integer.MAX_VALUE) + "_", name);
tempFile.deleteOnExit();
}
catch (IOException e) {
throw new ProgramInvocationException(
"An I/O error occurred while creating temporary file to extract nested library '" +
entry.getName() + "'.", e);
}
extractedTempLibraries.add(tempFile);
// copy the temp file contents to a temporary File
OutputStream out = null;
InputStream in = null;
try {
out = new FileOutputStream(tempFile);
in = new BufferedInputStream(jar.getInputStream(entry));
int numRead = 0;
while ((numRead = in.read(buffer)) != -1) {
out.write(buffer, 0, numRead);
}
}
catch (IOException e) {
throw new ProgramInvocationException("An I/O error occurred while extracting nested library '"
+ entry.getName() + "' to temporary file '" + tempFile.getAbsolutePath() + "'.");
}
finally {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
}
}
incomplete = false;
}
finally {
if (incomplete) {
deleteExtractedLibraries(extractedTempLibraries);
}
}
return extractedTempLibraries;
}
}
catch (Throwable t) {
throw new ProgramInvocationException("Unknown I/O error while extracting contained jar files.", t);
}
finally {
if (jar != null) {
try {
jar.close();
} catch (Throwable t) {}
}
}
} | java | public static List<File> extractContainedLibraries(URL jarFile) throws ProgramInvocationException {
Random rnd = new Random();
JarFile jar = null;
try {
jar = new JarFile(new File(jarFile.toURI()));
final List<JarEntry> containedJarFileEntries = new ArrayList<JarEntry>();
Enumeration<JarEntry> entries = jar.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
String name = entry.getName();
if (name.length() > 8 && name.startsWith("lib/") && name.endsWith(".jar")) {
containedJarFileEntries.add(entry);
}
}
if (containedJarFileEntries.isEmpty()) {
return Collections.emptyList();
}
else {
// go over all contained jar files
final List<File> extractedTempLibraries = new ArrayList<File>(containedJarFileEntries.size());
final byte[] buffer = new byte[4096];
boolean incomplete = true;
try {
for (int i = 0; i < containedJarFileEntries.size(); i++) {
final JarEntry entry = containedJarFileEntries.get(i);
String name = entry.getName();
// '/' as in case of zip, jar
// java.util.zip.ZipEntry#isDirectory always looks only for '/' not for File.separator
name = name.replace('/', '_');
File tempFile;
try {
tempFile = File.createTempFile(rnd.nextInt(Integer.MAX_VALUE) + "_", name);
tempFile.deleteOnExit();
}
catch (IOException e) {
throw new ProgramInvocationException(
"An I/O error occurred while creating temporary file to extract nested library '" +
entry.getName() + "'.", e);
}
extractedTempLibraries.add(tempFile);
// copy the temp file contents to a temporary File
OutputStream out = null;
InputStream in = null;
try {
out = new FileOutputStream(tempFile);
in = new BufferedInputStream(jar.getInputStream(entry));
int numRead = 0;
while ((numRead = in.read(buffer)) != -1) {
out.write(buffer, 0, numRead);
}
}
catch (IOException e) {
throw new ProgramInvocationException("An I/O error occurred while extracting nested library '"
+ entry.getName() + "' to temporary file '" + tempFile.getAbsolutePath() + "'.");
}
finally {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
}
}
incomplete = false;
}
finally {
if (incomplete) {
deleteExtractedLibraries(extractedTempLibraries);
}
}
return extractedTempLibraries;
}
}
catch (Throwable t) {
throw new ProgramInvocationException("Unknown I/O error while extracting contained jar files.", t);
}
finally {
if (jar != null) {
try {
jar.close();
} catch (Throwable t) {}
}
}
} | [
"public",
"static",
"List",
"<",
"File",
">",
"extractContainedLibraries",
"(",
"URL",
"jarFile",
")",
"throws",
"ProgramInvocationException",
"{",
"Random",
"rnd",
"=",
"new",
"Random",
"(",
")",
";",
"JarFile",
"jar",
"=",
"null",
";",
"try",
"{",
"jar",
... | Takes all JAR files that are contained in this program's JAR file and extracts them
to the system's temp directory.
@return The file names of the extracted temporary files.
@throws ProgramInvocationException Thrown, if the extraction process failed. | [
"Takes",
"all",
"JAR",
"files",
"that",
"are",
"contained",
"in",
"this",
"program",
"s",
"JAR",
"file",
"and",
"extracts",
"them",
"to",
"the",
"system",
"s",
"temp",
"directory",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java#L666-L764 | train | Extract the nested libraries from the given jar file. | [
30522,
2270,
10763,
2862,
1026,
5371,
1028,
14817,
8663,
28055,
29521,
19848,
3111,
1006,
24471,
2140,
15723,
8873,
2571,
1007,
11618,
2565,
2378,
19152,
10288,
24422,
1063,
6721,
29300,
2094,
1027,
2047,
6721,
1006,
1007,
1025,
15723,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java | URLUtil.decode | public static String decode(String url, String charset) throws UtilException {
if (StrUtil.isEmpty(url)) {
return url;
}
try {
return URLDecoder.decode(url, charset);
} catch (UnsupportedEncodingException e) {
throw new UtilException(e, "Unsupported encoding: [{}]", charset);
}
} | java | public static String decode(String url, String charset) throws UtilException {
if (StrUtil.isEmpty(url)) {
return url;
}
try {
return URLDecoder.decode(url, charset);
} catch (UnsupportedEncodingException e) {
throw new UtilException(e, "Unsupported encoding: [{}]", charset);
}
} | [
"public",
"static",
"String",
"decode",
"(",
"String",
"url",
",",
"String",
"charset",
")",
"throws",
"UtilException",
"{",
"if",
"(",
"StrUtil",
".",
"isEmpty",
"(",
"url",
")",
")",
"{",
"return",
"url",
";",
"}",
"try",
"{",
"return",
"URLDecoder",
... | 解码URL<br>
将%开头的16进制表示的内容解码。
@param url URL
@param charset 编码
@return 解码后的URL
@exception UtilException UnsupportedEncodingException | [
"解码URL<br",
">",
"将%开头的16进制表示的内容解码。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L373-L382 | train | Decodes a string of bytes from a base64 encoded string. | [
30522,
2270,
10763,
5164,
21933,
3207,
1006,
5164,
24471,
2140,
1010,
5164,
25869,
13462,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
6633,
13876,
2100,
1006,
24471,
2140,
1007,
1007,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java | ReUtil.get | public static String get(String regex, CharSequence content, int groupIndex) {
if (null == content || null == regex) {
return null;
}
// Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
final Pattern pattern = PatternPool.get(regex, Pattern.DOTALL);
return get(pattern, content, groupIndex);
} | java | public static String get(String regex, CharSequence content, int groupIndex) {
if (null == content || null == regex) {
return null;
}
// Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
final Pattern pattern = PatternPool.get(regex, Pattern.DOTALL);
return get(pattern, content, groupIndex);
} | [
"public",
"static",
"String",
"get",
"(",
"String",
"regex",
",",
"CharSequence",
"content",
",",
"int",
"groupIndex",
")",
"{",
"if",
"(",
"null",
"==",
"content",
"||",
"null",
"==",
"regex",
")",
"{",
"return",
"null",
";",
"}",
"// Pattern pattern = Pa... | 获得匹配的字符串
@param regex 匹配的正则
@param content 被匹配的内容
@param groupIndex 匹配正则的分组序号
@return 匹配后得到的字符串,未匹配返回null | [
"获得匹配的字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L69-L77 | train | Gets a group of characters that match the given regular expression. | [
30522,
2270,
10763,
5164,
2131,
1006,
5164,
19723,
10288,
1010,
25869,
3366,
4226,
5897,
4180,
1010,
20014,
2177,
22254,
10288,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
4180,
1064,
1064,
19701,
1027,
1027,
19723,
10288,
1007,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java | CheckpointCoordinator.triggerQueuedRequests | private void triggerQueuedRequests() {
if (triggerRequestQueued) {
triggerRequestQueued = false;
// trigger the checkpoint from the trigger timer, to finish the work of this thread before
// starting with the next checkpoint
if (periodicScheduling) {
if (currentPeriodicTrigger != null) {
currentPeriodicTrigger.cancel(false);
}
currentPeriodicTrigger = timer.scheduleAtFixedRate(
new ScheduledTrigger(),
0L, baseInterval, TimeUnit.MILLISECONDS);
}
else {
timer.execute(new ScheduledTrigger());
}
}
} | java | private void triggerQueuedRequests() {
if (triggerRequestQueued) {
triggerRequestQueued = false;
// trigger the checkpoint from the trigger timer, to finish the work of this thread before
// starting with the next checkpoint
if (periodicScheduling) {
if (currentPeriodicTrigger != null) {
currentPeriodicTrigger.cancel(false);
}
currentPeriodicTrigger = timer.scheduleAtFixedRate(
new ScheduledTrigger(),
0L, baseInterval, TimeUnit.MILLISECONDS);
}
else {
timer.execute(new ScheduledTrigger());
}
}
} | [
"private",
"void",
"triggerQueuedRequests",
"(",
")",
"{",
"if",
"(",
"triggerRequestQueued",
")",
"{",
"triggerRequestQueued",
"=",
"false",
";",
"// trigger the checkpoint from the trigger timer, to finish the work of this thread before",
"// starting with the next checkpoint",
"... | Triggers the queued request, if there is one.
<p>NOTE: The caller of this method must hold the lock when invoking the method! | [
"Triggers",
"the",
"queued",
"request",
"if",
"there",
"is",
"one",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java#L1005-L1023 | train | Trigger the queued requests. | [
30522,
2797,
11675,
9495,
4226,
5657,
16200,
15500,
2015,
1006,
1007,
1063,
2065,
1006,
9495,
2890,
15500,
4226,
5657,
2094,
1007,
1063,
9495,
2890,
15500,
4226,
5657,
2094,
1027,
6270,
1025,
1013,
1013,
9495,
1996,
26520,
2013,
1996,
9495,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.parseXml | public static Document parseXml(String xmlStr) {
if (StrUtil.isBlank(xmlStr)) {
throw new IllegalArgumentException("XML content string is empty !");
}
xmlStr = cleanInvalid(xmlStr);
return readXML(new InputSource(StrUtil.getReader(xmlStr)));
} | java | public static Document parseXml(String xmlStr) {
if (StrUtil.isBlank(xmlStr)) {
throw new IllegalArgumentException("XML content string is empty !");
}
xmlStr = cleanInvalid(xmlStr);
return readXML(new InputSource(StrUtil.getReader(xmlStr)));
} | [
"public",
"static",
"Document",
"parseXml",
"(",
"String",
"xmlStr",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"xmlStr",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"XML content string is empty !\"",
")",
";",
"}",
"xmlStr",
"=... | 将String类型的XML转换为XML文档
@param xmlStr XML字符串
@return XML文档 | [
"将String类型的XML转换为XML文档"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L157-L163 | train | Parses an XML string. | [
30522,
2270,
10763,
6254,
11968,
3366,
2595,
19968,
1006,
5164,
20950,
3367,
2099,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
20950,
3367,
2099,
1007,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/Setting.java | Setting.remove | public String remove(String group, Object key) {
return this.groupedMap.remove(group, Convert.toStr(key));
} | java | public String remove(String group, Object key) {
return this.groupedMap.remove(group, Convert.toStr(key));
} | [
"public",
"String",
"remove",
"(",
"String",
"group",
",",
"Object",
"key",
")",
"{",
"return",
"this",
".",
"groupedMap",
".",
"remove",
"(",
"group",
",",
"Convert",
".",
"toStr",
"(",
"key",
")",
")",
";",
"}"
] | 从指定分组中删除指定值
@param group 分组
@param key 键
@return 被删除的值,如果值不存在,返回null | [
"从指定分组中删除指定值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L432-L434 | train | Removes the specified key from the specified group. | [
30522,
2270,
5164,
6366,
1006,
5164,
2177,
1010,
4874,
3145,
1007,
1063,
2709,
2023,
1012,
15131,
2863,
2361,
1012,
6366,
1006,
2177,
1010,
10463,
1012,
2000,
3367,
2099,
1006,
3145,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/similarity/JaccardIndex.java | JaccardIndex.setGroupSize | public JaccardIndex<K, VV, EV> setGroupSize(int groupSize) {
Preconditions.checkArgument(groupSize > 0, "Group size must be greater than zero");
this.groupSize = groupSize;
return this;
} | java | public JaccardIndex<K, VV, EV> setGroupSize(int groupSize) {
Preconditions.checkArgument(groupSize > 0, "Group size must be greater than zero");
this.groupSize = groupSize;
return this;
} | [
"public",
"JaccardIndex",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"setGroupSize",
"(",
"int",
"groupSize",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"groupSize",
">",
"0",
",",
"\"Group size must be greater than zero\"",
")",
";",
"this",
".",
"groupS... | Override the default group size for the quadratic expansion of neighbor
pairs. Small groups generate more data whereas large groups distribute
computation less evenly among tasks.
<p>The default value should be near-optimal for all use cases.
@param groupSize the group size for the quadratic expansion of neighbor pairs
@return this | [
"Override",
"the",
"default",
"group",
"size",
"for",
"the",
"quadratic",
"expansion",
"of",
"neighbor",
"pairs",
".",
"Small",
"groups",
"generate",
"more",
"data",
"whereas",
"large",
"groups",
"distribute",
"computation",
"less",
"evenly",
"among",
"tasks",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/similarity/JaccardIndex.java#L95-L101 | train | Sets the group size. | [
30522,
2270,
14855,
16665,
17080,
13629,
2595,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
2275,
17058,
5332,
4371,
1006,
20014,
2967,
4697,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
2967,
4697,
1028,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java | IOManagerAsync.isProperlyShutDown | @Override
public boolean isProperlyShutDown() {
boolean readersShutDown = true;
for (ReaderThread rt : readers) {
readersShutDown &= rt.getState() == Thread.State.TERMINATED;
}
boolean writersShutDown = true;
for (WriterThread wt : writers) {
writersShutDown &= wt.getState() == Thread.State.TERMINATED;
}
return isShutdown.get() && readersShutDown && writersShutDown && super.isProperlyShutDown();
} | java | @Override
public boolean isProperlyShutDown() {
boolean readersShutDown = true;
for (ReaderThread rt : readers) {
readersShutDown &= rt.getState() == Thread.State.TERMINATED;
}
boolean writersShutDown = true;
for (WriterThread wt : writers) {
writersShutDown &= wt.getState() == Thread.State.TERMINATED;
}
return isShutdown.get() && readersShutDown && writersShutDown && super.isProperlyShutDown();
} | [
"@",
"Override",
"public",
"boolean",
"isProperlyShutDown",
"(",
")",
"{",
"boolean",
"readersShutDown",
"=",
"true",
";",
"for",
"(",
"ReaderThread",
"rt",
":",
"readers",
")",
"{",
"readersShutDown",
"&=",
"rt",
".",
"getState",
"(",
")",
"==",
"Thread",
... | Utility method to check whether the IO manager has been properly shut down. The IO manager is considered
to be properly shut down when it is closed and its threads have ceased operation.
@return True, if the IO manager has properly shut down, false otherwise. | [
"Utility",
"method",
"to",
"check",
"whether",
"the",
"IO",
"manager",
"has",
"been",
"properly",
"shut",
"down",
".",
"The",
"IO",
"manager",
"is",
"considered",
"to",
"be",
"properly",
"shut",
"down",
"when",
"it",
"is",
"closed",
"and",
"its",
"threads"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java#L170-L183 | train | Returns true if the thread pool is completely shut down. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
2003,
21572,
4842,
2135,
14235,
2102,
7698,
1006,
1007,
1063,
22017,
20898,
8141,
14235,
2102,
7698,
1027,
2995,
1025,
2005,
1006,
8068,
2705,
16416,
2094,
19387,
1024,
8141,
1007,
1063,
8141,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java | DataStream.transform | @PublicEvolving
public <R> SingleOutputStreamOperator<R> transform(String operatorName, TypeInformation<R> outTypeInfo, OneInputStreamOperator<T, R> operator) {
// read the output type of the input Transform to coax out errors about MissingTypeInfo
transformation.getOutputType();
OneInputTransformation<T, R> resultTransform = new OneInputTransformation<>(
this.transformation,
operatorName,
operator,
outTypeInfo,
environment.getParallelism());
@SuppressWarnings({ "unchecked", "rawtypes" })
SingleOutputStreamOperator<R> returnStream = new SingleOutputStreamOperator(environment, resultTransform);
getExecutionEnvironment().addOperator(resultTransform);
return returnStream;
} | java | @PublicEvolving
public <R> SingleOutputStreamOperator<R> transform(String operatorName, TypeInformation<R> outTypeInfo, OneInputStreamOperator<T, R> operator) {
// read the output type of the input Transform to coax out errors about MissingTypeInfo
transformation.getOutputType();
OneInputTransformation<T, R> resultTransform = new OneInputTransformation<>(
this.transformation,
operatorName,
operator,
outTypeInfo,
environment.getParallelism());
@SuppressWarnings({ "unchecked", "rawtypes" })
SingleOutputStreamOperator<R> returnStream = new SingleOutputStreamOperator(environment, resultTransform);
getExecutionEnvironment().addOperator(resultTransform);
return returnStream;
} | [
"@",
"PublicEvolving",
"public",
"<",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"transform",
"(",
"String",
"operatorName",
",",
"TypeInformation",
"<",
"R",
">",
"outTypeInfo",
",",
"OneInputStreamOperator",
"<",
"T",
",",
"R",
">",
"operator",
"... | Method for passing user defined operators along with the type
information that will transform the DataStream.
@param operatorName
name of the operator, for logging purposes
@param outTypeInfo
the output type of the operator
@param operator
the object containing the transformation logic
@param <R>
type of the return stream
@return the data stream constructed | [
"Method",
"for",
"passing",
"user",
"defined",
"operators",
"along",
"with",
"the",
"type",
"information",
"that",
"will",
"transform",
"the",
"DataStream",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L1176-L1195 | train | Creates a new OneInputTransformation instance and adds it to the execution environment. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
1026,
1054,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
10938,
1006,
5164,
6872,
18442,
1010,
2828,
2378,
14192,
3370,
1026,
1054,
1028,
2041,
13874,
2378,
14876,
1010,
2028,
237... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java | HttpResponseStatus.valueOf | public static HttpResponseStatus valueOf(int code) {
HttpResponseStatus status = valueOf0(code);
return status != null ? status : new HttpResponseStatus(code);
} | java | public static HttpResponseStatus valueOf(int code) {
HttpResponseStatus status = valueOf0(code);
return status != null ? status : new HttpResponseStatus(code);
} | [
"public",
"static",
"HttpResponseStatus",
"valueOf",
"(",
"int",
"code",
")",
"{",
"HttpResponseStatus",
"status",
"=",
"valueOf0",
"(",
"code",
")",
";",
"return",
"status",
"!=",
"null",
"?",
"status",
":",
"new",
"HttpResponseStatus",
"(",
"code",
")",
";... | Returns the {@link HttpResponseStatus} represented by the specified code.
If the specified code is a standard HTTP status code, a cached instance
will be returned. Otherwise, a new instance will be returned. | [
"Returns",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java#L333-L336 | train | Gets a new instance of the class with the specified HTTP status code. | [
30522,
2270,
10763,
8299,
6072,
26029,
8583,
29336,
2271,
3643,
11253,
1006,
20014,
3642,
1007,
1063,
8299,
6072,
26029,
8583,
29336,
2271,
3570,
1027,
3643,
11253,
2692,
1006,
3642,
1007,
1025,
2709,
3570,
999,
1027,
19701,
1029,
3570,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/ExecutionConfig.java | ExecutionConfig.registerTypeWithKryoSerializer | public <T extends Serializer<?> & Serializable>void registerTypeWithKryoSerializer(Class<?> type, T serializer) {
if (type == null || serializer == null) {
throw new NullPointerException("Cannot register null class or serializer.");
}
registeredTypesWithKryoSerializers.put(type, new SerializableSerializer<>(serializer));
} | java | public <T extends Serializer<?> & Serializable>void registerTypeWithKryoSerializer(Class<?> type, T serializer) {
if (type == null || serializer == null) {
throw new NullPointerException("Cannot register null class or serializer.");
}
registeredTypesWithKryoSerializers.put(type, new SerializableSerializer<>(serializer));
} | [
"public",
"<",
"T",
"extends",
"Serializer",
"<",
"?",
">",
"&",
"Serializable",
">",
"void",
"registerTypeWithKryoSerializer",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"T",
"serializer",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"serializer",
"=... | Registers the given type with a Kryo Serializer.
Note that the serializer instance must be serializable (as defined by java.io.Serializable),
because it may be distributed to the worker nodes by java serialization.
@param type The class of the types serialized with the given serializer.
@param serializer The serializer to use. | [
"Registers",
"the",
"given",
"type",
"with",
"a",
"Kryo",
"Serializer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/ExecutionConfig.java#L798-L804 | train | Registers a serializer for the given type. | [
30522,
2270,
1026,
1056,
8908,
7642,
17629,
1026,
1029,
1028,
1004,
7642,
21335,
3468,
1028,
11675,
4236,
13874,
24415,
21638,
7677,
8043,
4818,
17629,
1006,
2465,
1026,
1029,
1028,
2828,
1010,
1056,
7642,
17629,
1007,
1063,
2065,
1006,
282... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/io/SimpleVersionedSerialization.java | SimpleVersionedSerialization.readVersionAndDeSerialize | public static <T> T readVersionAndDeSerialize(SimpleVersionedSerializer<T> serializer, DataInputView in) throws IOException {
checkNotNull(serializer, "serializer");
checkNotNull(in, "in");
final int version = in.readInt();
final int length = in.readInt();
final byte[] data = new byte[length];
in.readFully(data);
return serializer.deserialize(version, data);
} | java | public static <T> T readVersionAndDeSerialize(SimpleVersionedSerializer<T> serializer, DataInputView in) throws IOException {
checkNotNull(serializer, "serializer");
checkNotNull(in, "in");
final int version = in.readInt();
final int length = in.readInt();
final byte[] data = new byte[length];
in.readFully(data);
return serializer.deserialize(version, data);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"readVersionAndDeSerialize",
"(",
"SimpleVersionedSerializer",
"<",
"T",
">",
"serializer",
",",
"DataInputView",
"in",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"serializer",
",",
"\"serializer\"",
")",
";",
... | Deserializes the version and datum from a stream.
<p>This method deserializes data serialized via
{@link #writeVersionAndSerialize(SimpleVersionedSerializer, Object, DataOutputView)}.
<p>The first four bytes will be interpreted as the version. The next four bytes will be
interpreted as the length of the datum bytes, then length-many bytes will be read.
Finally, the datum is deserialized via the {@link SimpleVersionedSerializer#deserialize(int, byte[])}
method.
@param serializer The serializer to serialize the datum with.
@param in The stream to deserialize from. | [
"Deserializes",
"the",
"version",
"and",
"datum",
"from",
"a",
"stream",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/io/SimpleVersionedSerialization.java#L78-L88 | train | Reads the version and de - serialize. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
3191,
27774,
5685,
6155,
11610,
3669,
4371,
1006,
3722,
27774,
2098,
8043,
4818,
17629,
1026,
1056,
1028,
7642,
17629,
1010,
2951,
2378,
18780,
8584,
1999,
1007,
11618,
22834,
10288,
24422,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.gray | public static void gray(Image srcImage, ImageOutputStream destImageStream) throws IORuntimeException {
writeJpg(gray(srcImage), destImageStream);
} | java | public static void gray(Image srcImage, ImageOutputStream destImageStream) throws IORuntimeException {
writeJpg(gray(srcImage), destImageStream);
} | [
"public",
"static",
"void",
"gray",
"(",
"Image",
"srcImage",
",",
"ImageOutputStream",
"destImageStream",
")",
"throws",
"IORuntimeException",
"{",
"writeJpg",
"(",
"gray",
"(",
"srcImage",
")",
",",
"destImageStream",
")",
";",
"}"
] | 彩色转为黑白<br>
此方法并不关闭流
@param srcImage 源图像流
@param destImageStream 目标图像流
@since 3.0.9
@throws IORuntimeException IO异常 | [
"彩色转为黑白<br",
">",
"此方法并不关闭流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L640-L642 | train | Write gray image to image output stream. | [
30522,
2270,
10763,
11675,
3897,
1006,
3746,
5034,
6895,
26860,
1010,
3746,
5833,
18780,
21422,
4078,
3775,
26860,
21422,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
4339,
3501,
26952,
1006,
3897,
1006,
5034,
6895,
26860,
1007,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java | CustomDictionary.reload | public static boolean reload()
{
String path[] = HanLP.Config.CustomDictionaryPath;
if (path == null || path.length == 0) return false;
IOUtil.deleteFile(path[0] + Predefine.BIN_EXT); // 删掉缓存
return loadMainDictionary(path[0]);
} | java | public static boolean reload()
{
String path[] = HanLP.Config.CustomDictionaryPath;
if (path == null || path.length == 0) return false;
IOUtil.deleteFile(path[0] + Predefine.BIN_EXT); // 删掉缓存
return loadMainDictionary(path[0]);
} | [
"public",
"static",
"boolean",
"reload",
"(",
")",
"{",
"String",
"path",
"[",
"]",
"=",
"HanLP",
".",
"Config",
".",
"CustomDictionaryPath",
";",
"if",
"(",
"path",
"==",
"null",
"||",
"path",
".",
"length",
"==",
"0",
")",
"return",
"false",
";",
"... | 热更新(重新加载)<br>
集群环境(或其他IOAdapter)需要自行删除缓存文件(路径 = HanLP.Config.CustomDictionaryPath[0] + Predefine.BIN_EXT)
@return 是否加载成功 | [
"热更新(重新加载)<br",
">",
"集群环境(或其他IOAdapter)需要自行删除缓存文件(路径",
"=",
"HanLP",
".",
"Config",
".",
"CustomDictionaryPath",
"[",
"0",
"]",
"+",
"Predefine",
".",
"BIN_EXT)"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L652-L658 | train | Reload the CRTCTYPE | [
30522,
2270,
10763,
22017,
20898,
2128,
11066,
1006,
1007,
1063,
5164,
4130,
1031,
1033,
1027,
7658,
14277,
1012,
9530,
8873,
2290,
1012,
7661,
29201,
3258,
5649,
15069,
1025,
2065,
1006,
4130,
1027,
1027,
19701,
1064,
1064,
4130,
1012,
309... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.addFile | private static void addFile(InputStream in, String path, ZipOutputStream out) throws UtilException {
if (null == in) {
return;
}
try {
out.putNextEntry(new ZipEntry(path));
IoUtil.copy(in, out);
} catch (IOException e) {
throw new UtilException(e);
} finally {
closeEntry(out);
}
} | java | private static void addFile(InputStream in, String path, ZipOutputStream out) throws UtilException {
if (null == in) {
return;
}
try {
out.putNextEntry(new ZipEntry(path));
IoUtil.copy(in, out);
} catch (IOException e) {
throw new UtilException(e);
} finally {
closeEntry(out);
}
} | [
"private",
"static",
"void",
"addFile",
"(",
"InputStream",
"in",
",",
"String",
"path",
",",
"ZipOutputStream",
"out",
")",
"throws",
"UtilException",
"{",
"if",
"(",
"null",
"==",
"in",
")",
"{",
"return",
";",
"}",
"try",
"{",
"out",
".",
"putNextEntr... | 添加文件流到压缩包,不关闭输入流
@param in 需要压缩的输入流
@param path 压缩的路径
@param out 压缩文件存储对象
@throws UtilException IO异常 | [
"添加文件流到压缩包,不关闭输入流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L820-L832 | train | Adds a file to a zip output stream. | [
30522,
2797,
10763,
11675,
5587,
8873,
2571,
1006,
20407,
25379,
1999,
1010,
5164,
4130,
1010,
14101,
5833,
18780,
21422,
2041,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
2065,
1006,
19701,
1027,
1027,
1999,
1007,
1063,
2709,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.aggregate | public AggregateOperator<T> aggregate(Aggregations agg, int field) {
return new AggregateOperator<>(this, agg, field, Utils.getCallLocationName());
} | java | public AggregateOperator<T> aggregate(Aggregations agg, int field) {
return new AggregateOperator<>(this, agg, field, Utils.getCallLocationName());
} | [
"public",
"AggregateOperator",
"<",
"T",
">",
"aggregate",
"(",
"Aggregations",
"agg",
",",
"int",
"field",
")",
"{",
"return",
"new",
"AggregateOperator",
"<>",
"(",
"this",
",",
"agg",
",",
"field",
",",
"Utils",
".",
"getCallLocationName",
"(",
")",
")"... | Applies an Aggregate transformation on a non-grouped {@link Tuple} {@link DataSet}.
<p><b>Note: Only Tuple DataSets can be aggregated.</b>
The transformation applies a built-in {@link Aggregations Aggregation} on a specified field
of a Tuple DataSet. Additional aggregation functions can be added to the resulting
{@link AggregateOperator} by calling {@link AggregateOperator#and(Aggregations, int)}.
@param agg The built-in aggregation function that is computed.
@param field The index of the Tuple field on which the aggregation function is applied.
@return An AggregateOperator that represents the aggregated DataSet.
@see Tuple
@see Aggregations
@see AggregateOperator
@see DataSet | [
"Applies",
"an",
"Aggregate",
"transformation",
"on",
"a",
"non",
"-",
"grouped",
"{",
"@link",
"Tuple",
"}",
"{",
"@link",
"DataSet",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L339-L341 | train | Create an aggregate operator. | [
30522,
2270,
9572,
25918,
8844,
1026,
1056,
1028,
9572,
1006,
28041,
2015,
12943,
2290,
1010,
20014,
2492,
1007,
1063,
2709,
2047,
9572,
25918,
8844,
1026,
1028,
1006,
2023,
1010,
12943,
2290,
1010,
2492,
1010,
21183,
12146,
1012,
30524,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/listener/TaskListenerManager.java | TaskListenerManager.notifyTaskSucceeded | public void notifyTaskSucceeded(TaskExecutor executor) {
synchronized (listeners) {
int size = listeners.size();
for (int i = 0; i < size; i++) {
TaskListener listenerl = listeners.get(i);
listenerl.onSucceeded(executor);
}
}
} | java | public void notifyTaskSucceeded(TaskExecutor executor) {
synchronized (listeners) {
int size = listeners.size();
for (int i = 0; i < size; i++) {
TaskListener listenerl = listeners.get(i);
listenerl.onSucceeded(executor);
}
}
} | [
"public",
"void",
"notifyTaskSucceeded",
"(",
"TaskExecutor",
"executor",
")",
"{",
"synchronized",
"(",
"listeners",
")",
"{",
"int",
"size",
"=",
"listeners",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
... | 通知所有监听任务启动器成功结束
@param executor {@link TaskExecutor} | [
"通知所有监听任务启动器成功结束"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/listener/TaskListenerManager.java#L59-L67 | train | Notifies all listeners that a task has been successfully completed. | [
30522,
2270,
11675,
2025,
8757,
10230,
5705,
14194,
3401,
19082,
1006,
4708,
10288,
8586,
16161,
2099,
4654,
8586,
16161,
2099,
1007,
1063,
25549,
1006,
13810,
1007,
1063,
20014,
2946,
1027,
13810,
1012,
2946,
1006,
1007,
1025,
2005,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java | VectorizedColumnReader.decodeDictionaryIds | private void decodeDictionaryIds(
int rowId,
int num,
WritableColumnVector column,
WritableColumnVector dictionaryIds) {
switch (descriptor.getPrimitiveType().getPrimitiveTypeName()) {
case INT32:
if (column.dataType() == DataTypes.IntegerType ||
DecimalType.is32BitDecimalType(column.dataType())) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putInt(i, dictionary.decodeToInt(dictionaryIds.getDictId(i)));
}
}
} else if (column.dataType() == DataTypes.ByteType) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putByte(i, (byte) dictionary.decodeToInt(dictionaryIds.getDictId(i)));
}
}
} else if (column.dataType() == DataTypes.ShortType) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putShort(i, (short) dictionary.decodeToInt(dictionaryIds.getDictId(i)));
}
}
} else {
throw constructConvertNotSupportedException(descriptor, column);
}
break;
case INT64:
if (column.dataType() == DataTypes.LongType ||
DecimalType.is64BitDecimalType(column.dataType()) ||
originalType == OriginalType.TIMESTAMP_MICROS) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putLong(i, dictionary.decodeToLong(dictionaryIds.getDictId(i)));
}
}
} else if (originalType == OriginalType.TIMESTAMP_MILLIS) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putLong(i,
DateTimeUtils.fromMillis(dictionary.decodeToLong(dictionaryIds.getDictId(i))));
}
}
} else {
throw constructConvertNotSupportedException(descriptor, column);
}
break;
case FLOAT:
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putFloat(i, dictionary.decodeToFloat(dictionaryIds.getDictId(i)));
}
}
break;
case DOUBLE:
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putDouble(i, dictionary.decodeToDouble(dictionaryIds.getDictId(i)));
}
}
break;
case INT96:
if (column.dataType() == DataTypes.TimestampType) {
if (!shouldConvertTimestamps()) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
Binary v = dictionary.decodeToBinary(dictionaryIds.getDictId(i));
column.putLong(i, ParquetRowConverter.binaryToSQLTimestamp(v));
}
}
} else {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
Binary v = dictionary.decodeToBinary(dictionaryIds.getDictId(i));
long rawTime = ParquetRowConverter.binaryToSQLTimestamp(v);
long adjTime = DateTimeUtils.convertTz(rawTime, convertTz, UTC);
column.putLong(i, adjTime);
}
}
}
} else {
throw constructConvertNotSupportedException(descriptor, column);
}
break;
case BINARY:
// TODO: this is incredibly inefficient as it blows up the dictionary right here. We
// need to do this better. We should probably add the dictionary data to the ColumnVector
// and reuse it across batches. This should mean adding a ByteArray would just update
// the length and offset.
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
Binary v = dictionary.decodeToBinary(dictionaryIds.getDictId(i));
column.putByteArray(i, v.getBytes());
}
}
break;
case FIXED_LEN_BYTE_ARRAY:
// DecimalType written in the legacy mode
if (DecimalType.is32BitDecimalType(column.dataType())) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
Binary v = dictionary.decodeToBinary(dictionaryIds.getDictId(i));
column.putInt(i, (int) ParquetRowConverter.binaryToUnscaledLong(v));
}
}
} else if (DecimalType.is64BitDecimalType(column.dataType())) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
Binary v = dictionary.decodeToBinary(dictionaryIds.getDictId(i));
column.putLong(i, ParquetRowConverter.binaryToUnscaledLong(v));
}
}
} else if (DecimalType.isByteArrayDecimalType(column.dataType())) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
Binary v = dictionary.decodeToBinary(dictionaryIds.getDictId(i));
column.putByteArray(i, v.getBytes());
}
}
} else {
throw constructConvertNotSupportedException(descriptor, column);
}
break;
default:
throw new UnsupportedOperationException(
"Unsupported type: " + descriptor.getPrimitiveType().getPrimitiveTypeName());
}
} | java | private void decodeDictionaryIds(
int rowId,
int num,
WritableColumnVector column,
WritableColumnVector dictionaryIds) {
switch (descriptor.getPrimitiveType().getPrimitiveTypeName()) {
case INT32:
if (column.dataType() == DataTypes.IntegerType ||
DecimalType.is32BitDecimalType(column.dataType())) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putInt(i, dictionary.decodeToInt(dictionaryIds.getDictId(i)));
}
}
} else if (column.dataType() == DataTypes.ByteType) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putByte(i, (byte) dictionary.decodeToInt(dictionaryIds.getDictId(i)));
}
}
} else if (column.dataType() == DataTypes.ShortType) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putShort(i, (short) dictionary.decodeToInt(dictionaryIds.getDictId(i)));
}
}
} else {
throw constructConvertNotSupportedException(descriptor, column);
}
break;
case INT64:
if (column.dataType() == DataTypes.LongType ||
DecimalType.is64BitDecimalType(column.dataType()) ||
originalType == OriginalType.TIMESTAMP_MICROS) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putLong(i, dictionary.decodeToLong(dictionaryIds.getDictId(i)));
}
}
} else if (originalType == OriginalType.TIMESTAMP_MILLIS) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putLong(i,
DateTimeUtils.fromMillis(dictionary.decodeToLong(dictionaryIds.getDictId(i))));
}
}
} else {
throw constructConvertNotSupportedException(descriptor, column);
}
break;
case FLOAT:
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putFloat(i, dictionary.decodeToFloat(dictionaryIds.getDictId(i)));
}
}
break;
case DOUBLE:
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
column.putDouble(i, dictionary.decodeToDouble(dictionaryIds.getDictId(i)));
}
}
break;
case INT96:
if (column.dataType() == DataTypes.TimestampType) {
if (!shouldConvertTimestamps()) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
Binary v = dictionary.decodeToBinary(dictionaryIds.getDictId(i));
column.putLong(i, ParquetRowConverter.binaryToSQLTimestamp(v));
}
}
} else {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
Binary v = dictionary.decodeToBinary(dictionaryIds.getDictId(i));
long rawTime = ParquetRowConverter.binaryToSQLTimestamp(v);
long adjTime = DateTimeUtils.convertTz(rawTime, convertTz, UTC);
column.putLong(i, adjTime);
}
}
}
} else {
throw constructConvertNotSupportedException(descriptor, column);
}
break;
case BINARY:
// TODO: this is incredibly inefficient as it blows up the dictionary right here. We
// need to do this better. We should probably add the dictionary data to the ColumnVector
// and reuse it across batches. This should mean adding a ByteArray would just update
// the length and offset.
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
Binary v = dictionary.decodeToBinary(dictionaryIds.getDictId(i));
column.putByteArray(i, v.getBytes());
}
}
break;
case FIXED_LEN_BYTE_ARRAY:
// DecimalType written in the legacy mode
if (DecimalType.is32BitDecimalType(column.dataType())) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
Binary v = dictionary.decodeToBinary(dictionaryIds.getDictId(i));
column.putInt(i, (int) ParquetRowConverter.binaryToUnscaledLong(v));
}
}
} else if (DecimalType.is64BitDecimalType(column.dataType())) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
Binary v = dictionary.decodeToBinary(dictionaryIds.getDictId(i));
column.putLong(i, ParquetRowConverter.binaryToUnscaledLong(v));
}
}
} else if (DecimalType.isByteArrayDecimalType(column.dataType())) {
for (int i = rowId; i < rowId + num; ++i) {
if (!column.isNullAt(i)) {
Binary v = dictionary.decodeToBinary(dictionaryIds.getDictId(i));
column.putByteArray(i, v.getBytes());
}
}
} else {
throw constructConvertNotSupportedException(descriptor, column);
}
break;
default:
throw new UnsupportedOperationException(
"Unsupported type: " + descriptor.getPrimitiveType().getPrimitiveTypeName());
}
} | [
"private",
"void",
"decodeDictionaryIds",
"(",
"int",
"rowId",
",",
"int",
"num",
",",
"WritableColumnVector",
"column",
",",
"WritableColumnVector",
"dictionaryIds",
")",
"{",
"switch",
"(",
"descriptor",
".",
"getPrimitiveType",
"(",
")",
".",
"getPrimitiveTypeNam... | Reads `num` values into column, decoding the values from `dictionaryIds` and `dictionary`. | [
"Reads",
"num",
"values",
"into",
"column",
"decoding",
"the",
"values",
"from",
"dictionaryIds",
"and",
"dictionary",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java#L256-L390 | train | Decode dictionary ids. | [
30522,
2797,
11675,
21933,
5732,
28097,
5649,
9821,
1006,
20014,
5216,
3593,
1010,
20014,
16371,
2213,
1010,
25697,
3085,
25778,
2819,
2078,
3726,
16761,
5930,
1010,
25697,
3085,
25778,
2819,
2078,
3726,
16761,
9206,
9821,
1007,
1063,
6942,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/UnilateralSortMerger.java | UnilateralSortMerger.spillingMarker | protected static <T> CircularElement<T> spillingMarker() {
@SuppressWarnings("unchecked")
CircularElement<T> c = (CircularElement<T>) SPILLING_MARKER;
return c;
} | java | protected static <T> CircularElement<T> spillingMarker() {
@SuppressWarnings("unchecked")
CircularElement<T> c = (CircularElement<T>) SPILLING_MARKER;
return c;
} | [
"protected",
"static",
"<",
"T",
">",
"CircularElement",
"<",
"T",
">",
"spillingMarker",
"(",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"CircularElement",
"<",
"T",
">",
"c",
"=",
"(",
"CircularElement",
"<",
"T",
">",
")",
"SPILLING_M... | Gets the element that is passed as marker for signal beginning of spilling.
@return The element that is passed as marker for signal beginning of spilling. | [
"Gets",
"the",
"element",
"that",
"is",
"passed",
"as",
"marker",
"for",
"signal",
"beginning",
"of",
"spilling",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/UnilateralSortMerger.java#L719-L723 | train | Returns the spilling marker. | [
30522,
5123,
10763,
1026,
1056,
1028,
8206,
12260,
3672,
1026,
1056,
1028,
18054,
10665,
2121,
1006,
1007,
1063,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
8206,
12260,
3672,
1026,
1056,
1028,
1039,
1027,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/MesosTaskManagerParameters.java | MesosTaskManagerParameters.buildUris | public static List<String> buildUris(Option<String> uris) {
if (uris.isEmpty()) {
return Collections.emptyList();
} else {
List<String> urisList = new ArrayList<>();
for (String uri : uris.get().split(",")) {
urisList.add(uri.trim());
}
return urisList;
}
} | java | public static List<String> buildUris(Option<String> uris) {
if (uris.isEmpty()) {
return Collections.emptyList();
} else {
List<String> urisList = new ArrayList<>();
for (String uri : uris.get().split(",")) {
urisList.add(uri.trim());
}
return urisList;
}
} | [
"public",
"static",
"List",
"<",
"String",
">",
"buildUris",
"(",
"Option",
"<",
"String",
">",
"uris",
")",
"{",
"if",
"(",
"uris",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"else",
"{",
"Li... | Build a list of URIs for providing custom artifacts to Mesos tasks.
@param uris a comma delimited optional string listing artifact URIs | [
"Build",
"a",
"list",
"of",
"URIs",
"for",
"providing",
"custom",
"artifacts",
"to",
"Mesos",
"tasks",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/MesosTaskManagerParameters.java#L528-L538 | train | Build URIs list. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
3857,
9496,
2015,
1006,
5724,
1026,
5164,
1028,
24471,
30524,
1065,
2842,
1063,
2862,
1026,
5164,
1028,
24471,
2483,
9863,
1027,
2047,
9140,
9863,
1026,
1028,
1006,
1007,
1025,
2005,
1006,
5164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/JobLeaderService.java | JobLeaderService.reconnect | public void reconnect(final JobID jobId) {
Preconditions.checkNotNull(jobId, "JobID must not be null.");
final Tuple2<LeaderRetrievalService, JobManagerLeaderListener> jobLeaderService = jobLeaderServices.get(jobId);
if (jobLeaderService != null) {
jobLeaderService.f1.reconnect();
} else {
LOG.info("Cannot reconnect to job {} because it is not registered.", jobId);
}
} | java | public void reconnect(final JobID jobId) {
Preconditions.checkNotNull(jobId, "JobID must not be null.");
final Tuple2<LeaderRetrievalService, JobManagerLeaderListener> jobLeaderService = jobLeaderServices.get(jobId);
if (jobLeaderService != null) {
jobLeaderService.f1.reconnect();
} else {
LOG.info("Cannot reconnect to job {} because it is not registered.", jobId);
}
} | [
"public",
"void",
"reconnect",
"(",
"final",
"JobID",
"jobId",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"jobId",
",",
"\"JobID must not be null.\"",
")",
";",
"final",
"Tuple2",
"<",
"LeaderRetrievalService",
",",
"JobManagerLeaderListener",
">",
"jobLea... | Triggers reconnection to the last known leader of the given job.
@param jobId specifying the job for which to trigger reconnection | [
"Triggers",
"reconnection",
"to",
"the",
"last",
"known",
"leader",
"of",
"the",
"given",
"job",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/JobLeaderService.java#L216-L226 | train | Reconnect to the given job. | [
30522,
2270,
11675,
28667,
18256,
6593,
1006,
2345,
3105,
3593,
3105,
3593,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
3105,
3593,
1010,
1000,
3105,
3593,
2442,
2025,
2022,
19701,
1012,
1000,
1007,
1025,
2345... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java | TypeExtractor.createTypeInfoFromFactory | @SuppressWarnings("unchecked")
private <IN1, IN2, OUT> TypeInformation<OUT> createTypeInfoFromFactory(
Type t, ArrayList<Type> typeHierarchy, TypeInformation<IN1> in1Type, TypeInformation<IN2> in2Type) {
final ArrayList<Type> factoryHierarchy = new ArrayList<>(typeHierarchy);
final TypeInfoFactory<? super OUT> factory = getClosestFactory(factoryHierarchy, t);
if (factory == null) {
return null;
}
final Type factoryDefiningType = factoryHierarchy.get(factoryHierarchy.size() - 1);
// infer possible type parameters from input
final Map<String, TypeInformation<?>> genericParams;
if (factoryDefiningType instanceof ParameterizedType) {
genericParams = new HashMap<>();
final ParameterizedType paramDefiningType = (ParameterizedType) factoryDefiningType;
final Type[] args = typeToClass(paramDefiningType).getTypeParameters();
final TypeInformation<?>[] subtypeInfo = createSubTypesInfo(t, paramDefiningType, factoryHierarchy, in1Type, in2Type, true);
assert subtypeInfo != null;
for (int i = 0; i < subtypeInfo.length; i++) {
genericParams.put(args[i].toString(), subtypeInfo[i]);
}
} else {
genericParams = Collections.emptyMap();
}
final TypeInformation<OUT> createdTypeInfo = (TypeInformation<OUT>) factory.createTypeInfo(t, genericParams);
if (createdTypeInfo == null) {
throw new InvalidTypesException("TypeInfoFactory returned invalid TypeInformation 'null'");
}
return createdTypeInfo;
} | java | @SuppressWarnings("unchecked")
private <IN1, IN2, OUT> TypeInformation<OUT> createTypeInfoFromFactory(
Type t, ArrayList<Type> typeHierarchy, TypeInformation<IN1> in1Type, TypeInformation<IN2> in2Type) {
final ArrayList<Type> factoryHierarchy = new ArrayList<>(typeHierarchy);
final TypeInfoFactory<? super OUT> factory = getClosestFactory(factoryHierarchy, t);
if (factory == null) {
return null;
}
final Type factoryDefiningType = factoryHierarchy.get(factoryHierarchy.size() - 1);
// infer possible type parameters from input
final Map<String, TypeInformation<?>> genericParams;
if (factoryDefiningType instanceof ParameterizedType) {
genericParams = new HashMap<>();
final ParameterizedType paramDefiningType = (ParameterizedType) factoryDefiningType;
final Type[] args = typeToClass(paramDefiningType).getTypeParameters();
final TypeInformation<?>[] subtypeInfo = createSubTypesInfo(t, paramDefiningType, factoryHierarchy, in1Type, in2Type, true);
assert subtypeInfo != null;
for (int i = 0; i < subtypeInfo.length; i++) {
genericParams.put(args[i].toString(), subtypeInfo[i]);
}
} else {
genericParams = Collections.emptyMap();
}
final TypeInformation<OUT> createdTypeInfo = (TypeInformation<OUT>) factory.createTypeInfo(t, genericParams);
if (createdTypeInfo == null) {
throw new InvalidTypesException("TypeInfoFactory returned invalid TypeInformation 'null'");
}
return createdTypeInfo;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"IN1",
",",
"IN2",
",",
"OUT",
">",
"TypeInformation",
"<",
"OUT",
">",
"createTypeInfoFromFactory",
"(",
"Type",
"t",
",",
"ArrayList",
"<",
"Type",
">",
"typeHierarchy",
",",
"TypeInformatio... | Creates type information using a factory if for this type or super types. Returns null otherwise. | [
"Creates",
"type",
"information",
"using",
"a",
"factory",
"if",
"for",
"this",
"type",
"or",
"super",
"types",
".",
"Returns",
"null",
"otherwise",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L1175-L1207 | train | Create TypeInformation from TypeInfoFactory. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2797,
1026,
1999,
2487,
1010,
1999,
2475,
1010,
2041,
1028,
2828,
2378,
14192,
3370,
1026,
2041,
1028,
3443,
13874,
2378,
14876,
19699,
5358,
21450,
1006,
2828... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/metrics/scope/ScopeFormats.java | ScopeFormats.fromConfig | public static ScopeFormats fromConfig(Configuration config) {
String jmFormat = config.getString(MetricOptions.SCOPE_NAMING_JM);
String jmJobFormat = config.getString(MetricOptions.SCOPE_NAMING_JM_JOB);
String tmFormat = config.getString(MetricOptions.SCOPE_NAMING_TM);
String tmJobFormat = config.getString(MetricOptions.SCOPE_NAMING_TM_JOB);
String taskFormat = config.getString(MetricOptions.SCOPE_NAMING_TASK);
String operatorFormat = config.getString(MetricOptions.SCOPE_NAMING_OPERATOR);
return new ScopeFormats(jmFormat, jmJobFormat, tmFormat, tmJobFormat, taskFormat, operatorFormat);
} | java | public static ScopeFormats fromConfig(Configuration config) {
String jmFormat = config.getString(MetricOptions.SCOPE_NAMING_JM);
String jmJobFormat = config.getString(MetricOptions.SCOPE_NAMING_JM_JOB);
String tmFormat = config.getString(MetricOptions.SCOPE_NAMING_TM);
String tmJobFormat = config.getString(MetricOptions.SCOPE_NAMING_TM_JOB);
String taskFormat = config.getString(MetricOptions.SCOPE_NAMING_TASK);
String operatorFormat = config.getString(MetricOptions.SCOPE_NAMING_OPERATOR);
return new ScopeFormats(jmFormat, jmJobFormat, tmFormat, tmJobFormat, taskFormat, operatorFormat);
} | [
"public",
"static",
"ScopeFormats",
"fromConfig",
"(",
"Configuration",
"config",
")",
"{",
"String",
"jmFormat",
"=",
"config",
".",
"getString",
"(",
"MetricOptions",
".",
"SCOPE_NAMING_JM",
")",
";",
"String",
"jmJobFormat",
"=",
"config",
".",
"getString",
"... | Creates the scope formats as defined in the given configuration.
@param config The configuration that defines the formats
@return The ScopeFormats parsed from the configuration | [
"Creates",
"the",
"scope",
"formats",
"as",
"defined",
"in",
"the",
"given",
"configuration",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/scope/ScopeFormats.java#L94-L103 | train | Creates a ScopeFormats object from the configuration. | [
30522,
2270,
10763,
9531,
14192,
11149,
2013,
8663,
8873,
2290,
1006,
9563,
9530,
8873,
2290,
1007,
1063,
5164,
1046,
2213,
14192,
4017,
1027,
9530,
8873,
2290,
1012,
4152,
18886,
3070,
1006,
12046,
7361,
9285,
1012,
9531,
1035,
10324,
1035... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java | CompositeByteBuf.removeComponent | public CompositeByteBuf removeComponent(int cIndex) {
checkComponentIndex(cIndex);
Component comp = components[cIndex];
if (lastAccessed == comp) {
lastAccessed = null;
}
comp.free();
removeComp(cIndex);
if (comp.length() > 0) {
// Only need to call updateComponentOffsets if the length was > 0
updateComponentOffsets(cIndex);
}
return this;
} | java | public CompositeByteBuf removeComponent(int cIndex) {
checkComponentIndex(cIndex);
Component comp = components[cIndex];
if (lastAccessed == comp) {
lastAccessed = null;
}
comp.free();
removeComp(cIndex);
if (comp.length() > 0) {
// Only need to call updateComponentOffsets if the length was > 0
updateComponentOffsets(cIndex);
}
return this;
} | [
"public",
"CompositeByteBuf",
"removeComponent",
"(",
"int",
"cIndex",
")",
"{",
"checkComponentIndex",
"(",
"cIndex",
")",
";",
"Component",
"comp",
"=",
"components",
"[",
"cIndex",
"]",
";",
"if",
"(",
"lastAccessed",
"==",
"comp",
")",
"{",
"lastAccessed",... | Remove the {@link ByteBuf} from the given index.
@param cIndex the index on from which the {@link ByteBuf} will be remove | [
"Remove",
"the",
"{",
"@link",
"ByteBuf",
"}",
"from",
"the",
"given",
"index",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L578-L591 | train | Removes a component from this CompositeByteBuf. | [
30522,
2270,
12490,
3762,
2618,
8569,
2546,
6366,
9006,
29513,
3372,
1006,
20014,
25022,
13629,
2595,
1007,
1063,
4638,
9006,
29513,
16778,
13629,
2595,
1006,
25022,
13629,
2595,
1007,
1025,
6922,
4012,
2361,
1027,
6177,
1031,
25022,
13629,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2Encoder.java | Bzip2Encoder.closeBlock | private void closeBlock(ByteBuf out) {
final Bzip2BlockCompressor blockCompressor = this.blockCompressor;
if (!blockCompressor.isEmpty()) {
blockCompressor.close(out);
final int blockCRC = blockCompressor.crc();
streamCRC = (streamCRC << 1 | streamCRC >>> 31) ^ blockCRC;
}
} | java | private void closeBlock(ByteBuf out) {
final Bzip2BlockCompressor blockCompressor = this.blockCompressor;
if (!blockCompressor.isEmpty()) {
blockCompressor.close(out);
final int blockCRC = blockCompressor.crc();
streamCRC = (streamCRC << 1 | streamCRC >>> 31) ^ blockCRC;
}
} | [
"private",
"void",
"closeBlock",
"(",
"ByteBuf",
"out",
")",
"{",
"final",
"Bzip2BlockCompressor",
"blockCompressor",
"=",
"this",
".",
"blockCompressor",
";",
"if",
"(",
"!",
"blockCompressor",
".",
"isEmpty",
"(",
")",
")",
"{",
"blockCompressor",
".",
"clos... | Close current block and update {@link #streamCRC}. | [
"Close",
"current",
"block",
"and",
"update",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2Encoder.java#L151-L158 | train | Close the block. | [
30522,
2797,
11675,
2485,
23467,
1006,
24880,
8569,
2546,
2041,
1007,
1063,
2345,
1038,
5831,
2361,
2475,
23467,
9006,
20110,
2953,
30524,
1012,
3796,
9006,
20110,
2953,
1025,
2065,
1006,
999,
3796,
9006,
20110,
2953,
1012,
2003,
6633,
1387... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java | TaskMemoryManager.releaseExecutionMemory | public void releaseExecutionMemory(long size, MemoryConsumer consumer) {
logger.debug("Task {} release {} from {}", taskAttemptId, Utils.bytesToString(size), consumer);
memoryManager.releaseExecutionMemory(size, taskAttemptId, consumer.getMode());
} | java | public void releaseExecutionMemory(long size, MemoryConsumer consumer) {
logger.debug("Task {} release {} from {}", taskAttemptId, Utils.bytesToString(size), consumer);
memoryManager.releaseExecutionMemory(size, taskAttemptId, consumer.getMode());
} | [
"public",
"void",
"releaseExecutionMemory",
"(",
"long",
"size",
",",
"MemoryConsumer",
"consumer",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Task {} release {} from {}\"",
",",
"taskAttemptId",
",",
"Utils",
".",
"bytesToString",
"(",
"size",
")",
",",
"consumer"... | Release N bytes of execution memory for a MemoryConsumer. | [
"Release",
"N",
"bytes",
"of",
"execution",
"memory",
"for",
"a",
"MemoryConsumer",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java#L236-L239 | train | Release execution memory from the task attempt. | [
30522,
2270,
11675,
2713,
10288,
8586,
13700,
4168,
5302,
2854,
1006,
2146,
2946,
1010,
3638,
8663,
23545,
2099,
7325,
1007,
1063,
8833,
4590,
1012,
2139,
8569,
2290,
1006,
1000,
4708,
1063,
1065,
2713,
1063,
1065,
2013,
1063,
1065,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java | SqlFunctionUtils.parseUrl | public static String parseUrl(String urlStr, String partToExtract, String key) {
if (!"QUERY".equals(partToExtract)) {
return null;
}
String query = parseUrl(urlStr, partToExtract);
if (query == null) {
return null;
}
Pattern p = Pattern.compile("(&|^)" + Pattern.quote(key) + "=([^&]*)");
Matcher m = p.matcher(query);
if (m.find()) {
return m.group(2);
}
return null;
} | java | public static String parseUrl(String urlStr, String partToExtract, String key) {
if (!"QUERY".equals(partToExtract)) {
return null;
}
String query = parseUrl(urlStr, partToExtract);
if (query == null) {
return null;
}
Pattern p = Pattern.compile("(&|^)" + Pattern.quote(key) + "=([^&]*)");
Matcher m = p.matcher(query);
if (m.find()) {
return m.group(2);
}
return null;
} | [
"public",
"static",
"String",
"parseUrl",
"(",
"String",
"urlStr",
",",
"String",
"partToExtract",
",",
"String",
"key",
")",
"{",
"if",
"(",
"!",
"\"QUERY\"",
".",
"equals",
"(",
"partToExtract",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"que... | Parse url and return various parameter of the URL.
If accept any null arguments, return null.
@param urlStr URL string.
@param partToExtract must be QUERY, or return null.
@param key parameter name.
@return target value. | [
"Parse",
"url",
"and",
"return",
"various",
"parameter",
"of",
"the",
"URL",
".",
"If",
"accept",
"any",
"null",
"arguments",
"return",
"null",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java#L556-L572 | train | Parse a URL into a String. | [
30522,
2270,
10763,
5164,
11968,
3366,
3126,
2140,
1006,
5164,
24471,
4877,
16344,
1010,
5164,
2112,
3406,
10288,
6494,
6593,
1010,
5164,
3145,
1007,
1063,
2065,
1006,
999,
1000,
23032,
1000,
1012,
19635,
1006,
2112,
3406,
10288,
6494,
6593... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java | Task.cancelInvokable | private void cancelInvokable(AbstractInvokable invokable) {
// in case of an exception during execution, we still call "cancel()" on the task
if (invokable != null && invokableHasBeenCanceled.compareAndSet(false, true)) {
try {
invokable.cancel();
}
catch (Throwable t) {
LOG.error("Error while canceling task {}.", taskNameWithSubtask, t);
}
}
} | java | private void cancelInvokable(AbstractInvokable invokable) {
// in case of an exception during execution, we still call "cancel()" on the task
if (invokable != null && invokableHasBeenCanceled.compareAndSet(false, true)) {
try {
invokable.cancel();
}
catch (Throwable t) {
LOG.error("Error while canceling task {}.", taskNameWithSubtask, t);
}
}
} | [
"private",
"void",
"cancelInvokable",
"(",
"AbstractInvokable",
"invokable",
")",
"{",
"// in case of an exception during execution, we still call \"cancel()\" on the task",
"if",
"(",
"invokable",
"!=",
"null",
"&&",
"invokableHasBeenCanceled",
".",
"compareAndSet",
"(",
"fals... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java#L1375-L1385 | train | Cancels the given invokable. | [
30522,
2797,
11675,
17542,
2378,
6767,
2912,
3468,
1006,
10061,
2378,
6767,
2912,
3468,
1999,
6767,
2912,
3468,
1007,
1063,
1013,
1013,
1999,
2553,
1997,
2019,
6453,
2076,
7781,
1010,
2057,
2145,
2655,
1000,
17542,
1006,
1007,
1000,
2006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/IOUtils.java | IOUtils.closeAll | public static void closeAll(Iterable<? extends AutoCloseable> closeables) throws Exception {
if (null != closeables) {
Exception collectedExceptions = null;
for (AutoCloseable closeable : closeables) {
try {
if (null != closeable) {
closeable.close();
}
} catch (Exception e) {
collectedExceptions = ExceptionUtils.firstOrSuppressed(collectedExceptions, e);
}
}
if (null != collectedExceptions) {
throw collectedExceptions;
}
}
} | java | public static void closeAll(Iterable<? extends AutoCloseable> closeables) throws Exception {
if (null != closeables) {
Exception collectedExceptions = null;
for (AutoCloseable closeable : closeables) {
try {
if (null != closeable) {
closeable.close();
}
} catch (Exception e) {
collectedExceptions = ExceptionUtils.firstOrSuppressed(collectedExceptions, e);
}
}
if (null != collectedExceptions) {
throw collectedExceptions;
}
}
} | [
"public",
"static",
"void",
"closeAll",
"(",
"Iterable",
"<",
"?",
"extends",
"AutoCloseable",
">",
"closeables",
")",
"throws",
"Exception",
"{",
"if",
"(",
"null",
"!=",
"closeables",
")",
"{",
"Exception",
"collectedExceptions",
"=",
"null",
";",
"for",
"... | Closes all {@link AutoCloseable} objects in the parameter, suppressing exceptions. Exception will be emitted
after calling close() on every object.
@param closeables iterable with closeables to close.
@throws Exception collected exceptions that occurred during closing | [
"Closes",
"all",
"{",
"@link",
"AutoCloseable",
"}",
"objects",
"in",
"the",
"parameter",
"suppressing",
"exceptions",
".",
"Exception",
"will",
"be",
"emitted",
"after",
"calling",
"close",
"()",
"on",
"every",
"object",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/IOUtils.java#L223-L242 | train | Close all AutoCloseables. | [
30522,
2270,
10763,
11675,
2485,
8095,
1006,
2009,
6906,
3468,
1026,
1029,
8908,
8285,
20464,
9232,
3085,
1028,
2485,
3085,
2015,
1007,
11618,
6453,
1063,
2065,
1006,
19701,
999,
1027,
2485,
3085,
2015,
1007,
1063,
6453,
5067,
10288,
24422,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.copy | public static long copy(ReadableByteChannel in, WritableByteChannel out) throws IORuntimeException {
return copy(in, out, DEFAULT_BUFFER_SIZE);
} | java | public static long copy(ReadableByteChannel in, WritableByteChannel out) throws IORuntimeException {
return copy(in, out, DEFAULT_BUFFER_SIZE);
} | [
"public",
"static",
"long",
"copy",
"(",
"ReadableByteChannel",
"in",
",",
"WritableByteChannel",
"out",
")",
"throws",
"IORuntimeException",
"{",
"return",
"copy",
"(",
"in",
",",
"out",
",",
"DEFAULT_BUFFER_SIZE",
")",
";",
"}"
] | 拷贝流,使用NIO,不会关闭流
@param in {@link ReadableByteChannel}
@param out {@link WritableByteChannel}
@return 拷贝的字节数
@throws IORuntimeException IO异常
@since 4.5.0 | [
"拷贝流,使用NIO,不会关闭流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L236-L238 | train | Copies the contents of the given channel to the given channel. | [
30522,
2270,
10763,
2146,
6100,
1006,
3191,
3085,
3762,
15007,
20147,
2140,
1999,
1010,
25697,
3085,
3762,
15007,
20147,
2140,
2041,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
6100,
1006,
1999,
1010,
2041,
1010,
12398,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDecoder.java | HpackDecoder.decode | public void decode(int streamId, ByteBuf in, Http2Headers headers, boolean validateHeaders) throws Http2Exception {
Http2HeadersSink sink = new Http2HeadersSink(streamId, headers, maxHeaderListSize, validateHeaders);
decode(in, sink);
// Now that we've read all of our headers we can perform the validation steps. We must
// delay throwing until this point to prevent dynamic table corruption.
sink.finish();
} | java | public void decode(int streamId, ByteBuf in, Http2Headers headers, boolean validateHeaders) throws Http2Exception {
Http2HeadersSink sink = new Http2HeadersSink(streamId, headers, maxHeaderListSize, validateHeaders);
decode(in, sink);
// Now that we've read all of our headers we can perform the validation steps. We must
// delay throwing until this point to prevent dynamic table corruption.
sink.finish();
} | [
"public",
"void",
"decode",
"(",
"int",
"streamId",
",",
"ByteBuf",
"in",
",",
"Http2Headers",
"headers",
",",
"boolean",
"validateHeaders",
")",
"throws",
"Http2Exception",
"{",
"Http2HeadersSink",
"sink",
"=",
"new",
"Http2HeadersSink",
"(",
"streamId",
",",
"... | Decode the header block into header fields.
<p>
This method assumes the entire header block is contained in {@code in}. | [
"Decode",
"the",
"header",
"block",
"into",
"header",
"fields",
".",
"<p",
">",
"This",
"method",
"assumes",
"the",
"entire",
"header",
"block",
"is",
"contained",
"in",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDecoder.java#L122-L129 | train | Decodes the given input stream. | [
30522,
2270,
11675,
21933,
3207,
1006,
20014,
5460,
3593,
1010,
24880,
8569,
2546,
1999,
1010,
8299,
2475,
4974,
2545,
20346,
2015,
1010,
22017,
20898,
9398,
3686,
4974,
2545,
1007,
11618,
8299,
2475,
10288,
24422,
1063,
8299,
2475,
4974,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/ThreadLocalRandom.java | ThreadLocalRandom.mix64 | private static long mix64(long z) {
z = (z ^ (z >>> 33)) * 0xff51afd7ed558ccdL;
z = (z ^ (z >>> 33)) * 0xc4ceb9fe1a85ec53L;
return z ^ (z >>> 33);
} | java | private static long mix64(long z) {
z = (z ^ (z >>> 33)) * 0xff51afd7ed558ccdL;
z = (z ^ (z >>> 33)) * 0xc4ceb9fe1a85ec53L;
return z ^ (z >>> 33);
} | [
"private",
"static",
"long",
"mix64",
"(",
"long",
"z",
")",
"{",
"z",
"=",
"(",
"z",
"^",
"(",
"z",
">>>",
"33",
")",
")",
"*",
"0xff51afd7ed558ccd",
"",
"L",
";",
"z",
"=",
"(",
"z",
"^",
"(",
"z",
">>>",
"33",
")",
")",
"*",
"0xc4ceb9fe1a8... | http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/concurrent/ThreadLocalRandom.java | [
"http",
":",
"//",
"gee",
".",
"cs",
".",
"oswego",
".",
"edu",
"/",
"cgi",
"-",
"bin",
"/",
"viewcvs",
".",
"cgi",
"/",
"jsr166",
"/",
"src",
"/",
"main",
"/",
"java",
"/",
"util",
"/",
"concurrent",
"/",
"ThreadLocalRandom",
".",
"java"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ThreadLocalRandom.java#L222-L226 | train | mix64 - 64 - bit | [
30522,
2797,
10763,
2146,
4666,
21084,
1006,
2146,
1062,
1007,
1063,
1062,
1027,
1006,
1062,
1034,
1006,
1062,
1028,
1028,
1028,
3943,
1007,
1007,
1008,
1014,
2595,
4246,
22203,
10354,
2094,
2581,
2098,
24087,
2620,
9468,
19422,
1025,
1062,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityTemplate.java | VelocityTemplate.wrap | public static VelocityTemplate wrap(org.apache.velocity.Template template) {
return (null == template) ? null : new VelocityTemplate(template);
} | java | public static VelocityTemplate wrap(org.apache.velocity.Template template) {
return (null == template) ? null : new VelocityTemplate(template);
} | [
"public",
"static",
"VelocityTemplate",
"wrap",
"(",
"org",
".",
"apache",
".",
"velocity",
".",
"Template",
"template",
")",
"{",
"return",
"(",
"null",
"==",
"template",
")",
"?",
"null",
":",
"new",
"VelocityTemplate",
"(",
"template",
")",
";",
"}"
] | 包装Velocity模板
@param template Velocity的模板对象 {@link org.apache.velocity.Template}
@return {@link VelocityTemplate} | [
"包装Velocity模板"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityTemplate.java#L36-L38 | train | Wrap a Velocity template object in a VelocityTemplate object. | [
30522,
2270,
10763,
10146,
18532,
15725,
10236,
1006,
8917,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/NShort/NShortSegment.java | NShortSegment.biSegment | public List<List<Vertex>> biSegment(char[] sSentence, int nKind, WordNet wordNetOptimum, WordNet wordNetAll)
{
List<List<Vertex>> coarseResult = new LinkedList<List<Vertex>>();
////////////////生成词网////////////////////
generateWordNet(wordNetAll);
// logger.trace("词网大小:" + wordNetAll.size());
// logger.trace("打印词网:\n" + wordNetAll);
///////////////生成词图////////////////////
Graph graph = generateBiGraph(wordNetAll);
// logger.trace(graph.toString());
if (HanLP.Config.DEBUG)
{
System.out.printf("打印词图:%s\n", graph.printByTo());
}
///////////////N-最短路径////////////////////
NShortPath nShortPath = new NShortPath(graph, nKind);
List<int[]> spResult = nShortPath.getNPaths(nKind * 2);
if (spResult.size() == 0)
{
throw new RuntimeException(nKind + "-最短路径求解失败,请检查上面的词网是否存在负圈或悬孤节点");
}
// logger.trace(nKind + "-最短路径");
// for (int[] path : spResult)
// {
// logger.trace(Graph.parseResult(graph.parsePath(path)));
// }
//////////////日期、数字合并策略
for (int[] path : spResult)
{
List<Vertex> vertexes = graph.parsePath(path);
generateWord(vertexes, wordNetOptimum);
coarseResult.add(vertexes);
}
return coarseResult;
} | java | public List<List<Vertex>> biSegment(char[] sSentence, int nKind, WordNet wordNetOptimum, WordNet wordNetAll)
{
List<List<Vertex>> coarseResult = new LinkedList<List<Vertex>>();
////////////////生成词网////////////////////
generateWordNet(wordNetAll);
// logger.trace("词网大小:" + wordNetAll.size());
// logger.trace("打印词网:\n" + wordNetAll);
///////////////生成词图////////////////////
Graph graph = generateBiGraph(wordNetAll);
// logger.trace(graph.toString());
if (HanLP.Config.DEBUG)
{
System.out.printf("打印词图:%s\n", graph.printByTo());
}
///////////////N-最短路径////////////////////
NShortPath nShortPath = new NShortPath(graph, nKind);
List<int[]> spResult = nShortPath.getNPaths(nKind * 2);
if (spResult.size() == 0)
{
throw new RuntimeException(nKind + "-最短路径求解失败,请检查上面的词网是否存在负圈或悬孤节点");
}
// logger.trace(nKind + "-最短路径");
// for (int[] path : spResult)
// {
// logger.trace(Graph.parseResult(graph.parsePath(path)));
// }
//////////////日期、数字合并策略
for (int[] path : spResult)
{
List<Vertex> vertexes = graph.parsePath(path);
generateWord(vertexes, wordNetOptimum);
coarseResult.add(vertexes);
}
return coarseResult;
} | [
"public",
"List",
"<",
"List",
"<",
"Vertex",
">",
">",
"biSegment",
"(",
"char",
"[",
"]",
"sSentence",
",",
"int",
"nKind",
",",
"WordNet",
"wordNetOptimum",
",",
"WordNet",
"wordNetAll",
")",
"{",
"List",
"<",
"List",
"<",
"Vertex",
">>",
"coarseResul... | 二元语言模型分词
@param sSentence 待分词的句子
@param nKind 需要几个结果
@param wordNetOptimum
@param wordNetAll
@return 一系列粗分结果 | [
"二元语言模型分词"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/NShort/NShortSegment.java#L136-L170 | train | This method is used to generate a BI segment of a sentence. | [
30522,
2270,
2862,
1026,
2862,
1026,
19449,
1028,
1028,
20377,
13910,
3672,
1006,
25869,
1031,
1033,
7020,
15781,
5897,
1010,
20014,
25930,
22254,
1010,
2773,
7159,
2773,
7159,
7361,
3775,
27147,
1010,
2773,
7159,
2773,
7159,
8095,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/net/NetworkUtils.java | NetworkUtils.obtainLoopbackIp4Address | public String obtainLoopbackIp4Address() {
final NetworkInterface networkInterface = getLoopBackAndIp4Only();
if (networkInterface != null) {
return networkInterface.getIp4LoopbackOnly().getHostName();
}
final String ipOfIp4LoopBack = getIpOfLoopBackIp4();
if (ipOfIp4LoopBack != null) {
return ipOfIp4LoopBack;
}
if (Platform.getCurrent().is(Platform.UNIX)) {
NetworkInterface linuxLoopback = networkInterfaceProvider.getLoInterface();
if (linuxLoopback != null) {
final InetAddress netAddress = linuxLoopback.getIp4LoopbackOnly();
if (netAddress != null) {
return netAddress.getHostAddress();
}
}
}
throw new WebDriverException(
"Unable to resolve local loopback address, please file an issue with the full message of this error:\n"
+
getNetWorkDiags() + "\n==== End of error message");
} | java | public String obtainLoopbackIp4Address() {
final NetworkInterface networkInterface = getLoopBackAndIp4Only();
if (networkInterface != null) {
return networkInterface.getIp4LoopbackOnly().getHostName();
}
final String ipOfIp4LoopBack = getIpOfLoopBackIp4();
if (ipOfIp4LoopBack != null) {
return ipOfIp4LoopBack;
}
if (Platform.getCurrent().is(Platform.UNIX)) {
NetworkInterface linuxLoopback = networkInterfaceProvider.getLoInterface();
if (linuxLoopback != null) {
final InetAddress netAddress = linuxLoopback.getIp4LoopbackOnly();
if (netAddress != null) {
return netAddress.getHostAddress();
}
}
}
throw new WebDriverException(
"Unable to resolve local loopback address, please file an issue with the full message of this error:\n"
+
getNetWorkDiags() + "\n==== End of error message");
} | [
"public",
"String",
"obtainLoopbackIp4Address",
"(",
")",
"{",
"final",
"NetworkInterface",
"networkInterface",
"=",
"getLoopBackAndIp4Only",
"(",
")",
";",
"if",
"(",
"networkInterface",
"!=",
"null",
")",
"{",
"return",
"networkInterface",
".",
"getIp4LoopbackOnly",... | Returns a single address that is guaranteed to resolve to an ipv4 representation of localhost
This may either be a hostname or an ip address, depending if we can guarantee what that the
hostname will resolve to ip4.
@return The address part og such an address | [
"Returns",
"a",
"single",
"address",
"that",
"is",
"guaranteed",
"to",
"resolve",
"to",
"an",
"ipv4",
"representation",
"of",
"localhost",
"This",
"may",
"either",
"be",
"a",
"hostname",
"or",
"an",
"ip",
"address",
"depending",
"if",
"we",
"can",
"guarantee... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/net/NetworkUtils.java#L115-L140 | train | Get the local loopback address. | [
30522,
2270,
5164,
6855,
4135,
7361,
5963,
11514,
2549,
4215,
16200,
4757,
1006,
1007,
1063,
2345,
2897,
18447,
2121,
12172,
2897,
18447,
2121,
12172,
1027,
2131,
4135,
7361,
5963,
5685,
11514,
2549,
2239,
2135,
1006,
1007,
1025,
2065,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/JoinNode.java | JoinNode.computeOperatorSpecificDefaultEstimates | @Override
protected void computeOperatorSpecificDefaultEstimates(DataStatistics statistics) {
long card1 = getFirstPredecessorNode().getEstimatedNumRecords();
long card2 = getSecondPredecessorNode().getEstimatedNumRecords();
this.estimatedNumRecords = (card1 < 0 || card2 < 0) ? -1 : Math.max(card1, card2);
if (this.estimatedNumRecords >= 0) {
float width1 = getFirstPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
float width2 = getSecondPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
float width = (width1 <= 0 || width2 <= 0) ? -1 : width1 + width2;
if (width > 0) {
this.estimatedOutputSize = (long) (width * this.estimatedNumRecords);
}
}
} | java | @Override
protected void computeOperatorSpecificDefaultEstimates(DataStatistics statistics) {
long card1 = getFirstPredecessorNode().getEstimatedNumRecords();
long card2 = getSecondPredecessorNode().getEstimatedNumRecords();
this.estimatedNumRecords = (card1 < 0 || card2 < 0) ? -1 : Math.max(card1, card2);
if (this.estimatedNumRecords >= 0) {
float width1 = getFirstPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
float width2 = getSecondPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
float width = (width1 <= 0 || width2 <= 0) ? -1 : width1 + width2;
if (width > 0) {
this.estimatedOutputSize = (long) (width * this.estimatedNumRecords);
}
}
} | [
"@",
"Override",
"protected",
"void",
"computeOperatorSpecificDefaultEstimates",
"(",
"DataStatistics",
"statistics",
")",
"{",
"long",
"card1",
"=",
"getFirstPredecessorNode",
"(",
")",
".",
"getEstimatedNumRecords",
"(",
")",
";",
"long",
"card2",
"=",
"getSecondPre... | The default estimates build on the principle of inclusion: The smaller input key domain is included in the larger
input key domain. We also assume that every key from the larger input has one join partner in the smaller input.
The result cardinality is hence the larger one. | [
"The",
"default",
"estimates",
"build",
"on",
"the",
"principle",
"of",
"inclusion",
":",
"The",
"smaller",
"input",
"key",
"domain",
"is",
"included",
"in",
"the",
"larger",
"input",
"key",
"domain",
".",
"We",
"also",
"assume",
"that",
"every",
"key",
"f... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/JoinNode.java#L97-L112 | train | Compute the default estimates for the operator. | [
30522,
1030,
2058,
15637,
5123,
11675,
24134,
25918,
18926,
5051,
6895,
8873,
19797,
12879,
23505,
4355,
21499,
2015,
1006,
2951,
9153,
16774,
6558,
6747,
1007,
1063,
2146,
4003,
2487,
1027,
2131,
8873,
12096,
28139,
3207,
9623,
21748,
3630,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.roundDown | public static BigDecimal roundDown(BigDecimal value, int scale) {
return round(value, scale, RoundingMode.DOWN);
} | java | public static BigDecimal roundDown(BigDecimal value, int scale) {
return round(value, scale, RoundingMode.DOWN);
} | [
"public",
"static",
"BigDecimal",
"roundDown",
"(",
"BigDecimal",
"value",
",",
"int",
"scale",
")",
"{",
"return",
"round",
"(",
"value",
",",
"scale",
",",
"RoundingMode",
".",
"DOWN",
")",
";",
"}"
] | 保留固定小数位数,舍去多余位数
@param value 需要科学计算的数据
@param scale 保留的小数位
@return 结果
@since 4.1.0 | [
"保留固定小数位数,舍去多余位数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L969-L971 | train | Round down the given value. | [
30522,
2270,
10763,
2502,
3207,
6895,
9067,
2461,
7698,
1006,
2502,
3207,
6895,
9067,
3643,
1010,
20014,
4094,
1007,
1063,
2709,
2461,
1006,
3643,
1010,
4094,
1010,
26939,
5302,
3207,
1012,
2091,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/ChannelOption.java | ChannelOption.newInstance | @Deprecated
@SuppressWarnings("unchecked")
public static <T> ChannelOption<T> newInstance(String name) {
return (ChannelOption<T>) pool.newInstance(name);
} | java | @Deprecated
@SuppressWarnings("unchecked")
public static <T> ChannelOption<T> newInstance(String name) {
return (ChannelOption<T>) pool.newInstance(name);
} | [
"@",
"Deprecated",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"ChannelOption",
"<",
"T",
">",
"newInstance",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"ChannelOption",
"<",
"T",
">",
")",
"pool",
".",
"ne... | Creates a new {@link ChannelOption} for the given {@code name} or fail with an
{@link IllegalArgumentException} if a {@link ChannelOption} for the given {@code name} exists.
@deprecated use {@link #valueOf(String)}. | [
"Creates",
"a",
"new",
"{",
"@link",
"ChannelOption",
"}",
"for",
"the",
"given",
"{",
"@code",
"name",
"}",
"or",
"fail",
"with",
"an",
"{",
"@link",
"IllegalArgumentException",
"}",
"if",
"a",
"{",
"@link",
"ChannelOption",
"}",
"for",
"the",
"given",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/ChannelOption.java#L71-L75 | train | Create a new instance of the CID class. | [
30522,
1030,
2139,
28139,
12921,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
3149,
7361,
3508,
1026,
1056,
1028,
2047,
7076,
26897,
1006,
5164,
2171,
1007,
1063,
2709,
1006,
3149,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonEnvironmentFactory.java | PythonEnvironmentFactory.create_remote_execution_environment | public PythonStreamExecutionEnvironment create_remote_execution_environment(
String host, int port, String... jar_files) {
return new PythonStreamExecutionEnvironment(
StreamExecutionEnvironment.createRemoteEnvironment(host, port, jar_files), new Path(localTmpPath), scriptName);
} | java | public PythonStreamExecutionEnvironment create_remote_execution_environment(
String host, int port, String... jar_files) {
return new PythonStreamExecutionEnvironment(
StreamExecutionEnvironment.createRemoteEnvironment(host, port, jar_files), new Path(localTmpPath), scriptName);
} | [
"public",
"PythonStreamExecutionEnvironment",
"create_remote_execution_environment",
"(",
"String",
"host",
",",
"int",
"port",
",",
"String",
"...",
"jar_files",
")",
"{",
"return",
"new",
"PythonStreamExecutionEnvironment",
"(",
"StreamExecutionEnvironment",
".",
"createR... | A thin wrapper layer over {@link StreamExecutionEnvironment#createRemoteEnvironment(String, int, String...)}.
@param host The host name or address of the master (JobManager), where the
program should be executed.
@param port The port of the master (JobManager), where the program should
be executed.
@param jar_files The JAR files with code that needs to be shipped to the
cluster. If the program uses user-defined functions,
user-defined input formats, or any libraries, those must be
provided in the JAR files.
@return A remote environment that executes the program on a cluster. | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"StreamExecutionEnvironment#createRemoteEnvironment",
"(",
"String",
"int",
"String",
"...",
")",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonEnvironmentFactory.java#L92-L96 | train | Create a remote environment. | [
30522,
2270,
18750,
21422,
10288,
8586,
13700,
2368,
21663,
2239,
3672,
3443,
1035,
6556,
1035,
7781,
1035,
4044,
1006,
5164,
3677,
1010,
20014,
3417,
1010,
5164,
1012,
1012,
1012,
15723,
1035,
6764,
1007,
1063,
2709,
2047,
18750,
21422,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.set | public HttpHeaders set(CharSequence name, Iterable<?> values) {
return set(name.toString(), values);
} | java | public HttpHeaders set(CharSequence name, Iterable<?> values) {
return set(name.toString(), values);
} | [
"public",
"HttpHeaders",
"set",
"(",
"CharSequence",
"name",
",",
"Iterable",
"<",
"?",
">",
"values",
")",
"{",
"return",
"set",
"(",
"name",
".",
"toString",
"(",
")",
",",
"values",
")",
";",
"}"
] | Sets a header with the specified name and values.
If there is an existing header with the same name, it is removed.
This getMethod can be represented approximately as the following code:
<pre>
headers.remove(name);
for (Object v: values) {
if (v == null) {
break;
}
headers.add(name, v);
}
</pre>
@param name The name of the headers being set
@param values The values of the headers being set
@return {@code this} | [
"Sets",
"a",
"header",
"with",
"the",
"specified",
"name",
"and",
"values",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1486-L1488 | train | Sets the value of the specified header field with the specified values. | [
30522,
2270,
8299,
4974,
2545,
2275,
1006,
25869,
3366,
4226,
5897,
2171,
1010,
2009,
6906,
3468,
1026,
1029,
1028,
5300,
1007,
1063,
2709,
2275,
1006,
2171,
1012,
2000,
3367,
4892,
1006,
1007,
1010,
5300,
1007,
1025,
1065,
102,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeMapData.java | UnsafeMapData.pointTo | public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) {
// Read the numBytes of key array from the first 8 bytes.
final long keyArraySize = Platform.getLong(baseObject, baseOffset);
assert keyArraySize >= 0 : "keyArraySize (" + keyArraySize + ") should >= 0";
assert keyArraySize <= Integer.MAX_VALUE :
"keyArraySize (" + keyArraySize + ") should <= Integer.MAX_VALUE";
final int valueArraySize = sizeInBytes - (int)keyArraySize - 8;
assert valueArraySize >= 0 : "valueArraySize (" + valueArraySize + ") should >= 0";
keys.pointTo(baseObject, baseOffset + 8, (int)keyArraySize);
values.pointTo(baseObject, baseOffset + 8 + keyArraySize, valueArraySize);
assert keys.numElements() == values.numElements();
this.baseObject = baseObject;
this.baseOffset = baseOffset;
this.sizeInBytes = sizeInBytes;
} | java | public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) {
// Read the numBytes of key array from the first 8 bytes.
final long keyArraySize = Platform.getLong(baseObject, baseOffset);
assert keyArraySize >= 0 : "keyArraySize (" + keyArraySize + ") should >= 0";
assert keyArraySize <= Integer.MAX_VALUE :
"keyArraySize (" + keyArraySize + ") should <= Integer.MAX_VALUE";
final int valueArraySize = sizeInBytes - (int)keyArraySize - 8;
assert valueArraySize >= 0 : "valueArraySize (" + valueArraySize + ") should >= 0";
keys.pointTo(baseObject, baseOffset + 8, (int)keyArraySize);
values.pointTo(baseObject, baseOffset + 8 + keyArraySize, valueArraySize);
assert keys.numElements() == values.numElements();
this.baseObject = baseObject;
this.baseOffset = baseOffset;
this.sizeInBytes = sizeInBytes;
} | [
"public",
"void",
"pointTo",
"(",
"Object",
"baseObject",
",",
"long",
"baseOffset",
",",
"int",
"sizeInBytes",
")",
"{",
"// Read the numBytes of key array from the first 8 bytes.",
"final",
"long",
"keyArraySize",
"=",
"Platform",
".",
"getLong",
"(",
"baseObject",
... | Update this UnsafeMapData to point to different backing data.
@param baseObject the base object
@param baseOffset the offset within the base object
@param sizeInBytes the size of this map's backing data, in bytes | [
"Update",
"this",
"UnsafeMapData",
"to",
"point",
"to",
"different",
"backing",
"data",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeMapData.java#L81-L98 | train | Point the contents of this block to the specified byte array. | [
30522,
2270,
11675,
2391,
3406,
1006,
4874,
2918,
16429,
20614,
1010,
2146,
2918,
27475,
3388,
1010,
20014,
2946,
2378,
3762,
4570,
1007,
1063,
1013,
1013,
3191,
1996,
15903,
17250,
2015,
1997,
3145,
9140,
2013,
1996,
2034,
1022,
27507,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/socket/nio/NioChannelOption.java | NioChannelOption.setOption | static <T> boolean setOption(Channel jdkChannel, NioChannelOption<T> option, T value) {
java.nio.channels.NetworkChannel channel = (java.nio.channels.NetworkChannel) jdkChannel;
if (!channel.supportedOptions().contains(option.option)) {
return false;
}
if (channel instanceof ServerSocketChannel && option.option == java.net.StandardSocketOptions.IP_TOS) {
// Skip IP_TOS as a workaround for a JDK bug:
// See http://mail.openjdk.java.net/pipermail/nio-dev/2018-August/005365.html
return false;
}
try {
channel.setOption(option.option, value);
return true;
} catch (IOException e) {
throw new ChannelException(e);
}
} | java | static <T> boolean setOption(Channel jdkChannel, NioChannelOption<T> option, T value) {
java.nio.channels.NetworkChannel channel = (java.nio.channels.NetworkChannel) jdkChannel;
if (!channel.supportedOptions().contains(option.option)) {
return false;
}
if (channel instanceof ServerSocketChannel && option.option == java.net.StandardSocketOptions.IP_TOS) {
// Skip IP_TOS as a workaround for a JDK bug:
// See http://mail.openjdk.java.net/pipermail/nio-dev/2018-August/005365.html
return false;
}
try {
channel.setOption(option.option, value);
return true;
} catch (IOException e) {
throw new ChannelException(e);
}
} | [
"static",
"<",
"T",
">",
"boolean",
"setOption",
"(",
"Channel",
"jdkChannel",
",",
"NioChannelOption",
"<",
"T",
">",
"option",
",",
"T",
"value",
")",
"{",
"java",
".",
"nio",
".",
"channels",
".",
"NetworkChannel",
"channel",
"=",
"(",
"java",
".",
... | Internal helper methods to remove code duplication between Nio*Channel implementations. | [
"Internal",
"helper",
"methods",
"to",
"remove",
"code",
"duplication",
"between",
"Nio",
"*",
"Channel",
"implementations",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/socket/nio/NioChannelOption.java#L56-L72 | train | Sets the option on the given channel. | [
30522,
10763,
1026,
1056,
1028,
22017,
20898,
2275,
7361,
3508,
1006,
3149,
26219,
2243,
26058,
1010,
9152,
11663,
20147,
4135,
16790,
1026,
1056,
1028,
5724,
1010,
1056,
3643,
1007,
1063,
9262,
1012,
30524,
3149,
1012,
3569,
7361,
9285,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/chaining/ChainedAllReduceDriver.java | ChainedAllReduceDriver.setup | @Override
public void setup(AbstractInvokable parent) {
@SuppressWarnings("unchecked")
final ReduceFunction<IT> red = BatchTask.instantiateUserCode(this.config, userCodeClassLoader, ReduceFunction.class);
this.reducer = red;
FunctionUtils.setFunctionRuntimeContext(red, getUdfRuntimeContext());
TypeSerializerFactory<IT> serializerFactory = this.config.getInputSerializer(0, userCodeClassLoader);
this.serializer = serializerFactory.getSerializer();
if (LOG.isDebugEnabled()) {
LOG.debug("ChainedAllReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + ".");
}
} | java | @Override
public void setup(AbstractInvokable parent) {
@SuppressWarnings("unchecked")
final ReduceFunction<IT> red = BatchTask.instantiateUserCode(this.config, userCodeClassLoader, ReduceFunction.class);
this.reducer = red;
FunctionUtils.setFunctionRuntimeContext(red, getUdfRuntimeContext());
TypeSerializerFactory<IT> serializerFactory = this.config.getInputSerializer(0, userCodeClassLoader);
this.serializer = serializerFactory.getSerializer();
if (LOG.isDebugEnabled()) {
LOG.debug("ChainedAllReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + ".");
}
} | [
"@",
"Override",
"public",
"void",
"setup",
"(",
"AbstractInvokable",
"parent",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"final",
"ReduceFunction",
"<",
"IT",
">",
"red",
"=",
"BatchTask",
".",
"instantiateUserCode",
"(",
"this",
".",
"con... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/chaining/ChainedAllReduceDriver.java#L41-L54 | train | Setup the chain of all reduce drivers. | [
30522,
1030,
2058,
15637,
2270,
11675,
16437,
1006,
10061,
2378,
6767,
2912,
3468,
6687,
1007,
1063,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2345,
5547,
11263,
27989,
1026,
2009,
1028,
2417,
1027,
14108,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/dialect/oracle/clause/OracleForClauseParser.java | OracleForClauseParser.parse | public void parse(final SelectStatement selectStatement) {
if (!lexerEngine.skipIfEqual(DefaultKeyword.FOR)) {
return;
}
lexerEngine.accept(DefaultKeyword.UPDATE);
if (lexerEngine.skipIfEqual(DefaultKeyword.OF)) {
do {
basicExpressionParser.parse(selectStatement);
} while (lexerEngine.skipIfEqual(Symbol.COMMA));
}
if (lexerEngine.equalAny(OracleKeyword.NOWAIT, OracleKeyword.WAIT)) {
lexerEngine.nextToken();
} else if (lexerEngine.skipIfEqual(OracleKeyword.SKIP)) {
lexerEngine.accept(OracleKeyword.LOCKED);
}
} | java | public void parse(final SelectStatement selectStatement) {
if (!lexerEngine.skipIfEqual(DefaultKeyword.FOR)) {
return;
}
lexerEngine.accept(DefaultKeyword.UPDATE);
if (lexerEngine.skipIfEqual(DefaultKeyword.OF)) {
do {
basicExpressionParser.parse(selectStatement);
} while (lexerEngine.skipIfEqual(Symbol.COMMA));
}
if (lexerEngine.equalAny(OracleKeyword.NOWAIT, OracleKeyword.WAIT)) {
lexerEngine.nextToken();
} else if (lexerEngine.skipIfEqual(OracleKeyword.SKIP)) {
lexerEngine.accept(OracleKeyword.LOCKED);
}
} | [
"public",
"void",
"parse",
"(",
"final",
"SelectStatement",
"selectStatement",
")",
"{",
"if",
"(",
"!",
"lexerEngine",
".",
"skipIfEqual",
"(",
"DefaultKeyword",
".",
"FOR",
")",
")",
"{",
"return",
";",
"}",
"lexerEngine",
".",
"accept",
"(",
"DefaultKeywo... | Parse for.
@param selectStatement select statement | [
"Parse",
"for",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/dialect/oracle/clause/OracleForClauseParser.java#L50-L65 | train | Parse a SELECT statement. | [
30522,
2270,
11675,
11968,
3366,
1006,
2345,
27034,
12259,
3672,
27034,
12259,
3672,
1007,
1063,
2065,
1006,
999,
17244,
7869,
3070,
3170,
1012,
13558,
29323,
26426,
1006,
12398,
14839,
18351,
1012,
2005,
1007,
1007,
1063,
2709,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java | UnsafeExternalSorter.insertKVRecord | public void insertKVRecord(Object keyBase, long keyOffset, int keyLen,
Object valueBase, long valueOffset, int valueLen, long prefix, boolean prefixIsNull)
throws IOException {
growPointerArrayIfNecessary();
int uaoSize = UnsafeAlignedOffset.getUaoSize();
final int required = keyLen + valueLen + (2 * uaoSize);
acquireNewPageIfNecessary(required);
final Object base = currentPage.getBaseObject();
final long recordAddress = taskMemoryManager.encodePageNumberAndOffset(currentPage, pageCursor);
UnsafeAlignedOffset.putSize(base, pageCursor, keyLen + valueLen + uaoSize);
pageCursor += uaoSize;
UnsafeAlignedOffset.putSize(base, pageCursor, keyLen);
pageCursor += uaoSize;
Platform.copyMemory(keyBase, keyOffset, base, pageCursor, keyLen);
pageCursor += keyLen;
Platform.copyMemory(valueBase, valueOffset, base, pageCursor, valueLen);
pageCursor += valueLen;
assert(inMemSorter != null);
inMemSorter.insertRecord(recordAddress, prefix, prefixIsNull);
} | java | public void insertKVRecord(Object keyBase, long keyOffset, int keyLen,
Object valueBase, long valueOffset, int valueLen, long prefix, boolean prefixIsNull)
throws IOException {
growPointerArrayIfNecessary();
int uaoSize = UnsafeAlignedOffset.getUaoSize();
final int required = keyLen + valueLen + (2 * uaoSize);
acquireNewPageIfNecessary(required);
final Object base = currentPage.getBaseObject();
final long recordAddress = taskMemoryManager.encodePageNumberAndOffset(currentPage, pageCursor);
UnsafeAlignedOffset.putSize(base, pageCursor, keyLen + valueLen + uaoSize);
pageCursor += uaoSize;
UnsafeAlignedOffset.putSize(base, pageCursor, keyLen);
pageCursor += uaoSize;
Platform.copyMemory(keyBase, keyOffset, base, pageCursor, keyLen);
pageCursor += keyLen;
Platform.copyMemory(valueBase, valueOffset, base, pageCursor, valueLen);
pageCursor += valueLen;
assert(inMemSorter != null);
inMemSorter.insertRecord(recordAddress, prefix, prefixIsNull);
} | [
"public",
"void",
"insertKVRecord",
"(",
"Object",
"keyBase",
",",
"long",
"keyOffset",
",",
"int",
"keyLen",
",",
"Object",
"valueBase",
",",
"long",
"valueOffset",
",",
"int",
"valueLen",
",",
"long",
"prefix",
",",
"boolean",
"prefixIsNull",
")",
"throws",
... | Write a key-value record to the sorter. The key and value will be put together in-memory,
using the following format:
record length (4 bytes), key length (4 bytes), key data, value data
record length = key length + value length + 4 | [
"Write",
"a",
"key",
"-",
"value",
"record",
"to",
"the",
"sorter",
".",
"The",
"key",
"and",
"value",
"will",
"be",
"put",
"together",
"in",
"-",
"memory",
"using",
"the",
"following",
"format",
":"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L424-L446 | train | Insert a single KeyValue record into the record store. | [
30522,
2270,
11675,
19274,
2243,
12229,
27108,
2094,
1006,
4874,
3145,
15058,
1010,
2146,
3145,
27475,
3388,
1010,
20014,
3145,
7770,
1010,
4874,
3643,
15058,
1010,
2146,
3643,
27475,
3388,
1010,
20014,
3643,
7770,
1010,
2146,
17576,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeutils/NestedSerializersSnapshotDelegate.java | NestedSerializersSnapshotDelegate.getRestoredNestedSerializer | public <T> TypeSerializer<T> getRestoredNestedSerializer(int pos) {
checkArgument(pos < nestedSnapshots.length);
@SuppressWarnings("unchecked")
TypeSerializerSnapshot<T> snapshot = (TypeSerializerSnapshot<T>) nestedSnapshots[pos];
return snapshot.restoreSerializer();
} | java | public <T> TypeSerializer<T> getRestoredNestedSerializer(int pos) {
checkArgument(pos < nestedSnapshots.length);
@SuppressWarnings("unchecked")
TypeSerializerSnapshot<T> snapshot = (TypeSerializerSnapshot<T>) nestedSnapshots[pos];
return snapshot.restoreSerializer();
} | [
"public",
"<",
"T",
">",
"TypeSerializer",
"<",
"T",
">",
"getRestoredNestedSerializer",
"(",
"int",
"pos",
")",
"{",
"checkArgument",
"(",
"pos",
"<",
"nestedSnapshots",
".",
"length",
")",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"TypeSeriali... | Creates the restore serializer from the pos-th config snapshot. | [
"Creates",
"the",
"restore",
"serializer",
"from",
"the",
"pos",
"-",
"th",
"config",
"snapshot",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/NestedSerializersSnapshotDelegate.java#L89-L96 | train | Get the serialized type serializer for the given position. | [
30522,
2270,
1026,
1056,
1028,
4127,
11610,
28863,
1026,
1056,
1028,
2131,
28533,
19574,
5267,
3064,
8043,
4818,
17629,
1006,
20014,
13433,
2015,
1007,
1063,
4638,
2906,
22850,
4765,
1006,
13433,
2015,
1026,
9089,
2098,
2015,
2532,
4523,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.titleContains | public static ExpectedCondition<Boolean> titleContains(final String title) {
return new ExpectedCondition<Boolean>() {
private String currentTitle = "";
@Override
public Boolean apply(WebDriver driver) {
currentTitle = driver.getTitle();
return currentTitle != null && currentTitle.contains(title);
}
@Override
public String toString() {
return String.format("title to contain \"%s\". Current title: \"%s\"", title, currentTitle);
}
};
} | java | public static ExpectedCondition<Boolean> titleContains(final String title) {
return new ExpectedCondition<Boolean>() {
private String currentTitle = "";
@Override
public Boolean apply(WebDriver driver) {
currentTitle = driver.getTitle();
return currentTitle != null && currentTitle.contains(title);
}
@Override
public String toString() {
return String.format("title to contain \"%s\". Current title: \"%s\"", title, currentTitle);
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"Boolean",
">",
"titleContains",
"(",
"final",
"String",
"title",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"Boolean",
">",
"(",
")",
"{",
"private",
"String",
"currentTitle",
"=",
"\"\"",
";",
"@",
"O... | An expectation for checking that the title contains a case-sensitive substring
@param title the fragment of title expected
@return true when the title matches, false otherwise | [
"An",
"expectation",
"for",
"checking",
"that",
"the",
"title",
"contains",
"a",
"case",
"-",
"sensitive",
"substring"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L80-L95 | train | An expectation for checking that the title contains the given string. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
2516,
8663,
18249,
2015,
1006,
2345,
5164,
2516,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
1006,
1007,
1063,
2797,
5164,
2783,
3775,
9286,
1027,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/PlatformDependent.java | PlatformDependent.freeDirectNoCleaner | public static void freeDirectNoCleaner(ByteBuffer buffer) {
assert USE_DIRECT_BUFFER_NO_CLEANER;
int capacity = buffer.capacity();
PlatformDependent0.freeMemory(PlatformDependent0.directBufferAddress(buffer));
decrementMemoryCounter(capacity);
} | java | public static void freeDirectNoCleaner(ByteBuffer buffer) {
assert USE_DIRECT_BUFFER_NO_CLEANER;
int capacity = buffer.capacity();
PlatformDependent0.freeMemory(PlatformDependent0.directBufferAddress(buffer));
decrementMemoryCounter(capacity);
} | [
"public",
"static",
"void",
"freeDirectNoCleaner",
"(",
"ByteBuffer",
"buffer",
")",
"{",
"assert",
"USE_DIRECT_BUFFER_NO_CLEANER",
";",
"int",
"capacity",
"=",
"buffer",
".",
"capacity",
"(",
")",
";",
"PlatformDependent0",
".",
"freeMemory",
"(",
"PlatformDependen... | This method <strong>MUST</strong> only be called for {@link ByteBuffer}s that were allocated via
{@link #allocateDirectNoCleaner(int)}. | [
"This",
"method",
"<strong",
">",
"MUST<",
"/",
"strong",
">",
"only",
"be",
"called",
"for",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L654-L660 | train | Free a direct buffer without cleaning it. | [
30522,
2270,
10763,
11675,
10650,
7442,
6593,
3630,
14321,
7231,
2099,
1006,
24880,
8569,
12494,
17698,
1007,
1063,
20865,
2224,
1035,
3622,
1035,
17698,
1035,
2053,
1035,
20133,
1025,
20014,
3977,
1027,
17698,
1012,
3977,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/rule/jaxb/loader/RuleDefinitionFileConstant.java | RuleDefinitionFileConstant.getExtractorRuleDefinitionFileName | public static String getExtractorRuleDefinitionFileName(final String rootDir, final DatabaseType databaseType) {
return Joiner.on('/').join(rootDir, databaseType.name().toLowerCase(), EXTRACTOR_RULE_DEFINITION_FILE_NAME);
} | java | public static String getExtractorRuleDefinitionFileName(final String rootDir, final DatabaseType databaseType) {
return Joiner.on('/').join(rootDir, databaseType.name().toLowerCase(), EXTRACTOR_RULE_DEFINITION_FILE_NAME);
} | [
"public",
"static",
"String",
"getExtractorRuleDefinitionFileName",
"(",
"final",
"String",
"rootDir",
",",
"final",
"DatabaseType",
"databaseType",
")",
"{",
"return",
"Joiner",
".",
"on",
"(",
"'",
"'",
")",
".",
"join",
"(",
"rootDir",
",",
"databaseType",
... | Get extractor rule definition file name.
@param rootDir root dir
@param databaseType database type
@return extractor rule definition file name | [
"Get",
"extractor",
"rule",
"definition",
"file",
"name",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/rule/jaxb/loader/RuleDefinitionFileConstant.java#L65-L67 | train | Gets extractor rule definition file name. | [
30522,
2270,
10763,
5164,
2131,
10288,
6494,
16761,
6820,
3709,
12879,
5498,
3508,
8873,
20844,
4168,
1006,
2345,
5164,
7117,
4305,
2099,
1010,
2345,
7809,
13874,
7809,
13874,
1007,
1063,
2709,
3693,
2121,
1012,
2006,
1006,
1005,
1013,
1005... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java | HttpTunnelServer.getServerThread | protected ServerThread getServerThread() throws IOException {
synchronized (this) {
if (this.serverThread == null) {
ByteChannel channel = this.serverConnection.open(this.longPollTimeout);
this.serverThread = new ServerThread(channel);
this.serverThread.start();
}
return this.serverThread;
}
} | java | protected ServerThread getServerThread() throws IOException {
synchronized (this) {
if (this.serverThread == null) {
ByteChannel channel = this.serverConnection.open(this.longPollTimeout);
this.serverThread = new ServerThread(channel);
this.serverThread.start();
}
return this.serverThread;
}
} | [
"protected",
"ServerThread",
"getServerThread",
"(",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"this",
".",
"serverThread",
"==",
"null",
")",
"{",
"ByteChannel",
"channel",
"=",
"this",
".",
"serverConnection",
".",
... | Returns the active server thread, creating and starting it if necessary.
@return the {@code ServerThread} (never {@code null})
@throws IOException in case of I/O errors | [
"Returns",
"the",
"active",
"server",
"thread",
"creating",
"and",
"starting",
"it",
"if",
"necessary",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java#L168-L177 | train | Get the server thread. | [
30522,
5123,
8241,
2705,
16416,
2094,
4152,
2121,
16874,
28362,
4215,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
25549,
1006,
2023,
1007,
1063,
2065,
1006,
2023,
1012,
8241,
2705,
16416,
2094,
1027,
1027,
19701,
1007,
1063,
24880,
26058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-0.10/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer010.java | FlinkKafkaProducer010.writeToKafkaWithTimestamps | @Deprecated
public static <T> FlinkKafkaProducer010Configuration<T> writeToKafkaWithTimestamps(DataStream<T> inStream,
String topicId,
KeyedSerializationSchema<T> serializationSchema,
Properties producerConfig,
FlinkKafkaPartitioner<T> customPartitioner) {
FlinkKafkaProducer010<T> kafkaProducer = new FlinkKafkaProducer010<>(topicId, serializationSchema, producerConfig, customPartitioner);
DataStreamSink<T> streamSink = inStream.addSink(kafkaProducer);
return new FlinkKafkaProducer010Configuration<>(streamSink, inStream, kafkaProducer);
} | java | @Deprecated
public static <T> FlinkKafkaProducer010Configuration<T> writeToKafkaWithTimestamps(DataStream<T> inStream,
String topicId,
KeyedSerializationSchema<T> serializationSchema,
Properties producerConfig,
FlinkKafkaPartitioner<T> customPartitioner) {
FlinkKafkaProducer010<T> kafkaProducer = new FlinkKafkaProducer010<>(topicId, serializationSchema, producerConfig, customPartitioner);
DataStreamSink<T> streamSink = inStream.addSink(kafkaProducer);
return new FlinkKafkaProducer010Configuration<>(streamSink, inStream, kafkaProducer);
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"T",
">",
"FlinkKafkaProducer010Configuration",
"<",
"T",
">",
"writeToKafkaWithTimestamps",
"(",
"DataStream",
"<",
"T",
">",
"inStream",
",",
"String",
"topicId",
",",
"KeyedSerializationSchema",
"<",
"T",
">",
"serial... | Creates a FlinkKafkaProducer for a given topic. The sink produces a DataStream to
the topic.
<p>This constructor allows writing timestamps to Kafka, it follow approach (b) (see above)
@param inStream The stream to write to Kafka
@param topicId The name of the target topic
@param serializationSchema A serializable serialization schema for turning user objects into a kafka-consumable byte[] supporting key/value messages
@param producerConfig Configuration properties for the KafkaProducer. 'bootstrap.servers.' is the only required argument.
@param customPartitioner A serializable partitioner for assigning messages to Kafka partitions.
@deprecated Use {@link #FlinkKafkaProducer010(String, KeyedSerializationSchema, Properties, FlinkKafkaPartitioner)}
and call {@link #setWriteTimestampToKafka(boolean)}. | [
"Creates",
"a",
"FlinkKafkaProducer",
"for",
"a",
"given",
"topic",
".",
"The",
"sink",
"produces",
"a",
"DataStream",
"to",
"the",
"topic",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.10/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer010.java#L273-L282 | train | Write to Kafka with timestamps | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
1026,
1056,
1028,
13109,
19839,
2912,
24316,
9331,
14127,
18796,
2099,
24096,
2692,
8663,
8873,
27390,
3370,
1026,
1056,
1028,
4339,
18715,
10354,
2912,
24415,
7292,
9153,
25370,
1006,
2951,
21422... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/tokenizer/NotionalTokenizer.java | NotionalTokenizer.seg2sentence | public static List<List<Term>> seg2sentence(String text, boolean shortest)
{
return SEGMENT.seg2sentence(text, shortest);
} | java | public static List<List<Term>> seg2sentence(String text, boolean shortest)
{
return SEGMENT.seg2sentence(text, shortest);
} | [
"public",
"static",
"List",
"<",
"List",
"<",
"Term",
">",
">",
"seg2sentence",
"(",
"String",
"text",
",",
"boolean",
"shortest",
")",
"{",
"return",
"SEGMENT",
".",
"seg2sentence",
"(",
"text",
",",
"shortest",
")",
";",
"}"
] | 分词断句 输出句子形式
@param text 待分词句子
@param shortest 是否断句为最细的子句(将逗号也视作分隔符)
@return 句子列表,每个句子由一个单词列表组成 | [
"分词断句",
"输出句子形式"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/tokenizer/NotionalTokenizer.java#L92-L95 | train | seg2sentence - returns a list of lists of terms from a sentence. | [
30522,
2270,
10763,
2862,
1026,
2862,
1026,
2744,
1028,
1028,
7367,
2290,
2475,
5054,
6528,
3401,
1006,
5164,
3793,
1010,
22017,
20898,
20047,
1007,
1063,
2709,
6903,
1012,
7367,
2290,
2475,
5054,
6528,
3401,
1006,
3793,
1010,
20047,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractPartitionDiscoverer.java | AbstractPartitionDiscoverer.setAndCheckDiscoveredPartition | public boolean setAndCheckDiscoveredPartition(KafkaTopicPartition partition) {
if (isUndiscoveredPartition(partition)) {
discoveredPartitions.add(partition);
return KafkaTopicPartitionAssigner.assign(partition, numParallelSubtasks) == indexOfThisSubtask;
}
return false;
} | java | public boolean setAndCheckDiscoveredPartition(KafkaTopicPartition partition) {
if (isUndiscoveredPartition(partition)) {
discoveredPartitions.add(partition);
return KafkaTopicPartitionAssigner.assign(partition, numParallelSubtasks) == indexOfThisSubtask;
}
return false;
} | [
"public",
"boolean",
"setAndCheckDiscoveredPartition",
"(",
"KafkaTopicPartition",
"partition",
")",
"{",
"if",
"(",
"isUndiscoveredPartition",
"(",
"partition",
")",
")",
"{",
"discoveredPartitions",
".",
"add",
"(",
"partition",
")",
";",
"return",
"KafkaTopicPartit... | Sets a partition as discovered. Partitions are considered as new
if its partition id is larger than all partition ids previously
seen for the topic it belongs to. Therefore, for a set of
discovered partitions, the order that this method is invoked with
each partition is important.
<p>If the partition is indeed newly discovered, this method also returns
whether the new partition should be subscribed by this subtask.
@param partition the partition to set and check
@return {@code true}, if the partition wasn't seen before and should
be subscribed by this subtask; {@code false} otherwise | [
"Sets",
"a",
"partition",
"as",
"discovered",
".",
"Partitions",
"are",
"considered",
"as",
"new",
"if",
"its",
"partition",
"id",
"is",
"larger",
"than",
"all",
"partition",
"ids",
"previously",
"seen",
"for",
"the",
"topic",
"it",
"belongs",
"to",
".",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractPartitionDiscoverer.java#L196-L204 | train | Sets the partition to be checked discovered. | [
30522,
2270,
22017,
20898,
2275,
5685,
5403,
3600,
10521,
3597,
25896,
19362,
3775,
3508,
1006,
10556,
24316,
10610,
24330,
19362,
3775,
3508,
13571,
1007,
1063,
2065,
1006,
2003,
8630,
2483,
3597,
25896,
19362,
3775,
3508,
1006,
13571,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java | ExcelBase.getOrCreateColumnStyle | public CellStyle getOrCreateColumnStyle(int x) {
CellStyle columnStyle = this.sheet.getColumnStyle(x);
if (null == columnStyle) {
columnStyle = this.workbook.createCellStyle();
this.sheet.setDefaultColumnStyle(x, columnStyle);
}
return columnStyle;
} | java | public CellStyle getOrCreateColumnStyle(int x) {
CellStyle columnStyle = this.sheet.getColumnStyle(x);
if (null == columnStyle) {
columnStyle = this.workbook.createCellStyle();
this.sheet.setDefaultColumnStyle(x, columnStyle);
}
return columnStyle;
} | [
"public",
"CellStyle",
"getOrCreateColumnStyle",
"(",
"int",
"x",
")",
"{",
"CellStyle",
"columnStyle",
"=",
"this",
".",
"sheet",
".",
"getColumnStyle",
"(",
"x",
")",
";",
"if",
"(",
"null",
"==",
"columnStyle",
")",
"{",
"columnStyle",
"=",
"this",
".",... | 获取或创建某一行的样式,返回样式后可以设置样式内容
@param x X坐标,从0计数,既列号
@return {@link CellStyle}
@since 4.1.4 | [
"获取或创建某一行的样式,返回样式后可以设置样式内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java#L233-L240 | train | Gets or creates a column style from the worksheet. | [
30522,
2270,
4442,
27983,
2131,
2953,
16748,
3686,
25778,
2819,
23808,
12844,
1006,
20014,
1060,
1007,
1063,
4442,
27983,
7753,
27983,
1027,
2023,
1012,
7123,
1012,
2131,
25778,
2819,
23808,
12844,
1006,
1060,
1007,
1025,
2065,
1006,
19701,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/utils/RefCountedBufferingFileStream.java | RefCountedBufferingFileStream.openNew | public static RefCountedBufferingFileStream openNew(
final FunctionWithException<File, RefCountedFile, IOException> tmpFileProvider) throws IOException {
return new RefCountedBufferingFileStream(
tmpFileProvider.apply(null),
BUFFER_SIZE);
} | java | public static RefCountedBufferingFileStream openNew(
final FunctionWithException<File, RefCountedFile, IOException> tmpFileProvider) throws IOException {
return new RefCountedBufferingFileStream(
tmpFileProvider.apply(null),
BUFFER_SIZE);
} | [
"public",
"static",
"RefCountedBufferingFileStream",
"openNew",
"(",
"final",
"FunctionWithException",
"<",
"File",
",",
"RefCountedFile",
",",
"IOException",
">",
"tmpFileProvider",
")",
"throws",
"IOException",
"{",
"return",
"new",
"RefCountedBufferingFileStream",
"(",... | ------------------------- Factory Methods ------------------------- | [
"-------------------------",
"Factory",
"Methods",
"-------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/utils/RefCountedBufferingFileStream.java#L167-L173 | train | Create a new file stream that can be used to write to a temporary file. | [
30522,
2270,
10763,
25416,
3597,
16671,
2098,
8569,
12494,
30524,
1026,
5371,
1010,
25416,
3597,
16671,
2098,
8873,
2571,
1010,
22834,
10288,
24422,
1028,
1056,
8737,
8873,
2571,
21572,
17258,
2121,
1007,
11618,
22834,
10288,
24422,
1063,
270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | client/src/main/java/com/networknt/client/Http2Client.java | Http2Client.createSSLContext | public static SSLContext createSSLContext() throws IOException {
Map<String, Object> tlsMap = (Map<String, Object>)ClientConfig.get().getMappedConfig().get(TLS);
return null==tlsMap?null:createSSLContext((String)tlsMap.get(TLSConfig.DEFAULT_GROUP_KEY));
} | java | public static SSLContext createSSLContext() throws IOException {
Map<String, Object> tlsMap = (Map<String, Object>)ClientConfig.get().getMappedConfig().get(TLS);
return null==tlsMap?null:createSSLContext((String)tlsMap.get(TLSConfig.DEFAULT_GROUP_KEY));
} | [
"public",
"static",
"SSLContext",
"createSSLContext",
"(",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"tlsMap",
"=",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"ClientConfig",
".",
"get",
"(",
")",
".",
"getMapp... | default method for creating ssl context. trustedNames config is not used.
@return SSLContext
@throws IOException | [
"default",
"method",
"for",
"creating",
"ssl",
"context",
".",
"trustedNames",
"config",
"is",
"not",
"used",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/Http2Client.java#L408-L412 | train | Create an SSLContext for use with the TLS configuration. | [
30522,
2270,
10763,
7020,
22499,
10111,
18413,
9005,
14540,
8663,
18209,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
4949,
1026,
5164,
1010,
4874,
1028,
1056,
4877,
2863,
2361,
1027,
1006,
4949,
1026,
5164,
1010,
4874,
1028,
1007,
7396,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | client/src/main/java/com/networknt/client/oauth/cache/LongestExpireCacheStrategy.java | LongestExpireCacheStrategy.cacheJwt | @Override
public synchronized void cacheJwt(Jwt.Key cachedKey, Jwt jwt) {
//update the expire time
LongestExpireCacheKey leCachKey = new LongestExpireCacheKey(cachedKey);
leCachKey.setExpiry(jwt.getExpire());
if(cachedJwts.size() >= capacity) {
if(expiryQueue.contains(leCachKey)) {
expiryQueue.remove(leCachKey);
} else {
cachedJwts.remove(expiryQueue.peek().getCacheKey());
expiryQueue.poll();
}
} else {
if(expiryQueue.contains(leCachKey)) {
expiryQueue.remove(leCachKey);
}
}
expiryQueue.add(leCachKey);
cachedJwts.put(cachedKey, jwt);
} | java | @Override
public synchronized void cacheJwt(Jwt.Key cachedKey, Jwt jwt) {
//update the expire time
LongestExpireCacheKey leCachKey = new LongestExpireCacheKey(cachedKey);
leCachKey.setExpiry(jwt.getExpire());
if(cachedJwts.size() >= capacity) {
if(expiryQueue.contains(leCachKey)) {
expiryQueue.remove(leCachKey);
} else {
cachedJwts.remove(expiryQueue.peek().getCacheKey());
expiryQueue.poll();
}
} else {
if(expiryQueue.contains(leCachKey)) {
expiryQueue.remove(leCachKey);
}
}
expiryQueue.add(leCachKey);
cachedJwts.put(cachedKey, jwt);
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"cacheJwt",
"(",
"Jwt",
".",
"Key",
"cachedKey",
",",
"Jwt",
"jwt",
")",
"{",
"//update the expire time",
"LongestExpireCacheKey",
"leCachKey",
"=",
"new",
"LongestExpireCacheKey",
"(",
"cachedKey",
")",
";",
"leC... | This method is to cache a jwt LongestExpireCacheStrategy based on a given Jwt.Key and a Jwt.
Every time it updates the expiry time of a jwt, and shift it up to a proper position.
Since the PriorityQueue is implemented by heap, the average O(n) should be O(log n).
@param cachedKey Jwt.Key the key to be used to cache
@param jwt Jwt the jwt to be cached | [
"This",
"method",
"is",
"to",
"cache",
"a",
"jwt",
"LongestExpireCacheStrategy",
"based",
"on",
"a",
"given",
"Jwt",
".",
"Key",
"and",
"a",
"Jwt",
".",
"Every",
"time",
"it",
"updates",
"the",
"expiry",
"time",
"of",
"a",
"jwt",
"and",
"shift",
"it",
... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/cache/LongestExpireCacheStrategy.java#L45-L64 | train | Cache a JWT. | [
30522,
1030,
2058,
15637,
2270,
25549,
11675,
17053,
3501,
26677,
1006,
1046,
26677,
1012,
3145,
17053,
2094,
14839,
1010,
1046,
26677,
1046,
26677,
1007,
1063,
1013,
1013,
10651,
1996,
4654,
20781,
2051,
6493,
10288,
20781,
3540,
5403,
14839... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getBeInt32 | public final int getBeInt32() {
if (position + 3 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 3));
byte[] buf = buffer;
return ((buf[position++]) << 24) | ((0xff & buf[position++]) << 16) | ((0xff & buf[position++]) << 8)
| (0xff & buf[position++]);
} | java | public final int getBeInt32() {
if (position + 3 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 3));
byte[] buf = buffer;
return ((buf[position++]) << 24) | ((0xff & buf[position++]) << 16) | ((0xff & buf[position++]) << 8)
| (0xff & buf[position++]);
} | [
"public",
"final",
"int",
"getBeInt32",
"(",
")",
"{",
"if",
"(",
"position",
"+",
"3",
">=",
"origin",
"+",
"limit",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"(",
"position",
"-",
"origin",
"+",
"3",
")",
")",
";... | Return next 32-bit signed int from buffer. (big-endian)
@see mysql-5.6.10/include/myisampack.h - mi_sint4korr | [
"Return",
"next",
"32",
"-",
"bit",
"signed",
"int",
"from",
"buffer",
".",
"(",
"big",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L515-L522 | train | Gets a signed int from the buffer as an int32. | [
30522,
2270,
2345,
20014,
2131,
19205,
3372,
16703,
1006,
1007,
1063,
2065,
1006,
2597,
1009,
1017,
1028,
1027,
4761,
1009,
5787,
1007,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
5787,
4654,
9468,
13089,
1024,
1000,
1009... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.equalTo | public final boolean equalTo(MemorySegment seg2, int offset1, int offset2, int length) {
int i = 0;
// we assume unaligned accesses are supported.
// Compare 8 bytes at a time.
while (i <= length - 8) {
if (getLong(offset1 + i) != seg2.getLong(offset2 + i)) {
return false;
}
i += 8;
}
// cover the last (length % 8) elements.
while (i < length) {
if (get(offset1 + i) != seg2.get(offset2 + i)) {
return false;
}
i += 1;
}
return true;
} | java | public final boolean equalTo(MemorySegment seg2, int offset1, int offset2, int length) {
int i = 0;
// we assume unaligned accesses are supported.
// Compare 8 bytes at a time.
while (i <= length - 8) {
if (getLong(offset1 + i) != seg2.getLong(offset2 + i)) {
return false;
}
i += 8;
}
// cover the last (length % 8) elements.
while (i < length) {
if (get(offset1 + i) != seg2.get(offset2 + i)) {
return false;
}
i += 1;
}
return true;
} | [
"public",
"final",
"boolean",
"equalTo",
"(",
"MemorySegment",
"seg2",
",",
"int",
"offset1",
",",
"int",
"offset2",
",",
"int",
"length",
")",
"{",
"int",
"i",
"=",
"0",
";",
"// we assume unaligned accesses are supported.",
"// Compare 8 bytes at a time.",
"while"... | Equals two memory segment regions.
@param seg2 Segment to equal this segment with
@param offset1 Offset of this segment to start equaling
@param offset2 Offset of seg2 to start equaling
@param length Length of the equaled memory region
@return true if equal, false otherwise | [
"Equals",
"two",
"memory",
"segment",
"regions",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L1407-L1428 | train | Compare two memory segments. | [
30522,
2270,
2345,
22017,
20898,
5020,
3406,
1006,
3638,
3366,
21693,
4765,
7367,
2290,
2475,
1010,
20014,
16396,
2487,
1010,
20014,
16396,
2475,
1010,
20014,
3091,
1007,
1063,
20014,
1045,
1027,
1014,
1025,
1013,
1013,
2057,
7868,
14477,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/dialect/log4j2/Log4j2Log.java | Log4j2Log.logIfEnabled | private boolean logIfEnabled(String fqcn, Level level, Throwable t, String msgTemplate, Object... arguments) {
if(this.logger instanceof AbstractLogger){
((AbstractLogger)this.logger).logIfEnabled(fqcn, level, null, StrUtil.format(msgTemplate, arguments), t);
return true;
}else{
return false;
}
} | java | private boolean logIfEnabled(String fqcn, Level level, Throwable t, String msgTemplate, Object... arguments) {
if(this.logger instanceof AbstractLogger){
((AbstractLogger)this.logger).logIfEnabled(fqcn, level, null, StrUtil.format(msgTemplate, arguments), t);
return true;
}else{
return false;
}
} | [
"private",
"boolean",
"logIfEnabled",
"(",
"String",
"fqcn",
",",
"Level",
"level",
",",
"Throwable",
"t",
",",
"String",
"msgTemplate",
",",
"Object",
"...",
"arguments",
")",
"{",
"if",
"(",
"this",
".",
"logger",
"instanceof",
"AbstractLogger",
")",
"{",
... | 打印日志<br>
此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题
@param fqcn 完全限定类名(Fully Qualified Class Name),用于纠正定位错误行号
@param level 日志级别,使用org.apache.logging.log4j.Level中的常量
@param t 异常
@param msgTemplate 消息模板
@param arguments 参数
@return 是否支持 LocationAwareLogger对象,如果不支持需要日志方法调用被包装类的相应方法 | [
"打印日志<br",
">",
"此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/dialect/log4j2/Log4j2Log.java#L192-L199 | train | Logs the exception if the logger is enabled. | [
30522,
2797,
22017,
20898,
8833,
29323,
22966,
2094,
1006,
5164,
1042,
4160,
2278,
2078,
1010,
2504,
2504,
1010,
5466,
3085,
1056,
1010,
5164,
5796,
13512,
6633,
15725,
1010,
4874,
1012,
1012,
1012,
9918,
1007,
1063,
2065,
1006,
2023,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getPackedLong | public final long getPackedLong() {
final int lead = getUint8();
if (lead < 251) return lead;
switch (lead) {
case 251:
return NULL_LENGTH;
case 252:
return getUint16();
case 253:
return getUint24();
default: /* Must be 254 when here */
final long value = getUint32();
position += 4; /* ignore other */
return value;
}
} | java | public final long getPackedLong() {
final int lead = getUint8();
if (lead < 251) return lead;
switch (lead) {
case 251:
return NULL_LENGTH;
case 252:
return getUint16();
case 253:
return getUint24();
default: /* Must be 254 when here */
final long value = getUint32();
position += 4; /* ignore other */
return value;
}
} | [
"public",
"final",
"long",
"getPackedLong",
"(",
")",
"{",
"final",
"int",
"lead",
"=",
"getUint8",
"(",
")",
";",
"if",
"(",
"lead",
"<",
"251",
")",
"return",
"lead",
";",
"switch",
"(",
"lead",
")",
"{",
"case",
"251",
":",
"return",
"NULL_LENGTH"... | Return next packed number from buffer. (little-endian)
@see LogBuffer#getPackedLong(int) | [
"Return",
"next",
"packed",
"number",
"from",
"buffer",
".",
"(",
"little",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L1023-L1039 | train | Gets the packed long value. | [
30522,
2270,
2345,
2146,
2131,
23947,
2098,
10052,
1006,
1007,
1063,
2345,
20014,
2599,
1027,
2131,
20023,
2102,
2620,
1006,
1007,
1025,
2065,
1006,
2599,
1026,
22582,
1007,
2709,
2599,
1025,
6942,
30524,
2131,
20023,
2102,
16048,
1006,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SerializedCheckpointData.java | SerializedCheckpointData.fromDeque | public static <T> SerializedCheckpointData[] fromDeque(
ArrayDeque<Tuple2<Long, Set<T>>> checkpoints,
TypeSerializer<T> serializer,
DataOutputSerializer outputBuffer) throws IOException {
SerializedCheckpointData[] serializedCheckpoints = new SerializedCheckpointData[checkpoints.size()];
int pos = 0;
for (Tuple2<Long, Set<T>> checkpoint : checkpoints) {
outputBuffer.clear();
Set<T> checkpointIds = checkpoint.f1;
for (T id : checkpointIds) {
serializer.serialize(id, outputBuffer);
}
serializedCheckpoints[pos++] = new SerializedCheckpointData(
checkpoint.f0, outputBuffer.getCopyOfBuffer(), checkpointIds.size());
}
return serializedCheckpoints;
} | java | public static <T> SerializedCheckpointData[] fromDeque(
ArrayDeque<Tuple2<Long, Set<T>>> checkpoints,
TypeSerializer<T> serializer,
DataOutputSerializer outputBuffer) throws IOException {
SerializedCheckpointData[] serializedCheckpoints = new SerializedCheckpointData[checkpoints.size()];
int pos = 0;
for (Tuple2<Long, Set<T>> checkpoint : checkpoints) {
outputBuffer.clear();
Set<T> checkpointIds = checkpoint.f1;
for (T id : checkpointIds) {
serializer.serialize(id, outputBuffer);
}
serializedCheckpoints[pos++] = new SerializedCheckpointData(
checkpoint.f0, outputBuffer.getCopyOfBuffer(), checkpointIds.size());
}
return serializedCheckpoints;
} | [
"public",
"static",
"<",
"T",
">",
"SerializedCheckpointData",
"[",
"]",
"fromDeque",
"(",
"ArrayDeque",
"<",
"Tuple2",
"<",
"Long",
",",
"Set",
"<",
"T",
">",
">",
">",
"checkpoints",
",",
"TypeSerializer",
"<",
"T",
">",
"serializer",
",",
"DataOutputSer... | Converts a list of checkpoints into an array of SerializedCheckpointData.
@param checkpoints The checkpoints to be converted into IdsCheckpointData.
@param serializer The serializer to serialize the IDs.
@param outputBuffer The reusable serialization buffer.
@param <T> The type of the ID.
@return An array of serializable SerializedCheckpointData, one per entry in the queue.
@throws IOException Thrown, if the serialization fails. | [
"Converts",
"a",
"list",
"of",
"checkpoints",
"into",
"an",
"array",
"of",
"SerializedCheckpointData",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SerializedCheckpointData.java#L115-L136 | train | Converts a sequence of checkpoints into an array of SerializedCheckpointData objects. | [
30522,
2270,
10763,
1026,
1056,
1028,
27289,
5403,
3600,
8400,
2850,
2696,
1031,
1033,
2013,
3207,
4226,
1006,
9140,
3207,
4226,
1026,
10722,
10814,
2475,
1026,
2146,
1010,
2275,
1026,
1056,
1028,
1028,
1028,
26520,
2015,
1010,
4127,
11610,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java | TableFactoryService.findInternal | public static <T> T findInternal(Class<T> factoryClass, Map<String, String> properties, Optional<ClassLoader> classLoader) {
Preconditions.checkNotNull(factoryClass);
Preconditions.checkNotNull(properties);
List<TableFactory> foundFactories = discoverFactories(classLoader);
List<TableFactory> classFactories = filterByFactoryClass(
factoryClass,
properties,
foundFactories);
List<TableFactory> contextFactories = filterByContext(
factoryClass,
properties,
foundFactories,
classFactories);
return filterBySupportedProperties(
factoryClass,
properties,
foundFactories,
contextFactories);
} | java | public static <T> T findInternal(Class<T> factoryClass, Map<String, String> properties, Optional<ClassLoader> classLoader) {
Preconditions.checkNotNull(factoryClass);
Preconditions.checkNotNull(properties);
List<TableFactory> foundFactories = discoverFactories(classLoader);
List<TableFactory> classFactories = filterByFactoryClass(
factoryClass,
properties,
foundFactories);
List<TableFactory> contextFactories = filterByContext(
factoryClass,
properties,
foundFactories,
classFactories);
return filterBySupportedProperties(
factoryClass,
properties,
foundFactories,
contextFactories);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"findInternal",
"(",
"Class",
"<",
"T",
">",
"factoryClass",
",",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
",",
"Optional",
"<",
"ClassLoader",
">",
"classLoader",
")",
"{",
"Preconditions",
".",
"ch... | Finds a table factory of the given class, property map, and classloader.
@param factoryClass desired factory class
@param properties properties that describe the factory configuration
@param classLoader classloader for service loading
@param <T> factory class type
@return the matching factory | [
"Finds",
"a",
"table",
"factory",
"of",
"the",
"given",
"class",
"property",
"map",
"and",
"classloader",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java#L120-L143 | train | Finds a table instance from the given class and properties. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
2424,
18447,
11795,
2389,
1006,
2465,
1026,
1056,
1028,
4713,
26266,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
5144,
1010,
11887,
1026,
2465,
11066,
2121,
1028,
2465,
11066,
2121,
1007,
1063,
3653... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/nonha/embedded/EmbeddedLeaderService.java | EmbeddedLeaderService.confirmLeader | private void confirmLeader(final EmbeddedLeaderElectionService service, final UUID leaderSessionId) {
synchronized (lock) {
// if the service was shut down in the meantime, ignore this confirmation
if (!service.running || shutdown) {
return;
}
try {
// check if the confirmation is for the same grant, or whether it is a stale grant
if (service == currentLeaderProposed && currentLeaderSessionId.equals(leaderSessionId)) {
final String address = service.contender.getAddress();
LOG.info("Received confirmation of leadership for leader {} , session={}", address, leaderSessionId);
// mark leadership
currentLeaderConfirmed = service;
currentLeaderAddress = address;
currentLeaderProposed = null;
// notify all listeners
notifyAllListeners(address, leaderSessionId);
}
else {
LOG.debug("Received confirmation of leadership for a stale leadership grant. Ignoring.");
}
}
catch (Throwable t) {
fatalError(t);
}
}
} | java | private void confirmLeader(final EmbeddedLeaderElectionService service, final UUID leaderSessionId) {
synchronized (lock) {
// if the service was shut down in the meantime, ignore this confirmation
if (!service.running || shutdown) {
return;
}
try {
// check if the confirmation is for the same grant, or whether it is a stale grant
if (service == currentLeaderProposed && currentLeaderSessionId.equals(leaderSessionId)) {
final String address = service.contender.getAddress();
LOG.info("Received confirmation of leadership for leader {} , session={}", address, leaderSessionId);
// mark leadership
currentLeaderConfirmed = service;
currentLeaderAddress = address;
currentLeaderProposed = null;
// notify all listeners
notifyAllListeners(address, leaderSessionId);
}
else {
LOG.debug("Received confirmation of leadership for a stale leadership grant. Ignoring.");
}
}
catch (Throwable t) {
fatalError(t);
}
}
} | [
"private",
"void",
"confirmLeader",
"(",
"final",
"EmbeddedLeaderElectionService",
"service",
",",
"final",
"UUID",
"leaderSessionId",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"// if the service was shut down in the meantime, ignore this confirmation",
"if",
"(",
"!... | Callback from leader contenders when they confirm a leader grant. | [
"Callback",
"from",
"leader",
"contenders",
"when",
"they",
"confirm",
"a",
"leader",
"grant",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/nonha/embedded/EmbeddedLeaderService.java#L239-L268 | train | Confirm the leader. | [
30522,
2797,
11675,
12210,
19000,
1006,
2345,
11157,
19000,
12260,
22014,
2121,
7903,
2063,
2326,
1010,
2345,
1057,
21272,
4177,
7971,
3258,
3593,
1007,
1063,
25549,
1006,
5843,
1007,
1063,
1013,
1013,
2065,
1996,
2326,
2001,
3844,
2091,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java | Trie.storeEmits | private static void storeEmits(int position, State currentState, List<Emit> collectedEmits)
{
Collection<String> emits = currentState.emit();
if (emits != null && !emits.isEmpty())
{
for (String emit : emits)
{
collectedEmits.add(new Emit(position - emit.length() + 1, position, emit));
}
}
} | java | private static void storeEmits(int position, State currentState, List<Emit> collectedEmits)
{
Collection<String> emits = currentState.emit();
if (emits != null && !emits.isEmpty())
{
for (String emit : emits)
{
collectedEmits.add(new Emit(position - emit.length() + 1, position, emit));
}
}
} | [
"private",
"static",
"void",
"storeEmits",
"(",
"int",
"position",
",",
"State",
"currentState",
",",
"List",
"<",
"Emit",
">",
"collectedEmits",
")",
"{",
"Collection",
"<",
"String",
">",
"emits",
"=",
"currentState",
".",
"emit",
"(",
")",
";",
"if",
... | 保存匹配结果
@param position 当前位置,也就是匹配到的模式串的结束位置+1
@param currentState 当前状态
@param collectedEmits 保存位置 | [
"保存匹配结果"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java#L301-L311 | train | Stores the emits of the sequence of tokens | [
30522,
2797,
10763,
11675,
3573,
23238,
3215,
1006,
20014,
2597,
1010,
2110,
14731,
12259,
1010,
2862,
1026,
12495,
2102,
1028,
5067,
23238,
3215,
1007,
1063,
3074,
1026,
5164,
1028,
12495,
3215,
1027,
14731,
12259,
1012,
12495,
2102,
30524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/Entity.java | Entity.setFieldNames | public Entity setFieldNames(String... fieldNames) {
if (ArrayUtil.isNotEmpty(fieldNames)) {
this.fieldNames = CollectionUtil.newHashSet(fieldNames);
}
return this;
} | java | public Entity setFieldNames(String... fieldNames) {
if (ArrayUtil.isNotEmpty(fieldNames)) {
this.fieldNames = CollectionUtil.newHashSet(fieldNames);
}
return this;
} | [
"public",
"Entity",
"setFieldNames",
"(",
"String",
"...",
"fieldNames",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isNotEmpty",
"(",
"fieldNames",
")",
")",
"{",
"this",
".",
"fieldNames",
"=",
"CollectionUtil",
".",
"newHashSet",
"(",
"fieldNames",
")",
";",
... | 设置字段列表,用于限制加入的字段的值
@param fieldNames 字段列表
@return 自身 | [
"设置字段列表,用于限制加入的字段的值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Entity.java#L158-L163 | train | Sets the field names of the entity. | [
30522,
2270,
9178,
2275,
3790,
18442,
2015,
1006,
5164,
1012,
1012,
1012,
2492,
30524,
1006,
2492,
18442,
2015,
1007,
1007,
1063,
2023,
1012,
2492,
18442,
2015,
1027,
3074,
21823,
2140,
1012,
2047,
14949,
7898,
3388,
1006,
2492,
18442,
2015... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/FixedLengthRowBasedKeyValueBatch.java | FixedLengthRowBasedKeyValueBatch.getValueFromKey | @Override
protected UnsafeRow getValueFromKey(int rowId) {
if (keyRowId != rowId) {
getKeyRow(rowId);
}
assert(rowId >= 0);
valueRow.pointTo(base, keyRow.getBaseOffset() + klen, vlen);
return valueRow;
} | java | @Override
protected UnsafeRow getValueFromKey(int rowId) {
if (keyRowId != rowId) {
getKeyRow(rowId);
}
assert(rowId >= 0);
valueRow.pointTo(base, keyRow.getBaseOffset() + klen, vlen);
return valueRow;
} | [
"@",
"Override",
"protected",
"UnsafeRow",
"getValueFromKey",
"(",
"int",
"rowId",
")",
"{",
"if",
"(",
"keyRowId",
"!=",
"rowId",
")",
"{",
"getKeyRow",
"(",
"rowId",
")",
";",
"}",
"assert",
"(",
"rowId",
">=",
"0",
")",
";",
"valueRow",
".",
"pointT... | Returns the value row by two steps:
1) looking up the key row with the same id (skipped if the key row is cached)
2) retrieve the value row by reusing the metadata from step 1)
In most times, 1) is skipped because `getKeyRow(id)` is often called before `getValueRow(id)`. | [
"Returns",
"the",
"value",
"row",
"by",
"two",
"steps",
":",
"1",
")",
"looking",
"up",
"the",
"key",
"row",
"with",
"the",
"same",
"id",
"(",
"skipped",
"if",
"the",
"key",
"row",
"is",
"cached",
")",
"2",
")",
"retrieve",
"the",
"value",
"row",
"... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/FixedLengthRowBasedKeyValueBatch.java#L92-L100 | train | Override to return the value of the key. | [
30522,
1030,
2058,
15637,
5123,
25135,
10524,
2131,
10175,
5657,
19699,
5358,
14839,
1006,
20014,
5216,
3593,
1007,
1063,
2065,
1006,
3145,
10524,
3593,
999,
1027,
5216,
3593,
1007,
1063,
2131,
14839,
10524,
1006,
5216,
3593,
1007,
1025,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/NormalizedKeySorter.java | NormalizedKeySorter.getIterator | @Override
public final MutableObjectIterator<T> getIterator() {
return new MutableObjectIterator<T>()
{
private final int size = size();
private int current = 0;
private int currentSegment = 0;
private int currentOffset = 0;
private MemorySegment currentIndexSegment = sortIndex.get(0);
@Override
public T next(T target) {
if (this.current < this.size) {
this.current++;
if (this.currentOffset > lastIndexEntryOffset) {
this.currentOffset = 0;
this.currentIndexSegment = sortIndex.get(++this.currentSegment);
}
long pointer = this.currentIndexSegment.getLong(this.currentOffset) & POINTER_MASK;
this.currentOffset += indexEntrySize;
try {
return getRecordFromBuffer(target, pointer);
}
catch (IOException ioe) {
throw new RuntimeException(ioe);
}
}
else {
return null;
}
}
@Override
public T next()
{
if (this.current < this.size) {
this.current++;
if (this.currentOffset > lastIndexEntryOffset) {
this.currentOffset = 0;
this.currentIndexSegment = sortIndex.get(++this.currentSegment);
}
long pointer = this.currentIndexSegment.getLong(this.currentOffset);
this.currentOffset += indexEntrySize;
try {
return getRecordFromBuffer(pointer);
}
catch (IOException ioe) {
throw new RuntimeException(ioe);
}
}
else {
return null;
}
}
};
} | java | @Override
public final MutableObjectIterator<T> getIterator() {
return new MutableObjectIterator<T>()
{
private final int size = size();
private int current = 0;
private int currentSegment = 0;
private int currentOffset = 0;
private MemorySegment currentIndexSegment = sortIndex.get(0);
@Override
public T next(T target) {
if (this.current < this.size) {
this.current++;
if (this.currentOffset > lastIndexEntryOffset) {
this.currentOffset = 0;
this.currentIndexSegment = sortIndex.get(++this.currentSegment);
}
long pointer = this.currentIndexSegment.getLong(this.currentOffset) & POINTER_MASK;
this.currentOffset += indexEntrySize;
try {
return getRecordFromBuffer(target, pointer);
}
catch (IOException ioe) {
throw new RuntimeException(ioe);
}
}
else {
return null;
}
}
@Override
public T next()
{
if (this.current < this.size) {
this.current++;
if (this.currentOffset > lastIndexEntryOffset) {
this.currentOffset = 0;
this.currentIndexSegment = sortIndex.get(++this.currentSegment);
}
long pointer = this.currentIndexSegment.getLong(this.currentOffset);
this.currentOffset += indexEntrySize;
try {
return getRecordFromBuffer(pointer);
}
catch (IOException ioe) {
throw new RuntimeException(ioe);
}
}
else {
return null;
}
}
};
} | [
"@",
"Override",
"public",
"final",
"MutableObjectIterator",
"<",
"T",
">",
"getIterator",
"(",
")",
"{",
"return",
"new",
"MutableObjectIterator",
"<",
"T",
">",
"(",
")",
"{",
"private",
"final",
"int",
"size",
"=",
"size",
"(",
")",
";",
"private",
"i... | Gets an iterator over all records in this buffer in their logical order.
@return An iterator returning the records in their logical order. | [
"Gets",
"an",
"iterator",
"over",
"all",
"records",
"in",
"this",
"buffer",
"in",
"their",
"logical",
"order",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/NormalizedKeySorter.java#L415-L476 | train | Get an iterator for the object. | [
30522,
1030,
2058,
15637,
2270,
2345,
14163,
10880,
16429,
20614,
21646,
8844,
1026,
1056,
1028,
2131,
21646,
8844,
1006,
1007,
1063,
2709,
2047,
14163,
10880,
16429,
20614,
21646,
8844,
1026,
1056,
1028,
1006,
1007,
1063,
2797,
2345,
20014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlLikeUtils.java | SqlLikeUtils.sqlToRegexSimilar | static String sqlToRegexSimilar(
String sqlPattern,
CharSequence escapeStr) {
final char escapeChar;
if (escapeStr != null) {
if (escapeStr.length() != 1) {
throw invalidEscapeCharacter(escapeStr.toString());
}
escapeChar = escapeStr.charAt(0);
} else {
escapeChar = 0;
}
return sqlToRegexSimilar(sqlPattern, escapeChar);
} | java | static String sqlToRegexSimilar(
String sqlPattern,
CharSequence escapeStr) {
final char escapeChar;
if (escapeStr != null) {
if (escapeStr.length() != 1) {
throw invalidEscapeCharacter(escapeStr.toString());
}
escapeChar = escapeStr.charAt(0);
} else {
escapeChar = 0;
}
return sqlToRegexSimilar(sqlPattern, escapeChar);
} | [
"static",
"String",
"sqlToRegexSimilar",
"(",
"String",
"sqlPattern",
",",
"CharSequence",
"escapeStr",
")",
"{",
"final",
"char",
"escapeChar",
";",
"if",
"(",
"escapeStr",
"!=",
"null",
")",
"{",
"if",
"(",
"escapeStr",
".",
"length",
"(",
")",
"!=",
"1"... | Translates a SQL SIMILAR pattern to Java regex pattern, with optional
escape string. | [
"Translates",
"a",
"SQL",
"SIMILAR",
"pattern",
"to",
"Java",
"regex",
"pattern",
"with",
"optional",
"escape",
"string",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlLikeUtils.java#L213-L226 | train | Converts a SQL pattern to a regular expression. | [
30522,
10763,
5164,
29296,
19277,
3351,
2595,
5332,
4328,
8017,
1006,
5164,
29296,
4502,
12079,
2078,
1010,
25869,
3366,
4226,
5897,
12976,
16344,
1007,
1063,
2345,
25869,
4019,
7507,
2099,
1025,
2065,
1006,
12976,
16344,
999,
1027,
19701,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlUtil.java | SqlUtil.blobToStr | public static String blobToStr(Blob blob, Charset charset) {
InputStream in = null;
try {
in = blob.getBinaryStream();
return IoUtil.read(in, charset);
} catch (SQLException e) {
throw new DbRuntimeException(e);
} finally {
IoUtil.close(in);
}
} | java | public static String blobToStr(Blob blob, Charset charset) {
InputStream in = null;
try {
in = blob.getBinaryStream();
return IoUtil.read(in, charset);
} catch (SQLException e) {
throw new DbRuntimeException(e);
} finally {
IoUtil.close(in);
}
} | [
"public",
"static",
"String",
"blobToStr",
"(",
"Blob",
"blob",
",",
"Charset",
"charset",
")",
"{",
"InputStream",
"in",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"blob",
".",
"getBinaryStream",
"(",
")",
";",
"return",
"IoUtil",
".",
"read",
"(",
"in"... | Blob字段值转字符串
@param blob {@link Blob}
@param charset 编码
@return 字符串
@since 3.0.6 | [
"Blob字段值转字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlUtil.java#L173-L183 | train | Converts a blob to a string. | [
30522,
2270,
10763,
5164,
1038,
4135,
19279,
14122,
2099,
1006,
1038,
4135,
2497,
1038,
4135,
2497,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
20407,
25379,
1999,
1027,
19701,
1025,
3046,
1063,
1999,
1027,
1038,
4135,
2497,
1012,
2131,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.toFile | public static void toFile(Document doc, String path, String charset) {
if (StrUtil.isBlank(charset)) {
charset = doc.getXmlEncoding();
}
if (StrUtil.isBlank(charset)) {
charset = CharsetUtil.UTF_8;
}
BufferedWriter writer = null;
try {
writer = FileUtil.getWriter(path, charset, false);
write(doc, writer, charset, INDENT_DEFAULT);
} finally {
IoUtil.close(writer);
}
} | java | public static void toFile(Document doc, String path, String charset) {
if (StrUtil.isBlank(charset)) {
charset = doc.getXmlEncoding();
}
if (StrUtil.isBlank(charset)) {
charset = CharsetUtil.UTF_8;
}
BufferedWriter writer = null;
try {
writer = FileUtil.getWriter(path, charset, false);
write(doc, writer, charset, INDENT_DEFAULT);
} finally {
IoUtil.close(writer);
}
} | [
"public",
"static",
"void",
"toFile",
"(",
"Document",
"doc",
",",
"String",
"path",
",",
"String",
"charset",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"charset",
")",
")",
"{",
"charset",
"=",
"doc",
".",
"getXmlEncoding",
"(",
")",
";",
... | 将XML文档写入到文件<br>
@param doc XML文档
@param path 文件路径绝对路径或相对ClassPath路径,不存在会自动创建
@param charset 自定义XML文件的编码,如果为{@code null} 读取XML文档中的编码,否则默认UTF-8 | [
"将XML文档写入到文件<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L298-L313 | train | Copies the contents of the given document to the given file. | [
30522,
2270,
10763,
11675,
2000,
8873,
2571,
1006,
6254,
9986,
1010,
5164,
4130,
1010,
5164,
25869,
13462,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
25869,
13462,
1007,
1007,
1063,
25869,
13462,
1027,
9986,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java | TaskSlotTable.notifyTimeout | @Override
public void notifyTimeout(AllocationID key, UUID ticket) {
checkInit();
if (slotActions != null) {
slotActions.timeoutSlot(key, ticket);
}
} | java | @Override
public void notifyTimeout(AllocationID key, UUID ticket) {
checkInit();
if (slotActions != null) {
slotActions.timeoutSlot(key, ticket);
}
} | [
"@",
"Override",
"public",
"void",
"notifyTimeout",
"(",
"AllocationID",
"key",
",",
"UUID",
"ticket",
")",
"{",
"checkInit",
"(",
")",
";",
"if",
"(",
"slotActions",
"!=",
"null",
")",
"{",
"slotActions",
".",
"timeoutSlot",
"(",
"key",
",",
"ticket",
"... | --------------------------------------------------------------------- | [
"---------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java#L562-L569 | train | Notifies slot actions that a timeout occurs. | [
30522,
1030,
2058,
15637,
2270,
11675,
2025,
8757,
7292,
5833,
1006,
16169,
3593,
3145,
1010,
1057,
21272,
7281,
1007,
1063,
4638,
5498,
2102,
1006,
1007,
1025,
2065,
1006,
10453,
18908,
8496,
999,
1027,
19701,
1007,
1063,
10453,
18908,
849... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/io/DelimitedInputFormat.java | DelimitedInputFormat.open | @Override
public void open(FileInputSplit split) throws IOException {
super.open(split);
initBuffers();
this.offset = splitStart;
if (this.splitStart != 0) {
this.stream.seek(offset);
readLine();
// if the first partial record already pushes the stream over
// the limit of our split, then no record starts within this split
if (this.overLimit) {
this.end = true;
}
} else {
fillBuffer(0);
}
} | java | @Override
public void open(FileInputSplit split) throws IOException {
super.open(split);
initBuffers();
this.offset = splitStart;
if (this.splitStart != 0) {
this.stream.seek(offset);
readLine();
// if the first partial record already pushes the stream over
// the limit of our split, then no record starts within this split
if (this.overLimit) {
this.end = true;
}
} else {
fillBuffer(0);
}
} | [
"@",
"Override",
"public",
"void",
"open",
"(",
"FileInputSplit",
"split",
")",
"throws",
"IOException",
"{",
"super",
".",
"open",
"(",
"split",
")",
";",
"initBuffers",
"(",
")",
";",
"this",
".",
"offset",
"=",
"splitStart",
";",
"if",
"(",
"this",
... | Opens the given input split. This method opens the input stream to the specified file, allocates read buffers
and positions the stream at the correct position, making sure that any partial record at the beginning is skipped.
@param split The input split to open.
@see org.apache.flink.api.common.io.FileInputFormat#open(org.apache.flink.core.fs.FileInputSplit) | [
"Opens",
"the",
"given",
"input",
"split",
".",
"This",
"method",
"opens",
"the",
"input",
"stream",
"to",
"the",
"specified",
"file",
"allocates",
"read",
"buffers",
"and",
"positions",
"the",
"stream",
"at",
"the",
"correct",
"position",
"making",
"sure",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/DelimitedInputFormat.java#L468-L485 | train | This method is called by the FileInputFormat to open the input stream. | [
30522,
1030,
2058,
15637,
2270,
11675,
2330,
1006,
5371,
2378,
18780,
13102,
15909,
3975,
1007,
11618,
22834,
10288,
24422,
1063,
3565,
1012,
2330,
1006,
3975,
1007,
1025,
1999,
4183,
8569,
12494,
2015,
1006,
1007,
1025,
2023,
1012,
16396,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpoint.java | PendingCheckpoint.acknowledgeTask | public TaskAcknowledgeResult acknowledgeTask(
ExecutionAttemptID executionAttemptId,
TaskStateSnapshot operatorSubtaskStates,
CheckpointMetrics metrics) {
synchronized (lock) {
if (discarded) {
return TaskAcknowledgeResult.DISCARDED;
}
final ExecutionVertex vertex = notYetAcknowledgedTasks.remove(executionAttemptId);
if (vertex == null) {
if (acknowledgedTasks.contains(executionAttemptId)) {
return TaskAcknowledgeResult.DUPLICATE;
} else {
return TaskAcknowledgeResult.UNKNOWN;
}
} else {
acknowledgedTasks.add(executionAttemptId);
}
List<OperatorID> operatorIDs = vertex.getJobVertex().getOperatorIDs();
int subtaskIndex = vertex.getParallelSubtaskIndex();
long ackTimestamp = System.currentTimeMillis();
long stateSize = 0L;
if (operatorSubtaskStates != null) {
for (OperatorID operatorID : operatorIDs) {
OperatorSubtaskState operatorSubtaskState =
operatorSubtaskStates.getSubtaskStateByOperatorID(operatorID);
// if no real operatorSubtaskState was reported, we insert an empty state
if (operatorSubtaskState == null) {
operatorSubtaskState = new OperatorSubtaskState();
}
OperatorState operatorState = operatorStates.get(operatorID);
if (operatorState == null) {
operatorState = new OperatorState(
operatorID,
vertex.getTotalNumberOfParallelSubtasks(),
vertex.getMaxParallelism());
operatorStates.put(operatorID, operatorState);
}
operatorState.putState(subtaskIndex, operatorSubtaskState);
stateSize += operatorSubtaskState.getStateSize();
}
}
++numAcknowledgedTasks;
// publish the checkpoint statistics
// to prevent null-pointers from concurrent modification, copy reference onto stack
final PendingCheckpointStats statsCallback = this.statsCallback;
if (statsCallback != null) {
// Do this in millis because the web frontend works with them
long alignmentDurationMillis = metrics.getAlignmentDurationNanos() / 1_000_000;
SubtaskStateStats subtaskStateStats = new SubtaskStateStats(
subtaskIndex,
ackTimestamp,
stateSize,
metrics.getSyncDurationMillis(),
metrics.getAsyncDurationMillis(),
metrics.getBytesBufferedInAlignment(),
alignmentDurationMillis);
statsCallback.reportSubtaskStats(vertex.getJobvertexId(), subtaskStateStats);
}
return TaskAcknowledgeResult.SUCCESS;
}
} | java | public TaskAcknowledgeResult acknowledgeTask(
ExecutionAttemptID executionAttemptId,
TaskStateSnapshot operatorSubtaskStates,
CheckpointMetrics metrics) {
synchronized (lock) {
if (discarded) {
return TaskAcknowledgeResult.DISCARDED;
}
final ExecutionVertex vertex = notYetAcknowledgedTasks.remove(executionAttemptId);
if (vertex == null) {
if (acknowledgedTasks.contains(executionAttemptId)) {
return TaskAcknowledgeResult.DUPLICATE;
} else {
return TaskAcknowledgeResult.UNKNOWN;
}
} else {
acknowledgedTasks.add(executionAttemptId);
}
List<OperatorID> operatorIDs = vertex.getJobVertex().getOperatorIDs();
int subtaskIndex = vertex.getParallelSubtaskIndex();
long ackTimestamp = System.currentTimeMillis();
long stateSize = 0L;
if (operatorSubtaskStates != null) {
for (OperatorID operatorID : operatorIDs) {
OperatorSubtaskState operatorSubtaskState =
operatorSubtaskStates.getSubtaskStateByOperatorID(operatorID);
// if no real operatorSubtaskState was reported, we insert an empty state
if (operatorSubtaskState == null) {
operatorSubtaskState = new OperatorSubtaskState();
}
OperatorState operatorState = operatorStates.get(operatorID);
if (operatorState == null) {
operatorState = new OperatorState(
operatorID,
vertex.getTotalNumberOfParallelSubtasks(),
vertex.getMaxParallelism());
operatorStates.put(operatorID, operatorState);
}
operatorState.putState(subtaskIndex, operatorSubtaskState);
stateSize += operatorSubtaskState.getStateSize();
}
}
++numAcknowledgedTasks;
// publish the checkpoint statistics
// to prevent null-pointers from concurrent modification, copy reference onto stack
final PendingCheckpointStats statsCallback = this.statsCallback;
if (statsCallback != null) {
// Do this in millis because the web frontend works with them
long alignmentDurationMillis = metrics.getAlignmentDurationNanos() / 1_000_000;
SubtaskStateStats subtaskStateStats = new SubtaskStateStats(
subtaskIndex,
ackTimestamp,
stateSize,
metrics.getSyncDurationMillis(),
metrics.getAsyncDurationMillis(),
metrics.getBytesBufferedInAlignment(),
alignmentDurationMillis);
statsCallback.reportSubtaskStats(vertex.getJobvertexId(), subtaskStateStats);
}
return TaskAcknowledgeResult.SUCCESS;
}
} | [
"public",
"TaskAcknowledgeResult",
"acknowledgeTask",
"(",
"ExecutionAttemptID",
"executionAttemptId",
",",
"TaskStateSnapshot",
"operatorSubtaskStates",
",",
"CheckpointMetrics",
"metrics",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"discarded",
")",
"... | Acknowledges the task with the given execution attempt id and the given subtask state.
@param executionAttemptId of the acknowledged task
@param operatorSubtaskStates of the acknowledged task
@param metrics Checkpoint metrics for the stats
@return TaskAcknowledgeResult of the operation | [
"Acknowledges",
"the",
"task",
"with",
"the",
"given",
"execution",
"attempt",
"id",
"and",
"the",
"given",
"subtask",
"state",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpoint.java#L306-L383 | train | Acknowledges a task. | [
30522,
2270,
4708,
8684,
19779,
3709,
4590,
2229,
11314,
13399,
10230,
2243,
1006,
7781,
19321,
6633,
13876,
3593,
7781,
19321,
6633,
13876,
3593,
1010,
8518,
12259,
2015,
2532,
4523,
12326,
9224,
12083,
10230,
5705,
12259,
2015,
1010,
26520,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getConfResourceAsInputStream | public InputStream getConfResourceAsInputStream(String name) {
try {
URL url= getResource(name);
if (url == null) {
LOG.info(name + " not found");
return null;
} else {
LOG.info("found resource " + name + " at " + url);
}
return url.openStream();
} catch (Exception e) {
return null;
}
} | java | public InputStream getConfResourceAsInputStream(String name) {
try {
URL url= getResource(name);
if (url == null) {
LOG.info(name + " not found");
return null;
} else {
LOG.info("found resource " + name + " at " + url);
}
return url.openStream();
} catch (Exception e) {
return null;
}
} | [
"public",
"InputStream",
"getConfResourceAsInputStream",
"(",
"String",
"name",
")",
"{",
"try",
"{",
"URL",
"url",
"=",
"getResource",
"(",
"name",
")",
";",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"LOG",
".",
"info",
"(",
"name",
"+",
"\" not found\"... | Get an input stream attached to the configuration resource with the
given <code>name</code>.
@param name configuration resource name.
@return an input stream attached to the resource. | [
"Get",
"an",
"input",
"stream",
"attached",
"to",
"the",
"configuration",
"resource",
"with",
"the",
"given",
"<code",
">",
"name<",
"/",
"code",
">",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2623-L2638 | train | Get a configuration resource as an input stream. | [
30522,
2270,
20407,
25379,
2131,
8663,
19699,
2229,
8162,
21456,
11493,
18780,
21422,
1006,
5164,
2171,
1007,
1063,
3046,
1063,
24471,
2140,
24471,
2140,
1027,
2131,
6072,
8162,
3401,
1006,
2171,
1007,
1025,
2065,
1006,
24471,
2140,
1027,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.getAny | @SuppressWarnings("unchecked")
public static <T> List<T> getAny(Collection<T> collection, int... indexes) {
final int size = collection.size();
final ArrayList<T> result = new ArrayList<>();
if (collection instanceof List) {
final List<T> list = ((List<T>) collection);
for (int index : indexes) {
if (index < 0) {
index += size;
}
result.add(list.get(index));
}
} else {
Object[] array = ((Collection<T>) collection).toArray();
for (int index : indexes) {
if (index < 0) {
index += size;
}
result.add((T) array[index]);
}
}
return result;
} | java | @SuppressWarnings("unchecked")
public static <T> List<T> getAny(Collection<T> collection, int... indexes) {
final int size = collection.size();
final ArrayList<T> result = new ArrayList<>();
if (collection instanceof List) {
final List<T> list = ((List<T>) collection);
for (int index : indexes) {
if (index < 0) {
index += size;
}
result.add(list.get(index));
}
} else {
Object[] array = ((Collection<T>) collection).toArray();
for (int index : indexes) {
if (index < 0) {
index += size;
}
result.add((T) array[index]);
}
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"getAny",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"int",
"...",
"indexes",
")",
"{",
"final",
"int",
"size",
"=",
"collection",
"... | 获取集合中指定多个下标的元素值,下标可以为负数,例如-1表示最后一个元素
@param <T> 元素类型
@param collection 集合
@param indexes 下标,支持负数
@return 元素值列表
@since 4.0.6 | [
"获取集合中指定多个下标的元素值,下标可以为负数,例如",
"-",
"1表示最后一个元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1878-L1900 | train | Returns a list of objects that are contained in the given collection with the specified indexes. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
2131,
19092,
1006,
3074,
1026,
1056,
1028,
3074,
1010,
20014,
1012,
1012,
1012,
5950,
2229,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-scala/src/main/java/org/apache/flink/api/scala/operators/ScalaCsvOutputFormat.java | ScalaCsvOutputFormat.setInputType | @Override
public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) {
if (!type.isTupleType()) {
throw new InvalidProgramException("The " + ScalaCsvOutputFormat.class.getSimpleName() +
" can only be used to write tuple data sets.");
}
} | java | @Override
public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) {
if (!type.isTupleType()) {
throw new InvalidProgramException("The " + ScalaCsvOutputFormat.class.getSimpleName() +
" can only be used to write tuple data sets.");
}
} | [
"@",
"Override",
"public",
"void",
"setInputType",
"(",
"TypeInformation",
"<",
"?",
">",
"type",
",",
"ExecutionConfig",
"executionConfig",
")",
"{",
"if",
"(",
"!",
"type",
".",
"isTupleType",
"(",
")",
")",
"{",
"throw",
"new",
"InvalidProgramException",
... | The purpose of this method is solely to check whether the data type to be processed
is in fact a tuple type. | [
"The",
"purpose",
"of",
"this",
"method",
"is",
"solely",
"to",
"check",
"whether",
"the",
"data",
"type",
"to",
"be",
"processed",
"is",
"in",
"fact",
"a",
"tuple",
"type",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-scala/src/main/java/org/apache/flink/api/scala/operators/ScalaCsvOutputFormat.java#L223-L229 | train | Sets the input type. | [
30522,
1030,
2058,
15637,
2270,
11675,
2275,
2378,
18780,
13874,
1006,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
2828,
1010,
7781,
8663,
8873,
2290,
7781,
8663,
8873,
2290,
1007,
1063,
2065,
1006,
999,
2828,
1012,
21541,
6279,
7485,
18863,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java | WordTree.matchAll | public List<String> matchAll(String text, int limit) {
return matchAll(text, limit, false, false);
} | java | public List<String> matchAll(String text, int limit) {
return matchAll(text, limit, false, false);
} | [
"public",
"List",
"<",
"String",
">",
"matchAll",
"(",
"String",
"text",
",",
"int",
"limit",
")",
"{",
"return",
"matchAll",
"(",
"text",
",",
"limit",
",",
"false",
",",
"false",
")",
";",
"}"
] | 找出所有匹配的关键字
@param text 被检查的文本
@param limit 限制匹配个数
@return 匹配的词列表 | [
"找出所有匹配的关键字"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java#L142-L144 | train | Match all the characters in text. | [
30522,
2270,
2862,
1026,
5164,
1028,
2674,
8095,
1006,
5164,
3793,
1010,
20014,
5787,
1007,
1063,
2709,
2674,
8095,
1006,
3793,
1010,
5787,
1010,
6270,
1010,
6270,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java | NativeLibraryLoader.classToByteArray | private static byte[] classToByteArray(Class<?> clazz) throws ClassNotFoundException {
String fileName = clazz.getName();
int lastDot = fileName.lastIndexOf('.');
if (lastDot > 0) {
fileName = fileName.substring(lastDot + 1);
}
URL classUrl = clazz.getResource(fileName + ".class");
if (classUrl == null) {
throw new ClassNotFoundException(clazz.getName());
}
byte[] buf = new byte[1024];
ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
InputStream in = null;
try {
in = classUrl.openStream();
for (int r; (r = in.read(buf)) != -1;) {
out.write(buf, 0, r);
}
return out.toByteArray();
} catch (IOException ex) {
throw new ClassNotFoundException(clazz.getName(), ex);
} finally {
closeQuietly(in);
closeQuietly(out);
}
} | java | private static byte[] classToByteArray(Class<?> clazz) throws ClassNotFoundException {
String fileName = clazz.getName();
int lastDot = fileName.lastIndexOf('.');
if (lastDot > 0) {
fileName = fileName.substring(lastDot + 1);
}
URL classUrl = clazz.getResource(fileName + ".class");
if (classUrl == null) {
throw new ClassNotFoundException(clazz.getName());
}
byte[] buf = new byte[1024];
ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
InputStream in = null;
try {
in = classUrl.openStream();
for (int r; (r = in.read(buf)) != -1;) {
out.write(buf, 0, r);
}
return out.toByteArray();
} catch (IOException ex) {
throw new ClassNotFoundException(clazz.getName(), ex);
} finally {
closeQuietly(in);
closeQuietly(out);
}
} | [
"private",
"static",
"byte",
"[",
"]",
"classToByteArray",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"throws",
"ClassNotFoundException",
"{",
"String",
"fileName",
"=",
"clazz",
".",
"getName",
"(",
")",
";",
"int",
"lastDot",
"=",
"fileName",
".",
"lastI... | Load the helper {@link Class} as a byte array, to be redefined in specified {@link ClassLoader}.
@param clazz - The helper {@link Class} provided by this bundle
@return The binary content of helper {@link Class}.
@throws ClassNotFoundException Helper class not found or loading failed | [
"Load",
"the",
"helper",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java#L442-L467 | train | Method classToByteArray. | [
30522,
2797,
10763,
24880,
1031,
1033,
2465,
3406,
3762,
27058,
11335,
2100,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1007,
11618,
2465,
17048,
14876,
8630,
10288,
24422,
1063,
5164,
5371,
18442,
1027,
18856,
10936,
2480,
1012,
2131,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java | TrafficCounter.start | public synchronized void start() {
if (monitorActive) {
return;
}
lastTime.set(milliSecondFromNano());
long localCheckInterval = checkInterval.get();
// if executor is null, it means it is piloted by a GlobalChannelTrafficCounter, so no executor
if (localCheckInterval > 0 && executor != null) {
monitorActive = true;
monitor = new TrafficMonitoringTask();
scheduledFuture =
executor.schedule(monitor, localCheckInterval, TimeUnit.MILLISECONDS);
}
} | java | public synchronized void start() {
if (monitorActive) {
return;
}
lastTime.set(milliSecondFromNano());
long localCheckInterval = checkInterval.get();
// if executor is null, it means it is piloted by a GlobalChannelTrafficCounter, so no executor
if (localCheckInterval > 0 && executor != null) {
monitorActive = true;
monitor = new TrafficMonitoringTask();
scheduledFuture =
executor.schedule(monitor, localCheckInterval, TimeUnit.MILLISECONDS);
}
} | [
"public",
"synchronized",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"monitorActive",
")",
"{",
"return",
";",
"}",
"lastTime",
".",
"set",
"(",
"milliSecondFromNano",
"(",
")",
")",
";",
"long",
"localCheckInterval",
"=",
"checkInterval",
".",
"get",
"(",... | Start the monitoring process. | [
"Start",
"the",
"monitoring",
"process",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java#L184-L197 | train | Start the TrafficMonitor. | [
30522,
2270,
25549,
11675,
2707,
1006,
1007,
1063,
2065,
1006,
8080,
19620,
1007,
1063,
2709,
1025,
1065,
2197,
7292,
1012,
2275,
1006,
4971,
5562,
8663,
20952,
21716,
7229,
2080,
1006,
1007,
1007,
1025,
2146,
2334,
5403,
18009,
10111,
2658... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.getIntHeader | @Deprecated
public static int getIntHeader(HttpMessage message, String name) {
return getIntHeader(message, (CharSequence) name);
} | java | @Deprecated
public static int getIntHeader(HttpMessage message, String name) {
return getIntHeader(message, (CharSequence) name);
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"getIntHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
")",
"{",
"return",
"getIntHeader",
"(",
"message",
",",
"(",
"CharSequence",
")",
"name",
")",
";",
"}"
] | @deprecated Use {@link #getInt(CharSequence)} instead.
@see #getIntHeader(HttpMessage, CharSequence) | [
"@deprecated",
"Use",
"{",
"@link",
"#getInt",
"(",
"CharSequence",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L709-L712 | train | Gets the value of the header with the given name as an int. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
20014,
2131,
18447,
4974,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
5164,
2171,
1007,
1063,
2709,
2131,
18447,
4974,
2121,
1006,
4471,
1010,
1006,
25869,
3366,
4226,
5897,
1007,
2171,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java | ReflectUtil.getMethodOfObj | public static Method getMethodOfObj(Object obj, String methodName, Object... args) throws SecurityException {
if (null == obj || StrUtil.isBlank(methodName)) {
return null;
}
return getMethod(obj.getClass(), methodName, ClassUtil.getClasses(args));
} | java | public static Method getMethodOfObj(Object obj, String methodName, Object... args) throws SecurityException {
if (null == obj || StrUtil.isBlank(methodName)) {
return null;
}
return getMethod(obj.getClass(), methodName, ClassUtil.getClasses(args));
} | [
"public",
"static",
"Method",
"getMethodOfObj",
"(",
"Object",
"obj",
",",
"String",
"methodName",
",",
"Object",
"...",
"args",
")",
"throws",
"SecurityException",
"{",
"if",
"(",
"null",
"==",
"obj",
"||",
"StrUtil",
".",
"isBlank",
"(",
"methodName",
")",... | 查找指定对象中的所有方法(包括非public方法),也包括父对象和Object类的方法
<p>
此方法为精准获取方法名,即方法名和参数数量和类型必须一致,否则返回<code>null</code>。
</p>
@param obj 被查找的对象,如果为{@code null}返回{@code null}
@param methodName 方法名,如果为空字符串返回{@code null}
@param args 参数
@return 方法
@throws SecurityException 无访问权限抛出异常 | [
"查找指定对象中的所有方法(包括非public方法),也包括父对象和Object类的方法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L393-L398 | train | Gets the method of obj. | [
30522,
2270,
10763,
4118,
2131,
11368,
6806,
3527,
14876,
2497,
3501,
1006,
4874,
27885,
3501,
1010,
5164,
4118,
18442,
1010,
4874,
1012,
1012,
1012,
12098,
5620,
1007,
11618,
3036,
10288,
24422,
1063,
2065,
1006,
19701,
1027,
1027,
27885,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java | ExceptionUtil.isFromOrSuppressedThrowable | public static boolean isFromOrSuppressedThrowable(Throwable throwable, Class<? extends Throwable> exceptionClass) {
return convertFromOrSuppressedThrowable(throwable, exceptionClass, true) != null;
} | java | public static boolean isFromOrSuppressedThrowable(Throwable throwable, Class<? extends Throwable> exceptionClass) {
return convertFromOrSuppressedThrowable(throwable, exceptionClass, true) != null;
} | [
"public",
"static",
"boolean",
"isFromOrSuppressedThrowable",
"(",
"Throwable",
"throwable",
",",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"exceptionClass",
")",
"{",
"return",
"convertFromOrSuppressedThrowable",
"(",
"throwable",
",",
"exceptionClass",
",",
"t... | 判断指定异常是否来自或者包含指定异常
@param throwable 异常
@param exceptionClass 定义的引起异常的类
@return true 来自或者包含
@since 4.3.2 | [
"判断指定异常是否来自或者包含指定异常"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java#L256-L258 | train | Checks if throwable is from or suppressed exception of given type. | [
30522,
2270,
10763,
22017,
20898,
2003,
19699,
19506,
2869,
6279,
19811,
2705,
10524,
3085,
1006,
5466,
3085,
5466,
3085,
1010,
2465,
1026,
1029,
8908,
5466,
3085,
1028,
6453,
26266,
1007,
1063,
2709,
10463,
19699,
19506,
2869,
6279,
19811,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | http-url/src/main/java/com/networknt/url/URLNormalizer.java | URLNormalizer.addWWW | public URLNormalizer addWWW() {
String host = toURL().getHost();
if (!host.toLowerCase().startsWith("www.")) {
url = StringUtils.replaceOnce(url, host, "www." + host);
}
return this;
} | java | public URLNormalizer addWWW() {
String host = toURL().getHost();
if (!host.toLowerCase().startsWith("www.")) {
url = StringUtils.replaceOnce(url, host, "www." + host);
}
return this;
} | [
"public",
"URLNormalizer",
"addWWW",
"(",
")",
"{",
"String",
"host",
"=",
"toURL",
"(",
")",
".",
"getHost",
"(",
")",
";",
"if",
"(",
"!",
"host",
".",
"toLowerCase",
"(",
")",
".",
"startsWith",
"(",
"\"www.\"",
")",
")",
"{",
"url",
"=",
"Strin... | <p>Adds "www." domain name prefix.</p>
<code>http://example.com/ → http://www.example.com/</code>
@return this instance | [
"<p",
">",
"Adds",
"www",
".",
"domain",
"name",
"prefix",
".",
"<",
"/",
"p",
">",
"<code",
">",
"http",
":",
"//",
"example",
".",
"com",
"/",
"&rarr",
";",
"http",
":",
"//",
"www",
".",
"example",
".",
"com",
"/",
"<",
"/",
"code",
">"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/URLNormalizer.java#L646-L652 | train | Add a WWW to the URL. | [
30522,
2270,
24471,
19666,
2953,
9067,
17629,
5587,
2860,
2860,
2860,
1006,
1007,
1063,
5164,
3677,
1027,
2778,
2140,
1006,
1007,
1012,
2131,
15006,
2102,
1006,
1007,
1025,
2065,
1006,
999,
3677,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/writer/RecoverableMultiPartUploadImpl.java | RecoverableMultiPartUploadImpl.uploadPart | @Override
public void uploadPart(RefCountedFSOutputStream file) throws IOException {
// this is to guarantee that nobody is
// writing to the file we are uploading.
checkState(file.isClosed());
final CompletableFuture<PartETag> future = new CompletableFuture<>();
uploadsInProgress.add(future);
final long partLength = file.getPos();
currentUploadInfo.registerNewPart(partLength);
file.retain(); // keep the file while the async upload still runs
uploadThreadPool.execute(new UploadTask(s3AccessHelper, currentUploadInfo, file, future));
} | java | @Override
public void uploadPart(RefCountedFSOutputStream file) throws IOException {
// this is to guarantee that nobody is
// writing to the file we are uploading.
checkState(file.isClosed());
final CompletableFuture<PartETag> future = new CompletableFuture<>();
uploadsInProgress.add(future);
final long partLength = file.getPos();
currentUploadInfo.registerNewPart(partLength);
file.retain(); // keep the file while the async upload still runs
uploadThreadPool.execute(new UploadTask(s3AccessHelper, currentUploadInfo, file, future));
} | [
"@",
"Override",
"public",
"void",
"uploadPart",
"(",
"RefCountedFSOutputStream",
"file",
")",
"throws",
"IOException",
"{",
"// this is to guarantee that nobody is",
"// writing to the file we are uploading.",
"checkState",
"(",
"file",
".",
"isClosed",
"(",
")",
")",
";... | Adds a part to the uploads without any size limitations.
<p>This method is non-blocking and does not wait for the part upload to complete.
@param file The file with the part data.
@throws IOException If this method throws an exception, the RecoverableS3MultiPartUpload
should not be used any more, but recovered instead. | [
"Adds",
"a",
"part",
"to",
"the",
"uploads",
"without",
"any",
"size",
"limitations",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/writer/RecoverableMultiPartUploadImpl.java#L100-L114 | train | Upload a part to the S3. | [
30522,
1030,
2058,
15637,
2270,
11675,
2039,
11066,
19362,
2102,
1006,
25416,
3597,
16671,
2098,
10343,
5833,
18780,
21422,
5371,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
2023,
2003,
2000,
11302,
2008,
6343,
2003,
1013,
1013,
3015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.cut | public static void cut(ImageInputStream srcStream, ImageOutputStream destStream, Rectangle rectangle) {
cut(read(srcStream), destStream, rectangle);
} | java | public static void cut(ImageInputStream srcStream, ImageOutputStream destStream, Rectangle rectangle) {
cut(read(srcStream), destStream, rectangle);
} | [
"public",
"static",
"void",
"cut",
"(",
"ImageInputStream",
"srcStream",
",",
"ImageOutputStream",
"destStream",
",",
"Rectangle",
"rectangle",
")",
"{",
"cut",
"(",
"read",
"(",
"srcStream",
")",
",",
"destStream",
",",
"rectangle",
")",
";",
"}"
] | 图像切割(按指定起点坐标和宽高切割),此方法并不关闭流
@param srcStream 源图像流
@param destStream 切片后的图像输出流
@param rectangle 矩形对象,表示矩形区域的x,y,width,height
@since 3.1.0 | [
"图像切割",
"(",
"按指定起点坐标和宽高切割",
")",
",此方法并不关闭流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L280-L282 | train | Cut the image from srcStream to destStream using the specified rectangle. | [
30522,
2270,
10763,
11675,
3013,
1006,
3746,
2378,
18780,
21422,
5034,
6169,
25379,
1010,
3746,
5833,
18780,
21422,
4078,
3215,
25379,
1010,
28667,
23395,
28667,
23395,
1007,
1063,
3013,
1006,
3191,
1006,
5034,
6169,
25379,
1007,
1010,
4078,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/batch/connectors/cassandra/CassandraOutputFormatBase.java | CassandraOutputFormatBase.close | @Override
public void close() throws IOException {
try {
if (session != null) {
session.close();
}
} catch (Exception e) {
LOG.error("Error while closing session.", e);
}
try {
if (cluster != null) {
cluster.close();
}
} catch (Exception e) {
LOG.error("Error while closing cluster.", e);
}
} | java | @Override
public void close() throws IOException {
try {
if (session != null) {
session.close();
}
} catch (Exception e) {
LOG.error("Error while closing session.", e);
}
try {
if (cluster != null) {
cluster.close();
}
} catch (Exception e) {
LOG.error("Error while closing cluster.", e);
}
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"session",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
... | Closes all resources used. | [
"Closes",
"all",
"resources",
"used",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/batch/connectors/cassandra/CassandraOutputFormatBase.java#L128-L145 | train | Close the underlying connection. | [
30522,
1030,
2058,
15637,
2270,
11675,
2485,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
3046,
1063,
2065,
1006,
5219,
999,
1027,
19701,
1007,
1063,
5219,
1012,
2485,
1006,
1007,
1025,
1065,
1065,
4608,
1006,
6453,
1041,
1007,
1063,
8833,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/DataSink.java | DataSink.setResources | private DataSink<T> setResources(ResourceSpec minResources, ResourceSpec preferredResources) {
Preconditions.checkNotNull(minResources, "The min resources must be not null.");
Preconditions.checkNotNull(preferredResources, "The preferred resources must be not null.");
Preconditions.checkArgument(minResources.isValid() && preferredResources.isValid() && minResources.lessThanOrEqual(preferredResources),
"The values in resources must be not less than 0 and the preferred resources must be greater than the min resources.");
this.minResources = minResources;
this.preferredResources = preferredResources;
return this;
} | java | private DataSink<T> setResources(ResourceSpec minResources, ResourceSpec preferredResources) {
Preconditions.checkNotNull(minResources, "The min resources must be not null.");
Preconditions.checkNotNull(preferredResources, "The preferred resources must be not null.");
Preconditions.checkArgument(minResources.isValid() && preferredResources.isValid() && minResources.lessThanOrEqual(preferredResources),
"The values in resources must be not less than 0 and the preferred resources must be greater than the min resources.");
this.minResources = minResources;
this.preferredResources = preferredResources;
return this;
} | [
"private",
"DataSink",
"<",
"T",
">",
"setResources",
"(",
"ResourceSpec",
"minResources",
",",
"ResourceSpec",
"preferredResources",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"minResources",
",",
"\"The min resources must be not null.\"",
")",
";",
"Precondi... | Sets the minimum and preferred resources for this data sink. and the lower and upper resource limits
will be considered in resource resize feature for future plan.
@param minResources The minimum resources for this data sink.
@param preferredResources The preferred resources for this data sink.
@return The data sink with set minimum and preferred resources. | [
"Sets",
"the",
"minimum",
"and",
"preferred",
"resources",
"for",
"this",
"data",
"sink",
".",
"and",
"the",
"lower",
"and",
"upper",
"resource",
"limits",
"will",
"be",
"considered",
"in",
"resource",
"resize",
"feature",
"for",
"future",
"plan",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/DataSink.java#L332-L342 | train | Sets the resources. | [
30522,
2797,
2951,
11493,
2243,
1026,
1056,
1028,
2275,
6072,
8162,
9623,
1006,
4219,
5051,
2278,
8117,
6072,
8162,
9623,
1010,
4219,
5051,
2278,
6871,
6072,
8162,
9623,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/undirected/TriangleListing.java | TriangleListing.runInternal | @Override
public DataSet<Result<K>> runInternal(Graph<K, VV, EV> input)
throws Exception {
// u, v where u < v
DataSet<Tuple2<K, K>> filteredByID = input
.getEdges()
.flatMap(new FilterByID<>())
.setParallelism(parallelism)
.name("Filter by ID");
// u, v, (edge value, deg(u), deg(v))
DataSet<Edge<K, Tuple3<EV, LongValue, LongValue>>> pairDegree = input
.run(new EdgeDegreePair<K, VV, EV>()
.setParallelism(parallelism));
// u, v where deg(u) < deg(v) or (deg(u) == deg(v) and u < v)
DataSet<Tuple2<K, K>> filteredByDegree = pairDegree
.flatMap(new FilterByDegree<>())
.setParallelism(parallelism)
.name("Filter by degree");
// u, v, w where (u, v) and (u, w) are edges in graph, v < w
DataSet<Tuple3<K, K, K>> triplets = filteredByDegree
.groupBy(0)
.sortGroup(1, Order.ASCENDING)
.reduceGroup(new GenerateTriplets<>())
.name("Generate triplets");
// u, v, w where (u, v), (u, w), and (v, w) are edges in graph, v < w
DataSet<Result<K>> triangles = triplets
.join(filteredByID, JoinOperatorBase.JoinHint.REPARTITION_HASH_SECOND)
.where(1, 2)
.equalTo(0, 1)
.with(new ProjectTriangles<>())
.name("Triangle listing");
if (permuteResults) {
triangles = triangles
.flatMap(new PermuteResult<>())
.name("Permute triangle vertices");
} else if (sortTriangleVertices.get()) {
triangles = triangles
.map(new SortTriangleVertices<>())
.name("Sort triangle vertices");
}
return triangles;
} | java | @Override
public DataSet<Result<K>> runInternal(Graph<K, VV, EV> input)
throws Exception {
// u, v where u < v
DataSet<Tuple2<K, K>> filteredByID = input
.getEdges()
.flatMap(new FilterByID<>())
.setParallelism(parallelism)
.name("Filter by ID");
// u, v, (edge value, deg(u), deg(v))
DataSet<Edge<K, Tuple3<EV, LongValue, LongValue>>> pairDegree = input
.run(new EdgeDegreePair<K, VV, EV>()
.setParallelism(parallelism));
// u, v where deg(u) < deg(v) or (deg(u) == deg(v) and u < v)
DataSet<Tuple2<K, K>> filteredByDegree = pairDegree
.flatMap(new FilterByDegree<>())
.setParallelism(parallelism)
.name("Filter by degree");
// u, v, w where (u, v) and (u, w) are edges in graph, v < w
DataSet<Tuple3<K, K, K>> triplets = filteredByDegree
.groupBy(0)
.sortGroup(1, Order.ASCENDING)
.reduceGroup(new GenerateTriplets<>())
.name("Generate triplets");
// u, v, w where (u, v), (u, w), and (v, w) are edges in graph, v < w
DataSet<Result<K>> triangles = triplets
.join(filteredByID, JoinOperatorBase.JoinHint.REPARTITION_HASH_SECOND)
.where(1, 2)
.equalTo(0, 1)
.with(new ProjectTriangles<>())
.name("Triangle listing");
if (permuteResults) {
triangles = triangles
.flatMap(new PermuteResult<>())
.name("Permute triangle vertices");
} else if (sortTriangleVertices.get()) {
triangles = triangles
.map(new SortTriangleVertices<>())
.name("Sort triangle vertices");
}
return triangles;
} | [
"@",
"Override",
"public",
"DataSet",
"<",
"Result",
"<",
"K",
">",
">",
"runInternal",
"(",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"input",
")",
"throws",
"Exception",
"{",
"// u, v where u < v",
"DataSet",
"<",
"Tuple2",
"<",
"K",
",",
"K",
... | /*
Implementation notes:
The requirement that "K extends CopyableValue<K>" can be removed when
Flink has a self-join and GenerateTriplets is implemented as such.
ProjectTriangles should eventually be replaced by ".projectFirst("*")"
when projections use code generation. | [
"/",
"*",
"Implementation",
"notes",
":"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/undirected/TriangleListing.java#L80-L127 | train | Run the CRF algorithm. | [
30522,
1030,
2058,
15637,
2270,
2951,
13462,
1026,
2765,
1026,
1047,
1028,
1028,
2448,
18447,
11795,
2389,
1006,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
7953,
1007,
11618,
6453,
1063,
1013,
1013,
1057,
1010,
1058,
2073,
1057... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java | RestTemplateBuilder.requestFactory | public RestTemplateBuilder requestFactory(
Class<? extends ClientHttpRequestFactory> requestFactory) {
Assert.notNull(requestFactory, "RequestFactory must not be null");
return requestFactory(() -> createRequestFactory(requestFactory));
} | java | public RestTemplateBuilder requestFactory(
Class<? extends ClientHttpRequestFactory> requestFactory) {
Assert.notNull(requestFactory, "RequestFactory must not be null");
return requestFactory(() -> createRequestFactory(requestFactory));
} | [
"public",
"RestTemplateBuilder",
"requestFactory",
"(",
"Class",
"<",
"?",
"extends",
"ClientHttpRequestFactory",
">",
"requestFactory",
")",
"{",
"Assert",
".",
"notNull",
"(",
"requestFactory",
",",
"\"RequestFactory must not be null\"",
")",
";",
"return",
"requestFa... | Set the {@link ClientHttpRequestFactory} class that should be used with the
{@link RestTemplate}.
@param requestFactory the request factory to use
@return a new builder instance | [
"Set",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java#L309-L313 | train | Sets the request factory. | [
30522,
2270,
2717,
18532,
15725,
8569,
23891,
2099,
5227,
21450,
30524,
1000,
1007,
1025,
2709,
5227,
21450,
1006,
1006,
1007,
1011,
1028,
3443,
2890,
15500,
21450,
1006,
5227,
21450,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.