repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpResponse.java | HttpResponse.body | public String body() throws HttpException {
try {
return HttpUtil.getString(bodyBytes(), this.charset, null == this.charsetFromResponse);
} catch (IOException e) {
throw new HttpException(e);
}
} | java | public String body() throws HttpException {
try {
return HttpUtil.getString(bodyBytes(), this.charset, null == this.charsetFromResponse);
} catch (IOException e) {
throw new HttpException(e);
}
} | [
"public",
"String",
"body",
"(",
")",
"throws",
"HttpException",
"{",
"try",
"{",
"return",
"HttpUtil",
".",
"getString",
"(",
"bodyBytes",
"(",
")",
",",
"this",
".",
"charset",
",",
"null",
"==",
"this",
".",
"charsetFromResponse",
")",
";",
"}",
"catc... | 获取响应主体
@return String
@throws HttpException 包装IO异常 | [
"获取响应主体"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpResponse.java#L216-L222 | train | Returns the body of the response as a String. | [
30522,
2270,
5164,
2303,
1006,
1007,
11618,
8299,
10288,
24422,
1063,
3046,
1063,
2709,
8299,
21823,
2140,
1012,
4152,
18886,
3070,
1006,
2303,
3762,
4570,
1006,
1007,
1010,
2023,
30524,
19701,
1027,
1027,
2023,
1012,
25869,
13462,
19699,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/EventSerializer.java | EventSerializer.isEvent | public static boolean isEvent(Buffer buffer, Class<?> eventClass) throws IOException {
return !buffer.isBuffer() && isEvent(buffer.getNioBufferReadable(), eventClass);
} | java | public static boolean isEvent(Buffer buffer, Class<?> eventClass) throws IOException {
return !buffer.isBuffer() && isEvent(buffer.getNioBufferReadable(), eventClass);
} | [
"public",
"static",
"boolean",
"isEvent",
"(",
"Buffer",
"buffer",
",",
"Class",
"<",
"?",
">",
"eventClass",
")",
"throws",
"IOException",
"{",
"return",
"!",
"buffer",
".",
"isBuffer",
"(",
")",
"&&",
"isEvent",
"(",
"buffer",
".",
"getNioBufferReadable",
... | Identifies whether the given buffer encodes the given event. Custom events are not supported.
@param buffer the buffer to peak into
@param eventClass the expected class of the event type
@return whether the event class of the <tt>buffer</tt> matches the given <tt>eventClass</tt> | [
"Identifies",
"whether",
"the",
"given",
"buffer",
"encodes",
"the",
"given",
"event",
".",
"Custom",
"events",
"are",
"not",
"supported",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/EventSerializer.java#L306-L308 | train | Checks if the given buffer is a buffer of the given class and is an instance of the given class. | [
30522,
2270,
10763,
22017,
20898,
2003,
18697,
3372,
1006,
17698,
17698,
1010,
2465,
1026,
1029,
1028,
2724,
26266,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
999,
17698,
1012,
2003,
8569,
12494,
1006,
1007,
1004,
1004,
2003,
18697,
3372,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/ReadOnlyHttp2Headers.java | ReadOnlyHttp2Headers.clientHeaders | public static ReadOnlyHttp2Headers clientHeaders(boolean validateHeaders,
AsciiString method, AsciiString path,
AsciiString scheme, AsciiString authority,
AsciiString... otherHeaders) {
return new ReadOnlyHttp2Headers(validateHeaders,
new AsciiString[] {
PseudoHeaderName.METHOD.value(), method, PseudoHeaderName.PATH.value(), path,
PseudoHeaderName.SCHEME.value(), scheme, PseudoHeaderName.AUTHORITY.value(), authority
},
otherHeaders);
} | java | public static ReadOnlyHttp2Headers clientHeaders(boolean validateHeaders,
AsciiString method, AsciiString path,
AsciiString scheme, AsciiString authority,
AsciiString... otherHeaders) {
return new ReadOnlyHttp2Headers(validateHeaders,
new AsciiString[] {
PseudoHeaderName.METHOD.value(), method, PseudoHeaderName.PATH.value(), path,
PseudoHeaderName.SCHEME.value(), scheme, PseudoHeaderName.AUTHORITY.value(), authority
},
otherHeaders);
} | [
"public",
"static",
"ReadOnlyHttp2Headers",
"clientHeaders",
"(",
"boolean",
"validateHeaders",
",",
"AsciiString",
"method",
",",
"AsciiString",
"path",
",",
"AsciiString",
"scheme",
",",
"AsciiString",
"authority",
",",
"AsciiString",
"...",
"otherHeaders",
")",
"{"... | Create a new read only representation of headers used by clients.
@param validateHeaders {@code true} will run validation on each header name/value pair to ensure protocol
compliance.
@param method The value for {@link PseudoHeaderName#METHOD}.
@param path The value for {@link PseudoHeaderName#PATH}.
@param scheme The value for {@link PseudoHeaderName#SCHEME}.
@param authority The value for {@link PseudoHeaderName#AUTHORITY}.
@param otherHeaders A an array of key:value pairs. Must not contain any
<a href="https://tools.ietf.org/html/rfc7540#section-8.1.2.1">pseudo headers</a>
or {@code null} names/values.
A copy will <strong>NOT</strong> be made of this array. If the contents of this array
may be modified externally you are responsible for passing in a copy.
@return a new read only representation of headers used by clients. | [
"Create",
"a",
"new",
"read",
"only",
"representation",
"of",
"headers",
"used",
"by",
"clients",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/ReadOnlyHttp2Headers.java#L83-L93 | train | Create a ReadOnlyHttp2Headers instance with the specified headers. | [
30522,
2270,
10763,
3191,
2239,
2135,
11039,
25856,
2475,
4974,
2545,
7396,
4974,
2545,
1006,
22017,
20898,
9398,
3686,
4974,
2545,
1010,
2004,
6895,
2923,
4892,
4118,
1010,
2004,
6895,
2923,
4892,
4130,
1010,
2004,
6895,
2923,
4892,
5679,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.putLongLittleEndian | public final void putLongLittleEndian(int index, long value) {
if (LITTLE_ENDIAN) {
putLong(index, value);
} else {
putLong(index, Long.reverseBytes(value));
}
} | java | public final void putLongLittleEndian(int index, long value) {
if (LITTLE_ENDIAN) {
putLong(index, value);
} else {
putLong(index, Long.reverseBytes(value));
}
} | [
"public",
"final",
"void",
"putLongLittleEndian",
"(",
"int",
"index",
",",
"long",
"value",
")",
"{",
"if",
"(",
"LITTLE_ENDIAN",
")",
"{",
"putLong",
"(",
"index",
",",
"value",
")",
";",
"}",
"else",
"{",
"putLong",
"(",
"index",
",",
"Long",
".",
... | Writes the given long value (64bit, 8 bytes) to the given position in little endian
byte order. This method's speed depends on the system's native byte order, and it
is possibly slower than {@link #putLong(int, long)}. For most cases (such as
transient storage in memory or serialization for I/O and network),
it suffices to know that the byte order in which the value is written is the same as the
one in which it is read, and {@link #putLong(int, long)} is the preferable choice.
@param index The position at which the value will be written.
@param value The long value to be written.
@throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment
size minus 8. | [
"Writes",
"the",
"given",
"long",
"value",
"(",
"64bit",
"8",
"bytes",
")",
"to",
"the",
"given",
"position",
"in",
"little",
"endian",
"byte",
"order",
".",
"This",
"method",
"s",
"speed",
"depends",
"on",
"the",
"system",
"s",
"native",
"byte",
"order"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L934-L940 | train | Puts a long value into the buffer at the given index. | [
30522,
2270,
2345,
11675,
2404,
10052,
15909,
9286,
10497,
2937,
1006,
20014,
5950,
1010,
2146,
3643,
1007,
1063,
2065,
1006,
2210,
1035,
2203,
2937,
1007,
1063,
2404,
10052,
1006,
5950,
1010,
3643,
1007,
1025,
1065,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.appendRange | public static Collection<Integer> appendRange(int start, int stop, int step, Collection<Integer> values) {
if (start < stop) {
step = Math.abs(step);
} else if (start > stop) {
step = -Math.abs(step);
} else {// start == end
values.add(start);
return values;
}
for (int i = start; (step > 0) ? i <= stop : i >= stop; i += step) {
values.add(i);
}
return values;
} | java | public static Collection<Integer> appendRange(int start, int stop, int step, Collection<Integer> values) {
if (start < stop) {
step = Math.abs(step);
} else if (start > stop) {
step = -Math.abs(step);
} else {// start == end
values.add(start);
return values;
}
for (int i = start; (step > 0) ? i <= stop : i >= stop; i += step) {
values.add(i);
}
return values;
} | [
"public",
"static",
"Collection",
"<",
"Integer",
">",
"appendRange",
"(",
"int",
"start",
",",
"int",
"stop",
",",
"int",
"step",
",",
"Collection",
"<",
"Integer",
">",
"values",
")",
"{",
"if",
"(",
"start",
"<",
"stop",
")",
"{",
"step",
"=",
"Ma... | 将给定范围内的整数添加到已有集合中
@param start 开始(包含)
@param stop 结束(包含)
@param step 步进
@param values 集合
@return 集合 | [
"将给定范围内的整数添加到已有集合中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L1356-L1370 | train | Appends the range of integer values to the given collection of integers. | [
30522,
2270,
10763,
3074,
1026,
16109,
1028,
10439,
19524,
15465,
1006,
20014,
2707,
1010,
20014,
2644,
1010,
20014,
3357,
1010,
3074,
1026,
16109,
1028,
5300,
1007,
1063,
2065,
1006,
2707,
1026,
2644,
1007,
1063,
3357,
1027,
8785,
1012,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java | Scheduler.updatePattern | public Scheduler updatePattern(String id, CronPattern pattern) {
this.taskTable.updatePattern(id, pattern);
return this;
} | java | public Scheduler updatePattern(String id, CronPattern pattern) {
this.taskTable.updatePattern(id, pattern);
return this;
} | [
"public",
"Scheduler",
"updatePattern",
"(",
"String",
"id",
",",
"CronPattern",
"pattern",
")",
"{",
"this",
".",
"taskTable",
".",
"updatePattern",
"(",
"id",
",",
"pattern",
")",
";",
"return",
"this",
";",
"}"
] | 更新Task执行的时间规则
@param id Task的ID
@param pattern {@link CronPattern}
@return this
@since 4.0.10 | [
"更新Task执行的时间规则"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java#L279-L282 | train | Updates an existing CronPattern. | [
30522,
2270,
6134,
2099,
10651,
4502,
12079,
2078,
1006,
5164,
8909,
1010,
13675,
2239,
4502,
12079,
2078,
5418,
1007,
1063,
2023,
1012,
4708,
10880,
1012,
10651,
4502,
12079,
2078,
1006,
8909,
1010,
5418,
1007,
1025,
2709,
2023,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/nr/TranslatedPersonDictionary.java | TranslatedPersonDictionary.containsKey | public static boolean containsKey(String key, int length)
{
if (!trie.containsKey(key)) return false;
return key.length() >= length;
} | java | public static boolean containsKey(String key, int length)
{
if (!trie.containsKey(key)) return false;
return key.length() >= length;
} | [
"public",
"static",
"boolean",
"containsKey",
"(",
"String",
"key",
",",
"int",
"length",
")",
"{",
"if",
"(",
"!",
"trie",
".",
"containsKey",
"(",
"key",
")",
")",
"return",
"false",
";",
"return",
"key",
".",
"length",
"(",
")",
">=",
"length",
";... | 时报包含key,且key至少长length
@param key
@param length
@return | [
"时报包含key,且key至少长length"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/nr/TranslatedPersonDictionary.java#L123-L127 | train | Check if a key is present in the trie. | [
30522,
2270,
10763,
22017,
20898,
3397,
14839,
1006,
5164,
3145,
1010,
20014,
3091,
1007,
1063,
2065,
1006,
999,
13012,
2063,
1012,
3397,
14839,
1006,
3145,
1007,
1007,
2709,
6270,
1025,
2709,
3145,
1012,
3091,
1006,
1007,
1028,
1027,
3091,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/clusterframework/BootstrapTools.java | BootstrapTools.updateTmpDirectoriesInConfiguration | public static void updateTmpDirectoriesInConfiguration(
Configuration configuration,
@Nullable String defaultDirs) {
if (configuration.contains(CoreOptions.TMP_DIRS)) {
LOG.info("Overriding Fink's temporary file directories with those " +
"specified in the Flink config: {}", configuration.getValue(CoreOptions.TMP_DIRS));
} else if (defaultDirs != null) {
LOG.info("Setting directories for temporary files to: {}", defaultDirs);
configuration.setString(CoreOptions.TMP_DIRS, defaultDirs);
configuration.setBoolean(USE_LOCAL_DEFAULT_TMP_DIRS, true);
}
} | java | public static void updateTmpDirectoriesInConfiguration(
Configuration configuration,
@Nullable String defaultDirs) {
if (configuration.contains(CoreOptions.TMP_DIRS)) {
LOG.info("Overriding Fink's temporary file directories with those " +
"specified in the Flink config: {}", configuration.getValue(CoreOptions.TMP_DIRS));
} else if (defaultDirs != null) {
LOG.info("Setting directories for temporary files to: {}", defaultDirs);
configuration.setString(CoreOptions.TMP_DIRS, defaultDirs);
configuration.setBoolean(USE_LOCAL_DEFAULT_TMP_DIRS, true);
}
} | [
"public",
"static",
"void",
"updateTmpDirectoriesInConfiguration",
"(",
"Configuration",
"configuration",
",",
"@",
"Nullable",
"String",
"defaultDirs",
")",
"{",
"if",
"(",
"configuration",
".",
"contains",
"(",
"CoreOptions",
".",
"TMP_DIRS",
")",
")",
"{",
"LOG... | Set temporary configuration directories if necessary.
@param configuration flink config to patch
@param defaultDirs in case no tmp directories is set, next directories will be applied | [
"Set",
"temporary",
"configuration",
"directories",
"if",
"necessary",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java#L523-L534 | train | Updates the temporary directories specified in the Flink configuration. | [
30522,
2270,
10763,
11675,
10651,
21246,
17299,
7442,
16761,
3111,
2378,
8663,
8873,
27390,
3370,
1006,
9563,
9563,
1010,
1030,
19701,
3085,
5164,
12398,
4305,
2869,
1007,
1063,
2065,
1006,
9563,
1012,
3397,
1006,
4563,
7361,
9285,
1012,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java | Matrix.getMatrix | public Matrix getMatrix(int[] r, int j0, int j1)
{
Matrix X = new Matrix(r.length, j1 - j0 + 1);
double[][] B = X.getArray();
try
{
for (int i = 0; i < r.length; i++)
{
for (int j = j0; j <= j1; j++)
{
B[i][j - j0] = A[r[i]][j];
}
}
}
catch (ArrayIndexOutOfBoundsException e)
{
throw new ArrayIndexOutOfBoundsException("Submatrix indices");
}
return X;
} | java | public Matrix getMatrix(int[] r, int j0, int j1)
{
Matrix X = new Matrix(r.length, j1 - j0 + 1);
double[][] B = X.getArray();
try
{
for (int i = 0; i < r.length; i++)
{
for (int j = j0; j <= j1; j++)
{
B[i][j - j0] = A[r[i]][j];
}
}
}
catch (ArrayIndexOutOfBoundsException e)
{
throw new ArrayIndexOutOfBoundsException("Submatrix indices");
}
return X;
} | [
"public",
"Matrix",
"getMatrix",
"(",
"int",
"[",
"]",
"r",
",",
"int",
"j0",
",",
"int",
"j1",
")",
"{",
"Matrix",
"X",
"=",
"new",
"Matrix",
"(",
"r",
".",
"length",
",",
"j1",
"-",
"j0",
"+",
"1",
")",
";",
"double",
"[",
"]",
"[",
"]",
... | Get a submatrix.
@param r Array of row indices.
@param j0 Initial column index
@param j1 Final column index
@return A(r(:), j0:j1)
@throws ArrayIndexOutOfBoundsException Submatrix indices | [
"Get",
"a",
"submatrix",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L454-L473 | train | Get a matrix of the 2D matrix of the specified indices. | [
30522,
2270,
8185,
2131,
18900,
17682,
1006,
20014,
1031,
1033,
1054,
1010,
20014,
1046,
2692,
1010,
20014,
1046,
2487,
1007,
1063,
8185,
1060,
1027,
2047,
8185,
1006,
1054,
1012,
3091,
1010,
1046,
2487,
1011,
1046,
2692,
1009,
1015,
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-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.fromTuple2DataSet | public static <K> Graph<K, NullValue, NullValue> fromTuple2DataSet(DataSet<Tuple2<K, K>> edges,
ExecutionEnvironment context) {
DataSet<Edge<K, NullValue>> edgeDataSet = edges
.map(new Tuple2ToEdgeMap<>())
.name("To Edge");
return fromDataSet(edgeDataSet, context);
} | java | public static <K> Graph<K, NullValue, NullValue> fromTuple2DataSet(DataSet<Tuple2<K, K>> edges,
ExecutionEnvironment context) {
DataSet<Edge<K, NullValue>> edgeDataSet = edges
.map(new Tuple2ToEdgeMap<>())
.name("To Edge");
return fromDataSet(edgeDataSet, context);
} | [
"public",
"static",
"<",
"K",
">",
"Graph",
"<",
"K",
",",
"NullValue",
",",
"NullValue",
">",
"fromTuple2DataSet",
"(",
"DataSet",
"<",
"Tuple2",
"<",
"K",
",",
"K",
">",
">",
"edges",
",",
"ExecutionEnvironment",
"context",
")",
"{",
"DataSet",
"<",
... | Creates a graph from a DataSet of Tuple2 objects for edges.
Each Tuple2 will become one Edge, where the source ID will be the first field of the Tuple2
and the target ID will be the second field of the Tuple2.
<p>Edge value types and Vertex values types will be set to NullValue.
@param edges a DataSet of Tuple2.
@param context the flink execution environment.
@return the newly created graph. | [
"Creates",
"a",
"graph",
"from",
"a",
"DataSet",
"of",
"Tuple2",
"objects",
"for",
"edges",
".",
"Each",
"Tuple2",
"will",
"become",
"one",
"Edge",
"where",
"the",
"source",
"ID",
"will",
"be",
"the",
"first",
"field",
"of",
"the",
"Tuple2",
"and",
"the"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L342-L350 | train | Creates a graph from a DataSet of Tuple2 objects. | [
30522,
2270,
10763,
1026,
1047,
1028,
10629,
1026,
1047,
1010,
19701,
10175,
5657,
1010,
19701,
10175,
5657,
1028,
2013,
8525,
10814,
2475,
2850,
18260,
2102,
1006,
2951,
13462,
1026,
10722,
10814,
2475,
1026,
1047,
1010,
1047,
1028,
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/io/resource/ResourceUtil.java | ResourceUtil.readStr | public static String readStr(String resource, Charset charset) {
return getResourceObj(resource).readStr(charset);
} | java | public static String readStr(String resource, Charset charset) {
return getResourceObj(resource).readStr(charset);
} | [
"public",
"static",
"String",
"readStr",
"(",
"String",
"resource",
",",
"Charset",
"charset",
")",
"{",
"return",
"getResourceObj",
"(",
"resource",
")",
".",
"readStr",
"(",
"charset",
")",
";",
"}"
] | 读取Classpath下的资源为字符串
@param resource 资源路径,使用相对ClassPath的路径
@param charset 编码
@return 资源内容
@since 3.1.1 | [
"读取Classpath下的资源为字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java#L47-L49 | train | Reads a string from the specified resource using the specified encoding. | [
30522,
2270,
10763,
5164,
9631,
16344,
1006,
5164,
7692,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2709,
2131,
6072,
8162,
3401,
16429,
3501,
1006,
7692,
1007,
1012,
9631,
16344,
1006,
25869,
13462,
1007,
1025,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/instance/HardwareDescription.java | HardwareDescription.extractFromSystem | public static HardwareDescription extractFromSystem(long managedMemory) {
final int numberOfCPUCores = Hardware.getNumberCPUCores();
final long sizeOfJvmHeap = Runtime.getRuntime().maxMemory();
final long sizeOfPhysicalMemory = Hardware.getSizeOfPhysicalMemory();
return new HardwareDescription(numberOfCPUCores, sizeOfPhysicalMemory, sizeOfJvmHeap, managedMemory);
} | java | public static HardwareDescription extractFromSystem(long managedMemory) {
final int numberOfCPUCores = Hardware.getNumberCPUCores();
final long sizeOfJvmHeap = Runtime.getRuntime().maxMemory();
final long sizeOfPhysicalMemory = Hardware.getSizeOfPhysicalMemory();
return new HardwareDescription(numberOfCPUCores, sizeOfPhysicalMemory, sizeOfJvmHeap, managedMemory);
} | [
"public",
"static",
"HardwareDescription",
"extractFromSystem",
"(",
"long",
"managedMemory",
")",
"{",
"final",
"int",
"numberOfCPUCores",
"=",
"Hardware",
".",
"getNumberCPUCores",
"(",
")",
";",
"final",
"long",
"sizeOfJvmHeap",
"=",
"Runtime",
".",
"getRuntime",... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/HardwareDescription.java#L151-L157 | train | Extract hardware description from system memory. | [
30522,
2270,
10763,
8051,
6155,
23235,
3258,
14817,
19699,
22225,
27268,
6633,
1006,
2146,
3266,
4168,
5302,
2854,
1007,
1063,
2345,
20014,
2193,
11253,
21906,
14194,
16610,
1027,
8051,
1012,
2131,
19172,
5677,
21906,
14194,
16610,
1006,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpBase.java | HttpBase.header | public T header(String name, String value, boolean isOverride) {
if(null != name && null != value){
final List<String> values = headers.get(name.trim());
if(isOverride || CollectionUtil.isEmpty(values)) {
final ArrayList<String> valueList = new ArrayList<String>();
valueList.add(value);
headers.put(name.trim(), valueList);
}else {
values.add(value.trim());
}
}
return (T) this;
} | java | public T header(String name, String value, boolean isOverride) {
if(null != name && null != value){
final List<String> values = headers.get(name.trim());
if(isOverride || CollectionUtil.isEmpty(values)) {
final ArrayList<String> valueList = new ArrayList<String>();
valueList.add(value);
headers.put(name.trim(), valueList);
}else {
values.add(value.trim());
}
}
return (T) this;
} | [
"public",
"T",
"header",
"(",
"String",
"name",
",",
"String",
"value",
",",
"boolean",
"isOverride",
")",
"{",
"if",
"(",
"null",
"!=",
"name",
"&&",
"null",
"!=",
"value",
")",
"{",
"final",
"List",
"<",
"String",
">",
"values",
"=",
"headers",
"."... | 设置一个header<br>
如果覆盖模式,则替换之前的值,否则加入到值列表中
@param name Header名
@param value Header值
@param isOverride 是否覆盖已有值
@return T 本身 | [
"设置一个header<br",
">",
"如果覆盖模式,则替换之前的值,否则加入到值列表中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpBase.java#L89-L101 | train | Adds a header to the response. | [
30522,
2270,
1056,
20346,
1006,
5164,
2171,
1010,
5164,
3643,
1010,
22017,
20898,
11163,
6299,
15637,
1007,
1063,
2065,
1006,
19701,
999,
1027,
2171,
1004,
1004,
19701,
999,
1027,
3643,
1007,
1063,
2345,
2862,
1026,
5164,
1028,
5300,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java | SoapClient.setMethod | public SoapClient setMethod(Name name, Map<String, Object> params, boolean useMethodPrefix) {
return setMethod(new QName(name.getURI(), name.getLocalName(), name.getPrefix()), params, useMethodPrefix);
} | java | public SoapClient setMethod(Name name, Map<String, Object> params, boolean useMethodPrefix) {
return setMethod(new QName(name.getURI(), name.getLocalName(), name.getPrefix()), params, useMethodPrefix);
} | [
"public",
"SoapClient",
"setMethod",
"(",
"Name",
"name",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
",",
"boolean",
"useMethodPrefix",
")",
"{",
"return",
"setMethod",
"(",
"new",
"QName",
"(",
"name",
".",
"getURI",
"(",
")",
",",
"name",... | 设置请求方法
@param name 方法名及其命名空间
@param params 参数
@param useMethodPrefix 是否使用方法的命名空间前缀
@return this | [
"设置请求方法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L224-L226 | train | Sets the SOAP method. | [
30522,
2270,
7815,
20464,
11638,
2275,
11368,
6806,
2094,
1006,
2171,
2171,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
11498,
5244,
1010,
22017,
20898,
2224,
11368,
6806,
18927,
2890,
8873,
2595,
1007,
1063,
2709,
2275,
11368,
6806,
2094,
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/jobmaster/JobMaster.java | JobMaster.startJobExecution | private Acknowledge startJobExecution(JobMasterId newJobMasterId) throws Exception {
validateRunsInMainThread();
checkNotNull(newJobMasterId, "The new JobMasterId must not be null.");
if (Objects.equals(getFencingToken(), newJobMasterId)) {
log.info("Already started the job execution with JobMasterId {}.", newJobMasterId);
return Acknowledge.get();
}
setNewFencingToken(newJobMasterId);
startJobMasterServices();
log.info("Starting execution of job {} ({}) under job master id {}.", jobGraph.getName(), jobGraph.getJobID(), newJobMasterId);
resetAndScheduleExecutionGraph();
return Acknowledge.get();
} | java | private Acknowledge startJobExecution(JobMasterId newJobMasterId) throws Exception {
validateRunsInMainThread();
checkNotNull(newJobMasterId, "The new JobMasterId must not be null.");
if (Objects.equals(getFencingToken(), newJobMasterId)) {
log.info("Already started the job execution with JobMasterId {}.", newJobMasterId);
return Acknowledge.get();
}
setNewFencingToken(newJobMasterId);
startJobMasterServices();
log.info("Starting execution of job {} ({}) under job master id {}.", jobGraph.getName(), jobGraph.getJobID(), newJobMasterId);
resetAndScheduleExecutionGraph();
return Acknowledge.get();
} | [
"private",
"Acknowledge",
"startJobExecution",
"(",
"JobMasterId",
"newJobMasterId",
")",
"throws",
"Exception",
"{",
"validateRunsInMainThread",
"(",
")",
";",
"checkNotNull",
"(",
"newJobMasterId",
",",
"\"The new JobMasterId must not be null.\"",
")",
";",
"if",
"(",
... | -- job starting and stopping ----------------------------------------------------------------- | [
"--",
"job",
"starting",
"and",
"stopping",
"-----------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java#L919-L940 | train | Start the execution of the job. | [
30522,
2797,
13399,
2707,
5558,
4783,
2595,
8586,
13700,
1006,
3105,
8706,
3593,
2047,
5558,
25526,
24268,
3593,
1007,
11618,
6453,
1063,
9398,
24932,
4609,
11493,
24238,
2705,
16416,
2094,
30524,
1000,
1996,
2047,
3105,
8706,
3593,
2442,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java | TrafficCounter.readTimeToWait | @Deprecated
public long readTimeToWait(final long size, final long limitTraffic, final long maxTime) {
return readTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano());
} | java | @Deprecated
public long readTimeToWait(final long size, final long limitTraffic, final long maxTime) {
return readTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano());
} | [
"@",
"Deprecated",
"public",
"long",
"readTimeToWait",
"(",
"final",
"long",
"size",
",",
"final",
"long",
"limitTraffic",
",",
"final",
"long",
"maxTime",
")",
"{",
"return",
"readTimeToWait",
"(",
"size",
",",
"limitTraffic",
",",
"maxTime",
",",
"milliSecon... | Returns the time to wait (if any) for the given length message, using the given limitTraffic and the max wait
time.
@param size
the recv size
@param limitTraffic
the traffic limit in bytes per second.
@param maxTime
the max time in ms to wait in case of excess of traffic.
@return the current time to wait (in ms) if needed for Read operation. | [
"Returns",
"the",
"time",
"to",
"wait",
"(",
"if",
"any",
")",
"for",
"the",
"given",
"length",
"message",
"using",
"the",
"given",
"limitTraffic",
"and",
"the",
"max",
"wait",
"time",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java#L480-L483 | train | Read time to wait. | [
30522,
1030,
2139,
28139,
12921,
2270,
2146,
3191,
7292,
18790,
4886,
2102,
1006,
2345,
2146,
2946,
1010,
2345,
2146,
5787,
6494,
26989,
2278,
1010,
2345,
2146,
4098,
7292,
1007,
1063,
2709,
3191,
7292,
18790,
4886,
2102,
1006,
2946,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java | IterUtil.toList | public static <E> List<E> toList(Iterable<E> iter) {
return toList(iter.iterator());
} | java | public static <E> List<E> toList(Iterable<E> iter) {
return toList(iter.iterator());
} | [
"public",
"static",
"<",
"E",
">",
"List",
"<",
"E",
">",
"toList",
"(",
"Iterable",
"<",
"E",
">",
"iter",
")",
"{",
"return",
"toList",
"(",
"iter",
".",
"iterator",
"(",
")",
")",
";",
"}"
] | Iterator转List<br>
不判断,直接生成新的List
@param <E> 元素类型
@param iter {@link Iterator}
@return List
@since 4.0.6 | [
"Iterator转List<br",
">",
"不判断,直接生成新的List"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L440-L442 | train | Returns a list that contains all the elements in the given iterable. | [
30522,
2270,
10763,
1026,
1041,
1028,
2862,
1026,
1041,
1028,
2000,
9863,
1006,
2009,
6906,
3468,
1026,
1041,
1028,
2009,
2121,
1007,
1063,
2709,
2000,
9863,
1006,
2009,
2121,
1012,
2009,
6906,
4263,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.java | BuildInfo.generateBuildProperties | @TaskAction
public void generateBuildProperties() {
try {
new BuildPropertiesWriter(new File(getDestinationDir(),
"build-info.properties")).writeBuildProperties(new ProjectDetails(
this.properties.getGroup(),
(this.properties.getArtifact() != null)
? this.properties.getArtifact() : "unspecified",
this.properties.getVersion(), this.properties.getName(),
this.properties.getTime(),
coerceToStringValues(this.properties.getAdditional())));
}
catch (IOException ex) {
throw new TaskExecutionException(this, ex);
}
} | java | @TaskAction
public void generateBuildProperties() {
try {
new BuildPropertiesWriter(new File(getDestinationDir(),
"build-info.properties")).writeBuildProperties(new ProjectDetails(
this.properties.getGroup(),
(this.properties.getArtifact() != null)
? this.properties.getArtifact() : "unspecified",
this.properties.getVersion(), this.properties.getName(),
this.properties.getTime(),
coerceToStringValues(this.properties.getAdditional())));
}
catch (IOException ex) {
throw new TaskExecutionException(this, ex);
}
} | [
"@",
"TaskAction",
"public",
"void",
"generateBuildProperties",
"(",
")",
"{",
"try",
"{",
"new",
"BuildPropertiesWriter",
"(",
"new",
"File",
"(",
"getDestinationDir",
"(",
")",
",",
"\"build-info.properties\"",
")",
")",
".",
"writeBuildProperties",
"(",
"new",
... | Generates the {@code build-info.properties} file in the configured
{@link #setDestinationDir(File) destination}. | [
"Generates",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.java#L53-L68 | train | Generate build - info. properties file. | [
30522,
1030,
4708,
18908,
3258,
2270,
11675,
9699,
8569,
4014,
18927,
18981,
8743,
3111,
1006,
1007,
1063,
3046,
1063,
2047,
3857,
21572,
4842,
7368,
15994,
1006,
2047,
5371,
1006,
2131,
6155,
13770,
3508,
4305,
2099,
1006,
1007,
1010,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java | NetUtil.getLocalhost | public static InetAddress getLocalhost() {
InetAddress candidateAddress = null;
NetworkInterface iface;
InetAddress inetAddr;
try {
for (Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); ifaces.hasMoreElements();) {
iface = ifaces.nextElement();
for (Enumeration<InetAddress> inetAddrs = iface.getInetAddresses(); inetAddrs.hasMoreElements();) {
inetAddr = inetAddrs.nextElement();
if (false == inetAddr.isLoopbackAddress()) {
if (inetAddr.isSiteLocalAddress()) {
return inetAddr;
} else if (null == candidateAddress) {
// 非site-local地址做为候选地址返回
candidateAddress = inetAddr;
}
}
}
}
} catch (SocketException e) {
// ignore socket exception, and return null;
}
if (null == candidateAddress) {
try {
candidateAddress = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
// ignore
}
}
return candidateAddress;
} | java | public static InetAddress getLocalhost() {
InetAddress candidateAddress = null;
NetworkInterface iface;
InetAddress inetAddr;
try {
for (Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); ifaces.hasMoreElements();) {
iface = ifaces.nextElement();
for (Enumeration<InetAddress> inetAddrs = iface.getInetAddresses(); inetAddrs.hasMoreElements();) {
inetAddr = inetAddrs.nextElement();
if (false == inetAddr.isLoopbackAddress()) {
if (inetAddr.isSiteLocalAddress()) {
return inetAddr;
} else if (null == candidateAddress) {
// 非site-local地址做为候选地址返回
candidateAddress = inetAddr;
}
}
}
}
} catch (SocketException e) {
// ignore socket exception, and return null;
}
if (null == candidateAddress) {
try {
candidateAddress = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
// ignore
}
}
return candidateAddress;
} | [
"public",
"static",
"InetAddress",
"getLocalhost",
"(",
")",
"{",
"InetAddress",
"candidateAddress",
"=",
"null",
";",
"NetworkInterface",
"iface",
";",
"InetAddress",
"inetAddr",
";",
"try",
"{",
"for",
"(",
"Enumeration",
"<",
"NetworkInterface",
">",
"ifaces",
... | 获取本机网卡IP地址,这个地址为所有网卡中非回路地址的第一个<br>
如果获取失败调用 {@link InetAddress#getLocalHost()}方法获取。<br>
此方法不会抛出异常,获取失败将返回<code>null</code><br>
参考:http://stackoverflow.com/questions/9481865/getting-the-ip-address-of-the-current-machine-using-java
@return 本机网卡IP地址,获取失败返回<code>null</code>
@since 3.0.1 | [
"获取本机网卡IP地址,这个地址为所有网卡中非回路地址的第一个<br",
">",
"如果获取失败调用",
"{",
"@link",
"InetAddress#getLocalHost",
"()",
"}",
"方法获取。<br",
">",
"此方法不会抛出异常,获取失败将返回<code",
">",
"null<",
"/",
"code",
">",
"<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L372-L404 | train | Gets the local host. | [
30522,
2270,
10763,
1999,
12928,
14141,
8303,
2131,
4135,
9289,
15006,
2102,
1006,
1007,
1063,
1999,
12928,
14141,
8303,
4018,
4215,
16200,
4757,
1027,
19701,
1025,
2897,
18447,
2121,
12172,
2065,
10732,
1025,
1999,
12928,
14141,
8303,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getReader | public static BufferedReader getReader(File file, Charset charset) throws IORuntimeException {
return IoUtil.getReader(getInputStream(file), charset);
} | java | public static BufferedReader getReader(File file, Charset charset) throws IORuntimeException {
return IoUtil.getReader(getInputStream(file), charset);
} | [
"public",
"static",
"BufferedReader",
"getReader",
"(",
"File",
"file",
",",
"Charset",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"IoUtil",
".",
"getReader",
"(",
"getInputStream",
"(",
"file",
")",
",",
"charset",
")",
";",
"}"
] | 获得一个文件读取器
@param file 文件
@param charset 字符集
@return BufferedReader对象
@throws IORuntimeException IO异常 | [
"获得一个文件读取器"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2005-L2007 | train | Returns a buffered reader for the specified file. | [
30522,
2270,
10763,
17698,
2098,
16416,
4063,
2131,
16416,
4063,
1006,
5371,
5371,
1010,
25869,
13462,
25869,
13462,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
22834,
21823,
2140,
1012,
2131,
16416,
4063,
1006,
2131,
2378,
187... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/TupleTypeInfo.java | TupleTypeInfo.getBasicTupleTypeInfo | @PublicEvolving
public static <X extends Tuple> TupleTypeInfo<X> getBasicTupleTypeInfo(Class<?>... basicTypes) {
if (basicTypes == null || basicTypes.length == 0) {
throw new IllegalArgumentException();
}
TypeInformation<?>[] infos = new TypeInformation<?>[basicTypes.length];
for (int i = 0; i < infos.length; i++) {
Class<?> type = basicTypes[i];
if (type == null) {
throw new IllegalArgumentException("Type at position " + i + " is null.");
}
TypeInformation<?> info = BasicTypeInfo.getInfoFor(type);
if (info == null) {
throw new IllegalArgumentException("Type at position " + i + " is not a basic type.");
}
infos[i] = info;
}
@SuppressWarnings("unchecked")
TupleTypeInfo<X> tupleInfo = (TupleTypeInfo<X>) new TupleTypeInfo<Tuple>(infos);
return tupleInfo;
} | java | @PublicEvolving
public static <X extends Tuple> TupleTypeInfo<X> getBasicTupleTypeInfo(Class<?>... basicTypes) {
if (basicTypes == null || basicTypes.length == 0) {
throw new IllegalArgumentException();
}
TypeInformation<?>[] infos = new TypeInformation<?>[basicTypes.length];
for (int i = 0; i < infos.length; i++) {
Class<?> type = basicTypes[i];
if (type == null) {
throw new IllegalArgumentException("Type at position " + i + " is null.");
}
TypeInformation<?> info = BasicTypeInfo.getInfoFor(type);
if (info == null) {
throw new IllegalArgumentException("Type at position " + i + " is not a basic type.");
}
infos[i] = info;
}
@SuppressWarnings("unchecked")
TupleTypeInfo<X> tupleInfo = (TupleTypeInfo<X>) new TupleTypeInfo<Tuple>(infos);
return tupleInfo;
} | [
"@",
"PublicEvolving",
"public",
"static",
"<",
"X",
"extends",
"Tuple",
">",
"TupleTypeInfo",
"<",
"X",
">",
"getBasicTupleTypeInfo",
"(",
"Class",
"<",
"?",
">",
"...",
"basicTypes",
")",
"{",
"if",
"(",
"basicTypes",
"==",
"null",
"||",
"basicTypes",
".... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfo.java#L216-L239 | train | Gets the TupleTypeInfo for the given basic types. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
10763,
1026,
1060,
8908,
10722,
10814,
1028,
10722,
10814,
13874,
2378,
14876,
1026,
1060,
1028,
2131,
22083,
2594,
8525,
10814,
13874,
2378,
14876,
1006,
2465,
1026,
1029,
1028,
1012,
1012,
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-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/GenericMetricGroup.java | GenericMetricGroup.makeScopeComponents | private static String[] makeScopeComponents(AbstractMetricGroup parent, String name) {
if (parent != null) {
String[] parentComponents = parent.getScopeComponents();
if (parentComponents != null && parentComponents.length > 0) {
String[] parts = new String[parentComponents.length + 1];
System.arraycopy(parentComponents, 0, parts, 0, parentComponents.length);
parts[parts.length - 1] = name;
return parts;
}
}
return new String[] { name };
} | java | private static String[] makeScopeComponents(AbstractMetricGroup parent, String name) {
if (parent != null) {
String[] parentComponents = parent.getScopeComponents();
if (parentComponents != null && parentComponents.length > 0) {
String[] parts = new String[parentComponents.length + 1];
System.arraycopy(parentComponents, 0, parts, 0, parentComponents.length);
parts[parts.length - 1] = name;
return parts;
}
}
return new String[] { name };
} | [
"private",
"static",
"String",
"[",
"]",
"makeScopeComponents",
"(",
"AbstractMetricGroup",
"parent",
",",
"String",
"name",
")",
"{",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"String",
"[",
"]",
"parentComponents",
"=",
"parent",
".",
"getScopeComponents"... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/GenericMetricGroup.java#L47-L58 | train | Make a scope component array for the given metric group. | [
30522,
2797,
10763,
5164,
1031,
1033,
3084,
16186,
9006,
29513,
7666,
1006,
10061,
12589,
17058,
6687,
1010,
5164,
2171,
1007,
1063,
2065,
1006,
6687,
999,
1027,
19701,
1007,
1063,
5164,
1031,
1033,
6687,
9006,
29513,
7666,
1027,
6687,
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-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBStateBackend.java | RocksDBStateBackend.createKeyedStateBackend | @Override
public <K> AbstractKeyedStateBackend<K> createKeyedStateBackend(
Environment env,
JobID jobID,
String operatorIdentifier,
TypeSerializer<K> keySerializer,
int numberOfKeyGroups,
KeyGroupRange keyGroupRange,
TaskKvStateRegistry kvStateRegistry,
TtlTimeProvider ttlTimeProvider,
MetricGroup metricGroup,
@Nonnull Collection<KeyedStateHandle> stateHandles,
CloseableRegistry cancelStreamRegistry) throws IOException {
// first, make sure that the RocksDB JNI library is loaded
// we do this explicitly here to have better error handling
String tempDir = env.getTaskManagerInfo().getTmpDirectories()[0];
ensureRocksDBIsLoaded(tempDir);
// replace all characters that are not legal for filenames with underscore
String fileCompatibleIdentifier = operatorIdentifier.replaceAll("[^a-zA-Z0-9\\-]", "_");
lazyInitializeForJob(env, fileCompatibleIdentifier);
File instanceBasePath = new File(
getNextStoragePath(),
"job_" + jobId + "_op_" + fileCompatibleIdentifier + "_uuid_" + UUID.randomUUID());
LocalRecoveryConfig localRecoveryConfig =
env.getTaskStateManager().createLocalRecoveryConfig();
ExecutionConfig executionConfig = env.getExecutionConfig();
StreamCompressionDecorator keyGroupCompressionDecorator = getCompressionDecorator(executionConfig);
RocksDBKeyedStateBackendBuilder<K> builder = new RocksDBKeyedStateBackendBuilder<>(
operatorIdentifier,
env.getUserClassLoader(),
instanceBasePath,
getDbOptions(),
stateName -> getColumnOptions(),
kvStateRegistry,
keySerializer,
numberOfKeyGroups,
keyGroupRange,
executionConfig,
localRecoveryConfig,
priorityQueueStateType,
ttlTimeProvider,
metricGroup,
stateHandles,
keyGroupCompressionDecorator,
cancelStreamRegistry
).setEnableIncrementalCheckpointing(isIncrementalCheckpointsEnabled())
.setEnableTtlCompactionFilter(isTtlCompactionFilterEnabled())
.setNumberOfTransferingThreads(getNumberOfTransferingThreads())
.setNativeMetricOptions(getMemoryWatcherOptions());
return builder.build();
} | java | @Override
public <K> AbstractKeyedStateBackend<K> createKeyedStateBackend(
Environment env,
JobID jobID,
String operatorIdentifier,
TypeSerializer<K> keySerializer,
int numberOfKeyGroups,
KeyGroupRange keyGroupRange,
TaskKvStateRegistry kvStateRegistry,
TtlTimeProvider ttlTimeProvider,
MetricGroup metricGroup,
@Nonnull Collection<KeyedStateHandle> stateHandles,
CloseableRegistry cancelStreamRegistry) throws IOException {
// first, make sure that the RocksDB JNI library is loaded
// we do this explicitly here to have better error handling
String tempDir = env.getTaskManagerInfo().getTmpDirectories()[0];
ensureRocksDBIsLoaded(tempDir);
// replace all characters that are not legal for filenames with underscore
String fileCompatibleIdentifier = operatorIdentifier.replaceAll("[^a-zA-Z0-9\\-]", "_");
lazyInitializeForJob(env, fileCompatibleIdentifier);
File instanceBasePath = new File(
getNextStoragePath(),
"job_" + jobId + "_op_" + fileCompatibleIdentifier + "_uuid_" + UUID.randomUUID());
LocalRecoveryConfig localRecoveryConfig =
env.getTaskStateManager().createLocalRecoveryConfig();
ExecutionConfig executionConfig = env.getExecutionConfig();
StreamCompressionDecorator keyGroupCompressionDecorator = getCompressionDecorator(executionConfig);
RocksDBKeyedStateBackendBuilder<K> builder = new RocksDBKeyedStateBackendBuilder<>(
operatorIdentifier,
env.getUserClassLoader(),
instanceBasePath,
getDbOptions(),
stateName -> getColumnOptions(),
kvStateRegistry,
keySerializer,
numberOfKeyGroups,
keyGroupRange,
executionConfig,
localRecoveryConfig,
priorityQueueStateType,
ttlTimeProvider,
metricGroup,
stateHandles,
keyGroupCompressionDecorator,
cancelStreamRegistry
).setEnableIncrementalCheckpointing(isIncrementalCheckpointsEnabled())
.setEnableTtlCompactionFilter(isTtlCompactionFilterEnabled())
.setNumberOfTransferingThreads(getNumberOfTransferingThreads())
.setNativeMetricOptions(getMemoryWatcherOptions());
return builder.build();
} | [
"@",
"Override",
"public",
"<",
"K",
">",
"AbstractKeyedStateBackend",
"<",
"K",
">",
"createKeyedStateBackend",
"(",
"Environment",
"env",
",",
"JobID",
"jobID",
",",
"String",
"operatorIdentifier",
",",
"TypeSerializer",
"<",
"K",
">",
"keySerializer",
",",
"i... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBStateBackend.java#L465-L521 | train | Create a new instance of the underlying state backend. | [
30522,
1030,
2058,
15637,
2270,
1026,
1047,
1028,
10061,
14839,
2098,
9153,
2618,
5963,
10497,
1026,
1047,
1028,
3443,
14839,
2098,
9153,
2618,
5963,
10497,
1006,
4044,
4372,
2615,
1010,
3105,
3593,
3105,
3593,
1010,
5164,
6872,
5178,
16778... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java | CliFrontendParser.printCustomCliOptions | private static void printCustomCliOptions(
Collection<CustomCommandLine<?>> customCommandLines,
HelpFormatter formatter,
boolean runOptions) {
// prints options from all available command-line classes
for (CustomCommandLine cli: customCommandLines) {
formatter.setSyntaxPrefix(" Options for " + cli.getId() + " mode:");
Options customOpts = new Options();
cli.addGeneralOptions(customOpts);
if (runOptions) {
cli.addRunOptions(customOpts);
}
formatter.printHelp(" ", customOpts);
System.out.println();
}
} | java | private static void printCustomCliOptions(
Collection<CustomCommandLine<?>> customCommandLines,
HelpFormatter formatter,
boolean runOptions) {
// prints options from all available command-line classes
for (CustomCommandLine cli: customCommandLines) {
formatter.setSyntaxPrefix(" Options for " + cli.getId() + " mode:");
Options customOpts = new Options();
cli.addGeneralOptions(customOpts);
if (runOptions) {
cli.addRunOptions(customOpts);
}
formatter.printHelp(" ", customOpts);
System.out.println();
}
} | [
"private",
"static",
"void",
"printCustomCliOptions",
"(",
"Collection",
"<",
"CustomCommandLine",
"<",
"?",
">",
">",
"customCommandLines",
",",
"HelpFormatter",
"formatter",
",",
"boolean",
"runOptions",
")",
"{",
"// prints options from all available command-line classes... | Prints custom cli options.
@param formatter The formatter to use for printing
@param runOptions True if the run options should be printed, False to print only general options | [
"Prints",
"custom",
"cli",
"options",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontendParser.java#L386-L401 | train | Prints the custom CLI options from all available command - line classes. | [
30522,
2797,
10763,
11675,
6140,
7874,
20389,
20464,
3695,
16790,
2015,
1006,
3074,
1026,
7661,
9006,
2386,
19422,
3170,
1026,
1029,
1028,
1028,
7661,
9006,
2386,
19422,
10586,
1010,
2393,
14192,
20097,
4289,
3334,
1010,
22017,
20898,
2448,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/ShardConsumer.java | ShardConsumer.getRecords | private GetRecordsResult getRecords(String shardItr, int maxNumberOfRecords) throws Exception {
GetRecordsResult getRecordsResult = null;
while (getRecordsResult == null) {
try {
getRecordsResult = kinesis.getRecords(shardItr, maxNumberOfRecords);
// Update millis behind latest so it gets reported by the millisBehindLatest gauge
Long millisBehindLatest = getRecordsResult.getMillisBehindLatest();
if (millisBehindLatest != null) {
shardMetricsReporter.setMillisBehindLatest(millisBehindLatest);
}
} catch (ExpiredIteratorException eiEx) {
LOG.warn("Encountered an unexpected expired iterator {} for shard {};" +
" refreshing the iterator ...", shardItr, subscribedShard);
shardItr = getShardIterator(lastSequenceNum);
// sleep for the fetch interval before the next getRecords attempt with the refreshed iterator
if (fetchIntervalMillis != 0) {
Thread.sleep(fetchIntervalMillis);
}
}
}
return getRecordsResult;
} | java | private GetRecordsResult getRecords(String shardItr, int maxNumberOfRecords) throws Exception {
GetRecordsResult getRecordsResult = null;
while (getRecordsResult == null) {
try {
getRecordsResult = kinesis.getRecords(shardItr, maxNumberOfRecords);
// Update millis behind latest so it gets reported by the millisBehindLatest gauge
Long millisBehindLatest = getRecordsResult.getMillisBehindLatest();
if (millisBehindLatest != null) {
shardMetricsReporter.setMillisBehindLatest(millisBehindLatest);
}
} catch (ExpiredIteratorException eiEx) {
LOG.warn("Encountered an unexpected expired iterator {} for shard {};" +
" refreshing the iterator ...", shardItr, subscribedShard);
shardItr = getShardIterator(lastSequenceNum);
// sleep for the fetch interval before the next getRecords attempt with the refreshed iterator
if (fetchIntervalMillis != 0) {
Thread.sleep(fetchIntervalMillis);
}
}
}
return getRecordsResult;
} | [
"private",
"GetRecordsResult",
"getRecords",
"(",
"String",
"shardItr",
",",
"int",
"maxNumberOfRecords",
")",
"throws",
"Exception",
"{",
"GetRecordsResult",
"getRecordsResult",
"=",
"null",
";",
"while",
"(",
"getRecordsResult",
"==",
"null",
")",
"{",
"try",
"{... | Calls {@link KinesisProxyInterface#getRecords(String, int)}, while also handling unexpected
AWS {@link ExpiredIteratorException}s to assure that we get results and don't just fail on
such occasions. The returned shard iterator within the successful {@link GetRecordsResult} should
be used for the next call to this method.
<p>Note: it is important that this method is not called again before all the records from the last result have been
fully collected with {@link ShardConsumer#deserializeRecordForCollectionAndUpdateState(UserRecord)}, otherwise
{@link ShardConsumer#lastSequenceNum} may refer to a sub-record in the middle of an aggregated record, leading to
incorrect shard iteration if the iterator had to be refreshed.
@param shardItr shard iterator to use
@param maxNumberOfRecords the maximum number of records to fetch for this getRecords attempt
@return get records result
@throws InterruptedException | [
"Calls",
"{",
"@link",
"KinesisProxyInterface#getRecords",
"(",
"String",
"int",
")",
"}",
"while",
"also",
"handling",
"unexpected",
"AWS",
"{",
"@link",
"ExpiredIteratorException",
"}",
"s",
"to",
"assure",
"that",
"we",
"get",
"results",
"and",
"don",
"t",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/ShardConsumer.java#L396-L420 | train | Get records from Kinesis. | [
30522,
2797,
2131,
2890,
27108,
5104,
6072,
11314,
2131,
2890,
27108,
5104,
1006,
5164,
21146,
17080,
16344,
1010,
20014,
4098,
19172,
5677,
11253,
2890,
27108,
5104,
1007,
11618,
6453,
1063,
2131,
2890,
27108,
5104,
6072,
11314,
2131,
2890,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getBeUlong40 | public final long getBeUlong40() {
if (position + 4 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 4));
byte[] buf = buffer;
return ((long) (0xff & buf[position++]) << 32) | ((long) (0xff & buf[position++]) << 24)
| ((long) (0xff & buf[position++]) << 16) | ((long) (0xff & buf[position++]) << 8)
| ((long) (0xff & buf[position++]));
} | java | public final long getBeUlong40() {
if (position + 4 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 4));
byte[] buf = buffer;
return ((long) (0xff & buf[position++]) << 32) | ((long) (0xff & buf[position++]) << 24)
| ((long) (0xff & buf[position++]) << 16) | ((long) (0xff & buf[position++]) << 8)
| ((long) (0xff & buf[position++]));
} | [
"public",
"final",
"long",
"getBeUlong40",
"(",
")",
"{",
"if",
"(",
"position",
"+",
"4",
">=",
"origin",
"+",
"limit",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"(",
"position",
"-",
"origin",
"+",
"4",
")",
")",
... | Return next 40-bit unsigned int from buffer. (big-endian)
@see mysql-5.6.10/include/myisampack.h - mi_uint5korr | [
"Return",
"next",
"40",
"-",
"bit",
"unsigned",
"int",
"from",
"buffer",
".",
"(",
"big",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L634-L642 | train | Gets a long value in the buffer as encoded in a SHORT_SPECIAL format. | [
30522,
2270,
2345,
2146,
2131,
4783,
18845,
3070,
12740,
1006,
1007,
1063,
2065,
1006,
2597,
1009,
1018,
1028,
1027,
4761,
1009,
5787,
1007,
5466,
2047,
30524,
1031,
1033,
20934,
2546,
1027,
17698,
1025,
2709,
1006,
1006,
2146,
1007,
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-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.getString | public static String getString(InputStream in, Charset charset, boolean isGetCharsetFromContent) throws IOException {
final byte[] contentBytes = IoUtil.readBytes(in);
return getString(contentBytes, charset, isGetCharsetFromContent);
} | java | public static String getString(InputStream in, Charset charset, boolean isGetCharsetFromContent) throws IOException {
final byte[] contentBytes = IoUtil.readBytes(in);
return getString(contentBytes, charset, isGetCharsetFromContent);
} | [
"public",
"static",
"String",
"getString",
"(",
"InputStream",
"in",
",",
"Charset",
"charset",
",",
"boolean",
"isGetCharsetFromContent",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"contentBytes",
"=",
"IoUtil",
".",
"readBytes",
"(",
"in",
... | 从流中读取内容<br>
首先尝试使用charset编码读取内容(如果为空默认UTF-8),如果isGetCharsetFromContent为true,则通过正则在正文中获取编码信息,转换为指定编码;
@param in 输入流
@param charset 字符集
@param isGetCharsetFromContent 是否从返回内容中获得编码信息
@return 内容
@throws IOException IO异常 | [
"从流中读取内容<br",
">",
"首先尝试使用charset编码读取内容(如果为空默认UTF",
"-",
"8),如果isGetCharsetFromContent为true,则通过正则在正文中获取编码信息,转换为指定编码;"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L679-L682 | train | Gets the string from the input stream. | [
30522,
2270,
10763,
5164,
4152,
18886,
3070,
1006,
20407,
25379,
1999,
1010,
25869,
13462,
25869,
13462,
1010,
22017,
20898,
2003,
18150,
7507,
22573,
24475,
21716,
8663,
6528,
2102,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
24880,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SparseVector.java | SparseVector.cosine | double cosine(SparseVector vec1, SparseVector vec2)
{
double norm1 = vec1.norm();
double norm2 = vec2.norm();
double result = 0.0f;
if (norm1 == 0 && norm2 == 0)
{
return result;
}
else
{
double prod = inner_product(vec1, vec2);
result = prod / (norm1 * norm2);
return Double.isNaN(result) ? 0.0f : result;
}
} | java | double cosine(SparseVector vec1, SparseVector vec2)
{
double norm1 = vec1.norm();
double norm2 = vec2.norm();
double result = 0.0f;
if (norm1 == 0 && norm2 == 0)
{
return result;
}
else
{
double prod = inner_product(vec1, vec2);
result = prod / (norm1 * norm2);
return Double.isNaN(result) ? 0.0f : result;
}
} | [
"double",
"cosine",
"(",
"SparseVector",
"vec1",
",",
"SparseVector",
"vec2",
")",
"{",
"double",
"norm1",
"=",
"vec1",
".",
"norm",
"(",
")",
";",
"double",
"norm2",
"=",
"vec2",
".",
"norm",
"(",
")",
";",
"double",
"result",
"=",
"0.0f",
";",
"if"... | Calculate the cosine value between vectors. | [
"Calculate",
"the",
"cosine",
"value",
"between",
"vectors",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/SparseVector.java#L167-L182 | train | Cosine of two vectors. | [
30522,
3313,
2522,
11493,
2063,
1006,
20288,
3726,
16761,
2310,
2278,
2487,
1010,
20288,
3726,
16761,
2310,
2278,
2475,
1007,
1063,
3313,
13373,
2487,
1027,
2310,
2278,
2487,
1012,
13373,
1006,
1007,
1025,
3313,
13373,
2475,
1027,
2310,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.read | public static String read(InputStream in, String charsetName) throws IORuntimeException {
FastByteArrayOutputStream out = read(in);
return StrUtil.isBlank(charsetName) ? out.toString() : out.toString(charsetName);
} | java | public static String read(InputStream in, String charsetName) throws IORuntimeException {
FastByteArrayOutputStream out = read(in);
return StrUtil.isBlank(charsetName) ? out.toString() : out.toString(charsetName);
} | [
"public",
"static",
"String",
"read",
"(",
"InputStream",
"in",
",",
"String",
"charsetName",
")",
"throws",
"IORuntimeException",
"{",
"FastByteArrayOutputStream",
"out",
"=",
"read",
"(",
"in",
")",
";",
"return",
"StrUtil",
".",
"isBlank",
"(",
"charsetName",... | 从流中读取内容
@param in 输入流
@param charsetName 字符集
@return 内容
@throws IORuntimeException IO异常 | [
"从流中读取内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L396-L399 | train | Reads a sequence of bytes from the specified input stream and returns the resulting string. | [
30522,
2270,
10763,
5164,
3191,
1006,
20407,
25379,
1999,
1010,
5164,
25869,
13462,
18442,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
3435,
3762,
27058,
11335,
29337,
25856,
16446,
25379,
2041,
1027,
3191,
1006,
1999,
1007,
1025,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getPattern | public Pattern getPattern(String name, Pattern defaultValue) {
String valString = get(name);
if (null == valString || valString.isEmpty()) {
return defaultValue;
}
try {
return Pattern.compile(valString);
} catch (PatternSyntaxException pse) {
LOG.warn("Regular expression '" + valString + "' for property '" +
name + "' not valid. Using default", pse);
return defaultValue;
}
} | java | public Pattern getPattern(String name, Pattern defaultValue) {
String valString = get(name);
if (null == valString || valString.isEmpty()) {
return defaultValue;
}
try {
return Pattern.compile(valString);
} catch (PatternSyntaxException pse) {
LOG.warn("Regular expression '" + valString + "' for property '" +
name + "' not valid. Using default", pse);
return defaultValue;
}
} | [
"public",
"Pattern",
"getPattern",
"(",
"String",
"name",
",",
"Pattern",
"defaultValue",
")",
"{",
"String",
"valString",
"=",
"get",
"(",
"name",
")",
";",
"if",
"(",
"null",
"==",
"valString",
"||",
"valString",
".",
"isEmpty",
"(",
")",
")",
"{",
"... | Get the value of the <code>name</code> property as a <code>Pattern</code>.
If no such property is specified, or if the specified value is not a valid
<code>Pattern</code>, then <code>DefaultValue</code> is returned.
Note that the returned value is NOT trimmed by this method.
@param name property name
@param defaultValue default value
@return property value as a compiled Pattern, or defaultValue | [
"Get",
"the",
"value",
"of",
"the",
"<code",
">",
"name<",
"/",
"code",
">",
"property",
"as",
"a",
"<code",
">",
"Pattern<",
"/",
"code",
">",
".",
"If",
"no",
"such",
"property",
"is",
"specified",
"or",
"if",
"the",
"specified",
"value",
"is",
"no... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1804-L1816 | train | Gets the regular expression for the property with the given name. | [
30522,
2270,
5418,
2131,
4502,
12079,
2078,
1006,
5164,
2171,
1010,
5418,
12398,
10175,
5657,
1007,
1063,
5164,
11748,
3367,
4892,
1027,
2131,
1006,
2171,
1007,
1025,
2065,
1006,
19701,
1027,
1027,
11748,
3367,
4892,
1064,
1064,
11748,
3367... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java | RestTemplateBuilder.errorHandler | public RestTemplateBuilder errorHandler(ResponseErrorHandler errorHandler) {
Assert.notNull(errorHandler, "ErrorHandler must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.requestFactoryCustomizer,
this.interceptors);
} | java | public RestTemplateBuilder errorHandler(ResponseErrorHandler errorHandler) {
Assert.notNull(errorHandler, "ErrorHandler must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.requestFactoryCustomizer,
this.interceptors);
} | [
"public",
"RestTemplateBuilder",
"errorHandler",
"(",
"ResponseErrorHandler",
"errorHandler",
")",
"{",
"Assert",
".",
"notNull",
"(",
"errorHandler",
",",
"\"ErrorHandler must not be null\"",
")",
";",
"return",
"new",
"RestTemplateBuilder",
"(",
"this",
".",
"detectRe... | Set the {@link ResponseErrorHandler} that should be used with the
{@link RestTemplate}.
@param errorHandler the error handler to use
@return a new builder instance | [
"Set",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java#L364-L371 | train | Creates a new RestTemplateBuilder with the specified error handler. | [
30522,
2270,
2717,
18532,
15725,
8569,
23891,
2099,
7561,
11774,
3917,
1006,
3433,
2121,
29165,
11774,
3917,
7561,
11774,
3917,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
7561,
11774,
3917,
1010,
1000,
7561,
11774,
3917,
2442,
2025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/clusterframework/types/SlotProfile.java | SlotProfile.noLocality | public static SlotProfile noLocality(ResourceProfile resourceProfile) {
return new SlotProfile(resourceProfile, Collections.emptyList(), Collections.emptyList());
} | java | public static SlotProfile noLocality(ResourceProfile resourceProfile) {
return new SlotProfile(resourceProfile, Collections.emptyList(), Collections.emptyList());
} | [
"public",
"static",
"SlotProfile",
"noLocality",
"(",
"ResourceProfile",
"resourceProfile",
")",
"{",
"return",
"new",
"SlotProfile",
"(",
"resourceProfile",
",",
"Collections",
".",
"emptyList",
"(",
")",
",",
"Collections",
".",
"emptyList",
"(",
")",
")",
";"... | Returns a slot profile for the given resource profile, without any locality requirements. | [
"Returns",
"a",
"slot",
"profile",
"for",
"the",
"given",
"resource",
"profile",
"without",
"any",
"locality",
"requirements",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/SlotProfile.java#L121-L123 | train | Returns a slot profile with no locality. | [
30522,
2270,
10763,
10453,
21572,
8873,
2571,
2053,
4135,
9289,
3012,
1006,
7692,
21572,
8873,
2571,
7692,
21572,
8873,
2571,
1007,
1063,
2709,
2047,
10453,
21572,
8873,
2571,
1006,
7692,
21572,
8873,
2571,
1010,
6407,
1012,
4064,
9863,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java | JDBCBackendDataSource.getConnections | @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
public List<Connection> getConnections(final ConnectionMode connectionMode, final String dataSourceName, final int connectionSize, final TransactionType transactionType) throws SQLException {
DataSource dataSource = dataSources.get(dataSourceName);
if (1 == connectionSize) {
return Collections.singletonList(createConnection(transactionType, dataSourceName, dataSource));
}
if (ConnectionMode.CONNECTION_STRICTLY == connectionMode) {
return createConnections(transactionType, dataSourceName, dataSource, connectionSize);
}
synchronized (dataSource) {
return createConnections(transactionType, dataSourceName, dataSource, connectionSize);
}
} | java | @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
public List<Connection> getConnections(final ConnectionMode connectionMode, final String dataSourceName, final int connectionSize, final TransactionType transactionType) throws SQLException {
DataSource dataSource = dataSources.get(dataSourceName);
if (1 == connectionSize) {
return Collections.singletonList(createConnection(transactionType, dataSourceName, dataSource));
}
if (ConnectionMode.CONNECTION_STRICTLY == connectionMode) {
return createConnections(transactionType, dataSourceName, dataSource, connectionSize);
}
synchronized (dataSource) {
return createConnections(transactionType, dataSourceName, dataSource, connectionSize);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"SynchronizationOnLocalVariableOrMethodParameter\"",
")",
"public",
"List",
"<",
"Connection",
">",
"getConnections",
"(",
"final",
"ConnectionMode",
"connectionMode",
",",
"final",
"String",
"dataSourceName",
",",
"final",
"int",
"connecti... | Get connections.
@param connectionMode connection mode
@param dataSourceName data source name
@param connectionSize size of connections to be get
@param transactionType transaction type
@return connections
@throws SQLException SQL exception | [
"Get",
"connections",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/datasource/JDBCBackendDataSource.java#L111-L123 | train | Gets the connections. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
26351,
8093,
10698,
9276,
2239,
4135,
9289,
10755,
19210,
2953,
11368,
6806,
18927,
5400,
22828,
1000,
1007,
2270,
2862,
1026,
4434,
1028,
2131,
8663,
2638,
22014,
1006,
2345,
4434,
5302,
32... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.newerThan | public static boolean newerThan(File file, File reference) {
if (null == reference || false == reference.exists()) {
return true;// 文件一定比一个不存在的文件新
}
return newerThan(file, reference.lastModified());
} | java | public static boolean newerThan(File file, File reference) {
if (null == reference || false == reference.exists()) {
return true;// 文件一定比一个不存在的文件新
}
return newerThan(file, reference.lastModified());
} | [
"public",
"static",
"boolean",
"newerThan",
"(",
"File",
"file",
",",
"File",
"reference",
")",
"{",
"if",
"(",
"null",
"==",
"reference",
"||",
"false",
"==",
"reference",
".",
"exists",
"(",
")",
")",
"{",
"return",
"true",
";",
"// 文件一定比一个不存在的文件新\r",
... | 给定文件或目录的最后修改时间是否晚于给定时间
@param file 文件或目录
@param reference 参照文件
@return 是否晚于给定时间 | [
"给定文件或目录的最后修改时间是否晚于给定时间"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L566-L571 | train | Checks if the given file is newer than the given reference file. | [
30522,
2270,
10763,
22017,
20898,
10947,
21604,
1006,
5371,
5371,
1010,
5371,
4431,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
4431,
1064,
1064,
6270,
1027,
1027,
4431,
1012,
6526,
1006,
1007,
1007,
1063,
2709,
2995,
1025,
1013,
1013,
1861,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getDeclaredFields | public static Field[] getDeclaredFields(Class<?> clazz) throws SecurityException {
if (null == clazz) {
return null;
}
return clazz.getDeclaredFields();
} | java | public static Field[] getDeclaredFields(Class<?> clazz) throws SecurityException {
if (null == clazz) {
return null;
}
return clazz.getDeclaredFields();
} | [
"public",
"static",
"Field",
"[",
"]",
"getDeclaredFields",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"throws",
"SecurityException",
"{",
"if",
"(",
"null",
"==",
"clazz",
")",
"{",
"return",
"null",
";",
"}",
"return",
"clazz",
".",
"getDeclaredFields",
... | 查找指定类中的所有字段(包括非public字段)
@param clazz 被查找字段的类
@return 字段
@throws SecurityException 安全异常 | [
"查找指定类中的所有字段(包括非public字段",
")"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L373-L378 | train | Returns an array of all the fields declared in the given class. | [
30522,
2270,
10763,
2492,
1031,
1033,
2131,
3207,
20464,
12069,
20952,
12891,
2015,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1007,
11618,
3036,
10288,
24422,
1063,
2065,
1006,
19701,
1027,
1027,
18856,
10936,
2480,
1007,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/instance/SlotSharingGroupAssignment.java | SlotSharingGroupAssignment.releaseSharedSlot | void releaseSharedSlot(SharedSlot sharedSlot) {
synchronized (lock) {
if (sharedSlot.markCancelled()) {
// we are releasing this slot
if (sharedSlot.hasChildren()) {
final FlinkException cause = new FlinkException("Releasing shared slot parent.");
// by simply releasing all children, we should eventually release this slot.
Set<Slot> children = sharedSlot.getSubSlots();
while (children.size() > 0) {
children.iterator().next().releaseSlot(cause);
}
}
else {
// if there are no children that trigger the release, we trigger it directly
internalDisposeEmptySharedSlot(sharedSlot);
}
}
}
} | java | void releaseSharedSlot(SharedSlot sharedSlot) {
synchronized (lock) {
if (sharedSlot.markCancelled()) {
// we are releasing this slot
if (sharedSlot.hasChildren()) {
final FlinkException cause = new FlinkException("Releasing shared slot parent.");
// by simply releasing all children, we should eventually release this slot.
Set<Slot> children = sharedSlot.getSubSlots();
while (children.size() > 0) {
children.iterator().next().releaseSlot(cause);
}
}
else {
// if there are no children that trigger the release, we trigger it directly
internalDisposeEmptySharedSlot(sharedSlot);
}
}
}
} | [
"void",
"releaseSharedSlot",
"(",
"SharedSlot",
"sharedSlot",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"sharedSlot",
".",
"markCancelled",
"(",
")",
")",
"{",
"// we are releasing this slot",
"if",
"(",
"sharedSlot",
".",
"hasChildren",
"(",
... | Called from {@link org.apache.flink.runtime.instance.SharedSlot#releaseSlot(Throwable)}.
@param sharedSlot The slot to be released. | [
"Called",
"from",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"runtime",
".",
"instance",
".",
"SharedSlot#releaseSlot",
"(",
"Throwable",
")",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/SlotSharingGroupAssignment.java#L516-L535 | train | Release the given shared slot. | [
30522,
11675,
7085,
8167,
2098,
14540,
4140,
1006,
4207,
14540,
4140,
4207,
14540,
4140,
1007,
1063,
25549,
1006,
5843,
1007,
1063,
2065,
1006,
4207,
14540,
4140,
1012,
2928,
9336,
29109,
3709,
1006,
1007,
1007,
1063,
1013,
1013,
2057,
2024... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.fromCollection | public static <K, VV, EV> Graph<K, VV, EV> fromCollection(Collection<Edge<K, EV>> edges,
final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) {
return fromDataSet(context.fromCollection(edges), vertexValueInitializer, context);
} | java | public static <K, VV, EV> Graph<K, VV, EV> fromCollection(Collection<Edge<K, EV>> edges,
final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) {
return fromDataSet(context.fromCollection(edges), vertexValueInitializer, context);
} | [
"public",
"static",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"fromCollection",
"(",
"Collection",
"<",
"Edge",
"<",
"K",
",",
"EV",
">",
">",
"edges",
",",
"final",
"MapFunction",
"<",
"K",
",",
"VV",
"... | Creates a graph from a Collection of edges.
Vertices are created automatically and their values are set
by applying the provided map function to the vertex IDs.
@param edges a Collection of edges.
@param vertexValueInitializer a map function that initializes the vertex values.
It allows to apply a map transformation on the vertex ID to produce an initial vertex value.
@param context the flink execution environment.
@return the newly created graph. | [
"Creates",
"a",
"graph",
"from",
"a",
"Collection",
"of",
"edges",
".",
"Vertices",
"are",
"created",
"automatically",
"and",
"their",
"values",
"are",
"set",
"by",
"applying",
"the",
"provided",
"map",
"function",
"to",
"the",
"vertex",
"IDs",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L147-L151 | train | Creates a graph from a collection of edges. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
2013,
26895,
18491,
1006,
3074,
1026,
3341,
1026,
1047,
1010,
23408,
1028,
1028,
7926,
1010,
2345,
4949,
11263,
279... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/classification/utilities/TextProcessUtility.java | TextProcessUtility.loadCorpus | public static Map<String, String[]> loadCorpus(String path)
{
Map<String, String[]> dataSet = new TreeMap<String, String[]>();
File root = new File(path);
File[] folders = root.listFiles();
if (folders == null) return null;
for (File folder : folders)
{
if (folder.isFile()) continue;
File[] files = folder.listFiles();
if (files == null) continue;
String[] documents = new String[files.length];
for (int i = 0; i < files.length; i++)
{
documents[i] = IOUtil.readTxt(files[i].getAbsolutePath());
}
dataSet.put(folder.getName(), documents);
}
return dataSet;
} | java | public static Map<String, String[]> loadCorpus(String path)
{
Map<String, String[]> dataSet = new TreeMap<String, String[]>();
File root = new File(path);
File[] folders = root.listFiles();
if (folders == null) return null;
for (File folder : folders)
{
if (folder.isFile()) continue;
File[] files = folder.listFiles();
if (files == null) continue;
String[] documents = new String[files.length];
for (int i = 0; i < files.length; i++)
{
documents[i] = IOUtil.readTxt(files[i].getAbsolutePath());
}
dataSet.put(folder.getName(), documents);
}
return dataSet;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"loadCorpus",
"(",
"String",
"path",
")",
"{",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"dataSet",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"String",
"[",
"]",
">"... | 加载一个文件夹下的所有语料
@param path
@return | [
"加载一个文件夹下的所有语料"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/classification/utilities/TextProcessUtility.java#L76-L96 | train | Load a corpus map from a path. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
5164,
1031,
1033,
1028,
7170,
24586,
2271,
1006,
5164,
4130,
1007,
1063,
4949,
1026,
5164,
1010,
5164,
1031,
1033,
1028,
2951,
13462,
1027,
2047,
3392,
2863,
2361,
1026,
5164,
1010,
5164,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/AbstractResource.java | AbstractResource.getURI | @Override
public URI getURI() throws IOException {
URL url = getURL();
try {
return ResourceUtils.toURI(url);
} catch (URISyntaxException ex) {
throw new RuntimeException("Invalid URI [" + url + "]", ex);
}
} | java | @Override
public URI getURI() throws IOException {
URL url = getURL();
try {
return ResourceUtils.toURI(url);
} catch (URISyntaxException ex) {
throw new RuntimeException("Invalid URI [" + url + "]", ex);
}
} | [
"@",
"Override",
"public",
"URI",
"getURI",
"(",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"getURL",
"(",
")",
";",
"try",
"{",
"return",
"ResourceUtils",
".",
"toURI",
"(",
"url",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"ex",
")... | This implementation builds a URI based on the URL returned by
{@link #getURL()}. | [
"This",
"implementation",
"builds",
"a",
"URI",
"based",
"on",
"the",
"URL",
"returned",
"by",
"{"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/AbstractResource.java#L78-L86 | train | Get the URI of the resource. | [
30522,
1030,
2058,
15637,
2270,
24471,
2072,
2131,
9496,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
24471,
2140,
24471,
2140,
1027,
2131,
3126,
2140,
1006,
1007,
1025,
3046,
1063,
2709,
30524,
5466,
2047,
2448,
7292,
10288,
24422,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.hasSortedPrefix | private boolean hasSortedPrefix(SelectScope scope, SqlNodeList orderList) {
return isSortCompatible(scope, orderList.get(0), false);
} | java | private boolean hasSortedPrefix(SelectScope scope, SqlNodeList orderList) {
return isSortCompatible(scope, orderList.get(0), false);
} | [
"private",
"boolean",
"hasSortedPrefix",
"(",
"SelectScope",
"scope",
",",
"SqlNodeList",
"orderList",
")",
"{",
"return",
"isSortCompatible",
"(",
"scope",
",",
"orderList",
".",
"get",
"(",
"0",
")",
",",
"false",
")",
";",
"}"
] | Returns whether the prefix is sorted. | [
"Returns",
"whether",
"the",
"prefix",
"is",
"sorted",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3675-L3677 | train | Returns true if the prefix of the order list is sorted. | [
30522,
2797,
22017,
20898,
2038,
21748,
3064,
28139,
8873,
2595,
1006,
27034,
16186,
9531,
1010,
29296,
3630,
9247,
2923,
2344,
9863,
1007,
1063,
2709,
26354,
11589,
9006,
24952,
3468,
1006,
9531,
1010,
2344,
9863,
1012,
2131,
1006,
1014,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.zip | public static Map<String, String> zip(String keys, String values, String delimiter, boolean isOrder) {
return ArrayUtil.zip(StrUtil.split(keys, delimiter), StrUtil.split(values, delimiter), isOrder);
} | java | public static Map<String, String> zip(String keys, String values, String delimiter, boolean isOrder) {
return ArrayUtil.zip(StrUtil.split(keys, delimiter), StrUtil.split(values, delimiter), isOrder);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"zip",
"(",
"String",
"keys",
",",
"String",
"values",
",",
"String",
"delimiter",
",",
"boolean",
"isOrder",
")",
"{",
"return",
"ArrayUtil",
".",
"zip",
"(",
"StrUtil",
".",
"split",
"(",
... | 映射键值(参考Python的zip()函数)<br>
例如:<br>
keys = a,b,c,d<br>
values = 1,2,3,4<br>
delimiter = , 则得到的Map是 {a=1, b=2, c=3, d=4}<br>
如果两个数组长度不同,则只对应最短部分
@param keys 键列表
@param values 值列表
@param delimiter 分隔符
@param isOrder 是否有序
@return Map
@since 3.0.4 | [
"映射键值(参考Python的zip",
"()",
"函数)<br",
">",
"例如:<br",
">",
"keys",
"=",
"a",
"b",
"c",
"d<br",
">",
"values",
"=",
"1",
"2",
"3",
"4<br",
">",
"delimiter",
"=",
"则得到的Map是",
"{",
"a",
"=",
"1",
"b",
"=",
"2",
"c",
"=",
"3",
"d",
"=",
"4",
"}",
"... | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1451-L1453 | train | Creates a map from the given strings. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
5164,
1028,
14101,
1006,
5164,
6309,
1010,
5164,
5300,
1010,
5164,
3972,
27605,
3334,
1010,
22017,
20898,
11163,
26764,
1007,
1063,
2709,
9140,
21823,
2140,
1012,
14101,
1006,
2358,
22134,
4014,
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/meta/MetaUtil.java | MetaUtil.getColumnNames | public static String[] getColumnNames(ResultSet rs) throws DbRuntimeException {
try {
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
String[] labelNames = new String[columnCount];
for (int i = 0; i < labelNames.length; i++) {
labelNames[i] = rsmd.getColumnLabel(i + 1);
}
return labelNames;
} catch (Exception e) {
throw new DbRuntimeException("Get colunms error!", e);
}
} | java | public static String[] getColumnNames(ResultSet rs) throws DbRuntimeException {
try {
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
String[] labelNames = new String[columnCount];
for (int i = 0; i < labelNames.length; i++) {
labelNames[i] = rsmd.getColumnLabel(i + 1);
}
return labelNames;
} catch (Exception e) {
throw new DbRuntimeException("Get colunms error!", e);
}
} | [
"public",
"static",
"String",
"[",
"]",
"getColumnNames",
"(",
"ResultSet",
"rs",
")",
"throws",
"DbRuntimeException",
"{",
"try",
"{",
"ResultSetMetaData",
"rsmd",
"=",
"rs",
".",
"getMetaData",
"(",
")",
";",
"int",
"columnCount",
"=",
"rsmd",
".",
"getCol... | 获得结果集的所有列名
@param rs 结果集
@return 列名数组
@throws DbRuntimeException SQL执行异常 | [
"获得结果集的所有列名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/meta/MetaUtil.java#L103-L115 | train | Gets the column names from a ResultSet. | [
30522,
2270,
10763,
5164,
1031,
1033,
2131,
25778,
2819,
9516,
7834,
1006,
3463,
3388,
12667,
1007,
11618,
16962,
15532,
30524,
1025,
20014,
5930,
3597,
16671,
1027,
12667,
26876,
1012,
2131,
25778,
2819,
15305,
16671,
1006,
1007,
1025,
5164,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java | AllWindowedStream.sideOutputLateData | @PublicEvolving
public AllWindowedStream<T, W> sideOutputLateData(OutputTag<T> outputTag) {
Preconditions.checkNotNull(outputTag, "Side output tag must not be null.");
this.lateDataOutputTag = input.getExecutionEnvironment().clean(outputTag);
return this;
} | java | @PublicEvolving
public AllWindowedStream<T, W> sideOutputLateData(OutputTag<T> outputTag) {
Preconditions.checkNotNull(outputTag, "Side output tag must not be null.");
this.lateDataOutputTag = input.getExecutionEnvironment().clean(outputTag);
return this;
} | [
"@",
"PublicEvolving",
"public",
"AllWindowedStream",
"<",
"T",
",",
"W",
">",
"sideOutputLateData",
"(",
"OutputTag",
"<",
"T",
">",
"outputTag",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"outputTag",
",",
"\"Side output tag must not be null.\"",
")",
... | Send late arriving data to the side output identified by the given {@link OutputTag}. Data
is considered late after the watermark has passed the end of the window plus the allowed
lateness set using {@link #allowedLateness(Time)}.
<p>You can get the stream of late data using
{@link SingleOutputStreamOperator#getSideOutput(OutputTag)} on the
{@link SingleOutputStreamOperator} resulting from the windowed operation
with the same {@link OutputTag}. | [
"Send",
"late",
"arriving",
"data",
"to",
"the",
"side",
"output",
"identified",
"by",
"the",
"given",
"{",
"@link",
"OutputTag",
"}",
".",
"Data",
"is",
"considered",
"late",
"after",
"the",
"watermark",
"has",
"passed",
"the",
"end",
"of",
"the",
"window... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java#L162-L167 | train | Sets the output tag of the LATE data stream. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
2035,
11101,
15096,
21422,
1026,
1056,
1010,
1059,
1028,
2217,
5833,
18780,
13776,
6790,
1006,
6434,
15900,
1026,
1056,
1028,
6434,
15900,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/yaml/YamlOrchestrationMasterSlaveDataSourceFactory.java | YamlOrchestrationMasterSlaveDataSourceFactory.createDataSource | public static DataSource createDataSource(final byte[] yamlBytes) throws SQLException, IOException {
YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlBytes);
return createDataSource(config.getDataSources(), config.getMasterSlaveRule(), config.getProps(), config.getOrchestration());
} | java | public static DataSource createDataSource(final byte[] yamlBytes) throws SQLException, IOException {
YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlBytes);
return createDataSource(config.getDataSources(), config.getMasterSlaveRule(), config.getProps(), config.getOrchestration());
} | [
"public",
"static",
"DataSource",
"createDataSource",
"(",
"final",
"byte",
"[",
"]",
"yamlBytes",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"YamlOrchestrationMasterSlaveRuleConfiguration",
"config",
"=",
"unmarshal",
"(",
"yamlBytes",
")",
";",
"return"... | Create master-slave data source.
@param yamlBytes YAML bytes for master-slave rule configuration with data sources
@return master-slave data source
@throws SQLException SQL exception
@throws IOException IO exception | [
"Create",
"master",
"-",
"slave",
"data",
"source",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/yaml/YamlOrchestrationMasterSlaveDataSourceFactory.java#L87-L90 | train | Create a DataSource from a YAML byte array. | [
30522,
2270,
10763,
2951,
6499,
3126,
3401,
2580,
6790,
6499,
3126,
3401,
1006,
2345,
24880,
1031,
1033,
8038,
19968,
3762,
4570,
1007,
11618,
29296,
10288,
24422,
1010,
22834,
10288,
24422,
1063,
8038,
19968,
2953,
8376,
6494,
3508,
27751,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/swing/DesktopUtil.java | DesktopUtil.browse | public static void browse(String url) {
final Desktop dsktop = getDsktop();
try {
dsktop.browse(URLUtil.toURI(url));
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static void browse(String url) {
final Desktop dsktop = getDsktop();
try {
dsktop.browse(URLUtil.toURI(url));
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"void",
"browse",
"(",
"String",
"url",
")",
"{",
"final",
"Desktop",
"dsktop",
"=",
"getDsktop",
"(",
")",
";",
"try",
"{",
"dsktop",
".",
"browse",
"(",
"URLUtil",
".",
"toURI",
"(",
"url",
")",
")",
";",
"}",
"catch",
"(",
"I... | 使用平台默认浏览器打开指定URL地址
@param url URL地址 | [
"使用平台默认浏览器打开指定URL地址"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/swing/DesktopUtil.java#L33-L40 | train | Browse the specified URL. | [
30522,
2270,
10763,
11675,
11347,
2063,
1006,
5164,
24471,
2140,
1007,
1063,
2345,
15363,
16233,
25509,
7361,
1027,
2131,
5104,
25509,
7361,
1006,
1007,
1025,
3046,
1063,
16233,
25509,
7361,
1012,
11347,
2063,
1006,
24471,
7630,
3775,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-hbase/src/main/java/org/apache/flink/addons/hbase/HBaseTableSchema.java | HBaseTableSchema.getQualifierKeys | byte[][] getQualifierKeys(String family) {
Map<String, TypeInformation<?>> qualifierMap = familyMap.get(family);
if (qualifierMap == null) {
throw new IllegalArgumentException("Family " + family + " does not exist in schema.");
}
Charset c = Charset.forName(charset);
byte[][] qualifierKeys = new byte[qualifierMap.size()][];
int i = 0;
for (String name : qualifierMap.keySet()) {
qualifierKeys[i++] = name.getBytes(c);
}
return qualifierKeys;
} | java | byte[][] getQualifierKeys(String family) {
Map<String, TypeInformation<?>> qualifierMap = familyMap.get(family);
if (qualifierMap == null) {
throw new IllegalArgumentException("Family " + family + " does not exist in schema.");
}
Charset c = Charset.forName(charset);
byte[][] qualifierKeys = new byte[qualifierMap.size()][];
int i = 0;
for (String name : qualifierMap.keySet()) {
qualifierKeys[i++] = name.getBytes(c);
}
return qualifierKeys;
} | [
"byte",
"[",
"]",
"[",
"]",
"getQualifierKeys",
"(",
"String",
"family",
")",
"{",
"Map",
"<",
"String",
",",
"TypeInformation",
"<",
"?",
">",
">",
"qualifierMap",
"=",
"familyMap",
".",
"get",
"(",
"family",
")",
";",
"if",
"(",
"qualifierMap",
"==",... | Returns the HBase identifiers of all registered column qualifiers for a specific column family.
@param family The name of the column family for which the column qualifier identifiers are returned.
@return The HBase identifiers of all registered column qualifiers for a specific column family. | [
"Returns",
"the",
"HBase",
"identifiers",
"of",
"all",
"registered",
"column",
"qualifiers",
"for",
"a",
"specific",
"column",
"family",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hbase/src/main/java/org/apache/flink/addons/hbase/HBaseTableSchema.java#L129-L143 | train | Returns the byte array of qualifier keys for the given family. | [
30522,
24880,
1031,
1033,
1031,
1033,
2131,
26426,
18095,
14839,
2015,
1006,
5164,
2155,
1007,
1063,
4949,
1026,
5164,
1010,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
1028,
10981,
2863,
2361,
1027,
2155,
2863,
30524,
2155,
1007,
1025,
2065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/SymmetricCrypto.java | SymmetricCrypto.encryptBase64 | public String encryptBase64(String data, String charset) {
return Base64.encode(encrypt(data, charset));
} | java | public String encryptBase64(String data, String charset) {
return Base64.encode(encrypt(data, charset));
} | [
"public",
"String",
"encryptBase64",
"(",
"String",
"data",
",",
"String",
"charset",
")",
"{",
"return",
"Base64",
".",
"encode",
"(",
"encrypt",
"(",
"data",
",",
"charset",
")",
")",
";",
"}"
] | 加密
@param data 被加密的字符串
@param charset 编码
@return 加密后的Base64 | [
"加密"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/SymmetricCrypto.java#L221-L223 | train | Encrypts the given data using the specified encoding. | [
30522,
2270,
5164,
4372,
26775,
22571,
2102,
15058,
21084,
1006,
5164,
2951,
1010,
5164,
25869,
13462,
1007,
1063,
2709,
2918,
21084,
1012,
4372,
16044,
1006,
4372,
26775,
22571,
2102,
1006,
2951,
1010,
25869,
13462,
1007,
1007,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java | ExceptionUtils.tryDeserializeAndThrow | public static void tryDeserializeAndThrow(Throwable throwable, ClassLoader classLoader) throws Throwable {
Throwable current = throwable;
while (!(current instanceof SerializedThrowable) && current.getCause() != null) {
current = current.getCause();
}
if (current instanceof SerializedThrowable) {
throw ((SerializedThrowable) current).deserializeError(classLoader);
} else {
throw throwable;
}
} | java | public static void tryDeserializeAndThrow(Throwable throwable, ClassLoader classLoader) throws Throwable {
Throwable current = throwable;
while (!(current instanceof SerializedThrowable) && current.getCause() != null) {
current = current.getCause();
}
if (current instanceof SerializedThrowable) {
throw ((SerializedThrowable) current).deserializeError(classLoader);
} else {
throw throwable;
}
} | [
"public",
"static",
"void",
"tryDeserializeAndThrow",
"(",
"Throwable",
"throwable",
",",
"ClassLoader",
"classLoader",
")",
"throws",
"Throwable",
"{",
"Throwable",
"current",
"=",
"throwable",
";",
"while",
"(",
"!",
"(",
"current",
"instanceof",
"SerializedThrowa... | Tries to find a {@link SerializedThrowable} as the cause of the given throwable and throws its
deserialized value. If there is no such throwable, then the original throwable is thrown.
@param throwable to check for a SerializedThrowable
@param classLoader to be used for the deserialization of the SerializedThrowable
@throws Throwable either the deserialized throwable or the given throwable | [
"Tries",
"to",
"find",
"a",
"{",
"@link",
"SerializedThrowable",
"}",
"as",
"the",
"cause",
"of",
"the",
"given",
"throwable",
"and",
"throws",
"its",
"deserialized",
"value",
".",
"If",
"there",
"is",
"no",
"such",
"throwable",
"then",
"the",
"original",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java#L435-L447 | train | Try to deserialize the given throwable and throw an exception if it fails. | [
30522,
2270,
10763,
11675,
3046,
6155,
11610,
3669,
4371,
5685,
2705,
10524,
1006,
30524,
1007,
999,
1027,
19701,
1007,
1063,
2783,
1027,
2783,
1012,
2131,
3540,
8557,
1006,
1007,
1025,
1065,
2065,
1006,
2783,
6013,
11253,
27289,
2705,
1052... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolverBuilder.java | DnsNameResolverBuilder.build | public DnsNameResolver build() {
if (eventLoop == null) {
throw new IllegalStateException("eventLoop should be specified to build a DnsNameResolver.");
}
if (resolveCache != null && (minTtl != null || maxTtl != null || negativeTtl != null)) {
throw new IllegalStateException("resolveCache and TTLs are mutually exclusive");
}
if (authoritativeDnsServerCache != null && (minTtl != null || maxTtl != null || negativeTtl != null)) {
throw new IllegalStateException("authoritativeDnsServerCache and TTLs are mutually exclusive");
}
DnsCache resolveCache = this.resolveCache != null ? this.resolveCache : newCache();
DnsCnameCache cnameCache = this.cnameCache != null ? this.cnameCache : newCnameCache();
AuthoritativeDnsServerCache authoritativeDnsServerCache = this.authoritativeDnsServerCache != null ?
this.authoritativeDnsServerCache : newAuthoritativeDnsServerCache();
return new DnsNameResolver(
eventLoop,
channelFactory,
resolveCache,
cnameCache,
authoritativeDnsServerCache,
dnsQueryLifecycleObserverFactory,
queryTimeoutMillis,
resolvedAddressTypes,
recursionDesired,
maxQueriesPerResolve,
traceEnabled,
maxPayloadSize,
optResourceEnabled,
hostsFileEntriesResolver,
dnsServerAddressStreamProvider,
searchDomains,
ndots,
decodeIdn);
} | java | public DnsNameResolver build() {
if (eventLoop == null) {
throw new IllegalStateException("eventLoop should be specified to build a DnsNameResolver.");
}
if (resolveCache != null && (minTtl != null || maxTtl != null || negativeTtl != null)) {
throw new IllegalStateException("resolveCache and TTLs are mutually exclusive");
}
if (authoritativeDnsServerCache != null && (minTtl != null || maxTtl != null || negativeTtl != null)) {
throw new IllegalStateException("authoritativeDnsServerCache and TTLs are mutually exclusive");
}
DnsCache resolveCache = this.resolveCache != null ? this.resolveCache : newCache();
DnsCnameCache cnameCache = this.cnameCache != null ? this.cnameCache : newCnameCache();
AuthoritativeDnsServerCache authoritativeDnsServerCache = this.authoritativeDnsServerCache != null ?
this.authoritativeDnsServerCache : newAuthoritativeDnsServerCache();
return new DnsNameResolver(
eventLoop,
channelFactory,
resolveCache,
cnameCache,
authoritativeDnsServerCache,
dnsQueryLifecycleObserverFactory,
queryTimeoutMillis,
resolvedAddressTypes,
recursionDesired,
maxQueriesPerResolve,
traceEnabled,
maxPayloadSize,
optResourceEnabled,
hostsFileEntriesResolver,
dnsServerAddressStreamProvider,
searchDomains,
ndots,
decodeIdn);
} | [
"public",
"DnsNameResolver",
"build",
"(",
")",
"{",
"if",
"(",
"eventLoop",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"eventLoop should be specified to build a DnsNameResolver.\"",
")",
";",
"}",
"if",
"(",
"resolveCache",
"!=",
"null"... | Returns a new {@link DnsNameResolver} instance.
@return a {@link DnsNameResolver} | [
"Returns",
"a",
"new",
"{",
"@link",
"DnsNameResolver",
"}",
"instance",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolverBuilder.java#L413-L449 | train | Build a DnsNameResolver. | [
30522,
2270,
1040,
3619,
18442,
6072,
4747,
6299,
3857,
1006,
1007,
1063,
2065,
1006,
2724,
4135,
7361,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
9153,
17389,
2595,
24422,
1006,
1000,
2724,
4135,
7361,
2323,
2022,
9675,
2000,
3857,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ReferenceCountUtil.java | ReferenceCountUtil.touch | @SuppressWarnings("unchecked")
public static <T> T touch(T msg, Object hint) {
if (msg instanceof ReferenceCounted) {
return (T) ((ReferenceCounted) msg).touch(hint);
}
return msg;
} | java | @SuppressWarnings("unchecked")
public static <T> T touch(T msg, Object hint) {
if (msg instanceof ReferenceCounted) {
return (T) ((ReferenceCounted) msg).touch(hint);
}
return msg;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"touch",
"(",
"T",
"msg",
",",
"Object",
"hint",
")",
"{",
"if",
"(",
"msg",
"instanceof",
"ReferenceCounted",
")",
"{",
"return",
"(",
"T",
")",
"(",
"(",
"R... | Tries to call {@link ReferenceCounted#touch(Object)} if the specified message implements
{@link ReferenceCounted}. If the specified message doesn't implement {@link ReferenceCounted},
this method does nothing. | [
"Tries",
"to",
"call",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ReferenceCountUtil.java#L74-L80 | train | touch a message. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
1056,
3543,
1006,
1056,
5796,
2290,
1010,
4874,
9374,
1007,
1063,
2065,
1006,
5796,
2290,
6013,
11253,
4431,
3597,
16671,
2098,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPool.java | LocalBufferPool.lazyDestroy | @Override
public void lazyDestroy() {
// NOTE: if you change this logic, be sure to update recycle() as well!
synchronized (availableMemorySegments) {
if (!isDestroyed) {
MemorySegment segment;
while ((segment = availableMemorySegments.poll()) != null) {
returnMemorySegment(segment);
}
BufferListener listener;
while ((listener = registeredListeners.poll()) != null) {
listener.notifyBufferDestroyed();
}
isDestroyed = true;
}
}
try {
networkBufferPool.destroyBufferPool(this);
} catch (IOException e) {
ExceptionUtils.rethrow(e);
}
} | java | @Override
public void lazyDestroy() {
// NOTE: if you change this logic, be sure to update recycle() as well!
synchronized (availableMemorySegments) {
if (!isDestroyed) {
MemorySegment segment;
while ((segment = availableMemorySegments.poll()) != null) {
returnMemorySegment(segment);
}
BufferListener listener;
while ((listener = registeredListeners.poll()) != null) {
listener.notifyBufferDestroyed();
}
isDestroyed = true;
}
}
try {
networkBufferPool.destroyBufferPool(this);
} catch (IOException e) {
ExceptionUtils.rethrow(e);
}
} | [
"@",
"Override",
"public",
"void",
"lazyDestroy",
"(",
")",
"{",
"// NOTE: if you change this logic, be sure to update recycle() as well!",
"synchronized",
"(",
"availableMemorySegments",
")",
"{",
"if",
"(",
"!",
"isDestroyed",
")",
"{",
"MemorySegment",
"segment",
";",
... | Destroy is called after the produce or consume phase of a task finishes. | [
"Destroy",
"is",
"called",
"after",
"the",
"produce",
"or",
"consume",
"phase",
"of",
"a",
"task",
"finishes",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPool.java#L315-L339 | train | This method is called by the buffer pool when it is being destroyed. | [
30522,
1030,
2058,
15637,
2270,
11675,
13971,
6155,
13181,
2100,
1006,
1007,
1063,
1013,
1013,
3602,
1024,
2065,
2017,
2689,
2023,
7961,
1010,
2022,
2469,
2000,
10651,
28667,
2100,
14321,
1006,
1007,
2004,
2092,
999,
25549,
1006,
2800,
4168... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.enableCheckpointing | @Deprecated
@SuppressWarnings("deprecation")
@PublicEvolving
public StreamExecutionEnvironment enableCheckpointing(long interval, CheckpointingMode mode, boolean force) {
checkpointCfg.setCheckpointingMode(mode);
checkpointCfg.setCheckpointInterval(interval);
checkpointCfg.setForceCheckpointing(force);
return this;
} | java | @Deprecated
@SuppressWarnings("deprecation")
@PublicEvolving
public StreamExecutionEnvironment enableCheckpointing(long interval, CheckpointingMode mode, boolean force) {
checkpointCfg.setCheckpointingMode(mode);
checkpointCfg.setCheckpointInterval(interval);
checkpointCfg.setForceCheckpointing(force);
return this;
} | [
"@",
"Deprecated",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"@",
"PublicEvolving",
"public",
"StreamExecutionEnvironment",
"enableCheckpointing",
"(",
"long",
"interval",
",",
"CheckpointingMode",
"mode",
",",
"boolean",
"force",
")",
"{",
"checkpointCfg",
... | Enables checkpointing for the streaming job. The distributed state of the streaming
dataflow will be periodically snapshotted. In case of a failure, the streaming
dataflow will be restarted from the latest completed checkpoint.
<p>The job draws checkpoints periodically, in the given interval. The state will be
stored in the configured state backend.
<p>NOTE: Checkpointing iterative streaming dataflows in not properly supported at
the moment. If the "force" parameter is set to true, the system will execute the
job nonetheless.
@param interval
Time interval between state checkpoints in millis.
@param mode
The checkpointing mode, selecting between "exactly once" and "at least once" guaranteed.
@param force
If true checkpointing will be enabled for iterative jobs as well.
@deprecated Use {@link #enableCheckpointing(long, CheckpointingMode)} instead.
Forcing checkpoints will be removed in the future. | [
"Enables",
"checkpointing",
"for",
"the",
"streaming",
"job",
".",
"The",
"distributed",
"state",
"of",
"the",
"streaming",
"dataflow",
"will",
"be",
"periodically",
"snapshotted",
".",
"In",
"case",
"of",
"a",
"failure",
"the",
"streaming",
"dataflow",
"will",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L366-L374 | train | Enable checkpointing for the current environment. | [
30522,
1030,
2139,
28139,
12921,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
2139,
28139,
10719,
1000,
1007,
1030,
2270,
6777,
4747,
6455,
2270,
5460,
10288,
8586,
13700,
2368,
21663,
2239,
3672,
9585,
5403,
3600,
8400,
2075,
1006,
2146,
134... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java | RequiredParameters.checkIsCastableToDefinedType | private void checkIsCastableToDefinedType(Option o, Map<String, String> data) throws RequiredParametersException {
if (o.hasType() && !o.isCastableToDefinedType(data.get(o.getName()))) {
throw new RequiredParametersException("Value for parameter " + o.getName() +
" cannot be cast to type " + o.getType());
}
} | java | private void checkIsCastableToDefinedType(Option o, Map<String, String> data) throws RequiredParametersException {
if (o.hasType() && !o.isCastableToDefinedType(data.get(o.getName()))) {
throw new RequiredParametersException("Value for parameter " + o.getName() +
" cannot be cast to type " + o.getType());
}
} | [
"private",
"void",
"checkIsCastableToDefinedType",
"(",
"Option",
"o",
",",
"Map",
"<",
"String",
",",
"String",
">",
"data",
")",
"throws",
"RequiredParametersException",
"{",
"if",
"(",
"o",
".",
"hasType",
"(",
")",
"&&",
"!",
"o",
".",
"isCastableToDefin... | is castable to the type of the option (if any is defined) | [
"is",
"castable",
"to",
"the",
"type",
"of",
"the",
"option",
"(",
"if",
"any",
"is",
"defined",
")"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java#L129-L134 | train | Checks if the value of the option is castable to the defined type. | [
30522,
2797,
11675,
4638,
2483,
10526,
3085,
3406,
3207,
23460,
11927,
18863,
1006,
5724,
1051,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
2951,
1007,
11618,
3223,
28689,
22828,
3366,
2595,
24422,
1063,
2065,
1006,
1051,
1012,
27151,
5051,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/IOUtils.java | IOUtils.readFully | public static void readFully(final InputStream in, final byte[] buf, int off, final int len)
throws IOException {
int toRead = len;
while (toRead > 0) {
final int ret = in.read(buf, off, toRead);
if (ret < 0) {
throw new IOException("Premeture EOF from inputStream");
}
toRead -= ret;
off += ret;
}
} | java | public static void readFully(final InputStream in, final byte[] buf, int off, final int len)
throws IOException {
int toRead = len;
while (toRead > 0) {
final int ret = in.read(buf, off, toRead);
if (ret < 0) {
throw new IOException("Premeture EOF from inputStream");
}
toRead -= ret;
off += ret;
}
} | [
"public",
"static",
"void",
"readFully",
"(",
"final",
"InputStream",
"in",
",",
"final",
"byte",
"[",
"]",
"buf",
",",
"int",
"off",
",",
"final",
"int",
"len",
")",
"throws",
"IOException",
"{",
"int",
"toRead",
"=",
"len",
";",
"while",
"(",
"toRead... | Reads len bytes in a loop.
@param in
The InputStream to read from
@param buf
The buffer to fill
@param off
offset from the buffer
@param len
the length of bytes to read
@throws IOException
if it could not read requested number of bytes for any reason (including EOF) | [
"Reads",
"len",
"bytes",
"in",
"a",
"loop",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/IOUtils.java#L129-L140 | train | Read len bytes from the input stream into the given byte array. | [
30522,
2270,
10763,
11675,
3191,
7699,
1006,
2345,
20407,
25379,
1999,
1010,
2345,
24880,
1031,
1033,
20934,
2546,
1010,
20014,
2125,
1010,
2345,
20014,
18798,
1007,
11618,
22834,
10288,
24422,
1063,
20014,
9538,
4215,
1027,
18798,
1025,
2096... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/types/StringValue.java | StringValue.setValue | @Override
public void setValue(StringValue value) {
checkNotNull(value);
setValue(value.value, 0, value.len);
} | java | @Override
public void setValue(StringValue value) {
checkNotNull(value);
setValue(value.value, 0, value.len);
} | [
"@",
"Override",
"public",
"void",
"setValue",
"(",
"StringValue",
"value",
")",
"{",
"checkNotNull",
"(",
"value",
")",
";",
"setValue",
"(",
"value",
".",
"value",
",",
"0",
",",
"value",
".",
"len",
")",
";",
"}"
] | Sets the value of the StringValue to the given string.
@param value The new string value. | [
"Sets",
"the",
"value",
"of",
"the",
"StringValue",
"to",
"the",
"given",
"string",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/StringValue.java#L159-L163 | train | Sets the value of the CID field. | [
30522,
1030,
2058,
15637,
2270,
11675,
2275,
10175,
5657,
1006,
5164,
10175,
5657,
3643,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
3643,
1007,
1025,
2275,
10175,
5657,
1006,
3643,
1012,
3643,
1010,
1014,
1010,
3643,
1012,
18798,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java | AbsSetting.getInt | public Integer getInt(String key, String group, Integer defaultValue) {
return Convert.toInt(getByGroup(key, group), defaultValue);
} | java | public Integer getInt(String key, String group, Integer defaultValue) {
return Convert.toInt(getByGroup(key, group), defaultValue);
} | [
"public",
"Integer",
"getInt",
"(",
"String",
"key",
",",
"String",
"group",
",",
"Integer",
"defaultValue",
")",
"{",
"return",
"Convert",
".",
"toInt",
"(",
"getByGroup",
"(",
"key",
",",
"group",
")",
",",
"defaultValue",
")",
";",
"}"
] | 获取数字型型属性值
@param key 属性名
@param group 分组名
@param defaultValue 默认值
@return 属性值 | [
"获取数字型型属性值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java#L164-L166 | train | Get Integer value from map by key and group. | [
30522,
2270,
16109,
2131,
18447,
1006,
5164,
3145,
1010,
5164,
2177,
1010,
16109,
12398,
10175,
5657,
1007,
1063,
2709,
10463,
1012,
2000,
18447,
1006,
2131,
3762,
17058,
1006,
3145,
1010,
2177,
1007,
1010,
12398,
10175,
5657,
1007,
1025,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.getClass | @SuppressWarnings("unchecked")
public <T> Class<T> getClass(String key, Class<? extends T> defaultValue, ClassLoader classLoader) throws ClassNotFoundException {
Object o = getRawValue(key);
if (o == null) {
return (Class<T>) defaultValue;
}
if (o.getClass() == String.class) {
return (Class<T>) Class.forName((String) o, true, classLoader);
}
LOG.warn("Configuration cannot evaluate value " + o + " as a class name");
return (Class<T>) defaultValue;
} | java | @SuppressWarnings("unchecked")
public <T> Class<T> getClass(String key, Class<? extends T> defaultValue, ClassLoader classLoader) throws ClassNotFoundException {
Object o = getRawValue(key);
if (o == null) {
return (Class<T>) defaultValue;
}
if (o.getClass() == String.class) {
return (Class<T>) Class.forName((String) o, true, classLoader);
}
LOG.warn("Configuration cannot evaluate value " + o + " as a class name");
return (Class<T>) defaultValue;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"Class",
"<",
"T",
">",
"getClass",
"(",
"String",
"key",
",",
"Class",
"<",
"?",
"extends",
"T",
">",
"defaultValue",
",",
"ClassLoader",
"classLoader",
")",
"throws",
"ClassNotF... | Returns the class associated with the given key as a string.
@param <T> The type of the class to return.
@param key The key pointing to the associated value
@param defaultValue The optional default value returned if no entry exists
@param classLoader The class loader used to resolve the class.
@return The value associated with the given key, or the default value, if to entry for the key exists. | [
"Returns",
"the",
"class",
"associated",
"with",
"the",
"given",
"key",
"as",
"a",
"string",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L98-L111 | train | Gets the Class object for the given key. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
1026,
1056,
1028,
2465,
1026,
1056,
1028,
2131,
26266,
1006,
5164,
3145,
1010,
2465,
1026,
1029,
8908,
1056,
1028,
12398,
10175,
5657,
1010,
2465,
11066,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/concurrent/DefaultPromise.java | DefaultPromise.progressiveListeners | private synchronized Object progressiveListeners() {
Object listeners = this.listeners;
if (listeners == null) {
// No listeners added
return null;
}
if (listeners instanceof DefaultFutureListeners) {
// Copy DefaultFutureListeners into an array of listeners.
DefaultFutureListeners dfl = (DefaultFutureListeners) listeners;
int progressiveSize = dfl.progressiveSize();
switch (progressiveSize) {
case 0:
return null;
case 1:
for (GenericFutureListener<?> l: dfl.listeners()) {
if (l instanceof GenericProgressiveFutureListener) {
return l;
}
}
return null;
}
GenericFutureListener<?>[] array = dfl.listeners();
GenericProgressiveFutureListener<?>[] copy = new GenericProgressiveFutureListener[progressiveSize];
for (int i = 0, j = 0; j < progressiveSize; i ++) {
GenericFutureListener<?> l = array[i];
if (l instanceof GenericProgressiveFutureListener) {
copy[j ++] = (GenericProgressiveFutureListener<?>) l;
}
}
return copy;
} else if (listeners instanceof GenericProgressiveFutureListener) {
return listeners;
} else {
// Only one listener was added and it's not a progressive listener.
return null;
}
} | java | private synchronized Object progressiveListeners() {
Object listeners = this.listeners;
if (listeners == null) {
// No listeners added
return null;
}
if (listeners instanceof DefaultFutureListeners) {
// Copy DefaultFutureListeners into an array of listeners.
DefaultFutureListeners dfl = (DefaultFutureListeners) listeners;
int progressiveSize = dfl.progressiveSize();
switch (progressiveSize) {
case 0:
return null;
case 1:
for (GenericFutureListener<?> l: dfl.listeners()) {
if (l instanceof GenericProgressiveFutureListener) {
return l;
}
}
return null;
}
GenericFutureListener<?>[] array = dfl.listeners();
GenericProgressiveFutureListener<?>[] copy = new GenericProgressiveFutureListener[progressiveSize];
for (int i = 0, j = 0; j < progressiveSize; i ++) {
GenericFutureListener<?> l = array[i];
if (l instanceof GenericProgressiveFutureListener) {
copy[j ++] = (GenericProgressiveFutureListener<?>) l;
}
}
return copy;
} else if (listeners instanceof GenericProgressiveFutureListener) {
return listeners;
} else {
// Only one listener was added and it's not a progressive listener.
return null;
}
} | [
"private",
"synchronized",
"Object",
"progressiveListeners",
"(",
")",
"{",
"Object",
"listeners",
"=",
"this",
".",
"listeners",
";",
"if",
"(",
"listeners",
"==",
"null",
")",
"{",
"// No listeners added",
"return",
"null",
";",
"}",
"if",
"(",
"listeners",
... | Returns a {@link GenericProgressiveFutureListener}, an array of {@link GenericProgressiveFutureListener}, or
{@code null}. | [
"Returns",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java#L686-L725 | train | Get the progressive listeners. | [
30522,
2797,
25549,
4874,
6555,
9863,
24454,
2015,
1006,
1007,
1063,
4874,
13810,
1027,
2023,
1012,
13810,
1025,
2065,
1006,
13810,
1027,
1027,
19701,
1007,
1063,
1013,
1013,
2053,
13810,
2794,
2709,
19701,
1025,
1065,
2065,
1006,
13810,
60... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java | LocalFileSystem.delete | private boolean delete(final File f) throws IOException {
if (f.isDirectory()) {
final File[] files = f.listFiles();
if (files != null) {
for (File file : files) {
final boolean del = delete(file);
if (!del) {
return false;
}
}
}
} else {
return f.delete();
}
// Now directory is empty
return f.delete();
} | java | private boolean delete(final File f) throws IOException {
if (f.isDirectory()) {
final File[] files = f.listFiles();
if (files != null) {
for (File file : files) {
final boolean del = delete(file);
if (!del) {
return false;
}
}
}
} else {
return f.delete();
}
// Now directory is empty
return f.delete();
} | [
"private",
"boolean",
"delete",
"(",
"final",
"File",
"f",
")",
"throws",
"IOException",
"{",
"if",
"(",
"f",
".",
"isDirectory",
"(",
")",
")",
"{",
"final",
"File",
"[",
"]",
"files",
"=",
"f",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"files",... | Deletes the given file or directory.
@param f
the file to be deleted
@return <code>true</code> if all files were deleted successfully, <code>false</code> otherwise
@throws IOException
thrown if an error occurred while deleting the files/directories | [
"Deletes",
"the",
"given",
"file",
"or",
"directory",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java#L208-L226 | train | Delete a file or directory. | [
30522,
2797,
22017,
20898,
3972,
12870,
1006,
2345,
5371,
1042,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
1042,
1012,
2003,
4305,
2890,
16761,
2100,
1006,
1007,
1007,
1063,
2345,
5371,
1031,
1033,
6764,
1027,
1042,
1012,
2862,
887... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java | CsvReader.tupleType | public <T extends Tuple> DataSource<T> tupleType(Class<T> targetType) {
Preconditions.checkNotNull(targetType, "The target type class must not be null.");
if (!Tuple.class.isAssignableFrom(targetType)) {
throw new IllegalArgumentException("The target type must be a subclass of " + Tuple.class.getName());
}
@SuppressWarnings("unchecked")
TupleTypeInfo<T> typeInfo = (TupleTypeInfo<T>) TypeExtractor.createTypeInfo(targetType);
CsvInputFormat<T> inputFormat = new TupleCsvInputFormat<T>(path, this.lineDelimiter, this.fieldDelimiter, typeInfo, this.includedMask);
Class<?>[] classes = new Class<?>[typeInfo.getArity()];
for (int i = 0; i < typeInfo.getArity(); i++) {
classes[i] = typeInfo.getTypeAt(i).getTypeClass();
}
configureInputFormat(inputFormat);
return new DataSource<T>(executionContext, inputFormat, typeInfo, Utils.getCallLocationName());
} | java | public <T extends Tuple> DataSource<T> tupleType(Class<T> targetType) {
Preconditions.checkNotNull(targetType, "The target type class must not be null.");
if (!Tuple.class.isAssignableFrom(targetType)) {
throw new IllegalArgumentException("The target type must be a subclass of " + Tuple.class.getName());
}
@SuppressWarnings("unchecked")
TupleTypeInfo<T> typeInfo = (TupleTypeInfo<T>) TypeExtractor.createTypeInfo(targetType);
CsvInputFormat<T> inputFormat = new TupleCsvInputFormat<T>(path, this.lineDelimiter, this.fieldDelimiter, typeInfo, this.includedMask);
Class<?>[] classes = new Class<?>[typeInfo.getArity()];
for (int i = 0; i < typeInfo.getArity(); i++) {
classes[i] = typeInfo.getTypeAt(i).getTypeClass();
}
configureInputFormat(inputFormat);
return new DataSource<T>(executionContext, inputFormat, typeInfo, Utils.getCallLocationName());
} | [
"public",
"<",
"T",
"extends",
"Tuple",
">",
"DataSource",
"<",
"T",
">",
"tupleType",
"(",
"Class",
"<",
"T",
">",
"targetType",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"targetType",
",",
"\"The target type class must not be null.\"",
")",
";",
"... | Configures the reader to read the CSV data and parse it to the given type. The type must be a subclass of
{@link Tuple}. The type information for the fields is obtained from the type class. The type
consequently needs to specify all generic field types of the tuple.
@param targetType The class of the target type, needs to be a subclass of Tuple.
@return The DataSet representing the parsed CSV data. | [
"Configures",
"the",
"reader",
"to",
"read",
"the",
"CSV",
"data",
"and",
"parse",
"it",
"to",
"the",
"given",
"type",
".",
"The",
"type",
"must",
"be",
"a",
"subclass",
"of",
"{",
"@link",
"Tuple",
"}",
".",
"The",
"type",
"information",
"for",
"the",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java#L342-L359 | train | Creates a data source that reads the CSV data from the file into the specified type. | [
30522,
2270,
1026,
1056,
8908,
10722,
10814,
1028,
2951,
6499,
3126,
3401,
1026,
1056,
1028,
10722,
10814,
13874,
1006,
2465,
1026,
1056,
1028,
4539,
13874,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
4539,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/logging/DeferredLog.java | DeferredLog.replay | public static Log replay(Log source, Class<?> destination) {
return replay(source, LogFactory.getLog(destination));
} | java | public static Log replay(Log source, Class<?> destination) {
return replay(source, LogFactory.getLog(destination));
} | [
"public",
"static",
"Log",
"replay",
"(",
"Log",
"source",
",",
"Class",
"<",
"?",
">",
"destination",
")",
"{",
"return",
"replay",
"(",
"source",
",",
"LogFactory",
".",
"getLog",
"(",
"destination",
")",
")",
";",
"}"
] | Replay from a source log to a destination log when the source is deferred.
@param source the source logger
@param destination the destination logger class
@return the destination | [
"Replay",
"from",
"a",
"source",
"log",
"to",
"a",
"destination",
"log",
"when",
"the",
"source",
"is",
"deferred",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java#L200-L202 | train | Replay the source log to the destination log. | [
30522,
2270,
10763,
8833,
15712,
1006,
8833,
3120,
1010,
2465,
1026,
1029,
1028,
7688,
1007,
1063,
2709,
15712,
1006,
3120,
1010,
8833,
21450,
1012,
2131,
21197,
1006,
7688,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/BinaryInputFormat.java | BinaryInputFormat.getCurrentState | @PublicEvolving
@Override
public Tuple2<Long, Long> getCurrentState() throws IOException {
if (this.blockBasedInput == null) {
throw new RuntimeException("You must have forgotten to call open() on your input format.");
}
return new Tuple2<>(
this.blockBasedInput.getCurrBlockPos(), // the last read index in the block
this.readRecords // the number of records read
);
} | java | @PublicEvolving
@Override
public Tuple2<Long, Long> getCurrentState() throws IOException {
if (this.blockBasedInput == null) {
throw new RuntimeException("You must have forgotten to call open() on your input format.");
}
return new Tuple2<>(
this.blockBasedInput.getCurrBlockPos(), // the last read index in the block
this.readRecords // the number of records read
);
} | [
"@",
"PublicEvolving",
"@",
"Override",
"public",
"Tuple2",
"<",
"Long",
",",
"Long",
">",
"getCurrentState",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"blockBasedInput",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/BinaryInputFormat.java#L384-L395 | train | Get the current state of the input stream. | [
30522,
1030,
2270,
6777,
4747,
6455,
1030,
2058,
15637,
2270,
10722,
10814,
2475,
1026,
2146,
1010,
2146,
1028,
2131,
10841,
14343,
7666,
12259,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
2023,
1012,
3796,
15058,
8718,
18780,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
redisson/redisson | redisson/src/main/java/org/redisson/spring/cache/CacheConfig.java | CacheConfig.fromYAML | public static Map<String, ? extends CacheConfig> fromYAML(File file) throws IOException {
return new CacheConfigSupport().fromYAML(file);
} | java | public static Map<String, ? extends CacheConfig> fromYAML(File file) throws IOException {
return new CacheConfigSupport().fromYAML(file);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"?",
"extends",
"CacheConfig",
">",
"fromYAML",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"return",
"new",
"CacheConfigSupport",
"(",
")",
".",
"fromYAML",
"(",
"file",
")",
";",
"}"
] | Read config objects stored in YAML format from <code>File</code>
@param file of config
@return config
@throws IOException error | [
"Read",
"config",
"objects",
"stored",
"in",
"YAML",
"format",
"from",
"<code",
">",
"File<",
"/",
"code",
">"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/spring/cache/CacheConfig.java#L201-L203 | train | Creates a map from a YAML file. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
1029,
8908,
17053,
8663,
8873,
2290,
1028,
2013,
14852,
2140,
1006,
5371,
5371,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
2047,
17053,
8663,
8873,
5620,
6279,
6442,
1006,
1007,
1012,
2013,
148... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/TwoPhaseCommitSinkFunction.java | TwoPhaseCommitSinkFunction.recoverAndCommitInternal | private void recoverAndCommitInternal(TransactionHolder<TXN> transactionHolder) {
try {
logWarningIfTimeoutAlmostReached(transactionHolder);
recoverAndCommit(transactionHolder.handle);
} catch (final Exception e) {
final long elapsedTime = clock.millis() - transactionHolder.transactionStartTime;
if (ignoreFailuresAfterTransactionTimeout && elapsedTime > transactionTimeout) {
LOG.error("Error while committing transaction {}. " +
"Transaction has been open for longer than the transaction timeout ({})." +
"Commit will not be attempted again. Data loss might have occurred.",
transactionHolder.handle, transactionTimeout, e);
} else {
throw e;
}
}
} | java | private void recoverAndCommitInternal(TransactionHolder<TXN> transactionHolder) {
try {
logWarningIfTimeoutAlmostReached(transactionHolder);
recoverAndCommit(transactionHolder.handle);
} catch (final Exception e) {
final long elapsedTime = clock.millis() - transactionHolder.transactionStartTime;
if (ignoreFailuresAfterTransactionTimeout && elapsedTime > transactionTimeout) {
LOG.error("Error while committing transaction {}. " +
"Transaction has been open for longer than the transaction timeout ({})." +
"Commit will not be attempted again. Data loss might have occurred.",
transactionHolder.handle, transactionTimeout, e);
} else {
throw e;
}
}
} | [
"private",
"void",
"recoverAndCommitInternal",
"(",
"TransactionHolder",
"<",
"TXN",
">",
"transactionHolder",
")",
"{",
"try",
"{",
"logWarningIfTimeoutAlmostReached",
"(",
"transactionHolder",
")",
";",
"recoverAndCommit",
"(",
"transactionHolder",
".",
"handle",
")",... | This method must be the only place to call {@link #recoverAndCommit(Object)} to ensure that
the configuration parameters {@link #transactionTimeout} and
{@link #ignoreFailuresAfterTransactionTimeout} are respected. | [
"This",
"method",
"must",
"be",
"the",
"only",
"place",
"to",
"call",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/TwoPhaseCommitSinkFunction.java#L390-L405 | train | Recover and commit internal method. | [
30522,
2797,
11675,
8980,
5685,
9006,
22930,
18447,
11795,
2389,
1006,
12598,
14528,
1026,
19067,
2078,
1028,
12598,
14528,
1007,
1063,
3046,
1063,
8833,
9028,
5582,
10128,
7292,
5833,
2389,
11800,
16416,
7690,
1006,
12598,
14528,
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... |
networknt/light-4j | dump/src/main/java/com/networknt/dump/BodyDumper.java | BodyDumper.putDumpInfoTo | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
if(StringUtils.isNotBlank(this.bodyContent)) {
result.put(DumpConstants.BODY, this.bodyContent);
}
} | java | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
if(StringUtils.isNotBlank(this.bodyContent)) {
result.put(DumpConstants.BODY, this.bodyContent);
}
} | [
"@",
"Override",
"protected",
"void",
"putDumpInfoTo",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"this",
".",
"bodyContent",
")",
")",
"{",
"result",
".",
"put",
"(",
"DumpConstan... | put bodyContent to result
@param result a Map<String, Object> you want to put dumping info to. | [
"put",
"bodyContent",
"to",
"result"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/BodyDumper.java#L51-L56 | train | Put the dump info to the result map. | [
30522,
1030,
2058,
15637,
5123,
11675,
2404,
8566,
8737,
2378,
14876,
3406,
1006,
4949,
1026,
5164,
1010,
4874,
1028,
2765,
1007,
1063,
2065,
1006,
5164,
21823,
4877,
1012,
3475,
4140,
28522,
8950,
1006,
2023,
1012,
2303,
8663,
6528,
2102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/AbstractServerBase.java | AbstractServerBase.start | public void start() throws Throwable {
Preconditions.checkState(serverAddress == null && serverShutdownFuture.get() == null,
serverName + " is already running @ " + serverAddress + ". ");
Iterator<Integer> portIterator = bindPortRange.iterator();
while (portIterator.hasNext() && !attemptToBind(portIterator.next())) {}
if (serverAddress != null) {
log.info("Started {} @ {}.", serverName, serverAddress);
} else {
log.info("Unable to start {}. All ports in provided range ({}) are occupied.", serverName, bindPortRange);
throw new FlinkRuntimeException("Unable to start " + serverName + ". All ports in provided range are occupied.");
}
} | java | public void start() throws Throwable {
Preconditions.checkState(serverAddress == null && serverShutdownFuture.get() == null,
serverName + " is already running @ " + serverAddress + ". ");
Iterator<Integer> portIterator = bindPortRange.iterator();
while (portIterator.hasNext() && !attemptToBind(portIterator.next())) {}
if (serverAddress != null) {
log.info("Started {} @ {}.", serverName, serverAddress);
} else {
log.info("Unable to start {}. All ports in provided range ({}) are occupied.", serverName, bindPortRange);
throw new FlinkRuntimeException("Unable to start " + serverName + ". All ports in provided range are occupied.");
}
} | [
"public",
"void",
"start",
"(",
")",
"throws",
"Throwable",
"{",
"Preconditions",
".",
"checkState",
"(",
"serverAddress",
"==",
"null",
"&&",
"serverShutdownFuture",
".",
"get",
"(",
")",
"==",
"null",
",",
"serverName",
"+",
"\" is already running @ \"",
"+",
... | Starts the server by binding to the configured bind address (blocking).
@throws Exception If something goes wrong during the bind operation. | [
"Starts",
"the",
"server",
"by",
"binding",
"to",
"the",
"configured",
"bind",
"address",
"(",
"blocking",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/AbstractServerBase.java#L187-L200 | train | Starts the server. | [
30522,
2270,
11675,
2707,
1006,
1007,
11618,
5466,
3085,
1063,
3653,
8663,
20562,
2015,
1012,
14148,
12259,
1006,
8241,
4215,
16200,
4757,
1027,
1027,
19701,
1004,
1004,
14903,
6979,
2102,
7698,
11263,
11244,
1012,
2131,
1006,
1007,
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-extra/src/main/java/cn/hutool/extra/template/engine/rythm/RythmEngine.java | RythmEngine.getTemplate | @Override
public Template getTemplate(String resource) {
return RythmTemplate.wrap(engine.getTemplate(resource));
} | java | @Override
public Template getTemplate(String resource) {
return RythmTemplate.wrap(engine.getTemplate(resource));
} | [
"@",
"Override",
"public",
"Template",
"getTemplate",
"(",
"String",
"resource",
")",
"{",
"return",
"RythmTemplate",
".",
"wrap",
"(",
"engine",
".",
"getTemplate",
"(",
"resource",
")",
")",
";",
"}"
] | --------------------------------------------------------------------------------- Constructor end | [
"---------------------------------------------------------------------------------",
"Constructor",
"end"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/rythm/RythmEngine.java#L47-L50 | train | Override this method to get a template from the engine. | [
30522,
1030,
2058,
15637,
2270,
23561,
2131,
18532,
15725,
1006,
5164,
7692,
1007,
1063,
2709,
29431,
2705,
20492,
6633,
15725,
1012,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/file/FileWriter.java | FileWriter.write | public File write(String content, boolean isAppend) throws IORuntimeException {
BufferedWriter writer = null;
try {
writer = getWriter(isAppend);
writer.write(content);
writer.flush();
}catch(IOException e){
throw new IORuntimeException(e);
}finally {
IoUtil.close(writer);
}
return file;
} | java | public File write(String content, boolean isAppend) throws IORuntimeException {
BufferedWriter writer = null;
try {
writer = getWriter(isAppend);
writer.write(content);
writer.flush();
}catch(IOException e){
throw new IORuntimeException(e);
}finally {
IoUtil.close(writer);
}
return file;
} | [
"public",
"File",
"write",
"(",
"String",
"content",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"BufferedWriter",
"writer",
"=",
"null",
";",
"try",
"{",
"writer",
"=",
"getWriter",
"(",
"isAppend",
")",
";",
"writer",
".",
"write"... | 将String写入文件
@param content 写入的内容
@param isAppend 是否追加
@return 目标文件
@throws IORuntimeException IO异常 | [
"将String写入文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java#L113-L125 | train | Writes the content to the file. | [
30522,
2270,
5371,
4339,
1006,
5164,
4180,
1010,
22017,
20898,
18061,
21512,
4859,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
17698,
2098,
15994,
3213,
1027,
19701,
1025,
3046,
1063,
3213,
1027,
2131,
15994,
1006,
18061,
21512,
4859... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.isFalse | public static void isFalse(boolean expression, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (expression) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
} | java | public static void isFalse(boolean expression, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (expression) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
} | [
"public",
"static",
"void",
"isFalse",
"(",
"boolean",
"expression",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"expression",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"... | 断言是否为假,如果为 {@code true} 抛出 {@code IllegalArgumentException} 异常<br>
<pre class="code">
Assert.isFalse(i < 0, "The value must be greater than zero");
</pre>
@param expression 波尔值
@param errorMsgTemplate 错误抛出异常附带的消息模板,变量用{}代替
@param params 参数列表
@throws IllegalArgumentException if expression is {@code false} | [
"断言是否为假,如果为",
"{",
"@code",
"true",
"}",
"抛出",
"{",
"@code",
"IllegalArgumentException",
"}",
"异常<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L63-L67 | train | Method isFalse. | [
30522,
2270,
10763,
11675,
2003,
7011,
4877,
2063,
1006,
22017,
20898,
3670,
1010,
5164,
7561,
5244,
13512,
6633,
15725,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
6206,
2906,
22850,
15781,
2595,
24422,
1063,
2065,
1006,
3670,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/servlet/ServletUtil.java | ServletUtil.getMultistageReverseProxyIp | private static String getMultistageReverseProxyIp(String ip) {
// 多级反向代理检测
if (ip != null && ip.indexOf(",") > 0) {
final String[] ips = ip.trim().split(",");
for (String subIp : ips) {
if (false == isUnknow(subIp)) {
ip = subIp;
break;
}
}
}
return ip;
} | java | private static String getMultistageReverseProxyIp(String ip) {
// 多级反向代理检测
if (ip != null && ip.indexOf(",") > 0) {
final String[] ips = ip.trim().split(",");
for (String subIp : ips) {
if (false == isUnknow(subIp)) {
ip = subIp;
break;
}
}
}
return ip;
} | [
"private",
"static",
"String",
"getMultistageReverseProxyIp",
"(",
"String",
"ip",
")",
"{",
"// 多级反向代理检测\r",
"if",
"(",
"ip",
"!=",
"null",
"&&",
"ip",
".",
"indexOf",
"(",
"\",\"",
")",
">",
"0",
")",
"{",
"final",
"String",
"[",
"]",
"ips",
"=",
"ip... | 从多级反向代理中获得第一个非unknown IP地址
@param ip 获得的IP地址
@return 第一个非unknown IP地址 | [
"从多级反向代理中获得第一个非unknown",
"IP地址"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L598-L610 | train | Gets the multi - proxy IP address. | [
30522,
2797,
10763,
5164,
2131,
12274,
7096,
11921,
4590,
22507,
3366,
21572,
18037,
11514,
1006,
5164,
12997,
1007,
1063,
1013,
1013,
100,
100,
100,
100,
1760,
100,
100,
100,
2065,
1006,
12997,
999,
1027,
19701,
1004,
1004,
12997,
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-java/src/main/java/org/apache/flink/api/java/ClosureCleaner.java | ClosureCleaner.clean | public static void clean(Object func, boolean checkSerializable) {
if (func == null) {
return;
}
final Class<?> cls = func.getClass();
// First find the field name of the "this$0" field, this can
// be "this$x" depending on the nesting
boolean closureAccessed = false;
for (Field f: cls.getDeclaredFields()) {
if (f.getName().startsWith("this$")) {
// found a closure referencing field - now try to clean
closureAccessed |= cleanThis0(func, cls, f.getName());
}
}
if (checkSerializable) {
try {
InstantiationUtil.serializeObject(func);
}
catch (Exception e) {
String functionType = getSuperClassOrInterfaceName(func.getClass());
String msg = functionType == null ?
(func + " is not serializable.") :
("The implementation of the " + functionType + " is not serializable.");
if (closureAccessed) {
msg += " The implementation accesses fields of its enclosing class, which is " +
"a common reason for non-serializability. " +
"A common solution is to make the function a proper (non-inner) class, or " +
"a static inner class.";
} else {
msg += " The object probably contains or references non serializable fields.";
}
throw new InvalidProgramException(msg, e);
}
}
} | java | public static void clean(Object func, boolean checkSerializable) {
if (func == null) {
return;
}
final Class<?> cls = func.getClass();
// First find the field name of the "this$0" field, this can
// be "this$x" depending on the nesting
boolean closureAccessed = false;
for (Field f: cls.getDeclaredFields()) {
if (f.getName().startsWith("this$")) {
// found a closure referencing field - now try to clean
closureAccessed |= cleanThis0(func, cls, f.getName());
}
}
if (checkSerializable) {
try {
InstantiationUtil.serializeObject(func);
}
catch (Exception e) {
String functionType = getSuperClassOrInterfaceName(func.getClass());
String msg = functionType == null ?
(func + " is not serializable.") :
("The implementation of the " + functionType + " is not serializable.");
if (closureAccessed) {
msg += " The implementation accesses fields of its enclosing class, which is " +
"a common reason for non-serializability. " +
"A common solution is to make the function a proper (non-inner) class, or " +
"a static inner class.";
} else {
msg += " The object probably contains or references non serializable fields.";
}
throw new InvalidProgramException(msg, e);
}
}
} | [
"public",
"static",
"void",
"clean",
"(",
"Object",
"func",
",",
"boolean",
"checkSerializable",
")",
"{",
"if",
"(",
"func",
"==",
"null",
")",
"{",
"return",
";",
"}",
"final",
"Class",
"<",
"?",
">",
"cls",
"=",
"func",
".",
"getClass",
"(",
")",
... | Tries to clean the closure of the given object, if the object is a non-static inner
class.
@param func The object whose closure should be cleaned.
@param checkSerializable Flag to indicate whether serializability should be checked after
the closure cleaning attempt.
@throws InvalidProgramException Thrown, if 'checkSerializable' is true, and the object was
not serializable after the closure cleaning.
@throws RuntimeException A RuntimeException may be thrown, if the code of the class could not
be loaded, in order to process during the closure cleaning. | [
"Tries",
"to",
"clean",
"the",
"closure",
"of",
"the",
"given",
"object",
"if",
"the",
"object",
"is",
"a",
"non",
"-",
"static",
"inner",
"class",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ClosureCleaner.java#L61-L102 | train | Clean the given object. | [
30522,
2270,
10763,
11675,
4550,
1006,
4874,
4569,
2278,
1010,
22017,
20898,
14148,
11610,
3669,
4143,
3468,
1007,
1063,
2065,
1006,
4569,
2278,
1027,
1027,
19701,
1007,
1063,
2709,
1025,
1065,
2345,
2465,
1026,
1029,
1028,
18856,
2015,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/py/String2PinyinConverter.java | String2PinyinConverter.convertSingle | public static Pinyin convertSingle(String single)
{
Pinyin pinyin = map.get(single);
if (pinyin == null) return Pinyin.none5;
return pinyin;
} | java | public static Pinyin convertSingle(String single)
{
Pinyin pinyin = map.get(single);
if (pinyin == null) return Pinyin.none5;
return pinyin;
} | [
"public",
"static",
"Pinyin",
"convertSingle",
"(",
"String",
"single",
")",
"{",
"Pinyin",
"pinyin",
"=",
"map",
".",
"get",
"(",
"single",
")",
";",
"if",
"(",
"pinyin",
"==",
"null",
")",
"return",
"Pinyin",
".",
"none5",
";",
"return",
"pinyin",
";... | 将单个音节转为拼音
@param single
@return | [
"将单个音节转为拼音"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/py/String2PinyinConverter.java#L154-L160 | train | Convert a single string to a Pinyin object. | [
30522,
2270,
10763,
9973,
19884,
2075,
2571,
1006,
5164,
2309,
1007,
1063,
9973,
9973,
1027,
4949,
1012,
2131,
1006,
2309,
1007,
1025,
2065,
1006,
9973,
1027,
1027,
19701,
1007,
2709,
9973,
1012,
3904,
2629,
1025,
2709,
9973,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.parseDateTime | public static DateTime parseDateTime(String dateString) {
dateString = normalize(dateString);
return parse(dateString, DatePattern.NORM_DATETIME_FORMAT);
} | java | public static DateTime parseDateTime(String dateString) {
dateString = normalize(dateString);
return parse(dateString, DatePattern.NORM_DATETIME_FORMAT);
} | [
"public",
"static",
"DateTime",
"parseDateTime",
"(",
"String",
"dateString",
")",
"{",
"dateString",
"=",
"normalize",
"(",
"dateString",
")",
";",
"return",
"parse",
"(",
"dateString",
",",
"DatePattern",
".",
"NORM_DATETIME_FORMAT",
")",
";",
"}"
] | 格式yyyy-MM-dd HH:mm:ss
@param dateString 标准形式的时间字符串
@return 日期对象 | [
"格式yyyy",
"-",
"MM",
"-",
"dd",
"HH",
":",
"mm",
":",
"ss"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L629-L632 | train | Parse a string of format yyyyMMddTHHmmssZ to a DateTime object. | [
30522,
2270,
10763,
3058,
7292,
11968,
6924,
3686,
7292,
1006,
5164,
5246,
18886,
3070,
1007,
1063,
5246,
18886,
3070,
1027,
3671,
4697,
1006,
5246,
18886,
3070,
1007,
1025,
2709,
11968,
3366,
1006,
5246,
18886,
3070,
1010,
3058,
4502,
1207... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-common/src/main/java/org/apache/spark/network/TransportContext.java | TransportContext.initializePipeline | public TransportChannelHandler initializePipeline(
SocketChannel channel,
RpcHandler channelRpcHandler) {
try {
TransportChannelHandler channelHandler = createChannelHandler(channel, channelRpcHandler);
ChunkFetchRequestHandler chunkFetchHandler =
createChunkFetchHandler(channelHandler, channelRpcHandler);
ChannelPipeline pipeline = channel.pipeline()
.addLast("encoder", ENCODER)
.addLast(TransportFrameDecoder.HANDLER_NAME, NettyUtils.createFrameDecoder())
.addLast("decoder", DECODER)
.addLast("idleStateHandler",
new IdleStateHandler(0, 0, conf.connectionTimeoutMs() / 1000))
// NOTE: Chunks are currently guaranteed to be returned in the order of request, but this
// would require more logic to guarantee if this were not part of the same event loop.
.addLast("handler", channelHandler);
// Use a separate EventLoopGroup to handle ChunkFetchRequest messages for shuffle rpcs.
if (chunkFetchWorkers != null) {
pipeline.addLast(chunkFetchWorkers, "chunkFetchHandler", chunkFetchHandler);
}
return channelHandler;
} catch (RuntimeException e) {
logger.error("Error while initializing Netty pipeline", e);
throw e;
}
} | java | public TransportChannelHandler initializePipeline(
SocketChannel channel,
RpcHandler channelRpcHandler) {
try {
TransportChannelHandler channelHandler = createChannelHandler(channel, channelRpcHandler);
ChunkFetchRequestHandler chunkFetchHandler =
createChunkFetchHandler(channelHandler, channelRpcHandler);
ChannelPipeline pipeline = channel.pipeline()
.addLast("encoder", ENCODER)
.addLast(TransportFrameDecoder.HANDLER_NAME, NettyUtils.createFrameDecoder())
.addLast("decoder", DECODER)
.addLast("idleStateHandler",
new IdleStateHandler(0, 0, conf.connectionTimeoutMs() / 1000))
// NOTE: Chunks are currently guaranteed to be returned in the order of request, but this
// would require more logic to guarantee if this were not part of the same event loop.
.addLast("handler", channelHandler);
// Use a separate EventLoopGroup to handle ChunkFetchRequest messages for shuffle rpcs.
if (chunkFetchWorkers != null) {
pipeline.addLast(chunkFetchWorkers, "chunkFetchHandler", chunkFetchHandler);
}
return channelHandler;
} catch (RuntimeException e) {
logger.error("Error while initializing Netty pipeline", e);
throw e;
}
} | [
"public",
"TransportChannelHandler",
"initializePipeline",
"(",
"SocketChannel",
"channel",
",",
"RpcHandler",
"channelRpcHandler",
")",
"{",
"try",
"{",
"TransportChannelHandler",
"channelHandler",
"=",
"createChannelHandler",
"(",
"channel",
",",
"channelRpcHandler",
")",... | Initializes a client or server Netty Channel Pipeline which encodes/decodes messages and
has a {@link org.apache.spark.network.server.TransportChannelHandler} to handle request or
response messages.
@param channel The channel to initialize.
@param channelRpcHandler The RPC handler to use for the channel.
@return Returns the created TransportChannelHandler, which includes a TransportClient that can
be used to communicate on this channel. The TransportClient is directly associated with a
ChannelHandler to ensure all users of the same channel get the same TransportClient object. | [
"Initializes",
"a",
"client",
"or",
"server",
"Netty",
"Channel",
"Pipeline",
"which",
"encodes",
"/",
"decodes",
"messages",
"and",
"has",
"a",
"{",
"@link",
"org",
".",
"apache",
".",
"spark",
".",
"network",
".",
"server",
".",
"TransportChannelHandler",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/TransportContext.java#L185-L210 | train | Initialize the Netty pipeline. | [
30522,
2270,
3665,
26058,
11774,
3917,
3988,
4697,
24548,
4179,
1006,
22278,
26058,
3149,
1010,
1054,
15042,
11774,
3917,
3149,
14536,
14856,
21222,
1007,
1063,
3046,
1063,
3665,
26058,
11774,
3917,
3149,
11774,
3917,
1027,
3443,
26058,
11774... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/restart/RestartStrategyFactory.java | RestartStrategyFactory.createRestartStrategyFactory | public static RestartStrategyFactory createRestartStrategyFactory(Configuration configuration) throws Exception {
String restartStrategyName = configuration.getString(ConfigConstants.RESTART_STRATEGY, null);
if (restartStrategyName == null) {
// support deprecated ConfigConstants values
final int numberExecutionRetries = configuration.getInteger(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS,
ConfigConstants.DEFAULT_EXECUTION_RETRIES);
String pauseString = configuration.getString(AkkaOptions.WATCH_HEARTBEAT_PAUSE);
String delayString = configuration.getString(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY,
pauseString);
long delay;
try {
delay = Duration.apply(delayString).toMillis();
} catch (NumberFormatException nfe) {
if (delayString.equals(pauseString)) {
throw new Exception("Invalid config value for " +
AkkaOptions.WATCH_HEARTBEAT_PAUSE.key() + ": " + pauseString +
". Value must be a valid duration (such as '10 s' or '1 min')");
} else {
throw new Exception("Invalid config value for " +
ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY + ": " + delayString +
". Value must be a valid duration (such as '100 milli' or '10 s')");
}
}
if (numberExecutionRetries > 0 && delay >= 0) {
return new FixedDelayRestartStrategy.FixedDelayRestartStrategyFactory(numberExecutionRetries, delay);
} else {
return new NoOrFixedIfCheckpointingEnabledRestartStrategyFactory();
}
}
switch (restartStrategyName.toLowerCase()) {
case "none":
case "off":
case "disable":
return NoRestartStrategy.createFactory(configuration);
case "fixeddelay":
case "fixed-delay":
return FixedDelayRestartStrategy.createFactory(configuration);
case "failurerate":
case "failure-rate":
return FailureRateRestartStrategy.createFactory(configuration);
default:
try {
Class<?> clazz = Class.forName(restartStrategyName);
if (clazz != null) {
Method method = clazz.getMethod(CREATE_METHOD, Configuration.class);
if (method != null) {
Object result = method.invoke(null, configuration);
if (result != null) {
return (RestartStrategyFactory) result;
}
}
}
} catch (ClassNotFoundException cnfe) {
LOG.warn("Could not find restart strategy class {}.", restartStrategyName);
} catch (NoSuchMethodException nsme) {
LOG.warn("Class {} does not has static method {}.", restartStrategyName, CREATE_METHOD);
} catch (InvocationTargetException ite) {
LOG.warn("Cannot call static method {} from class {}.", CREATE_METHOD, restartStrategyName);
} catch (IllegalAccessException iae) {
LOG.warn("Illegal access while calling method {} from class {}.", CREATE_METHOD, restartStrategyName);
}
// fallback in case of an error
return new NoOrFixedIfCheckpointingEnabledRestartStrategyFactory();
}
} | java | public static RestartStrategyFactory createRestartStrategyFactory(Configuration configuration) throws Exception {
String restartStrategyName = configuration.getString(ConfigConstants.RESTART_STRATEGY, null);
if (restartStrategyName == null) {
// support deprecated ConfigConstants values
final int numberExecutionRetries = configuration.getInteger(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS,
ConfigConstants.DEFAULT_EXECUTION_RETRIES);
String pauseString = configuration.getString(AkkaOptions.WATCH_HEARTBEAT_PAUSE);
String delayString = configuration.getString(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY,
pauseString);
long delay;
try {
delay = Duration.apply(delayString).toMillis();
} catch (NumberFormatException nfe) {
if (delayString.equals(pauseString)) {
throw new Exception("Invalid config value for " +
AkkaOptions.WATCH_HEARTBEAT_PAUSE.key() + ": " + pauseString +
". Value must be a valid duration (such as '10 s' or '1 min')");
} else {
throw new Exception("Invalid config value for " +
ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY + ": " + delayString +
". Value must be a valid duration (such as '100 milli' or '10 s')");
}
}
if (numberExecutionRetries > 0 && delay >= 0) {
return new FixedDelayRestartStrategy.FixedDelayRestartStrategyFactory(numberExecutionRetries, delay);
} else {
return new NoOrFixedIfCheckpointingEnabledRestartStrategyFactory();
}
}
switch (restartStrategyName.toLowerCase()) {
case "none":
case "off":
case "disable":
return NoRestartStrategy.createFactory(configuration);
case "fixeddelay":
case "fixed-delay":
return FixedDelayRestartStrategy.createFactory(configuration);
case "failurerate":
case "failure-rate":
return FailureRateRestartStrategy.createFactory(configuration);
default:
try {
Class<?> clazz = Class.forName(restartStrategyName);
if (clazz != null) {
Method method = clazz.getMethod(CREATE_METHOD, Configuration.class);
if (method != null) {
Object result = method.invoke(null, configuration);
if (result != null) {
return (RestartStrategyFactory) result;
}
}
}
} catch (ClassNotFoundException cnfe) {
LOG.warn("Could not find restart strategy class {}.", restartStrategyName);
} catch (NoSuchMethodException nsme) {
LOG.warn("Class {} does not has static method {}.", restartStrategyName, CREATE_METHOD);
} catch (InvocationTargetException ite) {
LOG.warn("Cannot call static method {} from class {}.", CREATE_METHOD, restartStrategyName);
} catch (IllegalAccessException iae) {
LOG.warn("Illegal access while calling method {} from class {}.", CREATE_METHOD, restartStrategyName);
}
// fallback in case of an error
return new NoOrFixedIfCheckpointingEnabledRestartStrategyFactory();
}
} | [
"public",
"static",
"RestartStrategyFactory",
"createRestartStrategyFactory",
"(",
"Configuration",
"configuration",
")",
"throws",
"Exception",
"{",
"String",
"restartStrategyName",
"=",
"configuration",
".",
"getString",
"(",
"ConfigConstants",
".",
"RESTART_STRATEGY",
",... | Creates a {@link RestartStrategy} instance from the given {@link Configuration}.
@return RestartStrategy instance
@throws Exception which indicates that the RestartStrategy could not be instantiated. | [
"Creates",
"a",
"{",
"@link",
"RestartStrategy",
"}",
"instance",
"from",
"the",
"given",
"{",
"@link",
"Configuration",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/restart/RestartStrategyFactory.java#L84-L157 | train | Creates a RestartStrategyFactory based on the configuration. | [
30522,
2270,
10763,
23818,
20528,
2618,
6292,
21450,
3443,
28533,
20591,
6494,
2618,
6292,
21450,
1006,
9563,
9563,
1007,
11618,
6453,
1063,
5164,
23818,
20528,
2618,
6292,
18442,
1027,
9563,
1012,
4152,
18886,
3070,
1006,
9530,
8873,
18195,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/WeightRandom.java | WeightRandom.add | public WeightRandom<T> add(T obj, double weight) {
return add(new WeightObj<T>(obj, weight));
} | java | public WeightRandom<T> add(T obj, double weight) {
return add(new WeightObj<T>(obj, weight));
} | [
"public",
"WeightRandom",
"<",
"T",
">",
"add",
"(",
"T",
"obj",
",",
"double",
"weight",
")",
"{",
"return",
"add",
"(",
"new",
"WeightObj",
"<",
"T",
">",
"(",
"obj",
",",
"weight",
")",
")",
";",
"}"
] | 增加对象
@param obj 对象
@param weight 权重
@return this | [
"增加对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/WeightRandom.java#L101-L103 | train | Add a new object to the random number generator. | [
30522,
2270,
3635,
13033,
5358,
1026,
1056,
1028,
5587,
1006,
1056,
27885,
3501,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestDecoder.java | HttpPostRequestDecoder.splitHeaderContentType | private static String[] splitHeaderContentType(String sb) {
int aStart;
int aEnd;
int bStart;
int bEnd;
int cStart;
int cEnd;
aStart = HttpPostBodyUtil.findNonWhitespace(sb, 0);
aEnd = sb.indexOf(';');
if (aEnd == -1) {
return new String[] { sb, "", "" };
}
bStart = HttpPostBodyUtil.findNonWhitespace(sb, aEnd + 1);
if (sb.charAt(aEnd - 1) == ' ') {
aEnd--;
}
bEnd = sb.indexOf(';', bStart);
if (bEnd == -1) {
bEnd = HttpPostBodyUtil.findEndOfString(sb);
return new String[] { sb.substring(aStart, aEnd), sb.substring(bStart, bEnd), "" };
}
cStart = HttpPostBodyUtil.findNonWhitespace(sb, bEnd + 1);
if (sb.charAt(bEnd - 1) == ' ') {
bEnd--;
}
cEnd = HttpPostBodyUtil.findEndOfString(sb);
return new String[] { sb.substring(aStart, aEnd), sb.substring(bStart, bEnd), sb.substring(cStart, cEnd) };
} | java | private static String[] splitHeaderContentType(String sb) {
int aStart;
int aEnd;
int bStart;
int bEnd;
int cStart;
int cEnd;
aStart = HttpPostBodyUtil.findNonWhitespace(sb, 0);
aEnd = sb.indexOf(';');
if (aEnd == -1) {
return new String[] { sb, "", "" };
}
bStart = HttpPostBodyUtil.findNonWhitespace(sb, aEnd + 1);
if (sb.charAt(aEnd - 1) == ' ') {
aEnd--;
}
bEnd = sb.indexOf(';', bStart);
if (bEnd == -1) {
bEnd = HttpPostBodyUtil.findEndOfString(sb);
return new String[] { sb.substring(aStart, aEnd), sb.substring(bStart, bEnd), "" };
}
cStart = HttpPostBodyUtil.findNonWhitespace(sb, bEnd + 1);
if (sb.charAt(bEnd - 1) == ' ') {
bEnd--;
}
cEnd = HttpPostBodyUtil.findEndOfString(sb);
return new String[] { sb.substring(aStart, aEnd), sb.substring(bStart, bEnd), sb.substring(cStart, cEnd) };
} | [
"private",
"static",
"String",
"[",
"]",
"splitHeaderContentType",
"(",
"String",
"sb",
")",
"{",
"int",
"aStart",
";",
"int",
"aEnd",
";",
"int",
"bStart",
";",
"int",
"bEnd",
";",
"int",
"cStart",
";",
"int",
"cEnd",
";",
"aStart",
"=",
"HttpPostBodyUt... | Split the very first line (Content-Type value) in 3 Strings
@return the array of 3 Strings | [
"Split",
"the",
"very",
"first",
"line",
"(",
"Content",
"-",
"Type",
"value",
")",
"in",
"3",
"Strings"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestDecoder.java#L265-L292 | train | Split the header content type into two parts. | [
30522,
2797,
10763,
5164,
1031,
1033,
3975,
4974,
2121,
8663,
6528,
15353,
5051,
1006,
5164,
24829,
1007,
1063,
20014,
2004,
7559,
2102,
1025,
20014,
29347,
4859,
1025,
20014,
18667,
7559,
2102,
1025,
20014,
8815,
1025,
20014,
20116,
7559,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
redisson/redisson | redisson/src/main/java/org/redisson/connection/MasterSlaveEntry.java | MasterSlaveEntry.changeMaster | public RFuture<RedisClient> changeMaster(URI address) {
ClientConnectionsEntry oldMaster = masterEntry;
RFuture<RedisClient> future = setupMasterEntry(address);
changeMaster(address, oldMaster, future);
return future;
} | java | public RFuture<RedisClient> changeMaster(URI address) {
ClientConnectionsEntry oldMaster = masterEntry;
RFuture<RedisClient> future = setupMasterEntry(address);
changeMaster(address, oldMaster, future);
return future;
} | [
"public",
"RFuture",
"<",
"RedisClient",
">",
"changeMaster",
"(",
"URI",
"address",
")",
"{",
"ClientConnectionsEntry",
"oldMaster",
"=",
"masterEntry",
";",
"RFuture",
"<",
"RedisClient",
">",
"future",
"=",
"setupMasterEntry",
"(",
"address",
")",
";",
"chang... | Freeze slave with <code>redis(s)://host:port</code> from slaves list.
Re-attach pub/sub listeners from it to other slave.
Shutdown old master client.
@param address of Redis
@return client | [
"Freeze",
"slave",
"with",
"<code",
">",
"redis",
"(",
"s",
")",
":",
"//",
"host",
":",
"port<",
"/",
"code",
">",
"from",
"slaves",
"list",
".",
"Re",
"-",
"attach",
"pub",
"/",
"sub",
"listeners",
"from",
"it",
"to",
"other",
"slave",
".",
"Shut... | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/connection/MasterSlaveEntry.java#L409-L414 | train | Change the master entry. | [
30522,
2270,
21792,
4904,
5397,
1026,
2417,
2483,
20464,
11638,
1028,
2689,
8706,
1006,
24471,
2072,
4769,
1007,
1063,
7396,
8663,
2638,
22014,
4765,
2854,
2214,
8706,
1027,
3040,
4765,
2854,
1025,
21792,
4904,
5397,
1026,
2417,
2483,
20464... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport-native-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueStreamChannel.java | AbstractKQueueStreamChannel.doWriteMultiple | private int doWriteMultiple(ChannelOutboundBuffer in) throws Exception {
final long maxBytesPerGatheringWrite = config().getMaxBytesPerGatheringWrite();
IovArray array = ((KQueueEventLoop) eventLoop()).cleanArray();
array.maxBytes(maxBytesPerGatheringWrite);
in.forEachFlushedMessage(array);
if (array.count() >= 1) {
// TODO: Handle the case where cnt == 1 specially.
return writeBytesMultiple(in, array);
}
// cnt == 0, which means the outbound buffer contained empty buffers only.
in.removeBytes(0);
return 0;
} | java | private int doWriteMultiple(ChannelOutboundBuffer in) throws Exception {
final long maxBytesPerGatheringWrite = config().getMaxBytesPerGatheringWrite();
IovArray array = ((KQueueEventLoop) eventLoop()).cleanArray();
array.maxBytes(maxBytesPerGatheringWrite);
in.forEachFlushedMessage(array);
if (array.count() >= 1) {
// TODO: Handle the case where cnt == 1 specially.
return writeBytesMultiple(in, array);
}
// cnt == 0, which means the outbound buffer contained empty buffers only.
in.removeBytes(0);
return 0;
} | [
"private",
"int",
"doWriteMultiple",
"(",
"ChannelOutboundBuffer",
"in",
")",
"throws",
"Exception",
"{",
"final",
"long",
"maxBytesPerGatheringWrite",
"=",
"config",
"(",
")",
".",
"getMaxBytesPerGatheringWrite",
"(",
")",
";",
"IovArray",
"array",
"=",
"(",
"(",... | Attempt to write multiple {@link ByteBuf} objects.
@param in the collection which contains objects to write.
@return The value that should be decremented from the write quantum which starts at
{@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows:
<ul>
<li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content)
is encountered</li>
<li>1 - if a single call to write data was made to the OS</li>
<li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but no
data was accepted</li>
</ul>
@throws Exception If an I/O error occurs. | [
"Attempt",
"to",
"write",
"multiple",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueStreamChannel.java#L348-L361 | train | Write multiple messages. | [
30522,
2797,
20014,
23268,
17625,
12274,
7096,
11514,
2571,
1006,
3149,
5833,
15494,
8569,
12494,
1999,
1007,
11618,
6453,
1063,
2345,
2146,
4098,
3762,
4570,
4842,
20697,
22658,
26373,
1027,
9530,
8873,
2290,
1006,
1007,
1012,
2131,
17848,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.getDateHeader | @Deprecated
public static Date getDateHeader(HttpMessage message, CharSequence name) throws ParseException {
String value = message.headers().get(name);
if (value == null) {
throw new ParseException("header not found: " + name, 0);
}
Date date = DateFormatter.parseHttpDate(value);
if (date == null) {
throw new ParseException("header can't be parsed into a Date: " + value, 0);
}
return date;
} | java | @Deprecated
public static Date getDateHeader(HttpMessage message, CharSequence name) throws ParseException {
String value = message.headers().get(name);
if (value == null) {
throw new ParseException("header not found: " + name, 0);
}
Date date = DateFormatter.parseHttpDate(value);
if (date == null) {
throw new ParseException("header can't be parsed into a Date: " + value, 0);
}
return date;
} | [
"@",
"Deprecated",
"public",
"static",
"Date",
"getDateHeader",
"(",
"HttpMessage",
"message",
",",
"CharSequence",
"name",
")",
"throws",
"ParseException",
"{",
"String",
"value",
"=",
"message",
".",
"headers",
"(",
")",
".",
"get",
"(",
"name",
")",
";",
... | @deprecated Use {@link #getTimeMillis(CharSequence)} instead.
Returns the date header value with the specified header name. If
there are more than one header value for the specified header name, the
first value is returned.
@return the header value
@throws ParseException
if there is no such header or the header value is not a formatted date | [
"@deprecated",
"Use",
"{",
"@link",
"#getTimeMillis",
"(",
"CharSequence",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L842-L853 | train | Get a Date header from a message. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
3058,
2131,
13701,
4974,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
25869,
3366,
4226,
5897,
2171,
1007,
11618,
11968,
19763,
2595,
24422,
1063,
5164,
3643,
1027,
4471,
1012,
20346,
2015,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslHandler.java | SslHandler.setHandshakeSuccess | private void setHandshakeSuccess() {
handshakePromise.trySuccess(ctx.channel());
if (logger.isDebugEnabled()) {
logger.debug("{} HANDSHAKEN: {}", ctx.channel(), engine.getSession().getCipherSuite());
}
ctx.fireUserEventTriggered(SslHandshakeCompletionEvent.SUCCESS);
if (readDuringHandshake && !ctx.channel().config().isAutoRead()) {
readDuringHandshake = false;
ctx.read();
}
} | java | private void setHandshakeSuccess() {
handshakePromise.trySuccess(ctx.channel());
if (logger.isDebugEnabled()) {
logger.debug("{} HANDSHAKEN: {}", ctx.channel(), engine.getSession().getCipherSuite());
}
ctx.fireUserEventTriggered(SslHandshakeCompletionEvent.SUCCESS);
if (readDuringHandshake && !ctx.channel().config().isAutoRead()) {
readDuringHandshake = false;
ctx.read();
}
} | [
"private",
"void",
"setHandshakeSuccess",
"(",
")",
"{",
"handshakePromise",
".",
"trySuccess",
"(",
"ctx",
".",
"channel",
"(",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"{} HANDSHAKEN: {... | Notify all the handshake futures about the successfully handshake | [
"Notify",
"all",
"the",
"handshake",
"futures",
"about",
"the",
"successfully",
"handshake"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslHandler.java#L1742-L1754 | train | Set the handshake success event. | [
30522,
2797,
11675,
6662,
29560,
20459,
2229,
14194,
9623,
2015,
1006,
1007,
1063,
2398,
20459,
13699,
21716,
5562,
1012,
3046,
6342,
9468,
7971,
1006,
30524,
1063,
8833,
4590,
1012,
2139,
8569,
2290,
1006,
1000,
1063,
1065,
2398,
20459,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/instance/NERInstance.java | NERInstance.extractFeature | protected int[] extractFeature(String[] wordArray, String[] posArray, FeatureMap featureMap, int position)
{
List<Integer> featVec = new ArrayList<Integer>();
String pre2Word = position >= 2 ? wordArray[position - 2] : "_B_";
String preWord = position >= 1 ? wordArray[position - 1] : "_B_";
String curWord = wordArray[position];
String nextWord = position <= wordArray.length - 2 ? wordArray[position + 1] : "_E_";
String next2Word = position <= wordArray.length - 3 ? wordArray[position + 2] : "_E_";
String pre2Pos = position >= 2 ? posArray[position - 2] : "_B_";
String prePos = position >= 1 ? posArray[position - 1] : "_B_";
String curPos = posArray[position];
String nextPos = position <= posArray.length - 2 ? posArray[position + 1] : "_E_";
String next2Pos = position <= posArray.length - 3 ? posArray[position + 2] : "_E_";
StringBuilder sb = new StringBuilder();
addFeatureThenClear(sb.append(pre2Word).append('1'), featVec, featureMap);
addFeatureThenClear(sb.append(preWord).append('2'), featVec, featureMap);
addFeatureThenClear(sb.append(curWord).append('3'), featVec, featureMap);
addFeatureThenClear(sb.append(nextWord).append('4'), featVec, featureMap);
addFeatureThenClear(sb.append(next2Word).append('5'), featVec, featureMap);
// addFeatureThenClear(sb.append(pre2Word).append(preWord).append('6'), featVec, featureMap);
// addFeatureThenClear(sb.append(preWord).append(curWord).append('7'), featVec, featureMap);
// addFeatureThenClear(sb.append(curWord).append(nextWord).append('8'), featVec, featureMap);
// addFeatureThenClear(sb.append(nextWord).append(next2Word).append('9'), featVec, featureMap);
addFeatureThenClear(sb.append(pre2Pos).append('A'), featVec, featureMap);
addFeatureThenClear(sb.append(prePos).append('B'), featVec, featureMap);
addFeatureThenClear(sb.append(curPos).append('C'), featVec, featureMap);
addFeatureThenClear(sb.append(nextPos).append('D'), featVec, featureMap);
addFeatureThenClear(sb.append(next2Pos).append('E'), featVec, featureMap);
addFeatureThenClear(sb.append(pre2Pos).append(prePos).append('F'), featVec, featureMap);
addFeatureThenClear(sb.append(prePos).append(curPos).append('G'), featVec, featureMap);
addFeatureThenClear(sb.append(curPos).append(nextPos).append('H'), featVec, featureMap);
addFeatureThenClear(sb.append(nextPos).append(next2Pos).append('I'), featVec, featureMap);
return toFeatureArray(featVec);
} | java | protected int[] extractFeature(String[] wordArray, String[] posArray, FeatureMap featureMap, int position)
{
List<Integer> featVec = new ArrayList<Integer>();
String pre2Word = position >= 2 ? wordArray[position - 2] : "_B_";
String preWord = position >= 1 ? wordArray[position - 1] : "_B_";
String curWord = wordArray[position];
String nextWord = position <= wordArray.length - 2 ? wordArray[position + 1] : "_E_";
String next2Word = position <= wordArray.length - 3 ? wordArray[position + 2] : "_E_";
String pre2Pos = position >= 2 ? posArray[position - 2] : "_B_";
String prePos = position >= 1 ? posArray[position - 1] : "_B_";
String curPos = posArray[position];
String nextPos = position <= posArray.length - 2 ? posArray[position + 1] : "_E_";
String next2Pos = position <= posArray.length - 3 ? posArray[position + 2] : "_E_";
StringBuilder sb = new StringBuilder();
addFeatureThenClear(sb.append(pre2Word).append('1'), featVec, featureMap);
addFeatureThenClear(sb.append(preWord).append('2'), featVec, featureMap);
addFeatureThenClear(sb.append(curWord).append('3'), featVec, featureMap);
addFeatureThenClear(sb.append(nextWord).append('4'), featVec, featureMap);
addFeatureThenClear(sb.append(next2Word).append('5'), featVec, featureMap);
// addFeatureThenClear(sb.append(pre2Word).append(preWord).append('6'), featVec, featureMap);
// addFeatureThenClear(sb.append(preWord).append(curWord).append('7'), featVec, featureMap);
// addFeatureThenClear(sb.append(curWord).append(nextWord).append('8'), featVec, featureMap);
// addFeatureThenClear(sb.append(nextWord).append(next2Word).append('9'), featVec, featureMap);
addFeatureThenClear(sb.append(pre2Pos).append('A'), featVec, featureMap);
addFeatureThenClear(sb.append(prePos).append('B'), featVec, featureMap);
addFeatureThenClear(sb.append(curPos).append('C'), featVec, featureMap);
addFeatureThenClear(sb.append(nextPos).append('D'), featVec, featureMap);
addFeatureThenClear(sb.append(next2Pos).append('E'), featVec, featureMap);
addFeatureThenClear(sb.append(pre2Pos).append(prePos).append('F'), featVec, featureMap);
addFeatureThenClear(sb.append(prePos).append(curPos).append('G'), featVec, featureMap);
addFeatureThenClear(sb.append(curPos).append(nextPos).append('H'), featVec, featureMap);
addFeatureThenClear(sb.append(nextPos).append(next2Pos).append('I'), featVec, featureMap);
return toFeatureArray(featVec);
} | [
"protected",
"int",
"[",
"]",
"extractFeature",
"(",
"String",
"[",
"]",
"wordArray",
",",
"String",
"[",
"]",
"posArray",
",",
"FeatureMap",
"featureMap",
",",
"int",
"position",
")",
"{",
"List",
"<",
"Integer",
">",
"featVec",
"=",
"new",
"ArrayList",
... | 提取特征,override此方法来拓展自己的特征模板
@param wordArray 词语
@param posArray 词性
@param featureMap 储存特征的结构
@param position 当前提取的词语所在的位置
@return 特征向量 | [
"提取特征,override此方法来拓展自己的特征模板"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/instance/NERInstance.java#L60-L98 | train | Extract feature vector from the array of words. | [
30522,
5123,
20014,
1031,
1033,
14817,
7959,
4017,
5397,
1006,
5164,
1031,
1033,
2773,
2906,
9447,
1010,
5164,
1031,
1033,
13433,
10286,
9447,
1010,
3444,
2863,
2361,
3444,
2863,
2361,
1010,
20014,
2597,
1007,
1063,
2862,
1026,
16109,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java | KeyedStream.transform | @Override
@PublicEvolving
public <R> SingleOutputStreamOperator<R> transform(String operatorName,
TypeInformation<R> outTypeInfo, OneInputStreamOperator<T, R> operator) {
SingleOutputStreamOperator<R> returnStream = super.transform(operatorName, outTypeInfo, operator);
// inject the key selector and key type
OneInputTransformation<T, R> transform = (OneInputTransformation<T, R>) returnStream.getTransformation();
transform.setStateKeySelector(keySelector);
transform.setStateKeyType(keyType);
return returnStream;
} | java | @Override
@PublicEvolving
public <R> SingleOutputStreamOperator<R> transform(String operatorName,
TypeInformation<R> outTypeInfo, OneInputStreamOperator<T, R> operator) {
SingleOutputStreamOperator<R> returnStream = super.transform(operatorName, outTypeInfo, operator);
// inject the key selector and key type
OneInputTransformation<T, R> transform = (OneInputTransformation<T, R>) returnStream.getTransformation();
transform.setStateKeySelector(keySelector);
transform.setStateKeyType(keyType);
return returnStream;
} | [
"@",
"Override",
"@",
"PublicEvolving",
"public",
"<",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"transform",
"(",
"String",
"operatorName",
",",
"TypeInformation",
"<",
"R",
">",
"outTypeInfo",
",",
"OneInputStreamOperator",
"<",
"T",
",",
"R",
"... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java#L258-L271 | train | Override this method to inject the key selector and key type into the operator. | [
30522,
1030,
2058,
15637,
1030,
2270,
6777,
4747,
6455,
2270,
1026,
1054,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
10938,
1006,
5164,
6872,
18442,
1010,
2828,
2378,
14192,
3370,
1026,
1054,
1028,
2041,
13874,
2378,
148... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/useragent/UserAgentParser.java | UserAgentParser.parse | public static UserAgent parse(String userAgentString) {
final UserAgent userAgent = new UserAgent();
final Browser browser = parseBrowser(userAgentString);
userAgent.setBrowser(parseBrowser(userAgentString));
userAgent.setVersion(browser.getVersion(userAgentString));
final Engine engine = parseEngine(userAgentString);
userAgent.setEngine(engine);
if (false == engine.isUnknown()) {
userAgent.setEngineVersion(parseEngineVersion(engine, userAgentString));
}
userAgent.setOs(parseOS(userAgentString));
final Platform platform = parsePlatform(userAgentString);
userAgent.setPlatform(platform);
userAgent.setMobile(platform.isMobile() || browser.isMobile());
return userAgent;
} | java | public static UserAgent parse(String userAgentString) {
final UserAgent userAgent = new UserAgent();
final Browser browser = parseBrowser(userAgentString);
userAgent.setBrowser(parseBrowser(userAgentString));
userAgent.setVersion(browser.getVersion(userAgentString));
final Engine engine = parseEngine(userAgentString);
userAgent.setEngine(engine);
if (false == engine.isUnknown()) {
userAgent.setEngineVersion(parseEngineVersion(engine, userAgentString));
}
userAgent.setOs(parseOS(userAgentString));
final Platform platform = parsePlatform(userAgentString);
userAgent.setPlatform(platform);
userAgent.setMobile(platform.isMobile() || browser.isMobile());
return userAgent;
} | [
"public",
"static",
"UserAgent",
"parse",
"(",
"String",
"userAgentString",
")",
"{",
"final",
"UserAgent",
"userAgent",
"=",
"new",
"UserAgent",
"(",
")",
";",
"final",
"Browser",
"browser",
"=",
"parseBrowser",
"(",
"userAgentString",
")",
";",
"userAgent",
... | 解析User-Agent
@param userAgentString User-Agent字符串
@return {@link UserAgent} | [
"解析User",
"-",
"Agent"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/useragent/UserAgentParser.java#L21-L40 | train | Parses the given UserAgent string. | [
30522,
2270,
10763,
5310,
4270,
3372,
11968,
3366,
1006,
5164,
5310,
4270,
7666,
18886,
3070,
1007,
1063,
2345,
5310,
4270,
3372,
5310,
4270,
3372,
1027,
2047,
5310,
4270,
3372,
1006,
1007,
1025,
2345,
16602,
16602,
1027,
11968,
3366,
12618... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/servlet/ServletUtil.java | ServletUtil.write | public static void write(HttpServletResponse response, String text, String contentType) {
response.setContentType(contentType);
Writer writer = null;
try {
writer = response.getWriter();
writer.write(text);
writer.flush();
} catch (IOException e) {
throw new UtilException(e);
} finally {
IoUtil.close(writer);
}
} | java | public static void write(HttpServletResponse response, String text, String contentType) {
response.setContentType(contentType);
Writer writer = null;
try {
writer = response.getWriter();
writer.write(text);
writer.flush();
} catch (IOException e) {
throw new UtilException(e);
} finally {
IoUtil.close(writer);
}
} | [
"public",
"static",
"void",
"write",
"(",
"HttpServletResponse",
"response",
",",
"String",
"text",
",",
"String",
"contentType",
")",
"{",
"response",
".",
"setContentType",
"(",
"contentType",
")",
";",
"Writer",
"writer",
"=",
"null",
";",
"try",
"{",
"wr... | 返回数据给客户端
@param response 响应对象{@link HttpServletResponse}
@param text 返回的内容
@param contentType 返回的类型 | [
"返回数据给客户端"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L480-L492 | train | Write text to the response using the specified content type. | [
30522,
2270,
10763,
11675,
4339,
1006,
16770,
2121,
2615,
7485,
6072,
26029,
3366,
3433,
1010,
5164,
3793,
1010,
5164,
4180,
13874,
1007,
1063,
3433,
1012,
2275,
8663,
6528,
15353,
5051,
1006,
4180,
13874,
1007,
1025,
3213,
3213,
1027,
1970... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/jooq/SqlDialectLookup.java | SqlDialectLookup.getDialect | public static SQLDialect getDialect(DataSource dataSource) {
if (dataSource == null) {
return SQLDialect.DEFAULT;
}
try {
String url = JdbcUtils.extractDatabaseMetaData(dataSource, "getURL");
SQLDialect sqlDialect = JDBCUtils.dialect(url);
if (sqlDialect != null) {
return sqlDialect;
}
}
catch (MetaDataAccessException ex) {
logger.warn("Unable to determine jdbc url from datasource", ex);
}
return SQLDialect.DEFAULT;
} | java | public static SQLDialect getDialect(DataSource dataSource) {
if (dataSource == null) {
return SQLDialect.DEFAULT;
}
try {
String url = JdbcUtils.extractDatabaseMetaData(dataSource, "getURL");
SQLDialect sqlDialect = JDBCUtils.dialect(url);
if (sqlDialect != null) {
return sqlDialect;
}
}
catch (MetaDataAccessException ex) {
logger.warn("Unable to determine jdbc url from datasource", ex);
}
return SQLDialect.DEFAULT;
} | [
"public",
"static",
"SQLDialect",
"getDialect",
"(",
"DataSource",
"dataSource",
")",
"{",
"if",
"(",
"dataSource",
"==",
"null",
")",
"{",
"return",
"SQLDialect",
".",
"DEFAULT",
";",
"}",
"try",
"{",
"String",
"url",
"=",
"JdbcUtils",
".",
"extractDatabase... | Return the most suitable {@link SQLDialect} for the given {@link DataSource}.
@param dataSource the source {@link DataSource}
@return the most suitable {@link SQLDialect} | [
"Return",
"the",
"most",
"suitable",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/SqlDialectLookup.java#L47-L62 | train | Get the SQL dialect for the given datasource. | [
30522,
2270,
10763,
29296,
27184,
22471,
2131,
27184,
22471,
1006,
2951,
6499,
3126,
3401,
2951,
6499,
3126,
3401,
1007,
1063,
2065,
1006,
2951,
6499,
3126,
3401,
1027,
1027,
19701,
1007,
1063,
2709,
29296,
27184,
22471,
1012,
12398,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsCheckpointStreamFactory.java | FsCheckpointStreamFactory.createCheckpointStateOutputStream | @Override
public FsCheckpointStateOutputStream createCheckpointStateOutputStream(CheckpointedStateScope scope) throws IOException {
Path target = scope == CheckpointedStateScope.EXCLUSIVE ? checkpointDirectory : sharedStateDirectory;
int bufferSize = Math.max(DEFAULT_WRITE_BUFFER_SIZE, fileStateThreshold);
return new FsCheckpointStateOutputStream(target, filesystem, bufferSize, fileStateThreshold);
} | java | @Override
public FsCheckpointStateOutputStream createCheckpointStateOutputStream(CheckpointedStateScope scope) throws IOException {
Path target = scope == CheckpointedStateScope.EXCLUSIVE ? checkpointDirectory : sharedStateDirectory;
int bufferSize = Math.max(DEFAULT_WRITE_BUFFER_SIZE, fileStateThreshold);
return new FsCheckpointStateOutputStream(target, filesystem, bufferSize, fileStateThreshold);
} | [
"@",
"Override",
"public",
"FsCheckpointStateOutputStream",
"createCheckpointStateOutputStream",
"(",
"CheckpointedStateScope",
"scope",
")",
"throws",
"IOException",
"{",
"Path",
"target",
"=",
"scope",
"==",
"CheckpointedStateScope",
".",
"EXCLUSIVE",
"?",
"checkpointDire... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsCheckpointStreamFactory.java#L122-L128 | train | Create a checkpoint state output stream. | [
30522,
1030,
2058,
15637,
2270,
1042,
22842,
3600,
26521,
12259,
5833,
18780,
21422,
3443,
5403,
3600,
26521,
12259,
5833,
18780,
21422,
1006,
26520,
2098,
9153,
4570,
16186,
9531,
1007,
11618,
22834,
10288,
24422,
1063,
4130,
4539,
1027,
953... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/fs/EntropyInjector.java | EntropyInjector.getEntropyFs | @Nullable
private static EntropyInjectingFileSystem getEntropyFs(FileSystem fs) {
if (fs instanceof EntropyInjectingFileSystem) {
return (EntropyInjectingFileSystem) fs;
}
else if (fs instanceof SafetyNetWrapperFileSystem) {
FileSystem delegate = ((SafetyNetWrapperFileSystem) fs).getWrappedDelegate();
if (delegate instanceof EntropyInjectingFileSystem) {
return (EntropyInjectingFileSystem) delegate;
}
else {
return null;
}
}
else {
return null;
}
} | java | @Nullable
private static EntropyInjectingFileSystem getEntropyFs(FileSystem fs) {
if (fs instanceof EntropyInjectingFileSystem) {
return (EntropyInjectingFileSystem) fs;
}
else if (fs instanceof SafetyNetWrapperFileSystem) {
FileSystem delegate = ((SafetyNetWrapperFileSystem) fs).getWrappedDelegate();
if (delegate instanceof EntropyInjectingFileSystem) {
return (EntropyInjectingFileSystem) delegate;
}
else {
return null;
}
}
else {
return null;
}
} | [
"@",
"Nullable",
"private",
"static",
"EntropyInjectingFileSystem",
"getEntropyFs",
"(",
"FileSystem",
"fs",
")",
"{",
"if",
"(",
"fs",
"instanceof",
"EntropyInjectingFileSystem",
")",
"{",
"return",
"(",
"EntropyInjectingFileSystem",
")",
"fs",
";",
"}",
"else",
... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/EntropyInjector.java#L92-L109 | train | Get the EntropyInjectingFileSystem from the given file system. | [
30522,
1030,
19701,
3085,
2797,
10763,
23077,
2378,
20614,
2075,
8873,
4244,
27268,
6633,
2131,
4765,
18981,
2100,
10343,
1006,
6764,
27268,
6633,
1042,
2015,
1007,
1063,
2065,
1006,
1042,
2015,
6013,
11253,
23077,
2378,
20614,
2075,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStreamUtils.java | DataStreamUtils.reinterpretAsKeyedStream | public static <T, K> KeyedStream<T, K> reinterpretAsKeyedStream(
DataStream<T> stream,
KeySelector<T, K> keySelector,
TypeInformation<K> typeInfo) {
PartitionTransformation<T> partitionTransformation = new PartitionTransformation<>(
stream.getTransformation(),
new ForwardPartitioner<>());
return new KeyedStream<>(
stream,
partitionTransformation,
keySelector,
typeInfo);
} | java | public static <T, K> KeyedStream<T, K> reinterpretAsKeyedStream(
DataStream<T> stream,
KeySelector<T, K> keySelector,
TypeInformation<K> typeInfo) {
PartitionTransformation<T> partitionTransformation = new PartitionTransformation<>(
stream.getTransformation(),
new ForwardPartitioner<>());
return new KeyedStream<>(
stream,
partitionTransformation,
keySelector,
typeInfo);
} | [
"public",
"static",
"<",
"T",
",",
"K",
">",
"KeyedStream",
"<",
"T",
",",
"K",
">",
"reinterpretAsKeyedStream",
"(",
"DataStream",
"<",
"T",
">",
"stream",
",",
"KeySelector",
"<",
"T",
",",
"K",
">",
"keySelector",
",",
"TypeInformation",
"<",
"K",
"... | Reinterprets the given {@link DataStream} as a {@link KeyedStream}, which extracts keys with the given
{@link KeySelector}.
<p>IMPORTANT: For every partition of the base stream, the keys of events in the base stream must be
partitioned exactly in the same way as if it was created through a {@link DataStream#keyBy(KeySelector)}.
@param stream The data stream to reinterpret. For every partition, this stream must be partitioned exactly
in the same way as if it was created through a {@link DataStream#keyBy(KeySelector)}.
@param keySelector Function that defines how keys are extracted from the data stream.
@param typeInfo Explicit type information about the key type.
@param <T> Type of events in the data stream.
@param <K> Type of the extracted keys.
@return The reinterpretation of the {@link DataStream} as a {@link KeyedStream}. | [
"Reinterprets",
"the",
"given",
"{",
"@link",
"DataStream",
"}",
"as",
"a",
"{",
"@link",
"KeyedStream",
"}",
"which",
"extracts",
"keys",
"with",
"the",
"given",
"{",
"@link",
"KeySelector",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStreamUtils.java#L129-L143 | train | Reinterprets a data stream as a KeyedStream. | [
30522,
2270,
10763,
1026,
1056,
1010,
1047,
1028,
3145,
2098,
21422,
1026,
1056,
1010,
1047,
1028,
27788,
3334,
28139,
10230,
14839,
2098,
21422,
1006,
2951,
21422,
1026,
1056,
1028,
5460,
1010,
6309,
12260,
16761,
1026,
1056,
1010,
1047,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java | TouchActions.flick | public TouchActions flick(int xSpeed, int ySpeed) {
if (touchScreen != null) {
action.addAction(new FlickAction(touchScreen, xSpeed, ySpeed));
}
return this;
} | java | public TouchActions flick(int xSpeed, int ySpeed) {
if (touchScreen != null) {
action.addAction(new FlickAction(touchScreen, xSpeed, ySpeed));
}
return this;
} | [
"public",
"TouchActions",
"flick",
"(",
"int",
"xSpeed",
",",
"int",
"ySpeed",
")",
"{",
"if",
"(",
"touchScreen",
"!=",
"null",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"FlickAction",
"(",
"touchScreen",
",",
"xSpeed",
",",
"ySpeed",
")",
")",
... | Sends a flick gesture to the current view.
@param xSpeed The horizontal speed in pixels/second
@param ySpeed The vertical speed in pixels/second
@return self | [
"Sends",
"a",
"flick",
"gesture",
"to",
"the",
"current",
"view",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java#L173-L178 | train | Adds a flick action to the TouchActions object. | [
30522,
2270,
3543,
18908,
8496,
17312,
1006,
20014,
1060,
13102,
13089,
1010,
20014,
1061,
13102,
13089,
1007,
1063,
2065,
1006,
3543,
18182,
999,
1027,
19701,
1007,
1063,
2895,
1012,
5587,
18908,
3258,
1006,
2047,
17312,
18908,
3258,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java | Bzip2BlockCompressor.writeRun | private void writeRun(final int value, int runLength) {
final int blockLength = this.blockLength;
final byte[] block = this.block;
blockValuesPresent[value] = true;
crc.updateCRC(value, runLength);
final byte byteValue = (byte) value;
switch (runLength) {
case 1:
block[blockLength] = byteValue;
this.blockLength = blockLength + 1;
break;
case 2:
block[blockLength] = byteValue;
block[blockLength + 1] = byteValue;
this.blockLength = blockLength + 2;
break;
case 3:
block[blockLength] = byteValue;
block[blockLength + 1] = byteValue;
block[blockLength + 2] = byteValue;
this.blockLength = blockLength + 3;
break;
default:
runLength -= 4;
blockValuesPresent[runLength] = true;
block[blockLength] = byteValue;
block[blockLength + 1] = byteValue;
block[blockLength + 2] = byteValue;
block[blockLength + 3] = byteValue;
block[blockLength + 4] = (byte) runLength;
this.blockLength = blockLength + 5;
break;
}
} | java | private void writeRun(final int value, int runLength) {
final int blockLength = this.blockLength;
final byte[] block = this.block;
blockValuesPresent[value] = true;
crc.updateCRC(value, runLength);
final byte byteValue = (byte) value;
switch (runLength) {
case 1:
block[blockLength] = byteValue;
this.blockLength = blockLength + 1;
break;
case 2:
block[blockLength] = byteValue;
block[blockLength + 1] = byteValue;
this.blockLength = blockLength + 2;
break;
case 3:
block[blockLength] = byteValue;
block[blockLength + 1] = byteValue;
block[blockLength + 2] = byteValue;
this.blockLength = blockLength + 3;
break;
default:
runLength -= 4;
blockValuesPresent[runLength] = true;
block[blockLength] = byteValue;
block[blockLength + 1] = byteValue;
block[blockLength + 2] = byteValue;
block[blockLength + 3] = byteValue;
block[blockLength + 4] = (byte) runLength;
this.blockLength = blockLength + 5;
break;
}
} | [
"private",
"void",
"writeRun",
"(",
"final",
"int",
"value",
",",
"int",
"runLength",
")",
"{",
"final",
"int",
"blockLength",
"=",
"this",
".",
"blockLength",
";",
"final",
"byte",
"[",
"]",
"block",
"=",
"this",
".",
"block",
";",
"blockValuesPresent",
... | Writes an RLE run to the block array, updating the block CRC and present values array as required.
@param value The value to write
@param runLength The run length of the value to write | [
"Writes",
"an",
"RLE",
"run",
"to",
"the",
"block",
"array",
"updating",
"the",
"block",
"CRC",
"and",
"present",
"values",
"array",
"as",
"required",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java#L138-L173 | train | Write a single run. | [
30522,
2797,
11675,
3213,
4609,
1006,
2345,
20014,
3643,
1010,
20014,
2448,
7770,
13512,
2232,
1007,
1063,
2345,
20014,
3796,
7770,
13512,
2232,
1027,
2023,
1012,
3796,
7770,
13512,
2232,
1025,
2345,
24880,
1031,
1033,
3796,
1027,
2023,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/utils/DataOutputEncoder.java | DataOutputEncoder.writeFixed | @Override
public void writeFixed(byte[] bytes, int start, int len) throws IOException {
out.write(bytes, start, len);
} | java | @Override
public void writeFixed(byte[] bytes, int start, int len) throws IOException {
out.write(bytes, start, len);
} | [
"@",
"Override",
"public",
"void",
"writeFixed",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"start",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"bytes",
",",
"start",
",",
"len",
")",
";",
"}"
] | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/utils/DataOutputEncoder.java#L83-L86 | train | Write fixed bytes. | [
30522,
1030,
2058,
15637,
2270,
11675,
4339,
23901,
1006,
24880,
1031,
1033,
27507,
1010,
20014,
2707,
1010,
20014,
18798,
1007,
11618,
22834,
10288,
24422,
1063,
2041,
1012,
4339,
1006,
27507,
1010,
2707,
1010,
18798,
1007,
1025,
1065,
102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/remote/RemoteWebDriverBuilder.java | RemoteWebDriverBuilder.build | public WebDriver build() {
if (options.isEmpty() && additionalCapabilities.isEmpty()) {
throw new SessionNotCreatedException("Refusing to create session without any capabilities");
}
Plan plan = getPlan();
CommandExecutor executor;
if (plan.isUsingDriverService()) {
AtomicReference<DriverService> serviceRef = new AtomicReference<>();
executor = new SpecCompliantExecutor(
() -> {
if (serviceRef.get() != null && serviceRef.get().isRunning()) {
throw new SessionNotCreatedException(
"Attempt to start the underlying service more than once");
}
try {
DriverService service = plan.getDriverService();
serviceRef.set(service);
service.start();
return service.getUrl();
} catch (IOException e) {
throw new SessionNotCreatedException(e.getMessage(), e);
}
},
plan::writePayload,
() -> serviceRef.get().stop());
} else {
executor = new SpecCompliantExecutor(() -> remoteHost, plan::writePayload, () -> {});
}
return new RemoteWebDriver(executor, new ImmutableCapabilities());
} | java | public WebDriver build() {
if (options.isEmpty() && additionalCapabilities.isEmpty()) {
throw new SessionNotCreatedException("Refusing to create session without any capabilities");
}
Plan plan = getPlan();
CommandExecutor executor;
if (plan.isUsingDriverService()) {
AtomicReference<DriverService> serviceRef = new AtomicReference<>();
executor = new SpecCompliantExecutor(
() -> {
if (serviceRef.get() != null && serviceRef.get().isRunning()) {
throw new SessionNotCreatedException(
"Attempt to start the underlying service more than once");
}
try {
DriverService service = plan.getDriverService();
serviceRef.set(service);
service.start();
return service.getUrl();
} catch (IOException e) {
throw new SessionNotCreatedException(e.getMessage(), e);
}
},
plan::writePayload,
() -> serviceRef.get().stop());
} else {
executor = new SpecCompliantExecutor(() -> remoteHost, plan::writePayload, () -> {});
}
return new RemoteWebDriver(executor, new ImmutableCapabilities());
} | [
"public",
"WebDriver",
"build",
"(",
")",
"{",
"if",
"(",
"options",
".",
"isEmpty",
"(",
")",
"&&",
"additionalCapabilities",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"SessionNotCreatedException",
"(",
"\"Refusing to create session without any capabiliti... | Actually create a new WebDriver session. The returned webdriver is not guaranteed to be a
{@link RemoteWebDriver}. | [
"Actually",
"create",
"a",
"new",
"WebDriver",
"session",
".",
"The",
"returned",
"webdriver",
"is",
"not",
"guaranteed",
"to",
"be",
"a",
"{"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/RemoteWebDriverBuilder.java#L194-L227 | train | Build the session. | [
30522,
2270,
4773,
23663,
2099,
3857,
1006,
1007,
1063,
2065,
1006,
7047,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1004,
1004,
3176,
17695,
28518,
15909,
3111,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1007,
1063,
5466,
2047,
5219,
17048... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DataStreamUtils.java | DataStreamUtils.reinterpretAsKeyedStream | public static <T, K> KeyedStream<T, K> reinterpretAsKeyedStream(
DataStream<T> stream,
KeySelector<T, K> keySelector) {
return reinterpretAsKeyedStream(
stream,
keySelector,
TypeExtractor.getKeySelectorTypes(keySelector, stream.getType()));
} | java | public static <T, K> KeyedStream<T, K> reinterpretAsKeyedStream(
DataStream<T> stream,
KeySelector<T, K> keySelector) {
return reinterpretAsKeyedStream(
stream,
keySelector,
TypeExtractor.getKeySelectorTypes(keySelector, stream.getType()));
} | [
"public",
"static",
"<",
"T",
",",
"K",
">",
"KeyedStream",
"<",
"T",
",",
"K",
">",
"reinterpretAsKeyedStream",
"(",
"DataStream",
"<",
"T",
">",
"stream",
",",
"KeySelector",
"<",
"T",
",",
"K",
">",
"keySelector",
")",
"{",
"return",
"reinterpretAsKey... | Reinterprets the given {@link DataStream} as a {@link KeyedStream}, which extracts keys with the given
{@link KeySelector}.
<p>IMPORTANT: For every partition of the base stream, the keys of events in the base stream must be
partitioned exactly in the same way as if it was created through a {@link DataStream#keyBy(KeySelector)}.
@param stream The data stream to reinterpret. For every partition, this stream must be partitioned exactly
in the same way as if it was created through a {@link DataStream#keyBy(KeySelector)}.
@param keySelector Function that defines how keys are extracted from the data stream.
@param <T> Type of events in the data stream.
@param <K> Type of the extracted keys.
@return The reinterpretation of the {@link DataStream} as a {@link KeyedStream}. | [
"Reinterprets",
"the",
"given",
"{",
"@link",
"DataStream",
"}",
"as",
"a",
"{",
"@link",
"KeyedStream",
"}",
"which",
"extracts",
"keys",
"with",
"the",
"given",
"{",
"@link",
"KeySelector",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStreamUtils.java#L104-L112 | train | Reinterprets a CID DataStream as a KeyedStream. | [
30522,
2270,
10763,
1026,
1056,
1010,
1047,
1028,
3145,
2098,
21422,
1026,
1056,
1010,
1047,
1028,
27788,
3334,
28139,
10230,
14839,
2098,
21422,
1006,
2951,
21422,
1026,
1056,
1028,
5460,
1010,
6309,
12260,
16761,
1026,
1056,
1010,
1047,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java | SSLUtils.createSSLServerSocketFactory | public static ServerSocketFactory createSSLServerSocketFactory(Configuration config) throws Exception {
SSLContext sslContext = createInternalSSLContext(config);
if (sslContext == null) {
throw new IllegalConfigurationException("SSL is not enabled");
}
String[] protocols = getEnabledProtocols(config);
String[] cipherSuites = getEnabledCipherSuites(config);
SSLServerSocketFactory factory = sslContext.getServerSocketFactory();
return new ConfiguringSSLServerSocketFactory(factory, protocols, cipherSuites);
} | java | public static ServerSocketFactory createSSLServerSocketFactory(Configuration config) throws Exception {
SSLContext sslContext = createInternalSSLContext(config);
if (sslContext == null) {
throw new IllegalConfigurationException("SSL is not enabled");
}
String[] protocols = getEnabledProtocols(config);
String[] cipherSuites = getEnabledCipherSuites(config);
SSLServerSocketFactory factory = sslContext.getServerSocketFactory();
return new ConfiguringSSLServerSocketFactory(factory, protocols, cipherSuites);
} | [
"public",
"static",
"ServerSocketFactory",
"createSSLServerSocketFactory",
"(",
"Configuration",
"config",
")",
"throws",
"Exception",
"{",
"SSLContext",
"sslContext",
"=",
"createInternalSSLContext",
"(",
"config",
")",
";",
"if",
"(",
"sslContext",
"==",
"null",
")"... | Creates a factory for SSL Server Sockets from the given configuration.
SSL Server Sockets are always part of internal communication. | [
"Creates",
"a",
"factory",
"for",
"SSL",
"Server",
"Sockets",
"from",
"the",
"given",
"configuration",
".",
"SSL",
"Server",
"Sockets",
"are",
"always",
"part",
"of",
"internal",
"communication",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java#L84-L95 | train | Creates a SSL ServerSocketFactory using the SSL configuration. | [
30522,
2270,
10763,
14903,
7432,
3388,
21450,
9005,
14540,
8043,
14028,
7432,
3388,
21450,
1006,
9563,
9530,
8873,
2290,
1007,
11618,
6453,
1063,
7020,
22499,
10111,
18413,
7020,
22499,
10111,
30524,
1025,
2065,
1006,
7020,
22499,
10111,
1841... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/summary/TextRankSentence.java | TextRankSentence.getTopSentence | public int[] getTopSentence(int size)
{
Collection<Integer> values = top.values();
size = Math.min(size, values.size());
int[] indexArray = new int[size];
Iterator<Integer> it = values.iterator();
for (int i = 0; i < size; ++i)
{
indexArray[i] = it.next();
}
return indexArray;
} | java | public int[] getTopSentence(int size)
{
Collection<Integer> values = top.values();
size = Math.min(size, values.size());
int[] indexArray = new int[size];
Iterator<Integer> it = values.iterator();
for (int i = 0; i < size; ++i)
{
indexArray[i] = it.next();
}
return indexArray;
} | [
"public",
"int",
"[",
"]",
"getTopSentence",
"(",
"int",
"size",
")",
"{",
"Collection",
"<",
"Integer",
">",
"values",
"=",
"top",
".",
"values",
"(",
")",
";",
"size",
"=",
"Math",
".",
"min",
"(",
"size",
",",
"values",
".",
"size",
"(",
")",
... | 获取前几个关键句子
@param size 要几个
@return 关键句子的下标 | [
"获取前几个关键句子"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/summary/TextRankSentence.java#L129-L140 | train | Get the top sentence. | [
30522,
2270,
20014,
1031,
1033,
2131,
25181,
15781,
5897,
1006,
20014,
2946,
1007,
1063,
3074,
1026,
16109,
1028,
5300,
1027,
2327,
1012,
5300,
1006,
1007,
1025,
2946,
1027,
8785,
1012,
8117,
1006,
2946,
1010,
5300,
1012,
2946,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/context/limit/Limit.java | Limit.isNeedRewriteRowCount | public boolean isNeedRewriteRowCount(final DatabaseType databaseType) {
return DatabaseType.MySQL == databaseType || DatabaseType.PostgreSQL == databaseType || DatabaseType.H2 == databaseType;
} | java | public boolean isNeedRewriteRowCount(final DatabaseType databaseType) {
return DatabaseType.MySQL == databaseType || DatabaseType.PostgreSQL == databaseType || DatabaseType.H2 == databaseType;
} | [
"public",
"boolean",
"isNeedRewriteRowCount",
"(",
"final",
"DatabaseType",
"databaseType",
")",
"{",
"return",
"DatabaseType",
".",
"MySQL",
"==",
"databaseType",
"||",
"DatabaseType",
".",
"PostgreSQL",
"==",
"databaseType",
"||",
"DatabaseType",
".",
"H2",
"==",
... | Judge is need rewrite row count or not.
@param databaseType database type
@return is need rewrite row count or not | [
"Judge",
"is",
"need",
"rewrite",
"row",
"count",
"or",
"not",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/context/limit/Limit.java#L115-L117 | train | Checks if the row count needs to be rewritten. | [
30522,
2270,
22017,
20898,
3475,
13089,
15603,
17625,
10524,
3597,
16671,
1006,
2345,
7809,
13874,
7809,
13874,
1007,
1063,
2709,
7809,
13874,
1012,
2026,
2015,
4160,
2140,
1027,
1027,
7809,
13874,
1064,
1064,
7809,
13874,
1012,
2695,
17603,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/Optimizer.java | Optimizer.createPreOptimizedPlan | public static List<DataSinkNode> createPreOptimizedPlan(Plan program) {
GraphCreatingVisitor graphCreator = new GraphCreatingVisitor(1, null);
program.accept(graphCreator);
return graphCreator.getSinks();
} | java | public static List<DataSinkNode> createPreOptimizedPlan(Plan program) {
GraphCreatingVisitor graphCreator = new GraphCreatingVisitor(1, null);
program.accept(graphCreator);
return graphCreator.getSinks();
} | [
"public",
"static",
"List",
"<",
"DataSinkNode",
">",
"createPreOptimizedPlan",
"(",
"Plan",
"program",
")",
"{",
"GraphCreatingVisitor",
"graphCreator",
"=",
"new",
"GraphCreatingVisitor",
"(",
"1",
",",
"null",
")",
";",
"program",
".",
"accept",
"(",
"graphCr... | This function performs only the first step to the compilation process - the creation of the optimizer
representation of the plan. No estimations or enumerations of alternatives are done here.
@param program The plan to generate the optimizer representation for.
@return The optimizer representation of the plan, as a collection of all data sinks
from the plan can be traversed. | [
"This",
"function",
"performs",
"only",
"the",
"first",
"step",
"to",
"the",
"compilation",
"process",
"-",
"the",
"creation",
"of",
"the",
"optimizer",
"representation",
"of",
"the",
"plan",
".",
"No",
"estimations",
"or",
"enumerations",
"of",
"alternatives",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/Optimizer.java#L540-L544 | train | Creates a pre - optimized plan. | [
30522,
2270,
10763,
2862,
1026,
2951,
11493,
2243,
3630,
3207,
1028,
3443,
28139,
7361,
3775,
4328,
5422,
24759,
2319,
1006,
2933,
2565,
1007,
1063,
10629,
16748,
5844,
11365,
15660,
10629,
16748,
8844,
1027,
2047,
10629,
16748,
5844,
11365,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java | HealthStatusHttpMapper.addStatusMapping | public void addStatusMapping(Status status, Integer httpStatus) {
Assert.notNull(status, "Status must not be null");
Assert.notNull(httpStatus, "HttpStatus must not be null");
addStatusMapping(status.getCode(), httpStatus);
} | java | public void addStatusMapping(Status status, Integer httpStatus) {
Assert.notNull(status, "Status must not be null");
Assert.notNull(httpStatus, "HttpStatus must not be null");
addStatusMapping(status.getCode(), httpStatus);
} | [
"public",
"void",
"addStatusMapping",
"(",
"Status",
"status",
",",
"Integer",
"httpStatus",
")",
"{",
"Assert",
".",
"notNull",
"(",
"status",
",",
"\"Status must not be null\"",
")",
";",
"Assert",
".",
"notNull",
"(",
"httpStatus",
",",
"\"HttpStatus must not b... | Add a status mapping to the existing set.
@param status the status to map
@param httpStatus the http status | [
"Add",
"a",
"status",
"mapping",
"to",
"the",
"existing",
"set",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java#L72-L76 | train | Add a status mapping to the response. | [
30522,
2270,
11675,
9909,
29336,
2271,
2863,
14853,
1006,
3570,
3570,
1010,
16109,
16770,
29336,
2271,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
3570,
1010,
1000,
3570,
2442,
2025,
2022,
19701,
1000,
1007,
1025,
20865,
1012,
2025,
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/RuntimeUtil.java | RuntimeUtil.getResult | public static String getResult(Process process, Charset charset) {
InputStream in = null;
try {
in = process.getInputStream();
return IoUtil.read(in, charset);
} finally {
IoUtil.close(in);
destroy(process);
}
} | java | public static String getResult(Process process, Charset charset) {
InputStream in = null;
try {
in = process.getInputStream();
return IoUtil.read(in, charset);
} finally {
IoUtil.close(in);
destroy(process);
}
} | [
"public",
"static",
"String",
"getResult",
"(",
"Process",
"process",
",",
"Charset",
"charset",
")",
"{",
"InputStream",
"in",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"process",
".",
"getInputStream",
"(",
")",
";",
"return",
"IoUtil",
".",
"read",
"("... | 获取命令执行结果,获取后销毁进程
@param process {@link Process} 进程
@param charset 编码
@return 命令执行结果列表
@since 3.1.2 | [
"获取命令执行结果,获取后销毁进程"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java#L191-L200 | train | Reads the result of a process. | [
30522,
2270,
10763,
5164,
2131,
6072,
11314,
1006,
2832,
2832,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
20407,
25379,
1999,
1027,
19701,
1025,
3046,
1063,
1999,
1027,
2832,
1012,
2131,
2378,
18780,
21422,
1006,
1007,
1025,
2709,
22834,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.