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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
netty/netty | buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java | CompositeByteBuf.addComponent | public CompositeByteBuf addComponent(boolean increaseWriterIndex, int cIndex, ByteBuf buffer) {
checkNotNull(buffer, "buffer");
addComponent0(increaseWriterIndex, cIndex, buffer);
consolidateIfNeeded();
return this;
} | java | public CompositeByteBuf addComponent(boolean increaseWriterIndex, int cIndex, ByteBuf buffer) {
checkNotNull(buffer, "buffer");
addComponent0(increaseWriterIndex, cIndex, buffer);
consolidateIfNeeded();
return this;
} | [
"public",
"CompositeByteBuf",
"addComponent",
"(",
"boolean",
"increaseWriterIndex",
",",
"int",
"cIndex",
",",
"ByteBuf",
"buffer",
")",
"{",
"checkNotNull",
"(",
"buffer",
",",
"\"buffer\"",
")",
";",
"addComponent0",
"(",
"increaseWriterIndex",
",",
"cIndex",
"... | Add the given {@link ByteBuf} on the specific index and increase the {@code writerIndex}
if {@code increaseWriterIndex} is {@code true}.
{@link ByteBuf#release()} ownership of {@code buffer} is transferred to this {@link CompositeByteBuf}.
@param cIndex the index on which the {@link ByteBuf} will be added.
@param buffer the {@link ByteBuf} to add. {@link ByteBuf#release()} ownership is transferred to this
{@link CompositeByteBuf}. | [
"Add",
"the",
"given",
"{",
"@link",
"ByteBuf",
"}",
"on",
"the",
"specific",
"index",
"and",
"increase",
"the",
"{",
"@code",
"writerIndex",
"}",
"if",
"{",
"@code",
"increaseWriterIndex",
"}",
"is",
"{",
"@code",
"true",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L263-L268 | train | Add a single component to this composite buffer. | [
30522,
2270,
12490,
3762,
2618,
8569,
2546,
5587,
9006,
29513,
3372,
1006,
22017,
20898,
3623,
15994,
22254,
10288,
1010,
20014,
25022,
13629,
2595,
1010,
24880,
8569,
2546,
17698,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
17698,
1010,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/Unpooled.java | Unpooled.copyShort | public static ByteBuf copyShort(short... values) {
if (values == null || values.length == 0) {
return EMPTY_BUFFER;
}
ByteBuf buffer = buffer(values.length * 2);
for (int v: values) {
buffer.writeShort(v);
}
return buffer;
} | java | public static ByteBuf copyShort(short... values) {
if (values == null || values.length == 0) {
return EMPTY_BUFFER;
}
ByteBuf buffer = buffer(values.length * 2);
for (int v: values) {
buffer.writeShort(v);
}
return buffer;
} | [
"public",
"static",
"ByteBuf",
"copyShort",
"(",
"short",
"...",
"values",
")",
"{",
"if",
"(",
"values",
"==",
"null",
"||",
"values",
".",
"length",
"==",
"0",
")",
"{",
"return",
"EMPTY_BUFFER",
";",
"}",
"ByteBuf",
"buffer",
"=",
"buffer",
"(",
"va... | Create a new big-endian buffer that holds a sequence of the specified 16-bit integers. | [
"Create",
"a",
"new",
"big",
"-",
"endian",
"buffer",
"that",
"holds",
"a",
"sequence",
"of",
"the",
"specified",
"16",
"-",
"bit",
"integers",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L708-L717 | train | Create a new big - endian buffer that holds a sequence of the specified 16 - bit integers. | [
30522,
2270,
10763,
24880,
8569,
2546,
6100,
22231,
5339,
1006,
2460,
1012,
1012,
1012,
5300,
1007,
1063,
2065,
1006,
5300,
1027,
1027,
19701,
1064,
1064,
5300,
1012,
3091,
1027,
1027,
1014,
1007,
1063,
2709,
4064,
1035,
17698,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionManager.java | ResultPartitionManager.onConsumedPartition | void onConsumedPartition(ResultPartition partition) {
final ResultPartition previous;
LOG.debug("Received consume notification from {}.", partition);
synchronized (registeredPartitions) {
previous = registeredPartitions.remove(partition.getPartitionId());
}
// Release the partition if it was successfully removed
if (partition == previous) {
partition.release();
LOG.debug("Released {}.", partition);
}
} | java | void onConsumedPartition(ResultPartition partition) {
final ResultPartition previous;
LOG.debug("Received consume notification from {}.", partition);
synchronized (registeredPartitions) {
previous = registeredPartitions.remove(partition.getPartitionId());
}
// Release the partition if it was successfully removed
if (partition == previous) {
partition.release();
LOG.debug("Released {}.", partition);
}
} | [
"void",
"onConsumedPartition",
"(",
"ResultPartition",
"partition",
")",
"{",
"final",
"ResultPartition",
"previous",
";",
"LOG",
".",
"debug",
"(",
"\"Received consume notification from {}.\"",
",",
"partition",
")",
";",
"synchronized",
"(",
"registeredPartitions",
")... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionManager.java#L108-L123 | train | Called when a partition is consumed from the result store. | [
30522,
11675,
2006,
8663,
23545,
18927,
8445,
22753,
1006,
2765,
19362,
3775,
3508,
13571,
1007,
1063,
2345,
2765,
19362,
3775,
3508,
3025,
1025,
8833,
1012,
2139,
8569,
2290,
1006,
1000,
2363,
16678,
26828,
2013,
1063,
1065,
1012,
1000,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaInvocationHandler.java | AkkaInvocationHandler.ask | protected CompletableFuture<?> ask(Object message, Time timeout) {
return FutureUtils.toJava(
Patterns.ask(rpcEndpoint, message, timeout.toMilliseconds()));
} | java | protected CompletableFuture<?> ask(Object message, Time timeout) {
return FutureUtils.toJava(
Patterns.ask(rpcEndpoint, message, timeout.toMilliseconds()));
} | [
"protected",
"CompletableFuture",
"<",
"?",
">",
"ask",
"(",
"Object",
"message",
",",
"Time",
"timeout",
")",
"{",
"return",
"FutureUtils",
".",
"toJava",
"(",
"Patterns",
".",
"ask",
"(",
"rpcEndpoint",
",",
"message",
",",
"timeout",
".",
"toMilliseconds"... | Sends the message to the RPC endpoint and returns a future containing
its response.
@param message to send to the RPC endpoint
@param timeout time to wait until the response future is failed with a {@link TimeoutException}
@return Response future | [
"Sends",
"the",
"message",
"to",
"the",
"RPC",
"endpoint",
"and",
"returns",
"a",
"future",
"containing",
"its",
"response",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaInvocationHandler.java#L351-L354 | train | Ask for a message. | [
30522,
5123,
4012,
10814,
10880,
11263,
11244,
1026,
1029,
1028,
3198,
1006,
4874,
4471,
1010,
2051,
2051,
5833,
1007,
1063,
2709,
2925,
21823,
4877,
1012,
2000,
3900,
3567,
1006,
7060,
1012,
3198,
1006,
1054,
15042,
10497,
8400,
1010,
4471... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/StringUtil.java | StringUtil.unescapeCsv | public static CharSequence unescapeCsv(CharSequence value) {
int length = checkNotNull(value, "value").length();
if (length == 0) {
return value;
}
int last = length - 1;
boolean quoted = isDoubleQuote(value.charAt(0)) && isDoubleQuote(value.charAt(last)) && length != 1;
if (!quoted) {
validateCsvFormat(value);
return value;
}
StringBuilder unescaped = InternalThreadLocalMap.get().stringBuilder();
for (int i = 1; i < last; i++) {
char current = value.charAt(i);
if (current == DOUBLE_QUOTE) {
if (isDoubleQuote(value.charAt(i + 1)) && (i + 1) != last) {
// Followed by a double-quote but not the last character
// Just skip the next double-quote
i++;
} else {
// Not followed by a double-quote or the following double-quote is the last character
throw newInvalidEscapedCsvFieldException(value, i);
}
}
unescaped.append(current);
}
return unescaped.toString();
} | java | public static CharSequence unescapeCsv(CharSequence value) {
int length = checkNotNull(value, "value").length();
if (length == 0) {
return value;
}
int last = length - 1;
boolean quoted = isDoubleQuote(value.charAt(0)) && isDoubleQuote(value.charAt(last)) && length != 1;
if (!quoted) {
validateCsvFormat(value);
return value;
}
StringBuilder unescaped = InternalThreadLocalMap.get().stringBuilder();
for (int i = 1; i < last; i++) {
char current = value.charAt(i);
if (current == DOUBLE_QUOTE) {
if (isDoubleQuote(value.charAt(i + 1)) && (i + 1) != last) {
// Followed by a double-quote but not the last character
// Just skip the next double-quote
i++;
} else {
// Not followed by a double-quote or the following double-quote is the last character
throw newInvalidEscapedCsvFieldException(value, i);
}
}
unescaped.append(current);
}
return unescaped.toString();
} | [
"public",
"static",
"CharSequence",
"unescapeCsv",
"(",
"CharSequence",
"value",
")",
"{",
"int",
"length",
"=",
"checkNotNull",
"(",
"value",
",",
"\"value\"",
")",
".",
"length",
"(",
")",
";",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"return",
"value... | Unescapes the specified escaped CSV field, if necessary according to
<a href="https://tools.ietf.org/html/rfc4180#section-2">RFC-4180</a>.
@param value The escaped CSV field which will be unescaped according to
<a href="https://tools.ietf.org/html/rfc4180#section-2">RFC-4180</a>
@return {@link CharSequence} the unescaped value if necessary, or the value unchanged | [
"Unescapes",
"the",
"specified",
"escaped",
"CSV",
"field",
"if",
"necessary",
"according",
"to",
"<a",
"href",
"=",
"https",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc4180#section",
"-",
"2",
">",
"RFC",
"-",
"4180<",
"/",
"a"... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L400-L427 | train | Unescapes the CSV value. | [
30522,
2270,
10763,
25869,
3366,
4226,
5897,
16655,
15782,
5051,
6169,
2615,
1006,
25869,
3366,
4226,
5897,
3643,
1007,
1063,
20014,
3091,
1027,
4638,
17048,
11231,
3363,
1006,
3643,
1010,
1000,
3643,
1000,
1007,
1012,
3091,
1006,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshot.java | PojoSerializerSnapshot.newPojoHasNewOrRemovedFields | private static boolean newPojoHasNewOrRemovedFields(
LinkedOptionalMap<Field, TypeSerializerSnapshot<?>> fieldSerializerSnapshots,
PojoSerializer<?> newPojoSerializer) {
int numRemovedFields = fieldSerializerSnapshots.absentKeysOrValues().size();
int numPreexistingFields = fieldSerializerSnapshots.size() - numRemovedFields;
boolean hasRemovedFields = numRemovedFields > 0;
boolean hasNewFields = newPojoSerializer.getFields().length - numPreexistingFields > 0;
return hasRemovedFields || hasNewFields;
} | java | private static boolean newPojoHasNewOrRemovedFields(
LinkedOptionalMap<Field, TypeSerializerSnapshot<?>> fieldSerializerSnapshots,
PojoSerializer<?> newPojoSerializer) {
int numRemovedFields = fieldSerializerSnapshots.absentKeysOrValues().size();
int numPreexistingFields = fieldSerializerSnapshots.size() - numRemovedFields;
boolean hasRemovedFields = numRemovedFields > 0;
boolean hasNewFields = newPojoSerializer.getFields().length - numPreexistingFields > 0;
return hasRemovedFields || hasNewFields;
} | [
"private",
"static",
"boolean",
"newPojoHasNewOrRemovedFields",
"(",
"LinkedOptionalMap",
"<",
"Field",
",",
"TypeSerializerSnapshot",
"<",
"?",
">",
">",
"fieldSerializerSnapshots",
",",
"PojoSerializer",
"<",
"?",
">",
"newPojoSerializer",
")",
"{",
"int",
"numRemov... | Checks whether the new {@link PojoSerializer} has new or removed fields compared to the previous one. | [
"Checks",
"whether",
"the",
"new",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshot.java#L373-L382 | train | Checks if a new pojo has new or removed fields. | [
30522,
2797,
10763,
22017,
20898,
2047,
6873,
5558,
14949,
2638,
12155,
14343,
5302,
7178,
15155,
1006,
5799,
7361,
3508,
2389,
2863,
2361,
1026,
2492,
1010,
4127,
11610,
28863,
2015,
2532,
4523,
12326,
1026,
1029,
1028,
1028,
4249,
11610,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java | SoapClient.setParams | public SoapClient setParams(Map<String, Object> params, boolean useMethodPrefix) {
for (Entry<String, Object> entry : MapUtil.wrap(params)) {
setParam(entry.getKey(), entry.getValue(), useMethodPrefix);
}
return this;
} | java | public SoapClient setParams(Map<String, Object> params, boolean useMethodPrefix) {
for (Entry<String, Object> entry : MapUtil.wrap(params)) {
setParam(entry.getKey(), entry.getValue(), useMethodPrefix);
}
return this;
} | [
"public",
"SoapClient",
"setParams",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
",",
"boolean",
"useMethodPrefix",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"Object",
">",
"entry",
":",
"MapUtil",
".",
"wrap",
"(",
"params",
")",
... | 批量设置参数
@param params 参数列表
@param useMethodPrefix 是否使用方法的命名空间前缀
@return this
@since 4.5.6 | [
"批量设置参数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L338-L343 | train | Sets the parameters for the request. | [
30522,
2270,
7815,
20464,
11638,
2275,
28689,
5244,
1006,
4949,
1026,
5164,
1010,
4874,
1028,
11498,
5244,
1010,
22017,
20898,
2224,
11368,
6806,
18927,
2890,
8873,
2595,
1007,
1063,
2005,
1006,
4443,
1026,
5164,
1010,
4874,
1028,
4443,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonStreamExecutionEnvironment.java | PythonStreamExecutionEnvironment.from_collection | public PythonDataStream from_collection(Collection<Object> collection) {
return new PythonDataStream<>(env.fromCollection(collection).map(new AdapterMap<>()));
} | java | public PythonDataStream from_collection(Collection<Object> collection) {
return new PythonDataStream<>(env.fromCollection(collection).map(new AdapterMap<>()));
} | [
"public",
"PythonDataStream",
"from_collection",
"(",
"Collection",
"<",
"Object",
">",
"collection",
")",
"{",
"return",
"new",
"PythonDataStream",
"<>",
"(",
"env",
".",
"fromCollection",
"(",
"collection",
")",
".",
"map",
"(",
"new",
"AdapterMap",
"<>",
"(... | A thin wrapper layer over {@link StreamExecutionEnvironment#fromCollection(java.util.Collection)}
<p>The input {@code Collection} is of type {@code Object}, because it is a collection
of Python elements. * There type is determined in runtime, by the Jython framework.</p>
@param collection The collection of python elements to create the data stream from.
@return The data stream representing the given collection | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"StreamExecutionEnvironment#fromCollection",
"(",
"java",
".",
"util",
".",
"Collection",
")",
"}"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonStreamExecutionEnvironment.java#L150-L152 | train | Creates a PythonDataStream from a collection of objects. | [
30522,
2270,
18750,
2850,
10230,
25379,
2013,
1035,
3074,
1006,
3074,
1026,
4874,
1028,
3074,
1007,
1063,
2709,
2047,
18750,
2850,
10230,
25379,
1026,
1028,
1006,
4372,
2615,
1012,
2013,
26895,
18491,
1006,
3074,
1007,
1012,
4949,
1006,
204... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java | ExcelBase.getSheets | public List<Sheet> getSheets() {
final int totalSheet = getSheetCount();
final List<Sheet> result = new ArrayList<>(totalSheet);
for (int i = 0; i < totalSheet; i++) {
result.add(this.workbook.getSheetAt(i));
}
return result;
} | java | public List<Sheet> getSheets() {
final int totalSheet = getSheetCount();
final List<Sheet> result = new ArrayList<>(totalSheet);
for (int i = 0; i < totalSheet; i++) {
result.add(this.workbook.getSheetAt(i));
}
return result;
} | [
"public",
"List",
"<",
"Sheet",
">",
"getSheets",
"(",
")",
"{",
"final",
"int",
"totalSheet",
"=",
"getSheetCount",
"(",
")",
";",
"final",
"List",
"<",
"Sheet",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
"totalSheet",
")",
";",
"for",
"(",
... | 获取此工作簿所有Sheet表
@return sheet表列表
@since 4.0.3 | [
"获取此工作簿所有Sheet表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java#L68-L75 | train | Gets the list of sheets contained in this worksheet. | [
30522,
2270,
2862,
1026,
7123,
1028,
4152,
21030,
3215,
1006,
1007,
1063,
2345,
20014,
21948,
21030,
2102,
1027,
4152,
21030,
13535,
21723,
1006,
1007,
1025,
2345,
2862,
1026,
7123,
1028,
2765,
1027,
2047,
9140,
9863,
1026,
1028,
1006,
2194... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/JobResult.java | JobResult.toJobExecutionResult | public JobExecutionResult toJobExecutionResult(ClassLoader classLoader) throws JobExecutionException, IOException, ClassNotFoundException {
if (applicationStatus == ApplicationStatus.SUCCEEDED) {
return new JobExecutionResult(
jobId,
netRuntime,
AccumulatorHelper.deserializeAccumulators(
accumulatorResults,
classLoader));
} else {
final Throwable cause;
if (serializedThrowable == null) {
cause = null;
} else {
cause = serializedThrowable.deserializeError(classLoader);
}
final JobExecutionException exception;
if (applicationStatus == ApplicationStatus.FAILED) {
exception = new JobExecutionException(jobId, "Job execution failed.", cause);
} else if (applicationStatus == ApplicationStatus.CANCELED) {
exception = new JobCancellationException(jobId, "Job was cancelled.", cause);
} else {
exception = new JobExecutionException(jobId, "Job completed with illegal application status: " + applicationStatus + '.', cause);
}
throw exception;
}
} | java | public JobExecutionResult toJobExecutionResult(ClassLoader classLoader) throws JobExecutionException, IOException, ClassNotFoundException {
if (applicationStatus == ApplicationStatus.SUCCEEDED) {
return new JobExecutionResult(
jobId,
netRuntime,
AccumulatorHelper.deserializeAccumulators(
accumulatorResults,
classLoader));
} else {
final Throwable cause;
if (serializedThrowable == null) {
cause = null;
} else {
cause = serializedThrowable.deserializeError(classLoader);
}
final JobExecutionException exception;
if (applicationStatus == ApplicationStatus.FAILED) {
exception = new JobExecutionException(jobId, "Job execution failed.", cause);
} else if (applicationStatus == ApplicationStatus.CANCELED) {
exception = new JobCancellationException(jobId, "Job was cancelled.", cause);
} else {
exception = new JobExecutionException(jobId, "Job completed with illegal application status: " + applicationStatus + '.', cause);
}
throw exception;
}
} | [
"public",
"JobExecutionResult",
"toJobExecutionResult",
"(",
"ClassLoader",
"classLoader",
")",
"throws",
"JobExecutionException",
",",
"IOException",
",",
"ClassNotFoundException",
"{",
"if",
"(",
"applicationStatus",
"==",
"ApplicationStatus",
".",
"SUCCEEDED",
")",
"{"... | Converts the {@link JobResult} to a {@link JobExecutionResult}.
@param classLoader to use for deserialization
@return JobExecutionResult
@throws JobCancellationException if the job was cancelled
@throws JobExecutionException if the job execution did not succeed
@throws IOException if the accumulator could not be deserialized
@throws ClassNotFoundException if the accumulator could not deserialized | [
"Converts",
"the",
"{",
"@link",
"JobResult",
"}",
"to",
"a",
"{",
"@link",
"JobExecutionResult",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobResult.java#L126-L155 | train | Converts the job result to a JobExecutionResult object. | [
30522,
2270,
3105,
10288,
8586,
13700,
6072,
11314,
2000,
5558,
4783,
2595,
8586,
13700,
6072,
11314,
1006,
2465,
11066,
2121,
2465,
11066,
2121,
1007,
11618,
3105,
10288,
8586,
13700,
10288,
24422,
1010,
22834,
10288,
24422,
1010,
2465,
1704... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlUtil.java | SqlUtil.buildConditions | public static Condition[] buildConditions(Entity entity) {
if (null == entity || entity.isEmpty()) {
return null;
}
final Condition[] conditions = new Condition[entity.size()];
int i = 0;
Object value;
for (Entry<String, Object> entry : entity.entrySet()) {
value = entry.getValue();
if (value instanceof Condition) {
conditions[i++] = (Condition) value;
} else {
conditions[i++] = new Condition(entry.getKey(), value);
}
}
return conditions;
} | java | public static Condition[] buildConditions(Entity entity) {
if (null == entity || entity.isEmpty()) {
return null;
}
final Condition[] conditions = new Condition[entity.size()];
int i = 0;
Object value;
for (Entry<String, Object> entry : entity.entrySet()) {
value = entry.getValue();
if (value instanceof Condition) {
conditions[i++] = (Condition) value;
} else {
conditions[i++] = new Condition(entry.getKey(), value);
}
}
return conditions;
} | [
"public",
"static",
"Condition",
"[",
"]",
"buildConditions",
"(",
"Entity",
"entity",
")",
"{",
"if",
"(",
"null",
"==",
"entity",
"||",
"entity",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Condition",
"[",
"]",
"conditi... | 通过实体对象构建条件对象
@param entity 实体对象
@return 条件对象 | [
"通过实体对象构建条件对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlUtil.java#L62-L80 | train | Build the conditions from an entity. | [
30522,
2270,
10763,
4650,
1031,
1033,
3857,
8663,
20562,
2015,
1006,
9178,
9178,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
9178,
1064,
1064,
9178,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1007,
1063,
2709,
19701,
1025,
1065,
2345,
4650,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/Segment.java | Segment.quickAtomSegment | protected static List<AtomNode> quickAtomSegment(char[] charArray, int start, int end)
{
List<AtomNode> atomNodeList = new LinkedList<AtomNode>();
int offsetAtom = start;
int preType = CharType.get(charArray[offsetAtom]);
int curType;
while (++offsetAtom < end)
{
curType = CharType.get(charArray[offsetAtom]);
if (curType != preType)
{
// 浮点数识别
if (preType == CharType.CT_NUM && ",,..".indexOf(charArray[offsetAtom]) != -1)
{
if (offsetAtom+1 < end)
{
int nextType = CharType.get(charArray[offsetAtom+1]);
if (nextType == CharType.CT_NUM)
{
continue;
}
}
}
atomNodeList.add(new AtomNode(new String(charArray, start, offsetAtom - start), preType));
start = offsetAtom;
}
preType = curType;
}
if (offsetAtom == end)
atomNodeList.add(new AtomNode(new String(charArray, start, offsetAtom - start), preType));
return atomNodeList;
} | java | protected static List<AtomNode> quickAtomSegment(char[] charArray, int start, int end)
{
List<AtomNode> atomNodeList = new LinkedList<AtomNode>();
int offsetAtom = start;
int preType = CharType.get(charArray[offsetAtom]);
int curType;
while (++offsetAtom < end)
{
curType = CharType.get(charArray[offsetAtom]);
if (curType != preType)
{
// 浮点数识别
if (preType == CharType.CT_NUM && ",,..".indexOf(charArray[offsetAtom]) != -1)
{
if (offsetAtom+1 < end)
{
int nextType = CharType.get(charArray[offsetAtom+1]);
if (nextType == CharType.CT_NUM)
{
continue;
}
}
}
atomNodeList.add(new AtomNode(new String(charArray, start, offsetAtom - start), preType));
start = offsetAtom;
}
preType = curType;
}
if (offsetAtom == end)
atomNodeList.add(new AtomNode(new String(charArray, start, offsetAtom - start), preType));
return atomNodeList;
} | [
"protected",
"static",
"List",
"<",
"AtomNode",
">",
"quickAtomSegment",
"(",
"char",
"[",
"]",
"charArray",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"List",
"<",
"AtomNode",
">",
"atomNodeList",
"=",
"new",
"LinkedList",
"<",
"AtomNode",
">",
"... | 快速原子分词,希望用这个方法替换掉原来缓慢的方法
@param charArray
@param start
@param end
@return | [
"快速原子分词,希望用这个方法替换掉原来缓慢的方法"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Segment.java#L158-L190 | train | quickAtomSegment This method is used to get a list of AtomNodes from a char array. | [
30522,
5123,
10763,
2862,
1026,
13787,
3630,
3207,
1028,
4248,
10610,
5244,
13910,
3672,
1006,
25869,
1031,
1033,
25869,
2906,
9447,
1010,
20014,
2707,
1010,
20014,
2203,
1007,
1063,
2862,
1026,
13787,
3630,
30524,
2213,
1033,
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... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/SmUtil.java | SmUtil.bigIntToFixexLengthBytes | private static byte[] bigIntToFixexLengthBytes(BigInteger rOrS) {
// for sm2p256v1, n is 00fffffffeffffffffffffffffffffffff7203df6b21c6052b53bbf40939d54123,
// r and s are the result of mod n, so they should be less than n and have length<=32
byte[] rs = rOrS.toByteArray();
if (rs.length == RS_LEN) {
return rs;
} else if (rs.length == RS_LEN + 1 && rs[0] == 0) {
return Arrays.copyOfRange(rs, 1, RS_LEN + 1);
} else if (rs.length < RS_LEN) {
byte[] result = new byte[RS_LEN];
Arrays.fill(result, (byte) 0);
System.arraycopy(rs, 0, result, RS_LEN - rs.length, rs.length);
return result;
} else {
throw new CryptoException("Error rs: {}", Hex.toHexString(rs));
}
} | java | private static byte[] bigIntToFixexLengthBytes(BigInteger rOrS) {
// for sm2p256v1, n is 00fffffffeffffffffffffffffffffffff7203df6b21c6052b53bbf40939d54123,
// r and s are the result of mod n, so they should be less than n and have length<=32
byte[] rs = rOrS.toByteArray();
if (rs.length == RS_LEN) {
return rs;
} else if (rs.length == RS_LEN + 1 && rs[0] == 0) {
return Arrays.copyOfRange(rs, 1, RS_LEN + 1);
} else if (rs.length < RS_LEN) {
byte[] result = new byte[RS_LEN];
Arrays.fill(result, (byte) 0);
System.arraycopy(rs, 0, result, RS_LEN - rs.length, rs.length);
return result;
} else {
throw new CryptoException("Error rs: {}", Hex.toHexString(rs));
}
} | [
"private",
"static",
"byte",
"[",
"]",
"bigIntToFixexLengthBytes",
"(",
"BigInteger",
"rOrS",
")",
"{",
"// for sm2p256v1, n is 00fffffffeffffffffffffffffffffffff7203df6b21c6052b53bbf40939d54123,\r",
"// r and s are the result of mod n, so they should be less than n and have length<=32\r",
... | BigInteger转固定长度bytes
@param rOrS {@link BigInteger}
@return 固定长度bytes
@since 4.5.0 | [
"BigInteger转固定长度bytes"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SmUtil.java#L230-L246 | train | Returns a byte array containing the bytes of the given BigInteger. | [
30522,
2797,
10763,
24880,
1031,
1033,
2502,
18447,
3406,
8873,
2595,
10288,
7770,
13512,
2232,
3762,
4570,
1006,
2502,
18447,
26320,
20996,
2869,
1007,
1063,
1013,
1013,
2005,
15488,
2475,
2361,
17788,
2575,
2615,
2487,
1010,
1050,
2003,
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-poi/src/main/java/cn/hutool/poi/excel/RowUtil.java | RowUtil.readRow | public static List<Object> readRow(Row row, CellEditor cellEditor) {
if (null == row) {
return new ArrayList<>(0);
}
final short length = row.getLastCellNum();
if (length < 0) {
return new ArrayList<>(0);
}
final List<Object> cellValues = new ArrayList<>((int) length);
Object cellValue;
boolean isAllNull = true;
for (short i = 0; i < length; i++) {
cellValue = CellUtil.getCellValue(row.getCell(i), cellEditor);
isAllNull &= StrUtil.isEmptyIfStr(cellValue);
cellValues.add(cellValue);
}
if (isAllNull) {
// 如果每个元素都为空,则定义为空行
return new ArrayList<>(0);
}
return cellValues;
} | java | public static List<Object> readRow(Row row, CellEditor cellEditor) {
if (null == row) {
return new ArrayList<>(0);
}
final short length = row.getLastCellNum();
if (length < 0) {
return new ArrayList<>(0);
}
final List<Object> cellValues = new ArrayList<>((int) length);
Object cellValue;
boolean isAllNull = true;
for (short i = 0; i < length; i++) {
cellValue = CellUtil.getCellValue(row.getCell(i), cellEditor);
isAllNull &= StrUtil.isEmptyIfStr(cellValue);
cellValues.add(cellValue);
}
if (isAllNull) {
// 如果每个元素都为空,则定义为空行
return new ArrayList<>(0);
}
return cellValues;
} | [
"public",
"static",
"List",
"<",
"Object",
">",
"readRow",
"(",
"Row",
"row",
",",
"CellEditor",
"cellEditor",
")",
"{",
"if",
"(",
"null",
"==",
"row",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
"0",
")",
";",
"}",
"final",
"short",
"length"... | 读取一行
@param row 行
@param cellEditor 单元格编辑器
@return 单元格值列表 | [
"读取一行"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/RowUtil.java#L44-L66 | train | Reads the row from the file. | [
30522,
2270,
10763,
2862,
1026,
4874,
1028,
3191,
10524,
1006,
5216,
5216,
1010,
3526,
2098,
15660,
3526,
2098,
15660,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
5216,
1007,
1063,
2709,
2047,
9140,
9863,
1026,
1028,
1006,
1014,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/Session.java | Session.beginTransaction | public void beginTransaction() throws SQLException {
final Connection conn = getConnection();
checkTransactionSupported(conn);
conn.setAutoCommit(false);
} | java | public void beginTransaction() throws SQLException {
final Connection conn = getConnection();
checkTransactionSupported(conn);
conn.setAutoCommit(false);
} | [
"public",
"void",
"beginTransaction",
"(",
")",
"throws",
"SQLException",
"{",
"final",
"Connection",
"conn",
"=",
"getConnection",
"(",
")",
";",
"checkTransactionSupported",
"(",
"conn",
")",
";",
"conn",
".",
"setAutoCommit",
"(",
"false",
")",
";",
"}"
] | 开始事务
@throws SQLException SQL执行异常 | [
"开始事务"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Session.java#L111-L115 | train | Begin a transaction. | [
30522,
2270,
11675,
4088,
6494,
3619,
18908,
3258,
1006,
1007,
11618,
29296,
10288,
24422,
1063,
2345,
4434,
9530,
2078,
1027,
2131,
8663,
2638,
7542,
1006,
1007,
1025,
4638,
6494,
3619,
18908,
8496,
6279,
6442,
2098,
1006,
9530,
2078,
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-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONStringer.java | JSONStringer.peek | private Scope peek() throws JSONException {
if (this.stack.isEmpty()) {
throw new JSONException("Nesting problem");
}
return this.stack.get(this.stack.size() - 1);
} | java | private Scope peek() throws JSONException {
if (this.stack.isEmpty()) {
throw new JSONException("Nesting problem");
}
return this.stack.get(this.stack.size() - 1);
} | [
"private",
"Scope",
"peek",
"(",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"this",
".",
"stack",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"JSONException",
"(",
"\"Nesting problem\"",
")",
";",
"}",
"return",
"this",
".",
"stack",
".",
... | Returns the value on the top of the stack.
@return the scope
@throws JSONException if processing of json failed | [
"Returns",
"the",
"value",
"on",
"the",
"top",
"of",
"the",
"stack",
"."
] | 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/JSONStringer.java#L214-L219 | train | Peek the top of the stack. | [
30522,
2797,
9531,
19043,
1006,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
2065,
1006,
2023,
1012,
9991,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1007,
1063,
5466,
2047,
1046,
3385,
10288,
24422,
1006,
1000,
21016,
3291,
1000,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/MathUtils.java | MathUtils.murmurHash | public static int murmurHash(int code) {
code *= 0xcc9e2d51;
code = Integer.rotateLeft(code, 15);
code *= 0x1b873593;
code = Integer.rotateLeft(code, 13);
code = code * 5 + 0xe6546b64;
code ^= 4;
code = bitMix(code);
if (code >= 0) {
return code;
}
else if (code != Integer.MIN_VALUE) {
return -code;
}
else {
return 0;
}
} | java | public static int murmurHash(int code) {
code *= 0xcc9e2d51;
code = Integer.rotateLeft(code, 15);
code *= 0x1b873593;
code = Integer.rotateLeft(code, 13);
code = code * 5 + 0xe6546b64;
code ^= 4;
code = bitMix(code);
if (code >= 0) {
return code;
}
else if (code != Integer.MIN_VALUE) {
return -code;
}
else {
return 0;
}
} | [
"public",
"static",
"int",
"murmurHash",
"(",
"int",
"code",
")",
"{",
"code",
"*=",
"0xcc9e2d51",
";",
"code",
"=",
"Integer",
".",
"rotateLeft",
"(",
"code",
",",
"15",
")",
";",
"code",
"*=",
"0x1b873593",
";",
"code",
"=",
"Integer",
".",
"rotateLe... | This function hashes an integer value.
<p>It is crucial to use different hash functions to partition data across machines and the internal partitioning of
data structures. This hash function is intended for partitioning across machines.
@param code The integer to be hashed.
@return The non-negative hash code for the integer. | [
"This",
"function",
"hashes",
"an",
"integer",
"value",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/MathUtils.java#L134-L154 | train | Returns the MurmurHash code for a given code. | [
30522,
2270,
10763,
20014,
20227,
14949,
2232,
1006,
20014,
3642,
1007,
1063,
3642,
1008,
1027,
1014,
2595,
9468,
2683,
2063,
2475,
2094,
22203,
1025,
3642,
1027,
16109,
1012,
24357,
2571,
6199,
1006,
3642,
1010,
2321,
1007,
1025,
3642,
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... |
alibaba/canal | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/MysqlGTIDSet.java | MysqlGTIDSet.parse | public static MysqlGTIDSet parse(String gtidData) {
Map<String, UUIDSet> m;
if (gtidData == null || gtidData.length() < 1) {
m = new HashMap<String, UUIDSet>();
} else {
// 存在多个GTID时会有回车符
String[] uuidStrs = gtidData.replaceAll("\n", "").split(",");
m = new HashMap<String, UUIDSet>(uuidStrs.length);
for (int i = 0; i < uuidStrs.length; i++) {
UUIDSet uuidSet = UUIDSet.parse(uuidStrs[i]);
m.put(uuidSet.SID.toString(), uuidSet);
}
}
MysqlGTIDSet gs = new MysqlGTIDSet();
gs.sets = m;
return gs;
} | java | public static MysqlGTIDSet parse(String gtidData) {
Map<String, UUIDSet> m;
if (gtidData == null || gtidData.length() < 1) {
m = new HashMap<String, UUIDSet>();
} else {
// 存在多个GTID时会有回车符
String[] uuidStrs = gtidData.replaceAll("\n", "").split(",");
m = new HashMap<String, UUIDSet>(uuidStrs.length);
for (int i = 0; i < uuidStrs.length; i++) {
UUIDSet uuidSet = UUIDSet.parse(uuidStrs[i]);
m.put(uuidSet.SID.toString(), uuidSet);
}
}
MysqlGTIDSet gs = new MysqlGTIDSet();
gs.sets = m;
return gs;
} | [
"public",
"static",
"MysqlGTIDSet",
"parse",
"(",
"String",
"gtidData",
")",
"{",
"Map",
"<",
"String",
",",
"UUIDSet",
">",
"m",
";",
"if",
"(",
"gtidData",
"==",
"null",
"||",
"gtidData",
".",
"length",
"(",
")",
"<",
"1",
")",
"{",
"m",
"=",
"ne... | 解析如下格式的字符串为MysqlGTIDSet: 726757ad-4455-11e8-ae04-0242ac110002:1 =>
MysqlGTIDSet{ sets: { 726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:2}] } }
} 726757ad-4455-11e8-ae04-0242ac110002:1-3 => MysqlGTIDSet{ sets: {
726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4}] } }
} 726757ad-4455-11e8-ae04-0242ac110002:1-3:4 => MysqlGTIDSet{ sets: {
726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:5}] } }
} 726757ad-4455-11e8-ae04-0242ac110002:1-3:7-9 => MysqlGTIDSet{ sets: {
726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4},
{start:7, stop: 10}] } } }
726757ad-4455-11e8-ae04-0242ac110002:1-3,726757
ad-4455-11e8-ae04-0242ac110003:4 => MysqlGTIDSet{ sets: {
726757ad-4455-11e8-ae04-0242ac110002: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:1, stop:4}] },
726757ad-4455-11e8-ae04-0242ac110003: UUIDSet{ SID:
726757ad-4455-11e8-ae04-0242ac110002, intervals: [{start:4, stop:5}] } }
}
@param gtidData
@return | [
"解析如下格式的字符串为MysqlGTIDSet",
":",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
":",
"1",
"=",
">",
"MysqlGTIDSet",
"{",
"sets",
":",
"{",
"726757ad",
"-",
"4455",
"-",
"11e8",
"-",
"ae04",
"-",
"0242ac110002",
":",
"UUIDSet",
"{"... | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/MysqlGTIDSet.java#L83-L102 | train | Parse GTID data into a MysqlGTIDSet object | [
30522,
2270,
10763,
2026,
2015,
4160,
2140,
13512,
9821,
3388,
11968,
3366,
1006,
5164,
14181,
3593,
2850,
2696,
1007,
1063,
4949,
1026,
5164,
1010,
1057,
21272,
13462,
1028,
1049,
1025,
2065,
1006,
14181,
3593,
2850,
2696,
1027,
1027,
1970... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java | MDAG.calculateSoleTransitionPathLength | private int calculateSoleTransitionPathLength(String str)
{
Stack<MDAGNode> transitionPathNodeStack = sourceNode.getTransitionPathNodes(str);
transitionPathNodeStack.pop(); //The MDAGNode at the top of the stack is not needed
//(we are processing the outgoing transitions of nodes inside str's _transition path,
//the outgoing transitions of the MDAGNode at the top of the stack are outside this path)
transitionPathNodeStack.trimToSize();
//Process each node in transitionPathNodeStack, using each to determine whether the
//_transition path corresponding to str is only used by str. This is true if and only if
//each node in the _transition path has a single outgoing _transition and is not an accept state.
while (!transitionPathNodeStack.isEmpty())
{
MDAGNode currentNode = transitionPathNodeStack.peek();
if (currentNode.getOutgoingTransitions().size() <= 1 && !currentNode.isAcceptNode())
transitionPathNodeStack.pop();
else
break;
}
/////
return (transitionPathNodeStack.capacity() - transitionPathNodeStack.size());
} | java | private int calculateSoleTransitionPathLength(String str)
{
Stack<MDAGNode> transitionPathNodeStack = sourceNode.getTransitionPathNodes(str);
transitionPathNodeStack.pop(); //The MDAGNode at the top of the stack is not needed
//(we are processing the outgoing transitions of nodes inside str's _transition path,
//the outgoing transitions of the MDAGNode at the top of the stack are outside this path)
transitionPathNodeStack.trimToSize();
//Process each node in transitionPathNodeStack, using each to determine whether the
//_transition path corresponding to str is only used by str. This is true if and only if
//each node in the _transition path has a single outgoing _transition and is not an accept state.
while (!transitionPathNodeStack.isEmpty())
{
MDAGNode currentNode = transitionPathNodeStack.peek();
if (currentNode.getOutgoingTransitions().size() <= 1 && !currentNode.isAcceptNode())
transitionPathNodeStack.pop();
else
break;
}
/////
return (transitionPathNodeStack.capacity() - transitionPathNodeStack.size());
} | [
"private",
"int",
"calculateSoleTransitionPathLength",
"(",
"String",
"str",
")",
"{",
"Stack",
"<",
"MDAGNode",
">",
"transitionPathNodeStack",
"=",
"sourceNode",
".",
"getTransitionPathNodes",
"(",
"str",
")",
";",
"transitionPathNodeStack",
".",
"pop",
"(",
")",
... | Calculates the length of the the sub-path in a _transition path, that is used only by a given string.
@param str a String corresponding to a _transition path from sourceNode
@return an int denoting the size of the sub-path in the _transition path
corresponding to {@code str} that is only used by {@code str} | [
"Calculates",
"the",
"length",
"of",
"the",
"the",
"sub",
"-",
"path",
"in",
"a",
"_transition",
"path",
"that",
"is",
"used",
"only",
"by",
"a",
"given",
"string",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L333-L356 | train | Calculate the length of the Sole Transition Path | [
30522,
2797,
20014,
18422,
19454,
3388,
5521,
28032,
3258,
15069,
7770,
13512,
2232,
1006,
5164,
2358,
2099,
1007,
1063,
9991,
1026,
9108,
8490,
3630,
3207,
1028,
6653,
15069,
3630,
6155,
2696,
3600,
1027,
3120,
3630,
3207,
1012,
2131,
6494... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.unWrap | public static float[] unWrap(Float... values) {
if (null == values) {
return null;
}
final int length = values.length;
if (0 == length) {
return new float[0];
}
final float[] array = new float[length];
for (int i = 0; i < length; i++) {
array[i] = values[i].floatValue();
}
return array;
} | java | public static float[] unWrap(Float... values) {
if (null == values) {
return null;
}
final int length = values.length;
if (0 == length) {
return new float[0];
}
final float[] array = new float[length];
for (int i = 0; i < length; i++) {
array[i] = values[i].floatValue();
}
return array;
} | [
"public",
"static",
"float",
"[",
"]",
"unWrap",
"(",
"Float",
"...",
"values",
")",
"{",
"if",
"(",
"null",
"==",
"values",
")",
"{",
"return",
"null",
";",
"}",
"final",
"int",
"length",
"=",
"values",
".",
"length",
";",
"if",
"(",
"0",
"==",
... | 包装类数组转为原始类型数组
@param values 包装类型数组
@return 原始类型数组 | [
"包装类数组转为原始类型数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L1641-L1655 | train | Creates an array of float values from the given float array. | [
30522,
2270,
10763,
14257,
1031,
1033,
4895,
13088,
9331,
1006,
14257,
1012,
1012,
1012,
5300,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
5300,
1007,
1063,
2709,
19701,
1025,
1065,
2345,
20014,
3091,
1027,
5300,
1012,
3091,
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... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/ds/pooled/PooledDataSource.java | PooledDataSource.getConnection | public PooledConnection getConnection(long wait) throws SQLException {
try {
return getConnectionDirect();
} catch (Exception e) {
ThreadUtil.sleep(wait);
}
return getConnectionDirect();
} | java | public PooledConnection getConnection(long wait) throws SQLException {
try {
return getConnectionDirect();
} catch (Exception e) {
ThreadUtil.sleep(wait);
}
return getConnectionDirect();
} | [
"public",
"PooledConnection",
"getConnection",
"(",
"long",
"wait",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"return",
"getConnectionDirect",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"ThreadUtil",
".",
"sleep",
"(",
"wait",
")",
... | 获取连接对象
@param wait 当池中无连接等待的毫秒数
@return 连接对象
@throws SQLException SQL异常 | [
"获取连接对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/ds/pooled/PooledDataSource.java#L139-L146 | train | Gets a connection from the database. | [
30522,
2270,
19107,
16409,
18256,
7542,
2131,
8663,
2638,
7542,
1006,
2146,
3524,
1007,
11618,
29296,
10288,
24422,
1063,
3046,
1063,
2709,
2131,
8663,
2638,
7542,
4305,
2890,
6593,
1006,
1007,
1025,
1065,
4608,
1006,
6453,
1041,
1007,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java | OpenSslSessionStats.number | public long number() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionNumber(context.ctx);
} finally {
readerLock.unlock();
}
} | java | public long number() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionNumber(context.ctx);
} finally {
readerLock.unlock();
}
} | [
"public",
"long",
"number",
"(",
")",
"{",
"Lock",
"readerLock",
"=",
"context",
".",
"ctxLock",
".",
"readLock",
"(",
")",
";",
"readerLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"SSLContext",
".",
"sessionNumber",
"(",
"context",
".",
"c... | Returns the current number of sessions in the internal session cache. | [
"Returns",
"the",
"current",
"number",
"of",
"sessions",
"in",
"the",
"internal",
"session",
"cache",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java#L43-L51 | train | Gets the number of the session. | [
30522,
2270,
2146,
2193,
1006,
1007,
1063,
5843,
8068,
7878,
1027,
6123,
1012,
14931,
2595,
7878,
1012,
3191,
7878,
1006,
1007,
1025,
8068,
7878,
1012,
5843,
1006,
1007,
1025,
3046,
1063,
2709,
7020,
22499,
10111,
18413,
1012,
5219,
19172,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpRequest.java | HttpRequest.form | public HttpRequest form(String name, Object value, Object... parameters) {
form(name, value);
for (int i = 0; i < parameters.length; i += 2) {
name = parameters[i].toString();
form(name, parameters[i + 1]);
}
return this;
} | java | public HttpRequest form(String name, Object value, Object... parameters) {
form(name, value);
for (int i = 0; i < parameters.length; i += 2) {
name = parameters[i].toString();
form(name, parameters[i + 1]);
}
return this;
} | [
"public",
"HttpRequest",
"form",
"(",
"String",
"name",
",",
"Object",
"value",
",",
"Object",
"...",
"parameters",
")",
"{",
"form",
"(",
"name",
",",
"value",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parameters",
".",
"length",
... | 设置表单数据
@param name 名
@param value 值
@param parameters 参数对,奇数为名,偶数为值
@return this | [
"设置表单数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpRequest.java#L465-L473 | train | Adds a form parameter to the request. | [
30522,
2270,
8299,
2890,
15500,
2433,
1006,
5164,
2171,
1010,
4874,
3643,
1010,
4874,
1012,
1012,
1012,
11709,
1007,
1063,
2433,
1006,
2171,
1010,
3643,
1007,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
11709,
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... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/digest/DigestUtil.java | DigestUtil.sha256Hex | public static String sha256Hex(String data, String charset) {
return new Digester(DigestAlgorithm.SHA256).digestHex(data, charset);
} | java | public static String sha256Hex(String data, String charset) {
return new Digester(DigestAlgorithm.SHA256).digestHex(data, charset);
} | [
"public",
"static",
"String",
"sha256Hex",
"(",
"String",
"data",
",",
"String",
"charset",
")",
"{",
"return",
"new",
"Digester",
"(",
"DigestAlgorithm",
".",
"SHA256",
")",
".",
"digestHex",
"(",
"data",
",",
"charset",
")",
";",
"}"
] | 计算SHA-256摘要值,并转为16进制字符串
@param data 被摘要数据
@param charset 编码
@return SHA-256摘要的16进制表示
@since 3.0.8 | [
"计算SHA",
"-",
"256摘要值,并转为16进制字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/digest/DigestUtil.java#L311-L313 | train | Returns the SHA256 hex string of the given data. | [
30522,
2270,
10763,
5164,
21146,
17788,
2575,
5369,
2595,
1006,
5164,
2951,
1010,
5164,
25869,
13462,
1007,
1063,
2709,
2047,
17886,
2121,
1006,
17886,
2389,
20255,
8939,
2213,
1012,
21146,
17788,
2575,
1007,
1012,
17886,
5369,
2595,
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 | common/src/main/java/io/netty/util/concurrent/FastThreadLocal.java | FastThreadLocal.get | @SuppressWarnings("unchecked")
public final V get() {
InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap.get();
Object v = threadLocalMap.indexedVariable(index);
if (v != InternalThreadLocalMap.UNSET) {
return (V) v;
}
return initialize(threadLocalMap);
} | java | @SuppressWarnings("unchecked")
public final V get() {
InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap.get();
Object v = threadLocalMap.indexedVariable(index);
if (v != InternalThreadLocalMap.UNSET) {
return (V) v;
}
return initialize(threadLocalMap);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"V",
"get",
"(",
")",
"{",
"InternalThreadLocalMap",
"threadLocalMap",
"=",
"InternalThreadLocalMap",
".",
"get",
"(",
")",
";",
"Object",
"v",
"=",
"threadLocalMap",
".",
"indexedVariable",
... | Returns the current value for the current thread | [
"Returns",
"the",
"current",
"value",
"for",
"the",
"current",
"thread"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/FastThreadLocal.java#L134-L143 | train | Get the value of the CRA - SECTYPE. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
2345,
1058,
2131,
1006,
1007,
1063,
4722,
2705,
16416,
19422,
24755,
19145,
2361,
11689,
4135,
9289,
2863,
2361,
1027,
4722,
2705,
16416,
19422,
24755,
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/lang/Console.java | Console.error | public static void error(Object obj) {
if (obj instanceof Throwable) {
Throwable e = (Throwable) obj;
error(e, e.getMessage());
} else {
error("{}", obj);
}
} | java | public static void error(Object obj) {
if (obj instanceof Throwable) {
Throwable e = (Throwable) obj;
error(e, e.getMessage());
} else {
error("{}", obj);
}
} | [
"public",
"static",
"void",
"error",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"Throwable",
")",
"{",
"Throwable",
"e",
"=",
"(",
"Throwable",
")",
"obj",
";",
"error",
"(",
"e",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";"... | 同 System.err.println()方法,打印控制台日志
@param obj 要打印的对象 | [
"同",
"System",
".",
"err",
".",
"println",
"()",
"方法,打印控制台日志"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Console.java#L128-L135 | train | Logs an error with a Throwable. | [
30522,
2270,
10763,
11675,
7561,
1006,
4874,
27885,
3501,
1007,
1063,
2065,
1006,
27885,
3501,
6013,
11253,
5466,
3085,
1007,
1063,
5466,
3085,
1041,
1027,
1006,
5466,
3085,
1007,
27885,
3501,
1025,
7561,
1006,
1041,
1010,
1041,
1012,
2131,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/PageUtil.java | PageUtil.rainbow | public static int[] rainbow(int currentPage, int pageCount, int displayCount) {
boolean isEven = true;
isEven = displayCount % 2 == 0;
int left = displayCount / 2;
int right = displayCount / 2;
int length = displayCount;
if (isEven) {
right++;
}
if (pageCount < displayCount) {
length = pageCount;
}
int[] result = new int[length];
if (pageCount >= displayCount) {
if (currentPage <= left) {
for (int i = 0; i < result.length; i++) {
result[i] = i + 1;
}
} else if (currentPage > pageCount - right) {
for (int i = 0; i < result.length; i++) {
result[i] = i + pageCount - displayCount + 1;
}
} else {
for (int i = 0; i < result.length; i++) {
result[i] = i + currentPage - left + (isEven ? 1 : 0);
}
}
} else {
for (int i = 0; i < result.length; i++) {
result[i] = i + 1;
}
}
return result;
} | java | public static int[] rainbow(int currentPage, int pageCount, int displayCount) {
boolean isEven = true;
isEven = displayCount % 2 == 0;
int left = displayCount / 2;
int right = displayCount / 2;
int length = displayCount;
if (isEven) {
right++;
}
if (pageCount < displayCount) {
length = pageCount;
}
int[] result = new int[length];
if (pageCount >= displayCount) {
if (currentPage <= left) {
for (int i = 0; i < result.length; i++) {
result[i] = i + 1;
}
} else if (currentPage > pageCount - right) {
for (int i = 0; i < result.length; i++) {
result[i] = i + pageCount - displayCount + 1;
}
} else {
for (int i = 0; i < result.length; i++) {
result[i] = i + currentPage - left + (isEven ? 1 : 0);
}
}
} else {
for (int i = 0; i < result.length; i++) {
result[i] = i + 1;
}
}
return result;
} | [
"public",
"static",
"int",
"[",
"]",
"rainbow",
"(",
"int",
"currentPage",
",",
"int",
"pageCount",
",",
"int",
"displayCount",
")",
"{",
"boolean",
"isEven",
"=",
"true",
";",
"isEven",
"=",
"displayCount",
"%",
"2",
"==",
"0",
";",
"int",
"left",
"="... | 分页彩虹算法<br>
来自:https://github.com/iceroot/iceroot/blob/master/src/main/java/com/icexxx/util/IceUtil.java<br>
通过传入的信息,生成一个分页列表显示
@param currentPage 当前页
@param pageCount 总页数
@param displayCount 每屏展示的页数
@return 分页条 | [
"分页彩虹算法<br",
">",
"来自:https",
":",
"//",
"github",
".",
"com",
"/",
"iceroot",
"/",
"iceroot",
"/",
"blob",
"/",
"master",
"/",
"src",
"/",
"main",
"/",
"java",
"/",
"com",
"/",
"icexxx",
"/",
"util",
"/",
"IceUtil",
".",
"java<br",
">",
"通过传入的信息,生成一... | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/PageUtil.java#L87-L122 | train | Creates a list of integers that are contiguously contiguous between the specified page and display count. | [
30522,
2270,
10763,
20014,
1031,
1033,
10098,
1006,
20014,
2783,
13704,
1010,
20014,
3931,
3597,
16671,
1010,
20014,
4653,
3597,
16671,
1007,
1063,
22017,
20898,
2003,
18697,
2078,
1027,
2995,
1025,
2003,
18697,
2078,
1027,
4653,
3597,
16671,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | client/src/main/java/org/apache/hc/core5/http/message/copied/TokenParser.java | TokenParser.copyQuotedContent | public void copyQuotedContent(final CharSequence buf, final ParserCursor cursor,
final StringBuilder dst) {
Args.notNull(buf, "Char sequence");
Args.notNull(cursor, "Parser cursor");
Args.notNull(dst, "String builder");
if (cursor.atEnd()) {
return;
}
int pos = cursor.getPos();
int indexFrom = cursor.getPos();
final int indexTo = cursor.getUpperBound();
char current = buf.charAt(pos);
if (current != DQUOTE) {
return;
}
pos++;
indexFrom++;
boolean escaped = false;
for (int i = indexFrom; i < indexTo; i++, pos++) {
current = buf.charAt(i);
if (escaped) {
if (current != DQUOTE && current != ESCAPE) {
dst.append(ESCAPE);
}
dst.append(current);
escaped = false;
} else {
if (current == DQUOTE) {
pos++;
break;
}
if (current == ESCAPE) {
escaped = true;
} else if (current != CR && current != LF) {
dst.append(current);
}
}
}
cursor.updatePos(pos);
} | java | public void copyQuotedContent(final CharSequence buf, final ParserCursor cursor,
final StringBuilder dst) {
Args.notNull(buf, "Char sequence");
Args.notNull(cursor, "Parser cursor");
Args.notNull(dst, "String builder");
if (cursor.atEnd()) {
return;
}
int pos = cursor.getPos();
int indexFrom = cursor.getPos();
final int indexTo = cursor.getUpperBound();
char current = buf.charAt(pos);
if (current != DQUOTE) {
return;
}
pos++;
indexFrom++;
boolean escaped = false;
for (int i = indexFrom; i < indexTo; i++, pos++) {
current = buf.charAt(i);
if (escaped) {
if (current != DQUOTE && current != ESCAPE) {
dst.append(ESCAPE);
}
dst.append(current);
escaped = false;
} else {
if (current == DQUOTE) {
pos++;
break;
}
if (current == ESCAPE) {
escaped = true;
} else if (current != CR && current != LF) {
dst.append(current);
}
}
}
cursor.updatePos(pos);
} | [
"public",
"void",
"copyQuotedContent",
"(",
"final",
"CharSequence",
"buf",
",",
"final",
"ParserCursor",
"cursor",
",",
"final",
"StringBuilder",
"dst",
")",
"{",
"Args",
".",
"notNull",
"(",
"buf",
",",
"\"Char sequence\"",
")",
";",
"Args",
".",
"notNull",
... | Transfers content enclosed with quote marks into the destination buffer.
@param buf buffer with the sequence of chars to be parsed
@param cursor defines the bounds and current position of the buffer
@param dst destination buffer | [
"Transfers",
"content",
"enclosed",
"with",
"quote",
"marks",
"into",
"the",
"destination",
"buffer",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/http/message/copied/TokenParser.java#L220-L259 | train | Copy quoted content. | [
30522,
2270,
11675,
6100,
28940,
27428,
8663,
6528,
2102,
1006,
2345,
25869,
3366,
4226,
5897,
20934,
2546,
1010,
2345,
11968,
8043,
10841,
25301,
2099,
12731,
25301,
2099,
1010,
2345,
5164,
8569,
23891,
2099,
16233,
2102,
1007,
1063,
12098,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.readXML | public static Document readXML(File file) {
Assert.notNull(file, "Xml file is null !");
if (false == file.exists()) {
throw new UtilException("File [{}] not a exist!", file.getAbsolutePath());
}
if (false == file.isFile()) {
throw new UtilException("[{}] not a file!", file.getAbsolutePath());
}
try {
file = file.getCanonicalFile();
} catch (IOException e) {
// ignore
}
BufferedInputStream in = null;
try {
in = FileUtil.getInputStream(file);
return readXML(in);
} finally {
IoUtil.close(in);
}
} | java | public static Document readXML(File file) {
Assert.notNull(file, "Xml file is null !");
if (false == file.exists()) {
throw new UtilException("File [{}] not a exist!", file.getAbsolutePath());
}
if (false == file.isFile()) {
throw new UtilException("[{}] not a file!", file.getAbsolutePath());
}
try {
file = file.getCanonicalFile();
} catch (IOException e) {
// ignore
}
BufferedInputStream in = null;
try {
in = FileUtil.getInputStream(file);
return readXML(in);
} finally {
IoUtil.close(in);
}
} | [
"public",
"static",
"Document",
"readXML",
"(",
"File",
"file",
")",
"{",
"Assert",
".",
"notNull",
"(",
"file",
",",
"\"Xml file is null !\"",
")",
";",
"if",
"(",
"false",
"==",
"file",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"UtilException"... | 读取解析XML文件
@param file XML文件
@return XML文档对象 | [
"读取解析XML文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L69-L91 | train | Reads an XML document from the specified file. | [
30522,
2270,
10763,
6254,
3191,
2595,
19968,
1006,
5371,
5371,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
5371,
1010,
1000,
20950,
5371,
2003,
19701,
999,
1000,
1007,
1025,
2065,
1006,
6270,
1027,
1027,
5371,
1012,
6526,
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... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java | CipherSuiteConverter.convertToCipherStrings | static void convertToCipherStrings(Iterable<String> cipherSuites, StringBuilder cipherBuilder,
StringBuilder cipherTLSv13Builder, boolean boringSSL) {
for (String c: cipherSuites) {
if (c == null) {
break;
}
String converted = toOpenSsl(c, boringSSL);
if (converted == null) {
converted = c;
}
if (!OpenSsl.isCipherSuiteAvailable(converted)) {
throw new IllegalArgumentException("unsupported cipher suite: " + c + '(' + converted + ')');
}
if (SslUtils.isTLSv13Cipher(converted) || SslUtils.isTLSv13Cipher(c)) {
cipherTLSv13Builder.append(converted);
cipherTLSv13Builder.append(':');
} else {
cipherBuilder.append(converted);
cipherBuilder.append(':');
}
}
if (cipherBuilder.length() == 0 && cipherTLSv13Builder.length() == 0) {
throw new IllegalArgumentException("empty cipher suites");
}
if (cipherBuilder.length() > 0) {
cipherBuilder.setLength(cipherBuilder.length() - 1);
}
if (cipherTLSv13Builder.length() > 0) {
cipherTLSv13Builder.setLength(cipherTLSv13Builder.length() - 1);
}
} | java | static void convertToCipherStrings(Iterable<String> cipherSuites, StringBuilder cipherBuilder,
StringBuilder cipherTLSv13Builder, boolean boringSSL) {
for (String c: cipherSuites) {
if (c == null) {
break;
}
String converted = toOpenSsl(c, boringSSL);
if (converted == null) {
converted = c;
}
if (!OpenSsl.isCipherSuiteAvailable(converted)) {
throw new IllegalArgumentException("unsupported cipher suite: " + c + '(' + converted + ')');
}
if (SslUtils.isTLSv13Cipher(converted) || SslUtils.isTLSv13Cipher(c)) {
cipherTLSv13Builder.append(converted);
cipherTLSv13Builder.append(':');
} else {
cipherBuilder.append(converted);
cipherBuilder.append(':');
}
}
if (cipherBuilder.length() == 0 && cipherTLSv13Builder.length() == 0) {
throw new IllegalArgumentException("empty cipher suites");
}
if (cipherBuilder.length() > 0) {
cipherBuilder.setLength(cipherBuilder.length() - 1);
}
if (cipherTLSv13Builder.length() > 0) {
cipherTLSv13Builder.setLength(cipherTLSv13Builder.length() - 1);
}
} | [
"static",
"void",
"convertToCipherStrings",
"(",
"Iterable",
"<",
"String",
">",
"cipherSuites",
",",
"StringBuilder",
"cipherBuilder",
",",
"StringBuilder",
"cipherTLSv13Builder",
",",
"boolean",
"boringSSL",
")",
"{",
"for",
"(",
"String",
"c",
":",
"cipherSuites"... | Convert the given ciphers if needed to OpenSSL format and append them to the correct {@link StringBuilder}
depending on if its a TLSv1.3 cipher or not. If this methods returns without throwing an exception its
guaranteed that at least one of the {@link StringBuilder}s contain some ciphers that can be used to configure
OpenSSL. | [
"Convert",
"the",
"given",
"ciphers",
"if",
"needed",
"to",
"OpenSSL",
"format",
"and",
"append",
"them",
"to",
"the",
"correct",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java#L457-L491 | train | Convert to cipher strings. | [
30522,
10763,
11675,
10463,
3406,
6895,
27921,
3367,
4892,
2015,
1006,
2009,
6906,
3468,
1026,
5164,
1028,
27715,
28880,
2229,
1010,
5164,
8569,
23891,
2099,
27715,
8569,
23891,
2099,
1010,
5164,
8569,
23891,
2099,
27715,
19646,
2015,
2615,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/Convert.java | Convert.toShort | public static Short toShort(Object value, Short defaultValue) {
return convert(Short.class, value, defaultValue);
} | java | public static Short toShort(Object value, Short defaultValue) {
return convert(Short.class, value, defaultValue);
} | [
"public",
"static",
"Short",
"toShort",
"(",
"Object",
"value",
",",
"Short",
"defaultValue",
")",
"{",
"return",
"convert",
"(",
"Short",
".",
"class",
",",
"value",
",",
"defaultValue",
")",
";",
"}"
] | 转换为Short<br>
如果给定的值为<code>null</code>,或者转换失败,返回默认值<br>
转换失败不会报错
@param value 被转换的值
@param defaultValue 转换错误时的默认值
@return 结果 | [
"转换为Short<br",
">",
"如果给定的值为<code",
">",
"null<",
"/",
"code",
">",
",或者转换失败,返回默认值<br",
">",
"转换失败不会报错"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L149-L151 | train | Converts value of type Short to Short. | [
30522,
2270,
10763,
2460,
2000,
22231,
5339,
1006,
4874,
3643,
1010,
2460,
12398,
10175,
5657,
1007,
1063,
2709,
10463,
1006,
2460,
1012,
2465,
1010,
3643,
1010,
12398,
10175,
5657,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CalendarInterval.java | CalendarInterval.fromDayTimeString | public static CalendarInterval fromDayTimeString(String s) throws IllegalArgumentException {
CalendarInterval result = null;
if (s == null) {
throw new IllegalArgumentException("Interval day-time string was null");
}
s = s.trim();
Matcher m = dayTimePattern.matcher(s);
if (!m.matches()) {
throw new IllegalArgumentException(
"Interval string does not match day-time format of 'd h:m:s.n': " + s);
} else {
try {
int sign = m.group(1) != null && m.group(1).equals("-") ? -1 : 1;
long days = toLongWithRange("day", m.group(2), 0, Integer.MAX_VALUE);
long hours = toLongWithRange("hour", m.group(3), 0, 23);
long minutes = toLongWithRange("minute", m.group(4), 0, 59);
long seconds = toLongWithRange("second", m.group(5), 0, 59);
// Hive allow nanosecond precision interval
long nanos = toLongWithRange("nanosecond", m.group(7), 0L, 999999999L);
result = new CalendarInterval(0, sign * (
days * MICROS_PER_DAY + hours * MICROS_PER_HOUR + minutes * MICROS_PER_MINUTE +
seconds * MICROS_PER_SECOND + nanos / 1000L));
} catch (Exception e) {
throw new IllegalArgumentException(
"Error parsing interval day-time string: " + e.getMessage(), e);
}
}
return result;
} | java | public static CalendarInterval fromDayTimeString(String s) throws IllegalArgumentException {
CalendarInterval result = null;
if (s == null) {
throw new IllegalArgumentException("Interval day-time string was null");
}
s = s.trim();
Matcher m = dayTimePattern.matcher(s);
if (!m.matches()) {
throw new IllegalArgumentException(
"Interval string does not match day-time format of 'd h:m:s.n': " + s);
} else {
try {
int sign = m.group(1) != null && m.group(1).equals("-") ? -1 : 1;
long days = toLongWithRange("day", m.group(2), 0, Integer.MAX_VALUE);
long hours = toLongWithRange("hour", m.group(3), 0, 23);
long minutes = toLongWithRange("minute", m.group(4), 0, 59);
long seconds = toLongWithRange("second", m.group(5), 0, 59);
// Hive allow nanosecond precision interval
long nanos = toLongWithRange("nanosecond", m.group(7), 0L, 999999999L);
result = new CalendarInterval(0, sign * (
days * MICROS_PER_DAY + hours * MICROS_PER_HOUR + minutes * MICROS_PER_MINUTE +
seconds * MICROS_PER_SECOND + nanos / 1000L));
} catch (Exception e) {
throw new IllegalArgumentException(
"Error parsing interval day-time string: " + e.getMessage(), e);
}
}
return result;
} | [
"public",
"static",
"CalendarInterval",
"fromDayTimeString",
"(",
"String",
"s",
")",
"throws",
"IllegalArgumentException",
"{",
"CalendarInterval",
"result",
"=",
"null",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"("... | Parse dayTime string in form: [-]d HH:mm:ss.nnnnnnnnn
adapted from HiveIntervalDayTime.valueOf | [
"Parse",
"dayTime",
"string",
"in",
"form",
":",
"[",
"-",
"]",
"d",
"HH",
":",
"mm",
":",
"ss",
".",
"nnnnnnnnn"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/CalendarInterval.java#L137-L165 | train | Create an interval from a day - time string. | [
30522,
2270,
10763,
8094,
18447,
2121,
10175,
2013,
10259,
7292,
3367,
4892,
1006,
5164,
1055,
1007,
11618,
6206,
2906,
22850,
15781,
2595,
24422,
1063,
8094,
18447,
2121,
10175,
2765,
1027,
19701,
1025,
2065,
1006,
1055,
1027,
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... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java | OpenSslSessionStats.hits | public long hits() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionHits(context.ctx);
} finally {
readerLock.unlock();
}
} | java | public long hits() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionHits(context.ctx);
} finally {
readerLock.unlock();
}
} | [
"public",
"long",
"hits",
"(",
")",
"{",
"Lock",
"readerLock",
"=",
"context",
".",
"ctxLock",
".",
"readLock",
"(",
")",
";",
"readerLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"SSLContext",
".",
"sessionHits",
"(",
"context",
".",
"ctx",... | Returns the number of successfully reused sessions. In client mode, a session set with {@code SSL_set_session}
successfully reused is counted as a hit. In server mode, a session successfully retrieved from internal or
external cache is counted as a hit. | [
"Returns",
"the",
"number",
"of",
"successfully",
"reused",
"sessions",
".",
"In",
"client",
"mode",
"a",
"session",
"set",
"with",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java#L136-L144 | train | Gets the number of hits in the session. | [
30522,
2270,
2146,
4978,
1006,
1007,
1063,
5843,
8068,
7878,
1027,
6123,
1012,
14931,
2595,
7878,
1012,
3191,
7878,
1006,
1007,
1025,
8068,
7878,
1012,
5843,
1006,
1007,
1025,
3046,
1063,
2709,
7020,
22499,
10111,
18413,
1012,
5219,
16584,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/memory/MemoryManager.java | MemoryManager.allocatePages | public List<MemorySegment> allocatePages(Object owner, int numPages) throws MemoryAllocationException {
final ArrayList<MemorySegment> segs = new ArrayList<MemorySegment>(numPages);
allocatePages(owner, segs, numPages);
return segs;
} | java | public List<MemorySegment> allocatePages(Object owner, int numPages) throws MemoryAllocationException {
final ArrayList<MemorySegment> segs = new ArrayList<MemorySegment>(numPages);
allocatePages(owner, segs, numPages);
return segs;
} | [
"public",
"List",
"<",
"MemorySegment",
">",
"allocatePages",
"(",
"Object",
"owner",
",",
"int",
"numPages",
")",
"throws",
"MemoryAllocationException",
"{",
"final",
"ArrayList",
"<",
"MemorySegment",
">",
"segs",
"=",
"new",
"ArrayList",
"<",
"MemorySegment",
... | Allocates a set of memory segments from this memory manager. If the memory manager pre-allocated the
segments, they will be taken from the pool of memory segments. Otherwise, they will be allocated
as part of this call.
@param owner The owner to associate with the memory segment, for the fallback release.
@param numPages The number of pages to allocate.
@return A list with the memory segments.
@throws MemoryAllocationException Thrown, if this memory manager does not have the requested amount
of memory pages any more. | [
"Allocates",
"a",
"set",
"of",
"memory",
"segments",
"from",
"this",
"memory",
"manager",
".",
"If",
"the",
"memory",
"manager",
"pre",
"-",
"allocated",
"the",
"segments",
"they",
"will",
"be",
"taken",
"from",
"the",
"pool",
"of",
"memory",
"segments",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/memory/MemoryManager.java#L259-L263 | train | Allocate pages. | [
30522,
2270,
2862,
1026,
3638,
3366,
21693,
4765,
1028,
2035,
24755,
2618,
13704,
2015,
1006,
4874,
3954,
1010,
20014,
16371,
8737,
13923,
1007,
11618,
3638,
8095,
23909,
10288,
24422,
1063,
2345,
9140,
9863,
1026,
3638,
3366,
21693,
4765,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/context/limit/Limit.java | Limit.processParameters | public void processParameters(final List<Object> parameters, final boolean isFetchAll, final DatabaseType databaseType) {
fill(parameters);
rewrite(parameters, isFetchAll, databaseType);
} | java | public void processParameters(final List<Object> parameters, final boolean isFetchAll, final DatabaseType databaseType) {
fill(parameters);
rewrite(parameters, isFetchAll, databaseType);
} | [
"public",
"void",
"processParameters",
"(",
"final",
"List",
"<",
"Object",
">",
"parameters",
",",
"final",
"boolean",
"isFetchAll",
",",
"final",
"DatabaseType",
"databaseType",
")",
"{",
"fill",
"(",
"parameters",
")",
";",
"rewrite",
"(",
"parameters",
","... | Fill parameters for rewrite limit.
@param parameters parameters
@param isFetchAll is fetch all data or not
@param databaseType database type | [
"Fill",
"parameters",
"for",
"rewrite",
"limit",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/context/limit/Limit.java#L70-L73 | train | Process parameters. | [
30522,
2270,
11675,
2832,
28689,
22828,
2015,
1006,
2345,
2862,
1026,
4874,
1028,
11709,
1010,
2345,
22017,
20898,
2003,
7959,
10649,
8095,
1010,
2345,
7809,
13874,
7809,
13874,
1007,
1063,
6039,
1006,
11709,
1007,
1025,
2128,
26373,
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/utility/TextUtility.java | TextUtility.getCharCount | public static int getCharCount(String charSet, String word)
{
int nCount = 0;
if (word != null)
{
String temp = word + " ";
for (int i = 0; i < word.length(); i++)
{
String s = temp.substring(i, i + 1);
if (charSet.indexOf(s) != -1)
nCount++;
}
}
return nCount;
} | java | public static int getCharCount(String charSet, String word)
{
int nCount = 0;
if (word != null)
{
String temp = word + " ";
for (int i = 0; i < word.length(); i++)
{
String s = temp.substring(i, i + 1);
if (charSet.indexOf(s) != -1)
nCount++;
}
}
return nCount;
} | [
"public",
"static",
"int",
"getCharCount",
"(",
"String",
"charSet",
",",
"String",
"word",
")",
"{",
"int",
"nCount",
"=",
"0",
";",
"if",
"(",
"word",
"!=",
"null",
")",
"{",
"String",
"temp",
"=",
"word",
"+",
"\" \"",
";",
"for",
"(",
"int",
"i... | 得到字符集的字符在字符串中出现的次数
@param charSet
@param word
@return | [
"得到字符集的字符在字符串中出现的次数"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/TextUtility.java#L342-L358 | train | getCharCount Method. | [
30522,
2270,
10763,
20014,
2131,
7507,
29566,
16671,
1006,
5164,
25869,
13462,
1010,
5164,
2773,
1007,
1063,
20014,
13316,
21723,
1027,
1014,
1025,
2065,
1006,
2773,
999,
1027,
19701,
1007,
1063,
5164,
8915,
8737,
1027,
2773,
1009,
1000,
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/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/internal/util/DataSourceConverter.java | DataSourceConverter.getDataSourceMap | public static Map<String, DataSource> getDataSourceMap(final Map<String, DataSourceConfiguration> dataSourceConfigurationMap) {
Map<String, DataSource> result = new LinkedHashMap<>(dataSourceConfigurationMap.size(), 1);
for (Entry<String, DataSourceConfiguration> entry : dataSourceConfigurationMap.entrySet()) {
result.put(entry.getKey(), entry.getValue().createDataSource());
}
return result;
} | java | public static Map<String, DataSource> getDataSourceMap(final Map<String, DataSourceConfiguration> dataSourceConfigurationMap) {
Map<String, DataSource> result = new LinkedHashMap<>(dataSourceConfigurationMap.size(), 1);
for (Entry<String, DataSourceConfiguration> entry : dataSourceConfigurationMap.entrySet()) {
result.put(entry.getKey(), entry.getValue().createDataSource());
}
return result;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"DataSource",
">",
"getDataSourceMap",
"(",
"final",
"Map",
"<",
"String",
",",
"DataSourceConfiguration",
">",
"dataSourceConfigurationMap",
")",
"{",
"Map",
"<",
"String",
",",
"DataSource",
">",
"result",
"=",
... | Get data source map.
@param dataSourceConfigurationMap data source configuration map
@return data source map | [
"Get",
"data",
"source",
"map",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/internal/util/DataSourceConverter.java#L43-L49 | train | Get DataSource Map. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
2951,
6499,
3126,
3401,
1028,
2131,
2850,
10230,
8162,
3401,
2863,
2361,
1006,
2345,
4949,
1026,
5164,
1010,
2951,
6499,
3126,
3401,
8663,
8873,
27390,
3370,
1028,
2951,
6499,
3126,
3401,
8663,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.slice | public static void slice(Image srcImage, File descDir, int destWidth, int destHeight) {
if (destWidth <= 0) {
destWidth = 200; // 切片宽度
}
if (destHeight <= 0) {
destHeight = 150; // 切片高度
}
int srcWidth = srcImage.getHeight(null); // 源图宽度
int srcHeight = srcImage.getWidth(null); // 源图高度
try {
if (srcWidth > destWidth && srcHeight > destHeight) {
int cols = 0; // 切片横向数量
int rows = 0; // 切片纵向数量
// 计算切片的横向和纵向数量
if (srcWidth % destWidth == 0) {
cols = srcWidth / destWidth;
} else {
cols = (int) Math.floor(srcWidth / destWidth) + 1;
}
if (srcHeight % destHeight == 0) {
rows = srcHeight / destHeight;
} else {
rows = (int) Math.floor(srcHeight / destHeight) + 1;
}
// 循环建立切片
BufferedImage tag;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
// 四个参数分别为图像起点坐标和宽高
// 即: CropImageFilter(int x,int y,int width,int height)
tag = cut(srcImage, new Rectangle(j * destWidth, i * destHeight, destWidth, destHeight));
// 输出为文件
ImageIO.write(tag, IMAGE_TYPE_JPEG, new File(descDir, "_r" + i + "_c" + j + ".jpg"));
}
}
}
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static void slice(Image srcImage, File descDir, int destWidth, int destHeight) {
if (destWidth <= 0) {
destWidth = 200; // 切片宽度
}
if (destHeight <= 0) {
destHeight = 150; // 切片高度
}
int srcWidth = srcImage.getHeight(null); // 源图宽度
int srcHeight = srcImage.getWidth(null); // 源图高度
try {
if (srcWidth > destWidth && srcHeight > destHeight) {
int cols = 0; // 切片横向数量
int rows = 0; // 切片纵向数量
// 计算切片的横向和纵向数量
if (srcWidth % destWidth == 0) {
cols = srcWidth / destWidth;
} else {
cols = (int) Math.floor(srcWidth / destWidth) + 1;
}
if (srcHeight % destHeight == 0) {
rows = srcHeight / destHeight;
} else {
rows = (int) Math.floor(srcHeight / destHeight) + 1;
}
// 循环建立切片
BufferedImage tag;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
// 四个参数分别为图像起点坐标和宽高
// 即: CropImageFilter(int x,int y,int width,int height)
tag = cut(srcImage, new Rectangle(j * destWidth, i * destHeight, destWidth, destHeight));
// 输出为文件
ImageIO.write(tag, IMAGE_TYPE_JPEG, new File(descDir, "_r" + i + "_c" + j + ".jpg"));
}
}
}
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"void",
"slice",
"(",
"Image",
"srcImage",
",",
"File",
"descDir",
",",
"int",
"destWidth",
",",
"int",
"destHeight",
")",
"{",
"if",
"(",
"destWidth",
"<=",
"0",
")",
"{",
"destWidth",
"=",
"200",
";",
"// 切片宽度\r",
"}",
"if",
"(",
... | 图像切片(指定切片的宽度和高度)
@param srcImage 源图像
@param descDir 切片目标文件夹
@param destWidth 目标切片宽度。默认200
@param destHeight 目标切片高度。默认150 | [
"图像切片(指定切片的宽度和高度)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L382-L422 | train | Creates a slice of the specified image. | [
30522,
2270,
10763,
11675,
14704,
1006,
3746,
5034,
6895,
26860,
1010,
5371,
4078,
19797,
4313,
1010,
20014,
4078,
2102,
9148,
11927,
2232,
1010,
20014,
4078,
10760,
18743,
1007,
1063,
2065,
1006,
4078,
2102,
9148,
11927,
2232,
1026,
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-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/relational/WebLogAnalysis.java | WebLogAnalysis.getDocumentsDataSet | private static DataSet<Tuple2<String, String>> getDocumentsDataSet(ExecutionEnvironment env, ParameterTool params) {
// Create DataSet for documents relation (URL, Doc-Text)
if (params.has("documents")) {
return env.readCsvFile(params.get("documents"))
.fieldDelimiter("|")
.types(String.class, String.class);
} else {
System.out.println("Executing WebLogAnalysis example with default documents data set.");
System.out.println("Use --documents to specify file input.");
return WebLogData.getDocumentDataSet(env);
}
} | java | private static DataSet<Tuple2<String, String>> getDocumentsDataSet(ExecutionEnvironment env, ParameterTool params) {
// Create DataSet for documents relation (URL, Doc-Text)
if (params.has("documents")) {
return env.readCsvFile(params.get("documents"))
.fieldDelimiter("|")
.types(String.class, String.class);
} else {
System.out.println("Executing WebLogAnalysis example with default documents data set.");
System.out.println("Use --documents to specify file input.");
return WebLogData.getDocumentDataSet(env);
}
} | [
"private",
"static",
"DataSet",
"<",
"Tuple2",
"<",
"String",
",",
"String",
">",
">",
"getDocumentsDataSet",
"(",
"ExecutionEnvironment",
"env",
",",
"ParameterTool",
"params",
")",
"{",
"// Create DataSet for documents relation (URL, Doc-Text)",
"if",
"(",
"params",
... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/relational/WebLogAnalysis.java#L260-L271 | train | Get documents data set. | [
30522,
2797,
10763,
2951,
13462,
1026,
10722,
10814,
2475,
1026,
5164,
1010,
5164,
1028,
1028,
2131,
3527,
24894,
11187,
2850,
18260,
2102,
1006,
7781,
2368,
21663,
2239,
3672,
4372,
2615,
1010,
16381,
3406,
4747,
11498,
5244,
1007,
1063,
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/nr/PersonDictionary.java | PersonDictionary.isBadCase | static boolean isBadCase(String name)
{
EnumItem<NR> nrEnumItem = dictionary.get(name);
if (nrEnumItem == null) return false;
return nrEnumItem.containsLabel(NR.A);
} | java | static boolean isBadCase(String name)
{
EnumItem<NR> nrEnumItem = dictionary.get(name);
if (nrEnumItem == null) return false;
return nrEnumItem.containsLabel(NR.A);
} | [
"static",
"boolean",
"isBadCase",
"(",
"String",
"name",
")",
"{",
"EnumItem",
"<",
"NR",
">",
"nrEnumItem",
"=",
"dictionary",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"nrEnumItem",
"==",
"null",
")",
"return",
"false",
";",
"return",
"nrEnumItem",... | 因为任何算法都无法解决100%的问题,总是有一些bad case,这些bad case会以“盖公章 A 1”的形式加入词典中<BR>
这个方法返回人名是否是bad case
@param name
@return | [
"因为任何算法都无法解决100%的问题,总是有一些bad",
"case,这些bad",
"case会以“盖公章",
"A",
"1”的形式加入词典中<BR",
">",
"这个方法返回人名是否是bad",
"case"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/nr/PersonDictionary.java#L204-L209 | train | Checks if a name is a bad case. | [
30522,
10763,
22017,
20898,
2003,
9024,
18382,
1006,
5164,
2171,
1007,
1063,
4372,
12717,
18532,
1026,
17212,
1028,
17212,
2368,
12717,
18532,
1027,
9206,
1012,
2131,
1006,
2171,
1007,
1025,
2065,
1006,
17212,
2368,
12717,
18532,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java | AbstractStreamOperator.getPartitionedState | protected <S extends State, N> S getPartitionedState(
N namespace,
TypeSerializer<N> namespaceSerializer,
StateDescriptor<S, ?> stateDescriptor) throws Exception {
/*
TODO: NOTE: This method does a lot of work caching / retrieving states just to update the namespace.
This method should be removed for the sake of namespaces being lazily fetched from the keyed
state backend, or being set on the state directly.
*/
if (keyedStateStore != null) {
return keyedStateBackend.getPartitionedState(namespace, namespaceSerializer, stateDescriptor);
} else {
throw new RuntimeException("Cannot create partitioned state. The keyed state " +
"backend has not been set. This indicates that the operator is not " +
"partitioned/keyed.");
}
} | java | protected <S extends State, N> S getPartitionedState(
N namespace,
TypeSerializer<N> namespaceSerializer,
StateDescriptor<S, ?> stateDescriptor) throws Exception {
/*
TODO: NOTE: This method does a lot of work caching / retrieving states just to update the namespace.
This method should be removed for the sake of namespaces being lazily fetched from the keyed
state backend, or being set on the state directly.
*/
if (keyedStateStore != null) {
return keyedStateBackend.getPartitionedState(namespace, namespaceSerializer, stateDescriptor);
} else {
throw new RuntimeException("Cannot create partitioned state. The keyed state " +
"backend has not been set. This indicates that the operator is not " +
"partitioned/keyed.");
}
} | [
"protected",
"<",
"S",
"extends",
"State",
",",
"N",
">",
"S",
"getPartitionedState",
"(",
"N",
"namespace",
",",
"TypeSerializer",
"<",
"N",
">",
"namespaceSerializer",
",",
"StateDescriptor",
"<",
"S",
",",
"?",
">",
"stateDescriptor",
")",
"throws",
"Exce... | Creates a partitioned state handle, using the state backend configured for this task.
@throws IllegalStateException Thrown, if the key/value state was already initialized.
@throws Exception Thrown, if the state backend cannot create the key/value state. | [
"Creates",
"a",
"partitioned",
"state",
"handle",
"using",
"the",
"state",
"backend",
"configured",
"for",
"this",
"task",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java#L583-L601 | train | Gets the partitioned state. | [
30522,
5123,
1026,
1055,
8908,
2110,
1010,
1050,
1028,
1055,
2131,
19362,
3775,
3508,
2098,
9153,
2618,
1006,
1050,
3415,
15327,
1010,
4127,
11610,
28863,
1026,
1050,
1028,
3415,
15327,
8043,
4818,
17629,
1010,
3090,
2229,
23235,
2953,
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... |
netty/netty | transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java | AbstractBootstrap.bind | public ChannelFuture bind(String inetHost, int inetPort) {
return bind(SocketUtils.socketAddress(inetHost, inetPort));
} | java | public ChannelFuture bind(String inetHost, int inetPort) {
return bind(SocketUtils.socketAddress(inetHost, inetPort));
} | [
"public",
"ChannelFuture",
"bind",
"(",
"String",
"inetHost",
",",
"int",
"inetPort",
")",
"{",
"return",
"bind",
"(",
"SocketUtils",
".",
"socketAddress",
"(",
"inetHost",
",",
"inetPort",
")",
")",
";",
"}"
] | Create a new {@link Channel} and bind it. | [
"Create",
"a",
"new",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java#L259-L261 | train | Binds the socket to the specified host and port. | [
30522,
2270,
3149,
11263,
11244,
14187,
1006,
5164,
1999,
11031,
14122,
1010,
20014,
1999,
3388,
6442,
1007,
1063,
2709,
14187,
1006,
22278,
21823,
4877,
1012,
22278,
4215,
30524,
6442,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java | HttpPostMultipartRequestDecoder.skipControlCharacters | private static void skipControlCharacters(ByteBuf undecodedChunk) {
if (!undecodedChunk.hasArray()) {
try {
skipControlCharactersStandard(undecodedChunk);
} catch (IndexOutOfBoundsException e1) {
throw new NotEnoughDataDecoderException(e1);
}
return;
}
SeekAheadOptimize sao = new SeekAheadOptimize(undecodedChunk);
while (sao.pos < sao.limit) {
char c = (char) (sao.bytes[sao.pos++] & 0xFF);
if (!Character.isISOControl(c) && !Character.isWhitespace(c)) {
sao.setReadPosition(1);
return;
}
}
throw new NotEnoughDataDecoderException("Access out of bounds");
} | java | private static void skipControlCharacters(ByteBuf undecodedChunk) {
if (!undecodedChunk.hasArray()) {
try {
skipControlCharactersStandard(undecodedChunk);
} catch (IndexOutOfBoundsException e1) {
throw new NotEnoughDataDecoderException(e1);
}
return;
}
SeekAheadOptimize sao = new SeekAheadOptimize(undecodedChunk);
while (sao.pos < sao.limit) {
char c = (char) (sao.bytes[sao.pos++] & 0xFF);
if (!Character.isISOControl(c) && !Character.isWhitespace(c)) {
sao.setReadPosition(1);
return;
}
}
throw new NotEnoughDataDecoderException("Access out of bounds");
} | [
"private",
"static",
"void",
"skipControlCharacters",
"(",
"ByteBuf",
"undecodedChunk",
")",
"{",
"if",
"(",
"!",
"undecodedChunk",
".",
"hasArray",
"(",
")",
")",
"{",
"try",
"{",
"skipControlCharactersStandard",
"(",
"undecodedChunk",
")",
";",
"}",
"catch",
... | Skip control Characters
@throws NotEnoughDataDecoderException | [
"Skip",
"control",
"Characters"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L580-L598 | train | Skip control characters. | [
30522,
2797,
10763,
11675,
13558,
8663,
13181,
29358,
5400,
21162,
2015,
1006,
24880,
8569,
2546,
6151,
8586,
10244,
16409,
17157,
2243,
1007,
1063,
30524,
1006,
5950,
5833,
11253,
15494,
3366,
2595,
24422,
1041,
2487,
1007,
1063,
5466,
2047,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/SpillChannelManager.java | SpillChannelManager.addOpenChannels | public synchronized void addOpenChannels(List<FileIOChannel> toOpen) {
checkArgument(!closed);
for (FileIOChannel channel : toOpen) {
openChannels.add(channel);
channels.remove(channel.getChannelID());
}
} | java | public synchronized void addOpenChannels(List<FileIOChannel> toOpen) {
checkArgument(!closed);
for (FileIOChannel channel : toOpen) {
openChannels.add(channel);
channels.remove(channel.getChannelID());
}
} | [
"public",
"synchronized",
"void",
"addOpenChannels",
"(",
"List",
"<",
"FileIOChannel",
">",
"toOpen",
")",
"{",
"checkArgument",
"(",
"!",
"closed",
")",
";",
"for",
"(",
"FileIOChannel",
"channel",
":",
"toOpen",
")",
"{",
"openChannels",
".",
"add",
"(",
... | Open File channels. | [
"Open",
"File",
"channels",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/SpillChannelManager.java#L57-L63 | train | Add open channels to the open list. | [
30522,
2270,
25549,
11675,
5587,
26915,
26058,
2015,
1006,
2862,
1026,
5371,
3695,
26058,
1028,
2205,
11837,
1007,
1063,
4638,
2906,
22850,
4765,
1006,
999,
2701,
1007,
1025,
2005,
1006,
5371,
3695,
26058,
3149,
1024,
2205,
11837,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java | ReUtil.get | public static String get(Pattern pattern, CharSequence content, int groupIndex) {
if (null == content || null == pattern) {
return null;
}
final Matcher matcher = pattern.matcher(content);
if (matcher.find()) {
return matcher.group(groupIndex);
}
return null;
} | java | public static String get(Pattern pattern, CharSequence content, int groupIndex) {
if (null == content || null == pattern) {
return null;
}
final Matcher matcher = pattern.matcher(content);
if (matcher.find()) {
return matcher.group(groupIndex);
}
return null;
} | [
"public",
"static",
"String",
"get",
"(",
"Pattern",
"pattern",
",",
"CharSequence",
"content",
",",
"int",
"groupIndex",
")",
"{",
"if",
"(",
"null",
"==",
"content",
"||",
"null",
"==",
"pattern",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Matcher... | 获得匹配的字符串,对应分组0表示整个匹配内容,1表示第一个括号分组内容,依次类推
@param pattern 编译后的正则模式
@param content 被匹配的内容
@param groupIndex 匹配正则的分组序号,0表示整个匹配内容,1表示第一个括号分组内容,依次类推
@return 匹配后得到的字符串,未匹配返回null | [
"获得匹配的字符串,对应分组0表示整个匹配内容,1表示第一个括号分组内容,依次类推"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L111-L121 | train | Gets the group of the specified group index from the specified CharSequence. | [
30522,
2270,
10763,
5164,
2131,
1006,
5418,
5418,
1010,
25869,
3366,
4226,
5897,
4180,
1010,
20014,
2177,
22254,
10288,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
4180,
1064,
1064,
19701,
1027,
1027,
5418,
1007,
1063,
2709,
19701,
1025,
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... |
networknt/light-4j | handler/src/main/java/com/networknt/handler/Handler.java | Handler.startDefaultHandlers | public static boolean startDefaultHandlers(HttpServerExchange httpServerExchange) {
// check if defaultHandlers is empty
if(defaultHandlers != null && defaultHandlers.size() > 0) {
httpServerExchange.putAttachment(CHAIN_ID, "defaultHandlers");
httpServerExchange.putAttachment(CHAIN_SEQ, 0);
return true;
}
return false;
} | java | public static boolean startDefaultHandlers(HttpServerExchange httpServerExchange) {
// check if defaultHandlers is empty
if(defaultHandlers != null && defaultHandlers.size() > 0) {
httpServerExchange.putAttachment(CHAIN_ID, "defaultHandlers");
httpServerExchange.putAttachment(CHAIN_SEQ, 0);
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"startDefaultHandlers",
"(",
"HttpServerExchange",
"httpServerExchange",
")",
"{",
"// check if defaultHandlers is empty",
"if",
"(",
"defaultHandlers",
"!=",
"null",
"&&",
"defaultHandlers",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
... | If there is no matching path, the OrchestrationHandler is going to try to start the defaultHandlers.
If there are default handlers defined, store the chain id within the exchange.
Otherwise return false.
@param httpServerExchange
The current requests server exchange.
@return true if a handler has been defined for the given path. | [
"If",
"there",
"is",
"no",
"matching",
"path",
"the",
"OrchestrationHandler",
"is",
"going",
"to",
"try",
"to",
"start",
"the",
"defaultHandlers",
".",
"If",
"there",
"are",
"default",
"handlers",
"defined",
"store",
"the",
"chain",
"id",
"within",
"the",
"e... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/handler/src/main/java/com/networknt/handler/Handler.java#L349-L357 | train | Start default handlers. | [
30522,
2270,
10763,
22017,
20898,
2707,
3207,
7011,
11314,
11774,
12910,
1006,
16770,
2121,
28943,
2595,
22305,
2063,
16770,
2121,
28943,
2595,
22305,
2063,
1007,
1063,
1013,
1013,
4638,
2065,
12398,
11774,
12910,
2003,
4064,
2065,
1006,
1239... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java | DataStream.project | @PublicEvolving
public <R extends Tuple> SingleOutputStreamOperator<R> project(int... fieldIndexes) {
return new StreamProjection<>(this, fieldIndexes).projectTupleX();
} | java | @PublicEvolving
public <R extends Tuple> SingleOutputStreamOperator<R> project(int... fieldIndexes) {
return new StreamProjection<>(this, fieldIndexes).projectTupleX();
} | [
"@",
"PublicEvolving",
"public",
"<",
"R",
"extends",
"Tuple",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"project",
"(",
"int",
"...",
"fieldIndexes",
")",
"{",
"return",
"new",
"StreamProjection",
"<>",
"(",
"this",
",",
"fieldIndexes",
")",
".",
"p... | Initiates a Project transformation on a {@link Tuple} {@link DataStream}.<br>
<b>Note: Only Tuple DataStreams can be projected.</b>
<p>The transformation projects each Tuple of the DataSet onto a (sub)set of
fields.
@param fieldIndexes
The field indexes of the input tuples that are retained. The
order of fields in the output tuple corresponds to the order
of field indexes.
@return The projected DataStream
@see Tuple
@see DataStream | [
"Initiates",
"a",
"Project",
"transformation",
"on",
"a",
"{",
"@link",
"Tuple",
"}",
"{",
"@link",
"DataStream",
"}",
".",
"<br",
">",
"<b",
">",
"Note",
":",
"Only",
"Tuple",
"DataStreams",
"can",
"be",
"projected",
".",
"<",
"/",
"b",
">"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L708-L711 | train | Project a tuple to a single field. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
1026,
1054,
8908,
10722,
10814,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
2622,
1006,
20014,
1012,
1012,
1012,
2492,
22254,
10288,
2229,
1007,
1063,
2709,
2047,
5460,
21572,
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... |
netty/netty | common/src/main/java/io/netty/util/concurrent/AbstractScheduledEventExecutor.java | AbstractScheduledEventExecutor.pollScheduledTask | protected final Runnable pollScheduledTask(long nanoTime) {
assert inEventLoop();
Queue<ScheduledFutureTask<?>> scheduledTaskQueue = this.scheduledTaskQueue;
ScheduledFutureTask<?> scheduledTask = scheduledTaskQueue == null ? null : scheduledTaskQueue.peek();
if (scheduledTask == null) {
return null;
}
if (scheduledTask.deadlineNanos() <= nanoTime) {
scheduledTaskQueue.remove();
return scheduledTask;
}
return null;
} | java | protected final Runnable pollScheduledTask(long nanoTime) {
assert inEventLoop();
Queue<ScheduledFutureTask<?>> scheduledTaskQueue = this.scheduledTaskQueue;
ScheduledFutureTask<?> scheduledTask = scheduledTaskQueue == null ? null : scheduledTaskQueue.peek();
if (scheduledTask == null) {
return null;
}
if (scheduledTask.deadlineNanos() <= nanoTime) {
scheduledTaskQueue.remove();
return scheduledTask;
}
return null;
} | [
"protected",
"final",
"Runnable",
"pollScheduledTask",
"(",
"long",
"nanoTime",
")",
"{",
"assert",
"inEventLoop",
"(",
")",
";",
"Queue",
"<",
"ScheduledFutureTask",
"<",
"?",
">",
">",
"scheduledTaskQueue",
"=",
"this",
".",
"scheduledTaskQueue",
";",
"Schedul... | Return the {@link Runnable} which is ready to be executed with the given {@code nanoTime}.
You should use {@link #nanoTime()} to retrieve the correct {@code nanoTime}. | [
"Return",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/AbstractScheduledEventExecutor.java#L101-L115 | train | Poll the scheduled task. | [
30522,
5123,
2345,
2448,
22966,
14592,
7690,
18696,
10230,
2243,
1006,
2146,
28991,
7292,
1007,
1063,
20865,
1999,
18697,
3372,
4135,
7361,
1006,
1007,
1025,
24240,
1026,
5115,
11263,
11244,
10230,
2243,
1026,
1029,
1028,
1028,
5115,
10230,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.writeToStream | public static File writeToStream(File file, OutputStream out) throws IORuntimeException {
return FileReader.create(file).writeToStream(out);
} | java | public static File writeToStream(File file, OutputStream out) throws IORuntimeException {
return FileReader.create(file).writeToStream(out);
} | [
"public",
"static",
"File",
"writeToStream",
"(",
"File",
"file",
",",
"OutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileReader",
".",
"create",
"(",
"file",
")",
".",
"writeToStream",
"(",
"out",
")",
";",
"}"
] | 将文件写入流中
@param file 文件
@param out 流
@return 目标文件
@throws IORuntimeException IO异常 | [
"将文件写入流中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3177-L3179 | train | Write the contents of the file to the given output stream. | [
30522,
2270,
10763,
5371,
4339,
13122,
25379,
1006,
5371,
5371,
1010,
27852,
25379,
2041,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
5371,
16416,
4063,
1012,
3443,
1006,
5371,
1007,
1012,
4339,
13122,
25379,
1006,
2041,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | example/src/main/java/io/netty/example/http2/helloworld/frame/server/HelloWorldHttp2Handler.java | HelloWorldHttp2Handler.onDataRead | private static void onDataRead(ChannelHandlerContext ctx, Http2DataFrame data) throws Exception {
Http2FrameStream stream = data.stream();
if (data.isEndStream()) {
sendResponse(ctx, stream, data.content());
} else {
// We do not send back the response to the remote-peer, so we need to release it.
data.release();
}
// Update the flowcontroller
ctx.write(new DefaultHttp2WindowUpdateFrame(data.initialFlowControlledBytes()).stream(stream));
} | java | private static void onDataRead(ChannelHandlerContext ctx, Http2DataFrame data) throws Exception {
Http2FrameStream stream = data.stream();
if (data.isEndStream()) {
sendResponse(ctx, stream, data.content());
} else {
// We do not send back the response to the remote-peer, so we need to release it.
data.release();
}
// Update the flowcontroller
ctx.write(new DefaultHttp2WindowUpdateFrame(data.initialFlowControlledBytes()).stream(stream));
} | [
"private",
"static",
"void",
"onDataRead",
"(",
"ChannelHandlerContext",
"ctx",
",",
"Http2DataFrame",
"data",
")",
"throws",
"Exception",
"{",
"Http2FrameStream",
"stream",
"=",
"data",
".",
"stream",
"(",
")",
";",
"if",
"(",
"data",
".",
"isEndStream",
"(",... | If receive a frame with end-of-stream set, send a pre-canned response. | [
"If",
"receive",
"a",
"frame",
"with",
"end",
"-",
"of",
"-",
"stream",
"set",
"send",
"a",
"pre",
"-",
"canned",
"response",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http2/helloworld/frame/server/HelloWorldHttp2Handler.java#L73-L85 | train | On data read. | [
30522,
2797,
10763,
11675,
2006,
2850,
7559,
13775,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
8299,
2475,
2850,
2696,
15643,
2951,
1007,
11618,
6453,
1063,
8299,
2475,
15643,
21422,
5460,
1027,
2951,
1012,
5460,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/CookieUtil.java | CookieUtil.validCookieNameOctets | private static BitSet validCookieNameOctets(BitSet validCookieValueOctets) {
BitSet bits = new BitSet(8);
bits.or(validCookieValueOctets);
bits.set('(', false);
bits.set(')', false);
bits.set('<', false);
bits.set('>', false);
bits.set('@', false);
bits.set(':', false);
bits.set('/', false);
bits.set('[', false);
bits.set(']', false);
bits.set('?', false);
bits.set('=', false);
bits.set('{', false);
bits.set('}', false);
bits.set(' ', false);
bits.set('\t', false);
return bits;
} | java | private static BitSet validCookieNameOctets(BitSet validCookieValueOctets) {
BitSet bits = new BitSet(8);
bits.or(validCookieValueOctets);
bits.set('(', false);
bits.set(')', false);
bits.set('<', false);
bits.set('>', false);
bits.set('@', false);
bits.set(':', false);
bits.set('/', false);
bits.set('[', false);
bits.set(']', false);
bits.set('?', false);
bits.set('=', false);
bits.set('{', false);
bits.set('}', false);
bits.set(' ', false);
bits.set('\t', false);
return bits;
} | [
"private",
"static",
"BitSet",
"validCookieNameOctets",
"(",
"BitSet",
"validCookieValueOctets",
")",
"{",
"BitSet",
"bits",
"=",
"new",
"BitSet",
"(",
"8",
")",
";",
"bits",
".",
"or",
"(",
"validCookieValueOctets",
")",
";",
"bits",
".",
"set",
"(",
"'",
... | | "{" | "}" | SP | HT | [
"|",
"{",
"|",
"}",
"|",
"SP",
"|",
"HT"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/CookieUtil.java#L49-L68 | train | Returns a bit set containing the valid cookie name octets. | [
30522,
2797,
10763,
9017,
3388,
9398,
3597,
23212,
8189,
26247,
6593,
8454,
1006,
9017,
3388,
9398,
3597,
23212,
13331,
7630,
8780,
6593,
8454,
1007,
1063,
9017,
3388,
9017,
1027,
2047,
9017,
3388,
1006,
1022,
1007,
1025,
9017,
1012,
2030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessage.java | HAProxyMessage.checkAddress | private static void checkAddress(String address, AddressFamily addrFamily) {
if (addrFamily == null) {
throw new NullPointerException("addrFamily");
}
switch (addrFamily) {
case AF_UNSPEC:
if (address != null) {
throw new HAProxyProtocolException("unable to validate an AF_UNSPEC address: " + address);
}
return;
case AF_UNIX:
return;
}
if (address == null) {
throw new NullPointerException("address");
}
switch (addrFamily) {
case AF_IPv4:
if (!NetUtil.isValidIpV4Address(address)) {
throw new HAProxyProtocolException("invalid IPv4 address: " + address);
}
break;
case AF_IPv6:
if (!NetUtil.isValidIpV6Address(address)) {
throw new HAProxyProtocolException("invalid IPv6 address: " + address);
}
break;
default:
throw new Error();
}
} | java | private static void checkAddress(String address, AddressFamily addrFamily) {
if (addrFamily == null) {
throw new NullPointerException("addrFamily");
}
switch (addrFamily) {
case AF_UNSPEC:
if (address != null) {
throw new HAProxyProtocolException("unable to validate an AF_UNSPEC address: " + address);
}
return;
case AF_UNIX:
return;
}
if (address == null) {
throw new NullPointerException("address");
}
switch (addrFamily) {
case AF_IPv4:
if (!NetUtil.isValidIpV4Address(address)) {
throw new HAProxyProtocolException("invalid IPv4 address: " + address);
}
break;
case AF_IPv6:
if (!NetUtil.isValidIpV6Address(address)) {
throw new HAProxyProtocolException("invalid IPv6 address: " + address);
}
break;
default:
throw new Error();
}
} | [
"private",
"static",
"void",
"checkAddress",
"(",
"String",
"address",
",",
"AddressFamily",
"addrFamily",
")",
"{",
"if",
"(",
"addrFamily",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"addrFamily\"",
")",
";",
"}",
"switch",
"(",
... | Validate an address (IPv4, IPv6, Unix Socket)
@param address human-readable address
@param addrFamily the {@link AddressFamily} to check the address against
@throws HAProxyProtocolException if the address is invalid | [
"Validate",
"an",
"address",
"(",
"IPv4",
"IPv6",
"Unix",
"Socket",
")"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessage.java#L418-L451 | train | checkAddress is called to check if the address is valid for the given address family | [
30522,
2797,
10763,
11675,
4638,
4215,
16200,
4757,
1006,
5164,
4769,
1010,
4769,
7011,
4328,
2135,
5587,
12881,
10631,
2135,
1007,
1063,
2065,
1006,
5587,
12881,
10631,
2135,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java | ThriftCLIServiceClient.closeOperation | @Override
public void closeOperation(OperationHandle opHandle)
throws HiveSQLException {
try {
TCloseOperationReq req = new TCloseOperationReq(opHandle.toTOperationHandle());
TCloseOperationResp resp = cliService.CloseOperation(req);
checkStatus(resp.getStatus());
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | java | @Override
public void closeOperation(OperationHandle opHandle)
throws HiveSQLException {
try {
TCloseOperationReq req = new TCloseOperationReq(opHandle.toTOperationHandle());
TCloseOperationResp resp = cliService.CloseOperation(req);
checkStatus(resp.getStatus());
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | [
"@",
"Override",
"public",
"void",
"closeOperation",
"(",
"OperationHandle",
"opHandle",
")",
"throws",
"HiveSQLException",
"{",
"try",
"{",
"TCloseOperationReq",
"req",
"=",
"new",
"TCloseOperationReq",
"(",
"opHandle",
".",
"toTOperationHandle",
"(",
")",
")",
"... | /* (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/thrift/ThriftCLIServiceClient.java#L337-L349 | 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,
3046,
1063,
22975,
10483,
8780,
29487,
2890,
4160,
2128,
4160,
1027,
2047,
22975,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/AttributeKey.java | AttributeKey.valueOf | @SuppressWarnings("unchecked")
public static <T> AttributeKey<T> valueOf(String name) {
return (AttributeKey<T>) pool.valueOf(name);
} | java | @SuppressWarnings("unchecked")
public static <T> AttributeKey<T> valueOf(String name) {
return (AttributeKey<T>) pool.valueOf(name);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"AttributeKey",
"<",
"T",
">",
"valueOf",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"AttributeKey",
"<",
"T",
">",
")",
"pool",
".",
"valueOf",
"(",
"name",
")... | Returns the singleton instance of the {@link AttributeKey} which has the specified {@code name}. | [
"Returns",
"the",
"singleton",
"instance",
"of",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AttributeKey.java#L37-L40 | train | Get an AttributeKey from the name. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
17961,
14839,
1026,
1056,
1028,
3643,
11253,
1006,
5164,
2171,
1007,
1063,
2709,
1006,
17961,
14839,
1026,
1056,
1028,
1007,
477... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/sax/ExcelSaxUtil.java | ExcelSaxUtil.getNumberValue | private static Number getNumberValue(String value, String numFmtString) {
if(StrUtil.isBlank(value)) {
return null;
}
double numValue = Double.parseDouble(value);
// 普通数字
if (null != numFmtString && numFmtString.indexOf(StrUtil.C_DOT) < 0) {
final long longPart = (long) numValue;
if (longPart == numValue) {
// 对于无小数部分的数字类型,转为Long
return longPart;
}
}
return numValue;
} | java | private static Number getNumberValue(String value, String numFmtString) {
if(StrUtil.isBlank(value)) {
return null;
}
double numValue = Double.parseDouble(value);
// 普通数字
if (null != numFmtString && numFmtString.indexOf(StrUtil.C_DOT) < 0) {
final long longPart = (long) numValue;
if (longPart == numValue) {
// 对于无小数部分的数字类型,转为Long
return longPart;
}
}
return numValue;
} | [
"private",
"static",
"Number",
"getNumberValue",
"(",
"String",
"value",
",",
"String",
"numFmtString",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"value",
")",
")",
"{",
"return",
"null",
";",
"}",
"double",
"numValue",
"=",
"Double",
".",
"pa... | 获取数字类型值
@param value 值
@param numFmtString 格式
@return 数字,可以是Double、Long
@since 4.1.0 | [
"获取数字类型值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/ExcelSaxUtil.java#L140-L154 | train | Gets the number value. | [
30522,
2797,
10763,
2193,
2131,
19172,
5677,
10175,
5657,
1006,
5164,
3643,
1010,
5164,
16371,
2213,
16715,
3215,
18886,
3070,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
3643,
1007,
1007,
1063,
2709,
19701,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/DefaultConfigurableOptionsFactory.java | DefaultConfigurableOptionsFactory.checkArgumentValid | private static boolean checkArgumentValid(String key, String value) {
if (POSITIVE_INT_CONFIG_SET.contains(key)) {
Preconditions.checkArgument(Integer.parseInt(value) > 0,
"Configured value for key: " + key + " must be larger than 0.");
} else if (SIZE_CONFIG_SET.contains(key)) {
Preconditions.checkArgument(MemorySize.parseBytes(value) > 0,
"Configured size for key" + key + " must be larger than 0.");
} else if (BOOLEAN_CONFIG_SET.contains(key)) {
Preconditions.checkArgument("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value),
"The configured boolean value: " + value + " for key: " + key + " is illegal.");
} else if (key.equals(COMPACTION_STYLE.key())) {
value = value.toLowerCase();
Preconditions.checkArgument(COMPACTION_STYLE_SET.contains(value),
"Compression type: " + value + " is not recognized with legal types: " + String.join(", ", COMPACTION_STYLE_SET));
}
return true;
} | java | private static boolean checkArgumentValid(String key, String value) {
if (POSITIVE_INT_CONFIG_SET.contains(key)) {
Preconditions.checkArgument(Integer.parseInt(value) > 0,
"Configured value for key: " + key + " must be larger than 0.");
} else if (SIZE_CONFIG_SET.contains(key)) {
Preconditions.checkArgument(MemorySize.parseBytes(value) > 0,
"Configured size for key" + key + " must be larger than 0.");
} else if (BOOLEAN_CONFIG_SET.contains(key)) {
Preconditions.checkArgument("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value),
"The configured boolean value: " + value + " for key: " + key + " is illegal.");
} else if (key.equals(COMPACTION_STYLE.key())) {
value = value.toLowerCase();
Preconditions.checkArgument(COMPACTION_STYLE_SET.contains(value),
"Compression type: " + value + " is not recognized with legal types: " + String.join(", ", COMPACTION_STYLE_SET));
}
return true;
} | [
"private",
"static",
"boolean",
"checkArgumentValid",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"POSITIVE_INT_CONFIG_SET",
".",
"contains",
"(",
"key",
")",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"Integer",
".",
"parseIn... | Helper method to check whether the (key,value) is valid through given configuration and returns the formatted value.
@param key The configuration key which is configurable in {@link RocksDBConfigurableOptions}.
@param value The value within given configuration.
@return whether the given key and value in string format is legal. | [
"Helper",
"method",
"to",
"check",
"whether",
"the",
"(",
"key",
"value",
")",
"is",
"valid",
"through",
"given",
"configuration",
"and",
"returns",
"the",
"formatted",
"value",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/DefaultConfigurableOptionsFactory.java#L380-L399 | train | Check that the given configuration value is valid. | [
30522,
2797,
10763,
22017,
20898,
4638,
2906,
22850,
4765,
10175,
3593,
1006,
5164,
3145,
1010,
5164,
3643,
1007,
1063,
2065,
1006,
3893,
1035,
20014,
1035,
9530,
8873,
2290,
1035,
2275,
1012,
3397,
1006,
3145,
1007,
1007,
1063,
3653,
8663,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.addFeature | protected static void addFeature(String feature, FeatureMap featureMap, List<Integer> featureList)
{
int featureId = featureMap.idOf(feature);
if (featureId != -1)
featureList.add(featureId);
} | java | protected static void addFeature(String feature, FeatureMap featureMap, List<Integer> featureList)
{
int featureId = featureMap.idOf(feature);
if (featureId != -1)
featureList.add(featureId);
} | [
"protected",
"static",
"void",
"addFeature",
"(",
"String",
"feature",
",",
"FeatureMap",
"featureMap",
",",
"List",
"<",
"Integer",
">",
"featureList",
")",
"{",
"int",
"featureId",
"=",
"featureMap",
".",
"idOf",
"(",
"feature",
")",
";",
"if",
"(",
"fea... | 向特征向量插入特征
@param feature 特征
@param featureMap 特征映射
@param featureList 特征向量 | [
"向特征向量插入特征"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java#L228-L233 | train | Add a feature to the list of featureIds. | [
30522,
5123,
10763,
11675,
5587,
7959,
4017,
5397,
1006,
5164,
3444,
1010,
3444,
2863,
2361,
3444,
2863,
2361,
1010,
2862,
1026,
16109,
1028,
3444,
9863,
1007,
1063,
20014,
3444,
3593,
1027,
3444,
2863,
2361,
1012,
8909,
11253,
1006,
3444,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.getChar | @SuppressWarnings("restriction")
public final char getChar(int index) {
final long pos = address + index;
if (index >= 0 && pos <= addressLimit - 2) {
return UNSAFE.getChar(heapMemory, pos);
}
else if (address > addressLimit) {
throw new IllegalStateException("This segment has been freed.");
}
else {
// index is in fact invalid
throw new IndexOutOfBoundsException();
}
} | java | @SuppressWarnings("restriction")
public final char getChar(int index) {
final long pos = address + index;
if (index >= 0 && pos <= addressLimit - 2) {
return UNSAFE.getChar(heapMemory, pos);
}
else if (address > addressLimit) {
throw new IllegalStateException("This segment has been freed.");
}
else {
// index is in fact invalid
throw new IndexOutOfBoundsException();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"restriction\"",
")",
"public",
"final",
"char",
"getChar",
"(",
"int",
"index",
")",
"{",
"final",
"long",
"pos",
"=",
"address",
"+",
"index",
";",
"if",
"(",
"index",
">=",
"0",
"&&",
"pos",
"<=",
"addressLimit",
"-",
... | Reads a char value from the given position, in the system's native byte order.
@param index The position from which the memory will be read.
@return The char value at the given position.
@throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment
size minus 2. | [
"Reads",
"a",
"char",
"value",
"from",
"the",
"given",
"position",
"in",
"the",
"system",
"s",
"native",
"byte",
"order",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L421-L434 | train | Gets a char from the segment. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
16840,
1000,
1007,
2270,
2345,
25869,
2131,
7507,
2099,
1006,
20014,
5950,
1007,
1063,
2345,
2146,
13433,
2015,
1027,
4769,
1009,
5950,
1025,
2065,
1006,
5950,
1028,
1027,
1014,
1004,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java | MqttDecoder.decodePayload | private static Result<?> decodePayload(
ByteBuf buffer,
MqttMessageType messageType,
int bytesRemainingInVariablePart,
Object variableHeader) {
switch (messageType) {
case CONNECT:
return decodeConnectionPayload(buffer, (MqttConnectVariableHeader) variableHeader);
case SUBSCRIBE:
return decodeSubscribePayload(buffer, bytesRemainingInVariablePart);
case SUBACK:
return decodeSubackPayload(buffer, bytesRemainingInVariablePart);
case UNSUBSCRIBE:
return decodeUnsubscribePayload(buffer, bytesRemainingInVariablePart);
case PUBLISH:
return decodePublishPayload(buffer, bytesRemainingInVariablePart);
default:
// unknown payload , no byte consumed
return new Result<Object>(null, 0);
}
} | java | private static Result<?> decodePayload(
ByteBuf buffer,
MqttMessageType messageType,
int bytesRemainingInVariablePart,
Object variableHeader) {
switch (messageType) {
case CONNECT:
return decodeConnectionPayload(buffer, (MqttConnectVariableHeader) variableHeader);
case SUBSCRIBE:
return decodeSubscribePayload(buffer, bytesRemainingInVariablePart);
case SUBACK:
return decodeSubackPayload(buffer, bytesRemainingInVariablePart);
case UNSUBSCRIBE:
return decodeUnsubscribePayload(buffer, bytesRemainingInVariablePart);
case PUBLISH:
return decodePublishPayload(buffer, bytesRemainingInVariablePart);
default:
// unknown payload , no byte consumed
return new Result<Object>(null, 0);
}
} | [
"private",
"static",
"Result",
"<",
"?",
">",
"decodePayload",
"(",
"ByteBuf",
"buffer",
",",
"MqttMessageType",
"messageType",
",",
"int",
"bytesRemainingInVariablePart",
",",
"Object",
"variableHeader",
")",
"{",
"switch",
"(",
"messageType",
")",
"{",
"case",
... | Decodes the payload.
@param buffer the buffer to decode from
@param messageType type of the message being decoded
@param bytesRemainingInVariablePart bytes remaining
@param variableHeader variable header of the same message
@return the payload | [
"Decodes",
"the",
"payload",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java#L306-L331 | train | Decode a single payload. | [
30522,
2797,
10763,
2765,
1026,
1029,
1028,
21933,
3207,
4502,
8516,
10441,
2094,
1006,
24880,
8569,
2546,
17698,
1010,
1049,
4160,
4779,
30524,
1006,
17698,
1010,
1006,
1049,
4160,
4779,
8663,
2638,
6593,
10755,
19210,
4974,
2121,
1007,
80... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-smtp/src/main/java/io/netty/handler/codec/smtp/SmtpCommand.java | SmtpCommand.valueOf | public static SmtpCommand valueOf(CharSequence commandName) {
ObjectUtil.checkNotNull(commandName, "commandName");
SmtpCommand command = COMMANDS.get(commandName.toString());
return command != null ? command : new SmtpCommand(AsciiString.of(commandName));
} | java | public static SmtpCommand valueOf(CharSequence commandName) {
ObjectUtil.checkNotNull(commandName, "commandName");
SmtpCommand command = COMMANDS.get(commandName.toString());
return command != null ? command : new SmtpCommand(AsciiString.of(commandName));
} | [
"public",
"static",
"SmtpCommand",
"valueOf",
"(",
"CharSequence",
"commandName",
")",
"{",
"ObjectUtil",
".",
"checkNotNull",
"(",
"commandName",
",",
"\"commandName\"",
")",
";",
"SmtpCommand",
"command",
"=",
"COMMANDS",
".",
"get",
"(",
"commandName",
".",
"... | Returns the {@link SmtpCommand} for the given command name. | [
"Returns",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-smtp/src/main/java/io/netty/handler/codec/smtp/SmtpCommand.java#L62-L66 | train | Get an instance of the class based on the command name. | [
30522,
2270,
10763,
15488,
25856,
9006,
2386,
2094,
3643,
11253,
1006,
25869,
3366,
4226,
5897,
3094,
18442,
1007,
1063,
4874,
21823,
2140,
1012,
4638,
17048,
11231,
3363,
1006,
3094,
18442,
1010,
1000,
3094,
18442,
1000,
1007,
1025,
15488,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeutils/NestedSerializersSnapshotDelegate.java | NestedSerializersSnapshotDelegate.legacyReadNestedSerializerSnapshots | public static NestedSerializersSnapshotDelegate legacyReadNestedSerializerSnapshots(DataInputView in, ClassLoader cl) throws IOException {
@SuppressWarnings("deprecation")
final List<Tuple2<TypeSerializer<?>, TypeSerializerSnapshot<?>>> serializersAndSnapshots =
TypeSerializerSerializationUtil.readSerializersAndConfigsWithResilience(in, cl);
final TypeSerializerSnapshot<?>[] nestedSnapshots = serializersAndSnapshots.stream()
.map(t -> t.f1)
.toArray(TypeSerializerSnapshot<?>[]::new);
return new NestedSerializersSnapshotDelegate(nestedSnapshots);
} | java | public static NestedSerializersSnapshotDelegate legacyReadNestedSerializerSnapshots(DataInputView in, ClassLoader cl) throws IOException {
@SuppressWarnings("deprecation")
final List<Tuple2<TypeSerializer<?>, TypeSerializerSnapshot<?>>> serializersAndSnapshots =
TypeSerializerSerializationUtil.readSerializersAndConfigsWithResilience(in, cl);
final TypeSerializerSnapshot<?>[] nestedSnapshots = serializersAndSnapshots.stream()
.map(t -> t.f1)
.toArray(TypeSerializerSnapshot<?>[]::new);
return new NestedSerializersSnapshotDelegate(nestedSnapshots);
} | [
"public",
"static",
"NestedSerializersSnapshotDelegate",
"legacyReadNestedSerializerSnapshots",
"(",
"DataInputView",
"in",
",",
"ClassLoader",
"cl",
")",
"throws",
"IOException",
"{",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"final",
"List",
"<",
"Tuple2",
... | Reads the composite snapshot of all the contained serializers in a way that is compatible
with Version 1 of the deprecated {@link CompositeTypeSerializerConfigSnapshot}. | [
"Reads",
"the",
"composite",
"snapshot",
"of",
"all",
"the",
"contained",
"serializers",
"in",
"a",
"way",
"that",
"is",
"compatible",
"with",
"Version",
"1",
"of",
"the",
"deprecated",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/NestedSerializersSnapshotDelegate.java#L192-L202 | train | Read the nested serializers snapshots. | [
30522,
2270,
10763,
9089,
2098,
8043,
4818,
17629,
4757,
2532,
4523,
12326,
9247,
29107,
2618,
8027,
16416,
2094,
5267,
3064,
30524,
1006,
1000,
2139,
28139,
10719,
1000,
1007,
2345,
2862,
1026,
10722,
10814,
2475,
1026,
4127,
11610,
28863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.isEmpty | public static boolean isEmpty(Object array) {
if (null == array) {
return true;
} else if (isArray(array)) {
return 0 == Array.getLength(array);
}
throw new UtilException("Object to provide is not a Array !");
} | java | public static boolean isEmpty(Object array) {
if (null == array) {
return true;
} else if (isArray(array)) {
return 0 == Array.getLength(array);
}
throw new UtilException("Object to provide is not a Array !");
} | [
"public",
"static",
"boolean",
"isEmpty",
"(",
"Object",
"array",
")",
"{",
"if",
"(",
"null",
"==",
"array",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"isArray",
"(",
"array",
")",
")",
"{",
"return",
"0",
"==",
"Array",
".",
"getLe... | 数组是否为空<br>
此方法会匹配单一对象,如果此对象为{@code null}则返回true<br>
如果此对象为非数组,理解为此对象为数组的第一个元素,则返回false<br>
如果此对象为数组对象,数组长度大于0情况下返回false,否则返回true
@param array 数组
@return 是否为空 | [
"数组是否为空<br",
">",
"此方法会匹配单一对象,如果此对象为",
"{",
"@code",
"null",
"}",
"则返回true<br",
">",
"如果此对象为非数组,理解为此对象为数组的第一个元素,则返回false<br",
">",
"如果此对象为数组对象,数组长度大于0情况下返回false,否则返回true"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L50-L57 | train | Checks if the given array is empty. | [
30522,
2270,
10763,
22017,
20898,
2003,
6633,
13876,
2100,
1006,
4874,
9140,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
9140,
1007,
1063,
2709,
2995,
1025,
1065,
2842,
2065,
1006,
18061,
11335,
2100,
1006,
9140,
1007,
1007,
1063,
2709,
1014... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.between | public String between(Date date, DateUnit unit, BetweenFormater.Level formatLevel) {
return new DateBetween(this, date).toString(formatLevel);
} | java | public String between(Date date, DateUnit unit, BetweenFormater.Level formatLevel) {
return new DateBetween(this, date).toString(formatLevel);
} | [
"public",
"String",
"between",
"(",
"Date",
"date",
",",
"DateUnit",
"unit",
",",
"BetweenFormater",
".",
"Level",
"formatLevel",
")",
"{",
"return",
"new",
"DateBetween",
"(",
"this",
",",
"date",
")",
".",
"toString",
"(",
"formatLevel",
")",
";",
"}"
] | 计算相差时长
@param date 对比的日期
@param unit 单位 {@link DateUnit}
@param formatLevel 格式化级别
@return 相差时长 | [
"计算相差时长"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateTime.java#L609-L611 | train | Returns a string representation of this date in the specified format level. | [
30522,
2270,
5164,
2090,
1006,
3058,
3058,
1010,
3058,
19496,
2102,
3131,
1010,
2090,
14192,
24932,
1012,
2504,
4289,
20414,
2884,
1007,
1063,
2709,
2047,
3058,
20915,
28394,
2078,
1006,
2023,
1010,
3058,
1007,
1012,
2000,
3367,
4892,
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/rpc/akka/AkkaRpcServiceUtils.java | AkkaRpcServiceUtils.createRpcService | public static RpcService createRpcService(
String hostname,
String portRangeDefinition,
Configuration configuration) throws Exception {
final ActorSystem actorSystem = BootstrapTools.startActorSystem(configuration, hostname, portRangeDefinition, LOG);
return instantiateAkkaRpcService(configuration, actorSystem);
} | java | public static RpcService createRpcService(
String hostname,
String portRangeDefinition,
Configuration configuration) throws Exception {
final ActorSystem actorSystem = BootstrapTools.startActorSystem(configuration, hostname, portRangeDefinition, LOG);
return instantiateAkkaRpcService(configuration, actorSystem);
} | [
"public",
"static",
"RpcService",
"createRpcService",
"(",
"String",
"hostname",
",",
"String",
"portRangeDefinition",
",",
"Configuration",
"configuration",
")",
"throws",
"Exception",
"{",
"final",
"ActorSystem",
"actorSystem",
"=",
"BootstrapTools",
".",
"startActorS... | Utility method to create RPC service from configuration and hostname, port.
@param hostname The hostname/address that describes the TaskManager's data location.
@param portRangeDefinition The port range to start TaskManager on.
@param configuration The configuration for the TaskManager.
@return The rpc service which is used to start and connect to the TaskManager RpcEndpoint .
@throws IOException Thrown, if the actor system can not bind to the address
@throws Exception Thrown is some other error occurs while creating akka actor system | [
"Utility",
"method",
"to",
"create",
"RPC",
"service",
"from",
"configuration",
"and",
"hostname",
"port",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcServiceUtils.java#L80-L86 | train | Create a RpcService. | [
30522,
2270,
10763,
1054,
15042,
8043,
7903,
2063,
3443,
14536,
6169,
2121,
7903,
2063,
1006,
5164,
3677,
18442,
1010,
5164,
3417,
24388,
14728,
16294,
22753,
1010,
9563,
9563,
1007,
11618,
6453,
1063,
2345,
5889,
27268,
6633,
5889,
27268,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/InstantiationUtil.java | InstantiationUtil.checkForInstantiation | public static void checkForInstantiation(Class<?> clazz) {
final String errorMessage = checkForInstantiationError(clazz);
if (errorMessage != null) {
throw new RuntimeException("The class '" + clazz.getName() + "' is not instantiable: " + errorMessage);
}
} | java | public static void checkForInstantiation(Class<?> clazz) {
final String errorMessage = checkForInstantiationError(clazz);
if (errorMessage != null) {
throw new RuntimeException("The class '" + clazz.getName() + "' is not instantiable: " + errorMessage);
}
} | [
"public",
"static",
"void",
"checkForInstantiation",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"final",
"String",
"errorMessage",
"=",
"checkForInstantiationError",
"(",
"clazz",
")",
";",
"if",
"(",
"errorMessage",
"!=",
"null",
")",
"{",
"throw",
"ne... | Performs a standard check whether the class can be instantiated by {@code Class#newInstance()}.
@param clazz The class to check.
@throws RuntimeException Thrown, if the class cannot be instantiated by {@code Class#newInstance()}. | [
"Performs",
"a",
"standard",
"check",
"whether",
"the",
"class",
"can",
"be",
"instantiated",
"by",
"{",
"@code",
"Class#newInstance",
"()",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/InstantiationUtil.java#L471-L477 | train | Check if the class is instantiable. | [
30522,
2270,
10763,
11675,
4638,
29278,
7076,
5794,
10711,
3508,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1007,
1063,
2345,
5164,
7561,
7834,
3736,
3351,
1027,
4638,
29278,
7076,
5794,
10711,
3508,
2121,
29165,
1006,
18856,
10936,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.setHttp2Authority | static void setHttp2Authority(String authority, Http2Headers out) {
// The authority MUST NOT include the deprecated "userinfo" subcomponent
if (authority != null) {
if (authority.isEmpty()) {
out.authority(EMPTY_STRING);
} else {
int start = authority.indexOf('@') + 1;
int length = authority.length() - start;
if (length == 0) {
throw new IllegalArgumentException("authority: " + authority);
}
out.authority(new AsciiString(authority, start, length));
}
}
} | java | static void setHttp2Authority(String authority, Http2Headers out) {
// The authority MUST NOT include the deprecated "userinfo" subcomponent
if (authority != null) {
if (authority.isEmpty()) {
out.authority(EMPTY_STRING);
} else {
int start = authority.indexOf('@') + 1;
int length = authority.length() - start;
if (length == 0) {
throw new IllegalArgumentException("authority: " + authority);
}
out.authority(new AsciiString(authority, start, length));
}
}
} | [
"static",
"void",
"setHttp2Authority",
"(",
"String",
"authority",
",",
"Http2Headers",
"out",
")",
"{",
"// The authority MUST NOT include the deprecated \"userinfo\" subcomponent",
"if",
"(",
"authority",
"!=",
"null",
")",
"{",
"if",
"(",
"authority",
".",
"isEmpty",... | package-private for testing only | [
"package",
"-",
"private",
"for",
"testing",
"only"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java#L545-L559 | train | Set the HTTP2 authority header. | [
30522,
10763,
11675,
6662,
4779,
2361,
2475,
4887,
27844,
3012,
1006,
5164,
3691,
1010,
8299,
2475,
4974,
2545,
2041,
1007,
1063,
1013,
1013,
1996,
3691,
2442,
2025,
2421,
1996,
2139,
28139,
12921,
1000,
5310,
2378,
14876,
1000,
4942,
9006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java | IOManagerAsync.getReadRequestQueue | RequestQueue<ReadRequest> getReadRequestQueue(FileIOChannel.ID channelID) {
return this.readers[channelID.getThreadNum()].requestQueue;
} | java | RequestQueue<ReadRequest> getReadRequestQueue(FileIOChannel.ID channelID) {
return this.readers[channelID.getThreadNum()].requestQueue;
} | [
"RequestQueue",
"<",
"ReadRequest",
">",
"getReadRequestQueue",
"(",
"FileIOChannel",
".",
"ID",
"channelID",
")",
"{",
"return",
"this",
".",
"readers",
"[",
"channelID",
".",
"getThreadNum",
"(",
")",
"]",
".",
"requestQueue",
";",
"}"
] | ------------------------------------------------------------------------- | [
"-------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java#L276-L278 | train | Get the request queue for a given channel ID. | [
30522,
5227,
4226,
5657,
1026,
3191,
2890,
15500,
1028,
2131,
16416,
16200,
15500,
4226,
5657,
1006,
5371,
3695,
26058,
1012,
8909,
3149,
3593,
1007,
1063,
2709,
2023,
1012,
8141,
1031,
3149,
3593,
1012,
2131,
2705,
16416,
2094,
19172,
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-optimizer/src/main/java/org/apache/flink/optimizer/costs/Costs.java | Costs.addHeuristicCpuCost | public void addHeuristicCpuCost(double cost) {
if (cost <= 0) {
throw new IllegalArgumentException("Heuristic costs must be positive.");
}
this.heuristicCpuCost += cost;
// check for overflow
if (this.heuristicCpuCost < 0) {
this.heuristicCpuCost = Double.MAX_VALUE;
}
} | java | public void addHeuristicCpuCost(double cost) {
if (cost <= 0) {
throw new IllegalArgumentException("Heuristic costs must be positive.");
}
this.heuristicCpuCost += cost;
// check for overflow
if (this.heuristicCpuCost < 0) {
this.heuristicCpuCost = Double.MAX_VALUE;
}
} | [
"public",
"void",
"addHeuristicCpuCost",
"(",
"double",
"cost",
")",
"{",
"if",
"(",
"cost",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Heuristic costs must be positive.\"",
")",
";",
"}",
"this",
".",
"heuristicCpuCost",
"+=",
"cos... | Adds the given heuristic CPU cost to the current heuristic CPU cost for this Costs object.
@param cost The heuristic CPU cost to add. | [
"Adds",
"the",
"given",
"heuristic",
"CPU",
"cost",
"to",
"the",
"current",
"heuristic",
"CPU",
"cost",
"for",
"this",
"Costs",
"object",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/costs/Costs.java#L292-L301 | train | Add the given heuristic cost to this cpu. | [
30522,
2270,
11675,
5587,
5369,
9496,
10074,
21906,
14194,
14122,
1006,
3313,
3465,
1007,
1063,
2065,
1006,
3465,
1026,
1027,
1014,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
2002,
9496,
10074,
5366,
2442,
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-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java | RequiredParameters.add | public void add(Option option) throws RequiredParametersException {
if (!this.data.containsKey(option.getName())) {
this.data.put(option.getName(), option);
} else {
throw new RequiredParametersException("Option with key " + option.getName() + " already exists.");
}
} | java | public void add(Option option) throws RequiredParametersException {
if (!this.data.containsKey(option.getName())) {
this.data.put(option.getName(), option);
} else {
throw new RequiredParametersException("Option with key " + option.getName() + " already exists.");
}
} | [
"public",
"void",
"add",
"(",
"Option",
"option",
")",
"throws",
"RequiredParametersException",
"{",
"if",
"(",
"!",
"this",
".",
"data",
".",
"containsKey",
"(",
"option",
".",
"getName",
"(",
")",
")",
")",
"{",
"this",
".",
"data",
".",
"put",
"(",
... | Add a parameter encapsulated in an {@link Option} object.
@param option - the parameter
@throws RequiredParametersException if an option with the same name is already defined | [
"Add",
"a",
"parameter",
"encapsulated",
"in",
"an",
"{",
"@link",
"Option",
"}",
"object",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java#L68-L74 | train | Add an option to the configuration. | [
30522,
2270,
11675,
5587,
1006,
5724,
5724,
1007,
11618,
3223,
28689,
22828,
3366,
2595,
24422,
1063,
2065,
1006,
999,
2023,
1012,
2951,
1012,
3397,
14839,
1006,
5724,
1012,
2131,
18442,
1006,
1007,
1007,
1007,
1063,
2023,
1012,
2951,
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-optimizer/src/main/java/org/apache/flink/optimizer/dataproperties/LocalProperties.java | LocalProperties.addUniqueFields | public LocalProperties addUniqueFields(FieldSet uniqueFields) {
LocalProperties copy = clone();
if (copy.uniqueFields == null) {
copy.uniqueFields = new HashSet<FieldSet>();
}
copy.uniqueFields.add(uniqueFields);
return copy;
} | java | public LocalProperties addUniqueFields(FieldSet uniqueFields) {
LocalProperties copy = clone();
if (copy.uniqueFields == null) {
copy.uniqueFields = new HashSet<FieldSet>();
}
copy.uniqueFields.add(uniqueFields);
return copy;
} | [
"public",
"LocalProperties",
"addUniqueFields",
"(",
"FieldSet",
"uniqueFields",
")",
"{",
"LocalProperties",
"copy",
"=",
"clone",
"(",
")",
";",
"if",
"(",
"copy",
".",
"uniqueFields",
"==",
"null",
")",
"{",
"copy",
".",
"uniqueFields",
"=",
"new",
"HashS... | Adds a combination of fields that are unique in these data properties.
@param uniqueFields The fields that are unique in these data properties. | [
"Adds",
"a",
"combination",
"of",
"fields",
"that",
"are",
"unique",
"in",
"these",
"data",
"properties",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dataproperties/LocalProperties.java#L101-L109 | train | Adds the given set of unique fields to the local properties. | [
30522,
2270,
2334,
21572,
4842,
7368,
5587,
19496,
4226,
15155,
1006,
4249,
3388,
4310,
15155,
1007,
1063,
2334,
21572,
4842,
7368,
6100,
1027,
17598,
1006,
1007,
1025,
2065,
1006,
6100,
1012,
4310,
15155,
1027,
1027,
19701,
1007,
1063,
610... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.get_possible_actions | void get_possible_actions(State source,
List<Action> actions)
{
if (0 == L || -1 == R)
{
System.err.println("decoder: not initialized, please check if the root dependency relation is correct set by --root.");
return;
}
actions.clear();
if (!source.buffer_empty())
{
actions.add(ActionFactory.make_shift());
}
if (source.stack_size() == 2)
{
if (source.buffer_empty())
{
actions.add(ActionFactory.make_right_arc(R));
}
}
else if (source.stack_size() > 2)
{
for (int l = 0; l < L; ++l)
{
if (l == R)
{
continue;
}
actions.add(ActionFactory.make_left_arc(l));
actions.add(ActionFactory.make_right_arc(l));
}
}
} | java | void get_possible_actions(State source,
List<Action> actions)
{
if (0 == L || -1 == R)
{
System.err.println("decoder: not initialized, please check if the root dependency relation is correct set by --root.");
return;
}
actions.clear();
if (!source.buffer_empty())
{
actions.add(ActionFactory.make_shift());
}
if (source.stack_size() == 2)
{
if (source.buffer_empty())
{
actions.add(ActionFactory.make_right_arc(R));
}
}
else if (source.stack_size() > 2)
{
for (int l = 0; l < L; ++l)
{
if (l == R)
{
continue;
}
actions.add(ActionFactory.make_left_arc(l));
actions.add(ActionFactory.make_right_arc(l));
}
}
} | [
"void",
"get_possible_actions",
"(",
"State",
"source",
",",
"List",
"<",
"Action",
">",
"actions",
")",
"{",
"if",
"(",
"0",
"==",
"L",
"||",
"-",
"1",
"==",
"R",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"decoder: not initialized, please c... | 获取当前状态可能的动作(动作=shift | left | right + 依存关系,也就是说是一条既有方向又有依存关系名称的依存边)
@param source 当前状态
@param actions 输出可能动作 | [
"获取当前状态可能的动作(动作",
"=",
"shift",
"|",
"left",
"|",
"right",
"+",
"依存关系,也就是说是一条既有方向又有依存关系名称的依存边)"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/TransitionSystem.java#L67-L101 | train | Get possible actions from the source state. | [
30522,
11675,
2131,
1035,
2825,
1035,
4506,
1006,
2110,
3120,
1010,
2862,
1026,
2895,
1028,
4506,
1007,
1063,
2065,
1006,
1014,
1027,
1027,
1048,
1064,
1064,
1011,
1015,
1027,
1027,
1054,
1007,
1063,
2291,
1012,
9413,
2099,
1012,
6140,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/firefox/FirefoxProfile.java | FirefoxProfile.onlyOverrideThisIfYouKnowWhatYouAreDoing | @Beta
protected Reader onlyOverrideThisIfYouKnowWhatYouAreDoing() {
URL resource = Resources.getResource(FirefoxProfile.class, defaultPrefs);
try {
return new InputStreamReader(resource.openStream());
} catch (IOException e) {
throw new WebDriverException(e);
}
} | java | @Beta
protected Reader onlyOverrideThisIfYouKnowWhatYouAreDoing() {
URL resource = Resources.getResource(FirefoxProfile.class, defaultPrefs);
try {
return new InputStreamReader(resource.openStream());
} catch (IOException e) {
throw new WebDriverException(e);
}
} | [
"@",
"Beta",
"protected",
"Reader",
"onlyOverrideThisIfYouKnowWhatYouAreDoing",
"(",
")",
"{",
"URL",
"resource",
"=",
"Resources",
".",
"getResource",
"(",
"FirefoxProfile",
".",
"class",
",",
"defaultPrefs",
")",
";",
"try",
"{",
"return",
"new",
"InputStreamRea... | <strong>Internal method. This is liable to change at a moment's notice.</strong>
@return InputStreamReader of the default firefox profile preferences | [
"<strong",
">",
"Internal",
"method",
".",
"This",
"is",
"liable",
"to",
"change",
"at",
"a",
"moment",
"s",
"notice",
".",
"<",
"/",
"strong",
">"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/firefox/FirefoxProfile.java#L112-L120 | train | This method is only called if you know what you are doing. | [
30522,
1030,
8247,
5123,
8068,
2069,
7840,
15637,
15222,
5332,
12031,
27967,
19779,
2860,
12707,
29337,
12069,
3527,
2075,
1006,
1007,
1063,
24471,
2140,
7692,
1027,
4219,
1012,
2131,
6072,
8162,
3401,
1006,
2543,
14876,
2595,
21572,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java | PropertiesMigrationReport.getWarningReport | public String getWarningReport() {
Map<String, List<PropertyMigration>> content = getContent(
LegacyProperties::getRenamed);
if (content.isEmpty()) {
return null;
}
StringBuilder report = new StringBuilder();
report.append(String.format("%nThe use of configuration keys that have been "
+ "renamed was found in the environment:%n%n"));
append(report, content);
report.append(String.format("%n"));
report.append("Each configuration key has been temporarily mapped to its "
+ "replacement for your convenience. To silence this warning, please "
+ "update your configuration to use the new keys.");
report.append(String.format("%n"));
return report.toString();
} | java | public String getWarningReport() {
Map<String, List<PropertyMigration>> content = getContent(
LegacyProperties::getRenamed);
if (content.isEmpty()) {
return null;
}
StringBuilder report = new StringBuilder();
report.append(String.format("%nThe use of configuration keys that have been "
+ "renamed was found in the environment:%n%n"));
append(report, content);
report.append(String.format("%n"));
report.append("Each configuration key has been temporarily mapped to its "
+ "replacement for your convenience. To silence this warning, please "
+ "update your configuration to use the new keys.");
report.append(String.format("%n"));
return report.toString();
} | [
"public",
"String",
"getWarningReport",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"List",
"<",
"PropertyMigration",
">",
">",
"content",
"=",
"getContent",
"(",
"LegacyProperties",
"::",
"getRenamed",
")",
";",
"if",
"(",
"content",
".",
"isEmpty",
"(",
")... | Return a report for all the properties that were automatically renamed. If no such
properties were found, return {@code null}.
@return a report with the configurations keys that should be renamed | [
"Return",
"a",
"report",
"for",
"all",
"the",
"properties",
"that",
"were",
"automatically",
"renamed",
".",
"If",
"no",
"such",
"properties",
"were",
"found",
"return",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReport.java#L42-L58 | train | Returns a string with a warning report for the configuration keys that have been renamed. | [
30522,
2270,
5164,
2131,
9028,
5582,
2890,
6442,
1006,
1007,
1063,
4949,
1026,
5164,
1010,
2862,
1026,
3200,
4328,
29397,
1028,
1028,
4180,
1027,
2131,
8663,
6528,
2102,
1006,
8027,
21572,
4842,
7368,
1024,
1024,
2131,
7389,
14074,
2094,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java | VectorizedParquetRecordReader.nextBatch | public boolean nextBatch() throws IOException {
for (WritableColumnVector vector : columnVectors) {
vector.reset();
}
columnarBatch.setNumRows(0);
if (rowsReturned >= totalRowCount) return false;
checkEndOfRowGroup();
int num = (int) Math.min((long) capacity, totalCountLoadedSoFar - rowsReturned);
for (int i = 0; i < columnReaders.length; ++i) {
if (columnReaders[i] == null) continue;
columnReaders[i].readBatch(num, columnVectors[i]);
}
rowsReturned += num;
columnarBatch.setNumRows(num);
numBatched = num;
batchIdx = 0;
return true;
} | java | public boolean nextBatch() throws IOException {
for (WritableColumnVector vector : columnVectors) {
vector.reset();
}
columnarBatch.setNumRows(0);
if (rowsReturned >= totalRowCount) return false;
checkEndOfRowGroup();
int num = (int) Math.min((long) capacity, totalCountLoadedSoFar - rowsReturned);
for (int i = 0; i < columnReaders.length; ++i) {
if (columnReaders[i] == null) continue;
columnReaders[i].readBatch(num, columnVectors[i]);
}
rowsReturned += num;
columnarBatch.setNumRows(num);
numBatched = num;
batchIdx = 0;
return true;
} | [
"public",
"boolean",
"nextBatch",
"(",
")",
"throws",
"IOException",
"{",
"for",
"(",
"WritableColumnVector",
"vector",
":",
"columnVectors",
")",
"{",
"vector",
".",
"reset",
"(",
")",
";",
"}",
"columnarBatch",
".",
"setNumRows",
"(",
"0",
")",
";",
"if"... | Advances to the next batch of rows. Returns false if there are no more. | [
"Advances",
"to",
"the",
"next",
"batch",
"of",
"rows",
".",
"Returns",
"false",
"if",
"there",
"are",
"no",
"more",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java#L250-L268 | train | Read the next batch of data. | [
30522,
2270,
22017,
20898,
2279,
14479,
2818,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
2005,
1006,
25697,
3085,
25778,
2819,
2078,
3726,
16761,
9207,
1024,
5930,
3726,
24817,
1007,
1063,
9207,
1012,
25141,
1006,
1007,
1025,
1065,
5930,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/LogFactory.java | LogFactory.getLog | public Log getLog(String name) {
Log log = logCache.get(name);
if (null == log) {
log = createLog(name);
logCache.put(name, log);
}
return log;
} | java | public Log getLog(String name) {
Log log = logCache.get(name);
if (null == log) {
log = createLog(name);
logCache.put(name, log);
}
return log;
} | [
"public",
"Log",
"getLog",
"(",
"String",
"name",
")",
"{",
"Log",
"log",
"=",
"logCache",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"null",
"==",
"log",
")",
"{",
"log",
"=",
"createLog",
"(",
"name",
")",
";",
"logCache",
".",
"put",
"(",
... | 获得日志对象
@param name 日志对象名
@return 日志对象 | [
"获得日志对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/LogFactory.java#L66-L73 | train | Gets the log with the given name. | [
30522,
2270,
8833,
2131,
21197,
1006,
5164,
2171,
1007,
1063,
8833,
8833,
1027,
8833,
3540,
5403,
1012,
2131,
1006,
2171,
1007,
1025,
2065,
1006,
19701,
1027,
1027,
8833,
1007,
1063,
8833,
1027,
3443,
21197,
1006,
2171,
1007,
1025,
8833,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeutils/CompositeTypeSerializerUtil.java | CompositeTypeSerializerUtil.setNestedSerializersSnapshots | public static void setNestedSerializersSnapshots(
CompositeTypeSerializerSnapshot<?, ?> compositeSnapshot,
TypeSerializerSnapshot<?>... nestedSnapshots) {
NestedSerializersSnapshotDelegate delegate = new NestedSerializersSnapshotDelegate(nestedSnapshots);
compositeSnapshot.setNestedSerializersSnapshotDelegate(delegate);
} | java | public static void setNestedSerializersSnapshots(
CompositeTypeSerializerSnapshot<?, ?> compositeSnapshot,
TypeSerializerSnapshot<?>... nestedSnapshots) {
NestedSerializersSnapshotDelegate delegate = new NestedSerializersSnapshotDelegate(nestedSnapshots);
compositeSnapshot.setNestedSerializersSnapshotDelegate(delegate);
} | [
"public",
"static",
"void",
"setNestedSerializersSnapshots",
"(",
"CompositeTypeSerializerSnapshot",
"<",
"?",
",",
"?",
">",
"compositeSnapshot",
",",
"TypeSerializerSnapshot",
"<",
"?",
">",
"...",
"nestedSnapshots",
")",
"{",
"NestedSerializersSnapshotDelegate",
"deleg... | Overrides the existing nested serializer's snapshots with the provided {@code nestedSnapshots}.
@param compositeSnapshot the composite snapshot to overwrite its nested serializers.
@param nestedSnapshots the nested snapshots to overwrite with. | [
"Overrides",
"the",
"existing",
"nested",
"serializer",
"s",
"snapshots",
"with",
"the",
"provided",
"{",
"@code",
"nestedSnapshots",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/CompositeTypeSerializerUtil.java#L61-L67 | train | Sets the serializers snapshots to be used for serialization. | [
30522,
2270,
10763,
11675,
2275,
5267,
3064,
8043,
4818,
17629,
4757,
2532,
4523,
12326,
2015,
1006,
12490,
13874,
8043,
4818,
17629,
2015,
2532,
4523,
12326,
1026,
1029,
1010,
1029,
1028,
12490,
2015,
2532,
4523,
12326,
1010,
4127,
11610,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Redisson.java | Redisson.createRx | public static RedissonRxClient createRx(Config config) {
RedissonRx react = new RedissonRx(config);
if (config.isReferenceEnabled()) {
react.enableRedissonReferenceSupport();
}
return react;
} | java | public static RedissonRxClient createRx(Config config) {
RedissonRx react = new RedissonRx(config);
if (config.isReferenceEnabled()) {
react.enableRedissonReferenceSupport();
}
return react;
} | [
"public",
"static",
"RedissonRxClient",
"createRx",
"(",
"Config",
"config",
")",
"{",
"RedissonRx",
"react",
"=",
"new",
"RedissonRx",
"(",
"config",
")",
";",
"if",
"(",
"config",
".",
"isReferenceEnabled",
"(",
")",
")",
"{",
"react",
".",
"enableRedisson... | Create Reactive Redisson instance with provided config
@param config for Redisson
@return Redisson instance | [
"Create",
"Reactive",
"Redisson",
"instance",
"with",
"provided",
"config"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/Redisson.java#L183-L189 | train | Create a RedissonRx client. | [
30522,
2270,
10763,
2417,
24077,
2099,
2595,
20464,
11638,
3443,
2099,
2595,
1006,
9530,
8873,
2290,
9530,
8873,
2290,
1007,
1063,
2417,
24077,
2099,
2595,
10509,
1027,
2047,
2417,
24077,
2099,
2595,
1006,
9530,
8873,
2290,
1007,
1025,
2065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsStateBackend.java | FsStateBackend.createKeyedStateBackend | @Override
public <K> AbstractKeyedStateBackend<K> createKeyedStateBackend(
Environment env,
JobID jobID,
String operatorIdentifier,
TypeSerializer<K> keySerializer,
int numberOfKeyGroups,
KeyGroupRange keyGroupRange,
TaskKvStateRegistry kvStateRegistry,
TtlTimeProvider ttlTimeProvider,
MetricGroup metricGroup,
@Nonnull Collection<KeyedStateHandle> stateHandles,
CloseableRegistry cancelStreamRegistry) throws BackendBuildingException {
TaskStateManager taskStateManager = env.getTaskStateManager();
LocalRecoveryConfig localRecoveryConfig = taskStateManager.createLocalRecoveryConfig();
HeapPriorityQueueSetFactory priorityQueueSetFactory =
new HeapPriorityQueueSetFactory(keyGroupRange, numberOfKeyGroups, 128);
return new HeapKeyedStateBackendBuilder<>(
kvStateRegistry,
keySerializer,
env.getUserClassLoader(),
numberOfKeyGroups,
keyGroupRange,
env.getExecutionConfig(),
ttlTimeProvider,
stateHandles,
AbstractStateBackend.getCompressionDecorator(env.getExecutionConfig()),
localRecoveryConfig,
priorityQueueSetFactory,
isUsingAsynchronousSnapshots(),
cancelStreamRegistry).build();
} | java | @Override
public <K> AbstractKeyedStateBackend<K> createKeyedStateBackend(
Environment env,
JobID jobID,
String operatorIdentifier,
TypeSerializer<K> keySerializer,
int numberOfKeyGroups,
KeyGroupRange keyGroupRange,
TaskKvStateRegistry kvStateRegistry,
TtlTimeProvider ttlTimeProvider,
MetricGroup metricGroup,
@Nonnull Collection<KeyedStateHandle> stateHandles,
CloseableRegistry cancelStreamRegistry) throws BackendBuildingException {
TaskStateManager taskStateManager = env.getTaskStateManager();
LocalRecoveryConfig localRecoveryConfig = taskStateManager.createLocalRecoveryConfig();
HeapPriorityQueueSetFactory priorityQueueSetFactory =
new HeapPriorityQueueSetFactory(keyGroupRange, numberOfKeyGroups, 128);
return new HeapKeyedStateBackendBuilder<>(
kvStateRegistry,
keySerializer,
env.getUserClassLoader(),
numberOfKeyGroups,
keyGroupRange,
env.getExecutionConfig(),
ttlTimeProvider,
stateHandles,
AbstractStateBackend.getCompressionDecorator(env.getExecutionConfig()),
localRecoveryConfig,
priorityQueueSetFactory,
isUsingAsynchronousSnapshots(),
cancelStreamRegistry).build();
} | [
"@",
"Override",
"public",
"<",
"K",
">",
"AbstractKeyedStateBackend",
"<",
"K",
">",
"createKeyedStateBackend",
"(",
"Environment",
"env",
",",
"JobID",
"jobID",
",",
"String",
"operatorIdentifier",
",",
"TypeSerializer",
"<",
"K",
">",
"keySerializer",
",",
"i... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsStateBackend.java#L457-L490 | train | Create a new instance of the HeapKeyedStateBackend interface. | [
30522,
1030,
2058,
15637,
2270,
1026,
1047,
1028,
10061,
14839,
2098,
9153,
2618,
5963,
10497,
1026,
1047,
1028,
3443,
14839,
2098,
9153,
2618,
5963,
10497,
1006,
4044,
4372,
2615,
1010,
3105,
3593,
3105,
3593,
1010,
5164,
6872,
5178,
16778... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.toRenderedImage | public static RenderedImage toRenderedImage(Image img) {
if (img instanceof RenderedImage) {
return (RenderedImage) img;
}
return copyImage(img, BufferedImage.TYPE_INT_RGB);
} | java | public static RenderedImage toRenderedImage(Image img) {
if (img instanceof RenderedImage) {
return (RenderedImage) img;
}
return copyImage(img, BufferedImage.TYPE_INT_RGB);
} | [
"public",
"static",
"RenderedImage",
"toRenderedImage",
"(",
"Image",
"img",
")",
"{",
"if",
"(",
"img",
"instanceof",
"RenderedImage",
")",
"{",
"return",
"(",
"RenderedImage",
")",
"img",
";",
"}",
"return",
"copyImage",
"(",
"img",
",",
"BufferedImage",
"... | {@link Image} 转 {@link RenderedImage}<br>
首先尝试强转,否则新建一个{@link BufferedImage}后重新绘制
@param img {@link Image}
@return {@link BufferedImage}
@since 4.3.2 | [
"{",
"@link",
"Image",
"}",
"转",
"{",
"@link",
"RenderedImage",
"}",
"<br",
">",
"首先尝试强转,否则新建一个",
"{",
"@link",
"BufferedImage",
"}",
"后重新绘制"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1143-L1149 | train | Converts an image to a rendered image. | [
30522,
2270,
10763,
10155,
9581,
3351,
9538,
11563,
2098,
9581,
3351,
1006,
3746,
10047,
2290,
1007,
1063,
2065,
1006,
10047,
2290,
6013,
11253,
10155,
9581,
3351,
1007,
1063,
2709,
1006,
10155,
9581,
3351,
1007,
10047,
2290,
1025,
1065,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java | BufferUtil.readStr | public static String readStr(ByteBuffer buffer, Charset charset) {
return StrUtil.str(readBytes(buffer), charset);
} | java | public static String readStr(ByteBuffer buffer, Charset charset) {
return StrUtil.str(readBytes(buffer), charset);
} | [
"public",
"static",
"String",
"readStr",
"(",
"ByteBuffer",
"buffer",
",",
"Charset",
"charset",
")",
"{",
"return",
"StrUtil",
".",
"str",
"(",
"readBytes",
"(",
"buffer",
")",
",",
"charset",
")",
";",
"}"
] | 读取剩余部分并转为字符串
@param buffer ByteBuffer
@param charset 编码
@return 字符串
@since 4.5.0 | [
"读取剩余部分并转为字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java#L89-L91 | train | Reads a string from the given buffer. | [
30522,
2270,
10763,
5164,
9631,
16344,
1006,
24880,
8569,
12494,
17698,
1010,
25869,
13462,
25869,
13462,
1007,
30524,
2099,
1006,
3191,
3762,
4570,
1006,
17698,
1007,
1010,
25869,
13462,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Page.java | Page.addOrder | public void addOrder(Order... orders) {
if(null != this.orders){
ArrayUtil.append(this.orders, orders);
}
this.orders = orders;
} | java | public void addOrder(Order... orders) {
if(null != this.orders){
ArrayUtil.append(this.orders, orders);
}
this.orders = orders;
} | [
"public",
"void",
"addOrder",
"(",
"Order",
"...",
"orders",
")",
"{",
"if",
"(",
"null",
"!=",
"this",
".",
"orders",
")",
"{",
"ArrayUtil",
".",
"append",
"(",
"this",
".",
"orders",
",",
"orders",
")",
";",
"}",
"this",
".",
"orders",
"=",
"orde... | 设置排序
@param orders 排序 | [
"设置排序"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Page.java#L123-L128 | train | Adds the given orders to the end of the list. | [
30522,
2270,
11675,
5587,
8551,
2121,
1006,
2344,
1012,
1012,
1012,
4449,
1007,
1063,
2065,
1006,
19701,
999,
1027,
2023,
1012,
4449,
1007,
1063,
9140,
21823,
2140,
1012,
10439,
10497,
1006,
2023,
1012,
4449,
1010,
4449,
1007,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java | NettyUtils.createEventLoop | public static EventLoopGroup createEventLoop(IOMode mode, int numThreads, String threadPrefix) {
ThreadFactory threadFactory = createThreadFactory(threadPrefix);
switch (mode) {
case NIO:
return new NioEventLoopGroup(numThreads, threadFactory);
case EPOLL:
return new EpollEventLoopGroup(numThreads, threadFactory);
default:
throw new IllegalArgumentException("Unknown io mode: " + mode);
}
} | java | public static EventLoopGroup createEventLoop(IOMode mode, int numThreads, String threadPrefix) {
ThreadFactory threadFactory = createThreadFactory(threadPrefix);
switch (mode) {
case NIO:
return new NioEventLoopGroup(numThreads, threadFactory);
case EPOLL:
return new EpollEventLoopGroup(numThreads, threadFactory);
default:
throw new IllegalArgumentException("Unknown io mode: " + mode);
}
} | [
"public",
"static",
"EventLoopGroup",
"createEventLoop",
"(",
"IOMode",
"mode",
",",
"int",
"numThreads",
",",
"String",
"threadPrefix",
")",
"{",
"ThreadFactory",
"threadFactory",
"=",
"createThreadFactory",
"(",
"threadPrefix",
")",
";",
"switch",
"(",
"mode",
"... | Creates a Netty EventLoopGroup based on the IOMode. | [
"Creates",
"a",
"Netty",
"EventLoopGroup",
"based",
"on",
"the",
"IOMode",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java#L61-L72 | train | Create an EventLoopGroup for the specified IO mode. | [
30522,
2270,
10763,
2724,
4135,
7361,
17058,
3443,
18697,
3372,
4135,
7361,
1006,
22834,
5302,
3207,
5549,
1010,
20014,
16371,
20492,
28362,
19303,
1010,
5164,
11689,
28139,
8873,
2595,
1007,
1063,
11689,
21450,
11689,
21450,
1027,
3443,
2705... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.countMap | public static <T> Map<T, Integer> countMap(Iterator<T> iter) {
final HashMap<T, Integer> countMap = new HashMap<>();
if (null != iter) {
Integer count;
T t;
while (iter.hasNext()) {
t = iter.next();
count = countMap.get(t);
if (null == count) {
countMap.put(t, 1);
} else {
countMap.put(t, count + 1);
}
}
}
return countMap;
} | java | public static <T> Map<T, Integer> countMap(Iterator<T> iter) {
final HashMap<T, Integer> countMap = new HashMap<>();
if (null != iter) {
Integer count;
T t;
while (iter.hasNext()) {
t = iter.next();
count = countMap.get(t);
if (null == count) {
countMap.put(t, 1);
} else {
countMap.put(t, count + 1);
}
}
}
return countMap;
} | [
"public",
"static",
"<",
"T",
">",
"Map",
"<",
"T",
",",
"Integer",
">",
"countMap",
"(",
"Iterator",
"<",
"T",
">",
"iter",
")",
"{",
"final",
"HashMap",
"<",
"T",
",",
"Integer",
">",
"countMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"if"... | 根据集合返回一个元素计数的 {@link Map}<br>
所谓元素计数就是假如这个集合中某个元素出现了n次,那将这个元素做为key,n做为value<br>
例如:[a,b,c,c,c] 得到:<br>
a: 1<br>
b: 1<br>
c: 3<br>
@param <T> 集合元素类型
@param iter {@link Iterator},如果为null返回一个空的Map
@return {@link Map} | [
"根据集合返回一个元素计数的",
"{",
"@link",
"Map",
"}",
"<br",
">",
"所谓元素计数就是假如这个集合中某个元素出现了n次,那将这个元素做为key,n做为value<br",
">",
"例如:",
"[",
"a",
"b",
"c",
"c",
"c",
"]",
"得到:<br",
">",
"a",
":",
"1<br",
">",
"b",
":",
"1<br",
">",
"c",
":",
"3<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L152-L168 | train | Returns a map of the number of unique attributes in the specified iterator. | [
30522,
2270,
10763,
1026,
1056,
1028,
4949,
1026,
1056,
1010,
16109,
1028,
4175,
2863,
2361,
1006,
2009,
6906,
4263,
1026,
1056,
1028,
2009,
2121,
1007,
1063,
2345,
23325,
2863,
2361,
1026,
1056,
1010,
16109,
1028,
4175,
2863,
2361,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/word2vec/TextFileCorpus.java | TextFileCorpus.readWord | String readWord(BufferedReader raf) throws IOException
{
while (true)
{
// check the buffer first
if (wbp < wordsBuffer.length)
{
return wordsBuffer[wbp++];
}
String line = raf.readLine();
if (line == null)
{ // end of corpus
eoc = true;
return null;
}
line = line.trim();
if (line.length() == 0)
{
continue;
}
cache.writeInt(-3); // mark end of sentence
wordsBuffer = line.split("\\s+");
wbp = 0;
eoc = false;
}
} | java | String readWord(BufferedReader raf) throws IOException
{
while (true)
{
// check the buffer first
if (wbp < wordsBuffer.length)
{
return wordsBuffer[wbp++];
}
String line = raf.readLine();
if (line == null)
{ // end of corpus
eoc = true;
return null;
}
line = line.trim();
if (line.length() == 0)
{
continue;
}
cache.writeInt(-3); // mark end of sentence
wordsBuffer = line.split("\\s+");
wbp = 0;
eoc = false;
}
} | [
"String",
"readWord",
"(",
"BufferedReader",
"raf",
")",
"throws",
"IOException",
"{",
"while",
"(",
"true",
")",
"{",
"// check the buffer first",
"if",
"(",
"wbp",
"<",
"wordsBuffer",
".",
"length",
")",
"{",
"return",
"wordsBuffer",
"[",
"wbp",
"++",
"]",... | Reads a single word from a file, assuming space + tab + EOL to be word boundaries
@param raf
@return null if EOF
@throws IOException | [
"Reads",
"a",
"single",
"word",
"from",
"a",
"file",
"assuming",
"space",
"+",
"tab",
"+",
"EOL",
"to",
"be",
"word",
"boundaries"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/TextFileCorpus.java#L184-L210 | train | readWord returns the next word from the reader | [
30522,
5164,
3191,
18351,
1006,
17698,
2098,
16416,
4063,
7148,
1007,
11618,
22834,
10288,
24422,
1063,
2096,
1006,
2995,
1007,
1063,
1013,
1013,
4638,
1996,
17698,
2034,
2065,
1006,
25610,
2361,
1026,
2616,
8569,
12494,
1012,
3091,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java | Router.allowedMethods | public Set<HttpMethod> allowedMethods(String uri) {
QueryStringDecoder decoder = new QueryStringDecoder(uri);
String[] tokens = PathPattern.removeSlashesAtBothEnds(decoder.path()).split("/");
if (anyMethodRouter.anyMatched(tokens)) {
return allAllowedMethods();
}
Set<HttpMethod> ret = new HashSet<HttpMethod>(routers.size());
for (Map.Entry<HttpMethod, MethodlessRouter<T>> entry : routers.entrySet()) {
MethodlessRouter<T> router = entry.getValue();
if (router.anyMatched(tokens)) {
HttpMethod method = entry.getKey();
ret.add(method);
}
}
return ret;
} | java | public Set<HttpMethod> allowedMethods(String uri) {
QueryStringDecoder decoder = new QueryStringDecoder(uri);
String[] tokens = PathPattern.removeSlashesAtBothEnds(decoder.path()).split("/");
if (anyMethodRouter.anyMatched(tokens)) {
return allAllowedMethods();
}
Set<HttpMethod> ret = new HashSet<HttpMethod>(routers.size());
for (Map.Entry<HttpMethod, MethodlessRouter<T>> entry : routers.entrySet()) {
MethodlessRouter<T> router = entry.getValue();
if (router.anyMatched(tokens)) {
HttpMethod method = entry.getKey();
ret.add(method);
}
}
return ret;
} | [
"public",
"Set",
"<",
"HttpMethod",
">",
"allowedMethods",
"(",
"String",
"uri",
")",
"{",
"QueryStringDecoder",
"decoder",
"=",
"new",
"QueryStringDecoder",
"(",
"uri",
")",
";",
"String",
"[",
"]",
"tokens",
"=",
"PathPattern",
".",
"removeSlashesAtBothEnds",
... | Returns allowed methods for a specific URI.
<p>For {@code OPTIONS *}, use {@link #allAllowedMethods()} instead of this method. | [
"Returns",
"allowed",
"methods",
"for",
"a",
"specific",
"URI",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java#L274-L292 | train | Returns the set of allowed HTTP methods for the given URI. | [
30522,
2270,
2275,
1026,
8299,
11368,
6806,
2094,
1028,
3039,
11368,
6806,
5104,
1006,
5164,
24471,
2072,
1007,
1063,
23032,
3367,
4892,
3207,
16044,
2099,
21933,
4063,
1027,
2047,
23032,
3367,
4892,
3207,
16044,
2099,
1006,
24471,
2072,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java | Router.targetToString | private static String targetToString(Object target) {
if (target instanceof Class) {
return ((Class<?>) target).getName();
} else {
return target.toString();
}
} | java | private static String targetToString(Object target) {
if (target instanceof Class) {
return ((Class<?>) target).getName();
} else {
return target.toString();
}
} | [
"private",
"static",
"String",
"targetToString",
"(",
"Object",
"target",
")",
"{",
"if",
"(",
"target",
"instanceof",
"Class",
")",
"{",
"return",
"(",
"(",
"Class",
"<",
"?",
">",
")",
"target",
")",
".",
"getName",
"(",
")",
";",
"}",
"else",
"{",... | Helper for toString.
<p>For example, returns
"io.netty.example.http.router.HttpRouterServerHandler" instead of
"class io.netty.example.http.router.HttpRouterServerHandler" | [
"Helper",
"for",
"toString",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java#L137-L143 | train | Returns the string representation of the target object. | [
30522,
2797,
10763,
5164,
4539,
13122,
18886,
3070,
1006,
4874,
4539,
1007,
1063,
2065,
1006,
4539,
6013,
11253,
2465,
1007,
1063,
2709,
1006,
1006,
2465,
1026,
1029,
1028,
1007,
4539,
1007,
1012,
2131,
18442,
1006,
1007,
1025,
1065,
2842,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-0.11/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer011.java | FlinkKafkaProducer011.flush | private void flush(KafkaTransactionState transaction) throws FlinkKafka011Exception {
if (transaction.producer != null) {
transaction.producer.flush();
}
long pendingRecordsCount = pendingRecords.get();
if (pendingRecordsCount != 0) {
throw new IllegalStateException("Pending record count must be zero at this point: " + pendingRecordsCount);
}
// if the flushed requests has errors, we should propagate it also and fail the checkpoint
checkErroneous();
} | java | private void flush(KafkaTransactionState transaction) throws FlinkKafka011Exception {
if (transaction.producer != null) {
transaction.producer.flush();
}
long pendingRecordsCount = pendingRecords.get();
if (pendingRecordsCount != 0) {
throw new IllegalStateException("Pending record count must be zero at this point: " + pendingRecordsCount);
}
// if the flushed requests has errors, we should propagate it also and fail the checkpoint
checkErroneous();
} | [
"private",
"void",
"flush",
"(",
"KafkaTransactionState",
"transaction",
")",
"throws",
"FlinkKafka011Exception",
"{",
"if",
"(",
"transaction",
".",
"producer",
"!=",
"null",
")",
"{",
"transaction",
".",
"producer",
".",
"flush",
"(",
")",
";",
"}",
"long",
... | Flush pending records.
@param transaction | [
"Flush",
"pending",
"records",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.11/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducer011.java#L775-L786 | train | Flushes the messages in the given transaction. | [
30522,
2797,
11675,
13862,
1006,
10556,
24316,
4017,
5521,
3736,
22014,
12259,
12598,
1007,
11618,
13109,
19839,
2912,
24316,
2050,
24096,
2487,
10288,
24422,
1063,
2065,
1006,
12598,
1012,
3135,
999,
1027,
19701,
1007,
1063,
12598,
1012,
313... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.get | public static ConditionEvaluationReport get(
ConfigurableListableBeanFactory beanFactory) {
synchronized (beanFactory) {
ConditionEvaluationReport report;
if (beanFactory.containsSingleton(BEAN_NAME)) {
report = beanFactory.getBean(BEAN_NAME, ConditionEvaluationReport.class);
}
else {
report = new ConditionEvaluationReport();
beanFactory.registerSingleton(BEAN_NAME, report);
}
locateParent(beanFactory.getParentBeanFactory(), report);
return report;
}
} | java | public static ConditionEvaluationReport get(
ConfigurableListableBeanFactory beanFactory) {
synchronized (beanFactory) {
ConditionEvaluationReport report;
if (beanFactory.containsSingleton(BEAN_NAME)) {
report = beanFactory.getBean(BEAN_NAME, ConditionEvaluationReport.class);
}
else {
report = new ConditionEvaluationReport();
beanFactory.registerSingleton(BEAN_NAME, report);
}
locateParent(beanFactory.getParentBeanFactory(), report);
return report;
}
} | [
"public",
"static",
"ConditionEvaluationReport",
"get",
"(",
"ConfigurableListableBeanFactory",
"beanFactory",
")",
"{",
"synchronized",
"(",
"beanFactory",
")",
"{",
"ConditionEvaluationReport",
"report",
";",
"if",
"(",
"beanFactory",
".",
"containsSingleton",
"(",
"B... | Obtain a {@link ConditionEvaluationReport} for the specified bean factory.
@param beanFactory the bean factory
@return an existing or new {@link ConditionEvaluationReport} | [
"Obtain",
"a",
"{"
] | 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#L182-L196 | train | Gets the condition evaluation report. | [
30522,
2270,
10763,
4650,
13331,
7630,
3370,
2890,
6442,
2131,
1006,
9530,
8873,
27390,
3085,
9863,
3085,
4783,
2319,
21450,
14068,
21450,
1007,
1063,
25549,
1006,
14068,
21450,
1007,
1063,
4650,
13331,
7630,
3370,
2890,
6442,
3189,
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... |
networknt/light-4j | client/src/main/java/com/networknt/client/Http2Client.java | Http2Client.connectAsync | public CompletableFuture<ClientConnection> connectAsync(URI uri) {
return this.connectAsync(null, uri, com.networknt.client.Http2Client.WORKER, com.networknt.client.Http2Client.SSL, com.networknt.client.Http2Client.BUFFER_POOL,
OptionMap.create(UndertowOptions.ENABLE_HTTP2, true));
} | java | public CompletableFuture<ClientConnection> connectAsync(URI uri) {
return this.connectAsync(null, uri, com.networknt.client.Http2Client.WORKER, com.networknt.client.Http2Client.SSL, com.networknt.client.Http2Client.BUFFER_POOL,
OptionMap.create(UndertowOptions.ENABLE_HTTP2, true));
} | [
"public",
"CompletableFuture",
"<",
"ClientConnection",
">",
"connectAsync",
"(",
"URI",
"uri",
")",
"{",
"return",
"this",
".",
"connectAsync",
"(",
"null",
",",
"uri",
",",
"com",
".",
"networknt",
".",
"client",
".",
"Http2Client",
".",
"WORKER",
",",
"... | Create async connection with default config value | [
"Create",
"async",
"connection",
"with",
"default",
"config",
"value"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/Http2Client.java#L714-L717 | train | Creates a new connection asynchronously. | [
30522,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
7396,
8663,
2638,
7542,
1028,
7532,
3022,
6038,
2278,
1006,
24471,
2072,
24471,
2072,
1007,
1063,
2709,
2023,
1012,
7532,
3022,
6038,
2278,
1006,
19701,
1010,
24471,
2072,
1010,
4012,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBNativeMetricMonitor.java | RocksDBNativeMetricMonitor.registerColumnFamily | void registerColumnFamily(String columnFamilyName, ColumnFamilyHandle handle) {
MetricGroup group = metricGroup.addGroup(columnFamilyName);
for (String property : options.getProperties()) {
RocksDBNativeMetricView gauge = new RocksDBNativeMetricView(handle, property);
group.gauge(property, gauge);
}
} | java | void registerColumnFamily(String columnFamilyName, ColumnFamilyHandle handle) {
MetricGroup group = metricGroup.addGroup(columnFamilyName);
for (String property : options.getProperties()) {
RocksDBNativeMetricView gauge = new RocksDBNativeMetricView(handle, property);
group.gauge(property, gauge);
}
} | [
"void",
"registerColumnFamily",
"(",
"String",
"columnFamilyName",
",",
"ColumnFamilyHandle",
"handle",
")",
"{",
"MetricGroup",
"group",
"=",
"metricGroup",
".",
"addGroup",
"(",
"columnFamilyName",
")",
";",
"for",
"(",
"String",
"property",
":",
"options",
".",... | Register gauges to pull native metrics for the column family.
@param columnFamilyName group name for the new gauges
@param handle native handle to the column family | [
"Register",
"gauges",
"to",
"pull",
"native",
"metrics",
"for",
"the",
"column",
"family",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBNativeMetricMonitor.java#L73-L80 | train | Register a column family with the RocksDB native metric. | [
30522,
11675,
4236,
25778,
2819,
2078,
7011,
4328,
2135,
1006,
5164,
5930,
7011,
4328,
9644,
14074,
1010,
5930,
7011,
4328,
2135,
11774,
2571,
5047,
1007,
1063,
12046,
17058,
2177,
1027,
12046,
17058,
1012,
5587,
17058,
1006,
5930,
7011,
43... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/experimental/SocketStreamIterator.java | SocketStreamIterator.hasNext | @Override
public boolean hasNext() {
if (next == null) {
try {
next = readNextFromStream();
} catch (Exception e) {
throw new RuntimeException("Failed to receive next element: " + e.getMessage(), e);
}
}
return next != null;
} | java | @Override
public boolean hasNext() {
if (next == null) {
try {
next = readNextFromStream();
} catch (Exception e) {
throw new RuntimeException("Failed to receive next element: " + e.getMessage(), e);
}
}
return next != null;
} | [
"@",
"Override",
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"if",
"(",
"next",
"==",
"null",
")",
"{",
"try",
"{",
"next",
"=",
"readNextFromStream",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
... | Returns true if the DataStream has more elements.
(Note: blocks if there will be more elements, but they are not available yet.)
@return true if the DataStream has more elements | [
"Returns",
"true",
"if",
"the",
"DataStream",
"has",
"more",
"elements",
".",
"(",
"Note",
":",
"blocks",
"if",
"there",
"will",
"be",
"more",
"elements",
"but",
"they",
"are",
"not",
"available",
"yet",
".",
")"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/experimental/SocketStreamIterator.java#L130-L141 | train | Returns true if there is more elements in the stream. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
8440,
10288,
2102,
1006,
1007,
1063,
2065,
1006,
2279,
1027,
1027,
19701,
1007,
1063,
3046,
1063,
2279,
1027,
3191,
2638,
18413,
19699,
22225,
25379,
1006,
1007,
1025,
1065,
4608,
1006,
6453,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dependency/CoNll/CoNLLSentence.java | CoNLLSentence.findChildren | public List<CoNLLWord> findChildren(CoNLLWord word)
{
List<CoNLLWord> result = new LinkedList<CoNLLWord>();
for (CoNLLWord other : this)
{
if (other.HEAD == word)
result.add(other);
}
return result;
} | java | public List<CoNLLWord> findChildren(CoNLLWord word)
{
List<CoNLLWord> result = new LinkedList<CoNLLWord>();
for (CoNLLWord other : this)
{
if (other.HEAD == word)
result.add(other);
}
return result;
} | [
"public",
"List",
"<",
"CoNLLWord",
">",
"findChildren",
"(",
"CoNLLWord",
"word",
")",
"{",
"List",
"<",
"CoNLLWord",
">",
"result",
"=",
"new",
"LinkedList",
"<",
"CoNLLWord",
">",
"(",
")",
";",
"for",
"(",
"CoNLLWord",
"other",
":",
"this",
")",
"{... | 找出所有子节点
@param word
@return | [
"找出所有子节点"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dependency/CoNll/CoNLLSentence.java#L137-L146 | train | Find all children of a given word. | [
30522,
2270,
2862,
1026,
9530,
3363,
18351,
1028,
2424,
19339,
7389,
1006,
9530,
3363,
18351,
2773,
1007,
1063,
2862,
1026,
9530,
3363,
18351,
1028,
2765,
1027,
2047,
5799,
9863,
1026,
9530,
3363,
18351,
1028,
1006,
1007,
1025,
2005,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.attributeToBe | public static ExpectedCondition<Boolean> attributeToBe(final By locator, final String attribute,
final String value) {
return new ExpectedCondition<Boolean>() {
private String currentValue = null;
@Override
public Boolean apply(WebDriver driver) {
WebElement element = driver.findElement(locator);
currentValue = element.getAttribute(attribute);
if (currentValue == null||currentValue.isEmpty()) {
currentValue = element.getCssValue(attribute);
}
return value.equals(currentValue);
}
@Override
public String toString() {
return String.format("element found by %s to have value \"%s\". Current value: \"%s\"",
locator, value, currentValue);
}
};
} | java | public static ExpectedCondition<Boolean> attributeToBe(final By locator, final String attribute,
final String value) {
return new ExpectedCondition<Boolean>() {
private String currentValue = null;
@Override
public Boolean apply(WebDriver driver) {
WebElement element = driver.findElement(locator);
currentValue = element.getAttribute(attribute);
if (currentValue == null||currentValue.isEmpty()) {
currentValue = element.getCssValue(attribute);
}
return value.equals(currentValue);
}
@Override
public String toString() {
return String.format("element found by %s to have value \"%s\". Current value: \"%s\"",
locator, value, currentValue);
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"Boolean",
">",
"attributeToBe",
"(",
"final",
"By",
"locator",
",",
"final",
"String",
"attribute",
",",
"final",
"String",
"value",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"Boolean",
">",
"(",
")",
... | An expectation for checking WebElement with given locator has attribute with a specific value
@param locator used to find the element
@param attribute used to define css or html attribute
@param value used as expected attribute value
@return Boolean true when element has css or html attribute with the value | [
"An",
"expectation",
"for",
"checking",
"WebElement",
"with",
"given",
"locator",
"has",
"attribute",
"with",
"a",
"specific",
"value"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L870-L891 | train | An expectation for checking WebElement with given locator has attribute with given value | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
17961,
3406,
4783,
1006,
2345,
2011,
8840,
11266,
2953,
1010,
2345,
5164,
17961,
1010,
2345,
5164,
3643,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
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-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/typeutils/BinaryRowSerializer.java | BinaryRowSerializer.copyFromPagesToView | public void copyFromPagesToView(
AbstractPagedInputView source, DataOutputView target) throws IOException {
checkSkipReadForFixLengthPart(source);
int length = source.readInt();
target.writeInt(length);
target.write(source, length);
} | java | public void copyFromPagesToView(
AbstractPagedInputView source, DataOutputView target) throws IOException {
checkSkipReadForFixLengthPart(source);
int length = source.readInt();
target.writeInt(length);
target.write(source, length);
} | [
"public",
"void",
"copyFromPagesToView",
"(",
"AbstractPagedInputView",
"source",
",",
"DataOutputView",
"target",
")",
"throws",
"IOException",
"{",
"checkSkipReadForFixLengthPart",
"(",
"source",
")",
";",
"int",
"length",
"=",
"source",
".",
"readInt",
"(",
")",
... | Copy a binaryRow which stored in paged input view to output view.
@param source source paged input view where the binary row stored
@param target the target output view. | [
"Copy",
"a",
"binaryRow",
"which",
"stored",
"in",
"paged",
"input",
"view",
"to",
"output",
"view",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/typeutils/BinaryRowSerializer.java#L209-L215 | train | Copy the contents of the given pages to the given output view. | [
30522,
2270,
11675,
6100,
19699,
25377,
13923,
26525,
2666,
2860,
1006,
10061,
13704,
8718,
18780,
8584,
3120,
1010,
2951,
30524,
4539,
1012,
4339,
1006,
3120,
1010,
3091,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AsyncDataStream.java | AsyncDataStream.orderedWait | public static <IN, OUT> SingleOutputStreamOperator<OUT> orderedWait(
DataStream<IN> in,
AsyncFunction<IN, OUT> func,
long timeout,
TimeUnit timeUnit,
int capacity) {
return addOperator(in, func, timeUnit.toMillis(timeout), capacity, OutputMode.ORDERED);
} | java | public static <IN, OUT> SingleOutputStreamOperator<OUT> orderedWait(
DataStream<IN> in,
AsyncFunction<IN, OUT> func,
long timeout,
TimeUnit timeUnit,
int capacity) {
return addOperator(in, func, timeUnit.toMillis(timeout), capacity, OutputMode.ORDERED);
} | [
"public",
"static",
"<",
"IN",
",",
"OUT",
">",
"SingleOutputStreamOperator",
"<",
"OUT",
">",
"orderedWait",
"(",
"DataStream",
"<",
"IN",
">",
"in",
",",
"AsyncFunction",
"<",
"IN",
",",
"OUT",
">",
"func",
",",
"long",
"timeout",
",",
"TimeUnit",
"tim... | Add an AsyncWaitOperator. The order to process input records is guaranteed to be the same as
input ones.
@param in Input {@link DataStream}
@param func {@link AsyncFunction}
@param timeout for the asynchronous operation to complete
@param timeUnit of the given timeout
@param capacity The max number of async i/o operation that can be triggered
@param <IN> Type of input record
@param <OUT> Type of output record
@return A new {@link SingleOutputStreamOperator}. | [
"Add",
"an",
"AsyncWaitOperator",
".",
"The",
"order",
"to",
"process",
"input",
"records",
"is",
"guaranteed",
"to",
"be",
"the",
"same",
"as",
"input",
"ones",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AsyncDataStream.java#L147-L154 | train | Create an ordered wait operator. | [
30522,
2270,
10763,
1026,
1999,
1010,
2041,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
2041,
1028,
3641,
21547,
2102,
1006,
2951,
21422,
1026,
1999,
1028,
1999,
1010,
2004,
6038,
2278,
11263,
27989,
1026,
1999,
1010,
2041,
1028,
456... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.findOne | public static <T> T findOne(Iterable<T> collection, Filter<T> filter) {
if (null != collection) {
for (T t : collection) {
if (filter.accept(t)) {
return t;
}
}
}
return null;
} | java | public static <T> T findOne(Iterable<T> collection, Filter<T> filter) {
if (null != collection) {
for (T t : collection) {
if (filter.accept(t)) {
return t;
}
}
}
return null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"findOne",
"(",
"Iterable",
"<",
"T",
">",
"collection",
",",
"Filter",
"<",
"T",
">",
"filter",
")",
"{",
"if",
"(",
"null",
"!=",
"collection",
")",
"{",
"for",
"(",
"T",
"t",
":",
"collection",
")",
"{",... | 查找第一个匹配元素对象
@param <T> 集合元素类型
@param collection 集合
@param filter 过滤器,满足过滤条件的第一个元素将被返回
@return 满足过滤条件的第一个元素
@since 3.1.0 | [
"查找第一个匹配元素对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1211-L1220 | train | Returns the first object matching the criteria specified in the passed in filter. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
2424,
5643,
1006,
2009,
6906,
3468,
1026,
1056,
1028,
3074,
1010,
11307,
1026,
1056,
1028,
11307,
1007,
1063,
2065,
1006,
19701,
999,
1027,
3074,
1007,
1063,
2005,
1006,
1056,
1056,
1024,
3074,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/Native.java | Native.epollBusyWait | public static int epollBusyWait(FileDescriptor epollFd, EpollEventArray events) throws IOException {
int ready = epollBusyWait0(epollFd.intValue(), events.memoryAddress(), events.length());
if (ready < 0) {
throw newIOException("epoll_wait", ready);
}
return ready;
} | java | public static int epollBusyWait(FileDescriptor epollFd, EpollEventArray events) throws IOException {
int ready = epollBusyWait0(epollFd.intValue(), events.memoryAddress(), events.length());
if (ready < 0) {
throw newIOException("epoll_wait", ready);
}
return ready;
} | [
"public",
"static",
"int",
"epollBusyWait",
"(",
"FileDescriptor",
"epollFd",
",",
"EpollEventArray",
"events",
")",
"throws",
"IOException",
"{",
"int",
"ready",
"=",
"epollBusyWait0",
"(",
"epollFd",
".",
"intValue",
"(",
")",
",",
"events",
".",
"memoryAddres... | Non-blocking variant of
{@link #epollWait(FileDescriptor, EpollEventArray, FileDescriptor, int, int)}
that will also hint to processor we are in a busy-wait loop. | [
"Non",
"-",
"blocking",
"variant",
"of",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/Native.java#L128-L134 | train | Wait for an array of events to be ready. | [
30522,
2270,
10763,
20014,
4958,
14511,
8286,
2100,
21547,
2102,
1006,
6406,
2229,
23235,
2953,
4958,
14511,
2546,
2094,
1010,
4958,
14511,
18697,
12380,
11335,
2100,
2824,
1007,
11618,
22834,
10288,
24422,
1063,
20014,
3201,
1027,
4958,
1451... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HttpUtil.java | HttpUtil.isAsteriskForm | public static boolean isAsteriskForm(URI uri) {
return "*".equals(uri.getPath()) &&
uri.getScheme() == null && uri.getSchemeSpecificPart() == null &&
uri.getHost() == null && uri.getAuthority() == null && uri.getQuery() == null &&
uri.getFragment() == null;
} | java | public static boolean isAsteriskForm(URI uri) {
return "*".equals(uri.getPath()) &&
uri.getScheme() == null && uri.getSchemeSpecificPart() == null &&
uri.getHost() == null && uri.getAuthority() == null && uri.getQuery() == null &&
uri.getFragment() == null;
} | [
"public",
"static",
"boolean",
"isAsteriskForm",
"(",
"URI",
"uri",
")",
"{",
"return",
"\"*\"",
".",
"equals",
"(",
"uri",
".",
"getPath",
"(",
")",
")",
"&&",
"uri",
".",
"getScheme",
"(",
")",
"==",
"null",
"&&",
"uri",
".",
"getSchemeSpecificPart",
... | Determine if a uri is in asterisk-form according to
<a href="https://tools.ietf.org/html/rfc7230#section-5.3">rfc7230, 5.3</a>. | [
"Determine",
"if",
"a",
"uri",
"is",
"in",
"asterisk",
"-",
"form",
"according",
"to",
"<a",
"href",
"=",
"https",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc7230#section",
"-",
"5",
".",
"3",
">",
"rfc7230",
"5",
".",
"3<",... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java#L53-L58 | train | Checks if the URI is a S3 Asterisk form URI. | [
30522,
2270,
10763,
22017,
20898,
18061,
6238,
20573,
14192,
1006,
24471,
2072,
24471,
2072,
1007,
1063,
2709,
1000,
1008,
1000,
1012,
19635,
1006,
24471,
2072,
1012,
2131,
15069,
1006,
1007,
1007,
1004,
1004,
24471,
2072,
1012,
4152,
5403,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTags.java | WebFluxTags.status | public static Tag status(ServerWebExchange exchange) {
HttpStatus status = exchange.getResponse().getStatusCode();
if (status == null) {
status = HttpStatus.OK;
}
return Tag.of("status", String.valueOf(status.value()));
} | java | public static Tag status(ServerWebExchange exchange) {
HttpStatus status = exchange.getResponse().getStatusCode();
if (status == null) {
status = HttpStatus.OK;
}
return Tag.of("status", String.valueOf(status.value()));
} | [
"public",
"static",
"Tag",
"status",
"(",
"ServerWebExchange",
"exchange",
")",
"{",
"HttpStatus",
"status",
"=",
"exchange",
".",
"getResponse",
"(",
")",
".",
"getStatusCode",
"(",
")",
";",
"if",
"(",
"status",
"==",
"null",
")",
"{",
"status",
"=",
"... | Creates a {@code status} tag based on the response status of the given
{@code exchange}.
@param exchange the exchange
@return the status tag derived from the response status | [
"Creates",
"a",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTags.java#L81-L87 | train | Get the status code from the response | [
30522,
2270,
10763,
6415,
3570,
1006,
8241,
8545,
4783,
2595,
22305,
2063,
3863,
1007,
1063,
16770,
29336,
2271,
3570,
1027,
3863,
1012,
2131,
6072,
26029,
3366,
1006,
1007,
1012,
4152,
29336,
2271,
16044,
1006,
1007,
1025,
2065,
1006,
3570... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/dialect/DialectFactory.java | DialectFactory.identifyDriver | public static String identifyDriver(String nameContainsProductInfo) {
if (StrUtil.isBlank(nameContainsProductInfo)) {
return null;
}
// 全部转为小写,忽略大小写
nameContainsProductInfo = StrUtil.cleanBlank(nameContainsProductInfo.toLowerCase());
String driver = null;
if (nameContainsProductInfo.contains("mysql")) {
driver = ClassLoaderUtil.isPresent(DRIVER_MYSQL_V6) ? DRIVER_MYSQL_V6 : DRIVER_MYSQL;
} else if (nameContainsProductInfo.contains("oracle")) {
driver = ClassLoaderUtil.isPresent(DRIVER_ORACLE) ? DRIVER_ORACLE : DRIVER_ORACLE_OLD;
} else if (nameContainsProductInfo.contains("postgresql")) {
driver = DRIVER_POSTGRESQL;
} else if (nameContainsProductInfo.contains("sqlite")) {
driver = DRIVER_SQLLITE3;
} else if (nameContainsProductInfo.contains("sqlserver")) {
driver = DRIVER_SQLSERVER;
} else if (nameContainsProductInfo.contains("hive")) {
driver = DRIVER_HIVE;
} else if (nameContainsProductInfo.contains("h2")) {
driver = DRIVER_H2;
} else if (nameContainsProductInfo.startsWith("jdbc:derby://")) {
// Derby数据库网络连接方式
driver = DRIVER_DERBY;
} else if (nameContainsProductInfo.contains("derby")) {
// 嵌入式Derby数据库
driver = DRIVER_DERBY_EMBEDDED;
} else if (nameContainsProductInfo.contains("hsqldb")) {
// HSQLDB
driver = DRIVER_HSQLDB;
} else if (nameContainsProductInfo.contains("dm")) {
// 达梦7
driver = DRIVER_DM7;
}
return driver;
} | java | public static String identifyDriver(String nameContainsProductInfo) {
if (StrUtil.isBlank(nameContainsProductInfo)) {
return null;
}
// 全部转为小写,忽略大小写
nameContainsProductInfo = StrUtil.cleanBlank(nameContainsProductInfo.toLowerCase());
String driver = null;
if (nameContainsProductInfo.contains("mysql")) {
driver = ClassLoaderUtil.isPresent(DRIVER_MYSQL_V6) ? DRIVER_MYSQL_V6 : DRIVER_MYSQL;
} else if (nameContainsProductInfo.contains("oracle")) {
driver = ClassLoaderUtil.isPresent(DRIVER_ORACLE) ? DRIVER_ORACLE : DRIVER_ORACLE_OLD;
} else if (nameContainsProductInfo.contains("postgresql")) {
driver = DRIVER_POSTGRESQL;
} else if (nameContainsProductInfo.contains("sqlite")) {
driver = DRIVER_SQLLITE3;
} else if (nameContainsProductInfo.contains("sqlserver")) {
driver = DRIVER_SQLSERVER;
} else if (nameContainsProductInfo.contains("hive")) {
driver = DRIVER_HIVE;
} else if (nameContainsProductInfo.contains("h2")) {
driver = DRIVER_H2;
} else if (nameContainsProductInfo.startsWith("jdbc:derby://")) {
// Derby数据库网络连接方式
driver = DRIVER_DERBY;
} else if (nameContainsProductInfo.contains("derby")) {
// 嵌入式Derby数据库
driver = DRIVER_DERBY_EMBEDDED;
} else if (nameContainsProductInfo.contains("hsqldb")) {
// HSQLDB
driver = DRIVER_HSQLDB;
} else if (nameContainsProductInfo.contains("dm")) {
// 达梦7
driver = DRIVER_DM7;
}
return driver;
} | [
"public",
"static",
"String",
"identifyDriver",
"(",
"String",
"nameContainsProductInfo",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"nameContainsProductInfo",
")",
")",
"{",
"return",
"null",
";",
"}",
"// 全部转为小写,忽略大小写\r",
"nameContainsProductInfo",
"=",
... | 通过JDBC URL等信息识别JDBC驱动名
@param nameContainsProductInfo 包含数据库标识的字符串
@return 驱动 | [
"通过JDBC",
"URL等信息识别JDBC驱动名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/dialect/DialectFactory.java#L109-L146 | train | Identify the driver name from the product info. | [
30522,
2270,
10763,
5164,
6709,
23663,
2099,
1006,
5164,
2171,
8663,
18249,
13102,
14127,
14194,
7629,
14876,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
2171,
8663,
18249,
13102,
14127,
14194,
7629,
14876,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.