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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/flink | flink-container/src/main/java/org/apache/flink/container/entrypoint/JarManifestParser.java | JarManifestParser.findEntryClass | @VisibleForTesting
static Optional<String> findEntryClass(File jarFile) throws IOException {
return findFirstManifestAttribute(
jarFile,
PackagedProgram.MANIFEST_ATTRIBUTE_ASSEMBLER_CLASS,
PackagedProgram.MANIFEST_ATTRIBUTE_MAIN_CLASS);
} | java | @VisibleForTesting
static Optional<String> findEntryClass(File jarFile) throws IOException {
return findFirstManifestAttribute(
jarFile,
PackagedProgram.MANIFEST_ATTRIBUTE_ASSEMBLER_CLASS,
PackagedProgram.MANIFEST_ATTRIBUTE_MAIN_CLASS);
} | [
"@",
"VisibleForTesting",
"static",
"Optional",
"<",
"String",
">",
"findEntryClass",
"(",
"File",
"jarFile",
")",
"throws",
"IOException",
"{",
"return",
"findFirstManifestAttribute",
"(",
"jarFile",
",",
"PackagedProgram",
".",
"MANIFEST_ATTRIBUTE_ASSEMBLER_CLASS",
",... | Returns the entry class as specified in the manifest of the provided JAR file.
<p>The following manifest attributes are checked in order to find the entry class:
<ol>
<li>{@link PackagedProgram#MANIFEST_ATTRIBUTE_ASSEMBLER_CLASS}</li>
<li>{@link PackagedProgram#MANIFEST_ATTRIBUTE_MAIN_CLASS}</li>
</ol>
@param jarFile JAR file to parse
@return Optional holding entry class
@throws IOException If there is an error accessing the JAR | [
"Returns",
"the",
"entry",
"class",
"as",
"specified",
"in",
"the",
"manifest",
"of",
"the",
"provided",
"JAR",
"file",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-container/src/main/java/org/apache/flink/container/entrypoint/JarManifestParser.java#L103-L109 | train | Find the entry class from the manifest file. | [
30522,
1030,
5710,
13028,
4355,
2075,
10763,
11887,
1026,
5164,
1028,
2424,
4765,
2854,
26266,
1006,
5371,
15723,
8873,
2571,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
2424,
8873,
12096,
20799,
14081,
19321,
3089,
8569,
2618,
1006,
15723,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/resource/ResourceUtil.java | ResourceUtil.getReader | public static BufferedReader getReader(String resurce, Charset charset) {
return getResourceObj(resurce).getReader(charset);
} | java | public static BufferedReader getReader(String resurce, Charset charset) {
return getResourceObj(resurce).getReader(charset);
} | [
"public",
"static",
"BufferedReader",
"getReader",
"(",
"String",
"resurce",
",",
"Charset",
"charset",
")",
"{",
"return",
"getResourceObj",
"(",
"resurce",
")",
".",
"getReader",
"(",
"charset",
")",
";",
"}"
] | 从ClassPath资源中获取{@link BufferedReader}
@param resurce ClassPath资源
@param charset 编码
@return {@link InputStream}
@since 3.1.2 | [
"从ClassPath资源中获取",
"{",
"@link",
"BufferedReader",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java#L87-L89 | train | Get a BufferedReader for a given resource. | [
30522,
2270,
10763,
17698,
2098,
16416,
4063,
2131,
16416,
4063,
1006,
5164,
24501,
3126,
3401,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2709,
2131,
6072,
8162,
3401,
16429,
3501,
1006,
24501,
3126,
3401,
1007,
1012,
2131,
16416,
4063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.containsJob | @VisibleForTesting
public boolean containsJob(JobID jobId) {
Preconditions.checkState(JobLeaderService.State.STARTED == state, "The service is currently not running.");
return jobLeaderServices.containsKey(jobId);
} | java | @VisibleForTesting
public boolean containsJob(JobID jobId) {
Preconditions.checkState(JobLeaderService.State.STARTED == state, "The service is currently not running.");
return jobLeaderServices.containsKey(jobId);
} | [
"@",
"VisibleForTesting",
"public",
"boolean",
"containsJob",
"(",
"JobID",
"jobId",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"JobLeaderService",
".",
"State",
".",
"STARTED",
"==",
"state",
",",
"\"The service is currently not running.\"",
")",
";",
"retu... | Check whether the service monitors the given job.
@param jobId identifying the job
@return True if the given job is monitored; otherwise false | [
"Check",
"whether",
"the",
"service",
"monitors",
"the",
"given",
"job",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/JobLeaderService.java#L462-L467 | train | Checks if the service is running for the given job. | [
30522,
1030,
5710,
13028,
4355,
2075,
2270,
22017,
20898,
3397,
5558,
2497,
1006,
3105,
3593,
3105,
3593,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
14148,
12259,
30524,
2326,
2003,
2747,
2025,
2770,
1012,
1000,
1007,
1025,
2709,
3105,
1900... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-json/src/main/java/cn/hutool/json/JSONObject.java | JSONObject.toJSONString | @Override
public String toJSONString(int indentFactor) throws JSONException {
final StringWriter w = new StringWriter();
return this.write(w, indentFactor, 0).toString();
} | java | @Override
public String toJSONString(int indentFactor) throws JSONException {
final StringWriter w = new StringWriter();
return this.write(w, indentFactor, 0).toString();
} | [
"@",
"Override",
"public",
"String",
"toJSONString",
"(",
"int",
"indentFactor",
")",
"throws",
"JSONException",
"{",
"final",
"StringWriter",
"w",
"=",
"new",
"StringWriter",
"(",
")",
";",
"return",
"this",
".",
"write",
"(",
"w",
",",
"indentFactor",
",",... | 格式化输出JSON字符串
@param indentFactor 每层缩进空格数
@return JSON字符串
@throws JSONException 包含非法数抛出此异常 | [
"格式化输出JSON字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONObject.java#L597-L601 | train | Serialize a
object to a JSON string. | [
30522,
1030,
2058,
15637,
2270,
5164,
2000,
22578,
5644,
18886,
3070,
1006,
20014,
27427,
4765,
7011,
16761,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
2345,
5164,
15994,
1059,
1027,
2047,
5164,
15994,
1006,
1007,
1025,
2709,
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... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/Setting.java | Setting.getAndRemove | public Object getAndRemove(String... keys) {
Object value = null;
for (String key : keys) {
value = remove(key);
if (null != value) {
break;
}
}
return value;
} | java | public Object getAndRemove(String... keys) {
Object value = null;
for (String key : keys) {
value = remove(key);
if (null != value) {
break;
}
}
return value;
} | [
"public",
"Object",
"getAndRemove",
"(",
"String",
"...",
"keys",
")",
"{",
"Object",
"value",
"=",
"null",
";",
"for",
"(",
"String",
"key",
":",
"keys",
")",
"{",
"value",
"=",
"remove",
"(",
"key",
")",
";",
"if",
"(",
"null",
"!=",
"value",
")"... | 获取并删除键值对,当指定键对应值非空时,返回并删除这个值,后边的键对应的值不再查找
@param keys 键列表,常用于别名
@return 值
@since 3.1.2 | [
"获取并删除键值对,当指定键对应值非空时,返回并删除这个值,后边的键对应的值不再查找"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L229-L238 | train | Gets the value of the specified keys from the map and returns the corresponding value. | [
30522,
2270,
4874,
2131,
5685,
28578,
21818,
1006,
5164,
1012,
1012,
1012,
6309,
1007,
1063,
4874,
3643,
1027,
19701,
1025,
2005,
1006,
5164,
3145,
1024,
6309,
1007,
1063,
3643,
1027,
6366,
1006,
3145,
1007,
1025,
2065,
1006,
19701,
999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.elementText | public static String elementText(Element element, String tagName) {
Element child = getElement(element, tagName);
return child == null ? null : child.getTextContent();
} | java | public static String elementText(Element element, String tagName) {
Element child = getElement(element, tagName);
return child == null ? null : child.getTextContent();
} | [
"public",
"static",
"String",
"elementText",
"(",
"Element",
"element",
",",
"String",
"tagName",
")",
"{",
"Element",
"child",
"=",
"getElement",
"(",
"element",
",",
"tagName",
")",
";",
"return",
"child",
"==",
"null",
"?",
"null",
":",
"child",
".",
... | 根据节点名获得第一个子节点
@param element 节点
@param tagName 节点名
@return 节点中的值 | [
"根据节点名获得第一个子节点"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L479-L482 | train | Gets the text content of an element. | [
30522,
2270,
10763,
5164,
5783,
18209,
1006,
5783,
5783,
1010,
5164,
6415,
18442,
1007,
1063,
5783,
2775,
1027,
2131,
12260,
3672,
1006,
5783,
1010,
6415,
18442,
1007,
1025,
2709,
2775,
1027,
1027,
19701,
1029,
19701,
1024,
2775,
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-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/typeutils/BinaryRowSerializer.java | BinaryRowSerializer.checkSkipReadForFixLengthPart | public void checkSkipReadForFixLengthPart(AbstractPagedInputView source) throws IOException {
// skip if there is no enough size.
// Note: Use currentSegmentLimit instead of segmentSize.
int available = source.getCurrentSegmentLimit() - source.getCurrentPositionInSegment();
if (available < getSerializedRowFixedPartLength()) {
source.advance();
}
} | java | public void checkSkipReadForFixLengthPart(AbstractPagedInputView source) throws IOException {
// skip if there is no enough size.
// Note: Use currentSegmentLimit instead of segmentSize.
int available = source.getCurrentSegmentLimit() - source.getCurrentPositionInSegment();
if (available < getSerializedRowFixedPartLength()) {
source.advance();
}
} | [
"public",
"void",
"checkSkipReadForFixLengthPart",
"(",
"AbstractPagedInputView",
"source",
")",
"throws",
"IOException",
"{",
"// skip if there is no enough size.",
"// Note: Use currentSegmentLimit instead of segmentSize.",
"int",
"available",
"=",
"source",
".",
"getCurrentSegme... | We need skip bytes to read when the remain bytes of current segment is not
enough to write binary row fixed part. See {@link BinaryRow}. | [
"We",
"need",
"skip",
"bytes",
"to",
"read",
"when",
"the",
"remain",
"bytes",
"of",
"current",
"segment",
"is",
"not",
"enough",
"to",
"write",
"binary",
"row",
"fixed",
"part",
".",
"See",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/typeutils/BinaryRowSerializer.java#L298-L305 | train | Check if skip read for fix length part. | [
30522,
2270,
11675,
14148,
3211,
28139,
4215,
29278,
8873,
2595,
7770,
13512,
22269,
8445,
1006,
10061,
13704,
8718,
18780,
8584,
3120,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
13558,
2065,
2045,
2003,
2053,
2438,
2946,
1012,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/WordBasedSegment.java | WordBasedSegment.generateWord | protected static void generateWord(List<Vertex> linkedArray, WordNet wordNetOptimum)
{
fixResultByRule(linkedArray);
//--------------------------------------------------------------------
// 建造新词网
wordNetOptimum.addAll(linkedArray);
} | java | protected static void generateWord(List<Vertex> linkedArray, WordNet wordNetOptimum)
{
fixResultByRule(linkedArray);
//--------------------------------------------------------------------
// 建造新词网
wordNetOptimum.addAll(linkedArray);
} | [
"protected",
"static",
"void",
"generateWord",
"(",
"List",
"<",
"Vertex",
">",
"linkedArray",
",",
"WordNet",
"wordNetOptimum",
")",
"{",
"fixResultByRule",
"(",
"linkedArray",
")",
";",
"//--------------------------------------------------------------------",
"// 建造新词网",
... | 对粗分结果执行一些规则上的合并拆分等等,同时合成新词网
@param linkedArray 粗分结果
@param wordNetOptimum 合并了所有粗分结果的词网 | [
"对粗分结果执行一些规则上的合并拆分等等,同时合成新词网"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/WordBasedSegment.java#L48-L55 | train | Generate a word from a list of vertices. | [
30522,
5123,
10763,
11675,
9699,
18351,
1006,
2862,
1026,
19449,
1028,
5799,
2906,
9447,
1010,
2773,
7159,
2773,
7159,
7361,
3775,
27147,
1007,
1063,
8081,
6072,
11314,
3762,
6820,
2571,
1006,
5799,
2906,
9447,
1007,
1025,
1013,
1013,
1011,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/fs/Path.java | Path.read | @Override
public void read(DataInputView in) throws IOException {
final boolean isNotNull = in.readBoolean();
if (isNotNull) {
final String scheme = StringUtils.readNullableString(in);
final String userInfo = StringUtils.readNullableString(in);
final String host = StringUtils.readNullableString(in);
final int port = in.readInt();
final String path = StringUtils.readNullableString(in);
final String query = StringUtils.readNullableString(in);
final String fragment = StringUtils.readNullableString(in);
try {
uri = new URI(scheme, userInfo, host, port, path, query, fragment);
} catch (URISyntaxException e) {
throw new IOException("Error reconstructing URI", e);
}
}
} | java | @Override
public void read(DataInputView in) throws IOException {
final boolean isNotNull = in.readBoolean();
if (isNotNull) {
final String scheme = StringUtils.readNullableString(in);
final String userInfo = StringUtils.readNullableString(in);
final String host = StringUtils.readNullableString(in);
final int port = in.readInt();
final String path = StringUtils.readNullableString(in);
final String query = StringUtils.readNullableString(in);
final String fragment = StringUtils.readNullableString(in);
try {
uri = new URI(scheme, userInfo, host, port, path, query, fragment);
} catch (URISyntaxException e) {
throw new IOException("Error reconstructing URI", e);
}
}
} | [
"@",
"Override",
"public",
"void",
"read",
"(",
"DataInputView",
"in",
")",
"throws",
"IOException",
"{",
"final",
"boolean",
"isNotNull",
"=",
"in",
".",
"readBoolean",
"(",
")",
";",
"if",
"(",
"isNotNull",
")",
"{",
"final",
"String",
"scheme",
"=",
"... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/Path.java#L465-L483 | train | Read the content of the CIDENTENTENTENT XML. | [
30522,
1030,
2058,
15637,
2270,
11675,
3191,
1006,
2951,
2378,
18780,
8584,
1999,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
22017,
20898,
3475,
4140,
11231,
3363,
1027,
1999,
1012,
3191,
5092,
9890,
2319,
1006,
1007,
1025,
2065,
1006,
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-crypto/src/main/java/cn/hutool/crypto/asymmetric/BaseAsymmetric.java | BaseAsymmetric.init | @SuppressWarnings("unchecked")
protected T init(String algorithm, PrivateKey privateKey, PublicKey publicKey) {
this.algorithm = algorithm;
if (null == privateKey && null == publicKey) {
initKeys();
} else {
if (null != privateKey) {
this.privateKey = privateKey;
}
if (null != publicKey) {
this.publicKey = publicKey;
}
}
return (T) this;
} | java | @SuppressWarnings("unchecked")
protected T init(String algorithm, PrivateKey privateKey, PublicKey publicKey) {
this.algorithm = algorithm;
if (null == privateKey && null == publicKey) {
initKeys();
} else {
if (null != privateKey) {
this.privateKey = privateKey;
}
if (null != publicKey) {
this.publicKey = publicKey;
}
}
return (T) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"T",
"init",
"(",
"String",
"algorithm",
",",
"PrivateKey",
"privateKey",
",",
"PublicKey",
"publicKey",
")",
"{",
"this",
".",
"algorithm",
"=",
"algorithm",
";",
"if",
"(",
"null",
"==",
"pri... | 初始化<br>
私钥和公钥同时为空时生成一对新的私钥和公钥<br>
私钥和公钥可以单独传入一个,如此则只能使用此钥匙来做加密(签名)或者解密(校验)
@param algorithm 算法
@param privateKey 私钥
@param publicKey 公钥
@return this | [
"初始化<br",
">",
"私钥和公钥同时为空时生成一对新的私钥和公钥<br",
">",
"私钥和公钥可以单独传入一个,如此则只能使用此钥匙来做加密(签名)或者解密(校验)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/BaseAsymmetric.java#L58-L73 | train | Initializes the object with the specified parameters. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
5123,
1056,
1999,
4183,
1006,
5164,
9896,
1010,
2797,
14839,
2797,
14839,
1010,
2270,
14839,
2270,
14839,
1007,
1063,
2023,
1012,
9896,
1027,
9896,
1025,
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... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.get | public static String get(String urlString, Charset customCharset) {
return HttpRequest.get(urlString).charset(customCharset).execute().body();
} | java | public static String get(String urlString, Charset customCharset) {
return HttpRequest.get(urlString).charset(customCharset).execute().body();
} | [
"public",
"static",
"String",
"get",
"(",
"String",
"urlString",
",",
"Charset",
"customCharset",
")",
"{",
"return",
"HttpRequest",
".",
"get",
"(",
"urlString",
")",
".",
"charset",
"(",
"customCharset",
")",
".",
"execute",
"(",
")",
".",
"body",
"(",
... | 发送get请求
@param urlString 网址
@param customCharset 自定义请求字符集,如果字符集获取不到,使用此字符集
@return 返回内容,如果只检查状态码,正常只返回 "",不正常返回 null | [
"发送get请求"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L96-L98 | train | Gets the content of a URL. | [
30522,
2270,
10763,
5164,
2131,
1006,
5164,
24471,
4877,
18886,
3070,
1010,
25869,
13462,
7661,
7507,
22573,
2102,
1007,
1063,
2709,
8299,
2890,
15500,
1012,
2131,
1006,
24471,
4877,
18886,
3070,
1007,
1012,
25869,
13462,
1006,
7661,
7507,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-planner-blink/src/main/java/org/apache/flink/table/plan/rules/logical/FlinkAggregateExpandDistinctAggregatesRule.java | FlinkAggregateExpandDistinctAggregatesRule.doRewrite | private void doRewrite(RelBuilder relBuilder, Aggregate aggregate, int n,
List<Integer> argList, int filterArg, List<RexInputRef> refs) {
final RexBuilder rexBuilder = aggregate.getCluster().getRexBuilder();
final List<RelDataTypeField> leftFields;
if (n == 0) {
leftFields = null;
} else {
leftFields = relBuilder.peek().getRowType().getFieldList();
}
// Aggregate(
// child,
// {COUNT(DISTINCT 1), SUM(DISTINCT 1), SUM(2)})
//
// becomes
//
// Aggregate(
// Join(
// child,
// Aggregate(child, < all columns > {}),
// INNER,
// <f2 = f5>))
//
// E.g.
// SELECT deptno, SUM(DISTINCT sal), COUNT(DISTINCT gender), MAX(age)
// FROM Emps
// GROUP BY deptno
//
// becomes
//
// SELECT e.deptno, adsal.sum_sal, adgender.count_gender, e.max_age
// FROM (
// SELECT deptno, MAX(age) as max_age
// FROM Emps GROUP BY deptno) AS e
// JOIN (
// SELECT deptno, COUNT(gender) AS count_gender FROM (
// SELECT DISTINCT deptno, gender FROM Emps) AS dgender
// GROUP BY deptno) AS adgender
// ON e.deptno = adgender.deptno
// JOIN (
// SELECT deptno, SUM(sal) AS sum_sal FROM (
// SELECT DISTINCT deptno, sal FROM Emps) AS dsal
// GROUP BY deptno) AS adsal
// ON e.deptno = adsal.deptno
// GROUP BY e.deptno
//
// Note that if a query contains no non-distinct aggregates, then the
// very first join/group by is omitted. In the example above, if
// MAX(age) is removed, then the sub-select of "e" is not needed, and
// instead the two other group by's are joined to one another.
// Project the columns of the GROUP BY plus the arguments
// to the agg function.
final Map<Integer, Integer> sourceOf = new HashMap<>();
createSelectDistinct(relBuilder, aggregate, argList, filterArg, sourceOf);
// Now compute the aggregate functions on top of the distinct dataset.
// Each distinct agg becomes a non-distinct call to the corresponding
// field from the right; for example,
// "COUNT(DISTINCT e.sal)"
// becomes
// "COUNT(distinct_e.sal)".
final List<AggregateCall> aggCallList = new ArrayList<>();
final List<AggregateCall> aggCalls = aggregate.getAggCallList();
final int groupAndIndicatorCount =
aggregate.getGroupCount() + aggregate.getIndicatorCount();
int i = groupAndIndicatorCount - 1;
for (AggregateCall aggCall : aggCalls) {
++i;
// Ignore agg calls which are not distinct or have the wrong set
// arguments. If we're rewriting aggs whose args are {sal}, we will
// rewrite COUNT(DISTINCT sal) and SUM(DISTINCT sal) but ignore
// COUNT(DISTINCT gender) or SUM(sal).
if (!aggCall.isDistinct()) {
continue;
}
if (!aggCall.getArgList().equals(argList)) {
continue;
}
// Re-map arguments.
final int argCount = aggCall.getArgList().size();
final List<Integer> newArgs = new ArrayList<>(argCount);
for (int j = 0; j < argCount; j++) {
final Integer arg = aggCall.getArgList().get(j);
newArgs.add(sourceOf.get(arg));
}
final int newFilterArg =
aggCall.filterArg >= 0 ? sourceOf.get(aggCall.filterArg) : -1;
final AggregateCall newAggCall =
AggregateCall.create(aggCall.getAggregation(), false,
aggCall.isApproximate(), newArgs,
newFilterArg, aggCall.getType(), aggCall.getName());
assert refs.get(i) == null;
if (n == 0) {
refs.set(i,
new RexInputRef(groupAndIndicatorCount + aggCallList.size(),
newAggCall.getType()));
} else {
refs.set(i,
new RexInputRef(leftFields.size() + groupAndIndicatorCount
+ aggCallList.size(), newAggCall.getType()));
}
aggCallList.add(newAggCall);
}
final Map<Integer, Integer> map = new HashMap<>();
for (Integer key : aggregate.getGroupSet()) {
map.put(key, map.size());
}
final ImmutableBitSet newGroupSet = aggregate.getGroupSet().permute(map);
assert newGroupSet
.equals(ImmutableBitSet.range(aggregate.getGroupSet().cardinality()));
com.google.common.collect.ImmutableList<ImmutableBitSet> newGroupingSets = null;
if (aggregate.indicator) {
newGroupingSets =
ImmutableBitSet.ORDERING.immutableSortedCopy(
ImmutableBitSet.permute(aggregate.getGroupSets(), map));
}
relBuilder.push(
aggregate.copy(aggregate.getTraitSet(), relBuilder.build(),
aggregate.indicator, newGroupSet, newGroupingSets, aggCallList));
// If there's no left child yet, no need to create the join
if (n == 0) {
return;
}
// Create the join condition. It is of the form
// 'left.f0 = right.f0 and left.f1 = right.f1 and ...'
// where {f0, f1, ...} are the GROUP BY fields.
final List<RelDataTypeField> distinctFields =
relBuilder.peek().getRowType().getFieldList();
final List<RexNode> conditions = com.google.common.collect.Lists.newArrayList();
for (i = 0; i < groupAndIndicatorCount; ++i) {
// null values form its own group
// use "is not distinct from" so that the join condition
// allows null values to match.
conditions.add(
rexBuilder.makeCall(SqlStdOperatorTable.IS_NOT_DISTINCT_FROM,
RexInputRef.of(i, leftFields),
new RexInputRef(leftFields.size() + i,
distinctFields.get(i).getType())));
}
// Join in the new 'select distinct' relation.
relBuilder.join(JoinRelType.INNER, conditions);
} | java | private void doRewrite(RelBuilder relBuilder, Aggregate aggregate, int n,
List<Integer> argList, int filterArg, List<RexInputRef> refs) {
final RexBuilder rexBuilder = aggregate.getCluster().getRexBuilder();
final List<RelDataTypeField> leftFields;
if (n == 0) {
leftFields = null;
} else {
leftFields = relBuilder.peek().getRowType().getFieldList();
}
// Aggregate(
// child,
// {COUNT(DISTINCT 1), SUM(DISTINCT 1), SUM(2)})
//
// becomes
//
// Aggregate(
// Join(
// child,
// Aggregate(child, < all columns > {}),
// INNER,
// <f2 = f5>))
//
// E.g.
// SELECT deptno, SUM(DISTINCT sal), COUNT(DISTINCT gender), MAX(age)
// FROM Emps
// GROUP BY deptno
//
// becomes
//
// SELECT e.deptno, adsal.sum_sal, adgender.count_gender, e.max_age
// FROM (
// SELECT deptno, MAX(age) as max_age
// FROM Emps GROUP BY deptno) AS e
// JOIN (
// SELECT deptno, COUNT(gender) AS count_gender FROM (
// SELECT DISTINCT deptno, gender FROM Emps) AS dgender
// GROUP BY deptno) AS adgender
// ON e.deptno = adgender.deptno
// JOIN (
// SELECT deptno, SUM(sal) AS sum_sal FROM (
// SELECT DISTINCT deptno, sal FROM Emps) AS dsal
// GROUP BY deptno) AS adsal
// ON e.deptno = adsal.deptno
// GROUP BY e.deptno
//
// Note that if a query contains no non-distinct aggregates, then the
// very first join/group by is omitted. In the example above, if
// MAX(age) is removed, then the sub-select of "e" is not needed, and
// instead the two other group by's are joined to one another.
// Project the columns of the GROUP BY plus the arguments
// to the agg function.
final Map<Integer, Integer> sourceOf = new HashMap<>();
createSelectDistinct(relBuilder, aggregate, argList, filterArg, sourceOf);
// Now compute the aggregate functions on top of the distinct dataset.
// Each distinct agg becomes a non-distinct call to the corresponding
// field from the right; for example,
// "COUNT(DISTINCT e.sal)"
// becomes
// "COUNT(distinct_e.sal)".
final List<AggregateCall> aggCallList = new ArrayList<>();
final List<AggregateCall> aggCalls = aggregate.getAggCallList();
final int groupAndIndicatorCount =
aggregate.getGroupCount() + aggregate.getIndicatorCount();
int i = groupAndIndicatorCount - 1;
for (AggregateCall aggCall : aggCalls) {
++i;
// Ignore agg calls which are not distinct or have the wrong set
// arguments. If we're rewriting aggs whose args are {sal}, we will
// rewrite COUNT(DISTINCT sal) and SUM(DISTINCT sal) but ignore
// COUNT(DISTINCT gender) or SUM(sal).
if (!aggCall.isDistinct()) {
continue;
}
if (!aggCall.getArgList().equals(argList)) {
continue;
}
// Re-map arguments.
final int argCount = aggCall.getArgList().size();
final List<Integer> newArgs = new ArrayList<>(argCount);
for (int j = 0; j < argCount; j++) {
final Integer arg = aggCall.getArgList().get(j);
newArgs.add(sourceOf.get(arg));
}
final int newFilterArg =
aggCall.filterArg >= 0 ? sourceOf.get(aggCall.filterArg) : -1;
final AggregateCall newAggCall =
AggregateCall.create(aggCall.getAggregation(), false,
aggCall.isApproximate(), newArgs,
newFilterArg, aggCall.getType(), aggCall.getName());
assert refs.get(i) == null;
if (n == 0) {
refs.set(i,
new RexInputRef(groupAndIndicatorCount + aggCallList.size(),
newAggCall.getType()));
} else {
refs.set(i,
new RexInputRef(leftFields.size() + groupAndIndicatorCount
+ aggCallList.size(), newAggCall.getType()));
}
aggCallList.add(newAggCall);
}
final Map<Integer, Integer> map = new HashMap<>();
for (Integer key : aggregate.getGroupSet()) {
map.put(key, map.size());
}
final ImmutableBitSet newGroupSet = aggregate.getGroupSet().permute(map);
assert newGroupSet
.equals(ImmutableBitSet.range(aggregate.getGroupSet().cardinality()));
com.google.common.collect.ImmutableList<ImmutableBitSet> newGroupingSets = null;
if (aggregate.indicator) {
newGroupingSets =
ImmutableBitSet.ORDERING.immutableSortedCopy(
ImmutableBitSet.permute(aggregate.getGroupSets(), map));
}
relBuilder.push(
aggregate.copy(aggregate.getTraitSet(), relBuilder.build(),
aggregate.indicator, newGroupSet, newGroupingSets, aggCallList));
// If there's no left child yet, no need to create the join
if (n == 0) {
return;
}
// Create the join condition. It is of the form
// 'left.f0 = right.f0 and left.f1 = right.f1 and ...'
// where {f0, f1, ...} are the GROUP BY fields.
final List<RelDataTypeField> distinctFields =
relBuilder.peek().getRowType().getFieldList();
final List<RexNode> conditions = com.google.common.collect.Lists.newArrayList();
for (i = 0; i < groupAndIndicatorCount; ++i) {
// null values form its own group
// use "is not distinct from" so that the join condition
// allows null values to match.
conditions.add(
rexBuilder.makeCall(SqlStdOperatorTable.IS_NOT_DISTINCT_FROM,
RexInputRef.of(i, leftFields),
new RexInputRef(leftFields.size() + i,
distinctFields.get(i).getType())));
}
// Join in the new 'select distinct' relation.
relBuilder.join(JoinRelType.INNER, conditions);
} | [
"private",
"void",
"doRewrite",
"(",
"RelBuilder",
"relBuilder",
",",
"Aggregate",
"aggregate",
",",
"int",
"n",
",",
"List",
"<",
"Integer",
">",
"argList",
",",
"int",
"filterArg",
",",
"List",
"<",
"RexInputRef",
">",
"refs",
")",
"{",
"final",
"RexBuil... | Converts all distinct aggregate calls to a given set of arguments.
<p>This method is called several times, one for each set of arguments.
Each time it is called, it generates a JOIN to a new SELECT DISTINCT
relational expression, and modifies the set of top-level calls.
@param aggregate Original aggregate
@param n Ordinal of this in a join. {@code relBuilder} contains the
input relational expression (either the original
aggregate, the output from the previous call to this
method. {@code n} is 0 if we're converting the
first distinct aggregate in a query with no non-distinct
aggregates)
@param argList Arguments to the distinct aggregate function
@param filterArg Argument that filters input to aggregate function, or -1
@param refs Array of expressions which will be the projected by the
result of this rule. Those relating to this arg list will
be modified @return Relational expression | [
"Converts",
"all",
"distinct",
"aggregate",
"calls",
"to",
"a",
"given",
"set",
"of",
"arguments",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/rules/logical/FlinkAggregateExpandDistinctAggregatesRule.java#L642-L792 | train | Rewrite the result of a single aggregate. | [
30522,
2797,
11675,
2079,
15603,
17625,
1006,
2128,
20850,
19231,
4063,
2128,
20850,
19231,
4063,
1010,
9572,
9572,
30524,
1027,
9572,
1012,
2131,
20464,
19966,
2121,
1006,
1007,
1012,
2131,
2890,
2595,
8569,
23891,
2099,
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... |
netty/netty | handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java | ChunkedWriteHandler.resumeTransfer | public void resumeTransfer() {
final ChannelHandlerContext ctx = this.ctx;
if (ctx == null) {
return;
}
if (ctx.executor().inEventLoop()) {
resumeTransfer0(ctx);
} else {
// let the transfer resume on the next event loop round
ctx.executor().execute(new Runnable() {
@Override
public void run() {
resumeTransfer0(ctx);
}
});
}
} | java | public void resumeTransfer() {
final ChannelHandlerContext ctx = this.ctx;
if (ctx == null) {
return;
}
if (ctx.executor().inEventLoop()) {
resumeTransfer0(ctx);
} else {
// let the transfer resume on the next event loop round
ctx.executor().execute(new Runnable() {
@Override
public void run() {
resumeTransfer0(ctx);
}
});
}
} | [
"public",
"void",
"resumeTransfer",
"(",
")",
"{",
"final",
"ChannelHandlerContext",
"ctx",
"=",
"this",
".",
"ctx",
";",
"if",
"(",
"ctx",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"ctx",
".",
"executor",
"(",
")",
".",
"inEventLoop",
"... | Continues to fetch the chunks from the input. | [
"Continues",
"to",
"fetch",
"the",
"chunks",
"from",
"the",
"input",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java#L99-L116 | train | Resume the transfer of the current message. | [
30522,
2270,
11675,
13746,
6494,
3619,
7512,
1006,
1007,
1063,
2345,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1027,
2023,
1012,
14931,
2595,
1025,
2065,
1006,
14931,
2595,
1027,
1027,
19701,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
149... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/TypeUtil.java | TypeUtil.getActualTypes | public static Type[] getActualTypes(Type actualType, Class<?> typeDefineClass, Type... typeVariables) {
if (false == typeDefineClass.isAssignableFrom(getClass(actualType))) {
throw new IllegalArgumentException("Parameter [superClass] must be assignable from [clazz]");
}
// 泛型参数标识符列表
final TypeVariable<?>[] typeVars = typeDefineClass.getTypeParameters();
if(ArrayUtil.isEmpty(typeVars)) {
return null;
}
// 实际类型列表
final Type[] actualTypeArguments = TypeUtil.getTypeArguments(actualType);
if(ArrayUtil.isEmpty(actualTypeArguments)) {
return null;
}
int size = Math.min(actualTypeArguments.length, typeVars.length);
final Map<TypeVariable<?>, Type> tableMap = new TableMap<>(typeVars, actualTypeArguments);
// 查找方法定义所在类或接口中此泛型参数的位置
final Type[] result = new Type[size];
for(int i = 0; i < typeVariables.length; i++) {
result[i] = (typeVariables[i] instanceof TypeVariable) ? tableMap.get(typeVariables[i]) : typeVariables[i];
}
return result;
} | java | public static Type[] getActualTypes(Type actualType, Class<?> typeDefineClass, Type... typeVariables) {
if (false == typeDefineClass.isAssignableFrom(getClass(actualType))) {
throw new IllegalArgumentException("Parameter [superClass] must be assignable from [clazz]");
}
// 泛型参数标识符列表
final TypeVariable<?>[] typeVars = typeDefineClass.getTypeParameters();
if(ArrayUtil.isEmpty(typeVars)) {
return null;
}
// 实际类型列表
final Type[] actualTypeArguments = TypeUtil.getTypeArguments(actualType);
if(ArrayUtil.isEmpty(actualTypeArguments)) {
return null;
}
int size = Math.min(actualTypeArguments.length, typeVars.length);
final Map<TypeVariable<?>, Type> tableMap = new TableMap<>(typeVars, actualTypeArguments);
// 查找方法定义所在类或接口中此泛型参数的位置
final Type[] result = new Type[size];
for(int i = 0; i < typeVariables.length; i++) {
result[i] = (typeVariables[i] instanceof TypeVariable) ? tableMap.get(typeVariables[i]) : typeVariables[i];
}
return result;
} | [
"public",
"static",
"Type",
"[",
"]",
"getActualTypes",
"(",
"Type",
"actualType",
",",
"Class",
"<",
"?",
">",
"typeDefineClass",
",",
"Type",
"...",
"typeVariables",
")",
"{",
"if",
"(",
"false",
"==",
"typeDefineClass",
".",
"isAssignableFrom",
"(",
"getC... | 获取指定泛型变量对应的真实类型<br>
由于子类中泛型参数实现和父类(接口)中泛型定义位置是一一对应的,因此可以通过对应关系找到泛型实现类型<br>
使用此方法注意:
<pre>
1. superClass必须是clazz的父类或者clazz实现的接口
2. typeVariable必须在superClass中声明
</pre>
@param actualType 真实类型所在类,此类中记录了泛型参数对应的实际类型
@param typeDefineClass 泛型变量声明所在类或接口,此类中定义了泛型类型
@param typeVariables 泛型变量,需要的实际类型对应的泛型参数
@return 给定泛型参数对应的实际类型,如果无对应类型,返回null
@since 4.5.7 | [
"获取指定泛型变量对应的真实类型<br",
">",
"由于子类中泛型参数实现和父类(接口)中泛型定义位置是一一对应的,因此可以通过对应关系找到泛型实现类型<br",
">",
"使用此方法注意:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java#L281-L306 | train | Gets the actual types. | [
30522,
2270,
10763,
2828,
1031,
1033,
2131,
18908,
8787,
13874,
2015,
1006,
2828,
5025,
13874,
1010,
2465,
1026,
1029,
1028,
21189,
12879,
3170,
26266,
1010,
2828,
1012,
1012,
1012,
2828,
10755,
19210,
2015,
1007,
1063,
2065,
1006,
6270,
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... |
networknt/light-4j | cluster/src/main/java/com/networknt/cluster/LightCluster.java | LightCluster.serviceToUrl | @Override
public String serviceToUrl(String protocol, String serviceId, String tag, String requestKey) {
URL url = loadBalance.select(discovery(protocol, serviceId, tag), requestKey);
if(logger.isDebugEnabled()) logger.debug("final url after load balance = " + url);
// construct a url in string
return protocol + "://" + url.getHost() + ":" + url.getPort();
} | java | @Override
public String serviceToUrl(String protocol, String serviceId, String tag, String requestKey) {
URL url = loadBalance.select(discovery(protocol, serviceId, tag), requestKey);
if(logger.isDebugEnabled()) logger.debug("final url after load balance = " + url);
// construct a url in string
return protocol + "://" + url.getHost() + ":" + url.getPort();
} | [
"@",
"Override",
"public",
"String",
"serviceToUrl",
"(",
"String",
"protocol",
",",
"String",
"serviceId",
",",
"String",
"tag",
",",
"String",
"requestKey",
")",
"{",
"URL",
"url",
"=",
"loadBalance",
".",
"select",
"(",
"discovery",
"(",
"protocol",
",",
... | Implement serviceToUrl with client side service discovery.
@param protocol String
@param serviceId String
@param requestKey String
@return String | [
"Implement",
"serviceToUrl",
"with",
"client",
"side",
"service",
"discovery",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/cluster/src/main/java/com/networknt/cluster/LightCluster.java#L62-L68 | train | This method is used to get a URL from the service to the URL. | [
30522,
1030,
2058,
15637,
2270,
5164,
2326,
21163,
2140,
1006,
5164,
8778,
1010,
5164,
2326,
3593,
1010,
5164,
6415,
1010,
5164,
5227,
14839,
1007,
1063,
24471,
2140,
24471,
2140,
1027,
7170,
26657,
1012,
7276,
1006,
5456,
1006,
8778,
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/types/StringValue.java | StringValue.setValue | public void setValue(char[] chars, int offset, int len) {
checkNotNull(chars);
if (offset < 0 || len < 0 || offset > chars.length - len) {
throw new IndexOutOfBoundsException();
}
ensureSize(len);
System.arraycopy(chars, offset, this.value, 0, len);
this.len = len;
this.hashCode = 0;
} | java | public void setValue(char[] chars, int offset, int len) {
checkNotNull(chars);
if (offset < 0 || len < 0 || offset > chars.length - len) {
throw new IndexOutOfBoundsException();
}
ensureSize(len);
System.arraycopy(chars, offset, this.value, 0, len);
this.len = len;
this.hashCode = 0;
} | [
"public",
"void",
"setValue",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"checkNotNull",
"(",
"chars",
")",
";",
"if",
"(",
"offset",
"<",
"0",
"||",
"len",
"<",
"0",
"||",
"offset",
">",
"chars",
".",
"len... | Sets the value of the StringValue to a substring of the given value.
@param chars The new string value (as a character array).
@param offset The position to start the substring.
@param len The length of the substring. | [
"Sets",
"the",
"value",
"of",
"the",
"StringValue",
"to",
"a",
"substring",
"of",
"the",
"given",
"value",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/StringValue.java#L221-L231 | train | Sets the value of this object from the specified char array. | [
30522,
2270,
11675,
2275,
10175,
5657,
1006,
25869,
1031,
1033,
25869,
2015,
1010,
20014,
16396,
1010,
20014,
18798,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
25869,
2015,
1007,
1025,
2065,
1006,
16396,
1026,
1014,
1064,
1064,
18798,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java | JpaProperties.determineDatabase | @Deprecated
public Database determineDatabase(DataSource dataSource) {
if (this.database != null) {
return this.database;
}
return DatabaseLookup.getDatabase(dataSource);
} | java | @Deprecated
public Database determineDatabase(DataSource dataSource) {
if (this.database != null) {
return this.database;
}
return DatabaseLookup.getDatabase(dataSource);
} | [
"@",
"Deprecated",
"public",
"Database",
"determineDatabase",
"(",
"DataSource",
"dataSource",
")",
"{",
"if",
"(",
"this",
".",
"database",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"database",
";",
"}",
"return",
"DatabaseLookup",
".",
"getDatabase",
... | Determine the {@link Database} to use based on this configuration and the primary
{@link DataSource}.
@param dataSource the auto-configured data source
@return {@code Database}
@deprecated since 2.2.0 in favor of letting the JPA container detect the database
to use. | [
"Determine",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java#L140-L146 | train | Determine the database to use for the given data source. | [
30522,
1030,
2139,
28139,
12921,
2270,
7809,
4340,
6790,
15058,
1006,
2951,
6499,
3126,
3401,
2951,
6499,
3126,
3401,
1007,
1063,
2065,
1006,
2023,
1012,
7809,
999,
1027,
19701,
1007,
1063,
2709,
2023,
1012,
7809,
1025,
1065,
2709,
7809,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/runtime/streamrecord/StreamRecord.java | StreamRecord.replace | @SuppressWarnings("unchecked")
public <X> StreamRecord<X> replace(X element) {
this.value = (T) element;
return (StreamRecord<X>) this;
} | java | @SuppressWarnings("unchecked")
public <X> StreamRecord<X> replace(X element) {
this.value = (T) element;
return (StreamRecord<X>) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"X",
">",
"StreamRecord",
"<",
"X",
">",
"replace",
"(",
"X",
"element",
")",
"{",
"this",
".",
"value",
"=",
"(",
"T",
")",
"element",
";",
"return",
"(",
"StreamRecord",
"<",
"X",
"... | Replace the currently stored value by the given new value. This returns a StreamElement
with the generic type parameter that matches the new value while keeping the old
timestamp.
@param element Element to set in this stream value
@return Returns the StreamElement with replaced value | [
"Replace",
"the",
"currently",
"stored",
"value",
"by",
"the",
"given",
"new",
"value",
".",
"This",
"returns",
"a",
"StreamElement",
"with",
"the",
"generic",
"type",
"parameter",
"that",
"matches",
"the",
"new",
"value",
"while",
"keeping",
"the",
"old",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/StreamRecord.java#L104-L108 | train | Replaces the value of the record with the given element. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
1026,
1060,
1028,
5460,
2890,
27108,
2094,
1026,
1060,
1028,
5672,
1006,
1060,
5783,
1007,
1063,
2023,
1012,
3643,
1027,
1006,
1056,
1007,
5783,
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/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java | ExecutionGraph.getArchivedExecutionConfig | @Override
public ArchivedExecutionConfig getArchivedExecutionConfig() {
// create a summary of all relevant data accessed in the web interface's JobConfigHandler
try {
ExecutionConfig executionConfig = jobInformation.getSerializedExecutionConfig().deserializeValue(userClassLoader);
if (executionConfig != null) {
return executionConfig.archive();
}
} catch (IOException | ClassNotFoundException e) {
LOG.error("Couldn't create ArchivedExecutionConfig for job {} ", getJobID(), e);
}
return null;
} | java | @Override
public ArchivedExecutionConfig getArchivedExecutionConfig() {
// create a summary of all relevant data accessed in the web interface's JobConfigHandler
try {
ExecutionConfig executionConfig = jobInformation.getSerializedExecutionConfig().deserializeValue(userClassLoader);
if (executionConfig != null) {
return executionConfig.archive();
}
} catch (IOException | ClassNotFoundException e) {
LOG.error("Couldn't create ArchivedExecutionConfig for job {} ", getJobID(), e);
}
return null;
} | [
"@",
"Override",
"public",
"ArchivedExecutionConfig",
"getArchivedExecutionConfig",
"(",
")",
"{",
"// create a summary of all relevant data accessed in the web interface's JobConfigHandler",
"try",
"{",
"ExecutionConfig",
"executionConfig",
"=",
"jobInformation",
".",
"getSerialized... | Returns the serializable {@link ArchivedExecutionConfig}.
@return ArchivedExecutionConfig which may be null in case of errors | [
"Returns",
"the",
"serializable",
"{",
"@link",
"ArchivedExecutionConfig",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java#L1282-L1294 | train | This method is used to get the archived execution config. | [
30522,
1030,
2058,
15637,
2270,
9749,
10288,
8586,
13700,
8663,
8873,
2290,
2131,
2906,
5428,
7178,
10288,
8586,
13700,
8663,
8873,
2290,
1006,
1007,
1063,
1013,
1013,
3443,
1037,
12654,
1997,
2035,
7882,
2951,
11570,
1999,
1996,
4773,
8278... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/server/src/org/openqa/grid/internal/ExternalSessionKey.java | ExternalSessionKey.fromJsonResponseBody | public static ExternalSessionKey fromJsonResponseBody(String responseBody) {
try {
Map<String, Object> json = new Json().toType(responseBody, MAP_TYPE);
if (json.get("sessionId") instanceof String) {
return new ExternalSessionKey((String) json.get("sessionId"));
}
// W3C response
if (json.get("value") instanceof Map) {
Map<?, ?> value = (Map<?, ?>) json.get("value");
if (value.get("sessionId") instanceof String) {
return new ExternalSessionKey((String) value.get("sessionId"));
}
}
} catch (JsonException | ClassCastException e) {
return null;
}
return null;
} | java | public static ExternalSessionKey fromJsonResponseBody(String responseBody) {
try {
Map<String, Object> json = new Json().toType(responseBody, MAP_TYPE);
if (json.get("sessionId") instanceof String) {
return new ExternalSessionKey((String) json.get("sessionId"));
}
// W3C response
if (json.get("value") instanceof Map) {
Map<?, ?> value = (Map<?, ?>) json.get("value");
if (value.get("sessionId") instanceof String) {
return new ExternalSessionKey((String) value.get("sessionId"));
}
}
} catch (JsonException | ClassCastException e) {
return null;
}
return null;
} | [
"public",
"static",
"ExternalSessionKey",
"fromJsonResponseBody",
"(",
"String",
"responseBody",
")",
"{",
"try",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"json",
"=",
"new",
"Json",
"(",
")",
".",
"toType",
"(",
"responseBody",
",",
"MAP_TYPE",
")",
... | Extract the external key from the server response for a selenium2 new session request.
The response body is expected to be of the form {"status":0,"sessionId":"XXXX",...}.
@param responseBody the response body to parse
@return the extracted ExternalKey, or null if one was not found. | [
"Extract",
"the",
"external",
"key",
"from",
"the",
"server",
"response",
"for",
"a",
"selenium2",
"new",
"session",
"request",
".",
"The",
"response",
"body",
"is",
"expected",
"to",
"be",
"of",
"the",
"form",
"{",
"status",
":",
"0",
"sessionId",
":",
... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/ExternalSessionKey.java#L103-L122 | train | This method is used to create an ExternalSessionKey object from a JSON response body. | [
30522,
2270,
10763,
6327,
8583,
10992,
14839,
2013,
22578,
2239,
6072,
26029,
3366,
23684,
1006,
5164,
3433,
23684,
1007,
1063,
3046,
1063,
4949,
1026,
5164,
1010,
4874,
1028,
1046,
3385,
1027,
2047,
1046,
3385,
1006,
1007,
1012,
2000,
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/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricIteration.java | VertexCentricIteration.withEdges | public static <K, VV, EV, Message> VertexCentricIteration<K, VV, EV, Message> withEdges(
DataSet<Edge<K, EV>> edgesWithValue, ComputeFunction<K, VV, EV, Message> cf,
int maximumNumberOfIterations) {
return new VertexCentricIteration<>(cf, edgesWithValue, null,
maximumNumberOfIterations);
} | java | public static <K, VV, EV, Message> VertexCentricIteration<K, VV, EV, Message> withEdges(
DataSet<Edge<K, EV>> edgesWithValue, ComputeFunction<K, VV, EV, Message> cf,
int maximumNumberOfIterations) {
return new VertexCentricIteration<>(cf, edgesWithValue, null,
maximumNumberOfIterations);
} | [
"public",
"static",
"<",
"K",
",",
"VV",
",",
"EV",
",",
"Message",
">",
"VertexCentricIteration",
"<",
"K",
",",
"VV",
",",
"EV",
",",
"Message",
">",
"withEdges",
"(",
"DataSet",
"<",
"Edge",
"<",
"K",
",",
"EV",
">",
">",
"edgesWithValue",
",",
... | Creates a new vertex-centric iteration operator.
@param edgesWithValue The data set containing edges.
@param cf The compute function
@param <K> The type of the vertex key (the vertex identifier).
@param <VV> The type of the vertex value (the state of the vertex).
@param <Message> The type of the message sent between vertices along the edges.
@param <EV> The type of the values that are associated with the edges.
@return An instance of the vertex-centric graph computation operator. | [
"Creates",
"a",
"new",
"vertex",
"-",
"centric",
"iteration",
"operator",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/VertexCentricIteration.java#L238-L244 | train | Create a new VertexCentricIteration instance with edges with the specified compute function. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1010,
4471,
1028,
19449,
22461,
21646,
3370,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1010,
4471,
1028,
2007,
24225,
2015,
1006,
2951,
13462,
1026,
3341,
1026,
1047,
1010,
234... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/bean/BeanUtil.java | BeanUtil.mapToBean | public static <T> T mapToBean(Map<?, ?> map, Class<T> beanClass, CopyOptions copyOptions) {
return fillBeanWithMap(map, ReflectUtil.newInstance(beanClass), copyOptions);
} | java | public static <T> T mapToBean(Map<?, ?> map, Class<T> beanClass, CopyOptions copyOptions) {
return fillBeanWithMap(map, ReflectUtil.newInstance(beanClass), copyOptions);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"mapToBean",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"Class",
"<",
"T",
">",
"beanClass",
",",
"CopyOptions",
"copyOptions",
")",
"{",
"return",
"fillBeanWithMap",
"(",
"map",
",",
"ReflectUtil",
".",
... | Map转换为Bean对象
@param <T> Bean类型
@param map {@link Map}
@param beanClass Bean Class
@param copyOptions 转Bean选项
@return Bean | [
"Map转换为Bean对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L354-L356 | train | Creates a new instance of the specified bean class from the given map. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
4949,
3406,
4783,
2319,
1006,
4949,
1026,
1029,
1010,
1029,
1028,
4949,
1010,
2465,
1026,
1056,
1028,
14068,
26266,
1010,
6100,
7361,
9285,
6100,
7361,
9285,
1007,
1063,
2709,
6039,
4783,
2319,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/FileUtil.java | FileUtil.getWebRoot | public static File getWebRoot() {
final String classPath = ClassUtil.getClassPath();
if (StrUtil.isNotBlank(classPath)) {
return getParent(file(classPath), 2);
}
return null;
} | java | public static File getWebRoot() {
final String classPath = ClassUtil.getClassPath();
if (StrUtil.isNotBlank(classPath)) {
return getParent(file(classPath), 2);
}
return null;
} | [
"public",
"static",
"File",
"getWebRoot",
"(",
")",
"{",
"final",
"String",
"classPath",
"=",
"ClassUtil",
".",
"getClassPath",
"(",
")",
";",
"if",
"(",
"StrUtil",
".",
"isNotBlank",
"(",
"classPath",
")",
")",
"{",
"return",
"getParent",
"(",
"file",
"... | 获取Web项目下的web root路径<br>
原理是首先获取ClassPath路径,由于在web项目中ClassPath位于 WEB-INF/classes/下,故向上获取两级目录即可。
@return web root路径
@since 4.0.13 | [
"获取Web项目下的web",
"root路径<br",
">",
"原理是首先获取ClassPath路径,由于在web项目中ClassPath位于",
"WEB",
"-",
"INF",
"/",
"classes",
"/",
"下,故向上获取两级目录即可。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3310-L3316 | train | Returns the web root of the application. | [
30522,
2270,
10763,
5371,
2131,
8545,
12618,
4140,
1006,
1007,
1063,
2345,
5164,
2465,
15069,
1027,
2465,
21823,
2140,
1012,
2131,
26266,
15069,
1006,
1007,
1025,
2065,
1006,
2358,
22134,
4014,
1012,
3475,
4140,
28522,
8950,
1006,
2465,
150... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/map/MapUtil.java | MapUtil.sort | public static <K, V> TreeMap<K, V> sort(Map<K, V> map, Comparator<? super K> comparator) {
TreeMap<K, V> result;
if (map instanceof TreeMap) {
// 已经是可排序Map,此时只有比较器一致才返回原map
result = (TreeMap<K, V>) map;
if (null == comparator || comparator.equals(result.comparator())) {
return result;
}
} else {
result = newTreeMap(map, comparator);
}
return result;
} | java | public static <K, V> TreeMap<K, V> sort(Map<K, V> map, Comparator<? super K> comparator) {
TreeMap<K, V> result;
if (map instanceof TreeMap) {
// 已经是可排序Map,此时只有比较器一致才返回原map
result = (TreeMap<K, V>) map;
if (null == comparator || comparator.equals(result.comparator())) {
return result;
}
} else {
result = newTreeMap(map, comparator);
}
return result;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"TreeMap",
"<",
"K",
",",
"V",
">",
"sort",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"Comparator",
"<",
"?",
"super",
"K",
">",
"comparator",
")",
"{",
"TreeMap",
"<",
"K",
",",
"V",
">",
... | 排序已有Map,Key有序的Map
@param map Map
@param comparator Key比较器
@return TreeMap
@since 4.0.1
@see #newTreeMap(Map, Comparator) | [
"排序已有Map,Key有序的Map"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L651-L664 | train | Returns a new TreeMap that contains all the elements of the specified map sorted according to the specified comparator. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
3392,
2863,
2361,
1026,
1047,
1010,
1058,
1028,
4066,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
4949,
1010,
4012,
28689,
4263,
1026,
1029,
3565,
1047,
1028,
4012,
28689,
4263,
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/spark | launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java | AbstractLauncher.addFile | public T addFile(String file) {
checkNotNull(file, "file");
builder.files.add(file);
return self();
} | java | public T addFile(String file) {
checkNotNull(file, "file");
builder.files.add(file);
return self();
} | [
"public",
"T",
"addFile",
"(",
"String",
"file",
")",
"{",
"checkNotNull",
"(",
"file",
",",
"\"file\"",
")",
";",
"builder",
".",
"files",
".",
"add",
"(",
"file",
")",
";",
"return",
"self",
"(",
")",
";",
"}"
] | Adds a file to be submitted with the application.
@param file Path to the file.
@return This launcher. | [
"Adds",
"a",
"file",
"to",
"be",
"submitted",
"with",
"the",
"application",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java#L228-L232 | train | Add a file to the generated code. | [
30522,
2270,
1056,
5587,
8873,
2571,
1006,
5164,
5371,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
5371,
1010,
1000,
5371,
1000,
1007,
1025,
12508,
1012,
6764,
1012,
5587,
1006,
5371,
1007,
1025,
2709,
2969,
1006,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/DirectLogFetcher.java | DirectLogFetcher.close | public void close() throws IOException {
try {
if (conn != null) conn.close();
conn = null;
mysqlInput = null;
mysqlOutput = null;
} catch (SQLException e) {
logger.warn("Unable to close connection", e);
}
} | java | public void close() throws IOException {
try {
if (conn != null) conn.close();
conn = null;
mysqlInput = null;
mysqlOutput = null;
} catch (SQLException e) {
logger.warn("Unable to close connection", e);
}
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"if",
"(",
"conn",
"!=",
"null",
")",
"conn",
".",
"close",
"(",
")",
";",
"conn",
"=",
"null",
";",
"mysqlInput",
"=",
"null",
";",
"mysqlOutput",
"=",
"null",
";",
"}"... | {@inheritDoc}
@see com.taobao.tddl.dbsync.binlog.LogFetcher#close() | [
"{",
"@inheritDoc",
"}"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/DirectLogFetcher.java#L375-L385 | train | Closes the connection. | [
30522,
2270,
11675,
2485,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
3046,
1063,
2065,
1006,
9530,
2078,
999,
1027,
19701,
1007,
9530,
2078,
1012,
2485,
1006,
1007,
1025,
9530,
2078,
1027,
19701,
1025,
2026,
2015,
4160,
4115,
18780,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/network/api/writer/RecordWriter.java | RecordWriter.close | public void close() {
clearBuffers();
// make sure we terminate the thread in any case
if (outputFlusher.isPresent()) {
outputFlusher.get().terminate();
try {
outputFlusher.get().join();
} catch (InterruptedException e) {
// ignore on close
// restore interrupt flag to fast exit further blocking calls
Thread.currentThread().interrupt();
}
}
} | java | public void close() {
clearBuffers();
// make sure we terminate the thread in any case
if (outputFlusher.isPresent()) {
outputFlusher.get().terminate();
try {
outputFlusher.get().join();
} catch (InterruptedException e) {
// ignore on close
// restore interrupt flag to fast exit further blocking calls
Thread.currentThread().interrupt();
}
}
} | [
"public",
"void",
"close",
"(",
")",
"{",
"clearBuffers",
"(",
")",
";",
"// make sure we terminate the thread in any case",
"if",
"(",
"outputFlusher",
".",
"isPresent",
"(",
")",
")",
"{",
"outputFlusher",
".",
"get",
"(",
")",
".",
"terminate",
"(",
")",
... | Closes the writer. This stops the flushing thread (if there is one). | [
"Closes",
"the",
"writer",
".",
"This",
"stops",
"the",
"flushing",
"thread",
"(",
"if",
"there",
"is",
"one",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/writer/RecordWriter.java#L272-L285 | train | Close the output and flush the output buffer. | [
30522,
2270,
11675,
2485,
1006,
1007,
1063,
3154,
8569,
12494,
2015,
1006,
1007,
1025,
1013,
1013,
2191,
2469,
2057,
20320,
1996,
11689,
1999,
2151,
2553,
2065,
1006,
6434,
10258,
20668,
2121,
1012,
2003,
28994,
4765,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java | RuntimeUtil.execForLines | public static List<String> execForLines(String... cmds) throws IORuntimeException {
return execForLines(CharsetUtil.systemCharset(), cmds);
} | java | public static List<String> execForLines(String... cmds) throws IORuntimeException {
return execForLines(CharsetUtil.systemCharset(), cmds);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"execForLines",
"(",
"String",
"...",
"cmds",
")",
"throws",
"IORuntimeException",
"{",
"return",
"execForLines",
"(",
"CharsetUtil",
".",
"systemCharset",
"(",
")",
",",
"cmds",
")",
";",
"}"
] | 执行系统命令,使用系统默认编码
@param cmds 命令列表,每个元素代表一条命令
@return 执行结果,按行区分
@throws IORuntimeException IO异常 | [
"执行系统命令,使用系统默认编码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java#L52-L54 | train | Executes the given command on the system s output stream. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
4654,
8586,
29278,
12735,
1006,
5164,
1012,
1012,
1012,
4642,
5104,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
4654,
8586,
29278,
12735,
1006,
25869,
13462,
21823,
2140,
1012,
2291,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.addAllIfNotContains | public static <T> List<T> addAllIfNotContains(List<T> list, List<T> otherList) {
for (T t : otherList) {
if (false == list.contains(t)) {
list.add(t);
}
}
return list;
} | java | public static <T> List<T> addAllIfNotContains(List<T> list, List<T> otherList) {
for (T t : otherList) {
if (false == list.contains(t)) {
list.add(t);
}
}
return list;
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"addAllIfNotContains",
"(",
"List",
"<",
"T",
">",
"list",
",",
"List",
"<",
"T",
">",
"otherList",
")",
"{",
"for",
"(",
"T",
"t",
":",
"otherList",
")",
"{",
"if",
"(",
"false",
"==",
... | 将另一个列表中的元素加入到列表中,如果列表中已经存在此元素则忽略之
@param <T> 集合元素类型
@param list 列表
@param otherList 其它列表
@return 此列表 | [
"将另一个列表中的元素加入到列表中,如果列表中已经存在此元素则忽略之"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1818-L1825 | train | Adds all elements from the otherList to the list if they do not already exist. | [
30522,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
5587,
8095,
10128,
17048,
8663,
18249,
2015,
1006,
2862,
1026,
1056,
1028,
2862,
1010,
2862,
1026,
1056,
1028,
2060,
9863,
1007,
1063,
2005,
1006,
1056,
1056,
1024,
2060,
9863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/PromiseNotificationUtil.java | PromiseNotificationUtil.tryCancel | public static void tryCancel(Promise<?> p, InternalLogger logger) {
if (!p.cancel(false) && logger != null) {
Throwable err = p.cause();
if (err == null) {
logger.warn("Failed to cancel promise because it has succeeded already: {}", p);
} else {
logger.warn(
"Failed to cancel promise because it has failed already: {}, unnotified cause:",
p, err);
}
}
} | java | public static void tryCancel(Promise<?> p, InternalLogger logger) {
if (!p.cancel(false) && logger != null) {
Throwable err = p.cause();
if (err == null) {
logger.warn("Failed to cancel promise because it has succeeded already: {}", p);
} else {
logger.warn(
"Failed to cancel promise because it has failed already: {}, unnotified cause:",
p, err);
}
}
} | [
"public",
"static",
"void",
"tryCancel",
"(",
"Promise",
"<",
"?",
">",
"p",
",",
"InternalLogger",
"logger",
")",
"{",
"if",
"(",
"!",
"p",
".",
"cancel",
"(",
"false",
")",
"&&",
"logger",
"!=",
"null",
")",
"{",
"Throwable",
"err",
"=",
"p",
"."... | Try to cancel the {@link Promise} and log if {@code logger} is not {@code null} in case this fails. | [
"Try",
"to",
"cancel",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PromiseNotificationUtil.java#L31-L42 | train | Try to cancel a promise. | [
30522,
2270,
10763,
11675,
3046,
9336,
29109,
1006,
4872,
1026,
1029,
1028,
1052,
1010,
4722,
21197,
4590,
8833,
4590,
1007,
1063,
2065,
1006,
999,
1052,
1012,
17542,
1006,
6270,
1007,
1004,
1004,
8833,
4590,
999,
1027,
19701,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getDeclaredMethod | public static Method getDeclaredMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) throws SecurityException {
return ReflectUtil.getMethod(clazz, methodName, parameterTypes);
} | java | public static Method getDeclaredMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) throws SecurityException {
return ReflectUtil.getMethod(clazz, methodName, parameterTypes);
} | [
"public",
"static",
"Method",
"getDeclaredMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"throws",
"SecurityException",
"{",
"return",
"ReflectUtil",
".",
"getMethod",
"(",... | 查找指定类中的所有方法(包括非public方法),也包括父类和Object类的方法 找不到方法会返回<code>null</code>
@param clazz 被查找的类
@param methodName 方法名
@param parameterTypes 参数类型
@return 方法
@throws SecurityException 无访问权限抛出异常 | [
"查找指定类中的所有方法(包括非public方法),也包括父类和Object类的方法",
"找不到方法会返回<code",
">",
"null<",
"/",
"code",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L341-L343 | train | Get a Method object that implements the specified method name and parameter types. | [
30522,
2270,
10763,
4118,
2131,
3207,
20464,
12069,
22117,
11031,
7716,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
5164,
4118,
18442,
1010,
2465,
1026,
1029,
1028,
1012,
1012,
1012,
16381,
13874,
2015,
1007,
11618,
3036,
10288,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.replaceIPWithDomainName | public URLNormalizer replaceIPWithDomainName() {
URL u = toURL();
if (!PATTERN_DOMAIN.matcher(u.getHost()).matches()) {
try {
InetAddress addr = InetAddress.getByName(u.getHost());
String host = addr.getHostName();
if (!u.getHost().equalsIgnoreCase(host)) {
url = url.replaceFirst(u.getHost(), host);
}
} catch (UnknownHostException e) {
logger.debug("Cannot resolve IP to host for :" + u.getHost(), e);
}
}
return this;
} | java | public URLNormalizer replaceIPWithDomainName() {
URL u = toURL();
if (!PATTERN_DOMAIN.matcher(u.getHost()).matches()) {
try {
InetAddress addr = InetAddress.getByName(u.getHost());
String host = addr.getHostName();
if (!u.getHost().equalsIgnoreCase(host)) {
url = url.replaceFirst(u.getHost(), host);
}
} catch (UnknownHostException e) {
logger.debug("Cannot resolve IP to host for :" + u.getHost(), e);
}
}
return this;
} | [
"public",
"URLNormalizer",
"replaceIPWithDomainName",
"(",
")",
"{",
"URL",
"u",
"=",
"toURL",
"(",
")",
";",
"if",
"(",
"!",
"PATTERN_DOMAIN",
".",
"matcher",
"(",
"u",
".",
"getHost",
"(",
")",
")",
".",
"matches",
"(",
")",
")",
"{",
"try",
"{",
... | <p>Replaces IP address with domain name. This is often not
reliable due to virtual domain names and can be slow, as it has
to access the network.</p>
<code>http://208.77.188.166/ → http://www.example.com/</code>
@return this instance | [
"<p",
">",
"Replaces",
"IP",
"address",
"with",
"domain",
"name",
".",
"This",
"is",
"often",
"not",
"reliable",
"due",
"to",
"virtual",
"domain",
"names",
"and",
"can",
"be",
"slow",
"as",
"it",
"has",
"to",
"access",
"the",
"network",
".",
"<",
"/",
... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/URLNormalizer.java#L569-L583 | train | Replace IP with domain name. | [
30522,
2270,
24471,
19666,
2953,
9067,
17629,
5672,
11514,
24415,
9527,
8113,
18442,
1006,
1007,
1063,
24471,
2140,
1057,
1027,
2778,
2140,
1006,
1007,
1025,
2065,
1006,
999,
5418,
1035,
5884,
1012,
2674,
2121,
1006,
1057,
1012,
2131,
15006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/monitor/remote/DbRemoteConfigLoader.java | DbRemoteConfigLoader.loadRemoteAdapterConfigs | @Override
public void loadRemoteAdapterConfigs() {
try {
// 加载远程adapter配置
loadModifiedAdapterConfigs();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
} | java | @Override
public void loadRemoteAdapterConfigs() {
try {
// 加载远程adapter配置
loadModifiedAdapterConfigs();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
} | [
"@",
"Override",
"public",
"void",
"loadRemoteAdapterConfigs",
"(",
")",
"{",
"try",
"{",
"// 加载远程adapter配置\r",
"loadModifiedAdapterConfigs",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"e",
".",
"getMessage",
"... | 加载adapter配置 | [
"加载adapter配置"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/monitor/remote/DbRemoteConfigLoader.java#L134-L142 | train | Override this method to load the remote adapter configs. | [
30522,
1030,
2058,
15637,
2270,
11675,
7170,
28578,
12184,
8447,
13876,
2121,
8663,
8873,
5620,
1006,
1007,
1063,
3046,
1063,
1013,
1013,
1779,
100,
100,
100,
15581,
2121,
100,
100,
7170,
5302,
4305,
10451,
8447,
13876,
2121,
8663,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java | JobMaster.tryRestoreExecutionGraphFromSavepoint | private void tryRestoreExecutionGraphFromSavepoint(ExecutionGraph executionGraphToRestore, SavepointRestoreSettings savepointRestoreSettings) throws Exception {
if (savepointRestoreSettings.restoreSavepoint()) {
final CheckpointCoordinator checkpointCoordinator = executionGraphToRestore.getCheckpointCoordinator();
if (checkpointCoordinator != null) {
checkpointCoordinator.restoreSavepoint(
savepointRestoreSettings.getRestorePath(),
savepointRestoreSettings.allowNonRestoredState(),
executionGraphToRestore.getAllVertices(),
userCodeLoader);
}
}
} | java | private void tryRestoreExecutionGraphFromSavepoint(ExecutionGraph executionGraphToRestore, SavepointRestoreSettings savepointRestoreSettings) throws Exception {
if (savepointRestoreSettings.restoreSavepoint()) {
final CheckpointCoordinator checkpointCoordinator = executionGraphToRestore.getCheckpointCoordinator();
if (checkpointCoordinator != null) {
checkpointCoordinator.restoreSavepoint(
savepointRestoreSettings.getRestorePath(),
savepointRestoreSettings.allowNonRestoredState(),
executionGraphToRestore.getAllVertices(),
userCodeLoader);
}
}
} | [
"private",
"void",
"tryRestoreExecutionGraphFromSavepoint",
"(",
"ExecutionGraph",
"executionGraphToRestore",
",",
"SavepointRestoreSettings",
"savepointRestoreSettings",
")",
"throws",
"Exception",
"{",
"if",
"(",
"savepointRestoreSettings",
".",
"restoreSavepoint",
"(",
")",
... | Tries to restore the given {@link ExecutionGraph} from the provided {@link SavepointRestoreSettings}.
@param executionGraphToRestore {@link ExecutionGraph} which is supposed to be restored
@param savepointRestoreSettings {@link SavepointRestoreSettings} containing information about the savepoint to restore from
@throws Exception if the {@link ExecutionGraph} could not be restored | [
"Tries",
"to",
"restore",
"the",
"given",
"{",
"@link",
"ExecutionGraph",
"}",
"from",
"the",
"provided",
"{",
"@link",
"SavepointRestoreSettings",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java#L1126-L1137 | train | Try to restore the execution graph from a savepoint. | [
30522,
2797,
11675,
3046,
28533,
5686,
10288,
8586,
13700,
14413,
19699,
22225,
10696,
8400,
1006,
7781,
14413,
7781,
14413,
19277,
23809,
2063,
1010,
3828,
8400,
28533,
16610,
18319,
3070,
2015,
3828,
8400,
28533,
16610,
18319,
3070,
2015,
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/map/MapBuilder.java | MapBuilder.create | public static <K, V> MapBuilder<K, V> create(Map<K, V> map) {
return new MapBuilder<>(map);
} | java | public static <K, V> MapBuilder<K, V> create(Map<K, V> map) {
return new MapBuilder<>(map);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"MapBuilder",
"<",
"K",
",",
"V",
">",
"create",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
")",
"{",
"return",
"new",
"MapBuilder",
"<>",
"(",
"map",
")",
";",
"}"
] | 创建Builder
@param <K> Key类型
@param <V> Value类型
@param map Map实体类
@return MapBuilder
@since 3.2.3 | [
"创建Builder"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapBuilder.java#L24-L26 | train | Creates a new MapBuilder instance. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
4949,
8569,
23891,
2099,
1026,
1047,
1010,
1058,
1028,
3443,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
4949,
1007,
1063,
2709,
2047,
4949,
8569,
23891,
2099,
1026,
1028,
1006,
4949,
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-optimizer/src/main/java/org/apache/flink/optimizer/dataproperties/LocalProperties.java | LocalProperties.combine | public static LocalProperties combine(LocalProperties lp1, LocalProperties lp2) {
if (lp1.ordering != null) {
return lp1;
} else if (lp2.ordering != null) {
return lp2;
} else if (lp1.groupedFields != null) {
return lp1;
} else if (lp2.groupedFields != null) {
return lp2;
} else if (lp1.uniqueFields != null && !lp1.uniqueFields.isEmpty()) {
return lp1;
} else if (lp2.uniqueFields != null && !lp2.uniqueFields.isEmpty()) {
return lp2;
} else {
return lp1;
}
} | java | public static LocalProperties combine(LocalProperties lp1, LocalProperties lp2) {
if (lp1.ordering != null) {
return lp1;
} else if (lp2.ordering != null) {
return lp2;
} else if (lp1.groupedFields != null) {
return lp1;
} else if (lp2.groupedFields != null) {
return lp2;
} else if (lp1.uniqueFields != null && !lp1.uniqueFields.isEmpty()) {
return lp1;
} else if (lp2.uniqueFields != null && !lp2.uniqueFields.isEmpty()) {
return lp2;
} else {
return lp1;
}
} | [
"public",
"static",
"LocalProperties",
"combine",
"(",
"LocalProperties",
"lp1",
",",
"LocalProperties",
"lp2",
")",
"{",
"if",
"(",
"lp1",
".",
"ordering",
"!=",
"null",
")",
"{",
"return",
"lp1",
";",
"}",
"else",
"if",
"(",
"lp2",
".",
"ordering",
"!=... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dataproperties/LocalProperties.java#L275-L291 | train | Combine two LocalProperties. | [
30522,
2270,
10763,
2334,
21572,
4842,
7368,
11506,
1006,
2334,
21572,
4842,
7368,
6948,
2487,
1010,
2334,
21572,
4842,
7368,
6948,
2475,
1007,
1063,
2065,
1006,
6948,
2487,
1012,
13063,
999,
1027,
19701,
1007,
1063,
2709,
6948,
2487,
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/flink | flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgramUtils.java | PackagedProgramUtils.createJobGraph | public static JobGraph createJobGraph(
PackagedProgram packagedProgram,
Configuration configuration,
int defaultParallelism) throws ProgramInvocationException {
return createJobGraph(packagedProgram, configuration, defaultParallelism, null);
} | java | public static JobGraph createJobGraph(
PackagedProgram packagedProgram,
Configuration configuration,
int defaultParallelism) throws ProgramInvocationException {
return createJobGraph(packagedProgram, configuration, defaultParallelism, null);
} | [
"public",
"static",
"JobGraph",
"createJobGraph",
"(",
"PackagedProgram",
"packagedProgram",
",",
"Configuration",
"configuration",
",",
"int",
"defaultParallelism",
")",
"throws",
"ProgramInvocationException",
"{",
"return",
"createJobGraph",
"(",
"packagedProgram",
",",
... | Creates a {@link JobGraph} with a random {@link JobID}
from the given {@link PackagedProgram}.
@param packagedProgram to extract the JobGraph from
@param configuration to use for the optimizer and job graph generator
@param defaultParallelism for the JobGraph
@return JobGraph extracted from the PackagedProgram
@throws ProgramInvocationException if the JobGraph generation failed | [
"Creates",
"a",
"{",
"@link",
"JobGraph",
"}",
"with",
"a",
"random",
"{",
"@link",
"JobID",
"}",
"from",
"the",
"given",
"{",
"@link",
"PackagedProgram",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgramUtils.java#L118-L123 | train | Create a job graph from a C ++ packaged program. | [
30522,
2270,
10763,
3105,
14413,
3443,
5558,
2497,
14413,
1006,
21972,
21572,
13113,
21972,
21572,
13113,
1010,
9563,
9563,
1010,
20014,
12398,
28689,
6216,
28235,
1007,
11618,
2565,
2378,
19152,
10288,
24422,
1063,
2709,
3443,
5558,
2497,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/SpringApplication.java | SpringApplication.setDefaultProperties | public void setDefaultProperties(Properties defaultProperties) {
this.defaultProperties = new HashMap<>();
for (Object key : Collections.list(defaultProperties.propertyNames())) {
this.defaultProperties.put((String) key, defaultProperties.get(key));
}
} | java | public void setDefaultProperties(Properties defaultProperties) {
this.defaultProperties = new HashMap<>();
for (Object key : Collections.list(defaultProperties.propertyNames())) {
this.defaultProperties.put((String) key, defaultProperties.get(key));
}
} | [
"public",
"void",
"setDefaultProperties",
"(",
"Properties",
"defaultProperties",
")",
"{",
"this",
".",
"defaultProperties",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"Object",
"key",
":",
"Collections",
".",
"list",
"(",
"defaultProperties",
".... | Convenient alternative to {@link #setDefaultProperties(Map)}.
@param defaultProperties some {@link Properties} | [
"Convenient",
"alternative",
"to",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L1077-L1082 | train | Sets the default properties. | [
30522,
2270,
11675,
2275,
3207,
7011,
11314,
21572,
4842,
7368,
1006,
5144,
12398,
21572,
4842,
7368,
1007,
1063,
2023,
1012,
12398,
21572,
4842,
7368,
1027,
2047,
23325,
2863,
2361,
1026,
1028,
1006,
1007,
1025,
2005,
1006,
4874,
3145,
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... |
alibaba/canal | client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/service/ESSyncService.java | ESSyncService.delete | private void delete(ESSyncConfig config, Dml dml) {
List<Map<String, Object>> dataList = dml.getData();
if (dataList == null || dataList.isEmpty()) {
return;
}
SchemaItem schemaItem = config.getEsMapping().getSchemaItem();
for (Map<String, Object> data : dataList) {
if (data == null || data.isEmpty()) {
continue;
}
ESMapping mapping = config.getEsMapping();
// ------是主表------
if (schemaItem.getMainTable().getTableName().equalsIgnoreCase(dml.getTable())) {
if (mapping.get_id() != null) {
FieldItem idFieldItem = schemaItem.getIdFieldItem(mapping);
// 主键为简单字段
if (!idFieldItem.isMethod() && !idFieldItem.isBinaryOp()) {
Object idVal = esTemplate.getValFromData(mapping,
data,
idFieldItem.getFieldName(),
idFieldItem.getColumn().getColumnName());
if (logger.isTraceEnabled()) {
logger.trace("Main table delete es index, destination:{}, table: {}, index: {}, id: {}",
config.getDestination(),
dml.getTable(),
mapping.get_index(),
idVal);
}
esTemplate.delete(mapping, idVal, null);
} else {
// ------主键带函数, 查询sql获取主键删除------
// FIXME 删除时反查sql为空记录, 无法获获取 id field 值
mainTableDelete(config, dml, data);
}
} else {
FieldItem pkFieldItem = schemaItem.getIdFieldItem(mapping);
if (!pkFieldItem.isMethod() && !pkFieldItem.isBinaryOp()) {
Map<String, Object> esFieldData = new LinkedHashMap<>();
Object pkVal = esTemplate.getESDataFromDmlData(mapping, data, esFieldData);
if (logger.isTraceEnabled()) {
logger.trace("Main table delete es index, destination:{}, table: {}, index: {}, pk: {}",
config.getDestination(),
dml.getTable(),
mapping.get_index(),
pkVal);
}
esFieldData.remove(pkFieldItem.getFieldName());
esFieldData.keySet().forEach(key -> esFieldData.put(key, null));
esTemplate.delete(mapping, pkVal, esFieldData);
} else {
// ------主键带函数, 查询sql获取主键删除------
mainTableDelete(config, dml, data);
}
}
}
// 从表的操作
for (TableItem tableItem : schemaItem.getAliasTableItems().values()) {
if (tableItem.isMain()) {
continue;
}
if (!tableItem.getTableName().equals(dml.getTable())) {
continue;
}
// 关联条件出现在主表查询条件是否为简单字段
boolean allFieldsSimple = true;
for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) {
if (fieldItem.isMethod() || fieldItem.isBinaryOp()) {
allFieldsSimple = false;
break;
}
}
// 所有查询字段均为简单字段
if (allFieldsSimple) {
// 不是子查询
if (!tableItem.isSubQuery()) {
// ------关联表简单字段更新为null------
Map<String, Object> esFieldData = new LinkedHashMap<>();
for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) {
esFieldData.put(Util.cleanColumn(fieldItem.getFieldName()), null);
}
joinTableSimpleFieldOperation(config, dml, data, tableItem, esFieldData);
} else {
// ------关联子表简单字段更新------
subTableSimpleFieldOperation(config, dml, data, null, tableItem);
}
} else {
// ------关联子表复杂字段更新 执行全sql更新es------
wholeSqlOperation(config, dml, data, null, tableItem);
}
}
}
} | java | private void delete(ESSyncConfig config, Dml dml) {
List<Map<String, Object>> dataList = dml.getData();
if (dataList == null || dataList.isEmpty()) {
return;
}
SchemaItem schemaItem = config.getEsMapping().getSchemaItem();
for (Map<String, Object> data : dataList) {
if (data == null || data.isEmpty()) {
continue;
}
ESMapping mapping = config.getEsMapping();
// ------是主表------
if (schemaItem.getMainTable().getTableName().equalsIgnoreCase(dml.getTable())) {
if (mapping.get_id() != null) {
FieldItem idFieldItem = schemaItem.getIdFieldItem(mapping);
// 主键为简单字段
if (!idFieldItem.isMethod() && !idFieldItem.isBinaryOp()) {
Object idVal = esTemplate.getValFromData(mapping,
data,
idFieldItem.getFieldName(),
idFieldItem.getColumn().getColumnName());
if (logger.isTraceEnabled()) {
logger.trace("Main table delete es index, destination:{}, table: {}, index: {}, id: {}",
config.getDestination(),
dml.getTable(),
mapping.get_index(),
idVal);
}
esTemplate.delete(mapping, idVal, null);
} else {
// ------主键带函数, 查询sql获取主键删除------
// FIXME 删除时反查sql为空记录, 无法获获取 id field 值
mainTableDelete(config, dml, data);
}
} else {
FieldItem pkFieldItem = schemaItem.getIdFieldItem(mapping);
if (!pkFieldItem.isMethod() && !pkFieldItem.isBinaryOp()) {
Map<String, Object> esFieldData = new LinkedHashMap<>();
Object pkVal = esTemplate.getESDataFromDmlData(mapping, data, esFieldData);
if (logger.isTraceEnabled()) {
logger.trace("Main table delete es index, destination:{}, table: {}, index: {}, pk: {}",
config.getDestination(),
dml.getTable(),
mapping.get_index(),
pkVal);
}
esFieldData.remove(pkFieldItem.getFieldName());
esFieldData.keySet().forEach(key -> esFieldData.put(key, null));
esTemplate.delete(mapping, pkVal, esFieldData);
} else {
// ------主键带函数, 查询sql获取主键删除------
mainTableDelete(config, dml, data);
}
}
}
// 从表的操作
for (TableItem tableItem : schemaItem.getAliasTableItems().values()) {
if (tableItem.isMain()) {
continue;
}
if (!tableItem.getTableName().equals(dml.getTable())) {
continue;
}
// 关联条件出现在主表查询条件是否为简单字段
boolean allFieldsSimple = true;
for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) {
if (fieldItem.isMethod() || fieldItem.isBinaryOp()) {
allFieldsSimple = false;
break;
}
}
// 所有查询字段均为简单字段
if (allFieldsSimple) {
// 不是子查询
if (!tableItem.isSubQuery()) {
// ------关联表简单字段更新为null------
Map<String, Object> esFieldData = new LinkedHashMap<>();
for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) {
esFieldData.put(Util.cleanColumn(fieldItem.getFieldName()), null);
}
joinTableSimpleFieldOperation(config, dml, data, tableItem, esFieldData);
} else {
// ------关联子表简单字段更新------
subTableSimpleFieldOperation(config, dml, data, null, tableItem);
}
} else {
// ------关联子表复杂字段更新 执行全sql更新es------
wholeSqlOperation(config, dml, data, null, tableItem);
}
}
}
} | [
"private",
"void",
"delete",
"(",
"ESSyncConfig",
"config",
",",
"Dml",
"dml",
")",
"{",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"dataList",
"=",
"dml",
".",
"getData",
"(",
")",
";",
"if",
"(",
"dataList",
"==",
"null",
"||",
"... | 删除操作dml
@param config es配置
@param dml dml数据 | [
"删除操作dml"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/service/ESSyncService.java#L324-L424 | train | Delete all data in DML | [
30522,
2797,
11675,
3972,
12870,
1006,
9686,
6508,
12273,
8663,
8873,
2290,
9530,
8873,
2290,
1010,
1040,
19968,
1040,
19968,
1007,
1063,
2862,
1026,
4949,
1026,
5164,
1010,
4874,
1028,
1028,
2951,
9863,
1027,
1040,
19968,
1012,
2131,
2850,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | metrics/src/main/java/io/dropwizard/metrics/WeightedSnapshot.java | WeightedSnapshot.getStdDev | @Override
public double getStdDev() {
// two-pass algorithm for variance, avoids numeric overflow
if (values.length <= 1) {
return 0;
}
final double mean = getMean();
double variance = 0;
for (int i = 0; i < values.length; i++) {
final double diff = values[i] - mean;
variance += normWeights[i] * diff*diff;
}
return Math.sqrt(variance);
} | java | @Override
public double getStdDev() {
// two-pass algorithm for variance, avoids numeric overflow
if (values.length <= 1) {
return 0;
}
final double mean = getMean();
double variance = 0;
for (int i = 0; i < values.length; i++) {
final double diff = values[i] - mean;
variance += normWeights[i] * diff*diff;
}
return Math.sqrt(variance);
} | [
"@",
"Override",
"public",
"double",
"getStdDev",
"(",
")",
"{",
"// two-pass algorithm for variance, avoids numeric overflow",
"if",
"(",
"values",
".",
"length",
"<=",
"1",
")",
"{",
"return",
"0",
";",
"}",
"final",
"double",
"mean",
"=",
"getMean",
"(",
")... | Returns the weighted standard deviation of the values in the snapshot.
@return the weighted standard deviation value | [
"Returns",
"the",
"weighted",
"standard",
"deviation",
"of",
"the",
"values",
"in",
"the",
"snapshot",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/WeightedSnapshot.java#L186-L203 | train | Get the standard deviation of the Cumulative Cumulative | [
30522,
1030,
2058,
15637,
2270,
3313,
4152,
2102,
14141,
6777,
1006,
1007,
1063,
1013,
1013,
2048,
1011,
3413,
9896,
2005,
23284,
1010,
26777,
16371,
25531,
2058,
12314,
2065,
1006,
5300,
1012,
3091,
1026,
1027,
1015,
1007,
1063,
2709,
1014... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/context/properties/bind/Bindable.java | Bindable.withAnnotations | public Bindable<T> withAnnotations(Annotation... annotations) {
return new Bindable<>(this.type, this.boxedType, this.value,
(annotations != null) ? annotations : NO_ANNOTATIONS);
} | java | public Bindable<T> withAnnotations(Annotation... annotations) {
return new Bindable<>(this.type, this.boxedType, this.value,
(annotations != null) ? annotations : NO_ANNOTATIONS);
} | [
"public",
"Bindable",
"<",
"T",
">",
"withAnnotations",
"(",
"Annotation",
"...",
"annotations",
")",
"{",
"return",
"new",
"Bindable",
"<>",
"(",
"this",
".",
"type",
",",
"this",
".",
"boxedType",
",",
"this",
".",
"value",
",",
"(",
"annotations",
"!=... | Create an updated {@link Bindable} instance with the specified annotations.
@param annotations the annotations
@return an updated {@link Bindable} | [
"Create",
"an",
"updated",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java#L151-L154 | train | Returns a copy of this object with the specified annotations. | [
30522,
2270,
14187,
3085,
1026,
1056,
1028,
2007,
11639,
17287,
9285,
1006,
5754,
17287,
3508,
1012,
1012,
1012,
5754,
17287,
9285,
1007,
1063,
2709,
2047,
14187,
3085,
1026,
1028,
1006,
2023,
1012,
2828,
1010,
2023,
1012,
27554,
13874,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.copy | public static long copy(Reader reader, Writer writer, int bufferSize) throws IORuntimeException {
return copy(reader, writer, bufferSize, null);
} | java | public static long copy(Reader reader, Writer writer, int bufferSize) throws IORuntimeException {
return copy(reader, writer, bufferSize, null);
} | [
"public",
"static",
"long",
"copy",
"(",
"Reader",
"reader",
",",
"Writer",
"writer",
",",
"int",
"bufferSize",
")",
"throws",
"IORuntimeException",
"{",
"return",
"copy",
"(",
"reader",
",",
"writer",
",",
"bufferSize",
",",
"null",
")",
";",
"}"
] | 将Reader中的内容复制到Writer中
@param reader Reader
@param writer Writer
@param bufferSize 缓存大小
@return 传输的byte数
@throws IORuntimeException IO异常 | [
"将Reader中的内容复制到Writer中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L86-L88 | train | Copies the contents of the specified reader to the specified writer using the default encoding. | [
30522,
2270,
10763,
2146,
6100,
1006,
8068,
8068,
1010,
3213,
3213,
1010,
20014,
17698,
5332,
4371,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
6100,
1006,
8068,
1010,
3213,
1010,
17698,
5332,
4371,
1010,
19701,
1007,
1025,
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/convert/ConverterRegistry.java | ConverterRegistry.putCustom | public ConverterRegistry putCustom(Type type, Class<? extends Converter<?>> converterClass) {
return putCustom(type, ReflectUtil.newInstance(converterClass));
} | java | public ConverterRegistry putCustom(Type type, Class<? extends Converter<?>> converterClass) {
return putCustom(type, ReflectUtil.newInstance(converterClass));
} | [
"public",
"ConverterRegistry",
"putCustom",
"(",
"Type",
"type",
",",
"Class",
"<",
"?",
"extends",
"Converter",
"<",
"?",
">",
">",
"converterClass",
")",
"{",
"return",
"putCustom",
"(",
"type",
",",
"ReflectUtil",
".",
"newInstance",
"(",
"converterClass",
... | 登记自定义转换器
@param type 转换的目标类型
@param converterClass 转换器类,必须有默认构造方法
@return {@link ConverterRegistry} | [
"登记自定义转换器"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/ConverterRegistry.java#L103-L105 | train | Add a custom converter class to the registry. | [
30522,
2270,
10463,
28849,
24063,
2854,
2404,
7874,
20389,
1006,
2828,
2828,
1010,
2465,
1026,
1029,
8908,
10463,
2121,
1026,
1029,
1028,
1028,
10463,
2121,
26266,
1007,
1063,
2709,
2404,
7874,
20389,
1006,
2828,
1010,
8339,
21823,
2140,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java | FastDatePrinter.appendFullDigits | private static void appendFullDigits(final Appendable buffer, int value, int minFieldWidth) throws IOException {
// specialized paths for 1 to 4 digits -> avoid the memory allocation from the temporary work array
// see LANG-1248
if (value < 10000) {
// less memory allocation path works for four digits or less
int nDigits = 4;
if (value < 1000) {
--nDigits;
if (value < 100) {
--nDigits;
if (value < 10) {
--nDigits;
}
}
}
// left zero pad
for (int i = minFieldWidth - nDigits; i > 0; --i) {
buffer.append('0');
}
switch (nDigits) {
case 4:
buffer.append((char) (value / 1000 + '0'));
value %= 1000;
case 3:
if (value >= 100) {
buffer.append((char) (value / 100 + '0'));
value %= 100;
} else {
buffer.append('0');
}
case 2:
if (value >= 10) {
buffer.append((char) (value / 10 + '0'));
value %= 10;
} else {
buffer.append('0');
}
case 1:
buffer.append((char) (value + '0'));
}
} else {
// more memory allocation path works for any digits
// build up decimal representation in reverse
final char[] work = new char[MAX_DIGITS];
int digit = 0;
while (value != 0) {
work[digit++] = (char) (value % 10 + '0');
value = value / 10;
}
// pad with zeros
while (digit < minFieldWidth) {
buffer.append('0');
--minFieldWidth;
}
// reverse
while (--digit >= 0) {
buffer.append(work[digit]);
}
}
} | java | private static void appendFullDigits(final Appendable buffer, int value, int minFieldWidth) throws IOException {
// specialized paths for 1 to 4 digits -> avoid the memory allocation from the temporary work array
// see LANG-1248
if (value < 10000) {
// less memory allocation path works for four digits or less
int nDigits = 4;
if (value < 1000) {
--nDigits;
if (value < 100) {
--nDigits;
if (value < 10) {
--nDigits;
}
}
}
// left zero pad
for (int i = minFieldWidth - nDigits; i > 0; --i) {
buffer.append('0');
}
switch (nDigits) {
case 4:
buffer.append((char) (value / 1000 + '0'));
value %= 1000;
case 3:
if (value >= 100) {
buffer.append((char) (value / 100 + '0'));
value %= 100;
} else {
buffer.append('0');
}
case 2:
if (value >= 10) {
buffer.append((char) (value / 10 + '0'));
value %= 10;
} else {
buffer.append('0');
}
case 1:
buffer.append((char) (value + '0'));
}
} else {
// more memory allocation path works for any digits
// build up decimal representation in reverse
final char[] work = new char[MAX_DIGITS];
int digit = 0;
while (value != 0) {
work[digit++] = (char) (value % 10 + '0');
value = value / 10;
}
// pad with zeros
while (digit < minFieldWidth) {
buffer.append('0');
--minFieldWidth;
}
// reverse
while (--digit >= 0) {
buffer.append(work[digit]);
}
}
} | [
"private",
"static",
"void",
"appendFullDigits",
"(",
"final",
"Appendable",
"buffer",
",",
"int",
"value",
",",
"int",
"minFieldWidth",
")",
"throws",
"IOException",
"{",
"// specialized paths for 1 to 4 digits -> avoid the memory allocation from the temporary work array",
"//... | Appends all digits to the given buffer.
@param buffer the buffer to append to.
@param value the value to append digits from. | [
"Appends",
"all",
"digits",
"to",
"the",
"given",
"buffer",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java#L426-L490 | train | Append full digits to the buffer. | [
30522,
2797,
10763,
11675,
10439,
10497,
3993,
6392,
8004,
12762,
1006,
2345,
10439,
10497,
3085,
17698,
1010,
20014,
3643,
1010,
20014,
8117,
3790,
9148,
11927,
2232,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
7772,
10425,
2005,
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... |
apache/flink | flink-metrics/flink-metrics-jmx/src/main/java/org/apache/flink/metrics/jmx/JMXReporter.java | JMXReporter.generateJmxTable | static Hashtable<String, String> generateJmxTable(Map<String, String> variables) {
Hashtable<String, String> ht = new Hashtable<>(variables.size());
for (Map.Entry<String, String> variable : variables.entrySet()) {
ht.put(replaceInvalidChars(variable.getKey()), replaceInvalidChars(variable.getValue()));
}
return ht;
} | java | static Hashtable<String, String> generateJmxTable(Map<String, String> variables) {
Hashtable<String, String> ht = new Hashtable<>(variables.size());
for (Map.Entry<String, String> variable : variables.entrySet()) {
ht.put(replaceInvalidChars(variable.getKey()), replaceInvalidChars(variable.getValue()));
}
return ht;
} | [
"static",
"Hashtable",
"<",
"String",
",",
"String",
">",
"generateJmxTable",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"variables",
")",
"{",
"Hashtable",
"<",
"String",
",",
"String",
">",
"ht",
"=",
"new",
"Hashtable",
"<>",
"(",
"variables",
"."... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-metrics/flink-metrics-jmx/src/main/java/org/apache/flink/metrics/jmx/JMXReporter.java#L225-L231 | train | Generate a table of the given map of variables. | [
30522,
10763,
23325,
10880,
1026,
5164,
1010,
5164,
1028,
9699,
24703,
18413,
3085,
1006,
4949,
1026,
5164,
1010,
5164,
1028,
10857,
1007,
1063,
23325,
10880,
1026,
5164,
1010,
5164,
1028,
1044,
2102,
1027,
2047,
23325,
10880,
1026,
1028,
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/util/ReflectUtil.java | ReflectUtil.getMethodNames | public static Set<String> getMethodNames(Class<?> clazz) throws SecurityException {
final HashSet<String> methodSet = new HashSet<String>();
final Method[] methods = getMethods(clazz);
for (Method method : methods) {
methodSet.add(method.getName());
}
return methodSet;
} | java | public static Set<String> getMethodNames(Class<?> clazz) throws SecurityException {
final HashSet<String> methodSet = new HashSet<String>();
final Method[] methods = getMethods(clazz);
for (Method method : methods) {
methodSet.add(method.getName());
}
return methodSet;
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"getMethodNames",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"throws",
"SecurityException",
"{",
"final",
"HashSet",
"<",
"String",
">",
"methodSet",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",... | 获得指定类中的Public方法名<br>
去重重载的方法
@param clazz 类
@return 方法名Set
@throws SecurityException 安全异常 | [
"获得指定类中的Public方法名<br",
">",
"去重重载的方法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L540-L547 | train | Returns a set of method names of all methods of the given class. | [
30522,
2270,
10763,
2275,
1026,
5164,
1028,
2131,
11368,
6806,
28911,
7834,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1007,
11618,
3036,
10288,
24422,
1063,
2345,
23325,
13462,
1026,
5164,
1028,
4725,
3388,
1027,
2047,
23325,
13462,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.getBeUint32 | public final long getBeUint32(final int pos) {
final int position = origin + pos;
if (pos + 3 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 3)));
byte[] buf = buffer;
return ((long) (0xff & buf[position + 3])) | ((long) (0xff & buf[position + 2]) << 8)
| ((long) (0xff & buf[position + 1]) << 16) | ((long) (0xff & buf[position]) << 24);
} | java | public final long getBeUint32(final int pos) {
final int position = origin + pos;
if (pos + 3 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 3)));
byte[] buf = buffer;
return ((long) (0xff & buf[position + 3])) | ((long) (0xff & buf[position + 2]) << 8)
| ((long) (0xff & buf[position + 1]) << 16) | ((long) (0xff & buf[position]) << 24);
} | [
"public",
"final",
"long",
"getBeUint32",
"(",
"final",
"int",
"pos",
")",
"{",
"final",
"int",
"position",
"=",
"origin",
"+",
"pos",
";",
"if",
"(",
"pos",
"+",
"3",
">=",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException... | Return 32-bit unsigned int from buffer. (big-endian)
@see mysql-5.6.10/include/myisampack.h - mi_usint4korr | [
"Return",
"32",
"-",
"bit",
"unsigned",
"int",
"from",
"buffer",
".",
"(",
"big",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L545-L554 | train | Gets a unsigned int from the buffer. | [
30522,
2270,
2345,
2146,
2131,
4783,
20023,
2102,
16703,
1006,
2345,
20014,
13433,
2015,
1007,
1063,
2345,
20014,
2597,
1027,
4761,
1009,
13433,
2015,
1025,
2065,
1006,
13433,
2015,
1009,
1017,
1028,
1027,
5787,
1064,
1064,
13433,
2015,
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... |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java | Scheduler.start | public Scheduler start() {
synchronized (lock) {
if (this.started) {
throw new CronException("Schedule is started!");
}
// 无界线程池,确保每一个需要执行的线程都可以及时运行,同时复用已有现成避免线程重复创建
this.threadExecutor = ExecutorBuilder.create().useSynchronousQueue().setThreadFactory(//
ThreadFactoryBuilder.create().setNamePrefix("hutool-cron-").setDaemon(this.daemon).build()//
).build();
this.taskLauncherManager = new TaskLauncherManager(this);
this.taskExecutorManager = new TaskExecutorManager(this);
// Start CronTimer
timer = new CronTimer(this);
timer.setDaemon(this.daemon);
timer.start();
this.started = true;
}
return this;
} | java | public Scheduler start() {
synchronized (lock) {
if (this.started) {
throw new CronException("Schedule is started!");
}
// 无界线程池,确保每一个需要执行的线程都可以及时运行,同时复用已有现成避免线程重复创建
this.threadExecutor = ExecutorBuilder.create().useSynchronousQueue().setThreadFactory(//
ThreadFactoryBuilder.create().setNamePrefix("hutool-cron-").setDaemon(this.daemon).build()//
).build();
this.taskLauncherManager = new TaskLauncherManager(this);
this.taskExecutorManager = new TaskExecutorManager(this);
// Start CronTimer
timer = new CronTimer(this);
timer.setDaemon(this.daemon);
timer.start();
this.started = true;
}
return this;
} | [
"public",
"Scheduler",
"start",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"this",
".",
"started",
")",
"{",
"throw",
"new",
"CronException",
"(",
"\"Schedule is started!\"",
")",
";",
"}",
"// 无界线程池,确保每一个需要执行的线程都可以及时运行,同时复用已有现成避免线程重复创建\r",
... | 启动
@return this | [
"启动"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java#L360-L380 | train | Start the scheduler. | [
30522,
2270,
6134,
2099,
2707,
1006,
1007,
1063,
25549,
1006,
5843,
1007,
1063,
2065,
1006,
2023,
1012,
2318,
1007,
1063,
5466,
2047,
13675,
5643,
2595,
24422,
1006,
1000,
6134,
2003,
2318,
999,
1000,
1007,
1025,
1065,
1013,
1013,
100,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java | WindowedStream.fold | @Deprecated
@Internal
public <R, ACC> SingleOutputStreamOperator<R> fold(
ACC initialValue,
FoldFunction<T, ACC> foldFunction,
ProcessWindowFunction<ACC, R, K, W> windowFunction,
TypeInformation<ACC> foldResultType,
TypeInformation<R> windowResultType) {
if (foldFunction instanceof RichFunction) {
throw new UnsupportedOperationException("FoldFunction can not be a RichFunction.");
}
if (windowAssigner instanceof MergingWindowAssigner) {
throw new UnsupportedOperationException("Fold cannot be used with a merging WindowAssigner.");
}
//clean the closures
windowFunction = input.getExecutionEnvironment().clean(windowFunction);
foldFunction = input.getExecutionEnvironment().clean(foldFunction);
final String opName = generateOperatorName(windowAssigner, trigger, evictor, foldFunction, windowFunction);
KeySelector<T, K> keySel = input.getKeySelector();
OneInputStreamOperator<T, R> operator;
if (evictor != null) {
@SuppressWarnings({"unchecked", "rawtypes"})
TypeSerializer<StreamRecord<T>> streamRecordSerializer =
(TypeSerializer<StreamRecord<T>>) new StreamElementSerializer(input.getType().createSerializer(getExecutionEnvironment().getConfig()));
ListStateDescriptor<StreamRecord<T>> stateDesc =
new ListStateDescriptor<>("window-contents", streamRecordSerializer);
operator =
new EvictingWindowOperator<>(windowAssigner,
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableProcessWindowFunction<>(new FoldApplyProcessWindowFunction<>(initialValue, foldFunction, windowFunction, foldResultType)),
trigger,
evictor,
allowedLateness,
lateDataOutputTag);
} else {
FoldingStateDescriptor<T, ACC> stateDesc = new FoldingStateDescriptor<>("window-contents",
initialValue,
foldFunction,
foldResultType.createSerializer(getExecutionEnvironment().getConfig()));
operator =
new WindowOperator<>(windowAssigner,
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueProcessWindowFunction<>(windowFunction),
trigger,
allowedLateness,
lateDataOutputTag);
}
return input.transform(opName, windowResultType, operator);
} | java | @Deprecated
@Internal
public <R, ACC> SingleOutputStreamOperator<R> fold(
ACC initialValue,
FoldFunction<T, ACC> foldFunction,
ProcessWindowFunction<ACC, R, K, W> windowFunction,
TypeInformation<ACC> foldResultType,
TypeInformation<R> windowResultType) {
if (foldFunction instanceof RichFunction) {
throw new UnsupportedOperationException("FoldFunction can not be a RichFunction.");
}
if (windowAssigner instanceof MergingWindowAssigner) {
throw new UnsupportedOperationException("Fold cannot be used with a merging WindowAssigner.");
}
//clean the closures
windowFunction = input.getExecutionEnvironment().clean(windowFunction);
foldFunction = input.getExecutionEnvironment().clean(foldFunction);
final String opName = generateOperatorName(windowAssigner, trigger, evictor, foldFunction, windowFunction);
KeySelector<T, K> keySel = input.getKeySelector();
OneInputStreamOperator<T, R> operator;
if (evictor != null) {
@SuppressWarnings({"unchecked", "rawtypes"})
TypeSerializer<StreamRecord<T>> streamRecordSerializer =
(TypeSerializer<StreamRecord<T>>) new StreamElementSerializer(input.getType().createSerializer(getExecutionEnvironment().getConfig()));
ListStateDescriptor<StreamRecord<T>> stateDesc =
new ListStateDescriptor<>("window-contents", streamRecordSerializer);
operator =
new EvictingWindowOperator<>(windowAssigner,
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableProcessWindowFunction<>(new FoldApplyProcessWindowFunction<>(initialValue, foldFunction, windowFunction, foldResultType)),
trigger,
evictor,
allowedLateness,
lateDataOutputTag);
} else {
FoldingStateDescriptor<T, ACC> stateDesc = new FoldingStateDescriptor<>("window-contents",
initialValue,
foldFunction,
foldResultType.createSerializer(getExecutionEnvironment().getConfig()));
operator =
new WindowOperator<>(windowAssigner,
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueProcessWindowFunction<>(windowFunction),
trigger,
allowedLateness,
lateDataOutputTag);
}
return input.transform(opName, windowResultType, operator);
} | [
"@",
"Deprecated",
"@",
"Internal",
"public",
"<",
"R",
",",
"ACC",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"fold",
"(",
"ACC",
"initialValue",
",",
"FoldFunction",
"<",
"T",
",",
"ACC",
">",
"foldFunction",
",",
"ProcessWindowFunction",
"<",
"ACC"... | Applies the given window function to each window. The window function is called for each
evaluation of the window for each key individually. The output of the window function is
interpreted as a regular non-windowed stream.
<p>Arriving data is incrementally aggregated using the given fold function.
@param initialValue the initial value to be passed to the first invocation of the fold function
@param foldFunction The fold function.
@param foldResultType The result type of the fold function.
@param windowFunction The process window function.
@param windowResultType The process window function result type.
@return The data stream that is the result of applying the fold function to the window.
@deprecated use {@link #aggregate(AggregateFunction, WindowFunction, TypeInformation, TypeInformation)} instead | [
"Applies",
"the",
"given",
"window",
"function",
"to",
"each",
"window",
".",
"The",
"window",
"function",
"is",
"called",
"for",
"each",
"evaluation",
"of",
"the",
"window",
"for",
"each",
"key",
"individually",
".",
"The",
"output",
"of",
"the",
"window",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java#L606-L669 | train | Folds the input stream into a single output stream. | [
30522,
1030,
2139,
28139,
12921,
1030,
4722,
2270,
1026,
1054,
1010,
16222,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
10671,
1006,
16222,
3988,
10175,
5657,
1010,
10671,
11263,
27989,
1026,
1056,
1010,
16222,
1028,
10671,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.consolidate | public CompositeByteBuf consolidate() {
ensureAccessible();
final int numComponents = componentCount;
if (numComponents <= 1) {
return this;
}
final int capacity = components[numComponents - 1].endOffset;
final ByteBuf consolidated = allocBuffer(capacity);
for (int i = 0; i < numComponents; i ++) {
components[i].transferTo(consolidated);
}
lastAccessed = null;
components[0] = new Component(consolidated, 0, 0, capacity, consolidated);
removeCompRange(1, numComponents);
return this;
} | java | public CompositeByteBuf consolidate() {
ensureAccessible();
final int numComponents = componentCount;
if (numComponents <= 1) {
return this;
}
final int capacity = components[numComponents - 1].endOffset;
final ByteBuf consolidated = allocBuffer(capacity);
for (int i = 0; i < numComponents; i ++) {
components[i].transferTo(consolidated);
}
lastAccessed = null;
components[0] = new Component(consolidated, 0, 0, capacity, consolidated);
removeCompRange(1, numComponents);
return this;
} | [
"public",
"CompositeByteBuf",
"consolidate",
"(",
")",
"{",
"ensureAccessible",
"(",
")",
";",
"final",
"int",
"numComponents",
"=",
"componentCount",
";",
"if",
"(",
"numComponents",
"<=",
"1",
")",
"{",
"return",
"this",
";",
"}",
"final",
"int",
"capacity... | Consolidate the composed {@link ByteBuf}s | [
"Consolidate",
"the",
"composed",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L1684-L1701 | train | Consolidates this CompositeByteBuf. | [
30522,
2270,
12490,
3762,
2618,
8569,
2546,
24939,
1006,
1007,
1063,
5676,
6305,
9623,
19307,
1006,
1007,
1025,
2345,
20014,
16371,
12458,
25377,
5643,
7666,
1027,
6922,
3597,
16671,
1025,
2065,
1006,
16371,
12458,
25377,
5643,
7666,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/lang/ObjectId.java | ObjectId.nextBytes | public static byte[] nextBytes() {
final ByteBuffer bb = ByteBuffer.wrap(new byte[12]);
bb.putInt((int) DateUtil.currentSeconds());// 4位
bb.putInt(machine);// 4位
bb.putInt(nextInc.getAndIncrement());// 4位
return bb.array();
} | java | public static byte[] nextBytes() {
final ByteBuffer bb = ByteBuffer.wrap(new byte[12]);
bb.putInt((int) DateUtil.currentSeconds());// 4位
bb.putInt(machine);// 4位
bb.putInt(nextInc.getAndIncrement());// 4位
return bb.array();
} | [
"public",
"static",
"byte",
"[",
"]",
"nextBytes",
"(",
")",
"{",
"final",
"ByteBuffer",
"bb",
"=",
"ByteBuffer",
".",
"wrap",
"(",
"new",
"byte",
"[",
"12",
"]",
")",
";",
"bb",
".",
"putInt",
"(",
"(",
"int",
")",
"DateUtil",
".",
"currentSeconds",... | 获取一个objectId的bytes表现形式
@return objectId
@since 4.1.15 | [
"获取一个objectId的bytes表现形式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/ObjectId.java#L77-L84 | train | Returns the next 16 bytes of data. | [
30522,
2270,
10763,
24880,
1031,
1033,
2279,
3762,
4570,
1006,
1007,
1063,
2345,
24880,
8569,
12494,
22861,
1027,
24880,
8569,
12494,
1012,
10236,
1006,
2047,
24880,
1031,
2260,
1033,
1007,
1025,
22861,
1012,
22072,
2102,
1006,
1006,
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/incubator-shardingsphere | sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/handshake/MySQLAuthenticationHandler.java | MySQLAuthenticationHandler.login | public boolean login(final String username, final byte[] authResponse) {
Optional<ProxyUser> user = getUser(username);
return user.isPresent() && (Strings.isNullOrEmpty(user.get().getPassword()) || Arrays.equals(getAuthCipherBytes(user.get().getPassword()), authResponse));
} | java | public boolean login(final String username, final byte[] authResponse) {
Optional<ProxyUser> user = getUser(username);
return user.isPresent() && (Strings.isNullOrEmpty(user.get().getPassword()) || Arrays.equals(getAuthCipherBytes(user.get().getPassword()), authResponse));
} | [
"public",
"boolean",
"login",
"(",
"final",
"String",
"username",
",",
"final",
"byte",
"[",
"]",
"authResponse",
")",
"{",
"Optional",
"<",
"ProxyUser",
">",
"user",
"=",
"getUser",
"(",
"username",
")",
";",
"return",
"user",
".",
"isPresent",
"(",
")"... | Login.
@param username connection username
@param authResponse connection auth response
@return login success or failure | [
"Login",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/handshake/MySQLAuthenticationHandler.java#L49-L52 | train | Check if the user is logged in. | [
30522,
2270,
22017,
20898,
8833,
2378,
1006,
2345,
5164,
5310,
18442,
1010,
2345,
24880,
1031,
1033,
8740,
2705,
6072,
26029,
3366,
1007,
1063,
11887,
1026,
24540,
20330,
1028,
5310,
1027,
2131,
20330,
1006,
5310,
18442,
1007,
1025,
2709,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/resourcemanager/JobLeaderIdService.java | JobLeaderIdService.start | public void start(JobLeaderIdActions initialJobLeaderIdActions) throws Exception {
if (isStarted()) {
clear();
}
this.jobLeaderIdActions = Preconditions.checkNotNull(initialJobLeaderIdActions);
} | java | public void start(JobLeaderIdActions initialJobLeaderIdActions) throws Exception {
if (isStarted()) {
clear();
}
this.jobLeaderIdActions = Preconditions.checkNotNull(initialJobLeaderIdActions);
} | [
"public",
"void",
"start",
"(",
"JobLeaderIdActions",
"initialJobLeaderIdActions",
")",
"throws",
"Exception",
"{",
"if",
"(",
"isStarted",
"(",
")",
")",
"{",
"clear",
"(",
")",
";",
"}",
"this",
".",
"jobLeaderIdActions",
"=",
"Preconditions",
".",
"checkNot... | Start the service with the given job leader actions.
@param initialJobLeaderIdActions to use for job leader id actions
@throws Exception which is thrown when clearing up old state | [
"Start",
"the",
"service",
"with",
"the",
"given",
"job",
"leader",
"actions",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/JobLeaderIdService.java#L87-L93 | train | Start the job leader manager. | [
30522,
2270,
11675,
2707,
1006,
3105,
19000,
8524,
22014,
3988,
5558,
3468,
9648,
14615,
18908,
8496,
1007,
11618,
6453,
1063,
2065,
1006,
26354,
7559,
3064,
1006,
1007,
1007,
1063,
3154,
1006,
1007,
1025,
1065,
2023,
1012,
3105,
19000,
852... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/dependency/nnparser/NeuralNetworkParser.java | NeuralNetworkParser.get_cluster_features | void get_cluster_features(final Context ctx,
final List<Integer> cluster4,
final List<Integer> cluster6,
final List<Integer> cluster,
List<Integer> features)
{
if (!use_cluster)
{
return;
}
PUSH(features, CLUSTER(cluster, ctx.S0));
PUSH(features, CLUSTER4(cluster4, ctx.S0));
PUSH(features, CLUSTER6(cluster6, ctx.S0));
PUSH(features, CLUSTER(cluster, ctx.S1));
PUSH(features, CLUSTER(cluster, ctx.S2));
PUSH(features, CLUSTER(cluster, ctx.N0));
PUSH(features, CLUSTER4(cluster4, ctx.N0));
PUSH(features, CLUSTER6(cluster6, ctx.N0));
PUSH(features, CLUSTER(cluster, ctx.N1));
PUSH(features, CLUSTER(cluster, ctx.N2));
PUSH(features, CLUSTER(cluster, ctx.S0L));
PUSH(features, CLUSTER(cluster, ctx.S0R));
PUSH(features, CLUSTER(cluster, ctx.S0L2));
PUSH(features, CLUSTER(cluster, ctx.S0R2));
PUSH(features, CLUSTER(cluster, ctx.S0LL));
PUSH(features, CLUSTER(cluster, ctx.S0RR));
PUSH(features, CLUSTER(cluster, ctx.S1L));
PUSH(features, CLUSTER(cluster, ctx.S1R));
PUSH(features, CLUSTER(cluster, ctx.S1L2));
PUSH(features, CLUSTER(cluster, ctx.S1R2));
PUSH(features, CLUSTER(cluster, ctx.S1LL));
PUSH(features, CLUSTER(cluster, ctx.S1RR));
} | java | void get_cluster_features(final Context ctx,
final List<Integer> cluster4,
final List<Integer> cluster6,
final List<Integer> cluster,
List<Integer> features)
{
if (!use_cluster)
{
return;
}
PUSH(features, CLUSTER(cluster, ctx.S0));
PUSH(features, CLUSTER4(cluster4, ctx.S0));
PUSH(features, CLUSTER6(cluster6, ctx.S0));
PUSH(features, CLUSTER(cluster, ctx.S1));
PUSH(features, CLUSTER(cluster, ctx.S2));
PUSH(features, CLUSTER(cluster, ctx.N0));
PUSH(features, CLUSTER4(cluster4, ctx.N0));
PUSH(features, CLUSTER6(cluster6, ctx.N0));
PUSH(features, CLUSTER(cluster, ctx.N1));
PUSH(features, CLUSTER(cluster, ctx.N2));
PUSH(features, CLUSTER(cluster, ctx.S0L));
PUSH(features, CLUSTER(cluster, ctx.S0R));
PUSH(features, CLUSTER(cluster, ctx.S0L2));
PUSH(features, CLUSTER(cluster, ctx.S0R2));
PUSH(features, CLUSTER(cluster, ctx.S0LL));
PUSH(features, CLUSTER(cluster, ctx.S0RR));
PUSH(features, CLUSTER(cluster, ctx.S1L));
PUSH(features, CLUSTER(cluster, ctx.S1R));
PUSH(features, CLUSTER(cluster, ctx.S1L2));
PUSH(features, CLUSTER(cluster, ctx.S1R2));
PUSH(features, CLUSTER(cluster, ctx.S1LL));
PUSH(features, CLUSTER(cluster, ctx.S1RR));
} | [
"void",
"get_cluster_features",
"(",
"final",
"Context",
"ctx",
",",
"final",
"List",
"<",
"Integer",
">",
"cluster4",
",",
"final",
"List",
"<",
"Integer",
">",
"cluster6",
",",
"final",
"List",
"<",
"Integer",
">",
"cluster",
",",
"List",
"<",
"Integer",... | 获取词聚类特征
@param ctx 上下文
@param cluster4
@param cluster6
@param cluster
@param features 输出特征 | [
"获取词聚类特征"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java#L831-L864 | train | Get the features of the cluster. | [
30522,
11675,
2131,
1035,
9324,
1035,
2838,
1006,
2345,
6123,
14931,
2595,
1010,
2345,
2862,
1026,
16109,
1028,
9324,
2549,
1010,
2345,
2862,
1026,
16109,
1028,
9324,
2575,
1010,
2345,
2862,
1026,
16109,
1028,
9324,
1010,
2862,
1026,
16109,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/lang/Assert.java | Assert.isInstanceOf | public static <T> T isInstanceOf(Class<?> type, T obj) {
return isInstanceOf(type, obj, "Object [{}] is not instanceof [{}]", obj, type);
} | java | public static <T> T isInstanceOf(Class<?> type, T obj) {
return isInstanceOf(type, obj, "Object [{}] is not instanceof [{}]", obj, type);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"isInstanceOf",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"T",
"obj",
")",
"{",
"return",
"isInstanceOf",
"(",
"type",
",",
"obj",
",",
"\"Object [{}] is not instanceof [{}]\"",
",",
"obj",
",",
"type",
")",
";",
... | 断言给定对象是否是给定类的实例
<pre class="code">
Assert.instanceOf(Foo.class, foo);
</pre>
@param <T> 被检查对象泛型类型
@param type 被检查对象匹配的类型
@param obj 被检查对象
@return 被检查的对象
@throws IllegalArgumentException if the object is not an instance of clazz
@see Class#isInstance(Object) | [
"断言给定对象是否是给定类的实例"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L429-L431 | train | Check if object is instance of type | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
2003,
7076,
26897,
11253,
1006,
2465,
1026,
1029,
1028,
2828,
1010,
1056,
27885,
3501,
1007,
1063,
2709,
2003,
7076,
26897,
11253,
1006,
2828,
1010,
27885,
3501,
1010,
1000,
4874,
1031,
1063,
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-runtime/src/main/java/org/apache/flink/runtime/operators/chaining/ChainedMapDriver.java | ChainedMapDriver.collect | @Override
public void collect(IT record) {
try {
this.numRecordsIn.inc();
this.outputCollector.collect(this.mapper.map(record));
} catch (Exception ex) {
throw new ExceptionInChainedStubException(this.taskName, ex);
}
} | java | @Override
public void collect(IT record) {
try {
this.numRecordsIn.inc();
this.outputCollector.collect(this.mapper.map(record));
} catch (Exception ex) {
throw new ExceptionInChainedStubException(this.taskName, ex);
}
} | [
"@",
"Override",
"public",
"void",
"collect",
"(",
"IT",
"record",
")",
"{",
"try",
"{",
"this",
".",
"numRecordsIn",
".",
"inc",
"(",
")",
";",
"this",
".",
"outputCollector",
".",
"collect",
"(",
"this",
".",
"mapper",
".",
"map",
"(",
"record",
")... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/chaining/ChainedMapDriver.java#L75-L83 | train | This method is called by the chain to collect a single record. | [
30522,
1030,
2058,
15637,
2270,
11675,
8145,
1006,
2009,
2501,
1007,
1063,
3046,
1063,
2023,
1012,
16371,
2213,
2890,
27108,
5104,
2378,
1012,
4297,
1006,
1007,
1025,
2023,
1012,
6434,
26895,
22471,
2953,
1012,
8145,
1006,
2023,
1012,
4949,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/CheckpointStatsHistory.java | CheckpointStatsHistory.addInProgressCheckpoint | void addInProgressCheckpoint(PendingCheckpointStats pending) {
if (readOnly) {
throw new UnsupportedOperationException("Can't create a snapshot of a read-only history.");
}
if (maxSize == 0) {
return;
}
checkNotNull(pending, "Pending checkpoint");
// Grow the array if required. This happens only for the first entries
// and makes the iterator logic easier, because we don't have any
// null elements with the growing array.
if (checkpointsArray.length < maxSize) {
checkpointsArray = Arrays.copyOf(checkpointsArray, checkpointsArray.length + 1);
}
// Wrap around if we are at the end. The next pos is the least recently
// added checkpoint.
if (nextPos == checkpointsArray.length) {
nextPos = 0;
}
checkpointsArray[nextPos++] = pending;
} | java | void addInProgressCheckpoint(PendingCheckpointStats pending) {
if (readOnly) {
throw new UnsupportedOperationException("Can't create a snapshot of a read-only history.");
}
if (maxSize == 0) {
return;
}
checkNotNull(pending, "Pending checkpoint");
// Grow the array if required. This happens only for the first entries
// and makes the iterator logic easier, because we don't have any
// null elements with the growing array.
if (checkpointsArray.length < maxSize) {
checkpointsArray = Arrays.copyOf(checkpointsArray, checkpointsArray.length + 1);
}
// Wrap around if we are at the end. The next pos is the least recently
// added checkpoint.
if (nextPos == checkpointsArray.length) {
nextPos = 0;
}
checkpointsArray[nextPos++] = pending;
} | [
"void",
"addInProgressCheckpoint",
"(",
"PendingCheckpointStats",
"pending",
")",
"{",
"if",
"(",
"readOnly",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Can't create a snapshot of a read-only history.\"",
")",
";",
"}",
"if",
"(",
"maxSize",
"=="... | Adds an in progress checkpoint to the checkpoint history.
@param pending In progress checkpoint to add. | [
"Adds",
"an",
"in",
"progress",
"checkpoint",
"to",
"the",
"checkpoint",
"history",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointStatsHistory.java#L218-L243 | train | Adds a pending checkpoint to the checkpoint array. | [
30522,
11675,
5587,
2378,
21572,
17603,
4757,
5403,
3600,
8400,
1006,
14223,
5403,
3600,
26521,
29336,
2015,
14223,
1007,
1063,
2065,
1006,
3191,
2239,
2135,
1007,
1063,
5466,
2047,
4895,
6342,
9397,
15613,
25918,
3370,
10288,
24422,
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-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CompletedCheckpointStatsSummary.java | CompletedCheckpointStatsSummary.updateSummary | void updateSummary(CompletedCheckpointStats completed) {
stateSize.add(completed.getStateSize());
duration.add(completed.getEndToEndDuration());
alignmentBuffered.add(completed.getAlignmentBuffered());
} | java | void updateSummary(CompletedCheckpointStats completed) {
stateSize.add(completed.getStateSize());
duration.add(completed.getEndToEndDuration());
alignmentBuffered.add(completed.getAlignmentBuffered());
} | [
"void",
"updateSummary",
"(",
"CompletedCheckpointStats",
"completed",
")",
"{",
"stateSize",
".",
"add",
"(",
"completed",
".",
"getStateSize",
"(",
")",
")",
";",
"duration",
".",
"add",
"(",
"completed",
".",
"getEndToEndDuration",
"(",
")",
")",
";",
"al... | Updates the summary with the given completed checkpoint.
@param completed Completed checkpoint to update the summary with. | [
"Updates",
"the",
"summary",
"with",
"the",
"given",
"completed",
"checkpoint",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CompletedCheckpointStatsSummary.java#L60-L64 | train | Updates the summary of the checkpoint. | [
30522,
11675,
14409,
2819,
7849,
2100,
1006,
2949,
5403,
3600,
26521,
29336,
2015,
2949,
1007,
1063,
2163,
4697,
1012,
5587,
1006,
2949,
1012,
4152,
12259,
5332,
4371,
1006,
1007,
1007,
1025,
9367,
1012,
5587,
1006,
2949,
1012,
2131,
10497,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/FileUtil.java | FileUtil.mkdir | public static File mkdir(File dir) {
if (dir == null) {
return null;
}
if (false == dir.exists()) {
dir.mkdirs();
}
return dir;
} | java | public static File mkdir(File dir) {
if (dir == null) {
return null;
}
if (false == dir.exists()) {
dir.mkdirs();
}
return dir;
} | [
"public",
"static",
"File",
"mkdir",
"(",
"File",
"dir",
")",
"{",
"if",
"(",
"dir",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"false",
"==",
"dir",
".",
"exists",
"(",
")",
")",
"{",
"dir",
".",
"mkdirs",
"(",
")",
";",
... | 创建文件夹,会递归自动创建其不存在的父文件夹,如果存在直接返回此文件夹<br>
此方法不对File对象类型做判断,如果File不存在,无法判断其类型
@param dir 目录
@return 创建的目录 | [
"创建文件夹,会递归自动创建其不存在的父文件夹,如果存在直接返回此文件夹<br",
">",
"此方法不对File对象类型做判断,如果File不存在,无法判断其类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L851-L859 | train | Creates the directory specified by the argument. | [
30522,
2270,
10763,
5371,
12395,
4305,
2099,
1006,
5371,
16101,
1007,
1063,
2065,
1006,
16101,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2065,
1006,
6270,
1027,
1027,
16101,
1012,
6526,
1006,
1007,
1007,
1063,
16101,
1012,
123... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.normalize | public static String normalize(String url, boolean isEncodeBody) {
if (StrUtil.isBlank(url)) {
return url;
}
final int sepIndex = url.indexOf("://");
String pre;
String body;
if (sepIndex > 0) {
pre = StrUtil.subPre(url, sepIndex + 3);
body = StrUtil.subSuf(url, sepIndex + 3);
} else {
pre = "http://";
body = url;
}
final int paramsSepIndex = StrUtil.indexOf(body, '?');
String params = null;
if (paramsSepIndex > 0) {
params = StrUtil.subSuf(body, paramsSepIndex);
body = StrUtil.subPre(body, paramsSepIndex);
}
// 去除开头的\或者/
body = body.replaceAll("^[\\/]+", StrUtil.EMPTY);
// 替换多个\或/为单个/
body = body.replace("\\", "/").replaceAll("//+", "/");
if (isEncodeBody) {
body = encode(body);
}
return pre + body + StrUtil.nullToEmpty(params);
} | java | public static String normalize(String url, boolean isEncodeBody) {
if (StrUtil.isBlank(url)) {
return url;
}
final int sepIndex = url.indexOf("://");
String pre;
String body;
if (sepIndex > 0) {
pre = StrUtil.subPre(url, sepIndex + 3);
body = StrUtil.subSuf(url, sepIndex + 3);
} else {
pre = "http://";
body = url;
}
final int paramsSepIndex = StrUtil.indexOf(body, '?');
String params = null;
if (paramsSepIndex > 0) {
params = StrUtil.subSuf(body, paramsSepIndex);
body = StrUtil.subPre(body, paramsSepIndex);
}
// 去除开头的\或者/
body = body.replaceAll("^[\\/]+", StrUtil.EMPTY);
// 替换多个\或/为单个/
body = body.replace("\\", "/").replaceAll("//+", "/");
if (isEncodeBody) {
body = encode(body);
}
return pre + body + StrUtil.nullToEmpty(params);
} | [
"public",
"static",
"String",
"normalize",
"(",
"String",
"url",
",",
"boolean",
"isEncodeBody",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"url",
")",
")",
"{",
"return",
"url",
";",
"}",
"final",
"int",
"sepIndex",
"=",
"url",
".",
"indexOf... | 标准化URL字符串,包括:
<pre>
1. 多个/替换为一个
</pre>
@param url URL字符串
@param isEncodeBody 是否对URL中body部分的中文和特殊字符做转义(不包括http:和/)
@return 标准化后的URL字符串
@since 4.4.1 | [
"标准化URL字符串,包括:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L569-L599 | train | Returns a URL normalized with the URL parameters and body. | [
30522,
2270,
10763,
5164,
3671,
4697,
1006,
5164,
24471,
2140,
1010,
22017,
20898,
2003,
2368,
16044,
30524,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
24471,
2140,
1007,
1007,
1063,
2709,
24471,
2140,
1025,
1065,
2345,
20014,
19802,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/dependency/nnparser/Matrix.java | Matrix.print | public void print(PrintWriter output, NumberFormat format, int width)
{
output.println(); // start on new line.
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
String s = format.format(A[i][j]); // format the number
int padding = Math.max(1, width - s.length()); // At _least_ 1 space
for (int k = 0; k < padding; k++)
output.print(' ');
output.print(s);
}
output.println();
}
output.println(); // end with blank line.
}
/**
* Read a matrix from a stream. The format is the same the print method,
* so printed matrices can be read back in (provided they were printed using
* US Locale). Elements are separated by
* whitespace, all the elements for each row appear on a single line,
* the last row is followed by a blank line.
*
* @param input the input stream.
*/
public static Matrix read(BufferedReader input) throws java.io.IOException
{
StreamTokenizer tokenizer = new StreamTokenizer(input);
// Although StreamTokenizer will parse numbers, it doesn't recognize
// scientific notation (E or D); however, Double.valueOf does.
// The strategy here is to disable StreamTokenizer's number parsing.
// We'll only get whitespace delimited words, EOL's and EOF's.
// These words should all be numbers, for Double.valueOf to parse.
tokenizer.resetSyntax();
tokenizer.wordChars(0, 255);
tokenizer.whitespaceChars(0, ' ');
tokenizer.eolIsSignificant(true);
java.util.Vector<Double> vD = new java.util.Vector<Double>();
// Ignore initial empty lines
while (tokenizer.nextToken() == StreamTokenizer.TT_EOL) ;
if (tokenizer.ttype == StreamTokenizer.TT_EOF)
throw new java.io.IOException("Unexpected EOF on matrix read.");
do
{
vD.addElement(Double.valueOf(tokenizer.sval)); // Read & store 1st row.
}
while (tokenizer.nextToken() == StreamTokenizer.TT_WORD);
int n = vD.size(); // Now we've got the number of columns!
double row[] = new double[n];
for (int j = 0; j < n; j++) // extract the elements of the 1st row.
row[j] = vD.elementAt(j).doubleValue();
java.util.Vector<double[]> v = new java.util.Vector<double[]>();
v.addElement(row); // Start storing rows instead of columns.
while (tokenizer.nextToken() == StreamTokenizer.TT_WORD)
{
// While non-empty lines
v.addElement(row = new double[n]);
int j = 0;
do
{
if (j >= n) throw new java.io.IOException
("Row " + v.size() + " is too long.");
row[j++] = Double.valueOf(tokenizer.sval).doubleValue();
}
while (tokenizer.nextToken() == StreamTokenizer.TT_WORD);
if (j < n) throw new java.io.IOException
("Row " + v.size() + " is too short.");
}
int m = v.size(); // Now we've got the number of rows.
double[][] A = new double[m][];
v.copyInto(A); // copy the rows out of the vector
return new Matrix(A);
}
/* ------------------------
Private Methods
* ------------------------ */
/**
* Check if size(A) == size(B)
**/
private void checkMatrixDimensions(Matrix B)
{
if (B.m != m || B.n != n)
{
throw new IllegalArgumentException("Matrix dimensions must agree.");
}
}
private static final long serialVersionUID = 1;
public static Matrix zero(int m, int n)
{
Matrix A = new Matrix(m, n);
double[][] X = A.getArray();
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
X[i][j] = 0.0;
}
}
return A;
}
public int rows()
{
return getRowDimension();
}
public int cols()
{
return getColumnDimension();
}
/**
* 取出第j列作为一个列向量
* @param j
* @return
*/
public Matrix col(int j)
{
double[][] X = new double[m][1];
for (int i = 0; i < m; i++)
{
X[i][0] = A[i][j];
}
return new Matrix(X);
}
/**
* 取出第i行作为一个行向量
* @param i
* @return
*/
public Matrix row(int i)
{
double[][] X = new double[1][n];
for (int j = 0; j < n; j++)
{
X[0][j] = A[i][j];
}
return new Matrix(X);
}
public Matrix block(int i, int j, int p, int q)
{
return getMatrix(i, i + p - 1, j, j + q - 1);
}
/**
* 返回矩阵的立方(以数组形式)
* @return
*/
public double[][] cube()
{
double[][] X = new double[m][n];
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
X[i][j] = Math.pow(A[i][j], 3.);
}
}
return X;
}
public void setZero()
{
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
A[i][j] = 0.;
}
}
}
public void save(DataOutputStream out) throws Exception
{
out.writeInt(m);
out.writeInt(n);
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
out.writeDouble(A[i][j]);
}
}
}
public boolean load(ByteArray byteArray)
{
m = byteArray.nextInt();
n = byteArray.nextInt();
A = new double[m][n];
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
A[i][j] = byteArray.nextDouble();
}
}
return true;
}
} | java | public void print(PrintWriter output, NumberFormat format, int width)
{
output.println(); // start on new line.
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
String s = format.format(A[i][j]); // format the number
int padding = Math.max(1, width - s.length()); // At _least_ 1 space
for (int k = 0; k < padding; k++)
output.print(' ');
output.print(s);
}
output.println();
}
output.println(); // end with blank line.
}
/**
* Read a matrix from a stream. The format is the same the print method,
* so printed matrices can be read back in (provided they were printed using
* US Locale). Elements are separated by
* whitespace, all the elements for each row appear on a single line,
* the last row is followed by a blank line.
*
* @param input the input stream.
*/
public static Matrix read(BufferedReader input) throws java.io.IOException
{
StreamTokenizer tokenizer = new StreamTokenizer(input);
// Although StreamTokenizer will parse numbers, it doesn't recognize
// scientific notation (E or D); however, Double.valueOf does.
// The strategy here is to disable StreamTokenizer's number parsing.
// We'll only get whitespace delimited words, EOL's and EOF's.
// These words should all be numbers, for Double.valueOf to parse.
tokenizer.resetSyntax();
tokenizer.wordChars(0, 255);
tokenizer.whitespaceChars(0, ' ');
tokenizer.eolIsSignificant(true);
java.util.Vector<Double> vD = new java.util.Vector<Double>();
// Ignore initial empty lines
while (tokenizer.nextToken() == StreamTokenizer.TT_EOL) ;
if (tokenizer.ttype == StreamTokenizer.TT_EOF)
throw new java.io.IOException("Unexpected EOF on matrix read.");
do
{
vD.addElement(Double.valueOf(tokenizer.sval)); // Read & store 1st row.
}
while (tokenizer.nextToken() == StreamTokenizer.TT_WORD);
int n = vD.size(); // Now we've got the number of columns!
double row[] = new double[n];
for (int j = 0; j < n; j++) // extract the elements of the 1st row.
row[j] = vD.elementAt(j).doubleValue();
java.util.Vector<double[]> v = new java.util.Vector<double[]>();
v.addElement(row); // Start storing rows instead of columns.
while (tokenizer.nextToken() == StreamTokenizer.TT_WORD)
{
// While non-empty lines
v.addElement(row = new double[n]);
int j = 0;
do
{
if (j >= n) throw new java.io.IOException
("Row " + v.size() + " is too long.");
row[j++] = Double.valueOf(tokenizer.sval).doubleValue();
}
while (tokenizer.nextToken() == StreamTokenizer.TT_WORD);
if (j < n) throw new java.io.IOException
("Row " + v.size() + " is too short.");
}
int m = v.size(); // Now we've got the number of rows.
double[][] A = new double[m][];
v.copyInto(A); // copy the rows out of the vector
return new Matrix(A);
}
/* ------------------------
Private Methods
* ------------------------ */
/**
* Check if size(A) == size(B)
**/
private void checkMatrixDimensions(Matrix B)
{
if (B.m != m || B.n != n)
{
throw new IllegalArgumentException("Matrix dimensions must agree.");
}
}
private static final long serialVersionUID = 1;
public static Matrix zero(int m, int n)
{
Matrix A = new Matrix(m, n);
double[][] X = A.getArray();
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
X[i][j] = 0.0;
}
}
return A;
}
public int rows()
{
return getRowDimension();
}
public int cols()
{
return getColumnDimension();
}
/**
* 取出第j列作为一个列向量
* @param j
* @return
*/
public Matrix col(int j)
{
double[][] X = new double[m][1];
for (int i = 0; i < m; i++)
{
X[i][0] = A[i][j];
}
return new Matrix(X);
}
/**
* 取出第i行作为一个行向量
* @param i
* @return
*/
public Matrix row(int i)
{
double[][] X = new double[1][n];
for (int j = 0; j < n; j++)
{
X[0][j] = A[i][j];
}
return new Matrix(X);
}
public Matrix block(int i, int j, int p, int q)
{
return getMatrix(i, i + p - 1, j, j + q - 1);
}
/**
* 返回矩阵的立方(以数组形式)
* @return
*/
public double[][] cube()
{
double[][] X = new double[m][n];
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
X[i][j] = Math.pow(A[i][j], 3.);
}
}
return X;
}
public void setZero()
{
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
A[i][j] = 0.;
}
}
}
public void save(DataOutputStream out) throws Exception
{
out.writeInt(m);
out.writeInt(n);
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
out.writeDouble(A[i][j]);
}
}
}
public boolean load(ByteArray byteArray)
{
m = byteArray.nextInt();
n = byteArray.nextInt();
A = new double[m][n];
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
A[i][j] = byteArray.nextDouble();
}
}
return true;
}
} | [
"public",
"void",
"print",
"(",
"PrintWriter",
"output",
",",
"NumberFormat",
"format",
",",
"int",
"width",
")",
"{",
"output",
".",
"println",
"(",
")",
";",
"// start on new line.",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m",
";",
"i",
"... | Print the matrix to the output stream. Line the elements up in columns.
Use the format object, and right justify within columns of width
characters.
Note that is the matrix is to be read back in, you probably will want
to use a NumberFormat that is set to US Locale.
@param output the output stream.
@param format A formatting object to format the matrix elements
@param width Column width.
@see DecimalFormat#setDecimalFormatSymbols | [
"Print",
"the",
"matrix",
"to",
"the",
"output",
"stream",
".",
"Line",
"the",
"elements",
"up",
"in",
"columns",
".",
"Use",
"the",
"format",
"object",
"and",
"right",
"justify",
"within",
"columns",
"of",
"width",
"characters",
".",
"Note",
"that",
"is",... | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L1100-L1315 | train | Print a matrix from a buffered reader. | [
30522,
2270,
11675,
6140,
1006,
6140,
15994,
6434,
1010,
2193,
14192,
4017,
4289,
1010,
20014,
9381,
1007,
1063,
6434,
1012,
6140,
19666,
1006,
1007,
1025,
1013,
1013,
2707,
2006,
2047,
30524,
1031,
1046,
1033,
1007,
1025,
1013,
1013,
4289,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/resource/MultiFileResource.java | MultiFileResource.add | public MultiFileResource add(File... files) {
for (File file : files) {
this.add(new FileResource(file));
}
return this;
} | java | public MultiFileResource add(File... files) {
for (File file : files) {
this.add(new FileResource(file));
}
return this;
} | [
"public",
"MultiFileResource",
"add",
"(",
"File",
"...",
"files",
")",
"{",
"for",
"(",
"File",
"file",
":",
"files",
")",
"{",
"this",
".",
"add",
"(",
"new",
"FileResource",
"(",
"file",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] | 增加文件资源
@param files 文件资源
@return this | [
"增加文件资源"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/MultiFileResource.java#L41-L46 | train | Adds multiple file resources to this multi file resource. | [
30522,
2270,
4800,
8873,
3917,
2229,
8162,
3401,
5587,
1006,
5371,
1012,
1012,
1012,
6764,
1007,
1063,
2005,
1006,
5371,
5371,
1024,
6764,
1007,
1063,
2023,
1012,
5587,
1006,
2047,
5371,
6072,
8162,
3401,
1006,
5371,
1007,
1007,
1025,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.getSocketAddr | public InetSocketAddress getSocketAddr(
String name, String defaultAddress, int defaultPort) {
final String address = getTrimmed(name, defaultAddress);
return NetUtils.createSocketAddr(address, defaultPort, name);
} | java | public InetSocketAddress getSocketAddr(
String name, String defaultAddress, int defaultPort) {
final String address = getTrimmed(name, defaultAddress);
return NetUtils.createSocketAddr(address, defaultPort, name);
} | [
"public",
"InetSocketAddress",
"getSocketAddr",
"(",
"String",
"name",
",",
"String",
"defaultAddress",
",",
"int",
"defaultPort",
")",
"{",
"final",
"String",
"address",
"=",
"getTrimmed",
"(",
"name",
",",
"defaultAddress",
")",
";",
"return",
"NetUtils",
".",... | Get the socket address for <code>name</code> property as a
<code>InetSocketAddress</code>.
@param name property name.
@param defaultAddress the default value
@param defaultPort the default port
@return InetSocketAddress | [
"Get",
"the",
"socket",
"address",
"for",
"<code",
">",
"name<",
"/",
"code",
">",
"property",
"as",
"a",
"<code",
">",
"InetSocketAddress<",
"/",
"code",
">",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2302-L2306 | train | Get socket address. | [
30522,
2270,
1999,
8454,
7432,
12928,
14141,
8303,
4152,
7432,
12928,
14141,
2099,
1006,
5164,
2171,
1010,
5164,
12398,
4215,
16200,
4757,
1010,
20014,
12398,
6442,
1007,
1063,
2345,
5164,
4769,
1027,
2131,
18886,
20058,
2094,
1006,
2171,
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 | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.reserveAndWriteUtf8 | public static int reserveAndWriteUtf8(ByteBuf buf, CharSequence seq, int reserveBytes) {
for (;;) {
if (buf instanceof WrappedCompositeByteBuf) {
// WrappedCompositeByteBuf is a sub-class of AbstractByteBuf so it needs special handling.
buf = buf.unwrap();
} else if (buf instanceof AbstractByteBuf) {
AbstractByteBuf byteBuf = (AbstractByteBuf) buf;
byteBuf.ensureWritable0(reserveBytes);
int written = writeUtf8(byteBuf, byteBuf.writerIndex, seq, seq.length());
byteBuf.writerIndex += written;
return written;
} else if (buf instanceof WrappedByteBuf) {
// Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path.
buf = buf.unwrap();
} else {
byte[] bytes = seq.toString().getBytes(CharsetUtil.UTF_8);
buf.writeBytes(bytes);
return bytes.length;
}
}
} | java | public static int reserveAndWriteUtf8(ByteBuf buf, CharSequence seq, int reserveBytes) {
for (;;) {
if (buf instanceof WrappedCompositeByteBuf) {
// WrappedCompositeByteBuf is a sub-class of AbstractByteBuf so it needs special handling.
buf = buf.unwrap();
} else if (buf instanceof AbstractByteBuf) {
AbstractByteBuf byteBuf = (AbstractByteBuf) buf;
byteBuf.ensureWritable0(reserveBytes);
int written = writeUtf8(byteBuf, byteBuf.writerIndex, seq, seq.length());
byteBuf.writerIndex += written;
return written;
} else if (buf instanceof WrappedByteBuf) {
// Unwrap as the wrapped buffer may be an AbstractByteBuf and so we can use fast-path.
buf = buf.unwrap();
} else {
byte[] bytes = seq.toString().getBytes(CharsetUtil.UTF_8);
buf.writeBytes(bytes);
return bytes.length;
}
}
} | [
"public",
"static",
"int",
"reserveAndWriteUtf8",
"(",
"ByteBuf",
"buf",
",",
"CharSequence",
"seq",
",",
"int",
"reserveBytes",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"if",
"(",
"buf",
"instanceof",
"WrappedCompositeByteBuf",
")",
"{",
"// WrappedComposite... | Encode a {@link CharSequence} in <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> and write
it into {@code reserveBytes} of a {@link ByteBuf}.
<p>
The {@code reserveBytes} must be computed (ie eagerly using {@link #utf8MaxBytes(CharSequence)}
or exactly with {@link #utf8Bytes(CharSequence)}) to ensure this method to not fail: for performance reasons
the index checks will be performed using just {@code reserveBytes}.<br>
This method returns the actual number of bytes written. | [
"Encode",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L511-L531 | train | Reserve and write UTF - 8. | [
30522,
2270,
10763,
20014,
3914,
5685,
26373,
4904,
2546,
2620,
1006,
24880,
8569,
2546,
20934,
2546,
1010,
25869,
3366,
4226,
5897,
7367,
4160,
1010,
20014,
3914,
3762,
4570,
1007,
1063,
2005,
1006,
1025,
1025,
1007,
1063,
2065,
1006,
2093... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/EnumUtil.java | EnumUtil.getEnumMap | public static <E extends Enum<E>> LinkedHashMap<String, E> getEnumMap(final Class<E> enumClass) {
final LinkedHashMap<String, E> map = new LinkedHashMap<String, E>();
for (final E e : enumClass.getEnumConstants()) {
map.put(e.name(), e);
}
return map;
} | java | public static <E extends Enum<E>> LinkedHashMap<String, E> getEnumMap(final Class<E> enumClass) {
final LinkedHashMap<String, E> map = new LinkedHashMap<String, E>();
for (final E e : enumClass.getEnumConstants()) {
map.put(e.name(), e);
}
return map;
} | [
"public",
"static",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"LinkedHashMap",
"<",
"String",
",",
"E",
">",
"getEnumMap",
"(",
"final",
"Class",
"<",
"E",
">",
"enumClass",
")",
"{",
"final",
"LinkedHashMap",
"<",
"String",
",",
"E",
">",
"ma... | 获取枚举字符串值和枚举对象的Map对应,使用LinkedHashMap保证有序<br>
结果中键为枚举名,值为枚举对象
@param enumClass 枚举类
@return 枚举字符串值和枚举对象的Map对应,使用LinkedHashMap保证有序
@since 4.0.2 | [
"获取枚举字符串值和枚举对象的Map对应,使用LinkedHashMap保证有序<br",
">",
"结果中键为枚举名,值为枚举对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/EnumUtil.java#L170-L176 | train | Gets the enum map. | [
30522,
2270,
10763,
1026,
1041,
8908,
4372,
2819,
1026,
1041,
1028,
1028,
5799,
14949,
22444,
2361,
1026,
5164,
1010,
1041,
1028,
2131,
2368,
2819,
2863,
2361,
1006,
2345,
2465,
1026,
1041,
1028,
4372,
2819,
26266,
1007,
1063,
2345,
5799,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/server/OKPacket.java | OKPacket.fromBytes | public void fromBytes(byte[] data) throws IOException {
int index = 0;
// 1. read field count
this.fieldCount = data[0];
index++;
// 2. read affected rows
this.affectedRows = ByteHelper.readBinaryCodedLengthBytes(data, index);
index += this.affectedRows.length;
// 3. read insert id
this.insertId = ByteHelper.readBinaryCodedLengthBytes(data, index);
index += this.insertId.length;
// 4. read server status
this.serverStatus = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
// 5. read warning count
this.warningCount = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
// 6. read message.
this.message = new String(ByteHelper.readFixedLengthBytes(data, index, data.length - index));
// end read
} | java | public void fromBytes(byte[] data) throws IOException {
int index = 0;
// 1. read field count
this.fieldCount = data[0];
index++;
// 2. read affected rows
this.affectedRows = ByteHelper.readBinaryCodedLengthBytes(data, index);
index += this.affectedRows.length;
// 3. read insert id
this.insertId = ByteHelper.readBinaryCodedLengthBytes(data, index);
index += this.insertId.length;
// 4. read server status
this.serverStatus = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
// 5. read warning count
this.warningCount = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
// 6. read message.
this.message = new String(ByteHelper.readFixedLengthBytes(data, index, data.length - index));
// end read
} | [
"public",
"void",
"fromBytes",
"(",
"byte",
"[",
"]",
"data",
")",
"throws",
"IOException",
"{",
"int",
"index",
"=",
"0",
";",
"// 1. read field count",
"this",
".",
"fieldCount",
"=",
"data",
"[",
"0",
"]",
";",
"index",
"++",
";",
"// 2. read affected r... | <pre>
VERSION 4.1
Bytes Name
----- ----
1 (Length Coded Binary) field_count, always = 0
1-9 (Length Coded Binary) affected_rows
1-9 (Length Coded Binary) insert_id
2 server_status
2 warning_count
n (until end of packet) message
</pre>
@throws IOException | [
"<pre",
">",
"VERSION",
"4",
".",
"1",
"Bytes",
"Name",
"-----",
"----",
"1",
"(",
"Length",
"Coded",
"Binary",
")",
"field_count",
"always",
"=",
"0",
"1",
"-",
"9",
"(",
"Length",
"Coded",
"Binary",
")",
"affected_rows",
"1",
"-",
"9",
"(",
"Length... | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/server/OKPacket.java#L38-L58 | train | Reads the CRAID from the byte array. | [
30522,
2270,
11675,
2013,
3762,
4570,
1006,
24880,
1031,
1033,
2951,
1007,
11618,
22834,
10288,
24422,
1063,
20014,
5950,
1027,
1014,
1025,
1013,
1013,
1015,
1012,
3191,
2492,
4175,
2023,
1012,
2492,
3597,
16671,
1027,
2951,
1031,
1014,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/graph/StreamGraphGenerator.java | StreamGraphGenerator.transform | private Collection<Integer> transform(StreamTransformation<?> transform) {
if (alreadyTransformed.containsKey(transform)) {
return alreadyTransformed.get(transform);
}
LOG.debug("Transforming " + transform);
if (transform.getMaxParallelism() <= 0) {
// if the max parallelism hasn't been set, then first use the job wide max parallelism
// from the ExecutionConfig.
int globalMaxParallelismFromConfig = env.getConfig().getMaxParallelism();
if (globalMaxParallelismFromConfig > 0) {
transform.setMaxParallelism(globalMaxParallelismFromConfig);
}
}
// call at least once to trigger exceptions about MissingTypeInfo
transform.getOutputType();
Collection<Integer> transformedIds;
if (transform instanceof OneInputTransformation<?, ?>) {
transformedIds = transformOneInputTransform((OneInputTransformation<?, ?>) transform);
} else if (transform instanceof TwoInputTransformation<?, ?, ?>) {
transformedIds = transformTwoInputTransform((TwoInputTransformation<?, ?, ?>) transform);
} else if (transform instanceof SourceTransformation<?>) {
transformedIds = transformSource((SourceTransformation<?>) transform);
} else if (transform instanceof SinkTransformation<?>) {
transformedIds = transformSink((SinkTransformation<?>) transform);
} else if (transform instanceof UnionTransformation<?>) {
transformedIds = transformUnion((UnionTransformation<?>) transform);
} else if (transform instanceof SplitTransformation<?>) {
transformedIds = transformSplit((SplitTransformation<?>) transform);
} else if (transform instanceof SelectTransformation<?>) {
transformedIds = transformSelect((SelectTransformation<?>) transform);
} else if (transform instanceof FeedbackTransformation<?>) {
transformedIds = transformFeedback((FeedbackTransformation<?>) transform);
} else if (transform instanceof CoFeedbackTransformation<?>) {
transformedIds = transformCoFeedback((CoFeedbackTransformation<?>) transform);
} else if (transform instanceof PartitionTransformation<?>) {
transformedIds = transformPartition((PartitionTransformation<?>) transform);
} else if (transform instanceof SideOutputTransformation<?>) {
transformedIds = transformSideOutput((SideOutputTransformation<?>) transform);
} else {
throw new IllegalStateException("Unknown transformation: " + transform);
}
// need this check because the iterate transformation adds itself before
// transforming the feedback edges
if (!alreadyTransformed.containsKey(transform)) {
alreadyTransformed.put(transform, transformedIds);
}
if (transform.getBufferTimeout() >= 0) {
streamGraph.setBufferTimeout(transform.getId(), transform.getBufferTimeout());
}
if (transform.getUid() != null) {
streamGraph.setTransformationUID(transform.getId(), transform.getUid());
}
if (transform.getUserProvidedNodeHash() != null) {
streamGraph.setTransformationUserHash(transform.getId(), transform.getUserProvidedNodeHash());
}
if (!streamGraph.getExecutionConfig().hasAutoGeneratedUIDsEnabled()) {
if (transform.getUserProvidedNodeHash() == null && transform.getUid() == null) {
throw new IllegalStateException("Auto generated UIDs have been disabled " +
"but no UID or hash has been assigned to operator " + transform.getName());
}
}
if (transform.getMinResources() != null && transform.getPreferredResources() != null) {
streamGraph.setResources(transform.getId(), transform.getMinResources(), transform.getPreferredResources());
}
return transformedIds;
} | java | private Collection<Integer> transform(StreamTransformation<?> transform) {
if (alreadyTransformed.containsKey(transform)) {
return alreadyTransformed.get(transform);
}
LOG.debug("Transforming " + transform);
if (transform.getMaxParallelism() <= 0) {
// if the max parallelism hasn't been set, then first use the job wide max parallelism
// from the ExecutionConfig.
int globalMaxParallelismFromConfig = env.getConfig().getMaxParallelism();
if (globalMaxParallelismFromConfig > 0) {
transform.setMaxParallelism(globalMaxParallelismFromConfig);
}
}
// call at least once to trigger exceptions about MissingTypeInfo
transform.getOutputType();
Collection<Integer> transformedIds;
if (transform instanceof OneInputTransformation<?, ?>) {
transformedIds = transformOneInputTransform((OneInputTransformation<?, ?>) transform);
} else if (transform instanceof TwoInputTransformation<?, ?, ?>) {
transformedIds = transformTwoInputTransform((TwoInputTransformation<?, ?, ?>) transform);
} else if (transform instanceof SourceTransformation<?>) {
transformedIds = transformSource((SourceTransformation<?>) transform);
} else if (transform instanceof SinkTransformation<?>) {
transformedIds = transformSink((SinkTransformation<?>) transform);
} else if (transform instanceof UnionTransformation<?>) {
transformedIds = transformUnion((UnionTransformation<?>) transform);
} else if (transform instanceof SplitTransformation<?>) {
transformedIds = transformSplit((SplitTransformation<?>) transform);
} else if (transform instanceof SelectTransformation<?>) {
transformedIds = transformSelect((SelectTransformation<?>) transform);
} else if (transform instanceof FeedbackTransformation<?>) {
transformedIds = transformFeedback((FeedbackTransformation<?>) transform);
} else if (transform instanceof CoFeedbackTransformation<?>) {
transformedIds = transformCoFeedback((CoFeedbackTransformation<?>) transform);
} else if (transform instanceof PartitionTransformation<?>) {
transformedIds = transformPartition((PartitionTransformation<?>) transform);
} else if (transform instanceof SideOutputTransformation<?>) {
transformedIds = transformSideOutput((SideOutputTransformation<?>) transform);
} else {
throw new IllegalStateException("Unknown transformation: " + transform);
}
// need this check because the iterate transformation adds itself before
// transforming the feedback edges
if (!alreadyTransformed.containsKey(transform)) {
alreadyTransformed.put(transform, transformedIds);
}
if (transform.getBufferTimeout() >= 0) {
streamGraph.setBufferTimeout(transform.getId(), transform.getBufferTimeout());
}
if (transform.getUid() != null) {
streamGraph.setTransformationUID(transform.getId(), transform.getUid());
}
if (transform.getUserProvidedNodeHash() != null) {
streamGraph.setTransformationUserHash(transform.getId(), transform.getUserProvidedNodeHash());
}
if (!streamGraph.getExecutionConfig().hasAutoGeneratedUIDsEnabled()) {
if (transform.getUserProvidedNodeHash() == null && transform.getUid() == null) {
throw new IllegalStateException("Auto generated UIDs have been disabled " +
"but no UID or hash has been assigned to operator " + transform.getName());
}
}
if (transform.getMinResources() != null && transform.getPreferredResources() != null) {
streamGraph.setResources(transform.getId(), transform.getMinResources(), transform.getPreferredResources());
}
return transformedIds;
} | [
"private",
"Collection",
"<",
"Integer",
">",
"transform",
"(",
"StreamTransformation",
"<",
"?",
">",
"transform",
")",
"{",
"if",
"(",
"alreadyTransformed",
".",
"containsKey",
"(",
"transform",
")",
")",
"{",
"return",
"alreadyTransformed",
".",
"get",
"(",... | Transforms one {@code StreamTransformation}.
<p>This checks whether we already transformed it and exits early in that case. If not it
delegates to one of the transformation specific methods. | [
"Transforms",
"one",
"{",
"@code",
"StreamTransformation",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java#L143-L219 | train | Transform a stream transformation. | [
30522,
2797,
3074,
1026,
16109,
1028,
10938,
1006,
5460,
6494,
3619,
14192,
3370,
1026,
1029,
1028,
10938,
1007,
1063,
2065,
1006,
2525,
6494,
3619,
29021,
1012,
3397,
14839,
1006,
10938,
1007,
1007,
1063,
2709,
2525,
6494,
3619,
29021,
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... |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/DynamoDBStreamsDataFetcher.java | DynamoDBStreamsDataFetcher.createShardConsumer | @Override
protected ShardConsumer createShardConsumer(
Integer subscribedShardStateIndex,
StreamShardHandle handle,
SequenceNumber lastSeqNum,
ShardMetricsReporter shardMetricsReporter) {
return new ShardConsumer(
this,
subscribedShardStateIndex,
handle,
lastSeqNum,
DynamoDBStreamsProxy.create(getConsumerConfiguration()),
shardMetricsReporter);
} | java | @Override
protected ShardConsumer createShardConsumer(
Integer subscribedShardStateIndex,
StreamShardHandle handle,
SequenceNumber lastSeqNum,
ShardMetricsReporter shardMetricsReporter) {
return new ShardConsumer(
this,
subscribedShardStateIndex,
handle,
lastSeqNum,
DynamoDBStreamsProxy.create(getConsumerConfiguration()),
shardMetricsReporter);
} | [
"@",
"Override",
"protected",
"ShardConsumer",
"createShardConsumer",
"(",
"Integer",
"subscribedShardStateIndex",
",",
"StreamShardHandle",
"handle",
",",
"SequenceNumber",
"lastSeqNum",
",",
"ShardMetricsReporter",
"shardMetricsReporter",
")",
"{",
"return",
"new",
"Shard... | Create a new DynamoDB streams shard consumer.
@param subscribedShardStateIndex the state index of the shard this consumer is subscribed to
@param handle stream handle
@param lastSeqNum last sequence number
@param shardMetricsReporter the reporter to report metrics to
@return | [
"Create",
"a",
"new",
"DynamoDB",
"streams",
"shard",
"consumer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/DynamoDBStreamsDataFetcher.java#L94-L108 | train | Override to create a new instance of the ShardConsumer class. | [
30522,
1030,
2058,
15637,
5123,
21146,
4103,
8663,
23545,
2099,
9005,
11783,
8663,
23545,
2099,
1006,
16109,
4942,
29234,
5104,
11783,
9153,
9589,
3207,
2595,
1010,
9199,
11783,
11774,
2571,
5047,
1010,
5537,
19172,
5677,
16180,
2063,
4160,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ArrayUtil.java | ArrayUtil.wrap | public static Short[] wrap(short... values) {
if (null == values) {
return null;
}
final int length = values.length;
if (0 == length) {
return new Short[0];
}
final Short[] array = new Short[length];
for (int i = 0; i < length; i++) {
array[i] = Short.valueOf(values[i]);
}
return array;
} | java | public static Short[] wrap(short... values) {
if (null == values) {
return null;
}
final int length = values.length;
if (0 == length) {
return new Short[0];
}
final Short[] array = new Short[length];
for (int i = 0; i < length; i++) {
array[i] = Short.valueOf(values[i]);
}
return array;
} | [
"public",
"static",
"Short",
"[",
"]",
"wrap",
"(",
"short",
"...",
"values",
")",
"{",
"if",
"(",
"null",
"==",
"values",
")",
"{",
"return",
"null",
";",
"}",
"final",
"int",
"length",
"=",
"values",
".",
"length",
";",
"if",
"(",
"0",
"==",
"l... | 将原始类型数组包装为包装类型
@param values 原始类型数组
@return 包装类型数组 | [
"将原始类型数组包装为包装类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L1575-L1589 | train | Wraps the given Short array with the same length as the input Short array. | [
30522,
2270,
10763,
2460,
1031,
1033,
10236,
1006,
2460,
1012,
1012,
1012,
5300,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
5300,
1007,
1063,
2709,
19701,
1025,
1065,
2345,
20014,
3091,
30524,
1025,
2065,
1006,
1014,
1027,
1027,
3091,
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/text/StrBuilder.java | StrBuilder.append | public StrBuilder append(char[] src, int srcPos, int length) {
return insert(this.position, src, srcPos, length);
} | java | public StrBuilder append(char[] src, int srcPos, int length) {
return insert(this.position, src, srcPos, length);
} | [
"public",
"StrBuilder",
"append",
"(",
"char",
"[",
"]",
"src",
",",
"int",
"srcPos",
",",
"int",
"length",
")",
"{",
"return",
"insert",
"(",
"this",
".",
"position",
",",
"src",
",",
"srcPos",
",",
"length",
")",
";",
"}"
] | 追加一个字符数组
@param src 字符数组
@param srcPos 开始位置(包括)
@param length 长度
@return this | [
"追加一个字符数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrBuilder.java#L128-L130 | train | Appends the specified characters to this builder. | [
30522,
2270,
2358,
15185,
19231,
4063,
10439,
10497,
1006,
25869,
1031,
1033,
5034,
2278,
1010,
20014,
5034,
21906,
2891,
1010,
20014,
3091,
1007,
1063,
2709,
19274,
1006,
2023,
1012,
2597,
1010,
5034,
2278,
1010,
5034,
21906,
2891,
1010,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/AbstractErrorController.java | AbstractErrorController.resolveErrorView | protected ModelAndView resolveErrorView(HttpServletRequest request,
HttpServletResponse response, HttpStatus status, Map<String, Object> model) {
for (ErrorViewResolver resolver : this.errorViewResolvers) {
ModelAndView modelAndView = resolver.resolveErrorView(request, status, model);
if (modelAndView != null) {
return modelAndView;
}
}
return null;
} | java | protected ModelAndView resolveErrorView(HttpServletRequest request,
HttpServletResponse response, HttpStatus status, Map<String, Object> model) {
for (ErrorViewResolver resolver : this.errorViewResolvers) {
ModelAndView modelAndView = resolver.resolveErrorView(request, status, model);
if (modelAndView != null) {
return modelAndView;
}
}
return null;
} | [
"protected",
"ModelAndView",
"resolveErrorView",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"HttpStatus",
"status",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"model",
")",
"{",
"for",
"(",
"ErrorViewResolver",
"resolver",... | Resolve any specific error views. By default this method delegates to
{@link ErrorViewResolver ErrorViewResolvers}.
@param request the request
@param response the response
@param status the HTTP status
@param model the suggested model
@return a specific {@link ModelAndView} or {@code null} if the default should be
used
@since 1.4.0 | [
"Resolve",
"any",
"specific",
"error",
"views",
".",
"By",
"default",
"this",
"method",
"delegates",
"to",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/error/AbstractErrorController.java#L110-L119 | train | Resolves the error view. | [
30522,
5123,
2944,
5685,
8584,
10663,
2121,
30524,
6072,
26029,
3366,
3433,
1010,
16770,
29336,
2271,
3570,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
2944,
1007,
1063,
2005,
1006,
7561,
8584,
6072,
4747,
6299,
10663,
2099,
1024,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/annotation/CombinationAnnotationElement.java | CombinationAnnotationElement.init | private void init(AnnotatedElement element) {
Annotation[] declaredAnnotations = element.getDeclaredAnnotations();
this.declaredAnnotationMap = new HashMap<>();
parseDeclared(declaredAnnotations);
Annotation[] annotations = element.getAnnotations();
if(declaredAnnotations == annotations) {
this.annotationMap = this.declaredAnnotationMap;
}else {
this.annotationMap = new HashMap<>();
parse(annotations);
}
} | java | private void init(AnnotatedElement element) {
Annotation[] declaredAnnotations = element.getDeclaredAnnotations();
this.declaredAnnotationMap = new HashMap<>();
parseDeclared(declaredAnnotations);
Annotation[] annotations = element.getAnnotations();
if(declaredAnnotations == annotations) {
this.annotationMap = this.declaredAnnotationMap;
}else {
this.annotationMap = new HashMap<>();
parse(annotations);
}
} | [
"private",
"void",
"init",
"(",
"AnnotatedElement",
"element",
")",
"{",
"Annotation",
"[",
"]",
"declaredAnnotations",
"=",
"element",
".",
"getDeclaredAnnotations",
"(",
")",
";",
"this",
".",
"declaredAnnotationMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
"... | 初始化
@param element 元素 | [
"初始化"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/annotation/CombinationAnnotationElement.java#L79-L91 | train | Initializes the annotation map. | [
30522,
2797,
11675,
1999,
4183,
1006,
5754,
17287,
3064,
12260,
3672,
5783,
1007,
1063,
5754,
17287,
3508,
1031,
1033,
4161,
11639,
17287,
9285,
1027,
5783,
1012,
2131,
3207,
20464,
12069,
7847,
17048,
10708,
1006,
1007,
1025,
2023,
1012,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/AsciiString.java | AsciiString.toUpperCase | public AsciiString toUpperCase() {
boolean uppercased = true;
int i, j;
final int len = length() + arrayOffset();
for (i = arrayOffset(); i < len; ++i) {
byte b = value[i];
if (b >= 'a' && b <= 'z') {
uppercased = false;
break;
}
}
// Check if this string does not contain any lowercase characters.
if (uppercased) {
return this;
}
final byte[] newValue = PlatformDependent.allocateUninitializedArray(length());
for (i = 0, j = arrayOffset(); i < newValue.length; ++i, ++j) {
newValue[i] = toUpperCase(value[j]);
}
return new AsciiString(newValue, false);
} | java | public AsciiString toUpperCase() {
boolean uppercased = true;
int i, j;
final int len = length() + arrayOffset();
for (i = arrayOffset(); i < len; ++i) {
byte b = value[i];
if (b >= 'a' && b <= 'z') {
uppercased = false;
break;
}
}
// Check if this string does not contain any lowercase characters.
if (uppercased) {
return this;
}
final byte[] newValue = PlatformDependent.allocateUninitializedArray(length());
for (i = 0, j = arrayOffset(); i < newValue.length; ++i, ++j) {
newValue[i] = toUpperCase(value[j]);
}
return new AsciiString(newValue, false);
} | [
"public",
"AsciiString",
"toUpperCase",
"(",
")",
"{",
"boolean",
"uppercased",
"=",
"true",
";",
"int",
"i",
",",
"j",
";",
"final",
"int",
"len",
"=",
"length",
"(",
")",
"+",
"arrayOffset",
"(",
")",
";",
"for",
"(",
"i",
"=",
"arrayOffset",
"(",
... | Converts the characters in this string to uppercase, using the default Locale.
@return a new string containing the uppercase characters equivalent to the characters in this string. | [
"Converts",
"the",
"characters",
"in",
"this",
"string",
"to",
"uppercase",
"using",
"the",
"default",
"Locale",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L958-L981 | train | Get the uppercase version of this string. | [
30522,
2270,
2004,
6895,
2923,
4892,
2000,
29547,
18992,
3366,
1006,
1007,
1063,
22017,
20898,
3356,
28969,
1027,
2995,
1025,
20014,
1045,
1010,
1046,
1025,
2345,
20014,
18798,
1027,
3091,
1006,
1007,
1009,
9140,
27475,
3388,
1006,
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-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.fullOuterJoin | public <R> JoinOperatorSetsBase<T, R> fullOuterJoin(DataSet<R> other) {
return new JoinOperatorSetsBase<>(this, other, JoinHint.OPTIMIZER_CHOOSES, JoinType.FULL_OUTER);
} | java | public <R> JoinOperatorSetsBase<T, R> fullOuterJoin(DataSet<R> other) {
return new JoinOperatorSetsBase<>(this, other, JoinHint.OPTIMIZER_CHOOSES, JoinType.FULL_OUTER);
} | [
"public",
"<",
"R",
">",
"JoinOperatorSetsBase",
"<",
"T",
",",
"R",
">",
"fullOuterJoin",
"(",
"DataSet",
"<",
"R",
">",
"other",
")",
"{",
"return",
"new",
"JoinOperatorSetsBase",
"<>",
"(",
"this",
",",
"other",
",",
"JoinHint",
".",
"OPTIMIZER_CHOOSES"... | Initiates a Full Outer Join transformation.
<p>An Outer Join transformation joins two elements of two
{@link DataSet DataSets} on key equality and provides multiple ways to combine
joining elements into one DataSet.
<p>Elements of <b>both</b> DataSets that do not have a matching
element on the opposing side are joined with {@code null} and emitted to the
resulting DataSet.
@param other The other DataSet with which this DataSet is joined.
@return A JoinOperatorSet to continue the definition of the Join transformation.
@see org.apache.flink.api.java.operators.join.JoinOperatorSetsBase
@see DataSet | [
"Initiates",
"a",
"Full",
"Outer",
"Join",
"transformation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L948-L950 | train | Create a full outer join of this DataSet with the other DataSet. | [
30522,
2270,
1026,
1054,
1028,
3693,
25918,
18926,
8454,
15058,
1026,
1056,
1010,
1054,
1028,
2440,
5833,
2121,
5558,
2378,
1006,
2951,
13462,
1026,
1054,
1028,
2060,
1007,
1063,
2709,
2047,
3693,
25918,
18926,
8454,
15058,
1026,
1028,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java | BufferUtil.copy | public static ByteBuffer copy(ByteBuffer src, int srcStart, ByteBuffer dest, int destStart, int length) {
System.arraycopy(src.array(), srcStart, dest.array(), destStart, length);
return dest;
} | java | public static ByteBuffer copy(ByteBuffer src, int srcStart, ByteBuffer dest, int destStart, int length) {
System.arraycopy(src.array(), srcStart, dest.array(), destStart, length);
return dest;
} | [
"public",
"static",
"ByteBuffer",
"copy",
"(",
"ByteBuffer",
"src",
",",
"int",
"srcStart",
",",
"ByteBuffer",
"dest",
",",
"int",
"destStart",
",",
"int",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"src",
".",
"array",
"(",
")",
",",
"srcStart... | 拷贝ByteBuffer
@param src 源ByteBuffer
@param srcStart 源开始的位置
@param dest 目标ByteBuffer
@param destStart 目标开始的位置
@param length 长度
@return 目标ByteBuffer | [
"拷贝ByteBuffer"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java#L65-L68 | train | Copies the contents of src into dest. | [
30522,
2270,
10763,
24880,
8569,
12494,
6100,
1006,
24880,
8569,
12494,
5034,
2278,
1010,
20014,
5034,
6169,
7559,
2102,
1010,
24880,
8569,
12494,
4078,
2102,
1010,
20014,
4078,
3215,
7559,
2102,
1010,
20014,
3091,
1007,
1063,
2291,
1012,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/EnumUtil.java | EnumUtil.getNames | public static List<String> getNames(Class<? extends Enum<?>> clazz) {
final Enum<?>[] enums = clazz.getEnumConstants();
if (null == enums) {
return null;
}
final List<String> list = new ArrayList<>(enums.length);
for (Enum<?> e : enums) {
list.add(e.name());
}
return list;
} | java | public static List<String> getNames(Class<? extends Enum<?>> clazz) {
final Enum<?>[] enums = clazz.getEnumConstants();
if (null == enums) {
return null;
}
final List<String> list = new ArrayList<>(enums.length);
for (Enum<?> e : enums) {
list.add(e.name());
}
return list;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getNames",
"(",
"Class",
"<",
"?",
"extends",
"Enum",
"<",
"?",
">",
">",
"clazz",
")",
"{",
"final",
"Enum",
"<",
"?",
">",
"[",
"]",
"enums",
"=",
"clazz",
".",
"getEnumConstants",
"(",
")",
";",
... | 枚举类中所有枚举对象的name列表
@param clazz 枚举类
@return name列表 | [
"枚举类中所有枚举对象的name列表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/EnumUtil.java#L103-L113 | train | Gets the names of all enums in the given class. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
2131,
18442,
2015,
1006,
2465,
1026,
1029,
8908,
4372,
2819,
1026,
1029,
1028,
1028,
18856,
10936,
2480,
1007,
1063,
2345,
4372,
2819,
1026,
1029,
1028,
1031,
1033,
4372,
18163,
1027,
30524,
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-optimizer/src/main/java/org/apache/flink/optimizer/dataproperties/GlobalProperties.java | GlobalProperties.isPartitionedOnFields | public boolean isPartitionedOnFields(FieldSet fields) {
if (this.partitioning.isPartitionedOnKey() && fields.isValidSubset(this.partitioningFields)) {
return true;
} else if (this.uniqueFieldCombinations != null) {
for (FieldSet set : this.uniqueFieldCombinations) {
if (fields.isValidSubset(set)) {
return true;
}
}
return false;
} else {
return false;
}
} | java | public boolean isPartitionedOnFields(FieldSet fields) {
if (this.partitioning.isPartitionedOnKey() && fields.isValidSubset(this.partitioningFields)) {
return true;
} else if (this.uniqueFieldCombinations != null) {
for (FieldSet set : this.uniqueFieldCombinations) {
if (fields.isValidSubset(set)) {
return true;
}
}
return false;
} else {
return false;
}
} | [
"public",
"boolean",
"isPartitionedOnFields",
"(",
"FieldSet",
"fields",
")",
"{",
"if",
"(",
"this",
".",
"partitioning",
".",
"isPartitionedOnKey",
"(",
")",
"&&",
"fields",
".",
"isValidSubset",
"(",
"this",
".",
"partitioningFields",
")",
")",
"{",
"return... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dataproperties/GlobalProperties.java#L201-L214 | train | Checks if this partitioned on the given fields. | [
30522,
2270,
22017,
20898,
2003,
19362,
3775,
3508,
26010,
2078,
15155,
1006,
4249,
3388,
4249,
1007,
1063,
2065,
1006,
2023,
1012,
13571,
2075,
1012,
2003,
19362,
3775,
3508,
26010,
8950,
3240,
1006,
1007,
1004,
1004,
4249,
1012,
2003,
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... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ftp/AbstractFtp.java | AbstractFtp.mkDirs | public void mkDirs(String dir) {
final String[] dirs = StrUtil.trim(dir).split("[\\\\/]+");
final String now = pwd();
if(dirs.length > 0 && StrUtil.isEmpty(dirs[0])) {
//首位为空,表示以/开头
this.cd(StrUtil.SLASH);
}
for (int i = 0; i < dirs.length; i++) {
if (StrUtil.isNotEmpty(dirs[i])) {
if (false == cd(dirs[i])) {
//目录不存在时创建
mkdir(dirs[i]);
cd(dirs[i]);
}
}
}
// 切换回工作目录
cd(now);
} | java | public void mkDirs(String dir) {
final String[] dirs = StrUtil.trim(dir).split("[\\\\/]+");
final String now = pwd();
if(dirs.length > 0 && StrUtil.isEmpty(dirs[0])) {
//首位为空,表示以/开头
this.cd(StrUtil.SLASH);
}
for (int i = 0; i < dirs.length; i++) {
if (StrUtil.isNotEmpty(dirs[i])) {
if (false == cd(dirs[i])) {
//目录不存在时创建
mkdir(dirs[i]);
cd(dirs[i]);
}
}
}
// 切换回工作目录
cd(now);
} | [
"public",
"void",
"mkDirs",
"(",
"String",
"dir",
")",
"{",
"final",
"String",
"[",
"]",
"dirs",
"=",
"StrUtil",
".",
"trim",
"(",
"dir",
")",
".",
"split",
"(",
"\"[\\\\\\\\/]+\"",
")",
";",
"final",
"String",
"now",
"=",
"pwd",
"(",
")",
";",
"if... | 创建指定文件夹及其父目录,从根目录开始创建,创建完成后回到默认的工作目录
@param dir 文件夹路径,绝对路径 | [
"创建指定文件夹及其父目录,从根目录开始创建,创建完成后回到默认的工作目录"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/AbstractFtp.java#L114-L133 | train | Create all the directories in the specified directory. | [
30522,
2270,
11675,
12395,
4305,
2869,
1006,
5164,
16101,
1007,
1063,
2345,
5164,
1031,
1033,
16101,
2015,
1027,
2358,
22134,
4014,
1012,
12241,
1006,
16101,
1007,
1012,
3975,
1006,
1000,
1031,
1032,
1032,
1032,
1032,
1013,
1033,
1009,
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... |
netty/netty | transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java | AbstractBootstrap.attr | public <T> B attr(AttributeKey<T> key, T value) {
if (key == null) {
throw new NullPointerException("key");
}
if (value == null) {
synchronized (attrs) {
attrs.remove(key);
}
} else {
synchronized (attrs) {
attrs.put(key, value);
}
}
return self();
} | java | public <T> B attr(AttributeKey<T> key, T value) {
if (key == null) {
throw new NullPointerException("key");
}
if (value == null) {
synchronized (attrs) {
attrs.remove(key);
}
} else {
synchronized (attrs) {
attrs.put(key, value);
}
}
return self();
} | [
"public",
"<",
"T",
">",
"B",
"attr",
"(",
"AttributeKey",
"<",
"T",
">",
"key",
",",
"T",
"value",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"key\"",
")",
";",
"}",
"if",
"(",
"value",
"==... | Allow to specify an initial attribute of the newly created {@link Channel}. If the {@code value} is
{@code null}, the attribute of the specified {@code key} is removed. | [
"Allow",
"to",
"specify",
"an",
"initial",
"attribute",
"of",
"the",
"newly",
"created",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java#L190-L204 | train | A method to add an attribute to the attribute set. | [
30522,
2270,
1026,
1056,
1028,
1038,
2012,
16344,
1006,
17961,
14839,
1026,
1056,
1028,
3145,
1010,
1056,
3643,
1007,
1063,
2065,
1006,
3145,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
3145,
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... |
netty/netty | transport/src/main/java/io/netty/channel/PendingWriteQueue.java | PendingWriteQueue.add | public void add(Object msg, ChannelPromise promise) {
assert ctx.executor().inEventLoop();
if (msg == null) {
throw new NullPointerException("msg");
}
if (promise == null) {
throw new NullPointerException("promise");
}
// It is possible for writes to be triggered from removeAndFailAll(). To preserve ordering,
// we should add them to the queue and let removeAndFailAll() fail them later.
int messageSize = size(msg);
PendingWrite write = PendingWrite.newInstance(msg, messageSize, promise);
PendingWrite currentTail = tail;
if (currentTail == null) {
tail = head = write;
} else {
currentTail.next = write;
tail = write;
}
size ++;
bytes += messageSize;
tracker.incrementPendingOutboundBytes(write.size);
} | java | public void add(Object msg, ChannelPromise promise) {
assert ctx.executor().inEventLoop();
if (msg == null) {
throw new NullPointerException("msg");
}
if (promise == null) {
throw new NullPointerException("promise");
}
// It is possible for writes to be triggered from removeAndFailAll(). To preserve ordering,
// we should add them to the queue and let removeAndFailAll() fail them later.
int messageSize = size(msg);
PendingWrite write = PendingWrite.newInstance(msg, messageSize, promise);
PendingWrite currentTail = tail;
if (currentTail == null) {
tail = head = write;
} else {
currentTail.next = write;
tail = write;
}
size ++;
bytes += messageSize;
tracker.incrementPendingOutboundBytes(write.size);
} | [
"public",
"void",
"add",
"(",
"Object",
"msg",
",",
"ChannelPromise",
"promise",
")",
"{",
"assert",
"ctx",
".",
"executor",
"(",
")",
".",
"inEventLoop",
"(",
")",
";",
"if",
"(",
"msg",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
... | Add the given {@code msg} and {@link ChannelPromise}. | [
"Add",
"the",
"given",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/PendingWriteQueue.java#L93-L116 | train | Add a message to the queue. | [
30522,
2270,
11675,
5587,
1006,
4874,
5796,
2290,
1010,
3149,
21572,
28732,
4872,
1007,
1063,
20865,
14931,
2595,
1012,
4654,
8586,
16161,
2099,
1006,
1007,
1012,
1999,
18697,
3372,
4135,
7361,
1006,
1007,
1025,
2065,
1006,
5796,
2290,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/context/properties/source/ConfigurationPropertyName.java | ConfigurationPropertyName.of | static ConfigurationPropertyName of(CharSequence name, boolean returnNullIfInvalid) {
Elements elements = elementsOf(name, returnNullIfInvalid);
return (elements != null) ? new ConfigurationPropertyName(elements) : null;
} | java | static ConfigurationPropertyName of(CharSequence name, boolean returnNullIfInvalid) {
Elements elements = elementsOf(name, returnNullIfInvalid);
return (elements != null) ? new ConfigurationPropertyName(elements) : null;
} | [
"static",
"ConfigurationPropertyName",
"of",
"(",
"CharSequence",
"name",
",",
"boolean",
"returnNullIfInvalid",
")",
"{",
"Elements",
"elements",
"=",
"elementsOf",
"(",
"name",
",",
"returnNullIfInvalid",
")",
";",
"return",
"(",
"elements",
"!=",
"null",
")",
... | Return a {@link ConfigurationPropertyName} for the specified string.
@param name the source name
@param returnNullIfInvalid if null should be returned if the name is not valid
@return a {@link ConfigurationPropertyName} instance
@throws InvalidConfigurationPropertyNameException if the name is not valid and
{@code returnNullIfInvalid} is {@code false} | [
"Return",
"a",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java#L490-L493 | train | Returns a new instance of the class with the specified name. | [
30522,
10763,
9563,
21572,
4842,
25680,
14074,
1997,
1006,
25869,
3366,
4226,
5897,
2171,
1010,
22017,
20898,
2709,
11231,
6894,
16294,
10175,
3593,
1007,
1063,
3787,
3787,
1027,
3787,
11253,
1006,
2171,
1010,
2709,
11231,
6894,
16294,
10175,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/watch/WatchMonitor.java | WatchMonitor.create | public static WatchMonitor create(String path, WatchEvent.Kind<?>... events){
return create(path, 0, events);
} | java | public static WatchMonitor create(String path, WatchEvent.Kind<?>... events){
return create(path, 0, events);
} | [
"public",
"static",
"WatchMonitor",
"create",
"(",
"String",
"path",
",",
"WatchEvent",
".",
"Kind",
"<",
"?",
">",
"...",
"events",
")",
"{",
"return",
"create",
"(",
"path",
",",
"0",
",",
"events",
")",
";",
"}"
] | 创建并初始化监听
@param path 路径
@param events 监听的事件列表
@return 监听对象 | [
"创建并初始化监听"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L151-L153 | train | Creates a new watch monitor that will watch the given path for events. | [
30522,
2270,
10763,
3422,
8202,
15660,
3443,
1006,
5164,
4130,
1010,
3422,
18697,
3372,
1012,
2785,
1026,
1029,
1028,
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,
0,
0,
0,
0,
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-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/internal/datasource/OrchestrationShardingDataSource.java | OrchestrationShardingDataSource.renew | @Subscribe
@SneakyThrows
public final synchronized void renew(final DataSourceChangedEvent dataSourceChangedEvent) {
dataSource.close();
dataSource = new ShardingDataSource(DataSourceConverter.getDataSourceMap(dataSourceChangedEvent.getDataSourceConfigurations()), dataSource.getShardingContext().getShardingRule(),
dataSource.getShardingContext().getShardingProperties().getProps());
} | java | @Subscribe
@SneakyThrows
public final synchronized void renew(final DataSourceChangedEvent dataSourceChangedEvent) {
dataSource.close();
dataSource = new ShardingDataSource(DataSourceConverter.getDataSourceMap(dataSourceChangedEvent.getDataSourceConfigurations()), dataSource.getShardingContext().getShardingRule(),
dataSource.getShardingContext().getShardingProperties().getProps());
} | [
"@",
"Subscribe",
"@",
"SneakyThrows",
"public",
"final",
"synchronized",
"void",
"renew",
"(",
"final",
"DataSourceChangedEvent",
"dataSourceChangedEvent",
")",
"{",
"dataSource",
".",
"close",
"(",
")",
";",
"dataSource",
"=",
"new",
"ShardingDataSource",
"(",
"... | Renew sharding data source.
@param dataSourceChangedEvent data source changed event | [
"Renew",
"sharding",
"data",
"source",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/internal/datasource/OrchestrationShardingDataSource.java#L98-L104 | train | Renews the sharding data source. | [
30522,
1030,
4942,
29234,
1030,
13583,
22123,
8093,
15568,
2270,
2345,
25549,
11675,
20687,
1006,
2345,
2951,
6499,
3126,
3401,
22305,
14728,
15338,
2951,
6499,
3126,
3401,
22305,
14728,
15338,
1007,
1063,
2951,
6499,
3126,
3401,
1012,
2485,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/collection/trie/DoubleArrayTrie.java | DoubleArrayTrie.load | public boolean load(String path, List<V> value)
{
if (!loadBaseAndCheck(path)) return false;
v = (V[]) value.toArray();
return true;
} | java | public boolean load(String path, List<V> value)
{
if (!loadBaseAndCheck(path)) return false;
v = (V[]) value.toArray();
return true;
} | [
"public",
"boolean",
"load",
"(",
"String",
"path",
",",
"List",
"<",
"V",
">",
"value",
")",
"{",
"if",
"(",
"!",
"loadBaseAndCheck",
"(",
"path",
")",
")",
"return",
"false",
";",
"v",
"=",
"(",
"V",
"[",
"]",
")",
"value",
".",
"toArray",
"(",... | 从磁盘加载,需要额外提供值
@param path
@param value
@return | [
"从磁盘加载,需要额外提供值"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L510-L515 | train | Load a single SECTYPE from the file. | [
30522,
2270,
22017,
20898,
7170,
1006,
5164,
4130,
1010,
2862,
1026,
1058,
1028,
3643,
1007,
1063,
2065,
1006,
999,
7170,
15058,
5685,
5403,
3600,
1006,
4130,
1007,
1007,
2709,
6270,
1025,
1058,
1027,
1006,
1058,
1031,
1033,
1007,
3643,
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-poi/src/main/java/cn/hutool/poi/excel/StyleSet.java | StyleSet.setBorder | public StyleSet setBorder(BorderStyle borderSize, IndexedColors colorIndex) {
StyleUtil.setBorder(this.headCellStyle, borderSize, colorIndex);
StyleUtil.setBorder(this.cellStyle, borderSize, colorIndex);
StyleUtil.setBorder(this.cellStyleForNumber, borderSize, colorIndex);
StyleUtil.setBorder(this.cellStyleForDate, borderSize, colorIndex);
return this;
} | java | public StyleSet setBorder(BorderStyle borderSize, IndexedColors colorIndex) {
StyleUtil.setBorder(this.headCellStyle, borderSize, colorIndex);
StyleUtil.setBorder(this.cellStyle, borderSize, colorIndex);
StyleUtil.setBorder(this.cellStyleForNumber, borderSize, colorIndex);
StyleUtil.setBorder(this.cellStyleForDate, borderSize, colorIndex);
return this;
} | [
"public",
"StyleSet",
"setBorder",
"(",
"BorderStyle",
"borderSize",
",",
"IndexedColors",
"colorIndex",
")",
"{",
"StyleUtil",
".",
"setBorder",
"(",
"this",
".",
"headCellStyle",
",",
"borderSize",
",",
"colorIndex",
")",
";",
"StyleUtil",
".",
"setBorder",
"(... | 定义所有单元格的边框类型
@param borderSize 边框粗细{@link BorderStyle}枚举
@param colorIndex 颜色的short值
@return this
@since 4.0.0 | [
"定义所有单元格的边框类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/StyleSet.java#L98-L104 | train | Sets the border of the style. | [
30522,
2270,
6782,
3388,
2275,
12821,
4063,
1006,
6645,
27983,
6645,
4697,
1010,
25331,
18717,
2015,
3609,
22254,
10288,
1007,
1063,
2806,
21823,
2140,
1012,
2275,
12821,
4063,
1006,
2023,
1012,
2132,
29109,
4877,
27983,
1010,
6645,
4697,
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-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/HadoopInputs.java | HadoopInputs.readHadoopFile | public static <K, V> HadoopInputFormat<K, V> readHadoopFile(org.apache.hadoop.mapred.FileInputFormat<K, V> mapredInputFormat, Class<K> key, Class<V> value, String inputPath, JobConf job) {
// set input path in JobConf
org.apache.hadoop.mapred.FileInputFormat.addInputPath(job, new org.apache.hadoop.fs.Path(inputPath));
// return wrapping InputFormat
return createHadoopInput(mapredInputFormat, key, value, job);
} | java | public static <K, V> HadoopInputFormat<K, V> readHadoopFile(org.apache.hadoop.mapred.FileInputFormat<K, V> mapredInputFormat, Class<K> key, Class<V> value, String inputPath, JobConf job) {
// set input path in JobConf
org.apache.hadoop.mapred.FileInputFormat.addInputPath(job, new org.apache.hadoop.fs.Path(inputPath));
// return wrapping InputFormat
return createHadoopInput(mapredInputFormat, key, value, job);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"HadoopInputFormat",
"<",
"K",
",",
"V",
">",
"readHadoopFile",
"(",
"org",
".",
"apache",
".",
"hadoop",
".",
"mapred",
".",
"FileInputFormat",
"<",
"K",
",",
"V",
">",
"mapredInputFormat",
",",
"Class",
"<... | Creates a Flink {@link InputFormat} that wraps the given Hadoop {@link org.apache.hadoop.mapred.FileInputFormat}.
@return A Flink InputFormat that wraps the Hadoop FileInputFormat. | [
"Creates",
"a",
"Flink",
"{",
"@link",
"InputFormat",
"}",
"that",
"wraps",
"the",
"given",
"Hadoop",
"{",
"@link",
"org",
".",
"apache",
".",
"hadoop",
".",
"mapred",
".",
"FileInputFormat",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/HadoopInputs.java#L50-L55 | train | Create a HadoopInputFormat from a HadoopFileInputFormat. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
2018,
18589,
2378,
18780,
14192,
4017,
1026,
1047,
1010,
1058,
1028,
3191,
16102,
18589,
8873,
2571,
1006,
8917,
1012,
15895,
1012,
2018,
18589,
1012,
4949,
5596,
1012,
5371,
2378,
18780,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/clause/InsertIntoClauseParser.java | InsertIntoClauseParser.parse | public void parse(final InsertStatement insertStatement) {
lexerEngine.unsupportedIfEqual(getUnsupportedKeywordsBeforeInto());
lexerEngine.skipUntil(DefaultKeyword.INTO);
lexerEngine.nextToken();
tableReferencesClauseParser.parse(insertStatement, true);
skipBetweenTableAndValues(insertStatement);
} | java | public void parse(final InsertStatement insertStatement) {
lexerEngine.unsupportedIfEqual(getUnsupportedKeywordsBeforeInto());
lexerEngine.skipUntil(DefaultKeyword.INTO);
lexerEngine.nextToken();
tableReferencesClauseParser.parse(insertStatement, true);
skipBetweenTableAndValues(insertStatement);
} | [
"public",
"void",
"parse",
"(",
"final",
"InsertStatement",
"insertStatement",
")",
"{",
"lexerEngine",
".",
"unsupportedIfEqual",
"(",
"getUnsupportedKeywordsBeforeInto",
"(",
")",
")",
";",
"lexerEngine",
".",
"skipUntil",
"(",
"DefaultKeyword",
".",
"INTO",
")",
... | Parse insert into.
@param insertStatement insert statement | [
"Parse",
"insert",
"into",
"."
] | 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/clause/InsertIntoClauseParser.java#L44-L50 | train | Parse the insert statement. | [
30522,
2270,
11675,
11968,
3366,
1006,
2345,
19274,
9153,
18532,
4765,
19274,
9153,
18532,
4765,
1007,
1063,
17244,
7869,
3070,
3170,
1012,
4895,
6342,
9397,
15613,
29323,
26426,
1006,
2131,
4609,
6342,
9397,
15613,
14839,
22104,
4783,
29278,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ssl/OpenSslSessionStats.java | OpenSslSessionStats.ticketKeyResume | public long ticketKeyResume() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionTicketKeyResume(context.ctx);
} finally {
readerLock.unlock();
}
} | java | public long ticketKeyResume() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionTicketKeyResume(context.ctx);
} finally {
readerLock.unlock();
}
} | [
"public",
"long",
"ticketKeyResume",
"(",
")",
"{",
"Lock",
"readerLock",
"=",
"context",
".",
"ctxLock",
".",
"readLock",
"(",
")",
";",
"readerLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"SSLContext",
".",
"sessionTicketKeyResume",
"(",
"con... | Returns the number of times a client presented a ticket derived from the primary key. | [
"Returns",
"the",
"number",
"of",
"times",
"a",
"client",
"presented",
"a",
"ticket",
"derived",
"from",
"the",
"primary",
"key",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java#L244-L252 | train | Get ticket key resume. | [
30522,
2270,
2146,
7281,
14839,
6072,
17897,
1006,
1007,
1063,
5843,
8068,
7878,
1027,
6123,
1012,
14931,
2595,
7878,
1012,
3191,
7878,
1006,
1007,
1025,
8068,
7878,
1012,
5843,
1006,
1007,
1025,
3046,
1063,
2709,
7020,
22499,
10111,
18413,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/jobmaster/JobManagerSharedServices.java | JobManagerSharedServices.fromConfiguration | public static JobManagerSharedServices fromConfiguration(
Configuration config,
BlobServer blobServer) throws Exception {
checkNotNull(config);
checkNotNull(blobServer);
final String classLoaderResolveOrder =
config.getString(CoreOptions.CLASSLOADER_RESOLVE_ORDER);
final String[] alwaysParentFirstLoaderPatterns = CoreOptions.getParentFirstLoaderPatterns(config);
final BlobLibraryCacheManager libraryCacheManager =
new BlobLibraryCacheManager(
blobServer,
FlinkUserCodeClassLoaders.ResolveOrder.fromString(classLoaderResolveOrder),
alwaysParentFirstLoaderPatterns);
final FiniteDuration timeout;
try {
timeout = AkkaUtils.getTimeout(config);
} catch (NumberFormatException e) {
throw new IllegalConfigurationException(AkkaUtils.formatDurationParsingErrorMessage());
}
final ScheduledExecutorService futureExecutor = Executors.newScheduledThreadPool(
Hardware.getNumberCPUCores(),
new ExecutorThreadFactory("jobmanager-future"));
final StackTraceSampleCoordinator stackTraceSampleCoordinator =
new StackTraceSampleCoordinator(futureExecutor, timeout.toMillis());
final int cleanUpInterval = config.getInteger(WebOptions.BACKPRESSURE_CLEANUP_INTERVAL);
final BackPressureStatsTrackerImpl backPressureStatsTracker = new BackPressureStatsTrackerImpl(
stackTraceSampleCoordinator,
cleanUpInterval,
config.getInteger(WebOptions.BACKPRESSURE_NUM_SAMPLES),
config.getInteger(WebOptions.BACKPRESSURE_REFRESH_INTERVAL),
Time.milliseconds(config.getInteger(WebOptions.BACKPRESSURE_DELAY)));
futureExecutor.scheduleWithFixedDelay(
backPressureStatsTracker::cleanUpOperatorStatsCache,
cleanUpInterval,
cleanUpInterval,
TimeUnit.MILLISECONDS);
return new JobManagerSharedServices(
futureExecutor,
libraryCacheManager,
RestartStrategyFactory.createRestartStrategyFactory(config),
stackTraceSampleCoordinator,
backPressureStatsTracker,
blobServer);
} | java | public static JobManagerSharedServices fromConfiguration(
Configuration config,
BlobServer blobServer) throws Exception {
checkNotNull(config);
checkNotNull(blobServer);
final String classLoaderResolveOrder =
config.getString(CoreOptions.CLASSLOADER_RESOLVE_ORDER);
final String[] alwaysParentFirstLoaderPatterns = CoreOptions.getParentFirstLoaderPatterns(config);
final BlobLibraryCacheManager libraryCacheManager =
new BlobLibraryCacheManager(
blobServer,
FlinkUserCodeClassLoaders.ResolveOrder.fromString(classLoaderResolveOrder),
alwaysParentFirstLoaderPatterns);
final FiniteDuration timeout;
try {
timeout = AkkaUtils.getTimeout(config);
} catch (NumberFormatException e) {
throw new IllegalConfigurationException(AkkaUtils.formatDurationParsingErrorMessage());
}
final ScheduledExecutorService futureExecutor = Executors.newScheduledThreadPool(
Hardware.getNumberCPUCores(),
new ExecutorThreadFactory("jobmanager-future"));
final StackTraceSampleCoordinator stackTraceSampleCoordinator =
new StackTraceSampleCoordinator(futureExecutor, timeout.toMillis());
final int cleanUpInterval = config.getInteger(WebOptions.BACKPRESSURE_CLEANUP_INTERVAL);
final BackPressureStatsTrackerImpl backPressureStatsTracker = new BackPressureStatsTrackerImpl(
stackTraceSampleCoordinator,
cleanUpInterval,
config.getInteger(WebOptions.BACKPRESSURE_NUM_SAMPLES),
config.getInteger(WebOptions.BACKPRESSURE_REFRESH_INTERVAL),
Time.milliseconds(config.getInteger(WebOptions.BACKPRESSURE_DELAY)));
futureExecutor.scheduleWithFixedDelay(
backPressureStatsTracker::cleanUpOperatorStatsCache,
cleanUpInterval,
cleanUpInterval,
TimeUnit.MILLISECONDS);
return new JobManagerSharedServices(
futureExecutor,
libraryCacheManager,
RestartStrategyFactory.createRestartStrategyFactory(config),
stackTraceSampleCoordinator,
backPressureStatsTracker,
blobServer);
} | [
"public",
"static",
"JobManagerSharedServices",
"fromConfiguration",
"(",
"Configuration",
"config",
",",
"BlobServer",
"blobServer",
")",
"throws",
"Exception",
"{",
"checkNotNull",
"(",
"config",
")",
";",
"checkNotNull",
"(",
"blobServer",
")",
";",
"final",
"Str... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobManagerSharedServices.java#L137-L189 | train | Create a new JobManagerSharedServices from the given configuration. | [
30522,
2270,
10763,
3105,
24805,
15776,
8167,
2098,
8043,
7903,
2229,
2013,
8663,
8873,
27390,
3370,
1006,
9563,
9530,
8873,
2290,
1010,
1038,
4135,
5910,
2121,
6299,
1038,
4135,
5910,
2121,
6299,
1007,
11618,
6453,
1063,
4638,
17048,
11231... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/SingleOutputStreamOperator.java | SingleOutputStreamOperator.setParallelism | public SingleOutputStreamOperator<T> setParallelism(int parallelism) {
Preconditions.checkArgument(canBeParallel() || parallelism == 1,
"The parallelism of non parallel operator must be 1.");
transformation.setParallelism(parallelism);
return this;
} | java | public SingleOutputStreamOperator<T> setParallelism(int parallelism) {
Preconditions.checkArgument(canBeParallel() || parallelism == 1,
"The parallelism of non parallel operator must be 1.");
transformation.setParallelism(parallelism);
return this;
} | [
"public",
"SingleOutputStreamOperator",
"<",
"T",
">",
"setParallelism",
"(",
"int",
"parallelism",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"canBeParallel",
"(",
")",
"||",
"parallelism",
"==",
"1",
",",
"\"The parallelism of non parallel operator must be ... | Sets the parallelism for this operator.
@param parallelism
The parallelism for this operator.
@return The operator with set parallelism. | [
"Sets",
"the",
"parallelism",
"for",
"this",
"operator",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SingleOutputStreamOperator.java#L140-L147 | train | Sets the parallelism of this operator. | [
30522,
2270,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1056,
1028,
2275,
28689,
6216,
28235,
1006,
20014,
5903,
2964,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
2064,
4783,
28689,
6216,
2140,
1006,
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-clients/src/main/java/org/apache/flink/client/LocalExecutor.java | LocalExecutor.executePlan | @Override
public JobExecutionResult executePlan(Plan plan) throws Exception {
if (plan == null) {
throw new IllegalArgumentException("The plan may not be null.");
}
synchronized (this.lock) {
// check if we start a session dedicated for this execution
final boolean shutDownAtEnd;
if (jobExecutorService == null) {
shutDownAtEnd = true;
// configure the number of local slots equal to the parallelism of the local plan
if (this.taskManagerNumSlots == DEFAULT_TASK_MANAGER_NUM_SLOTS) {
int maxParallelism = plan.getMaximumParallelism();
if (maxParallelism > 0) {
this.taskManagerNumSlots = maxParallelism;
}
}
// start the cluster for us
start();
}
else {
// we use the existing session
shutDownAtEnd = false;
}
try {
// TODO: Set job's default parallelism to max number of slots
final int slotsPerTaskManager = jobExecutorServiceConfiguration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS, taskManagerNumSlots);
final int numTaskManagers = jobExecutorServiceConfiguration.getInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 1);
plan.setDefaultParallelism(slotsPerTaskManager * numTaskManagers);
Optimizer pc = new Optimizer(new DataStatistics(), jobExecutorServiceConfiguration);
OptimizedPlan op = pc.compile(plan);
JobGraphGenerator jgg = new JobGraphGenerator(jobExecutorServiceConfiguration);
JobGraph jobGraph = jgg.compileJobGraph(op, plan.getJobId());
return jobExecutorService.executeJobBlocking(jobGraph);
}
finally {
if (shutDownAtEnd) {
stop();
}
}
}
} | java | @Override
public JobExecutionResult executePlan(Plan plan) throws Exception {
if (plan == null) {
throw new IllegalArgumentException("The plan may not be null.");
}
synchronized (this.lock) {
// check if we start a session dedicated for this execution
final boolean shutDownAtEnd;
if (jobExecutorService == null) {
shutDownAtEnd = true;
// configure the number of local slots equal to the parallelism of the local plan
if (this.taskManagerNumSlots == DEFAULT_TASK_MANAGER_NUM_SLOTS) {
int maxParallelism = plan.getMaximumParallelism();
if (maxParallelism > 0) {
this.taskManagerNumSlots = maxParallelism;
}
}
// start the cluster for us
start();
}
else {
// we use the existing session
shutDownAtEnd = false;
}
try {
// TODO: Set job's default parallelism to max number of slots
final int slotsPerTaskManager = jobExecutorServiceConfiguration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS, taskManagerNumSlots);
final int numTaskManagers = jobExecutorServiceConfiguration.getInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 1);
plan.setDefaultParallelism(slotsPerTaskManager * numTaskManagers);
Optimizer pc = new Optimizer(new DataStatistics(), jobExecutorServiceConfiguration);
OptimizedPlan op = pc.compile(plan);
JobGraphGenerator jgg = new JobGraphGenerator(jobExecutorServiceConfiguration);
JobGraph jobGraph = jgg.compileJobGraph(op, plan.getJobId());
return jobExecutorService.executeJobBlocking(jobGraph);
}
finally {
if (shutDownAtEnd) {
stop();
}
}
}
} | [
"@",
"Override",
"public",
"JobExecutionResult",
"executePlan",
"(",
"Plan",
"plan",
")",
"throws",
"Exception",
"{",
"if",
"(",
"plan",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The plan may not be null.\"",
")",
";",
"}",
"syn... | Executes the given program on a local runtime and waits for the job to finish.
<p>If the executor has not been started before, this starts the executor and shuts it down
after the job finished. If the job runs in session mode, the executor is kept alive until
no more references to the executor exist.</p>
@param plan The plan of the program to execute.
@return The net runtime of the program, in milliseconds.
@throws Exception Thrown, if either the startup of the local execution context, or the execution
caused an exception. | [
"Executes",
"the",
"given",
"program",
"on",
"a",
"local",
"runtime",
"and",
"waits",
"for",
"the",
"job",
"to",
"finish",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/LocalExecutor.java#L180-L230 | train | Execute a single plan. | [
30522,
1030,
2058,
15637,
2270,
3105,
10288,
8586,
13700,
6072,
11314,
15389,
24759,
2319,
1006,
2933,
2933,
1007,
11618,
6453,
1063,
2065,
1006,
2933,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java | TaskExecutorBuilder.taskDecorator | public TaskExecutorBuilder taskDecorator(TaskDecorator taskDecorator) {
return new TaskExecutorBuilder(this.queueCapacity, this.corePoolSize,
this.maxPoolSize, this.allowCoreThreadTimeOut, this.keepAlive,
this.awaitTermination, this.awaitTerminationPeriod, this.threadNamePrefix,
taskDecorator, this.customizers);
} | java | public TaskExecutorBuilder taskDecorator(TaskDecorator taskDecorator) {
return new TaskExecutorBuilder(this.queueCapacity, this.corePoolSize,
this.maxPoolSize, this.allowCoreThreadTimeOut, this.keepAlive,
this.awaitTermination, this.awaitTerminationPeriod, this.threadNamePrefix,
taskDecorator, this.customizers);
} | [
"public",
"TaskExecutorBuilder",
"taskDecorator",
"(",
"TaskDecorator",
"taskDecorator",
")",
"{",
"return",
"new",
"TaskExecutorBuilder",
"(",
"this",
".",
"queueCapacity",
",",
"this",
".",
"corePoolSize",
",",
"this",
".",
"maxPoolSize",
",",
"this",
".",
"allo... | Set the {@link TaskDecorator} to use or {@code null} to not use any.
@param taskDecorator the task decorator 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/task/TaskExecutorBuilder.java#L216-L221 | train | Add a task decorator. | [
30522,
2270,
4708,
10288,
8586,
16161,
15185,
19231,
4063,
4708,
3207,
27108,
8844,
1006,
4708,
3207,
27108,
8844,
4708,
3207,
27108,
8844,
1007,
1063,
2709,
2047,
4708,
10288,
8586,
16161,
15185,
19231,
4063,
1006,
2023,
1012,
24240,
17695,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/HanLP.java | HanLP.extractWords | public static List<WordInfo> extractWords(String text, int size)
{
return extractWords(text, size, false);
} | java | public static List<WordInfo> extractWords(String text, int size)
{
return extractWords(text, size, false);
} | [
"public",
"static",
"List",
"<",
"WordInfo",
">",
"extractWords",
"(",
"String",
"text",
",",
"int",
"size",
")",
"{",
"return",
"extractWords",
"(",
"text",
",",
"size",
",",
"false",
")",
";",
"}"
] | 提取词语
@param text 大文本
@param size 需要提取词语的数量
@return 一个词语列表 | [
"提取词语"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/HanLP.java#L732-L735 | train | Extract words from a text string. | [
30522,
2270,
10763,
2862,
1026,
2773,
2378,
14876,
1028,
14817,
22104,
1006,
5164,
3793,
1010,
20014,
2946,
1007,
1063,
2709,
14817,
22104,
1006,
3793,
1010,
2946,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/sax/ExcelSaxUtil.java | ExcelSaxUtil.getDateValue | private static DateTime getDateValue(String value) {
return DateUtil.date(org.apache.poi.ss.usermodel.DateUtil.getJavaDate(Double.parseDouble(value), false));
} | java | private static DateTime getDateValue(String value) {
return DateUtil.date(org.apache.poi.ss.usermodel.DateUtil.getJavaDate(Double.parseDouble(value), false));
} | [
"private",
"static",
"DateTime",
"getDateValue",
"(",
"String",
"value",
")",
"{",
"return",
"DateUtil",
".",
"date",
"(",
"org",
".",
"apache",
".",
"poi",
".",
"ss",
".",
"usermodel",
".",
"DateUtil",
".",
"getJavaDate",
"(",
"Double",
".",
"parseDouble"... | 获取日期
@param value 单元格值
@return 日期
@since 4.1.0 | [
"获取日期"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/ExcelSaxUtil.java#L128-L130 | train | Get the date value from a string. | [
30522,
2797,
10763,
3058,
7292,
2131,
13701,
10175,
5657,
1006,
5164,
3643,
1007,
1063,
2709,
3058,
21823,
2140,
1012,
3058,
1006,
8917,
1012,
15895,
1012,
13433,
2072,
1012,
7020,
1012,
5310,
5302,
9247,
1012,
3058,
21823,
2140,
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-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricFetcherImpl.java | MetricFetcherImpl.update | @Override
public void update() {
synchronized (this) {
long currentTime = System.currentTimeMillis();
if (currentTime - lastUpdateTime > updateInterval) {
lastUpdateTime = currentTime;
fetchMetrics();
}
}
} | java | @Override
public void update() {
synchronized (this) {
long currentTime = System.currentTimeMillis();
if (currentTime - lastUpdateTime > updateInterval) {
lastUpdateTime = currentTime;
fetchMetrics();
}
}
} | [
"@",
"Override",
"public",
"void",
"update",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"long",
"currentTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"currentTime",
"-",
"lastUpdateTime",
">",
"updateInterval",
")",
"... | This method can be used to signal this MetricFetcher that the metrics are still in use and should be updated. | [
"This",
"method",
"can",
"be",
"used",
"to",
"signal",
"this",
"MetricFetcher",
"that",
"the",
"metrics",
"are",
"still",
"in",
"use",
"and",
"should",
"be",
"updated",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricFetcherImpl.java#L99-L108 | train | Updates the metrics. | [
30522,
1030,
2058,
15637,
2270,
11675,
10651,
1006,
1007,
1063,
25549,
1006,
2023,
1007,
1063,
2146,
2783,
7292,
1027,
2291,
1012,
2783,
7292,
19912,
2483,
1006,
1007,
1025,
2065,
1006,
2783,
7292,
1011,
2197,
6279,
13701,
7292,
1028,
10651... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/util/SegmentsUtil.java | SegmentsUtil.hash | public static int hash(MemorySegment[] segments, int offset, int numBytes) {
if (inFirstSegment(segments, offset, numBytes)) {
return MurmurHashUtil.hashBytes(segments[0], offset, numBytes);
} else {
return hashMultiSeg(segments, offset, numBytes);
}
} | java | public static int hash(MemorySegment[] segments, int offset, int numBytes) {
if (inFirstSegment(segments, offset, numBytes)) {
return MurmurHashUtil.hashBytes(segments[0], offset, numBytes);
} else {
return hashMultiSeg(segments, offset, numBytes);
}
} | [
"public",
"static",
"int",
"hash",
"(",
"MemorySegment",
"[",
"]",
"segments",
",",
"int",
"offset",
",",
"int",
"numBytes",
")",
"{",
"if",
"(",
"inFirstSegment",
"(",
"segments",
",",
"offset",
",",
"numBytes",
")",
")",
"{",
"return",
"MurmurHashUtil",
... | hash segments to int.
@param segments Source segments.
@param offset Source segments offset.
@param numBytes the number bytes to hash. | [
"hash",
"segments",
"to",
"int",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L391-L397 | train | Hash a segment array. | [
30522,
2270,
10763,
20014,
23325,
1006,
3638,
3366,
21693,
4765,
1031,
1033,
9214,
1010,
20014,
16396,
1010,
20014,
15903,
17250,
2015,
1007,
1063,
2065,
1006,
1999,
8873,
12096,
3366,
21693,
4765,
1006,
9214,
1010,
16396,
1010,
15903,
17250,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/jdk/JdkLog.java | JdkLog.logIfEnabled | private void logIfEnabled(String callerFQCN, Level level, Throwable throwable, String format, Object[] arguments){
if(logger.isLoggable(level)){
LogRecord record = new LogRecord(level, StrUtil.format(format, arguments));
record.setLoggerName(getName());
record.setThrown(throwable);
fillCallerData(callerFQCN, record);
logger.log(record);
}
} | java | private void logIfEnabled(String callerFQCN, Level level, Throwable throwable, String format, Object[] arguments){
if(logger.isLoggable(level)){
LogRecord record = new LogRecord(level, StrUtil.format(format, arguments));
record.setLoggerName(getName());
record.setThrown(throwable);
fillCallerData(callerFQCN, record);
logger.log(record);
}
} | [
"private",
"void",
"logIfEnabled",
"(",
"String",
"callerFQCN",
",",
"Level",
"level",
",",
"Throwable",
"throwable",
",",
"String",
"format",
",",
"Object",
"[",
"]",
"arguments",
")",
"{",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"level",
")",
")",
... | 打印对应等级的日志
@param callerFQCN
@param level 等级
@param throwable 异常对象
@param format 消息模板
@param arguments 参数 | [
"打印对应等级的日志"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/dialect/jdk/JdkLog.java#L180-L188 | train | Logs a single exception if the logger is enabled. | [
30522,
2797,
11675,
8833,
29323,
22966,
2094,
1006,
5164,
20587,
2546,
4160,
2278,
2078,
1010,
2504,
2504,
1010,
5466,
3085,
5466,
3085,
1010,
5164,
4289,
1010,
4874,
1031,
1033,
9918,
1007,
1063,
2065,
1006,
8833,
4590,
1012,
2003,
21197,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java | KeyUtil.decodeECPoint | public static PublicKey decodeECPoint(String encode, String curveName) {
return BCUtil.decodeECPoint(encode, curveName);
} | java | public static PublicKey decodeECPoint(String encode, String curveName) {
return BCUtil.decodeECPoint(encode, curveName);
} | [
"public",
"static",
"PublicKey",
"decodeECPoint",
"(",
"String",
"encode",
",",
"String",
"curveName",
")",
"{",
"return",
"BCUtil",
".",
"decodeECPoint",
"(",
"encode",
",",
"curveName",
")",
";",
"}"
] | 解码恢复EC压缩公钥,支持Base64和Hex编码,(基于BouncyCastle)<br>
见:https://www.cnblogs.com/xinzhao/p/8963724.html
@param encode 压缩公钥
@param curveName EC曲线名
@since 4.4.4 | [
"解码恢复EC压缩公钥",
"支持Base64和Hex编码",
"(基于BouncyCastle)<br",
">",
"见:https",
":",
"//",
"www",
".",
"cnblogs",
".",
"com",
"/",
"xinzhao",
"/",
"p",
"/",
"8963724",
".",
"html"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L755-L757 | train | Decode an ECPoint from a string encoded with the specified encoding. | [
30522,
2270,
10763,
2270,
14839,
21933,
26095,
21906,
25785,
1006,
5164,
4372,
16044,
1010,
5164,
7774,
18442,
1007,
1063,
2709,
4647,
21823,
2140,
1012,
21933,
26095,
21906,
25785,
1006,
4372,
16044,
1010,
7774,
18442,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/utility/LexiconUtility.java | LexiconUtility.setAttribute | public static boolean setAttribute(String word, CoreDictionary.Attribute attribute)
{
if (attribute == null) return false;
if (CoreDictionary.trie.set(word, attribute)) return true;
if (CustomDictionary.dat.set(word, attribute)) return true;
if (CustomDictionary.trie == null)
{
CustomDictionary.add(word);
}
CustomDictionary.trie.put(word, attribute);
return true;
} | java | public static boolean setAttribute(String word, CoreDictionary.Attribute attribute)
{
if (attribute == null) return false;
if (CoreDictionary.trie.set(word, attribute)) return true;
if (CustomDictionary.dat.set(word, attribute)) return true;
if (CustomDictionary.trie == null)
{
CustomDictionary.add(word);
}
CustomDictionary.trie.put(word, attribute);
return true;
} | [
"public",
"static",
"boolean",
"setAttribute",
"(",
"String",
"word",
",",
"CoreDictionary",
".",
"Attribute",
"attribute",
")",
"{",
"if",
"(",
"attribute",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"CoreDictionary",
".",
"trie",
".",
"set",
"... | 设置某个单词的属性
@param word
@param attribute
@return | [
"设置某个单词的属性"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/LexiconUtility.java#L81-L93 | train | Sets the attribute for a word. | [
30522,
2270,
10763,
22017,
20898,
2275,
19321,
3089,
8569,
2618,
1006,
5164,
2773,
1010,
4563,
29201,
3258,
5649,
1012,
17961,
17961,
1007,
1063,
2065,
1006,
17961,
1027,
1027,
19701,
1007,
2709,
6270,
1025,
2065,
1006,
4563,
29201,
3258,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/rest/RestClusterClient.java | RestClusterClient.requestJobResult | @Override
public CompletableFuture<JobResult> requestJobResult(@Nonnull JobID jobId) {
return pollResourceAsync(
() -> {
final JobMessageParameters messageParameters = new JobMessageParameters();
messageParameters.jobPathParameter.resolve(jobId);
return sendRequest(
JobExecutionResultHeaders.getInstance(),
messageParameters);
});
} | java | @Override
public CompletableFuture<JobResult> requestJobResult(@Nonnull JobID jobId) {
return pollResourceAsync(
() -> {
final JobMessageParameters messageParameters = new JobMessageParameters();
messageParameters.jobPathParameter.resolve(jobId);
return sendRequest(
JobExecutionResultHeaders.getInstance(),
messageParameters);
});
} | [
"@",
"Override",
"public",
"CompletableFuture",
"<",
"JobResult",
">",
"requestJobResult",
"(",
"@",
"Nonnull",
"JobID",
"jobId",
")",
"{",
"return",
"pollResourceAsync",
"(",
"(",
")",
"->",
"{",
"final",
"JobMessageParameters",
"messageParameters",
"=",
"new",
... | Requests the {@link JobResult} for the given {@link JobID}. The method retries multiple
times to poll the {@link JobResult} before giving up.
@param jobId specifying the job for which to retrieve the {@link JobResult}
@return Future which is completed with the {@link JobResult} once the job has completed or
with a failure if the {@link JobResult} could not be retrieved. | [
"Requests",
"the",
"{",
"@link",
"JobResult",
"}",
"for",
"the",
"given",
"{",
"@link",
"JobID",
"}",
".",
"The",
"method",
"retries",
"multiple",
"times",
"to",
"poll",
"the",
"{",
"@link",
"JobResult",
"}",
"before",
"giving",
"up",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java#L298-L308 | train | Request a job result asynchronously. | [
30522,
1030,
2058,
15637,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
3105,
6072,
11314,
1028,
5227,
5558,
13578,
23722,
2102,
1006,
1030,
2512,
11231,
3363,
3105,
3593,
3105,
3593,
1007,
1063,
2709,
8554,
6072,
8162,
21456,
6508,
12273,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.