repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/array/LongArray.java | LongArray.set | public void set(int index, long value) {
assert index >= 0 : "index (" + index + ") should >= 0";
assert index < length : "index (" + index + ") should < length (" + length + ")";
Platform.putLong(baseObj, baseOffset + index * WIDTH, value);
} | java | public void set(int index, long value) {
assert index >= 0 : "index (" + index + ") should >= 0";
assert index < length : "index (" + index + ") should < length (" + length + ")";
Platform.putLong(baseObj, baseOffset + index * WIDTH, value);
} | [
"public",
"void",
"set",
"(",
"int",
"index",
",",
"long",
"value",
")",
"{",
"assert",
"index",
">=",
"0",
":",
"\"index (\"",
"+",
"index",
"+",
"\") should >= 0\"",
";",
"assert",
"index",
"<",
"length",
":",
"\"index (\"",
"+",
"index",
"+",
"\") sho... | Sets the value at position {@code index}. | [
"Sets",
"the",
"value",
"at",
"position",
"{"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/array/LongArray.java#L80-L84 | train | Set a long value in the surrogate. | [
30522,
2270,
11675,
2275,
1006,
20014,
5950,
1010,
2146,
3643,
1007,
1063,
20865,
5950,
1028,
1027,
1014,
1024,
1000,
5950,
1006,
1000,
1009,
5950,
1009,
1000,
1007,
2323,
1028,
1027,
1014,
1000,
1025,
20865,
5950,
1026,
3091,
1024,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java | RuntimeUtil.getErrorResult | public static String getErrorResult(Process process, Charset charset) {
InputStream in = null;
try {
in = process.getErrorStream();
return IoUtil.read(in, charset);
} finally {
IoUtil.close(in);
destroy(process);
}
} | java | public static String getErrorResult(Process process, Charset charset) {
InputStream in = null;
try {
in = process.getErrorStream();
return IoUtil.read(in, charset);
} finally {
IoUtil.close(in);
destroy(process);
}
} | [
"public",
"static",
"String",
"getErrorResult",
"(",
"Process",
"process",
",",
"Charset",
"charset",
")",
"{",
"InputStream",
"in",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"process",
".",
"getErrorStream",
"(",
")",
";",
"return",
"IoUtil",
".",
"read",
... | 获取命令执行异常结果,获取后销毁进程
@param process {@link Process} 进程
@param charset 编码
@return 命令执行结果列表
@since 4.1.21 | [
"获取命令执行异常结果,获取后销毁进程"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java#L221-L230 | train | Reads the error result from the process. | [
30522,
2270,
10763,
5164,
2131,
2121,
29165,
6072,
11314,
1006,
2832,
2832,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
20407,
25379,
1999,
1027,
19701,
1025,
3046,
1063,
1999,
1027,
2832,
1012,
2131,
2121,
29165,
21422,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/async/CompletedOperationCache.java | CompletedOperationCache.registerOngoingOperation | public void registerOngoingOperation(
final K operationKey,
final CompletableFuture<R> operationResultFuture) {
final ResultAccessTracker<R> inProgress = ResultAccessTracker.inProgress();
registeredOperationTriggers.put(operationKey, inProgress);
operationResultFuture.whenComplete((result, error) -> {
if (error == null) {
completedOperations.put(operationKey, inProgress.finishOperation(Either.Right(result)));
} else {
completedOperations.put(operationKey, inProgress.finishOperation(Either.Left(error)));
}
registeredOperationTriggers.remove(operationKey);
});
} | java | public void registerOngoingOperation(
final K operationKey,
final CompletableFuture<R> operationResultFuture) {
final ResultAccessTracker<R> inProgress = ResultAccessTracker.inProgress();
registeredOperationTriggers.put(operationKey, inProgress);
operationResultFuture.whenComplete((result, error) -> {
if (error == null) {
completedOperations.put(operationKey, inProgress.finishOperation(Either.Right(result)));
} else {
completedOperations.put(operationKey, inProgress.finishOperation(Either.Left(error)));
}
registeredOperationTriggers.remove(operationKey);
});
} | [
"public",
"void",
"registerOngoingOperation",
"(",
"final",
"K",
"operationKey",
",",
"final",
"CompletableFuture",
"<",
"R",
">",
"operationResultFuture",
")",
"{",
"final",
"ResultAccessTracker",
"<",
"R",
">",
"inProgress",
"=",
"ResultAccessTracker",
".",
"inPro... | Registers an ongoing operation with the cache.
@param operationResultFuture A future containing the operation result. | [
"Registers",
"an",
"ongoing",
"operation",
"with",
"the",
"cache",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/async/CompletedOperationCache.java#L106-L119 | train | Registers an operation with the result access tracker. | [
30522,
2270,
11675,
4236,
5063,
28765,
3995,
29487,
1006,
2345,
1047,
3169,
14839,
1010,
2345,
4012,
10814,
10880,
11263,
11244,
1026,
1054,
1028,
3169,
6072,
11314,
11263,
11244,
1007,
1063,
2345,
2765,
6305,
9623,
20528,
9102,
1026,
1054,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSink.java | GenericWriteAheadSink.cleanRestoredHandles | private void cleanRestoredHandles() throws Exception {
synchronized (pendingCheckpoints) {
Iterator<PendingCheckpoint> pendingCheckpointIt = pendingCheckpoints.iterator();
while (pendingCheckpointIt.hasNext()) {
PendingCheckpoint pendingCheckpoint = pendingCheckpointIt.next();
if (committer.isCheckpointCommitted(pendingCheckpoint.subtaskId, pendingCheckpoint.checkpointId)) {
pendingCheckpoint.stateHandle.discardState();
pendingCheckpointIt.remove();
}
}
}
} | java | private void cleanRestoredHandles() throws Exception {
synchronized (pendingCheckpoints) {
Iterator<PendingCheckpoint> pendingCheckpointIt = pendingCheckpoints.iterator();
while (pendingCheckpointIt.hasNext()) {
PendingCheckpoint pendingCheckpoint = pendingCheckpointIt.next();
if (committer.isCheckpointCommitted(pendingCheckpoint.subtaskId, pendingCheckpoint.checkpointId)) {
pendingCheckpoint.stateHandle.discardState();
pendingCheckpointIt.remove();
}
}
}
} | [
"private",
"void",
"cleanRestoredHandles",
"(",
")",
"throws",
"Exception",
"{",
"synchronized",
"(",
"pendingCheckpoints",
")",
"{",
"Iterator",
"<",
"PendingCheckpoint",
">",
"pendingCheckpointIt",
"=",
"pendingCheckpoints",
".",
"iterator",
"(",
")",
";",
"while"... | Called at {@link #open()} to clean-up the pending handle list.
It iterates over all restored pending handles, checks which ones are already
committed to the outside storage system and removes them from the list. | [
"Called",
"at",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSink.java#L191-L204 | train | Clean up any pending checkpoints that have been committed. | [
30522,
2797,
11675,
4550,
28533,
19574,
11774,
4244,
1006,
1007,
11618,
6453,
1063,
25549,
1006,
14223,
5403,
3600,
26521,
1007,
1063,
2009,
6906,
4263,
1026,
14223,
5403,
3600,
8400,
1028,
14223,
5403,
3600,
8400,
4183,
1027,
14223,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.setIntHeader | @Deprecated
public static void setIntHeader(HttpMessage message, String name, Iterable<Integer> values) {
message.headers().set(name, values);
} | java | @Deprecated
public static void setIntHeader(HttpMessage message, String name, Iterable<Integer> values) {
message.headers().set(name, values);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"setIntHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
",",
"Iterable",
"<",
"Integer",
">",
"values",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"set",
"(",
"name",
",",
"values",
")... | @deprecated Use {@link #set(CharSequence, Iterable)} instead.
@see #setIntHeader(HttpMessage, CharSequence, Iterable) | [
"@deprecated",
"Use",
"{",
"@link",
"#set",
"(",
"CharSequence",
"Iterable",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L785-L788 | train | Sets the value of a HTTP header. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
11675,
2275,
18447,
4974,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
5164,
2171,
1010,
2009,
6906,
3468,
1026,
16109,
1028,
5300,
1007,
1063,
4471,
1012,
20346,
2015,
1006,
1007,
1012,
2275... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBufferAccessor.java | SharedBufferAccessor.removeNode | private void removeNode(NodeId node, SharedBufferNode sharedBufferNode) throws Exception {
sharedBuffer.removeEntry(node);
EventId eventId = node.getEventId();
releaseEvent(eventId);
for (SharedBufferEdge sharedBufferEdge : sharedBufferNode.getEdges()) {
releaseNode(sharedBufferEdge.getTarget());
}
} | java | private void removeNode(NodeId node, SharedBufferNode sharedBufferNode) throws Exception {
sharedBuffer.removeEntry(node);
EventId eventId = node.getEventId();
releaseEvent(eventId);
for (SharedBufferEdge sharedBufferEdge : sharedBufferNode.getEdges()) {
releaseNode(sharedBufferEdge.getTarget());
}
} | [
"private",
"void",
"removeNode",
"(",
"NodeId",
"node",
",",
"SharedBufferNode",
"sharedBufferNode",
")",
"throws",
"Exception",
"{",
"sharedBuffer",
".",
"removeEntry",
"(",
"node",
")",
";",
"EventId",
"eventId",
"=",
"node",
".",
"getEventId",
"(",
")",
";"... | Removes the {@code SharedBufferNode}, when the ref is decreased to zero, and also
decrease the ref of the edge on this node.
@param node id of the entry
@param sharedBufferNode the node body to be removed
@throws Exception Thrown if the system cannot access the state. | [
"Removes",
"the",
"{",
"@code",
"SharedBufferNode",
"}",
"when",
"the",
"ref",
"is",
"decreased",
"to",
"zero",
"and",
"also",
"decrease",
"the",
"ref",
"of",
"the",
"edge",
"on",
"this",
"node",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBufferAccessor.java#L256-L264 | train | Remove a node from the shared buffer. | [
30522,
2797,
11675,
6366,
3630,
3207,
1006,
13045,
3593,
13045,
1010,
4207,
8569,
12494,
3630,
3207,
4207,
8569,
12494,
3630,
3207,
1007,
11618,
6453,
1063,
4207,
8569,
12494,
1012,
6366,
4765,
2854,
1006,
13045,
1007,
1025,
2724,
3593,
272... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java | SSLUtils.isInternalSSLEnabled | public static boolean isInternalSSLEnabled(Configuration sslConfig) {
@SuppressWarnings("deprecation")
final boolean fallbackFlag = sslConfig.getBoolean(SecurityOptions.SSL_ENABLED);
return sslConfig.getBoolean(SecurityOptions.SSL_INTERNAL_ENABLED, fallbackFlag);
} | java | public static boolean isInternalSSLEnabled(Configuration sslConfig) {
@SuppressWarnings("deprecation")
final boolean fallbackFlag = sslConfig.getBoolean(SecurityOptions.SSL_ENABLED);
return sslConfig.getBoolean(SecurityOptions.SSL_INTERNAL_ENABLED, fallbackFlag);
} | [
"public",
"static",
"boolean",
"isInternalSSLEnabled",
"(",
"Configuration",
"sslConfig",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"final",
"boolean",
"fallbackFlag",
"=",
"sslConfig",
".",
"getBoolean",
"(",
"SecurityOptions",
".",
"SSL_ENABLED... | Checks whether SSL for internal communication (rpc, data transport, blob server) is enabled. | [
"Checks",
"whether",
"SSL",
"for",
"internal",
"communication",
"(",
"rpc",
"data",
"transport",
"blob",
"server",
")",
"is",
"enabled",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java#L56-L60 | train | Returns true if SSL is enabled or not. | [
30522,
2270,
10763,
22017,
20898,
2003,
18447,
11795,
9777,
25016,
22966,
2094,
1006,
9563,
7020,
22499,
2078,
8873,
2290,
1007,
1063,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
2139,
28139,
10719,
1000,
1007,
2345,
22017,
20898,
2991,
5963,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/meta/MetaUtil.java | MetaUtil.getColumnNames | public static String[] getColumnNames(DataSource ds, String tableName) {
List<String> columnNames = new ArrayList<String>();
Connection conn = null;
ResultSet rs = null;
try {
conn = ds.getConnection();
final DatabaseMetaData metaData = conn.getMetaData();
rs = metaData.getColumns(conn.getCatalog(), null, tableName, null);
while (rs.next()) {
columnNames.add(rs.getString("COLUMN_NAME"));
}
return columnNames.toArray(new String[columnNames.size()]);
} catch (Exception e) {
throw new DbRuntimeException("Get columns error!", e);
} finally {
DbUtil.close(rs, conn);
}
} | java | public static String[] getColumnNames(DataSource ds, String tableName) {
List<String> columnNames = new ArrayList<String>();
Connection conn = null;
ResultSet rs = null;
try {
conn = ds.getConnection();
final DatabaseMetaData metaData = conn.getMetaData();
rs = metaData.getColumns(conn.getCatalog(), null, tableName, null);
while (rs.next()) {
columnNames.add(rs.getString("COLUMN_NAME"));
}
return columnNames.toArray(new String[columnNames.size()]);
} catch (Exception e) {
throw new DbRuntimeException("Get columns error!", e);
} finally {
DbUtil.close(rs, conn);
}
} | [
"public",
"static",
"String",
"[",
"]",
"getColumnNames",
"(",
"DataSource",
"ds",
",",
"String",
"tableName",
")",
"{",
"List",
"<",
"String",
">",
"columnNames",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"Connection",
"conn",
"=",
"nu... | 获得表的所有列名
@param ds 数据源
@param tableName 表名
@return 列数组
@throws DbRuntimeException SQL执行异常 | [
"获得表的所有列名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/meta/MetaUtil.java#L125-L142 | train | Get the column names of the table. | [
30522,
2270,
10763,
5164,
1031,
1033,
2131,
25778,
2819,
9516,
7834,
1006,
2951,
6499,
3126,
3401,
16233,
1010,
5164,
2795,
18442,
1007,
1063,
2862,
1026,
5164,
1028,
5930,
18442,
2015,
1027,
2047,
9140,
9863,
1026,
5164,
1028,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/useragent/UserAgentParser.java | UserAgentParser.parseOS | private static OS parseOS(String userAgentString) {
for (OS os : OS.oses) {
if (os.isMatch(userAgentString)) {
return os;
}
}
return OS.Unknown;
} | java | private static OS parseOS(String userAgentString) {
for (OS os : OS.oses) {
if (os.isMatch(userAgentString)) {
return os;
}
}
return OS.Unknown;
} | [
"private",
"static",
"OS",
"parseOS",
"(",
"String",
"userAgentString",
")",
"{",
"for",
"(",
"OS",
"os",
":",
"OS",
".",
"oses",
")",
"{",
"if",
"(",
"os",
".",
"isMatch",
"(",
"userAgentString",
")",
")",
"{",
"return",
"os",
";",
"}",
"}",
"retu... | 解析系统类型
@param userAgentString User-Agent字符串
@return 系统类型 | [
"解析系统类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/useragent/UserAgentParser.java#L91-L98 | train | Parses the user agent string to get the OS object. | [
30522,
2797,
10763,
9808,
11968,
3366,
2891,
1006,
5164,
5310,
4270,
7666,
18886,
3070,
1007,
1063,
2005,
1006,
9808,
9808,
1024,
9808,
1012,
9808,
2229,
1007,
1063,
2065,
1006,
9808,
1012,
2003,
18900,
2818,
1006,
5310,
4270,
7666,
18886,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java | CheckpointCoordinator.startCheckpointScheduler | public void startCheckpointScheduler() {
synchronized (lock) {
if (shutdown) {
throw new IllegalArgumentException("Checkpoint coordinator is shut down");
}
// make sure all prior timers are cancelled
stopCheckpointScheduler();
periodicScheduling = true;
long initialDelay = ThreadLocalRandom.current().nextLong(
minPauseBetweenCheckpointsNanos / 1_000_000L, baseInterval + 1L);
currentPeriodicTrigger = timer.scheduleAtFixedRate(
new ScheduledTrigger(), initialDelay, baseInterval, TimeUnit.MILLISECONDS);
}
} | java | public void startCheckpointScheduler() {
synchronized (lock) {
if (shutdown) {
throw new IllegalArgumentException("Checkpoint coordinator is shut down");
}
// make sure all prior timers are cancelled
stopCheckpointScheduler();
periodicScheduling = true;
long initialDelay = ThreadLocalRandom.current().nextLong(
minPauseBetweenCheckpointsNanos / 1_000_000L, baseInterval + 1L);
currentPeriodicTrigger = timer.scheduleAtFixedRate(
new ScheduledTrigger(), initialDelay, baseInterval, TimeUnit.MILLISECONDS);
}
} | [
"public",
"void",
"startCheckpointScheduler",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"shutdown",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Checkpoint coordinator is shut down\"",
")",
";",
"}",
"// make sure all prior time... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java#L1227-L1242 | train | Start the checkpoint scheduler. | [
30522,
2270,
11675,
2707,
5403,
3600,
26521,
7690,
9307,
2099,
1006,
1007,
1063,
25549,
1006,
5843,
1007,
1063,
2065,
1006,
3844,
7698,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
26520,
10669,
2003,
3844,
209... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.add | public HttpHeaders add(HttpHeaders headers) {
if (headers == null) {
throw new NullPointerException("headers");
}
for (Map.Entry<String, String> e: headers) {
add(e.getKey(), e.getValue());
}
return this;
} | java | public HttpHeaders add(HttpHeaders headers) {
if (headers == null) {
throw new NullPointerException("headers");
}
for (Map.Entry<String, String> e: headers) {
add(e.getKey(), e.getValue());
}
return this;
} | [
"public",
"HttpHeaders",
"add",
"(",
"HttpHeaders",
"headers",
")",
"{",
"if",
"(",
"headers",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"headers\"",
")",
";",
"}",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String... | Adds all header entries of the specified {@code headers}.
@return {@code this} | [
"Adds",
"all",
"header",
"entries",
"of",
"the",
"specified",
"{",
"@code",
"headers",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1414-L1422 | train | Add a collection of headers to this set. | [
30522,
2270,
8299,
4974,
2545,
5587,
1006,
8299,
4974,
2545,
20346,
2015,
1007,
1063,
2065,
1006,
20346,
2015,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
20346,
2015,
1000,
1007,
1025,
1065,
2005,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/utility/TextUtility.java | TextUtility.exceptionToString | public static String exceptionToString(Exception e)
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
return sw.toString();
} | java | public static String exceptionToString(Exception e)
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
return sw.toString();
} | [
"public",
"static",
"String",
"exceptionToString",
"(",
"Exception",
"e",
")",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"pw",
"=",
"new",
"PrintWriter",
"(",
"sw",
")",
";",
"e",
".",
"printStackTrace",
"(",
"pw"... | 将异常转为字符串
@param e
@return | [
"将异常转为字符串"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/TextUtility.java#L572-L578 | train | This method is used to get a string representation of an exception. | [
30522,
2270,
10763,
5164,
6453,
13122,
18886,
3070,
1006,
6453,
1041,
1007,
1063,
5164,
15994,
25430,
1027,
2047,
5164,
15994,
1006,
1007,
1025,
6140,
15994,
1052,
2860,
1027,
2047,
6140,
15994,
1006,
25430,
1007,
1025,
1041,
1012,
11204,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.mapVertices | @SuppressWarnings({ "unchecked", "rawtypes" })
public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper) {
TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertices.getType()).getTypeAt(0);
TypeInformation<NV> valueType;
if (mapper instanceof ResultTypeQueryable) {
valueType = ((ResultTypeQueryable) mapper).getProducedType();
} else {
valueType = TypeExtractor.createTypeInfo(MapFunction.class, mapper.getClass(), 1, vertices.getType(), null);
}
TypeInformation<Vertex<K, NV>> returnType = (TypeInformation<Vertex<K, NV>>) new TupleTypeInfo(
Vertex.class, keyType, valueType);
return mapVertices(mapper, returnType);
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper) {
TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertices.getType()).getTypeAt(0);
TypeInformation<NV> valueType;
if (mapper instanceof ResultTypeQueryable) {
valueType = ((ResultTypeQueryable) mapper).getProducedType();
} else {
valueType = TypeExtractor.createTypeInfo(MapFunction.class, mapper.getClass(), 1, vertices.getType(), null);
}
TypeInformation<Vertex<K, NV>> returnType = (TypeInformation<Vertex<K, NV>>) new TupleTypeInfo(
Vertex.class, keyType, valueType);
return mapVertices(mapper, returnType);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"<",
"NV",
">",
"Graph",
"<",
"K",
",",
"NV",
",",
"EV",
">",
"mapVertices",
"(",
"final",
"MapFunction",
"<",
"Vertex",
"<",
"K",
",",
"VV",
">",
",",
"NV",... | Apply a function to the attribute of each vertex in the graph.
@param mapper the map function to apply.
@return a new graph | [
"Apply",
"a",
"function",
"to",
"the",
"attribute",
"of",
"each",
"vertex",
"in",
"the",
"graph",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L527-L544 | train | Maps the set of vertices to a graph. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
4895,
5403,
18141,
1000,
1010,
1000,
6315,
13874,
2015,
1000,
1065,
1007,
2270,
1026,
1050,
2615,
1028,
10629,
1026,
1047,
1010,
1050,
2615,
1010,
23408,
1028,
4949,
16874,
23522,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java | AbstractAsymmetricCrypto.decryptStrFromBcd | public String decryptStrFromBcd(String data, KeyType keyType, Charset charset) {
return StrUtil.str(decryptFromBcd(data, keyType, charset), charset);
} | java | public String decryptStrFromBcd(String data, KeyType keyType, Charset charset) {
return StrUtil.str(decryptFromBcd(data, keyType, charset), charset);
} | [
"public",
"String",
"decryptStrFromBcd",
"(",
"String",
"data",
",",
"KeyType",
"keyType",
",",
"Charset",
"charset",
")",
"{",
"return",
"StrUtil",
".",
"str",
"(",
"decryptFromBcd",
"(",
"data",
",",
"keyType",
",",
"charset",
")",
",",
"charset",
")",
"... | 解密为字符串,密文需为BCD格式
@param data 数据,BCD格式
@param keyType 密钥类型
@param charset 加密前编码
@return 解密后的密文
@since 4.5.2 | [
"解密为字符串,密文需为BCD格式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L310-L312 | train | Decrypt a String using BCD. | [
30522,
2270,
5164,
11703,
2854,
22798,
16344,
19699,
5358,
9818,
2094,
1006,
5164,
2951,
1010,
3145,
13874,
3145,
13874,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2709,
2358,
22134,
4014,
1012,
2358,
2099,
1006,
11703,
2854,
13876,
19699,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/CoFeedbackTransformation.java | CoFeedbackTransformation.addFeedbackEdge | public void addFeedbackEdge(StreamTransformation<F> transform) {
if (transform.getParallelism() != this.getParallelism()) {
throw new UnsupportedOperationException(
"Parallelism of the feedback stream must match the parallelism of the original" +
" stream. Parallelism of original stream: " + this.getParallelism() +
"; parallelism of feedback stream: " + transform.getParallelism());
}
feedbackEdges.add(transform);
} | java | public void addFeedbackEdge(StreamTransformation<F> transform) {
if (transform.getParallelism() != this.getParallelism()) {
throw new UnsupportedOperationException(
"Parallelism of the feedback stream must match the parallelism of the original" +
" stream. Parallelism of original stream: " + this.getParallelism() +
"; parallelism of feedback stream: " + transform.getParallelism());
}
feedbackEdges.add(transform);
} | [
"public",
"void",
"addFeedbackEdge",
"(",
"StreamTransformation",
"<",
"F",
">",
"transform",
")",
"{",
"if",
"(",
"transform",
".",
"getParallelism",
"(",
")",
"!=",
"this",
".",
"getParallelism",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationExcep... | Adds a feedback edge. The parallelism of the {@code StreamTransformation} must match
the parallelism of the input {@code StreamTransformation} of the upstream
{@code StreamTransformation}.
@param transform The new feedback {@code StreamTransformation}. | [
"Adds",
"a",
"feedback",
"edge",
".",
"The",
"parallelism",
"of",
"the",
"{",
"@code",
"StreamTransformation",
"}",
"must",
"match",
"the",
"parallelism",
"of",
"the",
"input",
"{",
"@code",
"StreamTransformation",
"}",
"of",
"the",
"upstream",
"{",
"@code",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/CoFeedbackTransformation.java#L85-L95 | train | Adds a feedback edge to the original stream. | [
30522,
2270,
11675,
5587,
7959,
2098,
5963,
24225,
1006,
5460,
6494,
3619,
14192,
3370,
1026,
1042,
1028,
10938,
1007,
1063,
2065,
1006,
10938,
1012,
2131,
28689,
6216,
28235,
1006,
1007,
999,
1027,
2023,
1012,
2131,
28689,
6216,
28235,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/similarity/AdamicAdar.java | AdamicAdar.runInternal | @Override
public DataSet<Result<K>> runInternal(Graph<K, VV, EV> input)
throws Exception {
// s, d(s), 1/log(d(s))
DataSet<Tuple3<K, LongValue, FloatValue>> inverseLogDegree = input
.run(new VertexDegree<K, VV, EV>()
.setParallelism(parallelism))
.map(new VertexInverseLogDegree<>())
.setParallelism(parallelism)
.name("Vertex score");
// s, t, 1/log(d(s))
DataSet<Tuple3<K, K, FloatValue>> sourceInverseLogDegree = input
.getEdges()
.join(inverseLogDegree, JoinHint.REPARTITION_HASH_SECOND)
.where(0)
.equalTo(0)
.projectFirst(0, 1)
.<Tuple3<K, K, FloatValue>>projectSecond(2)
.setParallelism(parallelism)
.name("Edge score");
// group span, s, t, 1/log(d(s))
DataSet<Tuple4<IntValue, K, K, FloatValue>> groupSpans = sourceInverseLogDegree
.groupBy(0)
.sortGroup(1, Order.ASCENDING)
.reduceGroup(new GenerateGroupSpans<>())
.setParallelism(parallelism)
.name("Generate group spans");
// group, s, t, 1/log(d(s))
DataSet<Tuple4<IntValue, K, K, FloatValue>> groups = groupSpans
.rebalance()
.setParallelism(parallelism)
.name("Rebalance")
.flatMap(new GenerateGroups<>())
.setParallelism(parallelism)
.name("Generate groups");
// t, u, 1/log(d(s)) where (s, t) and (s, u) are edges in graph
DataSet<Tuple3<K, K, FloatValue>> twoPaths = groups
.groupBy(0, 1)
.sortGroup(2, Order.ASCENDING)
.reduceGroup(new GenerateGroupPairs<>())
.name("Generate group pairs");
// t, u, adamic-adar score
GroupReduceOperator<Tuple3<K, K, FloatValue>, Result<K>> scores = twoPaths
.groupBy(0, 1)
.reduceGroup(new ComputeScores<>(minimumScore, minimumRatio))
.name("Compute scores");
if (minimumRatio > 0.0f) {
// total score, number of pairs of neighbors
DataSet<Tuple2<FloatValue, LongValue>> sumOfScoresAndNumberOfNeighborPairs = inverseLogDegree
.map(new ComputeScoreFromVertex<>())
.setParallelism(parallelism)
.name("Average score")
.sum(0)
.andSum(1);
scores
.withBroadcastSet(sumOfScoresAndNumberOfNeighborPairs, SUM_OF_SCORES_AND_NUMBER_OF_NEIGHBOR_PAIRS);
}
if (mirrorResults) {
return scores
.flatMap(new MirrorResult<>())
.name("Mirror results");
} else {
return scores;
}
} | java | @Override
public DataSet<Result<K>> runInternal(Graph<K, VV, EV> input)
throws Exception {
// s, d(s), 1/log(d(s))
DataSet<Tuple3<K, LongValue, FloatValue>> inverseLogDegree = input
.run(new VertexDegree<K, VV, EV>()
.setParallelism(parallelism))
.map(new VertexInverseLogDegree<>())
.setParallelism(parallelism)
.name("Vertex score");
// s, t, 1/log(d(s))
DataSet<Tuple3<K, K, FloatValue>> sourceInverseLogDegree = input
.getEdges()
.join(inverseLogDegree, JoinHint.REPARTITION_HASH_SECOND)
.where(0)
.equalTo(0)
.projectFirst(0, 1)
.<Tuple3<K, K, FloatValue>>projectSecond(2)
.setParallelism(parallelism)
.name("Edge score");
// group span, s, t, 1/log(d(s))
DataSet<Tuple4<IntValue, K, K, FloatValue>> groupSpans = sourceInverseLogDegree
.groupBy(0)
.sortGroup(1, Order.ASCENDING)
.reduceGroup(new GenerateGroupSpans<>())
.setParallelism(parallelism)
.name("Generate group spans");
// group, s, t, 1/log(d(s))
DataSet<Tuple4<IntValue, K, K, FloatValue>> groups = groupSpans
.rebalance()
.setParallelism(parallelism)
.name("Rebalance")
.flatMap(new GenerateGroups<>())
.setParallelism(parallelism)
.name("Generate groups");
// t, u, 1/log(d(s)) where (s, t) and (s, u) are edges in graph
DataSet<Tuple3<K, K, FloatValue>> twoPaths = groups
.groupBy(0, 1)
.sortGroup(2, Order.ASCENDING)
.reduceGroup(new GenerateGroupPairs<>())
.name("Generate group pairs");
// t, u, adamic-adar score
GroupReduceOperator<Tuple3<K, K, FloatValue>, Result<K>> scores = twoPaths
.groupBy(0, 1)
.reduceGroup(new ComputeScores<>(minimumScore, minimumRatio))
.name("Compute scores");
if (minimumRatio > 0.0f) {
// total score, number of pairs of neighbors
DataSet<Tuple2<FloatValue, LongValue>> sumOfScoresAndNumberOfNeighborPairs = inverseLogDegree
.map(new ComputeScoreFromVertex<>())
.setParallelism(parallelism)
.name("Average score")
.sum(0)
.andSum(1);
scores
.withBroadcastSet(sumOfScoresAndNumberOfNeighborPairs, SUM_OF_SCORES_AND_NUMBER_OF_NEIGHBOR_PAIRS);
}
if (mirrorResults) {
return scores
.flatMap(new MirrorResult<>())
.name("Mirror results");
} else {
return scores;
}
} | [
"@",
"Override",
"public",
"DataSet",
"<",
"Result",
"<",
"K",
">",
">",
"runInternal",
"(",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"input",
")",
"throws",
"Exception",
"{",
"// s, d(s), 1/log(d(s))",
"DataSet",
"<",
"Tuple3",
"<",
"K",
",",
"Lo... | /*
Implementation notes:
The requirement that "K extends CopyableValue<K>" can be removed when
Flink has a self-join which performs the skew distribution handled by
GenerateGroupSpans / GenerateGroups / GenerateGroupPairs. | [
"/",
"*",
"Implementation",
"notes",
":"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/similarity/AdamicAdar.java#L149-L221 | train | Run the H2O algorithm. | [
30522,
1030,
2058,
15637,
2270,
30524,
1006,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
7953,
1007,
11618,
6453,
1063,
1013,
1013,
1055,
1010,
1040,
1006,
1055,
1007,
1010,
1015,
1013,
8833,
1006,
1040,
1006,
1055,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-mesos/src/main/java/org/apache/flink/mesos/Utils.java | Utils.scalar | public static Protos.Resource scalar(String name, String role, double value) {
checkNotNull(name);
checkNotNull(role);
checkNotNull(value);
return Protos.Resource.newBuilder()
.setName(name)
.setType(Protos.Value.Type.SCALAR)
.setScalar(Protos.Value.Scalar.newBuilder().setValue(value))
.setRole(role)
.build();
} | java | public static Protos.Resource scalar(String name, String role, double value) {
checkNotNull(name);
checkNotNull(role);
checkNotNull(value);
return Protos.Resource.newBuilder()
.setName(name)
.setType(Protos.Value.Type.SCALAR)
.setScalar(Protos.Value.Scalar.newBuilder().setValue(value))
.setRole(role)
.build();
} | [
"public",
"static",
"Protos",
".",
"Resource",
"scalar",
"(",
"String",
"name",
",",
"String",
"role",
",",
"double",
"value",
")",
"{",
"checkNotNull",
"(",
"name",
")",
";",
"checkNotNull",
"(",
"role",
")",
";",
"checkNotNull",
"(",
"value",
")",
";",... | Construct a scalar resource. | [
"Construct",
"a",
"scalar",
"resource",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/Utils.java#L185-L195 | train | Create a new resource with a scalar value. | [
30522,
2270,
10763,
15053,
2015,
1012,
7692,
26743,
2099,
1006,
5164,
2171,
1010,
5164,
2535,
1010,
3313,
3643,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
2171,
1007,
1025,
4638,
17048,
11231,
3363,
1006,
2535,
1007,
1025,
4638,
17048,
112... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java | OptimizerNode.areBranchCompatible | protected boolean areBranchCompatible(PlanNode plan1, PlanNode plan2) {
if (plan1 == null || plan2 == null) {
throw new NullPointerException();
}
// if there is no open branch, the children are always compatible.
// in most plans, that will be the dominant case
if (this.hereJoinedBranches == null || this.hereJoinedBranches.isEmpty()) {
return true;
}
for (OptimizerNode joinedBrancher : hereJoinedBranches) {
final PlanNode branch1Cand = plan1.getCandidateAtBranchPoint(joinedBrancher);
final PlanNode branch2Cand = plan2.getCandidateAtBranchPoint(joinedBrancher);
if (branch1Cand != null && branch2Cand != null && branch1Cand != branch2Cand) {
return false;
}
}
return true;
} | java | protected boolean areBranchCompatible(PlanNode plan1, PlanNode plan2) {
if (plan1 == null || plan2 == null) {
throw new NullPointerException();
}
// if there is no open branch, the children are always compatible.
// in most plans, that will be the dominant case
if (this.hereJoinedBranches == null || this.hereJoinedBranches.isEmpty()) {
return true;
}
for (OptimizerNode joinedBrancher : hereJoinedBranches) {
final PlanNode branch1Cand = plan1.getCandidateAtBranchPoint(joinedBrancher);
final PlanNode branch2Cand = plan2.getCandidateAtBranchPoint(joinedBrancher);
if (branch1Cand != null && branch2Cand != null && branch1Cand != branch2Cand) {
return false;
}
}
return true;
} | [
"protected",
"boolean",
"areBranchCompatible",
"(",
"PlanNode",
"plan1",
",",
"PlanNode",
"plan2",
")",
"{",
"if",
"(",
"plan1",
"==",
"null",
"||",
"plan2",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"// if there is ... | Checks whether to candidate plans for the sub-plan of this node are comparable. The two
alternative plans are comparable, if
a) There is no branch in the sub-plan of this node
b) Both candidates have the same candidate as the child at the last open branch.
@param plan1 The root node of the first candidate plan.
@param plan2 The root node of the second candidate plan.
@return True if the nodes are branch compatible in the inputs. | [
"Checks",
"whether",
"to",
"candidate",
"plans",
"for",
"the",
"sub",
"-",
"plan",
"of",
"this",
"node",
"are",
"comparable",
".",
"The",
"two",
"alternative",
"plans",
"are",
"comparable",
"if"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java#L970-L990 | train | Checks if two plan nodes are compatible. | [
30522,
5123,
22017,
20898,
2024,
10024,
12680,
9006,
24952,
3468,
1006,
2933,
3630,
3207,
2933,
2487,
1010,
2933,
3630,
3207,
2933,
2475,
1007,
1063,
2065,
1006,
2933,
2487,
1027,
1027,
19701,
1064,
1064,
2933,
2475,
1027,
1027,
19701,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/UnsortedGrouping.java | UnsortedGrouping.max | public AggregateOperator<T> max (int field) {
return this.aggregate (Aggregations.MAX, field, Utils.getCallLocationName());
} | java | public AggregateOperator<T> max (int field) {
return this.aggregate (Aggregations.MAX, field, Utils.getCallLocationName());
} | [
"public",
"AggregateOperator",
"<",
"T",
">",
"max",
"(",
"int",
"field",
")",
"{",
"return",
"this",
".",
"aggregate",
"(",
"Aggregations",
".",
"MAX",
",",
"field",
",",
"Utils",
".",
"getCallLocationName",
"(",
")",
")",
";",
"}"
] | Syntactic sugar for aggregate (MAX, field).
@param field The index of the Tuple field on which the aggregation function is applied.
@return An AggregateOperator that represents the max'ed DataSet.
@see org.apache.flink.api.java.operators.AggregateOperator | [
"Syntactic",
"sugar",
"for",
"aggregate",
"(",
"MAX",
"field",
")",
".",
"@param",
"field",
"The",
"index",
"of",
"the",
"Tuple",
"field",
"on",
"which",
"the",
"aggregation",
"function",
"is",
"applied",
".",
"@return",
"An",
"AggregateOperator",
"that",
"r... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/UnsortedGrouping.java#L114-L116 | train | Create an aggregate that aggregates values on the specified field using the MAX operator. | [
30522,
2270,
9572,
25918,
8844,
1026,
1056,
1028,
4098,
1006,
20014,
2492,
1007,
1063,
2709,
2023,
1012,
9572,
1006,
28041,
2015,
1012,
4098,
1010,
2492,
1010,
21183,
12146,
1012,
2131,
9289,
7174,
10719,
18442,
1006,
1007,
1007,
1025,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/csv/CsvParser.java | CsvParser.initHeader | private void initHeader(final List<String> currentFields) {
final Map<String, Integer> localHeaderMap = new LinkedHashMap<>(currentFields.size());
for (int i = 0; i < currentFields.size(); i++) {
final String field = currentFields.get(i);
if (StrUtil.isNotEmpty(field) && false ==localHeaderMap.containsKey(field)) {
localHeaderMap.put(field, i);
}
}
header = new CsvRow(this.lineNo, Collections.unmodifiableMap(localHeaderMap), Collections.unmodifiableList(currentFields));
} | java | private void initHeader(final List<String> currentFields) {
final Map<String, Integer> localHeaderMap = new LinkedHashMap<>(currentFields.size());
for (int i = 0; i < currentFields.size(); i++) {
final String field = currentFields.get(i);
if (StrUtil.isNotEmpty(field) && false ==localHeaderMap.containsKey(field)) {
localHeaderMap.put(field, i);
}
}
header = new CsvRow(this.lineNo, Collections.unmodifiableMap(localHeaderMap), Collections.unmodifiableList(currentFields));
} | [
"private",
"void",
"initHeader",
"(",
"final",
"List",
"<",
"String",
">",
"currentFields",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Integer",
">",
"localHeaderMap",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
"currentFields",
".",
"size",
"(",
")",
")",... | 当前行做为标题行
@param currentFields 当前行字段列表 | [
"当前行做为标题行"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvParser.java#L143-L153 | train | Initialize the header. | [
30522,
2797,
11675,
1999,
8939,
13775,
2121,
1006,
2345,
2862,
1026,
5164,
1028,
2783,
15155,
1007,
1063,
2345,
4949,
1026,
5164,
1010,
16109,
1028,
2334,
4974,
2121,
2863,
2361,
1027,
2047,
5799,
14949,
22444,
2361,
1026,
1028,
1006,
2783,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java | ExceptionUtils.rethrowException | public static void rethrowException(Throwable t) throws Exception {
if (t instanceof Error) {
throw (Error) t;
}
else if (t instanceof Exception) {
throw (Exception) t;
}
else {
throw new Exception(t.getMessage(), t);
}
} | java | public static void rethrowException(Throwable t) throws Exception {
if (t instanceof Error) {
throw (Error) t;
}
else if (t instanceof Exception) {
throw (Exception) t;
}
else {
throw new Exception(t.getMessage(), t);
}
} | [
"public",
"static",
"void",
"rethrowException",
"(",
"Throwable",
"t",
")",
"throws",
"Exception",
"{",
"if",
"(",
"t",
"instanceof",
"Error",
")",
"{",
"throw",
"(",
"Error",
")",
"t",
";",
"}",
"else",
"if",
"(",
"t",
"instanceof",
"Exception",
")",
... | Throws the given {@code Throwable} in scenarios where the signatures do allow to
throw a Exception. Errors and Exceptions are thrown directly, other "exotic"
subclasses of Throwable are wrapped in an Exception.
@param t The throwable to be thrown. | [
"Throws",
"the",
"given",
"{",
"@code",
"Throwable",
"}",
"in",
"scenarios",
"where",
"the",
"signatures",
"do",
"allow",
"to",
"throw",
"a",
"Exception",
".",
"Errors",
"and",
"Exceptions",
"are",
"thrown",
"directly",
"other",
"exotic",
"subclasses",
"of",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java#L250-L260 | train | rethrowException This method is used to throw an exception. | [
30522,
2270,
10763,
11675,
2128,
2705,
10524,
10288,
24422,
1006,
5466,
3085,
1056,
1007,
11618,
6453,
1063,
2065,
1006,
1056,
6013,
11253,
7561,
1007,
1063,
5466,
1006,
7561,
1007,
1056,
1025,
1065,
2842,
2065,
1006,
1056,
6013,
11253,
645... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.setInternal | private void setInternal(String key, String value) {
Preconditions.checkArgument(value != null && !value.isEmpty(),
"The configuration value must not be empty.");
configuredOptions.put(key, value);
} | java | private void setInternal(String key, String value) {
Preconditions.checkArgument(value != null && !value.isEmpty(),
"The configuration value must not be empty.");
configuredOptions.put(key, value);
} | [
"private",
"void",
"setInternal",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"value",
"!=",
"null",
"&&",
"!",
"value",
".",
"isEmpty",
"(",
")",
",",
"\"The configuration value must not be empty.\"",
")",... | Sets the configuration with (key, value) if the key is predefined, otherwise throws IllegalArgumentException.
@param key The configuration key, if key is not predefined, throws IllegalArgumentException out.
@param value The configuration value. | [
"Sets",
"the",
"configuration",
"with",
"(",
"key",
"value",
")",
"if",
"the",
"key",
"is",
"predefined",
"otherwise",
"throws",
"IllegalArgumentException",
"."
] | 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#L407-L412 | train | Sets the value of the configuration option. | [
30522,
2797,
11675,
2275,
18447,
11795,
2389,
1006,
5164,
3145,
1010,
5164,
3643,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
3643,
999,
1027,
19701,
1004,
1004,
999,
3643,
1012,
2003,
6633,
13876,
2100,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/math/Arrangement.java | Arrangement.count | public static long count(int n, int m) {
if(n == m) {
return NumberUtil.factorial(n);
}
return (n > m) ? NumberUtil.factorial(n, n - m) : 0;
} | java | public static long count(int n, int m) {
if(n == m) {
return NumberUtil.factorial(n);
}
return (n > m) ? NumberUtil.factorial(n, n - m) : 0;
} | [
"public",
"static",
"long",
"count",
"(",
"int",
"n",
",",
"int",
"m",
")",
"{",
"if",
"(",
"n",
"==",
"m",
")",
"{",
"return",
"NumberUtil",
".",
"factorial",
"(",
"n",
")",
";",
"}",
"return",
"(",
"n",
">",
"m",
")",
"?",
"NumberUtil",
".",
... | 计算排列数,即A(n, m) = n!/(n-m)!
@param n 总数
@param m 选择的个数
@return 排列数 | [
"计算排列数,即A",
"(",
"n",
"m",
")",
"=",
"n!",
"/",
"(",
"n",
"-",
"m",
")",
"!"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/math/Arrangement.java#L46-L51 | train | Returns the number of elements in the specified range of elements. | [
30522,
2270,
10763,
2146,
4175,
1006,
20014,
1050,
1010,
20014,
1049,
1007,
1063,
2065,
1006,
1050,
1027,
1027,
1049,
1007,
1063,
2709,
2193,
21823,
2140,
1012,
5387,
4818,
1006,
1050,
1007,
1025,
1065,
2709,
1006,
1050,
1028,
1049,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/scheduler/Scheduler.java | Scheduler.findInstance | private Pair<Instance, Locality> findInstance(Iterable<TaskManagerLocation> requestedLocations, boolean localOnly) {
// drain the queue of newly available instances
while (this.newlyAvailableInstances.size() > 0) {
Instance queuedInstance = this.newlyAvailableInstances.poll();
if (queuedInstance != null) {
this.instancesWithAvailableResources.put(queuedInstance.getTaskManagerID(), queuedInstance);
}
}
// if nothing is available at all, return null
if (this.instancesWithAvailableResources.isEmpty()) {
return null;
}
Iterator<TaskManagerLocation> locations = requestedLocations == null ? null : requestedLocations.iterator();
if (locations != null && locations.hasNext()) {
// we have a locality preference
while (locations.hasNext()) {
TaskManagerLocation location = locations.next();
if (location != null) {
Instance instance = instancesWithAvailableResources.remove(location.getResourceID());
if (instance != null) {
return new ImmutablePair<Instance, Locality>(instance, Locality.LOCAL);
}
}
}
// no local instance available
if (localOnly) {
return null;
}
else {
// take the first instance from the instances with resources
Iterator<Instance> instances = instancesWithAvailableResources.values().iterator();
Instance instanceToUse = instances.next();
instances.remove();
return new ImmutablePair<>(instanceToUse, Locality.NON_LOCAL);
}
}
else {
// no location preference, so use some instance
Iterator<Instance> instances = instancesWithAvailableResources.values().iterator();
Instance instanceToUse = instances.next();
instances.remove();
return new ImmutablePair<>(instanceToUse, Locality.UNCONSTRAINED);
}
} | java | private Pair<Instance, Locality> findInstance(Iterable<TaskManagerLocation> requestedLocations, boolean localOnly) {
// drain the queue of newly available instances
while (this.newlyAvailableInstances.size() > 0) {
Instance queuedInstance = this.newlyAvailableInstances.poll();
if (queuedInstance != null) {
this.instancesWithAvailableResources.put(queuedInstance.getTaskManagerID(), queuedInstance);
}
}
// if nothing is available at all, return null
if (this.instancesWithAvailableResources.isEmpty()) {
return null;
}
Iterator<TaskManagerLocation> locations = requestedLocations == null ? null : requestedLocations.iterator();
if (locations != null && locations.hasNext()) {
// we have a locality preference
while (locations.hasNext()) {
TaskManagerLocation location = locations.next();
if (location != null) {
Instance instance = instancesWithAvailableResources.remove(location.getResourceID());
if (instance != null) {
return new ImmutablePair<Instance, Locality>(instance, Locality.LOCAL);
}
}
}
// no local instance available
if (localOnly) {
return null;
}
else {
// take the first instance from the instances with resources
Iterator<Instance> instances = instancesWithAvailableResources.values().iterator();
Instance instanceToUse = instances.next();
instances.remove();
return new ImmutablePair<>(instanceToUse, Locality.NON_LOCAL);
}
}
else {
// no location preference, so use some instance
Iterator<Instance> instances = instancesWithAvailableResources.values().iterator();
Instance instanceToUse = instances.next();
instances.remove();
return new ImmutablePair<>(instanceToUse, Locality.UNCONSTRAINED);
}
} | [
"private",
"Pair",
"<",
"Instance",
",",
"Locality",
">",
"findInstance",
"(",
"Iterable",
"<",
"TaskManagerLocation",
">",
"requestedLocations",
",",
"boolean",
"localOnly",
")",
"{",
"// drain the queue of newly available instances",
"while",
"(",
"this",
".",
"newl... | Tries to find a requested instance. If no such instance is available it will return a non-
local instance. If no such instance exists (all slots occupied), then return null.
<p><b>NOTE:</b> This method is not thread-safe, it needs to be synchronized by the caller.</p>
@param requestedLocations The list of preferred instances. May be null or empty, which indicates that
no locality preference exists.
@param localOnly Flag to indicate whether only one of the exact local instances can be chosen. | [
"Tries",
"to",
"find",
"a",
"requested",
"instance",
".",
"If",
"no",
"such",
"instance",
"is",
"available",
"it",
"will",
"return",
"a",
"non",
"-",
"local",
"instance",
".",
"If",
"no",
"such",
"instance",
"exists",
"(",
"all",
"slots",
"occupied",
")"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/scheduler/Scheduler.java#L486-L537 | train | Find the instance with the given locations. | [
30522,
2797,
3940,
1026,
6013,
1010,
10246,
1028,
2424,
7076,
26897,
1006,
2009,
6906,
3468,
1026,
4708,
24805,
4590,
4135,
10719,
1028,
7303,
4135,
10719,
2015,
1010,
22017,
20898,
2334,
2239,
2135,
1007,
1063,
1013,
1013,
12475,
1996,
242... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/StreamRecord.java | StreamRecord.copyTo | public void copyTo(T valueCopy, StreamRecord<T> target) {
target.value = valueCopy;
target.timestamp = this.timestamp;
target.hasTimestamp = this.hasTimestamp;
} | java | public void copyTo(T valueCopy, StreamRecord<T> target) {
target.value = valueCopy;
target.timestamp = this.timestamp;
target.hasTimestamp = this.hasTimestamp;
} | [
"public",
"void",
"copyTo",
"(",
"T",
"valueCopy",
",",
"StreamRecord",
"<",
"T",
">",
"target",
")",
"{",
"target",
".",
"value",
"=",
"valueCopy",
";",
"target",
".",
"timestamp",
"=",
"this",
".",
"timestamp",
";",
"target",
".",
"hasTimestamp",
"=",
... | Copies this record into the new stream record. Uses the copied value as the value for the new
record, i.e., only copies timestamp fields. | [
"Copies",
"this",
"record",
"into",
"the",
"new",
"stream",
"record",
".",
"Uses",
"the",
"copied",
"value",
"as",
"the",
"value",
"for",
"the",
"new",
"record",
"i",
".",
"e",
".",
"only",
"copies",
"timestamp",
"fields",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamrecord/StreamRecord.java#L156-L160 | train | Copy the value of this record to the target record. | [
30522,
2270,
11675,
30524,
27108,
2094,
1026,
1056,
1028,
4539,
1007,
1063,
4539,
1012,
3643,
1027,
3643,
3597,
7685,
1025,
4539,
1012,
2335,
15464,
2361,
1027,
2023,
1012,
2335,
15464,
2361,
1025,
4539,
1012,
2038,
7292,
9153,
8737,
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/incubator-shardingsphere | sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/util/NumberUtil.java | NumberUtil.getExactlyNumber | public static Number getExactlyNumber(final String value, final int radix) {
try {
return getBigInteger(value, radix);
} catch (final NumberFormatException ex) {
return new BigDecimal(value);
}
} | java | public static Number getExactlyNumber(final String value, final int radix) {
try {
return getBigInteger(value, radix);
} catch (final NumberFormatException ex) {
return new BigDecimal(value);
}
} | [
"public",
"static",
"Number",
"getExactlyNumber",
"(",
"final",
"String",
"value",
",",
"final",
"int",
"radix",
")",
"{",
"try",
"{",
"return",
"getBigInteger",
"(",
"value",
",",
"radix",
")",
";",
"}",
"catch",
"(",
"final",
"NumberFormatException",
"ex",... | Get exactly number value and type.
@param value string to be converted
@param radix radix
@return exactly number value and type | [
"Get",
"exactly",
"number",
"value",
"and",
"type",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/util/NumberUtil.java#L71-L77 | train | Gets exactly number. | [
30522,
2270,
10763,
2193,
2131,
10288,
18908,
9644,
29440,
1006,
2345,
5164,
3643,
1010,
2345,
20014,
10958,
4305,
2595,
1007,
1063,
3046,
1063,
2709,
2131,
5638,
11528,
2618,
4590,
1006,
3643,
1010,
10958,
4305,
2595,
1007,
1025,
1065,
460... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SplittableIterator.java | SplittableIterator.getSplit | public Iterator<T> getSplit(int num, int numPartitions) {
if (numPartitions < 1 || num < 0 || num >= numPartitions) {
throw new IllegalArgumentException();
}
return split(numPartitions)[num];
} | java | public Iterator<T> getSplit(int num, int numPartitions) {
if (numPartitions < 1 || num < 0 || num >= numPartitions) {
throw new IllegalArgumentException();
}
return split(numPartitions)[num];
} | [
"public",
"Iterator",
"<",
"T",
">",
"getSplit",
"(",
"int",
"num",
",",
"int",
"numPartitions",
")",
"{",
"if",
"(",
"numPartitions",
"<",
"1",
"||",
"num",
"<",
"0",
"||",
"num",
">=",
"numPartitions",
")",
"{",
"throw",
"new",
"IllegalArgumentExceptio... | Splits this iterator into <i>n</i> partitions and returns the <i>i-th</i> partition
out of those.
@param num The partition to return (<i>i</i>).
@param numPartitions The number of partitions to split into (<i>n</i>).
@return The iterator for the partition. | [
"Splits",
"this",
"iterator",
"into",
"<i",
">",
"n<",
"/",
"i",
">",
"partitions",
"and",
"returns",
"the",
"<i",
">",
"i",
"-",
"th<",
"/",
"i",
">",
"partition",
"out",
"of",
"those",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/SplittableIterator.java#L54-L60 | train | Get the split iterator for the given number of partitions. | [
30522,
2270,
2009,
6906,
4263,
1026,
1056,
1028,
4152,
24759,
4183,
1006,
20014,
16371,
2213,
1010,
20014,
16371,
8737,
8445,
22753,
2015,
1007,
1063,
2065,
1006,
16371,
8737,
8445,
22753,
2015,
1026,
1015,
1064,
1064,
16371,
2213,
1026,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dependency/CoNll/CoNLLSentence.java | CoNLLSentence.getWordArrayWithRoot | public CoNLLWord[] getWordArrayWithRoot()
{
CoNLLWord[] wordArray = new CoNLLWord[word.length + 1];
wordArray[0] = CoNLLWord.ROOT;
System.arraycopy(word, 0, wordArray, 1, word.length);
return wordArray;
} | java | public CoNLLWord[] getWordArrayWithRoot()
{
CoNLLWord[] wordArray = new CoNLLWord[word.length + 1];
wordArray[0] = CoNLLWord.ROOT;
System.arraycopy(word, 0, wordArray, 1, word.length);
return wordArray;
} | [
"public",
"CoNLLWord",
"[",
"]",
"getWordArrayWithRoot",
"(",
")",
"{",
"CoNLLWord",
"[",
"]",
"wordArray",
"=",
"new",
"CoNLLWord",
"[",
"word",
".",
"length",
"+",
"1",
"]",
";",
"wordArray",
"[",
"0",
"]",
"=",
"CoNLLWord",
".",
"ROOT",
";",
"System... | 获取包含根节点在内的单词数组
@return | [
"获取包含根节点在内的单词数组"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dependency/CoNll/CoNLLSentence.java#L92-L99 | train | Returns the word array with the root word. | [
30522,
2270,
9530,
3363,
18351,
1031,
1033,
2131,
18351,
2906,
9447,
24415,
3217,
4140,
1006,
1007,
1063,
9530,
3363,
18351,
1031,
1033,
2773,
2906,
9447,
1027,
2047,
9530,
3363,
18351,
1031,
2773,
1012,
3091,
1009,
1015,
1033,
1025,
2773,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.unzip | public static File unzip(File zipFile, Charset charset) throws UtilException {
return unzip(zipFile, FileUtil.file(zipFile.getParentFile(), FileUtil.mainName(zipFile)), charset);
} | java | public static File unzip(File zipFile, Charset charset) throws UtilException {
return unzip(zipFile, FileUtil.file(zipFile.getParentFile(), FileUtil.mainName(zipFile)), charset);
} | [
"public",
"static",
"File",
"unzip",
"(",
"File",
"zipFile",
",",
"Charset",
"charset",
")",
"throws",
"UtilException",
"{",
"return",
"unzip",
"(",
"zipFile",
",",
"FileUtil",
".",
"file",
"(",
"zipFile",
".",
"getParentFile",
"(",
")",
",",
"FileUtil",
"... | 解压到文件名相同的目录中
@param zipFile 压缩文件
@param charset 编码
@return 解压的目录
@throws UtilException IO异常
@since 3.2.2 | [
"解压到文件名相同的目录中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L333-L335 | train | Unzip a file to a directory. | [
30522,
2270,
10763,
5371,
4895,
5831,
2361,
1006,
5371,
14101,
8873,
2571,
1010,
25869,
13462,
25869,
13462,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
2709,
4895,
5831,
2361,
1006,
14101,
8873,
2571,
1010,
5371,
21823,
2140,
1012,
5371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getCredentialEntry | private CredentialEntry getCredentialEntry(CredentialProvider provider,
String name) throws IOException {
CredentialEntry entry = provider.getCredentialEntry(name);
if (entry != null) {
return entry;
}
// The old name is stored in the credential provider.
String oldName = getDeprecatedKey(name);
if (oldName != null) {
entry = provider.getCredentialEntry(oldName);
if (entry != null) {
logDeprecationOnce(oldName, provider.toString());
return entry;
}
}
// The name is deprecated.
DeprecatedKeyInfo keyInfo = getDeprecatedKeyInfo(name);
if (keyInfo != null && keyInfo.newKeys != null) {
for (String newName : keyInfo.newKeys) {
entry = provider.getCredentialEntry(newName);
if (entry != null) {
logDeprecationOnce(name, null);
return entry;
}
}
}
return null;
} | java | private CredentialEntry getCredentialEntry(CredentialProvider provider,
String name) throws IOException {
CredentialEntry entry = provider.getCredentialEntry(name);
if (entry != null) {
return entry;
}
// The old name is stored in the credential provider.
String oldName = getDeprecatedKey(name);
if (oldName != null) {
entry = provider.getCredentialEntry(oldName);
if (entry != null) {
logDeprecationOnce(oldName, provider.toString());
return entry;
}
}
// The name is deprecated.
DeprecatedKeyInfo keyInfo = getDeprecatedKeyInfo(name);
if (keyInfo != null && keyInfo.newKeys != null) {
for (String newName : keyInfo.newKeys) {
entry = provider.getCredentialEntry(newName);
if (entry != null) {
logDeprecationOnce(name, null);
return entry;
}
}
}
return null;
} | [
"private",
"CredentialEntry",
"getCredentialEntry",
"(",
"CredentialProvider",
"provider",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"CredentialEntry",
"entry",
"=",
"provider",
".",
"getCredentialEntry",
"(",
"name",
")",
";",
"if",
"(",
"entry",
... | Get the credential entry by name from a credential provider.
Handle key deprecation.
@param provider a credential provider
@param name alias of the credential
@return the credential entry or null if not found | [
"Get",
"the",
"credential",
"entry",
"by",
"name",
"from",
"a",
"credential",
"provider",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2175-L2205 | train | Gets the CredentialEntry for the given name from the given credential provider. | [
30522,
2797,
13675,
14728,
19909,
4765,
2854,
2131,
16748,
16454,
4818,
4765,
2854,
1006,
13675,
14728,
19909,
21572,
17258,
2121,
10802,
1010,
5164,
2171,
1007,
11618,
22834,
10288,
24422,
1063,
13675,
14728,
19909,
4765,
2854,
4443,
1027,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactory.java | AbstractServletWebServerFactory.mergeInitializers | protected final ServletContextInitializer[] mergeInitializers(
ServletContextInitializer... initializers) {
List<ServletContextInitializer> mergedInitializers = new ArrayList<>();
mergedInitializers.add((servletContext) -> this.initParameters
.forEach(servletContext::setInitParameter));
mergedInitializers.add(new SessionConfiguringInitializer(this.session));
mergedInitializers.addAll(Arrays.asList(initializers));
mergedInitializers.addAll(this.initializers);
return mergedInitializers.toArray(new ServletContextInitializer[0]);
} | java | protected final ServletContextInitializer[] mergeInitializers(
ServletContextInitializer... initializers) {
List<ServletContextInitializer> mergedInitializers = new ArrayList<>();
mergedInitializers.add((servletContext) -> this.initParameters
.forEach(servletContext::setInitParameter));
mergedInitializers.add(new SessionConfiguringInitializer(this.session));
mergedInitializers.addAll(Arrays.asList(initializers));
mergedInitializers.addAll(this.initializers);
return mergedInitializers.toArray(new ServletContextInitializer[0]);
} | [
"protected",
"final",
"ServletContextInitializer",
"[",
"]",
"mergeInitializers",
"(",
"ServletContextInitializer",
"...",
"initializers",
")",
"{",
"List",
"<",
"ServletContextInitializer",
">",
"mergedInitializers",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"mer... | Utility method that can be used by subclasses wishing to combine the specified
{@link ServletContextInitializer} parameters with those defined in this instance.
@param initializers the initializers to merge
@return a complete set of merged initializers (with the specified parameters
appearing first) | [
"Utility",
"method",
"that",
"can",
"be",
"used",
"by",
"subclasses",
"wishing",
"to",
"combine",
"the",
"specified",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactory.java#L250-L259 | train | Merge the given servlet context initializers into one. | [
30522,
5123,
2345,
14262,
2615,
7485,
8663,
18209,
5498,
20925,
17629,
1031,
1033,
13590,
5498,
20925,
17629,
2015,
1006,
14262,
2615,
7485,
8663,
18209,
5498,
20925,
17629,
1012,
1012,
1012,
3988,
17629,
2015,
1007,
1063,
2862,
1026,
14262,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AbstractDb.java | AbstractDb.queryNumber | public Number queryNumber(String sql, Object... params) throws SQLException {
return query(sql, new NumberHandler(), params);
} | java | public Number queryNumber(String sql, Object... params) throws SQLException {
return query(sql, new NumberHandler(), params);
} | [
"public",
"Number",
"queryNumber",
"(",
"String",
"sql",
",",
"Object",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"return",
"query",
"(",
"sql",
",",
"new",
"NumberHandler",
"(",
")",
",",
"params",
")",
";",
"}"
] | 查询单条单个字段记录,并将其转换为Number
@param sql 查询语句
@param params 参数
@return 结果对象
@throws SQLException SQL执行异常 | [
"查询单条单个字段记录",
"并将其转换为Number"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L118-L120 | train | Query a number statement. | [
30522,
2270,
2193,
23032,
19172,
5677,
1006,
5164,
29296,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
23032,
1006,
29296,
1010,
2047,
2193,
11774,
3917,
1006,
1007,
1010,
11498,
5244,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.getAny | public static <T> T[] getAny(Object array, int... indexes) {
if(null == array) {
return null;
}
final T[] result = newArray(array.getClass().getComponentType(), indexes.length);
for (int i : indexes) {
result[i] = get(array, i);
}
return result;
} | java | public static <T> T[] getAny(Object array, int... indexes) {
if(null == array) {
return null;
}
final T[] result = newArray(array.getClass().getComponentType(), indexes.length);
for (int i : indexes) {
result[i] = get(array, i);
}
return result;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"getAny",
"(",
"Object",
"array",
",",
"int",
"...",
"indexes",
")",
"{",
"if",
"(",
"null",
"==",
"array",
")",
"{",
"return",
"null",
";",
"}",
"final",
"T",
"[",
"]",
"result",
"=",
"newArray",... | 获取数组中指定多个下标元素值,组成新数组
@param <T> 数组元素类型
@param array 数组
@param indexes 下标列表
@return 结果 | [
"获取数组中指定多个下标元素值,组成新数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L1834-L1844 | train | Gets any value in the array with the specified indexes. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
1031,
1033,
2131,
19092,
1006,
4874,
9140,
1010,
20014,
1012,
1012,
1012,
5950,
2229,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
9140,
1007,
1063,
2709,
19701,
1025,
1065,
2345,
1056,
1031,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | metrics/src/main/java/io/dropwizard/metrics/ScheduledReporter.java | ScheduledReporter.start | public void start(long period, TimeUnit unit) {
executor.scheduleAtFixedRate(() -> {
try {
report();
} catch (RuntimeException ex) {
LOG.error("RuntimeException thrown from {}#report. Exception was suppressed.", ScheduledReporter.this.getClass().getSimpleName(), ex);
}
}, period, period, unit);
} | java | public void start(long period, TimeUnit unit) {
executor.scheduleAtFixedRate(() -> {
try {
report();
} catch (RuntimeException ex) {
LOG.error("RuntimeException thrown from {}#report. Exception was suppressed.", ScheduledReporter.this.getClass().getSimpleName(), ex);
}
}, period, period, unit);
} | [
"public",
"void",
"start",
"(",
"long",
"period",
",",
"TimeUnit",
"unit",
")",
"{",
"executor",
".",
"scheduleAtFixedRate",
"(",
"(",
")",
"->",
"{",
"try",
"{",
"report",
"(",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"ex",
")",
"{",
"LOG",
... | Starts the reporter polling at the given period.
@param period the amount of time between polls
@param unit the unit for {@code period} | [
"Starts",
"the",
"reporter",
"polling",
"at",
"the",
"given",
"period",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/ScheduledReporter.java#L127-L135 | train | Start the report task. | [
30522,
2270,
11675,
2707,
1006,
2146,
2558,
1010,
2051,
19496,
2102,
3131,
1007,
1063,
4654,
8586,
16161,
2099,
1012,
6134,
4017,
23901,
11657,
1006,
1006,
1007,
1011,
1028,
1063,
3046,
1063,
3189,
1006,
1007,
1025,
1065,
4608,
1006,
2448,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/FlinkKinesisConsumer.java | FlinkKinesisConsumer.createFetcher | protected KinesisDataFetcher<T> createFetcher(
List<String> streams,
SourceFunction.SourceContext<T> sourceContext,
RuntimeContext runtimeContext,
Properties configProps,
KinesisDeserializationSchema<T> deserializationSchema) {
return new KinesisDataFetcher<>(streams, sourceContext, runtimeContext, configProps, deserializationSchema, shardAssigner, periodicWatermarkAssigner);
} | java | protected KinesisDataFetcher<T> createFetcher(
List<String> streams,
SourceFunction.SourceContext<T> sourceContext,
RuntimeContext runtimeContext,
Properties configProps,
KinesisDeserializationSchema<T> deserializationSchema) {
return new KinesisDataFetcher<>(streams, sourceContext, runtimeContext, configProps, deserializationSchema, shardAssigner, periodicWatermarkAssigner);
} | [
"protected",
"KinesisDataFetcher",
"<",
"T",
">",
"createFetcher",
"(",
"List",
"<",
"String",
">",
"streams",
",",
"SourceFunction",
".",
"SourceContext",
"<",
"T",
">",
"sourceContext",
",",
"RuntimeContext",
"runtimeContext",
",",
"Properties",
"configProps",
"... | This method is exposed for tests that need to mock the KinesisDataFetcher in the consumer. | [
"This",
"method",
"is",
"exposed",
"for",
"tests",
"that",
"need",
"to",
"mock",
"the",
"KinesisDataFetcher",
"in",
"the",
"consumer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/FlinkKinesisConsumer.java#L444-L452 | train | Creates a KinesisDataFetcher instance. | [
30522,
5123,
12631,
19009,
2850,
2696,
7959,
10649,
2121,
1026,
1056,
1028,
3443,
7959,
10649,
2121,
1006,
2862,
1026,
5164,
1028,
9199,
1010,
3120,
11263,
27989,
1012,
3120,
8663,
18209,
1026,
1056,
1028,
3120,
8663,
18209,
1010,
2448,
729... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFile.java | ChangedFile.getRelativeName | public String getRelativeName() {
File folder = this.sourceFolder.getAbsoluteFile();
File file = this.file.getAbsoluteFile();
String folderName = StringUtils.cleanPath(folder.getPath());
String fileName = StringUtils.cleanPath(file.getPath());
Assert.state(fileName.startsWith(folderName), () -> "The file " + fileName
+ " is not contained in the source folder " + folderName);
return fileName.substring(folderName.length() + 1);
} | java | public String getRelativeName() {
File folder = this.sourceFolder.getAbsoluteFile();
File file = this.file.getAbsoluteFile();
String folderName = StringUtils.cleanPath(folder.getPath());
String fileName = StringUtils.cleanPath(file.getPath());
Assert.state(fileName.startsWith(folderName), () -> "The file " + fileName
+ " is not contained in the source folder " + folderName);
return fileName.substring(folderName.length() + 1);
} | [
"public",
"String",
"getRelativeName",
"(",
")",
"{",
"File",
"folder",
"=",
"this",
".",
"sourceFolder",
".",
"getAbsoluteFile",
"(",
")",
";",
"File",
"file",
"=",
"this",
".",
"file",
".",
"getAbsoluteFile",
"(",
")",
";",
"String",
"folderName",
"=",
... | Return the name of the file relative to the source folder.
@return the relative name | [
"Return",
"the",
"name",
"of",
"the",
"file",
"relative",
"to",
"the",
"source",
"folder",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFile.java#L74-L82 | train | Gets the relative name of the file. | [
30522,
2270,
5164,
2131,
16570,
8082,
18442,
1006,
1007,
1063,
5371,
19622,
1027,
2023,
1012,
3120,
10371,
2121,
1012,
2131,
7875,
19454,
10421,
8873,
2571,
1006,
1007,
1025,
5371,
5371,
1027,
2023,
1012,
5371,
1012,
2131,
7875,
19454,
1042... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java | VelocityUtil.toWriter | public static void toWriter(String templateFileName, VelocityContext context, Writer writer) {
assertInit();
final Template template = Velocity.getTemplate(templateFileName);
merge(template, context, writer);
} | java | public static void toWriter(String templateFileName, VelocityContext context, Writer writer) {
assertInit();
final Template template = Velocity.getTemplate(templateFileName);
merge(template, context, writer);
} | [
"public",
"static",
"void",
"toWriter",
"(",
"String",
"templateFileName",
",",
"VelocityContext",
"context",
",",
"Writer",
"writer",
")",
"{",
"assertInit",
"(",
")",
";",
"final",
"Template",
"template",
"=",
"Velocity",
".",
"getTemplate",
"(",
"templateFile... | 生成内容写入流<br>
会自动关闭Writer
@param templateFileName 模板文件名
@param context 上下文
@param writer 流 | [
"生成内容写入流<br",
">",
"会自动关闭Writer"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L199-L204 | train | Write a Velocity template to a Writer. | [
30522,
2270,
10763,
11675,
15805,
17625,
2099,
1006,
5164,
23561,
8873,
20844,
4168,
1010,
10146,
8663,
18209,
6123,
1010,
3213,
3213,
1007,
1063,
20865,
5498,
2102,
1006,
1007,
1025,
2345,
23561,
23561,
1027,
10146,
1012,
2131,
18532,
15725,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java | RadixSort.sortKeyPrefixArrayAtByte | private static void sortKeyPrefixArrayAtByte(
LongArray array, long numRecords, long[] counts, int byteIdx, long inIndex, long outIndex,
boolean desc, boolean signed) {
assert counts.length == 256;
long[] offsets = transformCountsToOffsets(
counts, numRecords, array.getBaseOffset() + outIndex * 8L, 16, desc, signed);
Object baseObject = array.getBaseObject();
long baseOffset = array.getBaseOffset() + inIndex * 8L;
long maxOffset = baseOffset + numRecords * 16L;
for (long offset = baseOffset; offset < maxOffset; offset += 16) {
long key = Platform.getLong(baseObject, offset);
long prefix = Platform.getLong(baseObject, offset + 8);
int bucket = (int)((prefix >>> (byteIdx * 8)) & 0xff);
long dest = offsets[bucket];
Platform.putLong(baseObject, dest, key);
Platform.putLong(baseObject, dest + 8, prefix);
offsets[bucket] += 16;
}
} | java | private static void sortKeyPrefixArrayAtByte(
LongArray array, long numRecords, long[] counts, int byteIdx, long inIndex, long outIndex,
boolean desc, boolean signed) {
assert counts.length == 256;
long[] offsets = transformCountsToOffsets(
counts, numRecords, array.getBaseOffset() + outIndex * 8L, 16, desc, signed);
Object baseObject = array.getBaseObject();
long baseOffset = array.getBaseOffset() + inIndex * 8L;
long maxOffset = baseOffset + numRecords * 16L;
for (long offset = baseOffset; offset < maxOffset; offset += 16) {
long key = Platform.getLong(baseObject, offset);
long prefix = Platform.getLong(baseObject, offset + 8);
int bucket = (int)((prefix >>> (byteIdx * 8)) & 0xff);
long dest = offsets[bucket];
Platform.putLong(baseObject, dest, key);
Platform.putLong(baseObject, dest + 8, prefix);
offsets[bucket] += 16;
}
} | [
"private",
"static",
"void",
"sortKeyPrefixArrayAtByte",
"(",
"LongArray",
"array",
",",
"long",
"numRecords",
",",
"long",
"[",
"]",
"counts",
",",
"int",
"byteIdx",
",",
"long",
"inIndex",
",",
"long",
"outIndex",
",",
"boolean",
"desc",
",",
"boolean",
"s... | Specialization of sortAtByte() for key-prefix arrays. | [
"Specialization",
"of",
"sortAtByte",
"()",
"for",
"key",
"-",
"prefix",
"arrays",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java#L242-L260 | train | Sort key prefix array at byte. | [
30522,
2797,
10763,
11675,
4066,
14839,
28139,
8873,
18684,
11335,
26139,
3762,
2618,
1006,
2146,
2906,
9447,
9140,
1010,
2146,
16371,
2213,
2890,
27108,
5104,
1010,
2146,
1031,
1033,
9294,
1010,
20014,
24880,
3593,
2595,
1010,
2146,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryArray.java | BinaryArray.calculateFixLengthPartSize | public static int calculateFixLengthPartSize(InternalType type) {
if (type.equals(InternalTypes.BOOLEAN)) {
return 1;
} else if (type.equals(InternalTypes.BYTE)) {
return 1;
} else if (type.equals(InternalTypes.SHORT)) {
return 2;
} else if (type.equals(InternalTypes.INT)) {
return 4;
} else if (type.equals(InternalTypes.FLOAT)) {
return 4;
} else if (type.equals(InternalTypes.CHAR)) {
return 2;
} else if (type.equals(InternalTypes.DATE)) {
return 4;
} else if (type.equals(InternalTypes.TIME)) {
return 4;
} else {
// long, double is 8 bytes.
// It store the length and offset of variable-length part when type is string, map, etc.
return 8;
}
} | java | public static int calculateFixLengthPartSize(InternalType type) {
if (type.equals(InternalTypes.BOOLEAN)) {
return 1;
} else if (type.equals(InternalTypes.BYTE)) {
return 1;
} else if (type.equals(InternalTypes.SHORT)) {
return 2;
} else if (type.equals(InternalTypes.INT)) {
return 4;
} else if (type.equals(InternalTypes.FLOAT)) {
return 4;
} else if (type.equals(InternalTypes.CHAR)) {
return 2;
} else if (type.equals(InternalTypes.DATE)) {
return 4;
} else if (type.equals(InternalTypes.TIME)) {
return 4;
} else {
// long, double is 8 bytes.
// It store the length and offset of variable-length part when type is string, map, etc.
return 8;
}
} | [
"public",
"static",
"int",
"calculateFixLengthPartSize",
"(",
"InternalType",
"type",
")",
"{",
"if",
"(",
"type",
".",
"equals",
"(",
"InternalTypes",
".",
"BOOLEAN",
")",
")",
"{",
"return",
"1",
";",
"}",
"else",
"if",
"(",
"type",
".",
"equals",
"(",... | It store real value when type is primitive.
It store the length and offset of variable-length part when type is string, map, etc. | [
"It",
"store",
"real",
"value",
"when",
"type",
"is",
"primitive",
".",
"It",
"store",
"the",
"length",
"and",
"offset",
"of",
"variable",
"-",
"length",
"part",
"when",
"type",
"is",
"string",
"map",
"etc",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryArray.java#L59-L81 | train | Calculates the size of a fixed length part of a type. | [
30522,
2270,
10763,
20014,
18422,
8873,
2595,
7770,
13512,
22269,
20591,
4697,
1006,
4722,
13874,
2828,
1007,
1063,
2065,
1006,
2828,
1012,
19635,
1006,
4722,
13874,
2015,
1012,
22017,
20898,
1007,
1007,
1063,
2709,
1015,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.timeToSecond | public static int timeToSecond(String timeStr) {
if (StrUtil.isEmpty(timeStr)) {
return 0;
}
final List<String> hms = StrUtil.splitTrim(timeStr, StrUtil.C_COLON, 3);
int lastIndex = hms.size() - 1;
int result = 0;
for (int i = lastIndex; i >= 0; i--) {
result += Integer.parseInt(hms.get(i)) * Math.pow(60, (lastIndex - i));
}
return result;
} | java | public static int timeToSecond(String timeStr) {
if (StrUtil.isEmpty(timeStr)) {
return 0;
}
final List<String> hms = StrUtil.splitTrim(timeStr, StrUtil.C_COLON, 3);
int lastIndex = hms.size() - 1;
int result = 0;
for (int i = lastIndex; i >= 0; i--) {
result += Integer.parseInt(hms.get(i)) * Math.pow(60, (lastIndex - i));
}
return result;
} | [
"public",
"static",
"int",
"timeToSecond",
"(",
"String",
"timeStr",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isEmpty",
"(",
"timeStr",
")",
")",
"{",
"return",
"0",
";",
"}",
"final",
"List",
"<",
"String",
">",
"hms",
"=",
"StrUtil",
".",
"splitTrim",
... | HH:mm:ss 时间格式字符串转为秒数<br>
参考:https://github.com/iceroot
@param timeStr 字符串时分秒(HH:mm:ss)格式
@return 时分秒转换后的秒数
@since 3.1.2 | [
"HH",
":",
"mm",
":",
"ss",
"时间格式字符串转为秒数<br",
">",
"参考:https",
":",
"//",
"github",
".",
"com",
"/",
"iceroot"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1574-L1587 | train | Returns the number of seconds between two strings. | [
30522,
2270,
10763,
20014,
2051,
22282,
8663,
2094,
1006,
5164,
2335,
16344,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
6633,
13876,
2100,
1006,
2335,
16344,
1007,
1007,
1063,
2709,
1014,
1025,
1065,
2345,
2862,
1026,
5164,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/common/CommonSynonymDictionary.java | CommonSynonymDictionary.distance | public long distance(String a, String b)
{
SynonymItem itemA = get(a);
if (itemA == null) return Long.MAX_VALUE / 3;
SynonymItem itemB = get(b);
if (itemB == null) return Long.MAX_VALUE / 3;
return itemA.distance(itemB);
} | java | public long distance(String a, String b)
{
SynonymItem itemA = get(a);
if (itemA == null) return Long.MAX_VALUE / 3;
SynonymItem itemB = get(b);
if (itemB == null) return Long.MAX_VALUE / 3;
return itemA.distance(itemB);
} | [
"public",
"long",
"distance",
"(",
"String",
"a",
",",
"String",
"b",
")",
"{",
"SynonymItem",
"itemA",
"=",
"get",
"(",
"a",
")",
";",
"if",
"(",
"itemA",
"==",
"null",
")",
"return",
"Long",
".",
"MAX_VALUE",
"/",
"3",
";",
"SynonymItem",
"itemB",
... | 语义距离
@param a
@param b
@return | [
"语义距离"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/common/CommonSynonymDictionary.java#L127-L135 | train | Get distance between two tokens. | [
30522,
2270,
2146,
3292,
1006,
5164,
1037,
1010,
5164,
1038,
1007,
1063,
10675,
4221,
2213,
8875,
2050,
1027,
2131,
1006,
1037,
1007,
1025,
2065,
1006,
8875,
2050,
1027,
1027,
19701,
1007,
2709,
2146,
1012,
4098,
1035,
3643,
1013,
1017,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java | FileInputFormat.registerInflaterInputStreamFactory | public static void registerInflaterInputStreamFactory(String fileExtension, InflaterInputStreamFactory<?> factory) {
synchronized (INFLATER_INPUT_STREAM_FACTORIES) {
if (INFLATER_INPUT_STREAM_FACTORIES.put(fileExtension, factory) != null) {
LOG.warn("Overwriting an existing decompression algorithm for \"{}\" files.", fileExtension);
}
}
} | java | public static void registerInflaterInputStreamFactory(String fileExtension, InflaterInputStreamFactory<?> factory) {
synchronized (INFLATER_INPUT_STREAM_FACTORIES) {
if (INFLATER_INPUT_STREAM_FACTORIES.put(fileExtension, factory) != null) {
LOG.warn("Overwriting an existing decompression algorithm for \"{}\" files.", fileExtension);
}
}
} | [
"public",
"static",
"void",
"registerInflaterInputStreamFactory",
"(",
"String",
"fileExtension",
",",
"InflaterInputStreamFactory",
"<",
"?",
">",
"factory",
")",
"{",
"synchronized",
"(",
"INFLATER_INPUT_STREAM_FACTORIES",
")",
"{",
"if",
"(",
"INFLATER_INPUT_STREAM_FAC... | Registers a decompression algorithm through a {@link org.apache.flink.api.common.io.compression.InflaterInputStreamFactory}
with a file extension for transparent decompression.
@param fileExtension of the compressed files
@param factory to create an {@link java.util.zip.InflaterInputStream} that handles the decompression format | [
"Registers",
"a",
"decompression",
"algorithm",
"through",
"a",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java#L138-L144 | train | Registers an input stream factory for the specified file extension. | [
30522,
2270,
10763,
11675,
4236,
2378,
10258,
24932,
2378,
18780,
21422,
21450,
1006,
5164,
5371,
10288,
29048,
1010,
1999,
10258,
24932,
2378,
18780,
21422,
21450,
1026,
1029,
1028,
4713,
1007,
1063,
25549,
1006,
1999,
10258,
24932,
1035,
79... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/rtsp/RtspVersions.java | RtspVersions.valueOf | public static HttpVersion valueOf(String text) {
if (text == null) {
throw new NullPointerException("text");
}
text = text.trim().toUpperCase();
if ("RTSP/1.0".equals(text)) {
return RTSP_1_0;
}
return new HttpVersion(text, true);
} | java | public static HttpVersion valueOf(String text) {
if (text == null) {
throw new NullPointerException("text");
}
text = text.trim().toUpperCase();
if ("RTSP/1.0".equals(text)) {
return RTSP_1_0;
}
return new HttpVersion(text, true);
} | [
"public",
"static",
"HttpVersion",
"valueOf",
"(",
"String",
"text",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"text\"",
")",
";",
"}",
"text",
"=",
"text",
".",
"trim",
"(",
")",
".",
"toUpperC... | Returns an existing or new {@link HttpVersion} instance which matches to
the specified RTSP version string. If the specified {@code text} is
equal to {@code "RTSP/1.0"}, {@link #RTSP_1_0} will be returned.
Otherwise, a new {@link HttpVersion} instance will be returned. | [
"Returns",
"an",
"existing",
"or",
"new",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/rtsp/RtspVersions.java#L36-L47 | train | Gets the HttpVersion object from the specified string. | [
30522,
2270,
10763,
8299,
27774,
3643,
11253,
1006,
5164,
3793,
1007,
1063,
2065,
1006,
3793,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
3793,
1000,
1007,
1025,
1065,
3793,
1027,
3793,
1012,
12241... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java | CustomDictionary.parseText | public static void parseText(String text, AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor)
{
if (trie != null)
{
BaseSearcher searcher = CustomDictionary.getSearcher(text);
int offset;
Map.Entry<String, CoreDictionary.Attribute> entry;
while ((entry = searcher.next()) != null)
{
offset = searcher.getOffset();
processor.hit(offset, offset + entry.getKey().length(), entry.getValue());
}
}
DoubleArrayTrie<CoreDictionary.Attribute>.Searcher searcher = dat.getSearcher(text, 0);
while (searcher.next())
{
processor.hit(searcher.begin, searcher.begin + searcher.length, searcher.value);
}
} | java | public static void parseText(String text, AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute> processor)
{
if (trie != null)
{
BaseSearcher searcher = CustomDictionary.getSearcher(text);
int offset;
Map.Entry<String, CoreDictionary.Attribute> entry;
while ((entry = searcher.next()) != null)
{
offset = searcher.getOffset();
processor.hit(offset, offset + entry.getKey().length(), entry.getValue());
}
}
DoubleArrayTrie<CoreDictionary.Attribute>.Searcher searcher = dat.getSearcher(text, 0);
while (searcher.next())
{
processor.hit(searcher.begin, searcher.begin + searcher.length, searcher.value);
}
} | [
"public",
"static",
"void",
"parseText",
"(",
"String",
"text",
",",
"AhoCorasickDoubleArrayTrie",
".",
"IHit",
"<",
"CoreDictionary",
".",
"Attribute",
">",
"processor",
")",
"{",
"if",
"(",
"trie",
"!=",
"null",
")",
"{",
"BaseSearcher",
"searcher",
"=",
"... | 解析一段文本(目前采用了BinTrie+DAT的混合储存形式,此方法可以统一两个数据结构)
@param text 文本
@param processor 处理器 | [
"解析一段文本(目前采用了BinTrie",
"+",
"DAT的混合储存形式,此方法可以统一两个数据结构)"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L578-L596 | train | Parse text into a single segment. | [
30522,
2270,
10763,
11675,
11968,
13462,
10288,
2102,
1006,
5164,
3793,
1010,
6289,
24163,
8180,
6799,
26797,
3468,
2906,
9447,
18886,
2063,
1012,
1045,
16584,
1026,
4563,
29201,
3258,
5649,
1012,
17961,
1028,
13151,
1007,
1063,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java | ConditionMessage.forCondition | public static Builder forCondition(Class<? extends Annotation> condition,
Object... details) {
return new ConditionMessage().andCondition(condition, details);
} | java | public static Builder forCondition(Class<? extends Annotation> condition,
Object... details) {
return new ConditionMessage().andCondition(condition, details);
} | [
"public",
"static",
"Builder",
"forCondition",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"condition",
",",
"Object",
"...",
"details",
")",
"{",
"return",
"new",
"ConditionMessage",
"(",
")",
".",
"andCondition",
"(",
"condition",
",",
"details",
... | Factory method for a builder to construct a new {@link ConditionMessage} for a
condition.
@param condition the condition
@param details details of the condition
@return a {@link Builder} builder
@see #forCondition(String, Object...)
@see #andCondition(String, Object...) | [
"Factory",
"method",
"for",
"a",
"builder",
"to",
"construct",
"a",
"new",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java#L180-L183 | train | Creates a builder for a condition message. | [
30522,
2270,
10763,
12508,
2005,
8663,
20562,
1006,
2465,
1026,
1029,
8908,
5754,
17287,
3508,
1028,
4650,
1010,
4874,
1012,
1012,
1012,
4751,
1007,
1063,
2709,
2047,
4650,
7834,
3736,
3351,
1006,
1007,
1012,
1998,
8663,
20562,
1006,
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... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/NetUtils.java | NetUtils.getIPv6UrlRepresentation | private static String getIPv6UrlRepresentation(byte[] addressBytes) {
// first, convert bytes to 16 bit chunks
int[] hextets = new int[8];
for (int i = 0; i < hextets.length; i++) {
hextets[i] = (addressBytes[2 * i] & 0xFF) << 8 | (addressBytes[2 * i + 1] & 0xFF);
}
// now, find the sequence of zeros that should be compressed
int bestRunStart = -1;
int bestRunLength = -1;
int runStart = -1;
for (int i = 0; i < hextets.length + 1; i++) {
if (i < hextets.length && hextets[i] == 0) {
if (runStart < 0) {
runStart = i;
}
} else if (runStart >= 0) {
int runLength = i - runStart;
if (runLength > bestRunLength) {
bestRunStart = runStart;
bestRunLength = runLength;
}
runStart = -1;
}
}
if (bestRunLength >= 2) {
Arrays.fill(hextets, bestRunStart, bestRunStart + bestRunLength, -1);
}
// convert into text form
StringBuilder buf = new StringBuilder(40);
buf.append('[');
boolean lastWasNumber = false;
for (int i = 0; i < hextets.length; i++) {
boolean thisIsNumber = hextets[i] >= 0;
if (thisIsNumber) {
if (lastWasNumber) {
buf.append(':');
}
buf.append(Integer.toHexString(hextets[i]));
} else {
if (i == 0 || lastWasNumber) {
buf.append("::");
}
}
lastWasNumber = thisIsNumber;
}
buf.append(']');
return buf.toString();
} | java | private static String getIPv6UrlRepresentation(byte[] addressBytes) {
// first, convert bytes to 16 bit chunks
int[] hextets = new int[8];
for (int i = 0; i < hextets.length; i++) {
hextets[i] = (addressBytes[2 * i] & 0xFF) << 8 | (addressBytes[2 * i + 1] & 0xFF);
}
// now, find the sequence of zeros that should be compressed
int bestRunStart = -1;
int bestRunLength = -1;
int runStart = -1;
for (int i = 0; i < hextets.length + 1; i++) {
if (i < hextets.length && hextets[i] == 0) {
if (runStart < 0) {
runStart = i;
}
} else if (runStart >= 0) {
int runLength = i - runStart;
if (runLength > bestRunLength) {
bestRunStart = runStart;
bestRunLength = runLength;
}
runStart = -1;
}
}
if (bestRunLength >= 2) {
Arrays.fill(hextets, bestRunStart, bestRunStart + bestRunLength, -1);
}
// convert into text form
StringBuilder buf = new StringBuilder(40);
buf.append('[');
boolean lastWasNumber = false;
for (int i = 0; i < hextets.length; i++) {
boolean thisIsNumber = hextets[i] >= 0;
if (thisIsNumber) {
if (lastWasNumber) {
buf.append(':');
}
buf.append(Integer.toHexString(hextets[i]));
} else {
if (i == 0 || lastWasNumber) {
buf.append("::");
}
}
lastWasNumber = thisIsNumber;
}
buf.append(']');
return buf.toString();
} | [
"private",
"static",
"String",
"getIPv6UrlRepresentation",
"(",
"byte",
"[",
"]",
"addressBytes",
")",
"{",
"// first, convert bytes to 16 bit chunks",
"int",
"[",
"]",
"hextets",
"=",
"new",
"int",
"[",
"8",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
... | Creates a compressed URL style representation of an Inet6Address.
<p>This method copies and adopts code from Google's Guava library.
We re-implement this here in order to reduce dependency on Guava.
The Guava library has frequently caused dependency conflicts in the past. | [
"Creates",
"a",
"compressed",
"URL",
"style",
"representation",
"of",
"an",
"Inet6Address",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/NetUtils.java#L251-L301 | train | This method returns the IPv6 representation of the given address bytes. | [
30522,
2797,
10763,
5164,
2131,
11514,
2615,
2575,
3126,
20974,
13699,
6072,
19304,
1006,
24880,
1031,
1033,
4769,
3762,
4570,
1007,
1063,
1013,
1013,
2034,
1010,
10463,
27507,
2000,
2385,
2978,
24839,
20014,
1031,
1033,
2002,
18413,
30524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/PoolChunkList.java | PoolChunkList.add0 | void add0(PoolChunk<T> chunk) {
chunk.parent = this;
if (head == null) {
head = chunk;
chunk.prev = null;
chunk.next = null;
} else {
chunk.prev = null;
chunk.next = head;
head.prev = chunk;
head = chunk;
}
} | java | void add0(PoolChunk<T> chunk) {
chunk.parent = this;
if (head == null) {
head = chunk;
chunk.prev = null;
chunk.next = null;
} else {
chunk.prev = null;
chunk.next = head;
head.prev = chunk;
head = chunk;
}
} | [
"void",
"add0",
"(",
"PoolChunk",
"<",
"T",
">",
"chunk",
")",
"{",
"chunk",
".",
"parent",
"=",
"this",
";",
"if",
"(",
"head",
"==",
"null",
")",
"{",
"head",
"=",
"chunk",
";",
"chunk",
".",
"prev",
"=",
"null",
";",
"chunk",
".",
"next",
"=... | Adds the {@link PoolChunk} to this {@link PoolChunkList}. | [
"Adds",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/PoolChunkList.java#L146-L158 | train | Add a new chunk to the end of the list. | [
30522,
11675,
5587,
2692,
1006,
4770,
20760,
8950,
1026,
1056,
1028,
20000,
1007,
1063,
20000,
1012,
6687,
1027,
2023,
1025,
2065,
1006,
2132,
1027,
1027,
19701,
1007,
1063,
2132,
1027,
20000,
1025,
20000,
1012,
3653,
2615,
1027,
19701,
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-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java | ParameterTool.getShort | public short getShort(String key, short defaultValue) {
addToDefaults(key, Short.toString(defaultValue));
String value = get(key);
if (value == null) {
return defaultValue;
} else {
return Short.valueOf(value);
}
} | java | public short getShort(String key, short defaultValue) {
addToDefaults(key, Short.toString(defaultValue));
String value = get(key);
if (value == null) {
return defaultValue;
} else {
return Short.valueOf(value);
}
} | [
"public",
"short",
"getShort",
"(",
"String",
"key",
",",
"short",
"defaultValue",
")",
"{",
"addToDefaults",
"(",
"key",
",",
"Short",
".",
"toString",
"(",
"defaultValue",
")",
")",
";",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",... | Returns the Short value for the given key. If the key does not exists it will return the default value given.
The method fails if the value is not a Short. | [
"Returns",
"the",
"Short",
"value",
"for",
"the",
"given",
"key",
".",
"If",
"the",
"key",
"does",
"not",
"exists",
"it",
"will",
"return",
"the",
"default",
"value",
"given",
".",
"The",
"method",
"fails",
"if",
"the",
"value",
"is",
"not",
"a",
"Shor... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L423-L431 | train | Gets the Short value associated with the given key. The method fails if the key does not exist in this context. | [
30522,
2270,
2460,
4152,
27794,
1006,
5164,
3145,
1010,
2460,
12398,
10175,
5657,
1007,
1063,
5587,
3406,
3207,
7011,
11314,
2015,
1006,
3145,
1010,
2460,
1012,
2000,
3367,
4892,
1006,
12398,
10175,
5657,
1007,
1007,
1025,
5164,
3643,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/Convert.java | Convert.toBigDecimal | public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) {
return convert(BigDecimal.class, value, defaultValue);
} | java | public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) {
return convert(BigDecimal.class, value, defaultValue);
} | [
"public",
"static",
"BigDecimal",
"toBigDecimal",
"(",
"Object",
"value",
",",
"BigDecimal",
"defaultValue",
")",
"{",
"return",
"convert",
"(",
"BigDecimal",
".",
"class",
",",
"value",
",",
"defaultValue",
")",
";",
"}"
] | 转换为BigDecimal<br>
如果给定的值为空,或者转换失败,返回默认值<br>
转换失败不会报错
@param value 被转换的值
@param defaultValue 转换错误时的默认值
@return 结果 | [
"转换为BigDecimal<br",
">",
"如果给定的值为空,或者转换失败,返回默认值<br",
">",
"转换失败不会报错"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L421-L423 | train | Converts value of type BigInteger to BigDecimal. | [
30522,
2270,
10763,
2502,
3207,
6895,
9067,
2000,
5638,
2290,
3207,
6895,
9067,
1006,
4874,
3643,
1010,
2502,
3207,
6895,
9067,
12398,
10175,
5657,
1007,
1063,
2709,
10463,
1006,
2502,
3207,
6895,
9067,
1012,
2465,
1010,
3643,
1010,
12398,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/AhoCorasick/State.java | State.nextState | private State nextState(Character character, boolean ignoreRootState)
{
State nextState = this.success.get(character);
if (!ignoreRootState && nextState == null && this.depth == 0)
{
nextState = this;
}
return nextState;
} | java | private State nextState(Character character, boolean ignoreRootState)
{
State nextState = this.success.get(character);
if (!ignoreRootState && nextState == null && this.depth == 0)
{
nextState = this;
}
return nextState;
} | [
"private",
"State",
"nextState",
"(",
"Character",
"character",
",",
"boolean",
"ignoreRootState",
")",
"{",
"State",
"nextState",
"=",
"this",
".",
"success",
".",
"get",
"(",
"character",
")",
";",
"if",
"(",
"!",
"ignoreRootState",
"&&",
"nextState",
"=="... | 转移到下一个状态
@param character 希望按此字符转移
@param ignoreRootState 是否忽略根节点,如果是根节点自己调用则应该是true,否则为false
@return 转移结果 | [
"转移到下一个状态"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/AhoCorasick/State.java#L154-L162 | train | Get the next state for a given character. | [
30522,
2797,
2110,
2279,
9153,
2618,
1006,
2839,
2839,
1010,
22017,
20898,
8568,
3217,
12868,
12259,
1007,
1063,
2110,
2279,
9153,
2618,
1027,
2023,
1012,
3112,
1012,
2131,
1006,
2839,
1007,
1025,
2065,
1006,
999,
8568,
3217,
12868,
12259,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java | Ftp.upload | public boolean upload(String path, String fileName, File file) {
try (InputStream in = FileUtil.getInputStream(file)) {
return upload(path, fileName, in);
} catch (IOException e) {
throw new FtpException(e);
}
} | java | public boolean upload(String path, String fileName, File file) {
try (InputStream in = FileUtil.getInputStream(file)) {
return upload(path, fileName, in);
} catch (IOException e) {
throw new FtpException(e);
}
} | [
"public",
"boolean",
"upload",
"(",
"String",
"path",
",",
"String",
"fileName",
",",
"File",
"file",
")",
"{",
"try",
"(",
"InputStream",
"in",
"=",
"FileUtil",
".",
"getInputStream",
"(",
"file",
")",
")",
"{",
"return",
"upload",
"(",
"path",
",",
"... | 上传文件到指定目录,可选:
<pre>
1. path为null或""上传到当前路径
2. path为相对路径则相对于当前路径的子路径
3. path为绝对路径则上传到此路径
</pre>
@param file 文件
@param path 服务端路径,可以为{@code null} 或者相对路径或绝对路径
@param fileName 自定义在服务端保存的文件名
@return 是否上传成功 | [
"上传文件到指定目录,可选:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java#L382-L388 | train | Uploads a file to the server. | [
30522,
2270,
22017,
20898,
2039,
11066,
1006,
5164,
4130,
1010,
5164,
5371,
18442,
1010,
5371,
5371,
1007,
1063,
3046,
1006,
20407,
25379,
1999,
1027,
5371,
21823,
2140,
1012,
2131,
2378,
18780,
21422,
1006,
5371,
1007,
1007,
1063,
2709,
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-runtime/src/main/java/org/apache/flink/runtime/instance/InstanceManager.java | InstanceManager.registerTaskManager | public InstanceID registerTaskManager(
TaskManagerGateway taskManagerGateway,
TaskManagerLocation taskManagerLocation,
HardwareDescription resources,
int numberOfSlots) {
synchronized (this.lock) {
if (this.isShutdown) {
throw new IllegalStateException("InstanceManager is shut down.");
}
Instance prior = registeredHostsByResource.get(taskManagerLocation.getResourceID());
if (prior != null) {
throw new IllegalStateException("Registration attempt from TaskManager at "
+ taskManagerLocation.addressString() +
". This connection is already registered under ID " + prior.getId());
}
boolean wasDead = this.deadHosts.remove(taskManagerLocation.getResourceID());
if (wasDead) {
LOG.info("Registering TaskManager at " + taskManagerLocation.addressString() +
" which was marked as dead earlier because of a heart-beat timeout.");
}
InstanceID instanceID = new InstanceID();
Instance host = new Instance(
taskManagerGateway,
taskManagerLocation,
instanceID,
resources,
numberOfSlots);
registeredHostsById.put(instanceID, host);
registeredHostsByResource.put(taskManagerLocation.getResourceID(), host);
totalNumberOfAliveTaskSlots += numberOfSlots;
if (LOG.isInfoEnabled()) {
LOG.info(String.format("Registered TaskManager at %s (%s) as %s. " +
"Current number of registered hosts is %d. " +
"Current number of alive task slots is %d.",
taskManagerLocation.getHostname(),
taskManagerGateway.getAddress(),
instanceID,
registeredHostsById.size(),
totalNumberOfAliveTaskSlots));
}
host.reportHeartBeat();
// notify all listeners (for example the scheduler)
notifyNewInstance(host);
return instanceID;
}
} | java | public InstanceID registerTaskManager(
TaskManagerGateway taskManagerGateway,
TaskManagerLocation taskManagerLocation,
HardwareDescription resources,
int numberOfSlots) {
synchronized (this.lock) {
if (this.isShutdown) {
throw new IllegalStateException("InstanceManager is shut down.");
}
Instance prior = registeredHostsByResource.get(taskManagerLocation.getResourceID());
if (prior != null) {
throw new IllegalStateException("Registration attempt from TaskManager at "
+ taskManagerLocation.addressString() +
". This connection is already registered under ID " + prior.getId());
}
boolean wasDead = this.deadHosts.remove(taskManagerLocation.getResourceID());
if (wasDead) {
LOG.info("Registering TaskManager at " + taskManagerLocation.addressString() +
" which was marked as dead earlier because of a heart-beat timeout.");
}
InstanceID instanceID = new InstanceID();
Instance host = new Instance(
taskManagerGateway,
taskManagerLocation,
instanceID,
resources,
numberOfSlots);
registeredHostsById.put(instanceID, host);
registeredHostsByResource.put(taskManagerLocation.getResourceID(), host);
totalNumberOfAliveTaskSlots += numberOfSlots;
if (LOG.isInfoEnabled()) {
LOG.info(String.format("Registered TaskManager at %s (%s) as %s. " +
"Current number of registered hosts is %d. " +
"Current number of alive task slots is %d.",
taskManagerLocation.getHostname(),
taskManagerGateway.getAddress(),
instanceID,
registeredHostsById.size(),
totalNumberOfAliveTaskSlots));
}
host.reportHeartBeat();
// notify all listeners (for example the scheduler)
notifyNewInstance(host);
return instanceID;
}
} | [
"public",
"InstanceID",
"registerTaskManager",
"(",
"TaskManagerGateway",
"taskManagerGateway",
",",
"TaskManagerLocation",
"taskManagerLocation",
",",
"HardwareDescription",
"resources",
",",
"int",
"numberOfSlots",
")",
"{",
"synchronized",
"(",
"this",
".",
"lock",
")"... | Registers a task manager. Registration of a task manager makes it available to be used
for the job execution.
@param taskManagerGateway gateway to the task manager
@param taskManagerLocation Location info of the TaskManager
@param resources Hardware description of the TaskManager
@param numberOfSlots Number of available slots on the TaskManager
@return The assigned InstanceID of the registered task manager | [
"Registers",
"a",
"task",
"manager",
".",
"Registration",
"of",
"a",
"task",
"manager",
"makes",
"it",
"available",
"to",
"be",
"used",
"for",
"the",
"job",
"execution",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/InstanceManager.java#L137-L193 | train | Register a new instance of the TaskManager with the TaskManagerManager. | [
30522,
2270,
6013,
3593,
4236,
10230,
22287,
5162,
4590,
1006,
4708,
24805,
4590,
5867,
4576,
4708,
24805,
4590,
5867,
4576,
1010,
4708,
24805,
4590,
4135,
10719,
4708,
24805,
4590,
4135,
10719,
1010,
8051,
6155,
23235,
3258,
4219,
1010,
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-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSink.java | CassandraSink.addSink | public static <IN> CassandraSinkBuilder<IN> addSink(org.apache.flink.streaming.api.scala.DataStream<IN> input) {
return addSink(input.javaStream());
} | java | public static <IN> CassandraSinkBuilder<IN> addSink(org.apache.flink.streaming.api.scala.DataStream<IN> input) {
return addSink(input.javaStream());
} | [
"public",
"static",
"<",
"IN",
">",
"CassandraSinkBuilder",
"<",
"IN",
">",
"addSink",
"(",
"org",
".",
"apache",
".",
"flink",
".",
"streaming",
".",
"api",
".",
"scala",
".",
"DataStream",
"<",
"IN",
">",
"input",
")",
"{",
"return",
"addSink",
"(",
... | Writes a DataStream into a Cassandra database.
@param input input DataStream
@param <IN> input type
@return CassandraSinkBuilder, to further configure the sink | [
"Writes",
"a",
"DataStream",
"into",
"a",
"Cassandra",
"database",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSink.java#L201-L203 | train | Add a Cassandra sink to the Cassandra DataStream. | [
30522,
2270,
10763,
1026,
1999,
1028,
15609,
11493,
2243,
8569,
23891,
2099,
1026,
1999,
1028,
9909,
19839,
1006,
8917,
1012,
15895,
1012,
13109,
19839,
1012,
11058,
1012,
17928,
1012,
26743,
1012,
2951,
21422,
1026,
1999,
1028,
7953,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java | SqlConnRunner.del | public int del(Connection conn, Entity where) throws SQLException {
checkConn(conn);
if(CollectionUtil.isEmpty(where)){
//不允许做全表删除
throw new SQLException("Empty entity provided!");
}
final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName());
PreparedStatement ps = null;
try {
ps = dialect.psForDelete(conn, query);
return ps.executeUpdate();
} catch (SQLException e) {
throw e;
} finally {
DbUtil.close(ps);
}
} | java | public int del(Connection conn, Entity where) throws SQLException {
checkConn(conn);
if(CollectionUtil.isEmpty(where)){
//不允许做全表删除
throw new SQLException("Empty entity provided!");
}
final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName());
PreparedStatement ps = null;
try {
ps = dialect.psForDelete(conn, query);
return ps.executeUpdate();
} catch (SQLException e) {
throw e;
} finally {
DbUtil.close(ps);
}
} | [
"public",
"int",
"del",
"(",
"Connection",
"conn",
",",
"Entity",
"where",
")",
"throws",
"SQLException",
"{",
"checkConn",
"(",
"conn",
")",
";",
"if",
"(",
"CollectionUtil",
".",
"isEmpty",
"(",
"where",
")",
")",
"{",
"//不允许做全表删除\r",
"throw",
"new",
"... | 删除数据<br>
此方法不会关闭Connection
@param conn 数据库连接
@param where 条件
@return 影响行数
@throws SQLException SQL执行异常 | [
"删除数据<br",
">",
"此方法不会关闭Connection"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L235-L252 | train | Deletes the entity from the database. | [
30522,
2270,
20014,
3972,
1006,
4434,
9530,
2078,
1010,
9178,
2073,
1007,
11618,
29296,
10288,
24422,
1063,
4638,
8663,
2078,
1006,
9530,
2078,
1007,
1025,
2065,
1006,
3074,
21823,
2140,
1012,
2003,
6633,
13876,
2100,
1006,
2073,
1007,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java | Decimal.sign | public static Decimal sign(Decimal b0) {
if (b0.isCompact()) {
return new Decimal(b0.precision, b0.scale, b0.signum() * POW10[b0.scale], null);
} else {
return fromBigDecimal(BigDecimal.valueOf(b0.signum()), b0.precision, b0.scale);
}
} | java | public static Decimal sign(Decimal b0) {
if (b0.isCompact()) {
return new Decimal(b0.precision, b0.scale, b0.signum() * POW10[b0.scale], null);
} else {
return fromBigDecimal(BigDecimal.valueOf(b0.signum()), b0.precision, b0.scale);
}
} | [
"public",
"static",
"Decimal",
"sign",
"(",
"Decimal",
"b0",
")",
"{",
"if",
"(",
"b0",
".",
"isCompact",
"(",
")",
")",
"{",
"return",
"new",
"Decimal",
"(",
"b0",
".",
"precision",
",",
"b0",
".",
"scale",
",",
"b0",
".",
"signum",
"(",
")",
"*... | SQL <code>SIGN</code> operator applied to BigDecimal values.
preserve precision and scale. | [
"SQL",
"<code",
">",
"SIGN<",
"/",
"code",
">",
"operator",
"applied",
"to",
"BigDecimal",
"values",
".",
"preserve",
"precision",
"and",
"scale",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java#L405-L411 | train | Returns the sign of a decimal. | [
30522,
2270,
10763,
26066,
3696,
1006,
26066,
1038,
2692,
1007,
1063,
2065,
1006,
1038,
2692,
1012,
2003,
9006,
19498,
2102,
1006,
1007,
1007,
1063,
2709,
2047,
26066,
1006,
1038,
2692,
1012,
11718,
1010,
1038,
2692,
1012,
4094,
1010,
1038,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java | BinaryString.compareMultiSegments | private int compareMultiSegments(BinaryString other) {
if (sizeInBytes == 0 || other.sizeInBytes == 0) {
return sizeInBytes - other.sizeInBytes;
}
int len = Math.min(sizeInBytes, other.sizeInBytes);
MemorySegment seg1 = segments[0];
MemorySegment seg2 = other.segments[0];
int segmentSize = segments[0].size();
int otherSegmentSize = other.segments[0].size();
int sizeOfFirst1 = segmentSize - offset;
int sizeOfFirst2 = otherSegmentSize - other.offset;
int varSegIndex1 = 1;
int varSegIndex2 = 1;
// find the first segment of this string.
while (sizeOfFirst1 <= 0) {
sizeOfFirst1 += segmentSize;
seg1 = segments[varSegIndex1++];
}
while (sizeOfFirst2 <= 0) {
sizeOfFirst2 += otherSegmentSize;
seg2 = other.segments[varSegIndex2++];
}
int offset1 = segmentSize - sizeOfFirst1;
int offset2 = otherSegmentSize - sizeOfFirst2;
int needCompare = Math.min(Math.min(sizeOfFirst1, sizeOfFirst2), len);
while (needCompare > 0) {
// compare in one segment.
for (int i = 0; i < needCompare; i++) {
int res = (seg1.get(offset1 + i) & 0xFF) - (seg2.get(offset2 + i) & 0xFF);
if (res != 0) {
return res;
}
}
if (needCompare == len) {
break;
}
len -= needCompare;
// next segment
if (sizeOfFirst1 < sizeOfFirst2) { //I am smaller
seg1 = segments[varSegIndex1++];
offset1 = 0;
offset2 += needCompare;
sizeOfFirst1 = segmentSize;
sizeOfFirst2 -= needCompare;
} else if (sizeOfFirst1 > sizeOfFirst2) { //other is smaller
seg2 = other.segments[varSegIndex2++];
offset2 = 0;
offset1 += needCompare;
sizeOfFirst2 = otherSegmentSize;
sizeOfFirst1 -= needCompare;
} else { // same, should go ahead both.
seg1 = segments[varSegIndex1++];
seg2 = other.segments[varSegIndex2++];
offset1 = 0;
offset2 = 0;
sizeOfFirst1 = segmentSize;
sizeOfFirst2 = otherSegmentSize;
}
needCompare = Math.min(Math.min(sizeOfFirst1, sizeOfFirst2), len);
}
checkArgument(needCompare == len);
return sizeInBytes - other.sizeInBytes;
} | java | private int compareMultiSegments(BinaryString other) {
if (sizeInBytes == 0 || other.sizeInBytes == 0) {
return sizeInBytes - other.sizeInBytes;
}
int len = Math.min(sizeInBytes, other.sizeInBytes);
MemorySegment seg1 = segments[0];
MemorySegment seg2 = other.segments[0];
int segmentSize = segments[0].size();
int otherSegmentSize = other.segments[0].size();
int sizeOfFirst1 = segmentSize - offset;
int sizeOfFirst2 = otherSegmentSize - other.offset;
int varSegIndex1 = 1;
int varSegIndex2 = 1;
// find the first segment of this string.
while (sizeOfFirst1 <= 0) {
sizeOfFirst1 += segmentSize;
seg1 = segments[varSegIndex1++];
}
while (sizeOfFirst2 <= 0) {
sizeOfFirst2 += otherSegmentSize;
seg2 = other.segments[varSegIndex2++];
}
int offset1 = segmentSize - sizeOfFirst1;
int offset2 = otherSegmentSize - sizeOfFirst2;
int needCompare = Math.min(Math.min(sizeOfFirst1, sizeOfFirst2), len);
while (needCompare > 0) {
// compare in one segment.
for (int i = 0; i < needCompare; i++) {
int res = (seg1.get(offset1 + i) & 0xFF) - (seg2.get(offset2 + i) & 0xFF);
if (res != 0) {
return res;
}
}
if (needCompare == len) {
break;
}
len -= needCompare;
// next segment
if (sizeOfFirst1 < sizeOfFirst2) { //I am smaller
seg1 = segments[varSegIndex1++];
offset1 = 0;
offset2 += needCompare;
sizeOfFirst1 = segmentSize;
sizeOfFirst2 -= needCompare;
} else if (sizeOfFirst1 > sizeOfFirst2) { //other is smaller
seg2 = other.segments[varSegIndex2++];
offset2 = 0;
offset1 += needCompare;
sizeOfFirst2 = otherSegmentSize;
sizeOfFirst1 -= needCompare;
} else { // same, should go ahead both.
seg1 = segments[varSegIndex1++];
seg2 = other.segments[varSegIndex2++];
offset1 = 0;
offset2 = 0;
sizeOfFirst1 = segmentSize;
sizeOfFirst2 = otherSegmentSize;
}
needCompare = Math.min(Math.min(sizeOfFirst1, sizeOfFirst2), len);
}
checkArgument(needCompare == len);
return sizeInBytes - other.sizeInBytes;
} | [
"private",
"int",
"compareMultiSegments",
"(",
"BinaryString",
"other",
")",
"{",
"if",
"(",
"sizeInBytes",
"==",
"0",
"||",
"other",
".",
"sizeInBytes",
"==",
"0",
")",
"{",
"return",
"sizeInBytes",
"-",
"other",
".",
"sizeInBytes",
";",
"}",
"int",
"len"... | Find the boundaries of segments, and then compare MemorySegment. | [
"Find",
"the",
"boundaries",
"of",
"segments",
"and",
"then",
"compare",
"MemorySegment",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L260-L335 | train | Compare two binary strings. | [
30522,
2797,
20014,
12826,
12274,
7096,
5562,
21693,
11187,
1006,
12441,
3367,
4892,
2060,
1007,
1063,
2065,
1006,
2946,
2378,
3762,
4570,
1027,
1027,
1014,
1064,
1064,
2060,
1012,
2946,
2378,
3762,
4570,
1027,
1027,
1014,
1007,
1063,
2709,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/HashPartition.java | HashPartition.insertIntoBuildBuffer | public final long insertIntoBuildBuffer(BT record) throws IOException {
this.buildSideRecordCounter++;
if (isInMemory()) {
final long pointer = this.buildSideWriteBuffer.getCurrentPointer();
this.buildSideSerializer.serialize(record, this.buildSideWriteBuffer);
return isInMemory() ? pointer : -1;
} else {
this.buildSideSerializer.serialize(record, this.buildSideWriteBuffer);
return -1;
}
} | java | public final long insertIntoBuildBuffer(BT record) throws IOException {
this.buildSideRecordCounter++;
if (isInMemory()) {
final long pointer = this.buildSideWriteBuffer.getCurrentPointer();
this.buildSideSerializer.serialize(record, this.buildSideWriteBuffer);
return isInMemory() ? pointer : -1;
} else {
this.buildSideSerializer.serialize(record, this.buildSideWriteBuffer);
return -1;
}
} | [
"public",
"final",
"long",
"insertIntoBuildBuffer",
"(",
"BT",
"record",
")",
"throws",
"IOException",
"{",
"this",
".",
"buildSideRecordCounter",
"++",
";",
"if",
"(",
"isInMemory",
"(",
")",
")",
"{",
"final",
"long",
"pointer",
"=",
"this",
".",
"buildSid... | Inserts the given object into the current buffer. This method returns a pointer that
can be used to address the written record in this partition, if it is in-memory. The returned
pointers have no expressiveness in the case where the partition is spilled.
@param record The object to be written to the partition.
@return A pointer to the object in the partition, or <code>-1</code>, if the partition is spilled.
@throws IOException Thrown, when this is a spilled partition and the write failed. | [
"Inserts",
"the",
"given",
"object",
"into",
"the",
"current",
"buffer",
".",
"This",
"method",
"returns",
"a",
"pointer",
"that",
"can",
"be",
"used",
"to",
"address",
"the",
"written",
"record",
"in",
"this",
"partition",
"if",
"it",
"is",
"in",
"-",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/HashPartition.java#L252-L263 | train | Insert a record into the build buffer. | [
30522,
2270,
2345,
2146,
19274,
18447,
16429,
19231,
18939,
16093,
7512,
1006,
18411,
2501,
1007,
11618,
22834,
10288,
24422,
1063,
2023,
1012,
16473,
18688,
8586,
8551,
3597,
16671,
2121,
1009,
1009,
1025,
2065,
1006,
2003,
2378,
4168,
5302,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.unzipFileBytes | @SuppressWarnings("unchecked")
public static byte[] unzipFileBytes(File zipFile, Charset charset, String name) {
ZipFile zipFileObj = null;
try {
zipFileObj = new ZipFile(zipFile, charset);
final Enumeration<ZipEntry> em = (Enumeration<ZipEntry>) zipFileObj.entries();
ZipEntry zipEntry = null;
while (em.hasMoreElements()) {
zipEntry = em.nextElement();
if (zipEntry.isDirectory()) {
continue;
} else if (name.equals(zipEntry.getName())) {
return IoUtil.readBytes(zipFileObj.getInputStream(zipEntry));
}
}
} catch (IOException e) {
throw new UtilException(e);
} finally {
IoUtil.close(zipFileObj);
}
return null;
} | java | @SuppressWarnings("unchecked")
public static byte[] unzipFileBytes(File zipFile, Charset charset, String name) {
ZipFile zipFileObj = null;
try {
zipFileObj = new ZipFile(zipFile, charset);
final Enumeration<ZipEntry> em = (Enumeration<ZipEntry>) zipFileObj.entries();
ZipEntry zipEntry = null;
while (em.hasMoreElements()) {
zipEntry = em.nextElement();
if (zipEntry.isDirectory()) {
continue;
} else if (name.equals(zipEntry.getName())) {
return IoUtil.readBytes(zipFileObj.getInputStream(zipEntry));
}
}
} catch (IOException e) {
throw new UtilException(e);
} finally {
IoUtil.close(zipFileObj);
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"byte",
"[",
"]",
"unzipFileBytes",
"(",
"File",
"zipFile",
",",
"Charset",
"charset",
",",
"String",
"name",
")",
"{",
"ZipFile",
"zipFileObj",
"=",
"null",
";",
"try",
"{",
"zipFileObj... | 从Zip文件中提取指定的文件为bytes
@param zipFile Zip文件
@param charset 编码
@param name 文件名,如果存在于子文件夹中,此文件名必须包含目录名,例如images/aaa.txt
@return 文件内容bytes
@since 4.1.8 | [
"从Zip文件中提取指定的文件为bytes"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L459-L480 | train | Unzips a file and returns the bytes of the contents of the file. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
24880,
1031,
1033,
4895,
5831,
14376,
9463,
3762,
4570,
1006,
5371,
14101,
8873,
2571,
1010,
25869,
13462,
25869,
13462,
1010,
5164,
2171,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java | UndertowReactiveWebServerFactory.setDeploymentInfoCustomizers | public void setDeploymentInfoCustomizers(
Collection<? extends UndertowDeploymentInfoCustomizer> customizers) {
Assert.notNull(customizers, "Customizers must not be null");
this.deploymentInfoCustomizers = new ArrayList<>(customizers);
} | java | public void setDeploymentInfoCustomizers(
Collection<? extends UndertowDeploymentInfoCustomizer> customizers) {
Assert.notNull(customizers, "Customizers must not be null");
this.deploymentInfoCustomizers = new ArrayList<>(customizers);
} | [
"public",
"void",
"setDeploymentInfoCustomizers",
"(",
"Collection",
"<",
"?",
"extends",
"UndertowDeploymentInfoCustomizer",
">",
"customizers",
")",
"{",
"Assert",
".",
"notNull",
"(",
"customizers",
",",
"\"Customizers must not be null\"",
")",
";",
"this",
".",
"d... | Set {@link UndertowDeploymentInfoCustomizer}s that should be applied to the
Undertow {@link DeploymentInfo}. Calling this method will replace any existing
customizers.
@param customizers the customizers to set | [
"Set",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java#L211-L215 | train | Sets the deployment info customizers. | [
30522,
2270,
11675,
2275,
3207,
24759,
6977,
3672,
2378,
14876,
7874,
20389,
17629,
2015,
1006,
3074,
1026,
1029,
8908,
2104,
18790,
3207,
24759,
6977,
3672,
2378,
14876,
7874,
20389,
17629,
1028,
7661,
17629,
2015,
1007,
1063,
20865,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/OrderedStreamElementQueue.java | OrderedStreamElementQueue.onCompleteHandler | private void onCompleteHandler(StreamElementQueueEntry<?> streamElementQueueEntry) throws InterruptedException {
lock.lockInterruptibly();
try {
if (!queue.isEmpty() && queue.peek().isDone()) {
LOG.debug("Signal ordered stream element queue has completed head element.");
headIsCompleted.signalAll();
}
} finally {
lock.unlock();
}
} | java | private void onCompleteHandler(StreamElementQueueEntry<?> streamElementQueueEntry) throws InterruptedException {
lock.lockInterruptibly();
try {
if (!queue.isEmpty() && queue.peek().isDone()) {
LOG.debug("Signal ordered stream element queue has completed head element.");
headIsCompleted.signalAll();
}
} finally {
lock.unlock();
}
} | [
"private",
"void",
"onCompleteHandler",
"(",
"StreamElementQueueEntry",
"<",
"?",
">",
"streamElementQueueEntry",
")",
"throws",
"InterruptedException",
"{",
"lock",
".",
"lockInterruptibly",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"queue",
".",
"isEmpty",
"(... | Check if the completed {@link StreamElementQueueEntry} is the current head. If this is the
case, then notify the consumer thread about a new consumable entry.
@param streamElementQueueEntry which has been completed
@throws InterruptedException if the current thread is interrupted | [
"Check",
"if",
"the",
"completed",
"{",
"@link",
"StreamElementQueueEntry",
"}",
"is",
"the",
"current",
"head",
".",
"If",
"this",
"is",
"the",
"case",
"then",
"notify",
"the",
"consumer",
"thread",
"about",
"a",
"new",
"consumable",
"entry",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/OrderedStreamElementQueue.java#L218-L229 | train | Signal all waiting threads that the head element has completed. | [
30522,
2797,
11675,
2006,
9006,
10814,
2618,
11774,
3917,
1006,
5460,
12260,
3672,
4226,
5657,
4765,
2854,
1026,
1029,
1028,
5460,
12260,
3672,
4226,
5657,
4765,
2854,
1007,
11618,
7153,
10288,
24422,
1063,
5843,
1012,
5843,
18447,
2121,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.registerType | public void registerType(Class<?> type) {
if (type == null) {
throw new NullPointerException("Cannot register null type class.");
}
TypeInformation<?> typeInfo = TypeExtractor.createTypeInfo(type);
if (typeInfo instanceof PojoTypeInfo) {
config.registerPojoType(type);
} else {
config.registerKryoType(type);
}
} | java | public void registerType(Class<?> type) {
if (type == null) {
throw new NullPointerException("Cannot register null type class.");
}
TypeInformation<?> typeInfo = TypeExtractor.createTypeInfo(type);
if (typeInfo instanceof PojoTypeInfo) {
config.registerPojoType(type);
} else {
config.registerKryoType(type);
}
} | [
"public",
"void",
"registerType",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Cannot register null type class.\"",
")",
";",
"}",
"TypeInformation",
"<",
"?",
">",
... | Registers the given type with the serialization stack. If the type is
eventually serialized as a POJO, then the type is registered with the
POJO serializer. If the type ends up being serialized with Kryo, then it
will be registered at Kryo to make sure that only tags are written.
@param type
The class of the type to register. | [
"Registers",
"the",
"given",
"type",
"with",
"the",
"serialization",
"stack",
".",
"If",
"the",
"type",
"is",
"eventually",
"serialized",
"as",
"a",
"POJO",
"then",
"the",
"type",
"is",
"registered",
"with",
"the",
"POJO",
"serializer",
".",
"If",
"the",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L609-L621 | train | Registers a type. | [
30522,
2270,
11675,
4236,
13874,
1006,
2465,
1026,
1029,
1028,
2828,
1007,
1063,
2065,
1006,
2828,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
3685,
4236,
19701,
2828,
2465,
1012,
1000,
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-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.insert | @SuppressWarnings("unchecked")
public static <T> T[] insert(T[] buffer, int index, T... newElements) {
return (T[]) insert((Object)buffer, index, newElements);
} | java | @SuppressWarnings("unchecked")
public static <T> T[] insert(T[] buffer, int index, T... newElements) {
return (T[]) insert((Object)buffer, index, newElements);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"insert",
"(",
"T",
"[",
"]",
"buffer",
",",
"int",
"index",
",",
"T",
"...",
"newElements",
")",
"{",
"return",
"(",
"T",
"[",
"]",
")",
"insert"... | 将新元素插入到到已有数组中的某个位置<br>
添加新元素会生成一个新的数组,不影响原数组<br>
如果插入位置为为负数,从原数组从后向前计数,若大于原数组长度,则空白处用null填充
@param <T> 数组元素类型
@param buffer 已有数组
@param index 插入位置,此位置为对应此位置元素之前的空档
@param newElements 新元素
@return 新数组
@since 4.0.8 | [
"将新元素插入到到已有数组中的某个位置<br",
">",
"添加新元素会生成一个新的数组,不影响原数组<br",
">",
"如果插入位置为为负数,从原数组从后向前计数,若大于原数组长度,则空白处用null填充"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L456-L459 | train | Inserts the specified elements into the specified array at the specified index. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
30524,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java | DependencyCustomizer.add | public DependencyCustomizer add(String module, String classifier, String type,
boolean transitive) {
if (canAdd()) {
ArtifactCoordinatesResolver artifactCoordinatesResolver = this.dependencyResolutionContext
.getArtifactCoordinatesResolver();
this.classNode.addAnnotation(
createGrabAnnotation(artifactCoordinatesResolver.getGroupId(module),
artifactCoordinatesResolver.getArtifactId(module),
artifactCoordinatesResolver.getVersion(module), classifier,
type, transitive));
}
return this;
} | java | public DependencyCustomizer add(String module, String classifier, String type,
boolean transitive) {
if (canAdd()) {
ArtifactCoordinatesResolver artifactCoordinatesResolver = this.dependencyResolutionContext
.getArtifactCoordinatesResolver();
this.classNode.addAnnotation(
createGrabAnnotation(artifactCoordinatesResolver.getGroupId(module),
artifactCoordinatesResolver.getArtifactId(module),
artifactCoordinatesResolver.getVersion(module), classifier,
type, transitive));
}
return this;
} | [
"public",
"DependencyCustomizer",
"add",
"(",
"String",
"module",
",",
"String",
"classifier",
",",
"String",
"type",
",",
"boolean",
"transitive",
")",
"{",
"if",
"(",
"canAdd",
"(",
")",
")",
"{",
"ArtifactCoordinatesResolver",
"artifactCoordinatesResolver",
"="... | Add a single dependency with the specified classifier and type and, optionally, all
of its dependencies. The group ID and version of the dependency are resolved from
the module by using the customizer's {@link ArtifactCoordinatesResolver}.
@param module the module ID
@param classifier the classifier, may be {@code null}
@param type the type, may be {@code null}
@param transitive {@code true} if the transitive dependencies should also be added,
otherwise {@code false}
@return this {@link DependencyCustomizer} for continued use | [
"Add",
"a",
"single",
"dependency",
"with",
"the",
"specified",
"classifier",
"and",
"type",
"and",
"optionally",
"all",
"of",
"its",
"dependencies",
".",
"The",
"group",
"ID",
"and",
"version",
"of",
"the",
"dependency",
"are",
"resolved",
"from",
"the",
"m... | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java#L222-L234 | train | Add a new annotation to the class node. | [
30522,
2270,
24394,
7874,
20389,
17629,
5587,
1006,
5164,
11336,
1010,
5164,
2465,
30524,
1007,
1007,
1063,
20785,
3597,
8551,
28184,
6072,
4747,
6299,
20785,
3597,
8551,
28184,
6072,
4747,
6299,
1027,
2023,
1012,
24394,
6072,
4747,
13700,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/StatementUtil.java | StatementUtil.prepareStatement | public static PreparedStatement prepareStatement(Connection conn, SqlBuilder sqlBuilder) throws SQLException {
return prepareStatement(conn, sqlBuilder.build(), sqlBuilder.getParamValueArray());
} | java | public static PreparedStatement prepareStatement(Connection conn, SqlBuilder sqlBuilder) throws SQLException {
return prepareStatement(conn, sqlBuilder.build(), sqlBuilder.getParamValueArray());
} | [
"public",
"static",
"PreparedStatement",
"prepareStatement",
"(",
"Connection",
"conn",
",",
"SqlBuilder",
"sqlBuilder",
")",
"throws",
"SQLException",
"{",
"return",
"prepareStatement",
"(",
"conn",
",",
"sqlBuilder",
".",
"build",
"(",
")",
",",
"sqlBuilder",
".... | 创建{@link PreparedStatement}
@param conn 数据库连接
@param sqlBuilder {@link SqlBuilder}包括SQL语句和参数
@return {@link PreparedStatement}
@throws SQLException SQL异常
@since 4.1.3 | [
"创建",
"{",
"@link",
"PreparedStatement",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/StatementUtil.java#L110-L112 | train | Create a PreparedStatement object from the given SqlBuilder. | [
30522,
2270,
10763,
4810,
9153,
18532,
4765,
20776,
12259,
3672,
1006,
4434,
9530,
2078,
1010,
29296,
8569,
23891,
2099,
29296,
8569,
23891,
2099,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
20776,
12259,
3672,
1006,
9530,
2078,
1010,
29296... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/text/StrBuilder.java | StrBuilder.insert | public StrBuilder insert(int index, CharSequence csq) {
if (null == csq) {
csq = "null";
}
int len = csq.length();
moveDataAfterIndex(index, csq.length());
if (csq instanceof String) {
((String) csq).getChars(0, len, this.value, index);
} else if (csq instanceof StringBuilder) {
((StringBuilder) csq).getChars(0, len, this.value, index);
} else if (csq instanceof StringBuffer) {
((StringBuffer) csq).getChars(0, len, this.value, index);
} else if (csq instanceof StrBuilder) {
((StrBuilder) csq).getChars(0, len, this.value, index);
} else {
for (int i = 0, j = this.position; i < len; i++, j++) {
this.value[j] = csq.charAt(i);
}
}
this.position = Math.max(this.position, index) + len;
return this;
} | java | public StrBuilder insert(int index, CharSequence csq) {
if (null == csq) {
csq = "null";
}
int len = csq.length();
moveDataAfterIndex(index, csq.length());
if (csq instanceof String) {
((String) csq).getChars(0, len, this.value, index);
} else if (csq instanceof StringBuilder) {
((StringBuilder) csq).getChars(0, len, this.value, index);
} else if (csq instanceof StringBuffer) {
((StringBuffer) csq).getChars(0, len, this.value, index);
} else if (csq instanceof StrBuilder) {
((StrBuilder) csq).getChars(0, len, this.value, index);
} else {
for (int i = 0, j = this.position; i < len; i++, j++) {
this.value[j] = csq.charAt(i);
}
}
this.position = Math.max(this.position, index) + len;
return this;
} | [
"public",
"StrBuilder",
"insert",
"(",
"int",
"index",
",",
"CharSequence",
"csq",
")",
"{",
"if",
"(",
"null",
"==",
"csq",
")",
"{",
"csq",
"=",
"\"null\"",
";",
"}",
"int",
"len",
"=",
"csq",
".",
"length",
"(",
")",
";",
"moveDataAfterIndex",
"("... | 指定位置插入字符串的某个部分<br>
如果插入位置为当前位置,则定义为追加<br>
如果插入位置大于当前位置,则中间部分补充空格
@param index 位置
@param csq 字符串
@return this | [
"指定位置插入字符串的某个部分<br",
">",
"如果插入位置为当前位置,则定义为追加<br",
">",
"如果插入位置大于当前位置,则中间部分补充空格"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrBuilder.java#L227-L248 | train | Inserts a CharSequence into this builder at the specified index. | [
30522,
2270,
2358,
15185,
19231,
4063,
19274,
1006,
20014,
5950,
1010,
25869,
3366,
4226,
5897,
20116,
4160,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
20116,
4160,
1007,
1063,
20116,
4160,
1027,
1000,
19701,
1000,
1025,
1065,
20014,
18798,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/nosql/redis/RedisDS.java | RedisDS.init | public RedisDS init(String group) {
if (null == setting) {
setting = new Setting(REDIS_CONFIG_PATH, true);
}
final JedisPoolConfig config = new JedisPoolConfig();
// 共用配置
setting.toBean(config);
if (StrUtil.isNotBlank(group)) {
// 特有配置
setting.toBean(group, config);
}
this.pool = new JedisPool(config,
// 地址
setting.getStr("host", group, Protocol.DEFAULT_HOST),
// 端口
setting.getInt("port", group, Protocol.DEFAULT_PORT),
// 连接超时
setting.getInt("connectionTimeout", group, setting.getInt("timeout", group, Protocol.DEFAULT_TIMEOUT)),
// 读取数据超时
setting.getInt("soTimeout", group, setting.getInt("timeout", group, Protocol.DEFAULT_TIMEOUT)),
// 密码
setting.getStr("password", group, null),
// 数据库序号
setting.getInt("database", group, Protocol.DEFAULT_DATABASE),
// 客户端名
setting.getStr("clientName", group, "Hutool"),
// 是否使用SSL
setting.getBool("ssl", group, false),
// SSL相关,使用默认
null, null, null);
return this;
} | java | public RedisDS init(String group) {
if (null == setting) {
setting = new Setting(REDIS_CONFIG_PATH, true);
}
final JedisPoolConfig config = new JedisPoolConfig();
// 共用配置
setting.toBean(config);
if (StrUtil.isNotBlank(group)) {
// 特有配置
setting.toBean(group, config);
}
this.pool = new JedisPool(config,
// 地址
setting.getStr("host", group, Protocol.DEFAULT_HOST),
// 端口
setting.getInt("port", group, Protocol.DEFAULT_PORT),
// 连接超时
setting.getInt("connectionTimeout", group, setting.getInt("timeout", group, Protocol.DEFAULT_TIMEOUT)),
// 读取数据超时
setting.getInt("soTimeout", group, setting.getInt("timeout", group, Protocol.DEFAULT_TIMEOUT)),
// 密码
setting.getStr("password", group, null),
// 数据库序号
setting.getInt("database", group, Protocol.DEFAULT_DATABASE),
// 客户端名
setting.getStr("clientName", group, "Hutool"),
// 是否使用SSL
setting.getBool("ssl", group, false),
// SSL相关,使用默认
null, null, null);
return this;
} | [
"public",
"RedisDS",
"init",
"(",
"String",
"group",
")",
"{",
"if",
"(",
"null",
"==",
"setting",
")",
"{",
"setting",
"=",
"new",
"Setting",
"(",
"REDIS_CONFIG_PATH",
",",
"true",
")",
";",
"}",
"final",
"JedisPoolConfig",
"config",
"=",
"new",
"JedisP... | 初始化Jedis客户端
@param group Redis服务器信息分组
@return this | [
"初始化Jedis客户端"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/nosql/redis/RedisDS.java#L94-L128 | train | Initializes the connection pool with the specified configuration. | [
30522,
2270,
2417,
2483,
5104,
1999,
4183,
1006,
5164,
2177,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
4292,
1007,
1063,
4292,
1027,
2047,
4292,
1006,
2417,
2483,
1035,
9530,
8873,
2290,
1035,
4130,
1010,
2995,
1007,
1025,
1065,
2345,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-orc/src/main/java/org/apache/flink/orc/OrcRowInputFormat.java | OrcRowInputFormat.writeObject | private void writeObject(ObjectOutputStream out) throws IOException {
out.writeInt(batchSize);
this.conf.write(out);
out.writeUTF(schema.toString());
out.writeInt(selectedFields.length);
for (int f : selectedFields) {
out.writeInt(f);
}
out.writeInt(conjunctPredicates.size());
for (Predicate p : conjunctPredicates) {
out.writeObject(p);
}
} | java | private void writeObject(ObjectOutputStream out) throws IOException {
out.writeInt(batchSize);
this.conf.write(out);
out.writeUTF(schema.toString());
out.writeInt(selectedFields.length);
for (int f : selectedFields) {
out.writeInt(f);
}
out.writeInt(conjunctPredicates.size());
for (Predicate p : conjunctPredicates) {
out.writeObject(p);
}
} | [
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"writeInt",
"(",
"batchSize",
")",
";",
"this",
".",
"conf",
".",
"write",
"(",
"out",
")",
";",
"out",
".",
"writeUTF",
"(",
"schema",
"."... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-orc/src/main/java/org/apache/flink/orc/OrcRowInputFormat.java#L356-L370 | train | Writes the object to the stream. | [
30522,
2797,
11675,
4339,
16429,
20614,
1006,
4874,
5833,
18780,
21422,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
2041,
1012,
4339,
18447,
1006,
14108,
5332,
4371,
1007,
1025,
2023,
1012,
9530,
2546,
1012,
4339,
1006,
2041,
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-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.generateAlgorithm | public static String generateAlgorithm(AsymmetricAlgorithm asymmetricAlgorithm, DigestAlgorithm digestAlgorithm) {
final String digestPart = (null == digestAlgorithm) ? "NONE" : digestAlgorithm.name();
return StrUtil.format("{}with{}", digestPart, asymmetricAlgorithm.getValue());
} | java | public static String generateAlgorithm(AsymmetricAlgorithm asymmetricAlgorithm, DigestAlgorithm digestAlgorithm) {
final String digestPart = (null == digestAlgorithm) ? "NONE" : digestAlgorithm.name();
return StrUtil.format("{}with{}", digestPart, asymmetricAlgorithm.getValue());
} | [
"public",
"static",
"String",
"generateAlgorithm",
"(",
"AsymmetricAlgorithm",
"asymmetricAlgorithm",
",",
"DigestAlgorithm",
"digestAlgorithm",
")",
"{",
"final",
"String",
"digestPart",
"=",
"(",
"null",
"==",
"digestAlgorithm",
")",
"?",
"\"NONE\"",
":",
"digestAlg... | 生成算法,格式为XXXwithXXX
@param asymmetricAlgorithm 非对称算法
@param digestAlgorithm 摘要算法
@return 算法
@since 4.4.1 | [
"生成算法,格式为XXXwithXXX"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L277-L280 | train | Generates a digest algorithm name. | [
30522,
2270,
10763,
5164,
9699,
2389,
20255,
8939,
2213,
1006,
2004,
24335,
12589,
2389,
20255,
8939,
2213,
2004,
24335,
12589,
2389,
20255,
8939,
2213,
1010,
17886,
2389,
20255,
8939,
2213,
17886,
2389,
20255,
8939,
2213,
1007,
1063,
2345,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SingleOutputStreamOperator.java | SingleOutputStreamOperator.setMaxParallelism | @PublicEvolving
public SingleOutputStreamOperator<T> setMaxParallelism(int maxParallelism) {
Preconditions.checkArgument(maxParallelism > 0,
"The maximum parallelism must be greater than 0.");
Preconditions.checkArgument(canBeParallel() || maxParallelism == 1,
"The maximum parallelism of non parallel operator must be 1.");
transformation.setMaxParallelism(maxParallelism);
return this;
} | java | @PublicEvolving
public SingleOutputStreamOperator<T> setMaxParallelism(int maxParallelism) {
Preconditions.checkArgument(maxParallelism > 0,
"The maximum parallelism must be greater than 0.");
Preconditions.checkArgument(canBeParallel() || maxParallelism == 1,
"The maximum parallelism of non parallel operator must be 1.");
transformation.setMaxParallelism(maxParallelism);
return this;
} | [
"@",
"PublicEvolving",
"public",
"SingleOutputStreamOperator",
"<",
"T",
">",
"setMaxParallelism",
"(",
"int",
"maxParallelism",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"maxParallelism",
">",
"0",
",",
"\"The maximum parallelism must be greater than 0.\"",
"... | Sets the maximum parallelism of this operator.
<p>The maximum parallelism specifies the upper bound for dynamic scaling. It also defines the
number of key groups used for partitioned state.
@param maxParallelism Maximum parallelism
@return The operator with set maximum parallelism | [
"Sets",
"the",
"maximum",
"parallelism",
"of",
"this",
"operator",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SingleOutputStreamOperator.java#L158-L169 | train | Sets the maximum parallelism of this operator. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1056,
1028,
2275,
17848,
28689,
6216,
28235,
1006,
20014,
4098,
28689,
6216,
28235,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
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/flink | flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java | Types.PRIMITIVE_ARRAY | public static TypeInformation<?> PRIMITIVE_ARRAY(TypeInformation<?> elementType) {
if (elementType == BOOLEAN) {
return PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == BYTE) {
return PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == SHORT) {
return PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == INT) {
return PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == LONG) {
return PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == FLOAT) {
return PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == DOUBLE) {
return PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == CHAR) {
return PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO;
}
throw new IllegalArgumentException("Invalid element type for a primitive array.");
} | java | public static TypeInformation<?> PRIMITIVE_ARRAY(TypeInformation<?> elementType) {
if (elementType == BOOLEAN) {
return PrimitiveArrayTypeInfo.BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == BYTE) {
return PrimitiveArrayTypeInfo.BYTE_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == SHORT) {
return PrimitiveArrayTypeInfo.SHORT_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == INT) {
return PrimitiveArrayTypeInfo.INT_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == LONG) {
return PrimitiveArrayTypeInfo.LONG_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == FLOAT) {
return PrimitiveArrayTypeInfo.FLOAT_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == DOUBLE) {
return PrimitiveArrayTypeInfo.DOUBLE_PRIMITIVE_ARRAY_TYPE_INFO;
} else if (elementType == CHAR) {
return PrimitiveArrayTypeInfo.CHAR_PRIMITIVE_ARRAY_TYPE_INFO;
}
throw new IllegalArgumentException("Invalid element type for a primitive array.");
} | [
"public",
"static",
"TypeInformation",
"<",
"?",
">",
"PRIMITIVE_ARRAY",
"(",
"TypeInformation",
"<",
"?",
">",
"elementType",
")",
"{",
"if",
"(",
"elementType",
"==",
"BOOLEAN",
")",
"{",
"return",
"PrimitiveArrayTypeInfo",
".",
"BOOLEAN_PRIMITIVE_ARRAY_TYPE_INFO"... | Returns type information for Java arrays of primitive type (such as <code>byte[]</code>). The array
must not be null.
@param elementType element type of the array (e.g. Types.BOOLEAN, Types.INT, Types.DOUBLE) | [
"Returns",
"type",
"information",
"for",
"Java",
"arrays",
"of",
"primitive",
"type",
"(",
"such",
"as",
"<code",
">",
"byte",
"[]",
"<",
"/",
"code",
">",
")",
".",
"The",
"array",
"must",
"not",
"be",
"null",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java#L346-L365 | train | Returns the type information for a primitive array. | [
30522,
2270,
10763,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
10968,
1035,
9140,
1006,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
5783,
13874,
1007,
1063,
2065,
1006,
5783,
13874,
1027,
1027,
22017,
20898,
1007,
1063,
2709,
10968,
2906,
94... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java | JDBCDriverURLRecognizerEngine.getDatabaseType | public static DatabaseType getDatabaseType(final String url) {
switch (getDriverClassName(url)) {
case "com.mysql.cj.jdbc.Driver":
case "com.mysql.jdbc.Driver":
return DatabaseType.MySQL;
case "org.postgresql.Driver":
return DatabaseType.PostgreSQL;
case "oracle.jdbc.driver.OracleDriver":
return DatabaseType.Oracle;
case "com.microsoft.sqlserver.jdbc.SQLServerDriver":
return DatabaseType.SQLServer;
case "org.h2.Driver":
return DatabaseType.H2;
default:
throw new ShardingException("Cannot resolve JDBC url `%s`", url);
}
} | java | public static DatabaseType getDatabaseType(final String url) {
switch (getDriverClassName(url)) {
case "com.mysql.cj.jdbc.Driver":
case "com.mysql.jdbc.Driver":
return DatabaseType.MySQL;
case "org.postgresql.Driver":
return DatabaseType.PostgreSQL;
case "oracle.jdbc.driver.OracleDriver":
return DatabaseType.Oracle;
case "com.microsoft.sqlserver.jdbc.SQLServerDriver":
return DatabaseType.SQLServer;
case "org.h2.Driver":
return DatabaseType.H2;
default:
throw new ShardingException("Cannot resolve JDBC url `%s`", url);
}
} | [
"public",
"static",
"DatabaseType",
"getDatabaseType",
"(",
"final",
"String",
"url",
")",
"{",
"switch",
"(",
"getDriverClassName",
"(",
"url",
")",
")",
"{",
"case",
"\"com.mysql.cj.jdbc.Driver\"",
":",
"case",
"\"com.mysql.jdbc.Driver\"",
":",
"return",
"Database... | Get database type.
@param url JDBC URL
@return database type | [
"Get",
"database",
"type",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java#L74-L90 | train | Get database type from JDBC url. | [
30522,
2270,
10763,
7809,
13874,
2131,
2850,
2696,
15058,
13874,
1006,
2345,
5164,
24471,
2140,
1007,
1063,
6942,
1006,
2131,
23663,
11890,
27102,
18442,
1006,
24471,
2140,
1007,
1007,
1063,
2553,
1000,
4012,
1012,
2026,
2015,
4160,
2140,
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-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java | HpackDynamicTable.clear | public void clear() {
while (tail != head) {
hpackHeaderFields[tail++] = null;
if (tail == hpackHeaderFields.length) {
tail = 0;
}
}
head = 0;
tail = 0;
size = 0;
} | java | public void clear() {
while (tail != head) {
hpackHeaderFields[tail++] = null;
if (tail == hpackHeaderFields.length) {
tail = 0;
}
}
head = 0;
tail = 0;
size = 0;
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"while",
"(",
"tail",
"!=",
"head",
")",
"{",
"hpackHeaderFields",
"[",
"tail",
"++",
"]",
"=",
"null",
";",
"if",
"(",
"tail",
"==",
"hpackHeaderFields",
".",
"length",
")",
"{",
"tail",
"=",
"0",
";",
"}"... | Remove all entries from the dynamic table. | [
"Remove",
"all",
"entries",
"from",
"the",
"dynamic",
"table",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java#L137-L147 | train | Clear the array of all the records in this record. | [
30522,
2270,
11675,
3154,
1006,
1007,
1063,
2096,
1006,
5725,
999,
1027,
2132,
1007,
1063,
6522,
8684,
4974,
2121,
15155,
1031,
5725,
1009,
1009,
1033,
1027,
19701,
1025,
2065,
1006,
5725,
1027,
1027,
6522,
8684,
4974,
2121,
15155,
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... |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/LogFactory.java | LogFactory.create | public static LogFactory create() {
final LogFactory factory = doCreate();
factory.getLog(LogFactory.class).debug("Use [{}] Logger As Default.", factory.name);
return factory;
} | java | public static LogFactory create() {
final LogFactory factory = doCreate();
factory.getLog(LogFactory.class).debug("Use [{}] Logger As Default.", factory.name);
return factory;
} | [
"public",
"static",
"LogFactory",
"create",
"(",
")",
"{",
"final",
"LogFactory",
"factory",
"=",
"doCreate",
"(",
")",
";",
"factory",
".",
"getLog",
"(",
"LogFactory",
".",
"class",
")",
".",
"debug",
"(",
"\"Use [{}] Logger As Default.\"",
",",
"factory",
... | 决定日志实现
<p>
依次按照顺序检查日志库的jar是否被引入,如果未引入任何日志库,则检查ClassPath下的logging.properties,存在则使用JdkLogFactory,否则使用ConsoleLogFactory
@see Slf4jLogFactory
@see Log4j2LogFactory
@see Log4jLogFactory
@see ApacheCommonsLogFactory
@see TinyLogFactory
@see JbossLogFactory
@see ConsoleLogFactory
@see JdkLogFactory
@return 日志实现类 | [
"决定日志实现",
"<p",
">",
"依次按照顺序检查日志库的jar是否被引入,如果未引入任何日志库,则检查ClassPath下的logging",
".",
"properties,存在则使用JdkLogFactory,否则使用ConsoleLogFactory"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/LogFactory.java#L205-L209 | train | Create a new instance of the LogFactory class. | [
30522,
2270,
10763,
8833,
21450,
3443,
1006,
30524,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/RocksDBStateDownloader.java | RocksDBStateDownloader.downloadDataForAllStateHandles | private void downloadDataForAllStateHandles(
Map<StateHandleID, StreamStateHandle> stateHandleMap,
Path restoreInstancePath,
CloseableRegistry closeableRegistry) throws Exception {
try {
List<Runnable> runnables = createDownloadRunnables(stateHandleMap, restoreInstancePath, closeableRegistry);
List<CompletableFuture<Void>> futures = new ArrayList<>(runnables.size());
for (Runnable runnable : runnables) {
futures.add(CompletableFuture.runAsync(runnable, executorService));
}
FutureUtils.waitForAll(futures).get();
} catch (ExecutionException e) {
Throwable throwable = ExceptionUtils.stripExecutionException(e);
throwable = ExceptionUtils.stripException(throwable, RuntimeException.class);
if (throwable instanceof IOException) {
throw (IOException) throwable;
} else {
throw new FlinkRuntimeException("Failed to download data for state handles.", e);
}
}
} | java | private void downloadDataForAllStateHandles(
Map<StateHandleID, StreamStateHandle> stateHandleMap,
Path restoreInstancePath,
CloseableRegistry closeableRegistry) throws Exception {
try {
List<Runnable> runnables = createDownloadRunnables(stateHandleMap, restoreInstancePath, closeableRegistry);
List<CompletableFuture<Void>> futures = new ArrayList<>(runnables.size());
for (Runnable runnable : runnables) {
futures.add(CompletableFuture.runAsync(runnable, executorService));
}
FutureUtils.waitForAll(futures).get();
} catch (ExecutionException e) {
Throwable throwable = ExceptionUtils.stripExecutionException(e);
throwable = ExceptionUtils.stripException(throwable, RuntimeException.class);
if (throwable instanceof IOException) {
throw (IOException) throwable;
} else {
throw new FlinkRuntimeException("Failed to download data for state handles.", e);
}
}
} | [
"private",
"void",
"downloadDataForAllStateHandles",
"(",
"Map",
"<",
"StateHandleID",
",",
"StreamStateHandle",
">",
"stateHandleMap",
",",
"Path",
"restoreInstancePath",
",",
"CloseableRegistry",
"closeableRegistry",
")",
"throws",
"Exception",
"{",
"try",
"{",
"List"... | Copies all the files from the given stream state handles to the given path, renaming the files w.r.t. their
{@link StateHandleID}. | [
"Copies",
"all",
"the",
"files",
"from",
"the",
"given",
"stream",
"state",
"handles",
"to",
"the",
"given",
"path",
"renaming",
"the",
"files",
"w",
".",
"r",
".",
"t",
".",
"their",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBStateDownloader.java#L74-L95 | train | Download data for all state handles. | [
30522,
2797,
11675,
8816,
2850,
2696,
29278,
8095,
9153,
2618,
11774,
4244,
1006,
4949,
1026,
2110,
11774,
23057,
2094,
1010,
9199,
12259,
11774,
2571,
1028,
2110,
11774,
16930,
9331,
1010,
4130,
9239,
7076,
26897,
15069,
1010,
2485,
3085,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/support/ESSyncUtil.java | ESSyncUtil.typeConvert | public static Object typeConvert(Object val, String esType) {
if (val == null) {
return null;
}
if (esType == null) {
return val;
}
Object res = null;
if ("integer".equals(esType)) {
if (val instanceof Number) {
res = ((Number) val).intValue();
} else {
res = Integer.parseInt(val.toString());
}
} else if ("long".equals(esType)) {
if (val instanceof Number) {
res = ((Number) val).longValue();
} else {
res = Long.parseLong(val.toString());
}
} else if ("short".equals(esType)) {
if (val instanceof Number) {
res = ((Number) val).shortValue();
} else {
res = Short.parseShort(val.toString());
}
} else if ("byte".equals(esType)) {
if (val instanceof Number) {
res = ((Number) val).byteValue();
} else {
res = Byte.parseByte(val.toString());
}
} else if ("double".equals(esType)) {
if (val instanceof Number) {
res = ((Number) val).doubleValue();
} else {
res = Double.parseDouble(val.toString());
}
} else if ("float".equals(esType) || "half_float".equals(esType) || "scaled_float".equals(esType)) {
if (val instanceof Number) {
res = ((Number) val).floatValue();
} else {
res = Float.parseFloat(val.toString());
}
} else if ("boolean".equals(esType)) {
if (val instanceof Boolean) {
res = val;
} else if (val instanceof Number) {
int v = ((Number) val).intValue();
res = v != 0;
} else {
res = Boolean.parseBoolean(val.toString());
}
} else if ("date".equals(esType)) {
if (val instanceof java.sql.Time) {
DateTime dateTime = new DateTime(((java.sql.Time) val).getTime());
if (dateTime.getMillisOfSecond() != 0) {
res = dateTime.toString("HH:mm:ss.SSS");
} else {
res = dateTime.toString("HH:mm:ss");
}
} else if (val instanceof java.sql.Timestamp) {
DateTime dateTime = new DateTime(((java.sql.Timestamp) val).getTime());
if (dateTime.getMillisOfSecond() != 0) {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss.SSS" + Util.timeZone);
} else {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss" + Util.timeZone);
}
} else if (val instanceof java.sql.Date || val instanceof Date) {
DateTime dateTime;
if (val instanceof java.sql.Date) {
dateTime = new DateTime(((java.sql.Date) val).getTime());
} else {
dateTime = new DateTime(((Date) val).getTime());
}
if (dateTime.getHourOfDay() == 0 && dateTime.getMinuteOfHour() == 0 && dateTime.getSecondOfMinute() == 0
&& dateTime.getMillisOfSecond() == 0) {
res = dateTime.toString("yyyy-MM-dd");
} else {
if (dateTime.getMillisOfSecond() != 0) {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss.SSS" + Util.timeZone);
} else {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss" + Util.timeZone);
}
}
} else if (val instanceof Long) {
DateTime dateTime = new DateTime(((Long) val).longValue());
if (dateTime.getHourOfDay() == 0 && dateTime.getMinuteOfHour() == 0 && dateTime.getSecondOfMinute() == 0
&& dateTime.getMillisOfSecond() == 0) {
res = dateTime.toString("yyyy-MM-dd");
} else if (dateTime.getMillisOfSecond() != 0) {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss.SSS" + Util.timeZone);
} else {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss" + Util.timeZone);
}
} else if (val instanceof String) {
String v = ((String) val).trim();
if (v.length() > 18 && v.charAt(4) == '-' && v.charAt(7) == '-' && v.charAt(10) == ' '
&& v.charAt(13) == ':' && v.charAt(16) == ':') {
String dt = v.substring(0, 10) + "T" + v.substring(11);
Date date = Util.parseDate(dt);
if (date != null) {
DateTime dateTime = new DateTime(date);
if (dateTime.getMillisOfSecond() != 0) {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss.SSS" + Util.timeZone);
} else {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss" + Util.timeZone);
}
}
} else if (v.length() == 10 && v.charAt(4) == '-' && v.charAt(7) == '-') {
Date date = Util.parseDate(v);
if (date != null) {
DateTime dateTime = new DateTime(date);
res = dateTime.toString("yyyy-MM-dd");
}
}
}
} else if ("binary".equals(esType)) {
if (val instanceof byte[]) {
Base64 base64 = new Base64();
res = base64.encodeAsString((byte[]) val);
} else if (val instanceof Blob) {
byte[] b = blobToBytes((Blob) val);
Base64 base64 = new Base64();
res = base64.encodeAsString(b);
} else if (val instanceof String) {
// 对应canal中的单字节编码
byte[] b = ((String) val).getBytes(StandardCharsets.ISO_8859_1);
Base64 base64 = new Base64();
res = base64.encodeAsString(b);
}
} else if ("geo_point".equals(esType)) {
if (!(val instanceof String)) {
logger.error("es type is geo_point, but source type is not String");
return val;
}
if (!((String) val).contains(",")) {
logger.error("es type is geo_point, source value not contains ',' separator");
return val;
}
String[] point = ((String) val).split(",");
Map<String, Double> location = new HashMap<>();
location.put("lat", Double.valueOf(point[0].trim()));
location.put("lon", Double.valueOf(point[1].trim()));
return location;
} else if ("array".equals(esType)) {
if ("".equals(val.toString().trim())) {
res = new ArrayList<>();
} else {
String value = val.toString();
String separator = ",";
if (!value.contains(",")) {
if (value.contains(";")) {
separator = ";";
} else if (value.contains("|")) {
separator = "\\|";
} else if (value.contains("-")) {
separator = "-";
}
}
String[] values = value.split(separator);
return Arrays.asList(values);
}
} else if ("object".equals(esType)) {
if ("".equals(val.toString().trim())) {
res = new HashMap<>();
} else {
res = JSON.parseObject(val.toString(), Map.class);
}
} else {
// 其他类全以字符串处理
res = val.toString();
}
return res;
} | java | public static Object typeConvert(Object val, String esType) {
if (val == null) {
return null;
}
if (esType == null) {
return val;
}
Object res = null;
if ("integer".equals(esType)) {
if (val instanceof Number) {
res = ((Number) val).intValue();
} else {
res = Integer.parseInt(val.toString());
}
} else if ("long".equals(esType)) {
if (val instanceof Number) {
res = ((Number) val).longValue();
} else {
res = Long.parseLong(val.toString());
}
} else if ("short".equals(esType)) {
if (val instanceof Number) {
res = ((Number) val).shortValue();
} else {
res = Short.parseShort(val.toString());
}
} else if ("byte".equals(esType)) {
if (val instanceof Number) {
res = ((Number) val).byteValue();
} else {
res = Byte.parseByte(val.toString());
}
} else if ("double".equals(esType)) {
if (val instanceof Number) {
res = ((Number) val).doubleValue();
} else {
res = Double.parseDouble(val.toString());
}
} else if ("float".equals(esType) || "half_float".equals(esType) || "scaled_float".equals(esType)) {
if (val instanceof Number) {
res = ((Number) val).floatValue();
} else {
res = Float.parseFloat(val.toString());
}
} else if ("boolean".equals(esType)) {
if (val instanceof Boolean) {
res = val;
} else if (val instanceof Number) {
int v = ((Number) val).intValue();
res = v != 0;
} else {
res = Boolean.parseBoolean(val.toString());
}
} else if ("date".equals(esType)) {
if (val instanceof java.sql.Time) {
DateTime dateTime = new DateTime(((java.sql.Time) val).getTime());
if (dateTime.getMillisOfSecond() != 0) {
res = dateTime.toString("HH:mm:ss.SSS");
} else {
res = dateTime.toString("HH:mm:ss");
}
} else if (val instanceof java.sql.Timestamp) {
DateTime dateTime = new DateTime(((java.sql.Timestamp) val).getTime());
if (dateTime.getMillisOfSecond() != 0) {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss.SSS" + Util.timeZone);
} else {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss" + Util.timeZone);
}
} else if (val instanceof java.sql.Date || val instanceof Date) {
DateTime dateTime;
if (val instanceof java.sql.Date) {
dateTime = new DateTime(((java.sql.Date) val).getTime());
} else {
dateTime = new DateTime(((Date) val).getTime());
}
if (dateTime.getHourOfDay() == 0 && dateTime.getMinuteOfHour() == 0 && dateTime.getSecondOfMinute() == 0
&& dateTime.getMillisOfSecond() == 0) {
res = dateTime.toString("yyyy-MM-dd");
} else {
if (dateTime.getMillisOfSecond() != 0) {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss.SSS" + Util.timeZone);
} else {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss" + Util.timeZone);
}
}
} else if (val instanceof Long) {
DateTime dateTime = new DateTime(((Long) val).longValue());
if (dateTime.getHourOfDay() == 0 && dateTime.getMinuteOfHour() == 0 && dateTime.getSecondOfMinute() == 0
&& dateTime.getMillisOfSecond() == 0) {
res = dateTime.toString("yyyy-MM-dd");
} else if (dateTime.getMillisOfSecond() != 0) {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss.SSS" + Util.timeZone);
} else {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss" + Util.timeZone);
}
} else if (val instanceof String) {
String v = ((String) val).trim();
if (v.length() > 18 && v.charAt(4) == '-' && v.charAt(7) == '-' && v.charAt(10) == ' '
&& v.charAt(13) == ':' && v.charAt(16) == ':') {
String dt = v.substring(0, 10) + "T" + v.substring(11);
Date date = Util.parseDate(dt);
if (date != null) {
DateTime dateTime = new DateTime(date);
if (dateTime.getMillisOfSecond() != 0) {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss.SSS" + Util.timeZone);
} else {
res = dateTime.toString("yyyy-MM-dd'T'HH:mm:ss" + Util.timeZone);
}
}
} else if (v.length() == 10 && v.charAt(4) == '-' && v.charAt(7) == '-') {
Date date = Util.parseDate(v);
if (date != null) {
DateTime dateTime = new DateTime(date);
res = dateTime.toString("yyyy-MM-dd");
}
}
}
} else if ("binary".equals(esType)) {
if (val instanceof byte[]) {
Base64 base64 = new Base64();
res = base64.encodeAsString((byte[]) val);
} else if (val instanceof Blob) {
byte[] b = blobToBytes((Blob) val);
Base64 base64 = new Base64();
res = base64.encodeAsString(b);
} else if (val instanceof String) {
// 对应canal中的单字节编码
byte[] b = ((String) val).getBytes(StandardCharsets.ISO_8859_1);
Base64 base64 = new Base64();
res = base64.encodeAsString(b);
}
} else if ("geo_point".equals(esType)) {
if (!(val instanceof String)) {
logger.error("es type is geo_point, but source type is not String");
return val;
}
if (!((String) val).contains(",")) {
logger.error("es type is geo_point, source value not contains ',' separator");
return val;
}
String[] point = ((String) val).split(",");
Map<String, Double> location = new HashMap<>();
location.put("lat", Double.valueOf(point[0].trim()));
location.put("lon", Double.valueOf(point[1].trim()));
return location;
} else if ("array".equals(esType)) {
if ("".equals(val.toString().trim())) {
res = new ArrayList<>();
} else {
String value = val.toString();
String separator = ",";
if (!value.contains(",")) {
if (value.contains(";")) {
separator = ";";
} else if (value.contains("|")) {
separator = "\\|";
} else if (value.contains("-")) {
separator = "-";
}
}
String[] values = value.split(separator);
return Arrays.asList(values);
}
} else if ("object".equals(esType)) {
if ("".equals(val.toString().trim())) {
res = new HashMap<>();
} else {
res = JSON.parseObject(val.toString(), Map.class);
}
} else {
// 其他类全以字符串处理
res = val.toString();
}
return res;
} | [
"public",
"static",
"Object",
"typeConvert",
"(",
"Object",
"val",
",",
"String",
"esType",
")",
"{",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"esType",
"==",
"null",
")",
"{",
"return",
"val",
";",
"}",
"Obj... | 类型转换为Mapping中对应的类型 | [
"类型转换为Mapping中对应的类型"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/support/ESSyncUtil.java#L55-L232 | train | typeConvert Method. | [
30522,
2270,
10763,
4874,
2828,
8663,
16874,
1006,
4874,
11748,
1010,
5164,
9765,
18863,
1007,
1063,
2065,
1006,
11748,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2065,
1006,
9765,
18863,
1027,
1027,
19701,
1007,
1063,
2709,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java | DoubleArrayTrie.resize | private int resize(int newSize)
{
int[] base2 = new int[newSize];
int[] check2 = new int[newSize];
if (allocSize > 0)
{
System.arraycopy(base, 0, base2, 0, allocSize);
System.arraycopy(check, 0, check2, 0, allocSize);
}
base = base2;
check = check2;
return allocSize = newSize;
} | java | private int resize(int newSize)
{
int[] base2 = new int[newSize];
int[] check2 = new int[newSize];
if (allocSize > 0)
{
System.arraycopy(base, 0, base2, 0, allocSize);
System.arraycopy(check, 0, check2, 0, allocSize);
}
base = base2;
check = check2;
return allocSize = newSize;
} | [
"private",
"int",
"resize",
"(",
"int",
"newSize",
")",
"{",
"int",
"[",
"]",
"base2",
"=",
"new",
"int",
"[",
"newSize",
"]",
";",
"int",
"[",
"]",
"check2",
"=",
"new",
"int",
"[",
"newSize",
"]",
";",
"if",
"(",
"allocSize",
">",
"0",
")",
"... | 拓展数组
@param newSize
@return | [
"拓展数组"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L87-L101 | train | Resize the array of base and check arrays to the new size. | [
30522,
2797,
20014,
24501,
4697,
1006,
20014,
2739,
4697,
1007,
1063,
20014,
1031,
1033,
2918,
2475,
1027,
2047,
20014,
1031,
2739,
4697,
1033,
1025,
20014,
1031,
1033,
4638,
2475,
1027,
2047,
20014,
1031,
2739,
4697,
1033,
1025,
2065,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/FileArchivedExecutionGraphStore.java | FileArchivedExecutionGraphStore.calculateSize | private int calculateSize(JobID jobId, ArchivedExecutionGraph serializableExecutionGraph) {
final File archivedExecutionGraphFile = getExecutionGraphFile(jobId);
if (archivedExecutionGraphFile.exists()) {
return Math.toIntExact(archivedExecutionGraphFile.length());
} else {
LOG.debug("Could not find archived execution graph file for {}. Estimating the size instead.", jobId);
return serializableExecutionGraph.getAllVertices().size() * 1000 +
serializableExecutionGraph.getAccumulatorsSerialized().size() * 1000;
}
} | java | private int calculateSize(JobID jobId, ArchivedExecutionGraph serializableExecutionGraph) {
final File archivedExecutionGraphFile = getExecutionGraphFile(jobId);
if (archivedExecutionGraphFile.exists()) {
return Math.toIntExact(archivedExecutionGraphFile.length());
} else {
LOG.debug("Could not find archived execution graph file for {}. Estimating the size instead.", jobId);
return serializableExecutionGraph.getAllVertices().size() * 1000 +
serializableExecutionGraph.getAccumulatorsSerialized().size() * 1000;
}
} | [
"private",
"int",
"calculateSize",
"(",
"JobID",
"jobId",
",",
"ArchivedExecutionGraph",
"serializableExecutionGraph",
")",
"{",
"final",
"File",
"archivedExecutionGraphFile",
"=",
"getExecutionGraphFile",
"(",
"jobId",
")",
";",
"if",
"(",
"archivedExecutionGraphFile",
... | -------------------------------------------------------------- | [
"--------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/FileArchivedExecutionGraphStore.java#L217-L227 | train | Calculates the size of the given job. | [
30522,
2797,
20014,
18422,
5332,
4371,
1006,
3105,
3593,
3105,
3593,
1010,
9749,
10288,
8586,
13700,
14413,
7642,
21335,
3468,
10288,
8586,
13700,
14413,
1007,
1063,
2345,
5371,
9749,
10288,
8586,
13700,
14413,
8873,
2571,
1027,
2131,
10288,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java | IndexedElementsBinder.bindIndexed | protected final void bindIndexed(ConfigurationPropertyName name, Bindable<?> target,
AggregateElementBinder elementBinder, ResolvableType aggregateType,
ResolvableType elementType, IndexedCollectionSupplier result) {
for (ConfigurationPropertySource source : getContext().getSources()) {
bindIndexed(source, name, target, elementBinder, result, aggregateType,
elementType);
if (result.wasSupplied() && result.get() != null) {
return;
}
}
} | java | protected final void bindIndexed(ConfigurationPropertyName name, Bindable<?> target,
AggregateElementBinder elementBinder, ResolvableType aggregateType,
ResolvableType elementType, IndexedCollectionSupplier result) {
for (ConfigurationPropertySource source : getContext().getSources()) {
bindIndexed(source, name, target, elementBinder, result, aggregateType,
elementType);
if (result.wasSupplied() && result.get() != null) {
return;
}
}
} | [
"protected",
"final",
"void",
"bindIndexed",
"(",
"ConfigurationPropertyName",
"name",
",",
"Bindable",
"<",
"?",
">",
"target",
",",
"AggregateElementBinder",
"elementBinder",
",",
"ResolvableType",
"aggregateType",
",",
"ResolvableType",
"elementType",
",",
"IndexedCo... | Bind indexed elements to the supplied collection.
@param name the name of the property to bind
@param target the target bindable
@param elementBinder the binder to use for elements
@param aggregateType the aggregate type, may be a collection or an array
@param elementType the element type
@param result the destination for results | [
"Bind",
"indexed",
"elements",
"to",
"the",
"supplied",
"collection",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/IndexedElementsBinder.java#L67-L77 | train | Binds the indexed elements of the configuration property. | [
30522,
5123,
2345,
11675,
14187,
22254,
10288,
2098,
1006,
9563,
21572,
4842,
25680,
14074,
2171,
1010,
14187,
3085,
1026,
1029,
1028,
4539,
1010,
9572,
12260,
3672,
8428,
4063,
5783,
8428,
4063,
1010,
24501,
4747,
12423,
13874,
9572,
13874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java | RandomUtil.randomEle | public static <T> T randomEle(List<T> list, int limit) {
return list.get(randomInt(limit));
} | java | public static <T> T randomEle(List<T> list, int limit) {
return list.get(randomInt(limit));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"randomEle",
"(",
"List",
"<",
"T",
">",
"list",
",",
"int",
"limit",
")",
"{",
"return",
"list",
".",
"get",
"(",
"randomInt",
"(",
"limit",
")",
")",
";",
"}"
] | 随机获得列表中的元素
@param <T> 元素类型
@param list 列表
@param limit 限制列表的前N项
@return 随机元素 | [
"随机获得列表中的元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java#L274-L276 | train | Returns a random element from the list. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
6721,
12260,
1006,
2862,
1026,
1056,
1028,
2862,
1010,
20014,
5787,
1007,
1063,
2709,
2862,
1012,
2131,
1006,
6721,
18447,
1006,
5787,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.filter | public SingleOutputStreamOperator<T> filter(FilterFunction<T> filter) {
return transform("Filter", getType(), new StreamFilter<>(clean(filter)));
} | java | public SingleOutputStreamOperator<T> filter(FilterFunction<T> filter) {
return transform("Filter", getType(), new StreamFilter<>(clean(filter)));
} | [
"public",
"SingleOutputStreamOperator",
"<",
"T",
">",
"filter",
"(",
"FilterFunction",
"<",
"T",
">",
"filter",
")",
"{",
"return",
"transform",
"(",
"\"Filter\"",
",",
"getType",
"(",
")",
",",
"new",
"StreamFilter",
"<>",
"(",
"clean",
"(",
"filter",
")... | Applies a Filter transformation on a {@link DataStream}. The
transformation calls a {@link FilterFunction} for each element of the
DataStream and retains only those element for which the function returns
true. Elements for which the function returns false are filtered. The
user can also extend {@link RichFilterFunction} to gain access to other
features provided by the
{@link org.apache.flink.api.common.functions.RichFunction} interface.
@param filter
The FilterFunction that is called for each element of the
DataStream.
@return The filtered DataStream. | [
"Applies",
"a",
"Filter",
"transformation",
"on",
"a",
"{",
"@link",
"DataStream",
"}",
".",
"The",
"transformation",
"calls",
"a",
"{",
"@link",
"FilterFunction",
"}",
"for",
"each",
"element",
"of",
"the",
"DataStream",
"and",
"retains",
"only",
"those",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L687-L690 | train | Filters the output stream using the given filter function. | [
30522,
2270,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1056,
1028,
11307,
1006,
11307,
11263,
27989,
1026,
1056,
1028,
11307,
1007,
1063,
2709,
10938,
1006,
1000,
11307,
1000,
1010,
2131,
13874,
1006,
1007,
1010,
2047,
5460,
8873,
21928,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/WindowedStream.java | WindowedStream.evictor | @PublicEvolving
public WindowedStream<T, K, W> evictor(Evictor<? super T, ? super W> evictor) {
if (windowAssigner instanceof BaseAlignedWindowAssigner) {
throw new UnsupportedOperationException("Cannot use a " + windowAssigner.getClass().getSimpleName() + " with an Evictor.");
}
this.evictor = evictor;
return this;
} | java | @PublicEvolving
public WindowedStream<T, K, W> evictor(Evictor<? super T, ? super W> evictor) {
if (windowAssigner instanceof BaseAlignedWindowAssigner) {
throw new UnsupportedOperationException("Cannot use a " + windowAssigner.getClass().getSimpleName() + " with an Evictor.");
}
this.evictor = evictor;
return this;
} | [
"@",
"PublicEvolving",
"public",
"WindowedStream",
"<",
"T",
",",
"K",
",",
"W",
">",
"evictor",
"(",
"Evictor",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"W",
">",
"evictor",
")",
"{",
"if",
"(",
"windowAssigner",
"instanceof",
"BaseAlignedWindowAssigner... | Sets the {@code Evictor} that should be used to evict elements from a window before emission.
<p>Note: When using an evictor window performance will degrade significantly, since
incremental aggregation of window results cannot be used. | [
"Sets",
"the",
"{",
"@code",
"Evictor",
"}",
"that",
"should",
"be",
"used",
"to",
"evict",
"elements",
"from",
"a",
"window",
"before",
"emission",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java#L189-L196 | train | Sets the Evictor to use for evicting the stream. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
3332,
2098,
21422,
1026,
1056,
1010,
1047,
1010,
1059,
1028,
23408,
2594,
4263,
1006,
23408,
30524,
4895,
6342,
9397,
15613,
25918,
3370,
10288,
24422,
1006,
1000,
3685,
2224,
1037,
1000,
1009,
333... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.cbHits | public long cbHits() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionCbHits(context.ctx);
} finally {
readerLock.unlock();
}
} | java | public long cbHits() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionCbHits(context.ctx);
} finally {
readerLock.unlock();
}
} | [
"public",
"long",
"cbHits",
"(",
")",
"{",
"Lock",
"readerLock",
"=",
"context",
".",
"ctxLock",
".",
"readLock",
"(",
")",
";",
"readerLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"SSLContext",
".",
"sessionCbHits",
"(",
"context",
".",
"c... | Returns the number of successfully retrieved sessions from the external session cache in server mode. | [
"Returns",
"the",
"number",
"of",
"successfully",
"retrieved",
"sessions",
"from",
"the",
"external",
"session",
"cache",
"in",
"server",
"mode",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java#L149-L157 | train | Gets the number of hits in the session cache. | [
30522,
2270,
2146,
17324,
16584,
2015,
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,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/text/StrSpliter.java | StrSpliter.splitByRegex | public static List<String> splitByRegex(String str, String separatorRegex, int limit, boolean isTrim, boolean ignoreEmpty){
final Pattern pattern = PatternPool.get(separatorRegex);
return split(str, pattern, limit, isTrim, ignoreEmpty);
} | java | public static List<String> splitByRegex(String str, String separatorRegex, int limit, boolean isTrim, boolean ignoreEmpty){
final Pattern pattern = PatternPool.get(separatorRegex);
return split(str, pattern, limit, isTrim, ignoreEmpty);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"splitByRegex",
"(",
"String",
"str",
",",
"String",
"separatorRegex",
",",
"int",
"limit",
",",
"boolean",
"isTrim",
",",
"boolean",
"ignoreEmpty",
")",
"{",
"final",
"Pattern",
"pattern",
"=",
"PatternPool",
... | 通过正则切分字符串
@param str 字符串
@param separatorRegex 分隔符正则
@param limit 限制分片数
@param isTrim 是否去除切分字符串后每个元素两边的空格
@param ignoreEmpty 是否忽略空串
@return 切分后的集合
@since 3.0.8 | [
"通过正则切分字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java#L399-L402 | train | Splits the given string by the given separator regex. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
3975,
3762,
2890,
3351,
2595,
1006,
5164,
2358,
2099,
1010,
5164,
19802,
25879,
2953,
2890,
3351,
2595,
1010,
20014,
5787,
1010,
22017,
20898,
21541,
20026,
1010,
22017,
20898,
8568,
6633,
13876,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.presenceOfNestedElementLocatedBy | public static ExpectedCondition<WebElement> presenceOfNestedElementLocatedBy(
final WebElement element,
final By childLocator) {
return new ExpectedCondition<WebElement>() {
@Override
public WebElement apply(WebDriver webDriver) {
return element.findElement(childLocator);
}
@Override
public String toString() {
return String.format("visibility of element located by %s", childLocator);
}
};
} | java | public static ExpectedCondition<WebElement> presenceOfNestedElementLocatedBy(
final WebElement element,
final By childLocator) {
return new ExpectedCondition<WebElement>() {
@Override
public WebElement apply(WebDriver webDriver) {
return element.findElement(childLocator);
}
@Override
public String toString() {
return String.format("visibility of element located by %s", childLocator);
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"WebElement",
">",
"presenceOfNestedElementLocatedBy",
"(",
"final",
"WebElement",
"element",
",",
"final",
"By",
"childLocator",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"WebElement",
">",
"(",
")",
"{",
"... | An expectation for checking child WebElement as a part of parent element to be present
@param element used as parent element
@param childLocator used to find child element. For example td By.xpath("./tr/td")
@return subelement | [
"An",
"expectation",
"for",
"checking",
"child",
"WebElement",
"as",
"a",
"part",
"of",
"parent",
"element",
"to",
"be",
"present"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L1247-L1263 | train | An expectation for checking that an element is present on a nested page with a locator that is located by a child element. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
4773,
12260,
3672,
1028,
3739,
11253,
5267,
3064,
12260,
3672,
4135,
12921,
3762,
1006,
2345,
4773,
12260,
3672,
5783,
1010,
2345,
2011,
2775,
4135,
11266,
2953,
1007,
1063,
2709,
2047,
3517,
866... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.addParam | private static void addParam(Map<String, List<String>> params, String name, String value, String charset) {
name = URLUtil.decode(name, charset);
value = URLUtil.decode(value, charset);
List<String> values = params.get(name);
if (values == null) {
values = new ArrayList<String>(1); // 一般是一个参数
params.put(name, values);
}
values.add(value);
} | java | private static void addParam(Map<String, List<String>> params, String name, String value, String charset) {
name = URLUtil.decode(name, charset);
value = URLUtil.decode(value, charset);
List<String> values = params.get(name);
if (values == null) {
values = new ArrayList<String>(1); // 一般是一个参数
params.put(name, values);
}
values.add(value);
} | [
"private",
"static",
"void",
"addParam",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"params",
",",
"String",
"name",
",",
"String",
"value",
",",
"String",
"charset",
")",
"{",
"name",
"=",
"URLUtil",
".",
"decode",
"(",
"name",
... | 将键值对加入到值为List类型的Map中
@param params 参数
@param name key
@param value value
@param charset 编码 | [
"将键值对加入到值为List类型的Map中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L763-L772 | train | Add a parameter to a map. | [
30522,
2797,
10763,
11675,
5587,
28689,
2213,
1006,
4949,
1026,
5164,
1010,
2862,
1026,
5164,
1028,
1028,
11498,
5244,
1010,
5164,
2171,
1010,
5164,
3643,
1010,
5164,
25869,
13462,
1007,
1063,
2171,
1027,
24471,
7630,
3775,
2140,
1012,
2193... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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... |
apache/flink | flink-mesos/src/main/java/org/apache/flink/mesos/Utils.java | Utils.rangeValues | public static LongStream rangeValues(Collection<Protos.Resource> resources) {
checkNotNull(resources);
return resources.stream()
.filter(Protos.Resource::hasRanges)
.flatMap(r -> r.getRanges().getRangeList().stream())
.flatMapToLong(Utils::rangeValues);
} | java | public static LongStream rangeValues(Collection<Protos.Resource> resources) {
checkNotNull(resources);
return resources.stream()
.filter(Protos.Resource::hasRanges)
.flatMap(r -> r.getRanges().getRangeList().stream())
.flatMapToLong(Utils::rangeValues);
} | [
"public",
"static",
"LongStream",
"rangeValues",
"(",
"Collection",
"<",
"Protos",
".",
"Resource",
">",
"resources",
")",
"{",
"checkNotNull",
"(",
"resources",
")",
";",
"return",
"resources",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"Protos",
".",
"... | Gets a stream of values from a collection of range resources. | [
"Gets",
"a",
"stream",
"of",
"values",
"from",
"a",
"collection",
"of",
"range",
"resources",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/Utils.java#L222-L228 | train | Returns a stream of LongStream containing all range values of the resources in the collection. | [
30522,
2270,
10763,
2146,
21422,
2846,
10175,
15808,
1006,
3074,
1026,
15053,
2015,
1012,
7692,
1028,
4219,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
4219,
1007,
1025,
2709,
4219,
1012,
5460,
1006,
1007,
1012,
11307,
1006,
15053,
2015,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/join/JoinOperatorSetsBase.java | JoinOperatorSetsBase.where | public <K> JoinOperatorSetsPredicateBase where(KeySelector<I1, K> keySelector) {
TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keySelector, input1.getType());
return new JoinOperatorSetsPredicateBase(new Keys.SelectorFunctionKeys<>(keySelector, input1.getType(), keyType));
} | java | public <K> JoinOperatorSetsPredicateBase where(KeySelector<I1, K> keySelector) {
TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keySelector, input1.getType());
return new JoinOperatorSetsPredicateBase(new Keys.SelectorFunctionKeys<>(keySelector, input1.getType(), keyType));
} | [
"public",
"<",
"K",
">",
"JoinOperatorSetsPredicateBase",
"where",
"(",
"KeySelector",
"<",
"I1",
",",
"K",
">",
"keySelector",
")",
"{",
"TypeInformation",
"<",
"K",
">",
"keyType",
"=",
"TypeExtractor",
".",
"getKeySelectorTypes",
"(",
"keySelector",
",",
"i... | Continues a Join transformation and defines a {@link KeySelector} function for the first join {@link DataSet}.
<p>The KeySelector function is called for each element of the first DataSet and extracts a single
key value on which the DataSet is joined.
@param keySelector The KeySelector function which extracts the key values from the DataSet on which it is joined.
@return An incomplete Join transformation.
Call {@link org.apache.flink.api.java.operators.join.JoinOperatorSetsBase.JoinOperatorSetsPredicateBase#equalTo(int...)} or
{@link org.apache.flink.api.java.operators.join.JoinOperatorSetsBase.JoinOperatorSetsPredicateBase#equalTo(KeySelector)}
to continue the Join.
@see KeySelector
@see DataSet | [
"Continues",
"a",
"Join",
"transformation",
"and",
"defines",
"a",
"{",
"@link",
"KeySelector",
"}",
"function",
"for",
"the",
"first",
"join",
"{",
"@link",
"DataSet",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/join/JoinOperatorSetsBase.java#L128-L131 | train | Create a new JoinOperatorSetsPredicateBase that will accept the given key selector. | [
30522,
2270,
1026,
1047,
1028,
3693,
25918,
18926,
8454,
28139,
16467,
15058,
2073,
1006,
6309,
12260,
16761,
1026,
1045,
2487,
1010,
1047,
1028,
6309,
12260,
16761,
1007,
1063,
2828,
2378,
14192,
3370,
1026,
1047,
1028,
3145,
13874,
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... |
networknt/light-4j | http-url/src/main/java/com/networknt/url/URLNormalizer.java | URLNormalizer.removeDirectoryIndex | public URLNormalizer removeDirectoryIndex() {
String path = toURL().getPath();
if (PATTERN_PATH_LAST_SEGMENT.matcher(path).matches()) {
url = StringUtils.replaceOnce(
url, path, StringUtils.substringBeforeLast(path, "/") + "/");
}
return this;
} | java | public URLNormalizer removeDirectoryIndex() {
String path = toURL().getPath();
if (PATTERN_PATH_LAST_SEGMENT.matcher(path).matches()) {
url = StringUtils.replaceOnce(
url, path, StringUtils.substringBeforeLast(path, "/") + "/");
}
return this;
} | [
"public",
"URLNormalizer",
"removeDirectoryIndex",
"(",
")",
"{",
"String",
"path",
"=",
"toURL",
"(",
")",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"PATTERN_PATH_LAST_SEGMENT",
".",
"matcher",
"(",
"path",
")",
".",
"matches",
"(",
")",
")",
"{",
"url"... | <p>Removes directory index files. They are often not needed in URLs.</p>
<code>http://www.example.com/a/index.html →
http://www.example.com/a/</code>
<p>Index files must be the last URL path segment to be considered.
The following are considered index files:</p>
<ul>
<li>index.html</li>
<li>index.htm</li>
<li>index.shtml</li>
<li>index.php</li>
<li>default.html</li>
<li>default.htm</li>
<li>home.html</li>
<li>home.htm</li>
<li>index.php5</li>
<li>index.php4</li>
<li>index.php3</li>
<li>index.cgi</li>
<li>placeholder.html</li>
<li>default.asp</li>
</ul>
<p><b>Please Note:</b> There are no guarantees a URL without its
index files will be semantically equivalent, or even be valid.</p>
@return this instance | [
"<p",
">",
"Removes",
"directory",
"index",
"files",
".",
"They",
"are",
"often",
"not",
"needed",
"in",
"URLs",
".",
"<",
"/",
"p",
">",
"<code",
">",
"http",
":",
"//",
"www",
".",
"example",
".",
"com",
"/",
"a",
"/",
"index",
".",
"html",
"&r... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/URLNormalizer.java#L544-L551 | train | Remove directory index. | [
30522,
2270,
24471,
19666,
2953,
9067,
17629,
3718,
7442,
16761,
25811,
3207,
2595,
1006,
1007,
1063,
5164,
4130,
1027,
2778,
2140,
1006,
1007,
1012,
2131,
15069,
1006,
1007,
1025,
2065,
1006,
5418,
1035,
4130,
1035,
2197,
1035,
6903,
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... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpResponse.java | HttpResponse.forceSync | private HttpResponse forceSync() {
// 非同步状态转为同步状态
try {
this.readBody(this.in);
} catch (IORuntimeException e) {
if (e.getCause() instanceof FileNotFoundException) {
// 服务器无返回内容,忽略之
} else {
throw new HttpException(e);
}
} finally {
if (this.isAsync) {
this.isAsync = false;
}
this.close();
}
return this;
} | java | private HttpResponse forceSync() {
// 非同步状态转为同步状态
try {
this.readBody(this.in);
} catch (IORuntimeException e) {
if (e.getCause() instanceof FileNotFoundException) {
// 服务器无返回内容,忽略之
} else {
throw new HttpException(e);
}
} finally {
if (this.isAsync) {
this.isAsync = false;
}
this.close();
}
return this;
} | [
"private",
"HttpResponse",
"forceSync",
"(",
")",
"{",
"// 非同步状态转为同步状态\r",
"try",
"{",
"this",
".",
"readBody",
"(",
"this",
".",
"in",
")",
";",
"}",
"catch",
"(",
"IORuntimeException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getCause",
"(",
")",
"instan... | 强制同步,用于初始化<br>
强制同步后变化如下:
<pre>
1、读取body内容到内存
2、异步状态设为false(变为同步状态)
3、关闭Http流
4、断开与服务器连接
</pre>
@return this | [
"强制同步,用于初始化<br",
">",
"强制同步后变化如下:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpResponse.java#L425-L442 | train | Force sync. | [
30522,
2797,
8299,
6072,
26029,
3366,
2749,
6038,
2278,
1006,
1007,
1063,
1013,
1013,
100,
1794,
100,
100,
100,
100,
100,
1794,
100,
100,
100,
3046,
1063,
2023,
1012,
3191,
23684,
1006,
2023,
1012,
1999,
1007,
1025,
1065,
4608,
1006,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java | JobGraph.getVerticesSortedTopologicallyFromSources | public List<JobVertex> getVerticesSortedTopologicallyFromSources() throws InvalidProgramException {
// early out on empty lists
if (this.taskVertices.isEmpty()) {
return Collections.emptyList();
}
List<JobVertex> sorted = new ArrayList<JobVertex>(this.taskVertices.size());
Set<JobVertex> remaining = new LinkedHashSet<JobVertex>(this.taskVertices.values());
// start by finding the vertices with no input edges
// and the ones with disconnected inputs (that refer to some standalone data set)
{
Iterator<JobVertex> iter = remaining.iterator();
while (iter.hasNext()) {
JobVertex vertex = iter.next();
if (vertex.hasNoConnectedInputs()) {
sorted.add(vertex);
iter.remove();
}
}
}
int startNodePos = 0;
// traverse from the nodes that were added until we found all elements
while (!remaining.isEmpty()) {
// first check if we have more candidates to start traversing from. if not, then the
// graph is cyclic, which is not permitted
if (startNodePos >= sorted.size()) {
throw new InvalidProgramException("The job graph is cyclic.");
}
JobVertex current = sorted.get(startNodePos++);
addNodesThatHaveNoNewPredecessors(current, sorted, remaining);
}
return sorted;
} | java | public List<JobVertex> getVerticesSortedTopologicallyFromSources() throws InvalidProgramException {
// early out on empty lists
if (this.taskVertices.isEmpty()) {
return Collections.emptyList();
}
List<JobVertex> sorted = new ArrayList<JobVertex>(this.taskVertices.size());
Set<JobVertex> remaining = new LinkedHashSet<JobVertex>(this.taskVertices.values());
// start by finding the vertices with no input edges
// and the ones with disconnected inputs (that refer to some standalone data set)
{
Iterator<JobVertex> iter = remaining.iterator();
while (iter.hasNext()) {
JobVertex vertex = iter.next();
if (vertex.hasNoConnectedInputs()) {
sorted.add(vertex);
iter.remove();
}
}
}
int startNodePos = 0;
// traverse from the nodes that were added until we found all elements
while (!remaining.isEmpty()) {
// first check if we have more candidates to start traversing from. if not, then the
// graph is cyclic, which is not permitted
if (startNodePos >= sorted.size()) {
throw new InvalidProgramException("The job graph is cyclic.");
}
JobVertex current = sorted.get(startNodePos++);
addNodesThatHaveNoNewPredecessors(current, sorted, remaining);
}
return sorted;
} | [
"public",
"List",
"<",
"JobVertex",
">",
"getVerticesSortedTopologicallyFromSources",
"(",
")",
"throws",
"InvalidProgramException",
"{",
"// early out on empty lists",
"if",
"(",
"this",
".",
"taskVertices",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Collections"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java#L405-L444 | train | Returns a list of vertices sorted topologically from the sources. | [
30522,
2270,
2862,
1026,
3105,
16874,
10288,
1028,
2131,
16874,
23522,
21748,
3064,
14399,
10091,
2135,
19699,
22225,
8162,
9623,
1006,
1007,
11618,
19528,
21572,
13113,
10288,
24422,
1063,
1013,
1013,
2220,
2041,
2006,
4064,
7201,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/HanLP.java | HanLP.extractWords | public static List<WordInfo> extractWords(BufferedReader reader, int size, boolean newWordsOnly) throws IOException
{
NewWordDiscover discover = new NewWordDiscover(4, 0.0f, .5f, 100f, newWordsOnly);
return discover.discover(reader, size);
} | java | public static List<WordInfo> extractWords(BufferedReader reader, int size, boolean newWordsOnly) throws IOException
{
NewWordDiscover discover = new NewWordDiscover(4, 0.0f, .5f, 100f, newWordsOnly);
return discover.discover(reader, size);
} | [
"public",
"static",
"List",
"<",
"WordInfo",
">",
"extractWords",
"(",
"BufferedReader",
"reader",
",",
"int",
"size",
",",
"boolean",
"newWordsOnly",
")",
"throws",
"IOException",
"{",
"NewWordDiscover",
"discover",
"=",
"new",
"NewWordDiscover",
"(",
"4",
",",... | 提取词语(新词发现)
@param reader 从reader获取文本
@param size 需要提取词语的数量
@param newWordsOnly 是否只提取词典中没有的词语
@return 一个词语列表 | [
"提取词语(新词发现)"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/HanLP.java#L771-L775 | train | Extract words from a buffered reader. | [
30522,
2270,
10763,
2862,
1026,
2773,
2378,
14876,
1028,
14817,
22104,
1006,
17698,
2098,
16416,
4063,
8068,
1010,
20014,
2946,
1010,
22017,
20898,
2047,
22104,
2239,
2135,
1007,
11618,
22834,
10288,
24422,
1063,
2047,
18351,
10521,
3597,
629... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.writeString | public static File writeString(String content, File file, String charset) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.charset(charset)).write(content);
} | java | public static File writeString(String content, File file, String charset) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.charset(charset)).write(content);
} | [
"public",
"static",
"File",
"writeString",
"(",
"String",
"content",
",",
"File",
"file",
",",
"String",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
"(",
"file",
",",
"CharsetUtil",
".",
"charset",
"(",
"charset"... | 将String写入文件,覆盖模式
@param content 写入的内容
@param file 文件
@param charset 字符集
@return 被写入的文件
@throws IORuntimeException IO异常 | [
"将String写入文件,覆盖模式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2747-L2749 | train | Write a string to a file. | [
30522,
2270,
10763,
5371,
7009,
18886,
3070,
1006,
5164,
4180,
1010,
5371,
5371,
1010,
5164,
25869,
13462,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
5371,
15994,
1012,
3443,
1006,
5371,
1010,
25869,
13462,
21823,
2140,
30524,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/operators/DataSink.java | DataSink.translateToDataFlow | protected GenericDataSinkBase<T> translateToDataFlow(Operator<T> input) {
// select the name (or create a default one)
String name = this.name != null ? this.name : this.format.toString();
GenericDataSinkBase<T> sink = new GenericDataSinkBase<>(this.format, new UnaryOperatorInformation<>(this.type, new NothingTypeInfo()), name);
// set input
sink.setInput(input);
// set parameters
if (this.parameters != null) {
sink.getParameters().addAll(this.parameters);
}
// set parallelism
if (this.parallelism > 0) {
// use specified parallelism
sink.setParallelism(this.parallelism);
} else {
// if no parallelism has been specified, use parallelism of input operator to enable chaining
sink.setParallelism(input.getParallelism());
}
if (this.sortKeyPositions != null) {
// configure output sorting
Ordering ordering = new Ordering();
for (int i = 0; i < this.sortKeyPositions.length; i++) {
ordering.appendOrdering(this.sortKeyPositions[i], null, this.sortOrders[i]);
}
sink.setLocalOrder(ordering);
}
return sink;
} | java | protected GenericDataSinkBase<T> translateToDataFlow(Operator<T> input) {
// select the name (or create a default one)
String name = this.name != null ? this.name : this.format.toString();
GenericDataSinkBase<T> sink = new GenericDataSinkBase<>(this.format, new UnaryOperatorInformation<>(this.type, new NothingTypeInfo()), name);
// set input
sink.setInput(input);
// set parameters
if (this.parameters != null) {
sink.getParameters().addAll(this.parameters);
}
// set parallelism
if (this.parallelism > 0) {
// use specified parallelism
sink.setParallelism(this.parallelism);
} else {
// if no parallelism has been specified, use parallelism of input operator to enable chaining
sink.setParallelism(input.getParallelism());
}
if (this.sortKeyPositions != null) {
// configure output sorting
Ordering ordering = new Ordering();
for (int i = 0; i < this.sortKeyPositions.length; i++) {
ordering.appendOrdering(this.sortKeyPositions[i], null, this.sortOrders[i]);
}
sink.setLocalOrder(ordering);
}
return sink;
} | [
"protected",
"GenericDataSinkBase",
"<",
"T",
">",
"translateToDataFlow",
"(",
"Operator",
"<",
"T",
">",
"input",
")",
"{",
"// select the name (or create a default one)",
"String",
"name",
"=",
"this",
".",
"name",
"!=",
"null",
"?",
"this",
".",
"name",
":",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/DataSink.java#L233-L262 | train | Translates the given input operator to data flow. | [
30522,
5123,
12391,
2850,
10230,
19839,
15058,
1026,
1056,
1028,
17637,
3406,
2850,
2696,
12314,
1006,
6872,
1026,
1056,
1028,
7953,
1007,
1063,
1013,
1013,
7276,
1996,
2171,
1006,
2030,
3443,
1037,
12398,
2028,
1007,
5164,
2171,
1027,
2023... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/SymmetricCrypto.java | SymmetricCrypto.encryptHex | public String encryptHex(String data, String charset) {
return HexUtil.encodeHexStr(encrypt(data, charset));
} | java | public String encryptHex(String data, String charset) {
return HexUtil.encodeHexStr(encrypt(data, charset));
} | [
"public",
"String",
"encryptHex",
"(",
"String",
"data",
",",
"String",
"charset",
")",
"{",
"return",
"HexUtil",
".",
"encodeHexStr",
"(",
"encrypt",
"(",
"data",
",",
"charset",
")",
")",
";",
"}"
] | 加密
@param data 被加密的字符串
@param charset 编码
@return 加密后的Hex | [
"加密"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/SymmetricCrypto.java#L210-L212 | train | Encrypt a string using the specified charset. | [
30522,
2270,
5164,
4372,
26775,
22571,
10760,
2595,
1006,
5164,
2951,
1010,
5164,
25869,
13462,
1007,
1063,
2709,
2002,
2595,
21823,
2140,
1012,
4372,
16044,
5369,
2595,
3367,
2099,
1006,
4372,
26775,
22571,
2102,
1006,
2951,
1010,
25869,
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-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.sortPartition | public <K> SortPartitionOperator<T> sortPartition(KeySelector<T, K> keyExtractor, Order order) {
final TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keyExtractor, getType());
return new SortPartitionOperator<>(this, new Keys.SelectorFunctionKeys<>(clean(keyExtractor), getType(), keyType), order, Utils.getCallLocationName());
} | java | public <K> SortPartitionOperator<T> sortPartition(KeySelector<T, K> keyExtractor, Order order) {
final TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keyExtractor, getType());
return new SortPartitionOperator<>(this, new Keys.SelectorFunctionKeys<>(clean(keyExtractor), getType(), keyType), order, Utils.getCallLocationName());
} | [
"public",
"<",
"K",
">",
"SortPartitionOperator",
"<",
"T",
">",
"sortPartition",
"(",
"KeySelector",
"<",
"T",
",",
"K",
">",
"keyExtractor",
",",
"Order",
"order",
")",
"{",
"final",
"TypeInformation",
"<",
"K",
">",
"keyType",
"=",
"TypeExtractor",
".",... | Locally sorts the partitions of the DataSet on the extracted key in the specified order.
The DataSet can be sorted on multiple values by returning a tuple from the KeySelector.
<p>Note that no additional sort keys can be appended to a KeySelector sort keys. To sort
the partitions by multiple values using KeySelector, the KeySelector must return a tuple
consisting of the values.
@param keyExtractor The KeySelector function which extracts the key values from the DataSet
on which the DataSet is sorted.
@param order The order in which the DataSet is sorted.
@return The DataSet with sorted local partitions. | [
"Locally",
"sorts",
"the",
"partitions",
"of",
"the",
"DataSet",
"on",
"the",
"extracted",
"key",
"in",
"the",
"specified",
"order",
".",
"The",
"DataSet",
"can",
"be",
"sorted",
"on",
"multiple",
"values",
"by",
"returning",
"a",
"tuple",
"from",
"the",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1430-L1433 | train | Sorts the partitions of this DataSet using the provided key selector and order. | [
30522,
2270,
1026,
1047,
1028,
4066,
19362,
3775,
3508,
25918,
8844,
1026,
1056,
1028,
30524,
1063,
2345,
2828,
2378,
14192,
3370,
1026,
1047,
1028,
3145,
13874,
1027,
2828,
10288,
6494,
16761,
1012,
2131,
14839,
11246,
22471,
11589,
18863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.setDateHeader | @Deprecated
public static void setDateHeader(HttpMessage message, String name, Date value) {
setDateHeader(message, (CharSequence) name, value);
} | java | @Deprecated
public static void setDateHeader(HttpMessage message, String name, Date value) {
setDateHeader(message, (CharSequence) name, value);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"setDateHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
",",
"Date",
"value",
")",
"{",
"setDateHeader",
"(",
"message",
",",
"(",
"CharSequence",
")",
"name",
",",
"value",
")",
";",
"}"
] | @deprecated Use {@link #set(CharSequence, Object)} instead.
@see #setDateHeader(HttpMessage, CharSequence, Date) | [
"@deprecated",
"Use",
"{",
"@link",
"#set",
"(",
"CharSequence",
"Object",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L887-L890 | train | Sets the value of the specified header. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
11675,
2275,
13701,
4974,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
5164,
2171,
1010,
3058,
3643,
1007,
1063,
2275,
13701,
4974,
2121,
1006,
4471,
1010,
1006,
25869,
3366,
4226,
5897,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/codec/Morse.java | Morse.registerMorse | private static void registerMorse(Character abc, String dict) {
alphabets.put(Integer.valueOf(abc), dict);
dictionaries.put(dict, Integer.valueOf(abc));
} | java | private static void registerMorse(Character abc, String dict) {
alphabets.put(Integer.valueOf(abc), dict);
dictionaries.put(dict, Integer.valueOf(abc));
} | [
"private",
"static",
"void",
"registerMorse",
"(",
"Character",
"abc",
",",
"String",
"dict",
")",
"{",
"alphabets",
".",
"put",
"(",
"Integer",
".",
"valueOf",
"(",
"abc",
")",
",",
"dict",
")",
";",
"dictionaries",
".",
"put",
"(",
"dict",
",",
"Inte... | 注册莫尔斯电码表
@param abc 字母和字符
@param dict 二进制 | [
"注册莫尔斯电码表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/Morse.java#L29-L32 | train | Register a Morse character with the Morse Service. | [
30522,
2797,
10763,
11675,
4236,
5302,
22573,
1006,
2839,
5925,
1010,
5164,
4487,
6593,
1007,
1063,
12440,
2015,
1012,
2404,
1006,
16109,
1012,
3643,
11253,
1006,
5925,
1007,
1010,
4487,
6593,
1007,
1025,
4487,
7542,
12086,
1012,
2404,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-aop/src/main/java/cn/hutool/aop/proxy/ProxyFactory.java | ProxyFactory.createProxy | public static <T> T createProxy(T target, Class<? extends Aspect> aspectClass){
return createProxy(target, ReflectUtil.newInstance(aspectClass));
} | java | public static <T> T createProxy(T target, Class<? extends Aspect> aspectClass){
return createProxy(target, ReflectUtil.newInstance(aspectClass));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createProxy",
"(",
"T",
"target",
",",
"Class",
"<",
"?",
"extends",
"Aspect",
">",
"aspectClass",
")",
"{",
"return",
"createProxy",
"(",
"target",
",",
"ReflectUtil",
".",
"newInstance",
"(",
"aspectClass",
")",
... | 根据用户引入Cglib与否自动创建代理对象
@param <T> 切面对象类型
@param target 目标对象
@param aspectClass 切面对象类
@return 代理对象 | [
"根据用户引入Cglib与否自动创建代理对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-aop/src/main/java/cn/hutool/aop/proxy/ProxyFactory.java#L32-L34 | train | Creates a proxy object for the given target class and class. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
3443,
21572,
18037,
1006,
1056,
4539,
1010,
2465,
1026,
1029,
8908,
7814,
1028,
7814,
26266,
1007,
1063,
2709,
3443,
21572,
18037,
1006,
4539,
1010,
8339,
21823,
2140,
1012,
2047,
7076,
26897,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/UploadFile.java | UploadFile.processStream | protected boolean processStream(MultipartRequestInputStream input) throws IOException {
if (!isAllowedExtension()) {
// 非允许的扩展名
log.debug("Forbidden uploaded file [{}]", this.getFileName());
size = input.skipToBoundary();
return false;
}
size = 0;
// 处理内存文件
int memoryThreshold = setting.memoryThreshold;
if (memoryThreshold > 0) {
ByteArrayOutputStream baos = new ByteArrayOutputStream(memoryThreshold);
int written = input.copy(baos, memoryThreshold);
data = baos.toByteArray();
if (written <= memoryThreshold) {
// 文件存放于内存
size = data.length;
return true;
}
}
// 处理硬盘文件
tempFile = FileUtil.createTempFile(TMP_FILE_PREFIX, TMP_FILE_SUFFIX, FileUtil.touch(setting.tmpUploadPath), false);
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(tempFile));
if (data != null) {
size = data.length;
out.write(data);
data = null; // not needed anymore
}
int maxFileSize = setting.maxFileSize;
try {
if (maxFileSize == -1) {
size += input.copy(out);
return true;
}
size += input.copy(out, maxFileSize - size + 1); // one more byte to detect larger files
if (size > maxFileSize) {
// 超出上传大小限制
tempFile.delete();
tempFile = null;
log.debug("Upload file [{}] too big, file size > [{}]", this.getFileName(), maxFileSize);
input.skipToBoundary();
return false;
}
} finally {
IoUtil.close(out);
}
// if (getFileName().length() == 0 && size == 0) {
// size = -1;
// }
return true;
} | java | protected boolean processStream(MultipartRequestInputStream input) throws IOException {
if (!isAllowedExtension()) {
// 非允许的扩展名
log.debug("Forbidden uploaded file [{}]", this.getFileName());
size = input.skipToBoundary();
return false;
}
size = 0;
// 处理内存文件
int memoryThreshold = setting.memoryThreshold;
if (memoryThreshold > 0) {
ByteArrayOutputStream baos = new ByteArrayOutputStream(memoryThreshold);
int written = input.copy(baos, memoryThreshold);
data = baos.toByteArray();
if (written <= memoryThreshold) {
// 文件存放于内存
size = data.length;
return true;
}
}
// 处理硬盘文件
tempFile = FileUtil.createTempFile(TMP_FILE_PREFIX, TMP_FILE_SUFFIX, FileUtil.touch(setting.tmpUploadPath), false);
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(tempFile));
if (data != null) {
size = data.length;
out.write(data);
data = null; // not needed anymore
}
int maxFileSize = setting.maxFileSize;
try {
if (maxFileSize == -1) {
size += input.copy(out);
return true;
}
size += input.copy(out, maxFileSize - size + 1); // one more byte to detect larger files
if (size > maxFileSize) {
// 超出上传大小限制
tempFile.delete();
tempFile = null;
log.debug("Upload file [{}] too big, file size > [{}]", this.getFileName(), maxFileSize);
input.skipToBoundary();
return false;
}
} finally {
IoUtil.close(out);
}
// if (getFileName().length() == 0 && size == 0) {
// size = -1;
// }
return true;
} | [
"protected",
"boolean",
"processStream",
"(",
"MultipartRequestInputStream",
"input",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"isAllowedExtension",
"(",
")",
")",
"{",
"// 非允许的扩展名\r",
"log",
".",
"debug",
"(",
"\"Forbidden uploaded file [{}]\"",
",",
"thi... | 处理上传表单流,提取出文件
@param input 上传表单的流
@throws IOException | [
"处理上传表单流,提取出文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/UploadFile.java#L184-L236 | train | Process the multipart input stream. | [
30522,
5123,
22017,
20898,
2832,
21422,
1006,
4800,
19362,
7913,
15500,
2378,
18780,
21422,
7953,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
999,
18061,
7174,
15557,
10288,
29048,
1006,
1007,
1007,
1063,
1013,
1013,
100,
100,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.