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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/spark | common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java | ExternalShuffleBlockResolver.createNormalizedInternedPathname | @VisibleForTesting
static String createNormalizedInternedPathname(String dir1, String dir2, String fname) {
String pathname = dir1 + File.separator + dir2 + File.separator + fname;
Matcher m = MULTIPLE_SEPARATORS.matcher(pathname);
pathname = m.replaceAll("/");
// A single trailing slash needs to be taken care of separately
if (pathname.length() > 1 && pathname.endsWith("/")) {
pathname = pathname.substring(0, pathname.length() - 1);
}
return pathname.intern();
} | java | @VisibleForTesting
static String createNormalizedInternedPathname(String dir1, String dir2, String fname) {
String pathname = dir1 + File.separator + dir2 + File.separator + fname;
Matcher m = MULTIPLE_SEPARATORS.matcher(pathname);
pathname = m.replaceAll("/");
// A single trailing slash needs to be taken care of separately
if (pathname.length() > 1 && pathname.endsWith("/")) {
pathname = pathname.substring(0, pathname.length() - 1);
}
return pathname.intern();
} | [
"@",
"VisibleForTesting",
"static",
"String",
"createNormalizedInternedPathname",
"(",
"String",
"dir1",
",",
"String",
"dir2",
",",
"String",
"fname",
")",
"{",
"String",
"pathname",
"=",
"dir1",
"+",
"File",
".",
"separator",
"+",
"dir2",
"+",
"File",
".",
... | This method is needed to avoid the situation when multiple File instances for the
same pathname "foo/bar" are created, each with a separate copy of the "foo/bar" String.
According to measurements, in some scenarios such duplicate strings may waste a lot
of memory (~ 10% of the heap). To avoid that, we intern the pathname, and before that
we make sure that it's in a normalized form (contains no "//", "///" etc.) Otherwise,
the internal code in java.io.File would normalize it later, creating a new "foo/bar"
String copy. Unfortunately, we cannot just reuse the normalization code that java.io.File
uses, since it is in the package-private class java.io.FileSystem. | [
"This",
"method",
"is",
"needed",
"to",
"avoid",
"the",
"situation",
"when",
"multiple",
"File",
"instances",
"for",
"the",
"same",
"pathname",
"foo",
"/",
"bar",
"are",
"created",
"each",
"with",
"a",
"separate",
"copy",
"of",
"the",
"foo",
"/",
"bar",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java#L334-L344 | train | Create an interned path name from two directories. | [
30522,
1030,
5710,
13028,
4355,
2075,
10763,
5164,
3443,
12131,
9067,
3550,
18447,
11795,
2098,
15069,
18442,
1006,
5164,
16101,
2487,
1010,
5164,
16101,
2475,
1010,
5164,
1042,
18442,
1007,
1063,
5164,
4130,
18442,
1027,
16101,
2487,
1009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java | WebSocketClientHandshakerFactory.newHandshaker | public static WebSocketClientHandshaker newHandshaker(
URI webSocketURL, WebSocketVersion version, String subprotocol,
boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) {
return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders,
maxFramePayloadLength, true, false);
} | java | public static WebSocketClientHandshaker newHandshaker(
URI webSocketURL, WebSocketVersion version, String subprotocol,
boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) {
return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders,
maxFramePayloadLength, true, false);
} | [
"public",
"static",
"WebSocketClientHandshaker",
"newHandshaker",
"(",
"URI",
"webSocketURL",
",",
"WebSocketVersion",
"version",
",",
"String",
"subprotocol",
",",
"boolean",
"allowExtensions",
",",
"HttpHeaders",
"customHeaders",
",",
"int",
"maxFramePayloadLength",
")"... | Creates a new handshaker.
@param webSocketURL
URL for web socket communications. e.g "ws://myhost.com/mypath".
Subsequent web socket frames will be sent to this URL.
@param version
Version of web socket specification to use to connect to the server
@param subprotocol
Sub protocol request sent to the server. Null if no sub-protocol support is required.
@param allowExtensions
Allow extensions to be used in the reserved bits of the web socket frame
@param customHeaders
Custom HTTP headers to send during the handshake
@param maxFramePayloadLength
Maximum allowable frame payload length. Setting this value to your application's
requirement may reduce denial of service attacks using long data frames. | [
"Creates",
"a",
"new",
"handshaker",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java#L74-L79 | train | Create a new handshaker. | [
30522,
2270,
10763,
4773,
6499,
19869,
13535,
8751,
3372,
11774,
7377,
5484,
2047,
11774,
7377,
5484,
1006,
24471,
2072,
4773,
6499,
19869,
20689,
2140,
1010,
4773,
6499,
19869,
9189,
2545,
3258,
2544,
1010,
5164,
4942,
21572,
3406,
25778,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/TransitionSystem.java | TransitionSystem.transit | void transit(State source, Action act, State target)
{
int deprel = 0;
int[] deprel_inference = new int[]{deprel};
if (ActionUtils.is_shift(act))
{
target.shift(source);
}
else if (ActionUtils.is_left_arc(act, deprel_inference))
{
deprel = deprel_inference[0];
target.left_arc(source, deprel);
}
else if (ActionUtils.is_right_arc(act, deprel_inference))
{
deprel = deprel_inference[0];
target.right_arc(source, deprel);
}
else
{
System.err.printf("unknown transition in transit: %d-%d", act.name(), act.rel());
}
} | java | void transit(State source, Action act, State target)
{
int deprel = 0;
int[] deprel_inference = new int[]{deprel};
if (ActionUtils.is_shift(act))
{
target.shift(source);
}
else if (ActionUtils.is_left_arc(act, deprel_inference))
{
deprel = deprel_inference[0];
target.left_arc(source, deprel);
}
else if (ActionUtils.is_right_arc(act, deprel_inference))
{
deprel = deprel_inference[0];
target.right_arc(source, deprel);
}
else
{
System.err.printf("unknown transition in transit: %d-%d", act.name(), act.rel());
}
} | [
"void",
"transit",
"(",
"State",
"source",
",",
"Action",
"act",
",",
"State",
"target",
")",
"{",
"int",
"deprel",
"=",
"0",
";",
"int",
"[",
"]",
"deprel_inference",
"=",
"new",
"int",
"[",
"]",
"{",
"deprel",
"}",
";",
"if",
"(",
"ActionUtils",
... | 转移状态
@param source 源状态
@param act 动作
@param target 目标状态 | [
"转移状态"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/TransitionSystem.java#L109-L131 | train | Transit method. | [
30522,
11675,
6671,
1006,
2110,
3120,
1010,
2895,
2552,
1010,
2110,
4539,
1007,
1063,
20014,
2139,
28139,
2140,
1027,
1014,
1025,
20014,
1031,
1033,
2139,
28139,
2140,
1035,
28937,
1027,
2047,
20014,
1031,
1033,
1063,
2139,
28139,
2140,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-socket/src/main/java/cn/hutool/socket/aio/AioServer.java | AioServer.setOption | public <T> AioServer setOption(SocketOption<T> name, T value) throws IOException {
this.channel.setOption(name, value);
return this;
} | java | public <T> AioServer setOption(SocketOption<T> name, T value) throws IOException {
this.channel.setOption(name, value);
return this;
} | [
"public",
"<",
"T",
">",
"AioServer",
"setOption",
"(",
"SocketOption",
"<",
"T",
">",
"name",
",",
"T",
"value",
")",
"throws",
"IOException",
"{",
"this",
".",
"channel",
".",
"setOption",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
... | 设置 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/AioServer.java#L95-L98 | train | Sets a socket option. | [
30522,
2270,
1026,
1056,
1028,
9932,
9232,
2099,
6299,
2275,
7361,
3508,
1006,
22278,
7361,
3508,
1026,
1056,
1028,
2171,
1010,
1056,
3643,
1007,
11618,
22834,
10288,
24422,
1063,
2023,
1012,
3149,
1012,
2275,
7361,
3508,
1006,
2171,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/utility/TextUtility.java | TextUtility.exceptionToString | public static String exceptionToString(Exception e)
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
return sw.toString();
} | java | public static String exceptionToString(Exception e)
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
return sw.toString();
} | [
"public",
"static",
"String",
"exceptionToString",
"(",
"Exception",
"e",
")",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"pw",
"=",
"new",
"PrintWriter",
"(",
"sw",
")",
";",
"e",
".",
"printStackTrace",
"(",
"pw"... | 将异常转为字符串
@param e
@return | [
"将异常转为字符串"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/TextUtility.java#L572-L578 | train | This method is used to get a string representation of an exception. | [
30522,
2270,
10763,
5164,
6453,
13122,
18886,
3070,
1006,
6453,
1041,
1007,
1063,
5164,
15994,
25430,
1027,
2047,
5164,
15994,
1006,
1007,
1025,
6140,
15994,
1052,
2860,
1027,
2047,
6140,
15994,
1006,
25430,
1007,
1025,
1041,
1012,
11204,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java | AbstractFetcher.addDiscoveredPartitions | public void addDiscoveredPartitions(List<KafkaTopicPartition> newPartitions) throws IOException, ClassNotFoundException {
List<KafkaTopicPartitionState<KPH>> newPartitionStates = createPartitionStateHolders(
newPartitions,
KafkaTopicPartitionStateSentinel.EARLIEST_OFFSET,
timestampWatermarkMode,
watermarksPeriodic,
watermarksPunctuated,
userCodeClassLoader);
if (useMetrics) {
registerOffsetMetrics(consumerMetricGroup, newPartitionStates);
}
for (KafkaTopicPartitionState<KPH> newPartitionState : newPartitionStates) {
// the ordering is crucial here; first register the state holder, then
// push it to the partitions queue to be read
subscribedPartitionStates.add(newPartitionState);
unassignedPartitionsQueue.add(newPartitionState);
}
} | java | public void addDiscoveredPartitions(List<KafkaTopicPartition> newPartitions) throws IOException, ClassNotFoundException {
List<KafkaTopicPartitionState<KPH>> newPartitionStates = createPartitionStateHolders(
newPartitions,
KafkaTopicPartitionStateSentinel.EARLIEST_OFFSET,
timestampWatermarkMode,
watermarksPeriodic,
watermarksPunctuated,
userCodeClassLoader);
if (useMetrics) {
registerOffsetMetrics(consumerMetricGroup, newPartitionStates);
}
for (KafkaTopicPartitionState<KPH> newPartitionState : newPartitionStates) {
// the ordering is crucial here; first register the state holder, then
// push it to the partitions queue to be read
subscribedPartitionStates.add(newPartitionState);
unassignedPartitionsQueue.add(newPartitionState);
}
} | [
"public",
"void",
"addDiscoveredPartitions",
"(",
"List",
"<",
"KafkaTopicPartition",
">",
"newPartitions",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"List",
"<",
"KafkaTopicPartitionState",
"<",
"KPH",
">>",
"newPartitionStates",
"=",
"createPar... | Adds a list of newly discovered partitions to the fetcher for consuming.
<p>This method creates the partition state holder for each new partition, using
{@link KafkaTopicPartitionStateSentinel#EARLIEST_OFFSET} as the starting offset.
It uses the earliest offset because there may be delay in discovering a partition
after it was created and started receiving records.
<p>After the state representation for a partition is created, it is added to the
unassigned partitions queue to await to be consumed.
@param newPartitions discovered partitions to add | [
"Adds",
"a",
"list",
"of",
"newly",
"discovered",
"partitions",
"to",
"the",
"fetcher",
"for",
"consuming",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java#L229-L248 | train | Add discovered partitions to the partition state holder list. | [
30522,
2270,
11675,
5587,
10521,
3597,
25896,
19362,
3775,
9285,
1006,
2862,
1026,
10556,
24316,
10610,
24330,
19362,
3775,
3508,
1028,
2047,
19362,
3775,
9285,
1007,
11618,
22834,
10288,
24422,
1010,
2465,
17048,
14876,
8630,
10288,
24422,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java | HashCodeBuilder.reflectionHashCode | public static int reflectionHashCode(final Object object, final String... excludeFields) {
return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object, false,
null, excludeFields);
} | java | public static int reflectionHashCode(final Object object, final String... excludeFields) {
return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object, false,
null, excludeFields);
} | [
"public",
"static",
"int",
"reflectionHashCode",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"...",
"excludeFields",
")",
"{",
"return",
"reflectionHashCode",
"(",
"DEFAULT_INITIAL_VALUE",
",",
"DEFAULT_MULTIPLIER_VALUE",
",",
"object",
",",
"false",
"... | <p>
Uses reflection to build a valid hash code from the fields of {@code object}.
</p>
<p>
This constructor uses two hard coded choices for the constants needed to build a hash code.
</p>
<p>
It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
also not as efficient as testing explicitly.
</p>
<p>
Transient members will be not be used, as they are likely derived fields, and not part of the value of the
<code>Object</code>.
</p>
<p>
Static fields will not be tested. Superclass fields will be included. If no fields are found to include
in the hash code, the result of this method will be constant.
</p>
@param object
the Object to create a <code>hashCode</code> for
@param excludeFields
array of field names to exclude from use in calculation of hash code
@return int hash code
@throws IllegalArgumentException
if the object is <code>null</code> | [
"<p",
">",
"Uses",
"reflection",
"to",
"build",
"a",
"valid",
"hash",
"code",
"from",
"the",
"fields",
"of",
"{",
"@code",
"object",
"}",
".",
"<",
"/",
"p",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java#L457-L460 | train | Get the hashCode of the given object using reflection. | [
30522,
2270,
10763,
20014,
9185,
14949,
16257,
10244,
1006,
2345,
4874,
4874,
1010,
2345,
5164,
1012,
1012,
1012,
23329,
15155,
1007,
1063,
2709,
9185,
14949,
16257,
10244,
1006,
12398,
1035,
3988,
1035,
3643,
1010,
12398,
1035,
4800,
24759,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/gen/java/org/apache/hive/service/cli/thrift/TGetDelegationTokenReq.java | TGetDelegationTokenReq.isSet | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case SESSION_HANDLE:
return isSetSessionHandle();
case OWNER:
return isSetOwner();
case RENEWER:
return isSetRenewer();
}
throw new IllegalStateException();
} | java | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case SESSION_HANDLE:
return isSetSessionHandle();
case OWNER:
return isSetOwner();
case RENEWER:
return isSetRenewer();
}
throw new IllegalStateException();
} | [
"public",
"boolean",
"isSet",
"(",
"_Fields",
"field",
")",
"{",
"if",
"(",
"field",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"switch",
"(",
"field",
")",
"{",
"case",
"SESSION_HANDLE",
":",
"return",
"isSet... | Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise | [
"Returns",
"true",
"if",
"field",
"corresponding",
"to",
"fieldID",
"is",
"set",
"(",
"has",
"been",
"assigned",
"a",
"value",
")",
"and",
"false",
"otherwise"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TGetDelegationTokenReq.java#L283-L297 | train | Checks if field is set to a value of a CRAS_CTYPE object. | [
30522,
2270,
22017,
20898,
26354,
3388,
1006,
1035,
4249,
2492,
1007,
1063,
2065,
1006,
2492,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1007,
1025,
1065,
6942,
1006,
2492,
1007,
1063,
2553,
5219... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java | DoubleArrayTrie.parseText | public void parseText(String text, AhoCorasickDoubleArrayTrie.IHit<V> processor)
{
Searcher searcher = getSearcher(text, 0);
while (searcher.next())
{
processor.hit(searcher.begin, searcher.begin + searcher.length, searcher.value);
}
} | java | public void parseText(String text, AhoCorasickDoubleArrayTrie.IHit<V> processor)
{
Searcher searcher = getSearcher(text, 0);
while (searcher.next())
{
processor.hit(searcher.begin, searcher.begin + searcher.length, searcher.value);
}
} | [
"public",
"void",
"parseText",
"(",
"String",
"text",
",",
"AhoCorasickDoubleArrayTrie",
".",
"IHit",
"<",
"V",
">",
"processor",
")",
"{",
"Searcher",
"searcher",
"=",
"getSearcher",
"(",
"text",
",",
"0",
")",
";",
"while",
"(",
"searcher",
".",
"next",
... | 全切分
@param text 文本
@param processor 处理器 | [
"全切分"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L1347-L1354 | train | Parse a sequence of tokens from a text string. | [
30522,
2270,
11675,
11968,
13462,
10288,
2102,
1006,
5164,
3793,
1010,
6289,
24163,
8180,
6799,
26797,
3468,
2906,
9447,
18886,
2063,
1012,
1045,
16584,
1026,
1058,
1028,
13151,
1007,
1063,
3945,
2121,
3945,
2121,
1027,
4152,
14644,
7474,
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 | client/src/main/java/com/networknt/client/oauth/ClientRequestComposerProvider.java | ClientRequestComposerProvider.getComposer | public IClientRequestComposable getComposer(ClientRequestComposers composerName) {
IClientRequestComposable composer = composersMap.get(composerName);
if(composer == null) {
initDefaultComposer(composerName);
}
return composersMap.get(composerName);
} | java | public IClientRequestComposable getComposer(ClientRequestComposers composerName) {
IClientRequestComposable composer = composersMap.get(composerName);
if(composer == null) {
initDefaultComposer(composerName);
}
return composersMap.get(composerName);
} | [
"public",
"IClientRequestComposable",
"getComposer",
"(",
"ClientRequestComposers",
"composerName",
")",
"{",
"IClientRequestComposable",
"composer",
"=",
"composersMap",
".",
"get",
"(",
"composerName",
")",
";",
"if",
"(",
"composer",
"==",
"null",
")",
"{",
"init... | get IClientRequestComposable based on ClientRequestComposers composer name
@param composerName
@return IClientRequestComposable composer | [
"get",
"IClientRequestComposable",
"based",
"on",
"ClientRequestComposers",
"composer",
"name"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/ClientRequestComposerProvider.java#L41-L47 | train | Gets a client request composer by name. | [
30522,
2270,
24582,
8751,
3372,
2890,
15500,
9006,
6873,
19150,
2131,
9006,
20688,
2099,
1006,
7396,
2890,
15500,
9006,
20688,
2869,
4543,
18442,
1007,
1063,
24582,
8751,
3372,
2890,
15500,
9006,
6873,
19150,
4543,
1027,
9929,
2863,
2361,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.get | @SuppressWarnings("unchecked")
public static <T> T get(Object array, int index) {
if(null == array) {
return null;
}
if (index < 0) {
index += Array.getLength(array);
}
try {
return (T) Array.get(array, index);
} catch (ArrayIndexOutOfBoundsException e) {
return null;
}
} | java | @SuppressWarnings("unchecked")
public static <T> T get(Object array, int index) {
if(null == array) {
return null;
}
if (index < 0) {
index += Array.getLength(array);
}
try {
return (T) Array.get(array, index);
} catch (ArrayIndexOutOfBoundsException e) {
return null;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"get",
"(",
"Object",
"array",
",",
"int",
"index",
")",
"{",
"if",
"(",
"null",
"==",
"array",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"index",
"<... | 获取数组对象中指定index的值,支持负数,例如-1表示倒数第一个值<br>
如果数组下标越界,返回null
@param <T> 数组元素类型
@param array 数组对象
@param index 下标,支持负数
@return 值
@since 4.0.6 | [
"获取数组对象中指定index的值,支持负数,例如",
"-",
"1表示倒数第一个值<br",
">",
"如果数组下标越界,返回null"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L1810-L1824 | train | Returns the object at the specified index in the array or null if the array is null. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
1056,
2131,
1006,
4874,
9140,
1010,
20014,
5950,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
9140,
1007,
1063,
2709,
19701,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java | CLIService.closeOperation | @Override
public void closeOperation(OperationHandle opHandle)
throws HiveSQLException {
sessionManager.getOperationManager().getOperation(opHandle)
.getParentSession().closeOperation(opHandle);
LOG.debug(opHandle + ": closeOperation");
} | java | @Override
public void closeOperation(OperationHandle opHandle)
throws HiveSQLException {
sessionManager.getOperationManager().getOperation(opHandle)
.getParentSession().closeOperation(opHandle);
LOG.debug(opHandle + ": closeOperation");
} | [
"@",
"Override",
"public",
"void",
"closeOperation",
"(",
"OperationHandle",
"opHandle",
")",
"throws",
"HiveSQLException",
"{",
"sessionManager",
".",
"getOperationManager",
"(",
")",
".",
"getOperation",
"(",
"opHandle",
")",
".",
"getParentSession",
"(",
")",
"... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#closeOperation(org.apache.hive.service.cli.OperationHandle) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java#L421-L427 | train | Close an operation. | [
30522,
1030,
2058,
15637,
2270,
11675,
2485,
25918,
3370,
1006,
3169,
11774,
2571,
6728,
11774,
2571,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
5219,
24805,
4590,
1012,
2131,
25918,
3370,
24805,
4590,
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... |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/ShardConsumer.java | ShardConsumer.adaptRecordsToRead | private int adaptRecordsToRead(long runLoopTimeNanos, int numRecords, long recordBatchSizeBytes,
int maxNumberOfRecordsPerFetch) {
if (useAdaptiveReads && numRecords != 0 && runLoopTimeNanos != 0) {
long averageRecordSizeBytes = recordBatchSizeBytes / numRecords;
// Adjust number of records to fetch from the shard depending on current average record size
// to optimize 2 Mb / sec read limits
double loopFrequencyHz = 1000000000.0d / runLoopTimeNanos;
double bytesPerRead = KINESIS_SHARD_BYTES_PER_SECOND_LIMIT / loopFrequencyHz;
maxNumberOfRecordsPerFetch = (int) (bytesPerRead / averageRecordSizeBytes);
// Ensure the value is greater than 0 and not more than 10000L
maxNumberOfRecordsPerFetch = Math.max(1, Math.min(maxNumberOfRecordsPerFetch, ConsumerConfigConstants.DEFAULT_SHARD_GETRECORDS_MAX));
// Set metrics
shardMetricsReporter.setAverageRecordSizeBytes(averageRecordSizeBytes);
shardMetricsReporter.setLoopFrequencyHz(loopFrequencyHz);
shardMetricsReporter.setBytesPerRead(bytesPerRead);
}
return maxNumberOfRecordsPerFetch;
} | java | private int adaptRecordsToRead(long runLoopTimeNanos, int numRecords, long recordBatchSizeBytes,
int maxNumberOfRecordsPerFetch) {
if (useAdaptiveReads && numRecords != 0 && runLoopTimeNanos != 0) {
long averageRecordSizeBytes = recordBatchSizeBytes / numRecords;
// Adjust number of records to fetch from the shard depending on current average record size
// to optimize 2 Mb / sec read limits
double loopFrequencyHz = 1000000000.0d / runLoopTimeNanos;
double bytesPerRead = KINESIS_SHARD_BYTES_PER_SECOND_LIMIT / loopFrequencyHz;
maxNumberOfRecordsPerFetch = (int) (bytesPerRead / averageRecordSizeBytes);
// Ensure the value is greater than 0 and not more than 10000L
maxNumberOfRecordsPerFetch = Math.max(1, Math.min(maxNumberOfRecordsPerFetch, ConsumerConfigConstants.DEFAULT_SHARD_GETRECORDS_MAX));
// Set metrics
shardMetricsReporter.setAverageRecordSizeBytes(averageRecordSizeBytes);
shardMetricsReporter.setLoopFrequencyHz(loopFrequencyHz);
shardMetricsReporter.setBytesPerRead(bytesPerRead);
}
return maxNumberOfRecordsPerFetch;
} | [
"private",
"int",
"adaptRecordsToRead",
"(",
"long",
"runLoopTimeNanos",
",",
"int",
"numRecords",
",",
"long",
"recordBatchSizeBytes",
",",
"int",
"maxNumberOfRecordsPerFetch",
")",
"{",
"if",
"(",
"useAdaptiveReads",
"&&",
"numRecords",
"!=",
"0",
"&&",
"runLoopTi... | Calculates how many records to read each time through the loop based on a target throughput
and the measured frequenecy of the loop.
@param runLoopTimeNanos The total time of one pass through the loop
@param numRecords The number of records of the last read operation
@param recordBatchSizeBytes The total batch size of the last read operation
@param maxNumberOfRecordsPerFetch The current maxNumberOfRecordsPerFetch | [
"Calculates",
"how",
"many",
"records",
"to",
"read",
"each",
"time",
"through",
"the",
"loop",
"based",
"on",
"a",
"target",
"throughput",
"and",
"the",
"measured",
"frequenecy",
"of",
"the",
"loop",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/ShardConsumer.java#L308-L326 | train | Adapt records read from the shard. | [
30522,
2797,
20014,
15581,
2890,
27108,
5104,
19277,
4215,
1006,
2146,
2448,
4135,
7361,
7292,
7229,
2891,
1010,
20014,
16371,
2213,
2890,
27108,
5104,
1010,
2146,
2501,
14479,
18069,
4697,
3762,
4570,
1010,
20014,
4098,
19172,
5677,
11253,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AggregateBinder.java | AggregateBinder.bind | @SuppressWarnings("unchecked")
public final Object bind(ConfigurationPropertyName name, Bindable<?> target,
AggregateElementBinder elementBinder) {
Object result = bindAggregate(name, target, elementBinder);
Supplier<?> value = target.getValue();
if (result == null || value == null) {
return result;
}
return merge((Supplier<T>) value, (T) result);
} | java | @SuppressWarnings("unchecked")
public final Object bind(ConfigurationPropertyName name, Bindable<?> target,
AggregateElementBinder elementBinder) {
Object result = bindAggregate(name, target, elementBinder);
Supplier<?> value = target.getValue();
if (result == null || value == null) {
return result;
}
return merge((Supplier<T>) value, (T) result);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"Object",
"bind",
"(",
"ConfigurationPropertyName",
"name",
",",
"Bindable",
"<",
"?",
">",
"target",
",",
"AggregateElementBinder",
"elementBinder",
")",
"{",
"Object",
"result",
"=",
"bindAgg... | Perform binding for the aggregate.
@param name the configuration property name to bind
@param target the target to bind
@param elementBinder an element binder
@return the bound aggregate or null | [
"Perform",
"binding",
"for",
"the",
"aggregate",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/AggregateBinder.java#L55-L64 | train | Binds the given target object to the given aggregate element. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
2345,
4874,
14187,
1006,
9563,
21572,
4842,
25680,
14074,
2171,
1010,
14187,
3085,
1026,
1029,
1028,
4539,
1010,
9572,
12260,
3672,
8428,
4063,
5783,
842... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | client/src/main/java/com/networknt/client/Http2Client.java | Http2Client.createSSLContext | public static SSLContext createSSLContext() throws IOException {
Map<String, Object> tlsMap = (Map<String, Object>)ClientConfig.get().getMappedConfig().get(TLS);
return null==tlsMap?null:createSSLContext((String)tlsMap.get(TLSConfig.DEFAULT_GROUP_KEY));
} | java | public static SSLContext createSSLContext() throws IOException {
Map<String, Object> tlsMap = (Map<String, Object>)ClientConfig.get().getMappedConfig().get(TLS);
return null==tlsMap?null:createSSLContext((String)tlsMap.get(TLSConfig.DEFAULT_GROUP_KEY));
} | [
"public",
"static",
"SSLContext",
"createSSLContext",
"(",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"tlsMap",
"=",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"ClientConfig",
".",
"get",
"(",
")",
".",
"getMapp... | default method for creating ssl context. trustedNames config is not used.
@return SSLContext
@throws IOException | [
"default",
"method",
"for",
"creating",
"ssl",
"context",
".",
"trustedNames",
"config",
"is",
"not",
"used",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/Http2Client.java#L408-L412 | train | Create an SSLContext for use with the TLS configuration. | [
30522,
2270,
10763,
7020,
22499,
10111,
18413,
9005,
14540,
8663,
18209,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
4949,
1026,
5164,
1010,
4874,
1028,
1056,
4877,
2863,
2361,
1027,
1006,
4949,
1026,
5164,
1010,
4874,
1028,
1007,
7396,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.removeVertices | public Graph<K, VV, EV> removeVertices(List<Vertex<K, VV>> verticesToBeRemoved) {
return removeVertices(this.context.fromCollection(verticesToBeRemoved));
} | java | public Graph<K, VV, EV> removeVertices(List<Vertex<K, VV>> verticesToBeRemoved) {
return removeVertices(this.context.fromCollection(verticesToBeRemoved));
} | [
"public",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"removeVertices",
"(",
"List",
"<",
"Vertex",
"<",
"K",
",",
"VV",
">",
">",
"verticesToBeRemoved",
")",
"{",
"return",
"removeVertices",
"(",
"this",
".",
"context",
".",
"fromCollection",
"(",
"... | Removes the given list of vertices and its edges from the graph.
@param verticesToBeRemoved the list of vertices to be removed
@return the resulted graph containing the initial vertices and edges minus the vertices
and edges removed. | [
"Removes",
"the",
"given",
"list",
"of",
"vertices",
"and",
"its",
"edges",
"from",
"the",
"graph",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1485-L1487 | train | Removes the given vertices from the graph. | [
30522,
2270,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
6366,
16874,
23522,
1006,
2862,
1026,
19449,
1026,
1047,
1010,
1058,
2615,
1028,
1028,
18984,
3406,
5677,
6633,
21818,
2094,
1007,
1063,
2709,
6366,
16874,
23522,
1006,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/MutablePropertySources.java | MutablePropertySources.replace | public void replace(String name, PropertySource<?> propertySource) {
if (logger.isDebugEnabled()) {
logger.debug("Replacing PropertySource '" + name + "' with '" + propertySource.getName() + "'");
}
int index = assertPresentAndGetIndex(name);
this.propertySourceList.set(index, propertySource);
} | java | public void replace(String name, PropertySource<?> propertySource) {
if (logger.isDebugEnabled()) {
logger.debug("Replacing PropertySource '" + name + "' with '" + propertySource.getName() + "'");
}
int index = assertPresentAndGetIndex(name);
this.propertySourceList.set(index, propertySource);
} | [
"public",
"void",
"replace",
"(",
"String",
"name",
",",
"PropertySource",
"<",
"?",
">",
"propertySource",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Replacing PropertySource '\"",
"+",
"name",
... | Replace the property source with the given name with the given property
source object.
@param name the name of the property source to find and replace
@param propertySource the replacement property source
@throws IllegalArgumentException if no property source with the given name is
present
@see #contains | [
"Replace",
"the",
"property",
"source",
"with",
"the",
"given",
"name",
"with",
"the",
"given",
"property",
"source",
"object",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/MutablePropertySources.java#L161-L167 | train | Replaces the property source with the given property source. | [
30522,
2270,
11675,
5672,
1006,
5164,
2171,
1010,
3200,
6499,
3126,
3401,
1026,
1029,
1028,
3200,
6499,
3126,
3401,
1007,
1063,
2065,
1006,
8833,
4590,
1012,
2003,
3207,
8569,
6914,
3085,
2094,
1006,
1007,
1007,
1063,
8833,
4590,
1012,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-captcha/src/main/java/cn/hutool/captcha/LineCaptcha.java | LineCaptcha.createImage | @Override
public Image createImage(String code) {
// 图像buffer
final BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
final Graphics2D g = GraphicsUtil.createGraphics(image, ObjectUtil.defaultIfNull(this.background, Color.WHITE));
// 干扰线
drawInterfere(g);
// 字符串
drawString(g, code);
return image;
} | java | @Override
public Image createImage(String code) {
// 图像buffer
final BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
final Graphics2D g = GraphicsUtil.createGraphics(image, ObjectUtil.defaultIfNull(this.background, Color.WHITE));
// 干扰线
drawInterfere(g);
// 字符串
drawString(g, code);
return image;
} | [
"@",
"Override",
"public",
"Image",
"createImage",
"(",
"String",
"code",
")",
"{",
"// 图像buffer\r",
"final",
"BufferedImage",
"image",
"=",
"new",
"BufferedImage",
"(",
"width",
",",
"height",
",",
"BufferedImage",
".",
"TYPE_INT_RGB",
")",
";",
"final",
"Gra... | -------------------------------------------------------------------- Constructor end | [
"--------------------------------------------------------------------",
"Constructor",
"end"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-captcha/src/main/java/cn/hutool/captcha/LineCaptcha.java#L48-L61 | train | Create an image from a code. | [
30522,
1030,
2058,
15637,
2270,
3746,
3443,
9581,
3351,
1006,
5164,
3642,
1007,
1063,
1013,
1013,
100,
100,
17698,
2345,
17698,
2098,
9581,
3351,
3746,
1027,
2047,
17698,
2098,
9581,
3351,
1006,
9381,
1010,
4578,
1010,
17698,
2098,
9581,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/misc/HighwayHash.java | HighwayHash.hash64 | public static long hash64(byte[] data, int offset, int length, long[] key) {
HighwayHash h = new HighwayHash(key);
h.processAll(data, offset, length);
return h.finalize64();
} | java | public static long hash64(byte[] data, int offset, int length, long[] key) {
HighwayHash h = new HighwayHash(key);
h.processAll(data, offset, length);
return h.finalize64();
} | [
"public",
"static",
"long",
"hash64",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
",",
"long",
"[",
"]",
"key",
")",
"{",
"HighwayHash",
"h",
"=",
"new",
"HighwayHash",
"(",
"key",
")",
";",
"h",
".",
"processAll",
"(... | NOTE: The 64-bit HighwayHash algorithm is declared stable and no longer subject to change.
@param data array with data bytes
@param offset position of first byte of data to read from
@param length number of bytes from data to read
@param key array of size 4 with the key to initialize the hash with
@return 64-bit hash for the given data | [
"NOTE",
":",
"The",
"64",
"-",
"bit",
"HighwayHash",
"algorithm",
"is",
"declared",
"stable",
"and",
"no",
"longer",
"subject",
"to",
"change",
"."
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/misc/HighwayHash.java#L290-L294 | train | Hash 64 - bit data. | [
30522,
2270,
10763,
2146,
23325,
21084,
1006,
24880,
1031,
1033,
2951,
1010,
20014,
16396,
1010,
20014,
3091,
1010,
2146,
1031,
1033,
3145,
1007,
1063,
3307,
14949,
2232,
1044,
1027,
2047,
3307,
14949,
2232,
1006,
3145,
1007,
1025,
1044,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/socket/nio/NioChannelOption.java | NioChannelOption.setOption | static <T> boolean setOption(Channel jdkChannel, NioChannelOption<T> option, T value) {
java.nio.channels.NetworkChannel channel = (java.nio.channels.NetworkChannel) jdkChannel;
if (!channel.supportedOptions().contains(option.option)) {
return false;
}
if (channel instanceof ServerSocketChannel && option.option == java.net.StandardSocketOptions.IP_TOS) {
// Skip IP_TOS as a workaround for a JDK bug:
// See http://mail.openjdk.java.net/pipermail/nio-dev/2018-August/005365.html
return false;
}
try {
channel.setOption(option.option, value);
return true;
} catch (IOException e) {
throw new ChannelException(e);
}
} | java | static <T> boolean setOption(Channel jdkChannel, NioChannelOption<T> option, T value) {
java.nio.channels.NetworkChannel channel = (java.nio.channels.NetworkChannel) jdkChannel;
if (!channel.supportedOptions().contains(option.option)) {
return false;
}
if (channel instanceof ServerSocketChannel && option.option == java.net.StandardSocketOptions.IP_TOS) {
// Skip IP_TOS as a workaround for a JDK bug:
// See http://mail.openjdk.java.net/pipermail/nio-dev/2018-August/005365.html
return false;
}
try {
channel.setOption(option.option, value);
return true;
} catch (IOException e) {
throw new ChannelException(e);
}
} | [
"static",
"<",
"T",
">",
"boolean",
"setOption",
"(",
"Channel",
"jdkChannel",
",",
"NioChannelOption",
"<",
"T",
">",
"option",
",",
"T",
"value",
")",
"{",
"java",
".",
"nio",
".",
"channels",
".",
"NetworkChannel",
"channel",
"=",
"(",
"java",
".",
... | Internal helper methods to remove code duplication between Nio*Channel implementations. | [
"Internal",
"helper",
"methods",
"to",
"remove",
"code",
"duplication",
"between",
"Nio",
"*",
"Channel",
"implementations",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/socket/nio/NioChannelOption.java#L56-L72 | train | Sets the option on the given channel. | [
30522,
10763,
1026,
1056,
1028,
22017,
20898,
2275,
7361,
3508,
1006,
3149,
26219,
2243,
26058,
1010,
9152,
11663,
20147,
4135,
16790,
1026,
1056,
1028,
5724,
1010,
1056,
3643,
1007,
1063,
9262,
1012,
30524,
3149,
1012,
3569,
7361,
9285,
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-clients/src/main/java/org/apache/flink/client/RemoteExecutor.java | RemoteExecutor.start | @Override
public void start() throws Exception {
synchronized (lock) {
if (client == null) {
client = new RestClusterClient<>(clientConfiguration, "RemoteExecutor");
client.setPrintStatusDuringExecution(isPrintingStatusDuringExecution());
}
else {
throw new IllegalStateException("The remote executor was already started.");
}
}
} | java | @Override
public void start() throws Exception {
synchronized (lock) {
if (client == null) {
client = new RestClusterClient<>(clientConfiguration, "RemoteExecutor");
client.setPrintStatusDuringExecution(isPrintingStatusDuringExecution());
}
else {
throw new IllegalStateException("The remote executor was already started.");
}
}
} | [
"@",
"Override",
"public",
"void",
"start",
"(",
")",
"throws",
"Exception",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"client",
"==",
"null",
")",
"{",
"client",
"=",
"new",
"RestClusterClient",
"<>",
"(",
"clientConfiguration",
",",
"\"Remot... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/RemoteExecutor.java#L147-L158 | train | Start the remote executor. | [
30522,
1030,
2058,
15637,
2270,
11675,
2707,
1006,
1007,
11618,
6453,
1063,
25549,
1006,
5843,
1007,
1063,
2065,
1006,
7396,
1027,
1027,
19701,
1007,
1063,
7396,
1027,
2047,
2717,
20464,
19966,
2121,
20464,
11638,
1026,
1028,
1006,
7396,
86... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.contains | public boolean contains(final UTF8String substring) {
if (substring.numBytes == 0) {
return true;
}
byte first = substring.getByte(0);
for (int i = 0; i <= numBytes - substring.numBytes; i++) {
if (getByte(i) == first && matchAt(substring, i)) {
return true;
}
}
return false;
} | java | public boolean contains(final UTF8String substring) {
if (substring.numBytes == 0) {
return true;
}
byte first = substring.getByte(0);
for (int i = 0; i <= numBytes - substring.numBytes; i++) {
if (getByte(i) == first && matchAt(substring, i)) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"contains",
"(",
"final",
"UTF8String",
"substring",
")",
"{",
"if",
"(",
"substring",
".",
"numBytes",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"byte",
"first",
"=",
"substring",
".",
"getByte",
"(",
"0",
")",
";",
"for",
... | Returns whether this contains `substring` or not. | [
"Returns",
"whether",
"this",
"contains",
"substring",
"or",
"not",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L351-L363 | train | Check if this string contains the substring. | [
30522,
2270,
22017,
20898,
3397,
1006,
2345,
21183,
2546,
2620,
3367,
4892,
4942,
3367,
4892,
1007,
1063,
2065,
1006,
4942,
3367,
4892,
1012,
15903,
17250,
2015,
1027,
1027,
1014,
1007,
1063,
2709,
2995,
1025,
1065,
24880,
2034,
1027,
4942,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getTypeArguments | public static Type[] getTypeArguments(Type type) {
if (null == type) {
return null;
}
final ParameterizedType parameterizedType = toParameterizedType(type);
return (null == parameterizedType) ? null : parameterizedType.getActualTypeArguments();
} | java | public static Type[] getTypeArguments(Type type) {
if (null == type) {
return null;
}
final ParameterizedType parameterizedType = toParameterizedType(type);
return (null == parameterizedType) ? null : parameterizedType.getActualTypeArguments();
} | [
"public",
"static",
"Type",
"[",
"]",
"getTypeArguments",
"(",
"Type",
"type",
")",
"{",
"if",
"(",
"null",
"==",
"type",
")",
"{",
"return",
"null",
";",
"}",
"final",
"ParameterizedType",
"parameterizedType",
"=",
"toParameterizedType",
"(",
"type",
")",
... | 获得指定类型中所有泛型参数类型,例如:
<pre>
class A<T>
class B extends A<String>
</pre>
通过此方法,传入B.class即可得到String
@param type 指定类型
@return 所有泛型参数类型 | [
"获得指定类型中所有泛型参数类型,例如:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java#L230-L237 | train | Returns the type arguments of a given type. | [
30522,
2270,
10763,
2828,
1031,
1033,
2131,
13874,
2906,
22850,
11187,
1006,
2828,
2828,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
2828,
1007,
1063,
2709,
19701,
1025,
1065,
2345,
16381,
3550,
13874,
16381,
3550,
13874,
1027,
2327,
5400,
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-core/src/main/java/cn/hutool/core/comparator/ComparatorChain.java | ComparatorChain.setComparator | public ComparatorChain<E> setComparator(final int index, final Comparator<E> comparator) throws IndexOutOfBoundsException {
return setComparator(index, comparator, false);
} | java | public ComparatorChain<E> setComparator(final int index, final Comparator<E> comparator) throws IndexOutOfBoundsException {
return setComparator(index, comparator, false);
} | [
"public",
"ComparatorChain",
"<",
"E",
">",
"setComparator",
"(",
"final",
"int",
"index",
",",
"final",
"Comparator",
"<",
"E",
">",
"comparator",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"return",
"setComparator",
"(",
"index",
",",
"comparator",
",",
... | 替换指定位置的比较器,保持原排序方式
@param index 位置
@param comparator {@link Comparator}
@return this
@exception IndexOutOfBoundsException if index < 0 or index >= size() | [
"替换指定位置的比较器,保持原排序方式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/comparator/ComparatorChain.java#L119-L121 | train | Sets the comparator at the given index. | [
30522,
2270,
4012,
28689,
4263,
24925,
2078,
1026,
1041,
1028,
2275,
9006,
28689,
4263,
1006,
2345,
20014,
5950,
1010,
2345,
4012,
28689,
4263,
1026,
1041,
1028,
4012,
28689,
4263,
1007,
11618,
5950,
5833,
11253,
15494,
3366,
2595,
24422,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/savepoint/SavepointV2Serializer.java | SavepointV2Serializer.serializeMasterState | private void serializeMasterState(MasterState state, DataOutputStream dos) throws IOException {
// magic number for error detection
dos.writeInt(MASTER_STATE_MAGIC_NUMBER);
// for safety, we serialize first into an array and then write the array and its
// length into the checkpoint
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final DataOutputStream out = new DataOutputStream(baos);
out.writeInt(state.version());
out.writeUTF(state.name());
final byte[] bytes = state.bytes();
out.writeInt(bytes.length);
out.write(bytes, 0, bytes.length);
out.close();
byte[] data = baos.toByteArray();
dos.writeInt(data.length);
dos.write(data, 0, data.length);
} | java | private void serializeMasterState(MasterState state, DataOutputStream dos) throws IOException {
// magic number for error detection
dos.writeInt(MASTER_STATE_MAGIC_NUMBER);
// for safety, we serialize first into an array and then write the array and its
// length into the checkpoint
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final DataOutputStream out = new DataOutputStream(baos);
out.writeInt(state.version());
out.writeUTF(state.name());
final byte[] bytes = state.bytes();
out.writeInt(bytes.length);
out.write(bytes, 0, bytes.length);
out.close();
byte[] data = baos.toByteArray();
dos.writeInt(data.length);
dos.write(data, 0, data.length);
} | [
"private",
"void",
"serializeMasterState",
"(",
"MasterState",
"state",
",",
"DataOutputStream",
"dos",
")",
"throws",
"IOException",
"{",
"// magic number for error detection",
"dos",
".",
"writeInt",
"(",
"MASTER_STATE_MAGIC_NUMBER",
")",
";",
"// for safety, we serialize... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/savepoint/SavepointV2Serializer.java#L192-L213 | train | Serialize master state into the output stream. | [
30522,
2797,
11675,
7642,
4697,
27751,
12259,
1006,
5972,
12259,
2110,
1010,
2951,
5833,
18780,
21422,
9998,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
3894,
2193,
2005,
7561,
10788,
9998,
1012,
4339,
18447,
1006,
3040,
1035,
2110,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/registration/RegisteredRpcConnection.java | RegisteredRpcConnection.start | public void start() {
checkState(!closed, "The RPC connection is already closed");
checkState(!isConnected() && pendingRegistration == null, "The RPC connection is already started");
final RetryingRegistration<F, G, S> newRegistration = createNewRegistration();
if (REGISTRATION_UPDATER.compareAndSet(this, null, newRegistration)) {
newRegistration.startRegistration();
} else {
// concurrent start operation
newRegistration.cancel();
}
} | java | public void start() {
checkState(!closed, "The RPC connection is already closed");
checkState(!isConnected() && pendingRegistration == null, "The RPC connection is already started");
final RetryingRegistration<F, G, S> newRegistration = createNewRegistration();
if (REGISTRATION_UPDATER.compareAndSet(this, null, newRegistration)) {
newRegistration.startRegistration();
} else {
// concurrent start operation
newRegistration.cancel();
}
} | [
"public",
"void",
"start",
"(",
")",
"{",
"checkState",
"(",
"!",
"closed",
",",
"\"The RPC connection is already closed\"",
")",
";",
"checkState",
"(",
"!",
"isConnected",
"(",
")",
"&&",
"pendingRegistration",
"==",
"null",
",",
"\"The RPC connection is already s... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/registration/RegisteredRpcConnection.java#L89-L101 | train | Starts the RPC connection. | [
30522,
2270,
11675,
2707,
1006,
1007,
1063,
14148,
12259,
1006,
999,
2701,
1010,
1000,
1996,
1054,
15042,
4434,
2003,
2525,
2701,
1000,
1007,
1025,
14148,
12259,
1006,
999,
2003,
24230,
1006,
1007,
1004,
1004,
14223,
2890,
24063,
8156,
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-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/HadoopInputs.java | HadoopInputs.readHadoopFile | public static <K, V> HadoopInputFormat<K, V> readHadoopFile(org.apache.hadoop.mapred.FileInputFormat<K, V> mapredInputFormat, Class<K> key, Class<V> value, String inputPath) {
return readHadoopFile(mapredInputFormat, key, value, inputPath, new JobConf());
} | java | public static <K, V> HadoopInputFormat<K, V> readHadoopFile(org.apache.hadoop.mapred.FileInputFormat<K, V> mapredInputFormat, Class<K> key, Class<V> value, String inputPath) {
return readHadoopFile(mapredInputFormat, key, value, inputPath, new JobConf());
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"HadoopInputFormat",
"<",
"K",
",",
"V",
">",
"readHadoopFile",
"(",
"org",
".",
"apache",
".",
"hadoop",
".",
"mapred",
".",
"FileInputFormat",
"<",
"K",
",",
"V",
">",
"mapredInputFormat",
",",
"Class",
"<... | Creates a Flink {@link InputFormat} that wraps the given Hadoop {@link org.apache.hadoop.mapred.FileInputFormat}.
@return A Flink InputFormat that wraps the Hadoop FileInputFormat. | [
"Creates",
"a",
"Flink",
"{",
"@link",
"InputFormat",
"}",
"that",
"wraps",
"the",
"given",
"Hadoop",
"{",
"@link",
"org",
".",
"apache",
".",
"hadoop",
".",
"mapred",
".",
"FileInputFormat",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/HadoopInputs.java#L62-L64 | train | Read hadoop file. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
2018,
18589,
2378,
18780,
14192,
4017,
1026,
1047,
1010,
1058,
1028,
3191,
16102,
18589,
8873,
2571,
1006,
8917,
1012,
15895,
1012,
2018,
18589,
1012,
4949,
5596,
1012,
5371,
2378,
18780,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/perceptron/parser/KBeamArcEagerDependencyParser.java | KBeamArcEagerDependencyParser.evaluate | public double[] evaluate(String testCorpus) throws IOException, ExecutionException, InterruptedException
{
Options options = parser.options;
options.goldFile = testCorpus;
File tmpTemplate = File.createTempFile("pred-" + new Date().getTime(), ".conll");
tmpTemplate.deleteOnExit();
options.predFile = tmpTemplate.getAbsolutePath();
options.outputFile = options.predFile;
File scoreFile = File.createTempFile("score-" + new Date().getTime(), ".txt");
scoreFile.deleteOnExit();
parser.parseConllFile(testCorpus, options.outputFile, options.rootFirst, options.beamWidth, true,
options.lowercase, 1, false, scoreFile.getAbsolutePath());
return Evaluator.evaluate(options.goldFile, options.predFile, options.punctuations);
} | java | public double[] evaluate(String testCorpus) throws IOException, ExecutionException, InterruptedException
{
Options options = parser.options;
options.goldFile = testCorpus;
File tmpTemplate = File.createTempFile("pred-" + new Date().getTime(), ".conll");
tmpTemplate.deleteOnExit();
options.predFile = tmpTemplate.getAbsolutePath();
options.outputFile = options.predFile;
File scoreFile = File.createTempFile("score-" + new Date().getTime(), ".txt");
scoreFile.deleteOnExit();
parser.parseConllFile(testCorpus, options.outputFile, options.rootFirst, options.beamWidth, true,
options.lowercase, 1, false, scoreFile.getAbsolutePath());
return Evaluator.evaluate(options.goldFile, options.predFile, options.punctuations);
} | [
"public",
"double",
"[",
"]",
"evaluate",
"(",
"String",
"testCorpus",
")",
"throws",
"IOException",
",",
"ExecutionException",
",",
"InterruptedException",
"{",
"Options",
"options",
"=",
"parser",
".",
"options",
";",
"options",
".",
"goldFile",
"=",
"testCorp... | 标准化评测
@param testCorpus 测试语料
@return 包含UF、LF的数组
@throws IOException
@throws ExecutionException
@throws InterruptedException | [
"标准化评测"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/perceptron/parser/KBeamArcEagerDependencyParser.java#L96-L109 | train | Evaluate the CIS corpus. | [
30522,
2270,
3313,
1031,
1033,
16157,
1006,
5164,
3231,
24586,
2271,
1007,
11618,
22834,
10288,
24422,
1010,
7781,
10288,
24422,
1010,
7153,
10288,
24422,
1063,
7047,
7047,
1027,
11968,
8043,
1012,
7047,
1025,
7047,
1012,
2751,
8873,
2571,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java | RadixSort.sortKeyPrefixArray | public static int sortKeyPrefixArray(
LongArray array,
long startIndex,
long numRecords,
int startByteIndex,
int endByteIndex,
boolean desc,
boolean signed) {
assert startByteIndex >= 0 : "startByteIndex (" + startByteIndex + ") should >= 0";
assert endByteIndex <= 7 : "endByteIndex (" + endByteIndex + ") should <= 7";
assert endByteIndex > startByteIndex;
assert numRecords * 4 <= array.size();
long inIndex = startIndex;
long outIndex = startIndex + numRecords * 2L;
if (numRecords > 0) {
long[][] counts = getKeyPrefixArrayCounts(
array, startIndex, numRecords, startByteIndex, endByteIndex);
for (int i = startByteIndex; i <= endByteIndex; i++) {
if (counts[i] != null) {
sortKeyPrefixArrayAtByte(
array, numRecords, counts[i], i, inIndex, outIndex,
desc, signed && i == endByteIndex);
long tmp = inIndex;
inIndex = outIndex;
outIndex = tmp;
}
}
}
return Ints.checkedCast(inIndex);
} | java | public static int sortKeyPrefixArray(
LongArray array,
long startIndex,
long numRecords,
int startByteIndex,
int endByteIndex,
boolean desc,
boolean signed) {
assert startByteIndex >= 0 : "startByteIndex (" + startByteIndex + ") should >= 0";
assert endByteIndex <= 7 : "endByteIndex (" + endByteIndex + ") should <= 7";
assert endByteIndex > startByteIndex;
assert numRecords * 4 <= array.size();
long inIndex = startIndex;
long outIndex = startIndex + numRecords * 2L;
if (numRecords > 0) {
long[][] counts = getKeyPrefixArrayCounts(
array, startIndex, numRecords, startByteIndex, endByteIndex);
for (int i = startByteIndex; i <= endByteIndex; i++) {
if (counts[i] != null) {
sortKeyPrefixArrayAtByte(
array, numRecords, counts[i], i, inIndex, outIndex,
desc, signed && i == endByteIndex);
long tmp = inIndex;
inIndex = outIndex;
outIndex = tmp;
}
}
}
return Ints.checkedCast(inIndex);
} | [
"public",
"static",
"int",
"sortKeyPrefixArray",
"(",
"LongArray",
"array",
",",
"long",
"startIndex",
",",
"long",
"numRecords",
",",
"int",
"startByteIndex",
",",
"int",
"endByteIndex",
",",
"boolean",
"desc",
",",
"boolean",
"signed",
")",
"{",
"assert",
"s... | Specialization of sort() for key-prefix arrays. In this type of array, each record consists
of two longs, only the second of which is sorted on.
@param startIndex starting index in the array to sort from. This parameter is not supported
in the plain sort() implementation. | [
"Specialization",
"of",
"sort",
"()",
"for",
"key",
"-",
"prefix",
"arrays",
".",
"In",
"this",
"type",
"of",
"array",
"each",
"record",
"consists",
"of",
"two",
"longs",
"only",
"the",
"second",
"of",
"which",
"is",
"sorted",
"on",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java#L179-L208 | train | Sort key prefix array. | [
30522,
2270,
10763,
20014,
4066,
14839,
28139,
8873,
18684,
11335,
2100,
1006,
2146,
2906,
9447,
9140,
1010,
2146,
2707,
22254,
10288,
1010,
2146,
16371,
2213,
2890,
27108,
5104,
1010,
20014,
2707,
3762,
9589,
3207,
2595,
1010,
20014,
2203,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/EnumUtil.java | EnumUtil.getNames | public static List<String> getNames(Class<? extends Enum<?>> clazz) {
final Enum<?>[] enums = clazz.getEnumConstants();
if (null == enums) {
return null;
}
final List<String> list = new ArrayList<>(enums.length);
for (Enum<?> e : enums) {
list.add(e.name());
}
return list;
} | java | public static List<String> getNames(Class<? extends Enum<?>> clazz) {
final Enum<?>[] enums = clazz.getEnumConstants();
if (null == enums) {
return null;
}
final List<String> list = new ArrayList<>(enums.length);
for (Enum<?> e : enums) {
list.add(e.name());
}
return list;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getNames",
"(",
"Class",
"<",
"?",
"extends",
"Enum",
"<",
"?",
">",
">",
"clazz",
")",
"{",
"final",
"Enum",
"<",
"?",
">",
"[",
"]",
"enums",
"=",
"clazz",
".",
"getEnumConstants",
"(",
")",
";",
... | 枚举类中所有枚举对象的name列表
@param clazz 枚举类
@return name列表 | [
"枚举类中所有枚举对象的name列表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/EnumUtil.java#L103-L113 | train | Gets the names of all enums in the given class. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
2131,
18442,
2015,
1006,
2465,
1026,
1029,
8908,
4372,
2819,
1026,
1029,
1028,
1028,
18856,
10936,
2480,
1007,
1063,
2345,
4372,
2819,
1026,
1029,
1028,
1031,
1033,
4372,
18163,
1027,
30524,
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/date/DateTime.java | DateTime.toTimeStr | public String toTimeStr() {
if (null != this.timeZone) {
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DatePattern.NORM_TIME_PATTERN);
simpleDateFormat.setTimeZone(this.timeZone);
return toString(simpleDateFormat);
}
return toString(DatePattern.NORM_TIME_FORMAT);
} | java | public String toTimeStr() {
if (null != this.timeZone) {
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DatePattern.NORM_TIME_PATTERN);
simpleDateFormat.setTimeZone(this.timeZone);
return toString(simpleDateFormat);
}
return toString(DatePattern.NORM_TIME_FORMAT);
} | [
"public",
"String",
"toTimeStr",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"this",
".",
"timeZone",
")",
"{",
"final",
"SimpleDateFormat",
"simpleDateFormat",
"=",
"new",
"SimpleDateFormat",
"(",
"DatePattern",
".",
"NORM_TIME_PATTERN",
")",
";",
"simpleDateFormat... | 转为"HH:mm:ss" 格式字符串
@return "HH:mm:ss" 格式字符串
@since 4.1.4 | [
"转为",
"HH",
":",
"mm",
":",
"ss",
"格式字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateTime.java#L816-L823 | train | Returns a string representation of this object. | [
30522,
2270,
5164,
2000,
7292,
3367,
2099,
1006,
1007,
1063,
2065,
1006,
19701,
999,
1027,
2023,
1012,
2051,
15975,
1007,
1063,
2345,
3722,
13701,
14192,
4017,
3722,
13701,
14192,
4017,
1027,
2047,
3722,
13701,
14192,
4017,
1006,
3058,
4502... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/SymmetricCrypto.java | SymmetricCrypto.decryptStr | public String decryptStr(byte[] bytes, Charset charset) {
return StrUtil.str(decrypt(bytes), charset);
} | java | public String decryptStr(byte[] bytes, Charset charset) {
return StrUtil.str(decrypt(bytes), charset);
} | [
"public",
"String",
"decryptStr",
"(",
"byte",
"[",
"]",
"bytes",
",",
"Charset",
"charset",
")",
"{",
"return",
"StrUtil",
".",
"str",
"(",
"decrypt",
"(",
"bytes",
")",
",",
"charset",
")",
";",
"}"
] | 解密为字符串
@param bytes 被解密的bytes
@param charset 解密后的charset
@return 解密后的String | [
"解密为字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/SymmetricCrypto.java#L316-L318 | train | Decrypt bytes and return the resulting String. | [
30522,
2270,
5164,
11703,
2854,
22798,
16344,
1006,
24880,
1031,
1033,
27507,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2709,
2358,
22134,
4014,
1012,
2358,
2099,
1006,
11703,
2854,
13876,
1006,
27507,
1007,
1010,
25869,
13462,
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-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java | KeyMap.putOrAggregate | public final V putOrAggregate(K key, V value, ReduceFunction<V> aggregator) throws Exception {
final int hash = hash(key);
final int slot = indexOf(hash);
// search the chain from the slot
for (Entry<K, V> entry = table[slot]; entry != null; entry = entry.next) {
if (entry.hashCode == hash && entry.key.equals(key)) {
// found match
entry.value = aggregator.reduce(entry.value, value);
return entry.value;
}
}
// no match, insert a new value
insertNewEntry(hash, key, value, slot);
// return the original value
return value;
} | java | public final V putOrAggregate(K key, V value, ReduceFunction<V> aggregator) throws Exception {
final int hash = hash(key);
final int slot = indexOf(hash);
// search the chain from the slot
for (Entry<K, V> entry = table[slot]; entry != null; entry = entry.next) {
if (entry.hashCode == hash && entry.key.equals(key)) {
// found match
entry.value = aggregator.reduce(entry.value, value);
return entry.value;
}
}
// no match, insert a new value
insertNewEntry(hash, key, value, slot);
// return the original value
return value;
} | [
"public",
"final",
"V",
"putOrAggregate",
"(",
"K",
"key",
",",
"V",
"value",
",",
"ReduceFunction",
"<",
"V",
">",
"aggregator",
")",
"throws",
"Exception",
"{",
"final",
"int",
"hash",
"=",
"hash",
"(",
"key",
")",
";",
"final",
"int",
"slot",
"=",
... | Inserts or aggregates a value into the hash map. If the hash map does not yet contain the key,
this method inserts the value. If the table already contains the key (and a value) this
method will use the given ReduceFunction function to combine the existing value and the
given value to a new value, and store that value for the key.
@param key The key to map the value.
@param value The new value to insert, or aggregate with the existing value.
@param aggregator The aggregator to use if a value is already contained.
@return The value in the map after this operation: Either the given value, or the aggregated value.
@throws java.lang.NullPointerException Thrown, if the key is null.
@throws Exception The method forwards exceptions from the aggregation function. | [
"Inserts",
"or",
"aggregates",
"a",
"value",
"into",
"the",
"hash",
"map",
".",
"If",
"the",
"hash",
"map",
"does",
"not",
"yet",
"contain",
"the",
"key",
"this",
"method",
"inserts",
"the",
"value",
".",
"If",
"the",
"table",
"already",
"contains",
"the... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java#L192-L209 | train | Put or aggregate the value of the specified key. | [
30522,
2270,
2345,
1058,
2404,
6525,
13871,
2890,
5867,
1006,
1047,
3145,
1010,
1058,
3643,
1010,
5547,
11263,
27989,
1026,
1058,
1028,
24089,
1007,
11618,
6453,
1063,
2345,
20014,
23325,
1027,
23325,
1006,
3145,
1007,
1025,
2345,
20014,
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/HashUtil.java | HashUtil.rotatingHash | public static int rotatingHash(String key, int prime) {
int hash, i;
for (hash = key.length(), i = 0; i < key.length(); ++i) {
hash = (hash << 4) ^ (hash >> 28) ^ key.charAt(i);
}
// 使用:hash = (hash ^ (hash>>10) ^ (hash>>20)) & mask;
// 替代:hash %= prime;
// return (hash ^ (hash>>10) ^ (hash>>20));
return hash % prime;
} | java | public static int rotatingHash(String key, int prime) {
int hash, i;
for (hash = key.length(), i = 0; i < key.length(); ++i) {
hash = (hash << 4) ^ (hash >> 28) ^ key.charAt(i);
}
// 使用:hash = (hash ^ (hash>>10) ^ (hash>>20)) & mask;
// 替代:hash %= prime;
// return (hash ^ (hash>>10) ^ (hash>>20));
return hash % prime;
} | [
"public",
"static",
"int",
"rotatingHash",
"(",
"String",
"key",
",",
"int",
"prime",
")",
"{",
"int",
"hash",
",",
"i",
";",
"for",
"(",
"hash",
"=",
"key",
".",
"length",
"(",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"key",
".",
"length",
"(",... | 旋转hash
@param key 输入字符串
@param prime 质数
@return hash值 | [
"旋转hash"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java#L35-L45 | train | Returns the hash value of the given key. | [
30522,
2270,
10763,
20014,
13618,
14949,
2232,
1006,
5164,
3145,
1010,
20014,
3539,
1007,
1063,
20014,
23325,
1010,
1045,
1025,
2005,
1006,
23325,
1027,
3145,
1012,
3091,
1006,
1007,
1010,
1045,
1027,
1014,
1025,
1045,
1026,
3145,
1012,
309... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/proxy/KinesisProxy.java | KinesisProxy.describeStream | protected DescribeStreamResult describeStream(String streamName, @Nullable String startShardId)
throws InterruptedException {
final DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest();
describeStreamRequest.setStreamName(streamName);
describeStreamRequest.setExclusiveStartShardId(startShardId);
DescribeStreamResult describeStreamResult = null;
// Call DescribeStream, with full-jitter backoff (if we get LimitExceededException).
int attemptCount = 0;
while (describeStreamResult == null) { // retry until we get a result
try {
describeStreamResult = kinesisClient.describeStream(describeStreamRequest);
} catch (LimitExceededException le) {
long backoffMillis = fullJitterBackoff(
describeStreamBaseBackoffMillis,
describeStreamMaxBackoffMillis,
describeStreamExpConstant,
attemptCount++);
LOG.warn(String.format("Got LimitExceededException when describing stream %s. "
+ "Backing off for %d millis.", streamName, backoffMillis));
Thread.sleep(backoffMillis);
} catch (ResourceNotFoundException re) {
throw new RuntimeException("Error while getting stream details", re);
}
}
String streamStatus = describeStreamResult.getStreamDescription().getStreamStatus();
if (!(streamStatus.equals(StreamStatus.ACTIVE.toString())
|| streamStatus.equals(StreamStatus.UPDATING.toString()))) {
if (LOG.isWarnEnabled()) {
LOG.warn(String.format("The status of stream %s is %s ; result of the current "
+ "describeStream operation will not contain any shard information.",
streamName, streamStatus));
}
}
return describeStreamResult;
} | java | protected DescribeStreamResult describeStream(String streamName, @Nullable String startShardId)
throws InterruptedException {
final DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest();
describeStreamRequest.setStreamName(streamName);
describeStreamRequest.setExclusiveStartShardId(startShardId);
DescribeStreamResult describeStreamResult = null;
// Call DescribeStream, with full-jitter backoff (if we get LimitExceededException).
int attemptCount = 0;
while (describeStreamResult == null) { // retry until we get a result
try {
describeStreamResult = kinesisClient.describeStream(describeStreamRequest);
} catch (LimitExceededException le) {
long backoffMillis = fullJitterBackoff(
describeStreamBaseBackoffMillis,
describeStreamMaxBackoffMillis,
describeStreamExpConstant,
attemptCount++);
LOG.warn(String.format("Got LimitExceededException when describing stream %s. "
+ "Backing off for %d millis.", streamName, backoffMillis));
Thread.sleep(backoffMillis);
} catch (ResourceNotFoundException re) {
throw new RuntimeException("Error while getting stream details", re);
}
}
String streamStatus = describeStreamResult.getStreamDescription().getStreamStatus();
if (!(streamStatus.equals(StreamStatus.ACTIVE.toString())
|| streamStatus.equals(StreamStatus.UPDATING.toString()))) {
if (LOG.isWarnEnabled()) {
LOG.warn(String.format("The status of stream %s is %s ; result of the current "
+ "describeStream operation will not contain any shard information.",
streamName, streamStatus));
}
}
return describeStreamResult;
} | [
"protected",
"DescribeStreamResult",
"describeStream",
"(",
"String",
"streamName",
",",
"@",
"Nullable",
"String",
"startShardId",
")",
"throws",
"InterruptedException",
"{",
"final",
"DescribeStreamRequest",
"describeStreamRequest",
"=",
"new",
"DescribeStreamRequest",
"(... | Get metainfo for a Kinesis stream, which contains information about which shards this
Kinesis stream possess.
<p>This method is using a "full jitter" approach described in AWS's article,
<a href="https://www.awsarchitectureblog.com/2015/03/backoff.html">
"Exponential Backoff and Jitter"</a>.
This is necessary because concurrent calls will be made by all parallel subtask's fetcher.
This jitter backoff approach will help distribute calls across the fetchers over time.
@param streamName the stream to describe
@param startShardId which shard to start with for this describe operation
@return the result of the describe stream operation | [
"Get",
"metainfo",
"for",
"a",
"Kinesis",
"stream",
"which",
"contains",
"information",
"about",
"which",
"shards",
"this",
"Kinesis",
"stream",
"possess",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/proxy/KinesisProxy.java#L512-L550 | train | Describe stream. | [
30522,
5123,
5577,
25379,
6072,
11314,
5577,
25379,
1006,
5164,
5460,
18442,
1010,
1030,
19701,
3085,
5164,
4627,
11783,
3593,
1007,
11618,
7153,
10288,
24422,
1063,
2345,
5577,
25379,
2890,
15500,
5577,
25379,
2890,
15500,
1027,
2047,
5577,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tokenizer/NotionalTokenizer.java | NotionalTokenizer.seg2sentence | public static List<List<Term>> seg2sentence(String text, boolean shortest)
{
return SEGMENT.seg2sentence(text, shortest);
} | java | public static List<List<Term>> seg2sentence(String text, boolean shortest)
{
return SEGMENT.seg2sentence(text, shortest);
} | [
"public",
"static",
"List",
"<",
"List",
"<",
"Term",
">",
">",
"seg2sentence",
"(",
"String",
"text",
",",
"boolean",
"shortest",
")",
"{",
"return",
"SEGMENT",
".",
"seg2sentence",
"(",
"text",
",",
"shortest",
")",
";",
"}"
] | 分词断句 输出句子形式
@param text 待分词句子
@param shortest 是否断句为最细的子句(将逗号也视作分隔符)
@return 句子列表,每个句子由一个单词列表组成 | [
"分词断句",
"输出句子形式"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/tokenizer/NotionalTokenizer.java#L92-L95 | train | seg2sentence - returns a list of lists of terms from a sentence. | [
30522,
2270,
10763,
2862,
1026,
2862,
1026,
2744,
1028,
1028,
7367,
2290,
2475,
5054,
6528,
3401,
1006,
5164,
3793,
1010,
22017,
20898,
20047,
1007,
1063,
2709,
6903,
1012,
7367,
2290,
2475,
5054,
6528,
3401,
1006,
3793,
1010,
20047,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java | ExitCodeGenerators.getExitCode | public int getExitCode() {
int exitCode = 0;
for (ExitCodeGenerator generator : this.generators) {
try {
int value = generator.getExitCode();
if (value > 0 && value > exitCode || value < 0 && value < exitCode) {
exitCode = value;
}
}
catch (Exception ex) {
exitCode = (exitCode != 0) ? exitCode : 1;
ex.printStackTrace();
}
}
return exitCode;
} | java | public int getExitCode() {
int exitCode = 0;
for (ExitCodeGenerator generator : this.generators) {
try {
int value = generator.getExitCode();
if (value > 0 && value > exitCode || value < 0 && value < exitCode) {
exitCode = value;
}
}
catch (Exception ex) {
exitCode = (exitCode != 0) ? exitCode : 1;
ex.printStackTrace();
}
}
return exitCode;
} | [
"public",
"int",
"getExitCode",
"(",
")",
"{",
"int",
"exitCode",
"=",
"0",
";",
"for",
"(",
"ExitCodeGenerator",
"generator",
":",
"this",
".",
"generators",
")",
"{",
"try",
"{",
"int",
"value",
"=",
"generator",
".",
"getExitCode",
"(",
")",
";",
"i... | Get the final exit code that should be returned based on all contained generators.
@return the final exit code. | [
"Get",
"the",
"final",
"exit",
"code",
"that",
"should",
"be",
"returned",
"based",
"on",
"all",
"contained",
"generators",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java#L86-L101 | train | Gets the exit code. | [
30522,
2270,
20014,
2131,
10288,
4183,
16044,
1006,
1007,
1063,
20014,
6164,
16044,
1027,
1014,
1025,
2005,
1006,
6164,
16044,
6914,
6906,
4263,
13103,
1024,
2023,
1012,
16937,
1007,
1063,
3046,
1063,
20014,
3643,
1027,
13103,
1012,
2131,
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/dictionary/CustomDictionary.java | CustomDictionary.get | public static CoreDictionary.Attribute get(String key)
{
if (HanLP.Config.Normalization) key = CharTable.convert(key);
CoreDictionary.Attribute attribute = dat.get(key);
if (attribute != null) return attribute;
if (trie == null) return null;
return trie.get(key);
} | java | public static CoreDictionary.Attribute get(String key)
{
if (HanLP.Config.Normalization) key = CharTable.convert(key);
CoreDictionary.Attribute attribute = dat.get(key);
if (attribute != null) return attribute;
if (trie == null) return null;
return trie.get(key);
} | [
"public",
"static",
"CoreDictionary",
".",
"Attribute",
"get",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"HanLP",
".",
"Config",
".",
"Normalization",
")",
"key",
"=",
"CharTable",
".",
"convert",
"(",
"key",
")",
";",
"CoreDictionary",
".",
"Attribute",
... | 查单词
@param key
@return | [
"查单词"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L418-L425 | train | Get a value from the cache. | [
30522,
2270,
10763,
4563,
29201,
3258,
5649,
1012,
17961,
2131,
1006,
5164,
3145,
1007,
1063,
2065,
1006,
7658,
14277,
1012,
9530,
8873,
2290,
1012,
3671,
3989,
1007,
3145,
1027,
3673,
3085,
1012,
10463,
1006,
3145,
1007,
1025,
4563,
29201,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getTypeArgument | public static Class<?> getTypeArgument(Class<?> clazz, int index) {
final Type argumentType = TypeUtil.getTypeArgument(clazz, index);
if (null != argumentType && argumentType instanceof Class) {
return (Class<?>) argumentType;
}
return null;
} | java | public static Class<?> getTypeArgument(Class<?> clazz, int index) {
final Type argumentType = TypeUtil.getTypeArgument(clazz, index);
if (null != argumentType && argumentType instanceof Class) {
return (Class<?>) argumentType;
}
return null;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getTypeArgument",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"int",
"index",
")",
"{",
"final",
"Type",
"argumentType",
"=",
"TypeUtil",
".",
"getTypeArgument",
"(",
"clazz",
",",
"index",
")",
";",
"if",
"(... | 获得给定类的泛型参数
@param clazz 被检查的类,必须是已经确定泛型类型的类
@param index 泛型类型的索引号,既第几个泛型类型
@return {@link Class} | [
"获得给定类的泛型参数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L930-L936 | train | Gets the type argument of the given class at the given index. | [
30522,
2270,
10763,
2465,
1026,
1029,
1028,
2131,
13874,
2906,
22850,
4765,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
20014,
5950,
1007,
1063,
2345,
2828,
6685,
13874,
1027,
2828,
21823,
2140,
1012,
2131,
13874,
2906,
22850,
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-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateLowerCase | public static <T extends CharSequence> T validateLowerCase(T value, String errorMsg) throws ValidateException {
if (false == isLowerCase(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validateLowerCase(T value, String errorMsg) throws ValidateException {
if (false == isLowerCase(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateLowerCase",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isLowerCase",
"(",
"value",
")",
")",
"{",
"throw",
"n... | 验证字符串是否全部为小写字母
@param <T> 字符串类型
@param value 表单值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常
@since 3.3.0 | [
"验证字符串是否全部为小写字母"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L519-L524 | train | ValidateLowerCase method. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
9398,
3686,
27663,
18992,
3366,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
1027,
2003,
2766... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getOrCreateSourceFolder | protected final SourceFolder getOrCreateSourceFolder(String name) {
SourceFolder sourceFolder = this.sourceFolders.get(name);
if (sourceFolder == null) {
sourceFolder = new SourceFolder(name);
this.sourceFolders.put(name, sourceFolder);
}
return sourceFolder;
} | java | protected final SourceFolder getOrCreateSourceFolder(String name) {
SourceFolder sourceFolder = this.sourceFolders.get(name);
if (sourceFolder == null) {
sourceFolder = new SourceFolder(name);
this.sourceFolders.put(name, sourceFolder);
}
return sourceFolder;
} | [
"protected",
"final",
"SourceFolder",
"getOrCreateSourceFolder",
"(",
"String",
"name",
")",
"{",
"SourceFolder",
"sourceFolder",
"=",
"this",
".",
"sourceFolders",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"sourceFolder",
"==",
"null",
")",
"{",
"sourceFo... | Get or create a {@link SourceFolder} with the given name.
@param name the name of the folder
@return an existing or newly added {@link SourceFolder} | [
"Get",
"or",
"create",
"a",
"{"
] | 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#L110-L117 | train | Gets or creates the SourceFolder with the given name. | [
30522,
5123,
2345,
3120,
10371,
2121,
2131,
2953,
16748,
8520,
8162,
3401,
10371,
2121,
1006,
5164,
2171,
1007,
1063,
3120,
10371,
2121,
3120,
10371,
2121,
1027,
2023,
1012,
3120,
10371,
2545,
1012,
2131,
1006,
2171,
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/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java | Task.releaseNetworkResources | private void releaseNetworkResources() {
LOG.debug("Release task {} network resources (state: {}).", taskNameWithSubtask, getExecutionState());
for (ResultPartition partition : producedPartitions) {
taskEventDispatcher.unregisterPartition(partition.getPartitionId());
if (isCanceledOrFailed()) {
partition.fail(getFailureCause());
}
}
closeNetworkResources();
} | java | private void releaseNetworkResources() {
LOG.debug("Release task {} network resources (state: {}).", taskNameWithSubtask, getExecutionState());
for (ResultPartition partition : producedPartitions) {
taskEventDispatcher.unregisterPartition(partition.getPartitionId());
if (isCanceledOrFailed()) {
partition.fail(getFailureCause());
}
}
closeNetworkResources();
} | [
"private",
"void",
"releaseNetworkResources",
"(",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Release task {} network resources (state: {}).\"",
",",
"taskNameWithSubtask",
",",
"getExecutionState",
"(",
")",
")",
";",
"for",
"(",
"ResultPartition",
"partition",
":",
"pro... | Releases network resources before task exits. We should also fail the partition to release if the task
has failed, is canceled, or is being canceled at the moment. | [
"Releases",
"network",
"resources",
"before",
"task",
"exits",
".",
"We",
"should",
"also",
"fail",
"the",
"partition",
"to",
"release",
"if",
"the",
"task",
"has",
"failed",
"is",
"canceled",
"or",
"is",
"being",
"canceled",
"at",
"the",
"moment",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java#L881-L892 | train | Release the network resources associated with this task. | [
30522,
2797,
11675,
2713,
7159,
6198,
6072,
8162,
9623,
1006,
1007,
1063,
8833,
1012,
2139,
8569,
2290,
1006,
1000,
2713,
4708,
1063,
1065,
2897,
4219,
1006,
2110,
1024,
1063,
1065,
1007,
1012,
1000,
1010,
4708,
18442,
24415,
6342,
19279,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/AhoCorasick/AhoCorasickDoubleArrayTrie.java | AhoCorasickDoubleArrayTrie.parseText | public void parseText(String text, IHit<V> processor)
{
int position = 1;
int currentState = 0;
for (int i = 0; i < text.length(); ++i)
{
currentState = getState(currentState, text.charAt(i));
int[] hitArray = output[currentState];
if (hitArray != null)
{
for (int hit : hitArray)
{
processor.hit(position - l[hit], position, v[hit]);
}
}
++position;
}
} | java | public void parseText(String text, IHit<V> processor)
{
int position = 1;
int currentState = 0;
for (int i = 0; i < text.length(); ++i)
{
currentState = getState(currentState, text.charAt(i));
int[] hitArray = output[currentState];
if (hitArray != null)
{
for (int hit : hitArray)
{
processor.hit(position - l[hit], position, v[hit]);
}
}
++position;
}
} | [
"public",
"void",
"parseText",
"(",
"String",
"text",
",",
"IHit",
"<",
"V",
">",
"processor",
")",
"{",
"int",
"position",
"=",
"1",
";",
"int",
"currentState",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"text",
".",
"length... | 处理文本
@param text 文本
@param processor 处理器 | [
"处理文本"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/AhoCorasick/AhoCorasickDoubleArrayTrie.java#L103-L120 | train | Parse text. | [
30522,
2270,
11675,
11968,
13462,
10288,
2102,
1006,
5164,
3793,
1010,
1045,
16584,
1026,
1058,
1028,
13151,
1007,
1063,
20014,
2597,
1027,
1015,
1025,
20014,
14731,
12259,
1027,
1014,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/concurrent/FutureUtils.java | FutureUtils.retry | public static <T> CompletableFuture<T> retry(
final Supplier<CompletableFuture<T>> operation,
final int retries,
final Executor executor) {
final CompletableFuture<T> resultFuture = new CompletableFuture<>();
retryOperation(resultFuture, operation, retries, executor);
return resultFuture;
} | java | public static <T> CompletableFuture<T> retry(
final Supplier<CompletableFuture<T>> operation,
final int retries,
final Executor executor) {
final CompletableFuture<T> resultFuture = new CompletableFuture<>();
retryOperation(resultFuture, operation, retries, executor);
return resultFuture;
} | [
"public",
"static",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"retry",
"(",
"final",
"Supplier",
"<",
"CompletableFuture",
"<",
"T",
">",
">",
"operation",
",",
"final",
"int",
"retries",
",",
"final",
"Executor",
"executor",
")",
"{",
"final",
... | Retry the given operation the given number of times in case of a failure.
@param operation to executed
@param retries if the operation failed
@param executor to use to run the futures
@param <T> type of the result
@return Future containing either the result of the operation or a {@link RetryException} | [
"Retry",
"the",
"given",
"operation",
"the",
"given",
"number",
"of",
"times",
"in",
"case",
"of",
"a",
"failure",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java#L76-L86 | train | Retry a sequence of operations. | [
30522,
2270,
10763,
1026,
1056,
1028,
4012,
10814,
10880,
11263,
11244,
1026,
1056,
1028,
2128,
11129,
1006,
2345,
17024,
1026,
4012,
10814,
10880,
11263,
11244,
1026,
1056,
1028,
1028,
3169,
1010,
2345,
20014,
2128,
21011,
1010,
2345,
4654,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/window/WindowOperator.java | WindowOperator.emitWindowResult | private void emitWindowResult(W window) throws Exception {
BaseRow aggResult = windowFunction.getWindowAggregationResult(window);
if (sendRetraction) {
previousState.setCurrentNamespace(window);
BaseRow previousAggResult = previousState.value();
// has emitted result for the window
if (previousAggResult != null) {
// current agg is not equal to the previous emitted, should emit retract
if (!equaliser.equalsWithoutHeader(aggResult, previousAggResult)) {
reuseOutput.replace((BaseRow) getCurrentKey(), previousAggResult);
BaseRowUtil.setRetract(reuseOutput);
// send retraction
collector.collect(reuseOutput);
// send accumulate
reuseOutput.replace((BaseRow) getCurrentKey(), aggResult);
BaseRowUtil.setAccumulate(reuseOutput);
collector.collect(reuseOutput);
// update previousState
previousState.update(aggResult);
}
// if the previous agg equals to the current agg, no need to send retract and accumulate
}
// the first fire for the window, only send accumulate
else {
// send accumulate
reuseOutput.replace((BaseRow) getCurrentKey(), aggResult);
BaseRowUtil.setAccumulate(reuseOutput);
collector.collect(reuseOutput);
// update previousState
previousState.update(aggResult);
}
} else {
reuseOutput.replace((BaseRow) getCurrentKey(), aggResult);
// no need to set header
collector.collect(reuseOutput);
}
} | java | private void emitWindowResult(W window) throws Exception {
BaseRow aggResult = windowFunction.getWindowAggregationResult(window);
if (sendRetraction) {
previousState.setCurrentNamespace(window);
BaseRow previousAggResult = previousState.value();
// has emitted result for the window
if (previousAggResult != null) {
// current agg is not equal to the previous emitted, should emit retract
if (!equaliser.equalsWithoutHeader(aggResult, previousAggResult)) {
reuseOutput.replace((BaseRow) getCurrentKey(), previousAggResult);
BaseRowUtil.setRetract(reuseOutput);
// send retraction
collector.collect(reuseOutput);
// send accumulate
reuseOutput.replace((BaseRow) getCurrentKey(), aggResult);
BaseRowUtil.setAccumulate(reuseOutput);
collector.collect(reuseOutput);
// update previousState
previousState.update(aggResult);
}
// if the previous agg equals to the current agg, no need to send retract and accumulate
}
// the first fire for the window, only send accumulate
else {
// send accumulate
reuseOutput.replace((BaseRow) getCurrentKey(), aggResult);
BaseRowUtil.setAccumulate(reuseOutput);
collector.collect(reuseOutput);
// update previousState
previousState.update(aggResult);
}
} else {
reuseOutput.replace((BaseRow) getCurrentKey(), aggResult);
// no need to set header
collector.collect(reuseOutput);
}
} | [
"private",
"void",
"emitWindowResult",
"(",
"W",
"window",
")",
"throws",
"Exception",
"{",
"BaseRow",
"aggResult",
"=",
"windowFunction",
".",
"getWindowAggregationResult",
"(",
"window",
")",
";",
"if",
"(",
"sendRetraction",
")",
"{",
"previousState",
".",
"s... | Emits the window result of the given window. | [
"Emits",
"the",
"window",
"result",
"of",
"the",
"given",
"window",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/WindowOperator.java#L428-L465 | train | Emits the window result. | [
30522,
2797,
11675,
12495,
2102,
11101,
5004,
6072,
11314,
1006,
1059,
3332,
1007,
11618,
6453,
1063,
2918,
10524,
12943,
17603,
23722,
2102,
1027,
3332,
11263,
27989,
1012,
2131,
11101,
21293,
13871,
2890,
12540,
6072,
11314,
1006,
3332,
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/collection/CollUtil.java | CollUtil.addAll | public static <T> Collection<T> addAll(Collection<T> collection, T[] values) {
if (null != collection && null != values) {
for (T value : values) {
collection.add(value);
}
}
return collection;
} | java | public static <T> Collection<T> addAll(Collection<T> collection, T[] values) {
if (null != collection && null != values) {
for (T value : values) {
collection.add(value);
}
}
return collection;
} | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"addAll",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"T",
"[",
"]",
"values",
")",
"{",
"if",
"(",
"null",
"!=",
"collection",
"&&",
"null",
"!=",
"values",
")",
"{",
"for",
... | 加入全部
@param <T> 集合元素类型
@param collection 被加入的集合 {@link Collection}
@param values 要加入的内容数组
@return 原集合
@since 3.0.8 | [
"加入全部"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1801-L1808 | train | Adds all the values to the given collection. | [
30522,
2270,
10763,
1026,
1056,
1028,
3074,
1026,
1056,
1028,
5587,
8095,
1006,
3074,
1026,
1056,
1028,
3074,
1010,
1056,
1031,
1033,
5300,
1007,
1063,
2065,
1006,
19701,
999,
1027,
3074,
1004,
1004,
19701,
999,
1027,
5300,
1007,
1063,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonRowDeserializationSchema.java | JsonRowDeserializationSchema.convert | private Object convert(JsonNode node, TypeInformation<?> info) {
if (info == Types.VOID || node.isNull()) {
return null;
} else if (info == Types.BOOLEAN) {
return node.asBoolean();
} else if (info == Types.STRING) {
return node.asText();
} else if (info == Types.BIG_DEC) {
return node.decimalValue();
} else if (info == Types.BIG_INT) {
return node.bigIntegerValue();
} else if (info == Types.SQL_DATE) {
return Date.valueOf(node.asText());
} else if (info == Types.SQL_TIME) {
// according to RFC 3339 every full-time must have a timezone;
// until we have full timezone support, we only support UTC;
// users can parse their time as string as a workaround
final String time = node.asText();
if (time.indexOf('Z') < 0 || time.indexOf('.') >= 0) {
throw new IllegalStateException(
"Invalid time format. Only a time in UTC timezone without milliseconds is supported yet. " +
"Format: HH:mm:ss'Z'");
}
return Time.valueOf(time.substring(0, time.length() - 1));
} else if (info == Types.SQL_TIMESTAMP) {
// according to RFC 3339 every date-time must have a timezone;
// until we have full timezone support, we only support UTC;
// users can parse their time as string as a workaround
final String timestamp = node.asText();
if (timestamp.indexOf('Z') < 0) {
throw new IllegalStateException(
"Invalid timestamp format. Only a timestamp in UTC timezone is supported yet. " +
"Format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
}
return Timestamp.valueOf(timestamp.substring(0, timestamp.length() - 1).replace('T', ' '));
} else if (info instanceof RowTypeInfo) {
return convertRow(node, (RowTypeInfo) info);
} else if (info instanceof ObjectArrayTypeInfo) {
return convertObjectArray(node, ((ObjectArrayTypeInfo) info).getComponentInfo());
} else if (info instanceof BasicArrayTypeInfo) {
return convertObjectArray(node, ((BasicArrayTypeInfo) info).getComponentInfo());
} else if (info instanceof PrimitiveArrayTypeInfo &&
((PrimitiveArrayTypeInfo) info).getComponentType() == Types.BYTE) {
return convertByteArray(node);
} else {
// for types that were specified without JSON schema
// e.g. POJOs
try {
return objectMapper.treeToValue(node, info.getTypeClass());
} catch (JsonProcessingException e) {
throw new IllegalStateException("Unsupported type information '" + info + "' for node: " + node);
}
}
} | java | private Object convert(JsonNode node, TypeInformation<?> info) {
if (info == Types.VOID || node.isNull()) {
return null;
} else if (info == Types.BOOLEAN) {
return node.asBoolean();
} else if (info == Types.STRING) {
return node.asText();
} else if (info == Types.BIG_DEC) {
return node.decimalValue();
} else if (info == Types.BIG_INT) {
return node.bigIntegerValue();
} else if (info == Types.SQL_DATE) {
return Date.valueOf(node.asText());
} else if (info == Types.SQL_TIME) {
// according to RFC 3339 every full-time must have a timezone;
// until we have full timezone support, we only support UTC;
// users can parse their time as string as a workaround
final String time = node.asText();
if (time.indexOf('Z') < 0 || time.indexOf('.') >= 0) {
throw new IllegalStateException(
"Invalid time format. Only a time in UTC timezone without milliseconds is supported yet. " +
"Format: HH:mm:ss'Z'");
}
return Time.valueOf(time.substring(0, time.length() - 1));
} else if (info == Types.SQL_TIMESTAMP) {
// according to RFC 3339 every date-time must have a timezone;
// until we have full timezone support, we only support UTC;
// users can parse their time as string as a workaround
final String timestamp = node.asText();
if (timestamp.indexOf('Z') < 0) {
throw new IllegalStateException(
"Invalid timestamp format. Only a timestamp in UTC timezone is supported yet. " +
"Format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
}
return Timestamp.valueOf(timestamp.substring(0, timestamp.length() - 1).replace('T', ' '));
} else if (info instanceof RowTypeInfo) {
return convertRow(node, (RowTypeInfo) info);
} else if (info instanceof ObjectArrayTypeInfo) {
return convertObjectArray(node, ((ObjectArrayTypeInfo) info).getComponentInfo());
} else if (info instanceof BasicArrayTypeInfo) {
return convertObjectArray(node, ((BasicArrayTypeInfo) info).getComponentInfo());
} else if (info instanceof PrimitiveArrayTypeInfo &&
((PrimitiveArrayTypeInfo) info).getComponentType() == Types.BYTE) {
return convertByteArray(node);
} else {
// for types that were specified without JSON schema
// e.g. POJOs
try {
return objectMapper.treeToValue(node, info.getTypeClass());
} catch (JsonProcessingException e) {
throw new IllegalStateException("Unsupported type information '" + info + "' for node: " + node);
}
}
} | [
"private",
"Object",
"convert",
"(",
"JsonNode",
"node",
",",
"TypeInformation",
"<",
"?",
">",
"info",
")",
"{",
"if",
"(",
"info",
"==",
"Types",
".",
"VOID",
"||",
"node",
".",
"isNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"i... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonRowDeserializationSchema.java#L141-L194 | train | Convert a JSON node to a Java value. | [
30522,
2797,
4874,
10463,
1006,
1046,
3385,
3630,
3207,
13045,
1010,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
18558,
1007,
1063,
2065,
1006,
18558,
1027,
1027,
4127,
1012,
11675,
1064,
1064,
13045,
1012,
3475,
18083,
1006,
1007,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java | JSONArray.optLong | public long optLong(int index, long fallback) {
Object object = opt(index);
Long result = JSON.toLong(object);
return result != null ? result : fallback;
} | java | public long optLong(int index, long fallback) {
Object object = opt(index);
Long result = JSON.toLong(object);
return result != null ? result : fallback;
} | [
"public",
"long",
"optLong",
"(",
"int",
"index",
",",
"long",
"fallback",
")",
"{",
"Object",
"object",
"=",
"opt",
"(",
"index",
")",
";",
"Long",
"result",
"=",
"JSON",
".",
"toLong",
"(",
"object",
")",
";",
"return",
"result",
"!=",
"null",
"?",... | Returns the value at {@code index} if it exists and is a long or can be coerced to
a long. Returns {@code fallback} otherwise.
@param index the index to get the value from
@param fallback the fallback value
@return the value at {@code index} of {@code fallback} | [
"Returns",
"the",
"value",
"at",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java#L477-L481 | train | Get the optional long value associated with an index. | [
30522,
2270,
2146,
23569,
10052,
1006,
20014,
5950,
1010,
2146,
2991,
5963,
1007,
1063,
4874,
4874,
1027,
23569,
1006,
5950,
1007,
1025,
2146,
2765,
1027,
1046,
3385,
1012,
2000,
10052,
1006,
4874,
1007,
1025,
2709,
2765,
999,
1027,
19701,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateLocation.java | KvStateLocation.registerKvState | public void registerKvState(KeyGroupRange keyGroupRange, KvStateID kvStateId, InetSocketAddress kvStateAddress) {
if (keyGroupRange.getStartKeyGroup() < 0 || keyGroupRange.getEndKeyGroup() >= numKeyGroups) {
throw new IndexOutOfBoundsException("Key group index");
}
for (int kgIdx = keyGroupRange.getStartKeyGroup(); kgIdx <= keyGroupRange.getEndKeyGroup(); ++kgIdx) {
if (kvStateIds[kgIdx] == null && kvStateAddresses[kgIdx] == null) {
numRegisteredKeyGroups++;
}
kvStateIds[kgIdx] = kvStateId;
kvStateAddresses[kgIdx] = kvStateAddress;
}
} | java | public void registerKvState(KeyGroupRange keyGroupRange, KvStateID kvStateId, InetSocketAddress kvStateAddress) {
if (keyGroupRange.getStartKeyGroup() < 0 || keyGroupRange.getEndKeyGroup() >= numKeyGroups) {
throw new IndexOutOfBoundsException("Key group index");
}
for (int kgIdx = keyGroupRange.getStartKeyGroup(); kgIdx <= keyGroupRange.getEndKeyGroup(); ++kgIdx) {
if (kvStateIds[kgIdx] == null && kvStateAddresses[kgIdx] == null) {
numRegisteredKeyGroups++;
}
kvStateIds[kgIdx] = kvStateId;
kvStateAddresses[kgIdx] = kvStateAddress;
}
} | [
"public",
"void",
"registerKvState",
"(",
"KeyGroupRange",
"keyGroupRange",
",",
"KvStateID",
"kvStateId",
",",
"InetSocketAddress",
"kvStateAddress",
")",
"{",
"if",
"(",
"keyGroupRange",
".",
"getStartKeyGroup",
"(",
")",
"<",
"0",
"||",
"keyGroupRange",
".",
"g... | Registers a KvState instance for the given key group index.
@param keyGroupRange Key group range to register
@param kvStateId ID of the KvState instance at the key group index.
@param kvStateAddress Server address of the KvState instance at the key group index.
@throws IndexOutOfBoundsException If key group range start < 0 or key group range end >= Number of key groups | [
"Registers",
"a",
"KvState",
"instance",
"for",
"the",
"given",
"key",
"group",
"index",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateLocation.java#L171-L186 | train | Registers a KvState with the KvStateManager. | [
30522,
2270,
11675,
4236,
2243,
15088,
12259,
1006,
3145,
17058,
24388,
2063,
3145,
17058,
24388,
2063,
1010,
24888,
9153,
2618,
3593,
24888,
9153,
2618,
3593,
1010,
1999,
8454,
7432,
12928,
14141,
8303,
24888,
9153,
14565,
16200,
4757,
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-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.getFloat | public float getFloat(String key, float defaultValue) {
Object o = getRawValue(key);
if (o == null) {
return defaultValue;
}
return convertToFloat(o, defaultValue);
} | java | public float getFloat(String key, float defaultValue) {
Object o = getRawValue(key);
if (o == null) {
return defaultValue;
}
return convertToFloat(o, defaultValue);
} | [
"public",
"float",
"getFloat",
"(",
"String",
"key",
",",
"float",
"defaultValue",
")",
"{",
"Object",
"o",
"=",
"getRawValue",
"(",
"key",
")",
";",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"return",
"convertToFloat",
... | Returns the value associated with the given key as a float.
@param key
the key pointing to the associated value
@param defaultValue
the default value which is returned in case there is no value associated with the given key
@return the (default) value associated with the given key | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"key",
"as",
"a",
"float",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L426-L433 | train | Returns the float value for the given key. The defaultValue is returned if the key does not exist or if the value is not a float. | [
30522,
2270,
14257,
2131,
10258,
16503,
1006,
5164,
3145,
1010,
14257,
12398,
10175,
5657,
1007,
1063,
4874,
1051,
1027,
2131,
2527,
2860,
10175,
5657,
1006,
3145,
1007,
1025,
2065,
1006,
1051,
1027,
1027,
19701,
1007,
1063,
2709,
12398,
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-java/src/main/java/org/apache/flink/api/java/sampling/DistributedRandomSampler.java | DistributedRandomSampler.sample | @Override
public Iterator<T> sample(Iterator<T> input) {
return sampleInCoordinator(sampleInPartition(input));
} | java | @Override
public Iterator<T> sample(Iterator<T> input) {
return sampleInCoordinator(sampleInPartition(input));
} | [
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"sample",
"(",
"Iterator",
"<",
"T",
">",
"input",
")",
"{",
"return",
"sampleInCoordinator",
"(",
"sampleInPartition",
"(",
"input",
")",
")",
";",
"}"
] | Combine the first phase and second phase in sequence, implemented for test purpose only.
@param input Source data.
@return Sample result in sequence. | [
"Combine",
"the",
"first",
"phase",
"and",
"second",
"phase",
"in",
"sequence",
"implemented",
"for",
"test",
"purpose",
"only",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/sampling/DistributedRandomSampler.java#L125-L128 | train | Sample in the coordinator. | [
30522,
1030,
2058,
15637,
2270,
2009,
6906,
4263,
1026,
1056,
1028,
7099,
1006,
2009,
6906,
4263,
1026,
1056,
1028,
7953,
1007,
1063,
2709,
7099,
2378,
3597,
8551,
23207,
1006,
7099,
2378,
19362,
3775,
3508,
1006,
7953,
1007,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/bootstrap/Bootstrap.java | Bootstrap.connect | public ChannelFuture connect(SocketAddress remoteAddress) {
if (remoteAddress == null) {
throw new NullPointerException("remoteAddress");
}
validate();
return doResolveAndConnect(remoteAddress, config.localAddress());
} | java | public ChannelFuture connect(SocketAddress remoteAddress) {
if (remoteAddress == null) {
throw new NullPointerException("remoteAddress");
}
validate();
return doResolveAndConnect(remoteAddress, config.localAddress());
} | [
"public",
"ChannelFuture",
"connect",
"(",
"SocketAddress",
"remoteAddress",
")",
"{",
"if",
"(",
"remoteAddress",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"remoteAddress\"",
")",
";",
"}",
"validate",
"(",
")",
";",
"return",
"do... | Connect a {@link Channel} to the remote peer. | [
"Connect",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/bootstrap/Bootstrap.java#L139-L146 | train | Connects to the remote address. | [
30522,
2270,
3149,
11263,
11244,
7532,
1006,
22278,
4215,
16200,
4757,
6556,
4215,
16200,
4757,
1007,
1063,
2065,
1006,
6556,
4215,
16200,
4757,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
6556,
42... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java | JobMaster.handleJobMasterError | private void handleJobMasterError(final Throwable cause) {
if (ExceptionUtils.isJvmFatalError(cause)) {
log.error("Fatal error occurred on JobManager.", cause);
// The fatal error handler implementation should make sure that this call is non-blocking
fatalErrorHandler.onFatalError(cause);
} else {
jobCompletionActions.jobMasterFailed(cause);
}
} | java | private void handleJobMasterError(final Throwable cause) {
if (ExceptionUtils.isJvmFatalError(cause)) {
log.error("Fatal error occurred on JobManager.", cause);
// The fatal error handler implementation should make sure that this call is non-blocking
fatalErrorHandler.onFatalError(cause);
} else {
jobCompletionActions.jobMasterFailed(cause);
}
} | [
"private",
"void",
"handleJobMasterError",
"(",
"final",
"Throwable",
"cause",
")",
"{",
"if",
"(",
"ExceptionUtils",
".",
"isJvmFatalError",
"(",
"cause",
")",
")",
"{",
"log",
".",
"error",
"(",
"\"Fatal error occurred on JobManager.\"",
",",
"cause",
")",
";"... | ---------------------------------------------------------------------------------------------- | [
"----------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java#L1141-L1149 | train | Handle a job master error. | [
30522,
2797,
11675,
5047,
5558,
25526,
24268,
2121,
29165,
1006,
2345,
5466,
3085,
3426,
1007,
1063,
2065,
1006,
6453,
21823,
4877,
1012,
2003,
3501,
2615,
2213,
27753,
9453,
18933,
2099,
1006,
3426,
1007,
1007,
1063,
8833,
1012,
7561,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java | IOUtil.fileList | public static List<File> fileList(String path)
{
List<File> fileList = new LinkedList<File>();
File folder = new File(path);
if (folder.isDirectory())
enumerate(folder, fileList);
else
fileList.add(folder); // 兼容路径为文件的情况
return fileList;
} | java | public static List<File> fileList(String path)
{
List<File> fileList = new LinkedList<File>();
File folder = new File(path);
if (folder.isDirectory())
enumerate(folder, fileList);
else
fileList.add(folder); // 兼容路径为文件的情况
return fileList;
} | [
"public",
"static",
"List",
"<",
"File",
">",
"fileList",
"(",
"String",
"path",
")",
"{",
"List",
"<",
"File",
">",
"fileList",
"=",
"new",
"LinkedList",
"<",
"File",
">",
"(",
")",
";",
"File",
"folder",
"=",
"new",
"File",
"(",
"path",
")",
";",... | 递归遍历获取目录下的所有文件
@param path 根目录
@return 文件列表 | [
"递归遍历获取目录下的所有文件"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java#L425-L434 | train | Get a list of files from a path. | [
30522,
2270,
10763,
2862,
1026,
5371,
1028,
5371,
9863,
1006,
5164,
4130,
1007,
1063,
2862,
1026,
5371,
1028,
5371,
9863,
1027,
2047,
5799,
9863,
1026,
5371,
1028,
1006,
1007,
1025,
5371,
19622,
1027,
2047,
5371,
1006,
4130,
1007,
1025,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java | SqlDateTimeUtils.dateFormat | public static String dateFormat(long ts, String format, TimeZone tz) {
SimpleDateFormat formatter = FORMATTER_CACHE.get(format);
formatter.setTimeZone(tz);
Date dateTime = new Date(ts);
return formatter.format(dateTime);
} | java | public static String dateFormat(long ts, String format, TimeZone tz) {
SimpleDateFormat formatter = FORMATTER_CACHE.get(format);
formatter.setTimeZone(tz);
Date dateTime = new Date(ts);
return formatter.format(dateTime);
} | [
"public",
"static",
"String",
"dateFormat",
"(",
"long",
"ts",
",",
"String",
"format",
",",
"TimeZone",
"tz",
")",
"{",
"SimpleDateFormat",
"formatter",
"=",
"FORMATTER_CACHE",
".",
"get",
"(",
"format",
")",
";",
"formatter",
".",
"setTimeZone",
"(",
"tz",... | Format a timestamp as specific.
@param ts the timestamp to format.
@param format the string formatter.
@param tz the time zone | [
"Format",
"a",
"timestamp",
"as",
"specific",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L326-L331 | train | Format a timestamp in the specified format using the specified timezone. | [
30522,
2270,
10763,
5164,
3058,
14192,
4017,
1006,
2146,
24529,
1010,
5164,
4289,
1010,
2051,
15975,
1056,
2480,
1007,
1063,
3722,
13701,
14192,
4017,
4289,
3334,
1027,
4289,
3334,
1035,
17053,
1012,
2131,
1006,
4289,
1007,
1025,
4289,
3334... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.train | public BinaryClassificationFMeasure train(String corpus, int maxIteration, boolean averagePerceptron)
{
FeatureMap featureMap = new LockableFeatureMap(new TagSet(TaskType.CLASSIFICATION));
featureMap.mutable = true; // 训练时特征映射可拓充
Instance[] instanceList = readInstance(corpus, featureMap);
model = averagePerceptron ? trainAveragedPerceptron(instanceList, featureMap, maxIteration)
: trainNaivePerceptron(instanceList, featureMap, maxIteration);
featureMap.mutable = false; // 训练结束后特征不可写
return evaluate(instanceList);
} | java | public BinaryClassificationFMeasure train(String corpus, int maxIteration, boolean averagePerceptron)
{
FeatureMap featureMap = new LockableFeatureMap(new TagSet(TaskType.CLASSIFICATION));
featureMap.mutable = true; // 训练时特征映射可拓充
Instance[] instanceList = readInstance(corpus, featureMap);
model = averagePerceptron ? trainAveragedPerceptron(instanceList, featureMap, maxIteration)
: trainNaivePerceptron(instanceList, featureMap, maxIteration);
featureMap.mutable = false; // 训练结束后特征不可写
return evaluate(instanceList);
} | [
"public",
"BinaryClassificationFMeasure",
"train",
"(",
"String",
"corpus",
",",
"int",
"maxIteration",
",",
"boolean",
"averagePerceptron",
")",
"{",
"FeatureMap",
"featureMap",
"=",
"new",
"LockableFeatureMap",
"(",
"new",
"TagSet",
"(",
"TaskType",
".",
"CLASSIFI... | 训练
@param corpus 语料库
@param maxIteration 最大迭代次数
@param averagePerceptron 是否使用平均感知机算法
@return 模型在训练集上的准确率 | [
"训练"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java#L122-L131 | train | Train a binary classification FMeasure using the specified corpus. | [
30522,
2270,
12441,
26266,
9031,
16715,
5243,
28632,
3345,
1006,
5164,
13931,
1010,
20014,
21510,
14621,
3508,
1010,
22017,
20898,
2779,
4842,
3401,
13876,
4948,
1007,
1063,
3444,
2863,
2361,
3444,
2863,
2361,
1027,
2047,
5843,
3085,
7959,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple7.java | Tuple7.copy | @Override
@SuppressWarnings("unchecked")
public Tuple7<T0, T1, T2, T3, T4, T5, T6> copy() {
return new Tuple7<>(this.f0,
this.f1,
this.f2,
this.f3,
this.f4,
this.f5,
this.f6);
} | java | @Override
@SuppressWarnings("unchecked")
public Tuple7<T0, T1, T2, T3, T4, T5, T6> copy() {
return new Tuple7<>(this.f0,
this.f1,
this.f2,
this.f3,
this.f4,
this.f5,
this.f6);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Tuple7",
"<",
"T0",
",",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
">",
"copy",
"(",
")",
"{",
"return",
"new",
"Tuple7",
"<>",
"(",
"this",
".",
"... | Shallow tuple copy.
@return A new Tuple with the same fields as this. | [
"Shallow",
"tuple",
"copy",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple7.java#L248-L258 | train | Returns a copy of this tuple. | [
30522,
1030,
2058,
15637,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10722,
10814,
2581,
1026,
1056,
2692,
1010,
1056,
2487,
1010,
1056,
2475,
1010,
1056,
2509,
1010,
1056,
2549,
1010,
1056,
2629,
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... |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/internal/ExternalSessionKey.java | ExternalSessionKey.fromJsonResponseBody | public static ExternalSessionKey fromJsonResponseBody(String responseBody) {
try {
Map<String, Object> json = new Json().toType(responseBody, MAP_TYPE);
if (json.get("sessionId") instanceof String) {
return new ExternalSessionKey((String) json.get("sessionId"));
}
// W3C response
if (json.get("value") instanceof Map) {
Map<?, ?> value = (Map<?, ?>) json.get("value");
if (value.get("sessionId") instanceof String) {
return new ExternalSessionKey((String) value.get("sessionId"));
}
}
} catch (JsonException | ClassCastException e) {
return null;
}
return null;
} | java | public static ExternalSessionKey fromJsonResponseBody(String responseBody) {
try {
Map<String, Object> json = new Json().toType(responseBody, MAP_TYPE);
if (json.get("sessionId") instanceof String) {
return new ExternalSessionKey((String) json.get("sessionId"));
}
// W3C response
if (json.get("value") instanceof Map) {
Map<?, ?> value = (Map<?, ?>) json.get("value");
if (value.get("sessionId") instanceof String) {
return new ExternalSessionKey((String) value.get("sessionId"));
}
}
} catch (JsonException | ClassCastException e) {
return null;
}
return null;
} | [
"public",
"static",
"ExternalSessionKey",
"fromJsonResponseBody",
"(",
"String",
"responseBody",
")",
"{",
"try",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"json",
"=",
"new",
"Json",
"(",
")",
".",
"toType",
"(",
"responseBody",
",",
"MAP_TYPE",
")",
... | Extract the external key from the server response for a selenium2 new session request.
The response body is expected to be of the form {"status":0,"sessionId":"XXXX",...}.
@param responseBody the response body to parse
@return the extracted ExternalKey, or null if one was not found. | [
"Extract",
"the",
"external",
"key",
"from",
"the",
"server",
"response",
"for",
"a",
"selenium2",
"new",
"session",
"request",
".",
"The",
"response",
"body",
"is",
"expected",
"to",
"be",
"of",
"the",
"form",
"{",
"status",
":",
"0",
"sessionId",
":",
... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/ExternalSessionKey.java#L103-L122 | train | This method is used to create an ExternalSessionKey object from a JSON response body. | [
30522,
2270,
10763,
6327,
8583,
10992,
14839,
2013,
22578,
2239,
6072,
26029,
3366,
23684,
1006,
5164,
3433,
23684,
1007,
1063,
3046,
1063,
4949,
1026,
5164,
1010,
4874,
1028,
1046,
3385,
1027,
2047,
1046,
3385,
1006,
1007,
1012,
2000,
1387... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-container/src/main/java/org/apache/flink/container/entrypoint/JarManifestParser.java | JarManifestParser.findFirstManifestAttribute | private static Optional<String> findFirstManifestAttribute(File jarFile, String... attributes) throws IOException {
if (attributes.length == 0) {
return Optional.empty();
}
try (JarFile f = new JarFile(jarFile)) {
return findFirstManifestAttribute(f, attributes);
}
} | java | private static Optional<String> findFirstManifestAttribute(File jarFile, String... attributes) throws IOException {
if (attributes.length == 0) {
return Optional.empty();
}
try (JarFile f = new JarFile(jarFile)) {
return findFirstManifestAttribute(f, attributes);
}
} | [
"private",
"static",
"Optional",
"<",
"String",
">",
"findFirstManifestAttribute",
"(",
"File",
"jarFile",
",",
"String",
"...",
"attributes",
")",
"throws",
"IOException",
"{",
"if",
"(",
"attributes",
".",
"length",
"==",
"0",
")",
"{",
"return",
"Optional",... | Returns the value of the first manifest attribute found in the provided JAR file.
@param jarFile JAR file to parse
@param attributes Attributes to check
@return Optional holding value of first found attribute
@throws IOException If there is an error accessing the JAR | [
"Returns",
"the",
"value",
"of",
"the",
"first",
"manifest",
"attribute",
"found",
"in",
"the",
"provided",
"JAR",
"file",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-container/src/main/java/org/apache/flink/container/entrypoint/JarManifestParser.java#L119-L126 | train | Find the first manifest attribute of the given jar file. | [
30522,
2797,
10763,
11887,
1026,
5164,
1028,
2424,
8873,
12096,
20799,
14081,
19321,
3089,
8569,
2618,
1006,
5371,
15723,
8873,
2571,
1010,
5164,
1012,
1012,
1012,
12332,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
12332,
1012,
3091,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/SortUtil.java | SortUtil.putDecimalNormalizedKey | public static void putDecimalNormalizedKey(
Decimal record, MemorySegment target, int offset, int len) {
assert record.getPrecision() <= Decimal.MAX_COMPACT_PRECISION;
putLongNormalizedKey(record.toUnscaledLong(), target, offset, len);
} | java | public static void putDecimalNormalizedKey(
Decimal record, MemorySegment target, int offset, int len) {
assert record.getPrecision() <= Decimal.MAX_COMPACT_PRECISION;
putLongNormalizedKey(record.toUnscaledLong(), target, offset, len);
} | [
"public",
"static",
"void",
"putDecimalNormalizedKey",
"(",
"Decimal",
"record",
",",
"MemorySegment",
"target",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"assert",
"record",
".",
"getPrecision",
"(",
")",
"<=",
"Decimal",
".",
"MAX_COMPACT_PRECISION",
... | Just support the compact precision decimal. | [
"Just",
"support",
"the",
"compact",
"precision",
"decimal",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/SortUtil.java#L90-L94 | train | Put a normalized key in MemorySegment. | [
30522,
2270,
30524,
9067,
12131,
9067,
3550,
14839,
1006,
26066,
2501,
1010,
3638,
3366,
21693,
4765,
4539,
1010,
20014,
16396,
1010,
20014,
18798,
1007,
1063,
20865,
2501,
1012,
2131,
28139,
28472,
1006,
1007,
1026,
1027,
26066,
1012,
4098,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.toBuffered | public static BufferedInputStream toBuffered(InputStream in) {
return (in instanceof BufferedInputStream) ? (BufferedInputStream) in : new BufferedInputStream(in);
} | java | public static BufferedInputStream toBuffered(InputStream in) {
return (in instanceof BufferedInputStream) ? (BufferedInputStream) in : new BufferedInputStream(in);
} | [
"public",
"static",
"BufferedInputStream",
"toBuffered",
"(",
"InputStream",
"in",
")",
"{",
"return",
"(",
"in",
"instanceof",
"BufferedInputStream",
")",
"?",
"(",
"BufferedInputStream",
")",
"in",
":",
"new",
"BufferedInputStream",
"(",
"in",
")",
";",
"}"
] | 转换为{@link BufferedInputStream}
@param in {@link InputStream}
@return {@link BufferedInputStream}
@since 4.0.10 | [
"转换为",
"{",
"@link",
"BufferedInputStream",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L803-L805 | train | Converts an input stream to a buffered input stream. | [
30522,
2270,
10763,
17698,
2098,
2378,
18780,
21422,
2000,
8569,
12494,
2098,
1006,
20407,
25379,
1999,
1007,
1063,
2709,
1006,
1999,
6013,
11253,
17698,
2098,
2378,
18780,
21422,
1007,
1029,
1006,
17698,
2098,
2378,
18780,
21422,
1007,
1999,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/sql/SQLParserFactory.java | SQLParserFactory.newInstance | public static SQLParser newInstance(
final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine, final ShardingTableMetaData shardingTableMetaData, final String sql) {
lexerEngine.nextToken();
TokenType tokenType = lexerEngine.getCurrentToken().getType();
if (DQLStatement.isDQL(tokenType)) {
if (DatabaseType.MySQL == dbType || DatabaseType.H2 == dbType) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
return getDQLParser(dbType, shardingRule, lexerEngine, shardingTableMetaData);
}
if (DMLStatement.isDML(tokenType)) {
if (DatabaseType.MySQL == dbType || DatabaseType.H2 == dbType) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
return getDMLParser(dbType, tokenType, shardingRule, lexerEngine, shardingTableMetaData);
}
if (MySQLKeyword.REPLACE == tokenType) {
if (DatabaseType.MySQL == dbType || DatabaseType.H2 == dbType) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
}
if (TCLStatement.isTCL(tokenType)) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
if (DALStatement.isDAL(tokenType)) {
if (DatabaseType.PostgreSQL == dbType && PostgreSQLKeyword.SHOW == tokenType) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
return getDALParser(dbType, (Keyword) tokenType, shardingRule, lexerEngine);
}
lexerEngine.nextToken();
TokenType secondaryTokenType = lexerEngine.getCurrentToken().getType();
if (DCLStatement.isDCL(tokenType, secondaryTokenType)) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
if (DDLStatement.isDDL(tokenType, secondaryTokenType)) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
if (TCLStatement.isTCLUnsafe(dbType, tokenType, lexerEngine)) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
if (DefaultKeyword.SET.equals(tokenType)) {
return SetParserFactory.newInstance();
}
throw new SQLParsingUnsupportedException(tokenType);
} | java | public static SQLParser newInstance(
final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine, final ShardingTableMetaData shardingTableMetaData, final String sql) {
lexerEngine.nextToken();
TokenType tokenType = lexerEngine.getCurrentToken().getType();
if (DQLStatement.isDQL(tokenType)) {
if (DatabaseType.MySQL == dbType || DatabaseType.H2 == dbType) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
return getDQLParser(dbType, shardingRule, lexerEngine, shardingTableMetaData);
}
if (DMLStatement.isDML(tokenType)) {
if (DatabaseType.MySQL == dbType || DatabaseType.H2 == dbType) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
return getDMLParser(dbType, tokenType, shardingRule, lexerEngine, shardingTableMetaData);
}
if (MySQLKeyword.REPLACE == tokenType) {
if (DatabaseType.MySQL == dbType || DatabaseType.H2 == dbType) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
}
if (TCLStatement.isTCL(tokenType)) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
if (DALStatement.isDAL(tokenType)) {
if (DatabaseType.PostgreSQL == dbType && PostgreSQLKeyword.SHOW == tokenType) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
return getDALParser(dbType, (Keyword) tokenType, shardingRule, lexerEngine);
}
lexerEngine.nextToken();
TokenType secondaryTokenType = lexerEngine.getCurrentToken().getType();
if (DCLStatement.isDCL(tokenType, secondaryTokenType)) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
if (DDLStatement.isDDL(tokenType, secondaryTokenType)) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
if (TCLStatement.isTCLUnsafe(dbType, tokenType, lexerEngine)) {
return new AntlrParsingEngine(dbType, sql, shardingRule, shardingTableMetaData);
}
if (DefaultKeyword.SET.equals(tokenType)) {
return SetParserFactory.newInstance();
}
throw new SQLParsingUnsupportedException(tokenType);
} | [
"public",
"static",
"SQLParser",
"newInstance",
"(",
"final",
"DatabaseType",
"dbType",
",",
"final",
"ShardingRule",
"shardingRule",
",",
"final",
"LexerEngine",
"lexerEngine",
",",
"final",
"ShardingTableMetaData",
"shardingTableMetaData",
",",
"final",
"String",
"sql... | Create SQL parser.
@param dbType database type
@param shardingRule databases and tables sharding rule
@param lexerEngine lexical analysis engine
@param shardingTableMetaData sharding metadata
@param sql sql to parse
@return SQL parser | [
"Create",
"SQL",
"parser",
"."
] | 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/SQLParserFactory.java#L69-L114 | train | Create an instance of SQLParser. | [
30522,
2270,
10763,
29296,
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,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockDecompressor.java | Bzip2BlockDecompressor.decodeNextBWTByte | private int decodeNextBWTByte() {
int mergedPointer = bwtCurrentMergedPointer;
int nextDecodedByte = mergedPointer & 0xff;
bwtCurrentMergedPointer = bwtMergedPointers[mergedPointer >>> 8];
if (blockRandomised) {
if (--randomCount == 0) {
nextDecodedByte ^= 1;
randomIndex = (randomIndex + 1) % 512;
randomCount = Bzip2Rand.rNums(randomIndex);
}
}
bwtBytesDecoded++;
return nextDecodedByte;
} | java | private int decodeNextBWTByte() {
int mergedPointer = bwtCurrentMergedPointer;
int nextDecodedByte = mergedPointer & 0xff;
bwtCurrentMergedPointer = bwtMergedPointers[mergedPointer >>> 8];
if (blockRandomised) {
if (--randomCount == 0) {
nextDecodedByte ^= 1;
randomIndex = (randomIndex + 1) % 512;
randomCount = Bzip2Rand.rNums(randomIndex);
}
}
bwtBytesDecoded++;
return nextDecodedByte;
} | [
"private",
"int",
"decodeNextBWTByte",
"(",
")",
"{",
"int",
"mergedPointer",
"=",
"bwtCurrentMergedPointer",
";",
"int",
"nextDecodedByte",
"=",
"mergedPointer",
"&",
"0xff",
";",
"bwtCurrentMergedPointer",
"=",
"bwtMergedPointers",
"[",
"mergedPointer",
">>>",
"8",
... | Decodes a byte from the Burrows-Wheeler Transform stage. If the block has randomisation
applied, reverses the randomisation.
@return The decoded byte | [
"Decodes",
"a",
"byte",
"from",
"the",
"Burrows",
"-",
"Wheeler",
"Transform",
"stage",
".",
"If",
"the",
"block",
"has",
"randomisation",
"applied",
"reverses",
"the",
"randomisation",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockDecompressor.java#L309-L324 | train | Decode the next BWT byte. | [
30522,
2797,
20014,
21933,
4181,
10288,
2102,
2497,
26677,
3762,
2618,
1006,
1007,
1063,
20014,
5314,
8400,
2121,
1027,
1038,
26677,
10841,
14343,
3372,
5017,
5999,
8400,
2121,
1025,
20014,
2279,
3207,
16044,
18939,
17250,
1027,
5314,
8400,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/socket/nio/ProtocolFamilyConverter.java | ProtocolFamilyConverter.convert | public static ProtocolFamily convert(InternetProtocolFamily family) {
switch (family) {
case IPv4:
return StandardProtocolFamily.INET;
case IPv6:
return StandardProtocolFamily.INET6;
default:
throw new IllegalArgumentException();
}
} | java | public static ProtocolFamily convert(InternetProtocolFamily family) {
switch (family) {
case IPv4:
return StandardProtocolFamily.INET;
case IPv6:
return StandardProtocolFamily.INET6;
default:
throw new IllegalArgumentException();
}
} | [
"public",
"static",
"ProtocolFamily",
"convert",
"(",
"InternetProtocolFamily",
"family",
")",
"{",
"switch",
"(",
"family",
")",
"{",
"case",
"IPv4",
":",
"return",
"StandardProtocolFamily",
".",
"INET",
";",
"case",
"IPv6",
":",
"return",
"StandardProtocolFamily... | Convert the {@link InternetProtocolFamily}. This MUST only be called on jdk version >= 7. | [
"Convert",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/socket/nio/ProtocolFamilyConverter.java#L35-L44 | train | Convert the InternetProtocolFamily to the standard protocol family. | [
30522,
2270,
10763,
8778,
7011,
4328,
2135,
10463,
1006,
4274,
21572,
3406,
25778,
7011,
4328,
2135,
2155,
1007,
1063,
6942,
1006,
2155,
1007,
1063,
2553,
12997,
2615,
2549,
1024,
2709,
3115,
21572,
3406,
25778,
7011,
4328,
2135,
1012,
1999... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java | HMac.digest | public byte[] digest(File file) throws CryptoException{
InputStream in = null;
try {
in = FileUtil.getInputStream(file);
return digest(in);
} finally{
IoUtil.close(in);
}
} | java | public byte[] digest(File file) throws CryptoException{
InputStream in = null;
try {
in = FileUtil.getInputStream(file);
return digest(in);
} finally{
IoUtil.close(in);
}
} | [
"public",
"byte",
"[",
"]",
"digest",
"(",
"File",
"file",
")",
"throws",
"CryptoException",
"{",
"InputStream",
"in",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"FileUtil",
".",
"getInputStream",
"(",
"file",
")",
";",
"return",
"digest",
"(",
"in",
")"... | 生成文件摘要<br>
使用默认缓存大小,见 {@link IoUtil#DEFAULT_BUFFER_SIZE}
@param file 被摘要文件
@return 摘要bytes
@throws CryptoException Cause by IOException | [
"生成文件摘要<br",
">",
"使用默认缓存大小,见",
"{",
"@link",
"IoUtil#DEFAULT_BUFFER_SIZE",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java#L146-L154 | train | Digests the contents of the specified file. | [
30522,
2270,
24880,
1031,
1033,
17886,
1006,
5371,
5371,
1007,
11618,
19888,
8913,
2595,
24422,
1063,
20407,
25379,
1999,
1027,
19701,
1025,
3046,
1063,
1999,
1027,
5371,
21823,
2140,
1012,
2131,
2378,
18780,
21422,
1006,
5371,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java | HttpPostRequestEncoder.addBodyFileUploads | public void addBodyFileUploads(String name, File[] file, String[] contentType, boolean[] isText)
throws ErrorDataEncoderException {
if (file.length != contentType.length && file.length != isText.length) {
throw new IllegalArgumentException("Different array length");
}
for (int i = 0; i < file.length; i++) {
addBodyFileUpload(name, file[i], contentType[i], isText[i]);
}
} | java | public void addBodyFileUploads(String name, File[] file, String[] contentType, boolean[] isText)
throws ErrorDataEncoderException {
if (file.length != contentType.length && file.length != isText.length) {
throw new IllegalArgumentException("Different array length");
}
for (int i = 0; i < file.length; i++) {
addBodyFileUpload(name, file[i], contentType[i], isText[i]);
}
} | [
"public",
"void",
"addBodyFileUploads",
"(",
"String",
"name",
",",
"File",
"[",
"]",
"file",
",",
"String",
"[",
"]",
"contentType",
",",
"boolean",
"[",
"]",
"isText",
")",
"throws",
"ErrorDataEncoderException",
"{",
"if",
"(",
"file",
".",
"length",
"!=... | Add a series of Files associated with one File parameter
@param name
the name of the parameter
@param file
the array of files
@param contentType
the array of content Types associated with each file
@param isText
the array of isText attribute (False meaning binary mode) for each file
@throws IllegalArgumentException
also throws if array have different sizes
@throws ErrorDataEncoderException
if the encoding is in error or if the finalize were already done | [
"Add",
"a",
"series",
"of",
"Files",
"associated",
"with",
"one",
"File",
"parameter"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java#L429-L437 | train | Add a file array to the application. | [
30522,
2270,
11675,
5587,
23684,
8873,
2571,
6279,
11066,
2015,
1006,
5164,
2171,
1010,
5371,
1031,
1033,
5371,
1010,
5164,
1031,
1033,
4180,
13874,
1010,
22017,
20898,
1031,
1033,
21541,
10288,
2102,
1007,
11618,
7561,
2850,
2696,
2368,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONUtil.java | JSONUtil.quote | public static Writer quote(String str, Writer writer) throws IOException {
return quote(str, writer, true);
} | java | public static Writer quote(String str, Writer writer) throws IOException {
return quote(str, writer, true);
} | [
"public",
"static",
"Writer",
"quote",
"(",
"String",
"str",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"return",
"quote",
"(",
"str",
",",
"writer",
",",
"true",
")",
";",
"}"
] | 对所有双引号做转义处理(使用双反斜杠做转义)<br>
为了能在HTML中较好的显示,会将</转义为<\/<br>
JSON字符串中不能包含控制字符和未经转义的引号和反斜杠
@param str 字符串
@param writer Writer
@return Writer
@throws IOException IO异常 | [
"对所有双引号做转义处理(使用双反斜杠做转义)<br",
">",
"为了能在HTML中较好的显示,会将<",
";",
"/",
"转义为<",
";",
"\\",
"/",
"<br",
">",
"JSON字符串中不能包含控制字符和未经转义的引号和反斜杠"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L482-L484 | train | Quote a string and write it to a Writer. | [
30522,
2270,
10763,
3213,
14686,
1006,
5164,
2358,
2099,
1010,
3213,
3213,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
14686,
1006,
2358,
2099,
1010,
3213,
1010,
2995,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/util/AdapterMap.java | AdapterMap.adapt | public static PyObject adapt(Object o) {
if (o instanceof PyObject) {
return (PyObject) o;
}
return Py.java2py(o);
} | java | public static PyObject adapt(Object o) {
if (o instanceof PyObject) {
return (PyObject) o;
}
return Py.java2py(o);
} | [
"public",
"static",
"PyObject",
"adapt",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"o",
"instanceof",
"PyObject",
")",
"{",
"return",
"(",
"PyObject",
")",
"o",
";",
"}",
"return",
"Py",
".",
"java2py",
"(",
"o",
")",
";",
"}"
] | Convert java object to its corresponding PyObject representation.
@param o Java object
@return PyObject | [
"Convert",
"java",
"object",
"to",
"its",
"corresponding",
"PyObject",
"representation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/util/AdapterMap.java#L41-L46 | train | Adapts a Java object to a PyObject. | [
30522,
2270,
10763,
1052,
7677,
2497,
20614,
15581,
1006,
4874,
1051,
1007,
1063,
2065,
1006,
1051,
6013,
11253,
1052,
7677,
2497,
20614,
1007,
1063,
2709,
1006,
1052,
7677,
2497,
20614,
1007,
1051,
1025,
1065,
2709,
1052,
2100,
1012,
9262,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.mapVertices | @SuppressWarnings({ "unchecked", "rawtypes" })
public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper) {
TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertices.getType()).getTypeAt(0);
TypeInformation<NV> valueType;
if (mapper instanceof ResultTypeQueryable) {
valueType = ((ResultTypeQueryable) mapper).getProducedType();
} else {
valueType = TypeExtractor.createTypeInfo(MapFunction.class, mapper.getClass(), 1, vertices.getType(), null);
}
TypeInformation<Vertex<K, NV>> returnType = (TypeInformation<Vertex<K, NV>>) new TupleTypeInfo(
Vertex.class, keyType, valueType);
return mapVertices(mapper, returnType);
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper) {
TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertices.getType()).getTypeAt(0);
TypeInformation<NV> valueType;
if (mapper instanceof ResultTypeQueryable) {
valueType = ((ResultTypeQueryable) mapper).getProducedType();
} else {
valueType = TypeExtractor.createTypeInfo(MapFunction.class, mapper.getClass(), 1, vertices.getType(), null);
}
TypeInformation<Vertex<K, NV>> returnType = (TypeInformation<Vertex<K, NV>>) new TupleTypeInfo(
Vertex.class, keyType, valueType);
return mapVertices(mapper, returnType);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"<",
"NV",
">",
"Graph",
"<",
"K",
",",
"NV",
",",
"EV",
">",
"mapVertices",
"(",
"final",
"MapFunction",
"<",
"Vertex",
"<",
"K",
",",
"VV",
">",
",",
"NV",... | Apply a function to the attribute of each vertex in the graph.
@param mapper the map function to apply.
@return a new graph | [
"Apply",
"a",
"function",
"to",
"the",
"attribute",
"of",
"each",
"vertex",
"in",
"the",
"graph",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L527-L544 | train | Maps the set of vertices to a graph. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
4895,
5403,
18141,
1000,
1010,
1000,
6315,
13874,
2015,
1000,
1065,
1007,
2270,
1026,
1050,
2615,
1028,
10629,
1026,
1047,
1010,
1050,
2615,
1010,
23408,
1028,
4949,
16874,
23522,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java | AbstractTrafficShapingHandler.setReadLimit | public void setReadLimit(long readLimit) {
this.readLimit = readLimit;
if (trafficCounter != null) {
trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano());
}
} | java | public void setReadLimit(long readLimit) {
this.readLimit = readLimit;
if (trafficCounter != null) {
trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano());
}
} | [
"public",
"void",
"setReadLimit",
"(",
"long",
"readLimit",
")",
"{",
"this",
".",
"readLimit",
"=",
"readLimit",
";",
"if",
"(",
"trafficCounter",
"!=",
"null",
")",
"{",
"trafficCounter",
".",
"resetAccounting",
"(",
"TrafficCounter",
".",
"milliSecondFromNano... | <p>Note the change will be taken as best effort, meaning
that all already scheduled traffics will not be
changed, but only applied to new traffics.</p>
<p>So the expected usage of this method is to be used not too often,
accordingly to the traffic shaping configuration.</p>
@param readLimit the readLimit to set | [
"<p",
">",
"Note",
"the",
"change",
"will",
"be",
"taken",
"as",
"best",
"effort",
"meaning",
"that",
"all",
"already",
"scheduled",
"traffics",
"will",
"not",
"be",
"changed",
"but",
"only",
"applied",
"to",
"new",
"traffics",
".",
"<",
"/",
"p",
">",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java#L312-L317 | train | Sets the readLimit value. | [
30522,
2270,
11675,
2275,
16416,
19422,
27605,
2102,
1006,
2146,
3191,
17960,
4183,
1007,
1063,
2023,
1012,
3191,
17960,
4183,
1027,
3191,
17960,
4183,
1025,
2065,
1006,
4026,
3597,
16671,
2121,
999,
1027,
19701,
1007,
1063,
4026,
3597,
166... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.getString | public static String getString(InputStream in, Charset charset, boolean isGetCharsetFromContent) throws IOException {
final byte[] contentBytes = IoUtil.readBytes(in);
return getString(contentBytes, charset, isGetCharsetFromContent);
} | java | public static String getString(InputStream in, Charset charset, boolean isGetCharsetFromContent) throws IOException {
final byte[] contentBytes = IoUtil.readBytes(in);
return getString(contentBytes, charset, isGetCharsetFromContent);
} | [
"public",
"static",
"String",
"getString",
"(",
"InputStream",
"in",
",",
"Charset",
"charset",
",",
"boolean",
"isGetCharsetFromContent",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"contentBytes",
"=",
"IoUtil",
".",
"readBytes",
"(",
"in",
... | 从流中读取内容<br>
首先尝试使用charset编码读取内容(如果为空默认UTF-8),如果isGetCharsetFromContent为true,则通过正则在正文中获取编码信息,转换为指定编码;
@param in 输入流
@param charset 字符集
@param isGetCharsetFromContent 是否从返回内容中获得编码信息
@return 内容
@throws IOException IO异常 | [
"从流中读取内容<br",
">",
"首先尝试使用charset编码读取内容(如果为空默认UTF",
"-",
"8),如果isGetCharsetFromContent为true,则通过正则在正文中获取编码信息,转换为指定编码;"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L679-L682 | train | Gets the string from the input stream. | [
30522,
2270,
10763,
5164,
4152,
18886,
3070,
1006,
20407,
25379,
1999,
1010,
25869,
13462,
25869,
13462,
1010,
22017,
20898,
2003,
18150,
7507,
22573,
24475,
21716,
8663,
6528,
2102,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
24880,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/digest/Digester.java | Digester.digestWithoutSalt | private byte[] digestWithoutSalt(InputStream data, int bufferLength) throws IOException {
final byte[] buffer = new byte[bufferLength];
int read;
while ((read = data.read(buffer, 0, bufferLength)) > -1) {
this.digest.update(buffer, 0, read);
}
return this.digest.digest();
} | java | private byte[] digestWithoutSalt(InputStream data, int bufferLength) throws IOException {
final byte[] buffer = new byte[bufferLength];
int read;
while ((read = data.read(buffer, 0, bufferLength)) > -1) {
this.digest.update(buffer, 0, read);
}
return this.digest.digest();
} | [
"private",
"byte",
"[",
"]",
"digestWithoutSalt",
"(",
"InputStream",
"data",
",",
"int",
"bufferLength",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"bufferLength",
"]",
";",
"int",
"read",
";",
"while"... | 生成摘要
@param data {@link InputStream} 数据流
@param bufferLength 缓存长度,不足1使用 {@link IoUtil#DEFAULT_BUFFER_SIZE} 做为默认值
@return 摘要bytes
@throws IOException 从流中读取数据引发的IO异常 | [
"生成摘要"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/digest/Digester.java#L356-L363 | train | Digest without salt. | [
30522,
2797,
24880,
1031,
1033,
17886,
24415,
12166,
2389,
2102,
1006,
20407,
25379,
2951,
1010,
20014,
17698,
7770,
13512,
2232,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
24880,
1031,
1033,
17698,
1027,
2047,
24880,
1031,
17698,
7770,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/dialect/log4j2/Log4j2Log.java | Log4j2Log.logIfEnabled | private boolean logIfEnabled(String fqcn, Level level, Throwable t, String msgTemplate, Object... arguments) {
if(this.logger instanceof AbstractLogger){
((AbstractLogger)this.logger).logIfEnabled(fqcn, level, null, StrUtil.format(msgTemplate, arguments), t);
return true;
}else{
return false;
}
} | java | private boolean logIfEnabled(String fqcn, Level level, Throwable t, String msgTemplate, Object... arguments) {
if(this.logger instanceof AbstractLogger){
((AbstractLogger)this.logger).logIfEnabled(fqcn, level, null, StrUtil.format(msgTemplate, arguments), t);
return true;
}else{
return false;
}
} | [
"private",
"boolean",
"logIfEnabled",
"(",
"String",
"fqcn",
",",
"Level",
"level",
",",
"Throwable",
"t",
",",
"String",
"msgTemplate",
",",
"Object",
"...",
"arguments",
")",
"{",
"if",
"(",
"this",
".",
"logger",
"instanceof",
"AbstractLogger",
")",
"{",
... | 打印日志<br>
此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题
@param fqcn 完全限定类名(Fully Qualified Class Name),用于纠正定位错误行号
@param level 日志级别,使用org.apache.logging.log4j.Level中的常量
@param t 异常
@param msgTemplate 消息模板
@param arguments 参数
@return 是否支持 LocationAwareLogger对象,如果不支持需要日志方法调用被包装类的相应方法 | [
"打印日志<br",
">",
"此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/dialect/log4j2/Log4j2Log.java#L192-L199 | train | Logs the exception if the logger is enabled. | [
30522,
2797,
22017,
20898,
8833,
29323,
22966,
2094,
1006,
5164,
1042,
4160,
2278,
2078,
1010,
2504,
2504,
1010,
5466,
3085,
1056,
1010,
5164,
5796,
13512,
6633,
15725,
1010,
4874,
1012,
1012,
1012,
9918,
1007,
1063,
2065,
1006,
2023,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializerSnapshotData.java | KryoSerializerSnapshotData.writeSnapshotData | void writeSnapshotData(DataOutputView out) throws IOException {
writeTypeClass(out);
writeKryoRegistrations(out, kryoRegistrations);
writeDefaultKryoSerializers(out, defaultKryoSerializers);
writeDefaultKryoSerializerClasses(out, defaultKryoSerializerClasses);
} | java | void writeSnapshotData(DataOutputView out) throws IOException {
writeTypeClass(out);
writeKryoRegistrations(out, kryoRegistrations);
writeDefaultKryoSerializers(out, defaultKryoSerializers);
writeDefaultKryoSerializerClasses(out, defaultKryoSerializerClasses);
} | [
"void",
"writeSnapshotData",
"(",
"DataOutputView",
"out",
")",
"throws",
"IOException",
"{",
"writeTypeClass",
"(",
"out",
")",
";",
"writeKryoRegistrations",
"(",
"out",
",",
"kryoRegistrations",
")",
";",
"writeDefaultKryoSerializers",
"(",
"out",
",",
"defaultKr... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializerSnapshotData.java#L126-L131 | train | Writes the snapshot data. | [
30522,
11675,
7009,
2532,
4523,
12326,
2850,
2696,
1006,
2951,
5833,
18780,
8584,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
4339,
13874,
26266,
1006,
2041,
1007,
1025,
4339,
21638,
7677,
2890,
24063,
28893,
1006,
2041,
1010,
1047,
2854,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/StatementUtil.java | StatementUtil.prepareStatement | public static PreparedStatement prepareStatement(Connection conn, String sql, Object... params) throws SQLException {
Assert.notBlank(sql, "Sql String must be not blank!");
sql = sql.trim();
SqlLog.INSTASNCE.log(sql, params);
PreparedStatement ps;
if (StrUtil.startWithIgnoreCase(sql, "insert")) {
// 插入默认返回主键
ps = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
} else {
ps = conn.prepareStatement(sql);
}
return fillParams(ps, params);
} | java | public static PreparedStatement prepareStatement(Connection conn, String sql, Object... params) throws SQLException {
Assert.notBlank(sql, "Sql String must be not blank!");
sql = sql.trim();
SqlLog.INSTASNCE.log(sql, params);
PreparedStatement ps;
if (StrUtil.startWithIgnoreCase(sql, "insert")) {
// 插入默认返回主键
ps = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
} else {
ps = conn.prepareStatement(sql);
}
return fillParams(ps, params);
} | [
"public",
"static",
"PreparedStatement",
"prepareStatement",
"(",
"Connection",
"conn",
",",
"String",
"sql",
",",
"Object",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"Assert",
".",
"notBlank",
"(",
"sql",
",",
"\"Sql String must be not blank!\"",
")",
... | 创建{@link PreparedStatement}
@param conn 数据库连接
@param sql SQL语句,使用"?"做为占位符
@param params "?"对应参数列表
@return {@link PreparedStatement}
@throws SQLException SQL异常
@since 3.2.3 | [
"创建",
"{",
"@link",
"PreparedStatement",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/StatementUtil.java#L138-L151 | train | Create a PreparedStatement object from the given SQL and parameters. | [
30522,
2270,
10763,
4810,
9153,
18532,
4765,
20776,
12259,
3672,
1006,
4434,
9530,
2078,
1010,
5164,
29296,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
29296,
10288,
24422,
1063,
20865,
1012,
2025,
28522,
8950,
1006,
29296,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java | ConditionEvaluationReport.recordConditionEvaluation | public void recordConditionEvaluation(String source, Condition condition,
ConditionOutcome outcome) {
Assert.notNull(source, "Source must not be null");
Assert.notNull(condition, "Condition must not be null");
Assert.notNull(outcome, "Outcome must not be null");
this.unconditionalClasses.remove(source);
if (!this.outcomes.containsKey(source)) {
this.outcomes.put(source, new ConditionAndOutcomes());
}
this.outcomes.get(source).add(condition, outcome);
this.addedAncestorOutcomes = false;
} | java | public void recordConditionEvaluation(String source, Condition condition,
ConditionOutcome outcome) {
Assert.notNull(source, "Source must not be null");
Assert.notNull(condition, "Condition must not be null");
Assert.notNull(outcome, "Outcome must not be null");
this.unconditionalClasses.remove(source);
if (!this.outcomes.containsKey(source)) {
this.outcomes.put(source, new ConditionAndOutcomes());
}
this.outcomes.get(source).add(condition, outcome);
this.addedAncestorOutcomes = false;
} | [
"public",
"void",
"recordConditionEvaluation",
"(",
"String",
"source",
",",
"Condition",
"condition",
",",
"ConditionOutcome",
"outcome",
")",
"{",
"Assert",
".",
"notNull",
"(",
"source",
",",
"\"Source must not be null\"",
")",
";",
"Assert",
".",
"notNull",
"(... | Record the occurrence of condition evaluation.
@param source the source of the condition (class or method name)
@param condition the condition evaluated
@param outcome the condition outcome | [
"Record",
"the",
"occurrence",
"of",
"condition",
"evaluation",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionEvaluationReport.java#L78-L89 | train | Records a condition evaluation. | [
30522,
2270,
11675,
2501,
8663,
20562,
13331,
7630,
3370,
1006,
5164,
3120,
1010,
4650,
4650,
1010,
4650,
5833,
9006,
2063,
9560,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
3120,
1010,
1000,
3120,
2442,
2025,
2022,
19701,
1000,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/config/SqlParser.java | SqlParser.visitColumn | private static void visitColumn(SQLExpr expr, FieldItem fieldItem) {
if (expr instanceof SQLIdentifierExpr) {
// 无owner
SQLIdentifierExpr identifierExpr = (SQLIdentifierExpr) expr;
if (fieldItem.getFieldName() == null) {
fieldItem.setFieldName(identifierExpr.getName());
fieldItem.setExpr(identifierExpr.toString());
}
ColumnItem columnItem = new ColumnItem();
columnItem.setColumnName(identifierExpr.getName());
fieldItem.getOwners().add(null);
fieldItem.addColumn(columnItem);
} else if (expr instanceof SQLPropertyExpr) {
// 有owner
SQLPropertyExpr sqlPropertyExpr = (SQLPropertyExpr) expr;
if (fieldItem.getFieldName() == null) {
fieldItem.setFieldName(sqlPropertyExpr.getName());
fieldItem.setExpr(sqlPropertyExpr.toString());
}
fieldItem.getOwners().add(sqlPropertyExpr.getOwnernName());
ColumnItem columnItem = new ColumnItem();
columnItem.setColumnName(sqlPropertyExpr.getName());
columnItem.setOwner(sqlPropertyExpr.getOwnernName());
fieldItem.addColumn(columnItem);
} else if (expr instanceof SQLMethodInvokeExpr) {
SQLMethodInvokeExpr methodInvokeExpr = (SQLMethodInvokeExpr) expr;
fieldItem.setMethod(true);
for (SQLExpr sqlExpr : methodInvokeExpr.getArguments()) {
visitColumn(sqlExpr, fieldItem);
}
} else if (expr instanceof SQLBinaryOpExpr) {
SQLBinaryOpExpr sqlBinaryOpExpr = (SQLBinaryOpExpr) expr;
fieldItem.setBinaryOp(true);
visitColumn(sqlBinaryOpExpr.getLeft(), fieldItem);
visitColumn(sqlBinaryOpExpr.getRight(), fieldItem);
} else if (expr instanceof SQLCaseExpr) {
SQLCaseExpr sqlCaseExpr = (SQLCaseExpr) expr;
fieldItem.setMethod(true);
sqlCaseExpr.getItems().forEach(item-> visitColumn(item.getConditionExpr(), fieldItem));
}
} | java | private static void visitColumn(SQLExpr expr, FieldItem fieldItem) {
if (expr instanceof SQLIdentifierExpr) {
// 无owner
SQLIdentifierExpr identifierExpr = (SQLIdentifierExpr) expr;
if (fieldItem.getFieldName() == null) {
fieldItem.setFieldName(identifierExpr.getName());
fieldItem.setExpr(identifierExpr.toString());
}
ColumnItem columnItem = new ColumnItem();
columnItem.setColumnName(identifierExpr.getName());
fieldItem.getOwners().add(null);
fieldItem.addColumn(columnItem);
} else if (expr instanceof SQLPropertyExpr) {
// 有owner
SQLPropertyExpr sqlPropertyExpr = (SQLPropertyExpr) expr;
if (fieldItem.getFieldName() == null) {
fieldItem.setFieldName(sqlPropertyExpr.getName());
fieldItem.setExpr(sqlPropertyExpr.toString());
}
fieldItem.getOwners().add(sqlPropertyExpr.getOwnernName());
ColumnItem columnItem = new ColumnItem();
columnItem.setColumnName(sqlPropertyExpr.getName());
columnItem.setOwner(sqlPropertyExpr.getOwnernName());
fieldItem.addColumn(columnItem);
} else if (expr instanceof SQLMethodInvokeExpr) {
SQLMethodInvokeExpr methodInvokeExpr = (SQLMethodInvokeExpr) expr;
fieldItem.setMethod(true);
for (SQLExpr sqlExpr : methodInvokeExpr.getArguments()) {
visitColumn(sqlExpr, fieldItem);
}
} else if (expr instanceof SQLBinaryOpExpr) {
SQLBinaryOpExpr sqlBinaryOpExpr = (SQLBinaryOpExpr) expr;
fieldItem.setBinaryOp(true);
visitColumn(sqlBinaryOpExpr.getLeft(), fieldItem);
visitColumn(sqlBinaryOpExpr.getRight(), fieldItem);
} else if (expr instanceof SQLCaseExpr) {
SQLCaseExpr sqlCaseExpr = (SQLCaseExpr) expr;
fieldItem.setMethod(true);
sqlCaseExpr.getItems().forEach(item-> visitColumn(item.getConditionExpr(), fieldItem));
}
} | [
"private",
"static",
"void",
"visitColumn",
"(",
"SQLExpr",
"expr",
",",
"FieldItem",
"fieldItem",
")",
"{",
"if",
"(",
"expr",
"instanceof",
"SQLIdentifierExpr",
")",
"{",
"// 无owner",
"SQLIdentifierExpr",
"identifierExpr",
"=",
"(",
"SQLIdentifierExpr",
")",
"ex... | 解析字段
@param expr sql expr
@param fieldItem 字段属性 | [
"解析字段"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/config/SqlParser.java#L94-L134 | train | Visit a column. | [
30522,
2797,
10763,
11675,
3942,
25778,
2819,
2078,
1006,
29296,
10288,
18098,
4654,
18098,
1010,
2492,
4221,
2213,
2492,
4221,
2213,
1007,
1063,
2065,
1006,
4654,
18098,
6013,
11253,
29296,
5178,
16778,
8873,
7869,
2595,
18098,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/MDAG/SimpleMDAGNode.java | SimpleMDAGNode.traverseMDAG | public static SimpleMDAGNode traverseMDAG(SimpleMDAGNode[] mdagDataArray, SimpleMDAGNode sourceNode, String str)
{
// char firstLetter = str.charAt(0);
//Loop through the SimpleMDAGNodes in the processing MDAG's source node's _transition set,
//searching for the the one with a letter (char) equal to the first char of str.
//We can use that target node to _transition through the MDAG with the rest of the string
return sourceNode.transition(mdagDataArray, str.toCharArray());
// for(int i = 0; i < sourceNode.transitionSetSize; i++)
// {
// if(mdagDataArray[i].getLetter() == firstLetter)
// return mdagDataArray[i]._transition(mdagDataArray, str.substring(1));
// }
// /////
//
// return null;
} | java | public static SimpleMDAGNode traverseMDAG(SimpleMDAGNode[] mdagDataArray, SimpleMDAGNode sourceNode, String str)
{
// char firstLetter = str.charAt(0);
//Loop through the SimpleMDAGNodes in the processing MDAG's source node's _transition set,
//searching for the the one with a letter (char) equal to the first char of str.
//We can use that target node to _transition through the MDAG with the rest of the string
return sourceNode.transition(mdagDataArray, str.toCharArray());
// for(int i = 0; i < sourceNode.transitionSetSize; i++)
// {
// if(mdagDataArray[i].getLetter() == firstLetter)
// return mdagDataArray[i]._transition(mdagDataArray, str.substring(1));
// }
// /////
//
// return null;
} | [
"public",
"static",
"SimpleMDAGNode",
"traverseMDAG",
"(",
"SimpleMDAGNode",
"[",
"]",
"mdagDataArray",
",",
"SimpleMDAGNode",
"sourceNode",
",",
"String",
"str",
")",
"{",
"// char firstLetter = str.charAt(0);",
"//Loop through the SimpleMDAGNodes in the processing MDAG's... | Follows a _transition path starting from the source node of a MDAG.
@param mdagDataArray the array containing the data of the MDAG to be traversed
@param sourceNode the dummy SimpleMDAGNode which functions as the source of the MDAG data in {@code mdagDataArray}
@param str a String corresponding to a _transition path in the to-be-traversed MDAG
@return the SimpleMDAGNode at the end of the _transition path corresponding to
{@code str}, or null if such a _transition path is not present in the MDAG | [
"Follows",
"a",
"_transition",
"path",
"starting",
"from",
"the",
"source",
"node",
"of",
"a",
"MDAG",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/SimpleMDAGNode.java#L264-L280 | train | traverse MDAG. | [
30522,
2270,
10763,
3722,
26876,
8490,
3630,
3207,
20811,
26876,
8490,
1006,
3722,
26876,
8490,
3630,
3207,
1031,
1033,
9108,
8490,
2850,
2696,
2906,
9447,
1010,
3722,
26876,
8490,
3630,
3207,
3120,
3630,
3207,
1010,
5164,
2358,
2099,
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... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java | HttpConversionUtil.addHttp2ToHttpHeaders | public static void addHttp2ToHttpHeaders(int streamId, Http2Headers inputHeaders, HttpHeaders outputHeaders,
HttpVersion httpVersion, boolean isTrailer, boolean isRequest) throws Http2Exception {
Http2ToHttpHeaderTranslator translator = new Http2ToHttpHeaderTranslator(streamId, outputHeaders, isRequest);
try {
for (Entry<CharSequence, CharSequence> entry : inputHeaders) {
translator.translate(entry);
}
} catch (Http2Exception ex) {
throw ex;
} catch (Throwable t) {
throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error");
}
outputHeaders.remove(HttpHeaderNames.TRANSFER_ENCODING);
outputHeaders.remove(HttpHeaderNames.TRAILER);
if (!isTrailer) {
outputHeaders.setInt(ExtensionHeaderNames.STREAM_ID.text(), streamId);
HttpUtil.setKeepAlive(outputHeaders, httpVersion, true);
}
} | java | public static void addHttp2ToHttpHeaders(int streamId, Http2Headers inputHeaders, HttpHeaders outputHeaders,
HttpVersion httpVersion, boolean isTrailer, boolean isRequest) throws Http2Exception {
Http2ToHttpHeaderTranslator translator = new Http2ToHttpHeaderTranslator(streamId, outputHeaders, isRequest);
try {
for (Entry<CharSequence, CharSequence> entry : inputHeaders) {
translator.translate(entry);
}
} catch (Http2Exception ex) {
throw ex;
} catch (Throwable t) {
throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error");
}
outputHeaders.remove(HttpHeaderNames.TRANSFER_ENCODING);
outputHeaders.remove(HttpHeaderNames.TRAILER);
if (!isTrailer) {
outputHeaders.setInt(ExtensionHeaderNames.STREAM_ID.text(), streamId);
HttpUtil.setKeepAlive(outputHeaders, httpVersion, true);
}
} | [
"public",
"static",
"void",
"addHttp2ToHttpHeaders",
"(",
"int",
"streamId",
",",
"Http2Headers",
"inputHeaders",
",",
"HttpHeaders",
"outputHeaders",
",",
"HttpVersion",
"httpVersion",
",",
"boolean",
"isTrailer",
",",
"boolean",
"isRequest",
")",
"throws",
"Http2Exc... | Translate and add HTTP/2 headers to HTTP/1.x headers.
@param streamId The stream associated with {@code sourceHeaders}.
@param inputHeaders The HTTP/2 headers to convert.
@param outputHeaders The object which will contain the resulting HTTP/1.x headers..
@param httpVersion What HTTP/1.x version {@code outputHeaders} should be treated as when doing the conversion.
@param isTrailer {@code true} if {@code outputHeaders} should be treated as trailing headers.
{@code false} otherwise.
@param isRequest {@code true} if the {@code outputHeaders} will be used in a request message.
{@code false} for response message.
@throws Http2Exception If not all HTTP/2 headers can be translated to HTTP/1.x. | [
"Translate",
"and",
"add",
"HTTP",
"/",
"2",
"headers",
"to",
"HTTP",
"/",
"1",
".",
"x",
"headers",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java#L359-L378 | train | Add HTTP2 to HTTP headers. | [
30522,
2270,
10763,
11675,
5587,
11039,
25856,
2475,
3406,
11039,
25856,
4974,
2545,
1006,
20014,
5460,
3593,
1010,
8299,
2475,
4974,
2545,
7953,
4974,
2545,
1010,
8299,
4974,
2545,
6434,
4974,
2545,
1010,
8299,
27774,
8299,
27774,
1010,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java | TomcatReactiveWebServerFactory.setTomcatContextCustomizers | public void setTomcatContextCustomizers(
Collection<? extends TomcatContextCustomizer> tomcatContextCustomizers) {
Assert.notNull(tomcatContextCustomizers,
"TomcatContextCustomizers must not be null");
this.tomcatContextCustomizers = new ArrayList<>(tomcatContextCustomizers);
} | java | public void setTomcatContextCustomizers(
Collection<? extends TomcatContextCustomizer> tomcatContextCustomizers) {
Assert.notNull(tomcatContextCustomizers,
"TomcatContextCustomizers must not be null");
this.tomcatContextCustomizers = new ArrayList<>(tomcatContextCustomizers);
} | [
"public",
"void",
"setTomcatContextCustomizers",
"(",
"Collection",
"<",
"?",
"extends",
"TomcatContextCustomizer",
">",
"tomcatContextCustomizers",
")",
"{",
"Assert",
".",
"notNull",
"(",
"tomcatContextCustomizers",
",",
"\"TomcatContextCustomizers must not be null\"",
")",... | Set {@link TomcatContextCustomizer}s that should be applied to the Tomcat
{@link Context}. Calling this method will replace any existing customizers.
@param tomcatContextCustomizers the customizers to set | [
"Set",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java#L228-L233 | train | Sets the collection of TomcatContextCustomizers to use. | [
30522,
2270,
11675,
2275,
20389,
11266,
8663,
18209,
7874,
20389,
17629,
2015,
1006,
3074,
1026,
1029,
8908,
3419,
11266,
8663,
18209,
7874,
20389,
17629,
1028,
3419,
11266,
8663,
18209,
7874,
20389,
17629,
2015,
1007,
1063,
20865,
1012,
2025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/type/TypeConverters.java | TypeConverters.createExternalTypeInfoFromInternalType | @SuppressWarnings("unchecked")
public static TypeInformation createExternalTypeInfoFromInternalType(InternalType type) {
TypeInformation typeInfo = INTERNAL_TYPE_TO_EXTERNAL_TYPE_INFO.get(type);
if (typeInfo != null) {
return typeInfo;
}
if (type instanceof RowType) {
RowType rowType = (RowType) type;
return new RowTypeInfo(Arrays.stream(rowType.getFieldTypes())
.map(TypeConverters::createExternalTypeInfoFromInternalType)
.toArray(TypeInformation[]::new),
rowType.getFieldNames());
} else if (type instanceof ArrayType) {
return ObjectArrayTypeInfo.getInfoFor(
createExternalTypeInfoFromInternalType(((ArrayType) type).getElementType()));
} else if (type instanceof MapType) {
MapType mapType = (MapType) type;
return new MapTypeInfo(
createExternalTypeInfoFromInternalType(mapType.getKeyType()),
createExternalTypeInfoFromInternalType(mapType.getValueType()));
} else if (type instanceof MultisetType) {
MultisetType multisetType = (MultisetType) type;
return MultisetTypeInfo.getInfoFor(
createExternalTypeInfoFromInternalType(multisetType.getElementType()));
}
else if (type instanceof DecimalType) {
DecimalType decimalType = (DecimalType) type;
return new BigDecimalTypeInfo(decimalType.precision(), decimalType.scale());
} else if (type instanceof GenericType) {
GenericType genericType = (GenericType) type;
return genericType.getTypeInfo();
} else {
throw new UnsupportedOperationException("Not support yet: " + type);
}
} | java | @SuppressWarnings("unchecked")
public static TypeInformation createExternalTypeInfoFromInternalType(InternalType type) {
TypeInformation typeInfo = INTERNAL_TYPE_TO_EXTERNAL_TYPE_INFO.get(type);
if (typeInfo != null) {
return typeInfo;
}
if (type instanceof RowType) {
RowType rowType = (RowType) type;
return new RowTypeInfo(Arrays.stream(rowType.getFieldTypes())
.map(TypeConverters::createExternalTypeInfoFromInternalType)
.toArray(TypeInformation[]::new),
rowType.getFieldNames());
} else if (type instanceof ArrayType) {
return ObjectArrayTypeInfo.getInfoFor(
createExternalTypeInfoFromInternalType(((ArrayType) type).getElementType()));
} else if (type instanceof MapType) {
MapType mapType = (MapType) type;
return new MapTypeInfo(
createExternalTypeInfoFromInternalType(mapType.getKeyType()),
createExternalTypeInfoFromInternalType(mapType.getValueType()));
} else if (type instanceof MultisetType) {
MultisetType multisetType = (MultisetType) type;
return MultisetTypeInfo.getInfoFor(
createExternalTypeInfoFromInternalType(multisetType.getElementType()));
}
else if (type instanceof DecimalType) {
DecimalType decimalType = (DecimalType) type;
return new BigDecimalTypeInfo(decimalType.precision(), decimalType.scale());
} else if (type instanceof GenericType) {
GenericType genericType = (GenericType) type;
return genericType.getTypeInfo();
} else {
throw new UnsupportedOperationException("Not support yet: " + type);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"TypeInformation",
"createExternalTypeInfoFromInternalType",
"(",
"InternalType",
"type",
")",
"{",
"TypeInformation",
"typeInfo",
"=",
"INTERNAL_TYPE_TO_EXTERNAL_TYPE_INFO",
".",
"get",
"(",
"type",
... | Create a external {@link TypeInformation} from a {@link InternalType}.
<p>eg:
{@link InternalTypes#STRING} => {@link BasicTypeInfo#STRING_TYPE_INFO}.
{@link RowType} => {@link RowTypeInfo}. | [
"Create",
"a",
"external",
"{",
"@link",
"TypeInformation",
"}",
"from",
"a",
"{",
"@link",
"InternalType",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/type/TypeConverters.java#L226-L261 | train | Creates an external type information from the given type. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
2828,
2378,
14192,
3370,
3443,
10288,
16451,
2389,
13874,
2378,
14876,
19699,
20936,
10111,
12789,
24228,
5051,
1006,
4722,
13874,
2828,
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/bean/BeanUtil.java | BeanUtil.copyProperties | public static void copyProperties(Object source, Object target, CopyOptions copyOptions) {
if (null == copyOptions) {
copyOptions = new CopyOptions();
}
BeanCopier.create(source, target, copyOptions).copy();
} | java | public static void copyProperties(Object source, Object target, CopyOptions copyOptions) {
if (null == copyOptions) {
copyOptions = new CopyOptions();
}
BeanCopier.create(source, target, copyOptions).copy();
} | [
"public",
"static",
"void",
"copyProperties",
"(",
"Object",
"source",
",",
"Object",
"target",
",",
"CopyOptions",
"copyOptions",
")",
"{",
"if",
"(",
"null",
"==",
"copyOptions",
")",
"{",
"copyOptions",
"=",
"new",
"CopyOptions",
"(",
")",
";",
"}",
"Be... | 复制Bean对象属性<br>
限制类用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类
@param source 源Bean对象
@param target 目标Bean对象
@param copyOptions 拷贝选项,见 {@link CopyOptions} | [
"复制Bean对象属性<br",
">",
"限制类用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L617-L622 | train | Copies properties from source to target. | [
30522,
2270,
10763,
11675,
6100,
21572,
4842,
7368,
1006,
4874,
3120,
1010,
4874,
4539,
1010,
6100,
7361,
9285,
6100,
7361,
9285,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
6100,
7361,
9285,
1007,
1063,
6100,
7361,
9285,
1027,
2047,
6100,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | http-url/src/main/java/com/networknt/url/URLNormalizer.java | URLNormalizer.addWWW | public URLNormalizer addWWW() {
String host = toURL().getHost();
if (!host.toLowerCase().startsWith("www.")) {
url = StringUtils.replaceOnce(url, host, "www." + host);
}
return this;
} | java | public URLNormalizer addWWW() {
String host = toURL().getHost();
if (!host.toLowerCase().startsWith("www.")) {
url = StringUtils.replaceOnce(url, host, "www." + host);
}
return this;
} | [
"public",
"URLNormalizer",
"addWWW",
"(",
")",
"{",
"String",
"host",
"=",
"toURL",
"(",
")",
".",
"getHost",
"(",
")",
";",
"if",
"(",
"!",
"host",
".",
"toLowerCase",
"(",
")",
".",
"startsWith",
"(",
"\"www.\"",
")",
")",
"{",
"url",
"=",
"Strin... | <p>Adds "www." domain name prefix.</p>
<code>http://example.com/ → http://www.example.com/</code>
@return this instance | [
"<p",
">",
"Adds",
"www",
".",
"domain",
"name",
"prefix",
".",
"<",
"/",
"p",
">",
"<code",
">",
"http",
":",
"//",
"example",
".",
"com",
"/",
"&rarr",
";",
"http",
":",
"//",
"www",
".",
"example",
".",
"com",
"/",
"<",
"/",
"code",
">"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/URLNormalizer.java#L646-L652 | train | Add a WWW to the URL. | [
30522,
2270,
24471,
19666,
2953,
9067,
17629,
5587,
2860,
2860,
2860,
1006,
1007,
1063,
5164,
3677,
1027,
2778,
2140,
1006,
1007,
1012,
2131,
15006,
2102,
1006,
1007,
1025,
2065,
1006,
999,
3677,
1012,
2000,
27663,
18992,
3366,
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-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBMapState.java | RocksDBMapState.get | @Override
public UV get(UK userKey) throws IOException, RocksDBException {
byte[] rawKeyBytes = serializeCurrentKeyWithGroupAndNamespacePlusUserKey(userKey, userKeySerializer);
byte[] rawValueBytes = backend.db.get(columnFamily, rawKeyBytes);
return (rawValueBytes == null ? null : deserializeUserValue(dataInputView, rawValueBytes, userValueSerializer));
} | java | @Override
public UV get(UK userKey) throws IOException, RocksDBException {
byte[] rawKeyBytes = serializeCurrentKeyWithGroupAndNamespacePlusUserKey(userKey, userKeySerializer);
byte[] rawValueBytes = backend.db.get(columnFamily, rawKeyBytes);
return (rawValueBytes == null ? null : deserializeUserValue(dataInputView, rawValueBytes, userValueSerializer));
} | [
"@",
"Override",
"public",
"UV",
"get",
"(",
"UK",
"userKey",
")",
"throws",
"IOException",
",",
"RocksDBException",
"{",
"byte",
"[",
"]",
"rawKeyBytes",
"=",
"serializeCurrentKeyWithGroupAndNamespacePlusUserKey",
"(",
"userKey",
",",
"userKeySerializer",
")",
";",... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBMapState.java#L119-L125 | train | Gets the value of the user key. | [
30522,
1030,
2058,
15637,
2270,
23068,
2131,
1006,
2866,
5310,
14839,
1007,
11618,
22834,
10288,
24422,
1010,
5749,
18939,
10288,
24422,
1063,
24880,
1031,
1033,
6315,
14839,
3762,
4570,
1027,
7642,
4697,
10841,
14343,
3372,
14839,
24415,
170... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java | KeyUtil.getMainAlgorithm | public static String getMainAlgorithm(String algorithm) {
final int slashIndex = algorithm.indexOf(CharUtil.SLASH);
if (slashIndex > 0) {
return algorithm.substring(0, slashIndex);
}
return algorithm;
} | java | public static String getMainAlgorithm(String algorithm) {
final int slashIndex = algorithm.indexOf(CharUtil.SLASH);
if (slashIndex > 0) {
return algorithm.substring(0, slashIndex);
}
return algorithm;
} | [
"public",
"static",
"String",
"getMainAlgorithm",
"(",
"String",
"algorithm",
")",
"{",
"final",
"int",
"slashIndex",
"=",
"algorithm",
".",
"indexOf",
"(",
"CharUtil",
".",
"SLASH",
")",
";",
"if",
"(",
"slashIndex",
">",
"0",
")",
"{",
"return",
"algorit... | 获取主体算法名,例如RSA/ECB/PKCS1Padding的主体算法是RSA
@return 主体算法名
@since 4.5.2 | [
"获取主体算法名,例如RSA",
"/",
"ECB",
"/",
"PKCS1Padding的主体算法是RSA"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L521-L527 | train | Returns the main algorithm. | [
30522,
2270,
10763,
5164,
2131,
24238,
2389,
20255,
8939,
2213,
1006,
5164,
9896,
1007,
1063,
2345,
20014,
18296,
22254,
10288,
1027,
9896,
1012,
5950,
11253,
1006,
25869,
21823,
2140,
1012,
18296,
1007,
1025,
2065,
1006,
18296,
22254,
10288,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateInfo.java | KvStateInfo.duplicate | public KvStateInfo<K, N, V> duplicate() {
final TypeSerializer<K> dupKeySerializer = keySerializer.duplicate();
final TypeSerializer<N> dupNamespaceSerializer = namespaceSerializer.duplicate();
final TypeSerializer<V> dupSVSerializer = stateValueSerializer.duplicate();
if (
dupKeySerializer == keySerializer &&
dupNamespaceSerializer == namespaceSerializer &&
dupSVSerializer == stateValueSerializer
) {
return this;
}
return new KvStateInfo<>(dupKeySerializer, dupNamespaceSerializer, dupSVSerializer);
} | java | public KvStateInfo<K, N, V> duplicate() {
final TypeSerializer<K> dupKeySerializer = keySerializer.duplicate();
final TypeSerializer<N> dupNamespaceSerializer = namespaceSerializer.duplicate();
final TypeSerializer<V> dupSVSerializer = stateValueSerializer.duplicate();
if (
dupKeySerializer == keySerializer &&
dupNamespaceSerializer == namespaceSerializer &&
dupSVSerializer == stateValueSerializer
) {
return this;
}
return new KvStateInfo<>(dupKeySerializer, dupNamespaceSerializer, dupSVSerializer);
} | [
"public",
"KvStateInfo",
"<",
"K",
",",
"N",
",",
"V",
">",
"duplicate",
"(",
")",
"{",
"final",
"TypeSerializer",
"<",
"K",
">",
"dupKeySerializer",
"=",
"keySerializer",
".",
"duplicate",
"(",
")",
";",
"final",
"TypeSerializer",
"<",
"N",
">",
"dupNam... | Creates a deep copy of the current {@link KvStateInfo} by duplicating
all the included serializers.
<p>This method assumes correct implementation of the {@link TypeSerializer#duplicate()}
method of the included serializers. | [
"Creates",
"a",
"deep",
"copy",
"of",
"the",
"current",
"{",
"@link",
"KvStateInfo",
"}",
"by",
"duplicating",
"all",
"the",
"included",
"serializers",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateInfo.java#L79-L94 | train | Returns a duplicate of this state info. | [
30522,
2270,
24888,
9153,
9589,
14876,
1026,
1047,
1010,
1050,
1010,
1058,
1028,
24473,
1006,
1007,
1063,
2345,
4127,
11610,
28863,
1026,
1047,
1028,
4241,
2361,
14839,
8043,
4818,
17629,
1027,
6309,
11610,
28863,
1012,
24473,
1006,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java | RestTemplateBuilder.rootUri | public RestTemplateBuilder rootUri(String rootUri) {
return new RestTemplateBuilder(this.detectRequestFactory, rootUri,
this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.requestFactoryCustomizer,
this.interceptors);
} | java | public RestTemplateBuilder rootUri(String rootUri) {
return new RestTemplateBuilder(this.detectRequestFactory, rootUri,
this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.requestFactoryCustomizer,
this.interceptors);
} | [
"public",
"RestTemplateBuilder",
"rootUri",
"(",
"String",
"rootUri",
")",
"{",
"return",
"new",
"RestTemplateBuilder",
"(",
"this",
".",
"detectRequestFactory",
",",
"rootUri",
",",
"this",
".",
"messageConverters",
",",
"this",
".",
"requestFactorySupplier",
",",
... | Set a root URL that should be applied to each request that starts with {@code '/'}.
See {@link RootUriTemplateHandler} for details.
@param rootUri the root URI or {@code null}
@return a new builder instance | [
"Set",
"a",
"root",
"URL",
"that",
"should",
"be",
"applied",
"to",
"each",
"request",
"that",
"starts",
"with",
"{"
] | 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#L146-L152 | train | Create a new RestTemplateBuilder with the specified root URI. | [
30522,
2270,
2717,
18532,
15725,
8569,
23891,
2099,
7117,
9496,
1006,
5164,
7117,
9496,
1007,
1063,
2709,
2047,
2717,
18532,
15725,
8569,
23891,
2099,
1006,
2023,
1012,
11487,
2890,
15500,
21450,
1010,
7117,
9496,
1010,
2023,
1012,
4471,
86... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/webmonitor/WebMonitorEndpoint.java | WebMonitorEndpoint.grantLeadership | @Override
public void grantLeadership(final UUID leaderSessionID) {
log.info("{} was granted leadership with leaderSessionID={}", getRestBaseUrl(), leaderSessionID);
leaderElectionService.confirmLeaderSessionID(leaderSessionID);
} | java | @Override
public void grantLeadership(final UUID leaderSessionID) {
log.info("{} was granted leadership with leaderSessionID={}", getRestBaseUrl(), leaderSessionID);
leaderElectionService.confirmLeaderSessionID(leaderSessionID);
} | [
"@",
"Override",
"public",
"void",
"grantLeadership",
"(",
"final",
"UUID",
"leaderSessionID",
")",
"{",
"log",
".",
"info",
"(",
"\"{} was granted leadership with leaderSessionID={}\"",
",",
"getRestBaseUrl",
"(",
")",
",",
"leaderSessionID",
")",
";",
"leaderElectio... | ------------------------------------------------------------------------- | [
"-------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorEndpoint.java#L709-L713 | train | Grants leadership to a specific session ID. | [
30522,
1030,
2058,
15637,
2270,
11675,
3946,
19000,
9650,
1006,
2345,
1057,
21272,
4177,
7971,
3258,
3593,
1007,
1063,
8833,
1012,
18558,
1006,
1000,
1063,
1065,
2001,
4379,
4105,
2007,
4177,
7971,
3258,
3593,
1027,
1063,
1065,
1000,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dictionary/DictionaryMaker.java | DictionaryMaker.add | public void add(Item item)
{
Item innerItem = trie.get(item.key);
if (innerItem == null)
{
innerItem = item;
trie.put(innerItem.key, innerItem);
}
else
{
innerItem.combine(item);
}
} | java | public void add(Item item)
{
Item innerItem = trie.get(item.key);
if (innerItem == null)
{
innerItem = item;
trie.put(innerItem.key, innerItem);
}
else
{
innerItem.combine(item);
}
} | [
"public",
"void",
"add",
"(",
"Item",
"item",
")",
"{",
"Item",
"innerItem",
"=",
"trie",
".",
"get",
"(",
"item",
".",
"key",
")",
";",
"if",
"(",
"innerItem",
"==",
"null",
")",
"{",
"innerItem",
"=",
"item",
";",
"trie",
".",
"put",
"(",
"inne... | 插入条目
@param item | [
"插入条目"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/DictionaryMaker.java#L172-L184 | train | Add a single entry to the CRA. | [
30522,
2270,
11675,
5587,
1006,
8875,
8875,
1007,
1063,
8875,
5110,
4221,
2213,
1027,
13012,
2063,
1012,
2131,
1006,
8875,
1012,
3145,
1007,
1025,
2065,
1006,
5110,
4221,
2213,
1027,
1027,
19701,
1007,
1063,
5110,
4221,
2213,
1027,
8875,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.toImage | public static BufferedImage toImage(String base64) throws IORuntimeException {
byte[] decode = Base64.decode(base64, CharsetUtil.CHARSET_UTF_8);
return toImage(decode);
} | java | public static BufferedImage toImage(String base64) throws IORuntimeException {
byte[] decode = Base64.decode(base64, CharsetUtil.CHARSET_UTF_8);
return toImage(decode);
} | [
"public",
"static",
"BufferedImage",
"toImage",
"(",
"String",
"base64",
")",
"throws",
"IORuntimeException",
"{",
"byte",
"[",
"]",
"decode",
"=",
"Base64",
".",
"decode",
"(",
"base64",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
")",
";",
"return",
"toImage",... | 将Base64编码的图像信息转为 {@link BufferedImage}
@param base64 图像的Base64表示
@return {@link BufferedImage}
@throws IORuntimeException IO异常 | [
"将Base64编码的图像信息转为",
"{",
"@link",
"BufferedImage",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1229-L1232 | train | Converts a base64 encoded string to an image. | [
30522,
2270,
10763,
17698,
2098,
9581,
3351,
2000,
9581,
3351,
1006,
5164,
2918,
21084,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
24880,
1031,
1033,
21933,
3207,
1027,
2918,
21084,
1012,
21933,
3207,
1006,
2918,
21084,
1010,
25869,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java | IterUtil.getElementType | public static Class<?> getElementType(Iterator<?> iterator) {
final Iterator<?> iter2 = new CopiedIter<>(iterator);
if (null != iter2) {
Object t;
while (iter2.hasNext()) {
t = iter2.next();
if (null != t) {
return t.getClass();
}
}
}
return null;
} | java | public static Class<?> getElementType(Iterator<?> iterator) {
final Iterator<?> iter2 = new CopiedIter<>(iterator);
if (null != iter2) {
Object t;
while (iter2.hasNext()) {
t = iter2.next();
if (null != t) {
return t.getClass();
}
}
}
return null;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getElementType",
"(",
"Iterator",
"<",
"?",
">",
"iterator",
")",
"{",
"final",
"Iterator",
"<",
"?",
">",
"iter2",
"=",
"new",
"CopiedIter",
"<>",
"(",
"iterator",
")",
";",
"if",
"(",
"null",
"!=",
"iter... | 获得{@link Iterator}对象的元素类型(通过第一个非空元素判断)<br>
注意,此方法至少会调用多次next方法
@param iterator {@link Iterator}
@return 元素类型,当列表为空或元素全部为null时,返回null | [
"获得",
"{",
"@link",
"Iterator",
"}",
"对象的元素类型(通过第一个非空元素判断)<br",
">",
"注意,此方法至少会调用多次next方法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L540-L552 | train | Gets the type of the element from the given iterator. | [
30522,
2270,
10763,
2465,
1026,
1029,
1028,
2131,
12260,
3672,
13874,
1006,
2009,
6906,
4263,
1026,
1029,
1028,
2009,
6906,
4263,
1007,
1063,
2345,
2009,
6906,
4263,
1026,
1029,
1028,
2009,
2121,
2475,
1027,
2047,
15826,
21646,
1026,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.set | public HttpHeaders set(HttpHeaders headers) {
checkNotNull(headers, "headers");
clear();
if (headers.isEmpty()) {
return this;
}
for (Entry<String, String> entry : headers) {
add(entry.getKey(), entry.getValue());
}
return this;
} | java | public HttpHeaders set(HttpHeaders headers) {
checkNotNull(headers, "headers");
clear();
if (headers.isEmpty()) {
return this;
}
for (Entry<String, String> entry : headers) {
add(entry.getKey(), entry.getValue());
}
return this;
} | [
"public",
"HttpHeaders",
"set",
"(",
"HttpHeaders",
"headers",
")",
"{",
"checkNotNull",
"(",
"headers",
",",
"\"headers\"",
")",
";",
"clear",
"(",
")",
";",
"if",
"(",
"headers",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"for",
... | Cleans the current header entries and copies all header entries of the specified {@code headers}.
@return {@code this} | [
"Cleans",
"the",
"current",
"header",
"entries",
"and",
"copies",
"all",
"header",
"entries",
"of",
"the",
"specified",
"{",
"@code",
"headers",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1495-L1508 | train | Sets the HTTP headers. | [
30522,
2270,
8299,
4974,
2545,
2275,
1006,
8299,
4974,
2545,
20346,
2015,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
20346,
2015,
1010,
1000,
20346,
2015,
1000,
1007,
1025,
3154,
1006,
1007,
1025,
2065,
1006,
20346,
2015,
1012,
2003,
6633,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobManagerRunner.java | JobManagerRunner.unregisterJobFromHighAvailability | private void unregisterJobFromHighAvailability() {
try {
runningJobsRegistry.setJobFinished(jobGraph.getJobID());
}
catch (Throwable t) {
log.error("Could not un-register from high-availability services job {} ({})." +
"Other JobManager's may attempt to recover it and re-execute it.",
jobGraph.getName(), jobGraph.getJobID(), t);
}
} | java | private void unregisterJobFromHighAvailability() {
try {
runningJobsRegistry.setJobFinished(jobGraph.getJobID());
}
catch (Throwable t) {
log.error("Could not un-register from high-availability services job {} ({})." +
"Other JobManager's may attempt to recover it and re-execute it.",
jobGraph.getName(), jobGraph.getJobID(), t);
}
} | [
"private",
"void",
"unregisterJobFromHighAvailability",
"(",
")",
"{",
"try",
"{",
"runningJobsRegistry",
".",
"setJobFinished",
"(",
"jobGraph",
".",
"getJobID",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"log",
".",
"error",
"(",
... | Marks this runner's job as not running. Other JobManager will not recover the job
after this call.
<p>This method never throws an exception. | [
"Marks",
"this",
"runner",
"s",
"job",
"as",
"not",
"running",
".",
"Other",
"JobManager",
"will",
"not",
"recover",
"the",
"job",
"after",
"this",
"call",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobManagerRunner.java#L265-L274 | train | Un - registers the job from high - availability services. | [
30522,
2797,
11675,
4895,
2890,
24063,
2121,
5558,
29292,
21716,
4048,
5603,
12462,
11733,
8553,
1006,
1007,
1063,
3046,
1063,
2770,
5558,
5910,
2890,
24063,
2854,
1012,
2275,
5558,
29292,
5498,
14740,
1006,
3105,
14413,
1012,
2131,
5558,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonSingleInputStreamer.java | PythonSingleInputStreamer.streamBufferWithoutGroups | public final void streamBufferWithoutGroups(Iterator<IN> iterator, Collector<OUT> c) {
SingleElementPushBackIterator<IN> i = new SingleElementPushBackIterator<>(iterator);
try {
int size;
if (i.hasNext()) {
while (true) {
int sig = in.readInt();
switch (sig) {
case SIGNAL_BUFFER_REQUEST:
if (i.hasNext()) {
size = sender.sendBuffer(i);
sendWriteNotification(size, i.hasNext());
} else {
throw new RuntimeException("External process requested data even though none is available.");
}
break;
case SIGNAL_FINISHED:
return;
case SIGNAL_ERROR:
try {
outPrinter.join();
} catch (InterruptedException e) {
outPrinter.interrupt();
}
try {
errorPrinter.join();
} catch (InterruptedException e) {
errorPrinter.interrupt();
}
throw new RuntimeException(
"External process for task " + function.getRuntimeContext().getTaskName() + " terminated prematurely due to an error." + msg);
default:
receiver.collectBuffer(c, sig);
sendReadConfirmation();
break;
}
}
}
} catch (SocketTimeoutException ignored) {
throw new RuntimeException("External process for task " + function.getRuntimeContext().getTaskName() + " stopped responding." + msg.get());
} catch (Exception e) {
throw new RuntimeException("Critical failure for task " + function.getRuntimeContext().getTaskName() + ". " + msg.get(), e);
}
} | java | public final void streamBufferWithoutGroups(Iterator<IN> iterator, Collector<OUT> c) {
SingleElementPushBackIterator<IN> i = new SingleElementPushBackIterator<>(iterator);
try {
int size;
if (i.hasNext()) {
while (true) {
int sig = in.readInt();
switch (sig) {
case SIGNAL_BUFFER_REQUEST:
if (i.hasNext()) {
size = sender.sendBuffer(i);
sendWriteNotification(size, i.hasNext());
} else {
throw new RuntimeException("External process requested data even though none is available.");
}
break;
case SIGNAL_FINISHED:
return;
case SIGNAL_ERROR:
try {
outPrinter.join();
} catch (InterruptedException e) {
outPrinter.interrupt();
}
try {
errorPrinter.join();
} catch (InterruptedException e) {
errorPrinter.interrupt();
}
throw new RuntimeException(
"External process for task " + function.getRuntimeContext().getTaskName() + " terminated prematurely due to an error." + msg);
default:
receiver.collectBuffer(c, sig);
sendReadConfirmation();
break;
}
}
}
} catch (SocketTimeoutException ignored) {
throw new RuntimeException("External process for task " + function.getRuntimeContext().getTaskName() + " stopped responding." + msg.get());
} catch (Exception e) {
throw new RuntimeException("Critical failure for task " + function.getRuntimeContext().getTaskName() + ". " + msg.get(), e);
}
} | [
"public",
"final",
"void",
"streamBufferWithoutGroups",
"(",
"Iterator",
"<",
"IN",
">",
"iterator",
",",
"Collector",
"<",
"OUT",
">",
"c",
")",
"{",
"SingleElementPushBackIterator",
"<",
"IN",
">",
"i",
"=",
"new",
"SingleElementPushBackIterator",
"<>",
"(",
... | Sends all values contained in the iterator to the external process and collects all results.
@param iterator input stream
@param c collector | [
"Sends",
"all",
"values",
"contained",
"in",
"the",
"iterator",
"to",
"the",
"external",
"process",
"and",
"collects",
"all",
"results",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonSingleInputStreamer.java#L47-L90 | train | Stream the data from the iterator without the groups. | [
30522,
2270,
2345,
11675,
5460,
8569,
12494,
24415,
5833,
17058,
2015,
1006,
2009,
6906,
4263,
1026,
1999,
1028,
2009,
6906,
4263,
1010,
10018,
1026,
2041,
1028,
1039,
1007,
1063,
2309,
12260,
3672,
12207,
2232,
5963,
21646,
8844,
1026,
199... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-transaction/sharding-transaction-2pc/sharding-transaction-xa/sharding-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/connection/XAConnectionFactory.java | XAConnectionFactory.createXAConnection | public static XAConnection createXAConnection(final DatabaseType databaseType, final XADataSource xaDataSource, final Connection connection) {
switch (databaseType) {
case MySQL:
return new MySQLXAConnectionWrapper().wrap(xaDataSource, connection);
case PostgreSQL:
return new PostgreSQLXAConnectionWrapper().wrap(xaDataSource, connection);
case H2:
return new H2XAConnectionWrapper().wrap(xaDataSource, connection);
default:
throw new UnsupportedOperationException(String.format("Cannot support database type: `%s`", databaseType));
}
} | java | public static XAConnection createXAConnection(final DatabaseType databaseType, final XADataSource xaDataSource, final Connection connection) {
switch (databaseType) {
case MySQL:
return new MySQLXAConnectionWrapper().wrap(xaDataSource, connection);
case PostgreSQL:
return new PostgreSQLXAConnectionWrapper().wrap(xaDataSource, connection);
case H2:
return new H2XAConnectionWrapper().wrap(xaDataSource, connection);
default:
throw new UnsupportedOperationException(String.format("Cannot support database type: `%s`", databaseType));
}
} | [
"public",
"static",
"XAConnection",
"createXAConnection",
"(",
"final",
"DatabaseType",
"databaseType",
",",
"final",
"XADataSource",
"xaDataSource",
",",
"final",
"Connection",
"connection",
")",
"{",
"switch",
"(",
"databaseType",
")",
"{",
"case",
"MySQL",
":",
... | Create XA connection from normal connection.
@param databaseType database type
@param connection normal connection
@param xaDataSource XA data source
@return XA connection | [
"Create",
"XA",
"connection",
"from",
"normal",
"connection",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-transaction/sharding-transaction-2pc/sharding-transaction-xa/sharding-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/connection/XAConnectionFactory.java#L47-L58 | train | Create an XAConnection. | [
30522,
2270,
10763,
1060,
22684,
10087,
7542,
3443,
18684,
8663,
2638,
7542,
1006,
30524,
2026,
2015,
4160,
2140,
18684,
8663,
2638,
7542,
13088,
29098,
2121,
1006,
1007,
1012,
10236,
1006,
1060,
8447,
10230,
8162,
3401,
1010,
4434,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getBeUlong40 | public final long getBeUlong40(final int pos) {
final int position = origin + pos;
if (pos + 4 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 4)));
byte[] buf = buffer;
return ((long) (0xff & buf[position + 4])) | ((long) (0xff & buf[position + 3]) << 8)
| ((long) (0xff & buf[position + 2]) << 16) | ((long) (0xff & buf[position + 1]) << 24)
| ((long) (0xff & buf[position]) << 32);
} | java | public final long getBeUlong40(final int pos) {
final int position = origin + pos;
if (pos + 4 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 4)));
byte[] buf = buffer;
return ((long) (0xff & buf[position + 4])) | ((long) (0xff & buf[position + 3]) << 8)
| ((long) (0xff & buf[position + 2]) << 16) | ((long) (0xff & buf[position + 1]) << 24)
| ((long) (0xff & buf[position]) << 32);
} | [
"public",
"final",
"long",
"getBeUlong40",
"(",
"final",
"int",
"pos",
")",
"{",
"final",
"int",
"position",
"=",
"origin",
"+",
"pos",
";",
"if",
"(",
"pos",
"+",
"4",
">=",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentExceptio... | Return 40-bit unsigned int from buffer. (big-endian)
@see mysql-5.6.10/include/myisampack.h - mi_uint5korr | [
"Return",
"40",
"-",
"bit",
"unsigned",
"int",
"from",
"buffer",
".",
"(",
"big",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L617-L627 | train | Gets a long from the buffer starting at the given position in the beacon. | [
30522,
2270,
2345,
2146,
2131,
4783,
18845,
3070,
12740,
1006,
2345,
20014,
13433,
2015,
1007,
1063,
2345,
20014,
2597,
1027,
4761,
1009,
13433,
2015,
1025,
2065,
1006,
13433,
2015,
1009,
1018,
1028,
1027,
5787,
1064,
1064,
13433,
2015,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java | BinTrie.prefixSearch | public Set<Map.Entry<String, V>> prefixSearch(String key)
{
Set<Map.Entry<String, V>> entrySet = new TreeSet<Map.Entry<String, V>>();
StringBuilder sb = new StringBuilder(key.substring(0, key.length() - 1));
BaseNode branch = this;
char[] chars = key.toCharArray();
for (char aChar : chars)
{
if (branch == null) return entrySet;
branch = branch.getChild(aChar);
}
if (branch == null) return entrySet;
branch.walk(sb, entrySet);
return entrySet;
} | java | public Set<Map.Entry<String, V>> prefixSearch(String key)
{
Set<Map.Entry<String, V>> entrySet = new TreeSet<Map.Entry<String, V>>();
StringBuilder sb = new StringBuilder(key.substring(0, key.length() - 1));
BaseNode branch = this;
char[] chars = key.toCharArray();
for (char aChar : chars)
{
if (branch == null) return entrySet;
branch = branch.getChild(aChar);
}
if (branch == null) return entrySet;
branch.walk(sb, entrySet);
return entrySet;
} | [
"public",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"V",
">",
">",
"prefixSearch",
"(",
"String",
"key",
")",
"{",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"V",
">",
">",
"entrySet",
"=",
"new",
"TreeSet",
"<",
"Map",
".",
... | 前缀查询
@param key 查询串
@return 键值对 | [
"前缀查询"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java#L218-L233 | train | Prefix search method. | [
30522,
2270,
2275,
1026,
4949,
1012,
4443,
1026,
5164,
1010,
1058,
1028,
1028,
17576,
17310,
11140,
1006,
5164,
3145,
1007,
1063,
2275,
1026,
4949,
1012,
4443,
1026,
5164,
1010,
1058,
1028,
1028,
4443,
13462,
1027,
2047,
3628,
3388,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.range | public static int[] range(int includedStart, int excludedEnd, int step) {
if (includedStart > excludedEnd) {
int tmp = includedStart;
includedStart = excludedEnd;
excludedEnd = tmp;
}
if (step <= 0) {
step = 1;
}
int deviation = excludedEnd - includedStart;
int length = deviation / step;
if (deviation % step != 0) {
length += 1;
}
int[] range = new int[length];
for (int i = 0; i < length; i++) {
range[i] = includedStart;
includedStart += step;
}
return range;
} | java | public static int[] range(int includedStart, int excludedEnd, int step) {
if (includedStart > excludedEnd) {
int tmp = includedStart;
includedStart = excludedEnd;
excludedEnd = tmp;
}
if (step <= 0) {
step = 1;
}
int deviation = excludedEnd - includedStart;
int length = deviation / step;
if (deviation % step != 0) {
length += 1;
}
int[] range = new int[length];
for (int i = 0; i < length; i++) {
range[i] = includedStart;
includedStart += step;
}
return range;
} | [
"public",
"static",
"int",
"[",
"]",
"range",
"(",
"int",
"includedStart",
",",
"int",
"excludedEnd",
",",
"int",
"step",
")",
"{",
"if",
"(",
"includedStart",
">",
"excludedEnd",
")",
"{",
"int",
"tmp",
"=",
"includedStart",
";",
"includedStart",
"=",
"... | 生成一个数字列表<br>
自动判定正序反序
@param includedStart 开始的数字(包含)
@param excludedEnd 结束的数字(不包含)
@param step 步进
@return 数字列表 | [
"生成一个数字列表<br",
">",
"自动判定正序反序"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L667-L689 | train | Returns an array of integers that are within the specified range of the specified range of bytes. | [
30522,
2270,
10763,
20014,
1031,
1033,
2846,
1006,
20014,
2443,
14117,
2102,
1010,
20014,
12421,
10497,
1010,
20014,
3357,
1007,
1063,
2065,
1006,
2443,
14117,
2102,
1028,
12421,
10497,
1007,
1063,
20014,
1056,
8737,
1027,
2443,
14117,
2102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
redisson/redisson | redisson/src/main/java/org/redisson/RedissonSortedSet.java | RedissonSortedSet.binarySearch | public BinarySearchResult<V> binarySearch(V value, Codec codec) {
int size = list.size();
int upperIndex = size - 1;
int lowerIndex = 0;
while (lowerIndex <= upperIndex) {
int index = lowerIndex + (upperIndex - lowerIndex) / 2;
V res = list.getValue(index);
if (res == null) {
return new BinarySearchResult<V>();
}
int cmp = comparator.compare(value, res);
if (cmp == 0) {
BinarySearchResult<V> indexRes = new BinarySearchResult<V>();
indexRes.setIndex(index);
return indexRes;
} else if (cmp < 0) {
upperIndex = index - 1;
} else {
lowerIndex = index + 1;
}
}
BinarySearchResult<V> indexRes = new BinarySearchResult<V>();
indexRes.setIndex(-(lowerIndex + 1));
return indexRes;
} | java | public BinarySearchResult<V> binarySearch(V value, Codec codec) {
int size = list.size();
int upperIndex = size - 1;
int lowerIndex = 0;
while (lowerIndex <= upperIndex) {
int index = lowerIndex + (upperIndex - lowerIndex) / 2;
V res = list.getValue(index);
if (res == null) {
return new BinarySearchResult<V>();
}
int cmp = comparator.compare(value, res);
if (cmp == 0) {
BinarySearchResult<V> indexRes = new BinarySearchResult<V>();
indexRes.setIndex(index);
return indexRes;
} else if (cmp < 0) {
upperIndex = index - 1;
} else {
lowerIndex = index + 1;
}
}
BinarySearchResult<V> indexRes = new BinarySearchResult<V>();
indexRes.setIndex(-(lowerIndex + 1));
return indexRes;
} | [
"public",
"BinarySearchResult",
"<",
"V",
">",
"binarySearch",
"(",
"V",
"value",
",",
"Codec",
"codec",
")",
"{",
"int",
"size",
"=",
"list",
".",
"size",
"(",
")",
";",
"int",
"upperIndex",
"=",
"size",
"-",
"1",
";",
"int",
"lowerIndex",
"=",
"0",... | TODO optimize: get three values each time instead of single | [
"TODO",
"optimize",
":",
"get",
"three",
"values",
"each",
"time",
"instead",
"of",
"single"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/RedissonSortedSet.java#L421-L448 | train | Binary search for the value in the list. | [
30522,
2270,
12441,
17310,
11140,
6072,
11314,
1026,
1058,
1028,
12441,
17310,
11140,
1006,
1058,
3643,
1010,
3642,
2278,
3642,
2278,
1007,
1063,
20014,
2946,
1027,
2862,
1012,
2946,
1006,
1007,
1025,
20014,
3356,
22254,
10288,
1027,
2946,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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, String... excludeMethodNames) {
final HashSet<String> excludeMethodNameSet = CollectionUtil.newHashSet(excludeMethodNames);
return getPublicMethods(clazz, new Filter<Method>() {
@Override
public boolean accept(Method method) {
return false == excludeMethodNameSet.contains(method.getName());
}
});
} | java | public static List<Method> getPublicMethods(Class<?> clazz, String... excludeMethodNames) {
final HashSet<String> excludeMethodNameSet = CollectionUtil.newHashSet(excludeMethodNames);
return getPublicMethods(clazz, new Filter<Method>() {
@Override
public boolean accept(Method method) {
return false == excludeMethodNameSet.contains(method.getName());
}
});
} | [
"public",
"static",
"List",
"<",
"Method",
">",
"getPublicMethods",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"...",
"excludeMethodNames",
")",
"{",
"final",
"HashSet",
"<",
"String",
">",
"excludeMethodNameSet",
"=",
"CollectionUtil",
".",
"newHash... | 获得指定类过滤后的Public方法列表
@param clazz 查找方法的类
@param excludeMethodNames 不包括的方法名列表
@return 过滤后的方法列表 | [
"获得指定类过滤后的Public方法列表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L353-L361 | train | Returns a list of public methods of the given class including those that are not in the excludeMethodNames list. | [
30522,
2270,
10763,
2862,
1026,
4118,
1028,
2131,
14289,
16558,
2594,
11368,
6806,
5104,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
5164,
1012,
1012,
1012,
23329,
11368,
6806,
28911,
7834,
1007,
1063,
2345,
23325,
13462,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.