repo stringclasses 11 values | path stringlengths 41 234 | func_name stringlengths 5 78 | original_string stringlengths 71 14.1k | language stringclasses 1 value | code stringlengths 71 14.1k | code_tokens listlengths 22 2.65k | docstring stringlengths 2 5.35k | docstring_tokens listlengths 1 369 | sha stringclasses 11 values | url stringlengths 129 339 | partition stringclasses 1 value | summary stringlengths 7 175 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/TextSimilarity.java | TextSimilarity.charReg | private static boolean charReg(char charValue) {
return (charValue >= 0x4E00 && charValue <= 0XFFF) || //
(charValue >= 'a' && charValue <= 'z') || //
(charValue >= 'A' && charValue <= 'Z') || //
(charValue >= '0' && charValue <= '9');
} | java | private static boolean charReg(char charValue) {
return (charValue >= 0x4E00 && charValue <= 0XFFF) || //
(charValue >= 'a' && charValue <= 'z') || //
(charValue >= 'A' && charValue <= 'Z') || //
(charValue >= '0' && charValue <= '9');
} | [
"private",
"static",
"boolean",
"charReg",
"(",
"char",
"charValue",
")",
"{",
"return",
"(",
"charValue",
">=",
"0x4E00",
"&&",
"charValue",
"<=",
"0XFFF",
")",
"||",
"//",
"(",
"charValue",
">=",
"'",
"'",
"&&",
"charValue",
"<=",
"'",
"'",
")",
"||"... | 判断字符是否为汉字,数字和字母, 因为对符号进行相似度比较没有实际意义,故符号不加入考虑范围。
@param charValue 字符
@return 是否为汉字,数字和字母 | [
"判断字符是否为汉字,数字和字母,",
"因为对符号进行相似度比较没有实际意义,故符号不加入考虑范围。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/TextSimilarity.java#L72-L77 | train | Test if a character value is a valid Unicode character. | [
30522,
2797,
10763,
22017,
20898,
25869,
2890,
2290,
1006,
25869,
25869,
10175,
5657,
1007,
1063,
2709,
1006,
25869,
10175,
5657,
1028,
1027,
1014,
2595,
2549,
2063,
8889,
1004,
1004,
25869,
10175,
5657,
1026,
1027,
1014,
2595,
4246,
2546,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/mining/cluster/Cluster.java | Cluster.set_sectioned_gain | void set_sectioned_gain()
{
double gain = 0.0f;
if (sectioned_gain_ == 0 && sectioned_clusters_.size() > 1)
{
for (Cluster<K> cluster : sectioned_clusters_)
{
gain += cluster.composite_vector().norm();
}
gain -= composite_.norm();
}
sectioned_gain_ = gain;
} | java | void set_sectioned_gain()
{
double gain = 0.0f;
if (sectioned_gain_ == 0 && sectioned_clusters_.size() > 1)
{
for (Cluster<K> cluster : sectioned_clusters_)
{
gain += cluster.composite_vector().norm();
}
gain -= composite_.norm();
}
sectioned_gain_ = gain;
} | [
"void",
"set_sectioned_gain",
"(",
")",
"{",
"double",
"gain",
"=",
"0.0f",
";",
"if",
"(",
"sectioned_gain_",
"==",
"0",
"&&",
"sectioned_clusters_",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"for",
"(",
"Cluster",
"<",
"K",
">",
"cluster",
":",
"s... | Set a gain when the cluster sectioned. | [
"Set",
"a",
"gain",
"when",
"the",
"cluster",
"sectioned",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/Cluster.java#L179-L191 | train | Sets the gain of the sectioned terms of the URIs. | [
30522,
11675,
2275,
1035,
2930,
2098,
1035,
5114,
1006,
1007,
1063,
3313,
5114,
1027,
1014,
1012,
1014,
2546,
1025,
2065,
1006,
2930,
2098,
1035,
5114,
1035,
1027,
1027,
1014,
1004,
1004,
2930,
2098,
1035,
12906,
1035,
1012,
2946,
1006,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationTemp.java | ApplicationTemp.getDir | public File getDir() {
if (this.dir == null) {
synchronized (this) {
byte[] hash = generateHash(this.sourceClass);
this.dir = new File(getTempDirectory(), toHexString(hash));
this.dir.mkdirs();
Assert.state(this.dir.exists(),
() -> "Unable to create temp directory " + this.dir);
}
}
return this.dir;
} | java | public File getDir() {
if (this.dir == null) {
synchronized (this) {
byte[] hash = generateHash(this.sourceClass);
this.dir = new File(getTempDirectory(), toHexString(hash));
this.dir.mkdirs();
Assert.state(this.dir.exists(),
() -> "Unable to create temp directory " + this.dir);
}
}
return this.dir;
} | [
"public",
"File",
"getDir",
"(",
")",
"{",
"if",
"(",
"this",
".",
"dir",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"byte",
"[",
"]",
"hash",
"=",
"generateHash",
"(",
"this",
".",
"sourceClass",
")",
";",
"this",
".",
"dir",
... | Return the directory to be used for application specific temp files.
@return the application temp directory | [
"Return",
"the",
"directory",
"to",
"be",
"used",
"for",
"application",
"specific",
"temp",
"files",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/ApplicationTemp.java#L76-L87 | train | Gets the directory for the generated source class. | [
30522,
2270,
5371,
2131,
4305,
2099,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
16101,
1027,
1027,
19701,
1007,
1063,
25549,
1006,
2023,
1007,
1063,
24880,
1031,
1033,
23325,
1027,
9699,
14949,
2232,
1006,
2023,
1012,
3120,
26266,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java | TouchActions.flick | public TouchActions flick(int xSpeed, int ySpeed) {
if (touchScreen != null) {
action.addAction(new FlickAction(touchScreen, xSpeed, ySpeed));
}
return this;
} | java | public TouchActions flick(int xSpeed, int ySpeed) {
if (touchScreen != null) {
action.addAction(new FlickAction(touchScreen, xSpeed, ySpeed));
}
return this;
} | [
"public",
"TouchActions",
"flick",
"(",
"int",
"xSpeed",
",",
"int",
"ySpeed",
")",
"{",
"if",
"(",
"touchScreen",
"!=",
"null",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"FlickAction",
"(",
"touchScreen",
",",
"xSpeed",
",",
"ySpeed",
")",
")",
... | Sends a flick gesture to the current view.
@param xSpeed The horizontal speed in pixels/second
@param ySpeed The vertical speed in pixels/second
@return self | [
"Sends",
"a",
"flick",
"gesture",
"to",
"the",
"current",
"view",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java#L173-L178 | train | Adds a flick action to the TouchActions object. | [
30522,
2270,
3543,
18908,
8496,
17312,
1006,
20014,
1060,
13102,
13089,
1010,
20014,
1061,
13102,
13089,
1007,
1063,
2065,
1006,
3543,
18182,
999,
1027,
19701,
1007,
1063,
2895,
1012,
5587,
18908,
3258,
1006,
2047,
17312,
18908,
3258,
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/util/HexUtil.java | HexUtil.encodeHex | public static char[] encodeHex(String str, Charset charset) {
return encodeHex(StrUtil.bytes(str, charset), true);
} | java | public static char[] encodeHex(String str, Charset charset) {
return encodeHex(StrUtil.bytes(str, charset), true);
} | [
"public",
"static",
"char",
"[",
"]",
"encodeHex",
"(",
"String",
"str",
",",
"Charset",
"charset",
")",
"{",
"return",
"encodeHex",
"(",
"StrUtil",
".",
"bytes",
"(",
"str",
",",
"charset",
")",
",",
"true",
")",
";",
"}"
] | 将字节数组转换为十六进制字符数组
@param str 字符串
@param charset 编码
@return 十六进制char[] | [
"将字节数组转换为十六进制字符数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java#L67-L69 | train | Encode a String in hexadecimal using the specified encoding. | [
30522,
2270,
10763,
25869,
1031,
1033,
4372,
16044,
5369,
2595,
1006,
5164,
2358,
2099,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2709,
4372,
16044,
5369,
2595,
1006,
2358,
22134,
4014,
1012,
27507,
1006,
2358,
2099,
1010,
25869,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/spring/cache/CacheConfig.java | CacheConfig.fromYAML | public static Map<String, ? extends CacheConfig> fromYAML(File file) throws IOException {
return new CacheConfigSupport().fromYAML(file);
} | java | public static Map<String, ? extends CacheConfig> fromYAML(File file) throws IOException {
return new CacheConfigSupport().fromYAML(file);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"?",
"extends",
"CacheConfig",
">",
"fromYAML",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"return",
"new",
"CacheConfigSupport",
"(",
")",
".",
"fromYAML",
"(",
"file",
")",
";",
"}"
] | Read config objects stored in YAML format from <code>File</code>
@param file of config
@return config
@throws IOException error | [
"Read",
"config",
"objects",
"stored",
"in",
"YAML",
"format",
"from",
"<code",
">",
"File<",
"/",
"code",
">"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/spring/cache/CacheConfig.java#L201-L203 | train | Creates a map from a YAML file. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
1029,
8908,
17053,
8663,
8873,
2290,
1028,
2013,
14852,
2140,
1006,
5371,
5371,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
2047,
17053,
8663,
8873,
5620,
6279,
6442,
1006,
1007,
1012,
2013,
148... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/table/descriptors/Kafka.java | Kafka.property | public Kafka property(String key, String value) {
Preconditions.checkNotNull(key);
Preconditions.checkNotNull(value);
if (this.kafkaProperties == null) {
this.kafkaProperties = new HashMap<>();
}
kafkaProperties.put(key, value);
return this;
} | java | public Kafka property(String key, String value) {
Preconditions.checkNotNull(key);
Preconditions.checkNotNull(value);
if (this.kafkaProperties == null) {
this.kafkaProperties = new HashMap<>();
}
kafkaProperties.put(key, value);
return this;
} | [
"public",
"Kafka",
"property",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"key",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"value",
")",
";",
"if",
"(",
"this",
".",
"kafkaProperties",
"=="... | Adds a configuration properties for the Kafka consumer.
@param key property key for the Kafka consumer
@param value property value for the Kafka consumer | [
"Adds",
"a",
"configuration",
"properties",
"for",
"the",
"Kafka",
"consumer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/table/descriptors/Kafka.java#L113-L121 | train | Sets a Kafka property. | [
30522,
2270,
10556,
24316,
2050,
3200,
1006,
5164,
3145,
1010,
5164,
3643,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
3145,
1007,
1025,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
30524,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/codec/Base64Encoder.java | Base64Encoder.encodeUrlSafe | public static String encodeUrlSafe(String source, String charset) {
return encodeUrlSafe(StrUtil.bytes(source, charset), charset);
} | java | public static String encodeUrlSafe(String source, String charset) {
return encodeUrlSafe(StrUtil.bytes(source, charset), charset);
} | [
"public",
"static",
"String",
"encodeUrlSafe",
"(",
"String",
"source",
",",
"String",
"charset",
")",
"{",
"return",
"encodeUrlSafe",
"(",
"StrUtil",
".",
"bytes",
"(",
"source",
",",
"charset",
")",
",",
"charset",
")",
";",
"}"
] | base64编码,URL安全
@param source 被编码的base64字符串
@param charset 字符集
@return 被加密后的字符串
@since 3.0.6 | [
"base64编码",
"URL安全"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/Base64Encoder.java#L87-L89 | train | Encode a string to be encoded using URL safe encoding. | [
30522,
2270,
10763,
5164,
4372,
16044,
3126,
4877,
10354,
2063,
1006,
5164,
3120,
1010,
5164,
25869,
13462,
1007,
1063,
2709,
4372,
16044,
3126,
4877,
10354,
2063,
1006,
2358,
22134,
4014,
1012,
27507,
1006,
3120,
1010,
25869,
13462,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/recognition/nr/PersonRecognition.java | PersonRecognition.viterbiComputeSimply | public static List<NR> viterbiComputeSimply(List<EnumItem<NR>> roleTagList)
{
return Viterbi.computeEnumSimply(roleTagList, PersonDictionary.transformMatrixDictionary);
} | java | public static List<NR> viterbiComputeSimply(List<EnumItem<NR>> roleTagList)
{
return Viterbi.computeEnumSimply(roleTagList, PersonDictionary.transformMatrixDictionary);
} | [
"public",
"static",
"List",
"<",
"NR",
">",
"viterbiComputeSimply",
"(",
"List",
"<",
"EnumItem",
"<",
"NR",
">",
">",
"roleTagList",
")",
"{",
"return",
"Viterbi",
".",
"computeEnumSimply",
"(",
"roleTagList",
",",
"PersonDictionary",
".",
"transformMatrixDicti... | 简化的"维特比算法"求解最优标签
@param roleTagList
@return | [
"简化的",
"维特比算法",
"求解最优标签"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/recognition/nr/PersonRecognition.java#L135-L138 | train | Compute the viterbi formula. | [
30522,
2270,
10763,
2862,
1026,
17212,
1028,
6819,
3334,
13592,
25377,
10421,
5332,
8737,
2135,
1006,
2862,
1026,
4372,
12717,
18532,
1026,
17212,
1028,
1028,
2535,
15900,
9863,
1007,
1063,
2709,
6819,
3334,
5638,
1012,
24134,
2368,
18163,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java | ColumnVector.getBytes | public byte[] getBytes(int rowId, int count) {
byte[] res = new byte[count];
for (int i = 0; i < count; i++) {
res[i] = getByte(rowId + i);
}
return res;
} | java | public byte[] getBytes(int rowId, int count) {
byte[] res = new byte[count];
for (int i = 0; i < count; i++) {
res[i] = getByte(rowId + i);
}
return res;
} | [
"public",
"byte",
"[",
"]",
"getBytes",
"(",
"int",
"rowId",
",",
"int",
"count",
")",
"{",
"byte",
"[",
"]",
"res",
"=",
"new",
"byte",
"[",
"count",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
... | Gets byte type values from [rowId, rowId + count). The return values for the null slots
are undefined and can be anything. | [
"Gets",
"byte",
"type",
"values",
"from",
"[",
"rowId",
"rowId",
"+",
"count",
")",
".",
"The",
"return",
"values",
"for",
"the",
"null",
"slots",
"are",
"undefined",
"and",
"can",
"be",
"anything",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L110-L116 | train | Gets the bytes from the specified row. | [
30522,
2270,
24880,
1031,
1033,
2131,
3762,
4570,
1006,
20014,
5216,
3593,
1010,
20014,
4175,
1007,
1063,
24880,
1031,
1033,
24501,
1027,
2047,
24880,
1031,
4175,
1033,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
4175,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/AhoCorasick/AhoCorasickDoubleArrayTrie.java | AhoCorasickDoubleArrayTrie.get | public V get(String key)
{
int index = exactMatchSearch(key);
if (index >= 0)
{
return v[index];
}
return null;
} | java | public V get(String key)
{
int index = exactMatchSearch(key);
if (index >= 0)
{
return v[index];
}
return null;
} | [
"public",
"V",
"get",
"(",
"String",
"key",
")",
"{",
"int",
"index",
"=",
"exactMatchSearch",
"(",
"key",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"return",
"v",
"[",
"index",
"]",
";",
"}",
"return",
"null",
";",
"}"
] | 获取值
@param key 键
@return | [
"获取值"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/AhoCorasick/AhoCorasickDoubleArrayTrie.java#L285-L294 | train | Gets the value of a CIDCTYPE. | [
30522,
2270,
1058,
2131,
1006,
5164,
3145,
1007,
1063,
20014,
5950,
1027,
6635,
18900,
18069,
14644,
2818,
1006,
3145,
1007,
1025,
2065,
1006,
5950,
1028,
1027,
1014,
1007,
1063,
2709,
1058,
1031,
5950,
1033,
1025,
1065,
2709,
19701,
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/io/network/partition/consumer/InputGateMetrics.java | InputGateMetrics.refreshAndGetMax | int refreshAndGetMax() {
int max = 0;
for (InputChannel channel : inputGate.getInputChannels().values()) {
if (channel instanceof RemoteInputChannel) {
RemoteInputChannel rc = (RemoteInputChannel) channel;
int size = rc.unsynchronizedGetNumberOfQueuedBuffers();
max = Math.max(max, size);
}
}
return max;
} | java | int refreshAndGetMax() {
int max = 0;
for (InputChannel channel : inputGate.getInputChannels().values()) {
if (channel instanceof RemoteInputChannel) {
RemoteInputChannel rc = (RemoteInputChannel) channel;
int size = rc.unsynchronizedGetNumberOfQueuedBuffers();
max = Math.max(max, size);
}
}
return max;
} | [
"int",
"refreshAndGetMax",
"(",
")",
"{",
"int",
"max",
"=",
"0",
";",
"for",
"(",
"InputChannel",
"channel",
":",
"inputGate",
".",
"getInputChannels",
"(",
")",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"channel",
"instanceof",
"RemoteInputChannel",
... | Iterates over all input channels and collects the maximum number of queued buffers in a
channel in a best-effort way.
@return maximum number of queued buffers per channel | [
"Iterates",
"over",
"all",
"input",
"channels",
"and",
"collects",
"the",
"maximum",
"number",
"of",
"queued",
"buffers",
"in",
"a",
"channel",
"in",
"a",
"best",
"-",
"effort",
"way",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/InputGateMetrics.java#L97-L110 | train | Refresh the max number of queued buffers in the input gate. | [
30522,
20014,
25416,
21898,
5685,
18150,
17848,
1006,
1007,
1063,
20014,
4098,
1027,
1014,
1025,
2005,
1006,
7953,
26058,
3149,
1024,
7953,
5867,
1012,
2131,
2378,
18780,
26058,
2015,
1006,
1007,
1012,
5300,
1006,
1007,
1007,
1063,
2065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/TaskConfig.java | TaskConfig.setInputLocalStrategy | public void setInputLocalStrategy(int inputNum, LocalStrategy strategy) {
this.config.setInteger(INPUT_LOCAL_STRATEGY_PREFIX + inputNum, strategy.ordinal());
} | java | public void setInputLocalStrategy(int inputNum, LocalStrategy strategy) {
this.config.setInteger(INPUT_LOCAL_STRATEGY_PREFIX + inputNum, strategy.ordinal());
} | [
"public",
"void",
"setInputLocalStrategy",
"(",
"int",
"inputNum",
",",
"LocalStrategy",
"strategy",
")",
"{",
"this",
".",
"config",
".",
"setInteger",
"(",
"INPUT_LOCAL_STRATEGY_PREFIX",
"+",
"inputNum",
",",
"strategy",
".",
"ordinal",
"(",
")",
")",
";",
"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/TaskConfig.java#L400-L402 | train | Sets the local strategy for the specified input number. | [
30522,
2270,
11675,
2275,
2378,
18780,
4135,
9289,
20528,
2618,
6292,
1006,
20014,
7953,
19172,
1010,
10575,
6494,
2618,
6292,
5656,
1007,
1063,
2023,
1012,
9530,
8873,
2290,
1012,
2275,
18447,
26320,
1006,
7953,
1035,
2334,
1035,
5656,
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... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java | CipherSuiteConverter.toJava | static String toJava(String openSslCipherSuite, String protocol) {
Map<String, String> p2j = o2j.get(openSslCipherSuite);
if (p2j == null) {
p2j = cacheFromOpenSsl(openSslCipherSuite);
// This may happen if this method is queried when OpenSSL doesn't yet have a cipher setup. It will return
// "(NONE)" in this case.
if (p2j == null) {
return null;
}
}
String javaCipherSuite = p2j.get(protocol);
if (javaCipherSuite == null) {
String cipher = p2j.get("");
if (cipher == null) {
return null;
}
javaCipherSuite = protocol + '_' + cipher;
}
return javaCipherSuite;
} | java | static String toJava(String openSslCipherSuite, String protocol) {
Map<String, String> p2j = o2j.get(openSslCipherSuite);
if (p2j == null) {
p2j = cacheFromOpenSsl(openSslCipherSuite);
// This may happen if this method is queried when OpenSSL doesn't yet have a cipher setup. It will return
// "(NONE)" in this case.
if (p2j == null) {
return null;
}
}
String javaCipherSuite = p2j.get(protocol);
if (javaCipherSuite == null) {
String cipher = p2j.get("");
if (cipher == null) {
return null;
}
javaCipherSuite = protocol + '_' + cipher;
}
return javaCipherSuite;
} | [
"static",
"String",
"toJava",
"(",
"String",
"openSslCipherSuite",
",",
"String",
"protocol",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"p2j",
"=",
"o2j",
".",
"get",
"(",
"openSslCipherSuite",
")",
";",
"if",
"(",
"p2j",
"==",
"null",
")",
"... | Convert from OpenSSL cipher suite name convention to java cipher suite name convention.
@param openSslCipherSuite An OpenSSL cipher suite name.
@param protocol The cryptographic protocol (i.e. SSL, TLS, ...).
@return The translated cipher suite name according to java conventions. This will not be {@code null}. | [
"Convert",
"from",
"OpenSSL",
"cipher",
"suite",
"name",
"convention",
"to",
"java",
"cipher",
"suite",
"name",
"convention",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java#L282-L303 | train | Returns the Java cipher suite for the given OpenSSL cipher suite and protocol. | [
30522,
10763,
5164,
2000,
3900,
3567,
1006,
5164,
7480,
14540,
6895,
27921,
28880,
2063,
1010,
5164,
8778,
1007,
1063,
4949,
1026,
5164,
1010,
5164,
1028,
1052,
2475,
3501,
1027,
1051,
2475,
3501,
1012,
2131,
1006,
7480,
14540,
6895,
27921,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.addDeprecation | @Deprecated
public static void addDeprecation(String key, String[] newKeys) {
addDeprecation(key, newKeys, null);
} | java | @Deprecated
public static void addDeprecation(String key, String[] newKeys) {
addDeprecation(key, newKeys, null);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"addDeprecation",
"(",
"String",
"key",
",",
"String",
"[",
"]",
"newKeys",
")",
"{",
"addDeprecation",
"(",
"key",
",",
"newKeys",
",",
"null",
")",
";",
"}"
] | Adds the deprecated key to the global deprecation map when no custom
message is provided.
It does not override any existing entries in the deprecation map.
This is to be used only by the developers in order to add deprecation of
keys, and attempts to call this method after loading resources once,
would lead to <tt>UnsupportedOperationException</tt>
If a key is deprecated in favor of multiple keys, they are all treated as
aliases of each other, and setting any one of them resets all the others
to the new value.
If you have multiple deprecation entries to add, it is more efficient to
use #addDeprecations(DeprecationDelta[] deltas) instead.
@param key Key that is to be deprecated
@param newKeys list of keys that take up the values of deprecated key
@deprecated use {@link #addDeprecation(String key, String newKey)} instead | [
"Adds",
"the",
"deprecated",
"key",
"to",
"the",
"global",
"deprecation",
"map",
"when",
"no",
"custom",
"message",
"is",
"provided",
".",
"It",
"does",
"not",
"override",
"any",
"existing",
"entries",
"in",
"the",
"deprecation",
"map",
".",
"This",
"is",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L530-L533 | train | Add a deprecation message to the entity. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
11675,
5587,
3207,
28139,
10719,
1006,
5164,
3145,
1010,
5164,
1031,
1033,
2047,
14839,
2015,
1007,
1063,
5587,
3207,
28139,
10719,
1006,
3145,
1010,
2047,
14839,
2015,
1010,
19701,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java | ReUtil.replaceAll | public static String replaceAll(CharSequence str, Pattern pattern, Func1<Matcher, String> replaceFun){
if (StrUtil.isEmpty(str)) {
return StrUtil.str(str);
}
final Matcher matcher = pattern.matcher(str);
final StringBuffer buffer = new StringBuffer();
while (matcher.find()) {
try {
matcher.appendReplacement(buffer, replaceFun.call(matcher));
} catch (Exception e) {
throw new UtilException(e);
}
}
matcher.appendTail(buffer);
return buffer.toString();
} | java | public static String replaceAll(CharSequence str, Pattern pattern, Func1<Matcher, String> replaceFun){
if (StrUtil.isEmpty(str)) {
return StrUtil.str(str);
}
final Matcher matcher = pattern.matcher(str);
final StringBuffer buffer = new StringBuffer();
while (matcher.find()) {
try {
matcher.appendReplacement(buffer, replaceFun.call(matcher));
} catch (Exception e) {
throw new UtilException(e);
}
}
matcher.appendTail(buffer);
return buffer.toString();
} | [
"public",
"static",
"String",
"replaceAll",
"(",
"CharSequence",
"str",
",",
"Pattern",
"pattern",
",",
"Func1",
"<",
"Matcher",
",",
"String",
">",
"replaceFun",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isEmpty",
"(",
"str",
")",
")",
"{",
"return",
"StrUt... | 替换所有正则匹配的文本,并使用自定义函数决定如何替换
@param str 要替换的字符串
@param pattern 用于匹配的正则式
@param replaceFun 决定如何替换的函数,可能被多次调用(当有多个匹配时)
@return 替换后的字符串
@since 4.2.2 | [
"替换所有正则匹配的文本,并使用自定义函数决定如何替换"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L662-L678 | train | Replaces all occurrences of the given pattern in the given char sequence with the result of the given replaceFun. | [
30522,
2270,
10763,
5164,
5672,
8095,
1006,
25869,
3366,
4226,
5897,
2358,
2099,
1010,
5418,
5418,
1010,
4569,
2278,
2487,
1026,
2674,
2121,
1010,
5164,
1028,
5672,
11263,
2078,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
6633,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/src/main/java/com/alibaba/otter/canal/client/impl/running/ClientRunningMonitor.java | ClientRunningMonitor.initRunning | public synchronized void initRunning() {
if (!isStart()) {
return;
}
String path = ZookeeperPathUtils.getDestinationClientRunning(this.destination, clientData.getClientId());
// 序列化
byte[] bytes = JsonUtils.marshalToByte(clientData);
try {
mutex.set(false);
zkClient.create(path, bytes, CreateMode.EPHEMERAL);
processActiveEnter();// 触发一下事件
activeData = clientData;
mutex.set(true);
} catch (ZkNodeExistsException e) {
bytes = zkClient.readData(path, true);
if (bytes == null) {// 如果不存在节点,立即尝试一次
initRunning();
} else {
activeData = JsonUtils.unmarshalFromByte(bytes, ClientRunningData.class);
// 如果发现已经存在,判断一下是否自己,避免活锁
if (activeData.getAddress().contains(":") && isMine(activeData.getAddress())) {
mutex.set(true);
}
}
} catch (ZkNoNodeException e) {
zkClient.createPersistent(ZookeeperPathUtils.getClientIdNodePath(this.destination, clientData.getClientId()),
true); // 尝试创建父节点
initRunning();
} catch (Throwable t) {
logger.error(MessageFormat.format("There is an error when execute initRunning method, with destination [{0}].",
destination),
t);
// fixed issue 1220, 针对server节点不工作避免死循环
if (t instanceof ServerNotFoundException) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
// 出现任何异常尝试release
releaseRunning();
throw new CanalClientException("something goes wrong in initRunning method. ", t);
}
} | java | public synchronized void initRunning() {
if (!isStart()) {
return;
}
String path = ZookeeperPathUtils.getDestinationClientRunning(this.destination, clientData.getClientId());
// 序列化
byte[] bytes = JsonUtils.marshalToByte(clientData);
try {
mutex.set(false);
zkClient.create(path, bytes, CreateMode.EPHEMERAL);
processActiveEnter();// 触发一下事件
activeData = clientData;
mutex.set(true);
} catch (ZkNodeExistsException e) {
bytes = zkClient.readData(path, true);
if (bytes == null) {// 如果不存在节点,立即尝试一次
initRunning();
} else {
activeData = JsonUtils.unmarshalFromByte(bytes, ClientRunningData.class);
// 如果发现已经存在,判断一下是否自己,避免活锁
if (activeData.getAddress().contains(":") && isMine(activeData.getAddress())) {
mutex.set(true);
}
}
} catch (ZkNoNodeException e) {
zkClient.createPersistent(ZookeeperPathUtils.getClientIdNodePath(this.destination, clientData.getClientId()),
true); // 尝试创建父节点
initRunning();
} catch (Throwable t) {
logger.error(MessageFormat.format("There is an error when execute initRunning method, with destination [{0}].",
destination),
t);
// fixed issue 1220, 针对server节点不工作避免死循环
if (t instanceof ServerNotFoundException) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
// 出现任何异常尝试release
releaseRunning();
throw new CanalClientException("something goes wrong in initRunning method. ", t);
}
} | [
"public",
"synchronized",
"void",
"initRunning",
"(",
")",
"{",
"if",
"(",
"!",
"isStart",
"(",
")",
")",
"{",
"return",
";",
"}",
"String",
"path",
"=",
"ZookeeperPathUtils",
".",
"getDestinationClientRunning",
"(",
"this",
".",
"destination",
",",
"clientD... | 3,增加异常处理,保证出现异常时,running节点能被删除,否则会导致死锁 | [
"3",
"增加异常处理,保证出现异常时,running节点能被删除",
"否则会导致死锁"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client/src/main/java/com/alibaba/otter/canal/client/impl/running/ClientRunningMonitor.java#L112-L158 | train | initRunning - init running | [
30522,
2270,
25549,
11675,
1999,
4183,
15532,
5582,
1006,
1007,
1063,
2065,
1006,
999,
26354,
7559,
2102,
1006,
1007,
1007,
1063,
2709,
1025,
1065,
5164,
4130,
1027,
9201,
13106,
15069,
21823,
4877,
1012,
2131,
6155,
13770,
3508,
20464,
116... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/RequestedGlobalProperties.java | RequestedGlobalProperties.setCustomPartitioned | public void setCustomPartitioned(FieldSet partitionedFields, Partitioner<?> partitioner) {
if (partitionedFields == null || partitioner == null) {
throw new NullPointerException();
}
this.partitioning = PartitioningProperty.CUSTOM_PARTITIONING;
this.partitioningFields = partitionedFields;
this.ordering = null;
this.customPartitioner = partitioner;
} | java | public void setCustomPartitioned(FieldSet partitionedFields, Partitioner<?> partitioner) {
if (partitionedFields == null || partitioner == null) {
throw new NullPointerException();
}
this.partitioning = PartitioningProperty.CUSTOM_PARTITIONING;
this.partitioningFields = partitionedFields;
this.ordering = null;
this.customPartitioner = partitioner;
} | [
"public",
"void",
"setCustomPartitioned",
"(",
"FieldSet",
"partitionedFields",
",",
"Partitioner",
"<",
"?",
">",
"partitioner",
")",
"{",
"if",
"(",
"partitionedFields",
"==",
"null",
"||",
"partitioner",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerExc... | Sets these properties to request a custom partitioning with the given {@link Partitioner} instance.
If the fields are provided as {@link FieldSet}, then any permutation of the fields is a
valid partitioning, including subsets. If the fields are given as a {@link FieldList},
then only an exact partitioning on the fields matches this requested partitioning.
@param partitionedFields The key fields for the partitioning. | [
"Sets",
"these",
"properties",
"to",
"request",
"a",
"custom",
"partitioning",
"with",
"the",
"given",
"{",
"@link",
"Partitioner",
"}",
"instance",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dataproperties/RequestedGlobalProperties.java#L154-L163 | train | Sets the custom partitioning property. | [
30522,
2270,
11675,
2275,
7874,
20389,
19362,
3775,
3508,
2098,
1006,
4249,
3388,
13571,
2098,
15155,
1010,
13571,
2121,
1026,
1029,
1028,
13571,
2121,
1007,
1063,
2065,
1006,
13571,
2098,
15155,
1027,
1027,
19701,
1064,
1064,
13571,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/qrcode/QrCodeUtil.java | QrCodeUtil.encode | public static BitMatrix encode(String content, BarcodeFormat format, int width, int height) {
return encode(content, format, new QrConfig(width, height));
} | java | public static BitMatrix encode(String content, BarcodeFormat format, int width, int height) {
return encode(content, format, new QrConfig(width, height));
} | [
"public",
"static",
"BitMatrix",
"encode",
"(",
"String",
"content",
",",
"BarcodeFormat",
"format",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"return",
"encode",
"(",
"content",
",",
"format",
",",
"new",
"QrConfig",
"(",
"width",
",",
"height"... | 将文本内容编码为条形码或二维码
@param content 文本内容
@param format 格式枚举
@param width 宽度
@param height 高度
@return {@link BitMatrix} | [
"将文本内容编码为条形码或二维码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L234-L236 | train | Encodes a string into a BitMatrix. | [
30522,
2270,
10763,
2978,
18900,
17682,
4372,
16044,
1006,
5164,
4180,
1010,
3347,
16044,
14192,
4017,
4289,
1010,
20014,
9381,
1010,
20014,
4578,
1007,
1063,
2709,
4372,
16044,
1006,
4180,
1010,
4289,
1010,
2047,
1053,
29566,
2078,
8873,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/pattern/CronPattern.java | CronPattern.match | public boolean match(GregorianCalendar calendar, boolean isMatchSecond) {
final int second = calendar.get(Calendar.SECOND);
final int minute = calendar.get(Calendar.MINUTE);
final int hour = calendar.get(Calendar.HOUR_OF_DAY);
final int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
final int month = calendar.get(Calendar.MONTH) + 1;// 月份从1开始
final int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1; // 星期从0开始,0和7都表示周日
final int year = calendar.get(Calendar.YEAR);
boolean eval;
for (int i = 0; i < matcherSize; i++) {
eval = (isMatchSecond ? secondMatchers.get(i).match(second) : true) // 匹配秒(非秒匹配模式下始终返回true)
&& minuteMatchers.get(i).match(minute)// 匹配分
&& hourMatchers.get(i).match(hour)// 匹配时
&& isMatchDayOfMonth(dayOfMonthMatchers.get(i), dayOfMonth, month, calendar.isLeapYear(year))// 匹配日
&& monthMatchers.get(i).match(month) // 匹配月
&& dayOfWeekMatchers.get(i).match(dayOfWeek)// 匹配周
&& isMatch(yearMatchers, i, year);// 匹配年
if (eval) {
return true;
}
}
return false;
} | java | public boolean match(GregorianCalendar calendar, boolean isMatchSecond) {
final int second = calendar.get(Calendar.SECOND);
final int minute = calendar.get(Calendar.MINUTE);
final int hour = calendar.get(Calendar.HOUR_OF_DAY);
final int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
final int month = calendar.get(Calendar.MONTH) + 1;// 月份从1开始
final int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1; // 星期从0开始,0和7都表示周日
final int year = calendar.get(Calendar.YEAR);
boolean eval;
for (int i = 0; i < matcherSize; i++) {
eval = (isMatchSecond ? secondMatchers.get(i).match(second) : true) // 匹配秒(非秒匹配模式下始终返回true)
&& minuteMatchers.get(i).match(minute)// 匹配分
&& hourMatchers.get(i).match(hour)// 匹配时
&& isMatchDayOfMonth(dayOfMonthMatchers.get(i), dayOfMonth, month, calendar.isLeapYear(year))// 匹配日
&& monthMatchers.get(i).match(month) // 匹配月
&& dayOfWeekMatchers.get(i).match(dayOfWeek)// 匹配周
&& isMatch(yearMatchers, i, year);// 匹配年
if (eval) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"match",
"(",
"GregorianCalendar",
"calendar",
",",
"boolean",
"isMatchSecond",
")",
"{",
"final",
"int",
"second",
"=",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"SECOND",
")",
";",
"final",
"int",
"minute",
"=",
"calendar",
".",
... | 给定时间是否匹配定时任务表达式
@param calendar 时间
@param isMatchSecond 是否匹配秒
@return 如果匹配返回 <code>true</code>, 否则返回 <code>false</code> | [
"给定时间是否匹配定时任务表达式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/CronPattern.java#L157-L180 | train | Checks if the given calendar matches this calendar specification. | [
30522,
2270,
22017,
20898,
2674,
1006,
25847,
9289,
10497,
2906,
8094,
1010,
22017,
20898,
2003,
18900,
18069,
8586,
15422,
1007,
1063,
2345,
20014,
2117,
1027,
30524,
1027,
8094,
1012,
2131,
1006,
8094,
1012,
3371,
1007,
1025,
2345,
20014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSchemaCompatibility.java | TypeSerializerSchemaCompatibility.compatibleWithReconfiguredSerializer | public static <T> TypeSerializerSchemaCompatibility<T> compatibleWithReconfiguredSerializer(TypeSerializer<T> reconfiguredSerializer) {
return new TypeSerializerSchemaCompatibility<>(
Type.COMPATIBLE_WITH_RECONFIGURED_SERIALIZER,
Preconditions.checkNotNull(reconfiguredSerializer));
} | java | public static <T> TypeSerializerSchemaCompatibility<T> compatibleWithReconfiguredSerializer(TypeSerializer<T> reconfiguredSerializer) {
return new TypeSerializerSchemaCompatibility<>(
Type.COMPATIBLE_WITH_RECONFIGURED_SERIALIZER,
Preconditions.checkNotNull(reconfiguredSerializer));
} | [
"public",
"static",
"<",
"T",
">",
"TypeSerializerSchemaCompatibility",
"<",
"T",
">",
"compatibleWithReconfiguredSerializer",
"(",
"TypeSerializer",
"<",
"T",
">",
"reconfiguredSerializer",
")",
"{",
"return",
"new",
"TypeSerializerSchemaCompatibility",
"<>",
"(",
"Typ... | Returns a result that indicates a reconfigured version of the new serializer is compatible, and should be
used instead of the original new serializer.
@param reconfiguredSerializer the reconfigured version of the new serializer.
@return a result that indicates a reconfigured version of the new serializer is compatible, and should be
used instead of the original new serializer. | [
"Returns",
"a",
"result",
"that",
"indicates",
"a",
"reconfigured",
"version",
"of",
"the",
"new",
"serializer",
"is",
"compatible",
"and",
"should",
"be",
"used",
"instead",
"of",
"the",
"original",
"new",
"serializer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSchemaCompatibility.java#L108-L112 | train | Create a new instance of the type serializer schema compatibility with a reconfigured serializer. | [
30522,
2270,
10763,
1026,
1056,
1028,
4127,
11610,
28863,
22842,
22911,
25377,
10450,
8553,
1026,
1056,
1028,
11892,
24415,
2890,
8663,
8873,
27390,
2098,
8043,
4818,
17629,
1006,
4127,
11610,
28863,
1026,
1056,
1028,
28667,
2239,
8873,
27390... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-bloomFilter/src/main/java/cn/hutool/bloomfilter/BitSetBloomFilter.java | BitSetBloomFilter.contains | @Override
public boolean contains(String str) {
int[] positions = createHashes(str, hashFunctionNumber);
for (int i : positions) {
int position = Math.abs(i % bitSetSize);
if (!bitSet.get(position)) {
return false;
}
}
return true;
} | java | @Override
public boolean contains(String str) {
int[] positions = createHashes(str, hashFunctionNumber);
for (int i : positions) {
int position = Math.abs(i % bitSetSize);
if (!bitSet.get(position)) {
return false;
}
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"contains",
"(",
"String",
"str",
")",
"{",
"int",
"[",
"]",
"positions",
"=",
"createHashes",
"(",
"str",
",",
"hashFunctionNumber",
")",
";",
"for",
"(",
"int",
"i",
":",
"positions",
")",
"{",
"int",
"position",
... | 判定是否包含指定字符串
@param str 字符串
@return 是否包含,存在误差 | [
"判定是否包含指定字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-bloomFilter/src/main/java/cn/hutool/bloomfilter/BitSetBloomFilter.java#L79-L89 | train | Returns true if the specified string is contained in the set. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
3397,
1006,
5164,
2358,
2099,
1007,
1063,
20014,
1031,
1033,
4460,
1027,
3443,
14949,
15689,
1006,
2358,
2099,
1010,
23325,
11263,
27989,
19172,
5677,
1007,
1025,
2005,
1006,
20014,
1045,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/io/SimpleVersionedSerialization.java | SimpleVersionedSerialization.readVersionAndDeSerialize | public static <T> T readVersionAndDeSerialize(SimpleVersionedSerializer<T> serializer, DataInputView in) throws IOException {
checkNotNull(serializer, "serializer");
checkNotNull(in, "in");
final int version = in.readInt();
final int length = in.readInt();
final byte[] data = new byte[length];
in.readFully(data);
return serializer.deserialize(version, data);
} | java | public static <T> T readVersionAndDeSerialize(SimpleVersionedSerializer<T> serializer, DataInputView in) throws IOException {
checkNotNull(serializer, "serializer");
checkNotNull(in, "in");
final int version = in.readInt();
final int length = in.readInt();
final byte[] data = new byte[length];
in.readFully(data);
return serializer.deserialize(version, data);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"readVersionAndDeSerialize",
"(",
"SimpleVersionedSerializer",
"<",
"T",
">",
"serializer",
",",
"DataInputView",
"in",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"serializer",
",",
"\"serializer\"",
")",
";",
... | Deserializes the version and datum from a stream.
<p>This method deserializes data serialized via
{@link #writeVersionAndSerialize(SimpleVersionedSerializer, Object, DataOutputView)}.
<p>The first four bytes will be interpreted as the version. The next four bytes will be
interpreted as the length of the datum bytes, then length-many bytes will be read.
Finally, the datum is deserialized via the {@link SimpleVersionedSerializer#deserialize(int, byte[])}
method.
@param serializer The serializer to serialize the datum with.
@param in The stream to deserialize from. | [
"Deserializes",
"the",
"version",
"and",
"datum",
"from",
"a",
"stream",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/io/SimpleVersionedSerialization.java#L78-L88 | train | Reads the version and de - serialize. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
3191,
27774,
5685,
6155,
11610,
3669,
4371,
1006,
3722,
27774,
2098,
8043,
4818,
17629,
1026,
1056,
1028,
7642,
17629,
1010,
2951,
2378,
18780,
8584,
1999,
1007,
11618,
22834,
10288,
24422,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dml/PredicateUtils.java | PredicateUtils.createInCondition | public static Optional<Condition> createInCondition(final PredicateInRightValue inRightValue, final Column column) {
List<SQLExpression> sqlExpressions = new LinkedList<>();
for (ExpressionSegment each : inRightValue.getSqlExpressions()) {
if (!(each instanceof SimpleExpressionSegment)) {
sqlExpressions.clear();
break;
} else {
sqlExpressions.add(((SimpleExpressionSegment) each).getSQLExpression());
}
}
return sqlExpressions.isEmpty() ? Optional.<Condition>absent() : Optional.of(new Condition(column, sqlExpressions));
} | java | public static Optional<Condition> createInCondition(final PredicateInRightValue inRightValue, final Column column) {
List<SQLExpression> sqlExpressions = new LinkedList<>();
for (ExpressionSegment each : inRightValue.getSqlExpressions()) {
if (!(each instanceof SimpleExpressionSegment)) {
sqlExpressions.clear();
break;
} else {
sqlExpressions.add(((SimpleExpressionSegment) each).getSQLExpression());
}
}
return sqlExpressions.isEmpty() ? Optional.<Condition>absent() : Optional.of(new Condition(column, sqlExpressions));
} | [
"public",
"static",
"Optional",
"<",
"Condition",
">",
"createInCondition",
"(",
"final",
"PredicateInRightValue",
"inRightValue",
",",
"final",
"Column",
"column",
")",
"{",
"List",
"<",
"SQLExpression",
">",
"sqlExpressions",
"=",
"new",
"LinkedList",
"<>",
"(",... | Create condition of IN operator.
@param inRightValue right value of IN operator
@param column column
@return condition | [
"Create",
"condition",
"of",
"IN",
"operator",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dml/PredicateUtils.java#L112-L123 | train | Create in condition Optional. | [
30522,
2270,
10763,
11887,
1026,
4650,
1028,
3443,
2378,
8663,
20562,
1006,
2345,
3653,
16467,
2378,
15950,
10175,
5657,
1999,
15950,
10175,
5657,
1010,
2345,
5930,
5930,
1007,
1063,
2862,
1026,
29296,
10288,
20110,
3258,
1028,
29296,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java | MiniCluster.shutDownResourceManagerComponents | @GuardedBy("lock")
private CompletableFuture<Void> shutDownResourceManagerComponents() {
final Collection<CompletableFuture<Void>> terminationFutures = new ArrayList<>(dispatcherResourceManagerComponents.size());
for (DispatcherResourceManagerComponent<?> dispatcherResourceManagerComponent : dispatcherResourceManagerComponents) {
terminationFutures.add(dispatcherResourceManagerComponent.closeAsync());
}
final FutureUtils.ConjunctFuture<Void> dispatcherTerminationFuture = FutureUtils.completeAll(terminationFutures);
return FutureUtils.runAfterwards(
dispatcherTerminationFuture,
() -> {
Exception exception = null;
synchronized (lock) {
if (resourceManagerLeaderRetriever != null) {
try {
resourceManagerLeaderRetriever.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
resourceManagerLeaderRetriever = null;
}
if (dispatcherLeaderRetriever != null) {
try {
dispatcherLeaderRetriever.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
dispatcherLeaderRetriever = null;
}
if (webMonitorLeaderRetrievalService != null) {
try {
webMonitorLeaderRetrievalService.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
webMonitorLeaderRetrievalService = null;
}
}
if (exception != null) {
throw exception;
}
});
} | java | @GuardedBy("lock")
private CompletableFuture<Void> shutDownResourceManagerComponents() {
final Collection<CompletableFuture<Void>> terminationFutures = new ArrayList<>(dispatcherResourceManagerComponents.size());
for (DispatcherResourceManagerComponent<?> dispatcherResourceManagerComponent : dispatcherResourceManagerComponents) {
terminationFutures.add(dispatcherResourceManagerComponent.closeAsync());
}
final FutureUtils.ConjunctFuture<Void> dispatcherTerminationFuture = FutureUtils.completeAll(terminationFutures);
return FutureUtils.runAfterwards(
dispatcherTerminationFuture,
() -> {
Exception exception = null;
synchronized (lock) {
if (resourceManagerLeaderRetriever != null) {
try {
resourceManagerLeaderRetriever.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
resourceManagerLeaderRetriever = null;
}
if (dispatcherLeaderRetriever != null) {
try {
dispatcherLeaderRetriever.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
dispatcherLeaderRetriever = null;
}
if (webMonitorLeaderRetrievalService != null) {
try {
webMonitorLeaderRetrievalService.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
webMonitorLeaderRetrievalService = null;
}
}
if (exception != null) {
throw exception;
}
});
} | [
"@",
"GuardedBy",
"(",
"\"lock\"",
")",
"private",
"CompletableFuture",
"<",
"Void",
">",
"shutDownResourceManagerComponents",
"(",
")",
"{",
"final",
"Collection",
"<",
"CompletableFuture",
"<",
"Void",
">",
">",
"terminationFutures",
"=",
"new",
"ArrayList",
"<>... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java#L739-L791 | train | Shuts down all the resource manager components. | [
30522,
1030,
13802,
3762,
1006,
1000,
5843,
1000,
1007,
2797,
4012,
10814,
10880,
11263,
11244,
1026,
11675,
1028,
3844,
7698,
6072,
8162,
3401,
24805,
4590,
9006,
29513,
7666,
1006,
1007,
1063,
2345,
3074,
1026,
4012,
10814,
10880,
11263,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/SQLParsingEngine.java | SQLParsingEngine.parse | public SQLStatement parse(final boolean useCache) {
Optional<SQLStatement> cachedSQLStatement = getSQLStatementFromCache(useCache);
if (cachedSQLStatement.isPresent()) {
return cachedSQLStatement.get();
}
LexerEngine lexerEngine = LexerEngineFactory.newInstance(dbType, sql);
SQLStatement result = SQLParserFactory.newInstance(dbType, shardingRule, lexerEngine, shardingTableMetaData, sql).parse();
if (useCache) {
parsingResultCache.put(sql, result);
}
return result;
} | java | public SQLStatement parse(final boolean useCache) {
Optional<SQLStatement> cachedSQLStatement = getSQLStatementFromCache(useCache);
if (cachedSQLStatement.isPresent()) {
return cachedSQLStatement.get();
}
LexerEngine lexerEngine = LexerEngineFactory.newInstance(dbType, sql);
SQLStatement result = SQLParserFactory.newInstance(dbType, shardingRule, lexerEngine, shardingTableMetaData, sql).parse();
if (useCache) {
parsingResultCache.put(sql, result);
}
return result;
} | [
"public",
"SQLStatement",
"parse",
"(",
"final",
"boolean",
"useCache",
")",
"{",
"Optional",
"<",
"SQLStatement",
">",
"cachedSQLStatement",
"=",
"getSQLStatementFromCache",
"(",
"useCache",
")",
";",
"if",
"(",
"cachedSQLStatement",
".",
"isPresent",
"(",
")",
... | Parse SQL.
@param useCache use cache or not
@return parsed SQL statement | [
"Parse",
"SQL",
"."
] | 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/SQLParsingEngine.java#L55-L66 | train | Parse the SQL statement. | [
30522,
2270,
29296,
9153,
18532,
4765,
11968,
3366,
1006,
2345,
22017,
20898,
2224,
3540,
5403,
1007,
1063,
11887,
1026,
29296,
9153,
18532,
4765,
1028,
17053,
5104,
4160,
4877,
12259,
3672,
1027,
4152,
4160,
4877,
12259,
3672,
19699,
5358,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java | Statistics.columnDistinctCount | public Statistics columnDistinctCount(String columnName, Long ndv) {
this.columnStats
.computeIfAbsent(columnName, column -> new HashMap<>())
.put(DISTINCT_COUNT, String.valueOf(ndv));
return this;
} | java | public Statistics columnDistinctCount(String columnName, Long ndv) {
this.columnStats
.computeIfAbsent(columnName, column -> new HashMap<>())
.put(DISTINCT_COUNT, String.valueOf(ndv));
return this;
} | [
"public",
"Statistics",
"columnDistinctCount",
"(",
"String",
"columnName",
",",
"Long",
"ndv",
")",
"{",
"this",
".",
"columnStats",
".",
"computeIfAbsent",
"(",
"columnName",
",",
"column",
"->",
"new",
"HashMap",
"<>",
"(",
")",
")",
".",
"put",
"(",
"D... | Sets the number of distinct values statistic for the given column. | [
"Sets",
"the",
"number",
"of",
"distinct",
"values",
"statistic",
"for",
"the",
"given",
"column",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java#L91-L96 | train | This method is used to set the distinct count of a column. | [
30522,
2270,
6747,
5930,
10521,
7629,
6593,
3597,
16671,
1006,
5164,
5930,
18442,
1010,
2146,
1050,
2094,
2615,
1007,
1063,
2023,
1012,
7753,
29336,
2015,
1012,
24134,
10128,
7875,
5054,
2102,
1006,
5930,
18442,
1010,
5930,
1011,
1028,
2047... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/StringUtil.java | StringUtil.decodeHexDump | public static byte[] decodeHexDump(CharSequence hexDump, int fromIndex, int length) {
if (length < 0 || (length & 1) != 0) {
throw new IllegalArgumentException("length: " + length);
}
if (length == 0) {
return EmptyArrays.EMPTY_BYTES;
}
byte[] bytes = new byte[length >>> 1];
for (int i = 0; i < length; i += 2) {
bytes[i >>> 1] = decodeHexByte(hexDump, fromIndex + i);
}
return bytes;
} | java | public static byte[] decodeHexDump(CharSequence hexDump, int fromIndex, int length) {
if (length < 0 || (length & 1) != 0) {
throw new IllegalArgumentException("length: " + length);
}
if (length == 0) {
return EmptyArrays.EMPTY_BYTES;
}
byte[] bytes = new byte[length >>> 1];
for (int i = 0; i < length; i += 2) {
bytes[i >>> 1] = decodeHexByte(hexDump, fromIndex + i);
}
return bytes;
} | [
"public",
"static",
"byte",
"[",
"]",
"decodeHexDump",
"(",
"CharSequence",
"hexDump",
",",
"int",
"fromIndex",
",",
"int",
"length",
")",
"{",
"if",
"(",
"length",
"<",
"0",
"||",
"(",
"length",
"&",
"1",
")",
"!=",
"0",
")",
"{",
"throw",
"new",
... | Decodes part of a string with <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a>
@param hexDump a {@link CharSequence} which contains the hex dump
@param fromIndex start of hex dump in {@code hexDump}
@param length hex string length | [
"Decodes",
"part",
"of",
"a",
"string",
"with",
"<a",
"href",
"=",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Hex_dump",
">",
"hex",
"dump<",
"/",
"a",
">"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L247-L259 | train | Decode a hex dump of a string into a byte array. | [
30522,
2270,
10763,
24880,
1031,
1033,
21933,
25383,
10288,
8566,
8737,
1006,
25869,
3366,
4226,
5897,
2002,
2595,
8566,
8737,
1010,
20014,
2013,
22254,
10288,
1010,
20014,
3091,
1007,
1063,
2065,
1006,
3091,
1026,
1014,
1064,
1064,
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... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/similarity/JaccardIndex.java | JaccardIndex.setMaximumScore | public JaccardIndex<K, VV, EV> setMaximumScore(int numerator, int denominator) {
Preconditions.checkArgument(numerator >= 0, "Maximum score numerator must be non-negative");
Preconditions.checkArgument(denominator > 0, "Maximum score denominator must be greater than zero");
Preconditions.checkArgument(numerator <= denominator, "Maximum score fraction must be less than or equal to one");
this.unboundedScores = false;
this.maximumScoreNumerator = numerator;
this.maximumScoreDenominator = denominator;
return this;
} | java | public JaccardIndex<K, VV, EV> setMaximumScore(int numerator, int denominator) {
Preconditions.checkArgument(numerator >= 0, "Maximum score numerator must be non-negative");
Preconditions.checkArgument(denominator > 0, "Maximum score denominator must be greater than zero");
Preconditions.checkArgument(numerator <= denominator, "Maximum score fraction must be less than or equal to one");
this.unboundedScores = false;
this.maximumScoreNumerator = numerator;
this.maximumScoreDenominator = denominator;
return this;
} | [
"public",
"JaccardIndex",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"setMaximumScore",
"(",
"int",
"numerator",
",",
"int",
"denominator",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"numerator",
">=",
"0",
",",
"\"Maximum score numerator must be non-negative... | Filter out Jaccard Index scores greater than the given maximum fraction.
@param numerator numerator of the maximum score
@param denominator denominator of the maximum score
@return this
@see #setMinimumScore(int, int) | [
"Filter",
"out",
"Jaccard",
"Index",
"scores",
"greater",
"than",
"the",
"given",
"maximum",
"fraction",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/similarity/JaccardIndex.java#L131-L141 | train | Sets the maximum score. | [
30522,
2270,
14855,
16665,
17080,
13629,
2595,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
2275,
17848,
28591,
9363,
2890,
1006,
20014,
16371,
5017,
8844,
1010,
20014,
7939,
20936,
27413,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/WeightRandom.java | WeightRandom.add | public WeightRandom<T> add(T obj, double weight) {
return add(new WeightObj<T>(obj, weight));
} | java | public WeightRandom<T> add(T obj, double weight) {
return add(new WeightObj<T>(obj, weight));
} | [
"public",
"WeightRandom",
"<",
"T",
">",
"add",
"(",
"T",
"obj",
",",
"double",
"weight",
")",
"{",
"return",
"add",
"(",
"new",
"WeightObj",
"<",
"T",
">",
"(",
"obj",
",",
"weight",
")",
")",
";",
"}"
] | 增加对象
@param obj 对象
@param weight 权重
@return this | [
"增加对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/WeightRandom.java#L101-L103 | train | Add a new object to the random number generator. | [
30522,
2270,
3635,
13033,
5358,
1026,
1056,
1028,
5587,
1006,
1056,
27885,
3501,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java | WebSocketServerHandshaker00.newHandshakeResponse | @Override
protected FullHttpResponse newHandshakeResponse(FullHttpRequest req, HttpHeaders headers) {
// Serve the WebSocket handshake request.
if (!req.headers().containsValue(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE, true)
|| !HttpHeaderValues.WEBSOCKET.contentEqualsIgnoreCase(req.headers().get(HttpHeaderNames.UPGRADE))) {
throw new WebSocketHandshakeException("not a WebSocket handshake request: missing upgrade");
}
// Hixie 75 does not contain these headers while Hixie 76 does
boolean isHixie76 = req.headers().contains(HttpHeaderNames.SEC_WEBSOCKET_KEY1) &&
req.headers().contains(HttpHeaderNames.SEC_WEBSOCKET_KEY2);
// Create the WebSocket handshake response.
FullHttpResponse res = new DefaultFullHttpResponse(HTTP_1_1, new HttpResponseStatus(101,
isHixie76 ? "WebSocket Protocol Handshake" : "Web Socket Protocol Handshake"));
if (headers != null) {
res.headers().add(headers);
}
res.headers().add(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET);
res.headers().add(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE);
// Fill in the headers and contents depending on handshake getMethod.
if (isHixie76) {
// New handshake getMethod with a challenge:
res.headers().add(HttpHeaderNames.SEC_WEBSOCKET_ORIGIN, req.headers().get(HttpHeaderNames.ORIGIN));
res.headers().add(HttpHeaderNames.SEC_WEBSOCKET_LOCATION, uri());
String subprotocols = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL);
if (subprotocols != null) {
String selectedSubprotocol = selectSubprotocol(subprotocols);
if (selectedSubprotocol == null) {
if (logger.isDebugEnabled()) {
logger.debug("Requested subprotocol(s) not supported: {}", subprotocols);
}
} else {
res.headers().add(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, selectedSubprotocol);
}
}
// Calculate the answer of the challenge.
String key1 = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_KEY1);
String key2 = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_KEY2);
int a = (int) (Long.parseLong(BEGINNING_DIGIT.matcher(key1).replaceAll("")) /
BEGINNING_SPACE.matcher(key1).replaceAll("").length());
int b = (int) (Long.parseLong(BEGINNING_DIGIT.matcher(key2).replaceAll("")) /
BEGINNING_SPACE.matcher(key2).replaceAll("").length());
long c = req.content().readLong();
ByteBuf input = Unpooled.wrappedBuffer(new byte[16]).setIndex(0, 0);
input.writeInt(a);
input.writeInt(b);
input.writeLong(c);
res.content().writeBytes(WebSocketUtil.md5(input.array()));
} else {
// Old Hixie 75 handshake getMethod with no challenge:
String origin = req.headers().get(HttpHeaderNames.ORIGIN);
if (origin == null) {
throw new WebSocketHandshakeException("Missing origin header, got only " + req.headers().names());
}
res.headers().add(HttpHeaderNames.WEBSOCKET_ORIGIN, origin);
res.headers().add(HttpHeaderNames.WEBSOCKET_LOCATION, uri());
String protocol = req.headers().get(HttpHeaderNames.WEBSOCKET_PROTOCOL);
if (protocol != null) {
res.headers().add(HttpHeaderNames.WEBSOCKET_PROTOCOL, selectSubprotocol(protocol));
}
}
return res;
} | java | @Override
protected FullHttpResponse newHandshakeResponse(FullHttpRequest req, HttpHeaders headers) {
// Serve the WebSocket handshake request.
if (!req.headers().containsValue(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE, true)
|| !HttpHeaderValues.WEBSOCKET.contentEqualsIgnoreCase(req.headers().get(HttpHeaderNames.UPGRADE))) {
throw new WebSocketHandshakeException("not a WebSocket handshake request: missing upgrade");
}
// Hixie 75 does not contain these headers while Hixie 76 does
boolean isHixie76 = req.headers().contains(HttpHeaderNames.SEC_WEBSOCKET_KEY1) &&
req.headers().contains(HttpHeaderNames.SEC_WEBSOCKET_KEY2);
// Create the WebSocket handshake response.
FullHttpResponse res = new DefaultFullHttpResponse(HTTP_1_1, new HttpResponseStatus(101,
isHixie76 ? "WebSocket Protocol Handshake" : "Web Socket Protocol Handshake"));
if (headers != null) {
res.headers().add(headers);
}
res.headers().add(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET);
res.headers().add(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE);
// Fill in the headers and contents depending on handshake getMethod.
if (isHixie76) {
// New handshake getMethod with a challenge:
res.headers().add(HttpHeaderNames.SEC_WEBSOCKET_ORIGIN, req.headers().get(HttpHeaderNames.ORIGIN));
res.headers().add(HttpHeaderNames.SEC_WEBSOCKET_LOCATION, uri());
String subprotocols = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL);
if (subprotocols != null) {
String selectedSubprotocol = selectSubprotocol(subprotocols);
if (selectedSubprotocol == null) {
if (logger.isDebugEnabled()) {
logger.debug("Requested subprotocol(s) not supported: {}", subprotocols);
}
} else {
res.headers().add(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, selectedSubprotocol);
}
}
// Calculate the answer of the challenge.
String key1 = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_KEY1);
String key2 = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_KEY2);
int a = (int) (Long.parseLong(BEGINNING_DIGIT.matcher(key1).replaceAll("")) /
BEGINNING_SPACE.matcher(key1).replaceAll("").length());
int b = (int) (Long.parseLong(BEGINNING_DIGIT.matcher(key2).replaceAll("")) /
BEGINNING_SPACE.matcher(key2).replaceAll("").length());
long c = req.content().readLong();
ByteBuf input = Unpooled.wrappedBuffer(new byte[16]).setIndex(0, 0);
input.writeInt(a);
input.writeInt(b);
input.writeLong(c);
res.content().writeBytes(WebSocketUtil.md5(input.array()));
} else {
// Old Hixie 75 handshake getMethod with no challenge:
String origin = req.headers().get(HttpHeaderNames.ORIGIN);
if (origin == null) {
throw new WebSocketHandshakeException("Missing origin header, got only " + req.headers().names());
}
res.headers().add(HttpHeaderNames.WEBSOCKET_ORIGIN, origin);
res.headers().add(HttpHeaderNames.WEBSOCKET_LOCATION, uri());
String protocol = req.headers().get(HttpHeaderNames.WEBSOCKET_PROTOCOL);
if (protocol != null) {
res.headers().add(HttpHeaderNames.WEBSOCKET_PROTOCOL, selectSubprotocol(protocol));
}
}
return res;
} | [
"@",
"Override",
"protected",
"FullHttpResponse",
"newHandshakeResponse",
"(",
"FullHttpRequest",
"req",
",",
"HttpHeaders",
"headers",
")",
"{",
"// Serve the WebSocket handshake request.",
"if",
"(",
"!",
"req",
".",
"headers",
"(",
")",
".",
"containsValue",
"(",
... | <p>
Handle the web socket handshake for the web socket specification <a href=
"http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-00">HyBi version 0</a> and lower. This standard
is really a rehash of <a href="http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76" >hixie-76</a> and
<a href="http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-75" >hixie-75</a>.
</p>
<p>
Browser request to the server:
</p>
<pre>
GET /demo HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Host: example.com
Origin: http://example.com
Sec-WebSocket-Protocol: chat, sample
Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5
Sec-WebSocket-Key2: 12998 5 Y3 1 .P00
^n:ds[4U
</pre>
<p>
Server response:
</p>
<pre>
HTTP/1.1 101 WebSocket Protocol Handshake
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Origin: http://example.com
Sec-WebSocket-Location: ws://example.com/demo
Sec-WebSocket-Protocol: sample
8jKS'y:G*Co,Wxa-
</pre> | [
"<p",
">",
"Handle",
"the",
"web",
"socket",
"handshake",
"for",
"the",
"web",
"socket",
"specification",
"<a",
"href",
"=",
"http",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"draft",
"-",
"ietf",
"-",
"hybi",
"-",
"thewebsocketpro... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java#L106-L175 | train | Creates a new response for a WebSocket handshake request. | [
30522,
1030,
2058,
15637,
5123,
2440,
11039,
25856,
6072,
26029,
3366,
2047,
11774,
7377,
5484,
2229,
26029,
3366,
1006,
2440,
11039,
25856,
2890,
15500,
2128,
4160,
1010,
8299,
4974,
2545,
20346,
2015,
1007,
1063,
1013,
1013,
3710,
1996,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/datrie/MutableDoubleArrayTrieInteger.java | MutableDoubleArrayTrieInteger.transferValues | public int[] transferValues(int state, int codePoint)
{
if (state < 1)
{
return EMPTY_WALK_STATE;
}
if ((state != 1) && (isEmpty(state)))
{
return EMPTY_WALK_STATE;
}
int[] ids = this.charMap.toIdList(codePoint);
if (ids.length == 0)
{
return EMPTY_WALK_STATE;
}
for (int i = 0; i < ids.length; i++)
{
int c = ids[i];
if ((getBase(state) + c < getBaseArraySize())
&& (getCheck(getBase(state) + c) == state))
{
state = getBase(state) + c;
}
else
{
return EMPTY_WALK_STATE;
}
}
if (getCheck(getBase(state) + UNUSED_CHAR_VALUE) == state)
{
int value = getLeafValue(getBase(getBase(state)
+ UNUSED_CHAR_VALUE));
return new int[]{state, value};
}
return new int[]{state, -1};
} | java | public int[] transferValues(int state, int codePoint)
{
if (state < 1)
{
return EMPTY_WALK_STATE;
}
if ((state != 1) && (isEmpty(state)))
{
return EMPTY_WALK_STATE;
}
int[] ids = this.charMap.toIdList(codePoint);
if (ids.length == 0)
{
return EMPTY_WALK_STATE;
}
for (int i = 0; i < ids.length; i++)
{
int c = ids[i];
if ((getBase(state) + c < getBaseArraySize())
&& (getCheck(getBase(state) + c) == state))
{
state = getBase(state) + c;
}
else
{
return EMPTY_WALK_STATE;
}
}
if (getCheck(getBase(state) + UNUSED_CHAR_VALUE) == state)
{
int value = getLeafValue(getBase(getBase(state)
+ UNUSED_CHAR_VALUE));
return new int[]{state, value};
}
return new int[]{state, -1};
} | [
"public",
"int",
"[",
"]",
"transferValues",
"(",
"int",
"state",
",",
"int",
"codePoint",
")",
"{",
"if",
"(",
"state",
"<",
"1",
")",
"{",
"return",
"EMPTY_WALK_STATE",
";",
"}",
"if",
"(",
"(",
"state",
"!=",
"1",
")",
"&&",
"(",
"isEmpty",
"(",... | 转移状态并输出值
@param state
@param codePoint char
@return | [
"转移状态并输出值"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/datrie/MutableDoubleArrayTrieInteger.java#L657-L692 | train | transferValues This method is used to transfer values from a state to another state. | [
30522,
2270,
20014,
1031,
1033,
4651,
10175,
15808,
1006,
20014,
2110,
1010,
20014,
3642,
8400,
1007,
1063,
2065,
1006,
2110,
1026,
1015,
1007,
1063,
2709,
4064,
1035,
3328,
1035,
2110,
1025,
1065,
2065,
1006,
1006,
2110,
999,
1027,
1015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java | SpdySessionHandler.updateInitialSendWindowSize | private void updateInitialSendWindowSize(int newInitialWindowSize) {
int deltaWindowSize = newInitialWindowSize - initialSendWindowSize;
initialSendWindowSize = newInitialWindowSize;
spdySession.updateAllSendWindowSizes(deltaWindowSize);
} | java | private void updateInitialSendWindowSize(int newInitialWindowSize) {
int deltaWindowSize = newInitialWindowSize - initialSendWindowSize;
initialSendWindowSize = newInitialWindowSize;
spdySession.updateAllSendWindowSizes(deltaWindowSize);
} | [
"private",
"void",
"updateInitialSendWindowSize",
"(",
"int",
"newInitialWindowSize",
")",
"{",
"int",
"deltaWindowSize",
"=",
"newInitialWindowSize",
"-",
"initialSendWindowSize",
";",
"initialSendWindowSize",
"=",
"newInitialWindowSize",
";",
"spdySession",
".",
"updateAl... | need to synchronize to prevent new streams from being created while updating active streams | [
"need",
"to",
"synchronize",
"to",
"prevent",
"new",
"streams",
"from",
"being",
"created",
"while",
"updating",
"active",
"streams"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java#L699-L703 | train | Update the initial send window size. | [
30522,
2797,
11675,
10651,
5498,
20925,
5054,
2094,
11101,
15568,
4697,
1006,
20014,
2047,
5498,
20925,
11101,
15568,
4697,
1007,
1063,
20014,
7160,
11101,
15568,
4697,
1027,
2047,
5498,
20925,
11101,
15568,
4697,
1011,
20381,
10497,
11101,
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-http/src/main/java/cn/hutool/http/HttpRequest.java | HttpRequest.sendRedirectIfPosible | private HttpResponse sendRedirectIfPosible() {
if (this.maxRedirectCount < 1) {
// 不重定向
return null;
}
// 手动实现重定向
if (this.httpConnection.getHttpURLConnection().getInstanceFollowRedirects()) {
int responseCode;
try {
responseCode = httpConnection.responseCode();
} catch (IOException e) {
throw new HttpException(e);
}
if (responseCode != HttpURLConnection.HTTP_OK) {
if (responseCode == HttpURLConnection.HTTP_MOVED_TEMP || responseCode == HttpURLConnection.HTTP_MOVED_PERM || responseCode == HttpURLConnection.HTTP_SEE_OTHER) {
this.url = httpConnection.header(Header.LOCATION);
if (redirectCount < this.maxRedirectCount) {
redirectCount++;
return execute();
} else {
StaticLog.warn("URL [{}] redirect count more than two !", this.url);
}
}
}
}
return null;
} | java | private HttpResponse sendRedirectIfPosible() {
if (this.maxRedirectCount < 1) {
// 不重定向
return null;
}
// 手动实现重定向
if (this.httpConnection.getHttpURLConnection().getInstanceFollowRedirects()) {
int responseCode;
try {
responseCode = httpConnection.responseCode();
} catch (IOException e) {
throw new HttpException(e);
}
if (responseCode != HttpURLConnection.HTTP_OK) {
if (responseCode == HttpURLConnection.HTTP_MOVED_TEMP || responseCode == HttpURLConnection.HTTP_MOVED_PERM || responseCode == HttpURLConnection.HTTP_SEE_OTHER) {
this.url = httpConnection.header(Header.LOCATION);
if (redirectCount < this.maxRedirectCount) {
redirectCount++;
return execute();
} else {
StaticLog.warn("URL [{}] redirect count more than two !", this.url);
}
}
}
}
return null;
} | [
"private",
"HttpResponse",
"sendRedirectIfPosible",
"(",
")",
"{",
"if",
"(",
"this",
".",
"maxRedirectCount",
"<",
"1",
")",
"{",
"// 不重定向\r",
"return",
"null",
";",
"}",
"// 手动实现重定向\r",
"if",
"(",
"this",
".",
"httpConnection",
".",
"getHttpURLConnection",
"... | 调用转发,如果需要转发返回转发结果,否则返回<code>null</code>
@return {@link HttpResponse},无转发返回 <code>null</code> | [
"调用转发,如果需要转发返回转发结果,否则返回<code",
">",
"null<",
"/",
"code",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpRequest.java#L946-L973 | train | Sends a redirect if posible. | [
30522,
2797,
8299,
6072,
26029,
3366,
4604,
5596,
7442,
6593,
10128,
6873,
19307,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
4098,
5596,
7442,
6593,
3597,
16671,
1026,
1015,
1007,
1063,
1013,
1013,
1744,
100,
1822,
100,
2709,
19701,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.convertLineSeparator | public static File convertLineSeparator(File file, Charset charset, LineSeparator lineSeparator) {
final List<String> lines = readLines(file, charset);
return FileWriter.create(file, charset).writeLines(lines, lineSeparator, false);
} | java | public static File convertLineSeparator(File file, Charset charset, LineSeparator lineSeparator) {
final List<String> lines = readLines(file, charset);
return FileWriter.create(file, charset).writeLines(lines, lineSeparator, false);
} | [
"public",
"static",
"File",
"convertLineSeparator",
"(",
"File",
"file",
",",
"Charset",
"charset",
",",
"LineSeparator",
"lineSeparator",
")",
"{",
"final",
"List",
"<",
"String",
">",
"lines",
"=",
"readLines",
"(",
"file",
",",
"charset",
")",
";",
"retur... | 转换换行符<br>
将给定文件的换行符转换为指定换行符
@param file 文件
@param charset 编码
@param lineSeparator 换行符枚举{@link LineSeparator}
@return 被修改的文件
@since 3.1.0 | [
"转换换行符<br",
">",
"将给定文件的换行符转换为指定换行符"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3243-L3246 | train | Converts the line separator from UTF - 8 to UTF - 8. | [
30522,
2270,
10763,
5371,
10463,
12735,
13699,
25879,
2953,
1006,
5371,
5371,
1010,
25869,
13462,
25869,
13462,
1010,
3210,
13699,
25879,
2953,
3210,
13699,
25879,
2953,
1007,
1063,
2345,
2862,
1026,
5164,
1028,
3210,
1027,
3191,
12735,
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... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java | ReferenceCountedOpenSslEngine.writeEncryptedData | private ByteBuf writeEncryptedData(final ByteBuffer src, int len) {
final int pos = src.position();
if (src.isDirect()) {
SSL.bioSetByteBuffer(networkBIO, bufferAddress(src) + pos, len, false);
} else {
final ByteBuf buf = alloc.directBuffer(len);
try {
final int limit = src.limit();
src.limit(pos + len);
buf.writeBytes(src);
// Restore the original position and limit because we don't want to consume from `src`.
src.position(pos);
src.limit(limit);
SSL.bioSetByteBuffer(networkBIO, memoryAddress(buf), len, false);
return buf;
} catch (Throwable cause) {
buf.release();
PlatformDependent.throwException(cause);
}
}
return null;
} | java | private ByteBuf writeEncryptedData(final ByteBuffer src, int len) {
final int pos = src.position();
if (src.isDirect()) {
SSL.bioSetByteBuffer(networkBIO, bufferAddress(src) + pos, len, false);
} else {
final ByteBuf buf = alloc.directBuffer(len);
try {
final int limit = src.limit();
src.limit(pos + len);
buf.writeBytes(src);
// Restore the original position and limit because we don't want to consume from `src`.
src.position(pos);
src.limit(limit);
SSL.bioSetByteBuffer(networkBIO, memoryAddress(buf), len, false);
return buf;
} catch (Throwable cause) {
buf.release();
PlatformDependent.throwException(cause);
}
}
return null;
} | [
"private",
"ByteBuf",
"writeEncryptedData",
"(",
"final",
"ByteBuffer",
"src",
",",
"int",
"len",
")",
"{",
"final",
"int",
"pos",
"=",
"src",
".",
"position",
"(",
")",
";",
"if",
"(",
"src",
".",
"isDirect",
"(",
")",
")",
"{",
"SSL",
".",
"bioSetB... | Write encrypted data to the OpenSSL network BIO. | [
"Write",
"encrypted",
"data",
"to",
"the",
"OpenSSL",
"network",
"BIO",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java#L539-L561 | train | Write encrypted data to the network BIO. | [
30522,
2797,
24880,
8569,
2546,
4339,
2368,
26775,
22571,
3064,
2850,
2696,
1006,
2345,
24880,
8569,
12494,
5034,
2278,
1010,
20014,
18798,
1007,
1063,
2345,
20014,
13433,
2015,
1027,
5034,
2278,
1012,
2597,
1006,
1007,
1025,
2065,
1006,
50... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/InternalJSONUtil.java | InternalJSONUtil.writeValue | protected static final Writer writeValue(Writer writer, Object value, int indentFactor, int indent, JSONConfig config) throws JSONException, IOException {
if (value == null || value instanceof JSONNull) {
writer.write(JSONNull.NULL.toString());
} else if (value instanceof JSON) {
((JSON) value).write(writer, indentFactor, indent);
} else if (value instanceof Map) {
new JSONObject((Map<?, ?>) value).write(writer, indentFactor, indent);
} else if (value instanceof Iterable || value instanceof Iterator || value.getClass().isArray()) {
new JSONArray(value).write(writer, indentFactor, indent);
} else if (value instanceof Number) {
writer.write(NumberUtil.toStr((Number) value));
} else if (value instanceof Date || value instanceof Calendar) {
final String format = (null == config) ? null : config.getDateFormat();
writer.write(formatDate(value, format));
} else if (value instanceof Boolean) {
writer.write(value.toString());
} else if (value instanceof JSONString) {
Object o;
try {
o = ((JSONString) value).toJSONString();
} catch (Exception e) {
throw new JSONException(e);
}
writer.write(o != null ? o.toString() : JSONUtil.quote(value.toString()));
} else {
JSONUtil.quote(value.toString(), writer);
}
return writer;
} | java | protected static final Writer writeValue(Writer writer, Object value, int indentFactor, int indent, JSONConfig config) throws JSONException, IOException {
if (value == null || value instanceof JSONNull) {
writer.write(JSONNull.NULL.toString());
} else if (value instanceof JSON) {
((JSON) value).write(writer, indentFactor, indent);
} else if (value instanceof Map) {
new JSONObject((Map<?, ?>) value).write(writer, indentFactor, indent);
} else if (value instanceof Iterable || value instanceof Iterator || value.getClass().isArray()) {
new JSONArray(value).write(writer, indentFactor, indent);
} else if (value instanceof Number) {
writer.write(NumberUtil.toStr((Number) value));
} else if (value instanceof Date || value instanceof Calendar) {
final String format = (null == config) ? null : config.getDateFormat();
writer.write(formatDate(value, format));
} else if (value instanceof Boolean) {
writer.write(value.toString());
} else if (value instanceof JSONString) {
Object o;
try {
o = ((JSONString) value).toJSONString();
} catch (Exception e) {
throw new JSONException(e);
}
writer.write(o != null ? o.toString() : JSONUtil.quote(value.toString()));
} else {
JSONUtil.quote(value.toString(), writer);
}
return writer;
} | [
"protected",
"static",
"final",
"Writer",
"writeValue",
"(",
"Writer",
"writer",
",",
"Object",
"value",
",",
"int",
"indentFactor",
",",
"int",
"indent",
",",
"JSONConfig",
"config",
")",
"throws",
"JSONException",
",",
"IOException",
"{",
"if",
"(",
"value",... | 写入值到Writer
@param writer Writer
@param value 值
@param indentFactor 每一级别的缩进量
@param indent 缩进空格数
@param config 配置项
@return Writer
@throws JSONException
@throws IOException | [
"写入值到Writer"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/InternalJSONUtil.java#L41-L69 | train | Write a value to a writer. | [
30522,
5123,
10763,
2345,
3213,
4339,
10175,
5657,
1006,
3213,
3213,
1010,
4874,
3643,
1010,
20014,
27427,
4765,
7011,
16761,
1010,
20014,
27427,
4765,
1010,
1046,
3385,
8663,
8873,
2290,
9530,
8873,
2290,
1007,
11618,
1046,
3385,
10288,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java | SqlDateTimeUtils.dateDiff | public static int dateDiff(long t1, long t2, TimeZone tz) {
ZoneId zoneId = tz.toZoneId();
LocalDate ld1 = Instant.ofEpochMilli(t1).atZone(zoneId).toLocalDate();
LocalDate ld2 = Instant.ofEpochMilli(t2).atZone(zoneId).toLocalDate();
return (int) ChronoUnit.DAYS.between(ld2, ld1);
} | java | public static int dateDiff(long t1, long t2, TimeZone tz) {
ZoneId zoneId = tz.toZoneId();
LocalDate ld1 = Instant.ofEpochMilli(t1).atZone(zoneId).toLocalDate();
LocalDate ld2 = Instant.ofEpochMilli(t2).atZone(zoneId).toLocalDate();
return (int) ChronoUnit.DAYS.between(ld2, ld1);
} | [
"public",
"static",
"int",
"dateDiff",
"(",
"long",
"t1",
",",
"long",
"t2",
",",
"TimeZone",
"tz",
")",
"{",
"ZoneId",
"zoneId",
"=",
"tz",
".",
"toZoneId",
"(",
")",
";",
"LocalDate",
"ld1",
"=",
"Instant",
".",
"ofEpochMilli",
"(",
"t1",
")",
".",... | NOTE:
(1). JDK relies on the operating system clock for time.
Each operating system has its own method of handling date changes such as
leap seconds(e.g. OS will slow down the clock to accommodate for this).
(2). DST(Daylight Saving Time) is a legal issue, governments changed it
over time. Some days are NOT exactly 24 hours long, it could be 23/25 hours
long on the first or last day of daylight saving time.
JDK can handle DST correctly.
TODO:
carefully written algorithm can improve the performance | [
"NOTE",
":",
"(",
"1",
")",
".",
"JDK",
"relies",
"on",
"the",
"operating",
"system",
"clock",
"for",
"time",
".",
"Each",
"operating",
"system",
"has",
"its",
"own",
"method",
"of",
"handling",
"date",
"changes",
"such",
"as",
"leap",
"seconds",
"(",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L724-L729 | train | Get the number of days between two dates. | [
30522,
2270,
10763,
20014,
6052,
13355,
1006,
2146,
1056,
2487,
1010,
2146,
1056,
2475,
1010,
2051,
15975,
1056,
2480,
1007,
1063,
4224,
3593,
4224,
3593,
1027,
1056,
2480,
1012,
2000,
15975,
3593,
1006,
1007,
1025,
2334,
13701,
25510,
2487... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.getDecimal | public final BigDecimal getDecimal(final int pos, final int precision, final int scale) {
final int intg = precision - scale;
final int frac = scale;
final int intg0 = intg / DIG_PER_INT32;
final int frac0 = frac / DIG_PER_INT32;
final int intg0x = intg - intg0 * DIG_PER_INT32;
final int frac0x = frac - frac0 * DIG_PER_INT32;
final int binSize = intg0 * SIZE_OF_INT32 + dig2bytes[intg0x] + frac0 * SIZE_OF_INT32 + dig2bytes[frac0x];
if (pos + binSize > limit || pos < 0) {
throw new IllegalArgumentException("limit excceed: " + (pos < 0 ? pos : (pos + binSize)));
}
return getDecimal0(origin + pos, intg, frac, // NL
intg0,
frac0,
intg0x,
frac0x);
} | java | public final BigDecimal getDecimal(final int pos, final int precision, final int scale) {
final int intg = precision - scale;
final int frac = scale;
final int intg0 = intg / DIG_PER_INT32;
final int frac0 = frac / DIG_PER_INT32;
final int intg0x = intg - intg0 * DIG_PER_INT32;
final int frac0x = frac - frac0 * DIG_PER_INT32;
final int binSize = intg0 * SIZE_OF_INT32 + dig2bytes[intg0x] + frac0 * SIZE_OF_INT32 + dig2bytes[frac0x];
if (pos + binSize > limit || pos < 0) {
throw new IllegalArgumentException("limit excceed: " + (pos < 0 ? pos : (pos + binSize)));
}
return getDecimal0(origin + pos, intg, frac, // NL
intg0,
frac0,
intg0x,
frac0x);
} | [
"public",
"final",
"BigDecimal",
"getDecimal",
"(",
"final",
"int",
"pos",
",",
"final",
"int",
"precision",
",",
"final",
"int",
"scale",
")",
"{",
"final",
"int",
"intg",
"=",
"precision",
"-",
"scale",
";",
"final",
"int",
"frac",
"=",
"scale",
";",
... | Return big decimal from buffer.
@see mysql-5.1.60/strings/decimal.c - bin2decimal() | [
"Return",
"big",
"decimal",
"from",
"buffer",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L1229-L1246 | train | Gets the decimal value of a single entry in a binary format. | [
30522,
2270,
2345,
2502,
3207,
6895,
9067,
2131,
3207,
6895,
9067,
1006,
2345,
20014,
13433,
2015,
1010,
2345,
20014,
11718,
1010,
2345,
20014,
4094,
1007,
1063,
2345,
20014,
20014,
2290,
1027,
11718,
1011,
4094,
1025,
2345,
20014,
25312,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java | PackagedProgram.getAllLibraries | public List<URL> getAllLibraries() {
List<URL> libs = new ArrayList<URL>(this.extractedTempLibraries.size() + 1);
if (jarFile != null) {
libs.add(jarFile);
}
for (File tmpLib : this.extractedTempLibraries) {
try {
libs.add(tmpLib.getAbsoluteFile().toURI().toURL());
}
catch (MalformedURLException e) {
throw new RuntimeException("URL is invalid. This should not happen.", e);
}
}
return libs;
} | java | public List<URL> getAllLibraries() {
List<URL> libs = new ArrayList<URL>(this.extractedTempLibraries.size() + 1);
if (jarFile != null) {
libs.add(jarFile);
}
for (File tmpLib : this.extractedTempLibraries) {
try {
libs.add(tmpLib.getAbsoluteFile().toURI().toURL());
}
catch (MalformedURLException e) {
throw new RuntimeException("URL is invalid. This should not happen.", e);
}
}
return libs;
} | [
"public",
"List",
"<",
"URL",
">",
"getAllLibraries",
"(",
")",
"{",
"List",
"<",
"URL",
">",
"libs",
"=",
"new",
"ArrayList",
"<",
"URL",
">",
"(",
"this",
".",
"extractedTempLibraries",
".",
"size",
"(",
")",
"+",
"1",
")",
";",
"if",
"(",
"jarFi... | Returns all provided libraries needed to run the program. | [
"Returns",
"all",
"provided",
"libraries",
"needed",
"to",
"run",
"the",
"program",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java#L448-L464 | train | Returns a list of all the libraries that are extracted from the jar file. | [
30522,
2270,
2862,
1026,
24471,
2140,
1028,
2131,
8095,
29521,
19848,
3111,
1006,
1007,
1063,
2862,
1026,
24471,
2140,
1028,
5622,
5910,
1027,
2047,
9140,
9863,
1026,
24471,
2140,
1028,
1006,
2023,
1012,
15901,
18532,
24759,
12322,
19848,
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-setting/src/main/java/cn/hutool/setting/AbsSetting.java | AbsSetting.getBool | public Boolean getBool(String key, String group) {
return getBool(key, group, null);
} | java | public Boolean getBool(String key, String group) {
return getBool(key, group, null);
} | [
"public",
"Boolean",
"getBool",
"(",
"String",
"key",
",",
"String",
"group",
")",
"{",
"return",
"getBool",
"(",
"key",
",",
"group",
",",
"null",
")",
";",
"}"
] | 获取波尔型属性值
@param key 属性名
@param group 分组名
@return 属性值 | [
"获取波尔型属性值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java#L176-L178 | train | Returns the Boolean value for the given key in the specified group. | [
30522,
2270,
22017,
20898,
2131,
5092,
4747,
1006,
5164,
3145,
1010,
5164,
2177,
1007,
1063,
2709,
2131,
5092,
4747,
1006,
3145,
1010,
2177,
1010,
19701,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.isPrimitiveWrapper | public static boolean isPrimitiveWrapper(Class<?> clazz) {
if (null == clazz) {
return false;
}
return BasicType.wrapperPrimitiveMap.containsKey(clazz);
} | java | public static boolean isPrimitiveWrapper(Class<?> clazz) {
if (null == clazz) {
return false;
}
return BasicType.wrapperPrimitiveMap.containsKey(clazz);
} | [
"public",
"static",
"boolean",
"isPrimitiveWrapper",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"if",
"(",
"null",
"==",
"clazz",
")",
"{",
"return",
"false",
";",
"}",
"return",
"BasicType",
".",
"wrapperPrimitiveMap",
".",
"containsKey",
"(",
"clazz... | 是否为包装类型
@param clazz 类
@return 是否为包装类型 | [
"是否为包装类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L706-L711 | train | Checks if the given class is a primitive wrapper class. | [
30522,
2270,
10763,
22017,
20898,
2003,
18098,
27605,
6024,
13088,
29098,
2121,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
18856,
10936,
2480,
1007,
1063,
2709,
6270,
1025,
1065,
2709,
3937,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/HttpURL.java | HttpURL.getLastPathSegment | public String getLastPathSegment() {
if (StringUtils.isBlank(path)) {
return StringUtils.EMPTY;
}
String segment = path;
segment = StringUtils.substringAfterLast(segment, "/");
return segment;
} | java | public String getLastPathSegment() {
if (StringUtils.isBlank(path)) {
return StringUtils.EMPTY;
}
String segment = path;
segment = StringUtils.substringAfterLast(segment, "/");
return segment;
} | [
"public",
"String",
"getLastPathSegment",
"(",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"path",
")",
")",
"{",
"return",
"StringUtils",
".",
"EMPTY",
";",
"}",
"String",
"segment",
"=",
"path",
";",
"segment",
"=",
"StringUtils",
".",
"su... | Gets the last URL path segment without the query string.
If there are segment to return,
an empty string will be returned instead.
@return the last URL path segment | [
"Gets",
"the",
"last",
"URL",
"path",
"segment",
"without",
"the",
"query",
"string",
".",
"If",
"there",
"are",
"segment",
"to",
"return",
"an",
"empty",
"string",
"will",
"be",
"returned",
"instead",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/HttpURL.java#L257-L264 | train | Get the last path segment of the URL. | [
30522,
2270,
5164,
2131,
8523,
25856,
8988,
3366,
21693,
4765,
1006,
1007,
1063,
2065,
1006,
5164,
21823,
4877,
1012,
2003,
28522,
8950,
1006,
4130,
1007,
1007,
1063,
2709,
5164,
21823,
4877,
1012,
4064,
1025,
1065,
5164,
6903,
1027,
4130,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ConfigurationPropertySources.java | ConfigurationPropertySources.attach | public static void attach(Environment environment) {
Assert.isInstanceOf(ConfigurableEnvironment.class, environment);
MutablePropertySources sources = ((ConfigurableEnvironment) environment)
.getPropertySources();
PropertySource<?> attached = sources.get(ATTACHED_PROPERTY_SOURCE_NAME);
if (attached != null && attached.getSource() != sources) {
sources.remove(ATTACHED_PROPERTY_SOURCE_NAME);
attached = null;
}
if (attached == null) {
sources.addFirst(new ConfigurationPropertySourcesPropertySource(
ATTACHED_PROPERTY_SOURCE_NAME,
new SpringConfigurationPropertySources(sources)));
}
} | java | public static void attach(Environment environment) {
Assert.isInstanceOf(ConfigurableEnvironment.class, environment);
MutablePropertySources sources = ((ConfigurableEnvironment) environment)
.getPropertySources();
PropertySource<?> attached = sources.get(ATTACHED_PROPERTY_SOURCE_NAME);
if (attached != null && attached.getSource() != sources) {
sources.remove(ATTACHED_PROPERTY_SOURCE_NAME);
attached = null;
}
if (attached == null) {
sources.addFirst(new ConfigurationPropertySourcesPropertySource(
ATTACHED_PROPERTY_SOURCE_NAME,
new SpringConfigurationPropertySources(sources)));
}
} | [
"public",
"static",
"void",
"attach",
"(",
"Environment",
"environment",
")",
"{",
"Assert",
".",
"isInstanceOf",
"(",
"ConfigurableEnvironment",
".",
"class",
",",
"environment",
")",
";",
"MutablePropertySources",
"sources",
"=",
"(",
"(",
"ConfigurableEnvironment... | Attach a {@link ConfigurationPropertySource} support to the specified
{@link Environment}. Adapts each {@link PropertySource} managed by the environment
to a {@link ConfigurationPropertySource} and allows classic
{@link PropertySourcesPropertyResolver} calls to resolve using
{@link ConfigurationPropertyName configuration property names}.
<p>
The attached resolver will dynamically track any additions or removals from the
underlying {@link Environment} property sources.
@param environment the source environment (must be an instance of
{@link ConfigurableEnvironment})
@see #get(Environment) | [
"Attach",
"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/ConfigurationPropertySources.java#L72-L86 | train | Attaches the configuration property sources to the environment. | [
30522,
2270,
10763,
11675,
22476,
1006,
4044,
4044,
1007,
1063,
20865,
1012,
2003,
7076,
26897,
11253,
1006,
9530,
8873,
27390,
3085,
2368,
21663,
2239,
3672,
1012,
2465,
1010,
4044,
1007,
1025,
14163,
10880,
21572,
4842,
3723,
6499,
3126,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java | TypeExtractor.getUnaryOperatorReturnType | @SuppressWarnings("unchecked")
@PublicEvolving
public static <IN, OUT> TypeInformation<OUT> getUnaryOperatorReturnType(
Function function,
Class<?> baseClass,
int inputTypeArgumentIndex,
int outputTypeArgumentIndex,
int[] lambdaOutputTypeArgumentIndices,
TypeInformation<IN> inType,
String functionName,
boolean allowMissing) {
Preconditions.checkArgument(inType == null || inputTypeArgumentIndex >= 0, "Input type argument index was not provided");
Preconditions.checkArgument(outputTypeArgumentIndex >= 0, "Output type argument index was not provided");
Preconditions.checkArgument(
lambdaOutputTypeArgumentIndices != null,
"Indices for output type arguments within lambda not provided");
// explicit result type has highest precedence
if (function instanceof ResultTypeQueryable) {
return ((ResultTypeQueryable<OUT>) function).getProducedType();
}
// perform extraction
try {
final LambdaExecutable exec;
try {
exec = checkAndExtractLambda(function);
} catch (TypeExtractionException e) {
throw new InvalidTypesException("Internal error occurred.", e);
}
if (exec != null) {
// parameters must be accessed from behind, since JVM can add additional parameters e.g. when using local variables inside lambda function
// paramLen is the total number of parameters of the provided lambda, it includes parameters added through closure
final int paramLen = exec.getParameterTypes().length;
final Method sam = TypeExtractionUtils.getSingleAbstractMethod(baseClass);
// number of parameters the SAM of implemented interface has; the parameter indexing applies to this range
final int baseParametersLen = sam.getParameterTypes().length;
final Type output;
if (lambdaOutputTypeArgumentIndices.length > 0) {
output = TypeExtractionUtils.extractTypeFromLambda(
baseClass,
exec,
lambdaOutputTypeArgumentIndices,
paramLen,
baseParametersLen);
} else {
output = exec.getReturnType();
TypeExtractionUtils.validateLambdaType(baseClass, output);
}
return new TypeExtractor().privateCreateTypeInfo(output, inType, null);
} else {
if (inType != null) {
validateInputType(baseClass, function.getClass(), inputTypeArgumentIndex, inType);
}
return new TypeExtractor().privateCreateTypeInfo(baseClass, function.getClass(), outputTypeArgumentIndex, inType, null);
}
}
catch (InvalidTypesException e) {
if (allowMissing) {
return (TypeInformation<OUT>) new MissingTypeInfo(functionName != null ? functionName : function.toString(), e);
} else {
throw e;
}
}
} | java | @SuppressWarnings("unchecked")
@PublicEvolving
public static <IN, OUT> TypeInformation<OUT> getUnaryOperatorReturnType(
Function function,
Class<?> baseClass,
int inputTypeArgumentIndex,
int outputTypeArgumentIndex,
int[] lambdaOutputTypeArgumentIndices,
TypeInformation<IN> inType,
String functionName,
boolean allowMissing) {
Preconditions.checkArgument(inType == null || inputTypeArgumentIndex >= 0, "Input type argument index was not provided");
Preconditions.checkArgument(outputTypeArgumentIndex >= 0, "Output type argument index was not provided");
Preconditions.checkArgument(
lambdaOutputTypeArgumentIndices != null,
"Indices for output type arguments within lambda not provided");
// explicit result type has highest precedence
if (function instanceof ResultTypeQueryable) {
return ((ResultTypeQueryable<OUT>) function).getProducedType();
}
// perform extraction
try {
final LambdaExecutable exec;
try {
exec = checkAndExtractLambda(function);
} catch (TypeExtractionException e) {
throw new InvalidTypesException("Internal error occurred.", e);
}
if (exec != null) {
// parameters must be accessed from behind, since JVM can add additional parameters e.g. when using local variables inside lambda function
// paramLen is the total number of parameters of the provided lambda, it includes parameters added through closure
final int paramLen = exec.getParameterTypes().length;
final Method sam = TypeExtractionUtils.getSingleAbstractMethod(baseClass);
// number of parameters the SAM of implemented interface has; the parameter indexing applies to this range
final int baseParametersLen = sam.getParameterTypes().length;
final Type output;
if (lambdaOutputTypeArgumentIndices.length > 0) {
output = TypeExtractionUtils.extractTypeFromLambda(
baseClass,
exec,
lambdaOutputTypeArgumentIndices,
paramLen,
baseParametersLen);
} else {
output = exec.getReturnType();
TypeExtractionUtils.validateLambdaType(baseClass, output);
}
return new TypeExtractor().privateCreateTypeInfo(output, inType, null);
} else {
if (inType != null) {
validateInputType(baseClass, function.getClass(), inputTypeArgumentIndex, inType);
}
return new TypeExtractor().privateCreateTypeInfo(baseClass, function.getClass(), outputTypeArgumentIndex, inType, null);
}
}
catch (InvalidTypesException e) {
if (allowMissing) {
return (TypeInformation<OUT>) new MissingTypeInfo(functionName != null ? functionName : function.toString(), e);
} else {
throw e;
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"PublicEvolving",
"public",
"static",
"<",
"IN",
",",
"OUT",
">",
"TypeInformation",
"<",
"OUT",
">",
"getUnaryOperatorReturnType",
"(",
"Function",
"function",
",",
"Class",
"<",
"?",
">",
"baseClass",
... | Returns the unary operator's return type.
<p>This method can extract a type in 4 different ways:
<p>1. By using the generics of the base class like MyFunction<X, Y, Z, IN, OUT>.
This is what outputTypeArgumentIndex (in this example "4") is good for.
<p>2. By using input type inference SubMyFunction<T, String, String, String, T>.
This is what inputTypeArgumentIndex (in this example "0") and inType is good for.
<p>3. By using the static method that a compiler generates for Java lambdas.
This is what lambdaOutputTypeArgumentIndices is good for. Given that MyFunction has
the following single abstract method:
<pre>
<code>
void apply(IN value, Collector<OUT> value)
</code>
</pre>
<p> Lambda type indices allow the extraction of a type from lambdas. To extract the
output type <b>OUT</b> from the function one should pass {@code new int[] {1, 0}}.
"1" for selecting the parameter and 0 for the first generic in this type.
Use {@code TypeExtractor.NO_INDEX} for selecting the return type of the lambda for
extraction or if the class cannot be a lambda because it is not a single abstract
method interface.
<p>4. By using interfaces such as {@link TypeInfoFactory} or {@link ResultTypeQueryable}.
<p>See also comments in the header of this class.
@param function Function to extract the return type from
@param baseClass Base class of the function
@param inputTypeArgumentIndex Index of input generic type in the base class specification (ignored if inType is null)
@param outputTypeArgumentIndex Index of output generic type in the base class specification
@param lambdaOutputTypeArgumentIndices Table of indices of the type argument specifying the input type. See example.
@param inType Type of the input elements (In case of an iterable, it is the element type) or null
@param functionName Function name
@param allowMissing Can the type information be missing (this generates a MissingTypeInfo for postponing an exception)
@param <IN> Input type
@param <OUT> Output type
@return TypeInformation of the return type of the function | [
"Returns",
"the",
"unary",
"operator",
"s",
"return",
"type",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L527-L597 | train | Gets the unary operator return type. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
1030,
2270,
6777,
4747,
6455,
2270,
10763,
1026,
1999,
1010,
2041,
1028,
2828,
2378,
14192,
3370,
1026,
2041,
1028,
2131,
9521,
2854,
25918,
8844,
13465,
14287... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.toStr | public static String toStr(Document doc, boolean isPretty) {
return toStr(doc, CharsetUtil.UTF_8, isPretty);
} | java | public static String toStr(Document doc, boolean isPretty) {
return toStr(doc, CharsetUtil.UTF_8, isPretty);
} | [
"public",
"static",
"String",
"toStr",
"(",
"Document",
"doc",
",",
"boolean",
"isPretty",
")",
"{",
"return",
"toStr",
"(",
"doc",
",",
"CharsetUtil",
".",
"UTF_8",
",",
"isPretty",
")",
";",
"}"
] | 将XML文档转换为String<br>
字符编码使用XML文档中的编码,获取不到则使用UTF-8
@param doc XML文档
@param isPretty 是否格式化输出
@return XML字符串
@since 3.0.9 | [
"将XML文档转换为String<br",
">",
"字符编码使用XML文档中的编码,获取不到则使用UTF",
"-",
"8"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L234-L236 | train | Converts a Document to a String. | [
30522,
2270,
10763,
5164,
2000,
3367,
2099,
1006,
6254,
9986,
1010,
22017,
20898,
2003,
28139,
15353,
1007,
1063,
2709,
2000,
3367,
2099,
1006,
9986,
1010,
25869,
13462,
21823,
2140,
1012,
21183,
2546,
1035,
1022,
1010,
2003,
28139,
15353,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/src/main/java/com/alibaba/otter/canal/client/CanalConnectors.java | CanalConnectors.newSingleConnector | public static CanalConnector newSingleConnector(SocketAddress address, String destination, String username,
String password) {
SimpleCanalConnector canalConnector = new SimpleCanalConnector(address, username, password, destination);
canalConnector.setSoTimeout(60 * 1000);
canalConnector.setIdleTimeout(60 * 60 * 1000);
return canalConnector;
} | java | public static CanalConnector newSingleConnector(SocketAddress address, String destination, String username,
String password) {
SimpleCanalConnector canalConnector = new SimpleCanalConnector(address, username, password, destination);
canalConnector.setSoTimeout(60 * 1000);
canalConnector.setIdleTimeout(60 * 60 * 1000);
return canalConnector;
} | [
"public",
"static",
"CanalConnector",
"newSingleConnector",
"(",
"SocketAddress",
"address",
",",
"String",
"destination",
",",
"String",
"username",
",",
"String",
"password",
")",
"{",
"SimpleCanalConnector",
"canalConnector",
"=",
"new",
"SimpleCanalConnector",
"(",
... | 创建单链接的客户端链接
@param address
@param destination
@param username
@param password
@return | [
"创建单链接的客户端链接"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client/src/main/java/com/alibaba/otter/canal/client/CanalConnectors.java#L29-L35 | train | Creates a new single canal connector. | [
30522,
2270,
10763,
5033,
8663,
2638,
16761,
2739,
2075,
2571,
8663,
2638,
16761,
1006,
22278,
4215,
16200,
4757,
4769,
1010,
5164,
7688,
1010,
5164,
5310,
18442,
1010,
5164,
20786,
1007,
1063,
3722,
28621,
22499,
10087,
16761,
5033,
8663,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/JSONUtil.java | JSONUtil.parseObj | public static JSONObject parseObj(Object obj, boolean ignoreNullValue, boolean isOrder) {
return new JSONObject(obj, ignoreNullValue, isOrder);
} | java | public static JSONObject parseObj(Object obj, boolean ignoreNullValue, boolean isOrder) {
return new JSONObject(obj, ignoreNullValue, isOrder);
} | [
"public",
"static",
"JSONObject",
"parseObj",
"(",
"Object",
"obj",
",",
"boolean",
"ignoreNullValue",
",",
"boolean",
"isOrder",
")",
"{",
"return",
"new",
"JSONObject",
"(",
"obj",
",",
"ignoreNullValue",
",",
"isOrder",
")",
";",
"}"
] | JSON字符串转JSONObject对象
@param obj Bean对象或者Map
@param ignoreNullValue 是否忽略空值,如果source为JSON字符串,不忽略空值
@param isOrder 是否有序
@return JSONObject
@since 4.2.2 | [
"JSON字符串转JSONObject对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L93-L95 | train | Parse a JSON object. | [
30522,
2270,
10763,
1046,
3385,
16429,
20614,
11968,
3366,
16429,
3501,
1006,
4874,
27885,
3501,
1010,
22017,
20898,
8568,
11231,
3363,
10175,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/router/Router.java | Router.route | public RouteResult<T> route(HttpMethod method, String path) {
return route(method, path, Collections.emptyMap());
} | java | public RouteResult<T> route(HttpMethod method, String path) {
return route(method, path, Collections.emptyMap());
} | [
"public",
"RouteResult",
"<",
"T",
">",
"route",
"(",
"HttpMethod",
"method",
",",
"String",
"path",
")",
"{",
"return",
"route",
"(",
"method",
",",
"path",
",",
"Collections",
".",
"emptyMap",
"(",
")",
")",
";",
"}"
] | If there's no match, returns the result with {@link #notFound(Object) notFound}
as the target if it is set, otherwise returns {@code null}. | [
"If",
"there",
"s",
"no",
"match",
"returns",
"the",
"result",
"with",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java#L218-L220 | train | Route the request to the given path. | [
30522,
2270,
2799,
6072,
11314,
1026,
1056,
1028,
2799,
1006,
8299,
11368,
6806,
2094,
4118,
1010,
5164,
4130,
1007,
1063,
2709,
2799,
1006,
4118,
1010,
4130,
1010,
6407,
1012,
4064,
2863,
2361,
1006,
1007,
1007,
1025,
1065,
102,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/Dict.java | Dict.toBeanIgnoreCase | public <T> T toBeanIgnoreCase(T bean) {
BeanUtil.fillBeanWithMapIgnoreCase(this, bean, false);
return bean;
} | java | public <T> T toBeanIgnoreCase(T bean) {
BeanUtil.fillBeanWithMapIgnoreCase(this, bean, false);
return bean;
} | [
"public",
"<",
"T",
">",
"T",
"toBeanIgnoreCase",
"(",
"T",
"bean",
")",
"{",
"BeanUtil",
".",
"fillBeanWithMapIgnoreCase",
"(",
"this",
",",
"bean",
",",
"false",
")",
";",
"return",
"bean",
";",
"}"
] | 转换为Bean对象
@param <T> Bean类型
@param bean Bean
@return Bean
@since 3.3.1 | [
"转换为Bean对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Dict.java#L105-L108 | train | Converts this object to a bean with the same name ignoring case. | [
30522,
2270,
1026,
1056,
1028,
1056,
2000,
4783,
7088,
26745,
2890,
18382,
1006,
1056,
14068,
1007,
1063,
14068,
21823,
2140,
1012,
6039,
4783,
2319,
24415,
2863,
8197,
26745,
2890,
18382,
1006,
2023,
1010,
14068,
1010,
6270,
1007,
1025,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.get | public Entity get(Entity where) throws SQLException {
return find(where.getFieldNames(), where, new EntityHandler());
} | java | public Entity get(Entity where) throws SQLException {
return find(where.getFieldNames(), where, new EntityHandler());
} | [
"public",
"Entity",
"get",
"(",
"Entity",
"where",
")",
"throws",
"SQLException",
"{",
"return",
"find",
"(",
"where",
".",
"getFieldNames",
"(",
")",
",",
"where",
",",
"new",
"EntityHandler",
"(",
")",
")",
";",
"}"
] | 根据条件实体查询单个记录,当有多条返回时,只显示查询到的第一条
@param where 条件
@return 记录
@throws SQLException SQL执行异常 | [
"根据条件实体查询单个记录,当有多条返回时,只显示查询到的第一条"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L415-L418 | train | Get an entity from the database. | [
30522,
2270,
9178,
2131,
1006,
9178,
2073,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
2424,
1006,
2073,
1012,
2131,
3790,
18442,
2015,
1006,
1007,
1010,
2073,
1010,
2047,
9178,
11774,
3917,
1006,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/DateUtil.java | DateUtil.endOfWeek | public static Calendar endOfWeek(Calendar calendar, boolean isSundayAsLastDay) {
if(isSundayAsLastDay) {
calendar.setFirstDayOfWeek(Calendar.MONDAY);
}
return ceiling(calendar, DateField.WEEK_OF_MONTH);
} | java | public static Calendar endOfWeek(Calendar calendar, boolean isSundayAsLastDay) {
if(isSundayAsLastDay) {
calendar.setFirstDayOfWeek(Calendar.MONDAY);
}
return ceiling(calendar, DateField.WEEK_OF_MONTH);
} | [
"public",
"static",
"Calendar",
"endOfWeek",
"(",
"Calendar",
"calendar",
",",
"boolean",
"isSundayAsLastDay",
")",
"{",
"if",
"(",
"isSundayAsLastDay",
")",
"{",
"calendar",
".",
"setFirstDayOfWeek",
"(",
"Calendar",
".",
"MONDAY",
")",
";",
"}",
"return",
"c... | 获取某周的结束时间
@param calendar 日期 {@link Calendar}
@param isSundayAsLastDay 是否周日做为一周的最后一天(false表示周六做为最后一天)
@return {@link Calendar}
@since 3.1.2 | [
"获取某周的结束时间"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L922-L927 | train | Returns a copy of the given calendar that ends with the last day of the week. | [
30522,
2270,
10763,
8094,
2203,
11253,
28075,
1006,
8094,
8094,
1010,
22017,
20898,
26354,
18426,
16303,
8523,
2102,
10259,
1007,
1063,
2065,
30524,
12096,
10259,
11253,
28075,
1006,
8094,
1012,
6928,
1007,
1025,
1065,
2709,
5894,
1006,
8094,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/transformations/TwoInputTransformation.java | TwoInputTransformation.setStateKeySelectors | public void setStateKeySelectors(KeySelector<IN1, ?> stateKeySelector1, KeySelector<IN2, ?> stateKeySelector2) {
this.stateKeySelector1 = stateKeySelector1;
this.stateKeySelector2 = stateKeySelector2;
} | java | public void setStateKeySelectors(KeySelector<IN1, ?> stateKeySelector1, KeySelector<IN2, ?> stateKeySelector2) {
this.stateKeySelector1 = stateKeySelector1;
this.stateKeySelector2 = stateKeySelector2;
} | [
"public",
"void",
"setStateKeySelectors",
"(",
"KeySelector",
"<",
"IN1",
",",
"?",
">",
"stateKeySelector1",
",",
"KeySelector",
"<",
"IN2",
",",
"?",
">",
"stateKeySelector2",
")",
"{",
"this",
".",
"stateKeySelector1",
"=",
"stateKeySelector1",
";",
"this",
... | Sets the {@link KeySelector KeySelectors} that must be used for partitioning keyed state of
this transformation.
@param stateKeySelector1 The {@code KeySelector} to set for the first input
@param stateKeySelector2 The {@code KeySelector} to set for the first input | [
"Sets",
"the",
"{",
"@link",
"KeySelector",
"KeySelectors",
"}",
"that",
"must",
"be",
"used",
"for",
"partitioning",
"keyed",
"state",
"of",
"this",
"transformation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/TwoInputTransformation.java#L120-L123 | train | Sets the key selectors for the state. | [
30522,
2270,
11675,
4520,
12259,
14839,
11246,
22471,
5668,
1006,
6309,
12260,
16761,
1026,
1999,
2487,
1010,
1029,
1028,
2110,
14839,
11246,
22471,
2953,
2487,
1010,
6309,
12260,
16761,
1026,
1999,
2475,
1010,
1029,
1028,
2110,
14839,
11246,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/util/EmptyIterator.java | EmptyIterator.get | public static <E> EmptyIterator<E> get() {
@SuppressWarnings("unchecked")
EmptyIterator<E> iter = (EmptyIterator<E>) INSTANCE;
return iter;
} | java | public static <E> EmptyIterator<E> get() {
@SuppressWarnings("unchecked")
EmptyIterator<E> iter = (EmptyIterator<E>) INSTANCE;
return iter;
} | [
"public",
"static",
"<",
"E",
">",
"EmptyIterator",
"<",
"E",
">",
"get",
"(",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"EmptyIterator",
"<",
"E",
">",
"iter",
"=",
"(",
"EmptyIterator",
"<",
"E",
">",
")",
"INSTANCE",
";",
"return... | Gets a singleton instance of the empty iterator.
@param <E> The type of the objects (not) returned by the iterator.
@return An instance of the iterator. | [
"Gets",
"a",
"singleton",
"instance",
"of",
"the",
"empty",
"iterator",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/EmptyIterator.java#L41-L45 | train | Get an empty iterator. | [
30522,
2270,
10763,
1026,
1041,
1028,
4064,
21646,
8844,
1026,
1041,
1028,
2131,
1006,
1007,
1063,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
4064,
21646,
8844,
1026,
1041,
1028,
2009,
2121,
1027,
1006,
4064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | info/src/main/java/com/networknt/info/ServerInfoGetHandler.java | ServerInfoGetHandler.getServerTlsFingerPrint | private String getServerTlsFingerPrint() {
String fingerPrint = null;
Map<String, Object> serverConfig = Config.getInstance().getJsonMapConfigNoCache("server");
Map<String, Object> secretConfig = Config.getInstance().getJsonMapConfigNoCache("secret");
// load keystore here based on server config and secret config
String keystoreName = (String)serverConfig.get("keystoreName");
String serverKeystorePass = (String)secretConfig.get("serverKeystorePass");
if(keystoreName != null) {
try (InputStream stream = Config.getInstance().getInputStreamFromFile(keystoreName)) {
KeyStore loadedKeystore = KeyStore.getInstance("JKS");
loadedKeystore.load(stream, serverKeystorePass.toCharArray());
X509Certificate cert = (X509Certificate)loadedKeystore.getCertificate("server");
if(cert != null) {
fingerPrint = FingerPrintUtil.getCertFingerPrint(cert);
} else {
logger.error("Unable to find the certificate with alias name as server in the keystore");
}
} catch (Exception e) {
logger.error("Unable to load server keystore ", e);
}
}
return fingerPrint;
} | java | private String getServerTlsFingerPrint() {
String fingerPrint = null;
Map<String, Object> serverConfig = Config.getInstance().getJsonMapConfigNoCache("server");
Map<String, Object> secretConfig = Config.getInstance().getJsonMapConfigNoCache("secret");
// load keystore here based on server config and secret config
String keystoreName = (String)serverConfig.get("keystoreName");
String serverKeystorePass = (String)secretConfig.get("serverKeystorePass");
if(keystoreName != null) {
try (InputStream stream = Config.getInstance().getInputStreamFromFile(keystoreName)) {
KeyStore loadedKeystore = KeyStore.getInstance("JKS");
loadedKeystore.load(stream, serverKeystorePass.toCharArray());
X509Certificate cert = (X509Certificate)loadedKeystore.getCertificate("server");
if(cert != null) {
fingerPrint = FingerPrintUtil.getCertFingerPrint(cert);
} else {
logger.error("Unable to find the certificate with alias name as server in the keystore");
}
} catch (Exception e) {
logger.error("Unable to load server keystore ", e);
}
}
return fingerPrint;
} | [
"private",
"String",
"getServerTlsFingerPrint",
"(",
")",
"{",
"String",
"fingerPrint",
"=",
"null",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"serverConfig",
"=",
"Config",
".",
"getInstance",
"(",
")",
".",
"getJsonMapConfigNoCache",
"(",
"\"server\"",
... | We can get it from server module but we don't want mutual dependency. So
get it from config and keystore directly
@return String TLS server certificate finger print | [
"We",
"can",
"get",
"it",
"from",
"server",
"module",
"but",
"we",
"don",
"t",
"want",
"mutual",
"dependency",
".",
"So",
"get",
"it",
"from",
"config",
"and",
"keystore",
"directly"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/info/src/main/java/com/networknt/info/ServerInfoGetHandler.java#L156-L178 | train | Get the server tls finger print | [
30522,
2797,
5164,
4152,
2121,
16874,
4877,
20349,
16550,
1006,
1007,
1063,
5164,
4344,
16550,
1027,
19701,
1025,
4949,
1026,
5164,
1010,
4874,
1028,
8241,
8663,
8873,
2290,
1027,
9530,
8873,
2290,
1012,
2131,
7076,
26897,
1006,
1007,
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... |
netty/netty | transport-native-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueStreamChannel.java | AbstractKQueueStreamChannel.doWriteSingle | protected int doWriteSingle(ChannelOutboundBuffer in) throws Exception {
// The outbound buffer contains only one message or it contains a file region.
Object msg = in.current();
if (msg instanceof ByteBuf) {
return writeBytes(in, (ByteBuf) msg);
} else if (msg instanceof DefaultFileRegion) {
return writeDefaultFileRegion(in, (DefaultFileRegion) msg);
} else if (msg instanceof FileRegion) {
return writeFileRegion(in, (FileRegion) msg);
} else {
// Should never reach here.
throw new Error();
}
} | java | protected int doWriteSingle(ChannelOutboundBuffer in) throws Exception {
// The outbound buffer contains only one message or it contains a file region.
Object msg = in.current();
if (msg instanceof ByteBuf) {
return writeBytes(in, (ByteBuf) msg);
} else if (msg instanceof DefaultFileRegion) {
return writeDefaultFileRegion(in, (DefaultFileRegion) msg);
} else if (msg instanceof FileRegion) {
return writeFileRegion(in, (FileRegion) msg);
} else {
// Should never reach here.
throw new Error();
}
} | [
"protected",
"int",
"doWriteSingle",
"(",
"ChannelOutboundBuffer",
"in",
")",
"throws",
"Exception",
"{",
"// The outbound buffer contains only one message or it contains a file region.",
"Object",
"msg",
"=",
"in",
".",
"current",
"(",
")",
";",
"if",
"(",
"msg",
"inst... | Attempt to write a single object.
@param in the collection which contains objects to write.
@return The value that should be decremented from the write quantum which starts at
{@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows:
<ul>
<li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content)
is encountered</li>
<li>1 - if a single call to write data was made to the OS</li>
<li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but no
data was accepted</li>
</ul>
@throws Exception If an I/O error occurs. | [
"Attempt",
"to",
"write",
"a",
"single",
"object",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueStreamChannel.java#L319-L332 | train | Write single message. | [
30522,
5123,
20014,
23268,
28884,
2075,
2571,
1006,
3149,
5833,
15494,
8569,
12494,
1999,
1007,
11618,
6453,
1063,
1013,
1013,
1996,
2041,
15494,
17698,
3397,
2069,
2028,
4471,
2030,
2009,
3397,
1037,
5371,
2555,
1012,
4874,
5796,
2290,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.substituteVars | private String substituteVars(String expr) {
if (expr == null) {
return null;
}
String eval = expr;
for(int s = 0; s < MAX_SUBST; s++) {
final int[] varBounds = findSubVariable(eval);
if (varBounds[SUB_START_IDX] == -1) {
return eval;
}
final String var = eval.substring(varBounds[SUB_START_IDX],
varBounds[SUB_END_IDX]);
String val = null;
if (!restrictSystemProps) {
try {
if (var.startsWith("env.") && 4 < var.length()) {
String v = var.substring(4);
int i = 0;
for (; i < v.length(); i++) {
char c = v.charAt(i);
if (c == ':' && i < v.length() - 1 && v.charAt(i + 1) == '-') {
val = getenv(v.substring(0, i));
if (val == null || val.length() == 0) {
val = v.substring(i + 2);
}
break;
} else if (c == '-') {
val = getenv(v.substring(0, i));
if (val == null) {
val = v.substring(i + 1);
}
break;
}
}
if (i == v.length()) {
val = getenv(v);
}
} else {
val = getProperty(var);
}
} catch (SecurityException se) {
LOG.warn("Unexpected SecurityException in Configuration", se);
}
}
if (val == null) {
val = getRaw(var);
}
if (val == null) {
return eval; // return literal ${var}: var is unbound
}
final int dollar = varBounds[SUB_START_IDX] - "${".length();
final int afterRightBrace = varBounds[SUB_END_IDX] + "}".length();
final String refVar = eval.substring(dollar, afterRightBrace);
// detect self-referential values
if (val.contains(refVar)) {
return expr; // return original expression if there is a loop
}
// substitute
eval = eval.substring(0, dollar)
+ val
+ eval.substring(afterRightBrace);
}
throw new IllegalStateException("Variable substitution depth too large: "
+ MAX_SUBST + " " + expr);
} | java | private String substituteVars(String expr) {
if (expr == null) {
return null;
}
String eval = expr;
for(int s = 0; s < MAX_SUBST; s++) {
final int[] varBounds = findSubVariable(eval);
if (varBounds[SUB_START_IDX] == -1) {
return eval;
}
final String var = eval.substring(varBounds[SUB_START_IDX],
varBounds[SUB_END_IDX]);
String val = null;
if (!restrictSystemProps) {
try {
if (var.startsWith("env.") && 4 < var.length()) {
String v = var.substring(4);
int i = 0;
for (; i < v.length(); i++) {
char c = v.charAt(i);
if (c == ':' && i < v.length() - 1 && v.charAt(i + 1) == '-') {
val = getenv(v.substring(0, i));
if (val == null || val.length() == 0) {
val = v.substring(i + 2);
}
break;
} else if (c == '-') {
val = getenv(v.substring(0, i));
if (val == null) {
val = v.substring(i + 1);
}
break;
}
}
if (i == v.length()) {
val = getenv(v);
}
} else {
val = getProperty(var);
}
} catch (SecurityException se) {
LOG.warn("Unexpected SecurityException in Configuration", se);
}
}
if (val == null) {
val = getRaw(var);
}
if (val == null) {
return eval; // return literal ${var}: var is unbound
}
final int dollar = varBounds[SUB_START_IDX] - "${".length();
final int afterRightBrace = varBounds[SUB_END_IDX] + "}".length();
final String refVar = eval.substring(dollar, afterRightBrace);
// detect self-referential values
if (val.contains(refVar)) {
return expr; // return original expression if there is a loop
}
// substitute
eval = eval.substring(0, dollar)
+ val
+ eval.substring(afterRightBrace);
}
throw new IllegalStateException("Variable substitution depth too large: "
+ MAX_SUBST + " " + expr);
} | [
"private",
"String",
"substituteVars",
"(",
"String",
"expr",
")",
"{",
"if",
"(",
"expr",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"eval",
"=",
"expr",
";",
"for",
"(",
"int",
"s",
"=",
"0",
";",
"s",
"<",
"MAX_SUBST",
";",
... | Attempts to repeatedly expand the value {@code expr} by replacing the
left-most substring of the form "${var}" in the following precedence order
<ol>
<li>by the value of the environment variable "var" if defined</li>
<li>by the value of the Java system property "var" if defined</li>
<li>by the value of the configuration key "var" if defined</li>
</ol>
If var is unbounded the current state of expansion "prefix${var}suffix" is
returned.
<p>
This function also detects self-referential substitutions, i.e.
<pre>
{@code
foo.bar = ${foo.bar}
}
</pre>
If a cycle is detected then the original expr is returned. Loops
involving multiple substitutions are not detected.
@param expr the literal value of a config key
@return null if expr is null, otherwise the value resulting from expanding
expr using the algorithm above.
@throws IllegalArgumentException when more than
{@link Configuration#MAX_SUBST} replacements are required | [
"Attempts",
"to",
"repeatedly",
"expand",
"the",
"value",
"{",
"@code",
"expr",
"}",
"by",
"replacing",
"the",
"left",
"-",
"most",
"substring",
"of",
"the",
"form",
"$",
"{",
"var",
"}",
"in",
"the",
"following",
"precedence",
"order",
"<ol",
">",
"<li"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L982-L1049 | train | Substitute variables in the given expression. | [
30522,
2797,
5164,
7681,
10755,
2015,
1006,
5164,
4654,
18098,
1007,
1063,
2065,
1006,
4654,
18098,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
5164,
9345,
2140,
1027,
4654,
18098,
1025,
2005,
1006,
20014,
1055,
1027,
1014,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java | TemplateAvailabilityProviders.getProvider | public TemplateAvailabilityProvider getProvider(String view,
ApplicationContext applicationContext) {
Assert.notNull(applicationContext, "ApplicationContext must not be null");
return getProvider(view, applicationContext.getEnvironment(),
applicationContext.getClassLoader(), applicationContext);
} | java | public TemplateAvailabilityProvider getProvider(String view,
ApplicationContext applicationContext) {
Assert.notNull(applicationContext, "ApplicationContext must not be null");
return getProvider(view, applicationContext.getEnvironment(),
applicationContext.getClassLoader(), applicationContext);
} | [
"public",
"TemplateAvailabilityProvider",
"getProvider",
"(",
"String",
"view",
",",
"ApplicationContext",
"applicationContext",
")",
"{",
"Assert",
".",
"notNull",
"(",
"applicationContext",
",",
"\"ApplicationContext must not be null\"",
")",
";",
"return",
"getProvider",... | Get the provider that can be used to render the given view.
@param view the view to render
@param applicationContext the application context
@return a {@link TemplateAvailabilityProvider} or null | [
"Get",
"the",
"provider",
"that",
"can",
"be",
"used",
"to",
"render",
"the",
"given",
"view",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/TemplateAvailabilityProviders.java#L116-L121 | train | Get the TemplateAvailabilityProvider for the given view. | [
30522,
2270,
23561,
12462,
11733,
8553,
21572,
17258,
2121,
2131,
21572,
17258,
2121,
1006,
5164,
3193,
1010,
4646,
8663,
18209,
4646,
8663,
18209,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
4646,
8663,
18209,
1010,
1000,
4646,
8663,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/WordCountTable.java | WordCountTable.main | public static void main(String[] args) throws Exception {
ExecutionEnvironment env = ExecutionEnvironment.createCollectionsEnvironment();
BatchTableEnvironment tEnv = BatchTableEnvironment.create(env);
DataSet<WC> input = env.fromElements(
new WC("Hello", 1),
new WC("Ciao", 1),
new WC("Hello", 1));
Table table = tEnv.fromDataSet(input);
Table filtered = table
.groupBy("word")
.select("word, frequency.sum as frequency")
.filter("frequency = 2");
DataSet<WC> result = tEnv.toDataSet(filtered, WC.class);
result.print();
} | java | public static void main(String[] args) throws Exception {
ExecutionEnvironment env = ExecutionEnvironment.createCollectionsEnvironment();
BatchTableEnvironment tEnv = BatchTableEnvironment.create(env);
DataSet<WC> input = env.fromElements(
new WC("Hello", 1),
new WC("Ciao", 1),
new WC("Hello", 1));
Table table = tEnv.fromDataSet(input);
Table filtered = table
.groupBy("word")
.select("word, frequency.sum as frequency")
.filter("frequency = 2");
DataSet<WC> result = tEnv.toDataSet(filtered, WC.class);
result.print();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"ExecutionEnvironment",
"env",
"=",
"ExecutionEnvironment",
".",
"createCollectionsEnvironment",
"(",
")",
";",
"BatchTableEnvironment",
"tEnv",
"=",
"BatchTableEnv... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/WordCountTable.java#L39-L58 | train | Example of the test. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
7781,
2368,
21663,
2239,
3672,
4372,
2615,
1027,
7781,
2368,
21663,
2239,
3672,
1012,
3443,
26895,
18491,
5054,
21663,
2239,
3672,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/logging/StoringLocalLogs.java | StoringLocalLogs.addEntry | @Override
public void addEntry(String logType, LogEntry entry) {
if (!logTypesToInclude.contains(logType)) {
return;
}
if (!localLogs.containsKey(logType)) {
List<LogEntry> entries = new ArrayList<>();
entries.add(entry);
localLogs.put(logType, entries);
} else {
localLogs.get(logType).add(entry);
}
} | java | @Override
public void addEntry(String logType, LogEntry entry) {
if (!logTypesToInclude.contains(logType)) {
return;
}
if (!localLogs.containsKey(logType)) {
List<LogEntry> entries = new ArrayList<>();
entries.add(entry);
localLogs.put(logType, entries);
} else {
localLogs.get(logType).add(entry);
}
} | [
"@",
"Override",
"public",
"void",
"addEntry",
"(",
"String",
"logType",
",",
"LogEntry",
"entry",
")",
"{",
"if",
"(",
"!",
"logTypesToInclude",
".",
"contains",
"(",
"logType",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"localLogs",
".",
"con... | Add a new log entry to the local storage.
@param logType the log type to store
@param entry the entry to store | [
"Add",
"a",
"new",
"log",
"entry",
"to",
"the",
"local",
"storage",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/logging/StoringLocalLogs.java#L59-L72 | train | Add a log entry to the log. | [
30522,
1030,
2058,
15637,
2270,
11675,
5587,
4765,
2854,
1006,
5164,
8833,
13874,
1010,
8833,
4765,
2854,
4443,
1007,
1063,
2065,
1006,
999,
8833,
13874,
16033,
2378,
20464,
12672,
1012,
3397,
1006,
8833,
13874,
1007,
1007,
1063,
2709,
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-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/compiler/NFAStateNameHandler.java | NFAStateNameHandler.getUniqueInternalName | public String getUniqueInternalName(String baseName) {
int counter = 0;
String candidate = baseName;
while (usedNames.contains(candidate)) {
candidate = baseName + STATE_NAME_DELIM + counter++;
}
usedNames.add(candidate);
return candidate;
} | java | public String getUniqueInternalName(String baseName) {
int counter = 0;
String candidate = baseName;
while (usedNames.contains(candidate)) {
candidate = baseName + STATE_NAME_DELIM + counter++;
}
usedNames.add(candidate);
return candidate;
} | [
"public",
"String",
"getUniqueInternalName",
"(",
"String",
"baseName",
")",
"{",
"int",
"counter",
"=",
"0",
";",
"String",
"candidate",
"=",
"baseName",
";",
"while",
"(",
"usedNames",
".",
"contains",
"(",
"candidate",
")",
")",
"{",
"candidate",
"=",
"... | Used to give a unique name to {@link org.apache.flink.cep.nfa.NFA} states
created during the translation process. The name format will be
{@code baseName:counter} , where the counter is increasing for states with
the same {@code baseName}.
@param baseName The base of the name.
@return The (unique) name that is going to be used internally for the state. | [
"Used",
"to",
"give",
"a",
"unique",
"name",
"to",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"cep",
".",
"nfa",
".",
"NFA",
"}",
"states",
"created",
"during",
"the",
"translation",
"process",
".",
"The",
"name",
"format",
"will",
"be",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/compiler/NFAStateNameHandler.java#L77-L85 | train | Returns a unique internal name for the given base name. | [
30522,
2270,
5164,
2131,
19496,
4226,
18447,
11795,
2389,
18442,
1006,
5164,
2918,
18442,
1007,
1063,
20014,
4675,
1027,
1014,
1025,
5164,
4018,
1027,
2918,
18442,
1025,
2096,
1006,
2109,
18442,
2015,
1012,
3397,
1006,
4018,
1007,
1007,
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... |
netty/netty | common/src/main/java/io/netty/util/CharsetUtil.java | CharsetUtil.encoder | public static CharsetEncoder encoder(Charset charset, CodingErrorAction codingErrorAction) {
return encoder(charset, codingErrorAction, codingErrorAction);
} | java | public static CharsetEncoder encoder(Charset charset, CodingErrorAction codingErrorAction) {
return encoder(charset, codingErrorAction, codingErrorAction);
} | [
"public",
"static",
"CharsetEncoder",
"encoder",
"(",
"Charset",
"charset",
",",
"CodingErrorAction",
"codingErrorAction",
")",
"{",
"return",
"encoder",
"(",
"charset",
",",
"codingErrorAction",
",",
"codingErrorAction",
")",
";",
"}"
] | Returns a new {@link CharsetEncoder} for the {@link Charset} with the specified error action.
@param charset The specified charset
@param codingErrorAction The encoder's action for malformed-input and unmappable-character errors
@return The encoder for the specified {@code charset} | [
"Returns",
"a",
"new",
"{",
"@link",
"CharsetEncoder",
"}",
"for",
"the",
"{",
"@link",
"Charset",
"}",
"with",
"the",
"specified",
"error",
"action",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/CharsetUtil.java#L103-L105 | train | Create a charset encoder for the given charset. | [
30522,
2270,
10763,
25869,
13462,
2368,
16044,
2099,
4372,
16044,
2099,
1006,
25869,
13462,
25869,
13462,
1010,
16861,
2121,
29165,
18908,
3258,
16861,
2121,
29165,
18908,
3258,
1007,
1063,
2709,
4372,
16044,
2099,
1006,
25869,
13462,
1010,
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/img/ImgUtil.java | ImgUtil.binary | public static void binary(ImageInputStream srcStream, ImageOutputStream destStream, String imageType) {
binary(read(srcStream), destStream, imageType);
} | java | public static void binary(ImageInputStream srcStream, ImageOutputStream destStream, String imageType) {
binary(read(srcStream), destStream, imageType);
} | [
"public",
"static",
"void",
"binary",
"(",
"ImageInputStream",
"srcStream",
",",
"ImageOutputStream",
"destStream",
",",
"String",
"imageType",
")",
"{",
"binary",
"(",
"read",
"(",
"srcStream",
")",
",",
"destStream",
",",
"imageType",
")",
";",
"}"
] | 彩色转为黑白黑白二值化图片<br>
此方法并不关闭流
@param srcStream 源图像流
@param destStream 目标图像流
@param imageType 图片格式(扩展名)
@since 4.0.5 | [
"彩色转为黑白黑白二值化图片<br",
">",
"此方法并不关闭流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L688-L690 | train | Copies the image from srcStream to destStream using binary data format. | [
30522,
2270,
10763,
11675,
12441,
1006,
3746,
2378,
18780,
21422,
5034,
6169,
25379,
1010,
3746,
5833,
18780,
21422,
4078,
3215,
25379,
1010,
5164,
3746,
13874,
1007,
1063,
12441,
1006,
3191,
1006,
5034,
6169,
25379,
1007,
1010,
4078,
3215,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestDecoder.java | HttpPostRequestDecoder.isMultipart | public static boolean isMultipart(HttpRequest request) {
if (request.headers().contains(HttpHeaderNames.CONTENT_TYPE)) {
return getMultipartDataBoundary(request.headers().get(HttpHeaderNames.CONTENT_TYPE)) != null;
} else {
return false;
}
} | java | public static boolean isMultipart(HttpRequest request) {
if (request.headers().contains(HttpHeaderNames.CONTENT_TYPE)) {
return getMultipartDataBoundary(request.headers().get(HttpHeaderNames.CONTENT_TYPE)) != null;
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"isMultipart",
"(",
"HttpRequest",
"request",
")",
"{",
"if",
"(",
"request",
".",
"headers",
"(",
")",
".",
"contains",
"(",
"HttpHeaderNames",
".",
"CONTENT_TYPE",
")",
")",
"{",
"return",
"getMultipartDataBoundary",
"(",
"requ... | Check if the given request is a multipart request
@return True if the request is a Multipart request | [
"Check",
"if",
"the",
"given",
"request",
"is",
"a",
"multipart",
"request"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestDecoder.java#L142-L148 | train | Is multipart request? | [
30522,
2270,
10763,
22017,
20898,
2003,
12274,
7096,
11514,
8445,
1006,
8299,
2890,
15500,
5227,
1007,
1063,
2065,
1006,
5227,
1012,
20346,
2015,
1006,
1007,
1012,
3397,
1006,
8299,
4974,
11795,
14074,
2015,
1012,
4180,
1035,
2828,
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-core/src/main/java/org/apache/flink/api/java/tuple/Tuple5.java | Tuple5.copy | @Override
@SuppressWarnings("unchecked")
public Tuple5<T0, T1, T2, T3, T4> copy() {
return new Tuple5<>(this.f0,
this.f1,
this.f2,
this.f3,
this.f4);
} | java | @Override
@SuppressWarnings("unchecked")
public Tuple5<T0, T1, T2, T3, T4> copy() {
return new Tuple5<>(this.f0,
this.f1,
this.f2,
this.f3,
this.f4);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Tuple5",
"<",
"T0",
",",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
">",
"copy",
"(",
")",
"{",
"return",
"new",
"Tuple5",
"<>",
"(",
"this",
".",
"f0",
",",
"this",
".",
... | Shallow tuple copy.
@return A new Tuple with the same fields as this. | [
"Shallow",
"tuple",
"copy",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple5.java#L216-L224 | train | Returns a copy of this tuple. | [
30522,
1030,
2058,
15637,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10722,
10814,
2629,
1026,
1056,
2692,
1010,
1056,
2487,
1010,
1056,
2475,
1010,
1056,
2509,
1010,
1056,
2549,
1028,
6100,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcActor.java | AkkaRpcActor.stop | private void stop(RpcEndpointTerminationResult rpcEndpointTerminationResult) {
if (rpcEndpointStopped.compareAndSet(false, true)) {
this.rpcEndpointTerminationResult = rpcEndpointTerminationResult;
getContext().stop(getSelf());
}
} | java | private void stop(RpcEndpointTerminationResult rpcEndpointTerminationResult) {
if (rpcEndpointStopped.compareAndSet(false, true)) {
this.rpcEndpointTerminationResult = rpcEndpointTerminationResult;
getContext().stop(getSelf());
}
} | [
"private",
"void",
"stop",
"(",
"RpcEndpointTerminationResult",
"rpcEndpointTerminationResult",
")",
"{",
"if",
"(",
"rpcEndpointStopped",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"this",
".",
"rpcEndpointTerminationResult",
"=",
"rpcEndpointTer... | Stop the actor immediately. | [
"Stop",
"the",
"actor",
"immediately",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcActor.java#L452-L457 | train | Stop the context. | [
30522,
2797,
11675,
2644,
1006,
1054,
15042,
10497,
8400,
3334,
22311,
3508,
6072,
11314,
1054,
15042,
10497,
8400,
3334,
22311,
3508,
6072,
11314,
1007,
1063,
2065,
1006,
1054,
15042,
10497,
26521,
14399,
5669,
1012,
12826,
29560,
3388,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.fromParallelCollection | private <OUT> DataStreamSource<OUT> fromParallelCollection(SplittableIterator<OUT> iterator, TypeInformation<OUT>
typeInfo, String operatorName) {
return addSource(new FromSplittableIteratorFunction<>(iterator), operatorName, typeInfo);
} | java | private <OUT> DataStreamSource<OUT> fromParallelCollection(SplittableIterator<OUT> iterator, TypeInformation<OUT>
typeInfo, String operatorName) {
return addSource(new FromSplittableIteratorFunction<>(iterator), operatorName, typeInfo);
} | [
"private",
"<",
"OUT",
">",
"DataStreamSource",
"<",
"OUT",
">",
"fromParallelCollection",
"(",
"SplittableIterator",
"<",
"OUT",
">",
"iterator",
",",
"TypeInformation",
"<",
"OUT",
">",
"typeInfo",
",",
"String",
"operatorName",
")",
"{",
"return",
"addSource"... | private helper for passing different names | [
"private",
"helper",
"for",
"passing",
"different",
"names"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L918-L921 | train | Creates a data stream source for a parallel collection of data. | [
30522,
2797,
1026,
2041,
1028,
2951,
21422,
6499,
3126,
3401,
1026,
2041,
1028,
2013,
28689,
6216,
22499,
6216,
7542,
1006,
3975,
10880,
21646,
8844,
1026,
2041,
1028,
2009,
6906,
4263,
1010,
2828,
2378,
14192,
3370,
1026,
2041,
1028,
2828,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.invoke | public static <T> T invoke(String className, String methodName, boolean isSingleton, Object... args) {
Class<Object> clazz = loadClass(className);
try {
final Method method = getDeclaredMethod(clazz, methodName, getClasses(args));
if (null == method) {
throw new NoSuchMethodException(StrUtil.format("No such method: [{}]", methodName));
}
if (isStatic(method)) {
return ReflectUtil.invoke(null, method, args);
} else {
return ReflectUtil.invoke(isSingleton ? Singleton.get(clazz) : clazz.newInstance(), method, args);
}
} catch (Exception e) {
throw new UtilException(e);
}
} | java | public static <T> T invoke(String className, String methodName, boolean isSingleton, Object... args) {
Class<Object> clazz = loadClass(className);
try {
final Method method = getDeclaredMethod(clazz, methodName, getClasses(args));
if (null == method) {
throw new NoSuchMethodException(StrUtil.format("No such method: [{}]", methodName));
}
if (isStatic(method)) {
return ReflectUtil.invoke(null, method, args);
} else {
return ReflectUtil.invoke(isSingleton ? Singleton.get(clazz) : clazz.newInstance(), method, args);
}
} catch (Exception e) {
throw new UtilException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"invoke",
"(",
"String",
"className",
",",
"String",
"methodName",
",",
"boolean",
"isSingleton",
",",
"Object",
"...",
"args",
")",
"{",
"Class",
"<",
"Object",
">",
"clazz",
"=",
"loadClass",
"(",
"className",
")... | 执行方法<br>
可执行Private方法,也可执行static方法<br>
执行非static方法时,必须满足对象有默认构造方法<br>
@param <T> 对象类型
@param className 类名,完整类路径
@param methodName 方法名
@param isSingleton 是否为单例对象,如果此参数为false,每次执行方法时创建一个新对象
@param args 参数,必须严格对应指定方法的参数类型和数量
@return 返回结果 | [
"执行方法<br",
">",
"可执行Private方法,也可执行static方法<br",
">",
"执行非static方法时,必须满足对象有默认构造方法<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L681-L696 | train | Invoke a method on a class. | [
30522,
2270,
10763,
1026,
30524,
1063,
2345,
4118,
4118,
1027,
2131,
3207,
20464,
12069,
22117,
11031,
7716,
1006,
18856,
10936,
2480,
1010,
4118,
18442,
1010,
2131,
26266,
2229,
1006,
12098,
5620,
1007,
1007,
1025,
2065,
1006,
19701,
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/incubator-shardingsphere | sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/MySQLCommandPacketFactory.java | MySQLCommandPacketFactory.newInstance | public static MySQLCommandPacket newInstance(final MySQLCommandPacketType commandPacketType, final MySQLPacketPayload payload) throws SQLException {
switch (commandPacketType) {
case COM_QUIT:
return new MySQLComQuitPacket();
case COM_INIT_DB:
return new MySQLComInitDbPacket(payload);
case COM_FIELD_LIST:
return new MySQLComFieldListPacket(payload);
case COM_QUERY:
return new MySQLComQueryPacket(payload);
case COM_STMT_PREPARE:
return new MySQLComStmtPreparePacket(payload);
case COM_STMT_EXECUTE:
return new MySQLComStmtExecutePacket(payload);
case COM_STMT_CLOSE:
return new MySQLComStmtClosePacket(payload);
case COM_PING:
return new MySQLComPingPacket();
default:
return new MySQLUnsupportedCommandPacket(commandPacketType);
}
} | java | public static MySQLCommandPacket newInstance(final MySQLCommandPacketType commandPacketType, final MySQLPacketPayload payload) throws SQLException {
switch (commandPacketType) {
case COM_QUIT:
return new MySQLComQuitPacket();
case COM_INIT_DB:
return new MySQLComInitDbPacket(payload);
case COM_FIELD_LIST:
return new MySQLComFieldListPacket(payload);
case COM_QUERY:
return new MySQLComQueryPacket(payload);
case COM_STMT_PREPARE:
return new MySQLComStmtPreparePacket(payload);
case COM_STMT_EXECUTE:
return new MySQLComStmtExecutePacket(payload);
case COM_STMT_CLOSE:
return new MySQLComStmtClosePacket(payload);
case COM_PING:
return new MySQLComPingPacket();
default:
return new MySQLUnsupportedCommandPacket(commandPacketType);
}
} | [
"public",
"static",
"MySQLCommandPacket",
"newInstance",
"(",
"final",
"MySQLCommandPacketType",
"commandPacketType",
",",
"final",
"MySQLPacketPayload",
"payload",
")",
"throws",
"SQLException",
"{",
"switch",
"(",
"commandPacketType",
")",
"{",
"case",
"COM_QUIT",
":"... | Create new instance of command packet.
@param commandPacketType command packet type for MySQL
@param payload packet payload for MySQL
@return command packet for MySQL
@throws SQLException SQL exception | [
"Create",
"new",
"instance",
"of",
"command",
"packet",
"."
] | 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/command/MySQLCommandPacketFactory.java#L53-L74 | train | Create a new instance of the command packet class. | [
30522,
2270,
10763,
2026,
2015,
4160,
22499,
14760,
4859,
23947,
3388,
2047,
7076,
26897,
1006,
2345,
2026,
2015,
4160,
22499,
14760,
4859,
30524,
1006,
3094,
23947,
6582,
18863,
1007,
1063,
2553,
4012,
1035,
8046,
1024,
2709,
2047,
2026,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/net/NetworkUtils.java | NetworkUtils.getIp4NonLoopbackAddressOfThisMachine | public InetAddress getIp4NonLoopbackAddressOfThisMachine() {
for (NetworkInterface iface : networkInterfaceProvider.getNetworkInterfaces()) {
final InetAddress ip4NonLoopback = iface.getIp4NonLoopBackOnly();
if (ip4NonLoopback != null) {
return ip4NonLoopback;
}
}
throw new WebDriverException("Could not find a non-loopback ip4 address for this machine");
} | java | public InetAddress getIp4NonLoopbackAddressOfThisMachine() {
for (NetworkInterface iface : networkInterfaceProvider.getNetworkInterfaces()) {
final InetAddress ip4NonLoopback = iface.getIp4NonLoopBackOnly();
if (ip4NonLoopback != null) {
return ip4NonLoopback;
}
}
throw new WebDriverException("Could not find a non-loopback ip4 address for this machine");
} | [
"public",
"InetAddress",
"getIp4NonLoopbackAddressOfThisMachine",
"(",
")",
"{",
"for",
"(",
"NetworkInterface",
"iface",
":",
"networkInterfaceProvider",
".",
"getNetworkInterfaces",
"(",
")",
")",
"{",
"final",
"InetAddress",
"ip4NonLoopback",
"=",
"iface",
".",
"ge... | Returns a non-loopback IP4 hostname of the local host.
@return A string hostName | [
"Returns",
"a",
"non",
"-",
"loopback",
"IP4",
"hostname",
"of",
"the",
"local",
"host",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/net/NetworkUtils.java#L98-L106 | train | Get the IP4 address of the non - loopback network interface that is not loopback. | [
30522,
2270,
1999,
12928,
14141,
8303,
2131,
11514,
2549,
8540,
4135,
7361,
5963,
4215,
16200,
24137,
6199,
23108,
21046,
2638,
1006,
1007,
1063,
2005,
1006,
2897,
18447,
2121,
12172,
2065,
10732,
1024,
2897,
30524,
1999,
12928,
14141,
8303,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/corpus/document/sentence/word/Word.java | Word.create | public static Word create(String param)
{
if (param == null) return null;
int cutIndex = param.lastIndexOf('/');
if (cutIndex <= 0 || cutIndex == param.length() - 1)
{
logger.warning("使用 " + param + "创建单个单词失败");
return null;
}
return new Word(param.substring(0, cutIndex), param.substring(cutIndex + 1));
} | java | public static Word create(String param)
{
if (param == null) return null;
int cutIndex = param.lastIndexOf('/');
if (cutIndex <= 0 || cutIndex == param.length() - 1)
{
logger.warning("使用 " + param + "创建单个单词失败");
return null;
}
return new Word(param.substring(0, cutIndex), param.substring(cutIndex + 1));
} | [
"public",
"static",
"Word",
"create",
"(",
"String",
"param",
")",
"{",
"if",
"(",
"param",
"==",
"null",
")",
"return",
"null",
";",
"int",
"cutIndex",
"=",
"param",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"cutIndex",
"<=",
"0",
"|... | 通过参数构造一个单词
@param param 比如 人民网/nz
@return 一个单词 | [
"通过参数构造一个单词"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/document/sentence/word/Word.java#L49-L60 | train | create a CRS word from a URL | [
30522,
2270,
10763,
2773,
3443,
1006,
5164,
11498,
2213,
1007,
1063,
2065,
1006,
11498,
2213,
1027,
1027,
19701,
1007,
2709,
19701,
1025,
20014,
3013,
22254,
10288,
1027,
11498,
2213,
1012,
2197,
22254,
10288,
11253,
1006,
1005,
1013,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/YmlConfigBinder.java | YmlConfigBinder.bindYmlToObj | public static <T> T bindYmlToObj(String content, Class<T> clazz) {
return bindYmlToObj(null, content, clazz, null);
} | java | public static <T> T bindYmlToObj(String content, Class<T> clazz) {
return bindYmlToObj(null, content, clazz, null);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"bindYmlToObj",
"(",
"String",
"content",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"bindYmlToObj",
"(",
"null",
",",
"content",
",",
"clazz",
",",
"null",
")",
";",
"}"
] | 将当前内容绑定到指定对象
@param content yml内容
@param clazz 指定对象类型
@return 对象 | [
"将当前内容绑定到指定对象"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/YmlConfigBinder.java#L28-L30 | train | Bind an XSL document to an object. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
14187,
24335,
23223,
16429,
3501,
1006,
5164,
4180,
1010,
2465,
1026,
1056,
1028,
18856,
10936,
2480,
1007,
1063,
2709,
14187,
24335,
23223,
16429,
3501,
1006,
19701,
1010,
4180,
1010,
18856,
10936,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/src/main/java/org/apache/flink/table/plan/rules/logical/ExtendedAggregateExtractProjectRule.java | ExtendedAggregateExtractProjectRule.extractProjectsAndMapping | private Mapping extractProjectsAndMapping(
Aggregate aggregate,
RelNode input,
RelBuilder relBuilder) {
// Compute which input fields are used.
final ImmutableBitSet.Builder inputFieldsUsed = getInputFieldUsed(aggregate, input);
final List<RexNode> projects = new ArrayList<>();
final Mapping mapping =
Mappings.create(MappingType.INVERSE_SURJECTION,
aggregate.getInput().getRowType().getFieldCount(),
inputFieldsUsed.cardinality());
int j = 0;
for (int i : inputFieldsUsed.build()) {
projects.add(relBuilder.field(i));
mapping.set(i, j++);
}
if (input instanceof Project) {
// this will not create trivial projects
relBuilder.project(projects);
} else {
relBuilder.project(projects, Collections.emptyList(), true);
}
return mapping;
} | java | private Mapping extractProjectsAndMapping(
Aggregate aggregate,
RelNode input,
RelBuilder relBuilder) {
// Compute which input fields are used.
final ImmutableBitSet.Builder inputFieldsUsed = getInputFieldUsed(aggregate, input);
final List<RexNode> projects = new ArrayList<>();
final Mapping mapping =
Mappings.create(MappingType.INVERSE_SURJECTION,
aggregate.getInput().getRowType().getFieldCount(),
inputFieldsUsed.cardinality());
int j = 0;
for (int i : inputFieldsUsed.build()) {
projects.add(relBuilder.field(i));
mapping.set(i, j++);
}
if (input instanceof Project) {
// this will not create trivial projects
relBuilder.project(projects);
} else {
relBuilder.project(projects, Collections.emptyList(), true);
}
return mapping;
} | [
"private",
"Mapping",
"extractProjectsAndMapping",
"(",
"Aggregate",
"aggregate",
",",
"RelNode",
"input",
",",
"RelBuilder",
"relBuilder",
")",
"{",
"// Compute which input fields are used.",
"final",
"ImmutableBitSet",
".",
"Builder",
"inputFieldsUsed",
"=",
"getInputFiel... | Extract projects from the Aggregate and return the index mapping between the new projects
and it's input. | [
"Extract",
"projects",
"from",
"the",
"Aggregate",
"and",
"return",
"the",
"index",
"mapping",
"between",
"the",
"new",
"projects",
"and",
"it",
"s",
"input",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/plan/rules/logical/ExtendedAggregateExtractProjectRule.java#L92-L119 | train | Extract projects and mapping from the given aggregate and input node. | [
30522,
2797,
12375,
14817,
21572,
20614,
8791,
22117,
29098,
2075,
1006,
9572,
9572,
1010,
2128,
19666,
10244,
7953,
1010,
2128,
20850,
19231,
4063,
2128,
20850,
19231,
4063,
1007,
1063,
1013,
1013,
24134,
2029,
7953,
4249,
2024,
2109,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.jsReturnsValue | public static ExpectedCondition<Object> jsReturnsValue(final String javaScript) {
return new ExpectedCondition<Object>() {
@Override
public Object apply(WebDriver driver) {
try {
Object value = ((JavascriptExecutor) driver).executeScript(javaScript);
if (value instanceof List) {
return ((List<?>) value).isEmpty() ? null : value;
}
if (value instanceof String) {
return ((String) value).isEmpty() ? null : value;
}
return value;
} catch (WebDriverException e) {
return null;
}
}
@Override
public String toString() {
return String.format("js %s to be executable", javaScript);
}
};
} | java | public static ExpectedCondition<Object> jsReturnsValue(final String javaScript) {
return new ExpectedCondition<Object>() {
@Override
public Object apply(WebDriver driver) {
try {
Object value = ((JavascriptExecutor) driver).executeScript(javaScript);
if (value instanceof List) {
return ((List<?>) value).isEmpty() ? null : value;
}
if (value instanceof String) {
return ((String) value).isEmpty() ? null : value;
}
return value;
} catch (WebDriverException e) {
return null;
}
}
@Override
public String toString() {
return String.format("js %s to be executable", javaScript);
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"Object",
">",
"jsReturnsValue",
"(",
"final",
"String",
"javaScript",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"Object",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Object",
"apply",
"(",
"WebDrive... | An expectation for String value from javascript
@param javaScript as executable js line
@return true once js return string | [
"An",
"expectation",
"for",
"String",
"value",
"from",
"javascript"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L1471-L1496 | train | An expectation for checking that a javascript script returns a value. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
4874,
1028,
1046,
21338,
3388,
14287,
2015,
10175,
5657,
1006,
2345,
5164,
9262,
22483,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
4874,
1028,
1006,
1007,
1063,
1030,
2058,
15637,
2270,
487... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java | ByteToMessageDecoder.channelInputClosed | void channelInputClosed(ChannelHandlerContext ctx, List<Object> out) throws Exception {
if (cumulation != null) {
callDecode(ctx, cumulation, out);
decodeLast(ctx, cumulation, out);
} else {
decodeLast(ctx, Unpooled.EMPTY_BUFFER, out);
}
} | java | void channelInputClosed(ChannelHandlerContext ctx, List<Object> out) throws Exception {
if (cumulation != null) {
callDecode(ctx, cumulation, out);
decodeLast(ctx, cumulation, out);
} else {
decodeLast(ctx, Unpooled.EMPTY_BUFFER, out);
}
} | [
"void",
"channelInputClosed",
"(",
"ChannelHandlerContext",
"ctx",
",",
"List",
"<",
"Object",
">",
"out",
")",
"throws",
"Exception",
"{",
"if",
"(",
"cumulation",
"!=",
"null",
")",
"{",
"callDecode",
"(",
"ctx",
",",
"cumulation",
",",
"out",
")",
";",
... | Called when the input of the channel was closed which may be because it changed to inactive or because of
{@link ChannelInputShutdownEvent}. | [
"Called",
"when",
"the",
"input",
"of",
"the",
"channel",
"was",
"closed",
"which",
"may",
"be",
"because",
"it",
"changed",
"to",
"inactive",
"or",
"because",
"of",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java#L403-L410 | train | Called when the channel is closed. | [
30522,
11675,
3149,
2378,
18780,
20464,
24768,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
2862,
1026,
4874,
1028,
2041,
1007,
11618,
6453,
1063,
2065,
1006,
13988,
9513,
999,
1027,
19701,
1007,
1063,
2655,
3207,
16044,
1006,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java | JSONTokener.readObject | private JSONObject readObject() throws JSONException {
JSONObject result = new JSONObject();
/* Peek to see if this is the empty object. */
int first = nextCleanInternal();
if (first == '}') {
return result;
}
else if (first != -1) {
this.pos--;
}
while (true) {
Object name = nextValue();
if (!(name instanceof String)) {
if (name == null) {
throw syntaxError("Names cannot be null");
}
else {
throw syntaxError("Names must be strings, but " + name
+ " is of type " + name.getClass().getName());
}
}
/*
* Expect the name/value separator to be either a colon ':', an equals sign
* '=', or an arrow "=>". The last two are bogus but we include them because
* that's what the original implementation did.
*/
int separator = nextCleanInternal();
if (separator != ':' && separator != '=') {
throw syntaxError("Expected ':' after " + name);
}
if (this.pos < this.in.length() && this.in.charAt(this.pos) == '>') {
this.pos++;
}
result.put((String) name, nextValue());
switch (nextCleanInternal()) {
case '}':
return result;
case ';':
case ',':
continue;
default:
throw syntaxError("Unterminated object");
}
}
} | java | private JSONObject readObject() throws JSONException {
JSONObject result = new JSONObject();
/* Peek to see if this is the empty object. */
int first = nextCleanInternal();
if (first == '}') {
return result;
}
else if (first != -1) {
this.pos--;
}
while (true) {
Object name = nextValue();
if (!(name instanceof String)) {
if (name == null) {
throw syntaxError("Names cannot be null");
}
else {
throw syntaxError("Names must be strings, but " + name
+ " is of type " + name.getClass().getName());
}
}
/*
* Expect the name/value separator to be either a colon ':', an equals sign
* '=', or an arrow "=>". The last two are bogus but we include them because
* that's what the original implementation did.
*/
int separator = nextCleanInternal();
if (separator != ':' && separator != '=') {
throw syntaxError("Expected ':' after " + name);
}
if (this.pos < this.in.length() && this.in.charAt(this.pos) == '>') {
this.pos++;
}
result.put((String) name, nextValue());
switch (nextCleanInternal()) {
case '}':
return result;
case ';':
case ',':
continue;
default:
throw syntaxError("Unterminated object");
}
}
} | [
"private",
"JSONObject",
"readObject",
"(",
")",
"throws",
"JSONException",
"{",
"JSONObject",
"result",
"=",
"new",
"JSONObject",
"(",
")",
";",
"/* Peek to see if this is the empty object. */",
"int",
"first",
"=",
"nextCleanInternal",
"(",
")",
";",
"if",
"(",
... | Reads a sequence of key/value pairs and the trailing closing brace '}' of an
object. The opening brace '{' should have already been read.
@return an object
@throws JSONException if processing of json failed | [
"Reads",
"a",
"sequence",
"of",
"key",
"/",
"value",
"pairs",
"and",
"the",
"trailing",
"closing",
"brace",
"}",
"of",
"an",
"object",
".",
"The",
"opening",
"brace",
"{",
"should",
"have",
"already",
"been",
"read",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java#L359-L408 | train | Reads an object from the input. | [
30522,
2797,
1046,
3385,
16429,
20614,
3191,
16429,
20614,
1006,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
1046,
3385,
16429,
20614,
2765,
1027,
2047,
1046,
3385,
16429,
20614,
1006,
1007,
1025,
1013,
1008,
19043,
2000,
2156,
2065,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java | WebSocketClientHandshaker.processHandshake | public final ChannelFuture processHandshake(final Channel channel, HttpResponse response) {
return processHandshake(channel, response, channel.newPromise());
} | java | public final ChannelFuture processHandshake(final Channel channel, HttpResponse response) {
return processHandshake(channel, response, channel.newPromise());
} | [
"public",
"final",
"ChannelFuture",
"processHandshake",
"(",
"final",
"Channel",
"channel",
",",
"HttpResponse",
"response",
")",
"{",
"return",
"processHandshake",
"(",
"channel",
",",
"response",
",",
"channel",
".",
"newPromise",
"(",
")",
")",
";",
"}"
] | Process the opening handshake initiated by {@link #handshake}}.
@param channel
Channel
@param response
HTTP response containing the closing handshake details
@return future
the {@link ChannelFuture} which is notified once the handshake completes. | [
"Process",
"the",
"opening",
"handshake",
"initiated",
"by",
"{",
"@link",
"#handshake",
"}}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java#L373-L375 | train | Process a HTTP handshake. | [
30522,
2270,
2345,
3149,
11263,
11244,
2832,
11774,
7377,
3489,
1006,
2345,
3149,
3149,
1010,
8299,
6072,
26029,
3366,
3433,
1007,
1063,
2709,
2832,
11774,
7377,
3489,
1006,
3149,
1010,
3433,
1010,
3149,
1012,
2047,
21572,
28732,
1006,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java | CliFrontendParser.printCustomCliOptions | private static void printCustomCliOptions(
Collection<CustomCommandLine<?>> customCommandLines,
HelpFormatter formatter,
boolean runOptions) {
// prints options from all available command-line classes
for (CustomCommandLine cli: customCommandLines) {
formatter.setSyntaxPrefix(" Options for " + cli.getId() + " mode:");
Options customOpts = new Options();
cli.addGeneralOptions(customOpts);
if (runOptions) {
cli.addRunOptions(customOpts);
}
formatter.printHelp(" ", customOpts);
System.out.println();
}
} | java | private static void printCustomCliOptions(
Collection<CustomCommandLine<?>> customCommandLines,
HelpFormatter formatter,
boolean runOptions) {
// prints options from all available command-line classes
for (CustomCommandLine cli: customCommandLines) {
formatter.setSyntaxPrefix(" Options for " + cli.getId() + " mode:");
Options customOpts = new Options();
cli.addGeneralOptions(customOpts);
if (runOptions) {
cli.addRunOptions(customOpts);
}
formatter.printHelp(" ", customOpts);
System.out.println();
}
} | [
"private",
"static",
"void",
"printCustomCliOptions",
"(",
"Collection",
"<",
"CustomCommandLine",
"<",
"?",
">",
">",
"customCommandLines",
",",
"HelpFormatter",
"formatter",
",",
"boolean",
"runOptions",
")",
"{",
"// prints options from all available command-line classes... | Prints custom cli options.
@param formatter The formatter to use for printing
@param runOptions True if the run options should be printed, False to print only general options | [
"Prints",
"custom",
"cli",
"options",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java#L386-L401 | train | Prints the custom CLI options from all available command - line classes. | [
30522,
2797,
10763,
11675,
6140,
7874,
20389,
20464,
3695,
16790,
2015,
1006,
3074,
1026,
7661,
9006,
2386,
19422,
3170,
1026,
1029,
1028,
1028,
7661,
9006,
2386,
19422,
10586,
1010,
2393,
14192,
20097,
4289,
3334,
1010,
22017,
20898,
2448,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java | RestTemplateBuilder.setReadTimeout | public RestTemplateBuilder setReadTimeout(Duration readTimeout) {
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers,
this.requestFactoryCustomizer.readTimeout(readTimeout),
this.interceptors);
} | java | public RestTemplateBuilder setReadTimeout(Duration readTimeout) {
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers,
this.requestFactoryCustomizer.readTimeout(readTimeout),
this.interceptors);
} | [
"public",
"RestTemplateBuilder",
"setReadTimeout",
"(",
"Duration",
"readTimeout",
")",
"{",
"return",
"new",
"RestTemplateBuilder",
"(",
"this",
".",
"detectRequestFactory",
",",
"this",
".",
"rootUri",
",",
"this",
".",
"messageConverters",
",",
"this",
".",
"re... | Sets the read timeout on the underlying {@link ClientHttpRequestFactory}.
@param readTimeout the read timeout
@return a new builder instance.
@since 2.1.0 | [
"Sets",
"the",
"read",
"timeout",
"on",
"the",
"underlying",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java#L481-L488 | train | Sets the read timeout. | [
30522,
2270,
2717,
18532,
15725,
8569,
23891,
2099,
2275,
16416,
11927,
14428,
5833,
1006,
9367,
3191,
7292,
5833,
1007,
1063,
2709,
2047,
2717,
18532,
15725,
8569,
23891,
2099,
1006,
2023,
1012,
11487,
2890,
15500,
21450,
1010,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java | Launcher.createMainMethodRunner | protected MainMethodRunner createMainMethodRunner(String mainClass, String[] args,
ClassLoader classLoader) {
return new MainMethodRunner(mainClass, args);
} | java | protected MainMethodRunner createMainMethodRunner(String mainClass, String[] args,
ClassLoader classLoader) {
return new MainMethodRunner(mainClass, args);
} | [
"protected",
"MainMethodRunner",
"createMainMethodRunner",
"(",
"String",
"mainClass",
",",
"String",
"[",
"]",
"args",
",",
"ClassLoader",
"classLoader",
")",
"{",
"return",
"new",
"MainMethodRunner",
"(",
"mainClass",
",",
"args",
")",
";",
"}"
] | Create the {@code MainMethodRunner} used to launch the application.
@param mainClass the main class
@param args the incoming arguments
@param classLoader the classloader
@return the main method runner | [
"Create",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java#L97-L100 | train | Create a new instance of the main method runner. | [
30522,
5123,
2364,
11368,
6806,
13626,
4609,
3678,
3443,
24238,
11368,
6806,
30524,
3678,
1006,
2364,
26266,
1010,
12098,
5620,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/filecache/FileCache.java | FileCache.createTmpFile | public Future<Path> createTmpFile(String name, DistributedCacheEntry entry, JobID jobID, ExecutionAttemptID executionId) throws Exception {
synchronized (lock) {
Map<String, Future<Path>> jobEntries = entries.computeIfAbsent(jobID, k -> new HashMap<>());
// register reference holder
final Set<ExecutionAttemptID> refHolders = jobRefHolders.computeIfAbsent(jobID, id -> new HashSet<>());
refHolders.add(executionId);
Future<Path> fileEntry = jobEntries.get(name);
if (fileEntry != null) {
// file is already in the cache. return a future that
// immediately returns the file
return fileEntry;
} else {
// need to copy the file
// create the target path
File tempDirToUse = new File(storageDirectories[nextDirectory++], jobID.toString());
if (nextDirectory >= storageDirectories.length) {
nextDirectory = 0;
}
// kick off the copying
Callable<Path> cp;
if (entry.blobKey != null) {
cp = new CopyFromBlobProcess(entry, jobID, blobService, new Path(tempDirToUse.getAbsolutePath()));
} else {
cp = new CopyFromDFSProcess(entry, new Path(tempDirToUse.getAbsolutePath()));
}
FutureTask<Path> copyTask = new FutureTask<>(cp);
executorService.submit(copyTask);
// store our entry
jobEntries.put(name, copyTask);
return copyTask;
}
}
} | java | public Future<Path> createTmpFile(String name, DistributedCacheEntry entry, JobID jobID, ExecutionAttemptID executionId) throws Exception {
synchronized (lock) {
Map<String, Future<Path>> jobEntries = entries.computeIfAbsent(jobID, k -> new HashMap<>());
// register reference holder
final Set<ExecutionAttemptID> refHolders = jobRefHolders.computeIfAbsent(jobID, id -> new HashSet<>());
refHolders.add(executionId);
Future<Path> fileEntry = jobEntries.get(name);
if (fileEntry != null) {
// file is already in the cache. return a future that
// immediately returns the file
return fileEntry;
} else {
// need to copy the file
// create the target path
File tempDirToUse = new File(storageDirectories[nextDirectory++], jobID.toString());
if (nextDirectory >= storageDirectories.length) {
nextDirectory = 0;
}
// kick off the copying
Callable<Path> cp;
if (entry.blobKey != null) {
cp = new CopyFromBlobProcess(entry, jobID, blobService, new Path(tempDirToUse.getAbsolutePath()));
} else {
cp = new CopyFromDFSProcess(entry, new Path(tempDirToUse.getAbsolutePath()));
}
FutureTask<Path> copyTask = new FutureTask<>(cp);
executorService.submit(copyTask);
// store our entry
jobEntries.put(name, copyTask);
return copyTask;
}
}
} | [
"public",
"Future",
"<",
"Path",
">",
"createTmpFile",
"(",
"String",
"name",
",",
"DistributedCacheEntry",
"entry",
",",
"JobID",
"jobID",
",",
"ExecutionAttemptID",
"executionId",
")",
"throws",
"Exception",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"Map",
... | If the file doesn't exists locally, retrieve the file from the blob-service.
@param entry The cache entry descriptor (path, executable flag)
@param jobID The ID of the job for which the file is copied.
@return The handle to the task that copies the file. | [
"If",
"the",
"file",
"doesn",
"t",
"exists",
"locally",
"retrieve",
"the",
"file",
"from",
"the",
"blob",
"-",
"service",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/filecache/FileCache.java#L174-L212 | train | Create a temporary file for the given name. | [
30522,
2270,
2925,
1026,
4130,
1028,
3443,
21246,
14376,
9463,
1006,
5164,
2171,
1010,
5500,
3540,
25923,
3372,
2854,
4443,
1010,
3105,
3593,
3105,
3593,
1010,
7781,
19321,
6633,
13876,
3593,
7781,
30524,
5054,
2102,
1006,
3105,
3593,
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... |
netty/netty | transport-udt/src/main/java/io/netty/channel/udt/nio/NioUdtProvider.java | NioUdtProvider.newChannel | @SuppressWarnings("unchecked")
@Override
public T newChannel() {
switch (kind) {
case ACCEPTOR:
switch (type) {
case DATAGRAM:
return (T) new NioUdtMessageAcceptorChannel();
case STREAM:
return (T) new NioUdtByteAcceptorChannel();
default:
throw new IllegalStateException("wrong type=" + type);
}
case CONNECTOR:
switch (type) {
case DATAGRAM:
return (T) new NioUdtMessageConnectorChannel();
case STREAM:
return (T) new NioUdtByteConnectorChannel();
default:
throw new IllegalStateException("wrong type=" + type);
}
case RENDEZVOUS:
switch (type) {
case DATAGRAM:
return (T) new NioUdtMessageRendezvousChannel();
case STREAM:
return (T) new NioUdtByteRendezvousChannel();
default:
throw new IllegalStateException("wrong type=" + type);
}
default:
throw new IllegalStateException("wrong kind=" + kind);
}
} | java | @SuppressWarnings("unchecked")
@Override
public T newChannel() {
switch (kind) {
case ACCEPTOR:
switch (type) {
case DATAGRAM:
return (T) new NioUdtMessageAcceptorChannel();
case STREAM:
return (T) new NioUdtByteAcceptorChannel();
default:
throw new IllegalStateException("wrong type=" + type);
}
case CONNECTOR:
switch (type) {
case DATAGRAM:
return (T) new NioUdtMessageConnectorChannel();
case STREAM:
return (T) new NioUdtByteConnectorChannel();
default:
throw new IllegalStateException("wrong type=" + type);
}
case RENDEZVOUS:
switch (type) {
case DATAGRAM:
return (T) new NioUdtMessageRendezvousChannel();
case STREAM:
return (T) new NioUdtByteRendezvousChannel();
default:
throw new IllegalStateException("wrong type=" + type);
}
default:
throw new IllegalStateException("wrong kind=" + kind);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"T",
"newChannel",
"(",
")",
"{",
"switch",
"(",
"kind",
")",
"{",
"case",
"ACCEPTOR",
":",
"switch",
"(",
"type",
")",
"{",
"case",
"DATAGRAM",
":",
"return",
"(",
"T",
")"... | Produce new {@link UdtChannel} based on factory {@link #kind()} and
{@link #type()} | [
"Produce",
"new",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-udt/src/main/java/io/netty/channel/udt/nio/NioUdtProvider.java#L205-L239 | train | Creates a new instance of the NioUdtMessageChannel interface. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
1030,
2058,
15637,
2270,
1056,
2047,
26058,
1006,
1007,
1063,
6942,
1006,
2785,
1007,
1063,
2553,
5138,
2953,
1024,
6942,
1006,
2828,
1007,
1063,
2553,
2951,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorker.java | LaunchableMesosWorker.extractPortKeys | static Set<String> extractPortKeys(Configuration config) {
final LinkedHashSet<String> tmPortKeys = new LinkedHashSet<>(TM_PORT_KEYS);
final String portKeys = config.getString(PORT_ASSIGNMENTS);
if (portKeys != null) {
Arrays.stream(portKeys.split(","))
.map(String::trim)
.peek(key -> LOG.debug("Adding port key {} to mesos request"))
.forEach(tmPortKeys::add);
}
return Collections.unmodifiableSet(tmPortKeys);
} | java | static Set<String> extractPortKeys(Configuration config) {
final LinkedHashSet<String> tmPortKeys = new LinkedHashSet<>(TM_PORT_KEYS);
final String portKeys = config.getString(PORT_ASSIGNMENTS);
if (portKeys != null) {
Arrays.stream(portKeys.split(","))
.map(String::trim)
.peek(key -> LOG.debug("Adding port key {} to mesos request"))
.forEach(tmPortKeys::add);
}
return Collections.unmodifiableSet(tmPortKeys);
} | [
"static",
"Set",
"<",
"String",
">",
"extractPortKeys",
"(",
"Configuration",
"config",
")",
"{",
"final",
"LinkedHashSet",
"<",
"String",
">",
"tmPortKeys",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
"TM_PORT_KEYS",
")",
";",
"final",
"String",
"portKeys",
"=",
... | Get the port keys representing the TM's configured endpoints. This includes mandatory TM endpoints such as
data and rpc as well as optionally configured endpoints for services such as prometheus reporter
@param config to extract the port keys from
@return A deterministically ordered Set of port keys to expose from the TM container | [
"Get",
"the",
"port",
"keys",
"representing",
"the",
"TM",
"s",
"configured",
"endpoints",
".",
"This",
"includes",
"mandatory",
"TM",
"endpoints",
"such",
"as",
"data",
"and",
"rpc",
"as",
"well",
"as",
"optionally",
"configured",
"endpoints",
"for",
"service... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorker.java#L350-L363 | train | Extract port keys from configuration. | [
30522,
10763,
2275,
1026,
5164,
1028,
14817,
6442,
14839,
2015,
1006,
9563,
9530,
8873,
2290,
1007,
1063,
2345,
5799,
14949,
7898,
3388,
1026,
5164,
1028,
1056,
8737,
11589,
14839,
2015,
1027,
2047,
5799,
14949,
7898,
3388,
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-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.hmac | public static HMac hmac(HmacAlgorithm algorithm, String key) {
return new HMac(algorithm, StrUtil.utf8Bytes(key));
} | java | public static HMac hmac(HmacAlgorithm algorithm, String key) {
return new HMac(algorithm, StrUtil.utf8Bytes(key));
} | [
"public",
"static",
"HMac",
"hmac",
"(",
"HmacAlgorithm",
"algorithm",
",",
"String",
"key",
")",
"{",
"return",
"new",
"HMac",
"(",
"algorithm",
",",
"StrUtil",
".",
"utf8Bytes",
"(",
"key",
")",
")",
";",
"}"
] | 创建HMac对象,调用digest方法可获得hmac值
@param algorithm {@link HmacAlgorithm}
@param key 密钥,如果为<code>null</code>生成随机密钥
@return {@link HMac}
@since 3.3.0 | [
"创建HMac对象,调用digest方法可获得hmac值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L633-L635 | train | Creates a new HMAC - SHA256 with the specified algorithm and key. | [
30522,
2270,
10763,
20287,
6305,
20287,
6305,
1006,
20287,
19629,
2140,
20255,
8939,
2213,
9896,
1010,
5164,
3145,
1007,
1063,
2709,
2047,
20287,
6305,
1006,
9896,
1010,
2358,
22134,
4014,
1012,
21183,
2546,
2620,
3762,
4570,
1006,
3145,
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-optimizer/src/main/java/org/apache/flink/optimizer/Optimizer.java | Optimizer.createPreOptimizedPlan | public static List<DataSinkNode> createPreOptimizedPlan(Plan program) {
GraphCreatingVisitor graphCreator = new GraphCreatingVisitor(1, null);
program.accept(graphCreator);
return graphCreator.getSinks();
} | java | public static List<DataSinkNode> createPreOptimizedPlan(Plan program) {
GraphCreatingVisitor graphCreator = new GraphCreatingVisitor(1, null);
program.accept(graphCreator);
return graphCreator.getSinks();
} | [
"public",
"static",
"List",
"<",
"DataSinkNode",
">",
"createPreOptimizedPlan",
"(",
"Plan",
"program",
")",
"{",
"GraphCreatingVisitor",
"graphCreator",
"=",
"new",
"GraphCreatingVisitor",
"(",
"1",
",",
"null",
")",
";",
"program",
".",
"accept",
"(",
"graphCr... | This function performs only the first step to the compilation process - the creation of the optimizer
representation of the plan. No estimations or enumerations of alternatives are done here.
@param program The plan to generate the optimizer representation for.
@return The optimizer representation of the plan, as a collection of all data sinks
from the plan can be traversed. | [
"This",
"function",
"performs",
"only",
"the",
"first",
"step",
"to",
"the",
"compilation",
"process",
"-",
"the",
"creation",
"of",
"the",
"optimizer",
"representation",
"of",
"the",
"plan",
".",
"No",
"estimations",
"or",
"enumerations",
"of",
"alternatives",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/Optimizer.java#L540-L544 | train | Creates a pre - optimized plan. | [
30522,
2270,
10763,
2862,
1026,
2951,
11493,
2243,
3630,
3207,
1028,
3443,
28139,
7361,
3775,
4328,
5422,
24759,
2319,
1006,
2933,
2565,
1007,
1063,
10629,
16748,
5844,
11365,
15660,
10629,
16748,
8844,
1027,
2047,
10629,
16748,
5844,
11365,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/JSONConverter.java | JSONConverter.toArray | protected static Object toArray(JSONArray jsonArray, Class<?> arrayClass) {
return new ArrayConverter(arrayClass).convert(jsonArray, null);
} | java | protected static Object toArray(JSONArray jsonArray, Class<?> arrayClass) {
return new ArrayConverter(arrayClass).convert(jsonArray, null);
} | [
"protected",
"static",
"Object",
"toArray",
"(",
"JSONArray",
"jsonArray",
",",
"Class",
"<",
"?",
">",
"arrayClass",
")",
"{",
"return",
"new",
"ArrayConverter",
"(",
"arrayClass",
")",
".",
"convert",
"(",
"jsonArray",
",",
"null",
")",
";",
"}"
] | JSONArray转数组
@param jsonArray JSONArray
@param arrayClass 数组元素类型
@return 数组对象 | [
"JSONArray转数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONConverter.java#L38-L40 | train | Converts a JSONArray to an array of the given class. | [
30522,
5123,
10763,
4874,
2000,
2906,
9447,
1006,
1046,
3385,
2906,
9447,
1046,
3385,
2906,
9447,
1010,
2465,
1026,
1029,
1028,
9140,
26266,
1007,
1063,
2709,
2047,
9140,
8663,
16874,
2121,
1006,
9140,
26266,
1007,
1012,
10463,
1006,
1046,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.addFlattenedComponents | public CompositeByteBuf addFlattenedComponents(boolean increaseWriterIndex, ByteBuf buffer) {
checkNotNull(buffer, "buffer");
final int ridx = buffer.readerIndex();
final int widx = buffer.writerIndex();
if (ridx == widx) {
buffer.release();
return this;
}
if (!(buffer instanceof CompositeByteBuf)) {
addComponent0(increaseWriterIndex, componentCount, buffer);
consolidateIfNeeded();
return this;
}
final CompositeByteBuf from = (CompositeByteBuf) buffer;
from.checkIndex(ridx, widx - ridx);
final Component[] fromComponents = from.components;
final int compCountBefore = componentCount;
final int writerIndexBefore = writerIndex;
try {
for (int cidx = from.toComponentIndex0(ridx), newOffset = capacity();; cidx++) {
final Component component = fromComponents[cidx];
final int compOffset = component.offset;
final int fromIdx = Math.max(ridx, compOffset);
final int toIdx = Math.min(widx, component.endOffset);
final int len = toIdx - fromIdx;
if (len > 0) { // skip empty components
// Note that it's safe to just retain the unwrapped buf here, even in the case
// of PooledSlicedByteBufs - those slices will still be properly released by the
// source Component's free() method.
addComp(componentCount, new Component(
component.buf.retain(), component.idx(fromIdx), newOffset, len, null));
}
if (widx == toIdx) {
break;
}
newOffset += len;
}
if (increaseWriterIndex) {
writerIndex = writerIndexBefore + (widx - ridx);
}
consolidateIfNeeded();
buffer.release();
buffer = null;
return this;
} finally {
if (buffer != null) {
// if we did not succeed, attempt to rollback any components that were added
if (increaseWriterIndex) {
writerIndex = writerIndexBefore;
}
for (int cidx = componentCount - 1; cidx >= compCountBefore; cidx--) {
components[cidx].free();
removeComp(cidx);
}
}
}
} | java | public CompositeByteBuf addFlattenedComponents(boolean increaseWriterIndex, ByteBuf buffer) {
checkNotNull(buffer, "buffer");
final int ridx = buffer.readerIndex();
final int widx = buffer.writerIndex();
if (ridx == widx) {
buffer.release();
return this;
}
if (!(buffer instanceof CompositeByteBuf)) {
addComponent0(increaseWriterIndex, componentCount, buffer);
consolidateIfNeeded();
return this;
}
final CompositeByteBuf from = (CompositeByteBuf) buffer;
from.checkIndex(ridx, widx - ridx);
final Component[] fromComponents = from.components;
final int compCountBefore = componentCount;
final int writerIndexBefore = writerIndex;
try {
for (int cidx = from.toComponentIndex0(ridx), newOffset = capacity();; cidx++) {
final Component component = fromComponents[cidx];
final int compOffset = component.offset;
final int fromIdx = Math.max(ridx, compOffset);
final int toIdx = Math.min(widx, component.endOffset);
final int len = toIdx - fromIdx;
if (len > 0) { // skip empty components
// Note that it's safe to just retain the unwrapped buf here, even in the case
// of PooledSlicedByteBufs - those slices will still be properly released by the
// source Component's free() method.
addComp(componentCount, new Component(
component.buf.retain(), component.idx(fromIdx), newOffset, len, null));
}
if (widx == toIdx) {
break;
}
newOffset += len;
}
if (increaseWriterIndex) {
writerIndex = writerIndexBefore + (widx - ridx);
}
consolidateIfNeeded();
buffer.release();
buffer = null;
return this;
} finally {
if (buffer != null) {
// if we did not succeed, attempt to rollback any components that were added
if (increaseWriterIndex) {
writerIndex = writerIndexBefore;
}
for (int cidx = componentCount - 1; cidx >= compCountBefore; cidx--) {
components[cidx].free();
removeComp(cidx);
}
}
}
} | [
"public",
"CompositeByteBuf",
"addFlattenedComponents",
"(",
"boolean",
"increaseWriterIndex",
",",
"ByteBuf",
"buffer",
")",
"{",
"checkNotNull",
"(",
"buffer",
",",
"\"buffer\"",
")",
";",
"final",
"int",
"ridx",
"=",
"buffer",
".",
"readerIndex",
"(",
")",
";... | Add the given {@link ByteBuf} and increase the {@code writerIndex} if {@code increaseWriterIndex} is
{@code true}. If the provided buffer is a {@link CompositeByteBuf} itself, a "shallow copy" of its
readable components will be performed. Thus the actual number of new components added may vary
and in particular will be zero if the provided buffer is not readable.
<p>
{@link ByteBuf#release()} ownership of {@code buffer} is transferred to this {@link CompositeByteBuf}.
@param buffer the {@link ByteBuf} to add. {@link ByteBuf#release()} ownership is transferred to this
{@link CompositeByteBuf}. | [
"Add",
"the",
"given",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L427-L483 | train | Adds all components from the given buffer into this CompositeByteBuf. | [
30522,
2270,
12490,
3762,
2618,
8569,
2546,
5587,
10258,
19321,
6675,
9006,
29513,
7666,
1006,
22017,
20898,
3623,
15994,
22254,
10288,
1010,
24880,
8569,
2546,
17698,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
17698,
1010,
1000,
17698,
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... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java | Ftp.upload | @Override
public boolean upload(String path, File file) {
Assert.notNull(file, "file to upload is null !");
return upload(path, file.getName(), file);
} | java | @Override
public boolean upload(String path, File file) {
Assert.notNull(file, "file to upload is null !");
return upload(path, file.getName(), file);
} | [
"@",
"Override",
"public",
"boolean",
"upload",
"(",
"String",
"path",
",",
"File",
"file",
")",
"{",
"Assert",
".",
"notNull",
"(",
"file",
",",
"\"file to upload is null !\"",
")",
";",
"return",
"upload",
"(",
"path",
",",
"file",
".",
"getName",
"(",
... | 上传文件到指定目录,可选:
<pre>
1. path为null或""上传到当前路径
2. path为相对路径则相对于当前路径的子路径
3. path为绝对路径则上传到此路径
</pre>
@param path 服务端路径,可以为{@code null} 或者相对路径或绝对路径
@param file 文件
@return 是否上传成功 | [
"上传文件到指定目录,可选:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java#L362-L366 | train | Uploads a file to the server. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
2039,
11066,
1006,
5164,
4130,
1010,
5371,
5371,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
5371,
1010,
1000,
5371,
2000,
2039,
11066,
2003,
19701,
999,
1000,
1007,
1025,
2709,
2039,
1106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactory.java | NettyReactiveWebServerFactory.addServerCustomizers | public void addServerCustomizers(NettyServerCustomizer... serverCustomizers) {
Assert.notNull(serverCustomizers, "ServerCustomizer must not be null");
this.serverCustomizers.addAll(Arrays.asList(serverCustomizers));
} | java | public void addServerCustomizers(NettyServerCustomizer... serverCustomizers) {
Assert.notNull(serverCustomizers, "ServerCustomizer must not be null");
this.serverCustomizers.addAll(Arrays.asList(serverCustomizers));
} | [
"public",
"void",
"addServerCustomizers",
"(",
"NettyServerCustomizer",
"...",
"serverCustomizers",
")",
"{",
"Assert",
".",
"notNull",
"(",
"serverCustomizers",
",",
"\"ServerCustomizer must not be null\"",
")",
";",
"this",
".",
"serverCustomizers",
".",
"addAll",
"("... | Add {@link NettyServerCustomizer}s that should applied while building the server.
@param serverCustomizers the customizers to add | [
"Add",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/NettyReactiveWebServerFactory.java#L93-L96 | train | Add server customizers to the server. | [
30522,
2270,
11675,
9909,
2121,
6299,
7874,
20389,
17629,
2015,
1006,
5658,
3723,
8043,
6299,
7874,
20389,
17629,
1012,
1012,
1012,
8241,
7874,
20389,
17629,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
8241,
7874,
20389,
17629,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SerializedCheckpointData.java | SerializedCheckpointData.fromDeque | public static <T> SerializedCheckpointData[] fromDeque(
ArrayDeque<Tuple2<Long, Set<T>>> checkpoints,
TypeSerializer<T> serializer,
DataOutputSerializer outputBuffer) throws IOException {
SerializedCheckpointData[] serializedCheckpoints = new SerializedCheckpointData[checkpoints.size()];
int pos = 0;
for (Tuple2<Long, Set<T>> checkpoint : checkpoints) {
outputBuffer.clear();
Set<T> checkpointIds = checkpoint.f1;
for (T id : checkpointIds) {
serializer.serialize(id, outputBuffer);
}
serializedCheckpoints[pos++] = new SerializedCheckpointData(
checkpoint.f0, outputBuffer.getCopyOfBuffer(), checkpointIds.size());
}
return serializedCheckpoints;
} | java | public static <T> SerializedCheckpointData[] fromDeque(
ArrayDeque<Tuple2<Long, Set<T>>> checkpoints,
TypeSerializer<T> serializer,
DataOutputSerializer outputBuffer) throws IOException {
SerializedCheckpointData[] serializedCheckpoints = new SerializedCheckpointData[checkpoints.size()];
int pos = 0;
for (Tuple2<Long, Set<T>> checkpoint : checkpoints) {
outputBuffer.clear();
Set<T> checkpointIds = checkpoint.f1;
for (T id : checkpointIds) {
serializer.serialize(id, outputBuffer);
}
serializedCheckpoints[pos++] = new SerializedCheckpointData(
checkpoint.f0, outputBuffer.getCopyOfBuffer(), checkpointIds.size());
}
return serializedCheckpoints;
} | [
"public",
"static",
"<",
"T",
">",
"SerializedCheckpointData",
"[",
"]",
"fromDeque",
"(",
"ArrayDeque",
"<",
"Tuple2",
"<",
"Long",
",",
"Set",
"<",
"T",
">",
">",
">",
"checkpoints",
",",
"TypeSerializer",
"<",
"T",
">",
"serializer",
",",
"DataOutputSer... | Converts a list of checkpoints into an array of SerializedCheckpointData.
@param checkpoints The checkpoints to be converted into IdsCheckpointData.
@param serializer The serializer to serialize the IDs.
@param outputBuffer The reusable serialization buffer.
@param <T> The type of the ID.
@return An array of serializable SerializedCheckpointData, one per entry in the queue.
@throws IOException Thrown, if the serialization fails. | [
"Converts",
"a",
"list",
"of",
"checkpoints",
"into",
"an",
"array",
"of",
"SerializedCheckpointData",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SerializedCheckpointData.java#L115-L136 | train | Converts a sequence of checkpoints into an array of SerializedCheckpointData objects. | [
30522,
2270,
10763,
1026,
1056,
1028,
27289,
5403,
3600,
8400,
2850,
2696,
1031,
1033,
2013,
3207,
4226,
1006,
9140,
3207,
4226,
1026,
10722,
10814,
2475,
1026,
2146,
1010,
2275,
1026,
1056,
1028,
1028,
1028,
26520,
2015,
1010,
4127,
11610,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java | CustomDictionary.parseLongestText | public static void parseLongestText(String text, AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor)
{
if (trie != null)
{
final int[] lengthArray = new int[text.length()];
final CoreDictionary.Attribute[] attributeArray = new CoreDictionary.Attribute[text.length()];
char[] charArray = text.toCharArray();
DoubleArrayTrie<CoreDictionary.Attribute>.Searcher searcher = dat.getSearcher(charArray, 0);
while (searcher.next())
{
lengthArray[searcher.begin] = searcher.length;
attributeArray[searcher.begin] = searcher.value;
}
trie.parseText(charArray, new AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute>()
{
@Override
public void hit(int begin, int end, CoreDictionary.Attribute value)
{
int length = end - begin;
if (length > lengthArray[begin])
{
lengthArray[begin] = length;
attributeArray[begin] = value;
}
}
});
for (int i = 0; i < charArray.length;)
{
if (lengthArray[i] == 0)
{
++i;
}
else
{
processor.hit(i, i + lengthArray[i], attributeArray[i]);
i += lengthArray[i];
}
}
}
else
dat.parseLongestText(text, processor);
} | java | public static void parseLongestText(String text, AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor)
{
if (trie != null)
{
final int[] lengthArray = new int[text.length()];
final CoreDictionary.Attribute[] attributeArray = new CoreDictionary.Attribute[text.length()];
char[] charArray = text.toCharArray();
DoubleArrayTrie<CoreDictionary.Attribute>.Searcher searcher = dat.getSearcher(charArray, 0);
while (searcher.next())
{
lengthArray[searcher.begin] = searcher.length;
attributeArray[searcher.begin] = searcher.value;
}
trie.parseText(charArray, new AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute>()
{
@Override
public void hit(int begin, int end, CoreDictionary.Attribute value)
{
int length = end - begin;
if (length > lengthArray[begin])
{
lengthArray[begin] = length;
attributeArray[begin] = value;
}
}
});
for (int i = 0; i < charArray.length;)
{
if (lengthArray[i] == 0)
{
++i;
}
else
{
processor.hit(i, i + lengthArray[i], attributeArray[i]);
i += lengthArray[i];
}
}
}
else
dat.parseLongestText(text, processor);
} | [
"public",
"static",
"void",
"parseLongestText",
"(",
"String",
"text",
",",
"AhoCorasickDoubleArrayTrie",
".",
"IHit",
"<",
"CoreDictionary",
".",
"Attribute",
">",
"processor",
")",
"{",
"if",
"(",
"trie",
"!=",
"null",
")",
"{",
"final",
"int",
"[",
"]",
... | 最长匹配
@param text 文本
@param processor 处理器 | [
"最长匹配"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L604-L645 | train | Parses the text using the Longest Text Method. | [
30522,
2270,
10763,
11675,
11968,
11246,
5063,
4355,
18209,
1006,
5164,
3793,
1010,
6289,
24163,
8180,
6799,
26797,
3468,
2906,
9447,
18886,
2063,
1012,
1045,
16584,
1026,
4563,
29201,
3258,
5649,
1012,
17961,
1028,
13151,
1007,
1063,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
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... |
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... |
apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalog/v2/expressions/Expressions.java | Expressions.apply | public Transform apply(String name, Expression... args) {
return LogicalExpressions.apply(name,
JavaConverters.asScalaBuffer(Arrays.asList(args)).toSeq());
} | java | public Transform apply(String name, Expression... args) {
return LogicalExpressions.apply(name,
JavaConverters.asScalaBuffer(Arrays.asList(args)).toSeq());
} | [
"public",
"Transform",
"apply",
"(",
"String",
"name",
",",
"Expression",
"...",
"args",
")",
"{",
"return",
"LogicalExpressions",
".",
"apply",
"(",
"name",
",",
"JavaConverters",
".",
"asScalaBuffer",
"(",
"Arrays",
".",
"asList",
"(",
"args",
")",
")",
... | Create a logical transform for applying a named transform.
<p>
This transform can represent applying any named transform.
@param name the transform name
@param args expression arguments to the transform
@return a logical transform | [
"Create",
"a",
"logical",
"transform",
"for",
"applying",
"a",
"named",
"transform",
".",
"<p",
">",
"This",
"transform",
"can",
"represent",
"applying",
"any",
"named",
"transform",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalog/v2/expressions/Expressions.java#L43-L46 | train | Apply a Logical Expression to a CID | [
30522,
2270,
10938,
6611,
1006,
5164,
2171,
1010,
3670,
1012,
1012,
1012,
12098,
5620,
1007,
1063,
2709,
11177,
10288,
20110,
8496,
1012,
6611,
1006,
2171,
1010,
9262,
8663,
16874,
2545,
1012,
4632,
25015,
8569,
12494,
1006,
27448,
1012,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.getNodeListByXPath | public static NodeList getNodeListByXPath(String expression, Object source) {
return (NodeList) getByXPath(expression, source, XPathConstants.NODESET);
} | java | public static NodeList getNodeListByXPath(String expression, Object source) {
return (NodeList) getByXPath(expression, source, XPathConstants.NODESET);
} | [
"public",
"static",
"NodeList",
"getNodeListByXPath",
"(",
"String",
"expression",
",",
"Object",
"source",
")",
"{",
"return",
"(",
"NodeList",
")",
"getByXPath",
"(",
"expression",
",",
"source",
",",
"XPathConstants",
".",
"NODESET",
")",
";",
"}"
] | 通过XPath方式读取XML的NodeList<br>
Xpath相关文章:https://www.ibm.com/developerworks/cn/xml/x-javaxpathapi.html
@param expression XPath表达式
@param source 资源,可以是Docunent、Node节点等
@return NodeList
@since 4.0.9 | [
"通过XPath方式读取XML的NodeList<br",
">",
"Xpath相关文章:https",
":",
"//",
"www",
".",
"ibm",
".",
"com",
"/",
"developerworks",
"/",
"cn",
"/",
"xml",
"/",
"x",
"-",
"javaxpathapi",
".",
"html"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L585-L587 | train | Get NodeList by XPath | [
30522,
2270,
10763,
13045,
9863,
2131,
3630,
9247,
2923,
3762,
2595,
15069,
1006,
5164,
3670,
1010,
4874,
3120,
1007,
1063,
2709,
1006,
13045,
9863,
1007,
2131,
3762,
2595,
15069,
1006,
3670,
1010,
3120,
1010,
26726,
8988,
8663,
12693,
3215... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java | Wrapper.wrap | public Condition[] wrap(Condition... conditions){
final Condition[] clonedConditions = new Condition[conditions.length];
if(ArrayUtil.isNotEmpty(conditions)) {
Condition clonedCondition;
for(int i = 0; i < conditions.length; i++) {
clonedCondition = conditions[i].clone();
clonedCondition.setField(wrap(clonedCondition.getField()));
clonedConditions[i] = clonedCondition;
}
}
return clonedConditions;
} | java | public Condition[] wrap(Condition... conditions){
final Condition[] clonedConditions = new Condition[conditions.length];
if(ArrayUtil.isNotEmpty(conditions)) {
Condition clonedCondition;
for(int i = 0; i < conditions.length; i++) {
clonedCondition = conditions[i].clone();
clonedCondition.setField(wrap(clonedCondition.getField()));
clonedConditions[i] = clonedCondition;
}
}
return clonedConditions;
} | [
"public",
"Condition",
"[",
"]",
"wrap",
"(",
"Condition",
"...",
"conditions",
")",
"{",
"final",
"Condition",
"[",
"]",
"clonedConditions",
"=",
"new",
"Condition",
"[",
"conditions",
".",
"length",
"]",
";",
"if",
"(",
"ArrayUtil",
".",
"isNotEmpty",
"(... | 包装字段名<br>
有时字段与SQL的某些关键字冲突,导致SQL出错,因此需要将字段名用单引号或者反引号包装起来,避免冲突
@param conditions 被包装的实体
@return 包装后的字段名 | [
"包装字段名<br",
">",
"有时字段与SQL的某些关键字冲突,导致SQL出错,因此需要将字段名用单引号或者反引号包装起来,避免冲突"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java#L176-L188 | train | Creates a deep copy of the given conditions. | [
30522,
2270,
4650,
1031,
1033,
10236,
1006,
4650,
1012,
1012,
1012,
3785,
1007,
1063,
2345,
4650,
1031,
1033,
17598,
16409,
15422,
22753,
30524,
2100,
1006,
3785,
1007,
1007,
1063,
4650,
17598,
16409,
15422,
22753,
1025,
2005,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostStandardRequestDecoder.java | HttpPostStandardRequestDecoder.addHttpData | protected void addHttpData(InterfaceHttpData data) {
if (data == null) {
return;
}
List<InterfaceHttpData> datas = bodyMapHttpData.get(data.getName());
if (datas == null) {
datas = new ArrayList<InterfaceHttpData>(1);
bodyMapHttpData.put(data.getName(), datas);
}
datas.add(data);
bodyListHttpData.add(data);
} | java | protected void addHttpData(InterfaceHttpData data) {
if (data == null) {
return;
}
List<InterfaceHttpData> datas = bodyMapHttpData.get(data.getName());
if (datas == null) {
datas = new ArrayList<InterfaceHttpData>(1);
bodyMapHttpData.put(data.getName(), datas);
}
datas.add(data);
bodyListHttpData.add(data);
} | [
"protected",
"void",
"addHttpData",
"(",
"InterfaceHttpData",
"data",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"return",
";",
"}",
"List",
"<",
"InterfaceHttpData",
">",
"datas",
"=",
"bodyMapHttpData",
".",
"get",
"(",
"data",
".",
"getName",
... | Utility function to add a new decoded data | [
"Utility",
"function",
"to",
"add",
"a",
"new",
"decoded",
"data"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostStandardRequestDecoder.java#L366-L377 | train | Add a HTTP data to the exception. | [
30522,
5123,
11675,
5587,
11039,
25856,
2850,
2696,
1006,
8278,
11039,
25856,
2850,
2696,
2951,
1007,
1063,
2065,
1006,
2951,
1027,
1027,
19701,
1007,
1063,
2709,
1025,
1065,
2862,
1026,
8278,
11039,
25856,
2850,
2696,
1028,
2951,
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... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/UnsortedGrouping.java | UnsortedGrouping.sum | public AggregateOperator<T> sum (int field) {
return this.aggregate (Aggregations.SUM, field, Utils.getCallLocationName());
} | java | public AggregateOperator<T> sum (int field) {
return this.aggregate (Aggregations.SUM, field, Utils.getCallLocationName());
} | [
"public",
"AggregateOperator",
"<",
"T",
">",
"sum",
"(",
"int",
"field",
")",
"{",
"return",
"this",
".",
"aggregate",
"(",
"Aggregations",
".",
"SUM",
",",
"field",
",",
"Utils",
".",
"getCallLocationName",
"(",
")",
")",
";",
"}"
] | Syntactic sugar for aggregate (SUM, field).
@param field The index of the Tuple field on which the aggregation function is applied.
@return An AggregateOperator that represents the summed DataSet.
@see org.apache.flink.api.java.operators.AggregateOperator | [
"Syntactic",
"sugar",
"for",
"aggregate",
"(",
"SUM",
"field",
")",
".",
"@param",
"field",
"The",
"index",
"of",
"the",
"Tuple",
"field",
"on",
"which",
"the",
"aggregation",
"function",
"is",
"applied",
".",
"@return",
"An",
"AggregateOperator",
"that",
"r... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/UnsortedGrouping.java#L103-L105 | train | Create an aggregate that aggregates the results of a query on the specified field using the sum function. | [
30522,
2270,
9572,
25918,
8844,
1026,
1056,
1028,
7680,
1006,
20014,
2492,
1007,
1063,
2709,
2023,
1012,
9572,
1006,
28041,
2015,
1012,
7680,
1010,
2492,
1010,
21183,
12146,
1012,
2131,
9289,
7174,
10719,
18442,
1006,
1007,
1007,
1025,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java | AbstractFilterRegistrationBean.setServletNames | public void setServletNames(Collection<String> servletNames) {
Assert.notNull(servletNames, "ServletNames must not be null");
this.servletNames = new LinkedHashSet<>(servletNames);
} | java | public void setServletNames(Collection<String> servletNames) {
Assert.notNull(servletNames, "ServletNames must not be null");
this.servletNames = new LinkedHashSet<>(servletNames);
} | [
"public",
"void",
"setServletNames",
"(",
"Collection",
"<",
"String",
">",
"servletNames",
")",
"{",
"Assert",
".",
"notNull",
"(",
"servletNames",
",",
"\"ServletNames must not be null\"",
")",
";",
"this",
".",
"servletNames",
"=",
"new",
"LinkedHashSet",
"<>",... | Set servlet names that the filter will be registered against. This will replace any
previously specified servlet names.
@param servletNames the servlet names
@see #setServletRegistrationBeans
@see #setUrlPatterns | [
"Set",
"servlet",
"names",
"that",
"the",
"filter",
"will",
"be",
"registered",
"against",
".",
"This",
"will",
"replace",
"any",
"previously",
"specified",
"servlet",
"names",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java#L112-L115 | train | Sets the servlet names. | [
30522,
2270,
11675,
4520,
2121,
2615,
7485,
18442,
2015,
1006,
3074,
1026,
5164,
1028,
14262,
2615,
7485,
18442,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
14262,
2615,
7485,
18442,
2015,
1010,
1000,
14262,
2615,
7485,
18442,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/io/LocatableInputSplitAssigner.java | LocatableInputSplitAssigner.getNextInputSplit | @Override
public LocatableInputSplit getNextInputSplit(String host, int taskId) {
// for a null host, we return a remote split
if (host == null) {
synchronized (this.remoteSplitChooser) {
synchronized (this.unassigned) {
LocatableInputSplitWithCount split = this.remoteSplitChooser.getNextUnassignedMinLocalCountSplit(this.unassigned);
if (split != null) {
// got a split to assign. Double check that it hasn't been assigned before.
if (this.unassigned.remove(split)) {
if (LOG.isInfoEnabled()) {
LOG.info("Assigning split to null host (random assignment).");
}
remoteAssignments++;
return split.getSplit();
} else {
throw new IllegalStateException("Chosen InputSplit has already been assigned. This should not happen!");
}
} else {
// all splits consumed
if (LOG.isDebugEnabled()) {
LOG.debug("No more unassigned input splits remaining.");
}
return null;
}
}
}
}
host = host.toLowerCase(Locale.US);
// for any non-null host, we take the list of non-null splits
LocatableInputSplitChooser localSplits = this.localPerHost.get(host);
// if we have no list for this host yet, create one
if (localSplits == null) {
localSplits = new LocatableInputSplitChooser();
// lock the list, to be sure that others have to wait for that host's local list
synchronized (localSplits) {
LocatableInputSplitChooser prior = this.localPerHost.putIfAbsent(host, localSplits);
// if someone else beat us in the case to create this list, then we do not populate this one, but
// simply work with that other list
if (prior == null) {
// we are the first, we populate
// first, copy the remaining splits to release the lock on the set early
// because that is shared among threads
LocatableInputSplitWithCount[] remaining;
synchronized (this.unassigned) {
remaining = this.unassigned.toArray(new LocatableInputSplitWithCount[this.unassigned.size()]);
}
for (LocatableInputSplitWithCount isw : remaining) {
if (isLocal(host, isw.getSplit().getHostnames())) {
// Split is local on host.
// Increment local count
isw.incrementLocalCount();
// and add to local split list
localSplits.addInputSplit(isw);
}
}
}
else {
// someone else was faster
localSplits = prior;
}
}
}
// at this point, we have a list of local splits (possibly empty)
// we need to make sure no one else operates in the current list (that protects against
// list creation races) and that the unassigned set is consistent
// NOTE: we need to obtain the locks in this order, strictly!!!
synchronized (localSplits) {
synchronized (this.unassigned) {
LocatableInputSplitWithCount split = localSplits.getNextUnassignedMinLocalCountSplit(this.unassigned);
if (split != null) {
// found a valid split. Double check that it hasn't been assigned before.
if (this.unassigned.remove(split)) {
if (LOG.isInfoEnabled()) {
LOG.info("Assigning local split to host " + host);
}
localAssignments++;
return split.getSplit();
} else {
throw new IllegalStateException("Chosen InputSplit has already been assigned. This should not happen!");
}
}
}
}
// we did not find a local split, return a remote split
synchronized (this.remoteSplitChooser) {
synchronized (this.unassigned) {
LocatableInputSplitWithCount split = this.remoteSplitChooser.getNextUnassignedMinLocalCountSplit(this.unassigned);
if (split != null) {
// found a valid split. Double check that it hasn't been assigned yet.
if (this.unassigned.remove(split)) {
if (LOG.isInfoEnabled()) {
LOG.info("Assigning remote split to host " + host);
}
remoteAssignments++;
return split.getSplit();
} else {
throw new IllegalStateException("Chosen InputSplit has already been assigned. This should not happen!");
}
} else {
// all splits consumed
if (LOG.isDebugEnabled()) {
LOG.debug("No more input splits remaining.");
}
return null;
}
}
}
} | java | @Override
public LocatableInputSplit getNextInputSplit(String host, int taskId) {
// for a null host, we return a remote split
if (host == null) {
synchronized (this.remoteSplitChooser) {
synchronized (this.unassigned) {
LocatableInputSplitWithCount split = this.remoteSplitChooser.getNextUnassignedMinLocalCountSplit(this.unassigned);
if (split != null) {
// got a split to assign. Double check that it hasn't been assigned before.
if (this.unassigned.remove(split)) {
if (LOG.isInfoEnabled()) {
LOG.info("Assigning split to null host (random assignment).");
}
remoteAssignments++;
return split.getSplit();
} else {
throw new IllegalStateException("Chosen InputSplit has already been assigned. This should not happen!");
}
} else {
// all splits consumed
if (LOG.isDebugEnabled()) {
LOG.debug("No more unassigned input splits remaining.");
}
return null;
}
}
}
}
host = host.toLowerCase(Locale.US);
// for any non-null host, we take the list of non-null splits
LocatableInputSplitChooser localSplits = this.localPerHost.get(host);
// if we have no list for this host yet, create one
if (localSplits == null) {
localSplits = new LocatableInputSplitChooser();
// lock the list, to be sure that others have to wait for that host's local list
synchronized (localSplits) {
LocatableInputSplitChooser prior = this.localPerHost.putIfAbsent(host, localSplits);
// if someone else beat us in the case to create this list, then we do not populate this one, but
// simply work with that other list
if (prior == null) {
// we are the first, we populate
// first, copy the remaining splits to release the lock on the set early
// because that is shared among threads
LocatableInputSplitWithCount[] remaining;
synchronized (this.unassigned) {
remaining = this.unassigned.toArray(new LocatableInputSplitWithCount[this.unassigned.size()]);
}
for (LocatableInputSplitWithCount isw : remaining) {
if (isLocal(host, isw.getSplit().getHostnames())) {
// Split is local on host.
// Increment local count
isw.incrementLocalCount();
// and add to local split list
localSplits.addInputSplit(isw);
}
}
}
else {
// someone else was faster
localSplits = prior;
}
}
}
// at this point, we have a list of local splits (possibly empty)
// we need to make sure no one else operates in the current list (that protects against
// list creation races) and that the unassigned set is consistent
// NOTE: we need to obtain the locks in this order, strictly!!!
synchronized (localSplits) {
synchronized (this.unassigned) {
LocatableInputSplitWithCount split = localSplits.getNextUnassignedMinLocalCountSplit(this.unassigned);
if (split != null) {
// found a valid split. Double check that it hasn't been assigned before.
if (this.unassigned.remove(split)) {
if (LOG.isInfoEnabled()) {
LOG.info("Assigning local split to host " + host);
}
localAssignments++;
return split.getSplit();
} else {
throw new IllegalStateException("Chosen InputSplit has already been assigned. This should not happen!");
}
}
}
}
// we did not find a local split, return a remote split
synchronized (this.remoteSplitChooser) {
synchronized (this.unassigned) {
LocatableInputSplitWithCount split = this.remoteSplitChooser.getNextUnassignedMinLocalCountSplit(this.unassigned);
if (split != null) {
// found a valid split. Double check that it hasn't been assigned yet.
if (this.unassigned.remove(split)) {
if (LOG.isInfoEnabled()) {
LOG.info("Assigning remote split to host " + host);
}
remoteAssignments++;
return split.getSplit();
} else {
throw new IllegalStateException("Chosen InputSplit has already been assigned. This should not happen!");
}
} else {
// all splits consumed
if (LOG.isDebugEnabled()) {
LOG.debug("No more input splits remaining.");
}
return null;
}
}
}
} | [
"@",
"Override",
"public",
"LocatableInputSplit",
"getNextInputSplit",
"(",
"String",
"host",
",",
"int",
"taskId",
")",
"{",
"// for a null host, we return a remote split",
"if",
"(",
"host",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
".",
"remoteSplitCho... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/LocatableInputSplitAssigner.java#L77-L205 | train | Get the next input split for the given host. | [
30522,
1030,
2058,
15637,
2270,
8840,
11266,
3085,
2378,
18780,
13102,
15909,
2131,
2638,
18413,
2378,
18780,
13102,
15909,
1006,
5164,
3677,
1010,
20014,
4708,
3593,
1007,
1063,
1013,
1013,
2005,
1037,
19701,
3677,
1010,
2057,
2709,
1037,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.