repo stringclasses 11 values | path stringlengths 41 234 | func_name stringlengths 5 78 | original_string stringlengths 71 14.1k | language stringclasses 1 value | code stringlengths 71 14.1k | code_tokens listlengths 22 2.65k | docstring stringlengths 2 5.35k | docstring_tokens listlengths 1 369 | sha stringclasses 11 values | url stringlengths 129 339 | partition stringclasses 1 value | summary stringlengths 7 175 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONObject.java | JSONObject.put | @Override
public JSONObject put(String key, Object value) throws JSONException {
if (null == key) {
return this;
}
final boolean ignoreNullValue = this.config.isIgnoreNullValue();
if (ObjectUtil.isNull(value) && ignoreNullValue) {
// 忽略值模式下如果值为空清除key
this.remove(key);
} else {
InternalJSONUtil.testValidity(value);
this.rawHashMap.put(key, JSONUtil.wrap(value, ignoreNullValue));
}
return this;
} | java | @Override
public JSONObject put(String key, Object value) throws JSONException {
if (null == key) {
return this;
}
final boolean ignoreNullValue = this.config.isIgnoreNullValue();
if (ObjectUtil.isNull(value) && ignoreNullValue) {
// 忽略值模式下如果值为空清除key
this.remove(key);
} else {
InternalJSONUtil.testValidity(value);
this.rawHashMap.put(key, JSONUtil.wrap(value, ignoreNullValue));
}
return this;
} | [
"@",
"Override",
"public",
"JSONObject",
"put",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"null",
"==",
"key",
")",
"{",
"return",
"this",
";",
"}",
"final",
"boolean",
"ignoreNullValue",
"=",
"this",
"... | PUT 键值对到JSONObject中,如果值为<code>null</code>,将此键移除
@param key 键
@param value 值对象. 可以是以下类型: Boolean, Double, Integer, JSONArray, JSONObject, Long, String, or the JSONNull.NULL.
@return this.
@throws JSONException 值是无穷数字抛出此异常 | [
"PUT",
"键值对到JSONObject中,如果值为<code",
">",
"null<",
"/",
"code",
">",
",将此键移除"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONObject.java#L379-L394 | train | Add a value to the map. | [
30522,
1030,
2058,
15637,
2270,
1046,
3385,
16429,
20614,
2404,
1006,
5164,
3145,
1010,
4874,
3643,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
2065,
1006,
19701,
1027,
1027,
3145,
1007,
1063,
2709,
2023,
1025,
1065,
2345,
22017,
20898,
85... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.regionMatches | public boolean regionMatches(int thisStart, CharSequence string, int start, int length) {
if (string == null) {
throw new NullPointerException("string");
}
if (start < 0 || string.length() - start < length) {
return false;
}
final int thisLen = length();
if (thisStart < 0 || thisLen - thisStart < length) {
return false;
}
if (length <= 0) {
return true;
}
final int thatEnd = start + length;
for (int i = start, j = thisStart + arrayOffset(); i < thatEnd; i++, j++) {
if (b2c(value[j]) != string.charAt(i)) {
return false;
}
}
return true;
} | java | public boolean regionMatches(int thisStart, CharSequence string, int start, int length) {
if (string == null) {
throw new NullPointerException("string");
}
if (start < 0 || string.length() - start < length) {
return false;
}
final int thisLen = length();
if (thisStart < 0 || thisLen - thisStart < length) {
return false;
}
if (length <= 0) {
return true;
}
final int thatEnd = start + length;
for (int i = start, j = thisStart + arrayOffset(); i < thatEnd; i++, j++) {
if (b2c(value[j]) != string.charAt(i)) {
return false;
}
}
return true;
} | [
"public",
"boolean",
"regionMatches",
"(",
"int",
"thisStart",
",",
"CharSequence",
"string",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"if",
"(",
"string",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"string\"",
")",
... | Compares the specified string to this string and compares the specified range of characters to determine if they
are the same.
@param thisStart the starting offset in this string.
@param string the string to compare.
@param start the starting offset in the specified string.
@param length the number of characters to compare.
@return {@code true} if the ranges of characters are equal, {@code false} otherwise
@throws NullPointerException if {@code string} is {@code null}. | [
"Compares",
"the",
"specified",
"string",
"to",
"this",
"string",
"and",
"compares",
"the",
"specified",
"range",
"of",
"characters",
"to",
"determine",
"if",
"they",
"are",
"the",
"same",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L801-L826 | train | regionMatches This method checks if the specified string region matches this string. | [
30522,
2270,
22017,
20898,
2555,
18900,
8376,
1006,
20014,
2023,
14117,
2102,
1010,
25869,
3366,
4226,
5897,
5164,
1010,
20014,
2707,
1010,
20014,
3091,
1007,
1063,
2065,
1006,
5164,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/exceptions/ExceptionUtil.java | ExceptionUtil.stacktraceToOneLineString | public static String stacktraceToOneLineString(Throwable throwable, int limit) {
Map<Character, String> replaceCharToStrMap = new HashMap<>();
replaceCharToStrMap.put(StrUtil.C_CR, StrUtil.SPACE);
replaceCharToStrMap.put(StrUtil.C_LF, StrUtil.SPACE);
replaceCharToStrMap.put(StrUtil.C_TAB, StrUtil.SPACE);
return stacktraceToString(throwable, limit, replaceCharToStrMap);
} | java | public static String stacktraceToOneLineString(Throwable throwable, int limit) {
Map<Character, String> replaceCharToStrMap = new HashMap<>();
replaceCharToStrMap.put(StrUtil.C_CR, StrUtil.SPACE);
replaceCharToStrMap.put(StrUtil.C_LF, StrUtil.SPACE);
replaceCharToStrMap.put(StrUtil.C_TAB, StrUtil.SPACE);
return stacktraceToString(throwable, limit, replaceCharToStrMap);
} | [
"public",
"static",
"String",
"stacktraceToOneLineString",
"(",
"Throwable",
"throwable",
",",
"int",
"limit",
")",
"{",
"Map",
"<",
"Character",
",",
"String",
">",
"replaceCharToStrMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"replaceCharToStrMap",
".",
... | 堆栈转为单行完整字符串
@param throwable 异常对象
@param limit 限制最大长度
@return 堆栈转为的字符串 | [
"堆栈转为单行完整字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java#L147-L154 | train | Convert a Throwable to a line of text. | [
30522,
2270,
10763,
5164,
9991,
6494,
3401,
3406,
5643,
12735,
18886,
3070,
1006,
5466,
3085,
5466,
3085,
1010,
20014,
5787,
1007,
1063,
4949,
1026,
2839,
1010,
5164,
1028,
5672,
7507,
5339,
14122,
17830,
2361,
1027,
2047,
23325,
2863,
2361... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java | RemoteInputChannel.recycle | @Override
public void recycle(MemorySegment segment) {
int numAddedBuffers;
synchronized (bufferQueue) {
// Similar to notifyBufferAvailable(), make sure that we never add a buffer
// after releaseAllResources() released all buffers (see below for details).
if (isReleased.get()) {
try {
inputGate.returnExclusiveSegments(Collections.singletonList(segment));
return;
} catch (Throwable t) {
ExceptionUtils.rethrow(t);
}
}
numAddedBuffers = bufferQueue.addExclusiveBuffer(new NetworkBuffer(segment, this), numRequiredBuffers);
}
if (numAddedBuffers > 0 && unannouncedCredit.getAndAdd(numAddedBuffers) == 0) {
notifyCreditAvailable();
}
} | java | @Override
public void recycle(MemorySegment segment) {
int numAddedBuffers;
synchronized (bufferQueue) {
// Similar to notifyBufferAvailable(), make sure that we never add a buffer
// after releaseAllResources() released all buffers (see below for details).
if (isReleased.get()) {
try {
inputGate.returnExclusiveSegments(Collections.singletonList(segment));
return;
} catch (Throwable t) {
ExceptionUtils.rethrow(t);
}
}
numAddedBuffers = bufferQueue.addExclusiveBuffer(new NetworkBuffer(segment, this), numRequiredBuffers);
}
if (numAddedBuffers > 0 && unannouncedCredit.getAndAdd(numAddedBuffers) == 0) {
notifyCreditAvailable();
}
} | [
"@",
"Override",
"public",
"void",
"recycle",
"(",
"MemorySegment",
"segment",
")",
"{",
"int",
"numAddedBuffers",
";",
"synchronized",
"(",
"bufferQueue",
")",
"{",
"// Similar to notifyBufferAvailable(), make sure that we never add a buffer",
"// after releaseAllResources() r... | Exclusive buffer is recycled to this input channel directly and it may trigger return extra
floating buffer and notify increased credit to the producer.
@param segment The exclusive segment of this channel. | [
"Exclusive",
"buffer",
"is",
"recycled",
"to",
"this",
"input",
"channel",
"directly",
"and",
"it",
"may",
"trigger",
"return",
"extra",
"floating",
"buffer",
"and",
"notify",
"increased",
"credit",
"to",
"the",
"producer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java#L300-L321 | train | Recycle a memory segment. | [
30522,
1030,
2058,
15637,
2270,
11675,
28667,
2100,
14321,
1006,
3638,
3366,
21693,
4765,
6903,
1007,
1063,
20014,
16371,
25666,
5732,
8569,
12494,
2015,
1025,
25549,
1006,
17698,
4226,
5657,
1007,
1063,
1013,
1013,
2714,
2000,
2025,
8757,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java | Statistics.tableStats | public Statistics tableStats(TableStats tableStats) {
rowCount(tableStats.getRowCount());
columnStats.clear();
tableStats.getColumnStats().forEach(this::columnStats);
return this;
} | java | public Statistics tableStats(TableStats tableStats) {
rowCount(tableStats.getRowCount());
columnStats.clear();
tableStats.getColumnStats().forEach(this::columnStats);
return this;
} | [
"public",
"Statistics",
"tableStats",
"(",
"TableStats",
"tableStats",
")",
"{",
"rowCount",
"(",
"tableStats",
".",
"getRowCount",
"(",
")",
")",
";",
"columnStats",
".",
"clear",
"(",
")",
";",
"tableStats",
".",
"getColumnStats",
"(",
")",
".",
"forEach",... | Sets the statistics from a {@link TableStats} instance.
<p>This method overwrites all existing statistics.
@param tableStats the table statistics | [
"Sets",
"the",
"statistics",
"from",
"a",
"{",
"@link",
"TableStats",
"}",
"instance",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java#L59-L64 | train | This method is used to populate the statistics object with the given table stats. | [
30522,
2270,
6747,
7251,
29336,
2015,
1006,
7251,
29336,
2015,
7251,
29336,
2015,
1007,
1063,
5216,
3597,
16671,
1006,
7251,
29336,
2015,
1012,
2131,
10524,
3597,
16671,
1006,
1007,
1007,
1025,
7753,
29336,
2015,
1012,
3154,
1006,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java | RandomUtil.randomDay | public static DateTime randomDay(int min, int max) {
return DateUtil.offsetDay(DateUtil.date(), randomInt(min, max));
} | java | public static DateTime randomDay(int min, int max) {
return DateUtil.offsetDay(DateUtil.date(), randomInt(min, max));
} | [
"public",
"static",
"DateTime",
"randomDay",
"(",
"int",
"min",
",",
"int",
"max",
")",
"{",
"return",
"DateUtil",
".",
"offsetDay",
"(",
"DateUtil",
".",
"date",
"(",
")",
",",
"randomInt",
"(",
"min",
",",
"max",
")",
")",
";",
"}"
] | 以当天为基准,随机产生一个日期
@param min 偏移最小天,可以为负数表示过去的时间
@param max 偏移最大天,可以为负数表示过去的时间
@return 随机日期(随机天,其它时间不变)
@since 4.0.8 | [
"以当天为基准,随机产生一个日期"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java#L491-L493 | train | Returns a random date in the calendar system. | [
30522,
2270,
10763,
3058,
7292,
6721,
10259,
1006,
20014,
8117,
1010,
20014,
4098,
1007,
1063,
2709,
3058,
21823,
2140,
1012,
16396,
10259,
1006,
3058,
21823,
2140,
1012,
3058,
1006,
1007,
1010,
6721,
18447,
1006,
8117,
1010,
4098,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/ValueMatcherBuilder.java | ValueMatcherBuilder.parseStep | private static List<Integer> parseStep(String value, ValueParser parser) {
final List<String> parts = StrUtil.split(value, StrUtil.C_SLASH);
int size = parts.size();
List<Integer> results;
if (size == 1) {// 普通形式
results = parseRange(value, -1, parser);
} else if (size == 2) {// 间隔形式
final int step = parser.parse(parts.get(1));
if (step < 1) {
throw new CronException("Non positive divisor for field: [{}]", value);
}
results = parseRange(parts.get(0), step, parser);
} else {
throw new CronException("Invalid syntax of field: [{}]", value);
}
return results;
} | java | private static List<Integer> parseStep(String value, ValueParser parser) {
final List<String> parts = StrUtil.split(value, StrUtil.C_SLASH);
int size = parts.size();
List<Integer> results;
if (size == 1) {// 普通形式
results = parseRange(value, -1, parser);
} else if (size == 2) {// 间隔形式
final int step = parser.parse(parts.get(1));
if (step < 1) {
throw new CronException("Non positive divisor for field: [{}]", value);
}
results = parseRange(parts.get(0), step, parser);
} else {
throw new CronException("Invalid syntax of field: [{}]", value);
}
return results;
} | [
"private",
"static",
"List",
"<",
"Integer",
">",
"parseStep",
"(",
"String",
"value",
",",
"ValueParser",
"parser",
")",
"{",
"final",
"List",
"<",
"String",
">",
"parts",
"=",
"StrUtil",
".",
"split",
"(",
"value",
",",
"StrUtil",
".",
"C_SLASH",
")",
... | 处理间隔形式的表达式<br>
处理的形式包括:
<ul>
<li><strong>a</strong> 或 <strong>*</strong></li>
<li><strong>a/b</strong> 或 <strong>*/b</strong></li>
<li><strong>a-b/2</strong></li>
</ul>
@param value 表达式值
@param parser 针对这个时间字段的解析器
@return List | [
"处理间隔形式的表达式<br",
">",
"处理的形式包括:",
"<ul",
">",
"<li",
">",
"<strong",
">",
"a<",
"/",
"strong",
">",
"或",
"<strong",
">",
"*",
"<",
"/",
"strong",
">",
"<",
"/",
"li",
">",
"<li",
">",
"<strong",
">",
"a/",
";",
"b<",
"/",
"strong",
">",
"或",
... | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/ValueMatcherBuilder.java#L85-L102 | train | Parse step. | [
30522,
2797,
10763,
2862,
1026,
16109,
1028,
11968,
8583,
2618,
2361,
1006,
5164,
3643,
1010,
3643,
19362,
8043,
11968,
8043,
1007,
1063,
2345,
2862,
1026,
5164,
1028,
3033,
1027,
2358,
22134,
4014,
1012,
3975,
1006,
3643,
1010,
2358,
22134... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/HashPartition.java | HashPartition.getNumOccupiedMemorySegments | public int getNumOccupiedMemorySegments() {
// either the number of memory segments, or one for spilling
final int numPartitionBuffers = this.partitionBuffers != null ?
this.partitionBuffers.length : this.buildSideWriteBuffer.getNumOccupiedMemorySegments();
return numPartitionBuffers + numOverflowSegments;
} | java | public int getNumOccupiedMemorySegments() {
// either the number of memory segments, or one for spilling
final int numPartitionBuffers = this.partitionBuffers != null ?
this.partitionBuffers.length : this.buildSideWriteBuffer.getNumOccupiedMemorySegments();
return numPartitionBuffers + numOverflowSegments;
} | [
"public",
"int",
"getNumOccupiedMemorySegments",
"(",
")",
"{",
"// either the number of memory segments, or one for spilling",
"final",
"int",
"numPartitionBuffers",
"=",
"this",
".",
"partitionBuffers",
"!=",
"null",
"?",
"this",
".",
"partitionBuffers",
".",
"length",
... | Gets the number of memory segments used by this partition, which includes build side
memory buffers and overflow memory segments.
@return The number of occupied memory segments. | [
"Gets",
"the",
"number",
"of",
"memory",
"segments",
"used",
"by",
"this",
"partition",
"which",
"includes",
"build",
"side",
"memory",
"buffers",
"and",
"overflow",
"memory",
"segments",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/HashPartition.java#L208-L213 | train | Returns the number of memory segments occupied by this buffer. | [
30522,
2270,
20014,
2131,
19172,
10085,
15569,
6340,
4168,
5302,
24769,
13910,
8163,
1006,
1007,
1063,
1013,
1013,
2593,
1996,
2193,
1997,
3638,
9214,
1010,
2030,
2028,
2005,
18054,
2345,
20014,
16371,
8737,
8445,
22753,
8569,
12494,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java | StreamGraphGenerator.transformFeedback | private <T> Collection<Integer> transformFeedback(FeedbackTransformation<T> iterate) {
if (iterate.getFeedbackEdges().size() <= 0) {
throw new IllegalStateException("Iteration " + iterate + " does not have any feedback edges.");
}
StreamTransformation<T> input = iterate.getInput();
List<Integer> resultIds = new ArrayList<>();
// first transform the input stream(s) and store the result IDs
Collection<Integer> inputIds = transform(input);
resultIds.addAll(inputIds);
// the recursive transform might have already transformed this
if (alreadyTransformed.containsKey(iterate)) {
return alreadyTransformed.get(iterate);
}
// create the fake iteration source/sink pair
Tuple2<StreamNode, StreamNode> itSourceAndSink = streamGraph.createIterationSourceAndSink(
iterate.getId(),
getNewIterationNodeId(),
getNewIterationNodeId(),
iterate.getWaitTime(),
iterate.getParallelism(),
iterate.getMaxParallelism(),
iterate.getMinResources(),
iterate.getPreferredResources());
StreamNode itSource = itSourceAndSink.f0;
StreamNode itSink = itSourceAndSink.f1;
// We set the proper serializers for the sink/source
streamGraph.setSerializers(itSource.getId(), null, null, iterate.getOutputType().createSerializer(env.getConfig()));
streamGraph.setSerializers(itSink.getId(), iterate.getOutputType().createSerializer(env.getConfig()), null, null);
// also add the feedback source ID to the result IDs, so that downstream operators will
// add both as input
resultIds.add(itSource.getId());
// at the iterate to the already-seen-set with the result IDs, so that we can transform
// the feedback edges and let them stop when encountering the iterate node
alreadyTransformed.put(iterate, resultIds);
// so that we can determine the slot sharing group from all feedback edges
List<Integer> allFeedbackIds = new ArrayList<>();
for (StreamTransformation<T> feedbackEdge : iterate.getFeedbackEdges()) {
Collection<Integer> feedbackIds = transform(feedbackEdge);
allFeedbackIds.addAll(feedbackIds);
for (Integer feedbackId: feedbackIds) {
streamGraph.addEdge(feedbackId,
itSink.getId(),
0
);
}
}
String slotSharingGroup = determineSlotSharingGroup(null, allFeedbackIds);
itSink.setSlotSharingGroup(slotSharingGroup);
itSource.setSlotSharingGroup(slotSharingGroup);
return resultIds;
} | java | private <T> Collection<Integer> transformFeedback(FeedbackTransformation<T> iterate) {
if (iterate.getFeedbackEdges().size() <= 0) {
throw new IllegalStateException("Iteration " + iterate + " does not have any feedback edges.");
}
StreamTransformation<T> input = iterate.getInput();
List<Integer> resultIds = new ArrayList<>();
// first transform the input stream(s) and store the result IDs
Collection<Integer> inputIds = transform(input);
resultIds.addAll(inputIds);
// the recursive transform might have already transformed this
if (alreadyTransformed.containsKey(iterate)) {
return alreadyTransformed.get(iterate);
}
// create the fake iteration source/sink pair
Tuple2<StreamNode, StreamNode> itSourceAndSink = streamGraph.createIterationSourceAndSink(
iterate.getId(),
getNewIterationNodeId(),
getNewIterationNodeId(),
iterate.getWaitTime(),
iterate.getParallelism(),
iterate.getMaxParallelism(),
iterate.getMinResources(),
iterate.getPreferredResources());
StreamNode itSource = itSourceAndSink.f0;
StreamNode itSink = itSourceAndSink.f1;
// We set the proper serializers for the sink/source
streamGraph.setSerializers(itSource.getId(), null, null, iterate.getOutputType().createSerializer(env.getConfig()));
streamGraph.setSerializers(itSink.getId(), iterate.getOutputType().createSerializer(env.getConfig()), null, null);
// also add the feedback source ID to the result IDs, so that downstream operators will
// add both as input
resultIds.add(itSource.getId());
// at the iterate to the already-seen-set with the result IDs, so that we can transform
// the feedback edges and let them stop when encountering the iterate node
alreadyTransformed.put(iterate, resultIds);
// so that we can determine the slot sharing group from all feedback edges
List<Integer> allFeedbackIds = new ArrayList<>();
for (StreamTransformation<T> feedbackEdge : iterate.getFeedbackEdges()) {
Collection<Integer> feedbackIds = transform(feedbackEdge);
allFeedbackIds.addAll(feedbackIds);
for (Integer feedbackId: feedbackIds) {
streamGraph.addEdge(feedbackId,
itSink.getId(),
0
);
}
}
String slotSharingGroup = determineSlotSharingGroup(null, allFeedbackIds);
itSink.setSlotSharingGroup(slotSharingGroup);
itSource.setSlotSharingGroup(slotSharingGroup);
return resultIds;
} | [
"private",
"<",
"T",
">",
"Collection",
"<",
"Integer",
">",
"transformFeedback",
"(",
"FeedbackTransformation",
"<",
"T",
">",
"iterate",
")",
"{",
"if",
"(",
"iterate",
".",
"getFeedbackEdges",
"(",
")",
".",
"size",
"(",
")",
"<=",
"0",
")",
"{",
"t... | Transforms a {@code FeedbackTransformation}.
<p>This will recursively transform the input and the feedback edges. We return the
concatenation of the input IDs and the feedback IDs so that downstream operations can be
wired to both.
<p>This is responsible for creating the IterationSource and IterationSink which are used to
feed back the elements. | [
"Transforms",
"a",
"{",
"@code",
"FeedbackTransformation",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java#L345-L409 | train | This method is called by the iteration transformation to transform the feedback edges of the iteration. | [
30522,
2797,
1026,
1056,
1028,
3074,
1026,
16109,
1028,
10938,
7959,
2098,
5963,
1006,
12247,
6494,
3619,
14192,
3370,
1026,
1056,
1028,
2009,
22139,
1007,
1063,
2065,
1006,
2009,
22139,
1012,
2131,
7959,
2098,
5963,
24225,
2015,
1006,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.union | public UnionOperator<T> union(DataSet<T> other){
return new UnionOperator<>(this, other, Utils.getCallLocationName());
} | java | public UnionOperator<T> union(DataSet<T> other){
return new UnionOperator<>(this, other, Utils.getCallLocationName());
} | [
"public",
"UnionOperator",
"<",
"T",
">",
"union",
"(",
"DataSet",
"<",
"T",
">",
"other",
")",
"{",
"return",
"new",
"UnionOperator",
"<>",
"(",
"this",
",",
"other",
",",
"Utils",
".",
"getCallLocationName",
"(",
")",
")",
";",
"}"
] | Creates a union of this DataSet with an other DataSet. The other DataSet must be of the same data type.
@param other The other DataSet which is unioned with the current DataSet.
@return The resulting DataSet. | [
"Creates",
"a",
"union",
"of",
"this",
"DataSet",
"with",
"an",
"other",
"DataSet",
".",
"The",
"other",
"DataSet",
"must",
"be",
"of",
"the",
"same",
"data",
"type",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1241-L1243 | train | Create a union operator from the given data set. | [
30522,
2270,
2586,
25918,
8844,
1026,
1056,
1028,
2586,
1006,
2951,
13462,
1026,
1056,
1028,
2060,
1007,
1063,
2709,
2047,
2586,
25918,
8844,
1026,
1028,
1006,
2023,
1010,
2060,
1010,
21183,
12146,
1012,
2131,
9289,
7174,
10719,
18442,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.pressImage | public static void pressImage(Image srcImage, File outFile, Image pressImg, int x, int y, float alpha) throws IORuntimeException {
write(pressImage(srcImage, pressImg, x, y, alpha), outFile);
} | java | public static void pressImage(Image srcImage, File outFile, Image pressImg, int x, int y, float alpha) throws IORuntimeException {
write(pressImage(srcImage, pressImg, x, y, alpha), outFile);
} | [
"public",
"static",
"void",
"pressImage",
"(",
"Image",
"srcImage",
",",
"File",
"outFile",
",",
"Image",
"pressImg",
",",
"int",
"x",
",",
"int",
"y",
",",
"float",
"alpha",
")",
"throws",
"IORuntimeException",
"{",
"write",
"(",
"pressImage",
"(",
"srcIm... | 给图片添加图片水印<br>
此方法并不关闭流
@param srcImage 源图像流
@param outFile 写出文件
@param pressImg 水印图片,可以使用{@link ImageIO#read(File)}方法读取文件
@param x 修正值。 默认在中间,偏移量相对于中间偏移
@param y 修正值。 默认在中间,偏移量相对于中间偏移
@param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
@throws IORuntimeException IO异常
@since 3.2.2 | [
"给图片添加图片水印<br",
">",
"此方法并不关闭流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L924-L926 | train | Press an image to a file. | [
30522,
2270,
10763,
11675,
2811,
9581,
3351,
1006,
3746,
5034,
6895,
26860,
1010,
5371,
2041,
8873,
2571,
1010,
3746,
2811,
5714,
2290,
1010,
20014,
1060,
1010,
20014,
1061,
1010,
14257,
6541,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Snappy.java | Snappy.validateOffset | private static void validateOffset(int offset, int chunkSizeSoFar) {
if (offset == 0) {
throw new DecompressionException("Offset is less than minimum permissible value");
}
if (offset < 0) {
// Due to arithmetic overflow
throw new DecompressionException("Offset is greater than maximum value supported by this implementation");
}
if (offset > chunkSizeSoFar) {
throw new DecompressionException("Offset exceeds size of chunk");
}
} | java | private static void validateOffset(int offset, int chunkSizeSoFar) {
if (offset == 0) {
throw new DecompressionException("Offset is less than minimum permissible value");
}
if (offset < 0) {
// Due to arithmetic overflow
throw new DecompressionException("Offset is greater than maximum value supported by this implementation");
}
if (offset > chunkSizeSoFar) {
throw new DecompressionException("Offset exceeds size of chunk");
}
} | [
"private",
"static",
"void",
"validateOffset",
"(",
"int",
"offset",
",",
"int",
"chunkSizeSoFar",
")",
"{",
"if",
"(",
"offset",
"==",
"0",
")",
"{",
"throw",
"new",
"DecompressionException",
"(",
"\"Offset is less than minimum permissible value\"",
")",
";",
"}"... | Validates that the offset extracted from a compressed reference is within
the permissible bounds of an offset (0 < offset < Integer.MAX_VALUE), and does not
exceed the length of the chunk currently read so far.
@param offset The offset extracted from the compressed reference
@param chunkSizeSoFar The number of bytes read so far from this chunk
@throws DecompressionException if the offset is invalid | [
"Validates",
"that",
"the",
"offset",
"extracted",
"from",
"a",
"compressed",
"reference",
"is",
"within",
"the",
"permissible",
"bounds",
"of",
"an",
"offset",
"(",
"0",
"<",
"offset",
"<",
"Integer",
".",
"MAX_VALUE",
")",
"and",
"does",
"not",
"exceed",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java#L575-L588 | train | Validate the offset. | [
30522,
2797,
10763,
11675,
9398,
3686,
27475,
3388,
1006,
20014,
16396,
1010,
20014,
24839,
10057,
11253,
2906,
1007,
1063,
2065,
1006,
16396,
1027,
1027,
1014,
1007,
1063,
5466,
2047,
21933,
8737,
8303,
3258,
10288,
24422,
1006,
1000,
16396,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.createInternalSSLContext | @Nullable
private static SSLContext createInternalSSLContext(Configuration config) throws Exception {
checkNotNull(config, "config");
if (!isInternalSSLEnabled(config)) {
return null;
}
String keystoreFilePath = getAndCheckOption(
config, SecurityOptions.SSL_INTERNAL_KEYSTORE, SecurityOptions.SSL_KEYSTORE);
String keystorePassword = getAndCheckOption(
config, SecurityOptions.SSL_INTERNAL_KEYSTORE_PASSWORD, SecurityOptions.SSL_KEYSTORE_PASSWORD);
String certPassword = getAndCheckOption(
config, SecurityOptions.SSL_INTERNAL_KEY_PASSWORD, SecurityOptions.SSL_KEY_PASSWORD);
String trustStoreFilePath = getAndCheckOption(
config, SecurityOptions.SSL_INTERNAL_TRUSTSTORE, SecurityOptions.SSL_TRUSTSTORE);
String trustStorePassword = getAndCheckOption(
config, SecurityOptions.SSL_INTERNAL_TRUSTSTORE_PASSWORD, SecurityOptions.SSL_TRUSTSTORE_PASSWORD);
String sslProtocolVersion = config.getString(SecurityOptions.SSL_PROTOCOL);
int sessionCacheSize = config.getInteger(SecurityOptions.SSL_INTERNAL_SESSION_CACHE_SIZE);
int sessionTimeoutMs = config.getInteger(SecurityOptions.SSL_INTERNAL_SESSION_TIMEOUT);
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
try (InputStream keyStoreFile = Files.newInputStream(new File(keystoreFilePath).toPath())) {
keyStore.load(keyStoreFile, keystorePassword.toCharArray());
}
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
try (InputStream trustStoreFile = Files.newInputStream(new File(trustStoreFilePath).toPath())) {
trustStore.load(trustStoreFile, trustStorePassword.toCharArray());
}
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(keyStore, certPassword.toCharArray());
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(trustStore);
SSLContext sslContext = SSLContext.getInstance(sslProtocolVersion);
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
if (sessionCacheSize >= 0) {
sslContext.getClientSessionContext().setSessionCacheSize(sessionCacheSize);
}
if (sessionTimeoutMs >= 0) {
sslContext.getClientSessionContext().setSessionTimeout(sessionTimeoutMs / 1000);
}
return sslContext;
} | java | @Nullable
private static SSLContext createInternalSSLContext(Configuration config) throws Exception {
checkNotNull(config, "config");
if (!isInternalSSLEnabled(config)) {
return null;
}
String keystoreFilePath = getAndCheckOption(
config, SecurityOptions.SSL_INTERNAL_KEYSTORE, SecurityOptions.SSL_KEYSTORE);
String keystorePassword = getAndCheckOption(
config, SecurityOptions.SSL_INTERNAL_KEYSTORE_PASSWORD, SecurityOptions.SSL_KEYSTORE_PASSWORD);
String certPassword = getAndCheckOption(
config, SecurityOptions.SSL_INTERNAL_KEY_PASSWORD, SecurityOptions.SSL_KEY_PASSWORD);
String trustStoreFilePath = getAndCheckOption(
config, SecurityOptions.SSL_INTERNAL_TRUSTSTORE, SecurityOptions.SSL_TRUSTSTORE);
String trustStorePassword = getAndCheckOption(
config, SecurityOptions.SSL_INTERNAL_TRUSTSTORE_PASSWORD, SecurityOptions.SSL_TRUSTSTORE_PASSWORD);
String sslProtocolVersion = config.getString(SecurityOptions.SSL_PROTOCOL);
int sessionCacheSize = config.getInteger(SecurityOptions.SSL_INTERNAL_SESSION_CACHE_SIZE);
int sessionTimeoutMs = config.getInteger(SecurityOptions.SSL_INTERNAL_SESSION_TIMEOUT);
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
try (InputStream keyStoreFile = Files.newInputStream(new File(keystoreFilePath).toPath())) {
keyStore.load(keyStoreFile, keystorePassword.toCharArray());
}
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
try (InputStream trustStoreFile = Files.newInputStream(new File(trustStoreFilePath).toPath())) {
trustStore.load(trustStoreFile, trustStorePassword.toCharArray());
}
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(keyStore, certPassword.toCharArray());
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(trustStore);
SSLContext sslContext = SSLContext.getInstance(sslProtocolVersion);
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
if (sessionCacheSize >= 0) {
sslContext.getClientSessionContext().setSessionCacheSize(sessionCacheSize);
}
if (sessionTimeoutMs >= 0) {
sslContext.getClientSessionContext().setSessionTimeout(sessionTimeoutMs / 1000);
}
return sslContext;
} | [
"@",
"Nullable",
"private",
"static",
"SSLContext",
"createInternalSSLContext",
"(",
"Configuration",
"config",
")",
"throws",
"Exception",
"{",
"checkNotNull",
"(",
"config",
",",
"\"config\"",
")",
";",
"if",
"(",
"!",
"isInternalSSLEnabled",
"(",
"config",
")",... | Creates the SSL Context for internal SSL, if internal SSL is configured.
For internal SSL, the client and server side configuration are identical, because
of mutual authentication. | [
"Creates",
"the",
"SSL",
"Context",
"for",
"internal",
"SSL",
"if",
"internal",
"SSL",
"is",
"configured",
".",
"For",
"internal",
"SSL",
"the",
"client",
"and",
"server",
"side",
"configuration",
"are",
"identical",
"because",
"of",
"mutual",
"authentication",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java#L205-L257 | train | Creates an SSL context for internal SSL. | [
30522,
1030,
19701,
3085,
2797,
10763,
7020,
22499,
10111,
18413,
3443,
18447,
11795,
9777,
14540,
8663,
18209,
1006,
9563,
9530,
8873,
2290,
1007,
11618,
6453,
1063,
4638,
17048,
11231,
3363,
1006,
9530,
8873,
2290,
1010,
1000,
9530,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ObjectUtil.java | ObjectUtil.cloneIfPossible | public static <T> T cloneIfPossible(final T obj) {
T clone = null;
try {
clone = clone(obj);
} catch (Exception e) {
// pass
}
return clone == null ? obj : clone;
} | java | public static <T> T cloneIfPossible(final T obj) {
T clone = null;
try {
clone = clone(obj);
} catch (Exception e) {
// pass
}
return clone == null ? obj : clone;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"cloneIfPossible",
"(",
"final",
"T",
"obj",
")",
"{",
"T",
"clone",
"=",
"null",
";",
"try",
"{",
"clone",
"=",
"clone",
"(",
"obj",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// pass\r",
"}... | 返回克隆后的对象,如果克隆失败,返回原对象
@param <T> 对象类型
@param obj 对象
@return 克隆后或原对象 | [
"返回克隆后的对象,如果克隆失败,返回原对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ObjectUtil.java#L307-L315 | train | Clones the given object if possible. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
17598,
10128,
6873,
18719,
3468,
1006,
2345,
1056,
27885,
3501,
1007,
1063,
1056,
17598,
1027,
19701,
1025,
3046,
1063,
17598,
1027,
17598,
1006,
27885,
3501,
1007,
1025,
1065,
4608,
1006,
6453,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dictionary/NGramDictionaryMaker.java | NGramDictionaryMaker.saveNGramToTxt | public boolean saveNGramToTxt(String path)
{
try
{
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(IOUtil.newOutputStream(path)));
for (Map.Entry<String, Integer> entry : trie.entrySet())
{
bw.write(entry.getKey() + " " + entry.getValue());
bw.newLine();
}
bw.close();
}
catch (Exception e)
{
logger.warning("在保存NGram词典到" + path + "时发生异常" + e);
return false;
}
return true;
} | java | public boolean saveNGramToTxt(String path)
{
try
{
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(IOUtil.newOutputStream(path)));
for (Map.Entry<String, Integer> entry : trie.entrySet())
{
bw.write(entry.getKey() + " " + entry.getValue());
bw.newLine();
}
bw.close();
}
catch (Exception e)
{
logger.warning("在保存NGram词典到" + path + "时发生异常" + e);
return false;
}
return true;
} | [
"public",
"boolean",
"saveNGramToTxt",
"(",
"String",
"path",
")",
"{",
"try",
"{",
"BufferedWriter",
"bw",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"IOUtil",
".",
"newOutputStream",
"(",
"path",
")",
")",
")",
";",
"for",
"(",
... | 保存NGram词典
@param path
@return | [
"保存NGram词典"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/NGramDictionaryMaker.java#L73-L92 | train | Save NGram to txt | [
30522,
2270,
22017,
20898,
3828,
3070,
6444,
3406,
2102,
18413,
1006,
5164,
4130,
1007,
1063,
3046,
1063,
17698,
2098,
15994,
1038,
2860,
1027,
2047,
17698,
2098,
15994,
1006,
2047,
27852,
25379,
15994,
1006,
22834,
21823,
2140,
1012,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.readXML | public static Document readXML(String pathOrContent) {
if (StrUtil.startWith(pathOrContent, '<')) {
return parseXml(pathOrContent);
}
return readXML(FileUtil.file(pathOrContent));
} | java | public static Document readXML(String pathOrContent) {
if (StrUtil.startWith(pathOrContent, '<')) {
return parseXml(pathOrContent);
}
return readXML(FileUtil.file(pathOrContent));
} | [
"public",
"static",
"Document",
"readXML",
"(",
"String",
"pathOrContent",
")",
"{",
"if",
"(",
"StrUtil",
".",
"startWith",
"(",
"pathOrContent",
",",
"'",
"'",
")",
")",
"{",
"return",
"parseXml",
"(",
"pathOrContent",
")",
";",
"}",
"return",
"readXML",... | 读取解析XML文件<br>
如果给定内容以“<”开头,表示这是一个XML内容,直接读取,否则按照路径处理<br>
路径可以为相对路径,也可以是绝对路径,相对路径相对于ClassPath
@param pathOrContent 内容或路径
@return XML文档对象
@since 3.0.9 | [
"读取解析XML文件<br",
">",
"如果给定内容以“<",
";",
"”开头,表示这是一个XML内容,直接读取,否则按照路径处理<br",
">",
"路径可以为相对路径,也可以是绝对路径,相对路径相对于ClassPath"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L102-L107 | train | Reads an XML document from a file or a string. | [
30522,
2270,
10763,
6254,
3191,
2595,
19968,
1006,
5164,
4130,
2953,
8663,
6528,
2102,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2707,
24415,
1006,
4130,
2953,
8663,
6528,
2102,
1010,
1005,
1026,
1005,
1007,
1007,
1063,
2709,
11968,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/document/CorpusLoader.java | CorpusLoader.convert2DocumentList | public static List<Document> convert2DocumentList(String folderPath, boolean verbose)
{
long start = System.currentTimeMillis();
List<File> fileList = IOUtil.fileList(folderPath);
List<Document> documentList = new LinkedList<Document>();
int i = 0;
for (File file : fileList)
{
if (verbose) System.out.print(file);
Document document = convert2Document(file);
documentList.add(document);
if (verbose) System.out.println(" " + ++i + " / " + fileList.size());
}
if (verbose)
{
System.out.println(documentList.size());
System.out.printf("花费时间%d ms\n", System.currentTimeMillis() - start);
}
return documentList;
} | java | public static List<Document> convert2DocumentList(String folderPath, boolean verbose)
{
long start = System.currentTimeMillis();
List<File> fileList = IOUtil.fileList(folderPath);
List<Document> documentList = new LinkedList<Document>();
int i = 0;
for (File file : fileList)
{
if (verbose) System.out.print(file);
Document document = convert2Document(file);
documentList.add(document);
if (verbose) System.out.println(" " + ++i + " / " + fileList.size());
}
if (verbose)
{
System.out.println(documentList.size());
System.out.printf("花费时间%d ms\n", System.currentTimeMillis() - start);
}
return documentList;
} | [
"public",
"static",
"List",
"<",
"Document",
">",
"convert2DocumentList",
"(",
"String",
"folderPath",
",",
"boolean",
"verbose",
")",
"{",
"long",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"List",
"<",
"File",
">",
"fileList",
"=",
... | 读取整个目录中的人民日报格式语料
@param folderPath 路径
@param verbose
@return | [
"读取整个目录中的人民日报格式语料"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/document/CorpusLoader.java#L82-L101 | train | Convert 2 document list. | [
30522,
2270,
10763,
2862,
1026,
6254,
1028,
10463,
2475,
3527,
24894,
4765,
9863,
1006,
5164,
19622,
15069,
1010,
22017,
20898,
12034,
9232,
1007,
1063,
2146,
2707,
1027,
2291,
1012,
2783,
7292,
19912,
2483,
1006,
1007,
1025,
2862,
1026,
53... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java | SlotManager.freeSlot | public void freeSlot(SlotID slotId, AllocationID allocationId) {
checkInit();
TaskManagerSlot slot = slots.get(slotId);
if (null != slot) {
if (slot.getState() == TaskManagerSlot.State.ALLOCATED) {
if (Objects.equals(allocationId, slot.getAllocationId())) {
TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations.get(slot.getInstanceId());
if (taskManagerRegistration == null) {
throw new IllegalStateException("Trying to free a slot from a TaskManager " +
slot.getInstanceId() + " which has not been registered.");
}
updateSlotState(slot, taskManagerRegistration, null, null);
} else {
LOG.debug("Received request to free slot {} with expected allocation id {}, " +
"but actual allocation id {} differs. Ignoring the request.", slotId, allocationId, slot.getAllocationId());
}
} else {
LOG.debug("Slot {} has not been allocated.", allocationId);
}
} else {
LOG.debug("Trying to free a slot {} which has not been registered. Ignoring this message.", slotId);
}
} | java | public void freeSlot(SlotID slotId, AllocationID allocationId) {
checkInit();
TaskManagerSlot slot = slots.get(slotId);
if (null != slot) {
if (slot.getState() == TaskManagerSlot.State.ALLOCATED) {
if (Objects.equals(allocationId, slot.getAllocationId())) {
TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations.get(slot.getInstanceId());
if (taskManagerRegistration == null) {
throw new IllegalStateException("Trying to free a slot from a TaskManager " +
slot.getInstanceId() + " which has not been registered.");
}
updateSlotState(slot, taskManagerRegistration, null, null);
} else {
LOG.debug("Received request to free slot {} with expected allocation id {}, " +
"but actual allocation id {} differs. Ignoring the request.", slotId, allocationId, slot.getAllocationId());
}
} else {
LOG.debug("Slot {} has not been allocated.", allocationId);
}
} else {
LOG.debug("Trying to free a slot {} which has not been registered. Ignoring this message.", slotId);
}
} | [
"public",
"void",
"freeSlot",
"(",
"SlotID",
"slotId",
",",
"AllocationID",
"allocationId",
")",
"{",
"checkInit",
"(",
")",
";",
"TaskManagerSlot",
"slot",
"=",
"slots",
".",
"get",
"(",
"slotId",
")",
";",
"if",
"(",
"null",
"!=",
"slot",
")",
"{",
"... | Free the given slot from the given allocation. If the slot is still allocated by the given
allocation id, then the slot will be marked as free and will be subject to new slot requests.
@param slotId identifying the slot to free
@param allocationId with which the slot is presumably allocated | [
"Free",
"the",
"given",
"slot",
"from",
"the",
"given",
"allocation",
".",
"If",
"the",
"slot",
"is",
"still",
"allocated",
"by",
"the",
"given",
"allocation",
"id",
"then",
"the",
"slot",
"will",
"be",
"marked",
"as",
"free",
"and",
"will",
"be",
"subje... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java#L436-L463 | train | Frees a slot from a TaskManager. | [
30522,
2270,
11675,
2489,
14540,
4140,
1006,
10453,
3593,
10453,
3593,
1010,
16169,
3593,
16169,
3593,
1007,
1063,
4638,
5498,
2102,
1006,
1007,
1025,
4708,
24805,
15776,
10994,
10453,
1027,
19832,
1012,
2131,
1006,
10453,
3593,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/RedissonBlockingDeque.java | RedissonBlockingDeque.poll | @Override
public V poll(long timeout, TimeUnit unit) throws InterruptedException {
return blockingQueue.poll(timeout, unit);
} | java | @Override
public V poll(long timeout, TimeUnit unit) throws InterruptedException {
return blockingQueue.poll(timeout, unit);
} | [
"@",
"Override",
"public",
"V",
"poll",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"return",
"blockingQueue",
".",
"poll",
"(",
"timeout",
",",
"unit",
")",
";",
"}"
] | /*
(non-Javadoc)
@see java.util.concurrent.BlockingQueue#poll(long, java.util.concurrent.TimeUnit) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/RedissonBlockingDeque.java#L92-L95 | train | Polls the cache entry. | [
30522,
1030,
2058,
15637,
2270,
1058,
8554,
1006,
2146,
2051,
5833,
1010,
2051,
19496,
2102,
3131,
1007,
11618,
7153,
10288,
24422,
1063,
2709,
10851,
4226,
5657,
1012,
8554,
1006,
2051,
5833,
1010,
3131,
1007,
1025,
1065,
102,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/AWSUtil.java | AWSUtil.isValidRegion | public static boolean isValidRegion(String region) {
try {
Regions.fromName(region.toLowerCase());
} catch (IllegalArgumentException e) {
return false;
}
return true;
} | java | public static boolean isValidRegion(String region) {
try {
Regions.fromName(region.toLowerCase());
} catch (IllegalArgumentException e) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isValidRegion",
"(",
"String",
"region",
")",
"{",
"try",
"{",
"Regions",
".",
"fromName",
"(",
"region",
".",
"toLowerCase",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"return",
"false... | Checks whether or not a region ID is valid.
@param region The AWS region ID to check
@return true if the supplied region ID is valid, false otherwise | [
"Checks",
"whether",
"or",
"not",
"a",
"region",
"ID",
"is",
"valid",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/AWSUtil.java#L188-L195 | train | Checks if the given region is a valid region name. | [
30522,
2270,
10763,
22017,
20898,
2003,
10175,
3593,
23784,
1006,
5164,
2555,
1007,
1063,
3046,
1063,
4655,
1012,
2013,
18442,
1006,
2555,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1007,
1025,
1065,
4608,
1006,
6206,
2906,
22850,
15781,
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/ssl/JdkSslContext.java | JdkSslContext.buildKeyManagerFactory | @Deprecated
protected static KeyManagerFactory buildKeyManagerFactory(File certChainFile,
String keyAlgorithm, File keyFile, String keyPassword, KeyManagerFactory kmf)
throws KeyStoreException, NoSuchAlgorithmException, NoSuchPaddingException,
InvalidKeySpecException, InvalidAlgorithmParameterException, IOException,
CertificateException, KeyException, UnrecoverableKeyException {
return buildKeyManagerFactory(toX509Certificates(certChainFile), keyAlgorithm,
toPrivateKey(keyFile, keyPassword), keyPassword, kmf);
} | java | @Deprecated
protected static KeyManagerFactory buildKeyManagerFactory(File certChainFile,
String keyAlgorithm, File keyFile, String keyPassword, KeyManagerFactory kmf)
throws KeyStoreException, NoSuchAlgorithmException, NoSuchPaddingException,
InvalidKeySpecException, InvalidAlgorithmParameterException, IOException,
CertificateException, KeyException, UnrecoverableKeyException {
return buildKeyManagerFactory(toX509Certificates(certChainFile), keyAlgorithm,
toPrivateKey(keyFile, keyPassword), keyPassword, kmf);
} | [
"@",
"Deprecated",
"protected",
"static",
"KeyManagerFactory",
"buildKeyManagerFactory",
"(",
"File",
"certChainFile",
",",
"String",
"keyAlgorithm",
",",
"File",
"keyFile",
",",
"String",
"keyPassword",
",",
"KeyManagerFactory",
"kmf",
")",
"throws",
"KeyStoreException... | Build a {@link KeyManagerFactory} based upon a key algorithm, key file, key file password,
and a certificate chain.
@param certChainFile a X.509 certificate chain file in PEM format
@param keyAlgorithm the standard name of the requested algorithm. See the Java Secure Socket Extension
Reference Guide for information about standard algorithm names.
@param keyFile a PKCS#8 private key file in PEM format
@param keyPassword the password of the {@code keyFile}.
{@code null} if it's not password-protected.
@param kmf The existing {@link KeyManagerFactory} that will be used if not {@code null}
@return A {@link KeyManagerFactory} based upon a key algorithm, key file, key file password,
and a certificate chain.
@deprecated will be removed. | [
"Build",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/JdkSslContext.java#L473-L481 | train | Build a KeyManagerFactory from a file containing a chain of X509Certificates and a file containing a private key. | [
30522,
1030,
2139,
28139,
12921,
5123,
10763,
3145,
24805,
4590,
21450,
3857,
14839,
24805,
4590,
21450,
1006,
5371,
8292,
5339,
24925,
2078,
8873,
2571,
1010,
5164,
3145,
2389,
20255,
8939,
2213,
1010,
5371,
3145,
8873,
2571,
1010,
5164,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java | EnvironmentInformation.getRevisionInformation | public static RevisionInformation getRevisionInformation() {
String revision = UNKNOWN;
String commitDate = UNKNOWN;
try (InputStream propFile = EnvironmentInformation.class.getClassLoader().getResourceAsStream(".version.properties")) {
if (propFile != null) {
Properties properties = new Properties();
properties.load(propFile);
String propRevision = properties.getProperty("git.commit.id.abbrev");
String propCommitDate = properties.getProperty("git.commit.time");
revision = propRevision != null ? propRevision : UNKNOWN;
commitDate = propCommitDate != null ? propCommitDate : UNKNOWN;
}
} catch (Throwable t) {
if (LOG.isDebugEnabled()) {
LOG.debug("Cannot determine code revision: Unable to read version property file.", t);
} else {
LOG.info("Cannot determine code revision: Unable to read version property file.");
}
}
return new RevisionInformation(revision, commitDate);
} | java | public static RevisionInformation getRevisionInformation() {
String revision = UNKNOWN;
String commitDate = UNKNOWN;
try (InputStream propFile = EnvironmentInformation.class.getClassLoader().getResourceAsStream(".version.properties")) {
if (propFile != null) {
Properties properties = new Properties();
properties.load(propFile);
String propRevision = properties.getProperty("git.commit.id.abbrev");
String propCommitDate = properties.getProperty("git.commit.time");
revision = propRevision != null ? propRevision : UNKNOWN;
commitDate = propCommitDate != null ? propCommitDate : UNKNOWN;
}
} catch (Throwable t) {
if (LOG.isDebugEnabled()) {
LOG.debug("Cannot determine code revision: Unable to read version property file.", t);
} else {
LOG.info("Cannot determine code revision: Unable to read version property file.");
}
}
return new RevisionInformation(revision, commitDate);
} | [
"public",
"static",
"RevisionInformation",
"getRevisionInformation",
"(",
")",
"{",
"String",
"revision",
"=",
"UNKNOWN",
";",
"String",
"commitDate",
"=",
"UNKNOWN",
";",
"try",
"(",
"InputStream",
"propFile",
"=",
"EnvironmentInformation",
".",
"class",
".",
"ge... | Returns the code revision (commit and commit date) of Flink, as generated by the Maven builds.
@return The code revision. | [
"Returns",
"the",
"code",
"revision",
"(",
"commit",
"and",
"commit",
"date",
")",
"of",
"Flink",
"as",
"generated",
"by",
"the",
"Maven",
"builds",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java#L59-L80 | train | Returns the revision information. | [
30522,
2270,
10763,
13921,
2378,
14192,
3370,
2131,
2890,
17084,
2378,
14192,
3370,
1006,
1007,
1063,
5164,
13921,
1027,
4242,
1025,
5164,
10797,
13701,
1027,
4242,
1025,
3046,
1006,
20407,
25379,
17678,
8873,
2571,
1027,
4044,
2378,
14192,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/utility/LexiconUtility.java | LexiconUtility.convertStringToNature | public static Nature convertStringToNature(String name, LinkedHashSet<Nature> customNatureCollector)
{
Nature nature = Nature.fromString(name);
if (nature == null)
{
nature = Nature.create(name);
if (customNatureCollector != null) customNatureCollector.add(nature);
}
return nature;
} | java | public static Nature convertStringToNature(String name, LinkedHashSet<Nature> customNatureCollector)
{
Nature nature = Nature.fromString(name);
if (nature == null)
{
nature = Nature.create(name);
if (customNatureCollector != null) customNatureCollector.add(nature);
}
return nature;
} | [
"public",
"static",
"Nature",
"convertStringToNature",
"(",
"String",
"name",
",",
"LinkedHashSet",
"<",
"Nature",
">",
"customNatureCollector",
")",
"{",
"Nature",
"nature",
"=",
"Nature",
".",
"fromString",
"(",
"name",
")",
";",
"if",
"(",
"nature",
"==",
... | 将字符串词性转为Enum词性
@param name 词性名称
@param customNatureCollector 一个收集集合
@return 转换结果 | [
"将字符串词性转为Enum词性"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/LexiconUtility.java#L149-L158 | train | Convert string to a Nature object. | [
30522,
2270,
10763,
3267,
19884,
18886,
3070,
2669,
4017,
5397,
1006,
5164,
2171,
1010,
5799,
14949,
7898,
3388,
1026,
3267,
1028,
7661,
19833,
5397,
26895,
22471,
2953,
1007,
1063,
3267,
3267,
1027,
3267,
1012,
2013,
3367,
4892,
1006,
2171... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-socket/src/main/java/cn/hutool/socket/aio/AioClient.java | AioClient.setOption | public <T> AioClient setOption(SocketOption<T> name, T value) throws IOException {
this.session.getChannel().setOption(name, value);
return this;
} | java | public <T> AioClient setOption(SocketOption<T> name, T value) throws IOException {
this.session.getChannel().setOption(name, value);
return this;
} | [
"public",
"<",
"T",
">",
"AioClient",
"setOption",
"(",
"SocketOption",
"<",
"T",
">",
"name",
",",
"T",
"value",
")",
"throws",
"IOException",
"{",
"this",
".",
"session",
".",
"getChannel",
"(",
")",
".",
"setOption",
"(",
"name",
",",
"value",
")",
... | 设置 Socket 的 Option 选项<br>
选项见:{@link java.net.StandardSocketOptions}
@param <T> 选项泛型
@param name {@link SocketOption} 枚举
@param value SocketOption参数
@throws IOException IO异常 | [
"设置",
"Socket",
"的",
"Option",
"选项<br",
">",
"选项见:",
"{",
"@link",
"java",
".",
"net",
".",
"StandardSocketOptions",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-socket/src/main/java/cn/hutool/socket/aio/AioClient.java#L68-L71 | train | Sets an option on the socket. | [
30522,
2270,
1026,
1056,
1028,
9932,
10085,
8751,
3372,
2275,
7361,
3508,
1006,
22278,
7361,
3508,
1026,
1056,
1028,
2171,
1010,
1056,
3643,
1007,
11618,
22834,
10288,
24422,
1063,
2023,
1012,
5219,
1012,
2131,
26058,
1006,
1007,
1012,
2275... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/api/BatchOptions.java | BatchOptions.syncSlaves | public BatchOptions syncSlaves(int slaves, long timeout, TimeUnit unit) {
this.syncSlaves = slaves;
this.syncTimeout = unit.toMillis(timeout);
return this;
} | java | public BatchOptions syncSlaves(int slaves, long timeout, TimeUnit unit) {
this.syncSlaves = slaves;
this.syncTimeout = unit.toMillis(timeout);
return this;
} | [
"public",
"BatchOptions",
"syncSlaves",
"(",
"int",
"slaves",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"this",
".",
"syncSlaves",
"=",
"slaves",
";",
"this",
".",
"syncTimeout",
"=",
"unit",
".",
"toMillis",
"(",
"timeout",
")",
";",
"r... | Synchronize write operations execution within defined timeout
across specified amount of Redis slave nodes.
<p>
NOTE: Redis 3.0+ required
@param slaves - synchronization timeout
@param timeout - synchronization timeout
@param unit - synchronization timeout time unit
@return self instance | [
"Synchronize",
"write",
"operations",
"execution",
"within",
"defined",
"timeout",
"across",
"specified",
"amount",
"of",
"Redis",
"slave",
"nodes",
".",
"<p",
">",
"NOTE",
":",
"Redis",
"3",
".",
"0",
"+",
"required"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/BatchOptions.java#L152-L156 | train | Sets the number of threads to wait for the batch to complete. | [
30522,
2270,
14108,
7361,
9285,
26351,
14540,
21055,
1006,
20014,
7179,
1010,
2146,
2051,
5833,
1010,
2051,
19496,
2102,
3131,
1007,
1063,
2023,
1012,
26351,
14540,
21055,
1027,
7179,
1025,
2023,
1012,
26351,
7292,
5833,
1027,
3131,
1012,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnector.java | KafkaCanalConnector.unsubscribe | @Override
public void unsubscribe() {
waitClientRunning();
if (!running) {
return;
}
if (kafkaConsumer != null) {
kafkaConsumer.unsubscribe();
}
if (kafkaConsumer2 != null) {
kafkaConsumer2.unsubscribe();
}
} | java | @Override
public void unsubscribe() {
waitClientRunning();
if (!running) {
return;
}
if (kafkaConsumer != null) {
kafkaConsumer.unsubscribe();
}
if (kafkaConsumer2 != null) {
kafkaConsumer2.unsubscribe();
}
} | [
"@",
"Override",
"public",
"void",
"unsubscribe",
"(",
")",
"{",
"waitClientRunning",
"(",
")",
";",
"if",
"(",
"!",
"running",
")",
"{",
"return",
";",
"}",
"if",
"(",
"kafkaConsumer",
"!=",
"null",
")",
"{",
"kafkaConsumer",
".",
"unsubscribe",
"(",
... | 取消订阅 | [
"取消订阅"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnector.java#L148-L161 | train | Unsubscribe from Kafka. | [
30522,
1030,
2058,
15637,
2270,
11675,
4895,
6342,
5910,
26775,
20755,
1006,
1007,
1063,
3524,
20464,
11638,
15532,
5582,
1006,
1007,
1025,
2065,
1006,
999,
2770,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
10556,
24316,
22684,
3619,
17897,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java | Ftp.setMode | public Ftp setMode(FtpMode mode) {
this.mode = mode;
switch (mode) {
case Active:
this.client.enterLocalActiveMode();
break;
case Passive:
this.client.enterLocalPassiveMode();
break;
}
return this;
} | java | public Ftp setMode(FtpMode mode) {
this.mode = mode;
switch (mode) {
case Active:
this.client.enterLocalActiveMode();
break;
case Passive:
this.client.enterLocalPassiveMode();
break;
}
return this;
} | [
"public",
"Ftp",
"setMode",
"(",
"FtpMode",
"mode",
")",
"{",
"this",
".",
"mode",
"=",
"mode",
";",
"switch",
"(",
"mode",
")",
"{",
"case",
"Active",
":",
"this",
".",
"client",
".",
"enterLocalActiveMode",
"(",
")",
";",
"break",
";",
"case",
"Pas... | 设置FTP连接模式,可选主动和被动模式
@param mode 模式枚举
@return this
@since 4.1.19 | [
"设置FTP连接模式,可选主动和被动模式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java#L166-L177 | train | Sets the mode of the remote connection. | [
30522,
2270,
3027,
2361,
2275,
5302,
3207,
1006,
3027,
9737,
10244,
5549,
1007,
1063,
2023,
1012,
5549,
1027,
5549,
1025,
6942,
1006,
5549,
1007,
1063,
2553,
3161,
1024,
2023,
1012,
7396,
1012,
4607,
4135,
25015,
15277,
5302,
3207,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateGeneral | public static <T extends CharSequence> T validateGeneral(T value, int min, String errorMsg) throws ValidateException {
return validateGeneral(value, min, 0, errorMsg);
} | java | public static <T extends CharSequence> T validateGeneral(T value, int min, String errorMsg) throws ValidateException {
return validateGeneral(value, min, 0, errorMsg);
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateGeneral",
"(",
"T",
"value",
",",
"int",
"min",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"return",
"validateGeneral",
"(",
"value",
",",
"min",
",",
"0",
... | 验证是否为给定最小长度的英文字母 、数字和下划线
@param <T> 字符串类型
@param value 值
@param min 最小长度,负数自动识别为0
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证是否为给定最小长度的英文字母",
"、数字和下划线"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L423-L425 | train | Validate a string of characters in general. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
9398,
3686,
6914,
21673,
1006,
1056,
3643,
1010,
20014,
8117,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2709,
9398,
3686,
6914,
2167... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Entity.java | Entity.filter | public Entity filter(String... keys) {
final Entity result = new Entity(this.tableName);
result.setFieldNames(this.fieldNames);
for (String key : keys) {
if(this.containsKey(key)) {
result.put(key, this.get(key));
}
}
return result;
} | java | public Entity filter(String... keys) {
final Entity result = new Entity(this.tableName);
result.setFieldNames(this.fieldNames);
for (String key : keys) {
if(this.containsKey(key)) {
result.put(key, this.get(key));
}
}
return result;
} | [
"public",
"Entity",
"filter",
"(",
"String",
"...",
"keys",
")",
"{",
"final",
"Entity",
"result",
"=",
"new",
"Entity",
"(",
"this",
".",
"tableName",
")",
";",
"result",
".",
"setFieldNames",
"(",
"this",
".",
"fieldNames",
")",
";",
"for",
"(",
"Str... | 过滤Map保留指定键值对,如果键不存在跳过
@param keys 键列表
@return Dict 结果
@since 4.0.10 | [
"过滤Map保留指定键值对,如果键不存在跳过"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Entity.java#L227-L237 | train | Returns a new entity with the specified keys filtered. | [
30522,
2270,
9178,
11307,
1006,
5164,
1012,
1012,
1012,
6309,
1007,
1063,
2345,
9178,
2765,
1027,
2047,
9178,
1006,
2023,
1012,
2795,
18442,
1007,
1025,
2765,
1012,
2275,
3790,
18442,
2015,
1006,
2023,
1012,
2492,
18442,
2015,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpRequest.java | HttpRequest.cookie | public HttpRequest cookie(HttpCookie... cookies) {
if (ArrayUtil.isEmpty(cookies)) {
return disableCookie();
}
return cookie(ArrayUtil.join(cookies, ";"));
} | java | public HttpRequest cookie(HttpCookie... cookies) {
if (ArrayUtil.isEmpty(cookies)) {
return disableCookie();
}
return cookie(ArrayUtil.join(cookies, ";"));
} | [
"public",
"HttpRequest",
"cookie",
"(",
"HttpCookie",
"...",
"cookies",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"cookies",
")",
")",
"{",
"return",
"disableCookie",
"(",
")",
";",
"}",
"return",
"cookie",
"(",
"ArrayUtil",
".",
"join",
"("... | 设置Cookie<br>
自定义Cookie后会覆盖Hutool的默认Cookie行为
@param cookies Cookie值数组,如果为{@code null}则设置无效,使用默认Cookie行为
@return this
@since 3.1.1 | [
"设置Cookie<br",
">",
"自定义Cookie后会覆盖Hutool的默认Cookie行为"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpRequest.java#L368-L373 | train | Adds a cookie to the request. | [
30522,
2270,
8299,
2890,
15500,
17387,
1006,
8299,
3597,
23212,
2063,
1012,
1012,
1012,
16324,
1007,
1063,
2065,
1006,
9140,
21823,
2140,
1012,
2003,
6633,
13876,
2100,
1006,
16324,
1007,
1007,
1063,
2709,
4487,
19150,
3597,
23212,
2063,
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/metrics/groups/TaskIOMetricGroup.java | TaskIOMetricGroup.initializeBufferMetrics | public void initializeBufferMetrics(Task task) {
final MetricGroup buffers = addGroup("buffers");
buffers.gauge("inputQueueLength", new InputBuffersGauge(task));
buffers.gauge("outputQueueLength", new OutputBuffersGauge(task));
buffers.gauge("inPoolUsage", new InputBufferPoolUsageGauge(task));
buffers.gauge("outPoolUsage", new OutputBufferPoolUsageGauge(task));
} | java | public void initializeBufferMetrics(Task task) {
final MetricGroup buffers = addGroup("buffers");
buffers.gauge("inputQueueLength", new InputBuffersGauge(task));
buffers.gauge("outputQueueLength", new OutputBuffersGauge(task));
buffers.gauge("inPoolUsage", new InputBufferPoolUsageGauge(task));
buffers.gauge("outPoolUsage", new OutputBufferPoolUsageGauge(task));
} | [
"public",
"void",
"initializeBufferMetrics",
"(",
"Task",
"task",
")",
"{",
"final",
"MetricGroup",
"buffers",
"=",
"addGroup",
"(",
"\"buffers\"",
")",
";",
"buffers",
".",
"gauge",
"(",
"\"inputQueueLength\"",
",",
"new",
"InputBuffersGauge",
"(",
"task",
")",... | Initialize Buffer Metrics for a task. | [
"Initialize",
"Buffer",
"Metrics",
"for",
"a",
"task",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/TaskIOMetricGroup.java#L106-L112 | train | Initialize the buffer metrics for the given task. | [
30522,
2270,
11675,
3988,
4697,
8569,
12494,
12589,
2015,
1006,
4708,
4708,
1007,
1063,
2345,
12046,
17058,
17698,
2015,
1027,
5587,
17058,
1006,
1000,
17698,
2015,
1000,
1007,
1025,
17698,
2015,
1012,
7633,
1006,
1000,
7953,
4226,
16284,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java | Matrix.constructWithCopy | public static Matrix constructWithCopy(double[][] A)
{
int m = A.length;
int n = A[0].length;
Matrix X = new Matrix(m, n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++)
{
if (A[i].length != n)
{
throw new IllegalArgumentException
("All rows must have the same length.");
}
for (int j = 0; j < n; j++)
{
C[i][j] = A[i][j];
}
}
return X;
} | java | public static Matrix constructWithCopy(double[][] A)
{
int m = A.length;
int n = A[0].length;
Matrix X = new Matrix(m, n);
double[][] C = X.getArray();
for (int i = 0; i < m; i++)
{
if (A[i].length != n)
{
throw new IllegalArgumentException
("All rows must have the same length.");
}
for (int j = 0; j < n; j++)
{
C[i][j] = A[i][j];
}
}
return X;
} | [
"public",
"static",
"Matrix",
"constructWithCopy",
"(",
"double",
"[",
"]",
"[",
"]",
"A",
")",
"{",
"int",
"m",
"=",
"A",
".",
"length",
";",
"int",
"n",
"=",
"A",
"[",
"0",
"]",
".",
"length",
";",
"Matrix",
"X",
"=",
"new",
"Matrix",
"(",
"m... | Construct a matrix from a copy of a 2-D array.
@param A Two-dimensional array of doubles.
@throws IllegalArgumentException All rows must have the same length | [
"Construct",
"a",
"matrix",
"from",
"a",
"copy",
"of",
"a",
"2",
"-",
"D",
"array",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L199-L218 | train | Construct a copy of A | [
30522,
2270,
10763,
8185,
9570,
24415,
3597,
7685,
1006,
3313,
1031,
1033,
1031,
1033,
1037,
1007,
1063,
20014,
1049,
1027,
1037,
1012,
3091,
1025,
20014,
1050,
1027,
1037,
1031,
1014,
1033,
1012,
3091,
1025,
8185,
1060,
1027,
2047,
8185,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashPartition.java | BinaryHashPartition.getNumOccupiedMemorySegments | int getNumOccupiedMemorySegments() {
// either the number of memory segments, or one for spilling
final int numPartitionBuffers = this.partitionBuffers != null ?
this.partitionBuffers.length
: this.buildSideWriteBuffer.getNumOccupiedMemorySegments();
return numPartitionBuffers + bucketArea.buckets.length + bucketArea.numOverflowSegments;
} | java | int getNumOccupiedMemorySegments() {
// either the number of memory segments, or one for spilling
final int numPartitionBuffers = this.partitionBuffers != null ?
this.partitionBuffers.length
: this.buildSideWriteBuffer.getNumOccupiedMemorySegments();
return numPartitionBuffers + bucketArea.buckets.length + bucketArea.numOverflowSegments;
} | [
"int",
"getNumOccupiedMemorySegments",
"(",
")",
"{",
"// either the number of memory segments, or one for spilling",
"final",
"int",
"numPartitionBuffers",
"=",
"this",
".",
"partitionBuffers",
"!=",
"null",
"?",
"this",
".",
"partitionBuffers",
".",
"length",
":",
"this... | Gets the number of memory segments used by this partition, which includes build side
memory buffers and overflow memory segments.
@return The number of occupied memory segments. | [
"Gets",
"the",
"number",
"of",
"memory",
"segments",
"used",
"by",
"this",
"partition",
"which",
"includes",
"build",
"side",
"memory",
"buffers",
"and",
"overflow",
"memory",
"segments",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashPartition.java#L183-L189 | train | Returns the number of memory segments occupied by this buffer. | [
30522,
20014,
2131,
19172,
10085,
15569,
6340,
4168,
5302,
24769,
13910,
8163,
1006,
1007,
1063,
1013,
1013,
2593,
1996,
2193,
1997,
3638,
9214,
1010,
2030,
2028,
2005,
18054,
2345,
20014,
16371,
8737,
8445,
22753,
8569,
12494,
2015,
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... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java | OpenSslSessionStats.ticketKeyRenew | public long ticketKeyRenew() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionTicketKeyRenew(context.ctx);
} finally {
readerLock.unlock();
}
} | java | public long ticketKeyRenew() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionTicketKeyRenew(context.ctx);
} finally {
readerLock.unlock();
}
} | [
"public",
"long",
"ticketKeyRenew",
"(",
")",
"{",
"Lock",
"readerLock",
"=",
"context",
".",
"ctxLock",
".",
"readLock",
"(",
")",
";",
"readerLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"SSLContext",
".",
"sessionTicketKeyRenew",
"(",
"conte... | Returns the number of times a client presented a ticket derived from an older key,
and we upgraded to the primary key. | [
"Returns",
"the",
"number",
"of",
"times",
"a",
"client",
"presented",
"a",
"ticket",
"derived",
"from",
"an",
"older",
"key",
"and",
"we",
"upgraded",
"to",
"the",
"primary",
"key",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java#L231-L239 | train | Gets ticket key renew. | [
30522,
2270,
2146,
7281,
14839,
7389,
7974,
1006,
1007,
1063,
5843,
8068,
7878,
1027,
6123,
1012,
14931,
2595,
7878,
1012,
3191,
7878,
1006,
1007,
1025,
8068,
7878,
1012,
5843,
1006,
1007,
1025,
3046,
1063,
2709,
7020,
22499,
10111,
18413,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.reloadExistingConfigurations | public static synchronized void reloadExistingConfigurations() {
if (LOG.isDebugEnabled()) {
LOG.debug("Reloading " + REGISTRY.keySet().size()
+ " existing configurations");
}
for (Configuration conf : REGISTRY.keySet()) {
conf.reloadConfiguration();
}
} | java | public static synchronized void reloadExistingConfigurations() {
if (LOG.isDebugEnabled()) {
LOG.debug("Reloading " + REGISTRY.keySet().size()
+ " existing configurations");
}
for (Configuration conf : REGISTRY.keySet()) {
conf.reloadConfiguration();
}
} | [
"public",
"static",
"synchronized",
"void",
"reloadExistingConfigurations",
"(",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Reloading \"",
"+",
"REGISTRY",
".",
"keySet",
"(",
")",
".",
"size",
"(",
... | Reload existing configuration instances. | [
"Reload",
"existing",
"configuration",
"instances",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L730-L738 | train | Reload existing configurations. | [
30522,
2270,
10763,
25549,
11675,
2128,
11066,
10288,
2923,
2075,
8663,
8873,
27390,
10708,
1006,
1007,
1063,
2065,
1006,
8833,
1012,
2003,
3207,
8569,
6914,
3085,
2094,
1006,
1007,
1007,
1063,
8833,
1012,
2139,
8569,
2290,
1006,
1000,
2128... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java | CharArrayBuffer.subSequence | @Override
public CharSequence subSequence(final int beginIndex, final int endIndex) {
if (beginIndex < 0) {
throw new IndexOutOfBoundsException("Negative beginIndex: " + beginIndex);
}
if (endIndex > this.len) {
throw new IndexOutOfBoundsException("endIndex: " + endIndex + " > length: " + this.len);
}
if (beginIndex > endIndex) {
throw new IndexOutOfBoundsException("beginIndex: " + beginIndex + " > endIndex: " + endIndex);
}
return CharBuffer.wrap(this.array, beginIndex, endIndex);
} | java | @Override
public CharSequence subSequence(final int beginIndex, final int endIndex) {
if (beginIndex < 0) {
throw new IndexOutOfBoundsException("Negative beginIndex: " + beginIndex);
}
if (endIndex > this.len) {
throw new IndexOutOfBoundsException("endIndex: " + endIndex + " > length: " + this.len);
}
if (beginIndex > endIndex) {
throw new IndexOutOfBoundsException("beginIndex: " + beginIndex + " > endIndex: " + endIndex);
}
return CharBuffer.wrap(this.array, beginIndex, endIndex);
} | [
"@",
"Override",
"public",
"CharSequence",
"subSequence",
"(",
"final",
"int",
"beginIndex",
",",
"final",
"int",
"endIndex",
")",
"{",
"if",
"(",
"beginIndex",
"<",
"0",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Negative beginIndex: \"",
"+... | {@inheritDoc}
@since 4.4 | [
"{"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java#L477-L489 | train | Method to create a CharSequence from this sequence. | [
30522,
1030,
2058,
15637,
2270,
25869,
3366,
4226,
5897,
4942,
3366,
4226,
5897,
1006,
2345,
20014,
4088,
22254,
10288,
1010,
2345,
20014,
2203,
22254,
10288,
1007,
1063,
2065,
1006,
4088,
22254,
10288,
1026,
1014,
1007,
1063,
5466,
2047,
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-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java | BinaryString.concatWs | public static BinaryString concatWs(BinaryString separator, Iterable<BinaryString> inputs) {
if (null == separator || EMPTY_UTF8.equals(separator)) {
return concat(inputs);
}
separator.ensureMaterialized();
int numInputBytes = 0; // total number of bytes from the inputs
int numInputs = 0; // number of non-null inputs
for (BinaryString input : inputs) {
if (input != null) {
input.ensureMaterialized();
numInputBytes += input.sizeInBytes;
numInputs++;
}
}
if (numInputs == 0) {
// Return an empty string if there is no input, or all the inputs are null.
return EMPTY_UTF8;
}
// Allocate a new byte array, and copy the inputs one by one into it.
// The size of the new array is the size of all inputs, plus the separators.
final byte[] result = new byte[numInputBytes + (numInputs - 1) * separator.sizeInBytes];
int offset = 0;
int j = 0;
for (BinaryString input : inputs) {
if (input != null) {
int len = input.sizeInBytes;
SegmentsUtil.copyToBytes(input.segments, input.offset, result, offset, len);
offset += len;
j++;
// Add separator if this is not the last input.
if (j < numInputs) {
SegmentsUtil.copyToBytes(separator.segments, separator.offset, result, offset, separator.sizeInBytes);
offset += separator.sizeInBytes;
}
}
}
return fromBytes(result);
} | java | public static BinaryString concatWs(BinaryString separator, Iterable<BinaryString> inputs) {
if (null == separator || EMPTY_UTF8.equals(separator)) {
return concat(inputs);
}
separator.ensureMaterialized();
int numInputBytes = 0; // total number of bytes from the inputs
int numInputs = 0; // number of non-null inputs
for (BinaryString input : inputs) {
if (input != null) {
input.ensureMaterialized();
numInputBytes += input.sizeInBytes;
numInputs++;
}
}
if (numInputs == 0) {
// Return an empty string if there is no input, or all the inputs are null.
return EMPTY_UTF8;
}
// Allocate a new byte array, and copy the inputs one by one into it.
// The size of the new array is the size of all inputs, plus the separators.
final byte[] result = new byte[numInputBytes + (numInputs - 1) * separator.sizeInBytes];
int offset = 0;
int j = 0;
for (BinaryString input : inputs) {
if (input != null) {
int len = input.sizeInBytes;
SegmentsUtil.copyToBytes(input.segments, input.offset, result, offset, len);
offset += len;
j++;
// Add separator if this is not the last input.
if (j < numInputs) {
SegmentsUtil.copyToBytes(separator.segments, separator.offset, result, offset, separator.sizeInBytes);
offset += separator.sizeInBytes;
}
}
}
return fromBytes(result);
} | [
"public",
"static",
"BinaryString",
"concatWs",
"(",
"BinaryString",
"separator",
",",
"Iterable",
"<",
"BinaryString",
">",
"inputs",
")",
"{",
"if",
"(",
"null",
"==",
"separator",
"||",
"EMPTY_UTF8",
".",
"equals",
"(",
"separator",
")",
")",
"{",
"return... | Concatenates input strings together into a single string using the separator.
A null input is skipped. For example, concat(",", "a", null, "c") would yield "a,c". | [
"Concatenates",
"input",
"strings",
"together",
"into",
"a",
"single",
"string",
"using",
"the",
"separator",
".",
"A",
"null",
"input",
"is",
"skipped",
".",
"For",
"example",
"concat",
"(",
"a",
"null",
"c",
")",
"would",
"yield",
"a",
"c",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L502-L544 | train | Concatenates the given sequence of strings using the given separator. | [
30522,
2270,
10763,
12441,
3367,
4892,
9530,
11266,
9333,
1006,
12441,
3367,
4892,
19802,
25879,
2953,
1010,
2009,
6906,
3468,
1026,
12441,
3367,
4892,
1028,
20407,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
19802,
25879,
2953,
1064,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.apply | public <R> SingleOutputStreamOperator<R> apply(AllWindowFunction<T, R, W> function) {
String callLocation = Utils.getCallLocationName();
function = input.getExecutionEnvironment().clean(function);
TypeInformation<R> resultType = getAllWindowFunctionReturnType(function, getInputType());
return apply(new InternalIterableAllWindowFunction<>(function), resultType, callLocation);
} | java | public <R> SingleOutputStreamOperator<R> apply(AllWindowFunction<T, R, W> function) {
String callLocation = Utils.getCallLocationName();
function = input.getExecutionEnvironment().clean(function);
TypeInformation<R> resultType = getAllWindowFunctionReturnType(function, getInputType());
return apply(new InternalIterableAllWindowFunction<>(function), resultType, callLocation);
} | [
"public",
"<",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"apply",
"(",
"AllWindowFunction",
"<",
"T",
",",
"R",
",",
"W",
">",
"function",
")",
"{",
"String",
"callLocation",
"=",
"Utils",
".",
"getCallLocationName",
"(",
")",
";",
"function",... | Applies the given window function to each window. The window function is called for each
evaluation of the window. The output of the window function is
interpreted as a regular non-windowed stream.
<p>Note that this function requires that all data in the windows is buffered until the window
is evaluated, as the function provides no means of incremental aggregation.
@param function The window function.
@return The data stream that is the result of applying the window function to the window. | [
"Applies",
"the",
"given",
"window",
"function",
"to",
"each",
"window",
".",
"The",
"window",
"function",
"is",
"called",
"for",
"each",
"evaluation",
"of",
"the",
"window",
".",
"The",
"output",
"of",
"the",
"window",
"function",
"is",
"interpreted",
"as",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java#L1055-L1060 | train | Apply a window function to this stream. | [
30522,
2270,
1026,
1054,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
6611,
1006,
2035,
11101,
5004,
11263,
27989,
1026,
1056,
1010,
1054,
1010,
1059,
1028,
3853,
1007,
1063,
5164,
2655,
4135,
10719,
1027,
21183,
12146,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java | ThreadUtil.newExecutorByBlockingCoefficient | public static ThreadPoolExecutor newExecutorByBlockingCoefficient(float blockingCoefficient) {
if (blockingCoefficient >= 1 || blockingCoefficient < 0) {
throw new IllegalArgumentException("[blockingCoefficient] must between 0 and 1, or equals 0.");
}
// 最佳的线程数 = CPU可用核心数 / (1 - 阻塞系数)
int poolSize = (int) (Runtime.getRuntime().availableProcessors() / (1 - blockingCoefficient));
return ExecutorBuilder.create().setCorePoolSize(poolSize).setMaxPoolSize(poolSize).setKeepAliveTime(0L).build();
} | java | public static ThreadPoolExecutor newExecutorByBlockingCoefficient(float blockingCoefficient) {
if (blockingCoefficient >= 1 || blockingCoefficient < 0) {
throw new IllegalArgumentException("[blockingCoefficient] must between 0 and 1, or equals 0.");
}
// 最佳的线程数 = CPU可用核心数 / (1 - 阻塞系数)
int poolSize = (int) (Runtime.getRuntime().availableProcessors() / (1 - blockingCoefficient));
return ExecutorBuilder.create().setCorePoolSize(poolSize).setMaxPoolSize(poolSize).setKeepAliveTime(0L).build();
} | [
"public",
"static",
"ThreadPoolExecutor",
"newExecutorByBlockingCoefficient",
"(",
"float",
"blockingCoefficient",
")",
"{",
"if",
"(",
"blockingCoefficient",
">=",
"1",
"||",
"blockingCoefficient",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
... | 获得一个新的线程池<br>
传入阻塞系数,线程池的大小计算公式为:CPU可用核心数 / (1 - 阻塞因子)<br>
Blocking Coefficient(阻塞系数) = 阻塞时间/(阻塞时间+使用CPU的时间)<br>
计算密集型任务的阻塞系数为0,而IO密集型任务的阻塞系数则接近于1。
see: http://blog.csdn.net/partner4java/article/details/9417663
@param blockingCoefficient 阻塞系数,阻塞因子介于0~1之间的数,阻塞因子越大,线程池中的线程数越多。
@return {@link ThreadPoolExecutor}
@since 3.0.6 | [
"获得一个新的线程池<br",
">",
"传入阻塞系数,线程池的大小计算公式为:CPU可用核心数",
"/",
"(",
"1",
"-",
"阻塞因子",
")",
"<br",
">",
"Blocking",
"Coefficient",
"(",
"阻塞系数",
")",
"=",
"阻塞时间/(阻塞时间",
"+",
"使用CPU的时间)<br",
">",
"计算密集型任务的阻塞系数为0,而IO密集型任务的阻塞系数则接近于1。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java#L75-L83 | train | Creates a new ThreadPoolExecutor with the specified blocking coefficient. | [
30522,
2270,
10763,
11689,
16869,
10288,
8586,
16161,
2099,
2047,
10288,
8586,
16161,
15185,
2100,
23467,
2075,
16288,
26989,
23402,
3372,
1006,
14257,
10851,
16288,
26989,
23402,
3372,
1007,
1063,
2065,
1006,
10851,
16288,
26989,
23402,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.newHashSet | @SafeVarargs
public static <T> HashSet<T> newHashSet(boolean isSorted, T... ts) {
if (null == ts) {
return isSorted ? new LinkedHashSet<T>() : new HashSet<T>();
}
int initialCapacity = Math.max((int) (ts.length / .75f) + 1, 16);
HashSet<T> set = isSorted ? new LinkedHashSet<T>(initialCapacity) : new HashSet<T>(initialCapacity);
for (T t : ts) {
set.add(t);
}
return set;
} | java | @SafeVarargs
public static <T> HashSet<T> newHashSet(boolean isSorted, T... ts) {
if (null == ts) {
return isSorted ? new LinkedHashSet<T>() : new HashSet<T>();
}
int initialCapacity = Math.max((int) (ts.length / .75f) + 1, 16);
HashSet<T> set = isSorted ? new LinkedHashSet<T>(initialCapacity) : new HashSet<T>(initialCapacity);
for (T t : ts) {
set.add(t);
}
return set;
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"HashSet",
"<",
"T",
">",
"newHashSet",
"(",
"boolean",
"isSorted",
",",
"T",
"...",
"ts",
")",
"{",
"if",
"(",
"null",
"==",
"ts",
")",
"{",
"return",
"isSorted",
"?",
"new",
"LinkedHashSet",
"<... | 新建一个HashSet
@param <T> 集合元素类型
@param isSorted 是否有序,有序返回 {@link LinkedHashSet},否则返回 {@link HashSet}
@param ts 元素数组
@return HashSet对象 | [
"新建一个HashSet"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L427-L438 | train | Creates a set of objects that are contained in the specified array of objects. | [
30522,
1030,
3647,
24516,
10623,
2015,
2270,
10763,
1026,
1056,
30524,
14949,
7898,
3388,
1026,
1056,
1028,
1006,
1007,
1024,
2047,
23325,
13462,
1026,
1056,
1028,
1006,
1007,
1025,
1065,
20014,
3988,
17695,
6305,
3012,
1027,
8785,
1012,
40... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.isMultipart | public static boolean isMultipart(HttpServletRequest request) {
if (false == isPostMethod(request)) {
return false;
}
String contentType = request.getContentType();
if (StrUtil.isBlank(contentType)) {
return false;
}
if (contentType.toLowerCase().startsWith("multipart/")) {
return true;
}
return false;
} | java | public static boolean isMultipart(HttpServletRequest request) {
if (false == isPostMethod(request)) {
return false;
}
String contentType = request.getContentType();
if (StrUtil.isBlank(contentType)) {
return false;
}
if (contentType.toLowerCase().startsWith("multipart/")) {
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isMultipart",
"(",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"false",
"==",
"isPostMethod",
"(",
"request",
")",
")",
"{",
"return",
"false",
";",
"}",
"String",
"contentType",
"=",
"request",
".",
"getContentType",
... | 是否为Multipart类型表单,此类型表单用于文件上传
@param request 请求对象{@link HttpServletRequest}
@return 是否为Multipart类型表单,此类型表单用于文件上传 | [
"是否为Multipart类型表单,此类型表单用于文件上传"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L353-L367 | train | Checks if the request is a multipart request. | [
30522,
2270,
10763,
22017,
20898,
2003,
12274,
7096,
11514,
8445,
1006,
16770,
2121,
2615,
7485,
2890,
15500,
5227,
1007,
1063,
2065,
1006,
6270,
1027,
1027,
2003,
19894,
11368,
6806,
2094,
1006,
5227,
1007,
1007,
1063,
2709,
6270,
1025,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFiles.java | ClassLoaderFiles.addAll | public void addAll(ClassLoaderFiles files) {
Assert.notNull(files, "Files must not be null");
for (SourceFolder folder : files.getSourceFolders()) {
for (Map.Entry<String, ClassLoaderFile> entry : folder.getFilesEntrySet()) {
addFile(folder.getName(), entry.getKey(), entry.getValue());
}
}
} | java | public void addAll(ClassLoaderFiles files) {
Assert.notNull(files, "Files must not be null");
for (SourceFolder folder : files.getSourceFolders()) {
for (Map.Entry<String, ClassLoaderFile> entry : folder.getFilesEntrySet()) {
addFile(folder.getName(), entry.getKey(), entry.getValue());
}
}
} | [
"public",
"void",
"addAll",
"(",
"ClassLoaderFiles",
"files",
")",
"{",
"Assert",
".",
"notNull",
"(",
"files",
",",
"\"Files must not be null\"",
")",
";",
"for",
"(",
"SourceFolder",
"folder",
":",
"files",
".",
"getSourceFolders",
"(",
")",
")",
"{",
"for... | Add all elements items from the specified {@link ClassLoaderFiles} to this
instance.
@param files the files to add | [
"Add",
"all",
"elements",
"items",
"from",
"the",
"specified",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFiles.java#L67-L74 | train | Adds all the class loader files to this class loader. | [
30522,
2270,
11675,
5587,
8095,
1006,
2465,
11066,
2121,
8873,
4244,
6764,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
6764,
1010,
1000,
6764,
2442,
2025,
2022,
19701,
30524,
2121,
19622,
1024,
6764,
1012,
4152,
8162,
3401,
10371,
254... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/rest/CommonRest.java | CommonRest.etl | @PostMapping("/etl/{type}/{task}")
public EtlResult etl(@PathVariable String type, @PathVariable String task,
@RequestParam(name = "params", required = false) String params) {
return etl(type, null, task, params);
} | java | @PostMapping("/etl/{type}/{task}")
public EtlResult etl(@PathVariable String type, @PathVariable String task,
@RequestParam(name = "params", required = false) String params) {
return etl(type, null, task, params);
} | [
"@",
"PostMapping",
"(",
"\"/etl/{type}/{task}\"",
")",
"public",
"EtlResult",
"etl",
"(",
"@",
"PathVariable",
"String",
"type",
",",
"@",
"PathVariable",
"String",
"task",
",",
"@",
"RequestParam",
"(",
"name",
"=",
"\"params\"",
",",
"required",
"=",
"false... | ETL curl http://127.0.0.1:8081/etl/hbase/mytest_person2.yml -X POST
@param type 类型 hbase, es
@param task 任务名对应配置文件名 mytest_person2.yml
@param params etl where条件参数, 为空全部导入 | [
"ETL",
"curl",
"http",
":",
"//",
"127",
".",
"0",
".",
"0",
".",
"1",
":",
"8081",
"/",
"etl",
"/",
"hbase",
"/",
"mytest_person2",
".",
"yml",
"-",
"X",
"POST"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/rest/CommonRest.java#L120-L124 | train | A REST call to retrieve a CID . | [
30522,
1030,
2695,
2863,
14853,
1006,
1000,
1013,
3802,
2140,
30524,
1000,
11498,
5244,
1000,
1010,
3223,
1027,
6270,
1007,
5164,
11498,
5244,
1007,
1063,
2709,
3802,
2140,
1006,
2828,
1010,
19701,
1010,
4708,
1010,
11498,
5244,
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... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/DataSinkNode.java | DataSinkNode.getAlternativePlans | @Override
public List<PlanNode> getAlternativePlans(CostEstimator estimator) {
// check if we have a cached version
if (this.cachedPlans != null) {
return this.cachedPlans;
}
// calculate alternative sub-plans for predecessor
List<? extends PlanNode> subPlans = getPredecessorNode().getAlternativePlans(estimator);
List<PlanNode> outputPlans = new ArrayList<PlanNode>();
final int parallelism = getParallelism();
final int inDop = getPredecessorNode().getParallelism();
final ExecutionMode executionMode = this.input.getDataExchangeMode();
final boolean dopChange = parallelism != inDop;
final boolean breakPipeline = this.input.isBreakingPipeline();
InterestingProperties ips = this.input.getInterestingProperties();
for (PlanNode p : subPlans) {
for (RequestedGlobalProperties gp : ips.getGlobalProperties()) {
for (RequestedLocalProperties lp : ips.getLocalProperties()) {
Channel c = new Channel(p);
gp.parameterizeChannel(c, dopChange, executionMode, breakPipeline);
lp.parameterizeChannel(c);
c.setRequiredLocalProps(lp);
c.setRequiredGlobalProps(gp);
// no need to check whether the created properties meet what we need in case
// of ordering or global ordering, because the only interesting properties we have
// are what we require
outputPlans.add(new SinkPlanNode(this, "DataSink ("+this.getOperator().getName()+")" ,c));
}
}
}
// cost and prune the plans
for (PlanNode node : outputPlans) {
estimator.costOperator(node);
}
prunePlanAlternatives(outputPlans);
this.cachedPlans = outputPlans;
return outputPlans;
} | java | @Override
public List<PlanNode> getAlternativePlans(CostEstimator estimator) {
// check if we have a cached version
if (this.cachedPlans != null) {
return this.cachedPlans;
}
// calculate alternative sub-plans for predecessor
List<? extends PlanNode> subPlans = getPredecessorNode().getAlternativePlans(estimator);
List<PlanNode> outputPlans = new ArrayList<PlanNode>();
final int parallelism = getParallelism();
final int inDop = getPredecessorNode().getParallelism();
final ExecutionMode executionMode = this.input.getDataExchangeMode();
final boolean dopChange = parallelism != inDop;
final boolean breakPipeline = this.input.isBreakingPipeline();
InterestingProperties ips = this.input.getInterestingProperties();
for (PlanNode p : subPlans) {
for (RequestedGlobalProperties gp : ips.getGlobalProperties()) {
for (RequestedLocalProperties lp : ips.getLocalProperties()) {
Channel c = new Channel(p);
gp.parameterizeChannel(c, dopChange, executionMode, breakPipeline);
lp.parameterizeChannel(c);
c.setRequiredLocalProps(lp);
c.setRequiredGlobalProps(gp);
// no need to check whether the created properties meet what we need in case
// of ordering or global ordering, because the only interesting properties we have
// are what we require
outputPlans.add(new SinkPlanNode(this, "DataSink ("+this.getOperator().getName()+")" ,c));
}
}
}
// cost and prune the plans
for (PlanNode node : outputPlans) {
estimator.costOperator(node);
}
prunePlanAlternatives(outputPlans);
this.cachedPlans = outputPlans;
return outputPlans;
} | [
"@",
"Override",
"public",
"List",
"<",
"PlanNode",
">",
"getAlternativePlans",
"(",
"CostEstimator",
"estimator",
")",
"{",
"// check if we have a cached version",
"if",
"(",
"this",
".",
"cachedPlans",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"cachedPlans"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/DataSinkNode.java#L185-L229 | train | Get the alternative plans for this operator. | [
30522,
1030,
2058,
15637,
2270,
2862,
1026,
2933,
3630,
3207,
1028,
2131,
2389,
16451,
8082,
24759,
6962,
1006,
3465,
4355,
9581,
4263,
9765,
9581,
4263,
1007,
1063,
1013,
1013,
4638,
2065,
2057,
2031,
1037,
17053,
2094,
2544,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.offsetMinute | public static DateTime offsetMinute(Date date, int offset) {
return offset(date, DateField.MINUTE, offset);
} | java | public static DateTime offsetMinute(Date date, int offset) {
return offset(date, DateField.MINUTE, offset);
} | [
"public",
"static",
"DateTime",
"offsetMinute",
"(",
"Date",
"date",
",",
"int",
"offset",
")",
"{",
"return",
"offset",
"(",
"date",
",",
"DateField",
".",
"MINUTE",
",",
"offset",
")",
";",
"}"
] | 偏移分钟
@param date 日期
@param offset 偏移分钟数,正数向未来偏移,负数向历史偏移
@return 偏移后的日期 | [
"偏移分钟"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1142-L1144 | train | Create an offset from a date and time fields. | [
30522,
2270,
10763,
3058,
7292,
16396,
10020,
10421,
1006,
3058,
3058,
1010,
20014,
16396,
1007,
1063,
2709,
16396,
1006,
3058,
1010,
3058,
3790,
1012,
3371,
1010,
16396,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.fromParallelCollection | public <OUT> DataStreamSource<OUT> fromParallelCollection(SplittableIterator<OUT> iterator, TypeInformation<OUT>
typeInfo) {
return fromParallelCollection(iterator, typeInfo, "Parallel Collection Source");
} | java | public <OUT> DataStreamSource<OUT> fromParallelCollection(SplittableIterator<OUT> iterator, TypeInformation<OUT>
typeInfo) {
return fromParallelCollection(iterator, typeInfo, "Parallel Collection Source");
} | [
"public",
"<",
"OUT",
">",
"DataStreamSource",
"<",
"OUT",
">",
"fromParallelCollection",
"(",
"SplittableIterator",
"<",
"OUT",
">",
"iterator",
",",
"TypeInformation",
"<",
"OUT",
">",
"typeInfo",
")",
"{",
"return",
"fromParallelCollection",
"(",
"iterator",
... | Creates a new data stream that contains elements in the iterator. The iterator is splittable,
allowing the framework to create a parallel data stream source that returns the elements in
the iterator.
<p>Because the iterator will remain unmodified until the actual execution happens, the type
of data returned by the iterator must be given explicitly in the form of the type
information. This method is useful for cases where the type is generic. In that case, the
type class (as given in
{@link #fromParallelCollection(org.apache.flink.util.SplittableIterator, Class)} does not
supply all type information.
@param iterator
The iterator that produces the elements of the data stream
@param typeInfo
The TypeInformation for the produced data stream.
@param <OUT>
The type of the returned data stream
@return A data stream representing the elements in the iterator | [
"Creates",
"a",
"new",
"data",
"stream",
"that",
"contains",
"elements",
"in",
"the",
"iterator",
".",
"The",
"iterator",
"is",
"splittable",
"allowing",
"the",
"framework",
"to",
"create",
"a",
"parallel",
"data",
"stream",
"source",
"that",
"returns",
"the",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L912-L915 | train | Creates a data stream source from a parallel collection. | [
30522,
2270,
1026,
2041,
1028,
2951,
21422,
6499,
3126,
3401,
1026,
2041,
1028,
2013,
28689,
6216,
22499,
6216,
7542,
1006,
3975,
10880,
21646,
8844,
1026,
2041,
1028,
2009,
6906,
4263,
1010,
2828,
2378,
14192,
3370,
1026,
2041,
1028,
2828,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java | JarWriter.writeLoaderClasses | @Override
public void writeLoaderClasses(String loaderJarResourceName) throws IOException {
URL loaderJar = getClass().getClassLoader().getResource(loaderJarResourceName);
try (JarInputStream inputStream = new JarInputStream(
new BufferedInputStream(loaderJar.openStream()))) {
JarEntry entry;
while ((entry = inputStream.getNextJarEntry()) != null) {
if (entry.getName().endsWith(".class")) {
writeEntry(new JarArchiveEntry(entry),
new InputStreamEntryWriter(inputStream, false));
}
}
}
} | java | @Override
public void writeLoaderClasses(String loaderJarResourceName) throws IOException {
URL loaderJar = getClass().getClassLoader().getResource(loaderJarResourceName);
try (JarInputStream inputStream = new JarInputStream(
new BufferedInputStream(loaderJar.openStream()))) {
JarEntry entry;
while ((entry = inputStream.getNextJarEntry()) != null) {
if (entry.getName().endsWith(".class")) {
writeEntry(new JarArchiveEntry(entry),
new InputStreamEntryWriter(inputStream, false));
}
}
}
} | [
"@",
"Override",
"public",
"void",
"writeLoaderClasses",
"(",
"String",
"loaderJarResourceName",
")",
"throws",
"IOException",
"{",
"URL",
"loaderJar",
"=",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"getResource",
"(",
"loaderJarResourceName",
")... | Write the required spring-boot-loader classes to the JAR.
@param loaderJarResourceName the name of the resource containing the loader classes
to be written
@throws IOException if the classes cannot be written | [
"Write",
"the",
"required",
"spring",
"-",
"boot",
"-",
"loader",
"classes",
"to",
"the",
"JAR",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java#L222-L235 | train | Writes the loader classes to the output. | [
30522,
1030,
2058,
15637,
2270,
11675,
4339,
11066,
2121,
26266,
2229,
1006,
5164,
7170,
2121,
16084,
6072,
8162,
27524,
14074,
1007,
11618,
22834,
10288,
24422,
1063,
24471,
2140,
7170,
2121,
16084,
1027,
2131,
26266,
1006,
1007,
1012,
2131,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpBase.java | HttpBase.header | public T header(Header name, String value, boolean isOverride) {
return header(name.toString(), value, isOverride);
} | java | public T header(Header name, String value, boolean isOverride) {
return header(name.toString(), value, isOverride);
} | [
"public",
"T",
"header",
"(",
"Header",
"name",
",",
"String",
"value",
",",
"boolean",
"isOverride",
")",
"{",
"return",
"header",
"(",
"name",
".",
"toString",
"(",
")",
",",
"value",
",",
"isOverride",
")",
";",
"}"
] | 设置一个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#L111-L113 | train | Add a header to the response. | [
30522,
2270,
1056,
20346,
1006,
20346,
2171,
1010,
5164,
3643,
1010,
22017,
20898,
11163,
6299,
15637,
1007,
1063,
2709,
20346,
1006,
2171,
1012,
2000,
3367,
4892,
1006,
1007,
1010,
3643,
1010,
11163,
6299,
15637,
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... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java | TransportClientFactory.createUnmanagedClient | public TransportClient createUnmanagedClient(String remoteHost, int remotePort)
throws IOException, InterruptedException {
final InetSocketAddress address = new InetSocketAddress(remoteHost, remotePort);
return createClient(address);
} | java | public TransportClient createUnmanagedClient(String remoteHost, int remotePort)
throws IOException, InterruptedException {
final InetSocketAddress address = new InetSocketAddress(remoteHost, remotePort);
return createClient(address);
} | [
"public",
"TransportClient",
"createUnmanagedClient",
"(",
"String",
"remoteHost",
",",
"int",
"remotePort",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"final",
"InetSocketAddress",
"address",
"=",
"new",
"InetSocketAddress",
"(",
"remoteHost",
",",... | Create a completely new {@link TransportClient} to the given remote host / port.
This connection is not pooled.
As with {@link #createClient(String, int)}, this method is blocking. | [
"Create",
"a",
"completely",
"new",
"{",
"@link",
"TransportClient",
"}",
"to",
"the",
"given",
"remote",
"host",
"/",
"port",
".",
"This",
"connection",
"is",
"not",
"pooled",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java#L203-L207 | train | Create an uncontainer client. | [
30522,
2270,
3665,
20464,
11638,
3443,
4609,
24805,
5999,
20464,
11638,
1006,
5164,
6556,
15006,
2102,
1010,
20014,
6556,
6442,
1007,
11618,
22834,
10288,
24422,
1010,
7153,
10288,
24422,
1063,
2345,
1999,
8454,
7432,
12928,
14141,
8303,
4769... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/Img.java | Img.scale | public Img scale(int width, int height) {
final BufferedImage srcImg = getValidSrcImg();
int srcHeight = srcImg.getHeight();
int srcWidth = srcImg.getWidth();
int scaleType;
if (srcHeight == height && srcWidth == width) {
// 源与目标长宽一致返回原图
this.targetImage = srcImg;
return this;
} else if (srcHeight < height || srcWidth < width) {
// 放大图片使用平滑模式
scaleType = Image.SCALE_SMOOTH;
} else {
scaleType = Image.SCALE_DEFAULT;
}
final Image image = srcImg.getScaledInstance(width, height, scaleType);
this.targetImage = ImgUtil.toBufferedImage(image);
return this;
} | java | public Img scale(int width, int height) {
final BufferedImage srcImg = getValidSrcImg();
int srcHeight = srcImg.getHeight();
int srcWidth = srcImg.getWidth();
int scaleType;
if (srcHeight == height && srcWidth == width) {
// 源与目标长宽一致返回原图
this.targetImage = srcImg;
return this;
} else if (srcHeight < height || srcWidth < width) {
// 放大图片使用平滑模式
scaleType = Image.SCALE_SMOOTH;
} else {
scaleType = Image.SCALE_DEFAULT;
}
final Image image = srcImg.getScaledInstance(width, height, scaleType);
this.targetImage = ImgUtil.toBufferedImage(image);
return this;
} | [
"public",
"Img",
"scale",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"final",
"BufferedImage",
"srcImg",
"=",
"getValidSrcImg",
"(",
")",
";",
"int",
"srcHeight",
"=",
"srcImg",
".",
"getHeight",
"(",
")",
";",
"int",
"srcWidth",
"=",
"srcImg",... | 缩放图像(按长宽缩放)<br>
注意:目标长宽与原图不成比例会变形
@param width 目标宽度
@param height 目标高度
@return this | [
"缩放图像(按长宽缩放)<br",
">",
"注意:目标长宽与原图不成比例会变形"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L211-L229 | train | Scale the image. | [
30522,
2270,
10047,
2290,
4094,
1006,
20014,
9381,
1010,
20014,
4578,
1007,
1063,
2345,
17698,
2098,
9581,
3351,
5034,
6895,
24798,
1027,
2131,
10175,
9821,
11890,
5714,
2290,
1006,
1007,
1025,
20014,
5034,
5403,
18743,
1027,
5034,
6895,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/DataSourceTask.java | DataSourceTask.getLogString | private String getLogString(String message, String taskName) {
return BatchTask.constructLogString(message, taskName, this);
} | java | private String getLogString(String message, String taskName) {
return BatchTask.constructLogString(message, taskName, this);
} | [
"private",
"String",
"getLogString",
"(",
"String",
"message",
",",
"String",
"taskName",
")",
"{",
"return",
"BatchTask",
".",
"constructLogString",
"(",
"message",
",",
"taskName",
",",
"this",
")",
";",
"}"
] | Utility function that composes a string for logging purposes. The string includes the given message and
the index of the task in its task group together with the number of tasks in the task group.
@param message The main message for the log.
@param taskName The name of the task.
@return The string ready for logging. | [
"Utility",
"function",
"that",
"composes",
"a",
"string",
"for",
"logging",
"purposes",
".",
"The",
"string",
"includes",
"the",
"given",
"message",
"and",
"the",
"index",
"of",
"the",
"task",
"in",
"its",
"task",
"group",
"together",
"with",
"the",
"number"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/DataSourceTask.java#L339-L341 | train | Returns the log string for the given message. | [
30522,
2797,
5164,
2131,
21197,
3367,
4892,
1006,
5164,
4471,
1010,
5164,
4708,
18442,
1007,
1063,
2709,
14108,
10230,
2243,
1012,
9570,
21197,
3367,
4892,
1006,
4471,
1010,
4708,
18442,
1010,
2023,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/netty/PartitionRequestClient.java | PartitionRequestClient.requestSubpartition | public ChannelFuture requestSubpartition(
final ResultPartitionID partitionId,
final int subpartitionIndex,
final RemoteInputChannel inputChannel,
int delayMs) throws IOException {
checkNotClosed();
LOG.debug("Requesting subpartition {} of partition {} with {} ms delay.",
subpartitionIndex, partitionId, delayMs);
clientHandler.addInputChannel(inputChannel);
final PartitionRequest request = new PartitionRequest(
partitionId, subpartitionIndex, inputChannel.getInputChannelId(), inputChannel.getInitialCredit());
final ChannelFutureListener listener = new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if (!future.isSuccess()) {
clientHandler.removeInputChannel(inputChannel);
SocketAddress remoteAddr = future.channel().remoteAddress();
inputChannel.onError(
new LocalTransportException(
String.format("Sending the partition request to '%s' failed.", remoteAddr),
future.channel().localAddress(), future.cause()
));
}
}
};
if (delayMs == 0) {
ChannelFuture f = tcpChannel.writeAndFlush(request);
f.addListener(listener);
return f;
} else {
final ChannelFuture[] f = new ChannelFuture[1];
tcpChannel.eventLoop().schedule(new Runnable() {
@Override
public void run() {
f[0] = tcpChannel.writeAndFlush(request);
f[0].addListener(listener);
}
}, delayMs, TimeUnit.MILLISECONDS);
return f[0];
}
} | java | public ChannelFuture requestSubpartition(
final ResultPartitionID partitionId,
final int subpartitionIndex,
final RemoteInputChannel inputChannel,
int delayMs) throws IOException {
checkNotClosed();
LOG.debug("Requesting subpartition {} of partition {} with {} ms delay.",
subpartitionIndex, partitionId, delayMs);
clientHandler.addInputChannel(inputChannel);
final PartitionRequest request = new PartitionRequest(
partitionId, subpartitionIndex, inputChannel.getInputChannelId(), inputChannel.getInitialCredit());
final ChannelFutureListener listener = new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if (!future.isSuccess()) {
clientHandler.removeInputChannel(inputChannel);
SocketAddress remoteAddr = future.channel().remoteAddress();
inputChannel.onError(
new LocalTransportException(
String.format("Sending the partition request to '%s' failed.", remoteAddr),
future.channel().localAddress(), future.cause()
));
}
}
};
if (delayMs == 0) {
ChannelFuture f = tcpChannel.writeAndFlush(request);
f.addListener(listener);
return f;
} else {
final ChannelFuture[] f = new ChannelFuture[1];
tcpChannel.eventLoop().schedule(new Runnable() {
@Override
public void run() {
f[0] = tcpChannel.writeAndFlush(request);
f[0].addListener(listener);
}
}, delayMs, TimeUnit.MILLISECONDS);
return f[0];
}
} | [
"public",
"ChannelFuture",
"requestSubpartition",
"(",
"final",
"ResultPartitionID",
"partitionId",
",",
"final",
"int",
"subpartitionIndex",
",",
"final",
"RemoteInputChannel",
"inputChannel",
",",
"int",
"delayMs",
")",
"throws",
"IOException",
"{",
"checkNotClosed",
... | Requests a remote intermediate result partition queue.
<p>The request goes to the remote producer, for which this partition
request client instance has been created. | [
"Requests",
"a",
"remote",
"intermediate",
"result",
"partition",
"queue",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClient.java#L97-L144 | train | Request a subpartition of the specified result partition. | [
30522,
2270,
3149,
11263,
11244,
11186,
12083,
19362,
3775,
3508,
1006,
2345,
2765,
19362,
3775,
3508,
3593,
13571,
3593,
1010,
2345,
20014,
4942,
19362,
3775,
3508,
22254,
10288,
1010,
2345,
6556,
2378,
18780,
26058,
7953,
26058,
1010,
20014... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/expressions/ExpressionUtils.java | ExpressionUtils.extractValue | @SuppressWarnings("unchecked")
public static <V> Optional<V> extractValue(Expression expr, TypeInformation<V> type) {
if (expr instanceof ValueLiteralExpression) {
final ValueLiteralExpression valueLiteral = (ValueLiteralExpression) expr;
if (valueLiteral.getType().equals(type)) {
return Optional.of((V) valueLiteral.getValue());
}
}
return Optional.empty();
} | java | @SuppressWarnings("unchecked")
public static <V> Optional<V> extractValue(Expression expr, TypeInformation<V> type) {
if (expr instanceof ValueLiteralExpression) {
final ValueLiteralExpression valueLiteral = (ValueLiteralExpression) expr;
if (valueLiteral.getType().equals(type)) {
return Optional.of((V) valueLiteral.getValue());
}
}
return Optional.empty();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"V",
">",
"Optional",
"<",
"V",
">",
"extractValue",
"(",
"Expression",
"expr",
",",
"TypeInformation",
"<",
"V",
">",
"type",
")",
"{",
"if",
"(",
"expr",
"instanceof",
"ValueLit... | Extracts value of given type from expression assuming it is a {@link ValueLiteralExpression}.
@param expr literal to extract the value from
@param type expected type to extract from the literal
@param <V> type of extracted value
@return extracted value or empty if could not extract value of given type | [
"Extracts",
"value",
"of",
"given",
"type",
"from",
"expression",
"assuming",
"it",
"is",
"a",
"{",
"@link",
"ValueLiteralExpression",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/expressions/ExpressionUtils.java#L40-L49 | train | Extract value from expression. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1058,
1028,
11887,
1026,
1058,
1028,
14817,
10175,
5657,
1006,
3670,
4654,
18098,
1010,
2828,
2378,
14192,
3370,
1026,
1058,
1028,
2828,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java | RandomUtil.randomBigDecimal | public static BigDecimal randomBigDecimal(BigDecimal min, BigDecimal max) {
return NumberUtil.toBigDecimal(getRandom().nextDouble(min.doubleValue(), max.doubleValue()));
} | java | public static BigDecimal randomBigDecimal(BigDecimal min, BigDecimal max) {
return NumberUtil.toBigDecimal(getRandom().nextDouble(min.doubleValue(), max.doubleValue()));
} | [
"public",
"static",
"BigDecimal",
"randomBigDecimal",
"(",
"BigDecimal",
"min",
",",
"BigDecimal",
"max",
")",
"{",
"return",
"NumberUtil",
".",
"toBigDecimal",
"(",
"getRandom",
"(",
")",
".",
"nextDouble",
"(",
"min",
".",
"doubleValue",
"(",
")",
",",
"ma... | 获得指定范围内的随机数
@param min 最小数(包含)
@param max 最大数(不包含)
@return 随机数
@since 4.0.9 | [
"获得指定范围内的随机数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java#L239-L241 | train | Returns a random BigDecimal in the range [ min max ). | [
30522,
2270,
10763,
2502,
3207,
6895,
9067,
6721,
5638,
2290,
3207,
6895,
9067,
1006,
2502,
3207,
6895,
9067,
8117,
1010,
2502,
3207,
6895,
9067,
4098,
1007,
1063,
2709,
2193,
21823,
2140,
1012,
2000,
5638,
2290,
3207,
6895,
9067,
1006,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | Bindable.withSuppliedValue | public Bindable<T> withSuppliedValue(Supplier<T> suppliedValue) {
return new Bindable<>(this.type, this.boxedType, suppliedValue, NO_ANNOTATIONS);
} | java | public Bindable<T> withSuppliedValue(Supplier<T> suppliedValue) {
return new Bindable<>(this.type, this.boxedType, suppliedValue, NO_ANNOTATIONS);
} | [
"public",
"Bindable",
"<",
"T",
">",
"withSuppliedValue",
"(",
"Supplier",
"<",
"T",
">",
"suppliedValue",
")",
"{",
"return",
"new",
"Bindable",
"<>",
"(",
"this",
".",
"type",
",",
"this",
".",
"boxedType",
",",
"suppliedValue",
",",
"NO_ANNOTATIONS",
")... | Create an updated {@link Bindable} instance with a value supplier.
@param suppliedValue the supplier for the value
@return an updated {@link Bindable} | [
"Create",
"an",
"updated",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java#L175-L177 | train | Returns a new instance of this type with the supplied value. | [
30522,
2270,
14187,
3085,
1026,
1056,
1028,
2007,
6342,
9397,
8751,
2094,
10175,
5657,
1006,
17024,
1026,
1056,
1028,
8127,
10175,
5657,
1007,
1063,
2709,
2047,
14187,
3085,
1026,
1028,
1006,
2023,
1012,
2828,
1010,
2023,
1012,
27554,
13874... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.rotate | public static void rotate(Image image, int degree, ImageOutputStream out) throws IORuntimeException {
writeJpg(rotate(image, degree), out);
} | java | public static void rotate(Image image, int degree, ImageOutputStream out) throws IORuntimeException {
writeJpg(rotate(image, degree), out);
} | [
"public",
"static",
"void",
"rotate",
"(",
"Image",
"image",
",",
"int",
"degree",
",",
"ImageOutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"writeJpg",
"(",
"rotate",
"(",
"image",
",",
"degree",
")",
",",
"out",
")",
";",
"}"
] | 旋转图片为指定角度<br>
此方法不会关闭输出流,输出格式为JPG
@param image 目标图像
@param degree 旋转角度
@param out 输出图像流
@since 3.2.2
@throws IORuntimeException IO异常 | [
"旋转图片为指定角度<br",
">",
"此方法不会关闭输出流,输出格式为JPG"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1044-L1046 | train | Write a rotate image to an output stream. | [
30522,
2270,
10763,
11675,
24357,
1006,
3746,
3746,
1010,
20014,
3014,
1010,
3746,
5833,
18780,
21422,
2041,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
4339,
3501,
26952,
1006,
24357,
1006,
3746,
1010,
3014,
1007,
1010,
2041,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java | ExecutionVertex.scheduleForExecution | public CompletableFuture<Void> scheduleForExecution(
SlotProvider slotProvider,
boolean queued,
LocationPreferenceConstraint locationPreferenceConstraint,
@Nonnull Set<AllocationID> allPreviousExecutionGraphAllocationIds) {
return this.currentExecution.scheduleForExecution(
slotProvider,
queued,
locationPreferenceConstraint,
allPreviousExecutionGraphAllocationIds);
} | java | public CompletableFuture<Void> scheduleForExecution(
SlotProvider slotProvider,
boolean queued,
LocationPreferenceConstraint locationPreferenceConstraint,
@Nonnull Set<AllocationID> allPreviousExecutionGraphAllocationIds) {
return this.currentExecution.scheduleForExecution(
slotProvider,
queued,
locationPreferenceConstraint,
allPreviousExecutionGraphAllocationIds);
} | [
"public",
"CompletableFuture",
"<",
"Void",
">",
"scheduleForExecution",
"(",
"SlotProvider",
"slotProvider",
",",
"boolean",
"queued",
",",
"LocationPreferenceConstraint",
"locationPreferenceConstraint",
",",
"@",
"Nonnull",
"Set",
"<",
"AllocationID",
">",
"allPreviousE... | Schedules the current execution of this ExecutionVertex.
@param slotProvider to allocate the slots from
@param queued if the allocation can be queued
@param locationPreferenceConstraint constraint for the location preferences
@param allPreviousExecutionGraphAllocationIds set with all previous allocation ids in the job graph.
Can be empty if the allocation ids are not required for scheduling.
@return Future which is completed once the execution is deployed. The future
can also completed exceptionally. | [
"Schedules",
"the",
"current",
"execution",
"of",
"this",
"ExecutionVertex",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java#L661-L671 | train | Schedules a task for execution. | [
30522,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
11675,
1028,
30524,
24918,
10288,
8586,
13700,
14413,
8095,
23909,
9821,
1007,
1063,
2709,
2023,
1012,
2783,
10288,
8586,
13700,
1012,
6134,
29278,
10288,
8586,
13700,
1006,
10453,
21572,
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/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/sql/dal/show/ShowParserFactory.java | ShowParserFactory.newInstance | public static AbstractShowParser newInstance(final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine) {
switch (dbType) {
case H2:
case MySQL:
return new MySQLShowParser(shardingRule, lexerEngine);
default:
throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType));
}
} | java | public static AbstractShowParser newInstance(final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine) {
switch (dbType) {
case H2:
case MySQL:
return new MySQLShowParser(shardingRule, lexerEngine);
default:
throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType));
}
} | [
"public",
"static",
"AbstractShowParser",
"newInstance",
"(",
"final",
"DatabaseType",
"dbType",
",",
"final",
"ShardingRule",
"shardingRule",
",",
"final",
"LexerEngine",
"lexerEngine",
")",
"{",
"switch",
"(",
"dbType",
")",
"{",
"case",
"H2",
":",
"case",
"My... | Create show parser instance.
@param dbType database type
@param shardingRule databases and tables sharding rule
@param lexerEngine lexical analysis engine.
@return show parser instance | [
"Create",
"show",
"parser",
"instance",
"."
] | 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/sql/dal/show/ShowParserFactory.java#L43-L51 | train | Create a new instance of a show parser. | [
30522,
2270,
10763,
29474,
14406,
19362,
8043,
2047,
7076,
26897,
1006,
2345,
7809,
13874,
16962,
13874,
1010,
2345,
21146,
17080,
3070,
6820,
2571,
21146,
17080,
3070,
6820,
2571,
1010,
2345,
17244,
7869,
3070,
3170,
17244,
7869,
3070,
3170,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.toArray | public static <T> T[] toArray(Iterator<T> iterator, Class<T> componentType) {
return toArray(CollectionUtil.newArrayList(iterator), componentType);
} | java | public static <T> T[] toArray(Iterator<T> iterator, Class<T> componentType) {
return toArray(CollectionUtil.newArrayList(iterator), componentType);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"toArray",
"(",
"Iterator",
"<",
"T",
">",
"iterator",
",",
"Class",
"<",
"T",
">",
"componentType",
")",
"{",
"return",
"toArray",
"(",
"CollectionUtil",
".",
"newArrayList",
"(",
"iterator",
")",
",",... | 将集合转为数组
@param <T> 数组元素类型
@param iterator {@link Iterator}
@param componentType 集合元素类型
@return 数组
@since 3.0.9 | [
"将集合转为数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L2603-L2605 | train | Returns an array of the given type from the given iterator. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
1031,
1033,
2000,
2906,
9447,
1006,
2009,
6906,
4263,
1026,
1056,
1028,
2009,
6906,
4263,
1010,
2465,
1026,
1056,
1028,
6922,
13874,
1007,
1063,
2709,
2000,
2906,
9447,
1006,
3074,
21823,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.getReader | public static BufferedReader getReader(InputStream in, Charset charset) {
if (null == in) {
return null;
}
InputStreamReader reader = null;
if (null == charset) {
reader = new InputStreamReader(in);
} else {
reader = new InputStreamReader(in, charset);
}
return new BufferedReader(reader);
} | java | public static BufferedReader getReader(InputStream in, Charset charset) {
if (null == in) {
return null;
}
InputStreamReader reader = null;
if (null == charset) {
reader = new InputStreamReader(in);
} else {
reader = new InputStreamReader(in, charset);
}
return new BufferedReader(reader);
} | [
"public",
"static",
"BufferedReader",
"getReader",
"(",
"InputStream",
"in",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"null",
"==",
"in",
")",
"{",
"return",
"null",
";",
"}",
"InputStreamReader",
"reader",
"=",
"null",
";",
"if",
"(",
"null",
"==... | 获得一个Reader
@param in 输入流
@param charset 字符集
@return BufferedReader对象 | [
"获得一个Reader"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L312-L325 | train | Gets a buffered reader for the specified input stream. | [
30522,
2270,
10763,
17698,
2098,
16416,
4063,
2131,
16416,
4063,
1006,
20407,
25379,
1999,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1999,
1007,
1063,
2709,
19701,
1025,
1065,
20407,
25379,
16416,
4063,
8068... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/taskmanager/MemoryLogger.java | MemoryLogger.getMemoryUsageStatsAsString | public static String getMemoryUsageStatsAsString(MemoryMXBean memoryMXBean) {
MemoryUsage heap = memoryMXBean.getHeapMemoryUsage();
MemoryUsage nonHeap = memoryMXBean.getNonHeapMemoryUsage();
long heapUsed = heap.getUsed() >> 20;
long heapCommitted = heap.getCommitted() >> 20;
long heapMax = heap.getMax() >> 20;
long nonHeapUsed = nonHeap.getUsed() >> 20;
long nonHeapCommitted = nonHeap.getCommitted() >> 20;
long nonHeapMax = nonHeap.getMax() >> 20;
return String.format("Memory usage stats: [HEAP: %d/%d/%d MB, " +
"NON HEAP: %d/%d/%d MB (used/committed/max)]",
heapUsed, heapCommitted, heapMax, nonHeapUsed, nonHeapCommitted, nonHeapMax);
} | java | public static String getMemoryUsageStatsAsString(MemoryMXBean memoryMXBean) {
MemoryUsage heap = memoryMXBean.getHeapMemoryUsage();
MemoryUsage nonHeap = memoryMXBean.getNonHeapMemoryUsage();
long heapUsed = heap.getUsed() >> 20;
long heapCommitted = heap.getCommitted() >> 20;
long heapMax = heap.getMax() >> 20;
long nonHeapUsed = nonHeap.getUsed() >> 20;
long nonHeapCommitted = nonHeap.getCommitted() >> 20;
long nonHeapMax = nonHeap.getMax() >> 20;
return String.format("Memory usage stats: [HEAP: %d/%d/%d MB, " +
"NON HEAP: %d/%d/%d MB (used/committed/max)]",
heapUsed, heapCommitted, heapMax, nonHeapUsed, nonHeapCommitted, nonHeapMax);
} | [
"public",
"static",
"String",
"getMemoryUsageStatsAsString",
"(",
"MemoryMXBean",
"memoryMXBean",
")",
"{",
"MemoryUsage",
"heap",
"=",
"memoryMXBean",
".",
"getHeapMemoryUsage",
"(",
")",
";",
"MemoryUsage",
"nonHeap",
"=",
"memoryMXBean",
".",
"getNonHeapMemoryUsage",... | Gets the memory footprint of the JVM in a string representation.
@return A string describing how much heap memory and direct memory are allocated and used. | [
"Gets",
"the",
"memory",
"footprint",
"of",
"the",
"JVM",
"in",
"a",
"string",
"representation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/MemoryLogger.java#L156-L171 | train | Get the memory usage statistics as a string. | [
30522,
2270,
10763,
5164,
2131,
4168,
5302,
2854,
10383,
8449,
29336,
20939,
3367,
4892,
1006,
3638,
22984,
4783,
2319,
3638,
22984,
4783,
2319,
1007,
1063,
3638,
10383,
3351,
16721,
1027,
3638,
22984,
4783,
2319,
1012,
2131,
20192,
9737,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java | CanalServerWithEmbedded.get | @Override
public Message get(ClientIdentity clientIdentity, int batchSize) throws CanalServerException {
return get(clientIdentity, batchSize, null, null);
} | java | @Override
public Message get(ClientIdentity clientIdentity, int batchSize) throws CanalServerException {
return get(clientIdentity, batchSize, null, null);
} | [
"@",
"Override",
"public",
"Message",
"get",
"(",
"ClientIdentity",
"clientIdentity",
",",
"int",
"batchSize",
")",
"throws",
"CanalServerException",
"{",
"return",
"get",
"(",
"clientIdentity",
",",
"batchSize",
",",
"null",
",",
"null",
")",
";",
"}"
] | 获取数据
<pre>
注意: meta获取和数据的获取需要保证顺序性,优先拿到meta的,一定也会是优先拿到数据,所以需要加同步. (不能出现先拿到meta,拿到第二批数据,这样就会导致数据顺序性出现问题)
</pre> | [
"获取数据"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java#L202-L205 | train | Gets a sequence of messages from the server. | [
30522,
1030,
2058,
15637,
2270,
4471,
2131,
1006,
7396,
5178,
16778,
3723,
7396,
5178,
16778,
3723,
1010,
20014,
14108,
5332,
4371,
1007,
11618,
17263,
2121,
28943,
2595,
24422,
1063,
2709,
2131,
1006,
7396,
5178,
16778,
3723,
1010,
14108,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FileSystem.java | FileSystem.create | @Deprecated
public FSDataOutputStream create(
Path f,
boolean overwrite,
int bufferSize,
short replication,
long blockSize) throws IOException {
return create(f, overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE);
} | java | @Deprecated
public FSDataOutputStream create(
Path f,
boolean overwrite,
int bufferSize,
short replication,
long blockSize) throws IOException {
return create(f, overwrite ? WriteMode.OVERWRITE : WriteMode.NO_OVERWRITE);
} | [
"@",
"Deprecated",
"public",
"FSDataOutputStream",
"create",
"(",
"Path",
"f",
",",
"boolean",
"overwrite",
",",
"int",
"bufferSize",
",",
"short",
"replication",
",",
"long",
"blockSize",
")",
"throws",
"IOException",
"{",
"return",
"create",
"(",
"f",
",",
... | Opens an FSDataOutputStream at the indicated Path.
<p>This method is deprecated, because most of its parameters are ignored by most file systems.
To control for example the replication factor and block size in the Hadoop Distributed File system,
make sure that the respective Hadoop configuration file is either linked from the Flink configuration,
or in the classpath of either Flink or the user code.
@param f
the file name to open
@param overwrite
if a file with this name already exists, then if true,
the file will be overwritten, and if false an error will be thrown.
@param bufferSize
the size of the buffer to be used.
@param replication
required block replication for the file.
@param blockSize
the size of the file blocks
@throws IOException Thrown, if the stream could not be opened because of an I/O, or because
a file already exists at that path and the write mode indicates to not
overwrite the file.
@deprecated Deprecated because not well supported across types of file systems.
Control the behavior of specific file systems via configurations instead. | [
"Opens",
"an",
"FSDataOutputStream",
"at",
"the",
"indicated",
"Path",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java#L643-L652 | train | Create a new file with the specified options. | [
30522,
1030,
2139,
28139,
12921,
2270,
1042,
16150,
6790,
5833,
18780,
21422,
3443,
1006,
4130,
1042,
1010,
22017,
20898,
2058,
26373,
1010,
20014,
17698,
5332,
4371,
1010,
2460,
21647,
1010,
2146,
5991,
4697,
1007,
11618,
22834,
10288,
24422... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslator.java | JooqExceptionTranslator.handle | private void handle(ExecuteContext context, SQLExceptionTranslator translator,
SQLException exception) {
DataAccessException translated = translate(context, translator, exception);
if (exception.getNextException() == null) {
context.exception(translated);
}
else {
logger.error("Execution of SQL statement failed.", translated);
}
} | java | private void handle(ExecuteContext context, SQLExceptionTranslator translator,
SQLException exception) {
DataAccessException translated = translate(context, translator, exception);
if (exception.getNextException() == null) {
context.exception(translated);
}
else {
logger.error("Execution of SQL statement failed.", translated);
}
} | [
"private",
"void",
"handle",
"(",
"ExecuteContext",
"context",
",",
"SQLExceptionTranslator",
"translator",
",",
"SQLException",
"exception",
")",
"{",
"DataAccessException",
"translated",
"=",
"translate",
"(",
"context",
",",
"translator",
",",
"exception",
")",
"... | Handle a single exception in the chain. SQLExceptions might be nested multiple
levels deep. The outermost exception is usually the least interesting one ("Call
getNextException to see the cause."). Therefore the innermost exception is
propagated and all other exceptions are logged.
@param context the execute context
@param translator the exception translator
@param exception the exception | [
"Handle",
"a",
"single",
"exception",
"in",
"the",
"chain",
".",
"SQLExceptions",
"might",
"be",
"nested",
"multiple",
"levels",
"deep",
".",
"The",
"outermost",
"exception",
"is",
"usually",
"the",
"least",
"interesting",
"one",
"(",
"Call",
"getNextException",... | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslator.java#L80-L89 | train | Handle a SQL exception. | [
30522,
2797,
11675,
5047,
1006,
15389,
8663,
18209,
6123,
1010,
29296,
10288,
24422,
6494,
3619,
20051,
30524,
1012,
6453,
1006,
5421,
1007,
1025,
1065,
2842,
1063,
8833,
4590,
1012,
7561,
1006,
1000,
7781,
1997,
29296,
4861,
3478,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.removeBlank | public static <T extends CharSequence> Collection<T> removeBlank(Collection<T> collection) {
return filter(collection, new Filter<T>() {
@Override
public boolean accept(T t) {
return false == StrUtil.isBlank(t);
}
});
} | java | public static <T extends CharSequence> Collection<T> removeBlank(Collection<T> collection) {
return filter(collection, new Filter<T>() {
@Override
public boolean accept(T t) {
return false == StrUtil.isBlank(t);
}
});
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"Collection",
"<",
"T",
">",
"removeBlank",
"(",
"Collection",
"<",
"T",
">",
"collection",
")",
"{",
"return",
"filter",
"(",
"collection",
",",
"new",
"Filter",
"<",
"T",
">",
"(",
")",
"{... | 去除{@code null}或者""或者空白字符串 元素
@param collection 集合
@return 处理后的集合
@since 3.2.2 | [
"去除",
"{",
"@code",
"null",
"}",
"或者",
"或者空白字符串",
"元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1106-L1113 | train | Removes all blank characters from a collection. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
3074,
1026,
1056,
1028,
6366,
28522,
8950,
1006,
3074,
1026,
1056,
1028,
3074,
1007,
1063,
2709,
11307,
1006,
3074,
1010,
2047,
11307,
1026,
1056,
1028,
1006,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.sortEntryToList | public static <K, V> List<Entry<K, V>> sortEntryToList(Collection<Entry<K, V>> collection) {
List<Entry<K, V>> list = new LinkedList<>(collection);
Collections.sort(list, new Comparator<Entry<K, V>>() {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public int compare(Entry<K, V> o1, Entry<K, V> o2) {
V v1 = o1.getValue();
V v2 = o2.getValue();
if (v1 instanceof Comparable) {
return ((Comparable) v1).compareTo(v2);
} else {
return v1.toString().compareTo(v2.toString());
}
}
});
return list;
} | java | public static <K, V> List<Entry<K, V>> sortEntryToList(Collection<Entry<K, V>> collection) {
List<Entry<K, V>> list = new LinkedList<>(collection);
Collections.sort(list, new Comparator<Entry<K, V>>() {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public int compare(Entry<K, V> o1, Entry<K, V> o2) {
V v1 = o1.getValue();
V v2 = o2.getValue();
if (v1 instanceof Comparable) {
return ((Comparable) v1).compareTo(v2);
} else {
return v1.toString().compareTo(v2.toString());
}
}
});
return list;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"List",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"sortEntryToList",
"(",
"Collection",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"collection",
")",
"{",
"List",
"<",
"Entry",
"<",
"K",
",",
"V",... | 将Set排序(根据Entry的值)
@param <K> 键类型
@param <V> 值类型
@param collection 被排序的{@link Collection}
@return 排序后的Set | [
"将Set排序(根据Entry的值)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2210-L2228 | train | Creates a list of entries sorted by their value. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
2862,
1026,
4443,
1026,
1047,
1010,
1058,
1028,
1028,
4066,
4765,
2854,
3406,
9863,
1006,
3074,
1026,
4443,
1026,
1047,
1010,
1058,
1028,
1028,
3074,
1007,
1063,
2862,
1026,
4443,
1026,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/ThreadDeathWatcher.java | ThreadDeathWatcher.watch | public static void watch(Thread thread, Runnable task) {
if (thread == null) {
throw new NullPointerException("thread");
}
if (task == null) {
throw new NullPointerException("task");
}
if (!thread.isAlive()) {
throw new IllegalArgumentException("thread must be alive.");
}
schedule(thread, task, true);
} | java | public static void watch(Thread thread, Runnable task) {
if (thread == null) {
throw new NullPointerException("thread");
}
if (task == null) {
throw new NullPointerException("task");
}
if (!thread.isAlive()) {
throw new IllegalArgumentException("thread must be alive.");
}
schedule(thread, task, true);
} | [
"public",
"static",
"void",
"watch",
"(",
"Thread",
"thread",
",",
"Runnable",
"task",
")",
"{",
"if",
"(",
"thread",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"thread\"",
")",
";",
"}",
"if",
"(",
"task",
"==",
"null",
")"... | Schedules the specified {@code task} to run when the specified {@code thread} dies.
@param thread the {@link Thread} to watch
@param task the {@link Runnable} to run when the {@code thread} dies
@throws IllegalArgumentException if the specified {@code thread} is not alive | [
"Schedules",
"the",
"specified",
"{",
"@code",
"task",
"}",
"to",
"run",
"when",
"the",
"specified",
"{",
"@code",
"thread",
"}",
"dies",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ThreadDeathWatcher.java#L79-L91 | train | Schedule a Runnable on a thread. | [
30522,
2270,
10763,
11675,
3422,
1006,
11689,
11689,
1010,
2448,
22966,
4708,
1007,
1063,
2065,
1006,
11689,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
11689,
1000,
1007,
1025,
1065,
2065,
1006,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/Condition.java | Condition.parseValue | private void parseValue() {
// 当值无时,视为空判定
if (null == this.value) {
this.operator = OPERATOR_IS;
this.value = VALUE_NULL;
return;
}
// 对数组和集合值按照 IN 处理
if (this.value instanceof Collection || ArrayUtil.isArray(this.value)) {
this.operator = OPERATOR_IN;
return;
}
// 其他类型值,跳过
if (false == (this.value instanceof String)) {
return;
}
String valueStr = ((String) value);
if (StrUtil.isBlank(valueStr)) {
// 空字段不做处理
return;
}
valueStr = valueStr.trim();
// 处理null
if (StrUtil.endWithIgnoreCase(valueStr, "null")) {
if (StrUtil.equalsIgnoreCase("= null", valueStr) || StrUtil.equalsIgnoreCase("is null", valueStr)) {
// 处理"= null"和"is null"转换为"IS NULL"
this.operator = OPERATOR_IS;
this.value = VALUE_NULL;
this.isPlaceHolder = false;
return;
} else if (StrUtil.equalsIgnoreCase("!= null", valueStr) || StrUtil.equalsIgnoreCase("is not null", valueStr)) {
// 处理"!= null"和"is not null"转换为"IS NOT NULL"
this.operator = OPERATOR_IS_NOT;
this.value = VALUE_NULL;
this.isPlaceHolder = false;
return;
}
}
List<String> strs = StrUtil.split(valueStr, StrUtil.C_SPACE, 2);
if (strs.size() < 2) {
return;
}
// 处理常用符号和IN
final String firstPart = strs.get(0).trim().toUpperCase();
if (OPERATORS.contains(firstPart)) {
this.operator = firstPart;
this.value = strs.get(1).trim();
return;
}
// 处理LIKE
if (OPERATOR_LIKE.equals(firstPart)) {
this.operator = OPERATOR_LIKE;
this.value = unwrapQuote(strs.get(1));
return;
}
// 处理BETWEEN x AND y
if (OPERATOR_BETWEEN.equals(firstPart)) {
final List<String> betweenValueStrs = StrSpliter.splitTrimIgnoreCase(strs.get(1), LogicalOperator.AND.toString(), 2, true);
if (betweenValueStrs.size() < 2) {
// 必须满足a AND b格式,不满足被当作普通值
return;
}
this.operator = OPERATOR_BETWEEN;
this.value = unwrapQuote(betweenValueStrs.get(0));
this.secondValue = unwrapQuote(betweenValueStrs.get(1));
return;
}
} | java | private void parseValue() {
// 当值无时,视为空判定
if (null == this.value) {
this.operator = OPERATOR_IS;
this.value = VALUE_NULL;
return;
}
// 对数组和集合值按照 IN 处理
if (this.value instanceof Collection || ArrayUtil.isArray(this.value)) {
this.operator = OPERATOR_IN;
return;
}
// 其他类型值,跳过
if (false == (this.value instanceof String)) {
return;
}
String valueStr = ((String) value);
if (StrUtil.isBlank(valueStr)) {
// 空字段不做处理
return;
}
valueStr = valueStr.trim();
// 处理null
if (StrUtil.endWithIgnoreCase(valueStr, "null")) {
if (StrUtil.equalsIgnoreCase("= null", valueStr) || StrUtil.equalsIgnoreCase("is null", valueStr)) {
// 处理"= null"和"is null"转换为"IS NULL"
this.operator = OPERATOR_IS;
this.value = VALUE_NULL;
this.isPlaceHolder = false;
return;
} else if (StrUtil.equalsIgnoreCase("!= null", valueStr) || StrUtil.equalsIgnoreCase("is not null", valueStr)) {
// 处理"!= null"和"is not null"转换为"IS NOT NULL"
this.operator = OPERATOR_IS_NOT;
this.value = VALUE_NULL;
this.isPlaceHolder = false;
return;
}
}
List<String> strs = StrUtil.split(valueStr, StrUtil.C_SPACE, 2);
if (strs.size() < 2) {
return;
}
// 处理常用符号和IN
final String firstPart = strs.get(0).trim().toUpperCase();
if (OPERATORS.contains(firstPart)) {
this.operator = firstPart;
this.value = strs.get(1).trim();
return;
}
// 处理LIKE
if (OPERATOR_LIKE.equals(firstPart)) {
this.operator = OPERATOR_LIKE;
this.value = unwrapQuote(strs.get(1));
return;
}
// 处理BETWEEN x AND y
if (OPERATOR_BETWEEN.equals(firstPart)) {
final List<String> betweenValueStrs = StrSpliter.splitTrimIgnoreCase(strs.get(1), LogicalOperator.AND.toString(), 2, true);
if (betweenValueStrs.size() < 2) {
// 必须满足a AND b格式,不满足被当作普通值
return;
}
this.operator = OPERATOR_BETWEEN;
this.value = unwrapQuote(betweenValueStrs.get(0));
this.secondValue = unwrapQuote(betweenValueStrs.get(1));
return;
}
} | [
"private",
"void",
"parseValue",
"(",
")",
"{",
"// 当值无时,视为空判定\r",
"if",
"(",
"null",
"==",
"this",
".",
"value",
")",
"{",
"this",
".",
"operator",
"=",
"OPERATOR_IS",
";",
"this",
".",
"value",
"=",
"VALUE_NULL",
";",
"return",
";",
"}",
"// 对数组和集合值按照 ... | 解析值表达式<br>
支持"<>", "<=", "< ", ">=", "> ", "= ", "!=", "IN", "LIKE", "IS", "IS NOT"表达式<br>
如果无法识别表达式,则表达式为"=",表达式与值用空格隔开<br>
例如字段为name,那value可以为:"> 1"或者 "LIKE %Tom"此类 | [
"解析值表达式<br",
">",
"支持",
"<",
">",
"<",
"=",
"<",
">",
"=",
">",
"=",
"!",
"=",
"IN",
"LIKE",
"IS",
"IS",
"NOT",
"表达式<br",
">",
"如果无法识别表达式,则表达式为",
"=",
",表达式与值用空格隔开<br",
">",
"例如字段为name,那value可以为:",
">",
"1",
"或者",
"LIKE",
"%Tom",
"此类"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/Condition.java#L384-L461 | train | Parses the value. | [
30522,
2797,
11675,
11968,
3366,
10175,
5657,
1006,
1007,
1063,
1013,
1013,
100,
100,
100,
100,
1989,
100,
100,
1930,
100,
1822,
2065,
1006,
19701,
1027,
1027,
2023,
1012,
3643,
1007,
1063,
2023,
1012,
6872,
1027,
6872,
1035,
2003,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java | Wrapper.wrap | public String[] wrap(String... fields){
if(ArrayUtil.isEmpty(fields)) {
return fields;
}
String[] wrappedFields = new String[fields.length];
for(int i = 0; i < fields.length; i++) {
wrappedFields[i] = wrap(fields[i]);
}
return wrappedFields;
} | java | public String[] wrap(String... fields){
if(ArrayUtil.isEmpty(fields)) {
return fields;
}
String[] wrappedFields = new String[fields.length];
for(int i = 0; i < fields.length; i++) {
wrappedFields[i] = wrap(fields[i]);
}
return wrappedFields;
} | [
"public",
"String",
"[",
"]",
"wrap",
"(",
"String",
"...",
"fields",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"fields",
")",
")",
"{",
"return",
"fields",
";",
"}",
"String",
"[",
"]",
"wrappedFields",
"=",
"new",
"String",
"[",
"field... | 包装字段名<br>
有时字段与SQL的某些关键字冲突,导致SQL出错,因此需要将字段名用单引号或者反引号包装起来,避免冲突
@param fields 字段名
@return 包装后的字段名 | [
"包装字段名<br",
">",
"有时字段与SQL的某些关键字冲突,导致SQL出错,因此需要将字段名用单引号或者反引号包装起来,避免冲突"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java#L119-L130 | train | Wraps the given fields in a list of strings. | [
30522,
2270,
5164,
1031,
1033,
10236,
1006,
5164,
1012,
1012,
1012,
4249,
1007,
1063,
2065,
1006,
9140,
21823,
2140,
1012,
2003,
6633,
13876,
2100,
1006,
4249,
1007,
1007,
1063,
2709,
4249,
1025,
1065,
5164,
1031,
1033,
5058,
15155,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java | PerceptronClassifier.readInstance | private Instance[] readInstance(String corpus, FeatureMap featureMap)
{
IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(corpus);
List<Instance> instanceList = new LinkedList<Instance>();
for (String line : lineIterator)
{
String[] cells = line.split(",");
String text = cells[0], label = cells[1];
List<Integer> x = extractFeature(text, featureMap);
int y = featureMap.tagSet.add(label);
if (y == 0)
y = -1; // 感知机标签约定为±1
else if (y > 1)
throw new IllegalArgumentException("类别数大于2,目前只支持二分类。");
instanceList.add(new Instance(x, y));
}
return instanceList.toArray(new Instance[0]);
} | java | private Instance[] readInstance(String corpus, FeatureMap featureMap)
{
IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(corpus);
List<Instance> instanceList = new LinkedList<Instance>();
for (String line : lineIterator)
{
String[] cells = line.split(",");
String text = cells[0], label = cells[1];
List<Integer> x = extractFeature(text, featureMap);
int y = featureMap.tagSet.add(label);
if (y == 0)
y = -1; // 感知机标签约定为±1
else if (y > 1)
throw new IllegalArgumentException("类别数大于2,目前只支持二分类。");
instanceList.add(new Instance(x, y));
}
return instanceList.toArray(new Instance[0]);
} | [
"private",
"Instance",
"[",
"]",
"readInstance",
"(",
"String",
"corpus",
",",
"FeatureMap",
"featureMap",
")",
"{",
"IOUtil",
".",
"LineIterator",
"lineIterator",
"=",
"new",
"IOUtil",
".",
"LineIterator",
"(",
"corpus",
")",
";",
"List",
"<",
"Instance",
"... | 从语料库读取实例
@param corpus 语料库
@param featureMap 特征映射
@return 数据集 | [
"从语料库读取实例"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java#L193-L210 | train | readInstance returns an array of Instance | [
30522,
2797,
6013,
1031,
1033,
3191,
7076,
26897,
1006,
5164,
13931,
1010,
3444,
2863,
2361,
3444,
2863,
2361,
1007,
1063,
22834,
21823,
2140,
1012,
2240,
21646,
8844,
2240,
21646,
8844,
1027,
2047,
22834,
21823,
2140,
1012,
2240,
21646,
88... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java | UnsafeExternalSorter.growPointerArrayIfNecessary | private void growPointerArrayIfNecessary() throws IOException {
assert(inMemSorter != null);
if (!inMemSorter.hasSpaceForAnotherRecord()) {
long used = inMemSorter.getMemoryUsage();
LongArray array;
try {
// could trigger spilling
array = allocateArray(used / 8 * 2);
} catch (TooLargePageException e) {
// The pointer array is too big to fix in a single page, spill.
spill();
return;
} catch (SparkOutOfMemoryError e) {
// should have trigger spilling
if (!inMemSorter.hasSpaceForAnotherRecord()) {
logger.error("Unable to grow the pointer array");
throw e;
}
return;
}
// check if spilling is triggered or not
if (inMemSorter.hasSpaceForAnotherRecord()) {
freeArray(array);
} else {
inMemSorter.expandPointerArray(array);
}
}
} | java | private void growPointerArrayIfNecessary() throws IOException {
assert(inMemSorter != null);
if (!inMemSorter.hasSpaceForAnotherRecord()) {
long used = inMemSorter.getMemoryUsage();
LongArray array;
try {
// could trigger spilling
array = allocateArray(used / 8 * 2);
} catch (TooLargePageException e) {
// The pointer array is too big to fix in a single page, spill.
spill();
return;
} catch (SparkOutOfMemoryError e) {
// should have trigger spilling
if (!inMemSorter.hasSpaceForAnotherRecord()) {
logger.error("Unable to grow the pointer array");
throw e;
}
return;
}
// check if spilling is triggered or not
if (inMemSorter.hasSpaceForAnotherRecord()) {
freeArray(array);
} else {
inMemSorter.expandPointerArray(array);
}
}
} | [
"private",
"void",
"growPointerArrayIfNecessary",
"(",
")",
"throws",
"IOException",
"{",
"assert",
"(",
"inMemSorter",
"!=",
"null",
")",
";",
"if",
"(",
"!",
"inMemSorter",
".",
"hasSpaceForAnotherRecord",
"(",
")",
")",
"{",
"long",
"used",
"=",
"inMemSorte... | Checks whether there is enough space to insert an additional record in to the sort pointer
array and grows the array if additional space is required. If the required space cannot be
obtained, then the in-memory data will be spilled to disk. | [
"Checks",
"whether",
"there",
"is",
"enough",
"space",
"to",
"insert",
"an",
"additional",
"record",
"in",
"to",
"the",
"sort",
"pointer",
"array",
"and",
"grows",
"the",
"array",
"if",
"additional",
"space",
"is",
"required",
".",
"If",
"the",
"required",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L339-L366 | train | Grows the pointer array if necessary. | [
30522,
2797,
11675,
4982,
8400,
6906,
11335,
10139,
2546,
2638,
9623,
10286,
2100,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
20865,
1006,
1999,
4168,
5244,
11589,
2121,
999,
1027,
19701,
1007,
1025,
2065,
1006,
999,
1999,
4168,
5244,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.removeHeader | @Deprecated
public static void removeHeader(HttpMessage message, CharSequence name) {
message.headers().remove(name);
} | java | @Deprecated
public static void removeHeader(HttpMessage message, CharSequence name) {
message.headers().remove(name);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"removeHeader",
"(",
"HttpMessage",
"message",
",",
"CharSequence",
"name",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"remove",
"(",
"name",
")",
";",
"}"
] | @deprecated Use {@link #remove(CharSequence)} instead.
Removes the header with the specified name. | [
"@deprecated",
"Use",
"{",
"@link",
"#remove",
"(",
"CharSequence",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L689-L692 | train | Removes a header from the message. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
11675,
6366,
4974,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
25869,
3366,
4226,
5897,
2171,
1007,
1063,
4471,
1012,
20346,
2015,
1006,
1007,
1012,
6366,
1006,
2171,
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... |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.find | private int find(UTF8String str, int start) {
assert (str.numBytes > 0);
while (start <= numBytes - str.numBytes) {
if (ByteArrayMethods.arrayEquals(base, offset + start, str.base, str.offset, str.numBytes)) {
return start;
}
start += 1;
}
return -1;
} | java | private int find(UTF8String str, int start) {
assert (str.numBytes > 0);
while (start <= numBytes - str.numBytes) {
if (ByteArrayMethods.arrayEquals(base, offset + start, str.base, str.offset, str.numBytes)) {
return start;
}
start += 1;
}
return -1;
} | [
"private",
"int",
"find",
"(",
"UTF8String",
"str",
",",
"int",
"start",
")",
"{",
"assert",
"(",
"str",
".",
"numBytes",
">",
"0",
")",
";",
"while",
"(",
"start",
"<=",
"numBytes",
"-",
"str",
".",
"numBytes",
")",
"{",
"if",
"(",
"ByteArrayMethods... | Find the `str` from left to right. | [
"Find",
"the",
"str",
"from",
"left",
"to",
"right",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L740-L749 | train | Find the first index in the UTF8String. | [
30522,
2797,
20014,
2424,
1006,
21183,
2546,
2620,
3367,
4892,
2358,
2099,
1010,
20014,
2707,
1007,
1063,
20865,
1006,
2358,
2099,
1012,
15903,
17250,
2015,
1028,
1014,
1007,
1025,
2096,
1006,
2707,
1026,
1027,
15903,
17250,
2015,
1011,
235... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.expandSelectItem | private boolean expandSelectItem(
final SqlNode selectItem,
SqlSelect select,
RelDataType targetType,
List<SqlNode> selectItems,
Set<String> aliases,
List<Map.Entry<String, RelDataType>> fields,
final boolean includeSystemVars) {
final SelectScope scope = (SelectScope) getWhereScope(select);
if (expandStar(selectItems, aliases, fields, includeSystemVars, scope,
selectItem)) {
return true;
}
// Expand the select item: fully-qualify columns, and convert
// parentheses-free functions such as LOCALTIME into explicit function
// calls.
SqlNode expanded = expand(selectItem, scope);
final String alias =
deriveAlias(
selectItem,
aliases.size());
// If expansion has altered the natural alias, supply an explicit 'AS'.
final SqlValidatorScope selectScope = getSelectScope(select);
if (expanded != selectItem) {
String newAlias =
deriveAlias(
expanded,
aliases.size());
if (!newAlias.equals(alias)) {
expanded =
SqlStdOperatorTable.AS.createCall(
selectItem.getParserPosition(),
expanded,
new SqlIdentifier(alias, SqlParserPos.ZERO));
deriveTypeImpl(selectScope, expanded);
}
}
selectItems.add(expanded);
aliases.add(alias);
if (expanded != null) {
inferUnknownTypes(targetType, scope, expanded);
}
final RelDataType type = deriveType(selectScope, expanded);
setValidatedNodeType(expanded, type);
fields.add(Pair.of(alias, type));
return false;
} | java | private boolean expandSelectItem(
final SqlNode selectItem,
SqlSelect select,
RelDataType targetType,
List<SqlNode> selectItems,
Set<String> aliases,
List<Map.Entry<String, RelDataType>> fields,
final boolean includeSystemVars) {
final SelectScope scope = (SelectScope) getWhereScope(select);
if (expandStar(selectItems, aliases, fields, includeSystemVars, scope,
selectItem)) {
return true;
}
// Expand the select item: fully-qualify columns, and convert
// parentheses-free functions such as LOCALTIME into explicit function
// calls.
SqlNode expanded = expand(selectItem, scope);
final String alias =
deriveAlias(
selectItem,
aliases.size());
// If expansion has altered the natural alias, supply an explicit 'AS'.
final SqlValidatorScope selectScope = getSelectScope(select);
if (expanded != selectItem) {
String newAlias =
deriveAlias(
expanded,
aliases.size());
if (!newAlias.equals(alias)) {
expanded =
SqlStdOperatorTable.AS.createCall(
selectItem.getParserPosition(),
expanded,
new SqlIdentifier(alias, SqlParserPos.ZERO));
deriveTypeImpl(selectScope, expanded);
}
}
selectItems.add(expanded);
aliases.add(alias);
if (expanded != null) {
inferUnknownTypes(targetType, scope, expanded);
}
final RelDataType type = deriveType(selectScope, expanded);
setValidatedNodeType(expanded, type);
fields.add(Pair.of(alias, type));
return false;
} | [
"private",
"boolean",
"expandSelectItem",
"(",
"final",
"SqlNode",
"selectItem",
",",
"SqlSelect",
"select",
",",
"RelDataType",
"targetType",
",",
"List",
"<",
"SqlNode",
">",
"selectItems",
",",
"Set",
"<",
"String",
">",
"aliases",
",",
"List",
"<",
"Map",
... | If <code>selectItem</code> is "*" or "TABLE.*", expands it and returns
true; otherwise writes the unexpanded item.
@param selectItem Select-list item
@param select Containing select clause
@param selectItems List that expanded items are written to
@param aliases Set of aliases
@param fields List of field names and types, in alias order
@param includeSystemVars If true include system vars in lists
@return Whether the node was expanded | [
"If",
"<code",
">",
"selectItem<",
"/",
"code",
">",
"is",
"*",
"or",
"TABLE",
".",
"*",
"expands",
"it",
"and",
"returns",
"true",
";",
"otherwise",
"writes",
"the",
"unexpanded",
"item",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L420-L470 | train | Expand a select item. | [
30522,
2797,
22017,
20898,
24545,
12260,
6593,
4221,
2213,
1006,
2345,
29296,
3630,
3207,
7276,
4221,
2213,
1010,
29296,
11246,
22471,
7276,
1010,
2128,
15150,
29336,
18863,
4539,
13874,
1010,
2862,
1026,
29296,
3630,
3207,
1028,
7276,
4221,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java | Ftp.existFile | public boolean existFile(String path) {
FTPFile[] ftpFileArr;
try {
ftpFileArr = client.listFiles(path);
} catch (IOException e) {
throw new FtpException(e);
}
if (ArrayUtil.isNotEmpty(ftpFileArr)) {
return true;
}
return false;
} | java | public boolean existFile(String path) {
FTPFile[] ftpFileArr;
try {
ftpFileArr = client.listFiles(path);
} catch (IOException e) {
throw new FtpException(e);
}
if (ArrayUtil.isNotEmpty(ftpFileArr)) {
return true;
}
return false;
} | [
"public",
"boolean",
"existFile",
"(",
"String",
"path",
")",
"{",
"FTPFile",
"[",
"]",
"ftpFileArr",
";",
"try",
"{",
"ftpFileArr",
"=",
"client",
".",
"listFiles",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new"... | 判断ftp服务器文件是否存在
@param path 文件路径
@return 是否存在 | [
"判断ftp服务器文件是否存在"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java#L289-L300 | train | Checks if a file exists in the FTP server. | [
30522,
2270,
22017,
20898,
4839,
8873,
2571,
1006,
5164,
4130,
1007,
1063,
3027,
14376,
9463,
1031,
1033,
3027,
14376,
9463,
2906,
2099,
1025,
3046,
1063,
3027,
14376,
9463,
2906,
2099,
1027,
7396,
1012,
2862,
8873,
4244,
1006,
4130,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java | ReflectUtil.getPublicMethods | public static List<Method> getPublicMethods(Class<?> clazz, Filter<Method> filter) {
if (null == clazz) {
return null;
}
final Method[] methods = getPublicMethods(clazz);
List<Method> methodList;
if (null != filter) {
methodList = new ArrayList<>();
for (Method method : methods) {
if (filter.accept(method)) {
methodList.add(method);
}
}
} else {
methodList = CollectionUtil.newArrayList(methods);
}
return methodList;
} | java | public static List<Method> getPublicMethods(Class<?> clazz, Filter<Method> filter) {
if (null == clazz) {
return null;
}
final Method[] methods = getPublicMethods(clazz);
List<Method> methodList;
if (null != filter) {
methodList = new ArrayList<>();
for (Method method : methods) {
if (filter.accept(method)) {
methodList.add(method);
}
}
} else {
methodList = CollectionUtil.newArrayList(methods);
}
return methodList;
} | [
"public",
"static",
"List",
"<",
"Method",
">",
"getPublicMethods",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Filter",
"<",
"Method",
">",
"filter",
")",
"{",
"if",
"(",
"null",
"==",
"clazz",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Method"... | 获得指定类过滤后的Public方法列表
@param clazz 查找方法的类
@param filter 过滤器
@return 过滤后的方法列表 | [
"获得指定类过滤后的Public方法列表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L309-L327 | train | Gets the list of public methods of the specified class and optionally applies the specified filter to those methods. | [
30522,
2270,
10763,
2862,
1026,
4118,
1028,
2131,
14289,
16558,
2594,
11368,
6806,
5104,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
11307,
1026,
4118,
1028,
11307,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
18856,
10936,
2480,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/aggregate/BytesHashMap.java | BytesHashMap.append | public BinaryRow append(LookupInfo info, BinaryRow value) throws IOException {
try {
if (numElements >= growthThreshold) {
growAndRehash();
//update info's bucketSegmentIndex and bucketOffset
lookup(info.key);
}
BinaryRow toAppend = hashSetMode ? reusedValue : value;
long pointerToAppended = recordArea.appendRecord(info.key, toAppend);
bucketSegments.get(info.bucketSegmentIndex).putLong(info.bucketOffset, pointerToAppended);
bucketSegments.get(info.bucketSegmentIndex).putInt(
info.bucketOffset + ELEMENT_POINT_LENGTH, info.keyHashCode);
numElements++;
recordArea.setReadPosition(pointerToAppended);
recordArea.skipKey();
return recordArea.readValue(reusedValue);
} catch (EOFException e) {
numSpillFiles++;
spillInBytes += recordArea.segments.size() * ((long) segmentSize);
throw e;
}
} | java | public BinaryRow append(LookupInfo info, BinaryRow value) throws IOException {
try {
if (numElements >= growthThreshold) {
growAndRehash();
//update info's bucketSegmentIndex and bucketOffset
lookup(info.key);
}
BinaryRow toAppend = hashSetMode ? reusedValue : value;
long pointerToAppended = recordArea.appendRecord(info.key, toAppend);
bucketSegments.get(info.bucketSegmentIndex).putLong(info.bucketOffset, pointerToAppended);
bucketSegments.get(info.bucketSegmentIndex).putInt(
info.bucketOffset + ELEMENT_POINT_LENGTH, info.keyHashCode);
numElements++;
recordArea.setReadPosition(pointerToAppended);
recordArea.skipKey();
return recordArea.readValue(reusedValue);
} catch (EOFException e) {
numSpillFiles++;
spillInBytes += recordArea.segments.size() * ((long) segmentSize);
throw e;
}
} | [
"public",
"BinaryRow",
"append",
"(",
"LookupInfo",
"info",
",",
"BinaryRow",
"value",
")",
"throws",
"IOException",
"{",
"try",
"{",
"if",
"(",
"numElements",
">=",
"growthThreshold",
")",
"{",
"growAndRehash",
"(",
")",
";",
"//update info's bucketSegmentIndex a... | Append an value into the hash map's record area.
@return An BinaryRow mapping to the memory segments in the map's record area belonging to
the newly appended value.
@throws EOFException if the map can't allocate much more memory. | [
"Append",
"an",
"value",
"into",
"the",
"hash",
"map",
"s",
"record",
"area",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/aggregate/BytesHashMap.java#L315-L337 | train | Append a binary row to the lookup table. | [
30522,
2270,
12441,
10524,
10439,
10497,
1006,
2298,
6279,
2378,
14876,
18558,
1010,
12441,
10524,
3643,
1007,
11618,
22834,
10288,
24422,
1063,
3046,
1063,
2065,
1006,
16371,
10199,
13665,
2015,
1028,
1027,
3930,
2705,
21898,
11614,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.zip | public static File zip(File zipFile, String path, InputStream in, Charset charset) throws UtilException {
return zip(zipFile, new String[] { path }, new InputStream[] { in }, charset);
} | java | public static File zip(File zipFile, String path, InputStream in, Charset charset) throws UtilException {
return zip(zipFile, new String[] { path }, new InputStream[] { in }, charset);
} | [
"public",
"static",
"File",
"zip",
"(",
"File",
"zipFile",
",",
"String",
"path",
",",
"InputStream",
"in",
",",
"Charset",
"charset",
")",
"throws",
"UtilException",
"{",
"return",
"zip",
"(",
"zipFile",
",",
"new",
"String",
"[",
"]",
"{",
"path",
"}",... | 对流中的数据加入到压缩文件<br>
@param zipFile 生成的Zip文件,包括文件名。注意:zipPath不能是srcPath路径下的子文件夹
@param path 流数据在压缩文件中的路径或文件名
@param in 要压缩的源
@param charset 编码
@return 压缩文件
@throws UtilException IO异常
@since 3.2.2 | [
"对流中的数据加入到压缩文件<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L236-L238 | train | Creates a zip file from the given input stream and returns the file with the given path. | [
30522,
2270,
10763,
5371,
14101,
1006,
5371,
14101,
8873,
2571,
1010,
5164,
4130,
1010,
20407,
25379,
1999,
1010,
25869,
13462,
25869,
13462,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
2709,
14101,
1006,
14101,
8873,
2571,
1010,
2047,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java | RestTemplateBuilder.additionalInterceptors | public RestTemplateBuilder additionalInterceptors(
Collection<? extends ClientHttpRequestInterceptor> interceptors) {
Assert.notNull(interceptors, "interceptors must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.requestFactoryCustomizer,
append(this.interceptors, interceptors));
} | java | public RestTemplateBuilder additionalInterceptors(
Collection<? extends ClientHttpRequestInterceptor> interceptors) {
Assert.notNull(interceptors, "interceptors must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.requestFactoryCustomizer,
append(this.interceptors, interceptors));
} | [
"public",
"RestTemplateBuilder",
"additionalInterceptors",
"(",
"Collection",
"<",
"?",
"extends",
"ClientHttpRequestInterceptor",
">",
"interceptors",
")",
"{",
"Assert",
".",
"notNull",
"(",
"interceptors",
",",
"\"interceptors must not be null\"",
")",
";",
"return",
... | Add additional {@link ClientHttpRequestInterceptor ClientHttpRequestInterceptors}
that should be used with the {@link RestTemplate}.
@param interceptors the interceptors to add
@return a new builder instance
@since 1.4.1
@see #interceptors(ClientHttpRequestInterceptor...) | [
"Add",
"additional",
"{"
] | 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#L293-L301 | train | Add additional interceptors to the builder. | [
30522,
2270,
2717,
18532,
15725,
8569,
23891,
2099,
3176,
18447,
2121,
3401,
13876,
5668,
1006,
3074,
1026,
1029,
8908,
7396,
11039,
25856,
2890,
15500,
18447,
2121,
3401,
13876,
2953,
1028,
24727,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java | GlobalConfiguration.isSensitive | public static boolean isSensitive(String key) {
Preconditions.checkNotNull(key, "key is null");
final String keyInLower = key.toLowerCase();
for (String hideKey : SENSITIVE_KEYS) {
if (keyInLower.length() >= hideKey.length()
&& keyInLower.contains(hideKey)) {
return true;
}
}
return false;
} | java | public static boolean isSensitive(String key) {
Preconditions.checkNotNull(key, "key is null");
final String keyInLower = key.toLowerCase();
for (String hideKey : SENSITIVE_KEYS) {
if (keyInLower.length() >= hideKey.length()
&& keyInLower.contains(hideKey)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isSensitive",
"(",
"String",
"key",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"key",
",",
"\"key is null\"",
")",
";",
"final",
"String",
"keyInLower",
"=",
"key",
".",
"toLowerCase",
"(",
")",
";",
"for",
"(",
"S... | Check whether the key is a hidden key.
@param key the config key | [
"Check",
"whether",
"the",
"key",
"is",
"a",
"hidden",
"key",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java#L208-L218 | train | Checks if the given key is sensitive. | [
30522,
2270,
10763,
22017,
20898,
26354,
6132,
13043,
1006,
5164,
3145,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
3145,
1010,
1000,
3145,
2003,
19701,
1000,
1007,
1025,
2345,
5164,
3145,
2378,
27663,
2099,
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... |
networknt/light-4j | dump/src/main/java/com/networknt/dump/StatusCodeDumper.java | StatusCodeDumper.dumpResponse | @Override
public void dumpResponse(Map<String, Object> result) {
this.statusCodeResult = String.valueOf(exchange.getStatusCode());
this.putDumpInfoTo(result);
} | java | @Override
public void dumpResponse(Map<String, Object> result) {
this.statusCodeResult = String.valueOf(exchange.getStatusCode());
this.putDumpInfoTo(result);
} | [
"@",
"Override",
"public",
"void",
"dumpResponse",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"this",
".",
"statusCodeResult",
"=",
"String",
".",
"valueOf",
"(",
"exchange",
".",
"getStatusCode",
"(",
")",
")",
";",
"this",
".",
... | impl of dumping response status code to result
@param result A map you want to put dump information to | [
"impl",
"of",
"dumping",
"response",
"status",
"code",
"to",
"result"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/StatusCodeDumper.java#L38-L42 | train | Dump response to result | [
30522,
1030,
2058,
15637,
2270,
11675,
15653,
6072,
26029,
3366,
1006,
4949,
1026,
5164,
1010,
4874,
1028,
2765,
1007,
1063,
2023,
1012,
3570,
16044,
6072,
11314,
1027,
5164,
1012,
3643,
11253,
1006,
3863,
1012,
4152,
29336,
2271,
16044,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.setStreamTimeCharacteristic | @PublicEvolving
public void setStreamTimeCharacteristic(TimeCharacteristic characteristic) {
this.timeCharacteristic = Preconditions.checkNotNull(characteristic);
if (characteristic == TimeCharacteristic.ProcessingTime) {
getConfig().setAutoWatermarkInterval(0);
} else {
getConfig().setAutoWatermarkInterval(200);
}
} | java | @PublicEvolving
public void setStreamTimeCharacteristic(TimeCharacteristic characteristic) {
this.timeCharacteristic = Preconditions.checkNotNull(characteristic);
if (characteristic == TimeCharacteristic.ProcessingTime) {
getConfig().setAutoWatermarkInterval(0);
} else {
getConfig().setAutoWatermarkInterval(200);
}
} | [
"@",
"PublicEvolving",
"public",
"void",
"setStreamTimeCharacteristic",
"(",
"TimeCharacteristic",
"characteristic",
")",
"{",
"this",
".",
"timeCharacteristic",
"=",
"Preconditions",
".",
"checkNotNull",
"(",
"characteristic",
")",
";",
"if",
"(",
"characteristic",
"... | Sets the time characteristic for all streams create from this environment, e.g., processing
time, event time, or ingestion time.
<p>If you set the characteristic to IngestionTime of EventTime this will set a default
watermark update interval of 200 ms. If this is not applicable for your application
you should change it using {@link ExecutionConfig#setAutoWatermarkInterval(long)}.
@param characteristic The time characteristic. | [
"Sets",
"the",
"time",
"characteristic",
"for",
"all",
"streams",
"create",
"from",
"this",
"environment",
"e",
".",
"g",
".",
"processing",
"time",
"event",
"time",
"or",
"ingestion",
"time",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L637-L645 | train | Sets the stream time characteristic. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
11675,
4520,
25379,
7292,
7507,
22648,
3334,
6553,
1006,
2051,
7507,
22648,
3334,
6553,
8281,
1007,
1063,
2023,
1012,
2051,
7507,
22648,
3334,
6553,
1027,
3653,
8663,
20562,
2015,
1012,
4638,
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-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java | JobGraph.addVertex | public void addVertex(JobVertex vertex) {
final JobVertexID id = vertex.getID();
JobVertex previous = taskVertices.put(id, vertex);
// if we had a prior association, restore and throw an exception
if (previous != null) {
taskVertices.put(id, previous);
throw new IllegalArgumentException("The JobGraph already contains a vertex with that id.");
}
} | java | public void addVertex(JobVertex vertex) {
final JobVertexID id = vertex.getID();
JobVertex previous = taskVertices.put(id, vertex);
// if we had a prior association, restore and throw an exception
if (previous != null) {
taskVertices.put(id, previous);
throw new IllegalArgumentException("The JobGraph already contains a vertex with that id.");
}
} | [
"public",
"void",
"addVertex",
"(",
"JobVertex",
"vertex",
")",
"{",
"final",
"JobVertexID",
"id",
"=",
"vertex",
".",
"getID",
"(",
")",
";",
"JobVertex",
"previous",
"=",
"taskVertices",
".",
"put",
"(",
"id",
",",
"vertex",
")",
";",
"// if we had a pri... | Adds a new task vertex to the job graph if it is not already included.
@param vertex
the new task vertex to be added | [
"Adds",
"a",
"new",
"task",
"vertex",
"to",
"the",
"job",
"graph",
"if",
"it",
"is",
"not",
"already",
"included",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java#L289-L298 | train | Adds a new vertex to the job graph. | [
30522,
2270,
11675,
5587,
16874,
10288,
1006,
3105,
16874,
10288,
19449,
1007,
1063,
2345,
3105,
16874,
10288,
3593,
8909,
1027,
19449,
1012,
2131,
3593,
1006,
1007,
1025,
3105,
16874,
10288,
3025,
1027,
4708,
16874,
23522,
1012,
2404,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java | CsvReader.pojoType | public <T> DataSource<T> pojoType(Class<T> pojoType, String... pojoFields) {
Preconditions.checkNotNull(pojoType, "The POJO type class must not be null.");
Preconditions.checkNotNull(pojoFields, "POJO fields must be specified (not null) if output type is a POJO.");
final TypeInformation<T> ti = TypeExtractor.createTypeInfo(pojoType);
if (!(ti instanceof PojoTypeInfo)) {
throw new IllegalArgumentException(
"The specified class is not a POJO. The type class must meet the POJO requirements. Found: " + ti);
}
final PojoTypeInfo<T> pti = (PojoTypeInfo<T>) ti;
CsvInputFormat<T> inputFormat = new PojoCsvInputFormat<T>(path, this.lineDelimiter, this.fieldDelimiter, pti, pojoFields, this.includedMask);
configureInputFormat(inputFormat);
return new DataSource<T>(executionContext, inputFormat, pti, Utils.getCallLocationName());
} | java | public <T> DataSource<T> pojoType(Class<T> pojoType, String... pojoFields) {
Preconditions.checkNotNull(pojoType, "The POJO type class must not be null.");
Preconditions.checkNotNull(pojoFields, "POJO fields must be specified (not null) if output type is a POJO.");
final TypeInformation<T> ti = TypeExtractor.createTypeInfo(pojoType);
if (!(ti instanceof PojoTypeInfo)) {
throw new IllegalArgumentException(
"The specified class is not a POJO. The type class must meet the POJO requirements. Found: " + ti);
}
final PojoTypeInfo<T> pti = (PojoTypeInfo<T>) ti;
CsvInputFormat<T> inputFormat = new PojoCsvInputFormat<T>(path, this.lineDelimiter, this.fieldDelimiter, pti, pojoFields, this.includedMask);
configureInputFormat(inputFormat);
return new DataSource<T>(executionContext, inputFormat, pti, Utils.getCallLocationName());
} | [
"public",
"<",
"T",
">",
"DataSource",
"<",
"T",
">",
"pojoType",
"(",
"Class",
"<",
"T",
">",
"pojoType",
",",
"String",
"...",
"pojoFields",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"pojoType",
",",
"\"The POJO type class must not be null.\"",
")... | Configures the reader to read the CSV data and parse it to the given type. The all fields of the type
must be public or able to set value. The type information for the fields is obtained from the type class.
@param pojoType The class of the target POJO.
@param pojoFields The fields of the POJO which are mapped to CSV fields.
@return The DataSet representing the parsed CSV data. | [
"Configures",
"the",
"reader",
"to",
"read",
"the",
"CSV",
"data",
"and",
"parse",
"it",
"to",
"the",
"given",
"type",
".",
"The",
"all",
"fields",
"of",
"the",
"type",
"must",
"be",
"public",
"or",
"able",
"to",
"set",
"value",
".",
"The",
"type",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java#L316-L332 | train | Creates a data source that reads CSV data from the specified POJO type. | [
30522,
2270,
1026,
1056,
1028,
2951,
6499,
3126,
3401,
1026,
1056,
1028,
13433,
5558,
13874,
1006,
2465,
1026,
1056,
1028,
13433,
5558,
13874,
1010,
5164,
1012,
1012,
1012,
13433,
5558,
15155,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/SettingLoader.java | SettingLoader.replaceVar | private String replaceVar(String group, String value) {
// 找到所有变量标识
final Set<String> vars = ReUtil.findAll(reg_var, value, 0, new HashSet<String>());
String key;
for (String var : vars) {
key = ReUtil.get(reg_var, var, 1);
if (StrUtil.isNotBlank(key)) {
// 查找变量名对应的值
String varValue = this.groupedMap.get(group, key);
if (null != varValue) {
// 替换标识
value = value.replace(var, varValue);
} else {
// 跨分组查找
final List<String> groupAndKey = StrUtil.split(key, CharUtil.DOT, 2);
if (groupAndKey.size() > 1) {
varValue = this.groupedMap.get(groupAndKey.get(0), groupAndKey.get(1));
if (null != varValue) {
// 替换标识
value = value.replace(var, varValue);
}
}
}
}
}
return value;
} | java | private String replaceVar(String group, String value) {
// 找到所有变量标识
final Set<String> vars = ReUtil.findAll(reg_var, value, 0, new HashSet<String>());
String key;
for (String var : vars) {
key = ReUtil.get(reg_var, var, 1);
if (StrUtil.isNotBlank(key)) {
// 查找变量名对应的值
String varValue = this.groupedMap.get(group, key);
if (null != varValue) {
// 替换标识
value = value.replace(var, varValue);
} else {
// 跨分组查找
final List<String> groupAndKey = StrUtil.split(key, CharUtil.DOT, 2);
if (groupAndKey.size() > 1) {
varValue = this.groupedMap.get(groupAndKey.get(0), groupAndKey.get(1));
if (null != varValue) {
// 替换标识
value = value.replace(var, varValue);
}
}
}
}
}
return value;
} | [
"private",
"String",
"replaceVar",
"(",
"String",
"group",
",",
"String",
"value",
")",
"{",
"// 找到所有变量标识\r",
"final",
"Set",
"<",
"String",
">",
"vars",
"=",
"ReUtil",
".",
"findAll",
"(",
"reg_var",
",",
"value",
",",
"0",
",",
"new",
"HashSet",
"<",
... | 替换给定值中的变量标识
@param group 所在分组
@param value 值
@return 替换后的字符串 | [
"替换给定值中的变量标识"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/SettingLoader.java#L197-L223 | train | Replaces the var in the group with the value. | [
30522,
2797,
5164,
5672,
10755,
1006,
5164,
2177,
1010,
5164,
3643,
1007,
1063,
1013,
1013,
100,
100,
100,
1873,
100,
100,
100,
100,
2345,
2275,
1026,
5164,
1028,
13075,
2015,
1027,
2128,
21823,
2140,
1012,
2424,
8095,
1006,
19723,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierBuffer.java | BarrierBuffer.getNextNonBlocked | @Override
public BufferOrEvent getNextNonBlocked() throws Exception {
while (true) {
// process buffered BufferOrEvents before grabbing new ones
Optional<BufferOrEvent> next;
if (currentBuffered == null) {
next = inputGate.getNextBufferOrEvent();
}
else {
next = Optional.ofNullable(currentBuffered.getNext());
if (!next.isPresent()) {
completeBufferedSequence();
return getNextNonBlocked();
}
}
if (!next.isPresent()) {
if (!endOfStream) {
// end of input stream. stream continues with the buffered data
endOfStream = true;
releaseBlocksAndResetBarriers();
return getNextNonBlocked();
}
else {
// final end of both input and buffered data
return null;
}
}
BufferOrEvent bufferOrEvent = next.get();
if (isBlocked(bufferOrEvent.getChannelIndex())) {
// if the channel is blocked, we just store the BufferOrEvent
bufferBlocker.add(bufferOrEvent);
checkSizeLimit();
}
else if (bufferOrEvent.isBuffer()) {
return bufferOrEvent;
}
else if (bufferOrEvent.getEvent().getClass() == CheckpointBarrier.class) {
if (!endOfStream) {
// process barriers only if there is a chance of the checkpoint completing
processBarrier((CheckpointBarrier) bufferOrEvent.getEvent(), bufferOrEvent.getChannelIndex());
}
}
else if (bufferOrEvent.getEvent().getClass() == CancelCheckpointMarker.class) {
processCancellationBarrier((CancelCheckpointMarker) bufferOrEvent.getEvent());
}
else {
if (bufferOrEvent.getEvent().getClass() == EndOfPartitionEvent.class) {
processEndOfPartition();
}
return bufferOrEvent;
}
}
} | java | @Override
public BufferOrEvent getNextNonBlocked() throws Exception {
while (true) {
// process buffered BufferOrEvents before grabbing new ones
Optional<BufferOrEvent> next;
if (currentBuffered == null) {
next = inputGate.getNextBufferOrEvent();
}
else {
next = Optional.ofNullable(currentBuffered.getNext());
if (!next.isPresent()) {
completeBufferedSequence();
return getNextNonBlocked();
}
}
if (!next.isPresent()) {
if (!endOfStream) {
// end of input stream. stream continues with the buffered data
endOfStream = true;
releaseBlocksAndResetBarriers();
return getNextNonBlocked();
}
else {
// final end of both input and buffered data
return null;
}
}
BufferOrEvent bufferOrEvent = next.get();
if (isBlocked(bufferOrEvent.getChannelIndex())) {
// if the channel is blocked, we just store the BufferOrEvent
bufferBlocker.add(bufferOrEvent);
checkSizeLimit();
}
else if (bufferOrEvent.isBuffer()) {
return bufferOrEvent;
}
else if (bufferOrEvent.getEvent().getClass() == CheckpointBarrier.class) {
if (!endOfStream) {
// process barriers only if there is a chance of the checkpoint completing
processBarrier((CheckpointBarrier) bufferOrEvent.getEvent(), bufferOrEvent.getChannelIndex());
}
}
else if (bufferOrEvent.getEvent().getClass() == CancelCheckpointMarker.class) {
processCancellationBarrier((CancelCheckpointMarker) bufferOrEvent.getEvent());
}
else {
if (bufferOrEvent.getEvent().getClass() == EndOfPartitionEvent.class) {
processEndOfPartition();
}
return bufferOrEvent;
}
}
} | [
"@",
"Override",
"public",
"BufferOrEvent",
"getNextNonBlocked",
"(",
")",
"throws",
"Exception",
"{",
"while",
"(",
"true",
")",
"{",
"// process buffered BufferOrEvents before grabbing new ones",
"Optional",
"<",
"BufferOrEvent",
">",
"next",
";",
"if",
"(",
"curren... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierBuffer.java#L159-L213 | train | This method is used to get the next buffered BufferOrEvent from the input gate. | [
30522,
1030,
2058,
15637,
2270,
17698,
5686,
15338,
2131,
2638,
18413,
8540,
23467,
2098,
1006,
1007,
11618,
6453,
1063,
2096,
1006,
2995,
1007,
1063,
1013,
1013,
2832,
17698,
2098,
17698,
5686,
15338,
2015,
2077,
9775,
2047,
3924,
11887,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/IntervalJoinOperator.java | IntervalJoinOperator.processElement1 | @Override
public void processElement1(StreamRecord<T1> record) throws Exception {
processElement(record, leftBuffer, rightBuffer, lowerBound, upperBound, true);
} | java | @Override
public void processElement1(StreamRecord<T1> record) throws Exception {
processElement(record, leftBuffer, rightBuffer, lowerBound, upperBound, true);
} | [
"@",
"Override",
"public",
"void",
"processElement1",
"(",
"StreamRecord",
"<",
"T1",
">",
"record",
")",
"throws",
"Exception",
"{",
"processElement",
"(",
"record",
",",
"leftBuffer",
",",
"rightBuffer",
",",
"lowerBound",
",",
"upperBound",
",",
"true",
")"... | Process a {@link StreamRecord} from the left stream. Whenever an {@link StreamRecord}
arrives at the left stream, it will get added to the left buffer. Possible join candidates
for that element will be looked up from the right buffer and if the pair lies within the
user defined boundaries, it gets passed to the {@link ProcessJoinFunction}.
@param record An incoming record to be joined
@throws Exception Can throw an Exception during state access | [
"Process",
"a",
"{",
"@link",
"StreamRecord",
"}",
"from",
"the",
"left",
"stream",
".",
"Whenever",
"an",
"{",
"@link",
"StreamRecord",
"}",
"arrives",
"at",
"the",
"left",
"stream",
"it",
"will",
"get",
"added",
"to",
"the",
"left",
"buffer",
".",
"Pos... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/co/IntervalJoinOperator.java#L186-L189 | train | Process a single element. | [
30522,
1030,
2058,
15637,
2270,
11675,
2832,
12260,
3672,
2487,
1006,
5460,
2890,
27108,
2094,
1026,
1056,
2487,
1028,
2501,
1007,
11618,
6453,
1063,
2832,
12260,
3672,
1006,
2501,
1010,
2187,
8569,
12494,
1010,
2157,
8569,
12494,
1010,
289... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java | JSONObject.getString | public String getString(String name) throws JSONException {
Object object = get(name);
String result = JSON.toString(object);
if (result == null) {
throw JSON.typeMismatch(name, object, "String");
}
return result;
} | java | public String getString(String name) throws JSONException {
Object object = get(name);
String result = JSON.toString(object);
if (result == null) {
throw JSON.typeMismatch(name, object, "String");
}
return result;
} | [
"public",
"String",
"getString",
"(",
"String",
"name",
")",
"throws",
"JSONException",
"{",
"Object",
"object",
"=",
"get",
"(",
"name",
")",
";",
"String",
"result",
"=",
"JSON",
".",
"toString",
"(",
"object",
")",
";",
"if",
"(",
"result",
"==",
"n... | Returns the value mapped by {@code name} if it exists, coercing it if necessary.
@param name the name of the property
@return the value
@throws JSONException if no such mapping exists. | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L560-L567 | train | Get the string value for the given name. | [
30522,
2270,
5164,
4152,
18886,
3070,
1006,
5164,
2171,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
4874,
4874,
1027,
2131,
1006,
2171,
1007,
1025,
5164,
2765,
1027,
1046,
3385,
1012,
2000,
3367,
4892,
1006,
4874,
1007,
1025,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java | ThriftHttpCLIService.getHttpPath | private String getHttpPath(String httpPath) {
if(httpPath == null || httpPath.equals("")) {
httpPath = "/*";
}
else {
if(!httpPath.startsWith("/")) {
httpPath = "/" + httpPath;
}
if(httpPath.endsWith("/")) {
httpPath = httpPath + "*";
}
if(!httpPath.endsWith("/*")) {
httpPath = httpPath + "/*";
}
}
return httpPath;
} | java | private String getHttpPath(String httpPath) {
if(httpPath == null || httpPath.equals("")) {
httpPath = "/*";
}
else {
if(!httpPath.startsWith("/")) {
httpPath = "/" + httpPath;
}
if(httpPath.endsWith("/")) {
httpPath = httpPath + "*";
}
if(!httpPath.endsWith("/*")) {
httpPath = httpPath + "/*";
}
}
return httpPath;
} | [
"private",
"String",
"getHttpPath",
"(",
"String",
"httpPath",
")",
"{",
"if",
"(",
"httpPath",
"==",
"null",
"||",
"httpPath",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"httpPath",
"=",
"\"/*\"",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"httpPath",
"... | The config parameter can be like "path", "/path", "/path/", "path/*", "/path1/path2/*" and so on.
httpPath should end up as "/*", "/path/*" or "/path1/../pathN/*"
@param httpPath
@return | [
"The",
"config",
"parameter",
"can",
"be",
"like",
"path",
"/",
"path",
"/",
"path",
"/",
"path",
"/",
"*",
"/",
"path1",
"/",
"path2",
"/",
"*",
"and",
"so",
"on",
".",
"httpPath",
"should",
"end",
"up",
"as",
"/",
"*",
"/",
"path",
"/",
"*",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java#L165-L181 | train | Get the HTTP path. | [
30522,
2797,
5164,
2131,
11039,
25856,
15069,
1006,
5164,
8299,
15069,
1007,
1063,
2065,
1006,
8299,
15069,
1027,
1027,
19701,
1064,
1064,
8299,
15069,
1012,
19635,
1006,
1000,
1000,
1007,
1007,
1063,
8299,
15069,
1027,
1000,
1013,
1008,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java | ExcelUtil.readBySax | public static void readBySax(File file, int sheetIndex, RowHandler rowHandler) {
BufferedInputStream in = null;
try {
in = FileUtil.getInputStream(file);
readBySax(in, sheetIndex, rowHandler);
} finally {
IoUtil.close(in);
}
} | java | public static void readBySax(File file, int sheetIndex, RowHandler rowHandler) {
BufferedInputStream in = null;
try {
in = FileUtil.getInputStream(file);
readBySax(in, sheetIndex, rowHandler);
} finally {
IoUtil.close(in);
}
} | [
"public",
"static",
"void",
"readBySax",
"(",
"File",
"file",
",",
"int",
"sheetIndex",
",",
"RowHandler",
"rowHandler",
")",
"{",
"BufferedInputStream",
"in",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"FileUtil",
".",
"getInputStream",
"(",
"file",
")",
";... | 通过Sax方式读取Excel,同时支持03和07格式
@param file Excel文件
@param sheetIndex sheet序号
@param rowHandler 行处理器
@since 3.2.0 | [
"通过Sax方式读取Excel,同时支持03和07格式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L53-L61 | train | Reads a sequence of bytes from a file using the specified sheet index and row handler. | [
30522,
2270,
10763,
11675,
3191,
3762,
3736,
2595,
1006,
5371,
5371,
1010,
20014,
7123,
22254,
10288,
1010,
5216,
11774,
3917,
5216,
11774,
3917,
1007,
1063,
17698,
2098,
2378,
18780,
21422,
1999,
1027,
19701,
1025,
3046,
1063,
1999,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/SimpleConsumerThread.java | SimpleConsumerThread.requestAndSetOffsetsFromKafka | private static void requestAndSetOffsetsFromKafka(
SimpleConsumer consumer,
List<KafkaTopicPartitionState<TopicAndPartition>> partitionStates,
Map<TopicAndPartition, PartitionOffsetRequestInfo> partitionToRequestInfo) throws IOException {
int retries = 0;
OffsetResponse response;
while (true) {
kafka.javaapi.OffsetRequest request = new kafka.javaapi.OffsetRequest(
partitionToRequestInfo, kafka.api.OffsetRequest.CurrentVersion(), consumer.clientId());
response = consumer.getOffsetsBefore(request);
if (response.hasError()) {
StringBuilder exception = new StringBuilder();
for (KafkaTopicPartitionState<TopicAndPartition> part : partitionStates) {
short code;
if ((code = response.errorCode(part.getTopic(), part.getPartition())) != ErrorMapping.NoError()) {
exception.append("\nException for topic=").append(part.getTopic())
.append(" partition=").append(part.getPartition()).append(": ")
.append(ExceptionUtils.stringifyException(ErrorMapping.exceptionFor(code)));
}
}
if (++retries >= 3) {
throw new IOException("Unable to get last offset for partitions " + partitionStates + ": "
+ exception.toString());
} else {
LOG.warn("Unable to get last offset for partitions: Exception(s): {}", exception);
}
} else {
break; // leave retry loop
}
}
for (KafkaTopicPartitionState<TopicAndPartition> part: partitionStates) {
// there will be offsets only for partitions that were requested for
if (partitionToRequestInfo.containsKey(part.getKafkaPartitionHandle())) {
final long offset = response.offsets(part.getTopic(), part.getPartition())[0];
// the offset returned is that of the next record to fetch. because our state reflects the latest
// successfully emitted record, we subtract one
part.setOffset(offset - 1);
}
}
} | java | private static void requestAndSetOffsetsFromKafka(
SimpleConsumer consumer,
List<KafkaTopicPartitionState<TopicAndPartition>> partitionStates,
Map<TopicAndPartition, PartitionOffsetRequestInfo> partitionToRequestInfo) throws IOException {
int retries = 0;
OffsetResponse response;
while (true) {
kafka.javaapi.OffsetRequest request = new kafka.javaapi.OffsetRequest(
partitionToRequestInfo, kafka.api.OffsetRequest.CurrentVersion(), consumer.clientId());
response = consumer.getOffsetsBefore(request);
if (response.hasError()) {
StringBuilder exception = new StringBuilder();
for (KafkaTopicPartitionState<TopicAndPartition> part : partitionStates) {
short code;
if ((code = response.errorCode(part.getTopic(), part.getPartition())) != ErrorMapping.NoError()) {
exception.append("\nException for topic=").append(part.getTopic())
.append(" partition=").append(part.getPartition()).append(": ")
.append(ExceptionUtils.stringifyException(ErrorMapping.exceptionFor(code)));
}
}
if (++retries >= 3) {
throw new IOException("Unable to get last offset for partitions " + partitionStates + ": "
+ exception.toString());
} else {
LOG.warn("Unable to get last offset for partitions: Exception(s): {}", exception);
}
} else {
break; // leave retry loop
}
}
for (KafkaTopicPartitionState<TopicAndPartition> part: partitionStates) {
// there will be offsets only for partitions that were requested for
if (partitionToRequestInfo.containsKey(part.getKafkaPartitionHandle())) {
final long offset = response.offsets(part.getTopic(), part.getPartition())[0];
// the offset returned is that of the next record to fetch. because our state reflects the latest
// successfully emitted record, we subtract one
part.setOffset(offset - 1);
}
}
} | [
"private",
"static",
"void",
"requestAndSetOffsetsFromKafka",
"(",
"SimpleConsumer",
"consumer",
",",
"List",
"<",
"KafkaTopicPartitionState",
"<",
"TopicAndPartition",
">",
">",
"partitionStates",
",",
"Map",
"<",
"TopicAndPartition",
",",
"PartitionOffsetRequestInfo",
"... | Request offsets from Kafka with a specified set of partition's offset request information.
The returned offsets are used to set the internal partition states.
<p>This method retries three times if the response has an error.
@param consumer The consumer connected to lead broker
@param partitionStates the partition states, will be set with offsets fetched from Kafka request
@param partitionToRequestInfo map of each partition to its offset request info | [
"Request",
"offsets",
"from",
"Kafka",
"with",
"a",
"specified",
"set",
"of",
"partition",
"s",
"offset",
"request",
"information",
".",
"The",
"returned",
"offsets",
"are",
"used",
"to",
"set",
"the",
"internal",
"partition",
"states",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/SimpleConsumerThread.java#L484-L526 | train | This method requests offsets from Kafka for the given partitions and sets the offsets in the partitionToRequestInfo map. | [
30522,
2797,
10763,
11675,
5227,
29560,
18903,
21807,
8454,
19699,
5358,
2912,
24316,
2050,
1006,
3722,
8663,
23545,
2099,
7325,
1010,
2862,
1026,
10556,
24316,
10610,
24330,
19362,
3775,
9285,
12259,
1026,
8476,
5685,
19362,
3775,
3508,
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-log/src/main/java/cn/hutool/log/StaticLog.java | StaticLog.log | public static boolean log(Level level, Throwable t, String format, Object... arguments) {
return log(LogFactory.get(CallerUtil.getCallerCaller()), level, t, format, arguments);
} | java | public static boolean log(Level level, Throwable t, String format, Object... arguments) {
return log(LogFactory.get(CallerUtil.getCallerCaller()), level, t, format, arguments);
} | [
"public",
"static",
"boolean",
"log",
"(",
"Level",
"level",
",",
"Throwable",
"t",
",",
"String",
"format",
",",
"Object",
"...",
"arguments",
")",
"{",
"return",
"log",
"(",
"LogFactory",
".",
"get",
"(",
"CallerUtil",
".",
"getCallerCaller",
"(",
")",
... | 打印日志<br>
@param level 日志级别
@param t 需在日志中堆栈打印的异常
@param format 格式文本,{} 代表变量
@param arguments 变量对应的参数
@return 是否为LocationAwareLog日志 | [
"打印日志<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/StaticLog.java#L223-L225 | train | Log a throwable at the specified level. | [
30522,
2270,
10763,
22017,
20898,
8833,
1006,
2504,
2504,
1010,
5466,
3085,
1056,
1010,
5164,
4289,
1010,
4874,
1012,
1012,
1012,
9918,
1007,
1063,
2709,
8833,
1006,
8833,
21450,
1012,
2131,
1006,
20587,
21823,
2140,
1012,
2131,
9289,
3917,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/typeinfo/Types.java | Types.POJO | public static <T> TypeInformation<T> POJO(Class<T> pojoClass) {
final TypeInformation<T> ti = TypeExtractor.createTypeInfo(pojoClass);
if (ti instanceof PojoTypeInfo) {
return ti;
}
throw new InvalidTypesException("POJO type expected but was: " + ti);
} | java | public static <T> TypeInformation<T> POJO(Class<T> pojoClass) {
final TypeInformation<T> ti = TypeExtractor.createTypeInfo(pojoClass);
if (ti instanceof PojoTypeInfo) {
return ti;
}
throw new InvalidTypesException("POJO type expected but was: " + ti);
} | [
"public",
"static",
"<",
"T",
">",
"TypeInformation",
"<",
"T",
">",
"POJO",
"(",
"Class",
"<",
"T",
">",
"pojoClass",
")",
"{",
"final",
"TypeInformation",
"<",
"T",
">",
"ti",
"=",
"TypeExtractor",
".",
"createTypeInfo",
"(",
"pojoClass",
")",
";",
"... | Returns type information for a POJO (Plain Old Java Object).
<p>A POJO class is public and standalone (no non-static inner class). It has a public no-argument
constructor. All non-static, non-transient fields in the class (and all superclasses) are either public
(and non-final) or have a public getter and a setter method that follows the Java beans naming
conventions for getters and setters.
<p>A POJO is a fixed-length and null-aware composite type. Every field can be null independent
of the field's type.
<p>The generic types for all fields of the POJO can be defined in a hierarchy of subclasses.
<p>If Flink's type analyzer is unable to extract a valid POJO type information with
type information for all fields, an {@link org.apache.flink.api.common.functions.InvalidTypesException}
is thrown. Alternatively, you can use {@link Types#POJO(Class, Map)} to specify all fields manually.
@param pojoClass POJO class to be analyzed by Flink | [
"Returns",
"type",
"information",
"for",
"a",
"POJO",
"(",
"Plain",
"Old",
"Java",
"Object",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java#L281-L287 | train | Returns the POJO type information for the given class. | [
30522,
2270,
10763,
1026,
1056,
1028,
2828,
2378,
14192,
3370,
1026,
1056,
1028,
13433,
5558,
1006,
2465,
1026,
1056,
1028,
13433,
5558,
26266,
1007,
1063,
2345,
2828,
2378,
14192,
3370,
1026,
1056,
1028,
14841,
1027,
2828,
10288,
6494,
167... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java | TypeUtil.getActualTypes | public static Type[] getActualTypes(Type actualType, Class<?> typeDefineClass, Type... typeVariables) {
if (false == typeDefineClass.isAssignableFrom(getClass(actualType))) {
throw new IllegalArgumentException("Parameter [superClass] must be assignable from [clazz]");
}
// 泛型参数标识符列表
final TypeVariable<?>[] typeVars = typeDefineClass.getTypeParameters();
if(ArrayUtil.isEmpty(typeVars)) {
return null;
}
// 实际类型列表
final Type[] actualTypeArguments = TypeUtil.getTypeArguments(actualType);
if(ArrayUtil.isEmpty(actualTypeArguments)) {
return null;
}
int size = Math.min(actualTypeArguments.length, typeVars.length);
final Map<TypeVariable<?>, Type> tableMap = new TableMap<>(typeVars, actualTypeArguments);
// 查找方法定义所在类或接口中此泛型参数的位置
final Type[] result = new Type[size];
for(int i = 0; i < typeVariables.length; i++) {
result[i] = (typeVariables[i] instanceof TypeVariable) ? tableMap.get(typeVariables[i]) : typeVariables[i];
}
return result;
} | java | public static Type[] getActualTypes(Type actualType, Class<?> typeDefineClass, Type... typeVariables) {
if (false == typeDefineClass.isAssignableFrom(getClass(actualType))) {
throw new IllegalArgumentException("Parameter [superClass] must be assignable from [clazz]");
}
// 泛型参数标识符列表
final TypeVariable<?>[] typeVars = typeDefineClass.getTypeParameters();
if(ArrayUtil.isEmpty(typeVars)) {
return null;
}
// 实际类型列表
final Type[] actualTypeArguments = TypeUtil.getTypeArguments(actualType);
if(ArrayUtil.isEmpty(actualTypeArguments)) {
return null;
}
int size = Math.min(actualTypeArguments.length, typeVars.length);
final Map<TypeVariable<?>, Type> tableMap = new TableMap<>(typeVars, actualTypeArguments);
// 查找方法定义所在类或接口中此泛型参数的位置
final Type[] result = new Type[size];
for(int i = 0; i < typeVariables.length; i++) {
result[i] = (typeVariables[i] instanceof TypeVariable) ? tableMap.get(typeVariables[i]) : typeVariables[i];
}
return result;
} | [
"public",
"static",
"Type",
"[",
"]",
"getActualTypes",
"(",
"Type",
"actualType",
",",
"Class",
"<",
"?",
">",
"typeDefineClass",
",",
"Type",
"...",
"typeVariables",
")",
"{",
"if",
"(",
"false",
"==",
"typeDefineClass",
".",
"isAssignableFrom",
"(",
"getC... | 获取指定泛型变量对应的真实类型<br>
由于子类中泛型参数实现和父类(接口)中泛型定义位置是一一对应的,因此可以通过对应关系找到泛型实现类型<br>
使用此方法注意:
<pre>
1. superClass必须是clazz的父类或者clazz实现的接口
2. typeVariable必须在superClass中声明
</pre>
@param actualType 真实类型所在类,此类中记录了泛型参数对应的实际类型
@param typeDefineClass 泛型变量声明所在类或接口,此类中定义了泛型类型
@param typeVariables 泛型变量,需要的实际类型对应的泛型参数
@return 给定泛型参数对应的实际类型,如果无对应类型,返回null
@since 4.5.7 | [
"获取指定泛型变量对应的真实类型<br",
">",
"由于子类中泛型参数实现和父类(接口)中泛型定义位置是一一对应的,因此可以通过对应关系找到泛型实现类型<br",
">",
"使用此方法注意:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java#L281-L306 | train | Gets the actual types. | [
30522,
2270,
10763,
2828,
1031,
1033,
2131,
18908,
8787,
13874,
2015,
1006,
2828,
5025,
13874,
1010,
2465,
1026,
1029,
1028,
21189,
12879,
3170,
26266,
1010,
2828,
1012,
1012,
1012,
2828,
10755,
19210,
2015,
1007,
1063,
2065,
1006,
6270,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/phrase/MutualInformationEntropyPhraseExtractor.java | MutualInformationEntropyPhraseExtractor.extract | public static List<String> extract(String text, int size)
{
IPhraseExtractor extractor = new MutualInformationEntropyPhraseExtractor();
return extractor.extractPhrase(text, size);
} | java | public static List<String> extract(String text, int size)
{
IPhraseExtractor extractor = new MutualInformationEntropyPhraseExtractor();
return extractor.extractPhrase(text, size);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"extract",
"(",
"String",
"text",
",",
"int",
"size",
")",
"{",
"IPhraseExtractor",
"extractor",
"=",
"new",
"MutualInformationEntropyPhraseExtractor",
"(",
")",
";",
"return",
"extractor",
".",
"extractPhrase",
"(... | 一句话提取
@param text
@param size
@return | [
"一句话提取"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/phrase/MutualInformationEntropyPhraseExtractor.java#L101-L105 | train | Extract a list of strings from a text string. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
14817,
1006,
5164,
3793,
1010,
20014,
2946,
1007,
1063,
12997,
13492,
19763,
18413,
22648,
4263,
14817,
2953,
1027,
2047,
8203,
2378,
14192,
3370,
4765,
18981,
22571,
13492,
19763,
18413,
22648,
426... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.fillBeanWithMapIgnoreCase | public static <T> T fillBeanWithMapIgnoreCase(Map<?, ?> map, T bean, boolean isIgnoreError) {
return fillBeanWithMap(map, bean, CopyOptions.create().setIgnoreCase(true).setIgnoreError(isIgnoreError));
} | java | public static <T> T fillBeanWithMapIgnoreCase(Map<?, ?> map, T bean, boolean isIgnoreError) {
return fillBeanWithMap(map, bean, CopyOptions.create().setIgnoreCase(true).setIgnoreError(isIgnoreError));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"fillBeanWithMapIgnoreCase",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"T",
"bean",
",",
"boolean",
"isIgnoreError",
")",
"{",
"return",
"fillBeanWithMap",
"(",
"map",
",",
"bean",
",",
"CopyOptions",
".",
... | 使用Map填充Bean对象,忽略大小写
@param <T> Bean类型
@param map Map
@param bean Bean
@param isIgnoreError 是否忽略注入错误
@return Bean | [
"使用Map填充Bean对象,忽略大小写"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L395-L397 | train | Fill bean with map ignoring error. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
6039,
4783,
2319,
24415,
2863,
8197,
26745,
2890,
18382,
1006,
4949,
1026,
1029,
1010,
1029,
1028,
4949,
1010,
1056,
14068,
1010,
22017,
20898,
2003,
23773,
5686,
2121,
29165,
1007,
1063,
2709,
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/incubator-shardingsphere | sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/SQLRewriteEngine.java | SQLRewriteEngine.generateSQL | public SQLUnit generateSQL(final TableUnit tableUnit, final SQLBuilder sqlBuilder, final ShardingDataSourceMetaData shardingDataSourceMetaData) {
return sqlBuilder.toSQL(tableUnit, getTableTokens(tableUnit), shardingRule, shardingDataSourceMetaData);
} | java | public SQLUnit generateSQL(final TableUnit tableUnit, final SQLBuilder sqlBuilder, final ShardingDataSourceMetaData shardingDataSourceMetaData) {
return sqlBuilder.toSQL(tableUnit, getTableTokens(tableUnit), shardingRule, shardingDataSourceMetaData);
} | [
"public",
"SQLUnit",
"generateSQL",
"(",
"final",
"TableUnit",
"tableUnit",
",",
"final",
"SQLBuilder",
"sqlBuilder",
",",
"final",
"ShardingDataSourceMetaData",
"shardingDataSourceMetaData",
")",
"{",
"return",
"sqlBuilder",
".",
"toSQL",
"(",
"tableUnit",
",",
"getT... | Generate SQL string.
@param tableUnit route table unit
@param sqlBuilder SQL builder
@param shardingDataSourceMetaData sharding data source meta data
@return SQL unit | [
"Generate",
"SQL",
"string",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/SQLRewriteEngine.java#L514-L516 | train | Generate SQL. | [
30522,
2270,
29296,
19496,
2102,
19421,
4160,
2140,
1006,
2345,
2795,
19496,
2102,
2795,
19496,
2102,
1010,
2345,
29296,
8569,
23891,
2099,
29296,
8569,
23891,
2099,
1010,
2345,
21146,
17080,
3070,
2850,
10230,
8162,
3401,
11368,
8447,
2696,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.dumpConfiguration | public static void dumpConfiguration(Configuration config,
Writer out) throws IOException {
JsonFactory dumpFactory = new JsonFactory();
JsonGenerator dumpGenerator = dumpFactory.createGenerator(out);
dumpGenerator.writeStartObject();
dumpGenerator.writeFieldName("properties");
dumpGenerator.writeStartArray();
dumpGenerator.flush();
ConfigRedactor redactor = new ConfigRedactor(config);
synchronized (config) {
for (Map.Entry<Object,Object> item: config.getProps().entrySet()) {
appendJSONProperty(dumpGenerator, config, item.getKey().toString(),
redactor);
}
}
dumpGenerator.writeEndArray();
dumpGenerator.writeEndObject();
dumpGenerator.flush();
} | java | public static void dumpConfiguration(Configuration config,
Writer out) throws IOException {
JsonFactory dumpFactory = new JsonFactory();
JsonGenerator dumpGenerator = dumpFactory.createGenerator(out);
dumpGenerator.writeStartObject();
dumpGenerator.writeFieldName("properties");
dumpGenerator.writeStartArray();
dumpGenerator.flush();
ConfigRedactor redactor = new ConfigRedactor(config);
synchronized (config) {
for (Map.Entry<Object,Object> item: config.getProps().entrySet()) {
appendJSONProperty(dumpGenerator, config, item.getKey().toString(),
redactor);
}
}
dumpGenerator.writeEndArray();
dumpGenerator.writeEndObject();
dumpGenerator.flush();
} | [
"public",
"static",
"void",
"dumpConfiguration",
"(",
"Configuration",
"config",
",",
"Writer",
"out",
")",
"throws",
"IOException",
"{",
"JsonFactory",
"dumpFactory",
"=",
"new",
"JsonFactory",
"(",
")",
";",
"JsonGenerator",
"dumpGenerator",
"=",
"dumpFactory",
... | Writes out all properties and their attributes (final and resource) to
the given {@link Writer}, the format of the output would be,
<pre>
{ "properties" :
[ { key : "key1",
value : "value1",
isFinal : "key1.isFinal",
resource : "key1.resource" },
{ key : "key2",
value : "value2",
isFinal : "ke2.isFinal",
resource : "key2.resource" }
]
}
</pre>
It does not output the properties of the configuration object which
is loaded from an input stream.
<p>
@param config the configuration
@param out the Writer to write to
@throws IOException | [
"Writes",
"out",
"all",
"properties",
"and",
"their",
"attributes",
"(",
"final",
"and",
"resource",
")",
"to",
"the",
"given",
"{",
"@link",
"Writer",
"}",
"the",
"format",
"of",
"the",
"output",
"would",
"be"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L3324-L3342 | train | Dumps the configuration to the given writer. | [
30522,
2270,
10763,
11675,
15653,
8663,
8873,
27390,
3370,
1006,
9563,
9530,
8873,
2290,
1010,
3213,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
1046,
3385,
21450,
15653,
21450,
1027,
2047,
1046,
3385,
21450,
1006,
1007,
1025,
1046,
3385,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/OpenSslSessionContext.java | OpenSslSessionContext.setTicketKeys | @Deprecated
public void setTicketKeys(byte[] keys) {
if (keys.length % SessionTicketKey.TICKET_KEY_SIZE != 0) {
throw new IllegalArgumentException("keys.length % " + SessionTicketKey.TICKET_KEY_SIZE + " != 0");
}
SessionTicketKey[] tickets = new SessionTicketKey[keys.length / SessionTicketKey.TICKET_KEY_SIZE];
for (int i = 0, a = 0; i < tickets.length; i++) {
byte[] name = Arrays.copyOfRange(keys, a, SessionTicketKey.NAME_SIZE);
a += SessionTicketKey.NAME_SIZE;
byte[] hmacKey = Arrays.copyOfRange(keys, a, SessionTicketKey.HMAC_KEY_SIZE);
i += SessionTicketKey.HMAC_KEY_SIZE;
byte[] aesKey = Arrays.copyOfRange(keys, a, SessionTicketKey.AES_KEY_SIZE);
a += SessionTicketKey.AES_KEY_SIZE;
tickets[i] = new SessionTicketKey(name, hmacKey, aesKey);
}
Lock writerLock = context.ctxLock.writeLock();
writerLock.lock();
try {
SSLContext.clearOptions(context.ctx, SSL.SSL_OP_NO_TICKET);
SSLContext.setSessionTicketKeys(context.ctx, tickets);
} finally {
writerLock.unlock();
}
} | java | @Deprecated
public void setTicketKeys(byte[] keys) {
if (keys.length % SessionTicketKey.TICKET_KEY_SIZE != 0) {
throw new IllegalArgumentException("keys.length % " + SessionTicketKey.TICKET_KEY_SIZE + " != 0");
}
SessionTicketKey[] tickets = new SessionTicketKey[keys.length / SessionTicketKey.TICKET_KEY_SIZE];
for (int i = 0, a = 0; i < tickets.length; i++) {
byte[] name = Arrays.copyOfRange(keys, a, SessionTicketKey.NAME_SIZE);
a += SessionTicketKey.NAME_SIZE;
byte[] hmacKey = Arrays.copyOfRange(keys, a, SessionTicketKey.HMAC_KEY_SIZE);
i += SessionTicketKey.HMAC_KEY_SIZE;
byte[] aesKey = Arrays.copyOfRange(keys, a, SessionTicketKey.AES_KEY_SIZE);
a += SessionTicketKey.AES_KEY_SIZE;
tickets[i] = new SessionTicketKey(name, hmacKey, aesKey);
}
Lock writerLock = context.ctxLock.writeLock();
writerLock.lock();
try {
SSLContext.clearOptions(context.ctx, SSL.SSL_OP_NO_TICKET);
SSLContext.setSessionTicketKeys(context.ctx, tickets);
} finally {
writerLock.unlock();
}
} | [
"@",
"Deprecated",
"public",
"void",
"setTicketKeys",
"(",
"byte",
"[",
"]",
"keys",
")",
"{",
"if",
"(",
"keys",
".",
"length",
"%",
"SessionTicketKey",
".",
"TICKET_KEY_SIZE",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"keys.le... | Sets the SSL session ticket keys of this context.
@deprecated use {@link #setTicketKeys(OpenSslSessionTicketKey...)}. | [
"Sets",
"the",
"SSL",
"session",
"ticket",
"keys",
"of",
"this",
"context",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionContext.java#L72-L95 | train | Set the ticket keys. | [
30522,
1030,
2139,
28139,
12921,
2270,
11675,
2275,
26348,
3388,
14839,
2015,
1006,
24880,
1031,
1033,
6309,
1007,
1063,
2065,
1006,
6309,
1012,
3091,
1003,
5219,
26348,
3388,
14839,
1012,
7281,
1035,
3145,
1035,
2946,
999,
1027,
1014,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java | WatchUtil.createModify | public static WatchMonitor createModify(File file, int maxDepth, Watcher watcher) {
return createModify(file.toPath(), 0, watcher);
} | java | public static WatchMonitor createModify(File file, int maxDepth, Watcher watcher) {
return createModify(file.toPath(), 0, watcher);
} | [
"public",
"static",
"WatchMonitor",
"createModify",
"(",
"File",
"file",
",",
"int",
"maxDepth",
",",
"Watcher",
"watcher",
")",
"{",
"return",
"createModify",
"(",
"file",
".",
"toPath",
"(",
")",
",",
"0",
",",
"watcher",
")",
";",
"}"
] | 创建并初始化监听,监听修改事件
@param file 被监听文件
@param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录
@param watcher {@link Watcher}
@return {@link WatchMonitor}
@since 4.5.2 | [
"创建并初始化监听,监听修改事件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java#L325-L327 | train | Creates a watch monitor that will modify the given file. | [
30522,
2270,
10763,
3422,
8202,
15660,
3443,
5302,
4305,
12031,
1006,
5371,
5371,
1010,
20014,
4098,
3207,
13876,
2232,
1010,
3422,
2121,
3422,
2121,
1007,
1063,
2709,
3443,
5302,
4305,
12031,
1006,
5371,
1012,
2327,
8988,
1006,
1007,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.