repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashBucketArea.java | BinaryHashBucketArea.startLookup | void startLookup(int hashCode) {
final int posHashCode = findBucket(hashCode);
// get the bucket for the given hash code
final int bucketArrayPos = posHashCode >> table.bucketsPerSegmentBits;
final int bucketInSegmentOffset = (posHashCode & table.bucketsPerSegmentMask) << BUCKET_SIZE_BITS;
final MemorySegment bucket = this.buckets[bucketArrayPos];
table.bucketIterator.set(bucket, overflowSegments, partition, hashCode, bucketInSegmentOffset);
} | java | void startLookup(int hashCode) {
final int posHashCode = findBucket(hashCode);
// get the bucket for the given hash code
final int bucketArrayPos = posHashCode >> table.bucketsPerSegmentBits;
final int bucketInSegmentOffset = (posHashCode & table.bucketsPerSegmentMask) << BUCKET_SIZE_BITS;
final MemorySegment bucket = this.buckets[bucketArrayPos];
table.bucketIterator.set(bucket, overflowSegments, partition, hashCode, bucketInSegmentOffset);
} | [
"void",
"startLookup",
"(",
"int",
"hashCode",
")",
"{",
"final",
"int",
"posHashCode",
"=",
"findBucket",
"(",
"hashCode",
")",
";",
"// get the bucket for the given hash code",
"final",
"int",
"bucketArrayPos",
"=",
"posHashCode",
">>",
"table",
".",
"bucketsPerSe... | Probe start lookup joined build rows. | [
"Probe",
"start",
"lookup",
"joined",
"build",
"rows",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashBucketArea.java#L528-L536 | train | Start lookup of the given hash code. | [
30522,
11675,
2707,
4135,
21940,
2361,
1006,
20014,
23325,
16044,
1007,
1063,
2345,
20014,
13433,
7377,
4095,
16044,
1027,
2424,
24204,
3388,
1006,
23325,
16044,
1007,
1025,
1013,
1013,
2131,
1996,
13610,
2005,
1996,
2445,
23325,
3642,
2345,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.setOrAppend | public static <T> T[] setOrAppend(T[] buffer, int index, T value) {
if(index < buffer.length) {
Array.set(buffer, index, value);
return buffer;
}else {
return append(buffer, value);
}
} | java | public static <T> T[] setOrAppend(T[] buffer, int index, T value) {
if(index < buffer.length) {
Array.set(buffer, index, value);
return buffer;
}else {
return append(buffer, value);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"setOrAppend",
"(",
"T",
"[",
"]",
"buffer",
",",
"int",
"index",
",",
"T",
"value",
")",
"{",
"if",
"(",
"index",
"<",
"buffer",
".",
"length",
")",
"{",
"Array",
".",
"set",
"(",
"buffer",
","... | 将元素值设置为数组的某个位置,当给定的index大于数组长度,则追加
@param <T> 数组元素类型
@param buffer 已有数组
@param index 位置,大于长度追加,否则替换
@param value 新值
@return 新数组或原有数组
@since 4.1.2 | [
"将元素值设置为数组的某个位置,当给定的index大于数组长度,则追加"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L417-L424 | train | Sets the value in the buffer at the given index or appends the value to the buffer. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
1031,
1033,
2275,
6525,
21512,
4859,
1006,
1056,
1031,
1033,
17698,
1010,
20014,
5950,
1010,
1056,
3643,
1007,
1063,
2065,
1006,
5950,
1026,
17698,
1012,
3091,
1007,
1063,
9140,
1012,
2275,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readLines | public static List<String> readLines(URL url, String charset) throws IORuntimeException {
return readLines(url, charset, new ArrayList<String>());
} | java | public static List<String> readLines(URL url, String charset) throws IORuntimeException {
return readLines(url, charset, new ArrayList<String>());
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readLines",
"(",
"URL",
"url",
",",
"String",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"readLines",
"(",
"url",
",",
"charset",
",",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
... | 从文件中读取每一行数据
@param url 文件的URL
@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#L2307-L2309 | train | Reads the contents of the URL into a list of strings. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
3191,
12735,
1006,
24471,
2140,
24471,
2140,
1010,
5164,
25869,
13462,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
3191,
12735,
1006,
24471,
2140,
1010,
25869,
13462,
1010,
2047,
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... |
netty/netty | common/src/main/java/io/netty/util/internal/StringUtil.java | StringUtil.toHexStringPadded | public static <T extends Appendable> T toHexStringPadded(T dst, byte[] src, int offset, int length) {
final int end = offset + length;
for (int i = offset; i < end; i++) {
byteToHexStringPadded(dst, src[i]);
}
return dst;
} | java | public static <T extends Appendable> T toHexStringPadded(T dst, byte[] src, int offset, int length) {
final int end = offset + length;
for (int i = offset; i < end; i++) {
byteToHexStringPadded(dst, src[i]);
}
return dst;
} | [
"public",
"static",
"<",
"T",
"extends",
"Appendable",
">",
"T",
"toHexStringPadded",
"(",
"T",
"dst",
",",
"byte",
"[",
"]",
"src",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"final",
"int",
"end",
"=",
"offset",
"+",
"length",
";",
"for"... | Converts the specified byte array into a hexadecimal value and appends it to the specified buffer. | [
"Converts",
"the",
"specified",
"byte",
"array",
"into",
"a",
"hexadecimal",
"value",
"and",
"appends",
"it",
"to",
"the",
"specified",
"buffer",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L130-L136 | train | Converts a byte array to a hexidecimal string. | [
30522,
2270,
10763,
1026,
1056,
8908,
10439,
10497,
3085,
1028,
1056,
2000,
5369,
2595,
3367,
4892,
15455,
5732,
1006,
1056,
16233,
2102,
1010,
24880,
1031,
1033,
5034,
2278,
1010,
20014,
16396,
1010,
20014,
3091,
1007,
1063,
2345,
20014,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/StaticLog.java | StaticLog.error | public static void error(Log log, Throwable e) {
error(log, e, e.getMessage());
} | java | public static void error(Log log, Throwable e) {
error(log, e, e.getMessage());
} | [
"public",
"static",
"void",
"error",
"(",
"Log",
"log",
",",
"Throwable",
"e",
")",
"{",
"error",
"(",
"log",
",",
"e",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}"
] | Error等级日志<br>
@param log 日志对象
@param e 需在日志中堆栈打印的异常 | [
"Error等级日志<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/StaticLog.java#L184-L186 | train | Logs an error. | [
30522,
2270,
10763,
11675,
7561,
1006,
8833,
8833,
1010,
5466,
3085,
1041,
1007,
1063,
7561,
1006,
8833,
1010,
1041,
1010,
1041,
1012,
2131,
7834,
3736,
3351,
1006,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-transaction/sharding-transaction-2pc/sharding-transaction-xa/sharding-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/connection/XAConnectionFactory.java | XAConnectionFactory.createXAConnection | public static XAConnection createXAConnection(final DatabaseType databaseType, final XADataSource xaDataSource, final Connection connection) {
switch (databaseType) {
case MySQL:
return new MySQLXAConnectionWrapper().wrap(xaDataSource, connection);
case PostgreSQL:
return new PostgreSQLXAConnectionWrapper().wrap(xaDataSource, connection);
case H2:
return new H2XAConnectionWrapper().wrap(xaDataSource, connection);
default:
throw new UnsupportedOperationException(String.format("Cannot support database type: `%s`", databaseType));
}
} | java | public static XAConnection createXAConnection(final DatabaseType databaseType, final XADataSource xaDataSource, final Connection connection) {
switch (databaseType) {
case MySQL:
return new MySQLXAConnectionWrapper().wrap(xaDataSource, connection);
case PostgreSQL:
return new PostgreSQLXAConnectionWrapper().wrap(xaDataSource, connection);
case H2:
return new H2XAConnectionWrapper().wrap(xaDataSource, connection);
default:
throw new UnsupportedOperationException(String.format("Cannot support database type: `%s`", databaseType));
}
} | [
"public",
"static",
"XAConnection",
"createXAConnection",
"(",
"final",
"DatabaseType",
"databaseType",
",",
"final",
"XADataSource",
"xaDataSource",
",",
"final",
"Connection",
"connection",
")",
"{",
"switch",
"(",
"databaseType",
")",
"{",
"case",
"MySQL",
":",
... | Create XA connection from normal connection.
@param databaseType database type
@param connection normal connection
@param xaDataSource XA data source
@return XA connection | [
"Create",
"XA",
"connection",
"from",
"normal",
"connection",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-transaction/sharding-transaction-2pc/sharding-transaction-xa/sharding-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/connection/XAConnectionFactory.java#L47-L58 | train | Create an XAConnection. | [
30522,
2270,
10763,
1060,
22684,
10087,
7542,
3443,
18684,
8663,
2638,
7542,
1006,
30524,
2026,
2015,
4160,
2140,
18684,
8663,
2638,
7542,
13088,
29098,
2121,
1006,
1007,
1012,
10236,
1006,
1060,
8447,
10230,
8162,
3401,
1010,
4434,
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-socket/src/main/java/cn/hutool/socket/aio/AioServer.java | AioServer.close | public void close() {
IoUtil.close(this.channel);
if (null != this.group && false == this.group.isShutdown()) {
try {
this.group.shutdownNow();
} catch (IOException e) {
// ignore
}
}
// 结束阻塞
synchronized (this) {
this.notify();
}
} | java | public void close() {
IoUtil.close(this.channel);
if (null != this.group && false == this.group.isShutdown()) {
try {
this.group.shutdownNow();
} catch (IOException e) {
// ignore
}
}
// 结束阻塞
synchronized (this) {
this.notify();
}
} | [
"public",
"void",
"close",
"(",
")",
"{",
"IoUtil",
".",
"close",
"(",
"this",
".",
"channel",
")",
";",
"if",
"(",
"null",
"!=",
"this",
".",
"group",
"&&",
"false",
"==",
"this",
".",
"group",
".",
"isShutdown",
"(",
")",
")",
"{",
"try",
"{",
... | 关闭服务 | [
"关闭服务"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-socket/src/main/java/cn/hutool/socket/aio/AioServer.java#L151-L166 | train | Close the connection. | [
30522,
2270,
11675,
2485,
1006,
1007,
1063,
22834,
21823,
2140,
1012,
2485,
1006,
2023,
1012,
3149,
1007,
1025,
2065,
1006,
19701,
999,
1027,
2023,
1012,
2177,
1004,
1004,
6270,
1027,
1027,
2023,
1012,
2177,
1012,
26354,
6979,
2102,
7698,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/ConverterRegistry.java | ConverterRegistry.getConverter | public <T> Converter<T> getConverter(Type type, boolean isCustomFirst) {
Converter<T> converter = null;
if (isCustomFirst) {
converter = this.getCustomConverter(type);
if (null == converter) {
converter = this.getDefaultConverter(type);
}
} else {
converter = this.getDefaultConverter(type);
if (null == converter) {
converter = this.getCustomConverter(type);
}
}
return converter;
} | java | public <T> Converter<T> getConverter(Type type, boolean isCustomFirst) {
Converter<T> converter = null;
if (isCustomFirst) {
converter = this.getCustomConverter(type);
if (null == converter) {
converter = this.getDefaultConverter(type);
}
} else {
converter = this.getDefaultConverter(type);
if (null == converter) {
converter = this.getCustomConverter(type);
}
}
return converter;
} | [
"public",
"<",
"T",
">",
"Converter",
"<",
"T",
">",
"getConverter",
"(",
"Type",
"type",
",",
"boolean",
"isCustomFirst",
")",
"{",
"Converter",
"<",
"T",
">",
"converter",
"=",
"null",
";",
"if",
"(",
"isCustomFirst",
")",
"{",
"converter",
"=",
"thi... | 获得转换器<br>
@param <T> 转换的目标类型
@param type 类型
@param isCustomFirst 是否自定义转换器优先
@return 转换器 | [
"获得转换器<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/ConverterRegistry.java#L135-L149 | train | Returns a converter for the specified type. | [
30522,
2270,
1026,
1056,
1028,
10463,
2121,
1026,
1056,
1028,
2131,
8663,
16874,
2121,
1006,
2828,
2828,
1010,
22017,
20898,
2003,
7874,
20389,
8873,
12096,
1007,
1063,
10463,
2121,
1026,
1056,
1028,
10463,
2121,
1027,
19701,
1025,
2065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.roundHalfEven | public static BigDecimal roundHalfEven(BigDecimal value, int scale) {
return round(value, scale, RoundingMode.HALF_EVEN);
} | java | public static BigDecimal roundHalfEven(BigDecimal value, int scale) {
return round(value, scale, RoundingMode.HALF_EVEN);
} | [
"public",
"static",
"BigDecimal",
"roundHalfEven",
"(",
"BigDecimal",
"value",
",",
"int",
"scale",
")",
"{",
"return",
"round",
"(",
"value",
",",
"scale",
",",
"RoundingMode",
".",
"HALF_EVEN",
")",
";",
"}"
] | 四舍六入五成双计算法
<p>
四舍六入五成双是一种比较精确比较科学的计数保留法,是一种数字修约规则。
</p>
<pre>
算法规则:
四舍六入五考虑,
五后非零就进一,
五后皆零看奇偶,
五前为偶应舍去,
五前为奇要进一。
</pre>
@param value 需要科学计算的数据
@param scale 保留的小数位
@return 结果
@since 4.1.0 | [
"四舍六入五成双计算法",
"<p",
">",
"四舍六入五成双是一种比较精确比较科学的计数保留法,是一种数字修约规则。",
"<",
"/",
"p",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L945-L947 | train | Round to half even. | [
30522,
2270,
10763,
2502,
3207,
6895,
9067,
2461,
8865,
7959,
8159,
1006,
2502,
3207,
6895,
9067,
3643,
1010,
20014,
4094,
1007,
1063,
2709,
2461,
1006,
3643,
1010,
4094,
1010,
26939,
5302,
3207,
1012,
2431,
1035,
2130,
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... |
apache/incubator-shardingsphere | sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/postgresql/command/PostgreSQLCommandExecutorFactory.java | PostgreSQLCommandExecutorFactory.newInstance | public static CommandExecutor newInstance(final PostgreSQLCommandPacketType commandPacketType, final PostgreSQLCommandPacket commandPacket, final BackendConnection backendConnection) {
log.debug("Execute packet type: {}, value: {}", commandPacketType, commandPacket);
switch (commandPacketType) {
case QUERY:
return new PostgreSQLComQueryExecutor((PostgreSQLComQueryPacket) commandPacket, backendConnection);
case PARSE:
return new PostgreSQLComParseExecutor((PostgreSQLComParsePacket) commandPacket, backendConnection);
case BIND:
return new PostgreSQLComBindExecutor((PostgreSQLComBindPacket) commandPacket, backendConnection);
case DESCRIBE:
return new PostgreSQLComDescribeExecutor();
case EXECUTE:
return new PostgreSQLComExecuteExecutor();
case SYNC:
return new PostgreSQLComSyncExecutor();
case TERMINATE:
return new PostgreSQLComTerminationExecutor();
default:
return new PostgreSQLUnsupportedCommandExecutor();
}
} | java | public static CommandExecutor newInstance(final PostgreSQLCommandPacketType commandPacketType, final PostgreSQLCommandPacket commandPacket, final BackendConnection backendConnection) {
log.debug("Execute packet type: {}, value: {}", commandPacketType, commandPacket);
switch (commandPacketType) {
case QUERY:
return new PostgreSQLComQueryExecutor((PostgreSQLComQueryPacket) commandPacket, backendConnection);
case PARSE:
return new PostgreSQLComParseExecutor((PostgreSQLComParsePacket) commandPacket, backendConnection);
case BIND:
return new PostgreSQLComBindExecutor((PostgreSQLComBindPacket) commandPacket, backendConnection);
case DESCRIBE:
return new PostgreSQLComDescribeExecutor();
case EXECUTE:
return new PostgreSQLComExecuteExecutor();
case SYNC:
return new PostgreSQLComSyncExecutor();
case TERMINATE:
return new PostgreSQLComTerminationExecutor();
default:
return new PostgreSQLUnsupportedCommandExecutor();
}
} | [
"public",
"static",
"CommandExecutor",
"newInstance",
"(",
"final",
"PostgreSQLCommandPacketType",
"commandPacketType",
",",
"final",
"PostgreSQLCommandPacket",
"commandPacket",
",",
"final",
"BackendConnection",
"backendConnection",
")",
"{",
"log",
".",
"debug",
"(",
"\... | Create new instance of command executor.
@param commandPacketType command packet type for PostgreSQL
@param commandPacket command packet for PostgreSQL
@param backendConnection backend connection
@return command executor | [
"Create",
"new",
"instance",
"of",
"command",
"executor",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/postgresql/command/PostgreSQLCommandExecutorFactory.java#L56-L76 | train | Create new instance of command executor. | [
30522,
2270,
10763,
3094,
10288,
8586,
16161,
2099,
2047,
7076,
26897,
1006,
2345,
2695,
17603,
2015,
4160,
22499,
14760,
4859,
23947,
6582,
18863,
3094,
23947,
6582,
18863,
1010,
2345,
2695,
17603,
2015,
4160,
22499,
14760,
4859,
23947,
3388... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/datrie/MutableDoubleArrayTrieInteger.java | MutableDoubleArrayTrieInteger.insert | public boolean insert(String key, int value, boolean overwrite)
{
if ((null == key) || key.length() == 0 || (key.indexOf(UNUSED_CHAR) != -1))
{
return false;
}
if ((value < 0) || ((value & LEAF_BIT) != 0))
{
return false;
}
value = setLeafValue(value);
int[] ids = this.charMap.toIdList(key + UNUSED_CHAR);
int fromState = 1; // 根节点的index为1
int toState = 1;
int index = 0;
while (index < ids.length)
{
int c = ids[index];
toState = getBase(fromState) + c; // to = base[from] + c
expandArray(toState);
if (isEmpty(toState))
{
deleteFreeLink(toState);
setCheck(toState, fromState); // check[to] = from
if (index == ids.length - 1) // Leaf
{
++this.size;
setBase(toState, value); // base[to] = value
}
else
{
int nextChar = ids[(index + 1)];
setBase(toState, getNextFreeBase(nextChar)); // base[to] = free_state - c
}
}
else if (getCheck(toState) != fromState) // 冲突
{
solveConflict(fromState, c);
continue;
}
fromState = toState;
++index;
}
if (overwrite)
{
setBase(toState, value);
}
return true;
} | java | public boolean insert(String key, int value, boolean overwrite)
{
if ((null == key) || key.length() == 0 || (key.indexOf(UNUSED_CHAR) != -1))
{
return false;
}
if ((value < 0) || ((value & LEAF_BIT) != 0))
{
return false;
}
value = setLeafValue(value);
int[] ids = this.charMap.toIdList(key + UNUSED_CHAR);
int fromState = 1; // 根节点的index为1
int toState = 1;
int index = 0;
while (index < ids.length)
{
int c = ids[index];
toState = getBase(fromState) + c; // to = base[from] + c
expandArray(toState);
if (isEmpty(toState))
{
deleteFreeLink(toState);
setCheck(toState, fromState); // check[to] = from
if (index == ids.length - 1) // Leaf
{
++this.size;
setBase(toState, value); // base[to] = value
}
else
{
int nextChar = ids[(index + 1)];
setBase(toState, getNextFreeBase(nextChar)); // base[to] = free_state - c
}
}
else if (getCheck(toState) != fromState) // 冲突
{
solveConflict(fromState, c);
continue;
}
fromState = toState;
++index;
}
if (overwrite)
{
setBase(toState, value);
}
return true;
} | [
"public",
"boolean",
"insert",
"(",
"String",
"key",
",",
"int",
"value",
",",
"boolean",
"overwrite",
")",
"{",
"if",
"(",
"(",
"null",
"==",
"key",
")",
"||",
"key",
".",
"length",
"(",
")",
"==",
"0",
"||",
"(",
"key",
".",
"indexOf",
"(",
"UN... | 插入条目
@param key 键
@param value 值
@param overwrite 是否覆盖
@return | [
"插入条目"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/datrie/MutableDoubleArrayTrieInteger.java#L251-L304 | train | Insert a value into the cache. | [
30522,
2270,
22017,
20898,
19274,
1006,
5164,
3145,
1010,
20014,
30524,
5950,
11253,
1006,
15171,
1035,
25869,
1007,
999,
1027,
1011,
1015,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
1006,
3643,
1026,
1014,
1007,
1064,
1064,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | Bindable.withExistingValue | public Bindable<T> withExistingValue(T existingValue) {
Assert.isTrue(
existingValue == null || this.type.isArray()
|| this.boxedType.resolve().isInstance(existingValue),
() -> "ExistingValue must be an instance of " + this.type);
Supplier<T> value = (existingValue != null) ? () -> existingValue : null;
return new Bindable<>(this.type, this.boxedType, value, NO_ANNOTATIONS);
} | java | public Bindable<T> withExistingValue(T existingValue) {
Assert.isTrue(
existingValue == null || this.type.isArray()
|| this.boxedType.resolve().isInstance(existingValue),
() -> "ExistingValue must be an instance of " + this.type);
Supplier<T> value = (existingValue != null) ? () -> existingValue : null;
return new Bindable<>(this.type, this.boxedType, value, NO_ANNOTATIONS);
} | [
"public",
"Bindable",
"<",
"T",
">",
"withExistingValue",
"(",
"T",
"existingValue",
")",
"{",
"Assert",
".",
"isTrue",
"(",
"existingValue",
"==",
"null",
"||",
"this",
".",
"type",
".",
"isArray",
"(",
")",
"||",
"this",
".",
"boxedType",
".",
"resolve... | Create an updated {@link Bindable} instance with an existing value.
@param existingValue the existing value
@return an updated {@link Bindable} | [
"Create",
"an",
"updated",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java#L161-L168 | train | Returns a new instance of this Bindable with the specified existing value. | [
30522,
2270,
14187,
3085,
1026,
1056,
1028,
2007,
10288,
2923,
2075,
10175,
5657,
1006,
1056,
4493,
10175,
5657,
1007,
1063,
20865,
1012,
21541,
6820,
2063,
1006,
4493,
10175,
5657,
1027,
1027,
19701,
1064,
1064,
2023,
1012,
2828,
1012,
180... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/word2vec/DocVectorModel.java | DocVectorModel.query | public Vector query(String content)
{
if (content == null || content.length() == 0) return null;
List<Term> termList = NotionalTokenizer.segment(content);
Vector result = new Vector(dimension());
int n = 0;
for (Term term : termList)
{
Vector vector = wordVectorModel.vector(term.word);
if (vector == null)
{
continue;
}
++n;
result.addToSelf(vector);
}
if (n == 0)
{
return null;
}
result.normalize();
return result;
} | java | public Vector query(String content)
{
if (content == null || content.length() == 0) return null;
List<Term> termList = NotionalTokenizer.segment(content);
Vector result = new Vector(dimension());
int n = 0;
for (Term term : termList)
{
Vector vector = wordVectorModel.vector(term.word);
if (vector == null)
{
continue;
}
++n;
result.addToSelf(vector);
}
if (n == 0)
{
return null;
}
result.normalize();
return result;
} | [
"public",
"Vector",
"query",
"(",
"String",
"content",
")",
"{",
"if",
"(",
"content",
"==",
"null",
"||",
"content",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"List",
"<",
"Term",
">",
"termList",
"=",
"NotionalTokenizer",
".",
... | 将一个文档转为向量
@param content 文档
@return 向量 | [
"将一个文档转为向量"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/DocVectorModel.java#L68-L90 | train | Query a Sequence of Terms from a String. | [
30522,
2270,
9207,
23032,
1006,
5164,
4180,
1007,
1063,
2065,
1006,
4180,
1027,
1027,
19701,
1064,
1064,
4180,
1012,
3091,
1006,
1007,
1027,
1027,
1014,
1007,
2709,
19701,
1025,
2862,
1026,
2744,
1028,
2744,
9863,
1027,
9366,
2389,
18715,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/RdbAdapter.java | RdbAdapter.destroy | @Override
public void destroy() {
if (rdbConfigMonitor != null) {
rdbConfigMonitor.destroy();
}
if (rdbSyncService != null) {
rdbSyncService.close();
}
if (dataSource != null) {
dataSource.close();
}
} | java | @Override
public void destroy() {
if (rdbConfigMonitor != null) {
rdbConfigMonitor.destroy();
}
if (rdbSyncService != null) {
rdbSyncService.close();
}
if (dataSource != null) {
dataSource.close();
}
} | [
"@",
"Override",
"public",
"void",
"destroy",
"(",
")",
"{",
"if",
"(",
"rdbConfigMonitor",
"!=",
"null",
")",
"{",
"rdbConfigMonitor",
".",
"destroy",
"(",
")",
";",
"}",
"if",
"(",
"rdbSyncService",
"!=",
"null",
")",
"{",
"rdbSyncService",
".",
"close... | 销毁方法 | [
"销毁方法"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/RdbAdapter.java#L274-L287 | train | Destroy the application. | [
30522,
1030,
2058,
15637,
2270,
11675,
6033,
1006,
1007,
1063,
2065,
1006,
16428,
9818,
2239,
8873,
21693,
10698,
4263,
999,
1027,
19701,
1007,
1063,
16428,
9818,
2239,
8873,
21693,
10698,
4263,
1012,
6033,
1006,
1007,
1025,
1065,
2065,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.file | public static File file(String path) {
if (StrUtil.isBlank(path)) {
throw new NullPointerException("File path is blank!");
}
return new File(getAbsolutePath(path));
} | java | public static File file(String path) {
if (StrUtil.isBlank(path)) {
throw new NullPointerException("File path is blank!");
}
return new File(getAbsolutePath(path));
} | [
"public",
"static",
"File",
"file",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"path",
")",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"File path is blank!\"",
")",
";",
"}",
"return",
"new",
"File",
"(",
"g... | 创建File对象,自动识别相对或绝对路径,相对路径将自动从ClassPath下寻找
@param path 文件路径
@return File | [
"创建File对象,自动识别相对或绝对路径,相对路径将自动从ClassPath下寻找"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L314-L319 | train | Create a File object from a file path. | [
30522,
2270,
10763,
5371,
5371,
1006,
5164,
4130,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
4130,
1007,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
5371,
4130,
2003,
8744,
999,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternProcessFunctionBuilder.java | PatternProcessFunctionBuilder.fromFlatSelect | static <IN, OUT> FlatSelectBuilder<IN, OUT> fromFlatSelect(final PatternFlatSelectFunction<IN, OUT> function) {
return new FlatSelectBuilder<>(function);
} | java | static <IN, OUT> FlatSelectBuilder<IN, OUT> fromFlatSelect(final PatternFlatSelectFunction<IN, OUT> function) {
return new FlatSelectBuilder<>(function);
} | [
"static",
"<",
"IN",
",",
"OUT",
">",
"FlatSelectBuilder",
"<",
"IN",
",",
"OUT",
">",
"fromFlatSelect",
"(",
"final",
"PatternFlatSelectFunction",
"<",
"IN",
",",
"OUT",
">",
"function",
")",
"{",
"return",
"new",
"FlatSelectBuilder",
"<>",
"(",
"function",... | Starts constructing a {@link PatternProcessFunction} from a {@link PatternFlatSelectFunction} that
emitted elements through {@link org.apache.flink.util.Collector}. | [
"Starts",
"constructing",
"a",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternProcessFunctionBuilder.java#L42-L44 | train | Create a new FlatSelectBuilder from a pattern flat select function. | [
30522,
10763,
1026,
1999,
1010,
2041,
1028,
14201,
12260,
6593,
8569,
23891,
2099,
1026,
1999,
1010,
2041,
1028,
2013,
10258,
11149,
12260,
6593,
1006,
2345,
5418,
10258,
11149,
12260,
6593,
11263,
27989,
1026,
1999,
1010,
2041,
1028,
3853,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AstUtils.java | AstUtils.hasAtLeastOneAnnotation | public static boolean hasAtLeastOneAnnotation(AnnotatedNode node,
String... annotations) {
for (AnnotationNode annotationNode : node.getAnnotations()) {
for (String annotation : annotations) {
if (PatternMatchUtils.simpleMatch(annotation,
annotationNode.getClassNode().getName())) {
return true;
}
}
}
return false;
} | java | public static boolean hasAtLeastOneAnnotation(AnnotatedNode node,
String... annotations) {
for (AnnotationNode annotationNode : node.getAnnotations()) {
for (String annotation : annotations) {
if (PatternMatchUtils.simpleMatch(annotation,
annotationNode.getClassNode().getName())) {
return true;
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"hasAtLeastOneAnnotation",
"(",
"AnnotatedNode",
"node",
",",
"String",
"...",
"annotations",
")",
"{",
"for",
"(",
"AnnotationNode",
"annotationNode",
":",
"node",
".",
"getAnnotations",
"(",
")",
")",
"{",
"for",
"(",
"String",
... | Determine if an {@link AnnotatedNode} has one or more of the specified annotations.
N.B. the annotation type names are not normally fully qualified.
@param node the node to examine
@param annotations the annotations to look for
@return {@code true} if at least one of the annotations is found, otherwise
{@code false} | [
"Determine",
"if",
"an",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/AstUtils.java#L79-L90 | train | Checks if the given annotated node has at least one of the given annotations. | [
30522,
2270,
10763,
22017,
20898,
2038,
4017,
19738,
9221,
11639,
17287,
3508,
1006,
5754,
17287,
3064,
3630,
3207,
13045,
1010,
5164,
1012,
1012,
1012,
5754,
17287,
9285,
1007,
1063,
2005,
1006,
5754,
17287,
3508,
3630,
3207,
5754,
17287,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastClientFactory.java | HazelcastClientFactory.getHazelcastInstance | public HazelcastInstance getHazelcastInstance() {
if (StringUtils.hasText(this.clientConfig.getInstanceName())) {
return HazelcastClient
.getHazelcastClientByName(this.clientConfig.getInstanceName());
}
return HazelcastClient.newHazelcastClient(this.clientConfig);
} | java | public HazelcastInstance getHazelcastInstance() {
if (StringUtils.hasText(this.clientConfig.getInstanceName())) {
return HazelcastClient
.getHazelcastClientByName(this.clientConfig.getInstanceName());
}
return HazelcastClient.newHazelcastClient(this.clientConfig);
} | [
"public",
"HazelcastInstance",
"getHazelcastInstance",
"(",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"this",
".",
"clientConfig",
".",
"getInstanceName",
"(",
")",
")",
")",
"{",
"return",
"HazelcastClient",
".",
"getHazelcastClientByName",
"(",
... | Get the {@link HazelcastInstance}.
@return the {@link HazelcastInstance} | [
"Get",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastClientFactory.java#L74-L80 | train | Get the HazelcastInstance. | [
30522,
2270,
14015,
10526,
7076,
26897,
2131,
3270,
12638,
10526,
7076,
26897,
1006,
1007,
1063,
2065,
1006,
5164,
21823,
4877,
1012,
24748,
18413,
1006,
2023,
1012,
7396,
8663,
8873,
2290,
1012,
2131,
7076,
26897,
18442,
1006,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.appendUtf8Lines | public static <T> File appendUtf8Lines(Collection<T> list, String path) throws IORuntimeException {
return appendLines(list, path, CharsetUtil.CHARSET_UTF_8);
} | java | public static <T> File appendUtf8Lines(Collection<T> list, String path) throws IORuntimeException {
return appendLines(list, path, CharsetUtil.CHARSET_UTF_8);
} | [
"public",
"static",
"<",
"T",
">",
"File",
"appendUtf8Lines",
"(",
"Collection",
"<",
"T",
">",
"list",
",",
"String",
"path",
")",
"throws",
"IORuntimeException",
"{",
"return",
"appendLines",
"(",
"list",
",",
"path",
",",
"CharsetUtil",
".",
"CHARSET_UTF_... | 将列表写入文件,追加模式
@param <T> 集合元素类型
@param list 列表
@param path 文件路径
@return 目标文件
@throws IORuntimeException IO异常
@since 3.1.2 | [
"将列表写入文件,追加模式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2953-L2955 | train | Append UTF - 8 lines to a file. | [
30522,
2270,
10763,
1026,
1056,
1028,
5371,
10439,
10497,
4904,
2546,
2620,
12735,
1006,
3074,
1026,
1056,
1028,
2862,
1010,
5164,
4130,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
10439,
10497,
12735,
1006,
2862,
1010,
4130,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/io/FileOutputFormat.java | FileOutputFormat.initDefaultsFromConfiguration | public static void initDefaultsFromConfiguration(Configuration configuration) {
final boolean overwrite = configuration.getBoolean(CoreOptions.FILESYTEM_DEFAULT_OVERRIDE);
DEFAULT_WRITE_MODE = overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE;
final boolean alwaysCreateDirectory = configuration.getBoolean(CoreOptions.FILESYSTEM_OUTPUT_ALWAYS_CREATE_DIRECTORY);
DEFAULT_OUTPUT_DIRECTORY_MODE = alwaysCreateDirectory ? OutputDirectoryMode.ALWAYS : OutputDirectoryMode.PARONLY;
} | java | public static void initDefaultsFromConfiguration(Configuration configuration) {
final boolean overwrite = configuration.getBoolean(CoreOptions.FILESYTEM_DEFAULT_OVERRIDE);
DEFAULT_WRITE_MODE = overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE;
final boolean alwaysCreateDirectory = configuration.getBoolean(CoreOptions.FILESYSTEM_OUTPUT_ALWAYS_CREATE_DIRECTORY);
DEFAULT_OUTPUT_DIRECTORY_MODE = alwaysCreateDirectory ? OutputDirectoryMode.ALWAYS : OutputDirectoryMode.PARONLY;
} | [
"public",
"static",
"void",
"initDefaultsFromConfiguration",
"(",
"Configuration",
"configuration",
")",
"{",
"final",
"boolean",
"overwrite",
"=",
"configuration",
".",
"getBoolean",
"(",
"CoreOptions",
".",
"FILESYTEM_DEFAULT_OVERRIDE",
")",
";",
"DEFAULT_WRITE_MODE",
... | Initialize defaults for output format. Needs to be a static method because it is configured for local
cluster execution.
@param configuration The configuration to load defaults from | [
"Initialize",
"defaults",
"for",
"output",
"format",
".",
"Needs",
"to",
"be",
"a",
"static",
"method",
"because",
"it",
"is",
"configured",
"for",
"local",
"cluster",
"execution",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/FileOutputFormat.java#L75-L83 | train | Initialize the defaults from the configuration. | [
30522,
2270,
10763,
11675,
1999,
4183,
3207,
7011,
11314,
22747,
21716,
8663,
8873,
27390,
3370,
1006,
9563,
9563,
1007,
1063,
2345,
22017,
20898,
2058,
26373,
1027,
9563,
1012,
2131,
5092,
9890,
2319,
1006,
4563,
7361,
9285,
1012,
6764,
17... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/hooks/MasterHooks.java | MasterHooks.triggerMasterHooks | public static List<MasterState> triggerMasterHooks(
Collection<MasterTriggerRestoreHook<?>> hooks,
long checkpointId,
long timestamp,
Executor executor,
Time timeout) throws FlinkException {
final ArrayList<MasterState> states = new ArrayList<>(hooks.size());
for (MasterTriggerRestoreHook<?> hook : hooks) {
MasterState state = triggerHook(hook, checkpointId, timestamp, executor, timeout);
if (state != null) {
states.add(state);
}
}
states.trimToSize();
return states;
} | java | public static List<MasterState> triggerMasterHooks(
Collection<MasterTriggerRestoreHook<?>> hooks,
long checkpointId,
long timestamp,
Executor executor,
Time timeout) throws FlinkException {
final ArrayList<MasterState> states = new ArrayList<>(hooks.size());
for (MasterTriggerRestoreHook<?> hook : hooks) {
MasterState state = triggerHook(hook, checkpointId, timestamp, executor, timeout);
if (state != null) {
states.add(state);
}
}
states.trimToSize();
return states;
} | [
"public",
"static",
"List",
"<",
"MasterState",
">",
"triggerMasterHooks",
"(",
"Collection",
"<",
"MasterTriggerRestoreHook",
"<",
"?",
">",
">",
"hooks",
",",
"long",
"checkpointId",
",",
"long",
"timestamp",
",",
"Executor",
"executor",
",",
"Time",
"timeout"... | Triggers all given master hooks and returns state objects for each hook that
produced a state.
@param hooks The hooks to trigger
@param checkpointId The checkpoint ID of the triggering checkpoint
@param timestamp The (informational) timestamp for the triggering checkpoint
@param executor An executor that can be used for asynchronous I/O calls
@param timeout The maximum time that a hook may take to complete
@return A list containing all states produced by the hooks
@throws FlinkException Thrown, if the hooks throw an exception, or the state+
deserialization fails. | [
"Triggers",
"all",
"given",
"master",
"hooks",
"and",
"returns",
"state",
"objects",
"for",
"each",
"hook",
"that",
"produced",
"a",
"state",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/hooks/MasterHooks.java#L117-L135 | train | Triggers the given set of master hooks. | [
30522,
2270,
10763,
2862,
1026,
5972,
12259,
1028,
9495,
8706,
6806,
6559,
2015,
1006,
3074,
1026,
3040,
18886,
13327,
28533,
5686,
6806,
6559,
1026,
1029,
1028,
1028,
18008,
1010,
2146,
26520,
3593,
1010,
2146,
2335,
15464,
2361,
1010,
465... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/ThreadDeathWatcher.java | ThreadDeathWatcher.awaitInactivity | public static boolean awaitInactivity(long timeout, TimeUnit unit) throws InterruptedException {
if (unit == null) {
throw new NullPointerException("unit");
}
Thread watcherThread = ThreadDeathWatcher.watcherThread;
if (watcherThread != null) {
watcherThread.join(unit.toMillis(timeout));
return !watcherThread.isAlive();
} else {
return true;
}
} | java | public static boolean awaitInactivity(long timeout, TimeUnit unit) throws InterruptedException {
if (unit == null) {
throw new NullPointerException("unit");
}
Thread watcherThread = ThreadDeathWatcher.watcherThread;
if (watcherThread != null) {
watcherThread.join(unit.toMillis(timeout));
return !watcherThread.isAlive();
} else {
return true;
}
} | [
"public",
"static",
"boolean",
"awaitInactivity",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"unit",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"unit\"",
")",
";",
"}",
... | Waits until the thread of this watcher has no threads to watch and terminates itself.
Because a new watcher thread will be started again on {@link #watch(Thread, Runnable)},
this operation is only useful when you want to ensure that the watcher thread is terminated
<strong>after</strong> your application is shut down and there's no chance of calling
{@link #watch(Thread, Runnable)} afterwards.
@return {@code true} if and only if the watcher thread has been terminated | [
"Waits",
"until",
"the",
"thread",
"of",
"this",
"watcher",
"has",
"no",
"threads",
"to",
"watch",
"and",
"terminates",
"itself",
".",
"Because",
"a",
"new",
"watcher",
"thread",
"will",
"be",
"started",
"again",
"on",
"{",
"@link",
"#watch",
"(",
"Thread"... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ThreadDeathWatcher.java#L139-L151 | train | Await inactivity. | [
30522,
2270,
10763,
22017,
20898,
26751,
3981,
6593,
7730,
1006,
2146,
2051,
5833,
1010,
2051,
19496,
2102,
3131,
1007,
11618,
7153,
10288,
24422,
1063,
2065,
1006,
3131,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java | AllWindowedStream.sum | public SingleOutputStreamOperator<T> sum(String field) {
return aggregate(new SumAggregator<>(field, input.getType(), input.getExecutionConfig()));
} | java | public SingleOutputStreamOperator<T> sum(String field) {
return aggregate(new SumAggregator<>(field, input.getType(), input.getExecutionConfig()));
} | [
"public",
"SingleOutputStreamOperator",
"<",
"T",
">",
"sum",
"(",
"String",
"field",
")",
"{",
"return",
"aggregate",
"(",
"new",
"SumAggregator",
"<>",
"(",
"field",
",",
"input",
".",
"getType",
"(",
")",
",",
"input",
".",
"getExecutionConfig",
"(",
")... | Applies an aggregation that sums every window of the pojo data stream at
the given field for every window.
<p>A field expression is either the name of a public field or a getter method with
parentheses of the stream's underlying type. A dot can be used to drill down into objects,
as in {@code "field1.getInnerField2()" }.
@param field The field to sum
@return The transformed DataStream. | [
"Applies",
"an",
"aggregation",
"that",
"sums",
"every",
"window",
"of",
"the",
"pojo",
"data",
"stream",
"at",
"the",
"given",
"field",
"for",
"every",
"window",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java#L1393-L1395 | train | Applies an aggregation that sums the values of the stream | [
30522,
2270,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1056,
1028,
7680,
1006,
5164,
2492,
1007,
1063,
2709,
9572,
1006,
2047,
7680,
8490,
17603,
20697,
2953,
1026,
1028,
1006,
2492,
1010,
7953,
1012,
2131,
13874,
1006,
1007,
1010,
7953,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestDecoder.java | HttpPostRequestDecoder.isMultipart | public static boolean isMultipart(HttpRequest request) {
if (request.headers().contains(HttpHeaderNames.CONTENT_TYPE)) {
return getMultipartDataBoundary(request.headers().get(HttpHeaderNames.CONTENT_TYPE)) != null;
} else {
return false;
}
} | java | public static boolean isMultipart(HttpRequest request) {
if (request.headers().contains(HttpHeaderNames.CONTENT_TYPE)) {
return getMultipartDataBoundary(request.headers().get(HttpHeaderNames.CONTENT_TYPE)) != null;
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"isMultipart",
"(",
"HttpRequest",
"request",
")",
"{",
"if",
"(",
"request",
".",
"headers",
"(",
")",
".",
"contains",
"(",
"HttpHeaderNames",
".",
"CONTENT_TYPE",
")",
")",
"{",
"return",
"getMultipartDataBoundary",
"(",
"requ... | Check if the given request is a multipart request
@return True if the request is a Multipart request | [
"Check",
"if",
"the",
"given",
"request",
"is",
"a",
"multipart",
"request"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestDecoder.java#L142-L148 | train | Is multipart request? | [
30522,
2270,
10763,
22017,
20898,
2003,
12274,
7096,
11514,
8445,
1006,
8299,
2890,
15500,
5227,
1007,
1063,
2065,
1006,
5227,
1012,
20346,
2015,
1006,
1007,
1012,
3397,
1006,
8299,
4974,
11795,
14074,
2015,
1012,
4180,
1035,
2828,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/logging/Log4JLogger.java | Log4JLogger.trace | @Override
public void trace(String msg, Throwable t) {
logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, msg, t);
} | java | @Override
public void trace(String msg, Throwable t) {
logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, msg, t);
} | [
"@",
"Override",
"public",
"void",
"trace",
"(",
"String",
"msg",
",",
"Throwable",
"t",
")",
"{",
"logger",
".",
"log",
"(",
"FQCN",
",",
"traceCapable",
"?",
"Level",
".",
"TRACE",
":",
"Level",
".",
"DEBUG",
",",
"msg",
",",
"t",
")",
";",
"}"
] | Log an exception (throwable) at level TRACE with an accompanying message.
@param msg
the message accompanying the exception
@param t
the exception (throwable) to log | [
"Log",
"an",
"exception",
"(",
"throwable",
")",
"at",
"level",
"TRACE",
"with",
"an",
"accompanying",
"message",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/logging/Log4JLogger.java#L184-L187 | train | Log a message at the TRACE level. | [
30522,
1030,
2058,
15637,
2270,
11675,
7637,
1006,
5164,
5796,
2290,
1010,
5466,
3085,
1056,
1007,
1063,
8833,
4590,
1012,
8833,
1006,
1042,
4160,
2278,
2078,
1010,
7637,
17695,
3085,
1029,
2504,
1012,
7637,
1024,
2504,
1012,
2139,
8569,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java | TypeExtractionUtils.checkAndExtractLambda | public static LambdaExecutable checkAndExtractLambda(Function function) throws TypeExtractionException {
try {
// get serialized lambda
SerializedLambda serializedLambda = null;
for (Class<?> clazz = function.getClass(); clazz != null; clazz = clazz.getSuperclass()) {
try {
Method replaceMethod = clazz.getDeclaredMethod("writeReplace");
replaceMethod.setAccessible(true);
Object serialVersion = replaceMethod.invoke(function);
// check if class is a lambda function
if (serialVersion != null && serialVersion.getClass() == SerializedLambda.class) {
serializedLambda = (SerializedLambda) serialVersion;
break;
}
}
catch (NoSuchMethodException e) {
// thrown if the method is not there. fall through the loop
}
}
// not a lambda method -> return null
if (serializedLambda == null) {
return null;
}
// find lambda method
String className = serializedLambda.getImplClass();
String methodName = serializedLambda.getImplMethodName();
String methodSig = serializedLambda.getImplMethodSignature();
Class<?> implClass = Class.forName(className.replace('/', '.'), true, Thread.currentThread().getContextClassLoader());
// find constructor
if (methodName.equals("<init>")) {
Constructor<?>[] constructors = implClass.getDeclaredConstructors();
for (Constructor<?> constructor : constructors) {
if (getConstructorDescriptor(constructor).equals(methodSig)) {
return new LambdaExecutable(constructor);
}
}
}
// find method
else {
List<Method> methods = getAllDeclaredMethods(implClass);
for (Method method : methods) {
if (method.getName().equals(methodName) && getMethodDescriptor(method).equals(methodSig)) {
return new LambdaExecutable(method);
}
}
}
throw new TypeExtractionException("No lambda method found.");
}
catch (Exception e) {
throw new TypeExtractionException("Could not extract lambda method out of function: " +
e.getClass().getSimpleName() + " - " + e.getMessage(), e);
}
} | java | public static LambdaExecutable checkAndExtractLambda(Function function) throws TypeExtractionException {
try {
// get serialized lambda
SerializedLambda serializedLambda = null;
for (Class<?> clazz = function.getClass(); clazz != null; clazz = clazz.getSuperclass()) {
try {
Method replaceMethod = clazz.getDeclaredMethod("writeReplace");
replaceMethod.setAccessible(true);
Object serialVersion = replaceMethod.invoke(function);
// check if class is a lambda function
if (serialVersion != null && serialVersion.getClass() == SerializedLambda.class) {
serializedLambda = (SerializedLambda) serialVersion;
break;
}
}
catch (NoSuchMethodException e) {
// thrown if the method is not there. fall through the loop
}
}
// not a lambda method -> return null
if (serializedLambda == null) {
return null;
}
// find lambda method
String className = serializedLambda.getImplClass();
String methodName = serializedLambda.getImplMethodName();
String methodSig = serializedLambda.getImplMethodSignature();
Class<?> implClass = Class.forName(className.replace('/', '.'), true, Thread.currentThread().getContextClassLoader());
// find constructor
if (methodName.equals("<init>")) {
Constructor<?>[] constructors = implClass.getDeclaredConstructors();
for (Constructor<?> constructor : constructors) {
if (getConstructorDescriptor(constructor).equals(methodSig)) {
return new LambdaExecutable(constructor);
}
}
}
// find method
else {
List<Method> methods = getAllDeclaredMethods(implClass);
for (Method method : methods) {
if (method.getName().equals(methodName) && getMethodDescriptor(method).equals(methodSig)) {
return new LambdaExecutable(method);
}
}
}
throw new TypeExtractionException("No lambda method found.");
}
catch (Exception e) {
throw new TypeExtractionException("Could not extract lambda method out of function: " +
e.getClass().getSimpleName() + " - " + e.getMessage(), e);
}
} | [
"public",
"static",
"LambdaExecutable",
"checkAndExtractLambda",
"(",
"Function",
"function",
")",
"throws",
"TypeExtractionException",
"{",
"try",
"{",
"// get serialized lambda",
"SerializedLambda",
"serializedLambda",
"=",
"null",
";",
"for",
"(",
"Class",
"<",
"?",
... | Checks if the given function has been implemented using a Java 8 lambda. If yes, a LambdaExecutable
is returned describing the method/constructor. Otherwise null.
@throws TypeExtractionException lambda extraction is pretty hacky, it might fail for unknown JVM issues. | [
"Checks",
"if",
"the",
"given",
"function",
"has",
"been",
"implemented",
"using",
"a",
"Java",
"8",
"lambda",
".",
"If",
"yes",
"a",
"LambdaExecutable",
"is",
"returned",
"describing",
"the",
"method",
"/",
"constructor",
".",
"Otherwise",
"null",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java#L99-L156 | train | Check if the given function is a Lambda function and if so extract it. | [
30522,
2270,
10763,
23375,
10288,
8586,
23056,
4638,
5685,
10288,
6494,
6593,
10278,
2497,
2850,
1006,
3853,
3853,
1007,
11618,
2828,
10288,
6494,
7542,
10288,
24422,
1063,
3046,
1063,
1013,
1013,
2131,
27289,
23375,
27289,
10278,
2497,
2850,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java | Utils.require | static void require(boolean condition, String message, Object... values) {
if (!condition) {
throw new RuntimeException(String.format(message, values));
}
} | java | static void require(boolean condition, String message, Object... values) {
if (!condition) {
throw new RuntimeException(String.format(message, values));
}
} | [
"static",
"void",
"require",
"(",
"boolean",
"condition",
",",
"String",
"message",
",",
"Object",
"...",
"values",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"String",
".",
"format",
"(",
"message",
",",
"v... | Validates a condition, throwing a RuntimeException if the condition is violated.
@param condition The condition.
@param message The message for the runtime exception, with format variables as defined by
{@link String#format(String, Object...)}.
@param values The format arguments. | [
"Validates",
"a",
"condition",
"throwing",
"a",
"RuntimeException",
"if",
"the",
"condition",
"is",
"violated",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java#L589-L593 | train | Require that the condition is true. | [
30522,
10763,
11675,
5478,
1006,
22017,
20898,
4650,
1010,
5164,
4471,
1010,
4874,
1012,
1012,
1012,
5300,
1007,
1063,
2065,
1006,
999,
4650,
1007,
1063,
5466,
2047,
2448,
7292,
10288,
24422,
1006,
5164,
1012,
4289,
1006,
4471,
1010,
5300,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/program/JobWithJars.java | JobWithJars.getUserCodeClassLoader | public ClassLoader getUserCodeClassLoader() {
if (this.userCodeClassLoader == null) {
this.userCodeClassLoader = buildUserCodeClassLoader(jarFiles, classpaths, getClass().getClassLoader());
}
return this.userCodeClassLoader;
} | java | public ClassLoader getUserCodeClassLoader() {
if (this.userCodeClassLoader == null) {
this.userCodeClassLoader = buildUserCodeClassLoader(jarFiles, classpaths, getClass().getClassLoader());
}
return this.userCodeClassLoader;
} | [
"public",
"ClassLoader",
"getUserCodeClassLoader",
"(",
")",
"{",
"if",
"(",
"this",
".",
"userCodeClassLoader",
"==",
"null",
")",
"{",
"this",
".",
"userCodeClassLoader",
"=",
"buildUserCodeClassLoader",
"(",
"jarFiles",
",",
"classpaths",
",",
"getClass",
"(",
... | Gets the {@link java.lang.ClassLoader} that must be used to load user code classes.
@return The user code ClassLoader. | [
"Gets",
"the",
"{",
"@link",
"java",
".",
"lang",
".",
"ClassLoader",
"}",
"that",
"must",
"be",
"used",
"to",
"load",
"user",
"code",
"classes",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/JobWithJars.java#L105-L110 | train | Gets the user code class loader. | [
30522,
2270,
2465,
11066,
2121,
2131,
20330,
16044,
26266,
11066,
2121,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
5310,
16044,
26266,
11066,
2121,
1027,
1027,
19701,
1007,
1063,
2023,
1012,
5310,
16044,
26266,
11066,
2121,
1027,
3857,
20330,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/BOMInputStream.java | BOMInputStream.init | protected void init() throws IOException {
if (isInited) {
return;
}
byte bom[] = new byte[BOM_SIZE];
int n, unread;
n = in.read(bom, 0, bom.length);
if ((bom[0] == (byte) 0x00) && (bom[1] == (byte) 0x00) && (bom[2] == (byte) 0xFE) && (bom[3] == (byte) 0xFF)) {
charset = "UTF-32BE";
unread = n - 4;
} else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE) && (bom[2] == (byte) 0x00) && (bom[3] == (byte) 0x00)) {
charset = "UTF-32LE";
unread = n - 4;
} else if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) && (bom[2] == (byte) 0xBF)) {
charset = "UTF-8";
unread = n - 3;
} else if ((bom[0] == (byte) 0xFE) && (bom[1] == (byte) 0xFF)) {
charset = "UTF-16BE";
unread = n - 2;
} else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE)) {
charset = "UTF-16LE";
unread = n - 2;
} else {
// Unicode BOM mark not found, unread all bytes
charset = defaultCharset;
unread = n;
}
// System.out.println("read=" + n + ", unread=" + unread);
if (unread > 0) {
in.unread(bom, (n - unread), unread);
}
isInited = true;
} | java | protected void init() throws IOException {
if (isInited) {
return;
}
byte bom[] = new byte[BOM_SIZE];
int n, unread;
n = in.read(bom, 0, bom.length);
if ((bom[0] == (byte) 0x00) && (bom[1] == (byte) 0x00) && (bom[2] == (byte) 0xFE) && (bom[3] == (byte) 0xFF)) {
charset = "UTF-32BE";
unread = n - 4;
} else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE) && (bom[2] == (byte) 0x00) && (bom[3] == (byte) 0x00)) {
charset = "UTF-32LE";
unread = n - 4;
} else if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) && (bom[2] == (byte) 0xBF)) {
charset = "UTF-8";
unread = n - 3;
} else if ((bom[0] == (byte) 0xFE) && (bom[1] == (byte) 0xFF)) {
charset = "UTF-16BE";
unread = n - 2;
} else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE)) {
charset = "UTF-16LE";
unread = n - 2;
} else {
// Unicode BOM mark not found, unread all bytes
charset = defaultCharset;
unread = n;
}
// System.out.println("read=" + n + ", unread=" + unread);
if (unread > 0) {
in.unread(bom, (n - unread), unread);
}
isInited = true;
} | [
"protected",
"void",
"init",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isInited",
")",
"{",
"return",
";",
"}",
"byte",
"bom",
"[",
"]",
"=",
"new",
"byte",
"[",
"BOM_SIZE",
"]",
";",
"int",
"n",
",",
"unread",
";",
"n",
"=",
"in",
".",... | Read-ahead four bytes and check for BOM marks. <br>
Extra bytes are unread back to the stream, only BOM bytes are skipped.
@throws IOException 读取引起的异常 | [
"Read",
"-",
"ahead",
"four",
"bytes",
"and",
"check",
"for",
"BOM",
"marks",
".",
"<br",
">",
"Extra",
"bytes",
"are",
"unread",
"back",
"to",
"the",
"stream",
"only",
"BOM",
"bytes",
"are",
"skipped",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/BOMInputStream.java#L80-L116 | train | Initializes the object. | [
30522,
5123,
11675,
1999,
4183,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
2003,
5498,
3064,
1007,
1063,
2709,
1025,
1065,
24880,
8945,
2213,
1031,
1033,
1027,
2047,
24880,
1031,
8945,
2213,
1035,
2946,
1033,
1025,
20014,
105... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Either.java | Either.Left | public static <L, R> Either<L, R> Left(L value) {
return new Left<L, R>(value);
} | java | public static <L, R> Either<L, R> Left(L value) {
return new Left<L, R>(value);
} | [
"public",
"static",
"<",
"L",
",",
"R",
">",
"Either",
"<",
"L",
",",
"R",
">",
"Left",
"(",
"L",
"value",
")",
"{",
"return",
"new",
"Left",
"<",
"L",
",",
"R",
">",
"(",
"value",
")",
";",
"}"
] | Create a Left value of Either | [
"Create",
"a",
"Left",
"value",
"of",
"Either"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/Either.java#L44-L46 | train | Create a Left instance. | [
30522,
2270,
10763,
1026,
1048,
1010,
1054,
1028,
2593,
1026,
1048,
1010,
1054,
1028,
2187,
1006,
1048,
3643,
1007,
1063,
2709,
2047,
2187,
1026,
1048,
1010,
1054,
1028,
1006,
3643,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java | SimpleConfigurationMetadataRepository.add | public void add(ConfigurationMetadataProperty property,
ConfigurationMetadataSource source) {
if (source != null) {
putIfAbsent(source.getProperties(), property.getId(), property);
}
putIfAbsent(getGroup(source).getProperties(), property.getId(), property);
} | java | public void add(ConfigurationMetadataProperty property,
ConfigurationMetadataSource source) {
if (source != null) {
putIfAbsent(source.getProperties(), property.getId(), property);
}
putIfAbsent(getGroup(source).getProperties(), property.getId(), property);
} | [
"public",
"void",
"add",
"(",
"ConfigurationMetadataProperty",
"property",
",",
"ConfigurationMetadataSource",
"source",
")",
"{",
"if",
"(",
"source",
"!=",
"null",
")",
"{",
"putIfAbsent",
"(",
"source",
".",
"getProperties",
"(",
")",
",",
"property",
".",
... | Add a {@link ConfigurationMetadataProperty} with the
{@link ConfigurationMetadataSource source} that defines it, if any.
@param property the property to add
@param source the source | [
"Add",
"a",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java#L76-L82 | train | Add a configuration property to the configuration. | [
30522,
2270,
11675,
5587,
1006,
9563,
11368,
8447,
2696,
21572,
4842,
3723,
3200,
1010,
9563,
11368,
8447,
10230,
8162,
3401,
3120,
1007,
1063,
2065,
1006,
3120,
999,
1027,
19701,
1007,
1063,
2404,
10128,
7875,
5054,
2102,
1006,
3120,
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... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/base/MapPartitionOperatorBase.java | MapPartitionOperatorBase.executeOnCollections | @Override
protected List<OUT> executeOnCollections(List<IN> inputData, RuntimeContext ctx, ExecutionConfig executionConfig) throws Exception {
MapPartitionFunction<IN, OUT> function = this.userFunction.getUserCodeObject();
FunctionUtils.setFunctionRuntimeContext(function, ctx);
FunctionUtils.openFunction(function, this.parameters);
ArrayList<OUT> result = new ArrayList<OUT>(inputData.size() / 4);
TypeSerializer<IN> inSerializer = getOperatorInfo().getInputType().createSerializer(executionConfig);
TypeSerializer<OUT> outSerializer = getOperatorInfo().getOutputType().createSerializer(executionConfig);
CopyingIterator<IN> source = new CopyingIterator<IN>(inputData.iterator(), inSerializer);
CopyingListCollector<OUT> resultCollector = new CopyingListCollector<OUT>(result, outSerializer);
function.mapPartition(source, resultCollector);
result.trimToSize();
FunctionUtils.closeFunction(function);
return result;
} | java | @Override
protected List<OUT> executeOnCollections(List<IN> inputData, RuntimeContext ctx, ExecutionConfig executionConfig) throws Exception {
MapPartitionFunction<IN, OUT> function = this.userFunction.getUserCodeObject();
FunctionUtils.setFunctionRuntimeContext(function, ctx);
FunctionUtils.openFunction(function, this.parameters);
ArrayList<OUT> result = new ArrayList<OUT>(inputData.size() / 4);
TypeSerializer<IN> inSerializer = getOperatorInfo().getInputType().createSerializer(executionConfig);
TypeSerializer<OUT> outSerializer = getOperatorInfo().getOutputType().createSerializer(executionConfig);
CopyingIterator<IN> source = new CopyingIterator<IN>(inputData.iterator(), inSerializer);
CopyingListCollector<OUT> resultCollector = new CopyingListCollector<OUT>(result, outSerializer);
function.mapPartition(source, resultCollector);
result.trimToSize();
FunctionUtils.closeFunction(function);
return result;
} | [
"@",
"Override",
"protected",
"List",
"<",
"OUT",
">",
"executeOnCollections",
"(",
"List",
"<",
"IN",
">",
"inputData",
",",
"RuntimeContext",
"ctx",
",",
"ExecutionConfig",
"executionConfig",
")",
"throws",
"Exception",
"{",
"MapPartitionFunction",
"<",
"IN",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/base/MapPartitionOperatorBase.java#L61-L81 | train | Execute on collections. | [
30522,
1030,
2058,
15637,
5123,
2862,
1026,
2041,
1028,
15389,
2239,
26895,
18491,
2015,
1006,
2862,
1026,
1999,
1028,
7953,
2850,
2696,
1010,
2448,
7292,
8663,
18209,
14931,
2595,
1010,
7781,
8663,
8873,
2290,
7781,
8663,
8873,
2290,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java | SlotManager.findMatchingSlot | protected TaskManagerSlot findMatchingSlot(ResourceProfile requestResourceProfile) {
Iterator<Map.Entry<SlotID, TaskManagerSlot>> iterator = freeSlots.entrySet().iterator();
while (iterator.hasNext()) {
TaskManagerSlot taskManagerSlot = iterator.next().getValue();
// sanity check
Preconditions.checkState(
taskManagerSlot.getState() == TaskManagerSlot.State.FREE,
"TaskManagerSlot %s is not in state FREE but %s.",
taskManagerSlot.getSlotId(), taskManagerSlot.getState());
if (taskManagerSlot.getResourceProfile().isMatching(requestResourceProfile)) {
iterator.remove();
return taskManagerSlot;
}
}
return null;
} | java | protected TaskManagerSlot findMatchingSlot(ResourceProfile requestResourceProfile) {
Iterator<Map.Entry<SlotID, TaskManagerSlot>> iterator = freeSlots.entrySet().iterator();
while (iterator.hasNext()) {
TaskManagerSlot taskManagerSlot = iterator.next().getValue();
// sanity check
Preconditions.checkState(
taskManagerSlot.getState() == TaskManagerSlot.State.FREE,
"TaskManagerSlot %s is not in state FREE but %s.",
taskManagerSlot.getSlotId(), taskManagerSlot.getState());
if (taskManagerSlot.getResourceProfile().isMatching(requestResourceProfile)) {
iterator.remove();
return taskManagerSlot;
}
}
return null;
} | [
"protected",
"TaskManagerSlot",
"findMatchingSlot",
"(",
"ResourceProfile",
"requestResourceProfile",
")",
"{",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"SlotID",
",",
"TaskManagerSlot",
">",
">",
"iterator",
"=",
"freeSlots",
".",
"entrySet",
"(",
")",
".",
"... | Finds a matching slot for a given resource profile. A matching slot has at least as many
resources available as the given resource profile. If there is no such slot available, then
the method returns null.
<p>Note: If you want to change the behaviour of the slot manager wrt slot allocation and
request fulfillment, then you should override this method.
@param requestResourceProfile specifying the resource requirements for the a slot request
@return A matching slot which fulfills the given resource profile. Null if there is no such
slot available. | [
"Finds",
"a",
"matching",
"slot",
"for",
"a",
"given",
"resource",
"profile",
".",
"A",
"matching",
"slot",
"has",
"at",
"least",
"as",
"many",
"resources",
"available",
"as",
"the",
"given",
"resource",
"profile",
".",
"If",
"there",
"is",
"no",
"such",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java#L503-L522 | train | Find a matching slot for the given resource profile. | [
30522,
5123,
4708,
24805,
15776,
10994,
2424,
18900,
8450,
14540,
4140,
1006,
7692,
21572,
8873,
2571,
5227,
6072,
8162,
3401,
21572,
8873,
2571,
1007,
1063,
2009,
6906,
4263,
1026,
4949,
1012,
4443,
1026,
10453,
3593,
1010,
4708,
24805,
15... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FileTypeUtil.java | FileTypeUtil.getType | public static String getType(String fileStreamHexHead) {
for (Entry<String, String> fileTypeEntry : fileTypeMap.entrySet()) {
if(StrUtil.startWithIgnoreCase(fileStreamHexHead, fileTypeEntry.getKey())) {
return fileTypeEntry.getValue();
}
}
return null;
} | java | public static String getType(String fileStreamHexHead) {
for (Entry<String, String> fileTypeEntry : fileTypeMap.entrySet()) {
if(StrUtil.startWithIgnoreCase(fileStreamHexHead, fileTypeEntry.getKey())) {
return fileTypeEntry.getValue();
}
}
return null;
} | [
"public",
"static",
"String",
"getType",
"(",
"String",
"fileStreamHexHead",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"fileTypeEntry",
":",
"fileTypeMap",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"StrUtil",
".",
"startWithIg... | 根据文件流的头部信息获得文件类型
@param fileStreamHexHead 文件流头部16进制字符串
@return 文件类型,未找到为<code>null</code> | [
"根据文件流的头部信息获得文件类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileTypeUtil.java#L109-L116 | train | Returns the type of the file stream hex head. | [
30522,
2270,
10763,
5164,
2131,
13874,
1006,
5164,
6764,
25379,
5369,
2595,
4974,
1007,
1063,
2005,
1006,
4443,
1026,
5164,
1010,
5164,
1028,
5371,
13874,
4765,
2854,
1024,
5371,
13874,
2863,
2361,
1012,
4443,
13462,
1006,
1007,
1007,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.removeNull | public static <T> Collection<T> removeNull(Collection<T> collection) {
return filter(collection, new Editor<T>() {
@Override
public T edit(T t) {
// 返回null便不加入集合
return t;
}
});
} | java | public static <T> Collection<T> removeNull(Collection<T> collection) {
return filter(collection, new Editor<T>() {
@Override
public T edit(T t) {
// 返回null便不加入集合
return t;
}
});
} | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"removeNull",
"(",
"Collection",
"<",
"T",
">",
"collection",
")",
"{",
"return",
"filter",
"(",
"collection",
",",
"new",
"Editor",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"publi... | 去除{@code null} 元素
@param collection 集合
@return 处理后的集合
@since 3.2.2 | [
"去除",
"{",
"@code",
"null",
"}",
"元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1059-L1067 | train | Removes null elements from a collection. | [
30522,
2270,
10763,
1026,
1056,
1028,
3074,
1026,
1056,
1028,
6366,
11231,
3363,
1006,
3074,
1026,
1056,
1028,
3074,
1007,
1063,
2709,
11307,
1006,
3074,
1010,
2047,
3559,
1026,
1056,
1028,
1006,
1007,
1063,
1030,
2058,
15637,
2270,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.newHashMap | public static <K, V> HashMap<K, V> newHashMap(int size, boolean isOrder) {
int initialCapacity = (int) (size / DEFAULT_LOAD_FACTOR);
return isOrder ? new LinkedHashMap<K, V>(initialCapacity) : new HashMap<K, V>(initialCapacity);
} | java | public static <K, V> HashMap<K, V> newHashMap(int size, boolean isOrder) {
int initialCapacity = (int) (size / DEFAULT_LOAD_FACTOR);
return isOrder ? new LinkedHashMap<K, V>(initialCapacity) : new HashMap<K, V>(initialCapacity);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"HashMap",
"<",
"K",
",",
"V",
">",
"newHashMap",
"(",
"int",
"size",
",",
"boolean",
"isOrder",
")",
"{",
"int",
"initialCapacity",
"=",
"(",
"int",
")",
"(",
"size",
"/",
"DEFAULT_LOAD_FACTOR",
")",
";",... | 新建一个HashMap
@param <K> Key类型
@param <V> Value类型
@param size 初始大小,由于默认负载因子0.75,传入的size会实际初始大小为size / 0.75
@param isOrder Map的Key是否有序,有序返回 {@link LinkedHashMap},否则返回 {@link HashMap}
@return HashMap对象
@since 3.0.4 | [
"新建一个HashMap"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L81-L84 | train | Creates a new HashMap with the specified size. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
23325,
2863,
2361,
1026,
1047,
1010,
1058,
1028,
2047,
14949,
22444,
2361,
1006,
20014,
2946,
1010,
22017,
20898,
11163,
26764,
1007,
1063,
20014,
3988,
17695,
6305,
3012,
1027,
1006,
20014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java | TypeExtractor.isValidPojoField | private boolean isValidPojoField(Field f, Class<?> clazz, ArrayList<Type> typeHierarchy) {
if(Modifier.isPublic(f.getModifiers())) {
return true;
} else {
boolean hasGetter = false, hasSetter = false;
final String fieldNameLow = f.getName().toLowerCase().replaceAll("_", "");
Type fieldType = f.getGenericType();
Class<?> fieldTypeWrapper = ClassUtils.primitiveToWrapper(f.getType());
TypeVariable<?> fieldTypeGeneric = null;
if(fieldType instanceof TypeVariable) {
fieldTypeGeneric = (TypeVariable<?>) fieldType;
fieldType = materializeTypeVariable(typeHierarchy, (TypeVariable<?>)fieldType);
}
for(Method m : clazz.getMethods()) {
final String methodNameLow = m.getName().endsWith("_$eq") ?
m.getName().toLowerCase().replaceAll("_", "").replaceFirst("\\$eq$", "_\\$eq") :
m.getName().toLowerCase().replaceAll("_", "");
// check for getter
if( // The name should be "get<FieldName>" or "<fieldName>" (for scala) or "is<fieldName>" for boolean fields.
(methodNameLow.equals("get"+fieldNameLow) || methodNameLow.equals("is"+fieldNameLow) || methodNameLow.equals(fieldNameLow)) &&
// no arguments for the getter
m.getParameterTypes().length == 0 &&
// return type is same as field type (or the generic variant of it)
(m.getGenericReturnType().equals( fieldType ) || (fieldTypeWrapper != null && m.getReturnType().equals( fieldTypeWrapper )) || (fieldTypeGeneric != null && m.getGenericReturnType().equals(fieldTypeGeneric)) )
) {
hasGetter = true;
}
// check for setters (<FieldName>_$eq for scala)
if((methodNameLow.equals("set"+fieldNameLow) || methodNameLow.equals(fieldNameLow+"_$eq")) &&
m.getParameterTypes().length == 1 && // one parameter of the field's type
(m.getGenericParameterTypes()[0].equals( fieldType ) || (fieldTypeWrapper != null && m.getParameterTypes()[0].equals( fieldTypeWrapper )) || (fieldTypeGeneric != null && m.getGenericParameterTypes()[0].equals(fieldTypeGeneric) ) )&&
// return type is void.
m.getReturnType().equals(Void.TYPE)
) {
hasSetter = true;
}
}
if(hasGetter && hasSetter) {
return true;
} else {
if(!hasGetter) {
LOG.info(clazz+" does not contain a getter for field "+f.getName() );
}
if(!hasSetter) {
LOG.info(clazz+" does not contain a setter for field "+f.getName() );
}
return false;
}
}
} | java | private boolean isValidPojoField(Field f, Class<?> clazz, ArrayList<Type> typeHierarchy) {
if(Modifier.isPublic(f.getModifiers())) {
return true;
} else {
boolean hasGetter = false, hasSetter = false;
final String fieldNameLow = f.getName().toLowerCase().replaceAll("_", "");
Type fieldType = f.getGenericType();
Class<?> fieldTypeWrapper = ClassUtils.primitiveToWrapper(f.getType());
TypeVariable<?> fieldTypeGeneric = null;
if(fieldType instanceof TypeVariable) {
fieldTypeGeneric = (TypeVariable<?>) fieldType;
fieldType = materializeTypeVariable(typeHierarchy, (TypeVariable<?>)fieldType);
}
for(Method m : clazz.getMethods()) {
final String methodNameLow = m.getName().endsWith("_$eq") ?
m.getName().toLowerCase().replaceAll("_", "").replaceFirst("\\$eq$", "_\\$eq") :
m.getName().toLowerCase().replaceAll("_", "");
// check for getter
if( // The name should be "get<FieldName>" or "<fieldName>" (for scala) or "is<fieldName>" for boolean fields.
(methodNameLow.equals("get"+fieldNameLow) || methodNameLow.equals("is"+fieldNameLow) || methodNameLow.equals(fieldNameLow)) &&
// no arguments for the getter
m.getParameterTypes().length == 0 &&
// return type is same as field type (or the generic variant of it)
(m.getGenericReturnType().equals( fieldType ) || (fieldTypeWrapper != null && m.getReturnType().equals( fieldTypeWrapper )) || (fieldTypeGeneric != null && m.getGenericReturnType().equals(fieldTypeGeneric)) )
) {
hasGetter = true;
}
// check for setters (<FieldName>_$eq for scala)
if((methodNameLow.equals("set"+fieldNameLow) || methodNameLow.equals(fieldNameLow+"_$eq")) &&
m.getParameterTypes().length == 1 && // one parameter of the field's type
(m.getGenericParameterTypes()[0].equals( fieldType ) || (fieldTypeWrapper != null && m.getParameterTypes()[0].equals( fieldTypeWrapper )) || (fieldTypeGeneric != null && m.getGenericParameterTypes()[0].equals(fieldTypeGeneric) ) )&&
// return type is void.
m.getReturnType().equals(Void.TYPE)
) {
hasSetter = true;
}
}
if(hasGetter && hasSetter) {
return true;
} else {
if(!hasGetter) {
LOG.info(clazz+" does not contain a getter for field "+f.getName() );
}
if(!hasSetter) {
LOG.info(clazz+" does not contain a setter for field "+f.getName() );
}
return false;
}
}
} | [
"private",
"boolean",
"isValidPojoField",
"(",
"Field",
"f",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"ArrayList",
"<",
"Type",
">",
"typeHierarchy",
")",
"{",
"if",
"(",
"Modifier",
".",
"isPublic",
"(",
"f",
".",
"getModifiers",
"(",
")",
")",
")",... | Checks if the given field is a valid pojo field:
- it is public
OR
- there are getter and setter methods for the field.
@param f field to check
@param clazz class of field
@param typeHierarchy type hierarchy for materializing generic types | [
"Checks",
"if",
"the",
"given",
"field",
"is",
"a",
"valid",
"pojo",
"field",
":",
"-",
"it",
"is",
"public",
"OR",
"-",
"there",
"are",
"getter",
"and",
"setter",
"methods",
"for",
"the",
"field",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L1771-L1823 | train | Checks if the given field is a POJO field. | [
30522,
2797,
22017,
20898,
2003,
10175,
3593,
6873,
5558,
3790,
1006,
2492,
1042,
1010,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
9140,
9863,
1026,
2828,
1028,
2828,
4048,
6906,
29389,
1007,
1063,
2065,
1006,
16913,
18095,
1012,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java | ExecutionVertex.connectSource | public void connectSource(int inputNumber, IntermediateResult source, JobEdge edge, int consumerNumber) {
final DistributionPattern pattern = edge.getDistributionPattern();
final IntermediateResultPartition[] sourcePartitions = source.getPartitions();
ExecutionEdge[] edges;
switch (pattern) {
case POINTWISE:
edges = connectPointwise(sourcePartitions, inputNumber);
break;
case ALL_TO_ALL:
edges = connectAllToAll(sourcePartitions, inputNumber);
break;
default:
throw new RuntimeException("Unrecognized distribution pattern.");
}
inputEdges[inputNumber] = edges;
// add the consumers to the source
// for now (until the receiver initiated handshake is in place), we need to register the
// edges as the execution graph
for (ExecutionEdge ee : edges) {
ee.getSource().addConsumer(ee, consumerNumber);
}
} | java | public void connectSource(int inputNumber, IntermediateResult source, JobEdge edge, int consumerNumber) {
final DistributionPattern pattern = edge.getDistributionPattern();
final IntermediateResultPartition[] sourcePartitions = source.getPartitions();
ExecutionEdge[] edges;
switch (pattern) {
case POINTWISE:
edges = connectPointwise(sourcePartitions, inputNumber);
break;
case ALL_TO_ALL:
edges = connectAllToAll(sourcePartitions, inputNumber);
break;
default:
throw new RuntimeException("Unrecognized distribution pattern.");
}
inputEdges[inputNumber] = edges;
// add the consumers to the source
// for now (until the receiver initiated handshake is in place), we need to register the
// edges as the execution graph
for (ExecutionEdge ee : edges) {
ee.getSource().addConsumer(ee, consumerNumber);
}
} | [
"public",
"void",
"connectSource",
"(",
"int",
"inputNumber",
",",
"IntermediateResult",
"source",
",",
"JobEdge",
"edge",
",",
"int",
"consumerNumber",
")",
"{",
"final",
"DistributionPattern",
"pattern",
"=",
"edge",
".",
"getDistributionPattern",
"(",
")",
";",... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java#L369-L398 | train | Connects the given edge to the given source. | [
30522,
2270,
11675,
8539,
8162,
3401,
1006,
20014,
7953,
19172,
5677,
1010,
7783,
6072,
11314,
3120,
1010,
3105,
24225,
3341,
1010,
20014,
7325,
19172,
5677,
1007,
1063,
2345,
4353,
4502,
12079,
2078,
5418,
1027,
3341,
1012,
2131,
10521,
18... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/windowing/windows/TimeWindow.java | TimeWindow.cover | public TimeWindow cover(TimeWindow other) {
return new TimeWindow(Math.min(start, other.start), Math.max(end, other.end));
} | java | public TimeWindow cover(TimeWindow other) {
return new TimeWindow(Math.min(start, other.start), Math.max(end, other.end));
} | [
"public",
"TimeWindow",
"cover",
"(",
"TimeWindow",
"other",
")",
"{",
"return",
"new",
"TimeWindow",
"(",
"Math",
".",
"min",
"(",
"start",
",",
"other",
".",
"start",
")",
",",
"Math",
".",
"max",
"(",
"end",
",",
"other",
".",
"end",
")",
")",
"... | Returns the minimal window covers both this window and the given window. | [
"Returns",
"the",
"minimal",
"window",
"covers",
"both",
"this",
"window",
"and",
"the",
"given",
"window",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/TimeWindow.java#L126-L128 | train | Returns a new time window that contains the specified time window. | [
30522,
2270,
2051,
11101,
5004,
3104,
1006,
2051,
11101,
5004,
2060,
1007,
1063,
2709,
2047,
2051,
11101,
5004,
1006,
8785,
1012,
8117,
1006,
2707,
1010,
2060,
1012,
2707,
1007,
1010,
8785,
1012,
4098,
1006,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.groupReduceOnEdges | public <T> DataSet<T> groupReduceOnEdges(EdgesFunction<K, EV, T> edgesFunction,
EdgeDirection direction, TypeInformation<T> typeInfo) throws IllegalArgumentException {
switch (direction) {
case IN:
return edges.map(new ProjectVertexIdMap<>(1)).name("Vertex ID")
.withForwardedFields("f1->f0")
.groupBy(0).reduceGroup(new ApplyGroupReduceFunction<>(edgesFunction))
.name("GroupReduce on in-edges").returns(typeInfo);
case OUT:
return edges.map(new ProjectVertexIdMap<>(0)).name("Vertex ID")
.withForwardedFields("f0")
.groupBy(0).reduceGroup(new ApplyGroupReduceFunction<>(edgesFunction))
.name("GroupReduce on out-edges").returns(typeInfo);
case ALL:
return edges.flatMap(new EmitOneEdgePerNode<>()).name("Emit edge")
.groupBy(0).reduceGroup(new ApplyGroupReduceFunction<>(edgesFunction))
.name("GroupReduce on in- and out-edges").returns(typeInfo);
default:
throw new IllegalArgumentException("Illegal edge direction");
}
} | java | public <T> DataSet<T> groupReduceOnEdges(EdgesFunction<K, EV, T> edgesFunction,
EdgeDirection direction, TypeInformation<T> typeInfo) throws IllegalArgumentException {
switch (direction) {
case IN:
return edges.map(new ProjectVertexIdMap<>(1)).name("Vertex ID")
.withForwardedFields("f1->f0")
.groupBy(0).reduceGroup(new ApplyGroupReduceFunction<>(edgesFunction))
.name("GroupReduce on in-edges").returns(typeInfo);
case OUT:
return edges.map(new ProjectVertexIdMap<>(0)).name("Vertex ID")
.withForwardedFields("f0")
.groupBy(0).reduceGroup(new ApplyGroupReduceFunction<>(edgesFunction))
.name("GroupReduce on out-edges").returns(typeInfo);
case ALL:
return edges.flatMap(new EmitOneEdgePerNode<>()).name("Emit edge")
.groupBy(0).reduceGroup(new ApplyGroupReduceFunction<>(edgesFunction))
.name("GroupReduce on in- and out-edges").returns(typeInfo);
default:
throw new IllegalArgumentException("Illegal edge direction");
}
} | [
"public",
"<",
"T",
">",
"DataSet",
"<",
"T",
">",
"groupReduceOnEdges",
"(",
"EdgesFunction",
"<",
"K",
",",
"EV",
",",
"T",
">",
"edgesFunction",
",",
"EdgeDirection",
"direction",
",",
"TypeInformation",
"<",
"T",
">",
"typeInfo",
")",
"throws",
"Illega... | Groups by vertex and computes a GroupReduce transformation over the edge values of each vertex.
The edgesFunction applied on the edges only has access to the vertex id (not the vertex value)
of the grouping vertex.
<p>For each vertex, the edgesFunction can iterate over all edges of this vertex
with the specified direction, and emit any number of output elements, including none.
@param edgesFunction the group reduce function to apply to the neighboring edges of each vertex.
@param direction the edge direction (in-, out-, all-).
@param <T> the output type
@param typeInfo the explicit return type.
@return a DataSet containing elements of type T
@throws IllegalArgumentException | [
"Groups",
"by",
"vertex",
"and",
"computes",
"a",
"GroupReduce",
"transformation",
"over",
"the",
"edge",
"values",
"of",
"each",
"vertex",
".",
"The",
"edgesFunction",
"applied",
"on",
"the",
"edges",
"only",
"has",
"access",
"to",
"the",
"vertex",
"id",
"(... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1103-L1124 | train | Group reduce on edges DataSet. | [
30522,
2270,
1026,
1056,
1028,
2951,
13462,
1026,
1056,
1028,
2177,
5596,
18796,
17799,
8449,
1006,
7926,
11263,
27989,
1026,
1047,
1010,
23408,
1010,
1056,
1028,
7926,
11263,
27989,
1010,
13011,
7442,
7542,
3257,
1010,
2828,
2378,
14192,
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... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/HpackStaticTable.java | HpackStaticTable.createMap | private static CharSequenceMap<Integer> createMap() {
int length = STATIC_TABLE.size();
@SuppressWarnings("unchecked")
CharSequenceMap<Integer> ret = new CharSequenceMap<Integer>(true,
UnsupportedValueConverter.<Integer>instance(), length);
// Iterate through the static table in reverse order to
// save the smallest index for a given name in the map.
for (int index = length; index > 0; index--) {
HpackHeaderField entry = getEntry(index);
CharSequence name = entry.name;
ret.set(name, index);
}
return ret;
} | java | private static CharSequenceMap<Integer> createMap() {
int length = STATIC_TABLE.size();
@SuppressWarnings("unchecked")
CharSequenceMap<Integer> ret = new CharSequenceMap<Integer>(true,
UnsupportedValueConverter.<Integer>instance(), length);
// Iterate through the static table in reverse order to
// save the smallest index for a given name in the map.
for (int index = length; index > 0; index--) {
HpackHeaderField entry = getEntry(index);
CharSequence name = entry.name;
ret.set(name, index);
}
return ret;
} | [
"private",
"static",
"CharSequenceMap",
"<",
"Integer",
">",
"createMap",
"(",
")",
"{",
"int",
"length",
"=",
"STATIC_TABLE",
".",
"size",
"(",
")",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"CharSequenceMap",
"<",
"Integer",
">",
"ret",
"=",... | create a map CharSequenceMap header name to index value to allow quick lookup | [
"create",
"a",
"map",
"CharSequenceMap",
"header",
"name",
"to",
"index",
"value",
"to",
"allow",
"quick",
"lookup"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackStaticTable.java#L170-L183 | train | Create a map of all the class names to the smallest index. | [
30522,
2797,
10763,
25869,
3366,
4226,
5897,
2863,
2361,
1026,
16109,
1028,
3443,
2863,
2361,
1006,
1007,
1063,
20014,
3091,
1027,
10763,
1035,
2795,
1012,
2946,
1006,
1007,
1025,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java | SqlDateTimeUtils.toTimestamp | public static Long toTimestamp(String dateStr, TimeZone tz) {
int length = dateStr.length();
String format;
if (length == 21) {
format = DEFAULT_DATETIME_FORMATS[1];
} else if (length == 22) {
format = DEFAULT_DATETIME_FORMATS[2];
} else if (length == 23) {
format = DEFAULT_DATETIME_FORMATS[3];
} else {
// otherwise fall back to the default
format = DEFAULT_DATETIME_FORMATS[0];
}
return toTimestamp(dateStr, format, tz);
} | java | public static Long toTimestamp(String dateStr, TimeZone tz) {
int length = dateStr.length();
String format;
if (length == 21) {
format = DEFAULT_DATETIME_FORMATS[1];
} else if (length == 22) {
format = DEFAULT_DATETIME_FORMATS[2];
} else if (length == 23) {
format = DEFAULT_DATETIME_FORMATS[3];
} else {
// otherwise fall back to the default
format = DEFAULT_DATETIME_FORMATS[0];
}
return toTimestamp(dateStr, format, tz);
} | [
"public",
"static",
"Long",
"toTimestamp",
"(",
"String",
"dateStr",
",",
"TimeZone",
"tz",
")",
"{",
"int",
"length",
"=",
"dateStr",
".",
"length",
"(",
")",
";",
"String",
"format",
";",
"if",
"(",
"length",
"==",
"21",
")",
"{",
"format",
"=",
"D... | Parse date time string to timestamp based on the given time zone and
"yyyy-MM-dd HH:mm:ss" format. Returns null if parsing failed.
@param dateStr the date time string
@param tz the time zone | [
"Parse",
"date",
"time",
"string",
"to",
"timestamp",
"based",
"on",
"the",
"given",
"time",
"zone",
"and",
"yyyy",
"-",
"MM",
"-",
"dd",
"HH",
":",
"mm",
":",
"ss",
"format",
".",
"Returns",
"null",
"if",
"parsing",
"failed",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L247-L261 | train | Converts a String to a Long. | [
30522,
2270,
10763,
2146,
2000,
7292,
9153,
8737,
1006,
5164,
5246,
16344,
1010,
2051,
15975,
1056,
2480,
1007,
1063,
20014,
3091,
1027,
5246,
16344,
1012,
3091,
1006,
1007,
1025,
5164,
4289,
1025,
2065,
1006,
3091,
1027,
1027,
2538,
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/collection/trie/DoubleArrayTrie.java | DoubleArrayTrie.loadBaseAndCheck | private boolean loadBaseAndCheck(String path)
{
try
{
DataInputStream in = new DataInputStream(new BufferedInputStream(IOAdapter == null ?
new FileInputStream(path) :
IOAdapter.open(path)
));
size = in.readInt();
base = new int[size + 65535]; // 多留一些,防止越界
check = new int[size + 65535];
for (int i = 0; i < size; i++)
{
base[i] = in.readInt();
check[i] = in.readInt();
}
}
catch (Exception e)
{
return false;
}
return true;
} | java | private boolean loadBaseAndCheck(String path)
{
try
{
DataInputStream in = new DataInputStream(new BufferedInputStream(IOAdapter == null ?
new FileInputStream(path) :
IOAdapter.open(path)
));
size = in.readInt();
base = new int[size + 65535]; // 多留一些,防止越界
check = new int[size + 65535];
for (int i = 0; i < size; i++)
{
base[i] = in.readInt();
check[i] = in.readInt();
}
}
catch (Exception e)
{
return false;
}
return true;
} | [
"private",
"boolean",
"loadBaseAndCheck",
"(",
"String",
"path",
")",
"{",
"try",
"{",
"DataInputStream",
"in",
"=",
"new",
"DataInputStream",
"(",
"new",
"BufferedInputStream",
"(",
"IOAdapter",
"==",
"null",
"?",
"new",
"FileInputStream",
"(",
"path",
")",
"... | 从磁盘加载双数组
@param path
@return | [
"从磁盘加载双数组"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L590-L612 | train | Load base check. | [
30522,
2797,
22017,
20898,
7170,
15058,
5685,
5403,
3600,
1006,
5164,
4130,
1007,
1063,
3046,
1063,
2951,
2378,
18780,
21422,
1999,
1027,
2047,
2951,
2378,
18780,
21422,
1006,
2047,
17698,
2098,
2378,
18780,
21422,
1006,
22834,
8447,
13876,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContext.java | ServletWebServerApplicationContext.prepareWebApplicationContext | protected void prepareWebApplicationContext(ServletContext servletContext) {
Object rootContext = servletContext.getAttribute(
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
if (rootContext != null) {
if (rootContext == this) {
throw new IllegalStateException(
"Cannot initialize context because there is already a root application context present - "
+ "check whether you have multiple ServletContextInitializers!");
}
return;
}
Log logger = LogFactory.getLog(ContextLoader.class);
servletContext.log("Initializing Spring embedded WebApplicationContext");
try {
servletContext.setAttribute(
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, this);
if (logger.isDebugEnabled()) {
logger.debug(
"Published root WebApplicationContext as ServletContext attribute with name ["
+ WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
+ "]");
}
setServletContext(servletContext);
if (logger.isInfoEnabled()) {
long elapsedTime = System.currentTimeMillis() - getStartupDate();
logger.info("Root WebApplicationContext: initialization completed in "
+ elapsedTime + " ms");
}
}
catch (RuntimeException | Error ex) {
logger.error("Context initialization failed", ex);
servletContext.setAttribute(
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ex);
throw ex;
}
} | java | protected void prepareWebApplicationContext(ServletContext servletContext) {
Object rootContext = servletContext.getAttribute(
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
if (rootContext != null) {
if (rootContext == this) {
throw new IllegalStateException(
"Cannot initialize context because there is already a root application context present - "
+ "check whether you have multiple ServletContextInitializers!");
}
return;
}
Log logger = LogFactory.getLog(ContextLoader.class);
servletContext.log("Initializing Spring embedded WebApplicationContext");
try {
servletContext.setAttribute(
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, this);
if (logger.isDebugEnabled()) {
logger.debug(
"Published root WebApplicationContext as ServletContext attribute with name ["
+ WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
+ "]");
}
setServletContext(servletContext);
if (logger.isInfoEnabled()) {
long elapsedTime = System.currentTimeMillis() - getStartupDate();
logger.info("Root WebApplicationContext: initialization completed in "
+ elapsedTime + " ms");
}
}
catch (RuntimeException | Error ex) {
logger.error("Context initialization failed", ex);
servletContext.setAttribute(
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ex);
throw ex;
}
} | [
"protected",
"void",
"prepareWebApplicationContext",
"(",
"ServletContext",
"servletContext",
")",
"{",
"Object",
"rootContext",
"=",
"servletContext",
".",
"getAttribute",
"(",
"WebApplicationContext",
".",
"ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE",
")",
";",
"if",
"(",
"... | Prepare the {@link WebApplicationContext} with the given fully loaded
{@link ServletContext}. This method is usually called from
{@link ServletContextInitializer#onStartup(ServletContext)} and is similar to the
functionality usually provided by a {@link ContextLoaderListener}.
@param servletContext the operational servlet context | [
"Prepare",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContext.java#L271-L306 | train | Prepare the Spring embedded WebApplicationContext. | [
30522,
5123,
11675,
7374,
8545,
3676,
9397,
19341,
3508,
30524,
7485,
8663,
18209,
1012,
2131,
19321,
3089,
8569,
2618,
1006,
4773,
29098,
19341,
3508,
8663,
18209,
1012,
7117,
1035,
4773,
1035,
4646,
1035,
6123,
1035,
17961,
1007,
1025,
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-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/clustering/KMeans.java | KMeans.getCentroidDataSet | private static DataSet<Centroid> getCentroidDataSet(ParameterTool params, ExecutionEnvironment env) {
DataSet<Centroid> centroids;
if (params.has("centroids")) {
centroids = env.readCsvFile(params.get("centroids"))
.fieldDelimiter(" ")
.pojoType(Centroid.class, "id", "x", "y");
} else {
System.out.println("Executing K-Means example with default centroid data set.");
System.out.println("Use --centroids to specify file input.");
centroids = KMeansData.getDefaultCentroidDataSet(env);
}
return centroids;
} | java | private static DataSet<Centroid> getCentroidDataSet(ParameterTool params, ExecutionEnvironment env) {
DataSet<Centroid> centroids;
if (params.has("centroids")) {
centroids = env.readCsvFile(params.get("centroids"))
.fieldDelimiter(" ")
.pojoType(Centroid.class, "id", "x", "y");
} else {
System.out.println("Executing K-Means example with default centroid data set.");
System.out.println("Use --centroids to specify file input.");
centroids = KMeansData.getDefaultCentroidDataSet(env);
}
return centroids;
} | [
"private",
"static",
"DataSet",
"<",
"Centroid",
">",
"getCentroidDataSet",
"(",
"ParameterTool",
"params",
",",
"ExecutionEnvironment",
"env",
")",
"{",
"DataSet",
"<",
"Centroid",
">",
"centroids",
";",
"if",
"(",
"params",
".",
"has",
"(",
"\"centroids\"",
... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/clustering/KMeans.java#L125-L137 | train | Get the centroid data set from the input file. | [
30522,
2797,
10763,
2951,
13462,
1026,
18120,
3593,
1028,
2131,
13013,
22943,
2850,
18260,
2102,
1006,
16381,
3406,
4747,
11498,
5244,
1010,
7781,
2368,
21663,
2239,
3672,
4372,
2615,
1007,
1063,
2951,
13462,
1026,
18120,
3593,
1028,
18120,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/enjoy/EnjoyTemplate.java | EnjoyTemplate.wrap | public static EnjoyTemplate wrap(com.jfinal.template.Template EnjoyTemplate) {
return (null == EnjoyTemplate) ? null : new EnjoyTemplate(EnjoyTemplate);
} | java | public static EnjoyTemplate wrap(com.jfinal.template.Template EnjoyTemplate) {
return (null == EnjoyTemplate) ? null : new EnjoyTemplate(EnjoyTemplate);
} | [
"public",
"static",
"EnjoyTemplate",
"wrap",
"(",
"com",
".",
"jfinal",
".",
"template",
".",
"Template",
"EnjoyTemplate",
")",
"{",
"return",
"(",
"null",
"==",
"EnjoyTemplate",
")",
"?",
"null",
":",
"new",
"EnjoyTemplate",
"(",
"EnjoyTemplate",
")",
";",
... | 包装Enjoy模板
@param EnjoyTemplate Enjoy的模板对象 {@link com.jfinal.template.Template}
@return {@link EnjoyTemplate} | [
"包装Enjoy模板"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/enjoy/EnjoyTemplate.java#L27-L29 | train | Wraps an existing jpa. template. Template object. | [
30522,
2270,
10763,
5959,
18532,
15725,
10236,
1006,
4012,
1012,
1046,
16294,
2389,
1012,
23561,
1012,
23561,
5959,
18532,
15725,
1007,
1063,
2709,
1006,
19701,
1027,
1027,
5959,
18532,
15725,
1007,
1029,
19701,
1024,
2047,
5959,
18532,
15725... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HpackHuffmanEncoder.java | HpackHuffmanEncoder.getEncodedLength | int getEncodedLength(CharSequence data) {
if (data instanceof AsciiString) {
AsciiString string = (AsciiString) data;
try {
encodedLengthProcessor.reset();
string.forEachByte(encodedLengthProcessor);
return encodedLengthProcessor.length();
} catch (Exception e) {
PlatformDependent.throwException(e);
return -1;
}
} else {
return getEncodedLengthSlowPath(data);
}
} | java | int getEncodedLength(CharSequence data) {
if (data instanceof AsciiString) {
AsciiString string = (AsciiString) data;
try {
encodedLengthProcessor.reset();
string.forEachByte(encodedLengthProcessor);
return encodedLengthProcessor.length();
} catch (Exception e) {
PlatformDependent.throwException(e);
return -1;
}
} else {
return getEncodedLengthSlowPath(data);
}
} | [
"int",
"getEncodedLength",
"(",
"CharSequence",
"data",
")",
"{",
"if",
"(",
"data",
"instanceof",
"AsciiString",
")",
"{",
"AsciiString",
"string",
"=",
"(",
"AsciiString",
")",
"data",
";",
"try",
"{",
"encodedLengthProcessor",
".",
"reset",
"(",
")",
";",... | Returns the number of bytes required to Huffman encode the input string literal.
@param data the string literal to be Huffman encoded
@return the number of bytes required to Huffman encode {@code data} | [
"Returns",
"the",
"number",
"of",
"bytes",
"required",
"to",
"Huffman",
"encode",
"the",
"input",
"string",
"literal",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackHuffmanEncoder.java#L117-L131 | train | getEncodedLength This method is used to get the length of a char sequence. | [
30522,
20014,
2131,
2368,
16044,
10362,
3070,
2705,
1006,
25869,
3366,
4226,
5897,
2951,
1007,
1063,
2065,
1006,
2951,
6013,
11253,
2004,
6895,
2923,
4892,
1007,
1063,
2004,
6895,
2923,
4892,
5164,
1027,
1006,
2004,
6895,
2923,
4892,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/domain/EntityScanner.java | EntityScanner.scan | @SafeVarargs
public final Set<Class<?>> scan(Class<? extends Annotation>... annotationTypes)
throws ClassNotFoundException {
List<String> packages = getPackages();
if (packages.isEmpty()) {
return Collections.emptySet();
}
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
false);
scanner.setEnvironment(this.context.getEnvironment());
scanner.setResourceLoader(this.context);
for (Class<? extends Annotation> annotationType : annotationTypes) {
scanner.addIncludeFilter(new AnnotationTypeFilter(annotationType));
}
Set<Class<?>> entitySet = new HashSet<>();
for (String basePackage : packages) {
if (StringUtils.hasText(basePackage)) {
for (BeanDefinition candidate : scanner
.findCandidateComponents(basePackage)) {
entitySet.add(ClassUtils.forName(candidate.getBeanClassName(),
this.context.getClassLoader()));
}
}
}
return entitySet;
} | java | @SafeVarargs
public final Set<Class<?>> scan(Class<? extends Annotation>... annotationTypes)
throws ClassNotFoundException {
List<String> packages = getPackages();
if (packages.isEmpty()) {
return Collections.emptySet();
}
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(
false);
scanner.setEnvironment(this.context.getEnvironment());
scanner.setResourceLoader(this.context);
for (Class<? extends Annotation> annotationType : annotationTypes) {
scanner.addIncludeFilter(new AnnotationTypeFilter(annotationType));
}
Set<Class<?>> entitySet = new HashSet<>();
for (String basePackage : packages) {
if (StringUtils.hasText(basePackage)) {
for (BeanDefinition candidate : scanner
.findCandidateComponents(basePackage)) {
entitySet.add(ClassUtils.forName(candidate.getBeanClassName(),
this.context.getClassLoader()));
}
}
}
return entitySet;
} | [
"@",
"SafeVarargs",
"public",
"final",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"scan",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"...",
"annotationTypes",
")",
"throws",
"ClassNotFoundException",
"{",
"List",
"<",
"String",
">",
"packages",
"=... | Scan for entities with the specified annotations.
@param annotationTypes the annotation types used on the entities
@return a set of entity classes
@throws ClassNotFoundException if an entity class cannot be loaded | [
"Scan",
"for",
"entities",
"with",
"the",
"specified",
"annotations",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/domain/EntityScanner.java#L60-L85 | train | Scans the classpath for classes that are annotated with the given annotation types. | [
30522,
1030,
3647,
24516,
10623,
2015,
2270,
2345,
2275,
1026,
2465,
1026,
1029,
1028,
1028,
13594,
1006,
2465,
1026,
30524,
13923,
1006,
1007,
1025,
2065,
1006,
14555,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1007,
1063,
2709,
6407,
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... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/sources/tsextractors/TimestampExtractor.java | TimestampExtractor.toProperties | @Override
public Map<String, String> toProperties() {
Map<String, String> properties = new HashMap<>();
properties.put(Rowtime.ROWTIME_TIMESTAMPS_TYPE, Rowtime.ROWTIME_TIMESTAMPS_TYPE_VALUE_CUSTOM);
properties.put(Rowtime.ROWTIME_TIMESTAMPS_CLASS, this.getClass().getName());
properties.put(Rowtime.ROWTIME_TIMESTAMPS_SERIALIZED, EncodingUtils.encodeObjectToString(this));
return properties;
} | java | @Override
public Map<String, String> toProperties() {
Map<String, String> properties = new HashMap<>();
properties.put(Rowtime.ROWTIME_TIMESTAMPS_TYPE, Rowtime.ROWTIME_TIMESTAMPS_TYPE_VALUE_CUSTOM);
properties.put(Rowtime.ROWTIME_TIMESTAMPS_CLASS, this.getClass().getName());
properties.put(Rowtime.ROWTIME_TIMESTAMPS_SERIALIZED, EncodingUtils.encodeObjectToString(this));
return properties;
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"String",
">",
"toProperties",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"properties",
".",
"put",
"(",
"Rowtime",
".",
"RO... | This method is a default implementation that uses java serialization and it is discouraged.
All implementation should provide a more specific set of properties. | [
"This",
"method",
"is",
"a",
"default",
"implementation",
"that",
"uses",
"java",
"serialization",
"and",
"it",
"is",
"discouraged",
".",
"All",
"implementation",
"should",
"provide",
"a",
"more",
"specific",
"set",
"of",
"properties",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/sources/tsextractors/TimestampExtractor.java#L48-L55 | train | Returns a map of properties that can be used to write the rowtime. | [
30522,
1030,
2058,
15637,
2270,
4949,
1026,
5164,
1010,
5164,
1028,
2327,
18981,
8743,
3111,
1006,
1007,
1063,
4949,
1026,
5164,
1010,
5164,
1028,
5144,
1027,
2047,
23325,
2863,
2361,
1026,
1028,
1006,
1007,
1025,
5144,
1012,
2404,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.lastIndexOf | public static int lastIndexOf(short[] array, short value) {
if (null != array) {
for (int i = array.length - 1; i >= 0; i--) {
if (value == array[i]) {
return i;
}
}
}
return INDEX_NOT_FOUND;
} | java | public static int lastIndexOf(short[] array, short value) {
if (null != array) {
for (int i = array.length - 1; i >= 0; i--) {
if (value == array[i]) {
return i;
}
}
}
return INDEX_NOT_FOUND;
} | [
"public",
"static",
"int",
"lastIndexOf",
"(",
"short",
"[",
"]",
"array",
",",
"short",
"value",
")",
"{",
"if",
"(",
"null",
"!=",
"array",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"array",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i"... | 返回数组中指定元素所在最后的位置,未找到返回{@link #INDEX_NOT_FOUND}
@param array 数组
@param value 被检查的元素
@return 数组中指定元素所在位置,未找到返回{@link #INDEX_NOT_FOUND}
@since 3.0.7 | [
"返回数组中指定元素所在最后的位置,未找到返回",
"{",
"@link",
"#INDEX_NOT_FOUND",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L1119-L1128 | train | Returns the index of the last occurrence of the specified value in the array or INDEX_NOT_FOUND. | [
30522,
2270,
10763,
20014,
2197,
22254,
10288,
11253,
1006,
2460,
1031,
1033,
9140,
1010,
2460,
3643,
1007,
1063,
2065,
1006,
19701,
999,
1027,
9140,
1007,
1063,
2005,
1006,
20014,
1045,
1027,
9140,
1012,
3091,
1011,
1015,
1025,
1045,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/PinyinUtil.java | PinyinUtil.getAllFirstLetter | public static String getAllFirstLetter(String chinese) {
if (StrUtil.isBlank(chinese)) {
return StrUtil.EMPTY;
}
int len = chinese.length();
final StrBuilder strBuilder = new StrBuilder(len);
for (int i = 0; i < len; i++) {
strBuilder.append(getFirstLetter(chinese.charAt(i)));
}
return strBuilder.toString();
} | java | public static String getAllFirstLetter(String chinese) {
if (StrUtil.isBlank(chinese)) {
return StrUtil.EMPTY;
}
int len = chinese.length();
final StrBuilder strBuilder = new StrBuilder(len);
for (int i = 0; i < len; i++) {
strBuilder.append(getFirstLetter(chinese.charAt(i)));
}
return strBuilder.toString();
} | [
"public",
"static",
"String",
"getAllFirstLetter",
"(",
"String",
"chinese",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"chinese",
")",
")",
"{",
"return",
"StrUtil",
".",
"EMPTY",
";",
"}",
"int",
"len",
"=",
"chinese",
".",
"length",
"(",
"... | 获取所给中文的每个汉字首字母组成首字母字符串
@param chinese 汉字字符串
@return 首字母字符串 | [
"获取所给中文的每个汉字首字母组成首字母字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/PinyinUtil.java#L60-L72 | train | Gets all first letter from a string. | [
30522,
2270,
10763,
5164,
2131,
8095,
8873,
12096,
27901,
2099,
1006,
5164,
2822,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
2822,
1007,
1007,
1063,
2709,
2358,
22134,
4014,
1012,
4064,
1025,
1065,
20014,
1879... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/FlinkKinesisConsumer.java | FlinkKinesisConsumer.setPeriodicWatermarkAssigner | public void setPeriodicWatermarkAssigner(
AssignerWithPeriodicWatermarks<T> periodicWatermarkAssigner) {
this.periodicWatermarkAssigner = periodicWatermarkAssigner;
ClosureCleaner.clean(this.periodicWatermarkAssigner, true);
} | java | public void setPeriodicWatermarkAssigner(
AssignerWithPeriodicWatermarks<T> periodicWatermarkAssigner) {
this.periodicWatermarkAssigner = periodicWatermarkAssigner;
ClosureCleaner.clean(this.periodicWatermarkAssigner, true);
} | [
"public",
"void",
"setPeriodicWatermarkAssigner",
"(",
"AssignerWithPeriodicWatermarks",
"<",
"T",
">",
"periodicWatermarkAssigner",
")",
"{",
"this",
".",
"periodicWatermarkAssigner",
"=",
"periodicWatermarkAssigner",
";",
"ClosureCleaner",
".",
"clean",
"(",
"this",
"."... | Set the assigner that will extract the timestamp from {@link T} and calculate the
watermark.
@param periodicWatermarkAssigner periodic watermark assigner | [
"Set",
"the",
"assigner",
"that",
"will",
"extract",
"the",
"timestamp",
"from",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/FlinkKinesisConsumer.java#L251-L255 | train | Sets the periodic watermark assigner. | [
30522,
2270,
11675,
2275,
4842,
3695,
14808,
5880,
10665,
12054,
23773,
2121,
1006,
23911,
2121,
24415,
4842,
3695,
14808,
5880,
27373,
1026,
1056,
1028,
15861,
5880,
10665,
12054,
23773,
2121,
1007,
1063,
2023,
1012,
15861,
5880,
10665,
1205... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java | CompactingHashTable.buildTableWithUniqueKey | public void buildTableWithUniqueKey(final MutableObjectIterator<T> input) throws IOException {
// go over the complete input and insert every element into the hash table
T value;
while (this.running && (value = input.next()) != null) {
insertOrReplaceRecord(value);
}
} | java | public void buildTableWithUniqueKey(final MutableObjectIterator<T> input) throws IOException {
// go over the complete input and insert every element into the hash table
T value;
while (this.running && (value = input.next()) != null) {
insertOrReplaceRecord(value);
}
} | [
"public",
"void",
"buildTableWithUniqueKey",
"(",
"final",
"MutableObjectIterator",
"<",
"T",
">",
"input",
")",
"throws",
"IOException",
"{",
"// go over the complete input and insert every element into the hash table",
"T",
"value",
";",
"while",
"(",
"this",
".",
"runn... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java#L311-L318 | train | Build the hash table with a unique key. | [
30522,
2270,
11675,
3857,
10880,
24415,
19496,
4226,
14839,
1006,
2345,
14163,
10880,
16429,
20614,
21646,
8844,
1026,
1056,
1028,
7953,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
2175,
2058,
1996,
3143,
7953,
1998,
19274,
2296,
5783... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-api-java/src/main/java/org/apache/flink/table/operations/OperationExpressionsUtils.java | OperationExpressionsUtils.extractAggregationsAndProperties | public static CategorizedExpressions extractAggregationsAndProperties(
List<Expression> expressions,
Supplier<String> uniqueAttributeGenerator) {
AggregationAndPropertiesSplitter splitter = new AggregationAndPropertiesSplitter(uniqueAttributeGenerator);
expressions.forEach(expr -> expr.accept(splitter));
List<Expression> projections = expressions.stream()
.map(expr -> expr.accept(new AggregationAndPropertiesReplacer(splitter.aggregates,
splitter.properties)))
.collect(Collectors.toList());
List<Expression> aggregates = nameExpressions(splitter.aggregates);
List<Expression> properties = nameExpressions(splitter.properties);
return new CategorizedExpressions(projections, aggregates, properties);
} | java | public static CategorizedExpressions extractAggregationsAndProperties(
List<Expression> expressions,
Supplier<String> uniqueAttributeGenerator) {
AggregationAndPropertiesSplitter splitter = new AggregationAndPropertiesSplitter(uniqueAttributeGenerator);
expressions.forEach(expr -> expr.accept(splitter));
List<Expression> projections = expressions.stream()
.map(expr -> expr.accept(new AggregationAndPropertiesReplacer(splitter.aggregates,
splitter.properties)))
.collect(Collectors.toList());
List<Expression> aggregates = nameExpressions(splitter.aggregates);
List<Expression> properties = nameExpressions(splitter.properties);
return new CategorizedExpressions(projections, aggregates, properties);
} | [
"public",
"static",
"CategorizedExpressions",
"extractAggregationsAndProperties",
"(",
"List",
"<",
"Expression",
">",
"expressions",
",",
"Supplier",
"<",
"String",
">",
"uniqueAttributeGenerator",
")",
"{",
"AggregationAndPropertiesSplitter",
"splitter",
"=",
"new",
"Ag... | Extracts and deduplicates all aggregation and window property expressions (zero, one, or more)
from the given expressions.
@param expressions a list of expressions to extract
@param uniqueAttributeGenerator a supplier that every time returns a unique attribute
@return a Tuple2, the first field contains the extracted and deduplicated aggregations,
and the second field contains the extracted and deduplicated window properties. | [
"Extracts",
"and",
"deduplicates",
"all",
"aggregation",
"and",
"window",
"property",
"expressions",
"(",
"zero",
"one",
"or",
"more",
")",
"from",
"the",
"given",
"expressions",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/operations/OperationExpressionsUtils.java#L95-L110 | train | Extract the aggregates and properties from the given expressions. | [
30522,
2270,
10763,
20427,
10288,
20110,
8496,
14817,
8490,
17603,
12540,
8791,
18927,
18981,
30524,
19321,
3089,
8569,
2618,
6914,
6906,
4263,
1007,
1063,
28041,
5685,
21572,
4842,
7368,
13102,
15909,
3334,
3975,
3334,
1027,
2047,
28041,
568... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcUtils.java | RpcUtils.terminateRpcEndpoint | public static void terminateRpcEndpoint(RpcEndpoint rpcEndpoint, Time timeout) throws ExecutionException, InterruptedException, TimeoutException {
rpcEndpoint.closeAsync().get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);
} | java | public static void terminateRpcEndpoint(RpcEndpoint rpcEndpoint, Time timeout) throws ExecutionException, InterruptedException, TimeoutException {
rpcEndpoint.closeAsync().get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);
} | [
"public",
"static",
"void",
"terminateRpcEndpoint",
"(",
"RpcEndpoint",
"rpcEndpoint",
",",
"Time",
"timeout",
")",
"throws",
"ExecutionException",
",",
"InterruptedException",
",",
"TimeoutException",
"{",
"rpcEndpoint",
".",
"closeAsync",
"(",
")",
".",
"get",
"("... | Shuts the given {@link RpcEndpoint} down and awaits its termination.
@param rpcEndpoint to terminate
@param timeout for this operation
@throws ExecutionException if a problem occurred
@throws InterruptedException if the operation has been interrupted
@throws TimeoutException if a timeout occurred | [
"Shuts",
"the",
"given",
"{",
"@link",
"RpcEndpoint",
"}",
"down",
"and",
"awaits",
"its",
"termination",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcUtils.java#L76-L78 | train | Terminate the given RPC endpoint. | [
30522,
2270,
10763,
11675,
20320,
14536,
23865,
8400,
1006,
1054,
15042,
10497,
8400,
1054,
15042,
10497,
8400,
1010,
2051,
2051,
5833,
1007,
11618,
7781,
10288,
24422,
1010,
7153,
10288,
24422,
1010,
2051,
5833,
10288,
24422,
1063,
1054,
150... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/perceptron/transition/configuration/Instance.java | Instance.isNonprojective | public boolean isNonprojective()
{
for (int dep1 : goldDependencies.keySet())
{
int head1 = goldDependencies.get(dep1).headIndex;
for (int dep2 : goldDependencies.keySet())
{
int head2 = goldDependencies.get(dep2).headIndex;
if (head1 < 0 || head2 < 0)
continue;
if (dep1 > head1 && head1 != head2)
if ((dep1 > head2 && dep1 < dep2 && head1 < head2) || (dep1 < head2 && dep1 > dep2 && head1 < dep2))
return true;
if (dep1 < head1 && head1 != head2)
if ((head1 > head2 && head1 < dep2 && dep1 < head2) || (head1 < head2 && head1 > dep2 && dep1 < dep2))
return true;
}
}
return false;
} | java | public boolean isNonprojective()
{
for (int dep1 : goldDependencies.keySet())
{
int head1 = goldDependencies.get(dep1).headIndex;
for (int dep2 : goldDependencies.keySet())
{
int head2 = goldDependencies.get(dep2).headIndex;
if (head1 < 0 || head2 < 0)
continue;
if (dep1 > head1 && head1 != head2)
if ((dep1 > head2 && dep1 < dep2 && head1 < head2) || (dep1 < head2 && dep1 > dep2 && head1 < dep2))
return true;
if (dep1 < head1 && head1 != head2)
if ((head1 > head2 && head1 < dep2 && dep1 < head2) || (head1 < head2 && head1 > dep2 && dep1 < dep2))
return true;
}
}
return false;
} | [
"public",
"boolean",
"isNonprojective",
"(",
")",
"{",
"for",
"(",
"int",
"dep1",
":",
"goldDependencies",
".",
"keySet",
"(",
")",
")",
"{",
"int",
"head1",
"=",
"goldDependencies",
".",
"get",
"(",
"dep1",
")",
".",
"headIndex",
";",
"for",
"(",
"int... | Shows whether the tree to train is projective or not
@return true if the tree is non-projective | [
"Shows",
"whether",
"the",
"tree",
"to",
"train",
"is",
"projective",
"or",
"not"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/perceptron/transition/configuration/Instance.java#L84-L103 | train | Is the image nonprojective? | [
30522,
2270,
22017,
20898,
3475,
2239,
21572,
20614,
3512,
1006,
1007,
1063,
2005,
1006,
20014,
2139,
2361,
2487,
1024,
2751,
3207,
11837,
4181,
9243,
1012,
6309,
3388,
1006,
1007,
1007,
1063,
20014,
2132,
2487,
1027,
2751,
3207,
11837,
418... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.mapVertices | public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper, TypeInformation<Vertex<K, NV>> returnType) {
DataSet<Vertex<K, NV>> mappedVertices = vertices.map(
new MapFunction<Vertex<K, VV>, Vertex<K, NV>>() {
private Vertex<K, NV> output = new Vertex<>();
public Vertex<K, NV> map(Vertex<K, VV> value) throws Exception {
output.f0 = value.f0;
output.f1 = mapper.map(value);
return output;
}
})
.returns(returnType)
.withForwardedFields("f0")
.name("Map vertices");
return new Graph<>(mappedVertices, this.edges, this.context);
} | java | public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper, TypeInformation<Vertex<K, NV>> returnType) {
DataSet<Vertex<K, NV>> mappedVertices = vertices.map(
new MapFunction<Vertex<K, VV>, Vertex<K, NV>>() {
private Vertex<K, NV> output = new Vertex<>();
public Vertex<K, NV> map(Vertex<K, VV> value) throws Exception {
output.f0 = value.f0;
output.f1 = mapper.map(value);
return output;
}
})
.returns(returnType)
.withForwardedFields("f0")
.name("Map vertices");
return new Graph<>(mappedVertices, this.edges, this.context);
} | [
"public",
"<",
"NV",
">",
"Graph",
"<",
"K",
",",
"NV",
",",
"EV",
">",
"mapVertices",
"(",
"final",
"MapFunction",
"<",
"Vertex",
"<",
"K",
",",
"VV",
">",
",",
"NV",
">",
"mapper",
",",
"TypeInformation",
"<",
"Vertex",
"<",
"K",
",",
"NV",
">"... | Apply a function to the attribute of each vertex in the graph.
@param mapper the map function to apply.
@param returnType the explicit return type.
@return a new graph | [
"Apply",
"a",
"function",
"to",
"the",
"attribute",
"of",
"each",
"vertex",
"in",
"the",
"graph",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L553-L569 | train | Maps the set of vertices to a graph of edges using the provided mapping function. | [
30522,
2270,
1026,
1050,
2615,
1028,
10629,
1026,
1047,
1010,
1050,
2615,
1010,
23408,
1028,
4949,
16874,
23522,
1006,
2345,
4949,
11263,
27989,
30524,
2615,
1028,
4949,
4842,
1010,
2828,
2378,
14192,
3370,
1026,
19449,
1026,
1047,
1010,
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 | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.split | public AsciiString[] split(String expr, int max) {
return toAsciiStringArray(Pattern.compile(expr).split(this, max));
} | java | public AsciiString[] split(String expr, int max) {
return toAsciiStringArray(Pattern.compile(expr).split(this, max));
} | [
"public",
"AsciiString",
"[",
"]",
"split",
"(",
"String",
"expr",
",",
"int",
"max",
")",
"{",
"return",
"toAsciiStringArray",
"(",
"Pattern",
".",
"compile",
"(",
"expr",
")",
".",
"split",
"(",
"this",
",",
"max",
")",
")",
";",
"}"
] | Splits this string using the supplied regular expression {@code expr}. The parameter {@code max} controls the
behavior how many times the pattern is applied to the string.
@param expr the regular expression used to divide the string.
@param max the number of entries in the resulting array.
@return an array of Strings created by separating the string along matches of the regular expression.
@throws NullPointerException if {@code expr} is {@code null}.
@throws PatternSyntaxException if the syntax of the supplied regular expression is not valid.
@see Pattern#split(CharSequence, int) | [
"Splits",
"this",
"string",
"using",
"the",
"supplied",
"regular",
"expression",
"{",
"@code",
"expr",
"}",
".",
"The",
"parameter",
"{",
"@code",
"max",
"}",
"controls",
"the",
"behavior",
"how",
"many",
"times",
"the",
"pattern",
"is",
"applied",
"to",
"... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L1077-L1079 | train | Splits the given string into an array of ASCII strings. | [
30522,
2270,
2004,
6895,
2923,
4892,
1031,
1033,
3975,
1006,
5164,
4654,
18098,
1010,
20014,
4098,
1007,
1063,
2709,
2000,
3022,
6895,
2923,
4892,
2906,
9447,
1006,
5418,
1012,
4012,
22090,
1006,
4654,
18098,
1007,
1012,
3975,
1006,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java | CheckpointCoordinator.receiveAcknowledgeMessage | public boolean receiveAcknowledgeMessage(AcknowledgeCheckpoint message) throws CheckpointException {
if (shutdown || message == null) {
return false;
}
if (!job.equals(message.getJob())) {
LOG.error("Received wrong AcknowledgeCheckpoint message for job {}: {}", job, message);
return false;
}
final long checkpointId = message.getCheckpointId();
synchronized (lock) {
// we need to check inside the lock for being shutdown as well, otherwise we
// get races and invalid error log messages
if (shutdown) {
return false;
}
final PendingCheckpoint checkpoint = pendingCheckpoints.get(checkpointId);
if (checkpoint != null && !checkpoint.isDiscarded()) {
switch (checkpoint.acknowledgeTask(message.getTaskExecutionId(), message.getSubtaskState(), message.getCheckpointMetrics())) {
case SUCCESS:
LOG.debug("Received acknowledge message for checkpoint {} from task {} of job {}.",
checkpointId, message.getTaskExecutionId(), message.getJob());
if (checkpoint.isFullyAcknowledged()) {
completePendingCheckpoint(checkpoint);
}
break;
case DUPLICATE:
LOG.debug("Received a duplicate acknowledge message for checkpoint {}, task {}, job {}.",
message.getCheckpointId(), message.getTaskExecutionId(), message.getJob());
break;
case UNKNOWN:
LOG.warn("Could not acknowledge the checkpoint {} for task {} of job {}, " +
"because the task's execution attempt id was unknown. Discarding " +
"the state handle to avoid lingering state.", message.getCheckpointId(),
message.getTaskExecutionId(), message.getJob());
discardSubtaskState(message.getJob(), message.getTaskExecutionId(), message.getCheckpointId(), message.getSubtaskState());
break;
case DISCARDED:
LOG.warn("Could not acknowledge the checkpoint {} for task {} of job {}, " +
"because the pending checkpoint had been discarded. Discarding the " +
"state handle tp avoid lingering state.",
message.getCheckpointId(), message.getTaskExecutionId(), message.getJob());
discardSubtaskState(message.getJob(), message.getTaskExecutionId(), message.getCheckpointId(), message.getSubtaskState());
}
return true;
}
else if (checkpoint != null) {
// this should not happen
throw new IllegalStateException(
"Received message for discarded but non-removed checkpoint " + checkpointId);
}
else {
boolean wasPendingCheckpoint;
// message is for an unknown checkpoint, or comes too late (checkpoint disposed)
if (recentPendingCheckpoints.contains(checkpointId)) {
wasPendingCheckpoint = true;
LOG.warn("Received late message for now expired checkpoint attempt {} from " +
"{} of job {}.", checkpointId, message.getTaskExecutionId(), message.getJob());
}
else {
LOG.debug("Received message for an unknown checkpoint {} from {} of job {}.",
checkpointId, message.getTaskExecutionId(), message.getJob());
wasPendingCheckpoint = false;
}
// try to discard the state so that we don't have lingering state lying around
discardSubtaskState(message.getJob(), message.getTaskExecutionId(), message.getCheckpointId(), message.getSubtaskState());
return wasPendingCheckpoint;
}
}
} | java | public boolean receiveAcknowledgeMessage(AcknowledgeCheckpoint message) throws CheckpointException {
if (shutdown || message == null) {
return false;
}
if (!job.equals(message.getJob())) {
LOG.error("Received wrong AcknowledgeCheckpoint message for job {}: {}", job, message);
return false;
}
final long checkpointId = message.getCheckpointId();
synchronized (lock) {
// we need to check inside the lock for being shutdown as well, otherwise we
// get races and invalid error log messages
if (shutdown) {
return false;
}
final PendingCheckpoint checkpoint = pendingCheckpoints.get(checkpointId);
if (checkpoint != null && !checkpoint.isDiscarded()) {
switch (checkpoint.acknowledgeTask(message.getTaskExecutionId(), message.getSubtaskState(), message.getCheckpointMetrics())) {
case SUCCESS:
LOG.debug("Received acknowledge message for checkpoint {} from task {} of job {}.",
checkpointId, message.getTaskExecutionId(), message.getJob());
if (checkpoint.isFullyAcknowledged()) {
completePendingCheckpoint(checkpoint);
}
break;
case DUPLICATE:
LOG.debug("Received a duplicate acknowledge message for checkpoint {}, task {}, job {}.",
message.getCheckpointId(), message.getTaskExecutionId(), message.getJob());
break;
case UNKNOWN:
LOG.warn("Could not acknowledge the checkpoint {} for task {} of job {}, " +
"because the task's execution attempt id was unknown. Discarding " +
"the state handle to avoid lingering state.", message.getCheckpointId(),
message.getTaskExecutionId(), message.getJob());
discardSubtaskState(message.getJob(), message.getTaskExecutionId(), message.getCheckpointId(), message.getSubtaskState());
break;
case DISCARDED:
LOG.warn("Could not acknowledge the checkpoint {} for task {} of job {}, " +
"because the pending checkpoint had been discarded. Discarding the " +
"state handle tp avoid lingering state.",
message.getCheckpointId(), message.getTaskExecutionId(), message.getJob());
discardSubtaskState(message.getJob(), message.getTaskExecutionId(), message.getCheckpointId(), message.getSubtaskState());
}
return true;
}
else if (checkpoint != null) {
// this should not happen
throw new IllegalStateException(
"Received message for discarded but non-removed checkpoint " + checkpointId);
}
else {
boolean wasPendingCheckpoint;
// message is for an unknown checkpoint, or comes too late (checkpoint disposed)
if (recentPendingCheckpoints.contains(checkpointId)) {
wasPendingCheckpoint = true;
LOG.warn("Received late message for now expired checkpoint attempt {} from " +
"{} of job {}.", checkpointId, message.getTaskExecutionId(), message.getJob());
}
else {
LOG.debug("Received message for an unknown checkpoint {} from {} of job {}.",
checkpointId, message.getTaskExecutionId(), message.getJob());
wasPendingCheckpoint = false;
}
// try to discard the state so that we don't have lingering state lying around
discardSubtaskState(message.getJob(), message.getTaskExecutionId(), message.getCheckpointId(), message.getSubtaskState());
return wasPendingCheckpoint;
}
}
} | [
"public",
"boolean",
"receiveAcknowledgeMessage",
"(",
"AcknowledgeCheckpoint",
"message",
")",
"throws",
"CheckpointException",
"{",
"if",
"(",
"shutdown",
"||",
"message",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"job",
".",
"equa... | Receives an AcknowledgeCheckpoint message and returns whether the
message was associated with a pending checkpoint.
@param message Checkpoint ack from the task manager
@return Flag indicating whether the ack'd checkpoint was associated
with a pending checkpoint.
@throws CheckpointException If the checkpoint cannot be added to the completed checkpoint store. | [
"Receives",
"an",
"AcknowledgeCheckpoint",
"message",
"and",
"returns",
"whether",
"the",
"message",
"was",
"associated",
"with",
"a",
"pending",
"checkpoint",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java#L780-L862 | train | Receives an AcknowledgeCheckpoint message from the checkpoint manager. | [
30522,
2270,
22017,
20898,
4374,
8684,
19779,
3709,
3351,
7834,
3736,
3351,
1006,
13399,
5403,
3600,
8400,
4471,
1007,
11618,
26520,
10288,
24422,
1063,
2065,
1006,
3844,
7698,
1064,
1064,
4471,
1027,
1027,
19701,
1007,
1063,
2709,
6270,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java | HttpPostMultipartRequestDecoder.readDelimiter | private static String readDelimiter(ByteBuf undecodedChunk, String delimiter) {
if (!undecodedChunk.hasArray()) {
return readDelimiterStandard(undecodedChunk, delimiter);
}
SeekAheadOptimize sao = new SeekAheadOptimize(undecodedChunk);
int readerIndex = undecodedChunk.readerIndex();
int delimiterPos = 0;
int len = delimiter.length();
try {
StringBuilder sb = new StringBuilder(64);
// check conformity with delimiter
while (sao.pos < sao.limit && delimiterPos < len) {
byte nextByte = sao.bytes[sao.pos++];
if (nextByte == delimiter.charAt(delimiterPos)) {
delimiterPos++;
sb.append((char) nextByte);
} else {
// delimiter not found so break here !
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
}
}
// Now check if either opening delimiter or closing delimiter
if (sao.pos < sao.limit) {
byte nextByte = sao.bytes[sao.pos++];
if (nextByte == HttpConstants.CR) {
// first check for opening delimiter
if (sao.pos < sao.limit) {
nextByte = sao.bytes[sao.pos++];
if (nextByte == HttpConstants.LF) {
sao.setReadPosition(0);
return sb.toString();
} else {
// error CR without LF
// delimiter not found so break here !
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
}
} else {
// error since CR must be followed by LF
// delimiter not found so break here !
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
}
} else if (nextByte == HttpConstants.LF) {
// same first check for opening delimiter where LF used with
// no CR
sao.setReadPosition(0);
return sb.toString();
} else if (nextByte == '-') {
sb.append('-');
// second check for closing delimiter
if (sao.pos < sao.limit) {
nextByte = sao.bytes[sao.pos++];
if (nextByte == '-') {
sb.append('-');
// now try to find if CRLF or LF there
if (sao.pos < sao.limit) {
nextByte = sao.bytes[sao.pos++];
if (nextByte == HttpConstants.CR) {
if (sao.pos < sao.limit) {
nextByte = sao.bytes[sao.pos++];
if (nextByte == HttpConstants.LF) {
sao.setReadPosition(0);
return sb.toString();
} else {
// error CR without LF
// delimiter not found so break here !
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
}
} else {
// error CR without LF
// delimiter not found so break here !
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
}
} else if (nextByte == HttpConstants.LF) {
sao.setReadPosition(0);
return sb.toString();
} else {
// No CRLF but ok however (Adobe Flash
// uploader)
// minus 1 since we read one char ahead but
// should not
sao.setReadPosition(1);
return sb.toString();
}
}
// FIXME what do we do here?
// either considering it is fine, either waiting for
// more data to come?
// lets try considering it is fine...
sao.setReadPosition(0);
return sb.toString();
}
// whatever now => error since incomplete
// only one '-' => not enough or whatever not enough
// element
}
}
}
} catch (IndexOutOfBoundsException e) {
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException(e);
}
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
} | java | private static String readDelimiter(ByteBuf undecodedChunk, String delimiter) {
if (!undecodedChunk.hasArray()) {
return readDelimiterStandard(undecodedChunk, delimiter);
}
SeekAheadOptimize sao = new SeekAheadOptimize(undecodedChunk);
int readerIndex = undecodedChunk.readerIndex();
int delimiterPos = 0;
int len = delimiter.length();
try {
StringBuilder sb = new StringBuilder(64);
// check conformity with delimiter
while (sao.pos < sao.limit && delimiterPos < len) {
byte nextByte = sao.bytes[sao.pos++];
if (nextByte == delimiter.charAt(delimiterPos)) {
delimiterPos++;
sb.append((char) nextByte);
} else {
// delimiter not found so break here !
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
}
}
// Now check if either opening delimiter or closing delimiter
if (sao.pos < sao.limit) {
byte nextByte = sao.bytes[sao.pos++];
if (nextByte == HttpConstants.CR) {
// first check for opening delimiter
if (sao.pos < sao.limit) {
nextByte = sao.bytes[sao.pos++];
if (nextByte == HttpConstants.LF) {
sao.setReadPosition(0);
return sb.toString();
} else {
// error CR without LF
// delimiter not found so break here !
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
}
} else {
// error since CR must be followed by LF
// delimiter not found so break here !
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
}
} else if (nextByte == HttpConstants.LF) {
// same first check for opening delimiter where LF used with
// no CR
sao.setReadPosition(0);
return sb.toString();
} else if (nextByte == '-') {
sb.append('-');
// second check for closing delimiter
if (sao.pos < sao.limit) {
nextByte = sao.bytes[sao.pos++];
if (nextByte == '-') {
sb.append('-');
// now try to find if CRLF or LF there
if (sao.pos < sao.limit) {
nextByte = sao.bytes[sao.pos++];
if (nextByte == HttpConstants.CR) {
if (sao.pos < sao.limit) {
nextByte = sao.bytes[sao.pos++];
if (nextByte == HttpConstants.LF) {
sao.setReadPosition(0);
return sb.toString();
} else {
// error CR without LF
// delimiter not found so break here !
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
}
} else {
// error CR without LF
// delimiter not found so break here !
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
}
} else if (nextByte == HttpConstants.LF) {
sao.setReadPosition(0);
return sb.toString();
} else {
// No CRLF but ok however (Adobe Flash
// uploader)
// minus 1 since we read one char ahead but
// should not
sao.setReadPosition(1);
return sb.toString();
}
}
// FIXME what do we do here?
// either considering it is fine, either waiting for
// more data to come?
// lets try considering it is fine...
sao.setReadPosition(0);
return sb.toString();
}
// whatever now => error since incomplete
// only one '-' => not enough or whatever not enough
// element
}
}
}
} catch (IndexOutOfBoundsException e) {
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException(e);
}
undecodedChunk.readerIndex(readerIndex);
throw new NotEnoughDataDecoderException();
} | [
"private",
"static",
"String",
"readDelimiter",
"(",
"ByteBuf",
"undecodedChunk",
",",
"String",
"delimiter",
")",
"{",
"if",
"(",
"!",
"undecodedChunk",
".",
"hasArray",
"(",
")",
")",
"{",
"return",
"readDelimiterStandard",
"(",
"undecodedChunk",
",",
"delimit... | Read one line up to --delimiter or --delimiter-- and if existing the CRLF
or LF. Note that CRLF or LF are mandatory for opening delimiter
(--delimiter) but not for closing delimiter (--delimiter--) since some
clients does not include CRLF in this case.
@param delimiter
of the form --string, such that '--' is already included
@return the String from one line as the delimiter searched (opening or
closing)
@throws NotEnoughDataDecoderException
Need more chunks and reset the readerInder to the previous
value | [
"Read",
"one",
"line",
"up",
"to",
"--",
"delimiter",
"or",
"--",
"delimiter",
"--",
"and",
"if",
"existing",
"the",
"CRLF",
"or",
"LF",
".",
"Note",
"that",
"CRLF",
"or",
"LF",
"are",
"mandatory",
"for",
"opening",
"delimiter",
"(",
"--",
"delimiter",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L1180-L1288 | train | readDelimiter Method. | [
30522,
2797,
10763,
5164,
3191,
9247,
27605,
3334,
1006,
24880,
8569,
2546,
6151,
8586,
10244,
16409,
17157,
2243,
1010,
5164,
3972,
27605,
3334,
1007,
1063,
2065,
1006,
999,
6151,
8586,
10244,
16409,
17157,
2243,
1012,
2038,
2906,
9447,
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 | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.prettyHexDump | public static String prettyHexDump(ByteBuf buffer, int offset, int length) {
return HexUtil.prettyHexDump(buffer, offset, length);
} | java | public static String prettyHexDump(ByteBuf buffer, int offset, int length) {
return HexUtil.prettyHexDump(buffer, offset, length);
} | [
"public",
"static",
"String",
"prettyHexDump",
"(",
"ByteBuf",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"return",
"HexUtil",
".",
"prettyHexDump",
"(",
"buffer",
",",
"offset",
",",
"length",
")",
";",
"}"
] | Returns a multi-line hexadecimal dump of the specified {@link ByteBuf} that is easy to read by humans,
starting at the given {@code offset} using the given {@code length}. | [
"Returns",
"a",
"multi",
"-",
"line",
"hexadecimal",
"dump",
"of",
"the",
"specified",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L918-L920 | train | Pretty hex dump of a byte buffer. | [
30522,
2270,
10763,
5164,
3492,
5369,
2595,
8566,
8737,
1006,
24880,
8569,
2546,
17698,
1010,
20014,
16396,
1010,
20014,
3091,
1007,
1063,
2709,
2002,
2595,
21823,
2140,
1012,
3492,
5369,
2595,
8566,
8737,
1006,
17698,
1010,
16396,
1010,
30... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/hive-thriftserver/src/main/java/org/apache/hive/service/cli/TypeDescriptor.java | TypeDescriptor.getDecimalDigits | public Integer getDecimalDigits() {
switch (this.type) {
case BOOLEAN_TYPE:
case TINYINT_TYPE:
case SMALLINT_TYPE:
case INT_TYPE:
case BIGINT_TYPE:
return 0;
case FLOAT_TYPE:
return 7;
case DOUBLE_TYPE:
return 15;
case DECIMAL_TYPE:
return typeQualifiers.getScale();
case TIMESTAMP_TYPE:
return 9;
default:
return null;
}
} | java | public Integer getDecimalDigits() {
switch (this.type) {
case BOOLEAN_TYPE:
case TINYINT_TYPE:
case SMALLINT_TYPE:
case INT_TYPE:
case BIGINT_TYPE:
return 0;
case FLOAT_TYPE:
return 7;
case DOUBLE_TYPE:
return 15;
case DECIMAL_TYPE:
return typeQualifiers.getScale();
case TIMESTAMP_TYPE:
return 9;
default:
return null;
}
} | [
"public",
"Integer",
"getDecimalDigits",
"(",
")",
"{",
"switch",
"(",
"this",
".",
"type",
")",
"{",
"case",
"BOOLEAN_TYPE",
":",
"case",
"TINYINT_TYPE",
":",
"case",
"SMALLINT_TYPE",
":",
"case",
"INT_TYPE",
":",
"case",
"BIGINT_TYPE",
":",
"return",
"0",
... | The number of fractional digits for this type.
Null is returned for data types where this is not applicable. | [
"The",
"number",
"of",
"fractional",
"digits",
"for",
"this",
"type",
".",
"Null",
"is",
"returned",
"for",
"data",
"types",
"where",
"this",
"is",
"not",
"applicable",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/TypeDescriptor.java#L139-L158 | train | Get the decimal digits of this type. | [
30522,
2270,
16109,
2131,
3207,
6895,
9067,
4305,
23806,
2015,
1006,
1007,
1063,
6942,
1006,
2023,
1012,
2828,
1007,
1063,
2553,
22017,
20898,
1035,
2828,
1024,
2553,
4714,
18447,
1035,
2828,
1024,
2553,
2235,
18447,
1035,
2828,
1024,
2553,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HpackDynamicTable.java | HpackDynamicTable.getEntry | public HpackHeaderField getEntry(int index) {
if (index <= 0 || index > length()) {
throw new IndexOutOfBoundsException();
}
int i = head - index;
if (i < 0) {
return hpackHeaderFields[i + hpackHeaderFields.length];
} else {
return hpackHeaderFields[i];
}
} | java | public HpackHeaderField getEntry(int index) {
if (index <= 0 || index > length()) {
throw new IndexOutOfBoundsException();
}
int i = head - index;
if (i < 0) {
return hpackHeaderFields[i + hpackHeaderFields.length];
} else {
return hpackHeaderFields[i];
}
} | [
"public",
"HpackHeaderField",
"getEntry",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<=",
"0",
"||",
"index",
">",
"length",
"(",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
"int",
"i",
"=",
"head",
"-",
"... | Return the header field at the given index. The first and newest entry is always at index 1,
and the oldest entry is at the index length(). | [
"Return",
"the",
"header",
"field",
"at",
"the",
"given",
"index",
".",
"The",
"first",
"and",
"newest",
"entry",
"is",
"always",
"at",
"index",
"1",
"and",
"the",
"oldest",
"entry",
"is",
"at",
"the",
"index",
"length",
"()",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java#L84-L94 | train | Gets the entry at the specified index in the HpackHeader. | [
30522,
2270,
6522,
8684,
4974,
2121,
3790,
2131,
4765,
2854,
1006,
20014,
5950,
1007,
1063,
2065,
1006,
5950,
1026,
1027,
1014,
1064,
1064,
5950,
1028,
3091,
1006,
1007,
1007,
1063,
5466,
2047,
5950,
5833,
11253,
15494,
3366,
2595,
24422,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/SocketClientSink.java | SocketClientSink.invoke | @Override
public void invoke(IN value) throws Exception {
byte[] msg = schema.serialize(value);
try {
outputStream.write(msg);
if (autoFlush) {
outputStream.flush();
}
}
catch (IOException e) {
// if no re-tries are enable, fail immediately
if (maxNumRetries == 0) {
throw new IOException("Failed to send message '" + value + "' to socket server at "
+ hostName + ":" + port + ". Connection re-tries are not enabled.", e);
}
LOG.error("Failed to send message '" + value + "' to socket server at " + hostName + ":" + port +
". Trying to reconnect..." , e);
// do the retries in locked scope, to guard against concurrent close() calls
// note that the first re-try comes immediately, without a wait!
synchronized (lock) {
IOException lastException = null;
retries = 0;
while (isRunning && (maxNumRetries < 0 || retries < maxNumRetries)) {
// first, clean up the old resources
try {
if (outputStream != null) {
outputStream.close();
}
}
catch (IOException ee) {
LOG.error("Could not close output stream from failed write attempt", ee);
}
try {
if (client != null) {
client.close();
}
}
catch (IOException ee) {
LOG.error("Could not close socket from failed write attempt", ee);
}
// try again
retries++;
try {
// initialize a new connection
createConnection();
// re-try the write
outputStream.write(msg);
// success!
return;
}
catch (IOException ee) {
lastException = ee;
LOG.error("Re-connect to socket server and send message failed. Retry time(s): " + retries, ee);
}
// wait before re-attempting to connect
lock.wait(CONNECTION_RETRY_DELAY);
}
// throw an exception if the task is still running, otherwise simply leave the method
if (isRunning) {
throw new IOException("Failed to send message '" + value + "' to socket server at "
+ hostName + ":" + port + ". Failed after " + retries + " retries.", lastException);
}
}
}
} | java | @Override
public void invoke(IN value) throws Exception {
byte[] msg = schema.serialize(value);
try {
outputStream.write(msg);
if (autoFlush) {
outputStream.flush();
}
}
catch (IOException e) {
// if no re-tries are enable, fail immediately
if (maxNumRetries == 0) {
throw new IOException("Failed to send message '" + value + "' to socket server at "
+ hostName + ":" + port + ". Connection re-tries are not enabled.", e);
}
LOG.error("Failed to send message '" + value + "' to socket server at " + hostName + ":" + port +
". Trying to reconnect..." , e);
// do the retries in locked scope, to guard against concurrent close() calls
// note that the first re-try comes immediately, without a wait!
synchronized (lock) {
IOException lastException = null;
retries = 0;
while (isRunning && (maxNumRetries < 0 || retries < maxNumRetries)) {
// first, clean up the old resources
try {
if (outputStream != null) {
outputStream.close();
}
}
catch (IOException ee) {
LOG.error("Could not close output stream from failed write attempt", ee);
}
try {
if (client != null) {
client.close();
}
}
catch (IOException ee) {
LOG.error("Could not close socket from failed write attempt", ee);
}
// try again
retries++;
try {
// initialize a new connection
createConnection();
// re-try the write
outputStream.write(msg);
// success!
return;
}
catch (IOException ee) {
lastException = ee;
LOG.error("Re-connect to socket server and send message failed. Retry time(s): " + retries, ee);
}
// wait before re-attempting to connect
lock.wait(CONNECTION_RETRY_DELAY);
}
// throw an exception if the task is still running, otherwise simply leave the method
if (isRunning) {
throw new IOException("Failed to send message '" + value + "' to socket server at "
+ hostName + ":" + port + ". Failed after " + retries + " retries.", lastException);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"invoke",
"(",
"IN",
"value",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"msg",
"=",
"schema",
".",
"serialize",
"(",
"value",
")",
";",
"try",
"{",
"outputStream",
".",
"write",
"(",
"msg",
")",
";",
"if",
... | Called when new data arrives to the sink, and forwards it to Socket.
@param value The value to write to the socket. | [
"Called",
"when",
"new",
"data",
"arrives",
"to",
"the",
"sink",
"and",
"forwards",
"it",
"to",
"Socket",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/SocketClientSink.java#L143-L219 | train | This method is called by the client to send a message to the socket server. | [
30522,
1030,
2058,
15637,
2270,
11675,
1999,
6767,
3489,
1006,
1999,
3643,
1007,
11618,
6453,
1063,
24880,
1031,
1033,
5796,
2290,
1027,
8040,
28433,
1012,
7642,
4697,
1006,
3643,
1007,
1025,
3046,
1063,
27852,
25379,
1012,
4339,
1006,
5796... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/codec/BCD.java | BCD.bcdToStr | public static String bcdToStr(byte[] bytes) {
char temp[] = new char[bytes.length * 2], val;
for (int i = 0; i < bytes.length; i++) {
val = (char) (((bytes[i] & 0xf0) >> 4) & 0x0f);
temp[i * 2] = (char) (val > 9 ? val + 'A' - 10 : val + '0');
val = (char) (bytes[i] & 0x0f);
temp[i * 2 + 1] = (char) (val > 9 ? val + 'A' - 10 : val + '0');
}
return new String(temp);
} | java | public static String bcdToStr(byte[] bytes) {
char temp[] = new char[bytes.length * 2], val;
for (int i = 0; i < bytes.length; i++) {
val = (char) (((bytes[i] & 0xf0) >> 4) & 0x0f);
temp[i * 2] = (char) (val > 9 ? val + 'A' - 10 : val + '0');
val = (char) (bytes[i] & 0x0f);
temp[i * 2 + 1] = (char) (val > 9 ? val + 'A' - 10 : val + '0');
}
return new String(temp);
} | [
"public",
"static",
"String",
"bcdToStr",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"char",
"temp",
"[",
"]",
"=",
"new",
"char",
"[",
"bytes",
".",
"length",
"*",
"2",
"]",
",",
"val",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"b... | BCD转ASCII字符串
@param bytes BCD byte数组
@return ASCII字符串 | [
"BCD转ASCII字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/BCD.java#L84-L95 | train | Converts a byte array to a UTF - 8 string. | [
30522,
2270,
10763,
5164,
4647,
11927,
14122,
2099,
1006,
24880,
1031,
1033,
27507,
1007,
1063,
25869,
8915,
8737,
1031,
1033,
1027,
2047,
25869,
1031,
27507,
1012,
3091,
1008,
1016,
1033,
1010,
11748,
1025,
2005,
1006,
20014,
1045,
1027,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java | SqlExecutor.execute | public static boolean execute(PreparedStatement ps, Object... params) throws SQLException {
StatementUtil.fillParams(ps, params);
return ps.execute();
} | java | public static boolean execute(PreparedStatement ps, Object... params) throws SQLException {
StatementUtil.fillParams(ps, params);
return ps.execute();
} | [
"public",
"static",
"boolean",
"execute",
"(",
"PreparedStatement",
"ps",
",",
"Object",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"StatementUtil",
".",
"fillParams",
"(",
"ps",
",",
"params",
")",
";",
"return",
"ps",
".",
"execute",
"(",
")",
... | 可用于执行任何SQL语句,返回一个boolean值,表明执行该SQL语句是否返回了ResultSet。<br>
如果执行后第一个结果是ResultSet,则返回true,否则返回false。<br>
此方法不会关闭PreparedStatement
@param ps PreparedStatement对象
@param params 参数
@return 如果执行后第一个结果是ResultSet,则返回true,否则返回false。
@throws SQLException SQL执行异常 | [
"可用于执行任何SQL语句,返回一个boolean值,表明执行该SQL语句是否返回了ResultSet。<br",
">",
"如果执行后第一个结果是ResultSet,则返回true,否则返回false。<br",
">",
"此方法不会关闭PreparedStatement"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L296-L299 | train | Execute a prepared statement with the specified parameters. | [
30522,
2270,
10763,
22017,
20898,
15389,
1006,
4810,
9153,
18532,
4765,
8827,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
29296,
10288,
24422,
1063,
4861,
21823,
2140,
1012,
6039,
28689,
5244,
1006,
8827,
1010,
11498,
5244,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/ZooKeeperCompletedCheckpointStore.java | ZooKeeperCompletedCheckpointStore.addCheckpoint | @Override
public void addCheckpoint(final CompletedCheckpoint checkpoint) throws Exception {
checkNotNull(checkpoint, "Checkpoint");
final String path = checkpointIdToPath(checkpoint.getCheckpointID());
// Now add the new one. If it fails, we don't want to loose existing data.
checkpointsInZooKeeper.addAndLock(path, checkpoint);
completedCheckpoints.addLast(checkpoint);
// Everything worked, let's remove a previous checkpoint if necessary.
while (completedCheckpoints.size() > maxNumberOfCheckpointsToRetain) {
final CompletedCheckpoint completedCheckpoint = completedCheckpoints.removeFirst();
tryRemoveCompletedCheckpoint(completedCheckpoint, CompletedCheckpoint::discardOnSubsume);
}
LOG.debug("Added {} to {}.", checkpoint, path);
} | java | @Override
public void addCheckpoint(final CompletedCheckpoint checkpoint) throws Exception {
checkNotNull(checkpoint, "Checkpoint");
final String path = checkpointIdToPath(checkpoint.getCheckpointID());
// Now add the new one. If it fails, we don't want to loose existing data.
checkpointsInZooKeeper.addAndLock(path, checkpoint);
completedCheckpoints.addLast(checkpoint);
// Everything worked, let's remove a previous checkpoint if necessary.
while (completedCheckpoints.size() > maxNumberOfCheckpointsToRetain) {
final CompletedCheckpoint completedCheckpoint = completedCheckpoints.removeFirst();
tryRemoveCompletedCheckpoint(completedCheckpoint, CompletedCheckpoint::discardOnSubsume);
}
LOG.debug("Added {} to {}.", checkpoint, path);
} | [
"@",
"Override",
"public",
"void",
"addCheckpoint",
"(",
"final",
"CompletedCheckpoint",
"checkpoint",
")",
"throws",
"Exception",
"{",
"checkNotNull",
"(",
"checkpoint",
",",
"\"Checkpoint\"",
")",
";",
"final",
"String",
"path",
"=",
"checkpointIdToPath",
"(",
"... | Synchronously writes the new checkpoints to ZooKeeper and asynchronously removes older ones.
@param checkpoint Completed checkpoint to add. | [
"Synchronously",
"writes",
"the",
"new",
"checkpoints",
"to",
"ZooKeeper",
"and",
"asynchronously",
"removes",
"older",
"ones",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/ZooKeeperCompletedCheckpointStore.java#L209-L227 | train | Add a checkpoint to the cluster. | [
30522,
1030,
2058,
15637,
2270,
11675,
5587,
5403,
3600,
8400,
1006,
2345,
2949,
5403,
3600,
8400,
26520,
1007,
11618,
6453,
1063,
4638,
17048,
11231,
3363,
1006,
26520,
1010,
1000,
26520,
1000,
1007,
1025,
2345,
5164,
4130,
1027,
26520,
35... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/ChannelDuplexHandler.java | ChannelDuplexHandler.disconnect | @Skip
@Override
public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise)
throws Exception {
ctx.disconnect(promise);
} | java | @Skip
@Override
public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise)
throws Exception {
ctx.disconnect(promise);
} | [
"@",
"Skip",
"@",
"Override",
"public",
"void",
"disconnect",
"(",
"ChannelHandlerContext",
"ctx",
",",
"ChannelPromise",
"promise",
")",
"throws",
"Exception",
"{",
"ctx",
".",
"disconnect",
"(",
"promise",
")",
";",
"}"
] | Calls {@link ChannelHandlerContext#disconnect(ChannelPromise)} to forward
to the next {@link ChannelOutboundHandler} in the {@link ChannelPipeline}.
Sub-classes may override this method to change behavior. | [
"Calls",
"{",
"@link",
"ChannelHandlerContext#disconnect",
"(",
"ChannelPromise",
")",
"}",
"to",
"forward",
"to",
"the",
"next",
"{",
"@link",
"ChannelOutboundHandler",
"}",
"in",
"the",
"{",
"@link",
"ChannelPipeline",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/ChannelDuplexHandler.java#L63-L68 | train | Disconnect from a node. | [
30522,
1030,
13558,
1030,
2058,
15637,
2270,
11675,
12532,
10087,
6593,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
3149,
21572,
28732,
4872,
1007,
11618,
6453,
1063,
14931,
2595,
1012,
12532,
10087,
6593,
1006,
4872,
1007,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java | ReferenceCountedOpenSslContext.sslCtxPointer | @Deprecated
public final long sslCtxPointer() {
Lock readerLock = ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.getSslCtx(ctx);
} finally {
readerLock.unlock();
}
} | java | @Deprecated
public final long sslCtxPointer() {
Lock readerLock = ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.getSslCtx(ctx);
} finally {
readerLock.unlock();
}
} | [
"@",
"Deprecated",
"public",
"final",
"long",
"sslCtxPointer",
"(",
")",
"{",
"Lock",
"readerLock",
"=",
"ctxLock",
".",
"readLock",
"(",
")",
";",
"readerLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"SSLContext",
".",
"getSslCtx",
"(",
"ctx"... | Returns the pointer to the {@code SSL_CTX} object for this {@link ReferenceCountedOpenSslContext}.
Be aware that it is freed as soon as the {@link #release()} method is called.
At this point {@code 0} will be returned.
@deprecated this method is considered unsafe as the returned pointer may be released later. Dont use it! | [
"Returns",
"the",
"pointer",
"to",
"the",
"{",
"@code",
"SSL_CTX",
"}",
"object",
"for",
"this",
"{",
"@link",
"ReferenceCountedOpenSslContext",
"}",
".",
"Be",
"aware",
"that",
"it",
"is",
"freed",
"as",
"soon",
"as",
"the",
"{",
"@link",
"#release",
"()"... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java#L513-L522 | train | Get the pointer of the SSL context. | [
30522,
1030,
2139,
28139,
12921,
2270,
2345,
2146,
7020,
15472,
2102,
2595,
8400,
2121,
30524,
1063,
8068,
7878,
1012,
19829,
1006,
1007,
1025,
1065,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/cluster/Cluster.java | Cluster.clear | void clear()
{
documents_.clear();
composite_.clear();
if (centroid_ != null)
centroid_.clear();
if (sectioned_clusters_ != null)
sectioned_clusters_.clear();
sectioned_gain_ = 0.0;
} | java | void clear()
{
documents_.clear();
composite_.clear();
if (centroid_ != null)
centroid_.clear();
if (sectioned_clusters_ != null)
sectioned_clusters_.clear();
sectioned_gain_ = 0.0;
} | [
"void",
"clear",
"(",
")",
"{",
"documents_",
".",
"clear",
"(",
")",
";",
"composite_",
".",
"clear",
"(",
")",
";",
"if",
"(",
"centroid_",
"!=",
"null",
")",
"centroid_",
".",
"clear",
"(",
")",
";",
"if",
"(",
"sectioned_clusters_",
"!=",
"null",... | Clear status. | [
"Clear",
"status",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/Cluster.java#L54-L63 | train | Clear all the records in the SECTYPE. | [
30522,
11675,
3154,
1006,
1007,
1063,
5491,
1035,
1012,
3154,
1006,
1007,
1025,
12490,
1035,
1012,
3154,
1006,
1007,
1025,
2065,
1006,
18120,
3593,
1035,
999,
1027,
19701,
1007,
18120,
3593,
1035,
1012,
3154,
1006,
1007,
1025,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java | BeanDefinitionLoader.setEnvironment | public void setEnvironment(ConfigurableEnvironment environment) {
this.annotatedReader.setEnvironment(environment);
this.xmlReader.setEnvironment(environment);
this.scanner.setEnvironment(environment);
} | java | public void setEnvironment(ConfigurableEnvironment environment) {
this.annotatedReader.setEnvironment(environment);
this.xmlReader.setEnvironment(environment);
this.scanner.setEnvironment(environment);
} | [
"public",
"void",
"setEnvironment",
"(",
"ConfigurableEnvironment",
"environment",
")",
"{",
"this",
".",
"annotatedReader",
".",
"setEnvironment",
"(",
"environment",
")",
";",
"this",
".",
"xmlReader",
".",
"setEnvironment",
"(",
"environment",
")",
";",
"this",... | Set the environment to be used by the underlying readers and scanner.
@param environment the environment | [
"Set",
"the",
"environment",
"to",
"be",
"used",
"by",
"the",
"underlying",
"readers",
"and",
"scanner",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java#L115-L119 | train | Sets the environment. | [
30522,
2270,
11675,
2275,
2368,
21663,
2239,
3672,
1006,
9530,
8873,
27390,
3085,
2368,
21663,
2239,
3672,
4044,
1007,
1063,
2023,
1012,
5754,
17287,
30524,
2275,
2368,
21663,
2239,
3672,
1006,
4044,
1007,
1025,
2023,
1012,
26221,
1012,
227... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AsyncDataStream.java | AsyncDataStream.unorderedWait | public static <IN, OUT> SingleOutputStreamOperator<OUT> unorderedWait(
DataStream<IN> in,
AsyncFunction<IN, OUT> func,
long timeout,
TimeUnit timeUnit,
int capacity) {
return addOperator(in, func, timeUnit.toMillis(timeout), capacity, OutputMode.UNORDERED);
} | java | public static <IN, OUT> SingleOutputStreamOperator<OUT> unorderedWait(
DataStream<IN> in,
AsyncFunction<IN, OUT> func,
long timeout,
TimeUnit timeUnit,
int capacity) {
return addOperator(in, func, timeUnit.toMillis(timeout), capacity, OutputMode.UNORDERED);
} | [
"public",
"static",
"<",
"IN",
",",
"OUT",
">",
"SingleOutputStreamOperator",
"<",
"OUT",
">",
"unorderedWait",
"(",
"DataStream",
"<",
"IN",
">",
"in",
",",
"AsyncFunction",
"<",
"IN",
",",
"OUT",
">",
"func",
",",
"long",
"timeout",
",",
"TimeUnit",
"t... | Add an AsyncWaitOperator. The order of output stream records may be reordered.
@param in Input {@link DataStream}
@param func {@link AsyncFunction}
@param timeout for the asynchronous operation to complete
@param timeUnit of the given timeout
@param capacity The max number of async i/o operation that can be triggered
@param <IN> Type of input record
@param <OUT> Type of output record
@return A new {@link SingleOutputStreamOperator}. | [
"Add",
"an",
"AsyncWaitOperator",
".",
"The",
"order",
"of",
"output",
"stream",
"records",
"may",
"be",
"reordered",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AsyncDataStream.java#L102-L109 | train | Create an unordered wait operator. | [
30522,
2270,
10763,
1026,
1999,
1010,
2041,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
2041,
1028,
27776,
26764,
2098,
21547,
2102,
1006,
2951,
21422,
1026,
1999,
1028,
1999,
1010,
2004,
6038,
2278,
11263,
27989,
1026,
1999,
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... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/ds/GlobalDSFactory.java | GlobalDSFactory.get | public static DSFactory get() {
if (null == factory) {
synchronized (lock) {
if (null == factory) {
factory = DSFactory.create(null);
}
}
}
return factory;
} | java | public static DSFactory get() {
if (null == factory) {
synchronized (lock) {
if (null == factory) {
factory = DSFactory.create(null);
}
}
}
return factory;
} | [
"public",
"static",
"DSFactory",
"get",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"factory",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"null",
"==",
"factory",
")",
"{",
"factory",
"=",
"DSFactory",
".",
"create",
"(",
"null",
")",
... | 获取默认的数据源工厂,读取默认数据库配置文件<br>
此处使用懒加载模式,在第一次调用此方法时才创建默认数据源工厂<br>
如果想自定义全局的数据源工厂,请在第一次调用此方法前调用{@link #set(DSFactory)} 方法自行定义
@return 当前使用的数据源工厂 | [
"获取默认的数据源工厂,读取默认数据库配置文件<br",
">",
"此处使用懒加载模式,在第一次调用此方法时才创建默认数据源工厂<br",
">",
"如果想自定义全局的数据源工厂,请在第一次调用此方法前调用",
"{",
"@link",
"#set",
"(",
"DSFactory",
")",
"}",
"方法自行定义"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/ds/GlobalDSFactory.java#L42-L51 | train | Gets the reference to the DSFactory. | [
30522,
2270,
10763,
16233,
21450,
2131,
1006,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
4713,
1007,
1063,
25549,
1006,
5843,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
4713,
1007,
1063,
4713,
1027,
16233,
21450,
1012,
3443,
1006,
19701,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java | Router.aggregateRoutes | private static <T> void aggregateRoutes(
String method, Map<PathPattern, T> routes,
List<String> accMethods, List<String> accPatterns, List<String> accTargets) {
for (Map.Entry<PathPattern, T> entry : routes.entrySet()) {
accMethods.add(method);
accPatterns.add("/" + entry.getKey().pattern());
accTargets.add(targetToString(entry.getValue()));
}
} | java | private static <T> void aggregateRoutes(
String method, Map<PathPattern, T> routes,
List<String> accMethods, List<String> accPatterns, List<String> accTargets) {
for (Map.Entry<PathPattern, T> entry : routes.entrySet()) {
accMethods.add(method);
accPatterns.add("/" + entry.getKey().pattern());
accTargets.add(targetToString(entry.getValue()));
}
} | [
"private",
"static",
"<",
"T",
">",
"void",
"aggregateRoutes",
"(",
"String",
"method",
",",
"Map",
"<",
"PathPattern",
",",
"T",
">",
"routes",
",",
"List",
"<",
"String",
">",
"accMethods",
",",
"List",
"<",
"String",
">",
"accPatterns",
",",
"List",
... | Helper for toString. | [
"Helper",
"for",
"toString",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java#L106-L114 | train | Aggregate the routes. | [
30522,
2797,
10763,
1026,
1056,
1028,
11675,
9572,
22494,
4570,
1006,
5164,
4118,
1010,
4949,
1026,
4130,
4502,
12079,
2078,
1010,
1056,
1028,
5847,
1010,
2862,
1026,
5164,
1028,
16222,
11368,
6806,
5104,
1010,
2862,
1026,
5164,
1028,
16222... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java | QrCodeUtil.generate | public static BufferedImage generate(String content, BarcodeFormat format, int width, int height) {
return generate(content, format, new QrConfig(width, height));
} | java | public static BufferedImage generate(String content, BarcodeFormat format, int width, int height) {
return generate(content, format, new QrConfig(width, height));
} | [
"public",
"static",
"BufferedImage",
"generate",
"(",
"String",
"content",
",",
"BarcodeFormat",
"format",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"return",
"generate",
"(",
"content",
",",
"format",
",",
"new",
"QrConfig",
"(",
"width",
",",
... | 生成二维码或条形码图片
@param content 文本内容
@param format 格式,可选二维码或者条形码
@param width 宽度
@param height 高度
@return 二维码图片(黑白) | [
"生成二维码或条形码图片"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L146-L148 | train | Generates a image of the specified size using the specified format. | [
30522,
2270,
10763,
17698,
2098,
9581,
3351,
9699,
1006,
5164,
4180,
1010,
3347,
16044,
14192,
4017,
4289,
1010,
20014,
9381,
1010,
20014,
4578,
1007,
1063,
2709,
9699,
1006,
4180,
1010,
4289,
1010,
2047,
1053,
29566,
2078,
8873,
2290,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/State.java | State.addEmit | public void addEmit(String keyword)
{
if (this.emits == null)
{
this.emits = new TreeSet<String>();
}
this.emits.add(keyword);
} | java | public void addEmit(String keyword)
{
if (this.emits == null)
{
this.emits = new TreeSet<String>();
}
this.emits.add(keyword);
} | [
"public",
"void",
"addEmit",
"(",
"String",
"keyword",
")",
"{",
"if",
"(",
"this",
".",
"emits",
"==",
"null",
")",
"{",
"this",
".",
"emits",
"=",
"new",
"TreeSet",
"<",
"String",
">",
"(",
")",
";",
"}",
"this",
".",
"emits",
".",
"add",
"(",
... | 添加一个匹配到的模式串(这个状态对应着这个模式串)
@param keyword | [
"添加一个匹配到的模式串(这个状态对应着这个模式串",
")"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/State.java#L74-L81 | train | Add an entity to the set of entity emission keywords. | [
30522,
2270,
11675,
5587,
23238,
2102,
1006,
5164,
3145,
18351,
1007,
1063,
2065,
1006,
2023,
1012,
12495,
3215,
1027,
1027,
19701,
1007,
1063,
2023,
1012,
12495,
3215,
1027,
2047,
3628,
3388,
1026,
5164,
1028,
1006,
1007,
1025,
1065,
2023,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.compare | public static int compare(ByteBuf bufferA, ByteBuf bufferB) {
final int aLen = bufferA.readableBytes();
final int bLen = bufferB.readableBytes();
final int minLength = Math.min(aLen, bLen);
final int uintCount = minLength >>> 2;
final int byteCount = minLength & 3;
int aIndex = bufferA.readerIndex();
int bIndex = bufferB.readerIndex();
if (uintCount > 0) {
boolean bufferAIsBigEndian = bufferA.order() == ByteOrder.BIG_ENDIAN;
final long res;
int uintCountIncrement = uintCount << 2;
if (bufferA.order() == bufferB.order()) {
res = bufferAIsBigEndian ? compareUintBigEndian(bufferA, bufferB, aIndex, bIndex, uintCountIncrement) :
compareUintLittleEndian(bufferA, bufferB, aIndex, bIndex, uintCountIncrement);
} else {
res = bufferAIsBigEndian ? compareUintBigEndianA(bufferA, bufferB, aIndex, bIndex, uintCountIncrement) :
compareUintBigEndianB(bufferA, bufferB, aIndex, bIndex, uintCountIncrement);
}
if (res != 0) {
// Ensure we not overflow when cast
return (int) Math.min(Integer.MAX_VALUE, Math.max(Integer.MIN_VALUE, res));
}
aIndex += uintCountIncrement;
bIndex += uintCountIncrement;
}
for (int aEnd = aIndex + byteCount; aIndex < aEnd; ++aIndex, ++bIndex) {
int comp = bufferA.getUnsignedByte(aIndex) - bufferB.getUnsignedByte(bIndex);
if (comp != 0) {
return comp;
}
}
return aLen - bLen;
} | java | public static int compare(ByteBuf bufferA, ByteBuf bufferB) {
final int aLen = bufferA.readableBytes();
final int bLen = bufferB.readableBytes();
final int minLength = Math.min(aLen, bLen);
final int uintCount = minLength >>> 2;
final int byteCount = minLength & 3;
int aIndex = bufferA.readerIndex();
int bIndex = bufferB.readerIndex();
if (uintCount > 0) {
boolean bufferAIsBigEndian = bufferA.order() == ByteOrder.BIG_ENDIAN;
final long res;
int uintCountIncrement = uintCount << 2;
if (bufferA.order() == bufferB.order()) {
res = bufferAIsBigEndian ? compareUintBigEndian(bufferA, bufferB, aIndex, bIndex, uintCountIncrement) :
compareUintLittleEndian(bufferA, bufferB, aIndex, bIndex, uintCountIncrement);
} else {
res = bufferAIsBigEndian ? compareUintBigEndianA(bufferA, bufferB, aIndex, bIndex, uintCountIncrement) :
compareUintBigEndianB(bufferA, bufferB, aIndex, bIndex, uintCountIncrement);
}
if (res != 0) {
// Ensure we not overflow when cast
return (int) Math.min(Integer.MAX_VALUE, Math.max(Integer.MIN_VALUE, res));
}
aIndex += uintCountIncrement;
bIndex += uintCountIncrement;
}
for (int aEnd = aIndex + byteCount; aIndex < aEnd; ++aIndex, ++bIndex) {
int comp = bufferA.getUnsignedByte(aIndex) - bufferB.getUnsignedByte(bIndex);
if (comp != 0) {
return comp;
}
}
return aLen - bLen;
} | [
"public",
"static",
"int",
"compare",
"(",
"ByteBuf",
"bufferA",
",",
"ByteBuf",
"bufferB",
")",
"{",
"final",
"int",
"aLen",
"=",
"bufferA",
".",
"readableBytes",
"(",
")",
";",
"final",
"int",
"bLen",
"=",
"bufferB",
".",
"readableBytes",
"(",
")",
";"... | Compares the two specified buffers as described in {@link ByteBuf#compareTo(ByteBuf)}.
This method is useful when implementing a new buffer type. | [
"Compares",
"the",
"two",
"specified",
"buffers",
"as",
"described",
"in",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L288-L325 | train | Compare two byte buffers. | [
30522,
2270,
10763,
20014,
12826,
1006,
24880,
8569,
2546,
17698,
2050,
1010,
24880,
8569,
2546,
17698,
2497,
1007,
1063,
2345,
20014,
15669,
2078,
1027,
17698,
2050,
1012,
3191,
3085,
3762,
4570,
1006,
1007,
1025,
2345,
20014,
1038,
7770,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.zip | public static File zip(File zipFile, String path, InputStream in) throws UtilException {
return zip(zipFile, path, in, DEFAULT_CHARSET);
} | java | public static File zip(File zipFile, String path, InputStream in) throws UtilException {
return zip(zipFile, path, in, DEFAULT_CHARSET);
} | [
"public",
"static",
"File",
"zip",
"(",
"File",
"zipFile",
",",
"String",
"path",
",",
"InputStream",
"in",
")",
"throws",
"UtilException",
"{",
"return",
"zip",
"(",
"zipFile",
",",
"path",
",",
"in",
",",
"DEFAULT_CHARSET",
")",
";",
"}"
] | 对流中的数据加入到压缩文件<br>
使用默认编码UTF-8
@param zipFile 生成的Zip文件,包括文件名。注意:zipPath不能是srcPath路径下的子文件夹
@param path 流数据在压缩文件中的路径或文件名
@param in 要压缩的源
@return 压缩文件
@throws UtilException IO异常
@since 3.0.6 | [
"对流中的数据加入到压缩文件<br",
">",
"使用默认编码UTF",
"-",
"8"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L221-L223 | train | Creates a zip file from the given input stream. | [
30522,
2270,
10763,
5371,
14101,
1006,
5371,
14101,
8873,
2571,
1010,
5164,
4130,
1010,
20407,
25379,
1999,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
2709,
14101,
1006,
14101,
8873,
2571,
1010,
4130,
1010,
1999,
1010,
12398,
1035,
25869,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Graph.java | Graph.connect | public void connect(int from, int to, double weight)
{
edgesTo[to].add(new EdgeFrom(from, weight, vertexes[from].word + '@' + vertexes[to].word));
} | java | public void connect(int from, int to, double weight)
{
edgesTo[to].add(new EdgeFrom(from, weight, vertexes[from].word + '@' + vertexes[to].word));
} | [
"public",
"void",
"connect",
"(",
"int",
"from",
",",
"int",
"to",
",",
"double",
"weight",
")",
"{",
"edgesTo",
"[",
"to",
"]",
".",
"add",
"(",
"new",
"EdgeFrom",
"(",
"from",
",",
"weight",
",",
"vertexes",
"[",
"from",
"]",
".",
"word",
"+",
... | 连接两个节点
@param from 起点
@param to 终点
@param weight 花费 | [
"连接两个节点"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/Graph.java#L54-L57 | train | Connect two words. | [
30522,
2270,
11675,
7532,
1006,
20014,
2013,
1010,
20014,
2000,
1010,
3313,
3635,
1007,
1063,
7926,
3406,
1031,
2000,
1033,
1012,
5587,
1006,
2047,
3341,
19699,
5358,
1006,
2013,
1010,
3635,
1010,
19449,
2229,
1031,
2013,
1033,
1012,
2773,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AbstractBinaryMemcacheEncoder.java | AbstractBinaryMemcacheEncoder.encodeKey | private static void encodeKey(ByteBuf buf, ByteBuf key) {
if (key == null || !key.isReadable()) {
return;
}
buf.writeBytes(key);
} | java | private static void encodeKey(ByteBuf buf, ByteBuf key) {
if (key == null || !key.isReadable()) {
return;
}
buf.writeBytes(key);
} | [
"private",
"static",
"void",
"encodeKey",
"(",
"ByteBuf",
"buf",
",",
"ByteBuf",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
"||",
"!",
"key",
".",
"isReadable",
"(",
")",
")",
"{",
"return",
";",
"}",
"buf",
".",
"writeBytes",
"(",
"key",
")"... | Encode the key.
@param buf the {@link ByteBuf} to write into.
@param key the key to encode. | [
"Encode",
"the",
"key",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-memcache/src/main/java/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheEncoder.java#L68-L74 | train | Encode a single key into the buffer. | [
30522,
2797,
10763,
11675,
4372,
16044,
14839,
1006,
24880,
8569,
2546,
20934,
2546,
1010,
24880,
8569,
2546,
3145,
1007,
1063,
2065,
1006,
3145,
1027,
1027,
19701,
1064,
1064,
999,
3145,
1012,
2003,
16416,
20782,
1006,
1007,
1007,
1063,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfiguration.java | HibernateMetricsAutoConfiguration.getEntityManagerFactoryName | private String getEntityManagerFactoryName(String beanName) {
if (beanName.length() > ENTITY_MANAGER_FACTORY_SUFFIX.length() && StringUtils
.endsWithIgnoreCase(beanName, ENTITY_MANAGER_FACTORY_SUFFIX)) {
return beanName.substring(0,
beanName.length() - ENTITY_MANAGER_FACTORY_SUFFIX.length());
}
return beanName;
} | java | private String getEntityManagerFactoryName(String beanName) {
if (beanName.length() > ENTITY_MANAGER_FACTORY_SUFFIX.length() && StringUtils
.endsWithIgnoreCase(beanName, ENTITY_MANAGER_FACTORY_SUFFIX)) {
return beanName.substring(0,
beanName.length() - ENTITY_MANAGER_FACTORY_SUFFIX.length());
}
return beanName;
} | [
"private",
"String",
"getEntityManagerFactoryName",
"(",
"String",
"beanName",
")",
"{",
"if",
"(",
"beanName",
".",
"length",
"(",
")",
">",
"ENTITY_MANAGER_FACTORY_SUFFIX",
".",
"length",
"(",
")",
"&&",
"StringUtils",
".",
"endsWithIgnoreCase",
"(",
"beanName",... | Get the name of an {@link EntityManagerFactory} based on its {@code beanName}.
@param beanName the name of the {@link EntityManagerFactory} bean
@return a name for the given entity manager factory | [
"Get",
"the",
"name",
"of",
"an",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfiguration.java#L83-L90 | train | Gets the entity manager factory name. | [
30522,
2797,
5164,
2131,
4765,
3012,
24805,
4590,
21450,
18442,
1006,
5164,
14068,
18442,
1007,
1063,
2065,
1006,
14068,
18442,
1012,
3091,
1006,
1007,
1028,
9178,
1035,
3208,
1035,
4713,
1035,
16809,
1012,
3091,
1006,
1007,
1004,
1004,
516... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.distinct | public <K> DistinctOperator<T> distinct(KeySelector<T, K> keyExtractor) {
TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keyExtractor, getType());
return new DistinctOperator<>(this, new Keys.SelectorFunctionKeys<>(keyExtractor, getType(), keyType), Utils.getCallLocationName());
} | java | public <K> DistinctOperator<T> distinct(KeySelector<T, K> keyExtractor) {
TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keyExtractor, getType());
return new DistinctOperator<>(this, new Keys.SelectorFunctionKeys<>(keyExtractor, getType(), keyType), Utils.getCallLocationName());
} | [
"public",
"<",
"K",
">",
"DistinctOperator",
"<",
"T",
">",
"distinct",
"(",
"KeySelector",
"<",
"T",
",",
"K",
">",
"keyExtractor",
")",
"{",
"TypeInformation",
"<",
"K",
">",
"keyType",
"=",
"TypeExtractor",
".",
"getKeySelectorTypes",
"(",
"keyExtractor",... | Returns a distinct set of a {@link DataSet} using a {@link KeySelector} function.
<p>The KeySelector function is called for each element of the DataSet and extracts a single key value on which the
decision is made if two items are distinct or not.
@param keyExtractor The KeySelector function which extracts the key values from the DataSet on which the
distinction of the DataSet is decided.
@return A DistinctOperator that represents the distinct DataSet. | [
"Returns",
"a",
"distinct",
"set",
"of",
"a",
"{",
"@link",
"DataSet",
"}",
"using",
"a",
"{",
"@link",
"KeySelector",
"}",
"function",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L596-L599 | train | Create a distinct operator. | [
30522,
2270,
1026,
1047,
1028,
5664,
25918,
8844,
1026,
1056,
1028,
5664,
1006,
6309,
12260,
16761,
1026,
1056,
1010,
1047,
1028,
3145,
10288,
6494,
16761,
1007,
1063,
2828,
2378,
14192,
3370,
1026,
1047,
1028,
3145,
13874,
1027,
2828,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/restore/RocksDBFullRestoreOperation.java | RocksDBFullRestoreOperation.restore | @Override
public RocksDBRestoreResult restore()
throws IOException, StateMigrationException, RocksDBException {
openDB();
for (KeyedStateHandle keyedStateHandle : restoreStateHandles) {
if (keyedStateHandle != null) {
if (!(keyedStateHandle instanceof KeyGroupsStateHandle)) {
throw new IllegalStateException("Unexpected state handle type, " +
"expected: " + KeyGroupsStateHandle.class +
", but found: " + keyedStateHandle.getClass());
}
this.currentKeyGroupsStateHandle = (KeyGroupsStateHandle) keyedStateHandle;
restoreKeyGroupsInStateHandle();
}
}
return new RocksDBRestoreResult(this.db, defaultColumnFamilyHandle, nativeMetricMonitor,
-1, null, null);
} | java | @Override
public RocksDBRestoreResult restore()
throws IOException, StateMigrationException, RocksDBException {
openDB();
for (KeyedStateHandle keyedStateHandle : restoreStateHandles) {
if (keyedStateHandle != null) {
if (!(keyedStateHandle instanceof KeyGroupsStateHandle)) {
throw new IllegalStateException("Unexpected state handle type, " +
"expected: " + KeyGroupsStateHandle.class +
", but found: " + keyedStateHandle.getClass());
}
this.currentKeyGroupsStateHandle = (KeyGroupsStateHandle) keyedStateHandle;
restoreKeyGroupsInStateHandle();
}
}
return new RocksDBRestoreResult(this.db, defaultColumnFamilyHandle, nativeMetricMonitor,
-1, null, null);
} | [
"@",
"Override",
"public",
"RocksDBRestoreResult",
"restore",
"(",
")",
"throws",
"IOException",
",",
"StateMigrationException",
",",
"RocksDBException",
"{",
"openDB",
"(",
")",
";",
"for",
"(",
"KeyedStateHandle",
"keyedStateHandle",
":",
"restoreStateHandles",
")",... | Restores all key-groups data that is referenced by the passed state handles. | [
"Restores",
"all",
"key",
"-",
"groups",
"data",
"that",
"is",
"referenced",
"by",
"the",
"passed",
"state",
"handles",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBFullRestoreOperation.java#L128-L146 | train | Restore the RocksDB database. | [
30522,
1030,
2058,
15637,
2270,
5749,
18939,
28533,
5686,
6072,
11314,
9239,
1006,
1007,
11618,
22834,
10288,
24422,
1010,
2110,
4328,
29397,
10288,
24422,
1010,
5749,
18939,
10288,
24422,
1063,
2330,
18939,
1006,
1007,
1025,
2005,
1006,
3145... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.flushCache | void flushCache() throws Exception {
if (!entryCache.isEmpty()) {
entries.putAll(entryCache);
entryCache.clear();
}
if (!eventsBufferCache.isEmpty()) {
eventsBuffer.putAll(eventsBufferCache);
eventsBufferCache.clear();
}
} | java | void flushCache() throws Exception {
if (!entryCache.isEmpty()) {
entries.putAll(entryCache);
entryCache.clear();
}
if (!eventsBufferCache.isEmpty()) {
eventsBuffer.putAll(eventsBufferCache);
eventsBufferCache.clear();
}
} | [
"void",
"flushCache",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"entryCache",
".",
"isEmpty",
"(",
")",
")",
"{",
"entries",
".",
"putAll",
"(",
"entryCache",
")",
";",
"entryCache",
".",
"clear",
"(",
")",
";",
"}",
"if",
"(",
"!",
"ev... | Flush the event and node from cache to state.
@throws Exception Thrown if the system cannot access the state. | [
"Flush",
"the",
"event",
"and",
"node",
"from",
"cache",
"to",
"state",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBuffer.java#L233-L242 | train | Flushes the cache. | [
30522,
11675,
13862,
3540,
5403,
1006,
1007,
11618,
6453,
1063,
2065,
1006,
999,
4443,
3540,
5403,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1007,
1063,
10445,
1012,
2404,
8095,
1006,
4443,
3540,
5403,
1007,
1025,
4443,
3540,
5403,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getUint8 | public final int getUint8(final int pos) {
if (pos >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: " + pos);
return 0xff & buffer[origin + pos];
} | java | public final int getUint8(final int pos) {
if (pos >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: " + pos);
return 0xff & buffer[origin + pos];
} | [
"public",
"final",
"int",
"getUint8",
"(",
"final",
"int",
"pos",
")",
"{",
"if",
"(",
"pos",
">=",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"pos",
")",
";",
"return",
"0xff",
"&",
... | Return 8-bit unsigned int from buffer. | [
"Return",
"8",
"-",
"bit",
"unsigned",
"int",
"from",
"buffer",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L225-L229 | train | Gets an unsigned 8 - bit value from the buffer. | [
30522,
2270,
2345,
20014,
2131,
20023,
2102,
2620,
1006,
2345,
20014,
13433,
2015,
1007,
1063,
2065,
1006,
13433,
2015,
1028,
1027,
5787,
1064,
1064,
13433,
2015,
1026,
1014,
1007,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/HadoopInputs.java | HadoopInputs.readHadoopFile | public static <K, V> org.apache.flink.api.java.hadoop.mapreduce.HadoopInputFormat<K, V> readHadoopFile(
org.apache.hadoop.mapreduce.lib.input.FileInputFormat<K, V> mapreduceInputFormat, Class<K> key, Class<V> value, String inputPath) throws IOException {
return readHadoopFile(mapreduceInputFormat, key, value, inputPath, Job.getInstance());
} | java | public static <K, V> org.apache.flink.api.java.hadoop.mapreduce.HadoopInputFormat<K, V> readHadoopFile(
org.apache.hadoop.mapreduce.lib.input.FileInputFormat<K, V> mapreduceInputFormat, Class<K> key, Class<V> value, String inputPath) throws IOException {
return readHadoopFile(mapreduceInputFormat, key, value, inputPath, Job.getInstance());
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"org",
".",
"apache",
".",
"flink",
".",
"api",
".",
"java",
".",
"hadoop",
".",
"mapreduce",
".",
"HadoopInputFormat",
"<",
"K",
",",
"V",
">",
"readHadoopFile",
"(",
"org",
".",
"apache",
".",
"hadoop",
... | Creates a Flink {@link InputFormat} that wraps the given Hadoop {@link org.apache.hadoop.mapreduce.lib.input.FileInputFormat}.
@return A Flink InputFormat that wraps the Hadoop FileInputFormat. | [
"Creates",
"a",
"Flink",
"{",
"@link",
"InputFormat",
"}",
"that",
"wraps",
"the",
"given",
"Hadoop",
"{",
"@link",
"org",
".",
"apache",
".",
"hadoop",
".",
"mapreduce",
".",
"lib",
".",
"input",
".",
"FileInputFormat",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/HadoopInputs.java#L102-L105 | train | Read hadoop file. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
8917,
1012,
15895,
1012,
13109,
19839,
1012,
17928,
1012,
9262,
1012,
2018,
18589,
1012,
4949,
5596,
18796,
1012,
2018,
18589,
2378,
18780,
14192,
4017,
1026,
1047,
1010,
1058,
1028,
3191,
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-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSchemaConverter.java | AvroSchemaConverter.convertToTypeInfo | @SuppressWarnings("unchecked")
public static <T extends SpecificRecord> TypeInformation<Row> convertToTypeInfo(Class<T> avroClass) {
Preconditions.checkNotNull(avroClass, "Avro specific record class must not be null.");
// determine schema to retrieve deterministic field order
final Schema schema = SpecificData.get().getSchema(avroClass);
return (TypeInformation<Row>) convertToTypeInfo(schema);
} | java | @SuppressWarnings("unchecked")
public static <T extends SpecificRecord> TypeInformation<Row> convertToTypeInfo(Class<T> avroClass) {
Preconditions.checkNotNull(avroClass, "Avro specific record class must not be null.");
// determine schema to retrieve deterministic field order
final Schema schema = SpecificData.get().getSchema(avroClass);
return (TypeInformation<Row>) convertToTypeInfo(schema);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"SpecificRecord",
">",
"TypeInformation",
"<",
"Row",
">",
"convertToTypeInfo",
"(",
"Class",
"<",
"T",
">",
"avroClass",
")",
"{",
"Preconditions",
".",
"checkNotNull",... | Converts an Avro class into a nested row structure with deterministic field order and data
types that are compatible with Flink's Table & SQL API.
@param avroClass Avro specific record that contains schema information
@return type information matching the schema | [
"Converts",
"an",
"Avro",
"class",
"into",
"a",
"nested",
"row",
"structure",
"with",
"deterministic",
"field",
"order",
"and",
"data",
"types",
"that",
"are",
"compatible",
"with",
"Flink",
"s",
"Table",
"&",
"SQL",
"API",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSchemaConverter.java#L58-L64 | train | Converts an Avro specific record class to a type information. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
8908,
3563,
2890,
27108,
2094,
1028,
2828,
2378,
14192,
3370,
1026,
5216,
1028,
10463,
3406,
13874,
2378,
14876,
1006,
2465,
1026,
105... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Repackager.java | Repackager.repackage | public void repackage(File destination, Libraries libraries,
LaunchScript launchScript) throws IOException {
if (destination == null || destination.isDirectory()) {
throw new IllegalArgumentException("Invalid destination");
}
if (libraries == null) {
throw new IllegalArgumentException("Libraries must not be null");
}
if (this.layout == null) {
this.layout = getLayoutFactory().getLayout(this.source);
}
destination = destination.getAbsoluteFile();
File workingSource = this.source;
if (alreadyRepackaged() && this.source.equals(destination)) {
return;
}
if (this.source.equals(destination)) {
workingSource = getBackupFile();
workingSource.delete();
renameFile(this.source, workingSource);
}
destination.delete();
try {
try (JarFile jarFileSource = new JarFile(workingSource)) {
repackage(jarFileSource, destination, libraries, launchScript);
}
}
finally {
if (!this.backupSource && !this.source.equals(workingSource)) {
deleteFile(workingSource);
}
}
} | java | public void repackage(File destination, Libraries libraries,
LaunchScript launchScript) throws IOException {
if (destination == null || destination.isDirectory()) {
throw new IllegalArgumentException("Invalid destination");
}
if (libraries == null) {
throw new IllegalArgumentException("Libraries must not be null");
}
if (this.layout == null) {
this.layout = getLayoutFactory().getLayout(this.source);
}
destination = destination.getAbsoluteFile();
File workingSource = this.source;
if (alreadyRepackaged() && this.source.equals(destination)) {
return;
}
if (this.source.equals(destination)) {
workingSource = getBackupFile();
workingSource.delete();
renameFile(this.source, workingSource);
}
destination.delete();
try {
try (JarFile jarFileSource = new JarFile(workingSource)) {
repackage(jarFileSource, destination, libraries, launchScript);
}
}
finally {
if (!this.backupSource && !this.source.equals(workingSource)) {
deleteFile(workingSource);
}
}
} | [
"public",
"void",
"repackage",
"(",
"File",
"destination",
",",
"Libraries",
"libraries",
",",
"LaunchScript",
"launchScript",
")",
"throws",
"IOException",
"{",
"if",
"(",
"destination",
"==",
"null",
"||",
"destination",
".",
"isDirectory",
"(",
")",
")",
"{... | Repackage to the given destination so that it can be launched using '
{@literal java -jar}'.
@param destination the destination file (may be the same as the source)
@param libraries the libraries required to run the archive
@param launchScript an optional launch script prepended to the front of the jar
@throws IOException if the file cannot be repackaged
@since 1.3.0 | [
"Repackage",
"to",
"the",
"given",
"destination",
"so",
"that",
"it",
"can",
"be",
"launched",
"using",
"{"
] | 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/Repackager.java#L171-L203 | train | Repackage the source file to the destination file. | [
30522,
2270,
11675,
16360,
8684,
4270,
1006,
5371,
7688,
1010,
8860,
8860,
1010,
4888,
22483,
4888,
22483,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
7688,
1027,
1027,
19701,
1064,
1064,
7688,
1012,
2003,
4305,
2890,
16761,
2100,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java | AbstractFetcher.commitInternalOffsetsToKafka | public final void commitInternalOffsetsToKafka(
Map<KafkaTopicPartition, Long> offsets,
@Nonnull KafkaCommitCallback commitCallback) throws Exception {
// Ignore sentinels. They might appear here if snapshot has started before actual offsets values
// replaced sentinels
doCommitInternalOffsetsToKafka(filterOutSentinels(offsets), commitCallback);
} | java | public final void commitInternalOffsetsToKafka(
Map<KafkaTopicPartition, Long> offsets,
@Nonnull KafkaCommitCallback commitCallback) throws Exception {
// Ignore sentinels. They might appear here if snapshot has started before actual offsets values
// replaced sentinels
doCommitInternalOffsetsToKafka(filterOutSentinels(offsets), commitCallback);
} | [
"public",
"final",
"void",
"commitInternalOffsetsToKafka",
"(",
"Map",
"<",
"KafkaTopicPartition",
",",
"Long",
">",
"offsets",
",",
"@",
"Nonnull",
"KafkaCommitCallback",
"commitCallback",
")",
"throws",
"Exception",
"{",
"// Ignore sentinels. They might appear here if sna... | Commits the given partition offsets to the Kafka brokers (or to ZooKeeper for
older Kafka versions). This method is only ever called when the offset commit mode of
the consumer is {@link OffsetCommitMode#ON_CHECKPOINTS}.
<p>The given offsets are the internal checkpointed offsets, representing
the last processed record of each partition. Version-specific implementations of this method
need to hold the contract that the given offsets must be incremented by 1 before
committing them, so that committed offsets to Kafka represent "the next record to process".
@param offsets The offsets to commit to Kafka (implementations must increment offsets by 1 before committing).
@param commitCallback The callback that the user should trigger when a commit request completes or fails.
@throws Exception This method forwards exceptions. | [
"Commits",
"the",
"given",
"partition",
"offsets",
"to",
"the",
"Kafka",
"brokers",
"(",
"or",
"to",
"ZooKeeper",
"for",
"older",
"Kafka",
"versions",
")",
".",
"This",
"method",
"is",
"only",
"ever",
"called",
"when",
"the",
"offset",
"commit",
"mode",
"o... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java#L289-L295 | train | Commit the offsets to Kafka. | [
30522,
2270,
2345,
11675,
10797,
18447,
11795,
23067,
21807,
8454,
18715,
10354,
2912,
1006,
4949,
1026,
10556,
24316,
10610,
24330,
19362,
3775,
3508,
1010,
2146,
1028,
16396,
2015,
1010,
1030,
30524,
3711,
2182,
2065,
20057,
12326,
2038,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.cut | public static BufferedImage cut(Image srcImage, int x, int y, int radius) {
return Img.from(srcImage).cut(x, y, radius).getImg();
} | java | public static BufferedImage cut(Image srcImage, int x, int y, int radius) {
return Img.from(srcImage).cut(x, y, radius).getImg();
} | [
"public",
"static",
"BufferedImage",
"cut",
"(",
"Image",
"srcImage",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"radius",
")",
"{",
"return",
"Img",
".",
"from",
"(",
"srcImage",
")",
".",
"cut",
"(",
"x",
",",
"y",
",",
"radius",
")",
".",
"... | 图像切割(按指定起点坐标和宽高切割)
@param srcImage 源图像
@param x 原图的x坐标起始位置
@param y 原图的y坐标起始位置
@param radius 半径,小于0表示填充满整个图片(直径取长宽最小值)
@return {@link BufferedImage}
@since 4.1.15 | [
"图像切割",
"(",
"按指定起点坐标和宽高切割",
")"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L358-L360 | train | Cut the image at the specified coordinates. | [
30522,
2270,
10763,
17698,
2098,
9581,
3351,
3013,
1006,
3746,
5034,
6895,
26860,
1010,
20014,
1060,
1010,
20014,
1061,
1010,
20014,
12177,
1007,
1063,
2709,
10047,
2290,
1012,
2013,
1006,
5034,
6895,
26860,
1007,
1012,
3013,
1006,
1060,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleServiceMetrics.java | YarnShuffleServiceMetrics.collectMetric | public static void collectMetric(
MetricsRecordBuilder metricsRecordBuilder, String name, Metric metric) {
if (metric instanceof Timer) {
Timer t = (Timer) metric;
metricsRecordBuilder
.addCounter(new ShuffleServiceMetricsInfo(name + "_count", "Count of timer " + name),
t.getCount())
.addGauge(
new ShuffleServiceMetricsInfo(name + "_rate15", "15 minute rate of timer " + name),
t.getFifteenMinuteRate())
.addGauge(
new ShuffleServiceMetricsInfo(name + "_rate5", "5 minute rate of timer " + name),
t.getFiveMinuteRate())
.addGauge(
new ShuffleServiceMetricsInfo(name + "_rate1", "1 minute rate of timer " + name),
t.getOneMinuteRate())
.addGauge(new ShuffleServiceMetricsInfo(name + "_rateMean", "Mean rate of timer " + name),
t.getMeanRate());
} else if (metric instanceof Meter) {
Meter m = (Meter) metric;
metricsRecordBuilder
.addCounter(new ShuffleServiceMetricsInfo(name + "_count", "Count of meter " + name),
m.getCount())
.addGauge(
new ShuffleServiceMetricsInfo(name + "_rate15", "15 minute rate of meter " + name),
m.getFifteenMinuteRate())
.addGauge(
new ShuffleServiceMetricsInfo(name + "_rate5", "5 minute rate of meter " + name),
m.getFiveMinuteRate())
.addGauge(
new ShuffleServiceMetricsInfo(name + "_rate1", "1 minute rate of meter " + name),
m.getOneMinuteRate())
.addGauge(new ShuffleServiceMetricsInfo(name + "_rateMean", "Mean rate of meter " + name),
m.getMeanRate());
} else if (metric instanceof Gauge) {
final Object gaugeValue = ((Gauge) metric).getValue();
if (gaugeValue instanceof Integer) {
metricsRecordBuilder.addGauge(getShuffleServiceMetricsInfo(name), (Integer) gaugeValue);
} else if (gaugeValue instanceof Long) {
metricsRecordBuilder.addGauge(getShuffleServiceMetricsInfo(name), (Long) gaugeValue);
} else if (gaugeValue instanceof Float) {
metricsRecordBuilder.addGauge(getShuffleServiceMetricsInfo(name), (Float) gaugeValue);
} else if (gaugeValue instanceof Double) {
metricsRecordBuilder.addGauge(getShuffleServiceMetricsInfo(name), (Double) gaugeValue);
} else {
throw new IllegalStateException(
"Not supported class type of metric[" + name + "] for value " + gaugeValue);
}
} else if (metric instanceof Counter) {
Counter c = (Counter) metric;
long counterValue = c.getCount();
metricsRecordBuilder.addGauge(new ShuffleServiceMetricsInfo(name, "Number of " +
"connections to shuffle service " + name), counterValue);
}
} | java | public static void collectMetric(
MetricsRecordBuilder metricsRecordBuilder, String name, Metric metric) {
if (metric instanceof Timer) {
Timer t = (Timer) metric;
metricsRecordBuilder
.addCounter(new ShuffleServiceMetricsInfo(name + "_count", "Count of timer " + name),
t.getCount())
.addGauge(
new ShuffleServiceMetricsInfo(name + "_rate15", "15 minute rate of timer " + name),
t.getFifteenMinuteRate())
.addGauge(
new ShuffleServiceMetricsInfo(name + "_rate5", "5 minute rate of timer " + name),
t.getFiveMinuteRate())
.addGauge(
new ShuffleServiceMetricsInfo(name + "_rate1", "1 minute rate of timer " + name),
t.getOneMinuteRate())
.addGauge(new ShuffleServiceMetricsInfo(name + "_rateMean", "Mean rate of timer " + name),
t.getMeanRate());
} else if (metric instanceof Meter) {
Meter m = (Meter) metric;
metricsRecordBuilder
.addCounter(new ShuffleServiceMetricsInfo(name + "_count", "Count of meter " + name),
m.getCount())
.addGauge(
new ShuffleServiceMetricsInfo(name + "_rate15", "15 minute rate of meter " + name),
m.getFifteenMinuteRate())
.addGauge(
new ShuffleServiceMetricsInfo(name + "_rate5", "5 minute rate of meter " + name),
m.getFiveMinuteRate())
.addGauge(
new ShuffleServiceMetricsInfo(name + "_rate1", "1 minute rate of meter " + name),
m.getOneMinuteRate())
.addGauge(new ShuffleServiceMetricsInfo(name + "_rateMean", "Mean rate of meter " + name),
m.getMeanRate());
} else if (metric instanceof Gauge) {
final Object gaugeValue = ((Gauge) metric).getValue();
if (gaugeValue instanceof Integer) {
metricsRecordBuilder.addGauge(getShuffleServiceMetricsInfo(name), (Integer) gaugeValue);
} else if (gaugeValue instanceof Long) {
metricsRecordBuilder.addGauge(getShuffleServiceMetricsInfo(name), (Long) gaugeValue);
} else if (gaugeValue instanceof Float) {
metricsRecordBuilder.addGauge(getShuffleServiceMetricsInfo(name), (Float) gaugeValue);
} else if (gaugeValue instanceof Double) {
metricsRecordBuilder.addGauge(getShuffleServiceMetricsInfo(name), (Double) gaugeValue);
} else {
throw new IllegalStateException(
"Not supported class type of metric[" + name + "] for value " + gaugeValue);
}
} else if (metric instanceof Counter) {
Counter c = (Counter) metric;
long counterValue = c.getCount();
metricsRecordBuilder.addGauge(new ShuffleServiceMetricsInfo(name, "Number of " +
"connections to shuffle service " + name), counterValue);
}
} | [
"public",
"static",
"void",
"collectMetric",
"(",
"MetricsRecordBuilder",
"metricsRecordBuilder",
",",
"String",
"name",
",",
"Metric",
"metric",
")",
"{",
"if",
"(",
"metric",
"instanceof",
"Timer",
")",
"{",
"Timer",
"t",
"=",
"(",
"Timer",
")",
"metric",
... | The metric types used in
{@link org.apache.spark.network.shuffle.ExternalShuffleBlockHandler.ShuffleMetrics}.
Visible for testing. | [
"The",
"metric",
"types",
"used",
"in",
"{"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleServiceMetrics.java#L61-L116 | train | Collect a metric. | [
30522,
2270,
10763,
11675,
8145,
12589,
1006,
12046,
21338,
8586,
8551,
8569,
23891,
2099,
12046,
21338,
8586,
8551,
8569,
23891,
2099,
1010,
5164,
2171,
1010,
12046,
12046,
1007,
1063,
2065,
1006,
12046,
6013,
11253,
25309,
1007,
30524,
2530... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/orc/OrcColumnarBatchReader.java | OrcColumnarBatchReader.initBatch | public void initBatch(
TypeDescription orcSchema,
StructField[] requiredFields,
int[] requestedDataColIds,
int[] requestedPartitionColIds,
InternalRow partitionValues) {
wrap = new VectorizedRowBatchWrap(orcSchema.createRowBatch(capacity));
assert(!wrap.batch().selectedInUse); // `selectedInUse` should be initialized with `false`.
assert(requiredFields.length == requestedDataColIds.length);
assert(requiredFields.length == requestedPartitionColIds.length);
// If a required column is also partition column, use partition value and don't read from file.
for (int i = 0; i < requiredFields.length; i++) {
if (requestedPartitionColIds[i] != -1) {
requestedDataColIds[i] = -1;
}
}
this.requiredFields = requiredFields;
this.requestedDataColIds = requestedDataColIds;
StructType resultSchema = new StructType(requiredFields);
// Just wrap the ORC column vector instead of copying it to Spark column vector.
orcVectorWrappers = new org.apache.spark.sql.vectorized.ColumnVector[resultSchema.length()];
for (int i = 0; i < requiredFields.length; i++) {
DataType dt = requiredFields[i].dataType();
if (requestedPartitionColIds[i] != -1) {
OnHeapColumnVector partitionCol = new OnHeapColumnVector(capacity, dt);
ColumnVectorUtils.populate(partitionCol, partitionValues, requestedPartitionColIds[i]);
partitionCol.setIsConstant();
orcVectorWrappers[i] = partitionCol;
} else {
int colId = requestedDataColIds[i];
// Initialize the missing columns once.
if (colId == -1) {
OnHeapColumnVector missingCol = new OnHeapColumnVector(capacity, dt);
missingCol.putNulls(0, capacity);
missingCol.setIsConstant();
orcVectorWrappers[i] = missingCol;
} else {
orcVectorWrappers[i] = new OrcColumnVector(dt, wrap.batch().cols[colId]);
}
}
}
columnarBatch = new ColumnarBatch(orcVectorWrappers);
} | java | public void initBatch(
TypeDescription orcSchema,
StructField[] requiredFields,
int[] requestedDataColIds,
int[] requestedPartitionColIds,
InternalRow partitionValues) {
wrap = new VectorizedRowBatchWrap(orcSchema.createRowBatch(capacity));
assert(!wrap.batch().selectedInUse); // `selectedInUse` should be initialized with `false`.
assert(requiredFields.length == requestedDataColIds.length);
assert(requiredFields.length == requestedPartitionColIds.length);
// If a required column is also partition column, use partition value and don't read from file.
for (int i = 0; i < requiredFields.length; i++) {
if (requestedPartitionColIds[i] != -1) {
requestedDataColIds[i] = -1;
}
}
this.requiredFields = requiredFields;
this.requestedDataColIds = requestedDataColIds;
StructType resultSchema = new StructType(requiredFields);
// Just wrap the ORC column vector instead of copying it to Spark column vector.
orcVectorWrappers = new org.apache.spark.sql.vectorized.ColumnVector[resultSchema.length()];
for (int i = 0; i < requiredFields.length; i++) {
DataType dt = requiredFields[i].dataType();
if (requestedPartitionColIds[i] != -1) {
OnHeapColumnVector partitionCol = new OnHeapColumnVector(capacity, dt);
ColumnVectorUtils.populate(partitionCol, partitionValues, requestedPartitionColIds[i]);
partitionCol.setIsConstant();
orcVectorWrappers[i] = partitionCol;
} else {
int colId = requestedDataColIds[i];
// Initialize the missing columns once.
if (colId == -1) {
OnHeapColumnVector missingCol = new OnHeapColumnVector(capacity, dt);
missingCol.putNulls(0, capacity);
missingCol.setIsConstant();
orcVectorWrappers[i] = missingCol;
} else {
orcVectorWrappers[i] = new OrcColumnVector(dt, wrap.batch().cols[colId]);
}
}
}
columnarBatch = new ColumnarBatch(orcVectorWrappers);
} | [
"public",
"void",
"initBatch",
"(",
"TypeDescription",
"orcSchema",
",",
"StructField",
"[",
"]",
"requiredFields",
",",
"int",
"[",
"]",
"requestedDataColIds",
",",
"int",
"[",
"]",
"requestedPartitionColIds",
",",
"InternalRow",
"partitionValues",
")",
"{",
"wra... | Initialize columnar batch by setting required schema and partition information.
With this information, this creates ColumnarBatch with the full schema.
@param orcSchema Schema from ORC file reader.
@param requiredFields All the fields that are required to return, including partition fields.
@param requestedDataColIds Requested column ids from orcSchema. -1 if not existed.
@param requestedPartitionColIds Requested column ids from partition schema. -1 if not existed.
@param partitionValues Values of partition columns. | [
"Initialize",
"columnar",
"batch",
"by",
"setting",
"required",
"schema",
"and",
"partition",
"information",
".",
"With",
"this",
"information",
"this",
"creates",
"ColumnarBatch",
"with",
"the",
"full",
"schema",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/orc/OrcColumnarBatchReader.java#L143-L189 | train | Initialize the batch. | [
30522,
2270,
11675,
1999,
4183,
14479,
2818,
1006,
21189,
2229,
23235,
3258,
2030,
6169,
5403,
2863,
1010,
2358,
6820,
6593,
3790,
1031,
1033,
3223,
15155,
1010,
20014,
1031,
1033,
7303,
2850,
2696,
25778,
9821,
1010,
20014,
1031,
1033,
730... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/graph/EnumTriangles.java | EnumTriangles.main | public static void main(String[] args) throws Exception {
// Checking input parameters
final ParameterTool params = ParameterTool.fromArgs(args);
// set up execution environment
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
// make parameters available in the web interface
env.getConfig().setGlobalJobParameters(params);
// read input data
DataSet<Edge> edges;
if (params.has("edges")) {
edges = env.readCsvFile(params.get("edges"))
.fieldDelimiter(" ")
.includeFields(true, true)
.types(Integer.class, Integer.class)
.map(new TupleEdgeConverter());
} else {
System.out.println("Executing EnumTriangles example with default edges data set.");
System.out.println("Use --edges to specify file input.");
edges = EnumTrianglesData.getDefaultEdgeDataSet(env);
}
// project edges by vertex id
DataSet<Edge> edgesById = edges
.map(new EdgeByIdProjector());
DataSet<Triad> triangles = edgesById
// build triads
.groupBy(Edge.V1).sortGroup(Edge.V2, Order.ASCENDING).reduceGroup(new TriadBuilder())
// filter triads
.join(edgesById).where(Triad.V2, Triad.V3).equalTo(Edge.V1, Edge.V2).with(new TriadFilter());
// emit result
if (params.has("output")) {
triangles.writeAsCsv(params.get("output"), "\n", ",");
// execute program
env.execute("Basic Triangle Enumeration Example");
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
triangles.print();
}
} | java | public static void main(String[] args) throws Exception {
// Checking input parameters
final ParameterTool params = ParameterTool.fromArgs(args);
// set up execution environment
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
// make parameters available in the web interface
env.getConfig().setGlobalJobParameters(params);
// read input data
DataSet<Edge> edges;
if (params.has("edges")) {
edges = env.readCsvFile(params.get("edges"))
.fieldDelimiter(" ")
.includeFields(true, true)
.types(Integer.class, Integer.class)
.map(new TupleEdgeConverter());
} else {
System.out.println("Executing EnumTriangles example with default edges data set.");
System.out.println("Use --edges to specify file input.");
edges = EnumTrianglesData.getDefaultEdgeDataSet(env);
}
// project edges by vertex id
DataSet<Edge> edgesById = edges
.map(new EdgeByIdProjector());
DataSet<Triad> triangles = edgesById
// build triads
.groupBy(Edge.V1).sortGroup(Edge.V2, Order.ASCENDING).reduceGroup(new TriadBuilder())
// filter triads
.join(edgesById).where(Triad.V2, Triad.V3).equalTo(Edge.V1, Edge.V2).with(new TriadFilter());
// emit result
if (params.has("output")) {
triangles.writeAsCsv(params.get("output"), "\n", ",");
// execute program
env.execute("Basic Triangle Enumeration Example");
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
triangles.print();
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"// Checking input parameters",
"final",
"ParameterTool",
"params",
"=",
"ParameterTool",
".",
"fromArgs",
"(",
"args",
")",
";",
"// set up execution environment",... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/graph/EnumTriangles.java#L77-L121 | train | Main method to run the Sequence Enumeration example. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
1013,
1013,
9361,
7953,
11709,
2345,
16381,
3406,
4747,
11498,
5244,
1027,
16381,
3406,
4747,
1012,
2013,
2906,
5620,
1006,
12098,
5620,
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... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/Session.java | Session.quietRollback | public void quietRollback() {
try {
getConnection().rollback();
} catch (Exception e) {
log.error(e);
} finally {
try {
getConnection().setAutoCommit(true); // 事务结束,恢复自动提交
} catch (SQLException e) {
log.error(e);
}
}
} | java | public void quietRollback() {
try {
getConnection().rollback();
} catch (Exception e) {
log.error(e);
} finally {
try {
getConnection().setAutoCommit(true); // 事务结束,恢复自动提交
} catch (SQLException e) {
log.error(e);
}
}
} | [
"public",
"void",
"quietRollback",
"(",
")",
"{",
"try",
"{",
"getConnection",
"(",
")",
".",
"rollback",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"get... | 静默回滚事务<br>
回滚事务 | [
"静默回滚事务<br",
">",
"回滚事务"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Session.java#L159-L171 | train | Rollback the transaction. | [
30522,
2270,
11675,
4251,
28402,
5963,
1006,
1007,
1063,
3046,
1063,
2131,
8663,
2638,
7542,
1006,
1007,
1012,
4897,
5963,
1006,
1007,
1025,
1065,
4608,
1006,
6453,
1041,
1007,
1063,
8833,
1012,
7561,
1006,
1041,
1007,
1025,
1065,
2633,
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/HexUtil.java | HexUtil.decodeHex | public static byte[] decodeHex(char[] hexData) {
int len = hexData.length;
if ((len & 0x01) != 0) {
throw new RuntimeException("Odd number of characters.");
}
byte[] out = new byte[len >> 1];
// two characters form the hex value.
for (int i = 0, j = 0; j < len; i++) {
int f = toDigit(hexData[j], j) << 4;
j++;
f = f | toDigit(hexData[j], j);
j++;
out[i] = (byte) (f & 0xFF);
}
return out;
} | java | public static byte[] decodeHex(char[] hexData) {
int len = hexData.length;
if ((len & 0x01) != 0) {
throw new RuntimeException("Odd number of characters.");
}
byte[] out = new byte[len >> 1];
// two characters form the hex value.
for (int i = 0, j = 0; j < len; i++) {
int f = toDigit(hexData[j], j) << 4;
j++;
f = f | toDigit(hexData[j], j);
j++;
out[i] = (byte) (f & 0xFF);
}
return out;
} | [
"public",
"static",
"byte",
"[",
"]",
"decodeHex",
"(",
"char",
"[",
"]",
"hexData",
")",
"{",
"int",
"len",
"=",
"hexData",
".",
"length",
";",
"if",
"(",
"(",
"len",
"&",
"0x01",
")",
"!=",
"0",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
... | 将十六进制字符数组转换为字节数组
@param hexData 十六进制char[]
@return byte[]
@throws RuntimeException 如果源十六进制字符数组是一个奇怪的长度,将抛出运行时异常 | [
"将十六进制字符数组转换为字节数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java#L167-L187 | train | Decodes a byte array of hex characters from the given char array. | [
30522,
2270,
10763,
24880,
1031,
1033,
21933,
25383,
10288,
1006,
25869,
1031,
1033,
2002,
2595,
2850,
2696,
1007,
1063,
20014,
18798,
1027,
2002,
2595,
2850,
2696,
1012,
3091,
1025,
2065,
1006,
1006,
18798,
1004,
1014,
2595,
24096,
1007,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/pattern/CronPattern.java | CronPattern.isMatchDayOfMonth | private static boolean isMatchDayOfMonth(ValueMatcher matcher, int dayOfMonth, int month, boolean isLeapYear) {
return ((matcher instanceof DayOfMonthValueMatcher) //
? ((DayOfMonthValueMatcher) matcher).match(dayOfMonth, month, isLeapYear) //
: matcher.match(dayOfMonth));
} | java | private static boolean isMatchDayOfMonth(ValueMatcher matcher, int dayOfMonth, int month, boolean isLeapYear) {
return ((matcher instanceof DayOfMonthValueMatcher) //
? ((DayOfMonthValueMatcher) matcher).match(dayOfMonth, month, isLeapYear) //
: matcher.match(dayOfMonth));
} | [
"private",
"static",
"boolean",
"isMatchDayOfMonth",
"(",
"ValueMatcher",
"matcher",
",",
"int",
"dayOfMonth",
",",
"int",
"month",
",",
"boolean",
"isLeapYear",
")",
"{",
"return",
"(",
"(",
"matcher",
"instanceof",
"DayOfMonthValueMatcher",
")",
"//\r",
"?",
"... | 是否匹配日(指定月份的第几天)
@param matcher {@link ValueMatcher}
@param dayOfMonth 日
@param month 月
@param isLeapYear 是否闰年
@return 是否匹配 | [
"是否匹配日(指定月份的第几天)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/CronPattern.java#L198-L202 | train | Checks if the given matcher is a match for a day of month. | [
30522,
2797,
10763,
22017,
20898,
2003,
18900,
2818,
10259,
11253,
9629,
2232,
1006,
30524,
11253,
9629,
2232,
10175,
5657,
18900,
7474,
1007,
1013,
1013,
1029,
1006,
1006,
2154,
11253,
9629,
2232,
10175,
5657,
18900,
7474,
1007,
2674,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/interval/IntervalTree.java | IntervalTree.removeOverlaps | public List<Intervalable> removeOverlaps(List<Intervalable> intervals)
{
// 排序,按照先大小后左端点的顺序
Collections.sort(intervals, new IntervalableComparatorBySize());
Set<Intervalable> removeIntervals = new TreeSet<Intervalable>();
for (Intervalable interval : intervals)
{
// 如果区间已经被移除了,就忽略它
if (removeIntervals.contains(interval))
{
continue;
}
// 否则就移除它
removeIntervals.addAll(findOverlaps(interval));
}
// 移除所有的重叠区间
for (Intervalable removeInterval : removeIntervals)
{
intervals.remove(removeInterval);
}
// 排序,按照左端顺序
Collections.sort(intervals, new IntervalableComparatorByPosition());
return intervals;
} | java | public List<Intervalable> removeOverlaps(List<Intervalable> intervals)
{
// 排序,按照先大小后左端点的顺序
Collections.sort(intervals, new IntervalableComparatorBySize());
Set<Intervalable> removeIntervals = new TreeSet<Intervalable>();
for (Intervalable interval : intervals)
{
// 如果区间已经被移除了,就忽略它
if (removeIntervals.contains(interval))
{
continue;
}
// 否则就移除它
removeIntervals.addAll(findOverlaps(interval));
}
// 移除所有的重叠区间
for (Intervalable removeInterval : removeIntervals)
{
intervals.remove(removeInterval);
}
// 排序,按照左端顺序
Collections.sort(intervals, new IntervalableComparatorByPosition());
return intervals;
} | [
"public",
"List",
"<",
"Intervalable",
">",
"removeOverlaps",
"(",
"List",
"<",
"Intervalable",
">",
"intervals",
")",
"{",
"// 排序,按照先大小后左端点的顺序",
"Collections",
".",
"sort",
"(",
"intervals",
",",
"new",
"IntervalableComparatorBySize",
"(",
")",
")",
";",
"Set",... | 从区间列表中移除重叠的区间
@param intervals
@return | [
"从区间列表中移除重叠的区间"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/interval/IntervalTree.java#L34-L64 | train | Remove overlapping intervals. | [
30522,
2270,
2862,
1026,
13483,
3085,
1028,
6366,
7840,
2721,
4523,
1006,
2862,
30524,
1025,
2275,
1026,
13483,
3085,
1028,
6366,
18447,
2121,
10175,
2015,
1027,
2047,
3628,
3388,
1026,
13483,
3085,
1028,
1006,
1007,
1025,
2005,
1006,
13483... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/dictionary/TFDictionary.java | TFDictionary.saveKeyTo | public boolean saveKeyTo(String path)
{
LinkedList<String> keyList = new LinkedList<String>();
for (Map.Entry<String, TermFrequency> entry : trie.entrySet())
{
keyList.add(entry.getKey());
}
return IOUtil.saveCollectionToTxt(keyList, path);
} | java | public boolean saveKeyTo(String path)
{
LinkedList<String> keyList = new LinkedList<String>();
for (Map.Entry<String, TermFrequency> entry : trie.entrySet())
{
keyList.add(entry.getKey());
}
return IOUtil.saveCollectionToTxt(keyList, path);
} | [
"public",
"boolean",
"saveKeyTo",
"(",
"String",
"path",
")",
"{",
"LinkedList",
"<",
"String",
">",
"keyList",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"TermFrequency",
">",
"ent... | 仅仅将值保存到文件
@param path
@return | [
"仅仅将值保存到文件"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/TFDictionary.java#L167-L175 | train | Save the key to a file. | [
30522,
2270,
22017,
20898,
3828,
14839,
3406,
1006,
5164,
4130,
1007,
1063,
5799,
9863,
1026,
5164,
1028,
3145,
9863,
1027,
2047,
5799,
9863,
1026,
5164,
1028,
1006,
1007,
1025,
2005,
1006,
4949,
1012,
4443,
1026,
5164,
1010,
2744,
19699,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ExecutionEnvironment.java | ExecutionEnvironment.createRemoteEnvironment | public static ExecutionEnvironment createRemoteEnvironment(String host, int port, String... jarFiles) {
return new RemoteEnvironment(host, port, jarFiles);
} | java | public static ExecutionEnvironment createRemoteEnvironment(String host, int port, String... jarFiles) {
return new RemoteEnvironment(host, port, jarFiles);
} | [
"public",
"static",
"ExecutionEnvironment",
"createRemoteEnvironment",
"(",
"String",
"host",
",",
"int",
"port",
",",
"String",
"...",
"jarFiles",
")",
"{",
"return",
"new",
"RemoteEnvironment",
"(",
"host",
",",
"port",
",",
"jarFiles",
")",
";",
"}"
] | Creates a {@link RemoteEnvironment}. The remote environment sends (parts of) the program
to a cluster for execution. Note that all file paths used in the program must be accessible from the
cluster. The execution will use the cluster's default parallelism, unless the parallelism is
set explicitly via {@link ExecutionEnvironment#setParallelism(int)}.
@param host The host name or address of the master (JobManager), where the program should be executed.
@param port The port of the master (JobManager), where the program should be executed.
@param jarFiles The JAR files with code that needs to be shipped to the cluster. If the program uses
user-defined functions, user-defined input formats, or any libraries, those must be
provided in the JAR files.
@return A remote environment that executes the program on a cluster. | [
"Creates",
"a",
"{",
"@link",
"RemoteEnvironment",
"}",
".",
"The",
"remote",
"environment",
"sends",
"(",
"parts",
"of",
")",
"the",
"program",
"to",
"a",
"cluster",
"for",
"execution",
".",
"Note",
"that",
"all",
"file",
"paths",
"used",
"in",
"the",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L1172-L1174 | train | Creates a remote environment. | [
30522,
2270,
10763,
7781,
2368,
21663,
2239,
3672,
3443,
28578,
12184,
2368,
21663,
2239,
3672,
1006,
5164,
3677,
1010,
20014,
3417,
1010,
5164,
1012,
1012,
1012,
15723,
8873,
4244,
1007,
1063,
2709,
2047,
6556,
2368,
21663,
2239,
3672,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java | DoubleArrayTrie.insert | private int insert(List<Node> siblings, BitSet used)
{
if (error_ < 0)
return 0;
int begin = 0;
int pos = Math.max(siblings.get(0).code + 1, nextCheckPos) - 1;
int nonzero_num = 0;
int first = 0;
if (allocSize <= pos)
resize(pos + 1);
outer:
// 此循环体的目标是找出满足base[begin + a1...an] == 0的n个空闲空间,a1...an是siblings中的n个节点
while (true)
{
pos++;
if (allocSize <= pos)
resize(pos + 1);
if (check[pos] != 0)
{
nonzero_num++;
continue;
}
else if (first == 0)
{
nextCheckPos = pos;
first = 1;
}
begin = pos - siblings.get(0).code; // 当前位置离第一个兄弟节点的距离
if (allocSize <= (begin + siblings.get(siblings.size() - 1).code))
{
resize(begin + siblings.get(siblings.size() - 1).code + Character.MAX_VALUE);
}
//if (used[begin])
// continue;
if(used.get(begin)){
continue;
}
for (int i = 1; i < siblings.size(); i++)
if (check[begin + siblings.get(i).code] != 0)
continue outer;
break;
}
// -- Simple heuristics --
// if the percentage of non-empty contents in check between the
// index
// 'next_check_pos' and 'check' is greater than some constant value
// (e.g. 0.9),
// new 'next_check_pos' index is written by 'check'.
if (1.0 * nonzero_num / (pos - nextCheckPos + 1) >= 0.95)
nextCheckPos = pos; // 从位置 next_check_pos 开始到 pos 间,如果已占用的空间在95%以上,下次插入节点时,直接从 pos 位置处开始查找
//used[begin] = true;
used.set(begin);
size = (size > begin + siblings.get(siblings.size() - 1).code + 1) ? size
: begin + siblings.get(siblings.size() - 1).code + 1;
for (int i = 0; i < siblings.size(); i++)
{
check[begin + siblings.get(i).code] = begin;
// System.out.println(this);
}
for (int i = 0; i < siblings.size(); i++)
{
List<Node> new_siblings = new ArrayList<Node>();
if (fetch(siblings.get(i), new_siblings) == 0) // 一个词的终止且不为其他词的前缀
{
base[begin + siblings.get(i).code] = (value != null) ? (-value[siblings
.get(i).left] - 1) : (-siblings.get(i).left - 1);
// System.out.println(this);
if (value != null && (-value[siblings.get(i).left] - 1) >= 0)
{
error_ = -2;
return 0;
}
progress++;
// if (progress_func_) (*progress_func_) (progress,
// keySize);
}
else
{
int h = insert(new_siblings, used); // dfs
base[begin + siblings.get(i).code] = h;
// System.out.println(this);
}
}
return begin;
} | java | private int insert(List<Node> siblings, BitSet used)
{
if (error_ < 0)
return 0;
int begin = 0;
int pos = Math.max(siblings.get(0).code + 1, nextCheckPos) - 1;
int nonzero_num = 0;
int first = 0;
if (allocSize <= pos)
resize(pos + 1);
outer:
// 此循环体的目标是找出满足base[begin + a1...an] == 0的n个空闲空间,a1...an是siblings中的n个节点
while (true)
{
pos++;
if (allocSize <= pos)
resize(pos + 1);
if (check[pos] != 0)
{
nonzero_num++;
continue;
}
else if (first == 0)
{
nextCheckPos = pos;
first = 1;
}
begin = pos - siblings.get(0).code; // 当前位置离第一个兄弟节点的距离
if (allocSize <= (begin + siblings.get(siblings.size() - 1).code))
{
resize(begin + siblings.get(siblings.size() - 1).code + Character.MAX_VALUE);
}
//if (used[begin])
// continue;
if(used.get(begin)){
continue;
}
for (int i = 1; i < siblings.size(); i++)
if (check[begin + siblings.get(i).code] != 0)
continue outer;
break;
}
// -- Simple heuristics --
// if the percentage of non-empty contents in check between the
// index
// 'next_check_pos' and 'check' is greater than some constant value
// (e.g. 0.9),
// new 'next_check_pos' index is written by 'check'.
if (1.0 * nonzero_num / (pos - nextCheckPos + 1) >= 0.95)
nextCheckPos = pos; // 从位置 next_check_pos 开始到 pos 间,如果已占用的空间在95%以上,下次插入节点时,直接从 pos 位置处开始查找
//used[begin] = true;
used.set(begin);
size = (size > begin + siblings.get(siblings.size() - 1).code + 1) ? size
: begin + siblings.get(siblings.size() - 1).code + 1;
for (int i = 0; i < siblings.size(); i++)
{
check[begin + siblings.get(i).code] = begin;
// System.out.println(this);
}
for (int i = 0; i < siblings.size(); i++)
{
List<Node> new_siblings = new ArrayList<Node>();
if (fetch(siblings.get(i), new_siblings) == 0) // 一个词的终止且不为其他词的前缀
{
base[begin + siblings.get(i).code] = (value != null) ? (-value[siblings
.get(i).left] - 1) : (-siblings.get(i).left - 1);
// System.out.println(this);
if (value != null && (-value[siblings.get(i).left] - 1) >= 0)
{
error_ = -2;
return 0;
}
progress++;
// if (progress_func_) (*progress_func_) (progress,
// keySize);
}
else
{
int h = insert(new_siblings, used); // dfs
base[begin + siblings.get(i).code] = h;
// System.out.println(this);
}
}
return begin;
} | [
"private",
"int",
"insert",
"(",
"List",
"<",
"Node",
">",
"siblings",
",",
"BitSet",
"used",
")",
"{",
"if",
"(",
"error_",
"<",
"0",
")",
"return",
"0",
";",
"int",
"begin",
"=",
"0",
";",
"int",
"pos",
"=",
"Math",
".",
"max",
"(",
"siblings",... | 插入节点
@param siblings 等待插入的兄弟节点
@return 插入位置 | [
"插入节点"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L161-L262 | train | inserts a new entry in the log. | [
30522,
2797,
20014,
19274,
1006,
2862,
1026,
13045,
1028,
9504,
1010,
9017,
3388,
2109,
1007,
1063,
2065,
1006,
7561,
1035,
1026,
1014,
1007,
2709,
1014,
1025,
20014,
4088,
1027,
1014,
1025,
20014,
13433,
2015,
1027,
8785,
1012,
4098,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.