repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java | TomcatServletWebServerFactory.setContextValves | public void setContextValves(Collection<? extends Valve> contextValves) {
Assert.notNull(contextValves, "Valves must not be null");
this.contextValves = new ArrayList<>(contextValves);
} | java | public void setContextValves(Collection<? extends Valve> contextValves) {
Assert.notNull(contextValves, "Valves must not be null");
this.contextValves = new ArrayList<>(contextValves);
} | [
"public",
"void",
"setContextValves",
"(",
"Collection",
"<",
"?",
"extends",
"Valve",
">",
"contextValves",
")",
"{",
"Assert",
".",
"notNull",
"(",
"contextValves",
",",
"\"Valves must not be null\"",
")",
";",
"this",
".",
"contextValves",
"=",
"new",
"ArrayL... | Set {@link Valve}s that should be applied to the Tomcat {@link Context}. Calling
this method will replace any existing valves.
@param contextValves the valves to set | [
"Set",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java#L521-L524 | train | Sets the context valves. | [
30522,
2270,
11675,
2275,
8663,
18209,
10175,
6961,
1006,
3074,
1026,
1029,
8908,
10764,
1028,
6123,
10175,
6961,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
6123,
10175,
6961,
1010,
1000,
17355,
2442,
2025,
2022,
19701,
1000,
1007,
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... |
alibaba/canal | common/src/main/java/com/alibaba/otter/canal/common/utils/CommonUtils.java | CommonUtils.deleteDir | public static boolean deleteDir(File dirFile) {
if (!dirFile.exists()) {
return false;
}
if (dirFile.isFile()) {
return dirFile.delete();
} else {
File[] files = dirFile.listFiles();
if (files == null || files.length == 0) {
return dirFile.delete();
}
for (File file : files) {
deleteDir(file);
}
}
return dirFile.delete();
} | java | public static boolean deleteDir(File dirFile) {
if (!dirFile.exists()) {
return false;
}
if (dirFile.isFile()) {
return dirFile.delete();
} else {
File[] files = dirFile.listFiles();
if (files == null || files.length == 0) {
return dirFile.delete();
}
for (File file : files) {
deleteDir(file);
}
}
return dirFile.delete();
} | [
"public",
"static",
"boolean",
"deleteDir",
"(",
"File",
"dirFile",
")",
"{",
"if",
"(",
"!",
"dirFile",
".",
"exists",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"dirFile",
".",
"isFile",
"(",
")",
")",
"{",
"return",
"dirFile",
"... | 删除文件夹
@param dirFile 文件夹对象
@return 是否删除成功 | [
"删除文件夹"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/common/src/main/java/com/alibaba/otter/canal/common/utils/CommonUtils.java#L34-L52 | train | Delete a directory. | [
30522,
2270,
10763,
22017,
20898,
17159,
4313,
1006,
5371,
16101,
8873,
2571,
1007,
1063,
2065,
1006,
999,
16101,
8873,
2571,
1012,
6526,
1006,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
16101,
8873,
2571,
1012,
2003,
8873,
2571,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java | CommandBuilderUtils.checkState | static void checkState(boolean check, String msg, Object... args) {
if (!check) {
throw new IllegalStateException(String.format(msg, args));
}
} | java | static void checkState(boolean check, String msg, Object... args) {
if (!check) {
throw new IllegalStateException(String.format(msg, args));
}
} | [
"static",
"void",
"checkState",
"(",
"boolean",
"check",
",",
"String",
"msg",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"!",
"check",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
"format",
"(",
"msg",
",",
"args",
")... | Throws IllegalStateException with the given message if the check is false. | [
"Throws",
"IllegalStateException",
"with",
"the",
"given",
"message",
"if",
"the",
"check",
"is",
"false",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L226-L230 | train | Check if a check is true. | [
30522,
10763,
11675,
14148,
12259,
1006,
22017,
20898,
4638,
1010,
5164,
5796,
2290,
1010,
4874,
1012,
1012,
1012,
12098,
5620,
1007,
1063,
2065,
1006,
999,
4638,
1007,
1063,
5466,
2047,
6206,
9153,
17389,
2595,
24422,
1006,
5164,
1012,
428... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/utils/ParquetSchemaConverter.java | ParquetSchemaConverter.toParquetType | public static MessageType toParquetType(TypeInformation<?> typeInformation, boolean legacyMode) {
return (MessageType) convertField(null, typeInformation, Type.Repetition.OPTIONAL, legacyMode);
} | java | public static MessageType toParquetType(TypeInformation<?> typeInformation, boolean legacyMode) {
return (MessageType) convertField(null, typeInformation, Type.Repetition.OPTIONAL, legacyMode);
} | [
"public",
"static",
"MessageType",
"toParquetType",
"(",
"TypeInformation",
"<",
"?",
">",
"typeInformation",
",",
"boolean",
"legacyMode",
")",
"{",
"return",
"(",
"MessageType",
")",
"convertField",
"(",
"null",
",",
"typeInformation",
",",
"Type",
".",
"Repet... | Converts Flink Internal Type to Parquet schema.
@param typeInformation Flink type information
@param legacyMode is standard LIST and MAP schema or back-compatible schema
@return Parquet schema | [
"Converts",
"Flink",
"Internal",
"Type",
"to",
"Parquet",
"schema",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/utils/ParquetSchemaConverter.java#L70-L72 | train | Converts a Parquet type to a Java type. | [
30522,
2270,
10763,
4471,
13874,
2327,
2906,
12647,
13874,
1006,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
2828,
2378,
14192,
3370,
1010,
22017,
20898,
8027,
5302,
3207,
1007,
1063,
2709,
1006,
4471,
13874,
1007,
10463,
3790,
1006,
19701,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport-native-unix-common/src/main/java/io/netty/channel/unix/FileDescriptor.java | FileDescriptor.from | public static FileDescriptor from(String path) throws IOException {
checkNotNull(path, "path");
int res = open(path);
if (res < 0) {
throw newIOException("open", res);
}
return new FileDescriptor(res);
} | java | public static FileDescriptor from(String path) throws IOException {
checkNotNull(path, "path");
int res = open(path);
if (res < 0) {
throw newIOException("open", res);
}
return new FileDescriptor(res);
} | [
"public",
"static",
"FileDescriptor",
"from",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"path",
",",
"\"path\"",
")",
";",
"int",
"res",
"=",
"open",
"(",
"path",
")",
";",
"if",
"(",
"res",
"<",
"0",
")",
"{",
"t... | Open a new {@link FileDescriptor} for the given path. | [
"Open",
"a",
"new",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-unix-common/src/main/java/io/netty/channel/unix/FileDescriptor.java#L208-L215 | train | Gets a FileDescriptor from the specified path. | [
30522,
2270,
10763,
6406,
2229,
23235,
2953,
2013,
1006,
5164,
4130,
1007,
11618,
22834,
10288,
24422,
1063,
4638,
17048,
11231,
3363,
1006,
4130,
1010,
1000,
4130,
1000,
1007,
1025,
20014,
24501,
1027,
2330,
1006,
4130,
1007,
1025,
2065,
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-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.getString | public static String getString(byte[] contentBytes, Charset charset, boolean isGetCharsetFromContent) throws IOException {
if (null == contentBytes) {
return null;
}
if (null == charset) {
charset = CharsetUtil.CHARSET_UTF_8;
}
String content = new String(contentBytes, charset);
if (isGetCharsetFromContent) {
final String charsetInContentStr = ReUtil.get(META_CHARSET_PATTERN, content, 1);
if (StrUtil.isNotBlank(charsetInContentStr)) {
Charset charsetInContent = null;
try {
charsetInContent = Charset.forName(charsetInContentStr);
} catch (Exception e) {
if (StrUtil.containsIgnoreCase(charsetInContentStr, "utf-8") || StrUtil.containsIgnoreCase(charsetInContentStr, "utf8")) {
charsetInContent = CharsetUtil.CHARSET_UTF_8;
} else if (StrUtil.containsIgnoreCase(charsetInContentStr, "gbk")) {
charsetInContent = CharsetUtil.CHARSET_GBK;
}
// ignore
}
if (null != charsetInContent && false == charset.equals(charsetInContent)) {
content = new String(contentBytes, charsetInContent);
}
}
}
return content;
} | java | public static String getString(byte[] contentBytes, Charset charset, boolean isGetCharsetFromContent) throws IOException {
if (null == contentBytes) {
return null;
}
if (null == charset) {
charset = CharsetUtil.CHARSET_UTF_8;
}
String content = new String(contentBytes, charset);
if (isGetCharsetFromContent) {
final String charsetInContentStr = ReUtil.get(META_CHARSET_PATTERN, content, 1);
if (StrUtil.isNotBlank(charsetInContentStr)) {
Charset charsetInContent = null;
try {
charsetInContent = Charset.forName(charsetInContentStr);
} catch (Exception e) {
if (StrUtil.containsIgnoreCase(charsetInContentStr, "utf-8") || StrUtil.containsIgnoreCase(charsetInContentStr, "utf8")) {
charsetInContent = CharsetUtil.CHARSET_UTF_8;
} else if (StrUtil.containsIgnoreCase(charsetInContentStr, "gbk")) {
charsetInContent = CharsetUtil.CHARSET_GBK;
}
// ignore
}
if (null != charsetInContent && false == charset.equals(charsetInContent)) {
content = new String(contentBytes, charsetInContent);
}
}
}
return content;
} | [
"public",
"static",
"String",
"getString",
"(",
"byte",
"[",
"]",
"contentBytes",
",",
"Charset",
"charset",
",",
"boolean",
"isGetCharsetFromContent",
")",
"throws",
"IOException",
"{",
"if",
"(",
"null",
"==",
"contentBytes",
")",
"{",
"return",
"null",
";",... | 从流中读取内容<br>
首先尝试使用charset编码读取内容(如果为空默认UTF-8),如果isGetCharsetFromContent为true,则通过正则在正文中获取编码信息,转换为指定编码;
@param contentBytes 内容byte数组
@param charset 字符集
@param isGetCharsetFromContent 是否从返回内容中获得编码信息
@return 内容
@throws IOException IO异常 | [
"从流中读取内容<br",
">",
"首先尝试使用charset编码读取内容(如果为空默认UTF",
"-",
"8),如果isGetCharsetFromContent为true,则通过正则在正文中获取编码信息,转换为指定编码;"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L694-L723 | train | Gets the string from the byte array. | [
30522,
2270,
10763,
5164,
4152,
18886,
3070,
1006,
24880,
1031,
1033,
4180,
3762,
4570,
1010,
25869,
13462,
25869,
13462,
1010,
22017,
20898,
2003,
18150,
7507,
22573,
24475,
21716,
8663,
6528,
2102,
1007,
11618,
22834,
10288,
24422,
1063,
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... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBuffer.java | SharedBuffer.upsertEvent | void upsertEvent(EventId eventId, Lockable<V> event) {
this.eventsBufferCache.put(eventId, event);
} | java | void upsertEvent(EventId eventId, Lockable<V> event) {
this.eventsBufferCache.put(eventId, event);
} | [
"void",
"upsertEvent",
"(",
"EventId",
"eventId",
",",
"Lockable",
"<",
"V",
">",
"event",
")",
"{",
"this",
".",
"eventsBufferCache",
".",
"put",
"(",
"eventId",
",",
"event",
")",
";",
"}"
] | Inserts or updates an event in cache.
@param eventId id of the event
@param event event body | [
"Inserts",
"or",
"updates",
"an",
"event",
"in",
"cache",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBuffer.java#L162-L164 | train | Upsert an event in the cache. | [
30522,
11675,
11139,
8743,
18697,
3372,
1006,
2724,
3593,
2724,
3593,
1010,
5843,
3085,
1026,
1058,
1028,
2724,
1007,
1063,
2023,
1012,
2824,
8569,
12494,
3540,
5403,
1012,
2404,
1006,
2724,
3593,
1010,
2724,
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... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getUint16 | public final int getUint16() {
if (position + 1 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 1));
byte[] buf = buffer;
return (0xff & buf[position++]) | ((0xff & buf[position++]) << 8);
} | java | public final int getUint16() {
if (position + 1 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 1));
byte[] buf = buffer;
return (0xff & buf[position++]) | ((0xff & buf[position++]) << 8);
} | [
"public",
"final",
"int",
"getUint16",
"(",
")",
"{",
"if",
"(",
"position",
"+",
"1",
">=",
"origin",
"+",
"limit",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"(",
"position",
"-",
"origin",
"+",
"1",
")",
")",
";"... | Return next 16-bit unsigned int from buffer. (little-endian)
@see mysql-5.1.60/include/my_global.h - uint2korr | [
"Return",
"next",
"16",
"-",
"bit",
"unsigned",
"int",
"from",
"buffer",
".",
"(",
"little",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L288-L294 | train | Gets a 16 - bit unsigned integer from the buffer. | [
30522,
2270,
2345,
20014,
2131,
20023,
2102,
16048,
1006,
1007,
1063,
2065,
1006,
2597,
1009,
1015,
1028,
1027,
4761,
1009,
5787,
1007,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
5787,
4654,
9468,
13089,
1024,
1000,
1009... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java | WebSocketServerHandshakerFactory.newHandshaker | public WebSocketServerHandshaker newHandshaker(HttpRequest req) {
CharSequence version = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_VERSION);
if (version != null) {
if (version.equals(WebSocketVersion.V13.toHttpHeaderValue())) {
// Version 13 of the wire protocol - RFC 6455 (version 17 of the draft hybi specification).
return new WebSocketServerHandshaker13(
webSocketURL, subprotocols, allowExtensions, maxFramePayloadLength, allowMaskMismatch);
} else if (version.equals(WebSocketVersion.V08.toHttpHeaderValue())) {
// Version 8 of the wire protocol - version 10 of the draft hybi specification.
return new WebSocketServerHandshaker08(
webSocketURL, subprotocols, allowExtensions, maxFramePayloadLength, allowMaskMismatch);
} else if (version.equals(WebSocketVersion.V07.toHttpHeaderValue())) {
// Version 8 of the wire protocol - version 07 of the draft hybi specification.
return new WebSocketServerHandshaker07(
webSocketURL, subprotocols, allowExtensions, maxFramePayloadLength, allowMaskMismatch);
} else {
return null;
}
} else {
// Assume version 00 where version header was not specified
return new WebSocketServerHandshaker00(webSocketURL, subprotocols, maxFramePayloadLength);
}
} | java | public WebSocketServerHandshaker newHandshaker(HttpRequest req) {
CharSequence version = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_VERSION);
if (version != null) {
if (version.equals(WebSocketVersion.V13.toHttpHeaderValue())) {
// Version 13 of the wire protocol - RFC 6455 (version 17 of the draft hybi specification).
return new WebSocketServerHandshaker13(
webSocketURL, subprotocols, allowExtensions, maxFramePayloadLength, allowMaskMismatch);
} else if (version.equals(WebSocketVersion.V08.toHttpHeaderValue())) {
// Version 8 of the wire protocol - version 10 of the draft hybi specification.
return new WebSocketServerHandshaker08(
webSocketURL, subprotocols, allowExtensions, maxFramePayloadLength, allowMaskMismatch);
} else if (version.equals(WebSocketVersion.V07.toHttpHeaderValue())) {
// Version 8 of the wire protocol - version 07 of the draft hybi specification.
return new WebSocketServerHandshaker07(
webSocketURL, subprotocols, allowExtensions, maxFramePayloadLength, allowMaskMismatch);
} else {
return null;
}
} else {
// Assume version 00 where version header was not specified
return new WebSocketServerHandshaker00(webSocketURL, subprotocols, maxFramePayloadLength);
}
} | [
"public",
"WebSocketServerHandshaker",
"newHandshaker",
"(",
"HttpRequest",
"req",
")",
"{",
"CharSequence",
"version",
"=",
"req",
".",
"headers",
"(",
")",
".",
"get",
"(",
"HttpHeaderNames",
".",
"SEC_WEBSOCKET_VERSION",
")",
";",
"if",
"(",
"version",
"!=",
... | Instances a new handshaker
@return A new WebSocketServerHandshaker for the requested web socket version. Null if web
socket version is not supported. | [
"Instances",
"a",
"new",
"handshaker"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshakerFactory.java#L114-L137 | train | New handshaker implementation. | [
30522,
2270,
4773,
6499,
19869,
3215,
2121,
6299,
11774,
7377,
5484,
2047,
11774,
7377,
5484,
1006,
8299,
2890,
15500,
2128,
4160,
1007,
1063,
25869,
3366,
4226,
5897,
2544,
1027,
2128,
4160,
1012,
20346,
2015,
1006,
1007,
1012,
2131,
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-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/StringValueArray.java | StringValueArray.initialize | private void initialize(int bytes) {
Preconditions.checkArgument(bytes > 0, "Requested array with zero capacity");
Preconditions.checkArgument(bytes <= MAX_ARRAY_SIZE, "Requested capacity exceeds limit of " + MAX_ARRAY_SIZE);
data = new byte[bytes];
} | java | private void initialize(int bytes) {
Preconditions.checkArgument(bytes > 0, "Requested array with zero capacity");
Preconditions.checkArgument(bytes <= MAX_ARRAY_SIZE, "Requested capacity exceeds limit of " + MAX_ARRAY_SIZE);
data = new byte[bytes];
} | [
"private",
"void",
"initialize",
"(",
"int",
"bytes",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"bytes",
">",
"0",
",",
"\"Requested array with zero capacity\"",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"bytes",
"<=",
"MAX_ARRAY_SIZE",
","... | Initializes the array with the provided number of bytes.
@param bytes initial size of the encapsulated array in bytes | [
"Initializes",
"the",
"array",
"with",
"the",
"provided",
"number",
"of",
"bytes",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/StringValueArray.java#L106-L111 | train | Initializes the internal data array with the requested size. | [
30522,
2797,
11675,
3988,
4697,
1006,
20014,
27507,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
27507,
1028,
1014,
1010,
1000,
7303,
9140,
2007,
5717,
3977,
1000,
1007,
1025,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java | JSONArray.getInt | public int getInt(int index) throws JSONException {
Object object = get(index);
Integer result = JSON.toInteger(object);
if (result == null) {
throw JSON.typeMismatch(index, object, "int");
}
return result;
} | java | public int getInt(int index) throws JSONException {
Object object = get(index);
Integer result = JSON.toInteger(object);
if (result == null) {
throw JSON.typeMismatch(index, object, "int");
}
return result;
} | [
"public",
"int",
"getInt",
"(",
"int",
"index",
")",
"throws",
"JSONException",
"{",
"Object",
"object",
"=",
"get",
"(",
"index",
")",
";",
"Integer",
"result",
"=",
"JSON",
".",
"toInteger",
"(",
"object",
")",
";",
"if",
"(",
"result",
"==",
"null",... | Returns the value at {@code index} if it exists and is an int or can be coerced to
an int.
@param index the index to get the value from
@return the {@code value}
@throws JSONException if the value at {@code index} doesn't exist or cannot be
coerced to an int. | [
"Returns",
"the",
"value",
"at",
"{"
] | 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/JSONArray.java#L410-L417 | train | Get the int value associated with an index. | [
30522,
2270,
20014,
2131,
18447,
1006,
20014,
5950,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
4874,
4874,
1027,
2131,
1006,
5950,
1007,
1025,
16109,
2765,
1027,
1046,
3385,
1012,
2000,
18447,
26320,
1006,
4874,
1007,
1025,
2065,
1006,
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... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslHandler.java | SslHandler.isEncrypted | public static boolean isEncrypted(ByteBuf buffer) {
if (buffer.readableBytes() < SslUtils.SSL_RECORD_HEADER_LENGTH) {
throw new IllegalArgumentException(
"buffer must have at least " + SslUtils.SSL_RECORD_HEADER_LENGTH + " readable bytes");
}
return getEncryptedPacketLength(buffer, buffer.readerIndex()) != SslUtils.NOT_ENCRYPTED;
} | java | public static boolean isEncrypted(ByteBuf buffer) {
if (buffer.readableBytes() < SslUtils.SSL_RECORD_HEADER_LENGTH) {
throw new IllegalArgumentException(
"buffer must have at least " + SslUtils.SSL_RECORD_HEADER_LENGTH + " readable bytes");
}
return getEncryptedPacketLength(buffer, buffer.readerIndex()) != SslUtils.NOT_ENCRYPTED;
} | [
"public",
"static",
"boolean",
"isEncrypted",
"(",
"ByteBuf",
"buffer",
")",
"{",
"if",
"(",
"buffer",
".",
"readableBytes",
"(",
")",
"<",
"SslUtils",
".",
"SSL_RECORD_HEADER_LENGTH",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"buffer must have ... | Returns {@code true} if the given {@link ByteBuf} is encrypted. Be aware that this method
will not increase the readerIndex of the given {@link ByteBuf}.
@param buffer
The {@link ByteBuf} to read from. Be aware that it must have at least 5 bytes to read,
otherwise it will throw an {@link IllegalArgumentException}.
@return encrypted
{@code true} if the {@link ByteBuf} is encrypted, {@code false} otherwise.
@throws IllegalArgumentException
Is thrown if the given {@link ByteBuf} has not at least 5 bytes to read. | [
"Returns",
"{",
"@code",
"true",
"}",
"if",
"the",
"given",
"{",
"@link",
"ByteBuf",
"}",
"is",
"encrypted",
".",
"Be",
"aware",
"that",
"this",
"method",
"will",
"not",
"increase",
"the",
"readerIndex",
"of",
"the",
"given",
"{",
"@link",
"ByteBuf",
"}"... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslHandler.java#L1181-L1187 | train | Checks if the buffer contains encrypted data. | [
30522,
2270,
10763,
22017,
20898,
2003,
2368,
26775,
22571,
3064,
1006,
24880,
8569,
2546,
17698,
1007,
1063,
2065,
1006,
17698,
1012,
3191,
3085,
3762,
4570,
1006,
1007,
30524,
1000,
3191,
3085,
27507,
1000,
1007,
1025,
1065,
2709,
2131,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/UUIDSet.java | UUIDSet.parse | public static UUIDSet parse(String str) {
String[] ss = str.split(":");
if (ss.length < 2) {
throw new RuntimeException(String.format("parseUUIDSet failed due to wrong format: %s", str));
}
List<Interval> intervals = new ArrayList<Interval>();
for (int i = 1; i < ss.length; i++) {
intervals.add(parseInterval(ss[i]));
}
UUIDSet uuidSet = new UUIDSet();
uuidSet.SID = UUID.fromString(ss[0]);
uuidSet.intervals = combine(intervals);
return uuidSet;
} | java | public static UUIDSet parse(String str) {
String[] ss = str.split(":");
if (ss.length < 2) {
throw new RuntimeException(String.format("parseUUIDSet failed due to wrong format: %s", str));
}
List<Interval> intervals = new ArrayList<Interval>();
for (int i = 1; i < ss.length; i++) {
intervals.add(parseInterval(ss[i]));
}
UUIDSet uuidSet = new UUIDSet();
uuidSet.SID = UUID.fromString(ss[0]);
uuidSet.intervals = combine(intervals);
return uuidSet;
} | [
"public",
"static",
"UUIDSet",
"parse",
"(",
"String",
"str",
")",
"{",
"String",
"[",
"]",
"ss",
"=",
"str",
".",
"split",
"(",
"\":\"",
")",
";",
"if",
"(",
"ss",
".",
"length",
"<",
"2",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"String... | 解析如下格式字符串为UUIDSet: 726757ad-4455-11e8-ae04-0242ac110002:1 => UUIDSet{SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:2}]}
726757ad-4455-11e8-ae04-0242ac110002:1-3 => UUIDSet{SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4}]}
726757ad-4455-11e8-ae04-0242ac110002:1-3:4 UUIDSet{SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:5}]}
726757ad-4455-11e8-ae04-0242ac110002:1-3:7-9 UUIDSet{SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4},
{start:7, stop:10}]}
@param str
@return | [
"解析如下格式字符串为UUIDSet",
":",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
":",
"1",
"=",
">",
"UUIDSet",
"{",
"SID",
":",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
"intervals",
":",
"[",
"{",
"start... | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/UUIDSet.java#L101-L118 | train | Parses a string of UUIDSet format. | [
30522,
2270,
10763,
1057,
21272,
13462,
11968,
3366,
1006,
5164,
2358,
2099,
1007,
1063,
5164,
1031,
1033,
7020,
1027,
2358,
2099,
1012,
3975,
1006,
1000,
1024,
1000,
1007,
1025,
2065,
1006,
7020,
1012,
3091,
1026,
1016,
1007,
1063,
5466,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/types/valuearray/NullValueArray.java | NullValueArray.compareTo | @Override
public int compareTo(ValueArray<NullValue> o) {
NullValueArray other = (NullValueArray) o;
return Integer.compare(position, other.position);
} | java | @Override
public int compareTo(ValueArray<NullValue> o) {
NullValueArray other = (NullValueArray) o;
return Integer.compare(position, other.position);
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"ValueArray",
"<",
"NullValue",
">",
"o",
")",
"{",
"NullValueArray",
"other",
"=",
"(",
"NullValueArray",
")",
"o",
";",
"return",
"Integer",
".",
"compare",
"(",
"position",
",",
"other",
".",
"position... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/NullValueArray.java#L147-L152 | train | Compares two NullValueArrays in ascending order. | [
30522,
1030,
2058,
15637,
2270,
20014,
12826,
3406,
1006,
3643,
2906,
9447,
1026,
19701,
10175,
5657,
1028,
1051,
1007,
1063,
19701,
10175,
5657,
2906,
9447,
2060,
1027,
1006,
19701,
10175,
5657,
2906,
9447,
1007,
1051,
1025,
2709,
16109,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/DeweyNumber.java | DeweyNumber.fromString | public static DeweyNumber fromString(final String deweyNumberString) {
String[] splits = deweyNumberString.split("\\.");
if (splits.length == 0) {
return new DeweyNumber(Integer.parseInt(deweyNumberString));
} else {
int[] deweyNumber = new int[splits.length];
for (int i = 0; i < splits.length; i++) {
deweyNumber[i] = Integer.parseInt(splits[i]);
}
return new DeweyNumber(deweyNumber);
}
} | java | public static DeweyNumber fromString(final String deweyNumberString) {
String[] splits = deweyNumberString.split("\\.");
if (splits.length == 0) {
return new DeweyNumber(Integer.parseInt(deweyNumberString));
} else {
int[] deweyNumber = new int[splits.length];
for (int i = 0; i < splits.length; i++) {
deweyNumber[i] = Integer.parseInt(splits[i]);
}
return new DeweyNumber(deweyNumber);
}
} | [
"public",
"static",
"DeweyNumber",
"fromString",
"(",
"final",
"String",
"deweyNumberString",
")",
"{",
"String",
"[",
"]",
"splits",
"=",
"deweyNumberString",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"if",
"(",
"splits",
".",
"length",
"==",
"0",
")",
"{... | Creates a dewey number from a string representation. The input string must be a dot separated
string of integers.
@param deweyNumberString Dot separated string of integers
@return Dewey number generated from the given input string | [
"Creates",
"a",
"dewey",
"number",
"from",
"a",
"string",
"representation",
".",
"The",
"input",
"string",
"must",
"be",
"a",
"dot",
"separated",
"string",
"of",
"integers",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/DeweyNumber.java#L175-L189 | train | Creates a DeweyNumber from a String. | [
30522,
2270,
10763,
20309,
19172,
5677,
2013,
3367,
4892,
1006,
2345,
5164,
20309,
19172,
17198,
18886,
3070,
1007,
1063,
5164,
1031,
1033,
19584,
1027,
20309,
19172,
17198,
18886,
3070,
1012,
3975,
1006,
1000,
1032,
1032,
1012,
1000,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.pressText | public static void pressText(Image srcImage, File destFile, String pressText, Color color, Font font, int x, int y, float alpha) throws IORuntimeException {
write(pressText(srcImage, pressText, color, font, x, y, alpha), destFile);
} | java | public static void pressText(Image srcImage, File destFile, String pressText, Color color, Font font, int x, int y, float alpha) throws IORuntimeException {
write(pressText(srcImage, pressText, color, font, x, y, alpha), destFile);
} | [
"public",
"static",
"void",
"pressText",
"(",
"Image",
"srcImage",
",",
"File",
"destFile",
",",
"String",
"pressText",
",",
"Color",
"color",
",",
"Font",
"font",
",",
"int",
"x",
",",
"int",
"y",
",",
"float",
"alpha",
")",
"throws",
"IORuntimeException"... | 给图片添加文字水印<br>
此方法并不关闭流
@param srcImage 源图像
@param destFile 目标流
@param pressText 水印文字
@param color 水印的字体颜色
@param font {@link Font} 字体相关信息,如果默认则为{@code null}
@param x 修正值。 默认在中间,偏移量相对于中间偏移
@param y 修正值。 默认在中间,偏移量相对于中间偏移
@param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
@throws IORuntimeException IO异常
@since 3.2.2 | [
"给图片添加文字水印<br",
">",
"此方法并不关闭流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L807-L809 | train | Press text from srcImage to destFile using the specified color font and alpha. | [
30522,
2270,
10763,
11675,
2811,
18209,
1006,
3746,
5034,
6895,
26860,
1010,
5371,
4078,
24475,
9463,
1010,
5164,
2811,
18209,
1010,
3609,
3609,
1010,
15489,
15489,
1010,
20014,
1060,
1010,
30524,
1061,
1010,
6541,
1007,
1010,
4078,
24475,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/service/ESSyncService.java | ESSyncService.insert | private void insert(ESSyncConfig config, Dml dml) {
List<Map<String, Object>> dataList = dml.getData();
if (dataList == null || dataList.isEmpty()) {
return;
}
SchemaItem schemaItem = config.getEsMapping().getSchemaItem();
for (Map<String, Object> data : dataList) {
if (data == null || data.isEmpty()) {
continue;
}
if (schemaItem.getAliasTableItems().size() == 1 && schemaItem.isAllFieldsSimple()) {
// ------单表 & 所有字段都为简单字段------
singleTableSimpleFiledInsert(config, dml, data);
} else {
// ------是主表 查询sql来插入------
if (schemaItem.getMainTable().getTableName().equalsIgnoreCase(dml.getTable())) {
mainTableInsert(config, dml, data);
}
// 从表的操作
for (TableItem tableItem : schemaItem.getAliasTableItems().values()) {
if (tableItem.isMain()) {
continue;
}
if (!tableItem.getTableName().equals(dml.getTable())) {
continue;
}
// 关联条件出现在主表查询条件是否为简单字段
boolean allFieldsSimple = true;
for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) {
if (fieldItem.isMethod() || fieldItem.isBinaryOp()) {
allFieldsSimple = false;
break;
}
}
// 所有查询字段均为简单字段
if (allFieldsSimple) {
// 不是子查询
if (!tableItem.isSubQuery()) {
// ------关联表简单字段插入------
Map<String, Object> esFieldData = new LinkedHashMap<>();
for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) {
Object value = esTemplate.getValFromData(config.getEsMapping(),
data,
fieldItem.getFieldName(),
fieldItem.getColumn().getColumnName());
esFieldData.put(Util.cleanColumn(fieldItem.getFieldName()), value);
}
joinTableSimpleFieldOperation(config, dml, data, tableItem, esFieldData);
} else {
// ------关联子表简单字段插入------
subTableSimpleFieldOperation(config, dml, data, null, tableItem);
}
} else {
// ------关联子表复杂字段插入 执行全sql更新es------
wholeSqlOperation(config, dml, data, null, tableItem);
}
}
}
}
} | java | private void insert(ESSyncConfig config, Dml dml) {
List<Map<String, Object>> dataList = dml.getData();
if (dataList == null || dataList.isEmpty()) {
return;
}
SchemaItem schemaItem = config.getEsMapping().getSchemaItem();
for (Map<String, Object> data : dataList) {
if (data == null || data.isEmpty()) {
continue;
}
if (schemaItem.getAliasTableItems().size() == 1 && schemaItem.isAllFieldsSimple()) {
// ------单表 & 所有字段都为简单字段------
singleTableSimpleFiledInsert(config, dml, data);
} else {
// ------是主表 查询sql来插入------
if (schemaItem.getMainTable().getTableName().equalsIgnoreCase(dml.getTable())) {
mainTableInsert(config, dml, data);
}
// 从表的操作
for (TableItem tableItem : schemaItem.getAliasTableItems().values()) {
if (tableItem.isMain()) {
continue;
}
if (!tableItem.getTableName().equals(dml.getTable())) {
continue;
}
// 关联条件出现在主表查询条件是否为简单字段
boolean allFieldsSimple = true;
for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) {
if (fieldItem.isMethod() || fieldItem.isBinaryOp()) {
allFieldsSimple = false;
break;
}
}
// 所有查询字段均为简单字段
if (allFieldsSimple) {
// 不是子查询
if (!tableItem.isSubQuery()) {
// ------关联表简单字段插入------
Map<String, Object> esFieldData = new LinkedHashMap<>();
for (FieldItem fieldItem : tableItem.getRelationSelectFieldItems()) {
Object value = esTemplate.getValFromData(config.getEsMapping(),
data,
fieldItem.getFieldName(),
fieldItem.getColumn().getColumnName());
esFieldData.put(Util.cleanColumn(fieldItem.getFieldName()), value);
}
joinTableSimpleFieldOperation(config, dml, data, tableItem, esFieldData);
} else {
// ------关联子表简单字段插入------
subTableSimpleFieldOperation(config, dml, data, null, tableItem);
}
} else {
// ------关联子表复杂字段插入 执行全sql更新es------
wholeSqlOperation(config, dml, data, null, tableItem);
}
}
}
}
} | [
"private",
"void",
"insert",
"(",
"ESSyncConfig",
"config",
",",
"Dml",
"dml",
")",
"{",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"dataList",
"=",
"dml",
".",
"getData",
"(",
")",
";",
"if",
"(",
"dataList",
"==",
"null",
"||",
"... | 插入操作dml
@param config es配置
@param dml dml数据 | [
"插入操作dml"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/service/ESSyncService.java#L123-L185 | train | Insert DML. | [
30522,
2797,
11675,
19274,
1006,
9686,
6508,
12273,
8663,
8873,
2290,
9530,
8873,
2290,
1010,
1040,
19968,
1040,
19968,
1007,
1063,
2862,
1026,
4949,
1026,
5164,
1010,
4874,
1028,
1028,
2951,
9863,
1027,
1040,
19968,
1012,
2131,
2850,
2696,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.down | public TouchActions down(int x, int y) {
if (touchScreen != null) {
action.addAction(new DownAction(touchScreen, x, y));
}
return this;
} | java | public TouchActions down(int x, int y) {
if (touchScreen != null) {
action.addAction(new DownAction(touchScreen, x, y));
}
return this;
} | [
"public",
"TouchActions",
"down",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"if",
"(",
"touchScreen",
"!=",
"null",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"DownAction",
"(",
"touchScreen",
",",
"x",
",",
"y",
")",
")",
";",
"}",
"retur... | Allows the execution of the gesture 'down' on the screen. It is typically the first of a
sequence of touch gestures.
@param x The x coordinate relative to the viewport
@param y The y coordinate relative to the viewport
@return self | [
"Allows",
"the",
"execution",
"of",
"the",
"gesture",
"down",
"on",
"the",
"screen",
".",
"It",
"is",
"typically",
"the",
"first",
"of",
"a",
"sequence",
"of",
"touch",
"gestures",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java#L71-L76 | train | Add a down touch screen action. | [
30522,
2270,
3543,
18908,
8496,
2091,
1006,
20014,
1060,
1010,
20014,
1061,
1007,
1063,
2065,
1006,
3543,
18182,
999,
1027,
19701,
1007,
1063,
2895,
1012,
5587,
18908,
3258,
1006,
2047,
2091,
18908,
3258,
1006,
3543,
18182,
1010,
1060,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/AsynchronousFileIOChannel.java | AsynchronousFileIOChannel.handleProcessedBuffer | final protected void handleProcessedBuffer(T buffer, IOException ex) {
if (buffer == null) {
return;
}
// even if the callbacks throw an error, we need to maintain our bookkeeping
try {
if (ex != null && this.exception == null) {
this.exception = ex;
this.resultHandler.requestFailed(buffer, ex);
}
else {
this.resultHandler.requestSuccessful(buffer);
}
}
finally {
NotificationListener listener = null;
// Decrement the number of outstanding requests. If we are currently closing, notify the
// waiters. If there is a listener, notify her as well.
synchronized (this.closeLock) {
if (this.requestsNotReturned.decrementAndGet() == 0) {
if (this.closed) {
this.closeLock.notifyAll();
}
synchronized (listenerLock) {
listener = allRequestsProcessedListener;
allRequestsProcessedListener = null;
}
}
}
if (listener != null) {
listener.onNotification();
}
}
} | java | final protected void handleProcessedBuffer(T buffer, IOException ex) {
if (buffer == null) {
return;
}
// even if the callbacks throw an error, we need to maintain our bookkeeping
try {
if (ex != null && this.exception == null) {
this.exception = ex;
this.resultHandler.requestFailed(buffer, ex);
}
else {
this.resultHandler.requestSuccessful(buffer);
}
}
finally {
NotificationListener listener = null;
// Decrement the number of outstanding requests. If we are currently closing, notify the
// waiters. If there is a listener, notify her as well.
synchronized (this.closeLock) {
if (this.requestsNotReturned.decrementAndGet() == 0) {
if (this.closed) {
this.closeLock.notifyAll();
}
synchronized (listenerLock) {
listener = allRequestsProcessedListener;
allRequestsProcessedListener = null;
}
}
}
if (listener != null) {
listener.onNotification();
}
}
} | [
"final",
"protected",
"void",
"handleProcessedBuffer",
"(",
"T",
"buffer",
",",
"IOException",
"ex",
")",
"{",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"return",
";",
"}",
"// even if the callbacks throw an error, we need to maintain our bookkeeping",
"try",
"{",
... | Handles a processed <tt>Buffer</tt>. This method is invoked by the
asynchronous IO worker threads upon completion of the IO request with the
provided buffer and/or an exception that occurred while processing the request
for that buffer.
@param buffer The buffer to be processed.
@param ex The exception that occurred in the I/O threads when processing the buffer's request. | [
"Handles",
"a",
"processed",
"<tt",
">",
"Buffer<",
"/",
"tt",
">",
".",
"This",
"method",
"is",
"invoked",
"by",
"the",
"asynchronous",
"IO",
"worker",
"threads",
"upon",
"completion",
"of",
"the",
"IO",
"request",
"with",
"the",
"provided",
"buffer",
"an... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/AsynchronousFileIOChannel.java#L188-L225 | train | Handle the processing of a processed buffer. | [
30522,
2345,
5123,
11675,
5047,
21572,
9623,
6924,
8569,
12494,
1006,
1056,
17698,
1010,
22834,
10288,
24422,
4654,
1007,
1063,
2065,
1006,
17698,
1027,
1027,
19701,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
2130,
2065,
1996,
2655,
12221,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/types/parser/FieldParser.java | FieldParser.nextStringLength | protected static final int nextStringLength(byte[] bytes, int startPos, int length, char delimiter) {
if (length <= 0) {
throw new IllegalArgumentException("Invalid input: Empty string");
}
int limitedLength = 0;
final byte delByte = (byte) delimiter;
while (limitedLength < length && bytes[startPos + limitedLength] != delByte) {
limitedLength++;
}
return limitedLength;
} | java | protected static final int nextStringLength(byte[] bytes, int startPos, int length, char delimiter) {
if (length <= 0) {
throw new IllegalArgumentException("Invalid input: Empty string");
}
int limitedLength = 0;
final byte delByte = (byte) delimiter;
while (limitedLength < length && bytes[startPos + limitedLength] != delByte) {
limitedLength++;
}
return limitedLength;
} | [
"protected",
"static",
"final",
"int",
"nextStringLength",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"startPos",
",",
"int",
"length",
",",
"char",
"delimiter",
")",
"{",
"if",
"(",
"length",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException... | Returns the length of a string. Throws an exception if the column is empty.
@return the length of the string | [
"Returns",
"the",
"length",
"of",
"a",
"string",
".",
"Throws",
"an",
"exception",
"if",
"the",
"column",
"is",
"empty",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/parser/FieldParser.java#L230-L242 | train | Returns the length of the next string in the byte array starting at the given position. | [
30522,
5123,
10763,
2345,
20014,
2279,
3367,
4892,
7770,
13512,
2232,
1006,
24880,
1031,
1033,
27507,
1010,
20014,
2707,
6873,
2015,
1010,
20014,
3091,
1010,
25869,
3972,
27605,
3334,
1007,
1063,
2065,
1006,
3091,
1026,
1027,
1014,
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... |
netty/netty | transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java | AbstractCoalescingBufferQueue.removeFirst | public final ByteBuf removeFirst(ChannelPromise aggregatePromise) {
Object entry = bufAndListenerPairs.poll();
if (entry == null) {
return null;
}
assert entry instanceof ByteBuf;
ByteBuf result = (ByteBuf) entry;
decrementReadableBytes(result.readableBytes());
entry = bufAndListenerPairs.peek();
if (entry instanceof ChannelFutureListener) {
aggregatePromise.addListener((ChannelFutureListener) entry);
bufAndListenerPairs.poll();
}
return result;
} | java | public final ByteBuf removeFirst(ChannelPromise aggregatePromise) {
Object entry = bufAndListenerPairs.poll();
if (entry == null) {
return null;
}
assert entry instanceof ByteBuf;
ByteBuf result = (ByteBuf) entry;
decrementReadableBytes(result.readableBytes());
entry = bufAndListenerPairs.peek();
if (entry instanceof ChannelFutureListener) {
aggregatePromise.addListener((ChannelFutureListener) entry);
bufAndListenerPairs.poll();
}
return result;
} | [
"public",
"final",
"ByteBuf",
"removeFirst",
"(",
"ChannelPromise",
"aggregatePromise",
")",
"{",
"Object",
"entry",
"=",
"bufAndListenerPairs",
".",
"poll",
"(",
")",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"assert",
"... | Remove the first {@link ByteBuf} from the queue.
@param aggregatePromise used to aggregate the promises and listeners for the returned buffer.
@return the first {@link ByteBuf} from the queue. | [
"Remove",
"the",
"first",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java#L108-L124 | train | Removes the first entry from the buffer. | [
30522,
2270,
2345,
24880,
8569,
2546,
6366,
8873,
12096,
1006,
3149,
21572,
28732,
9572,
21572,
28732,
1007,
1063,
4874,
4443,
1027,
20934,
15143,
19422,
27870,
3678,
4502,
18894,
1012,
8554,
1006,
1007,
1025,
2065,
1006,
4443,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.union | public UnionOperator<T> union(DataSet<T> other){
return new UnionOperator<>(this, other, Utils.getCallLocationName());
} | java | public UnionOperator<T> union(DataSet<T> other){
return new UnionOperator<>(this, other, Utils.getCallLocationName());
} | [
"public",
"UnionOperator",
"<",
"T",
">",
"union",
"(",
"DataSet",
"<",
"T",
">",
"other",
")",
"{",
"return",
"new",
"UnionOperator",
"<>",
"(",
"this",
",",
"other",
",",
"Utils",
".",
"getCallLocationName",
"(",
")",
")",
";",
"}"
] | Creates a union of this DataSet with an other DataSet. The other DataSet must be of the same data type.
@param other The other DataSet which is unioned with the current DataSet.
@return The resulting DataSet. | [
"Creates",
"a",
"union",
"of",
"this",
"DataSet",
"with",
"an",
"other",
"DataSet",
".",
"The",
"other",
"DataSet",
"must",
"be",
"of",
"the",
"same",
"data",
"type",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1241-L1243 | train | Create a union operator from the given data set. | [
30522,
2270,
2586,
25918,
8844,
1026,
1056,
1028,
2586,
1006,
2951,
13462,
1026,
1056,
1028,
2060,
1007,
1063,
2709,
2047,
2586,
25918,
8844,
1026,
1028,
1006,
2023,
1010,
2060,
1010,
21183,
12146,
1012,
2131,
9289,
7174,
10719,
18442,
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-json/src/main/java/cn/hutool/json/JSONObject.java | JSONObject.put | @Override
public JSONObject put(String key, Object value) throws JSONException {
if (null == key) {
return this;
}
final boolean ignoreNullValue = this.config.isIgnoreNullValue();
if (ObjectUtil.isNull(value) && ignoreNullValue) {
// 忽略值模式下如果值为空清除key
this.remove(key);
} else {
InternalJSONUtil.testValidity(value);
this.rawHashMap.put(key, JSONUtil.wrap(value, ignoreNullValue));
}
return this;
} | java | @Override
public JSONObject put(String key, Object value) throws JSONException {
if (null == key) {
return this;
}
final boolean ignoreNullValue = this.config.isIgnoreNullValue();
if (ObjectUtil.isNull(value) && ignoreNullValue) {
// 忽略值模式下如果值为空清除key
this.remove(key);
} else {
InternalJSONUtil.testValidity(value);
this.rawHashMap.put(key, JSONUtil.wrap(value, ignoreNullValue));
}
return this;
} | [
"@",
"Override",
"public",
"JSONObject",
"put",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"null",
"==",
"key",
")",
"{",
"return",
"this",
";",
"}",
"final",
"boolean",
"ignoreNullValue",
"=",
"this",
"... | PUT 键值对到JSONObject中,如果值为<code>null</code>,将此键移除
@param key 键
@param value 值对象. 可以是以下类型: Boolean, Double, Integer, JSONArray, JSONObject, Long, String, or the JSONNull.NULL.
@return this.
@throws JSONException 值是无穷数字抛出此异常 | [
"PUT",
"键值对到JSONObject中,如果值为<code",
">",
"null<",
"/",
"code",
">",
",将此键移除"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONObject.java#L379-L394 | train | Add a value to the map. | [
30522,
1030,
2058,
15637,
2270,
1046,
3385,
16429,
20614,
2404,
1006,
5164,
3145,
1010,
4874,
3643,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
2065,
1006,
19701,
1027,
1027,
3145,
1007,
1063,
2709,
2023,
1025,
1065,
2345,
22017,
20898,
85... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java | JarWriter.writeManifest | public void writeManifest(Manifest manifest) throws IOException {
JarArchiveEntry entry = new JarArchiveEntry("META-INF/MANIFEST.MF");
writeEntry(entry, manifest::write);
} | java | public void writeManifest(Manifest manifest) throws IOException {
JarArchiveEntry entry = new JarArchiveEntry("META-INF/MANIFEST.MF");
writeEntry(entry, manifest::write);
} | [
"public",
"void",
"writeManifest",
"(",
"Manifest",
"manifest",
")",
"throws",
"IOException",
"{",
"JarArchiveEntry",
"entry",
"=",
"new",
"JarArchiveEntry",
"(",
"\"META-INF/MANIFEST.MF\"",
")",
";",
"writeEntry",
"(",
"entry",
",",
"manifest",
"::",
"write",
")"... | Write the specified manifest.
@param manifest the manifest to write
@throws IOException of the manifest cannot be written | [
"Write",
"the",
"specified",
"manifest",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java#L114-L117 | train | Write the manifest to the underlying file. | [
30522,
2270,
11675,
4339,
20799,
14081,
1006,
19676,
19676,
1007,
11618,
22834,
10288,
24422,
1063,
15723,
2906,
5428,
3726,
4765,
2854,
4443,
1027,
2047,
15723,
2906,
5428,
3726,
4765,
2854,
1006,
1000,
18804,
1011,
1999,
2546,
1013,
19676,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/dialect/DialectFactory.java | DialectFactory.newDialect | public static Dialect newDialect(String driverName) {
final Dialect dialect = internalNewDialect(driverName);
StaticLog.debug("Use Dialect: [{}].", dialect.getClass().getSimpleName());
return dialect;
} | java | public static Dialect newDialect(String driverName) {
final Dialect dialect = internalNewDialect(driverName);
StaticLog.debug("Use Dialect: [{}].", dialect.getClass().getSimpleName());
return dialect;
} | [
"public",
"static",
"Dialect",
"newDialect",
"(",
"String",
"driverName",
")",
"{",
"final",
"Dialect",
"dialect",
"=",
"internalNewDialect",
"(",
"driverName",
")",
";",
"StaticLog",
".",
"debug",
"(",
"\"Use Dialect: [{}].\"",
",",
"dialect",
".",
"getClass",
... | 根据驱动名创建方言<br>
驱动名是不分区大小写完全匹配的
@param driverName JDBC驱动类名
@return 方言 | [
"根据驱动名创建方言<br",
">",
"驱动名是不分区大小写完全匹配的"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/dialect/DialectFactory.java#L70-L74 | train | Create a new instance of the specified Dialect class. | [
30522,
2270,
10763,
9329,
2047,
27184,
22471,
1006,
5164,
4062,
18442,
1007,
1063,
2345,
9329,
9329,
1027,
4722,
2638,
21724,
4818,
22471,
1006,
4062,
18442,
1007,
1025,
10763,
21197,
1012,
2139,
8569,
2290,
1006,
1000,
2224,
9329,
1024,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java | Sftp.put | public Sftp put(String srcFilePath, String destPath) {
return put(srcFilePath, destPath, Mode.OVERWRITE);
} | java | public Sftp put(String srcFilePath, String destPath) {
return put(srcFilePath, destPath, Mode.OVERWRITE);
} | [
"public",
"Sftp",
"put",
"(",
"String",
"srcFilePath",
",",
"String",
"destPath",
")",
"{",
"return",
"put",
"(",
"srcFilePath",
",",
"destPath",
",",
"Mode",
".",
"OVERWRITE",
")",
";",
"}"
] | 将本地文件上传到目标服务器,目标文件名为destPath,若destPath为目录,则目标文件名将与srcFilePath文件名相同。覆盖模式
@param srcFilePath 本地文件路径
@param destPath 目标路径,
@return this | [
"将本地文件上传到目标服务器,目标文件名为destPath,若destPath为目录,则目标文件名将与srcFilePath文件名相同。覆盖模式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java#L363-L365 | train | Uploads a file to the remote host overwriting the existing file. | [
30522,
2270,
16420,
25856,
2404,
1006,
5164,
5034,
2278,
8873,
2571,
15069,
1010,
5164,
4078,
25856,
8988,
1007,
1063,
2709,
2404,
1006,
5034,
2278,
8873,
2571,
15069,
1010,
4078,
25856,
8988,
1010,
5549,
1012,
2058,
26373,
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... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java | Http2ConnectionHandler.onConnectionError | protected void onConnectionError(ChannelHandlerContext ctx, boolean outbound,
Throwable cause, Http2Exception http2Ex) {
if (http2Ex == null) {
http2Ex = new Http2Exception(INTERNAL_ERROR, cause.getMessage(), cause);
}
ChannelPromise promise = ctx.newPromise();
ChannelFuture future = goAway(ctx, http2Ex, ctx.newPromise());
if (http2Ex.shutdownHint() == Http2Exception.ShutdownHint.GRACEFUL_SHUTDOWN) {
doGracefulShutdown(ctx, future, promise);
} else {
future.addListener(new ClosingChannelFutureListener(ctx, promise));
}
} | java | protected void onConnectionError(ChannelHandlerContext ctx, boolean outbound,
Throwable cause, Http2Exception http2Ex) {
if (http2Ex == null) {
http2Ex = new Http2Exception(INTERNAL_ERROR, cause.getMessage(), cause);
}
ChannelPromise promise = ctx.newPromise();
ChannelFuture future = goAway(ctx, http2Ex, ctx.newPromise());
if (http2Ex.shutdownHint() == Http2Exception.ShutdownHint.GRACEFUL_SHUTDOWN) {
doGracefulShutdown(ctx, future, promise);
} else {
future.addListener(new ClosingChannelFutureListener(ctx, promise));
}
} | [
"protected",
"void",
"onConnectionError",
"(",
"ChannelHandlerContext",
"ctx",
",",
"boolean",
"outbound",
",",
"Throwable",
"cause",
",",
"Http2Exception",
"http2Ex",
")",
"{",
"if",
"(",
"http2Ex",
"==",
"null",
")",
"{",
"http2Ex",
"=",
"new",
"Http2Exception... | Handler for a connection error. Sends a GO_AWAY frame to the remote endpoint. Once all
streams are closed, the connection is shut down.
@param ctx the channel context
@param outbound {@code true} if the error was caused by an outbound operation.
@param cause the exception that was caught
@param http2Ex the {@link Http2Exception} that is embedded in the causality chain. This may
be {@code null} if it's an unknown exception. | [
"Handler",
"for",
"a",
"connection",
"error",
".",
"Sends",
"a",
"GO_AWAY",
"frame",
"to",
"the",
"remote",
"endpoint",
".",
"Once",
"all",
"streams",
"are",
"closed",
"the",
"connection",
"is",
"shut",
"down",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L657-L670 | train | Handle a connection error. | [
30522,
5123,
11675,
2006,
8663,
2638,
7542,
2121,
29165,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
22017,
20898,
2041,
15494,
1010,
5466,
3085,
3426,
1010,
8299,
2475,
10288,
24422,
8299,
2475,
10288,
1007,
1063,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/csv/CsvWriter.java | CsvWriter.appendLine | private void appendLine(final String... fields) throws IORuntimeException {
try {
doAppendLine(fields);
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | private void appendLine(final String... fields) throws IORuntimeException {
try {
doAppendLine(fields);
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"private",
"void",
"appendLine",
"(",
"final",
"String",
"...",
"fields",
")",
"throws",
"IORuntimeException",
"{",
"try",
"{",
"doAppendLine",
"(",
"fields",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IORuntimeException",
"(... | 追加一行,末尾会自动换行,但是追加前不会换行
@param fields 字段列表 ({@code null} 值会被做为空值追加)
@throws IORuntimeException IO异常 | [
"追加一行,末尾会自动换行,但是追加前不会换行"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvWriter.java#L233-L239 | train | Append a line to the output. | [
30522,
2797,
11675,
10439,
10497,
4179,
1006,
2345,
5164,
1012,
1012,
1012,
4249,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
3046,
1063,
2079,
29098,
10497,
4179,
1006,
4249,
1007,
1025,
1065,
4608,
1006,
22834,
10288,
24422,
1041,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ClusterAnalyzer.java | ClusterAnalyzer.preprocess | protected List<String> preprocess(String document)
{
List<Term> termList = segment.seg(document);
ListIterator<Term> listIterator = termList.listIterator();
while (listIterator.hasNext())
{
Term term = listIterator.next();
if (CoreStopWordDictionary.contains(term.word) ||
term.nature.startsWith("w")
)
{
listIterator.remove();
}
}
List<String> wordList = new ArrayList<String>(termList.size());
for (Term term : termList)
{
wordList.add(term.word);
}
return wordList;
} | java | protected List<String> preprocess(String document)
{
List<Term> termList = segment.seg(document);
ListIterator<Term> listIterator = termList.listIterator();
while (listIterator.hasNext())
{
Term term = listIterator.next();
if (CoreStopWordDictionary.contains(term.word) ||
term.nature.startsWith("w")
)
{
listIterator.remove();
}
}
List<String> wordList = new ArrayList<String>(termList.size());
for (Term term : termList)
{
wordList.add(term.word);
}
return wordList;
} | [
"protected",
"List",
"<",
"String",
">",
"preprocess",
"(",
"String",
"document",
")",
"{",
"List",
"<",
"Term",
">",
"termList",
"=",
"segment",
".",
"seg",
"(",
"document",
")",
";",
"ListIterator",
"<",
"Term",
">",
"listIterator",
"=",
"termList",
".... | 重载此方法实现自己的预处理逻辑(预处理、分词、去除停用词)
@param document 文档
@return 单词列表 | [
"重载此方法实现自己的预处理逻辑(预处理、分词、去除停用词)"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/ClusterAnalyzer.java#L65-L85 | train | Preprocessing method. | [
30522,
5123,
2862,
1026,
5164,
1028,
17463,
3217,
9623,
2015,
1006,
5164,
6254,
1007,
1063,
2862,
1026,
2744,
1028,
2744,
9863,
1027,
6903,
1012,
7367,
2290,
1006,
6254,
1007,
1025,
2862,
21646,
8844,
1026,
2744,
1028,
2862,
21646,
8844,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/ClosableBlockingQueue.java | ClosableBlockingQueue.getBatchBlocking | public List<E> getBatchBlocking(long timeoutMillis) throws InterruptedException {
if (timeoutMillis == 0L) {
// wait forever case
return getBatchBlocking();
} else if (timeoutMillis < 0L) {
throw new IllegalArgumentException("invalid timeout");
}
final long deadline = System.nanoTime() + timeoutMillis * 1_000_000L;
lock.lock();
try {
while (open && elements.isEmpty() && timeoutMillis > 0) {
nonEmpty.await(timeoutMillis, TimeUnit.MILLISECONDS);
timeoutMillis = (deadline - System.nanoTime()) / 1_000_000L;
}
if (!open) {
throw new IllegalStateException("queue is closed");
}
else if (elements.isEmpty()) {
return Collections.emptyList();
}
else {
ArrayList<E> result = new ArrayList<>(elements);
elements.clear();
return result;
}
} finally {
lock.unlock();
}
} | java | public List<E> getBatchBlocking(long timeoutMillis) throws InterruptedException {
if (timeoutMillis == 0L) {
// wait forever case
return getBatchBlocking();
} else if (timeoutMillis < 0L) {
throw new IllegalArgumentException("invalid timeout");
}
final long deadline = System.nanoTime() + timeoutMillis * 1_000_000L;
lock.lock();
try {
while (open && elements.isEmpty() && timeoutMillis > 0) {
nonEmpty.await(timeoutMillis, TimeUnit.MILLISECONDS);
timeoutMillis = (deadline - System.nanoTime()) / 1_000_000L;
}
if (!open) {
throw new IllegalStateException("queue is closed");
}
else if (elements.isEmpty()) {
return Collections.emptyList();
}
else {
ArrayList<E> result = new ArrayList<>(elements);
elements.clear();
return result;
}
} finally {
lock.unlock();
}
} | [
"public",
"List",
"<",
"E",
">",
"getBatchBlocking",
"(",
"long",
"timeoutMillis",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"timeoutMillis",
"==",
"0L",
")",
"{",
"// wait forever case",
"return",
"getBatchBlocking",
"(",
")",
";",
"}",
"else",
"... | Gets all the elements found in the list, or blocks until at least one element
was added. This method is similar as {@link #getBatchBlocking()}, but takes
a number of milliseconds that the method will maximally wait before returning.
<p>This method never returns null, but an empty list, if the queue is empty when
the method is called and the request times out before an element was added.
<p>The method throws an {@code IllegalStateException} if the queue is closed.
Checking whether the queue is open and removing the next element is one atomic operation.
@param timeoutMillis The number of milliseconds to wait, at most.
@return A list with all elements in the queue, possible an empty list.
@throws IllegalStateException Thrown, if the queue is closed.
@throws InterruptedException Throw, if the thread is interrupted while waiting for an
element to be added. | [
"Gets",
"all",
"the",
"elements",
"found",
"in",
"the",
"list",
"or",
"blocks",
"until",
"at",
"least",
"one",
"element",
"was",
"added",
".",
"This",
"method",
"is",
"similar",
"as",
"{",
"@link",
"#getBatchBlocking",
"()",
"}",
"but",
"takes",
"a",
"nu... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/ClosableBlockingQueue.java#L434-L465 | train | Get a list of elements from the queue blocking until all elements are added to the queue. | [
30522,
2270,
2862,
1026,
1041,
1028,
2131,
14479,
2818,
23467,
2075,
1006,
2146,
2051,
5833,
19912,
2483,
1007,
11618,
7153,
10288,
24422,
1063,
2065,
1006,
2051,
5833,
19912,
2483,
1027,
1027,
1014,
2140,
1007,
1063,
1013,
1013,
3524,
5091... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/StrBuilder.java | StrBuilder.insert | public StrBuilder insert(int index, char[] src, int srcPos, int length) {
if (ArrayUtil.isEmpty(src) || srcPos > src.length || length <= 0) {
return this;
}
if (index < 0) {
index = 0;
}
if (srcPos < 0) {
srcPos = 0;
} else if (srcPos + length > src.length) {
// 长度越界,只截取最大长度
length = src.length - srcPos;
}
moveDataAfterIndex(index, length);
// 插入数据
System.arraycopy(src, srcPos, value, index, length);
this.position = Math.max(this.position, index) + length;
return this;
} | java | public StrBuilder insert(int index, char[] src, int srcPos, int length) {
if (ArrayUtil.isEmpty(src) || srcPos > src.length || length <= 0) {
return this;
}
if (index < 0) {
index = 0;
}
if (srcPos < 0) {
srcPos = 0;
} else if (srcPos + length > src.length) {
// 长度越界,只截取最大长度
length = src.length - srcPos;
}
moveDataAfterIndex(index, length);
// 插入数据
System.arraycopy(src, srcPos, value, index, length);
this.position = Math.max(this.position, index) + length;
return this;
} | [
"public",
"StrBuilder",
"insert",
"(",
"int",
"index",
",",
"char",
"[",
"]",
"src",
",",
"int",
"srcPos",
",",
"int",
"length",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"src",
")",
"||",
"srcPos",
">",
"src",
".",
"length",
"||",
"le... | 指定位置插入数据<br>
如果插入位置为当前位置,则定义为追加<br>
如果插入位置大于当前位置,则中间部分补充空格
@param index 插入位置
@param src 源数组
@param srcPos 位置
@param length 长度
@return this | [
"指定位置插入数据<br",
">",
"如果插入位置为当前位置,则定义为追加<br",
">",
"如果插入位置大于当前位置,则中间部分补充空格"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrBuilder.java#L197-L216 | train | Inserts a portion of the specified array into this builder. | [
30522,
2270,
2358,
15185,
19231,
4063,
19274,
1006,
20014,
5950,
1010,
25869,
1031,
1033,
5034,
2278,
1010,
20014,
5034,
21906,
2891,
1010,
20014,
3091,
1007,
1063,
2065,
1006,
9140,
21823,
2140,
1012,
2003,
6633,
13876,
2100,
1006,
5034,
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-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java | ParameterTool.mergeWith | public ParameterTool mergeWith(ParameterTool other) {
final Map<String, String> resultData = new HashMap<>(data.size() + other.data.size());
resultData.putAll(data);
resultData.putAll(other.data);
final ParameterTool ret = new ParameterTool(resultData);
final HashSet<String> requestedParametersLeft = new HashSet<>(data.keySet());
requestedParametersLeft.removeAll(unrequestedParameters);
final HashSet<String> requestedParametersRight = new HashSet<>(other.data.keySet());
requestedParametersRight.removeAll(other.unrequestedParameters);
ret.unrequestedParameters.removeAll(requestedParametersLeft);
ret.unrequestedParameters.removeAll(requestedParametersRight);
return ret;
} | java | public ParameterTool mergeWith(ParameterTool other) {
final Map<String, String> resultData = new HashMap<>(data.size() + other.data.size());
resultData.putAll(data);
resultData.putAll(other.data);
final ParameterTool ret = new ParameterTool(resultData);
final HashSet<String> requestedParametersLeft = new HashSet<>(data.keySet());
requestedParametersLeft.removeAll(unrequestedParameters);
final HashSet<String> requestedParametersRight = new HashSet<>(other.data.keySet());
requestedParametersRight.removeAll(other.unrequestedParameters);
ret.unrequestedParameters.removeAll(requestedParametersLeft);
ret.unrequestedParameters.removeAll(requestedParametersRight);
return ret;
} | [
"public",
"ParameterTool",
"mergeWith",
"(",
"ParameterTool",
"other",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"resultData",
"=",
"new",
"HashMap",
"<>",
"(",
"data",
".",
"size",
"(",
")",
"+",
"other",
".",
"data",
".",
"size",
"... | Merges two {@link ParameterTool}.
@param other Other {@link ParameterTool} object
@return The Merged {@link ParameterTool} | [
"Merges",
"two",
"{",
"@link",
"ParameterTool",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L552-L569 | train | Merge two parameter tools. | [
30522,
2270,
16381,
3406,
4747,
13590,
24415,
1006,
16381,
3406,
4747,
2060,
1007,
1063,
2345,
4949,
1026,
5164,
1010,
5164,
1028,
2765,
2850,
2696,
1027,
2047,
23325,
2863,
2361,
1026,
1028,
1006,
2951,
1012,
2946,
1006,
1007,
1009,
2060,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java | TaskMemoryManager.showMemoryUsage | public void showMemoryUsage() {
logger.info("Memory used in task " + taskAttemptId);
synchronized (this) {
long memoryAccountedForByConsumers = 0;
for (MemoryConsumer c: consumers) {
long totalMemUsage = c.getUsed();
memoryAccountedForByConsumers += totalMemUsage;
if (totalMemUsage > 0) {
logger.info("Acquired by " + c + ": " + Utils.bytesToString(totalMemUsage));
}
}
long memoryNotAccountedFor =
memoryManager.getExecutionMemoryUsageForTask(taskAttemptId) - memoryAccountedForByConsumers;
logger.info(
"{} bytes of memory were used by task {} but are not associated with specific consumers",
memoryNotAccountedFor, taskAttemptId);
logger.info(
"{} bytes of memory are used for execution and {} bytes of memory are used for storage",
memoryManager.executionMemoryUsed(), memoryManager.storageMemoryUsed());
}
} | java | public void showMemoryUsage() {
logger.info("Memory used in task " + taskAttemptId);
synchronized (this) {
long memoryAccountedForByConsumers = 0;
for (MemoryConsumer c: consumers) {
long totalMemUsage = c.getUsed();
memoryAccountedForByConsumers += totalMemUsage;
if (totalMemUsage > 0) {
logger.info("Acquired by " + c + ": " + Utils.bytesToString(totalMemUsage));
}
}
long memoryNotAccountedFor =
memoryManager.getExecutionMemoryUsageForTask(taskAttemptId) - memoryAccountedForByConsumers;
logger.info(
"{} bytes of memory were used by task {} but are not associated with specific consumers",
memoryNotAccountedFor, taskAttemptId);
logger.info(
"{} bytes of memory are used for execution and {} bytes of memory are used for storage",
memoryManager.executionMemoryUsed(), memoryManager.storageMemoryUsed());
}
} | [
"public",
"void",
"showMemoryUsage",
"(",
")",
"{",
"logger",
".",
"info",
"(",
"\"Memory used in task \"",
"+",
"taskAttemptId",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"long",
"memoryAccountedForByConsumers",
"=",
"0",
";",
"for",
"(",
"MemoryConsumer... | Dump the memory usage of all consumers. | [
"Dump",
"the",
"memory",
"usage",
"of",
"all",
"consumers",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java#L244-L264 | train | Show the memory usage of the task. | [
30522,
2270,
11675,
2265,
4168,
5302,
2854,
10383,
3351,
1006,
1007,
1063,
8833,
4590,
1012,
18558,
1006,
1000,
3638,
2109,
1999,
4708,
1000,
1009,
4708,
19321,
6633,
13876,
3593,
1007,
1025,
25549,
1006,
2023,
1007,
1063,
2146,
3638,
6305,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-rabbitmq/src/main/java/org/apache/flink/streaming/connectors/rabbitmq/RMQSink.java | RMQSink.setupQueue | protected void setupQueue() throws IOException {
if (queueName != null) {
channel.queueDeclare(queueName, false, false, false, null);
}
} | java | protected void setupQueue() throws IOException {
if (queueName != null) {
channel.queueDeclare(queueName, false, false, false, null);
}
} | [
"protected",
"void",
"setupQueue",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"queueName",
"!=",
"null",
")",
"{",
"channel",
".",
"queueDeclare",
"(",
"queueName",
",",
"false",
",",
"false",
",",
"false",
",",
"null",
")",
";",
"}",
"}"
] | Sets up the queue. The default implementation just declares the queue. The user may override
this method to have a custom setup for the queue (i.e. binding the queue to an exchange or
defining custom queue parameters) | [
"Sets",
"up",
"the",
"queue",
".",
"The",
"default",
"implementation",
"just",
"declares",
"the",
"queue",
".",
"The",
"user",
"may",
"override",
"this",
"method",
"to",
"have",
"a",
"custom",
"setup",
"for",
"the",
"queue",
"(",
"i",
".",
"e",
".",
"b... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-rabbitmq/src/main/java/org/apache/flink/streaming/connectors/rabbitmq/RMQSink.java#L122-L126 | train | Setup the queue. | [
30522,
5123,
11675,
16437,
4226,
5657,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
24240,
18442,
999,
1027,
19701,
1007,
1063,
3149,
1012,
24240,
3207,
20464,
12069,
1006,
24240,
18442,
1010,
6270,
1010,
6270,
1010,
6270,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBStateBackend.java | RocksDBStateBackend.configure | @Override
public RocksDBStateBackend configure(Configuration config, ClassLoader classLoader) {
return new RocksDBStateBackend(this, config, classLoader);
} | java | @Override
public RocksDBStateBackend configure(Configuration config, ClassLoader classLoader) {
return new RocksDBStateBackend(this, config, classLoader);
} | [
"@",
"Override",
"public",
"RocksDBStateBackend",
"configure",
"(",
"Configuration",
"config",
",",
"ClassLoader",
"classLoader",
")",
"{",
"return",
"new",
"RocksDBStateBackend",
"(",
"this",
",",
"config",
",",
"classLoader",
")",
";",
"}"
] | Creates a copy of this state backend that uses the values defined in the configuration
for fields where that were not yet specified in this state backend.
@param config The configuration.
@param classLoader The class loader.
@return The re-configured variant of the state backend | [
"Creates",
"a",
"copy",
"of",
"this",
"state",
"backend",
"that",
"uses",
"the",
"values",
"defined",
"in",
"the",
"configuration",
"for",
"fields",
"where",
"that",
"were",
"not",
"yet",
"specified",
"in",
"this",
"state",
"backend",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBStateBackend.java#L373-L376 | train | Override this method to configure the state backend. | [
30522,
1030,
2058,
15637,
2270,
5749,
18939,
9153,
2618,
5963,
10497,
9530,
8873,
27390,
2063,
1006,
9563,
9530,
8873,
2290,
1010,
2465,
11066,
2121,
2465,
11066,
2121,
1007,
1063,
2709,
2047,
5749,
18939,
9153,
2618,
5963,
10497,
1006,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointStatsTracker.java | CheckpointStatsTracker.reportPendingCheckpoint | PendingCheckpointStats reportPendingCheckpoint(
long checkpointId,
long triggerTimestamp,
CheckpointProperties props) {
ConcurrentHashMap<JobVertexID, TaskStateStats> taskStateStats = createEmptyTaskStateStatsMap();
PendingCheckpointStats pending = new PendingCheckpointStats(
checkpointId,
triggerTimestamp,
props,
totalSubtaskCount,
taskStateStats,
new PendingCheckpointStatsCallback());
statsReadWriteLock.lock();
try {
counts.incrementInProgressCheckpoints();
history.addInProgressCheckpoint(pending);
dirty = true;
} finally {
statsReadWriteLock.unlock();
}
return pending;
} | java | PendingCheckpointStats reportPendingCheckpoint(
long checkpointId,
long triggerTimestamp,
CheckpointProperties props) {
ConcurrentHashMap<JobVertexID, TaskStateStats> taskStateStats = createEmptyTaskStateStatsMap();
PendingCheckpointStats pending = new PendingCheckpointStats(
checkpointId,
triggerTimestamp,
props,
totalSubtaskCount,
taskStateStats,
new PendingCheckpointStatsCallback());
statsReadWriteLock.lock();
try {
counts.incrementInProgressCheckpoints();
history.addInProgressCheckpoint(pending);
dirty = true;
} finally {
statsReadWriteLock.unlock();
}
return pending;
} | [
"PendingCheckpointStats",
"reportPendingCheckpoint",
"(",
"long",
"checkpointId",
",",
"long",
"triggerTimestamp",
",",
"CheckpointProperties",
"props",
")",
"{",
"ConcurrentHashMap",
"<",
"JobVertexID",
",",
"TaskStateStats",
">",
"taskStateStats",
"=",
"createEmptyTaskSta... | Creates a new pending checkpoint tracker.
@param checkpointId ID of the checkpoint.
@param triggerTimestamp Trigger timestamp of the checkpoint.
@param props The checkpoint properties.
@return Tracker for statistics gathering. | [
"Creates",
"a",
"new",
"pending",
"checkpoint",
"tracker",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointStatsTracker.java#L194-L220 | train | Reports a pending checkpoint. | [
30522,
14223,
5403,
3600,
26521,
29336,
2015,
3189,
11837,
4667,
5403,
3600,
8400,
1006,
2146,
26520,
3593,
1010,
2146,
9495,
7292,
9153,
8737,
1010,
26520,
21572,
4842,
7368,
24387,
1007,
1063,
16483,
14949,
22444,
2361,
1026,
3105,
16874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-memcache/src/main/java/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheDecoder.java | AbstractBinaryMemcacheDecoder.invalidMessage | private M invalidMessage(Exception cause) {
state = State.BAD_MESSAGE;
M message = buildInvalidMessage();
message.setDecoderResult(DecoderResult.failure(cause));
return message;
} | java | private M invalidMessage(Exception cause) {
state = State.BAD_MESSAGE;
M message = buildInvalidMessage();
message.setDecoderResult(DecoderResult.failure(cause));
return message;
} | [
"private",
"M",
"invalidMessage",
"(",
"Exception",
"cause",
")",
"{",
"state",
"=",
"State",
".",
"BAD_MESSAGE",
";",
"M",
"message",
"=",
"buildInvalidMessage",
"(",
")",
";",
"message",
".",
"setDecoderResult",
"(",
"DecoderResult",
".",
"failure",
"(",
"... | Helper method to create a message indicating a invalid decoding result.
@param cause the cause of the decoding failure.
@return a valid message indicating failure. | [
"Helper",
"method",
"to",
"create",
"a",
"message",
"indicating",
"a",
"invalid",
"decoding",
"result",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-memcache/src/main/java/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheDecoder.java#L175-L180 | train | Creates an invalid message. | [
30522,
2797,
1049,
19528,
7834,
3736,
3351,
1006,
6453,
3426,
1007,
1063,
2110,
1027,
2110,
1012,
2919,
1035,
4471,
1025,
1049,
4471,
1027,
3857,
2378,
10175,
3593,
7834,
3736,
3351,
1006,
1007,
1025,
4471,
1012,
2275,
3207,
16044,
14343,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/ChannelReaderInputView.java | ChannelReaderInputView.close | @Override
public List<MemorySegment> close() throws IOException {
if (this.closed) {
throw new IllegalStateException("Already closed.");
}
this.closed = true;
// re-collect all memory segments
ArrayList<MemorySegment> list = this.freeMem;
final MemorySegment current = getCurrentSegment();
if (current != null) {
list.add(current);
}
clear();
// close the writer and gather all segments
final LinkedBlockingQueue<MemorySegment> queue = this.reader.getReturnQueue();
this.reader.close();
while (list.size() < this.numSegments) {
final MemorySegment m = queue.poll();
if (m == null) {
// we get null if the queue is empty. that should not be the case if the reader was properly closed.
throw new RuntimeException("Bug in ChannelReaderInputView: MemorySegments lost.");
}
list.add(m);
}
return list;
} | java | @Override
public List<MemorySegment> close() throws IOException {
if (this.closed) {
throw new IllegalStateException("Already closed.");
}
this.closed = true;
// re-collect all memory segments
ArrayList<MemorySegment> list = this.freeMem;
final MemorySegment current = getCurrentSegment();
if (current != null) {
list.add(current);
}
clear();
// close the writer and gather all segments
final LinkedBlockingQueue<MemorySegment> queue = this.reader.getReturnQueue();
this.reader.close();
while (list.size() < this.numSegments) {
final MemorySegment m = queue.poll();
if (m == null) {
// we get null if the queue is empty. that should not be the case if the reader was properly closed.
throw new RuntimeException("Bug in ChannelReaderInputView: MemorySegments lost.");
}
list.add(m);
}
return list;
} | [
"@",
"Override",
"public",
"List",
"<",
"MemorySegment",
">",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"closed",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Already closed.\"",
")",
";",
"}",
"this",
".",
"clo... | Closes this InputView, closing the underlying reader and returning all memory segments.
@return A list containing all memory segments originally supplied to this view.
@throws IOException Thrown, if the underlying reader could not be properly closed. | [
"Closes",
"this",
"InputView",
"closing",
"the",
"underlying",
"reader",
"and",
"returning",
"all",
"memory",
"segments",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/ChannelReaderInputView.java#L171-L199 | train | Closes the underlying reader and returns the list of memory segments that were allocated. | [
30522,
1030,
2058,
15637,
2270,
2862,
1026,
3638,
3366,
21693,
4765,
1028,
2485,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
30524,
1065,
2023,
1012,
2701,
1027,
2995,
1025,
1013,
1013,
2128,
1011,
8145,
2035,
3638,
9214,
9140... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/remote/RemoteWebDriverBuilder.java | RemoteWebDriverBuilder.addAlternative | public RemoteWebDriverBuilder addAlternative(Capabilities options) {
Map<String, Object> serialized = validate(Objects.requireNonNull(options));
this.options.add(serialized);
return this;
} | java | public RemoteWebDriverBuilder addAlternative(Capabilities options) {
Map<String, Object> serialized = validate(Objects.requireNonNull(options));
this.options.add(serialized);
return this;
} | [
"public",
"RemoteWebDriverBuilder",
"addAlternative",
"(",
"Capabilities",
"options",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"serialized",
"=",
"validate",
"(",
"Objects",
".",
"requireNonNull",
"(",
"options",
")",
")",
";",
"this",
".",
"options... | Add to the list of possible configurations that might be asked for. It is possible to ask for
more than one type of browser per session. For example, perhaps you have an extension that is
available for two different kinds of browser, and you'd like to test it). | [
"Add",
"to",
"the",
"list",
"of",
"possible",
"configurations",
"that",
"might",
"be",
"asked",
"for",
".",
"It",
"is",
"possible",
"to",
"ask",
"for",
"more",
"than",
"one",
"type",
"of",
"browser",
"per",
"session",
".",
"For",
"example",
"perhaps",
"y... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/RemoteWebDriverBuilder.java#L120-L124 | train | Add alternative capabilities. | [
30522,
2270,
6556,
8545,
2497,
23663,
15185,
19231,
4063,
5587,
2389,
16451,
8082,
1006,
9859,
7047,
1007,
1063,
4949,
1026,
5164,
1010,
4874,
1028,
27289,
1027,
9398,
3686,
1006,
5200,
1012,
5478,
8540,
11231,
3363,
1006,
7047,
1007,
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-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java | CsvReader.includeFields | public CsvReader includeFields(String mask) {
boolean[] includedMask = new boolean[mask.length()];
for (int i = 0; i < mask.length(); i++) {
char c = mask.charAt(i);
if (c == '1' || c == 'T' || c == 't') {
includedMask[i] = true;
} else if (c != '0' && c != 'F' && c != 'f') {
throw new IllegalArgumentException("Mask string may contain only '0' and '1'.");
}
}
return includeFields(includedMask);
} | java | public CsvReader includeFields(String mask) {
boolean[] includedMask = new boolean[mask.length()];
for (int i = 0; i < mask.length(); i++) {
char c = mask.charAt(i);
if (c == '1' || c == 'T' || c == 't') {
includedMask[i] = true;
} else if (c != '0' && c != 'F' && c != 'f') {
throw new IllegalArgumentException("Mask string may contain only '0' and '1'.");
}
}
return includeFields(includedMask);
} | [
"public",
"CsvReader",
"includeFields",
"(",
"String",
"mask",
")",
"{",
"boolean",
"[",
"]",
"includedMask",
"=",
"new",
"boolean",
"[",
"mask",
".",
"length",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mask",
".",
"leng... | Configures which fields of the CSV file should be included and which should be skipped. The
positions in the string (read from position 0 to its length) define whether the field at
the corresponding position in the CSV schema should be included.
parser will look at the first {@code n} fields, where {@code n} is the length of the mask string
The parser will skip over all fields where the character at the corresponding position
in the string is {@code '0'}, {@code 'F'}, or {@code 'f'} (representing the value
{@code false}). The result contains the fields where the corresponding position in
the boolean array is {@code '1'}, {@code 'T'}, or {@code 't'} (representing the value {@code true}).
@param mask The string mask defining which fields to include and which to skip.
@return The CSV reader instance itself, to allow for fluent function chaining. | [
"Configures",
"which",
"fields",
"of",
"the",
"CSV",
"file",
"should",
"be",
"included",
"and",
"which",
"should",
"be",
"skipped",
".",
"The",
"positions",
"in",
"the",
"string",
"(",
"read",
"from",
"position",
"0",
"to",
"its",
"length",
")",
"define",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java#L233-L246 | train | Returns a reader that reads the specified mask of fields. | [
30522,
2270,
20116,
12229,
9648,
2099,
2421,
15155,
1006,
5164,
7308,
1007,
1063,
22017,
20898,
1031,
1033,
2443,
9335,
2243,
1027,
2047,
22017,
20898,
1031,
7308,
1012,
3091,
1006,
1007,
1033,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
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-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/Simplify.java | Simplify.simplify | public <T extends Comparable<T>> Graph<T, NullValue, NullValue> simplify(Graph<T, NullValue, NullValue> graph, int parallelism)
throws Exception {
switch (value) {
case DIRECTED:
graph = graph
.run(new org.apache.flink.graph.asm.simple.directed.Simplify<T, NullValue, NullValue>()
.setParallelism(parallelism));
break;
case UNDIRECTED:
graph = graph
.run(new org.apache.flink.graph.asm.simple.undirected.Simplify<T, NullValue, NullValue>(false)
.setParallelism(parallelism));
break;
case UNDIRECTED_CLIP_AND_FLIP:
graph = graph
.run(new org.apache.flink.graph.asm.simple.undirected.Simplify<T, NullValue, NullValue>(true)
.setParallelism(parallelism));
break;
}
return graph;
} | java | public <T extends Comparable<T>> Graph<T, NullValue, NullValue> simplify(Graph<T, NullValue, NullValue> graph, int parallelism)
throws Exception {
switch (value) {
case DIRECTED:
graph = graph
.run(new org.apache.flink.graph.asm.simple.directed.Simplify<T, NullValue, NullValue>()
.setParallelism(parallelism));
break;
case UNDIRECTED:
graph = graph
.run(new org.apache.flink.graph.asm.simple.undirected.Simplify<T, NullValue, NullValue>(false)
.setParallelism(parallelism));
break;
case UNDIRECTED_CLIP_AND_FLIP:
graph = graph
.run(new org.apache.flink.graph.asm.simple.undirected.Simplify<T, NullValue, NullValue>(true)
.setParallelism(parallelism));
break;
}
return graph;
} | [
"public",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"Graph",
"<",
"T",
",",
"NullValue",
",",
"NullValue",
">",
"simplify",
"(",
"Graph",
"<",
"T",
",",
"NullValue",
",",
"NullValue",
">",
"graph",
",",
"int",
"parallelism",
")",
"throws",... | Simplify the given graph based on the configured value.
@param graph input graph
@param <T> graph key type
@return output graph
@throws Exception on error | [
"Simplify",
"the",
"given",
"graph",
"based",
"on",
"the",
"configured",
"value",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/Simplify.java#L112-L133 | train | Simplify a graph. | [
30522,
2270,
1026,
1056,
8908,
12435,
1026,
1056,
1028,
1028,
10629,
1026,
1056,
1010,
19701,
10175,
5657,
1010,
19701,
10175,
5657,
1028,
21934,
28250,
1006,
10629,
1026,
1056,
1010,
19701,
10175,
5657,
1010,
19701,
10175,
5657,
1028,
10629,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ClusterAnalyzer.java | ClusterAnalyzer.repeatedBisection | public List<Set<K>> repeatedBisection(int nclusters, double limit_eval)
{
Cluster<K> cluster = new Cluster<K>();
List<Cluster<K>> clusters_ = new ArrayList<Cluster<K>>(nclusters > 0 ? nclusters : 16);
for (Document<K> document : documents_.values())
{
cluster.add_document(document);
}
PriorityQueue<Cluster<K>> que = new PriorityQueue<Cluster<K>>();
cluster.section(2);
refine_clusters(cluster.sectioned_clusters());
cluster.set_sectioned_gain();
cluster.composite_vector().clear();
que.add(cluster);
while (!que.isEmpty())
{
if (nclusters > 0 && que.size() >= nclusters)
break;
cluster = que.peek();
if (cluster.sectioned_clusters().size() < 1)
break;
if (limit_eval > 0 && cluster.sectioned_gain() < limit_eval)
break;
que.poll();
List<Cluster<K>> sectioned = cluster.sectioned_clusters();
for (Cluster<K> c : sectioned)
{
c.section(2);
refine_clusters(c.sectioned_clusters());
c.set_sectioned_gain();
if (c.sectioned_gain() < limit_eval)
{
for (Cluster<K> sub : c.sectioned_clusters())
{
sub.clear();
}
}
c.composite_vector().clear();
que.add(c);
}
}
while (!que.isEmpty())
{
clusters_.add(0, que.poll());
}
return toResult(clusters_);
} | java | public List<Set<K>> repeatedBisection(int nclusters, double limit_eval)
{
Cluster<K> cluster = new Cluster<K>();
List<Cluster<K>> clusters_ = new ArrayList<Cluster<K>>(nclusters > 0 ? nclusters : 16);
for (Document<K> document : documents_.values())
{
cluster.add_document(document);
}
PriorityQueue<Cluster<K>> que = new PriorityQueue<Cluster<K>>();
cluster.section(2);
refine_clusters(cluster.sectioned_clusters());
cluster.set_sectioned_gain();
cluster.composite_vector().clear();
que.add(cluster);
while (!que.isEmpty())
{
if (nclusters > 0 && que.size() >= nclusters)
break;
cluster = que.peek();
if (cluster.sectioned_clusters().size() < 1)
break;
if (limit_eval > 0 && cluster.sectioned_gain() < limit_eval)
break;
que.poll();
List<Cluster<K>> sectioned = cluster.sectioned_clusters();
for (Cluster<K> c : sectioned)
{
c.section(2);
refine_clusters(c.sectioned_clusters());
c.set_sectioned_gain();
if (c.sectioned_gain() < limit_eval)
{
for (Cluster<K> sub : c.sectioned_clusters())
{
sub.clear();
}
}
c.composite_vector().clear();
que.add(c);
}
}
while (!que.isEmpty())
{
clusters_.add(0, que.poll());
}
return toResult(clusters_);
} | [
"public",
"List",
"<",
"Set",
"<",
"K",
">",
">",
"repeatedBisection",
"(",
"int",
"nclusters",
",",
"double",
"limit_eval",
")",
"{",
"Cluster",
"<",
"K",
">",
"cluster",
"=",
"new",
"Cluster",
"<",
"K",
">",
"(",
")",
";",
"List",
"<",
"Cluster",
... | repeated bisection 聚类
@param nclusters 簇的数量
@param limit_eval 准则函数增幅阈值
@return 指定数量的簇(Set)构成的集合 | [
"repeated",
"bisection",
"聚类"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/ClusterAnalyzer.java#L201-L250 | train | Repeats the repeated bisection of the set of clusters. | [
30522,
2270,
2862,
1026,
2275,
1026,
1047,
1028,
1028,
5567,
18477,
18491,
1006,
20014,
13316,
7393,
7747,
1010,
3313,
5787,
1035,
9345,
2140,
1007,
1063,
9324,
1026,
1047,
1028,
9324,
1027,
2047,
9324,
1026,
1047,
1028,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java | MainClassFinder.findSingleMainClass | public static String findSingleMainClass(JarFile jarFile, String classesLocation,
String annotationName) throws IOException {
SingleMainClassCallback callback = new SingleMainClassCallback(annotationName);
MainClassFinder.doWithMainClasses(jarFile, classesLocation, callback);
return callback.getMainClassName();
} | java | public static String findSingleMainClass(JarFile jarFile, String classesLocation,
String annotationName) throws IOException {
SingleMainClassCallback callback = new SingleMainClassCallback(annotationName);
MainClassFinder.doWithMainClasses(jarFile, classesLocation, callback);
return callback.getMainClassName();
} | [
"public",
"static",
"String",
"findSingleMainClass",
"(",
"JarFile",
"jarFile",
",",
"String",
"classesLocation",
",",
"String",
"annotationName",
")",
"throws",
"IOException",
"{",
"SingleMainClassCallback",
"callback",
"=",
"new",
"SingleMainClassCallback",
"(",
"anno... | Find a single main class in a given jar file. A main class annotated with an
annotation with the given {@code annotationName} will be preferred over a main
class with no such annotation.
@param jarFile the jar file to search
@param classesLocation the location within the jar containing classes
@param annotationName the name of the annotation that may be present on the main
class
@return the main class or {@code null}
@throws IOException if the jar file cannot be read | [
"Find",
"a",
"single",
"main",
"class",
"in",
"a",
"given",
"jar",
"file",
".",
"A",
"main",
"class",
"annotated",
"with",
"an",
"annotation",
"with",
"the",
"given",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java#L201-L206 | train | Find the main class name of a single class. | [
30522,
2270,
10763,
5164,
4858,
2075,
16930,
8113,
26266,
1006,
15723,
8873,
2571,
15723,
8873,
2571,
1010,
5164,
4280,
4135,
10719,
1010,
5164,
5754,
17287,
3508,
18442,
1007,
11618,
22834,
10288,
24422,
1063,
2309,
24238,
26266,
9289,
20850... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | client/src/main/java/com/networknt/client/oauth/ClientRequestComposerProvider.java | ClientRequestComposerProvider.getComposer | public IClientRequestComposable getComposer(ClientRequestComposers composerName) {
IClientRequestComposable composer = composersMap.get(composerName);
if(composer == null) {
initDefaultComposer(composerName);
}
return composersMap.get(composerName);
} | java | public IClientRequestComposable getComposer(ClientRequestComposers composerName) {
IClientRequestComposable composer = composersMap.get(composerName);
if(composer == null) {
initDefaultComposer(composerName);
}
return composersMap.get(composerName);
} | [
"public",
"IClientRequestComposable",
"getComposer",
"(",
"ClientRequestComposers",
"composerName",
")",
"{",
"IClientRequestComposable",
"composer",
"=",
"composersMap",
".",
"get",
"(",
"composerName",
")",
";",
"if",
"(",
"composer",
"==",
"null",
")",
"{",
"init... | get IClientRequestComposable based on ClientRequestComposers composer name
@param composerName
@return IClientRequestComposable composer | [
"get",
"IClientRequestComposable",
"based",
"on",
"ClientRequestComposers",
"composer",
"name"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/ClientRequestComposerProvider.java#L41-L47 | train | Gets a client request composer by name. | [
30522,
2270,
24582,
8751,
3372,
2890,
15500,
9006,
6873,
19150,
2131,
9006,
20688,
2099,
1006,
7396,
2890,
15500,
9006,
20688,
2869,
4543,
18442,
1007,
1063,
24582,
8751,
3372,
2890,
15500,
9006,
6873,
19150,
4543,
1027,
9929,
2863,
2361,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple7.java | Tuple7.of | public static <T0, T1, T2, T3, T4, T5, T6> Tuple7<T0, T1, T2, T3, T4, T5, T6> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6) {
return new Tuple7<>(value0,
value1,
value2,
value3,
value4,
value5,
value6);
} | java | public static <T0, T1, T2, T3, T4, T5, T6> Tuple7<T0, T1, T2, T3, T4, T5, T6> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6) {
return new Tuple7<>(value0,
value1,
value2,
value3,
value4,
value5,
value6);
} | [
"public",
"static",
"<",
"T0",
",",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
">",
"Tuple7",
"<",
"T0",
",",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
">",
"of",
"(",
"T0",
"value0",
",",
"T1",
"value... | Creates a new tuple and assigns the given values to the tuple's fields.
This is more convenient than using the constructor, because the compiler can
infer the generic type arguments implicitly. For example:
{@code Tuple3.of(n, x, s)}
instead of
{@code new Tuple3<Integer, Double, String>(n, x, s)} | [
"Creates",
"a",
"new",
"tuple",
"and",
"assigns",
"the",
"given",
"values",
"to",
"the",
"tuple",
"s",
"fields",
".",
"This",
"is",
"more",
"convenient",
"than",
"using",
"the",
"constructor",
"because",
"the",
"compiler",
"can",
"infer",
"the",
"generic",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple7.java#L268-L276 | train | Construct a tuple 7 with the specified values. | [
30522,
2270,
10763,
1026,
1056,
2692,
1010,
1056,
2487,
1010,
1056,
2475,
1010,
1056,
2509,
1010,
1056,
2549,
1010,
1056,
2629,
1010,
1056,
2575,
1028,
10722,
10814,
2581,
1026,
1056,
2692,
1010,
1056,
2487,
1010,
1056,
2475,
1010,
1056,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tag/Nature.java | Nature.fromString | public static final Nature fromString(String name)
{
Integer id = idMap.get(name);
if (id == null)
return null;
return values[id];
} | java | public static final Nature fromString(String name)
{
Integer id = idMap.get(name);
if (id == null)
return null;
return values[id];
} | [
"public",
"static",
"final",
"Nature",
"fromString",
"(",
"String",
"name",
")",
"{",
"Integer",
"id",
"=",
"idMap",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"id",
"==",
"null",
")",
"return",
"null",
";",
"return",
"values",
"[",
"id",
"]",
"... | 安全地将字符串类型的词性转为Enum类型,如果未定义该词性,则返回null
@param name 字符串词性
@return Enum词性 | [
"安全地将字符串类型的词性转为Enum类型,如果未定义该词性,则返回null"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/tag/Nature.java#L825-L831 | train | Get a Nature object from a string. | [
30522,
2270,
10763,
2345,
3267,
2013,
3367,
4892,
1006,
5164,
2171,
1007,
1063,
16109,
8909,
1027,
8909,
2863,
2361,
1012,
2131,
1006,
2171,
1007,
1025,
2065,
1006,
8909,
1027,
1027,
19701,
1007,
2709,
19701,
1025,
2709,
5300,
1031,
8909,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-socket/src/main/java/cn/hutool/socket/aio/AioSession.java | AioSession.read | public AioSession read(CompletionHandler<Integer, AioSession> handler) {
if (isOpen()) {
this.readBuffer.clear();
this.channel.read(this.readBuffer, Math.max(this.readTimeout, 0L), TimeUnit.MILLISECONDS, this, handler);
}
return this;
} | java | public AioSession read(CompletionHandler<Integer, AioSession> handler) {
if (isOpen()) {
this.readBuffer.clear();
this.channel.read(this.readBuffer, Math.max(this.readTimeout, 0L), TimeUnit.MILLISECONDS, this, handler);
}
return this;
} | [
"public",
"AioSession",
"read",
"(",
"CompletionHandler",
"<",
"Integer",
",",
"AioSession",
">",
"handler",
")",
"{",
"if",
"(",
"isOpen",
"(",
")",
")",
"{",
"this",
".",
"readBuffer",
".",
"clear",
"(",
")",
";",
"this",
".",
"channel",
".",
"read",... | 读取数据到Buffer
@param handler {@link CompletionHandler}
@return this | [
"读取数据到Buffer"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-socket/src/main/java/cn/hutool/socket/aio/AioSession.java#L110-L116 | train | Reads data from the device. | [
30522,
2270,
9932,
27465,
10992,
3191,
1006,
6503,
11774,
3917,
1026,
16109,
1010,
30524,
2023,
1012,
3191,
7292,
5833,
1010,
1014,
2140,
1007,
1010,
2051,
19496,
2102,
1012,
4971,
5562,
8663,
5104,
1010,
2023,
1010,
28213,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readLines | public static List<String> readLines(File file, String charset) throws IORuntimeException {
return readLines(file, charset, new ArrayList<String>());
} | java | public static List<String> readLines(File file, String charset) throws IORuntimeException {
return readLines(file, charset, new ArrayList<String>());
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readLines",
"(",
"File",
"file",
",",
"String",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"readLines",
"(",
"file",
",",
"charset",
",",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",... | 从文件中读取每一行数据
@param file 文件
@param charset 字符集
@return 文件中的每行内容的集合List
@throws IORuntimeException IO异常 | [
"从文件中读取每一行数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2380-L2382 | train | Reads a file into a list of strings. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
3191,
12735,
1006,
5371,
5371,
1010,
5164,
25869,
13462,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
3191,
12735,
1006,
5371,
1010,
25869,
13462,
1010,
2047,
9140,
9863,
1026,
5164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/word/NewWordDiscover.java | NewWordDiscover.discover | public List<WordInfo> discover(String doc, int size)
{
try
{
return discover(new BufferedReader(new StringReader(doc)), size);
}
catch (IOException e)
{
throw new RuntimeException(e);
}
} | java | public List<WordInfo> discover(String doc, int size)
{
try
{
return discover(new BufferedReader(new StringReader(doc)), size);
}
catch (IOException e)
{
throw new RuntimeException(e);
}
} | [
"public",
"List",
"<",
"WordInfo",
">",
"discover",
"(",
"String",
"doc",
",",
"int",
"size",
")",
"{",
"try",
"{",
"return",
"discover",
"(",
"new",
"BufferedReader",
"(",
"new",
"StringReader",
"(",
"doc",
")",
")",
",",
"size",
")",
";",
"}",
"cat... | 提取词语
@param doc 大文本
@param size 需要提取词语的数量
@return 一个词语列表 | [
"提取词语"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word/NewWordDiscover.java#L127-L137 | train | Discover a sequence of words from a string. | [
30522,
2270,
2862,
1026,
2773,
2378,
14876,
1028,
7523,
1006,
5164,
9986,
1010,
20014,
2946,
1007,
1063,
3046,
1063,
2709,
7523,
1006,
2047,
17698,
2098,
16416,
4063,
1006,
2047,
5164,
16416,
4063,
1006,
9986,
1007,
1007,
1010,
2946,
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-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java | TableFactoryService.find | public static <T> T find(Class<T> factoryClass, Map<String, String> propertyMap) {
return findInternal(factoryClass, propertyMap, Optional.empty());
} | java | public static <T> T find(Class<T> factoryClass, Map<String, String> propertyMap) {
return findInternal(factoryClass, propertyMap, Optional.empty());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"find",
"(",
"Class",
"<",
"T",
">",
"factoryClass",
",",
"Map",
"<",
"String",
",",
"String",
">",
"propertyMap",
")",
"{",
"return",
"findInternal",
"(",
"factoryClass",
",",
"propertyMap",
",",
"Optional",
".",
... | Finds a table factory of the given class and property map.
@param factoryClass desired factory class
@param propertyMap properties that describe the factory configuration
@param <T> factory class type
@return the matching factory | [
"Finds",
"a",
"table",
"factory",
"of",
"the",
"given",
"class",
"and",
"property",
"map",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java#L93-L95 | train | Find a factory class with the given property map. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
2424,
1006,
2465,
1026,
1056,
1028,
4713,
26266,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
3200,
2863,
2361,
1007,
1063,
2709,
2424,
18447,
11795,
2389,
1006,
4713,
26266,
1010,
3200,
2863,
2361,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.writeLines | public static <T> File writeLines(Collection<T> list, File file, Charset charset, boolean isAppend) throws IORuntimeException {
return FileWriter.create(file, charset).writeLines(list, isAppend);
} | java | public static <T> File writeLines(Collection<T> list, File file, Charset charset, boolean isAppend) throws IORuntimeException {
return FileWriter.create(file, charset).writeLines(list, isAppend);
} | [
"public",
"static",
"<",
"T",
">",
"File",
"writeLines",
"(",
"Collection",
"<",
"T",
">",
"list",
",",
"File",
"file",
",",
"Charset",
"charset",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
... | 将列表写入文件
@param <T> 集合元素类型
@param list 列表
@param file 文件
@param charset 字符集
@param isAppend 是否追加
@return 目标文件
@throws IORuntimeException IO异常 | [
"将列表写入文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3071-L3073 | train | Write a collection of objects to a file. | [
30522,
2270,
10763,
1026,
1056,
1028,
5371,
4339,
12735,
1006,
3074,
1026,
1056,
1028,
2862,
1010,
5371,
5371,
1010,
25869,
13462,
25869,
13462,
1010,
22017,
20898,
18061,
21512,
4859,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java | ExcelUtil.getReader | public static ExcelReader getReader(File bookFile, String sheetName) {
try {
return new ExcelReader(bookFile, sheetName);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | java | public static ExcelReader getReader(File bookFile, String sheetName) {
try {
return new ExcelReader(bookFile, sheetName);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | [
"public",
"static",
"ExcelReader",
"getReader",
"(",
"File",
"bookFile",
",",
"String",
"sheetName",
")",
"{",
"try",
"{",
"return",
"new",
"ExcelReader",
"(",
"bookFile",
",",
"sheetName",
")",
";",
"}",
"catch",
"(",
"NoClassDefFoundError",
"e",
")",
"{",
... | 获取Excel读取器,通过调用{@link ExcelReader}的read或readXXX方法读取Excel内容
@param bookFile Excel文件
@param sheetName sheet名,第一个默认是sheet1
@return {@link ExcelReader} | [
"获取Excel读取器,通过调用",
"{",
"@link",
"ExcelReader",
"}",
"的read或readXXX方法读取Excel内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L245-L251 | train | Returns an ExcelReader for the specified sheet. | [
30522,
2270,
10763,
24970,
16416,
4063,
2131,
16416,
4063,
1006,
5371,
2338,
8873,
2571,
1010,
5164,
7123,
18442,
1007,
1063,
3046,
1063,
2709,
2047,
24970,
16416,
4063,
1006,
2338,
8873,
2571,
1010,
7123,
18442,
1007,
1025,
1065,
4608,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapListState.java | HeapListState.mergeState | @Override
protected List<V> mergeState(List<V> a, List<V> b) {
a.addAll(b);
return a;
} | java | @Override
protected List<V> mergeState(List<V> a, List<V> b) {
a.addAll(b);
return a;
} | [
"@",
"Override",
"protected",
"List",
"<",
"V",
">",
"mergeState",
"(",
"List",
"<",
"V",
">",
"a",
",",
"List",
"<",
"V",
">",
"b",
")",
"{",
"a",
".",
"addAll",
"(",
"b",
")",
";",
"return",
"a",
";",
"}"
] | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapListState.java#L146-L150 | train | Merge two lists of values. | [
30522,
1030,
2058,
15637,
5123,
2862,
1026,
1058,
1028,
13590,
9153,
2618,
1006,
2862,
1026,
1058,
1028,
1037,
1010,
2862,
1026,
1058,
1028,
1038,
1007,
1063,
1037,
1012,
5587,
8095,
1006,
1038,
1007,
1025,
2709,
1037,
1025,
1065,
102,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java | ClusterEntrypoint.cleanupDirectories | private void cleanupDirectories() throws IOException {
ShutdownHookUtil.removeShutdownHook(shutDownHook, getClass().getSimpleName(), LOG);
final String webTmpDir = configuration.getString(WebOptions.TMP_DIR);
FileUtils.deleteDirectory(new File(webTmpDir));
} | java | private void cleanupDirectories() throws IOException {
ShutdownHookUtil.removeShutdownHook(shutDownHook, getClass().getSimpleName(), LOG);
final String webTmpDir = configuration.getString(WebOptions.TMP_DIR);
FileUtils.deleteDirectory(new File(webTmpDir));
} | [
"private",
"void",
"cleanupDirectories",
"(",
")",
"throws",
"IOException",
"{",
"ShutdownHookUtil",
".",
"removeShutdownHook",
"(",
"shutDownHook",
",",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
",",
"LOG",
")",
";",
"final",
"String",
"webTmpDir",
... | Clean up of temporary directories created by the {@link ClusterEntrypoint}.
@throws IOException if the temporary directories could not be cleaned up | [
"Clean",
"up",
"of",
"temporary",
"directories",
"created",
"by",
"the",
"{",
"@link",
"ClusterEntrypoint",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java#L452-L458 | train | Cleanup directories. | [
30522,
2797,
11675,
27686,
4305,
2890,
16761,
3111,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
3844,
7698,
6806,
21940,
3775,
2140,
1012,
20362,
6979,
2102,
7698,
6806,
6559,
1006,
3844,
7698,
6806,
6559,
1010,
2131,
26266,
1006,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/Convert.java | Convert.toLong | public static Long toLong(Object value, Long defaultValue) {
return convert(Long.class, value, defaultValue);
} | java | public static Long toLong(Object value, Long defaultValue) {
return convert(Long.class, value, defaultValue);
} | [
"public",
"static",
"Long",
"toLong",
"(",
"Object",
"value",
",",
"Long",
"defaultValue",
")",
"{",
"return",
"convert",
"(",
"Long",
".",
"class",
",",
"value",
",",
"defaultValue",
")",
";",
"}"
] | 转换为long<br>
如果给定的值为空,或者转换失败,返回默认值<br>
转换失败不会报错
@param value 被转换的值
@param defaultValue 转换错误时的默认值
@return 结果 | [
"转换为long<br",
">",
"如果给定的值为空,或者转换失败,返回默认值<br",
">",
"转换失败不会报错"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L256-L258 | train | Converts value of type Long to Long. | [
30522,
2270,
10763,
2146,
2000,
10052,
1006,
4874,
3643,
1010,
2146,
12398,
10175,
5657,
1007,
1063,
2709,
10463,
1006,
2146,
1012,
2465,
1010,
3643,
1010,
12398,
10175,
5657,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/com/thoughtworks/selenium/DefaultRemoteCommand.java | DefaultRemoteCommand.parse | public static RemoteCommand parse(String inputLine) {
if (null == inputLine) throw new NullPointerException("inputLine can't be null");
String[] values = inputLine.split("\\|");
if (values.length != NUMARGSINCLUDINGBOUNDARIES) {
throw new IllegalStateException("Cannot parse invalid line: " + inputLine + values.length);
}
return new DefaultRemoteCommand(values[FIRSTINDEX], new String[] {values[SECONDINDEX],
values[THIRDINDEX]});
} | java | public static RemoteCommand parse(String inputLine) {
if (null == inputLine) throw new NullPointerException("inputLine can't be null");
String[] values = inputLine.split("\\|");
if (values.length != NUMARGSINCLUDINGBOUNDARIES) {
throw new IllegalStateException("Cannot parse invalid line: " + inputLine + values.length);
}
return new DefaultRemoteCommand(values[FIRSTINDEX], new String[] {values[SECONDINDEX],
values[THIRDINDEX]});
} | [
"public",
"static",
"RemoteCommand",
"parse",
"(",
"String",
"inputLine",
")",
"{",
"if",
"(",
"null",
"==",
"inputLine",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"inputLine can't be null\"",
")",
";",
"String",
"[",
"]",
"values",
"=",
"inputLine",
... | Factory method to create a RemoteCommand from a wiki-style input string
@param inputLine wiki-style input string
@return RemoteCommand | [
"Factory",
"method",
"to",
"create",
"a",
"RemoteCommand",
"from",
"a",
"wiki",
"-",
"style",
"input",
"string"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/com/thoughtworks/selenium/DefaultRemoteCommand.java#L74-L82 | train | Parses a single command line. | [
30522,
2270,
10763,
6556,
9006,
2386,
2094,
11968,
3366,
1006,
5164,
7953,
4179,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
7953,
4179,
1007,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
7953,
4179,
2064,
1005,
1056,
2022,
19701,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java | Sanitizer.setKeysToSanitize | public void setKeysToSanitize(String... keysToSanitize) {
Assert.notNull(keysToSanitize, "KeysToSanitize must not be null");
this.keysToSanitize = new Pattern[keysToSanitize.length];
for (int i = 0; i < keysToSanitize.length; i++) {
this.keysToSanitize[i] = getPattern(keysToSanitize[i]);
}
} | java | public void setKeysToSanitize(String... keysToSanitize) {
Assert.notNull(keysToSanitize, "KeysToSanitize must not be null");
this.keysToSanitize = new Pattern[keysToSanitize.length];
for (int i = 0; i < keysToSanitize.length; i++) {
this.keysToSanitize[i] = getPattern(keysToSanitize[i]);
}
} | [
"public",
"void",
"setKeysToSanitize",
"(",
"String",
"...",
"keysToSanitize",
")",
"{",
"Assert",
".",
"notNull",
"(",
"keysToSanitize",
",",
"\"KeysToSanitize must not be null\"",
")",
";",
"this",
".",
"keysToSanitize",
"=",
"new",
"Pattern",
"[",
"keysToSanitize... | Keys that should be sanitized. Keys can be simple strings that the property ends
with or regular expressions.
@param keysToSanitize the keys to sanitize | [
"Keys",
"that",
"should",
"be",
"sanitized",
".",
"Keys",
"can",
"be",
"simple",
"strings",
"that",
"the",
"property",
"ends",
"with",
"or",
"regular",
"expressions",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Sanitizer.java#L54-L60 | train | Sets the keys to sanitize. | [
30522,
2270,
11675,
2275,
14839,
16033,
8791,
25090,
4371,
1006,
5164,
1012,
1012,
1012,
6309,
13122,
7088,
3775,
4371,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
6309,
13122,
7088,
3775,
4371,
1010,
1000,
6309,
13122,
7088,
3775,
43... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/state/heap/HeapReducingState.java | HeapReducingState.mergeState | @Override
protected V mergeState(V a, V b) throws Exception {
return reduceTransformation.apply(a, b);
} | java | @Override
protected V mergeState(V a, V b) throws Exception {
return reduceTransformation.apply(a, b);
} | [
"@",
"Override",
"protected",
"V",
"mergeState",
"(",
"V",
"a",
",",
"V",
"b",
")",
"throws",
"Exception",
"{",
"return",
"reduceTransformation",
".",
"apply",
"(",
"a",
",",
"b",
")",
";",
"}"
] | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapReducingState.java#L111-L114 | train | Merge two state objects. | [
30522,
1030,
2058,
15637,
5123,
1058,
13590,
9153,
2618,
1006,
1058,
1037,
1010,
1058,
1038,
1007,
11618,
6453,
1063,
2709,
5547,
6494,
3619,
14192,
3370,
1012,
6611,
1006,
1037,
1010,
1038,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.getDegrees | public DataSet<Tuple2<K, LongValue>> getDegrees() {
return outDegrees()
.union(inDegrees()).name("In- and out-degree")
.groupBy(0).sum(1).name("Sum");
} | java | public DataSet<Tuple2<K, LongValue>> getDegrees() {
return outDegrees()
.union(inDegrees()).name("In- and out-degree")
.groupBy(0).sum(1).name("Sum");
} | [
"public",
"DataSet",
"<",
"Tuple2",
"<",
"K",
",",
"LongValue",
">",
">",
"getDegrees",
"(",
")",
"{",
"return",
"outDegrees",
"(",
")",
".",
"union",
"(",
"inDegrees",
"(",
")",
")",
".",
"name",
"(",
"\"In- and out-degree\"",
")",
".",
"groupBy",
"("... | Return the degree of all vertices in the graph.
@return A DataSet of {@code Tuple2<vertexId, degree>} | [
"Return",
"the",
"degree",
"of",
"all",
"vertices",
"in",
"the",
"graph",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L974-L978 | train | Get the degree of the data set. | [
30522,
2270,
2951,
13462,
1026,
10722,
10814,
2475,
1026,
1047,
1010,
2146,
10175,
5657,
1028,
1028,
2131,
3207,
28637,
2015,
1006,
1007,
1063,
2709,
2041,
3207,
28637,
2015,
1006,
1007,
1012,
2586,
1006,
27427,
13910,
9910,
2015,
1006,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.followedByAny | public Pattern<T, T> followedByAny(final String name) {
return new Pattern<>(name, this, ConsumingStrategy.SKIP_TILL_ANY, afterMatchSkipStrategy);
} | java | public Pattern<T, T> followedByAny(final String name) {
return new Pattern<>(name, this, ConsumingStrategy.SKIP_TILL_ANY, afterMatchSkipStrategy);
} | [
"public",
"Pattern",
"<",
"T",
",",
"T",
">",
"followedByAny",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"new",
"Pattern",
"<>",
"(",
"name",
",",
"this",
",",
"ConsumingStrategy",
".",
"SKIP_TILL_ANY",
",",
"afterMatchSkipStrategy",
")",
";",
"}... | Appends a new pattern to the existing one. The new pattern enforces non-strict
temporal contiguity. This means that a matching event of this pattern and the
preceding matching event might be interleaved with other events which are ignored.
@param name Name of the new pattern
@return A new pattern which is appended to this one | [
"Appends",
"a",
"new",
"pattern",
"to",
"the",
"existing",
"one",
".",
"The",
"new",
"pattern",
"enforces",
"non",
"-",
"strict",
"temporal",
"contiguity",
".",
"This",
"means",
"that",
"a",
"matching",
"event",
"of",
"this",
"pattern",
"and",
"the",
"prec... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L321-L323 | train | Creates a pattern that matches when the given string is followed by any of the matched elements. | [
30522,
2270,
5418,
1026,
1056,
1010,
1056,
1028,
2628,
3762,
19092,
1006,
2345,
5164,
2171,
1007,
1063,
2709,
2047,
5418,
1026,
1028,
1006,
2171,
1010,
2023,
1010,
15077,
20528,
2618,
6292,
1012,
13558,
1035,
6229,
1035,
2151,
1010,
2044,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/NetUtils.java | NetUtils.hostAndPortToUrlString | public static String hostAndPortToUrlString(String host, int port) throws UnknownHostException {
return ipAddressAndPortToUrlString(InetAddress.getByName(host), port);
} | java | public static String hostAndPortToUrlString(String host, int port) throws UnknownHostException {
return ipAddressAndPortToUrlString(InetAddress.getByName(host), port);
} | [
"public",
"static",
"String",
"hostAndPortToUrlString",
"(",
"String",
"host",
",",
"int",
"port",
")",
"throws",
"UnknownHostException",
"{",
"return",
"ipAddressAndPortToUrlString",
"(",
"InetAddress",
".",
"getByName",
"(",
"host",
")",
",",
"port",
")",
";",
... | Normalizes and encodes a hostname and port to be included in URL.
In particular, this method makes sure that IPv6 address literals have the proper
formatting to be included in URLs.
@param host The address to be included in the URL.
@param port The port for the URL address.
@return The proper URL string encoded IP address and port.
@throws java.net.UnknownHostException Thrown, if the hostname cannot be translated into a URL. | [
"Normalizes",
"and",
"encodes",
"a",
"hostname",
"and",
"port",
"to",
"be",
"included",
"in",
"URL",
".",
"In",
"particular",
"this",
"method",
"makes",
"sure",
"that",
"IPv6",
"address",
"literals",
"have",
"the",
"proper",
"formatting",
"to",
"be",
"includ... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/NetUtils.java#L229-L231 | train | Convert host and port to url string. | [
30522,
2270,
10763,
5164,
3677,
5685,
6442,
21163,
4877,
18886,
3070,
1006,
5164,
3677,
1010,
20014,
3417,
1007,
11618,
4242,
15006,
2618,
2595,
24422,
1063,
2709,
25249,
16200,
11488,
4859,
6442,
21163,
4877,
18886,
3070,
1006,
1999,
12928,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java | EnvironmentInformation.getJvmVersion | public static String getJvmVersion() {
try {
final RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean();
return bean.getVmName() + " - " + bean.getVmVendor() + " - " + bean.getSpecVersion() + '/' + bean.getVmVersion();
}
catch (Throwable t) {
return UNKNOWN;
}
} | java | public static String getJvmVersion() {
try {
final RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean();
return bean.getVmName() + " - " + bean.getVmVendor() + " - " + bean.getSpecVersion() + '/' + bean.getVmVersion();
}
catch (Throwable t) {
return UNKNOWN;
}
} | [
"public",
"static",
"String",
"getJvmVersion",
"(",
")",
"{",
"try",
"{",
"final",
"RuntimeMXBean",
"bean",
"=",
"ManagementFactory",
".",
"getRuntimeMXBean",
"(",
")",
";",
"return",
"bean",
".",
"getVmName",
"(",
")",
"+",
"\" - \"",
"+",
"bean",
".",
"g... | Gets the version of the JVM in the form "VM_Name - Vendor - Spec/Version".
@return The JVM version. | [
"Gets",
"the",
"version",
"of",
"the",
"JVM",
"in",
"the",
"form",
"VM_Name",
"-",
"Vendor",
"-",
"Spec",
"/",
"Version",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java#L174-L182 | train | Get the version of the JVM. | [
30522,
2270,
10763,
5164,
2131,
3501,
2615,
2213,
27774,
1006,
1007,
1063,
3046,
1063,
2345,
2448,
7292,
22984,
4783,
2319,
14068,
1027,
2968,
21450,
1012,
2131,
15532,
7292,
22984,
4783,
2319,
1006,
1007,
1025,
2709,
14068,
1012,
2131,
261... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java | WatchMonitor.create | public static WatchMonitor create(URI uri, int maxDepth, WatchEvent.Kind<?>... events){
return create(Paths.get(uri), maxDepth, events);
} | java | public static WatchMonitor create(URI uri, int maxDepth, WatchEvent.Kind<?>... events){
return create(Paths.get(uri), maxDepth, events);
} | [
"public",
"static",
"WatchMonitor",
"create",
"(",
"URI",
"uri",
",",
"int",
"maxDepth",
",",
"WatchEvent",
".",
"Kind",
"<",
"?",
">",
"...",
"events",
")",
"{",
"return",
"create",
"(",
"Paths",
".",
"get",
"(",
"uri",
")",
",",
"maxDepth",
",",
"e... | 创建并初始化监听
@param uri URI
@param events 监听的事件列表
@param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录
@return 监听对象 | [
"创建并初始化监听"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L120-L122 | train | Creates a new watch monitor for the given uri. | [
30522,
2270,
10763,
3422,
8202,
15660,
3443,
1006,
24471,
2072,
24471,
2072,
1010,
20014,
4098,
3207,
13876,
2232,
1010,
3422,
18697,
3372,
1012,
2785,
1026,
1029,
1028,
1012,
1012,
1012,
2824,
1007,
1063,
2709,
3443,
1006,
10425,
1012,
213... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/types/valuearray/DoubleValueArray.java | DoubleValueArray.compareTo | @Override
public int compareTo(ValueArray<DoubleValue> o) {
DoubleValueArray other = (DoubleValueArray) o;
int min = Math.min(position, other.position);
for (int i = 0; i < min; i++) {
int cmp = Double.compare(data[i], other.data[i]);
if (cmp != 0) {
return cmp;
}
}
return Integer.compare(position, other.position);
} | java | @Override
public int compareTo(ValueArray<DoubleValue> o) {
DoubleValueArray other = (DoubleValueArray) o;
int min = Math.min(position, other.position);
for (int i = 0; i < min; i++) {
int cmp = Double.compare(data[i], other.data[i]);
if (cmp != 0) {
return cmp;
}
}
return Integer.compare(position, other.position);
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"ValueArray",
"<",
"DoubleValue",
">",
"o",
")",
"{",
"DoubleValueArray",
"other",
"=",
"(",
"DoubleValueArray",
")",
"o",
";",
"int",
"min",
"=",
"Math",
".",
"min",
"(",
"position",
",",
"other",
".",... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/DoubleValueArray.java#L226-L240 | train | Compares two DoubleValueArrays. | [
30522,
1030,
2058,
15637,
2270,
20014,
12826,
3406,
1006,
3643,
2906,
9447,
1026,
3313,
10175,
5657,
1028,
1051,
1007,
1063,
3313,
10175,
5657,
2906,
9447,
2060,
1027,
1006,
3313,
10175,
5657,
2906,
9447,
1007,
1051,
1025,
20014,
8117,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/CaseInsensitiveMap.java | CaseInsensitiveMap.customKey | @Override
protected Object customKey(Object key) {
if (null != key && key instanceof CharSequence) {
key = key.toString().toLowerCase();
}
return key;
} | java | @Override
protected Object customKey(Object key) {
if (null != key && key instanceof CharSequence) {
key = key.toString().toLowerCase();
}
return key;
} | [
"@",
"Override",
"protected",
"Object",
"customKey",
"(",
"Object",
"key",
")",
"{",
"if",
"(",
"null",
"!=",
"key",
"&&",
"key",
"instanceof",
"CharSequence",
")",
"{",
"key",
"=",
"key",
".",
"toString",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
... | 将Key转为小写
@param key KEY
@return 小写KEY | [
"将Key转为小写"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/CaseInsensitiveMap.java#L74-L80 | train | Override to set the custom key to lowercase. | [
30522,
1030,
2058,
15637,
5123,
4874,
7661,
14839,
1006,
4874,
3145,
1007,
1063,
2065,
1006,
19701,
999,
1027,
3145,
1004,
1004,
3145,
6013,
11253,
25869,
3366,
4226,
5897,
1007,
1063,
3145,
1027,
3145,
1012,
2000,
3367,
4892,
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-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java | OptimizerNode.addOutgoingConnection | public void addOutgoingConnection(DagConnection connection) {
if (this.outgoingConnections == null) {
this.outgoingConnections = new ArrayList<DagConnection>();
} else {
if (this.outgoingConnections.size() == 64) {
throw new CompilerException("Cannot currently handle nodes with more than 64 outputs.");
}
}
this.outgoingConnections.add(connection);
} | java | public void addOutgoingConnection(DagConnection connection) {
if (this.outgoingConnections == null) {
this.outgoingConnections = new ArrayList<DagConnection>();
} else {
if (this.outgoingConnections.size() == 64) {
throw new CompilerException("Cannot currently handle nodes with more than 64 outputs.");
}
}
this.outgoingConnections.add(connection);
} | [
"public",
"void",
"addOutgoingConnection",
"(",
"DagConnection",
"connection",
")",
"{",
"if",
"(",
"this",
".",
"outgoingConnections",
"==",
"null",
")",
"{",
"this",
".",
"outgoingConnections",
"=",
"new",
"ArrayList",
"<",
"DagConnection",
">",
"(",
")",
";... | Adds a new outgoing connection to this node.
@param connection
The connection to add. | [
"Adds",
"a",
"new",
"outgoing",
"connection",
"to",
"this",
"node",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java#L343-L353 | train | Adds an outgoing connection to this node. | [
30522,
2270,
11675,
5587,
5833,
26966,
8663,
2638,
7542,
1006,
4830,
18195,
18256,
7542,
4434,
1007,
1063,
2065,
1006,
2023,
1012,
22011,
8663,
2638,
22014,
1027,
1027,
19701,
1007,
1063,
2023,
1012,
22011,
8663,
2638,
22014,
1027,
2047,
91... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getInt32 | public final int getInt32() {
if (position + 3 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 3));
byte[] buf = buffer;
return (0xff & buf[position++]) | ((0xff & buf[position++]) << 8) | ((0xff & buf[position++]) << 16)
| ((buf[position++]) << 24);
} | java | public final int getInt32() {
if (position + 3 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 3));
byte[] buf = buffer;
return (0xff & buf[position++]) | ((0xff & buf[position++]) << 8) | ((0xff & buf[position++]) << 16)
| ((buf[position++]) << 24);
} | [
"public",
"final",
"int",
"getInt32",
"(",
")",
"{",
"if",
"(",
"position",
"+",
"3",
">=",
"origin",
"+",
"limit",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"(",
"position",
"-",
"origin",
"+",
"3",
")",
")",
";",... | Return next 32-bit signed int from buffer. (little-endian)
@see mysql-5.1.60/include/my_global.h - sint4korr | [
"Return",
"next",
"32",
"-",
"bit",
"signed",
"int",
"from",
"buffer",
".",
"(",
"little",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L501-L508 | train | Gets a 32 - bit integer from the buffer. | [
30522,
2270,
2345,
20014,
2131,
18447,
16703,
1006,
1007,
1063,
2065,
1006,
2597,
1009,
1017,
1028,
1027,
4761,
1009,
5787,
1007,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
5787,
4654,
9468,
13089,
1024,
1000,
1009,
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-db/src/main/java/cn/hutool/db/dialect/DriverUtil.java | DriverUtil.identifyDriver | public static String identifyDriver(Connection conn) throws DbRuntimeException {
String driver = null;
DatabaseMetaData meta;
try {
meta = conn.getMetaData();
driver = identifyDriver(meta.getDatabaseProductName());
if (StrUtil.isBlank(driver)) {
driver = identifyDriver(meta.getDriverName());
}
} catch (SQLException e) {
throw new DbRuntimeException("Identify driver error!", e);
}
return driver;
} | java | public static String identifyDriver(Connection conn) throws DbRuntimeException {
String driver = null;
DatabaseMetaData meta;
try {
meta = conn.getMetaData();
driver = identifyDriver(meta.getDatabaseProductName());
if (StrUtil.isBlank(driver)) {
driver = identifyDriver(meta.getDriverName());
}
} catch (SQLException e) {
throw new DbRuntimeException("Identify driver error!", e);
}
return driver;
} | [
"public",
"static",
"String",
"identifyDriver",
"(",
"Connection",
"conn",
")",
"throws",
"DbRuntimeException",
"{",
"String",
"driver",
"=",
"null",
";",
"DatabaseMetaData",
"meta",
";",
"try",
"{",
"meta",
"=",
"conn",
".",
"getMetaData",
"(",
")",
";",
"d... | 识别JDBC驱动名
@param conn 数据库连接对象
@return 驱动
@throws DbRuntimeException SQL异常包装,获取元数据信息失败 | [
"识别JDBC驱动名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/dialect/DriverUtil.java#L71-L85 | train | Identify the database driver for a connection. | [
30522,
2270,
10763,
5164,
6709,
23663,
2099,
1006,
4434,
9530,
2078,
1007,
11618,
16962,
15532,
7292,
10288,
24422,
1063,
5164,
4062,
1027,
19701,
1025,
7809,
11368,
8447,
2696,
18804,
1025,
3046,
1063,
18804,
1027,
9530,
2078,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java | HashUtil.elfHash | public static int elfHash(String str) {
int hash = 0;
int x = 0;
for (int i = 0; i < str.length(); i++) {
hash = (hash << 4) + str.charAt(i);
if ((x = (int) (hash & 0xF0000000L)) != 0) {
hash ^= (x >> 24);
hash &= ~x;
}
}
return hash & 0x7FFFFFFF;
} | java | public static int elfHash(String str) {
int hash = 0;
int x = 0;
for (int i = 0; i < str.length(); i++) {
hash = (hash << 4) + str.charAt(i);
if ((x = (int) (hash & 0xF0000000L)) != 0) {
hash ^= (x >> 24);
hash &= ~x;
}
}
return hash & 0x7FFFFFFF;
} | [
"public",
"static",
"int",
"elfHash",
"(",
"String",
"str",
")",
"{",
"int",
"hash",
"=",
"0",
";",
"int",
"x",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"hash"... | ELF算法
@param str 字符串
@return hash值 | [
"ELF算法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java#L260-L273 | train | Returns the ELF hash code of the specified string. | [
30522,
2270,
10763,
20014,
17163,
14949,
2232,
1006,
5164,
2358,
2099,
1007,
1063,
20014,
23325,
1027,
1014,
1025,
20014,
1060,
1027,
1014,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
2358,
2099,
1012,
3091,
1006,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java | ReflectUtil.getMethodIgnoreCase | public static Method getMethodIgnoreCase(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException {
return getMethod(clazz, true, methodName, paramTypes);
} | java | public static Method getMethodIgnoreCase(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException {
return getMethod(clazz, true, methodName, paramTypes);
} | [
"public",
"static",
"Method",
"getMethodIgnoreCase",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"paramTypes",
")",
"throws",
"SecurityException",
"{",
"return",
"getMethod",
"(",
"clazz",
",",
"true... | 忽略大小写查找指定方法,如果找不到对应的方法则返回<code>null</code>
<p>
此方法为精准获取方法名,即方法名和参数数量和类型必须一致,否则返回<code>null</code>。
</p>
@param clazz 类,如果为{@code null}返回{@code null}
@param methodName 方法名,如果为空字符串返回{@code null}
@param paramTypes 参数类型,指定参数类型如果是方法的子类也算
@return 方法
@throws SecurityException 无权访问抛出异常
@since 3.2.0 | [
"忽略大小写查找指定方法,如果找不到对应的方法则返回<code",
">",
"null<",
"/",
"code",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L414-L416 | train | Get a Method object that implements the specified Method name ignoring case. | [
30522,
2270,
10763,
4118,
2131,
11368,
6806,
4305,
26745,
2890,
18382,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
5164,
4118,
18442,
1010,
2465,
1026,
1029,
1028,
1012,
1012,
1012,
11498,
20492,
18863,
2015,
1007,
11618,
3036,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/GlobalLogFactory.java | GlobalLogFactory.set | public static LogFactory set(LogFactory logFactory) {
logFactory.getLog(GlobalLogFactory.class).debug("Custom Use [{}] Logger.", logFactory.name);
currentLogFactory = logFactory;
return currentLogFactory;
} | java | public static LogFactory set(LogFactory logFactory) {
logFactory.getLog(GlobalLogFactory.class).debug("Custom Use [{}] Logger.", logFactory.name);
currentLogFactory = logFactory;
return currentLogFactory;
} | [
"public",
"static",
"LogFactory",
"set",
"(",
"LogFactory",
"logFactory",
")",
"{",
"logFactory",
".",
"getLog",
"(",
"GlobalLogFactory",
".",
"class",
")",
".",
"debug",
"(",
"\"Custom Use [{}] Logger.\"",
",",
"logFactory",
".",
"name",
")",
";",
"currentLogFa... | 自定义日志实现
@see Slf4jLogFactory
@see Log4jLogFactory
@see Log4j2LogFactory
@see ApacheCommonsLogFactory
@see JdkLogFactory
@see ConsoleLogFactory
@param logFactory 日志工厂类对象
@return 自定义的日志工厂类 | [
"自定义日志实现"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/GlobalLogFactory.java#L71-L75 | train | Set the LogFactory to use. | [
30522,
2270,
10763,
8833,
21450,
2275,
1006,
8833,
21450,
8833,
21450,
1007,
1063,
8833,
21450,
1012,
2131,
21197,
1006,
3795,
21197,
21450,
1012,
2465,
1007,
1012,
2139,
8569,
2290,
1006,
1000,
7661,
2224,
1031,
1063,
1065,
1033,
8833,
459... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.closeAsync | @Override
public CompletableFuture<Void> closeAsync() {
synchronized (lock) {
if (running) {
LOG.info("Shutting down Flink Mini Cluster");
try {
final long shutdownTimeoutMillis = miniClusterConfiguration.getConfiguration().getLong(ClusterOptions.CLUSTER_SERVICES_SHUTDOWN_TIMEOUT);
final int numComponents = 2 + miniClusterConfiguration.getNumTaskManagers();
final Collection<CompletableFuture<Void>> componentTerminationFutures = new ArrayList<>(numComponents);
componentTerminationFutures.addAll(terminateTaskExecutors());
componentTerminationFutures.add(shutDownResourceManagerComponents());
final FutureUtils.ConjunctFuture<Void> componentsTerminationFuture = FutureUtils.completeAll(componentTerminationFutures);
final CompletableFuture<Void> metricSystemTerminationFuture = FutureUtils.composeAfterwards(
componentsTerminationFuture,
this::closeMetricSystem);
// shut down the RpcServices
final CompletableFuture<Void> rpcServicesTerminationFuture = metricSystemTerminationFuture
.thenCompose((Void ignored) -> terminateRpcServices());
final CompletableFuture<Void> remainingServicesTerminationFuture = FutureUtils.runAfterwards(
rpcServicesTerminationFuture,
this::terminateMiniClusterServices);
final CompletableFuture<Void> executorsTerminationFuture = FutureUtils.runAfterwards(
remainingServicesTerminationFuture,
() -> terminateExecutors(shutdownTimeoutMillis));
executorsTerminationFuture.whenComplete(
(Void ignored, Throwable throwable) -> {
if (throwable != null) {
terminationFuture.completeExceptionally(ExceptionUtils.stripCompletionException(throwable));
} else {
terminationFuture.complete(null);
}
});
} finally {
running = false;
}
}
return terminationFuture;
}
} | java | @Override
public CompletableFuture<Void> closeAsync() {
synchronized (lock) {
if (running) {
LOG.info("Shutting down Flink Mini Cluster");
try {
final long shutdownTimeoutMillis = miniClusterConfiguration.getConfiguration().getLong(ClusterOptions.CLUSTER_SERVICES_SHUTDOWN_TIMEOUT);
final int numComponents = 2 + miniClusterConfiguration.getNumTaskManagers();
final Collection<CompletableFuture<Void>> componentTerminationFutures = new ArrayList<>(numComponents);
componentTerminationFutures.addAll(terminateTaskExecutors());
componentTerminationFutures.add(shutDownResourceManagerComponents());
final FutureUtils.ConjunctFuture<Void> componentsTerminationFuture = FutureUtils.completeAll(componentTerminationFutures);
final CompletableFuture<Void> metricSystemTerminationFuture = FutureUtils.composeAfterwards(
componentsTerminationFuture,
this::closeMetricSystem);
// shut down the RpcServices
final CompletableFuture<Void> rpcServicesTerminationFuture = metricSystemTerminationFuture
.thenCompose((Void ignored) -> terminateRpcServices());
final CompletableFuture<Void> remainingServicesTerminationFuture = FutureUtils.runAfterwards(
rpcServicesTerminationFuture,
this::terminateMiniClusterServices);
final CompletableFuture<Void> executorsTerminationFuture = FutureUtils.runAfterwards(
remainingServicesTerminationFuture,
() -> terminateExecutors(shutdownTimeoutMillis));
executorsTerminationFuture.whenComplete(
(Void ignored, Throwable throwable) -> {
if (throwable != null) {
terminationFuture.completeExceptionally(ExceptionUtils.stripCompletionException(throwable));
} else {
terminationFuture.complete(null);
}
});
} finally {
running = false;
}
}
return terminationFuture;
}
} | [
"@",
"Override",
"public",
"CompletableFuture",
"<",
"Void",
">",
"closeAsync",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"running",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Shutting down Flink Mini Cluster\"",
")",
";",
"try",
"{",
"fi... | Shuts down the mini cluster, failing all currently executing jobs.
The mini cluster can be started again by calling the {@link #start()} method again.
<p>This method shuts down all started services and components,
even if an exception occurs in the process of shutting down some component.
@return Future which is completed once the MiniCluster has been completely shut down | [
"Shuts",
"down",
"the",
"mini",
"cluster",
"failing",
"all",
"currently",
"executing",
"jobs",
".",
"The",
"mini",
"cluster",
"can",
"be",
"started",
"again",
"by",
"calling",
"the",
"{",
"@link",
"#start",
"()",
"}",
"method",
"again",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java#L413-L460 | train | Close the Flink Mini Cluster asynchronously. | [
30522,
1030,
2058,
15637,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
11675,
1028,
2485,
3022,
6038,
2278,
1006,
1007,
1063,
25549,
1006,
5843,
1007,
1063,
2065,
1006,
2770,
1007,
1063,
8833,
1012,
18558,
1006,
1000,
17521,
2091,
13109,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java | URLUtil.getURL | public static URL getURL(File file) {
Assert.notNull(file, "File is null !");
try {
return file.toURI().toURL();
} catch (MalformedURLException e) {
throw new UtilException(e, "Error occured when get URL!");
}
} | java | public static URL getURL(File file) {
Assert.notNull(file, "File is null !");
try {
return file.toURI().toURL();
} catch (MalformedURLException e) {
throw new UtilException(e, "Error occured when get URL!");
}
} | [
"public",
"static",
"URL",
"getURL",
"(",
"File",
"file",
")",
"{",
"Assert",
".",
"notNull",
"(",
"file",
",",
"\"File is null !\"",
")",
";",
"try",
"{",
"return",
"file",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
";",
"}",
"catch",
"(",
"M... | 获得URL,常用于使用绝对路径时的情况
@param file URL对应的文件对象
@return URL
@exception UtilException MalformedURLException | [
"获得URL,常用于使用绝对路径时的情况"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L156-L163 | train | Gets the URL of a file. | [
30522,
2270,
10763,
24471,
2140,
2131,
3126,
2140,
1006,
5371,
5371,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
5371,
1010,
1000,
5371,
2003,
19701,
999,
1000,
1007,
1025,
3046,
1063,
2709,
5371,
1012,
2778,
2072,
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... |
networknt/light-4j | client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java | CharArrayBuffer.append | public void append(final ByteArrayBuffer b, final int off, final int len) {
if (b == null) {
return;
}
append(b.array(), off, len);
} | java | public void append(final ByteArrayBuffer b, final int off, final int len) {
if (b == null) {
return;
}
append(b.array(), off, len);
} | [
"public",
"void",
"append",
"(",
"final",
"ByteArrayBuffer",
"b",
",",
"final",
"int",
"off",
",",
"final",
"int",
"len",
")",
"{",
"if",
"(",
"b",
"==",
"null",
")",
"{",
"return",
";",
"}",
"append",
"(",
"b",
".",
"array",
"(",
")",
",",
"off"... | Appends {@code len} bytes to this buffer from the given source
array starting at index {@code off}. The capacity of the buffer
is increased, if necessary, to accommodate all {@code len} bytes.
<p>
The bytes are converted to chars using simple cast.
@param b the bytes to be appended.
@param off the index of the first byte to append.
@param len the number of bytes to append.
@throws IndexOutOfBoundsException if {@code off} is out of
range, {@code len} is negative, or
{@code off} + {@code len} is out of range. | [
"Appends",
"{",
"@code",
"len",
"}",
"bytes",
"to",
"this",
"buffer",
"from",
"the",
"given",
"source",
"array",
"starting",
"at",
"index",
"{",
"@code",
"off",
"}",
".",
"The",
"capacity",
"of",
"the",
"buffer",
"is",
"increased",
"if",
"necessary",
"to... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java#L212-L217 | train | Append a byte array buffer to the log. | [
30522,
2270,
11675,
10439,
10497,
1006,
2345,
24880,
2906,
9447,
8569,
12494,
1038,
1010,
2345,
20014,
2125,
1010,
2345,
20014,
18798,
1007,
1063,
2065,
1006,
1038,
1027,
1027,
19701,
1007,
1063,
2709,
1025,
1065,
10439,
10497,
1006,
1038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java | IterUtil.toMap | public static <K, V> HashMap<K, V> toMap(Iterable<Entry<K, V>> entryIter) {
final HashMap<K, V> map = new HashMap<K, V>();
if (isNotEmpty(entryIter)) {
for (Entry<K, V> entry : entryIter) {
map.put(entry.getKey(), entry.getValue());
}
}
return map;
} | java | public static <K, V> HashMap<K, V> toMap(Iterable<Entry<K, V>> entryIter) {
final HashMap<K, V> map = new HashMap<K, V>();
if (isNotEmpty(entryIter)) {
for (Entry<K, V> entry : entryIter) {
map.put(entry.getKey(), entry.getValue());
}
}
return map;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"HashMap",
"<",
"K",
",",
"V",
">",
"toMap",
"(",
"Iterable",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"entryIter",
")",
"{",
"final",
"HashMap",
"<",
"K",
",",
"V",
">",
"map",
"=",
"new",
"Has... | 将Entry集合转换为HashMap
@param <K> 键类型
@param <V> 值类型
@param entryIter entry集合
@return Map | [
"将Entry集合转换为HashMap"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L349-L357 | train | Creates a map from the given iterable of entries. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
23325,
2863,
2361,
1026,
1047,
1010,
1058,
1028,
3419,
9331,
1006,
2009,
6906,
3468,
1026,
4443,
1026,
1047,
1010,
1058,
1028,
1028,
4443,
21646,
1007,
1063,
2345,
23325,
2863,
2361,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | utility/src/main/java/com/networknt/utility/StringUtils.java | StringUtils.join | public static String join(final Iterable<?> iterable, final char separator) {
if (iterable == null) {
return null;
}
return join(iterable.iterator(), separator);
} | java | public static String join(final Iterable<?> iterable, final char separator) {
if (iterable == null) {
return null;
}
return join(iterable.iterator(), separator);
} | [
"public",
"static",
"String",
"join",
"(",
"final",
"Iterable",
"<",
"?",
">",
"iterable",
",",
"final",
"char",
"separator",
")",
"{",
"if",
"(",
"iterable",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"join",
"(",
"iterable",
".",
... | <p>Joins the elements of the provided {@code Iterable} into
a single String containing the provided elements.</p>
<p>No delimiter is added before or after the list. Null objects or empty
strings within the iteration are represented by empty strings.</p>
<p>See the examples here: {@link #join(Object[],char)}. </p>
@param iterable the {@code Iterable} providing the values to join together, may be null
@param separator the separator character to use
@return the joined String, {@code null} if null iterator input
@since 2.3 | [
"<p",
">",
"Joins",
"the",
"elements",
"of",
"the",
"provided",
"{",
"@code",
"Iterable",
"}",
"into",
"a",
"single",
"String",
"containing",
"the",
"provided",
"elements",
".",
"<",
"/",
"p",
">"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/StringUtils.java#L1244-L1249 | train | Join an iterable of strings. | [
30522,
2270,
10763,
5164,
3693,
1006,
2345,
2009,
6906,
3468,
1026,
1029,
1028,
2009,
6906,
3468,
1010,
2345,
25869,
19802,
25879,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/Other/CommonAhoCorasickSegmentUtil.java | CommonAhoCorasickSegmentUtil.segment | public static <V> LinkedList<ResultTerm<V>> segment(String text, AhoCorasickDoubleArrayTrie<V> trie)
{
return segment(text.toCharArray(), trie);
} | java | public static <V> LinkedList<ResultTerm<V>> segment(String text, AhoCorasickDoubleArrayTrie<V> trie)
{
return segment(text.toCharArray(), trie);
} | [
"public",
"static",
"<",
"V",
">",
"LinkedList",
"<",
"ResultTerm",
"<",
"V",
">",
">",
"segment",
"(",
"String",
"text",
",",
"AhoCorasickDoubleArrayTrie",
"<",
"V",
">",
"trie",
")",
"{",
"return",
"segment",
"(",
"text",
".",
"toCharArray",
"(",
")",
... | 最长分词,合并未知语素
@param text 文本
@param trie 自动机
@param <V> 类型
@return 结果链表 | [
"最长分词,合并未知语素"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Other/CommonAhoCorasickSegmentUtil.java#L35-L38 | train | segment a string into a list of terms. | [
30522,
2270,
10763,
1026,
1058,
1028,
5799,
9863,
1026,
2765,
3334,
2213,
1026,
1058,
1028,
1028,
6903,
1006,
5164,
3793,
1010,
6289,
24163,
8180,
6799,
26797,
3468,
2906,
9447,
18886,
2063,
1026,
1058,
1028,
13012,
2063,
1007,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/InstantiationUtil.java | InstantiationUtil.resolveClassByName | public static <T> Class<T> resolveClassByName(
DataInputView in,
ClassLoader cl,
Class<? super T> supertype) throws IOException {
final String className = in.readUTF();
final Class<?> rawClazz;
try {
rawClazz = Class.forName(className, false, cl);
}
catch (ClassNotFoundException e) {
throw new IOException(
"Could not find class '" + className + "' in classpath.", e);
}
if (!supertype.isAssignableFrom(rawClazz)) {
throw new IOException("The class " + className + " is not a subclass of " + supertype.getName());
}
@SuppressWarnings("unchecked")
Class<T> clazz = (Class<T>) rawClazz;
return clazz;
} | java | public static <T> Class<T> resolveClassByName(
DataInputView in,
ClassLoader cl,
Class<? super T> supertype) throws IOException {
final String className = in.readUTF();
final Class<?> rawClazz;
try {
rawClazz = Class.forName(className, false, cl);
}
catch (ClassNotFoundException e) {
throw new IOException(
"Could not find class '" + className + "' in classpath.", e);
}
if (!supertype.isAssignableFrom(rawClazz)) {
throw new IOException("The class " + className + " is not a subclass of " + supertype.getName());
}
@SuppressWarnings("unchecked")
Class<T> clazz = (Class<T>) rawClazz;
return clazz;
} | [
"public",
"static",
"<",
"T",
">",
"Class",
"<",
"T",
">",
"resolveClassByName",
"(",
"DataInputView",
"in",
",",
"ClassLoader",
"cl",
",",
"Class",
"<",
"?",
"super",
"T",
">",
"supertype",
")",
"throws",
"IOException",
"{",
"final",
"String",
"className"... | Loads a class by name from the given input stream and reflectively instantiates it.
<p>This method will use {@link DataInputView#readUTF()} to read the class name, and
then attempt to load the class from the given ClassLoader.
<p>The resolved class is checked to be equal to or a subtype of the given supertype
class.
@param in The stream to read the class name from.
@param cl The class loader to resolve the class.
@param supertype A class that the resolved class must extend.
@throws IOException Thrown, if the class name could not be read, the class could not be found,
or the class is not a subtype of the given supertype class. | [
"Loads",
"a",
"class",
"by",
"name",
"from",
"the",
"given",
"input",
"stream",
"and",
"reflectively",
"instantiates",
"it",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/InstantiationUtil.java#L700-L722 | train | Resolves a class by name. | [
30522,
2270,
10763,
1026,
1056,
1028,
2465,
1026,
1056,
1028,
10663,
26266,
3762,
18442,
1006,
2951,
2378,
18780,
8584,
1999,
1010,
2465,
11066,
2121,
18856,
1010,
2465,
1026,
1029,
3565,
1056,
1028,
3565,
13874,
1007,
11618,
22834,
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... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.signParams | public static String signParams(DigestAlgorithm digestAlgorithm, Map<?, ?> params, String separator, String keyValueSeparator, boolean isIgnoreNull) {
if (MapUtil.isEmpty(params)) {
return null;
}
final String paramsStr = MapUtil.join(MapUtil.sort(params), separator, keyValueSeparator, isIgnoreNull);
return new Digester(digestAlgorithm).digestHex(paramsStr);
} | java | public static String signParams(DigestAlgorithm digestAlgorithm, Map<?, ?> params, String separator, String keyValueSeparator, boolean isIgnoreNull) {
if (MapUtil.isEmpty(params)) {
return null;
}
final String paramsStr = MapUtil.join(MapUtil.sort(params), separator, keyValueSeparator, isIgnoreNull);
return new Digester(digestAlgorithm).digestHex(paramsStr);
} | [
"public",
"static",
"String",
"signParams",
"(",
"DigestAlgorithm",
"digestAlgorithm",
",",
"Map",
"<",
"?",
",",
"?",
">",
"params",
",",
"String",
"separator",
",",
"String",
"keyValueSeparator",
",",
"boolean",
"isIgnoreNull",
")",
"{",
"if",
"(",
"MapUtil"... | 对参数做签名<br>
参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串
@param digestAlgorithm 摘要算法
@param params 参数
@param separator entry之间的连接符
@param keyValueSeparator kv之间的连接符
@param isIgnoreNull 是否忽略null的键和值
@return 签名
@since 4.0.1 | [
"对参数做签名<br",
">",
"参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L920-L926 | train | Sign params. | [
30522,
2270,
10763,
5164,
3696,
28689,
5244,
1006,
17886,
2389,
20255,
8939,
2213,
17886,
2389,
20255,
8939,
2213,
1010,
4949,
1026,
1029,
1010,
1029,
1028,
11498,
5244,
1010,
5164,
19802,
25879,
2953,
1010,
5164,
3145,
10175,
15808,
13699,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSerializer.java | AvroSerializer.enterExclusiveThread | private void enterExclusiveThread() {
// we use simple get, check, set here, rather than CAS
// we don't need lock-style correctness, this is only a sanity-check and we thus
// favor speed at the cost of some false negatives in this check
Thread previous = currentThread;
Thread thisThread = Thread.currentThread();
if (previous == null) {
currentThread = thisThread;
}
else if (previous != thisThread) {
throw new IllegalStateException(
"Concurrent access to KryoSerializer. Thread 1: " + thisThread.getName() +
" , Thread 2: " + previous.getName());
}
} | java | private void enterExclusiveThread() {
// we use simple get, check, set here, rather than CAS
// we don't need lock-style correctness, this is only a sanity-check and we thus
// favor speed at the cost of some false negatives in this check
Thread previous = currentThread;
Thread thisThread = Thread.currentThread();
if (previous == null) {
currentThread = thisThread;
}
else if (previous != thisThread) {
throw new IllegalStateException(
"Concurrent access to KryoSerializer. Thread 1: " + thisThread.getName() +
" , Thread 2: " + previous.getName());
}
} | [
"private",
"void",
"enterExclusiveThread",
"(",
")",
"{",
"// we use simple get, check, set here, rather than CAS",
"// we don't need lock-style correctness, this is only a sanity-check and we thus",
"// favor speed at the cost of some false negatives in this check",
"Thread",
"previous",
"=",... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSerializer.java#L340-L355 | train | Enter an exclusive thread. | [
30522,
2797,
11675,
4607,
10288,
23633,
2705,
16416,
2094,
1006,
1007,
1063,
1013,
1013,
2057,
2224,
3722,
2131,
1010,
4638,
1010,
2275,
2182,
1010,
2738,
2084,
25222,
1013,
1013,
2057,
2123,
1005,
1056,
2342,
5843,
1011,
2806,
6149,
2791,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/AbstractCheckpointStats.java | AbstractCheckpointStats.getEndToEndDuration | public long getEndToEndDuration() {
SubtaskStateStats subtask = getLatestAcknowledgedSubtaskStats();
if (subtask != null) {
return Math.max(0, subtask.getAckTimestamp() - triggerTimestamp);
} else {
return -1;
}
} | java | public long getEndToEndDuration() {
SubtaskStateStats subtask = getLatestAcknowledgedSubtaskStats();
if (subtask != null) {
return Math.max(0, subtask.getAckTimestamp() - triggerTimestamp);
} else {
return -1;
}
} | [
"public",
"long",
"getEndToEndDuration",
"(",
")",
"{",
"SubtaskStateStats",
"subtask",
"=",
"getLatestAcknowledgedSubtaskStats",
"(",
")",
";",
"if",
"(",
"subtask",
"!=",
"null",
")",
"{",
"return",
"Math",
".",
"max",
"(",
"0",
",",
"subtask",
".",
"getAc... | Returns the duration of this checkpoint calculated as the time since
triggering until the latest acknowledged subtask or <code>-1</code> if
no subtask was acknowledged yet.
@return Duration of this checkpoint or <code>-1</code> if no subtask was acknowledged yet. | [
"Returns",
"the",
"duration",
"of",
"this",
"checkpoint",
"calculated",
"as",
"the",
"time",
"since",
"triggering",
"until",
"the",
"latest",
"acknowledged",
"subtask",
"or",
"<code",
">",
"-",
"1<",
"/",
"code",
">",
"if",
"no",
"subtask",
"was",
"acknowled... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/AbstractCheckpointStats.java#L186-L193 | train | Returns the duration of the last acknowledged subtask. | [
30522,
2270,
2146,
2131,
10497,
3406,
10497,
24979,
3370,
1006,
1007,
1063,
4942,
10230,
5705,
12259,
9153,
3215,
4942,
10230,
2243,
1027,
2131,
26786,
2696,
3600,
19779,
3709,
30524,
9153,
8737,
1006,
1007,
1011,
9495,
7292,
9153,
8737,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java | DependencyCustomizer.ifAnyMissingClasses | public DependencyCustomizer ifAnyMissingClasses(String... classNames) {
return new DependencyCustomizer(this) {
@Override
protected boolean canAdd() {
for (String className : classNames) {
try {
DependencyCustomizer.this.loader.loadClass(className);
}
catch (Exception ex) {
return true;
}
}
return false;
}
};
} | java | public DependencyCustomizer ifAnyMissingClasses(String... classNames) {
return new DependencyCustomizer(this) {
@Override
protected boolean canAdd() {
for (String className : classNames) {
try {
DependencyCustomizer.this.loader.loadClass(className);
}
catch (Exception ex) {
return true;
}
}
return false;
}
};
} | [
"public",
"DependencyCustomizer",
"ifAnyMissingClasses",
"(",
"String",
"...",
"classNames",
")",
"{",
"return",
"new",
"DependencyCustomizer",
"(",
"this",
")",
"{",
"@",
"Override",
"protected",
"boolean",
"canAdd",
"(",
")",
"{",
"for",
"(",
"String",
"classN... | Create a nested {@link DependencyCustomizer} that only applies if any of the
specified class names are not on the class path.
@param classNames the class names to test
@return a nested {@link DependencyCustomizer} | [
"Create",
"a",
"nested",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java#L91-L106 | train | Creates a dependency customizer that will add classes that are missing from the classpath. | [
30522,
2270,
24394,
7874,
20389,
17629,
2065,
19092,
15630,
7741,
26266,
2229,
1006,
5164,
1012,
1012,
1012,
2465,
18442,
2015,
1007,
1063,
2709,
2047,
24394,
7874,
20389,
17629,
1006,
2023,
1007,
1063,
1030,
2058,
15637,
5123,
22017,
20898,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java | WindowedStream.aggregate | @PublicEvolving
public <ACC, V, R> SingleOutputStreamOperator<R> aggregate(
AggregateFunction<T, ACC, V> aggregateFunction,
WindowFunction<V, R, K, W> windowFunction,
TypeInformation<ACC> accumulatorType,
TypeInformation<R> resultType) {
checkNotNull(aggregateFunction, "aggregateFunction");
checkNotNull(windowFunction, "windowFunction");
checkNotNull(accumulatorType, "accumulatorType");
checkNotNull(resultType, "resultType");
if (aggregateFunction instanceof RichFunction) {
throw new UnsupportedOperationException("This aggregate function cannot be a RichFunction.");
}
//clean the closures
windowFunction = input.getExecutionEnvironment().clean(windowFunction);
aggregateFunction = input.getExecutionEnvironment().clean(aggregateFunction);
final String opName = generateOperatorName(windowAssigner, trigger, evictor, aggregateFunction, windowFunction);
KeySelector<T, K> keySel = input.getKeySelector();
OneInputStreamOperator<T, R> operator;
if (evictor != null) {
@SuppressWarnings({"unchecked", "rawtypes"})
TypeSerializer<StreamRecord<T>> streamRecordSerializer =
(TypeSerializer<StreamRecord<T>>) new StreamElementSerializer(input.getType().createSerializer(getExecutionEnvironment().getConfig()));
ListStateDescriptor<StreamRecord<T>> stateDesc =
new ListStateDescriptor<>("window-contents", streamRecordSerializer);
operator = new EvictingWindowOperator<>(windowAssigner,
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new AggregateApplyWindowFunction<>(aggregateFunction, windowFunction)),
trigger,
evictor,
allowedLateness,
lateDataOutputTag);
} else {
AggregatingStateDescriptor<T, ACC, V> stateDesc = new AggregatingStateDescriptor<>("window-contents",
aggregateFunction, accumulatorType.createSerializer(getExecutionEnvironment().getConfig()));
operator = new WindowOperator<>(windowAssigner,
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(windowFunction),
trigger,
allowedLateness,
lateDataOutputTag);
}
return input.transform(opName, resultType, operator);
} | java | @PublicEvolving
public <ACC, V, R> SingleOutputStreamOperator<R> aggregate(
AggregateFunction<T, ACC, V> aggregateFunction,
WindowFunction<V, R, K, W> windowFunction,
TypeInformation<ACC> accumulatorType,
TypeInformation<R> resultType) {
checkNotNull(aggregateFunction, "aggregateFunction");
checkNotNull(windowFunction, "windowFunction");
checkNotNull(accumulatorType, "accumulatorType");
checkNotNull(resultType, "resultType");
if (aggregateFunction instanceof RichFunction) {
throw new UnsupportedOperationException("This aggregate function cannot be a RichFunction.");
}
//clean the closures
windowFunction = input.getExecutionEnvironment().clean(windowFunction);
aggregateFunction = input.getExecutionEnvironment().clean(aggregateFunction);
final String opName = generateOperatorName(windowAssigner, trigger, evictor, aggregateFunction, windowFunction);
KeySelector<T, K> keySel = input.getKeySelector();
OneInputStreamOperator<T, R> operator;
if (evictor != null) {
@SuppressWarnings({"unchecked", "rawtypes"})
TypeSerializer<StreamRecord<T>> streamRecordSerializer =
(TypeSerializer<StreamRecord<T>>) new StreamElementSerializer(input.getType().createSerializer(getExecutionEnvironment().getConfig()));
ListStateDescriptor<StreamRecord<T>> stateDesc =
new ListStateDescriptor<>("window-contents", streamRecordSerializer);
operator = new EvictingWindowOperator<>(windowAssigner,
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new AggregateApplyWindowFunction<>(aggregateFunction, windowFunction)),
trigger,
evictor,
allowedLateness,
lateDataOutputTag);
} else {
AggregatingStateDescriptor<T, ACC, V> stateDesc = new AggregatingStateDescriptor<>("window-contents",
aggregateFunction, accumulatorType.createSerializer(getExecutionEnvironment().getConfig()));
operator = new WindowOperator<>(windowAssigner,
windowAssigner.getWindowSerializer(getExecutionEnvironment().getConfig()),
keySel,
input.getKeyType().createSerializer(getExecutionEnvironment().getConfig()),
stateDesc,
new InternalSingleValueWindowFunction<>(windowFunction),
trigger,
allowedLateness,
lateDataOutputTag);
}
return input.transform(opName, resultType, operator);
} | [
"@",
"PublicEvolving",
"public",
"<",
"ACC",
",",
"V",
",",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"aggregate",
"(",
"AggregateFunction",
"<",
"T",
",",
"ACC",
",",
"V",
">",
"aggregateFunction",
",",
"WindowFunction",
"<",
"V",
",",
"R",
... | Applies the given window function to each window. The window function is called for each
evaluation of the window for each key individually. The output of the window function is
interpreted as a regular non-windowed stream.
<p>Arriving data is incrementally aggregated using the given aggregate function. This means
that the window function typically has only a single value to process when called.
@param aggregateFunction The aggregation function that is used for incremental aggregation.
@param windowFunction The window function.
@param accumulatorType Type information for the internal accumulator type of the aggregation function
@param resultType Type information for the result type of the window function
@return The data stream that is the result of applying the window function to the window.
@param <ACC> The type of the AggregateFunction's accumulator
@param <V> The type of AggregateFunction's result, and the WindowFunction's input
@param <R> The type of the elements in the resulting stream, equal to the
WindowFunction's result type | [
"Applies",
"the",
"given",
"window",
"function",
"to",
"each",
"window",
".",
"The",
"window",
"function",
"is",
"called",
"for",
"each",
"evaluation",
"of",
"the",
"window",
"for",
"each",
"key",
"individually",
".",
"The",
"output",
"of",
"the",
"window",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java#L791-L851 | train | Creates an operator that aggregates the contents of the input stream using the given window function and accumulator type. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
1026,
16222,
1010,
1058,
1010,
1054,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
9572,
1006,
9572,
11263,
27989,
1026,
1056,
1010,
16222,
1010,
1058,
1028,
9572,
11263,
27989,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/IdcardUtil.java | IdcardUtil.hide | public static String hide(String idCard, int startInclude, int endExclude) {
return StrUtil.hide(idCard, startInclude, endExclude);
} | java | public static String hide(String idCard, int startInclude, int endExclude) {
return StrUtil.hide(idCard, startInclude, endExclude);
} | [
"public",
"static",
"String",
"hide",
"(",
"String",
"idCard",
",",
"int",
"startInclude",
",",
"int",
"endExclude",
")",
"{",
"return",
"StrUtil",
".",
"hide",
"(",
"idCard",
",",
"startInclude",
",",
"endExclude",
")",
";",
"}"
] | 隐藏指定位置的几个身份证号数字为“*”
@param idCard 身份证号
@param startInclude 开始位置(包含)
@param endExclude 结束位置(不包含)
@return 隐藏后的身份证号码
@since 3.2.2
@see StrUtil#hide(CharSequence, int, int) | [
"隐藏指定位置的几个身份证号数字为“",
"*",
"”"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/IdcardUtil.java#L525-L527 | train | Hide the id card. | [
30522,
2270,
10763,
5164,
5342,
1006,
5164,
8909,
11522,
1010,
20014,
2707,
2378,
20464,
12672,
1010,
20014,
2203,
10288,
20464,
12672,
1007,
1063,
2709,
2358,
22134,
4014,
1012,
5342,
1006,
8909,
11522,
1010,
2707,
2378,
20464,
12672,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java | TaskExecutorBuilder.additionalCustomizers | public TaskExecutorBuilder additionalCustomizers(
TaskExecutorCustomizer... customizers) {
Assert.notNull(customizers, "Customizers must not be null");
return additionalCustomizers(Arrays.asList(customizers));
} | java | public TaskExecutorBuilder additionalCustomizers(
TaskExecutorCustomizer... customizers) {
Assert.notNull(customizers, "Customizers must not be null");
return additionalCustomizers(Arrays.asList(customizers));
} | [
"public",
"TaskExecutorBuilder",
"additionalCustomizers",
"(",
"TaskExecutorCustomizer",
"...",
"customizers",
")",
"{",
"Assert",
".",
"notNull",
"(",
"customizers",
",",
"\"Customizers must not be null\"",
")",
";",
"return",
"additionalCustomizers",
"(",
"Arrays",
".",... | Add {@link TaskExecutorCustomizer TaskExecutorCustomizers} that should be applied
to the {@link ThreadPoolTaskExecutor}. Customizers are applied in the order that
they were added after builder configuration has been applied.
@param customizers the customizers to add
@return a new builder instance
@see #customizers(TaskExecutorCustomizer...) | [
"Add",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java#L262-L266 | train | Add additional customizers to the task executor. | [
30522,
2270,
4708,
10288,
8586,
16161,
15185,
19231,
4063,
3176,
7874,
20389,
17629,
2015,
1006,
4708,
10288,
8586,
16161,
29006,
20389,
17629,
1012,
1012,
1012,
7661,
17629,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
7661,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/common/CommonSynonymDictionaryEx.java | CommonSynonymDictionaryEx.distance | public long distance(String a, String b)
{
Long[] itemA = get(a);
if (itemA == null) return Long.MAX_VALUE / 3;
Long[] itemB = get(b);
if (itemB == null) return Long.MAX_VALUE / 3;
return ArrayDistance.computeAverageDistance(itemA, itemB);
} | java | public long distance(String a, String b)
{
Long[] itemA = get(a);
if (itemA == null) return Long.MAX_VALUE / 3;
Long[] itemB = get(b);
if (itemB == null) return Long.MAX_VALUE / 3;
return ArrayDistance.computeAverageDistance(itemA, itemB);
} | [
"public",
"long",
"distance",
"(",
"String",
"a",
",",
"String",
"b",
")",
"{",
"Long",
"[",
"]",
"itemA",
"=",
"get",
"(",
"a",
")",
";",
"if",
"(",
"itemA",
"==",
"null",
")",
"return",
"Long",
".",
"MAX_VALUE",
"/",
"3",
";",
"Long",
"[",
"]... | 语义距离
@param a
@param b
@return | [
"语义距离"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/common/CommonSynonymDictionaryEx.java#L109-L117 | train | Compute the distance between two URIs. | [
30522,
2270,
2146,
3292,
1006,
5164,
1037,
1010,
5164,
1038,
1007,
1063,
2146,
1031,
1033,
8875,
2050,
1027,
2131,
1006,
1037,
1007,
1025,
2065,
1006,
8875,
2050,
1027,
1027,
19701,
1007,
2709,
2146,
1012,
4098,
1035,
3643,
1013,
1017,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/Segment.java | Segment.combineByCustomDictionary | protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList, DoubleArrayTrie<CoreDictionary.Attribute> dat)
{
assert vertexList.size() >= 2 : "vertexList至少包含 始##始 和 末##末";
Vertex[] wordNet = new Vertex[vertexList.size()];
vertexList.toArray(wordNet);
// DAT合并
int length = wordNet.length - 1; // 跳过首尾
for (int i = 1; i < length; ++i)
{
int state = 1;
state = dat.transition(wordNet[i].realWord, state);
if (state > 0)
{
int to = i + 1;
int end = to;
CoreDictionary.Attribute value = dat.output(state);
for (; to < length; ++to)
{
state = dat.transition(wordNet[to].realWord, state);
if (state < 0) break;
CoreDictionary.Attribute output = dat.output(state);
if (output != null)
{
value = output;
end = to + 1;
}
}
if (value != null)
{
combineWords(wordNet, i, end, value);
i = end - 1;
}
}
}
// BinTrie合并
if (CustomDictionary.trie != null)
{
for (int i = 1; i < length; ++i)
{
if (wordNet[i] == null) continue;
BaseNode<CoreDictionary.Attribute> state = CustomDictionary.trie.transition(wordNet[i].realWord.toCharArray(), 0);
if (state != null)
{
int to = i + 1;
int end = to;
CoreDictionary.Attribute value = state.getValue();
for (; to < length; ++to)
{
if (wordNet[to] == null) continue;
state = state.transition(wordNet[to].realWord.toCharArray(), 0);
if (state == null) break;
if (state.getValue() != null)
{
value = state.getValue();
end = to + 1;
}
}
if (value != null)
{
combineWords(wordNet, i, end, value);
i = end - 1;
}
}
}
}
vertexList.clear();
for (Vertex vertex : wordNet)
{
if (vertex != null) vertexList.add(vertex);
}
return vertexList;
} | java | protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList, DoubleArrayTrie<CoreDictionary.Attribute> dat)
{
assert vertexList.size() >= 2 : "vertexList至少包含 始##始 和 末##末";
Vertex[] wordNet = new Vertex[vertexList.size()];
vertexList.toArray(wordNet);
// DAT合并
int length = wordNet.length - 1; // 跳过首尾
for (int i = 1; i < length; ++i)
{
int state = 1;
state = dat.transition(wordNet[i].realWord, state);
if (state > 0)
{
int to = i + 1;
int end = to;
CoreDictionary.Attribute value = dat.output(state);
for (; to < length; ++to)
{
state = dat.transition(wordNet[to].realWord, state);
if (state < 0) break;
CoreDictionary.Attribute output = dat.output(state);
if (output != null)
{
value = output;
end = to + 1;
}
}
if (value != null)
{
combineWords(wordNet, i, end, value);
i = end - 1;
}
}
}
// BinTrie合并
if (CustomDictionary.trie != null)
{
for (int i = 1; i < length; ++i)
{
if (wordNet[i] == null) continue;
BaseNode<CoreDictionary.Attribute> state = CustomDictionary.trie.transition(wordNet[i].realWord.toCharArray(), 0);
if (state != null)
{
int to = i + 1;
int end = to;
CoreDictionary.Attribute value = state.getValue();
for (; to < length; ++to)
{
if (wordNet[to] == null) continue;
state = state.transition(wordNet[to].realWord.toCharArray(), 0);
if (state == null) break;
if (state.getValue() != null)
{
value = state.getValue();
end = to + 1;
}
}
if (value != null)
{
combineWords(wordNet, i, end, value);
i = end - 1;
}
}
}
}
vertexList.clear();
for (Vertex vertex : wordNet)
{
if (vertex != null) vertexList.add(vertex);
}
return vertexList;
} | [
"protected",
"static",
"List",
"<",
"Vertex",
">",
"combineByCustomDictionary",
"(",
"List",
"<",
"Vertex",
">",
"vertexList",
",",
"DoubleArrayTrie",
"<",
"CoreDictionary",
".",
"Attribute",
">",
"dat",
")",
"{",
"assert",
"vertexList",
".",
"size",
"(",
")",... | 使用用户词典合并粗分结果
@param vertexList 粗分结果
@param dat 用户自定义词典
@return 合并后的结果 | [
"使用用户词典合并粗分结果"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Segment.java#L208-L279 | train | Combine by custom dictionary | [
30522,
5123,
10763,
2862,
1026,
19449,
1028,
11506,
3762,
7874,
20389,
29201,
3258,
5649,
1006,
2862,
1026,
19449,
1028,
19449,
9863,
1010,
3313,
2906,
9447,
18886,
2063,
1026,
4563,
29201,
3258,
5649,
1012,
17961,
1028,
23755,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.newHandler | public final SslHandler newHandler(ByteBufAllocator alloc, String peerHost, int peerPort) {
return newHandler(alloc, peerHost, peerPort, startTls);
} | java | public final SslHandler newHandler(ByteBufAllocator alloc, String peerHost, int peerPort) {
return newHandler(alloc, peerHost, peerPort, startTls);
} | [
"public",
"final",
"SslHandler",
"newHandler",
"(",
"ByteBufAllocator",
"alloc",
",",
"String",
"peerHost",
",",
"int",
"peerPort",
")",
"{",
"return",
"newHandler",
"(",
"alloc",
",",
"peerHost",
",",
"peerPort",
",",
"startTls",
")",
";",
"}"
] | Creates a new {@link SslHandler}
@see #newHandler(ByteBufAllocator, String, int, Executor) | [
"Creates",
"a",
"new",
"{",
"@link",
"SslHandler",
"}"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L941-L943 | train | Create a new SslHandler. | [
30522,
2270,
2345,
7020,
2140,
11774,
3917,
2047,
11774,
3917,
1006,
24880,
8569,
13976,
24755,
4263,
2035,
10085,
1010,
5164,
8152,
15006,
2102,
1010,
20014,
8152,
6442,
1007,
1063,
2709,
2047,
11774,
3917,
1006,
2035,
10085,
1010,
8152,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueue.java | UnorderedStreamElementQueue.addEntry | private <T> void addEntry(StreamElementQueueEntry<T> streamElementQueueEntry) {
assert(lock.isHeldByCurrentThread());
if (streamElementQueueEntry.isWatermark()) {
lastSet = new HashSet<>(capacity);
if (firstSet.isEmpty()) {
firstSet.add(streamElementQueueEntry);
} else {
Set<StreamElementQueueEntry<?>> watermarkSet = new HashSet<>(1);
watermarkSet.add(streamElementQueueEntry);
uncompletedQueue.offer(watermarkSet);
}
uncompletedQueue.offer(lastSet);
} else {
lastSet.add(streamElementQueueEntry);
}
streamElementQueueEntry.onComplete(
(StreamElementQueueEntry<T> value) -> {
try {
onCompleteHandler(value);
} catch (InterruptedException e) {
// The accept executor thread got interrupted. This is probably cause by
// the shutdown of the executor.
LOG.debug("AsyncBufferEntry could not be properly completed because the " +
"executor thread has been interrupted.", e);
} catch (Throwable t) {
operatorActions.failOperator(new Exception("Could not complete the " +
"stream element queue entry: " + value + '.', t));
}
},
executor);
numberEntries++;
} | java | private <T> void addEntry(StreamElementQueueEntry<T> streamElementQueueEntry) {
assert(lock.isHeldByCurrentThread());
if (streamElementQueueEntry.isWatermark()) {
lastSet = new HashSet<>(capacity);
if (firstSet.isEmpty()) {
firstSet.add(streamElementQueueEntry);
} else {
Set<StreamElementQueueEntry<?>> watermarkSet = new HashSet<>(1);
watermarkSet.add(streamElementQueueEntry);
uncompletedQueue.offer(watermarkSet);
}
uncompletedQueue.offer(lastSet);
} else {
lastSet.add(streamElementQueueEntry);
}
streamElementQueueEntry.onComplete(
(StreamElementQueueEntry<T> value) -> {
try {
onCompleteHandler(value);
} catch (InterruptedException e) {
// The accept executor thread got interrupted. This is probably cause by
// the shutdown of the executor.
LOG.debug("AsyncBufferEntry could not be properly completed because the " +
"executor thread has been interrupted.", e);
} catch (Throwable t) {
operatorActions.failOperator(new Exception("Could not complete the " +
"stream element queue entry: " + value + '.', t));
}
},
executor);
numberEntries++;
} | [
"private",
"<",
"T",
">",
"void",
"addEntry",
"(",
"StreamElementQueueEntry",
"<",
"T",
">",
"streamElementQueueEntry",
")",
"{",
"assert",
"(",
"lock",
".",
"isHeldByCurrentThread",
"(",
")",
")",
";",
"if",
"(",
"streamElementQueueEntry",
".",
"isWatermark",
... | Add the given stream element queue entry to the current last set if it is not a watermark.
If it is a watermark, then stop adding to the current last set, insert the watermark into its
own set and add a new last set.
@param streamElementQueueEntry to be inserted
@param <T> Type of the stream element queue entry's result | [
"Add",
"the",
"given",
"stream",
"element",
"queue",
"entry",
"to",
"the",
"current",
"last",
"set",
"if",
"it",
"is",
"not",
"a",
"watermark",
".",
"If",
"it",
"is",
"a",
"watermark",
"then",
"stop",
"adding",
"to",
"the",
"current",
"last",
"set",
"i... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/UnorderedStreamElementQueue.java#L269-L304 | train | Add a new entry to the async buffer. | [
30522,
2797,
1026,
1056,
1028,
11675,
5587,
4765,
2854,
1006,
5460,
12260,
3672,
4226,
5657,
4765,
2854,
1026,
1056,
1028,
5460,
12260,
3672,
4226,
5657,
4765,
2854,
1007,
1063,
20865,
1006,
5843,
1012,
2003,
24850,
3762,
10841,
14343,
3372... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/JSONObject.java | JSONObject.optInt | public int optInt(String name, int fallback) {
Object object = opt(name);
Integer result = JSON.toInteger(object);
return result != null ? result : fallback;
} | java | public int optInt(String name, int fallback) {
Object object = opt(name);
Integer result = JSON.toInteger(object);
return result != null ? result : fallback;
} | [
"public",
"int",
"optInt",
"(",
"String",
"name",
",",
"int",
"fallback",
")",
"{",
"Object",
"object",
"=",
"opt",
"(",
"name",
")",
";",
"Integer",
"result",
"=",
"JSON",
".",
"toInteger",
"(",
"object",
")",
";",
"return",
"result",
"!=",
"null",
... | Returns the value mapped by {@code name} if it exists and is an int or can be
coerced to an int. Returns {@code fallback} otherwise.
@param name the name of the property
@param fallback a fallback value
@return the value or {@code fallback} | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | 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/JSONObject.java#L504-L508 | train | Get the optional int value associated with the given name. | [
30522,
2270,
20014,
23569,
18447,
1006,
5164,
2171,
1010,
20014,
2991,
5963,
1007,
1063,
4874,
4874,
1027,
23569,
1006,
2171,
1007,
1025,
16109,
2765,
1027,
1046,
3385,
1012,
2000,
18447,
26320,
1006,
4874,
1007,
1025,
2709,
2765,
999,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java | JettyServletWebServerFactory.addJspServlet | protected final void addJspServlet(WebAppContext context) {
Assert.notNull(context, "Context must not be null");
ServletHolder holder = new ServletHolder();
holder.setName("jsp");
holder.setClassName(getJsp().getClassName());
holder.setInitParameter("fork", "false");
holder.setInitParameters(getJsp().getInitParameters());
holder.setInitOrder(3);
context.getServletHandler().addServlet(holder);
ServletMapping mapping = new ServletMapping();
mapping.setServletName("jsp");
mapping.setPathSpecs(new String[] { "*.jsp", "*.jspx" });
context.getServletHandler().addServletMapping(mapping);
} | java | protected final void addJspServlet(WebAppContext context) {
Assert.notNull(context, "Context must not be null");
ServletHolder holder = new ServletHolder();
holder.setName("jsp");
holder.setClassName(getJsp().getClassName());
holder.setInitParameter("fork", "false");
holder.setInitParameters(getJsp().getInitParameters());
holder.setInitOrder(3);
context.getServletHandler().addServlet(holder);
ServletMapping mapping = new ServletMapping();
mapping.setServletName("jsp");
mapping.setPathSpecs(new String[] { "*.jsp", "*.jspx" });
context.getServletHandler().addServletMapping(mapping);
} | [
"protected",
"final",
"void",
"addJspServlet",
"(",
"WebAppContext",
"context",
")",
"{",
"Assert",
".",
"notNull",
"(",
"context",
",",
"\"Context must not be null\"",
")",
";",
"ServletHolder",
"holder",
"=",
"new",
"ServletHolder",
"(",
")",
";",
"holder",
".... | Add Jetty's {@code JspServlet} to the given {@link WebAppContext}.
@param context the jetty {@link WebAppContext} | [
"Add",
"Jetty",
"s",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java#L312-L325 | train | Adds the jsp servlet to the web application context. | [
30522,
5123,
2345,
11675,
5587,
22578,
29251,
2099,
2615,
7485,
1006,
4773,
29098,
8663,
18209,
6123,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
6123,
1010,
1000,
6123,
2442,
2025,
2022,
19701,
1000,
1007,
1025,
14262,
2615,
7485,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/types/StringValue.java | StringValue.setValue | public void setValue(StringValue value, int offset, int len) {
checkNotNull(value);
setValue(value.value, offset, len);
} | java | public void setValue(StringValue value, int offset, int len) {
checkNotNull(value);
setValue(value.value, offset, len);
} | [
"public",
"void",
"setValue",
"(",
"StringValue",
"value",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"checkNotNull",
"(",
"value",
")",
";",
"setValue",
"(",
"value",
".",
"value",
",",
"offset",
",",
"len",
")",
";",
"}"
] | Sets the value of the StringValue to a substring of the given string.
@param value The new string value.
@param offset The position to start the substring.
@param len The length of the substring. | [
"Sets",
"the",
"value",
"of",
"the",
"StringValue",
"to",
"a",
"substring",
"of",
"the",
"given",
"string",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/StringValue.java#L172-L175 | train | Sets the value of the specified String value. | [
30522,
2270,
11675,
2275,
10175,
5657,
1006,
5164,
10175,
5657,
3643,
1010,
20014,
16396,
1010,
20014,
18798,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
3643,
1007,
1025,
2275,
10175,
5657,
1006,
3643,
1012,
3643,
1010,
16396,
1010,
18798,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java | URLUtil.isJarFileURL | public static boolean isJarFileURL(URL url) {
return (URL_PROTOCOL_FILE.equals(url.getProtocol()) && //
url.getPath().toLowerCase().endsWith(FileUtil.JAR_FILE_EXT));
} | java | public static boolean isJarFileURL(URL url) {
return (URL_PROTOCOL_FILE.equals(url.getProtocol()) && //
url.getPath().toLowerCase().endsWith(FileUtil.JAR_FILE_EXT));
} | [
"public",
"static",
"boolean",
"isJarFileURL",
"(",
"URL",
"url",
")",
"{",
"return",
"(",
"URL_PROTOCOL_FILE",
".",
"equals",
"(",
"url",
".",
"getProtocol",
"(",
")",
")",
"&&",
"//\r",
"url",
".",
"getPath",
"(",
")",
".",
"toLowerCase",
"(",
")",
"... | 提供的URL是否为Jar文件URL 判断依据为file协议且扩展名为.jar
@param url the URL to check
@return whether the URL has been identified as a JAR file URL
@since 4.1 | [
"提供的URL是否为Jar文件URL",
"判断依据为file协议且扩展名为",
".",
"jar"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L494-L497 | train | Checks if the given URL is a jar file URL. | [
30522,
2270,
10763,
22017,
20898,
2003,
16084,
8873,
2571,
3126,
2140,
1006,
24471,
2140,
24471,
2140,
1007,
1063,
2709,
1006,
24471,
2140,
1035,
8778,
1035,
5371,
1012,
19635,
1006,
24471,
2140,
1012,
2131,
21572,
3406,
25778,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/CoreDictionary.java | CoreDictionary.getTermFrequency | public static int getTermFrequency(String term)
{
Attribute attribute = get(term);
if (attribute == null) return 0;
return attribute.totalFrequency;
} | java | public static int getTermFrequency(String term)
{
Attribute attribute = get(term);
if (attribute == null) return 0;
return attribute.totalFrequency;
} | [
"public",
"static",
"int",
"getTermFrequency",
"(",
"String",
"term",
")",
"{",
"Attribute",
"attribute",
"=",
"get",
"(",
"term",
")",
";",
"if",
"(",
"attribute",
"==",
"null",
")",
"return",
"0",
";",
"return",
"attribute",
".",
"totalFrequency",
";",
... | 获取词频
@param term
@return | [
"获取词频"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CoreDictionary.java#L193-L198 | train | Gets the term frequency. | [
30522,
2270,
10763,
20014,
2131,
3334,
2213,
19699,
2063,
4226,
9407,
1006,
5164,
2744,
1007,
1063,
17961,
17961,
1027,
2131,
1006,
2744,
1007,
1025,
2065,
1006,
17961,
1027,
1027,
19701,
1007,
2709,
1014,
1025,
2709,
17961,
1012,
2561,
196... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getAlternativeNames | private String[] getAlternativeNames(String name) {
String altNames[] = null;
DeprecatedKeyInfo keyInfo = null;
DeprecationContext cur = deprecationContext.get();
String depKey = cur.getReverseDeprecatedKeyMap().get(name);
if(depKey != null) {
keyInfo = cur.getDeprecatedKeyMap().get(depKey);
if(keyInfo.newKeys.length > 0) {
if(getProps().containsKey(depKey)) {
//if deprecated key is previously set explicitly
List<String> list = new ArrayList<String>();
list.addAll(Arrays.asList(keyInfo.newKeys));
list.add(depKey);
altNames = list.toArray(new String[list.size()]);
}
else {
altNames = keyInfo.newKeys;
}
}
}
return altNames;
} | java | private String[] getAlternativeNames(String name) {
String altNames[] = null;
DeprecatedKeyInfo keyInfo = null;
DeprecationContext cur = deprecationContext.get();
String depKey = cur.getReverseDeprecatedKeyMap().get(name);
if(depKey != null) {
keyInfo = cur.getDeprecatedKeyMap().get(depKey);
if(keyInfo.newKeys.length > 0) {
if(getProps().containsKey(depKey)) {
//if deprecated key is previously set explicitly
List<String> list = new ArrayList<String>();
list.addAll(Arrays.asList(keyInfo.newKeys));
list.add(depKey);
altNames = list.toArray(new String[list.size()]);
}
else {
altNames = keyInfo.newKeys;
}
}
}
return altNames;
} | [
"private",
"String",
"[",
"]",
"getAlternativeNames",
"(",
"String",
"name",
")",
"{",
"String",
"altNames",
"[",
"]",
"=",
"null",
";",
"DeprecatedKeyInfo",
"keyInfo",
"=",
"null",
";",
"DeprecationContext",
"cur",
"=",
"deprecationContext",
".",
"get",
"(",
... | Returns alternative names (non-deprecated keys or previously-set deprecated keys)
for a given non-deprecated key.
If the given key is deprecated, return null.
@param name property name.
@return alternative names. | [
"Returns",
"alternative",
"names",
"(",
"non",
"-",
"deprecated",
"keys",
"or",
"previously",
"-",
"set",
"deprecated",
"keys",
")",
"for",
"a",
"given",
"non",
"-",
"deprecated",
"key",
".",
"If",
"the",
"given",
"key",
"is",
"deprecated",
"return",
"null... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1180-L1201 | train | Get the alternative names for a property. | [
30522,
2797,
5164,
1031,
1033,
2131,
2389,
16451,
8082,
18442,
2015,
1006,
5164,
2171,
1007,
1063,
5164,
12456,
18442,
2015,
1031,
1033,
1027,
19701,
1025,
2139,
28139,
12921,
14839,
2378,
14876,
3145,
2378,
14876,
1027,
19701,
1025,
2139,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/common/Vertex.java | Vertex.newJapanesePersonInstance | public static Vertex newJapanesePersonInstance(String realWord, int frequency)
{
return new Vertex(Predefine.TAG_PEOPLE, realWord, new CoreDictionary.Attribute(Nature.nrj, frequency));
} | java | public static Vertex newJapanesePersonInstance(String realWord, int frequency)
{
return new Vertex(Predefine.TAG_PEOPLE, realWord, new CoreDictionary.Attribute(Nature.nrj, frequency));
} | [
"public",
"static",
"Vertex",
"newJapanesePersonInstance",
"(",
"String",
"realWord",
",",
"int",
"frequency",
")",
"{",
"return",
"new",
"Vertex",
"(",
"Predefine",
".",
"TAG_PEOPLE",
",",
"realWord",
",",
"new",
"CoreDictionary",
".",
"Attribute",
"(",
"Nature... | 创建一个日本人名实例
@param realWord
@return | [
"创建一个日本人名实例"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/Vertex.java#L397-L400 | train | Create a Japanese Person Vertex. | [
30522,
2270,
10763,
19449,
2047,
3900,
9739,
6810,
27576,
7076,
26897,
1006,
5164,
2613,
18351,
1010,
20014,
6075,
1007,
1063,
2709,
2047,
19449,
1006,
3653,
3207,
23460,
1012,
6415,
1035,
2111,
1010,
2613,
18351,
1010,
2047,
4563,
29201,
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/Graph.java | Graph.filterOnEdges | public Graph<K, VV, EV> filterOnEdges(FilterFunction<Edge<K, EV>> edgeFilter) {
DataSet<Edge<K, EV>> filteredEdges = this.edges.filter(edgeFilter).name("Filter on edges");
return new Graph<>(this.vertices, filteredEdges, this.context);
} | java | public Graph<K, VV, EV> filterOnEdges(FilterFunction<Edge<K, EV>> edgeFilter) {
DataSet<Edge<K, EV>> filteredEdges = this.edges.filter(edgeFilter).name("Filter on edges");
return new Graph<>(this.vertices, filteredEdges, this.context);
} | [
"public",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"filterOnEdges",
"(",
"FilterFunction",
"<",
"Edge",
"<",
"K",
",",
"EV",
">",
">",
"edgeFilter",
")",
"{",
"DataSet",
"<",
"Edge",
"<",
"K",
",",
"EV",
">",
">",
"filteredEdges",
"=",
"this",... | Apply a filtering function to the graph and return a sub-graph that
satisfies the predicates only for the edges.
@param edgeFilter the filter function for edges.
@return the resulting sub-graph. | [
"Apply",
"a",
"filtering",
"function",
"to",
"the",
"graph",
"and",
"return",
"a",
"sub",
"-",
"graph",
"that",
"satisfies",
"the",
"predicates",
"only",
"for",
"the",
"edges",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L907-L911 | train | Filters the edges of this graph by applying the given filter function to each edge. | [
30522,
2270,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
11307,
17799,
8449,
1006,
11307,
11263,
27989,
1026,
3341,
1026,
1047,
1010,
23408,
1028,
1028,
3341,
8873,
21928,
1007,
1063,
2951,
13462,
1026,
3341,
1026,
1047,
1010,
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/spark | sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java | WritableColumnVector.getArray | @Override
public final ColumnarArray getArray(int rowId) {
if (isNullAt(rowId)) return null;
return new ColumnarArray(arrayData(), getArrayOffset(rowId), getArrayLength(rowId));
} | java | @Override
public final ColumnarArray getArray(int rowId) {
if (isNullAt(rowId)) return null;
return new ColumnarArray(arrayData(), getArrayOffset(rowId), getArrayLength(rowId));
} | [
"@",
"Override",
"public",
"final",
"ColumnarArray",
"getArray",
"(",
"int",
"rowId",
")",
"{",
"if",
"(",
"isNullAt",
"(",
"rowId",
")",
")",
"return",
"null",
";",
"return",
"new",
"ColumnarArray",
"(",
"arrayData",
"(",
")",
",",
"getArrayOffset",
"(",
... | array offsets and lengths in the current column vector. | [
"array",
"offsets",
"and",
"lengths",
"in",
"the",
"current",
"column",
"vector",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java#L623-L627 | train | Gets the columnar array at the given row id. | [
30522,
1030,
2058,
15637,
2270,
2345,
5930,
5400,
11335,
2100,
2131,
2906,
9447,
1006,
20014,
5216,
3593,
1007,
1063,
2065,
1006,
3475,
22187,
2102,
1006,
5216,
3593,
1007,
1007,
2709,
19701,
1025,
2709,
2047,
5930,
5400,
11335,
2100,
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-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.validateValues | protected void validateValues(
SqlCall node,
RelDataType targetRowType,
final SqlValidatorScope scope) {
assert node.getKind() == SqlKind.VALUES;
final List<SqlNode> operands = node.getOperandList();
for (SqlNode operand : operands) {
if (!(operand.getKind() == SqlKind.ROW)) {
throw Util.needToImplement(
"Values function where operands are scalars");
}
SqlCall rowConstructor = (SqlCall) operand;
if (conformance.isInsertSubsetColumnsAllowed() && targetRowType.isStruct()
&& rowConstructor.operandCount() < targetRowType.getFieldCount()) {
targetRowType =
typeFactory.createStructType(
targetRowType.getFieldList()
.subList(0, rowConstructor.operandCount()));
} else if (targetRowType.isStruct()
&& rowConstructor.operandCount() != targetRowType.getFieldCount()) {
return;
}
inferUnknownTypes(
targetRowType,
scope,
rowConstructor);
if (targetRowType.isStruct()) {
for (Pair<SqlNode, RelDataTypeField> pair
: Pair.zip(rowConstructor.getOperandList(),
targetRowType.getFieldList())) {
if (!pair.right.getType().isNullable()
&& SqlUtil.isNullLiteral(pair.left, false)) {
throw newValidationError(node,
RESOURCE.columnNotNullable(pair.right.getName()));
}
}
}
}
for (SqlNode operand : operands) {
operand.validate(this, scope);
}
// validate that all row types have the same number of columns
// and that expressions in each column are compatible.
// A values expression is turned into something that looks like
// ROW(type00, type01,...), ROW(type11,...),...
final int rowCount = operands.size();
if (rowCount >= 2) {
SqlCall firstRow = (SqlCall) operands.get(0);
final int columnCount = firstRow.operandCount();
// 1. check that all rows have the same cols length
for (SqlNode operand : operands) {
SqlCall thisRow = (SqlCall) operand;
if (columnCount != thisRow.operandCount()) {
throw newValidationError(node,
RESOURCE.incompatibleValueType(
SqlStdOperatorTable.VALUES.getName()));
}
}
// 2. check if types at i:th position in each row are compatible
for (int col = 0; col < columnCount; col++) {
final int c = col;
final RelDataType type =
typeFactory.leastRestrictive(
new AbstractList<RelDataType>() {
public RelDataType get(int row) {
SqlCall thisRow = (SqlCall) operands.get(row);
return deriveType(scope, thisRow.operand(c));
}
public int size() {
return rowCount;
}
});
if (null == type) {
throw newValidationError(node,
RESOURCE.incompatibleValueType(
SqlStdOperatorTable.VALUES.getName()));
}
}
}
} | java | protected void validateValues(
SqlCall node,
RelDataType targetRowType,
final SqlValidatorScope scope) {
assert node.getKind() == SqlKind.VALUES;
final List<SqlNode> operands = node.getOperandList();
for (SqlNode operand : operands) {
if (!(operand.getKind() == SqlKind.ROW)) {
throw Util.needToImplement(
"Values function where operands are scalars");
}
SqlCall rowConstructor = (SqlCall) operand;
if (conformance.isInsertSubsetColumnsAllowed() && targetRowType.isStruct()
&& rowConstructor.operandCount() < targetRowType.getFieldCount()) {
targetRowType =
typeFactory.createStructType(
targetRowType.getFieldList()
.subList(0, rowConstructor.operandCount()));
} else if (targetRowType.isStruct()
&& rowConstructor.operandCount() != targetRowType.getFieldCount()) {
return;
}
inferUnknownTypes(
targetRowType,
scope,
rowConstructor);
if (targetRowType.isStruct()) {
for (Pair<SqlNode, RelDataTypeField> pair
: Pair.zip(rowConstructor.getOperandList(),
targetRowType.getFieldList())) {
if (!pair.right.getType().isNullable()
&& SqlUtil.isNullLiteral(pair.left, false)) {
throw newValidationError(node,
RESOURCE.columnNotNullable(pair.right.getName()));
}
}
}
}
for (SqlNode operand : operands) {
operand.validate(this, scope);
}
// validate that all row types have the same number of columns
// and that expressions in each column are compatible.
// A values expression is turned into something that looks like
// ROW(type00, type01,...), ROW(type11,...),...
final int rowCount = operands.size();
if (rowCount >= 2) {
SqlCall firstRow = (SqlCall) operands.get(0);
final int columnCount = firstRow.operandCount();
// 1. check that all rows have the same cols length
for (SqlNode operand : operands) {
SqlCall thisRow = (SqlCall) operand;
if (columnCount != thisRow.operandCount()) {
throw newValidationError(node,
RESOURCE.incompatibleValueType(
SqlStdOperatorTable.VALUES.getName()));
}
}
// 2. check if types at i:th position in each row are compatible
for (int col = 0; col < columnCount; col++) {
final int c = col;
final RelDataType type =
typeFactory.leastRestrictive(
new AbstractList<RelDataType>() {
public RelDataType get(int row) {
SqlCall thisRow = (SqlCall) operands.get(row);
return deriveType(scope, thisRow.operand(c));
}
public int size() {
return rowCount;
}
});
if (null == type) {
throw newValidationError(node,
RESOURCE.incompatibleValueType(
SqlStdOperatorTable.VALUES.getName()));
}
}
}
} | [
"protected",
"void",
"validateValues",
"(",
"SqlCall",
"node",
",",
"RelDataType",
"targetRowType",
",",
"final",
"SqlValidatorScope",
"scope",
")",
"{",
"assert",
"node",
".",
"getKind",
"(",
")",
"==",
"SqlKind",
".",
"VALUES",
";",
"final",
"List",
"<",
"... | Validates a VALUES clause.
@param node Values clause
@param targetRowType Row type which expression must conform to
@param scope Scope within which clause occurs | [
"Validates",
"a",
"VALUES",
"clause",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L4656-L4745 | train | Validate the VALUES node. | [
30522,
5123,
11675,
9398,
3686,
10175,
15808,
1006,
29296,
9289,
2140,
13045,
1010,
2128,
15150,
29336,
18863,
4539,
10524,
13874,
1010,
2345,
29296,
10175,
8524,
6591,
16186,
9531,
1007,
1063,
20865,
13045,
1012,
2131,
18824,
1006,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/suggest/Suggester.java | Suggester.max | private static Double max(Map<String, Double> map)
{
Double theMax = 0.0;
for (Double v : map.values())
{
theMax = Math.max(theMax, v);
}
return theMax;
} | java | private static Double max(Map<String, Double> map)
{
Double theMax = 0.0;
for (Double v : map.values())
{
theMax = Math.max(theMax, v);
}
return theMax;
} | [
"private",
"static",
"Double",
"max",
"(",
"Map",
"<",
"String",
",",
"Double",
">",
"map",
")",
"{",
"Double",
"theMax",
"=",
"0.0",
";",
"for",
"(",
"Double",
"v",
":",
"map",
".",
"values",
"(",
")",
")",
"{",
"theMax",
"=",
"Math",
".",
"max"... | 从map的值中找出最大值,这个值是从0开始的
@param map
@return | [
"从map的值中找出最大值,这个值是从0开始的"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/suggest/Suggester.java#L131-L140 | train | Get the max value of a map of CRAs. | [
30522,
2797,
10763,
3313,
4098,
1006,
4949,
1026,
5164,
1010,
3313,
1028,
4949,
1007,
1063,
3313,
2068,
8528,
1027,
1014,
1012,
1014,
1025,
2005,
1006,
3313,
1058,
1024,
4949,
1012,
5300,
1006,
1007,
1007,
1063,
2068,
8528,
1027,
8785,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.