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/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromElementsFunction.java | FromElementsFunction.checkCollection | public static <OUT> void checkCollection(Collection<OUT> elements, Class<OUT> viewedAs) {
for (OUT elem : elements) {
if (elem == null) {
throw new IllegalArgumentException("The collection contains a null element");
}
if (!viewedAs.isAssignableFrom(elem.getClass())) {
throw new IllegalArgumentException("The elements in the collection are not all subclasses of " +
viewedAs.getCanonicalName());
}
}
} | java | public static <OUT> void checkCollection(Collection<OUT> elements, Class<OUT> viewedAs) {
for (OUT elem : elements) {
if (elem == null) {
throw new IllegalArgumentException("The collection contains a null element");
}
if (!viewedAs.isAssignableFrom(elem.getClass())) {
throw new IllegalArgumentException("The elements in the collection are not all subclasses of " +
viewedAs.getCanonicalName());
}
}
} | [
"public",
"static",
"<",
"OUT",
">",
"void",
"checkCollection",
"(",
"Collection",
"<",
"OUT",
">",
"elements",
",",
"Class",
"<",
"OUT",
">",
"viewedAs",
")",
"{",
"for",
"(",
"OUT",
"elem",
":",
"elements",
")",
"{",
"if",
"(",
"elem",
"==",
"null"... | Verifies that all elements in the collection are non-null, and are of the given class, or
a subclass thereof.
@param elements The collection to check.
@param viewedAs The class to which the elements must be assignable to.
@param <OUT> The generic type of the collection to be checked. | [
"Verifies",
"that",
"all",
"elements",
"in",
"the",
"collection",
"are",
"non",
"-",
"null",
"and",
"are",
"of",
"the",
"given",
"class",
"or",
"a",
"subclass",
"thereof",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/FromElementsFunction.java#L220-L231 | train | Checks that the elements in the collection are all subclasses of the given class. | [
30522,
2270,
10763,
1026,
2041,
1028,
11675,
4638,
26895,
18491,
1006,
3074,
1026,
2041,
1028,
3787,
1010,
2465,
1026,
2041,
1028,
7021,
3022,
1007,
1063,
2005,
1006,
2041,
3449,
6633,
1024,
3787,
1007,
1063,
2065,
1006,
3449,
6633,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getFinalParameters | public Set<String> getFinalParameters() {
Set<String> setFinalParams = Collections.newSetFromMap(
new ConcurrentHashMap<String, Boolean>());
setFinalParams.addAll(finalParameters);
return setFinalParams;
} | java | public Set<String> getFinalParameters() {
Set<String> setFinalParams = Collections.newSetFromMap(
new ConcurrentHashMap<String, Boolean>());
setFinalParams.addAll(finalParameters);
return setFinalParams;
} | [
"public",
"Set",
"<",
"String",
">",
"getFinalParameters",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"setFinalParams",
"=",
"Collections",
".",
"newSetFromMap",
"(",
"new",
"ConcurrentHashMap",
"<",
"String",
",",
"Boolean",
">",
"(",
")",
")",
";",
"setFi... | Get the set of parameters marked final.
@return final parameter set. | [
"Get",
"the",
"set",
"of",
"parameters",
"marked",
"final",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2669-L2674 | train | Returns the final parameters. | [
30522,
2270,
2275,
1026,
5164,
1028,
2131,
16294,
2389,
28689,
22828,
2015,
1006,
1007,
1063,
2275,
1026,
5164,
1028,
2275,
16294,
2389,
28689,
5244,
1027,
6407,
1012,
2739,
3388,
19699,
5358,
2863,
2361,
1006,
2047,
16483,
14949,
22444,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/file/Tailer.java | Tailer.start | public void start(boolean async) {
// 初始读取
try {
this.readTail();
} catch (IOException e) {
throw new IORuntimeException(e);
}
final LineReadWatcher lineReadWatcher = new LineReadWatcher(this.randomAccessFile, this.charset, this.lineHandler);
final ScheduledFuture<?> scheduledFuture = this.executorService.scheduleAtFixedRate(//
lineReadWatcher, //
0, //
this.period, TimeUnit.MILLISECONDS//
);
if (false == async) {
try {
scheduledFuture.get();
} catch (ExecutionException e) {
throw new UtilException(e);
} catch (InterruptedException e) {
// ignore and exist
}
}
} | java | public void start(boolean async) {
// 初始读取
try {
this.readTail();
} catch (IOException e) {
throw new IORuntimeException(e);
}
final LineReadWatcher lineReadWatcher = new LineReadWatcher(this.randomAccessFile, this.charset, this.lineHandler);
final ScheduledFuture<?> scheduledFuture = this.executorService.scheduleAtFixedRate(//
lineReadWatcher, //
0, //
this.period, TimeUnit.MILLISECONDS//
);
if (false == async) {
try {
scheduledFuture.get();
} catch (ExecutionException e) {
throw new UtilException(e);
} catch (InterruptedException e) {
// ignore and exist
}
}
} | [
"public",
"void",
"start",
"(",
"boolean",
"async",
")",
"{",
"// 初始读取\r",
"try",
"{",
"this",
".",
"readTail",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IORuntimeException",
"(",
"e",
")",
";",
"}",
"final",
"L... | 开始监听
@param async 是否异步执行 | [
"开始监听"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/Tailer.java#L107-L131 | train | Start the read thread. | [
30522,
2270,
11675,
2707,
1006,
22017,
20898,
2004,
6038,
2278,
1007,
1063,
1013,
1013,
100,
100,
100,
100,
3046,
1063,
2023,
1012,
3191,
14162,
1006,
1007,
1025,
1065,
4608,
1006,
22834,
10288,
24422,
1041,
1007,
1063,
5466,
2047,
22834,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/ExecutorUtils.java | ExecutorUtils.gracefulShutdown | public static void gracefulShutdown(long timeout, TimeUnit unit, ExecutorService... executorServices) {
for (ExecutorService executorService: executorServices) {
executorService.shutdown();
}
boolean wasInterrupted = false;
final long endTime = unit.toMillis(timeout) + System.currentTimeMillis();
long timeLeft = unit.toMillis(timeout);
boolean hasTimeLeft = timeLeft > 0L;
for (ExecutorService executorService: executorServices) {
if (wasInterrupted || !hasTimeLeft) {
executorService.shutdownNow();
} else {
try {
if (!executorService.awaitTermination(timeLeft, TimeUnit.MILLISECONDS)) {
LOG.warn("ExecutorService did not terminate in time. Shutting it down now.");
executorService.shutdownNow();
}
} catch (InterruptedException e) {
LOG.warn("Interrupted while shutting down executor services. Shutting all " +
"remaining ExecutorServices down now.", e);
executorService.shutdownNow();
wasInterrupted = true;
Thread.currentThread().interrupt();
}
timeLeft = endTime - System.currentTimeMillis();
hasTimeLeft = timeLeft > 0L;
}
}
} | java | public static void gracefulShutdown(long timeout, TimeUnit unit, ExecutorService... executorServices) {
for (ExecutorService executorService: executorServices) {
executorService.shutdown();
}
boolean wasInterrupted = false;
final long endTime = unit.toMillis(timeout) + System.currentTimeMillis();
long timeLeft = unit.toMillis(timeout);
boolean hasTimeLeft = timeLeft > 0L;
for (ExecutorService executorService: executorServices) {
if (wasInterrupted || !hasTimeLeft) {
executorService.shutdownNow();
} else {
try {
if (!executorService.awaitTermination(timeLeft, TimeUnit.MILLISECONDS)) {
LOG.warn("ExecutorService did not terminate in time. Shutting it down now.");
executorService.shutdownNow();
}
} catch (InterruptedException e) {
LOG.warn("Interrupted while shutting down executor services. Shutting all " +
"remaining ExecutorServices down now.", e);
executorService.shutdownNow();
wasInterrupted = true;
Thread.currentThread().interrupt();
}
timeLeft = endTime - System.currentTimeMillis();
hasTimeLeft = timeLeft > 0L;
}
}
} | [
"public",
"static",
"void",
"gracefulShutdown",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
",",
"ExecutorService",
"...",
"executorServices",
")",
"{",
"for",
"(",
"ExecutorService",
"executorService",
":",
"executorServices",
")",
"{",
"executorService",
".",... | Gracefully shutdown the given {@link ExecutorService}. The call waits the given timeout that
all ExecutorServices terminate. If the ExecutorServices do not terminate in this time,
they will be shut down hard.
@param timeout to wait for the termination of all ExecutorServices
@param unit of the timeout
@param executorServices to shut down | [
"Gracefully",
"shutdown",
"the",
"given",
"{",
"@link",
"ExecutorService",
"}",
".",
"The",
"call",
"waits",
"the",
"given",
"timeout",
"that",
"all",
"ExecutorServices",
"terminate",
".",
"If",
"the",
"ExecutorServices",
"do",
"not",
"terminate",
"in",
"this",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExecutorUtils.java#L44-L77 | train | Gracefully shuts down all the ExecutorServices in the given timeout. | [
30522,
2270,
10763,
11675,
19415,
14235,
2102,
7698,
1006,
2146,
2051,
5833,
1010,
2051,
19496,
2102,
3131,
1010,
4654,
8586,
16161,
22573,
2099,
7903,
2063,
1012,
1012,
1012,
4654,
8586,
16161,
22573,
2099,
7903,
2229,
1007,
1063,
2005,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslHandler.java | SslHandler.setHandshakeFailure | private void setHandshakeFailure(ChannelHandlerContext ctx, Throwable cause, boolean closeInbound,
boolean notify, boolean alwaysFlushAndClose) {
try {
// Release all resources such as internal buffers that SSLEngine
// is managing.
outboundClosed = true;
engine.closeOutbound();
if (closeInbound) {
try {
engine.closeInbound();
} catch (SSLException e) {
if (logger.isDebugEnabled()) {
// only log in debug mode as it most likely harmless and latest chrome still trigger
// this all the time.
//
// See https://github.com/netty/netty/issues/1340
String msg = e.getMessage();
if (msg == null || !(msg.contains("possible truncation attack") ||
msg.contains("closing inbound before receiving peer's close_notify"))) {
logger.debug("{} SSLEngine.closeInbound() raised an exception.", ctx.channel(), e);
}
}
}
}
if (handshakePromise.tryFailure(cause) || alwaysFlushAndClose) {
SslUtils.handleHandshakeFailure(ctx, cause, notify);
}
} finally {
// Ensure we remove and fail all pending writes in all cases and so release memory quickly.
releaseAndFailAll(cause);
}
} | java | private void setHandshakeFailure(ChannelHandlerContext ctx, Throwable cause, boolean closeInbound,
boolean notify, boolean alwaysFlushAndClose) {
try {
// Release all resources such as internal buffers that SSLEngine
// is managing.
outboundClosed = true;
engine.closeOutbound();
if (closeInbound) {
try {
engine.closeInbound();
} catch (SSLException e) {
if (logger.isDebugEnabled()) {
// only log in debug mode as it most likely harmless and latest chrome still trigger
// this all the time.
//
// See https://github.com/netty/netty/issues/1340
String msg = e.getMessage();
if (msg == null || !(msg.contains("possible truncation attack") ||
msg.contains("closing inbound before receiving peer's close_notify"))) {
logger.debug("{} SSLEngine.closeInbound() raised an exception.", ctx.channel(), e);
}
}
}
}
if (handshakePromise.tryFailure(cause) || alwaysFlushAndClose) {
SslUtils.handleHandshakeFailure(ctx, cause, notify);
}
} finally {
// Ensure we remove and fail all pending writes in all cases and so release memory quickly.
releaseAndFailAll(cause);
}
} | [
"private",
"void",
"setHandshakeFailure",
"(",
"ChannelHandlerContext",
"ctx",
",",
"Throwable",
"cause",
",",
"boolean",
"closeInbound",
",",
"boolean",
"notify",
",",
"boolean",
"alwaysFlushAndClose",
")",
"{",
"try",
"{",
"// Release all resources such as internal buff... | Notify all the handshake futures about the failure during the handshake. | [
"Notify",
"all",
"the",
"handshake",
"futures",
"about",
"the",
"failure",
"during",
"the",
"handshake",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslHandler.java#L1766-L1798 | train | Set the handshake failure flag. | [
30522,
2797,
11675,
6662,
29560,
20459,
12879,
12502,
5397,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
5466,
3085,
3426,
1010,
22017,
20898,
2485,
2378,
15494,
1010,
22017,
20898,
2025,
8757,
1010,
22017,
20898,
2467,
10258,
206... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashPartition.java | BinaryHashPartition.insertIntoBuildBuffer | final int insertIntoBuildBuffer(BinaryRow record) throws IOException {
this.buildSideRecordCounter++;
if (isInMemory()) {
final long pointer = this.buildSideWriteBuffer.getCurrentPointer();
int skip = this.buildSideSerializer.serializeToPages(record, this.buildSideWriteBuffer);
if (isInMemory()) {
long ret = pointer + skip;
if (ret > Integer.MAX_VALUE) {
throw new RuntimeException("Too more data in this partition: " + ret);
}
return (int) ret;
} else {
return -1;
}
} else {
this.buildSideSerializer.serializeToPages(record, this.buildSideWriteBuffer);
return -1;
}
} | java | final int insertIntoBuildBuffer(BinaryRow record) throws IOException {
this.buildSideRecordCounter++;
if (isInMemory()) {
final long pointer = this.buildSideWriteBuffer.getCurrentPointer();
int skip = this.buildSideSerializer.serializeToPages(record, this.buildSideWriteBuffer);
if (isInMemory()) {
long ret = pointer + skip;
if (ret > Integer.MAX_VALUE) {
throw new RuntimeException("Too more data in this partition: " + ret);
}
return (int) ret;
} else {
return -1;
}
} else {
this.buildSideSerializer.serializeToPages(record, this.buildSideWriteBuffer);
return -1;
}
} | [
"final",
"int",
"insertIntoBuildBuffer",
"(",
"BinaryRow",
"record",
")",
"throws",
"IOException",
"{",
"this",
".",
"buildSideRecordCounter",
"++",
";",
"if",
"(",
"isInMemory",
"(",
")",
")",
"{",
"final",
"long",
"pointer",
"=",
"this",
".",
"buildSideWrite... | 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-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashPartition.java#L243-L262 | train | Insert a binary row into the build buffer. | [
30522,
2345,
20014,
19274,
18447,
16429,
19231,
18939,
16093,
7512,
1006,
12441,
10524,
2501,
1007,
11618,
22834,
10288,
24422,
1063,
2023,
1012,
16473,
18688,
8586,
8551,
3597,
16671,
2121,
1009,
1009,
1025,
2065,
1006,
2003,
2378,
4168,
530... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/context/WebServerPortFileWriter.java | WebServerPortFileWriter.getPortFile | protected File getPortFile(ApplicationContext applicationContext) {
String namespace = getServerNamespace(applicationContext);
if (StringUtils.isEmpty(namespace)) {
return this.file;
}
String name = this.file.getName();
String extension = StringUtils.getFilenameExtension(this.file.getName());
name = name.substring(0, name.length() - extension.length() - 1);
if (isUpperCase(name)) {
name = name + "-" + namespace.toUpperCase(Locale.ENGLISH);
}
else {
name = name + "-" + namespace.toLowerCase(Locale.ENGLISH);
}
if (StringUtils.hasLength(extension)) {
name = name + "." + extension;
}
return new File(this.file.getParentFile(), name);
} | java | protected File getPortFile(ApplicationContext applicationContext) {
String namespace = getServerNamespace(applicationContext);
if (StringUtils.isEmpty(namespace)) {
return this.file;
}
String name = this.file.getName();
String extension = StringUtils.getFilenameExtension(this.file.getName());
name = name.substring(0, name.length() - extension.length() - 1);
if (isUpperCase(name)) {
name = name + "-" + namespace.toUpperCase(Locale.ENGLISH);
}
else {
name = name + "-" + namespace.toLowerCase(Locale.ENGLISH);
}
if (StringUtils.hasLength(extension)) {
name = name + "." + extension;
}
return new File(this.file.getParentFile(), name);
} | [
"protected",
"File",
"getPortFile",
"(",
"ApplicationContext",
"applicationContext",
")",
"{",
"String",
"namespace",
"=",
"getServerNamespace",
"(",
"applicationContext",
")",
";",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"namespace",
")",
")",
"{",
"return... | Return the actual port file that should be written for the given application
context. The default implementation builds a file from the source file and the
application context namespace if available.
@param applicationContext the source application context
@return the file that should be written | [
"Return",
"the",
"actual",
"port",
"file",
"that",
"should",
"be",
"written",
"for",
"the",
"given",
"application",
"context",
".",
"The",
"default",
"implementation",
"builds",
"a",
"file",
"from",
"the",
"source",
"file",
"and",
"the",
"application",
"contex... | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/context/WebServerPortFileWriter.java#L106-L124 | train | Get the port file. | [
30522,
5123,
5371,
2131,
6442,
8873,
2571,
1006,
4646,
8663,
18209,
4646,
8663,
18209,
1007,
1063,
5164,
3415,
15327,
1027,
4152,
2121,
23062,
14074,
23058,
1006,
4646,
8663,
18209,
1007,
1025,
2065,
1006,
5164,
21823,
4877,
1012,
2003,
663... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-cache/src/main/java/cn/hutool/cache/impl/FIFOCache.java | FIFOCache.pruneCache | @Override
protected int pruneCache() {
int count = 0;
CacheObj<K, V> first = null;
// 清理过期对象并找出链表头部元素(先入元素)
Iterator<CacheObj<K, V>> values = cacheMap.values().iterator();
while (values.hasNext()) {
CacheObj<K, V> co = values.next();
if (co.isExpired()) {
values.remove();
count++;
}
if (first == null) {
first = co;
}
}
// 清理结束后依旧是满的,则删除第一个被缓存的对象
if (isFull() && null != first) {
cacheMap.remove(first.key);
onRemove(first.key, first.obj);
count++;
}
return count;
} | java | @Override
protected int pruneCache() {
int count = 0;
CacheObj<K, V> first = null;
// 清理过期对象并找出链表头部元素(先入元素)
Iterator<CacheObj<K, V>> values = cacheMap.values().iterator();
while (values.hasNext()) {
CacheObj<K, V> co = values.next();
if (co.isExpired()) {
values.remove();
count++;
}
if (first == null) {
first = co;
}
}
// 清理结束后依旧是满的,则删除第一个被缓存的对象
if (isFull() && null != first) {
cacheMap.remove(first.key);
onRemove(first.key, first.obj);
count++;
}
return count;
} | [
"@",
"Override",
"protected",
"int",
"pruneCache",
"(",
")",
"{",
"int",
"count",
"=",
"0",
";",
"CacheObj",
"<",
"K",
",",
"V",
">",
"first",
"=",
"null",
";",
"// 清理过期对象并找出链表头部元素(先入元素)\r",
"Iterator",
"<",
"CacheObj",
"<",
"K",
",",
"V",
">",
">",
... | 先进先出的清理策略<br>
先遍历缓存清理过期的缓存对象,如果清理后还是满的,则删除第一个缓存对象 | [
"先进先出的清理策略<br",
">",
"先遍历缓存清理过期的缓存对象,如果清理后还是满的,则删除第一个缓存对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cache/src/main/java/cn/hutool/cache/impl/FIFOCache.java#L51-L76 | train | Override the pruneCache method to remove expired cache objects. | [
30522,
1030,
2058,
15637,
5123,
20014,
10975,
9816,
3540,
5403,
1006,
1007,
1063,
20014,
4175,
1027,
1014,
1025,
17053,
16429,
3501,
1026,
1047,
1010,
1058,
1028,
2034,
1027,
19701,
1025,
1013,
1013,
1903,
100,
100,
100,
100,
100,
100,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/InternalJSONUtil.java | InternalJSONUtil.propertyPut | protected static JSONObject propertyPut(JSONObject jsonObject, Object key, Object value) {
String keyStr = Convert.toStr(key);
String[] path = StrUtil.split(keyStr, StrUtil.DOT);
int last = path.length - 1;
JSONObject target = jsonObject;
for (int i = 0; i < last; i += 1) {
String segment = path[i];
JSONObject nextTarget = target.getJSONObject(segment);
if (nextTarget == null) {
nextTarget = new JSONObject();
target.put(segment, nextTarget);
}
target = nextTarget;
}
target.put(path[last], value);
return jsonObject;
} | java | protected static JSONObject propertyPut(JSONObject jsonObject, Object key, Object value) {
String keyStr = Convert.toStr(key);
String[] path = StrUtil.split(keyStr, StrUtil.DOT);
int last = path.length - 1;
JSONObject target = jsonObject;
for (int i = 0; i < last; i += 1) {
String segment = path[i];
JSONObject nextTarget = target.getJSONObject(segment);
if (nextTarget == null) {
nextTarget = new JSONObject();
target.put(segment, nextTarget);
}
target = nextTarget;
}
target.put(path[last], value);
return jsonObject;
} | [
"protected",
"static",
"JSONObject",
"propertyPut",
"(",
"JSONObject",
"jsonObject",
",",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"String",
"keyStr",
"=",
"Convert",
".",
"toStr",
"(",
"key",
")",
";",
"String",
"[",
"]",
"path",
"=",
"StrUtil",... | 将Property的键转化为JSON形式<br>
用于识别类似于:com.luxiaolei.package.hutool这类用点隔开的键
@param jsonObject JSONObject
@param key 键
@param value 值
@return JSONObject | [
"将Property的键转化为JSON形式<br",
">",
"用于识别类似于:com",
".",
"luxiaolei",
".",
"package",
".",
"hutool这类用点隔开的键"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/InternalJSONUtil.java#L191-L207 | train | Convenience method for creating a new JSONObject with a single property. | [
30522,
5123,
10763,
1046,
3385,
16429,
20614,
3200,
18780,
1006,
1046,
3385,
16429,
20614,
1046,
3385,
16429,
20614,
1010,
4874,
3145,
1010,
4874,
3643,
1007,
1063,
5164,
6309,
16344,
1027,
10463,
1012,
2000,
3367,
2099,
1006,
3145,
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... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/RC4.java | RC4.encrypt | public byte[] encrypt(String message, Charset charset) throws CryptoException {
return crypt(StrUtil.bytes(message, charset));
} | java | public byte[] encrypt(String message, Charset charset) throws CryptoException {
return crypt(StrUtil.bytes(message, charset));
} | [
"public",
"byte",
"[",
"]",
"encrypt",
"(",
"String",
"message",
",",
"Charset",
"charset",
")",
"throws",
"CryptoException",
"{",
"return",
"crypt",
"(",
"StrUtil",
".",
"bytes",
"(",
"message",
",",
"charset",
")",
")",
";",
"}"
] | 加密
@param message 消息
@param charset 编码
@return 密文
@throws CryptoException key长度小于5或者大于255抛出此异常 | [
"加密"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/RC4.java#L49-L51 | train | Encrypts the given string using the given charset. | [
30522,
2270,
24880,
1031,
1033,
4372,
26775,
22571,
2102,
1006,
5164,
4471,
1010,
25869,
13462,
25869,
13462,
1007,
11618,
19888,
8913,
2595,
24422,
1063,
2709,
19888,
1006,
2358,
22134,
4014,
1012,
27507,
1006,
4471,
1010,
25869,
13462,
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/convert/ConverterRegistry.java | ConverterRegistry.getDefaultConverter | @SuppressWarnings("unchecked")
public <T> Converter<T> getDefaultConverter(Type type) {
return (null == defaultConverterMap) ? null : (Converter<T>) defaultConverterMap.get(type);
} | java | @SuppressWarnings("unchecked")
public <T> Converter<T> getDefaultConverter(Type type) {
return (null == defaultConverterMap) ? null : (Converter<T>) defaultConverterMap.get(type);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"Converter",
"<",
"T",
">",
"getDefaultConverter",
"(",
"Type",
"type",
")",
"{",
"return",
"(",
"null",
"==",
"defaultConverterMap",
")",
"?",
"null",
":",
"(",
"Converter",
"<",... | 获得默认转换器
@param <T> 转换的目标类型(转换器转换到的类型)
@param type 类型
@return 转换器 | [
"获得默认转换器"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/ConverterRegistry.java#L158-L161 | train | Returns the default converter for the given type. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
1026,
1056,
1028,
10463,
2121,
1026,
1056,
1028,
2131,
3207,
7011,
11314,
8663,
16874,
2121,
1006,
2828,
2828,
1007,
1063,
2709,
1006,
19701,
1027,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/crf/crfpp/Node.java | Node.calcExpectation | public void calcExpectation(double[] expected, double Z, int size)
{
double c = Math.exp(alpha + beta - cost - Z);
for (int i = 0; fVector.get(i) != -1; i++)
{
int idx = fVector.get(i) + y;
expected[idx] += c;
}
for (Path p : lpath)
{
p.calcExpectation(expected, Z, size);
}
} | java | public void calcExpectation(double[] expected, double Z, int size)
{
double c = Math.exp(alpha + beta - cost - Z);
for (int i = 0; fVector.get(i) != -1; i++)
{
int idx = fVector.get(i) + y;
expected[idx] += c;
}
for (Path p : lpath)
{
p.calcExpectation(expected, Z, size);
}
} | [
"public",
"void",
"calcExpectation",
"(",
"double",
"[",
"]",
"expected",
",",
"double",
"Z",
",",
"int",
"size",
")",
"{",
"double",
"c",
"=",
"Math",
".",
"exp",
"(",
"alpha",
"+",
"beta",
"-",
"cost",
"-",
"Z",
")",
";",
"for",
"(",
"int",
"i"... | 计算节点期望
@param expected 输出期望
@param Z 规范化因子
@param size 标签个数 | [
"计算节点期望"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/crf/crfpp/Node.java#L80-L92 | train | Calculate the expectation for this class. | [
30522,
2270,
11675,
10250,
3401,
2595,
5051,
25572,
3508,
1006,
3313,
1031,
1033,
3517,
1010,
3313,
1062,
1010,
20014,
2946,
1007,
1063,
3313,
1039,
1027,
8785,
1012,
4654,
2361,
1006,
6541,
1009,
8247,
1011,
3465,
1011,
1062,
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/collection/CollUtil.java | CollUtil.intersection | public static <T> Collection<T> intersection(Collection<T> coll1, Collection<T> coll2) {
final ArrayList<T> list = new ArrayList<>();
if (isNotEmpty(coll1) && isNotEmpty(coll2)) {
final Map<T, Integer> map1 = countMap(coll1);
final Map<T, Integer> map2 = countMap(coll2);
final Set<T> elts = newHashSet(coll2);
int m;
for (T t : elts) {
m = Math.min(Convert.toInt(map1.get(t), 0), Convert.toInt(map2.get(t), 0));
for (int i = 0; i < m; i++) {
list.add(t);
}
}
}
return list;
} | java | public static <T> Collection<T> intersection(Collection<T> coll1, Collection<T> coll2) {
final ArrayList<T> list = new ArrayList<>();
if (isNotEmpty(coll1) && isNotEmpty(coll2)) {
final Map<T, Integer> map1 = countMap(coll1);
final Map<T, Integer> map2 = countMap(coll2);
final Set<T> elts = newHashSet(coll2);
int m;
for (T t : elts) {
m = Math.min(Convert.toInt(map1.get(t), 0), Convert.toInt(map2.get(t), 0));
for (int i = 0; i < m; i++) {
list.add(t);
}
}
}
return list;
} | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"intersection",
"(",
"Collection",
"<",
"T",
">",
"coll1",
",",
"Collection",
"<",
"T",
">",
"coll2",
")",
"{",
"final",
"ArrayList",
"<",
"T",
">",
"list",
"=",
"new",
"ArrayList",
"<>"... | 两个集合的交集<br>
针对一个集合中存在多个相同元素的情况,计算两个集合中此元素的个数,保留最少的个数<br>
例如:集合1:[a, b, c, c, c],集合2:[a, b, c, c]<br>
结果:[a, b, c, c],此结果中只保留了两个c
@param <T> 集合元素类型
@param coll1 集合1
@param coll2 集合2
@return 交集的集合,返回 {@link ArrayList} | [
"两个集合的交集<br",
">",
"针对一个集合中存在多个相同元素的情况,计算两个集合中此元素的个数,保留最少的个数<br",
">",
"例如:集合1:",
"[",
"a",
"b",
"c",
"c",
"c",
"]",
",集合2:",
"[",
"a",
"b",
"c",
"c",
"]",
"<br",
">",
"结果:",
"[",
"a",
"b",
"c",
"c",
"]",
",此结果中只保留了两个c"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L128-L143 | train | Returns the intersection of the two collections. | [
30522,
2270,
10763,
1026,
1056,
1028,
3074,
1026,
1056,
1028,
6840,
1006,
3074,
1026,
1056,
1028,
8902,
2140,
2487,
1010,
3074,
1026,
1056,
1028,
8902,
2140,
2475,
1007,
1063,
2345,
9140,
9863,
1026,
1056,
1028,
2862,
1027,
2047,
9140,
98... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshot.java | PojoSerializerSnapshot.constructReconfiguredPojoSerializer | private static <T> PojoSerializer<T> constructReconfiguredPojoSerializer(
PojoSerializer<T> originalNewPojoSerializer,
IntermediateCompatibilityResult<T> fieldSerializerCompatibility,
LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> registeredSerializerSnapshots,
IntermediateCompatibilityResult<T> preExistingRegistrationsCompatibility,
LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> nonRegisteredSubclassSerializerSnapshots) {
@SuppressWarnings("unchecked")
final TypeSerializer<Object>[] reconfiguredFieldSerializers = constructReconfiguredFieldSerializers(fieldSerializerCompatibility);
Tuple2<LinkedHashMap<Class<?>, Integer>, TypeSerializer<Object>[]> reconfiguredSubclassRegistry = constructReconfiguredSubclassRegistry(
originalNewPojoSerializer.getBundledSubclassSerializerRegistry(),
registeredSerializerSnapshots,
preExistingRegistrationsCompatibility);
return new PojoSerializer<>(
originalNewPojoSerializer.getPojoClass(),
originalNewPojoSerializer.getFields(),
reconfiguredFieldSerializers,
reconfiguredSubclassRegistry.f0,
reconfiguredSubclassRegistry.f1,
restoreSerializers(nonRegisteredSubclassSerializerSnapshots.unwrapOptionals()),
originalNewPojoSerializer.getExecutionConfig());
} | java | private static <T> PojoSerializer<T> constructReconfiguredPojoSerializer(
PojoSerializer<T> originalNewPojoSerializer,
IntermediateCompatibilityResult<T> fieldSerializerCompatibility,
LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> registeredSerializerSnapshots,
IntermediateCompatibilityResult<T> preExistingRegistrationsCompatibility,
LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> nonRegisteredSubclassSerializerSnapshots) {
@SuppressWarnings("unchecked")
final TypeSerializer<Object>[] reconfiguredFieldSerializers = constructReconfiguredFieldSerializers(fieldSerializerCompatibility);
Tuple2<LinkedHashMap<Class<?>, Integer>, TypeSerializer<Object>[]> reconfiguredSubclassRegistry = constructReconfiguredSubclassRegistry(
originalNewPojoSerializer.getBundledSubclassSerializerRegistry(),
registeredSerializerSnapshots,
preExistingRegistrationsCompatibility);
return new PojoSerializer<>(
originalNewPojoSerializer.getPojoClass(),
originalNewPojoSerializer.getFields(),
reconfiguredFieldSerializers,
reconfiguredSubclassRegistry.f0,
reconfiguredSubclassRegistry.f1,
restoreSerializers(nonRegisteredSubclassSerializerSnapshots.unwrapOptionals()),
originalNewPojoSerializer.getExecutionConfig());
} | [
"private",
"static",
"<",
"T",
">",
"PojoSerializer",
"<",
"T",
">",
"constructReconfiguredPojoSerializer",
"(",
"PojoSerializer",
"<",
"T",
">",
"originalNewPojoSerializer",
",",
"IntermediateCompatibilityResult",
"<",
"T",
">",
"fieldSerializerCompatibility",
",",
"Li... | Creates a reconfigured version of the {@link PojoSerializer}.
@param originalNewPojoSerializer the original new {@link PojoSerializer} to create a reconfigured version of.
@param fieldSerializerCompatibility compatibility of preexisting fields' serializers.
@param registeredSerializerSnapshots snapshot of previous registered subclasses' serializers.
@param preExistingRegistrationsCompatibility compatibility of preexisting subclasses' serializers.
@param nonRegisteredSubclassSerializerSnapshots snapshot of previous non-registered subclasses' serializers.
@return a reconfigured version of the original new {@link PojoSerializer}. | [
"Creates",
"a",
"reconfigured",
"version",
"of",
"the",
"{",
"@link",
"PojoSerializer",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshot.java#L433-L456 | train | Construct a reconfigured pojo serializer. | [
30522,
2797,
10763,
1026,
1056,
1028,
13433,
19929,
11610,
28863,
1026,
1056,
1028,
9570,
2890,
8663,
8873,
27390,
2098,
6873,
19929,
11610,
28863,
1006,
13433,
19929,
11610,
28863,
1026,
1056,
1028,
2434,
2638,
2860,
6873,
19929,
11610,
2886... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java | TouchActions.longPress | public TouchActions longPress(WebElement onElement) {
if (touchScreen != null) {
action.addAction(new LongPressAction(touchScreen, (Locatable) onElement));
}
return this;
} | java | public TouchActions longPress(WebElement onElement) {
if (touchScreen != null) {
action.addAction(new LongPressAction(touchScreen, (Locatable) onElement));
}
return this;
} | [
"public",
"TouchActions",
"longPress",
"(",
"WebElement",
"onElement",
")",
"{",
"if",
"(",
"touchScreen",
"!=",
"null",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"LongPressAction",
"(",
"touchScreen",
",",
"(",
"Locatable",
")",
"onElement",
")",
")... | Allows the execution of long press gestures.
@param onElement The {@link WebElement} to long press
@return self | [
"Allows",
"the",
"execution",
"of",
"long",
"press",
"gestures",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java#L143-L148 | train | Long press the touch screen. | [
30522,
2270,
3543,
18908,
8496,
2146,
20110,
1006,
4773,
12260,
3672,
2028,
16930,
4765,
1007,
1063,
2065,
1006,
3543,
18182,
999,
1027,
19701,
1007,
1063,
2895,
1012,
5587,
18908,
3258,
1006,
2047,
2146,
20110,
18908,
3258,
1006,
3543,
181... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcUtils.java | RpcUtils.terminateRpcServices | public static void terminateRpcServices(
Time timeout,
RpcService... rpcServices) throws InterruptedException, ExecutionException, TimeoutException {
final Collection<CompletableFuture<?>> terminationFutures = new ArrayList<>(rpcServices.length);
for (RpcService service : rpcServices) {
if (service != null) {
terminationFutures.add(service.stopService());
}
}
FutureUtils.waitForAll(terminationFutures).get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);
} | java | public static void terminateRpcServices(
Time timeout,
RpcService... rpcServices) throws InterruptedException, ExecutionException, TimeoutException {
final Collection<CompletableFuture<?>> terminationFutures = new ArrayList<>(rpcServices.length);
for (RpcService service : rpcServices) {
if (service != null) {
terminationFutures.add(service.stopService());
}
}
FutureUtils.waitForAll(terminationFutures).get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);
} | [
"public",
"static",
"void",
"terminateRpcServices",
"(",
"Time",
"timeout",
",",
"RpcService",
"...",
"rpcServices",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
",",
"TimeoutException",
"{",
"final",
"Collection",
"<",
"CompletableFuture",
"<",
"... | Shuts the given rpc services down and waits for their termination.
@param rpcServices to shut down
@param timeout for this operation
@throws InterruptedException if the operation has been interrupted
@throws ExecutionException if a problem occurred
@throws TimeoutException if a timeout occurred | [
"Shuts",
"the",
"given",
"rpc",
"services",
"down",
"and",
"waits",
"for",
"their",
"termination",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcUtils.java#L102-L114 | train | Terminate all the rpc services. | [
30522,
2270,
10763,
11675,
20320,
14536,
6169,
2121,
7903,
2229,
1006,
2051,
2051,
5833,
1010,
1054,
15042,
8043,
7903,
2063,
1012,
1012,
1012,
1054,
15042,
8043,
7903,
2229,
1007,
11618,
7153,
10288,
24422,
1010,
7781,
10288,
24422,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.copy | public static long copy(Reader reader, Writer writer, int bufferSize, StreamProgress streamProgress) throws IORuntimeException {
char[] buffer = new char[bufferSize];
long size = 0;
int readSize;
if (null != streamProgress) {
streamProgress.start();
}
try {
while ((readSize = reader.read(buffer, 0, bufferSize)) != EOF) {
writer.write(buffer, 0, readSize);
size += readSize;
writer.flush();
if (null != streamProgress) {
streamProgress.progress(size);
}
}
} catch (Exception e) {
throw new IORuntimeException(e);
}
if (null != streamProgress) {
streamProgress.finish();
}
return size;
} | java | public static long copy(Reader reader, Writer writer, int bufferSize, StreamProgress streamProgress) throws IORuntimeException {
char[] buffer = new char[bufferSize];
long size = 0;
int readSize;
if (null != streamProgress) {
streamProgress.start();
}
try {
while ((readSize = reader.read(buffer, 0, bufferSize)) != EOF) {
writer.write(buffer, 0, readSize);
size += readSize;
writer.flush();
if (null != streamProgress) {
streamProgress.progress(size);
}
}
} catch (Exception e) {
throw new IORuntimeException(e);
}
if (null != streamProgress) {
streamProgress.finish();
}
return size;
} | [
"public",
"static",
"long",
"copy",
"(",
"Reader",
"reader",
",",
"Writer",
"writer",
",",
"int",
"bufferSize",
",",
"StreamProgress",
"streamProgress",
")",
"throws",
"IORuntimeException",
"{",
"char",
"[",
"]",
"buffer",
"=",
"new",
"char",
"[",
"bufferSize"... | 将Reader中的内容复制到Writer中
@param reader Reader
@param writer Writer
@param bufferSize 缓存大小
@param streamProgress 进度处理器
@return 传输的byte数
@throws IORuntimeException IO异常 | [
"将Reader中的内容复制到Writer中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L100-L123 | train | Copies the contents of the specified reader to the specified writer. | [
30522,
2270,
10763,
2146,
6100,
1006,
8068,
8068,
1010,
3213,
3213,
1010,
20014,
17698,
5332,
4371,
1010,
5460,
21572,
17603,
4757,
5460,
21572,
17603,
4757,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
25869,
1031,
1033,
17698,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.contains | @PublicEvolving
public boolean contains(ConfigOption<?> configOption) {
synchronized (this.confData){
// first try the current key
if (this.confData.containsKey(configOption.key())) {
return true;
}
else if (configOption.hasFallbackKeys()) {
// try the fallback keys
for (FallbackKey fallbackKey : configOption.fallbackKeys()) {
if (this.confData.containsKey(fallbackKey.getKey())) {
loggingFallback(fallbackKey, configOption);
return true;
}
}
}
return false;
}
} | java | @PublicEvolving
public boolean contains(ConfigOption<?> configOption) {
synchronized (this.confData){
// first try the current key
if (this.confData.containsKey(configOption.key())) {
return true;
}
else if (configOption.hasFallbackKeys()) {
// try the fallback keys
for (FallbackKey fallbackKey : configOption.fallbackKeys()) {
if (this.confData.containsKey(fallbackKey.getKey())) {
loggingFallback(fallbackKey, configOption);
return true;
}
}
}
return false;
}
} | [
"@",
"PublicEvolving",
"public",
"boolean",
"contains",
"(",
"ConfigOption",
"<",
"?",
">",
"configOption",
")",
"{",
"synchronized",
"(",
"this",
".",
"confData",
")",
"{",
"// first try the current key",
"if",
"(",
"this",
".",
"confData",
".",
"containsKey",
... | Checks whether there is an entry for the given config option.
@param configOption The configuration option
@return <tt>true</tt> if a valid (current or deprecated) key of the config option is stored,
<tt>false</tt> otherwise | [
"Checks",
"whether",
"there",
"is",
"an",
"entry",
"for",
"the",
"given",
"config",
"option",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L727-L746 | train | Checks if the configuration options contain the given key. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
22017,
20898,
3397,
1006,
9530,
8873,
3995,
16790,
1026,
1029,
1028,
9530,
8873,
3995,
16790,
1007,
1063,
25549,
1006,
2023,
1012,
9530,
2546,
2850,
2696,
1007,
1063,
1013,
1013,
2034,
3046,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/digest/DigestUtil.java | DigestUtil.sha256 | public static byte[] sha256(String data, String charset) {
return new Digester(DigestAlgorithm.SHA256).digest(data, charset);
} | java | public static byte[] sha256(String data, String charset) {
return new Digester(DigestAlgorithm.SHA256).digest(data, charset);
} | [
"public",
"static",
"byte",
"[",
"]",
"sha256",
"(",
"String",
"data",
",",
"String",
"charset",
")",
"{",
"return",
"new",
"Digester",
"(",
"DigestAlgorithm",
".",
"SHA256",
")",
".",
"digest",
"(",
"data",
",",
"charset",
")",
";",
"}"
] | 计算SHA-256摘要值
@param data 被摘要数据
@param charset 编码
@return SHA-256摘要
@since 3.0.8 | [
"计算SHA",
"-",
"256摘要值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/digest/DigestUtil.java#L255-L257 | train | Returns the SHA256 digest of the given data. | [
30522,
2270,
10763,
24880,
1031,
1033,
21146,
17788,
2575,
1006,
5164,
2951,
1010,
5164,
25869,
13462,
1007,
1063,
2709,
2047,
17886,
2121,
1006,
17886,
2389,
20255,
8939,
2213,
1012,
21146,
17788,
2575,
1007,
1012,
17886,
1006,
2951,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/UserFacingListState.java | UserFacingListState.get | @Override
public Iterable<T> get() throws Exception {
Iterable<T> original = originalState.get();
return original != null ? original : emptyState;
} | java | @Override
public Iterable<T> get() throws Exception {
Iterable<T> original = originalState.get();
return original != null ? original : emptyState;
} | [
"@",
"Override",
"public",
"Iterable",
"<",
"T",
">",
"get",
"(",
")",
"throws",
"Exception",
"{",
"Iterable",
"<",
"T",
">",
"original",
"=",
"originalState",
".",
"get",
"(",
")",
";",
"return",
"original",
"!=",
"null",
"?",
"original",
":",
"emptyS... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/UserFacingListState.java#L43-L47 | train | Returns the original state. | [
30522,
1030,
2058,
15637,
2270,
2009,
6906,
3468,
1026,
1056,
1028,
2131,
1006,
1007,
11618,
6453,
1063,
2009,
6906,
3468,
1026,
1056,
1028,
2434,
1027,
23728,
12259,
1012,
2131,
1006,
1007,
1025,
2709,
2434,
999,
1027,
19701,
1029,
2434,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java | DateTimeUtils.subtractMonths | public static int subtractMonths(int date0, int date1) {
if (date0 < date1) {
return -subtractMonths(date1, date0);
}
// Start with an estimate.
// Since no month has more than 31 days, the estimate is <= the true value.
int m = (date0 - date1) / 31;
for (;;) {
int date2 = addMonths(date1, m);
if (date2 >= date0) {
return m;
}
int date3 = addMonths(date1, m + 1);
if (date3 > date0) {
return m;
}
++m;
}
} | java | public static int subtractMonths(int date0, int date1) {
if (date0 < date1) {
return -subtractMonths(date1, date0);
}
// Start with an estimate.
// Since no month has more than 31 days, the estimate is <= the true value.
int m = (date0 - date1) / 31;
for (;;) {
int date2 = addMonths(date1, m);
if (date2 >= date0) {
return m;
}
int date3 = addMonths(date1, m + 1);
if (date3 > date0) {
return m;
}
++m;
}
} | [
"public",
"static",
"int",
"subtractMonths",
"(",
"int",
"date0",
",",
"int",
"date1",
")",
"{",
"if",
"(",
"date0",
"<",
"date1",
")",
"{",
"return",
"-",
"subtractMonths",
"(",
"date1",
",",
"date0",
")",
";",
"}",
"// Start with an estimate.",
"// Since... | Finds the number of months between two dates, each represented as the
number of days since the epoch. | [
"Finds",
"the",
"number",
"of",
"months",
"between",
"two",
"dates",
"each",
"represented",
"as",
"the",
"number",
"of",
"days",
"since",
"the",
"epoch",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java#L1107-L1125 | train | Subtracts the months from the given date. | [
30522,
2270,
10763,
20014,
4942,
6494,
6593,
9629,
7898,
1006,
20014,
3058,
2692,
1010,
20014,
3058,
2487,
1007,
1063,
2065,
1006,
3058,
2692,
1026,
3058,
2487,
1007,
1063,
2709,
1011,
4942,
6494,
6593,
9629,
7898,
1006,
3058,
2487,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.indexOf | public static int indexOf(ByteBuf needle, ByteBuf haystack) {
// TODO: maybe use Boyer Moore for efficiency.
int attempts = haystack.readableBytes() - needle.readableBytes() + 1;
for (int i = 0; i < attempts; i++) {
if (equals(needle, needle.readerIndex(),
haystack, haystack.readerIndex() + i,
needle.readableBytes())) {
return haystack.readerIndex() + i;
}
}
return -1;
} | java | public static int indexOf(ByteBuf needle, ByteBuf haystack) {
// TODO: maybe use Boyer Moore for efficiency.
int attempts = haystack.readableBytes() - needle.readableBytes() + 1;
for (int i = 0; i < attempts; i++) {
if (equals(needle, needle.readerIndex(),
haystack, haystack.readerIndex() + i,
needle.readableBytes())) {
return haystack.readerIndex() + i;
}
}
return -1;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"ByteBuf",
"needle",
",",
"ByteBuf",
"haystack",
")",
"{",
"// TODO: maybe use Boyer Moore for efficiency.",
"int",
"attempts",
"=",
"haystack",
".",
"readableBytes",
"(",
")",
"-",
"needle",
".",
"readableBytes",
"(",
")... | Returns the reader index of needle in haystack, or -1 if needle is not in haystack. | [
"Returns",
"the",
"reader",
"index",
"of",
"needle",
"in",
"haystack",
"or",
"-",
"1",
"if",
"needle",
"is",
"not",
"in",
"haystack",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L210-L221 | train | Gets the index of needle in haystack. | [
30522,
2270,
10763,
20014,
5950,
11253,
1006,
24880,
8569,
2546,
12201,
1010,
24880,
8569,
2546,
29051,
2696,
3600,
1007,
1063,
1013,
1013,
28681,
2080,
1024,
2672,
2224,
23456,
5405,
2005,
8122,
1012,
20014,
4740,
1027,
29051,
2696,
3600,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AbstractFilterRegistrationBean.java | AbstractFilterRegistrationBean.setDispatcherTypes | public void setDispatcherTypes(DispatcherType first, DispatcherType... rest) {
this.dispatcherTypes = EnumSet.of(first, rest);
} | java | public void setDispatcherTypes(DispatcherType first, DispatcherType... rest) {
this.dispatcherTypes = EnumSet.of(first, rest);
} | [
"public",
"void",
"setDispatcherTypes",
"(",
"DispatcherType",
"first",
",",
"DispatcherType",
"...",
"rest",
")",
"{",
"this",
".",
"dispatcherTypes",
"=",
"EnumSet",
".",
"of",
"(",
"first",
",",
"rest",
")",
";",
"}"
] | Convenience method to {@link #setDispatcherTypes(EnumSet) set dispatcher types}
using the specified elements.
@param first the first dispatcher type
@param rest additional dispatcher types | [
"Convenience",
"method",
"to",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBean.java#L172-L174 | train | Sets the dispatcher types. | [
30522,
2270,
11675,
2275,
10521,
4502,
10649,
15010,
10374,
1006,
18365,
15010,
5051,
2034,
1010,
18365,
15010,
5051,
1012,
1012,
1012,
2717,
1007,
1063,
2023,
1012,
18365,
15010,
10374,
1027,
4372,
18163,
3388,
1012,
1997,
1006,
2034,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/tokenizer/lexical/AbstractLexicalAnalyzer.java | AbstractLexicalAnalyzer.combineWords | private static void combineWords(String[] wordNet, int start, int end, CoreDictionary.Attribute[] attributeArray, CoreDictionary.Attribute value)
{
if (start + 1 != end) // 小优化,如果只有一个词,那就不需要合并,直接应用新属性
{
StringBuilder sbTerm = new StringBuilder();
for (int j = start; j < end; ++j)
{
if (wordNet[j] == null) continue;
sbTerm.append(wordNet[j]);
wordNet[j] = null;
}
wordNet[start] = sbTerm.toString();
}
attributeArray[start] = value;
} | java | private static void combineWords(String[] wordNet, int start, int end, CoreDictionary.Attribute[] attributeArray, CoreDictionary.Attribute value)
{
if (start + 1 != end) // 小优化,如果只有一个词,那就不需要合并,直接应用新属性
{
StringBuilder sbTerm = new StringBuilder();
for (int j = start; j < end; ++j)
{
if (wordNet[j] == null) continue;
sbTerm.append(wordNet[j]);
wordNet[j] = null;
}
wordNet[start] = sbTerm.toString();
}
attributeArray[start] = value;
} | [
"private",
"static",
"void",
"combineWords",
"(",
"String",
"[",
"]",
"wordNet",
",",
"int",
"start",
",",
"int",
"end",
",",
"CoreDictionary",
".",
"Attribute",
"[",
"]",
"attributeArray",
",",
"CoreDictionary",
".",
"Attribute",
"value",
")",
"{",
"if",
... | 将连续的词语合并为一个
@param wordNet 词图
@param start 起始下标(包含)
@param end 结束下标(不包含)
@param value 新的属性 | [
"将连续的词语合并为一个"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/tokenizer/lexical/AbstractLexicalAnalyzer.java#L710-L724 | train | Combine words. | [
30522,
2797,
10763,
11675,
11506,
22104,
1006,
5164,
1031,
1033,
2773,
7159,
1010,
20014,
2707,
1010,
20014,
2203,
1010,
4563,
29201,
3258,
5649,
1012,
17961,
1031,
1033,
17961,
2906,
9447,
1010,
4563,
29201,
3258,
5649,
1012,
17961,
3643,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.getMultipart | public static MultipartFormData getMultipart(ServletRequest request, UploadSetting uploadSetting) throws IORuntimeException {
final MultipartFormData formData = new MultipartFormData(uploadSetting);
try {
formData.parseRequest(request);
} catch (IOException e) {
throw new IORuntimeException(e);
}
return formData;
} | java | public static MultipartFormData getMultipart(ServletRequest request, UploadSetting uploadSetting) throws IORuntimeException {
final MultipartFormData formData = new MultipartFormData(uploadSetting);
try {
formData.parseRequest(request);
} catch (IOException e) {
throw new IORuntimeException(e);
}
return formData;
} | [
"public",
"static",
"MultipartFormData",
"getMultipart",
"(",
"ServletRequest",
"request",
",",
"UploadSetting",
"uploadSetting",
")",
"throws",
"IORuntimeException",
"{",
"final",
"MultipartFormData",
"formData",
"=",
"new",
"MultipartFormData",
"(",
"uploadSetting",
")"... | 获得multipart/form-data 表单内容<br>
包括文件和普通表单数据<br>
在同一次请求中,此方法只能被执行一次!
@param request {@link ServletRequest}
@param uploadSetting 上传文件的设定,包括最大文件大小、保存在内存的边界大小、临时目录、扩展名限定等
@return MultiPart表单
@throws IORuntimeException IO异常
@since 4.0.2 | [
"获得multipart",
"/",
"form",
"-",
"data",
"表单内容<br",
">",
"包括文件和普通表单数据<br",
">",
"在同一次请求中,此方法只能被执行一次!"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L258-L267 | train | Gets a MultipartFormData object from the given request. | [
30522,
2270,
10763,
4800,
19362,
24475,
2953,
26876,
6790,
2131,
12274,
7096,
11514,
8445,
1006,
14262,
2615,
7485,
2890,
15500,
5227,
1010,
2039,
11066,
21678,
2075,
2039,
11066,
21678,
2075,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
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/document/sentence/Sentence.java | Sentence.text | public String text(String delimiter)
{
if (delimiter == null) delimiter = "";
StringBuilder sb = new StringBuilder(size() * 3);
for (IWord word : this)
{
if (word instanceof CompoundWord)
{
for (Word child : ((CompoundWord) word).innerList)
{
sb.append(child.getValue()).append(delimiter);
}
}
else
{
sb.append(word.getValue()).append(delimiter);
}
}
sb.setLength(sb.length() - delimiter.length());
return sb.toString();
} | java | public String text(String delimiter)
{
if (delimiter == null) delimiter = "";
StringBuilder sb = new StringBuilder(size() * 3);
for (IWord word : this)
{
if (word instanceof CompoundWord)
{
for (Word child : ((CompoundWord) word).innerList)
{
sb.append(child.getValue()).append(delimiter);
}
}
else
{
sb.append(word.getValue()).append(delimiter);
}
}
sb.setLength(sb.length() - delimiter.length());
return sb.toString();
} | [
"public",
"String",
"text",
"(",
"String",
"delimiter",
")",
"{",
"if",
"(",
"delimiter",
"==",
"null",
")",
"delimiter",
"=",
"\"\"",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"size",
"(",
")",
"*",
"3",
")",
";",
"for",
"(",
"IW... | 原始文本形式(无标注,raw text)
@param delimiter 词语之间的分隔符
@return | [
"原始文本形式(无标注,raw",
"text)"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/document/sentence/Sentence.java#L291-L312 | train | Text method. | [
30522,
2270,
5164,
3793,
1006,
5164,
3972,
27605,
3334,
1007,
1063,
2065,
1006,
3972,
27605,
3334,
1027,
1027,
19701,
1007,
3972,
27605,
3334,
1027,
1000,
1000,
1025,
5164,
8569,
23891,
2099,
24829,
1027,
2047,
5164,
8569,
23891,
2099,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.registerTypeWithKryoSerializer | public <T extends Serializer<?> & Serializable>void registerTypeWithKryoSerializer(Class<?> type, T serializer) {
config.registerTypeWithKryoSerializer(type, serializer);
} | java | public <T extends Serializer<?> & Serializable>void registerTypeWithKryoSerializer(Class<?> type, T serializer) {
config.registerTypeWithKryoSerializer(type, serializer);
} | [
"public",
"<",
"T",
"extends",
"Serializer",
"<",
"?",
">",
"&",
"Serializable",
">",
"void",
"registerTypeWithKryoSerializer",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"T",
"serializer",
")",
"{",
"config",
".",
"registerTypeWithKryoSerializer",
"(",
"type",... | Registers the given type with a Kryo Serializer.
<p>Note that the serializer instance must be serializable (as defined by
java.io.Serializable), because it may be distributed to the worker nodes
by java serialization.
@param type
The class of the types serialized with the given serializer.
@param serializer
The serializer to use. | [
"Registers",
"the",
"given",
"type",
"with",
"a",
"Kryo",
"Serializer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L582-L584 | train | Register a serializer with the KryoSerializer. | [
30522,
2270,
1026,
1056,
8908,
7642,
17629,
1026,
1029,
1028,
1004,
7642,
21335,
3468,
1028,
11675,
4236,
13874,
24415,
21638,
7677,
8043,
4818,
17629,
1006,
2465,
1026,
1029,
1028,
2828,
1010,
1056,
7642,
17629,
1007,
1063,
9530,
8873,
229... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DeltaIteration.java | DeltaIteration.closeWith | public DataSet<ST> closeWith(DataSet<ST> solutionSetDelta, DataSet<WT> newWorkset) {
return new DeltaIterationResultSet<ST, WT>(initialSolutionSet.getExecutionEnvironment(),
initialSolutionSet.getType(), initialWorkset.getType(), this, solutionSetDelta, newWorkset, keys, maxIterations);
} | java | public DataSet<ST> closeWith(DataSet<ST> solutionSetDelta, DataSet<WT> newWorkset) {
return new DeltaIterationResultSet<ST, WT>(initialSolutionSet.getExecutionEnvironment(),
initialSolutionSet.getType(), initialWorkset.getType(), this, solutionSetDelta, newWorkset, keys, maxIterations);
} | [
"public",
"DataSet",
"<",
"ST",
">",
"closeWith",
"(",
"DataSet",
"<",
"ST",
">",
"solutionSetDelta",
",",
"DataSet",
"<",
"WT",
">",
"newWorkset",
")",
"{",
"return",
"new",
"DeltaIterationResultSet",
"<",
"ST",
",",
"WT",
">",
"(",
"initialSolutionSet",
... | Closes the delta iteration. This method defines the end of the delta iteration's function.
@param solutionSetDelta The delta for the solution set. The delta will be merged into the solution set at the end of
each iteration.
@param newWorkset The new workset (feedback data set) that will be fed back to the next iteration.
@return The DataSet that represents the result of the iteration, after the computation has terminated.
@see DataSet#iterateDelta(DataSet, int, int...) | [
"Closes",
"the",
"delta",
"iteration",
".",
"This",
"method",
"defines",
"the",
"end",
"of",
"the",
"delta",
"iteration",
"s",
"function",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/DeltaIteration.java#L94-L97 | train | Close the delta iteration result set. | [
30522,
2270,
2951,
13462,
1026,
2358,
1028,
2485,
24415,
1006,
2951,
13462,
1026,
2358,
1028,
7300,
3388,
9247,
2696,
1010,
2951,
13462,
1026,
1059,
2102,
1028,
2047,
9316,
3388,
1007,
1063,
2709,
2047,
7160,
21646,
3370,
6072,
11314,
13462... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.updateAttributeIfExist | private static boolean updateAttributeIfExist(String key, CoreDictionary.Attribute attribute, TreeMap<String, CoreDictionary.Attribute> map, TreeMap<Integer, CoreDictionary.Attribute> rewriteTable)
{
int wordID = CoreDictionary.getWordID(key);
CoreDictionary.Attribute attributeExisted;
if (wordID != -1)
{
attributeExisted = CoreDictionary.get(wordID);
attributeExisted.nature = attribute.nature;
attributeExisted.frequency = attribute.frequency;
attributeExisted.totalFrequency = attribute.totalFrequency;
// 收集该覆写
rewriteTable.put(wordID, attribute);
return true;
}
attributeExisted = map.get(key);
if (attributeExisted != null)
{
attributeExisted.nature = attribute.nature;
attributeExisted.frequency = attribute.frequency;
attributeExisted.totalFrequency = attribute.totalFrequency;
return true;
}
return false;
} | java | private static boolean updateAttributeIfExist(String key, CoreDictionary.Attribute attribute, TreeMap<String, CoreDictionary.Attribute> map, TreeMap<Integer, CoreDictionary.Attribute> rewriteTable)
{
int wordID = CoreDictionary.getWordID(key);
CoreDictionary.Attribute attributeExisted;
if (wordID != -1)
{
attributeExisted = CoreDictionary.get(wordID);
attributeExisted.nature = attribute.nature;
attributeExisted.frequency = attribute.frequency;
attributeExisted.totalFrequency = attribute.totalFrequency;
// 收集该覆写
rewriteTable.put(wordID, attribute);
return true;
}
attributeExisted = map.get(key);
if (attributeExisted != null)
{
attributeExisted.nature = attribute.nature;
attributeExisted.frequency = attribute.frequency;
attributeExisted.totalFrequency = attribute.totalFrequency;
return true;
}
return false;
} | [
"private",
"static",
"boolean",
"updateAttributeIfExist",
"(",
"String",
"key",
",",
"CoreDictionary",
".",
"Attribute",
"attribute",
",",
"TreeMap",
"<",
"String",
",",
"CoreDictionary",
".",
"Attribute",
">",
"map",
",",
"TreeMap",
"<",
"Integer",
",",
"CoreDi... | 如果已经存在该词条,直接更新该词条的属性
@param key 词语
@param attribute 词语的属性
@param map 加载期间的map
@param rewriteTable
@return 是否更新了 | [
"如果已经存在该词条",
"直接更新该词条的属性"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L230-L255 | train | Update attribute if exist. | [
30522,
2797,
10763,
22017,
20898,
10651,
19321,
3089,
8569,
2618,
29323,
9048,
3367,
1006,
5164,
3145,
1010,
4563,
29201,
3258,
5649,
1012,
17961,
17961,
1010,
3392,
2863,
2361,
1026,
5164,
1010,
4563,
29201,
3258,
5649,
1012,
17961,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Schema.java | Schema.field | public Schema field(String fieldName, TypeInformation<?> fieldType) {
field(fieldName, TypeStringUtils.writeTypeInfo(fieldType));
return this;
} | java | public Schema field(String fieldName, TypeInformation<?> fieldType) {
field(fieldName, TypeStringUtils.writeTypeInfo(fieldType));
return this;
} | [
"public",
"Schema",
"field",
"(",
"String",
"fieldName",
",",
"TypeInformation",
"<",
"?",
">",
"fieldType",
")",
"{",
"field",
"(",
"fieldName",
",",
"TypeStringUtils",
".",
"writeTypeInfo",
"(",
"fieldType",
")",
")",
";",
"return",
"this",
";",
"}"
] | Adds a field with the field name and the type information. Required.
This method can be called multiple times. The call order of this method defines
also the order of the fields in a row.
@param fieldName the field name
@param fieldType the type information of the field | [
"Adds",
"a",
"field",
"with",
"the",
"field",
"name",
"and",
"the",
"type",
"information",
".",
"Required",
".",
"This",
"method",
"can",
"be",
"called",
"multiple",
"times",
".",
"The",
"call",
"order",
"of",
"this",
"method",
"defines",
"also",
"the",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Schema.java#L76-L79 | train | Create a new field with the given name and type information. | [
30522,
2270,
8040,
28433,
2492,
1006,
5164,
2492,
18442,
1010,
2828,
2378,
14192,
30524,
2492,
13874,
1007,
1007,
1025,
2709,
2023,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/cookie/ServerCookieEncoder.java | ServerCookieEncoder.encode | public String encode(Cookie cookie) {
final String name = checkNotNull(cookie, "cookie").name();
final String value = cookie.value() != null ? cookie.value() : "";
validateCookie(name, value);
StringBuilder buf = stringBuilder();
if (cookie.wrap()) {
addQuoted(buf, name, value);
} else {
add(buf, name, value);
}
if (cookie.maxAge() != Long.MIN_VALUE) {
add(buf, CookieHeaderNames.MAX_AGE, cookie.maxAge());
Date expires = new Date(cookie.maxAge() * 1000 + System.currentTimeMillis());
buf.append(CookieHeaderNames.EXPIRES);
buf.append('=');
DateFormatter.append(expires, buf);
buf.append(';');
buf.append(HttpConstants.SP_CHAR);
}
if (cookie.path() != null) {
add(buf, CookieHeaderNames.PATH, cookie.path());
}
if (cookie.domain() != null) {
add(buf, CookieHeaderNames.DOMAIN, cookie.domain());
}
if (cookie.isSecure()) {
add(buf, CookieHeaderNames.SECURE);
}
if (cookie.isHttpOnly()) {
add(buf, CookieHeaderNames.HTTPONLY);
}
return stripTrailingSeparator(buf);
} | java | public String encode(Cookie cookie) {
final String name = checkNotNull(cookie, "cookie").name();
final String value = cookie.value() != null ? cookie.value() : "";
validateCookie(name, value);
StringBuilder buf = stringBuilder();
if (cookie.wrap()) {
addQuoted(buf, name, value);
} else {
add(buf, name, value);
}
if (cookie.maxAge() != Long.MIN_VALUE) {
add(buf, CookieHeaderNames.MAX_AGE, cookie.maxAge());
Date expires = new Date(cookie.maxAge() * 1000 + System.currentTimeMillis());
buf.append(CookieHeaderNames.EXPIRES);
buf.append('=');
DateFormatter.append(expires, buf);
buf.append(';');
buf.append(HttpConstants.SP_CHAR);
}
if (cookie.path() != null) {
add(buf, CookieHeaderNames.PATH, cookie.path());
}
if (cookie.domain() != null) {
add(buf, CookieHeaderNames.DOMAIN, cookie.domain());
}
if (cookie.isSecure()) {
add(buf, CookieHeaderNames.SECURE);
}
if (cookie.isHttpOnly()) {
add(buf, CookieHeaderNames.HTTPONLY);
}
return stripTrailingSeparator(buf);
} | [
"public",
"String",
"encode",
"(",
"Cookie",
"cookie",
")",
"{",
"final",
"String",
"name",
"=",
"checkNotNull",
"(",
"cookie",
",",
"\"cookie\"",
")",
".",
"name",
"(",
")",
";",
"final",
"String",
"value",
"=",
"cookie",
".",
"value",
"(",
")",
"!=",... | Encodes the specified cookie into a Set-Cookie header value.
@param cookie the cookie
@return a single Set-Cookie header value | [
"Encodes",
"the",
"specified",
"cookie",
"into",
"a",
"Set",
"-",
"Cookie",
"header",
"value",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/cookie/ServerCookieEncoder.java#L90-L129 | train | Encode a Cookie object into a String. | [
30522,
2270,
5164,
4372,
16044,
1006,
17387,
17387,
1007,
1063,
2345,
5164,
2171,
1027,
4638,
17048,
11231,
3363,
1006,
17387,
1010,
1000,
17387,
1000,
1007,
1012,
2171,
1006,
1007,
1025,
2345,
5164,
3643,
1027,
17387,
1012,
3643,
1006,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/cloudfoundry/CloudFoundryCustomContextPathExample.java | CloudFoundryCustomContextPathExample.servletWebServerFactory | @Bean
public TomcatServletWebServerFactory servletWebServerFactory() {
return new TomcatServletWebServerFactory() {
@Override
protected void prepareContext(Host host,
ServletContextInitializer[] initializers) {
super.prepareContext(host, initializers);
StandardContext child = new StandardContext();
child.addLifecycleListener(new Tomcat.FixContextListener());
child.setPath("/cloudfoundryapplication");
ServletContainerInitializer initializer = getServletContextInitializer(
getContextPath());
child.addServletContainerInitializer(initializer, Collections.emptySet());
child.setCrossContext(true);
host.addChild(child);
}
};
} | java | @Bean
public TomcatServletWebServerFactory servletWebServerFactory() {
return new TomcatServletWebServerFactory() {
@Override
protected void prepareContext(Host host,
ServletContextInitializer[] initializers) {
super.prepareContext(host, initializers);
StandardContext child = new StandardContext();
child.addLifecycleListener(new Tomcat.FixContextListener());
child.setPath("/cloudfoundryapplication");
ServletContainerInitializer initializer = getServletContextInitializer(
getContextPath());
child.addServletContainerInitializer(initializer, Collections.emptySet());
child.setCrossContext(true);
host.addChild(child);
}
};
} | [
"@",
"Bean",
"public",
"TomcatServletWebServerFactory",
"servletWebServerFactory",
"(",
")",
"{",
"return",
"new",
"TomcatServletWebServerFactory",
"(",
")",
"{",
"@",
"Override",
"protected",
"void",
"prepareContext",
"(",
"Host",
"host",
",",
"ServletContextInitialize... | tag::configuration[] | [
"tag",
"::",
"configuration",
"[]"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/cloudfoundry/CloudFoundryCustomContextPathExample.java#L48-L67 | train | Creates a TomcatServletWebServerFactory. | [
30522,
1030,
14068,
2270,
3419,
19588,
2121,
2615,
7485,
8545,
5910,
2121,
6299,
21450,
14262,
2615,
7485,
8545,
5910,
2121,
6299,
21450,
1006,
1007,
1063,
2709,
2047,
3419,
19588,
2121,
2615,
7485,
8545,
5910,
2121,
6299,
21450,
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-dfa/src/main/java/cn/hutool/dfa/WordTree.java | WordTree.matchAll | public List<String> matchAll(String text, int limit, boolean isDensityMatch, boolean isGreedMatch) {
if(null == text){
return null;
}
List<String> findedWords = new ArrayList<String>();
WordTree current = this;
int length = text.length();
StringBuilder wordBuffer;//存放查找到的字符缓存。完整出现一个词时加到findedWords中,否则清空
char currentChar;
for (int i = 0; i < length; i++) {
wordBuffer = StrUtil.builder();
for (int j = i; j < length; j++) {
currentChar = text.charAt(j);
// Console.log("i: {}, j: {}, currentChar: {}", i, j, currentChar);
if(StopChar.isStopChar(currentChar)){
if(wordBuffer.length() > 0){
//做为关键词中间的停顿词被当作关键词的一部分被返回
wordBuffer.append(currentChar);
}else{
//停顿词做为关键词的第一个字符时需要跳过
i++;
}
continue;
}else if(false == current.containsKey(currentChar)){
//非关键字符被整体略过,重新以下个字符开始检查
break;
}
wordBuffer.append(currentChar);
if(current.isEnd(currentChar)){
//到达单词末尾,关键词成立,从此词的下一个位置开始查找
findedWords.add(wordBuffer.toString());
if(limit > 0 && findedWords.size() >= limit){
//超过匹配限制个数,直接返回
return findedWords;
}
if(false == isDensityMatch){
//如果非密度匹配,跳过匹配到的词
i = j;
}
if(false == isGreedMatch){
//如果懒惰匹配(非贪婪匹配)。当遇到第一个结尾标记就结束本轮匹配
break;
}
}
current = current.get(currentChar);
if(null == current){
break;
}
}
current = this;
}
return findedWords;
} | java | public List<String> matchAll(String text, int limit, boolean isDensityMatch, boolean isGreedMatch) {
if(null == text){
return null;
}
List<String> findedWords = new ArrayList<String>();
WordTree current = this;
int length = text.length();
StringBuilder wordBuffer;//存放查找到的字符缓存。完整出现一个词时加到findedWords中,否则清空
char currentChar;
for (int i = 0; i < length; i++) {
wordBuffer = StrUtil.builder();
for (int j = i; j < length; j++) {
currentChar = text.charAt(j);
// Console.log("i: {}, j: {}, currentChar: {}", i, j, currentChar);
if(StopChar.isStopChar(currentChar)){
if(wordBuffer.length() > 0){
//做为关键词中间的停顿词被当作关键词的一部分被返回
wordBuffer.append(currentChar);
}else{
//停顿词做为关键词的第一个字符时需要跳过
i++;
}
continue;
}else if(false == current.containsKey(currentChar)){
//非关键字符被整体略过,重新以下个字符开始检查
break;
}
wordBuffer.append(currentChar);
if(current.isEnd(currentChar)){
//到达单词末尾,关键词成立,从此词的下一个位置开始查找
findedWords.add(wordBuffer.toString());
if(limit > 0 && findedWords.size() >= limit){
//超过匹配限制个数,直接返回
return findedWords;
}
if(false == isDensityMatch){
//如果非密度匹配,跳过匹配到的词
i = j;
}
if(false == isGreedMatch){
//如果懒惰匹配(非贪婪匹配)。当遇到第一个结尾标记就结束本轮匹配
break;
}
}
current = current.get(currentChar);
if(null == current){
break;
}
}
current = this;
}
return findedWords;
} | [
"public",
"List",
"<",
"String",
">",
"matchAll",
"(",
"String",
"text",
",",
"int",
"limit",
",",
"boolean",
"isDensityMatch",
",",
"boolean",
"isGreedMatch",
")",
"{",
"if",
"(",
"null",
"==",
"text",
")",
"{",
"return",
"null",
";",
"}",
"List",
"<"... | 找出所有匹配的关键字<br>
密集匹配原则:假如关键词有 ab,b,文本是abab,将匹配 [ab,b,ab]<br>
贪婪匹配(最长匹配)原则:假如关键字a,ab,最长匹配将匹配[a, ab]
@param text 被检查的文本
@param limit 限制匹配个数
@param isDensityMatch 是否使用密集匹配原则
@param isGreedMatch 是否使用贪婪匹配(最长匹配)原则
@return 匹配的词列表 | [
"找出所有匹配的关键字<br",
">",
"密集匹配原则:假如关键词有",
"ab",
"b,文本是abab,将匹配",
"[",
"ab",
"b",
"ab",
"]",
"<br",
">",
"贪婪匹配(最长匹配)原则:假如关键字a",
"ab,最长匹配将匹配",
"[",
"a",
"ab",
"]"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java#L157-L210 | train | Match all words in text | [
30522,
2270,
2862,
1026,
5164,
1028,
2674,
8095,
1006,
5164,
3793,
1010,
20014,
5787,
1010,
22017,
20898,
2003,
4181,
17759,
18900,
2818,
1010,
22017,
20898,
2003,
28637,
22117,
4017,
2818,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
3793,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/com/thoughtworks/selenium/HttpCommandProcessor.java | HttpCommandProcessor.getOutputStreamWriter | protected Writer getOutputStreamWriter(HttpURLConnection conn) throws IOException {
return new BufferedWriter(new OutputStreamWriter(conn.getOutputStream(), UTF_8));
} | java | protected Writer getOutputStreamWriter(HttpURLConnection conn) throws IOException {
return new BufferedWriter(new OutputStreamWriter(conn.getOutputStream(), UTF_8));
} | [
"protected",
"Writer",
"getOutputStreamWriter",
"(",
"HttpURLConnection",
"conn",
")",
"throws",
"IOException",
"{",
"return",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"conn",
".",
"getOutputStream",
"(",
")",
",",
"UTF_8",
")",
")",
";",
... | for testing | [
"for",
"testing"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/com/thoughtworks/selenium/HttpCommandProcessor.java#L152-L154 | train | Get the output stream writer. | [
30522,
5123,
3213,
2131,
5833,
18780,
21422,
15994,
1006,
8299,
3126,
22499,
10087,
7542,
9530,
2078,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
2047,
17698,
2098,
15994,
1006,
2047,
27852,
25379,
15994,
1006,
9530,
2078,
1012,
2131,
5833,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java | CipherSuiteConverter.isJ2OCached | static boolean isJ2OCached(String key, String value) {
return value.equals(j2o.get(key));
} | java | static boolean isJ2OCached(String key, String value) {
return value.equals(j2o.get(key));
} | [
"static",
"boolean",
"isJ2OCached",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"return",
"value",
".",
"equals",
"(",
"j2o",
".",
"get",
"(",
"key",
")",
")",
";",
"}"
] | Tests if the specified key-value pair has been cached in Java-to-OpenSSL cache. | [
"Tests",
"if",
"the",
"specified",
"key",
"-",
"value",
"pair",
"has",
"been",
"cached",
"in",
"Java",
"-",
"to",
"-",
"OpenSSL",
"cache",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java#L132-L134 | train | Checks if the value is the same as the one in the cache. | [
30522,
10763,
22017,
20898,
2003,
3501,
2475,
24755,
7690,
1006,
5164,
3145,
1010,
5164,
3643,
1007,
1063,
2709,
3643,
1012,
19635,
1006,
1046,
2475,
2080,
1012,
2131,
1006,
3145,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/StreamProjection.java | StreamProjection.projectTupleX | @SuppressWarnings("unchecked")
public <OUT extends Tuple> SingleOutputStreamOperator<OUT> projectTupleX() {
SingleOutputStreamOperator<OUT> projOperator = null;
switch (fieldIndexes.length) {
case 1: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple1(); break;
case 2: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple2(); break;
case 3: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple3(); break;
case 4: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple4(); break;
case 5: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple5(); break;
case 6: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple6(); break;
case 7: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple7(); break;
case 8: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple8(); break;
case 9: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple9(); break;
case 10: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple10(); break;
case 11: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple11(); break;
case 12: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple12(); break;
case 13: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple13(); break;
case 14: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple14(); break;
case 15: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple15(); break;
case 16: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple16(); break;
case 17: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple17(); break;
case 18: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple18(); break;
case 19: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple19(); break;
case 20: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple20(); break;
case 21: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple21(); break;
case 22: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple22(); break;
case 23: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple23(); break;
case 24: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple24(); break;
case 25: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple25(); break;
default:
throw new IllegalStateException("Excessive arity in tuple.");
}
return projOperator;
} | java | @SuppressWarnings("unchecked")
public <OUT extends Tuple> SingleOutputStreamOperator<OUT> projectTupleX() {
SingleOutputStreamOperator<OUT> projOperator = null;
switch (fieldIndexes.length) {
case 1: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple1(); break;
case 2: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple2(); break;
case 3: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple3(); break;
case 4: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple4(); break;
case 5: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple5(); break;
case 6: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple6(); break;
case 7: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple7(); break;
case 8: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple8(); break;
case 9: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple9(); break;
case 10: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple10(); break;
case 11: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple11(); break;
case 12: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple12(); break;
case 13: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple13(); break;
case 14: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple14(); break;
case 15: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple15(); break;
case 16: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple16(); break;
case 17: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple17(); break;
case 18: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple18(); break;
case 19: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple19(); break;
case 20: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple20(); break;
case 21: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple21(); break;
case 22: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple22(); break;
case 23: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple23(); break;
case 24: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple24(); break;
case 25: projOperator = (SingleOutputStreamOperator<OUT>) projectTuple25(); break;
default:
throw new IllegalStateException("Excessive arity in tuple.");
}
return projOperator;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"OUT",
"extends",
"Tuple",
">",
"SingleOutputStreamOperator",
"<",
"OUT",
">",
"projectTupleX",
"(",
")",
"{",
"SingleOutputStreamOperator",
"<",
"OUT",
">",
"projOperator",
"=",
"null",
";",
"sw... | Chooses a projectTupleX according to the length of
{@link org.apache.flink.streaming.api.datastream.StreamProjection#fieldIndexes}.
@return The projected DataStream.
@see org.apache.flink.api.java.operators.ProjectOperator.Projection | [
"Chooses",
"a",
"projectTupleX",
"according",
"to",
"the",
"length",
"of",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"streaming",
".",
"api",
".",
"datastream",
".",
"StreamProjection#fieldIndexes",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/StreamProjection.java#L89-L124 | train | Project the tuples into a single output stream operator. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
1026,
2041,
8908,
10722,
10814,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
2041,
1028,
2622,
8525,
19386,
1006,
1007,
1063,
2309,
5833,
18780,
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/incubator-shardingsphere | sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/connection/BackendConnection.java | BackendConnection.getConnections | public List<Connection> getConnections(final ConnectionMode connectionMode, final String dataSourceName, final int connectionSize) throws SQLException {
if (stateHandler.isInTransaction()) {
return getConnectionsWithTransaction(connectionMode, dataSourceName, connectionSize);
} else {
return getConnectionsWithoutTransaction(connectionMode, dataSourceName, connectionSize);
}
} | java | public List<Connection> getConnections(final ConnectionMode connectionMode, final String dataSourceName, final int connectionSize) throws SQLException {
if (stateHandler.isInTransaction()) {
return getConnectionsWithTransaction(connectionMode, dataSourceName, connectionSize);
} else {
return getConnectionsWithoutTransaction(connectionMode, dataSourceName, connectionSize);
}
} | [
"public",
"List",
"<",
"Connection",
">",
"getConnections",
"(",
"final",
"ConnectionMode",
"connectionMode",
",",
"final",
"String",
"dataSourceName",
",",
"final",
"int",
"connectionSize",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"stateHandler",
".",
"isIn... | Get connections of current thread datasource.
@param connectionMode connection mode
@param dataSourceName data source name
@param connectionSize size of connections to be get
@return connections
@throws SQLException SQL exception | [
"Get",
"connections",
"of",
"current",
"thread",
"datasource",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/connection/BackendConnection.java#L137-L143 | train | Gets the connections. | [
30522,
2270,
2862,
1026,
4434,
1028,
2131,
8663,
2638,
22014,
1006,
2345,
4434,
5302,
3207,
4434,
5302,
3207,
1010,
2345,
5164,
2951,
6499,
3126,
27524,
14074,
1010,
2345,
20014,
7264,
4697,
1007,
11618,
29296,
10288,
24422,
1063,
2065,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.getFieldValues | public static <T> List<T> getFieldValues(Iterable<?> collection, final String fieldName, final Class<T> elementType) {
List<Object> fieldValues = getFieldValues(collection, fieldName);
return Convert.toList(elementType, fieldValues);
} | java | public static <T> List<T> getFieldValues(Iterable<?> collection, final String fieldName, final Class<T> elementType) {
List<Object> fieldValues = getFieldValues(collection, fieldName);
return Convert.toList(elementType, fieldValues);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"getFieldValues",
"(",
"Iterable",
"<",
"?",
">",
"collection",
",",
"final",
"String",
"fieldName",
",",
"final",
"Class",
"<",
"T",
">",
"elementType",
")",
"{",
"List",
"<",
"Object",
">",
... | 获取给定Bean列表中指定字段名对应字段值的列表<br>
列表元素支持Bean与Map
@param <T> 元素类型
@param collection Bean集合或Map集合
@param fieldName 字段名或map的键
@param elementType 元素类型类
@return 字段值列表
@since 4.5.6 | [
"获取给定Bean列表中指定字段名对应字段值的列表<br",
">",
"列表元素支持Bean与Map"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1197-L1200 | train | Gets the field values of a collection. | [
30522,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
2131,
3790,
10175,
15808,
1006,
2009,
6906,
3468,
1026,
1029,
1028,
3074,
1010,
2345,
5164,
30524,
2709,
10463,
1012,
2000,
9863,
1006,
5783,
13874,
1010,
2492,
10175,
15808,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/server/ErrorPacket.java | ErrorPacket.fromBytes | public void fromBytes(byte[] data) {
int index = 0;
// 1. read field count
this.fieldCount = data[0];
index++;
// 2. read error no.
this.errorNumber = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
// 3. read marker
this.sqlStateMarker = data[index];
index++;
// 4. read sqlState
this.sqlState = ByteHelper.readFixedLengthBytes(data, index, 5);
index += 5;
// 5. read message
this.message = new String(ByteHelper.readFixedLengthBytes(data, index, data.length - index));
// end read
} | java | public void fromBytes(byte[] data) {
int index = 0;
// 1. read field count
this.fieldCount = data[0];
index++;
// 2. read error no.
this.errorNumber = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
// 3. read marker
this.sqlStateMarker = data[index];
index++;
// 4. read sqlState
this.sqlState = ByteHelper.readFixedLengthBytes(data, index, 5);
index += 5;
// 5. read message
this.message = new String(ByteHelper.readFixedLengthBytes(data, index, data.length - index));
// end read
} | [
"public",
"void",
"fromBytes",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"int",
"index",
"=",
"0",
";",
"// 1. read field count",
"this",
".",
"fieldCount",
"=",
"data",
"[",
"0",
"]",
";",
"index",
"++",
";",
"// 2. read error no.",
"this",
".",
"errorNu... | <pre>
VERSION 4.1
Bytes Name
----- ----
1 field_count, always = 0xff
2 errno
1 (sqlstate marker), always '#'
5 sqlstate (5 characters)
n message
</pre> | [
"<pre",
">",
"VERSION",
"4",
".",
"1",
"Bytes",
"Name",
"-----",
"----",
"1",
"field_count",
"always",
"=",
"0xff",
"2",
"errno",
"1",
"(",
"sqlstate",
"marker",
")",
"always",
"#",
"5",
"sqlstate",
"(",
"5",
"characters",
")",
"n",
"message"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/server/ErrorPacket.java#L29-L46 | train | Reads the CRASS from byte array. | [
30522,
2270,
11675,
2013,
3762,
4570,
1006,
24880,
1031,
1033,
2951,
1007,
1063,
20014,
5950,
1027,
1014,
1025,
1013,
1013,
1015,
1012,
3191,
2492,
4175,
2023,
1012,
2492,
3597,
16671,
1027,
2951,
1031,
1014,
1033,
1025,
5950,
1009,
1009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/SortUtil.java | SortUtil.putStringNormalizedKey | public static void putStringNormalizedKey(
BinaryString value, MemorySegment target, int offset, int numBytes) {
final int limit = offset + numBytes;
final int end = value.getSizeInBytes();
for (int i = 0; i < end && offset < limit; i++) {
target.put(offset++, value.getByte(i));
}
for (int i = offset; i < limit; i++) {
target.put(i, (byte) 0);
}
} | java | public static void putStringNormalizedKey(
BinaryString value, MemorySegment target, int offset, int numBytes) {
final int limit = offset + numBytes;
final int end = value.getSizeInBytes();
for (int i = 0; i < end && offset < limit; i++) {
target.put(offset++, value.getByte(i));
}
for (int i = offset; i < limit; i++) {
target.put(i, (byte) 0);
}
} | [
"public",
"static",
"void",
"putStringNormalizedKey",
"(",
"BinaryString",
"value",
",",
"MemorySegment",
"target",
",",
"int",
"offset",
",",
"int",
"numBytes",
")",
"{",
"final",
"int",
"limit",
"=",
"offset",
"+",
"numBytes",
";",
"final",
"int",
"end",
"... | UTF-8 supports bytes comparison. | [
"UTF",
"-",
"8",
"supports",
"bytes",
"comparison",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/SortUtil.java#L74-L85 | train | Put a binary string into a MemorySegment. | [
30522,
2270,
10763,
11675,
8509,
18886,
3070,
12131,
9067,
3550,
14839,
1006,
12441,
3367,
4892,
3643,
1010,
3638,
3366,
21693,
4765,
4539,
1010,
20014,
16396,
1010,
20014,
15903,
17250,
2015,
1007,
1063,
2345,
20014,
5787,
1027,
16396,
1009,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java | Task.transitionState | private boolean transitionState(ExecutionState currentState, ExecutionState newState, Throwable cause) {
if (STATE_UPDATER.compareAndSet(this, currentState, newState)) {
if (cause == null) {
LOG.info("{} ({}) switched from {} to {}.", taskNameWithSubtask, executionId, currentState, newState);
} else {
LOG.info("{} ({}) switched from {} to {}.", taskNameWithSubtask, executionId, currentState, newState, cause);
}
return true;
} else {
return false;
}
} | java | private boolean transitionState(ExecutionState currentState, ExecutionState newState, Throwable cause) {
if (STATE_UPDATER.compareAndSet(this, currentState, newState)) {
if (cause == null) {
LOG.info("{} ({}) switched from {} to {}.", taskNameWithSubtask, executionId, currentState, newState);
} else {
LOG.info("{} ({}) switched from {} to {}.", taskNameWithSubtask, executionId, currentState, newState, cause);
}
return true;
} else {
return false;
}
} | [
"private",
"boolean",
"transitionState",
"(",
"ExecutionState",
"currentState",
",",
"ExecutionState",
"newState",
",",
"Throwable",
"cause",
")",
"{",
"if",
"(",
"STATE_UPDATER",
".",
"compareAndSet",
"(",
"this",
",",
"currentState",
",",
"newState",
")",
")",
... | Try to transition the execution state from the current state to the new state.
@param currentState of the execution
@param newState of the execution
@param cause of the transition change or null
@return true if the transition was successful, otherwise false | [
"Try",
"to",
"transition",
"the",
"execution",
"state",
"from",
"the",
"current",
"state",
"to",
"the",
"new",
"state",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java#L962-L974 | train | Transition the state of the task. | [
30522,
2797,
22017,
20898,
22166,
12259,
1006,
22679,
12259,
14731,
12259,
1010,
22679,
12259,
2739,
12259,
1010,
5466,
3085,
3426,
1007,
1063,
2065,
1006,
2110,
1035,
10651,
2099,
1012,
12826,
29560,
3388,
1006,
2023,
1010,
14731,
12259,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-orc/src/main/java/org/apache/flink/orc/OrcBatchReader.java | OrcBatchReader.readField | private static void readField(Object[] vals, int fieldIdx, TypeDescription schema, ColumnVector vector, int childCount) {
// check the type of the vector to decide how to read it.
switch (schema.getCategory()) {
case BOOLEAN:
if (vector.noNulls) {
readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readBoolean);
} else {
readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readBoolean);
}
break;
case BYTE:
if (vector.noNulls) {
readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readByte);
} else {
readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readByte);
}
break;
case SHORT:
if (vector.noNulls) {
readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readShort);
} else {
readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readShort);
}
break;
case INT:
if (vector.noNulls) {
readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readInt);
} else {
readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readInt);
}
break;
case LONG:
if (vector.noNulls) {
readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readLong);
} else {
readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readLong);
}
break;
case FLOAT:
if (vector.noNulls) {
readNonNullDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readFloat);
} else {
readDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readFloat);
}
break;
case DOUBLE:
if (vector.noNulls) {
readNonNullDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readDouble);
} else {
readDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readDouble);
}
break;
case CHAR:
case VARCHAR:
case STRING:
if (vector.noNulls) {
readNonNullBytesColumnAsString(vals, fieldIdx, (BytesColumnVector) vector, childCount);
} else {
readBytesColumnAsString(vals, fieldIdx, (BytesColumnVector) vector, childCount);
}
break;
case DATE:
if (vector.noNulls) {
readNonNullLongColumnAsDate(vals, fieldIdx, (LongColumnVector) vector, childCount);
} else {
readLongColumnAsDate(vals, fieldIdx, (LongColumnVector) vector, childCount);
}
break;
case TIMESTAMP:
if (vector.noNulls) {
readNonNullTimestampColumn(vals, fieldIdx, (TimestampColumnVector) vector, childCount);
} else {
readTimestampColumn(vals, fieldIdx, (TimestampColumnVector) vector, childCount);
}
break;
case BINARY:
if (vector.noNulls) {
readNonNullBytesColumnAsBinary(vals, fieldIdx, (BytesColumnVector) vector, childCount);
} else {
readBytesColumnAsBinary(vals, fieldIdx, (BytesColumnVector) vector, childCount);
}
break;
case DECIMAL:
if (vector.noNulls) {
readNonNullDecimalColumn(vals, fieldIdx, (DecimalColumnVector) vector, childCount);
} else {
readDecimalColumn(vals, fieldIdx, (DecimalColumnVector) vector, childCount);
}
break;
case STRUCT:
if (vector.noNulls) {
readNonNullStructColumn(vals, fieldIdx, (StructColumnVector) vector, schema, childCount);
} else {
readStructColumn(vals, fieldIdx, (StructColumnVector) vector, schema, childCount);
}
break;
case LIST:
if (vector.noNulls) {
readNonNullListColumn(vals, fieldIdx, (ListColumnVector) vector, schema, childCount);
} else {
readListColumn(vals, fieldIdx, (ListColumnVector) vector, schema, childCount);
}
break;
case MAP:
if (vector.noNulls) {
readNonNullMapColumn(vals, fieldIdx, (MapColumnVector) vector, schema, childCount);
} else {
readMapColumn(vals, fieldIdx, (MapColumnVector) vector, schema, childCount);
}
break;
case UNION:
throw new UnsupportedOperationException("UNION type not supported yet");
default:
throw new IllegalArgumentException("Unknown type " + schema);
}
} | java | private static void readField(Object[] vals, int fieldIdx, TypeDescription schema, ColumnVector vector, int childCount) {
// check the type of the vector to decide how to read it.
switch (schema.getCategory()) {
case BOOLEAN:
if (vector.noNulls) {
readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readBoolean);
} else {
readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readBoolean);
}
break;
case BYTE:
if (vector.noNulls) {
readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readByte);
} else {
readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readByte);
}
break;
case SHORT:
if (vector.noNulls) {
readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readShort);
} else {
readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readShort);
}
break;
case INT:
if (vector.noNulls) {
readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readInt);
} else {
readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readInt);
}
break;
case LONG:
if (vector.noNulls) {
readNonNullLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readLong);
} else {
readLongColumn(vals, fieldIdx, (LongColumnVector) vector, childCount, OrcBatchReader::readLong);
}
break;
case FLOAT:
if (vector.noNulls) {
readNonNullDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readFloat);
} else {
readDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readFloat);
}
break;
case DOUBLE:
if (vector.noNulls) {
readNonNullDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readDouble);
} else {
readDoubleColumn(vals, fieldIdx, (DoubleColumnVector) vector, childCount, OrcBatchReader::readDouble);
}
break;
case CHAR:
case VARCHAR:
case STRING:
if (vector.noNulls) {
readNonNullBytesColumnAsString(vals, fieldIdx, (BytesColumnVector) vector, childCount);
} else {
readBytesColumnAsString(vals, fieldIdx, (BytesColumnVector) vector, childCount);
}
break;
case DATE:
if (vector.noNulls) {
readNonNullLongColumnAsDate(vals, fieldIdx, (LongColumnVector) vector, childCount);
} else {
readLongColumnAsDate(vals, fieldIdx, (LongColumnVector) vector, childCount);
}
break;
case TIMESTAMP:
if (vector.noNulls) {
readNonNullTimestampColumn(vals, fieldIdx, (TimestampColumnVector) vector, childCount);
} else {
readTimestampColumn(vals, fieldIdx, (TimestampColumnVector) vector, childCount);
}
break;
case BINARY:
if (vector.noNulls) {
readNonNullBytesColumnAsBinary(vals, fieldIdx, (BytesColumnVector) vector, childCount);
} else {
readBytesColumnAsBinary(vals, fieldIdx, (BytesColumnVector) vector, childCount);
}
break;
case DECIMAL:
if (vector.noNulls) {
readNonNullDecimalColumn(vals, fieldIdx, (DecimalColumnVector) vector, childCount);
} else {
readDecimalColumn(vals, fieldIdx, (DecimalColumnVector) vector, childCount);
}
break;
case STRUCT:
if (vector.noNulls) {
readNonNullStructColumn(vals, fieldIdx, (StructColumnVector) vector, schema, childCount);
} else {
readStructColumn(vals, fieldIdx, (StructColumnVector) vector, schema, childCount);
}
break;
case LIST:
if (vector.noNulls) {
readNonNullListColumn(vals, fieldIdx, (ListColumnVector) vector, schema, childCount);
} else {
readListColumn(vals, fieldIdx, (ListColumnVector) vector, schema, childCount);
}
break;
case MAP:
if (vector.noNulls) {
readNonNullMapColumn(vals, fieldIdx, (MapColumnVector) vector, schema, childCount);
} else {
readMapColumn(vals, fieldIdx, (MapColumnVector) vector, schema, childCount);
}
break;
case UNION:
throw new UnsupportedOperationException("UNION type not supported yet");
default:
throw new IllegalArgumentException("Unknown type " + schema);
}
} | [
"private",
"static",
"void",
"readField",
"(",
"Object",
"[",
"]",
"vals",
",",
"int",
"fieldIdx",
",",
"TypeDescription",
"schema",
",",
"ColumnVector",
"vector",
",",
"int",
"childCount",
")",
"{",
"// check the type of the vector to decide how to read it.",
"switch... | Reads a vector of data into an array of objects.
@param vals The array that needs to be filled.
@param fieldIdx If the vals array is an array of Row, the index of the field that needs to be filled.
Otherwise a -1 must be passed and the data is directly filled into the array.
@param schema The schema of the vector to read.
@param vector The vector to read.
@param childCount The number of vector entries to read. | [
"Reads",
"a",
"vector",
"of",
"data",
"into",
"an",
"array",
"of",
"objects",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-orc/src/main/java/org/apache/flink/orc/OrcBatchReader.java#L158-L274 | train | Read a field from the given vector. | [
30522,
2797,
10763,
11675,
3191,
3790,
1006,
4874,
1031,
1033,
11748,
2015,
1010,
20014,
2492,
3593,
2595,
1010,
21189,
2229,
23235,
3258,
8040,
28433,
1010,
5930,
3726,
16761,
9207,
1010,
20014,
2775,
3597,
16671,
1007,
1063,
1013,
1013,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraph.java | StreamGraph.addVirtualPartitionNode | public void addVirtualPartitionNode(Integer originalId, Integer virtualId, StreamPartitioner<?> partitioner) {
if (virtualPartitionNodes.containsKey(virtualId)) {
throw new IllegalStateException("Already has virtual partition node with id " + virtualId);
}
virtualPartitionNodes.put(virtualId,
new Tuple2<Integer, StreamPartitioner<?>>(originalId, partitioner));
} | java | public void addVirtualPartitionNode(Integer originalId, Integer virtualId, StreamPartitioner<?> partitioner) {
if (virtualPartitionNodes.containsKey(virtualId)) {
throw new IllegalStateException("Already has virtual partition node with id " + virtualId);
}
virtualPartitionNodes.put(virtualId,
new Tuple2<Integer, StreamPartitioner<?>>(originalId, partitioner));
} | [
"public",
"void",
"addVirtualPartitionNode",
"(",
"Integer",
"originalId",
",",
"Integer",
"virtualId",
",",
"StreamPartitioner",
"<",
"?",
">",
"partitioner",
")",
"{",
"if",
"(",
"virtualPartitionNodes",
".",
"containsKey",
"(",
"virtualId",
")",
")",
"{",
"th... | Adds a new virtual node that is used to connect a downstream vertex to an input with a
certain partitioning.
<p>When adding an edge from the virtual node to a downstream node the connection will be made
to the original node, but with the partitioning given here.
@param originalId ID of the node that should be connected to.
@param virtualId ID of the virtual node.
@param partitioner The partitioner | [
"Adds",
"a",
"new",
"virtual",
"node",
"that",
"is",
"used",
"to",
"connect",
"a",
"downstream",
"vertex",
"to",
"an",
"input",
"with",
"a",
"certain",
"partitioning",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraph.java#L347-L355 | train | Add a virtual partition node to the partition graph. | [
30522,
2270,
11675,
5587,
21663,
26302,
14277,
8445,
22753,
3630,
3207,
1006,
16109,
2434,
3593,
1010,
16109,
7484,
30524,
19362,
3775,
3508,
3630,
6155,
1012,
3397,
14839,
1006,
7484,
3593,
1007,
1007,
1063,
5466,
2047,
6206,
9153,
17389,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/clustering/TriangleListingBase.java | TriangleListingBase.setSortTriangleVertices | public TriangleListingBase<K, VV, EV, R> setSortTriangleVertices(boolean sortTriangleVertices) {
this.sortTriangleVertices.set(sortTriangleVertices);
return this;
} | java | public TriangleListingBase<K, VV, EV, R> setSortTriangleVertices(boolean sortTriangleVertices) {
this.sortTriangleVertices.set(sortTriangleVertices);
return this;
} | [
"public",
"TriangleListingBase",
"<",
"K",
",",
"VV",
",",
"EV",
",",
"R",
">",
"setSortTriangleVertices",
"(",
"boolean",
"sortTriangleVertices",
")",
"{",
"this",
".",
"sortTriangleVertices",
".",
"set",
"(",
"sortTriangleVertices",
")",
";",
"return",
"this",... | Normalize the triangle listing such that for each result (K0, K1, K2)
the vertex IDs are sorted K0 < K1 < K2.
@param sortTriangleVertices whether to output each triangle's vertices in sorted order
@return this | [
"Normalize",
"the",
"triangle",
"listing",
"such",
"that",
"for",
"each",
"result",
"(",
"K0",
"K1",
"K2",
")",
"the",
"vertex",
"IDs",
"are",
"sorted",
"K0",
"<",
"K1",
"<",
"K2",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/TriangleListingBase.java#L63-L67 | train | Sets whether the triangle list should be sorted. | [
30522,
2270,
9546,
9863,
2075,
15058,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1010,
1054,
1028,
4520,
11589,
18886,
5654,
20414,
8743,
23522,
1006,
22017,
20898,
4066,
18886,
5654,
20414,
8743,
23522,
1007,
1063,
2023,
1012,
30524,
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/util/IdcardUtil.java | IdcardUtil.getGenderByIdCard | public static int getGenderByIdCard(String idCard) {
Assert.notBlank(idCard);
final int len = idCard.length();
if(len < CHINA_ID_MIN_LENGTH) {
throw new IllegalArgumentException("ID Card length must be 15 or 18");
}
if (len == CHINA_ID_MIN_LENGTH) {
idCard = convert15To18(idCard);
}
char sCardChar = idCard.charAt(16);
int gender = -1;
if (Integer.parseInt(String.valueOf(sCardChar)) % 2 != 0) {
gender = 1;
} else {
gender = 0;
}
return gender;
} | java | public static int getGenderByIdCard(String idCard) {
Assert.notBlank(idCard);
final int len = idCard.length();
if(len < CHINA_ID_MIN_LENGTH) {
throw new IllegalArgumentException("ID Card length must be 15 or 18");
}
if (len == CHINA_ID_MIN_LENGTH) {
idCard = convert15To18(idCard);
}
char sCardChar = idCard.charAt(16);
int gender = -1;
if (Integer.parseInt(String.valueOf(sCardChar)) % 2 != 0) {
gender = 1;
} else {
gender = 0;
}
return gender;
} | [
"public",
"static",
"int",
"getGenderByIdCard",
"(",
"String",
"idCard",
")",
"{",
"Assert",
".",
"notBlank",
"(",
"idCard",
")",
";",
"final",
"int",
"len",
"=",
"idCard",
".",
"length",
"(",
")",
";",
"if",
"(",
"len",
"<",
"CHINA_ID_MIN_LENGTH",
")",
... | 根据身份编号获取性别,只支持15或18位身份证号码
@param idCard 身份编号
@return 性别(1: 男,0: 女) | [
"根据身份编号获取性别,只支持15或18位身份证号码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/IdcardUtil.java#L480-L498 | train | Gets the Gender By Card. | [
30522,
2270,
10763,
20014,
2131,
6914,
4063,
3762,
3593,
11522,
1006,
5164,
8909,
11522,
1007,
1063,
20865,
1012,
2025,
28522,
8950,
1006,
8909,
11522,
1007,
1025,
2345,
20014,
18798,
1027,
8909,
11522,
1012,
3091,
1006,
1007,
1025,
2065,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/utility/TextUtility.java | TextUtility.long2char | public static char[] long2char(long x)
{
char[] c = new char[4];
c[0] = (char) (x >> 48);
c[1] = (char) (x >> 32);
c[2] = (char) (x >> 16);
c[3] = (char) (x);
return c;
} | java | public static char[] long2char(long x)
{
char[] c = new char[4];
c[0] = (char) (x >> 48);
c[1] = (char) (x >> 32);
c[2] = (char) (x >> 16);
c[3] = (char) (x);
return c;
} | [
"public",
"static",
"char",
"[",
"]",
"long2char",
"(",
"long",
"x",
")",
"{",
"char",
"[",
"]",
"c",
"=",
"new",
"char",
"[",
"4",
"]",
";",
"c",
"[",
"0",
"]",
"=",
"(",
"char",
")",
"(",
"x",
">>",
"48",
")",
";",
"c",
"[",
"1",
"]",
... | 转换long型为char数组
@param x | [
"转换long型为char数组"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/TextUtility.java#L539-L547 | train | long2char This is a utility method to convert a long to a char array. | [
30522,
2270,
10763,
25869,
1031,
1033,
2146,
2475,
7507,
2099,
1006,
2146,
1060,
1007,
1063,
25869,
1031,
1033,
1039,
1027,
2047,
25869,
1031,
1018,
1033,
1025,
1039,
1031,
1014,
1033,
1027,
1006,
25869,
1007,
1006,
1060,
1028,
1028,
4466,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/BoundedPriorityQueue.java | BoundedPriorityQueue.offer | @Override
public boolean offer(E e) {
if(size() >= capacity) {
E head = peek();
if (this.comparator().compare(e, head) <= 0){
return true;
}
//当队列满时,就要淘汰顶端队列
poll();
}
return super.offer(e);
} | java | @Override
public boolean offer(E e) {
if(size() >= capacity) {
E head = peek();
if (this.comparator().compare(e, head) <= 0){
return true;
}
//当队列满时,就要淘汰顶端队列
poll();
}
return super.offer(e);
} | [
"@",
"Override",
"public",
"boolean",
"offer",
"(",
"E",
"e",
")",
"{",
"if",
"(",
"size",
"(",
")",
">=",
"capacity",
")",
"{",
"E",
"head",
"=",
"peek",
"(",
")",
";",
"if",
"(",
"this",
".",
"comparator",
"(",
")",
".",
"compare",
"(",
"e",
... | 加入元素,当队列满时,淘汰末尾元素
@param e 元素
@return 加入成功与否 | [
"加入元素,当队列满时,淘汰末尾元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/BoundedPriorityQueue.java#L60-L71 | train | offer method. | [
30522,
1030,
2058,
30524,
1026,
1027,
1014,
1007,
1063,
2709,
2995,
1025,
1065,
1013,
1013,
100,
100,
100,
100,
100,
1989,
100,
100,
100,
100,
100,
100,
100,
100,
8554,
1006,
1007,
1025,
1065,
2709,
3565,
1012,
3749,
1006,
1041,
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-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/relational/TPCHQuery3.java | TPCHQuery3.main | public static void main(String[] args) throws Exception {
final ParameterTool params = ParameterTool.fromArgs(args);
if (!params.has("lineitem") && !params.has("customer") && !params.has("orders")) {
System.err.println(" This program expects data from the TPC-H benchmark as input data.");
System.err.println(" Due to legal restrictions, we can not ship generated data.");
System.out.println(" You can find the TPC-H data generator at http://www.tpc.org/tpch/.");
System.out.println(" Usage: TPCHQuery3 --lineitem <path> --customer <path> --orders <path> [--output <path>]");
return;
}
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
env.getConfig().setGlobalJobParameters(params);
// get input data
DataSet<Lineitem> lineitems = getLineitemDataSet(env, params.get("lineitem"));
DataSet<Customer> customers = getCustomerDataSet(env, params.get("customer"));
DataSet<Order> orders = getOrdersDataSet(env, params.get("orders"));
// Filter market segment "AUTOMOBILE"
customers = customers.filter(
new FilterFunction<Customer>() {
@Override
public boolean filter(Customer c) {
return c.getMktsegment().equals("AUTOMOBILE");
}
});
// Filter all Orders with o_orderdate < 12.03.1995
orders = orders.filter(
new FilterFunction<Order>() {
private final DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
private final Date date = format.parse("1995-03-12");
@Override
public boolean filter(Order o) throws ParseException {
return format.parse(o.getOrderdate()).before(date);
}
});
// Filter all Lineitems with l_shipdate > 12.03.1995
lineitems = lineitems.filter(
new FilterFunction<Lineitem>() {
private final DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
private final Date date = format.parse("1995-03-12");
@Override
public boolean filter(Lineitem l) throws ParseException {
return format.parse(l.getShipdate()).after(date);
}
});
// Join customers with orders and package them into a ShippingPriorityItem
DataSet<ShippingPriorityItem> customerWithOrders =
customers.join(orders).where(0).equalTo(1)
.with(
new JoinFunction<Customer, Order, ShippingPriorityItem>() {
@Override
public ShippingPriorityItem join(Customer c, Order o) {
return new ShippingPriorityItem(o.getOrderKey(), 0.0, o.getOrderdate(),
o.getShippriority());
}
});
// Join the last join result with Lineitems
DataSet<ShippingPriorityItem> result =
customerWithOrders.join(lineitems).where(0).equalTo(0)
.with(
new JoinFunction<ShippingPriorityItem, Lineitem, ShippingPriorityItem>() {
@Override
public ShippingPriorityItem join(ShippingPriorityItem i, Lineitem l) {
i.setRevenue(l.getExtendedprice() * (1 - l.getDiscount()));
return i;
}
})
// Group by l_orderkey, o_orderdate and o_shippriority and compute revenue sum
.groupBy(0, 2, 3)
.aggregate(Aggregations.SUM, 1);
// emit result
if (params.has("output")) {
result.writeAsCsv(params.get("output"), "\n", "|");
// execute program
env.execute("TPCH Query 3 Example");
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
result.print();
}
} | java | public static void main(String[] args) throws Exception {
final ParameterTool params = ParameterTool.fromArgs(args);
if (!params.has("lineitem") && !params.has("customer") && !params.has("orders")) {
System.err.println(" This program expects data from the TPC-H benchmark as input data.");
System.err.println(" Due to legal restrictions, we can not ship generated data.");
System.out.println(" You can find the TPC-H data generator at http://www.tpc.org/tpch/.");
System.out.println(" Usage: TPCHQuery3 --lineitem <path> --customer <path> --orders <path> [--output <path>]");
return;
}
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
env.getConfig().setGlobalJobParameters(params);
// get input data
DataSet<Lineitem> lineitems = getLineitemDataSet(env, params.get("lineitem"));
DataSet<Customer> customers = getCustomerDataSet(env, params.get("customer"));
DataSet<Order> orders = getOrdersDataSet(env, params.get("orders"));
// Filter market segment "AUTOMOBILE"
customers = customers.filter(
new FilterFunction<Customer>() {
@Override
public boolean filter(Customer c) {
return c.getMktsegment().equals("AUTOMOBILE");
}
});
// Filter all Orders with o_orderdate < 12.03.1995
orders = orders.filter(
new FilterFunction<Order>() {
private final DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
private final Date date = format.parse("1995-03-12");
@Override
public boolean filter(Order o) throws ParseException {
return format.parse(o.getOrderdate()).before(date);
}
});
// Filter all Lineitems with l_shipdate > 12.03.1995
lineitems = lineitems.filter(
new FilterFunction<Lineitem>() {
private final DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
private final Date date = format.parse("1995-03-12");
@Override
public boolean filter(Lineitem l) throws ParseException {
return format.parse(l.getShipdate()).after(date);
}
});
// Join customers with orders and package them into a ShippingPriorityItem
DataSet<ShippingPriorityItem> customerWithOrders =
customers.join(orders).where(0).equalTo(1)
.with(
new JoinFunction<Customer, Order, ShippingPriorityItem>() {
@Override
public ShippingPriorityItem join(Customer c, Order o) {
return new ShippingPriorityItem(o.getOrderKey(), 0.0, o.getOrderdate(),
o.getShippriority());
}
});
// Join the last join result with Lineitems
DataSet<ShippingPriorityItem> result =
customerWithOrders.join(lineitems).where(0).equalTo(0)
.with(
new JoinFunction<ShippingPriorityItem, Lineitem, ShippingPriorityItem>() {
@Override
public ShippingPriorityItem join(ShippingPriorityItem i, Lineitem l) {
i.setRevenue(l.getExtendedprice() * (1 - l.getDiscount()));
return i;
}
})
// Group by l_orderkey, o_orderdate and o_shippriority and compute revenue sum
.groupBy(0, 2, 3)
.aggregate(Aggregations.SUM, 1);
// emit result
if (params.has("output")) {
result.writeAsCsv(params.get("output"), "\n", "|");
// execute program
env.execute("TPCH Query 3 Example");
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
result.print();
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"final",
"ParameterTool",
"params",
"=",
"ParameterTool",
".",
"fromArgs",
"(",
"args",
")",
";",
"if",
"(",
"!",
"params",
".",
"has",
"(",
"\"lineitem... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/relational/TPCHQuery3.java#L86-L177 | train | Main method to run the TPC - H benchmark. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
2345,
16381,
3406,
4747,
11498,
5244,
1027,
16381,
3406,
4747,
1012,
2013,
2906,
5620,
1006,
12098,
5620,
1007,
1025,
2065,
1006,
999,
11498,
524... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java | PojoSerializer.snapshotConfiguration | @Override
public PojoSerializerSnapshot<T> snapshotConfiguration() {
return buildSnapshot(
clazz,
registeredClasses,
registeredSerializers,
fields,
fieldSerializers,
subclassSerializerCache);
} | java | @Override
public PojoSerializerSnapshot<T> snapshotConfiguration() {
return buildSnapshot(
clazz,
registeredClasses,
registeredSerializers,
fields,
fieldSerializers,
subclassSerializerCache);
} | [
"@",
"Override",
"public",
"PojoSerializerSnapshot",
"<",
"T",
">",
"snapshotConfiguration",
"(",
")",
"{",
"return",
"buildSnapshot",
"(",
"clazz",
",",
"registeredClasses",
",",
"registeredSerializers",
",",
"fields",
",",
"fieldSerializers",
",",
"subclassSerialize... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java#L577-L586 | train | Creates a snapshot of the configuration of the object. | [
30522,
1030,
2058,
15637,
2270,
13433,
19929,
11610,
28863,
2015,
2532,
4523,
12326,
1026,
1056,
1028,
20057,
12326,
8663,
8873,
27390,
3370,
1006,
1007,
1063,
2709,
16473,
2532,
4523,
12326,
1006,
18856,
10936,
2480,
1010,
5068,
26266,
2229,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/sampling/BernoulliSampler.java | BernoulliSampler.sample | @Override
public Iterator<T> sample(final Iterator<T> input) {
if (fraction == 0) {
return emptyIterable;
}
return new SampledIterator<T>() {
T current = null;
@Override
public boolean hasNext() {
if (current == null) {
current = getNextSampledElement();
}
return current != null;
}
@Override
public T next() {
if (current == null) {
return getNextSampledElement();
} else {
T result = current;
current = null;
return result;
}
}
private T getNextSampledElement() {
if (fraction <= THRESHOLD) {
double rand = random.nextDouble();
double u = Math.max(rand, EPSILON);
int gap = (int) (Math.log(u) / Math.log(1 - fraction));
int elementCount = 0;
if (input.hasNext()) {
T element = input.next();
while (input.hasNext() && elementCount < gap) {
element = input.next();
elementCount++;
}
if (elementCount < gap) {
return null;
} else {
return element;
}
} else {
return null;
}
} else {
while (input.hasNext()) {
T element = input.next();
if (random.nextDouble() <= fraction) {
return element;
}
}
return null;
}
}
};
} | java | @Override
public Iterator<T> sample(final Iterator<T> input) {
if (fraction == 0) {
return emptyIterable;
}
return new SampledIterator<T>() {
T current = null;
@Override
public boolean hasNext() {
if (current == null) {
current = getNextSampledElement();
}
return current != null;
}
@Override
public T next() {
if (current == null) {
return getNextSampledElement();
} else {
T result = current;
current = null;
return result;
}
}
private T getNextSampledElement() {
if (fraction <= THRESHOLD) {
double rand = random.nextDouble();
double u = Math.max(rand, EPSILON);
int gap = (int) (Math.log(u) / Math.log(1 - fraction));
int elementCount = 0;
if (input.hasNext()) {
T element = input.next();
while (input.hasNext() && elementCount < gap) {
element = input.next();
elementCount++;
}
if (elementCount < gap) {
return null;
} else {
return element;
}
} else {
return null;
}
} else {
while (input.hasNext()) {
T element = input.next();
if (random.nextDouble() <= fraction) {
return element;
}
}
return null;
}
}
};
} | [
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"sample",
"(",
"final",
"Iterator",
"<",
"T",
">",
"input",
")",
"{",
"if",
"(",
"fraction",
"==",
"0",
")",
"{",
"return",
"emptyIterable",
";",
"}",
"return",
"new",
"SampledIterator",
"<",
"T",
... | Sample the input elements, for each input element, take a Bernoulli trail for sampling.
@param input Elements to be sampled.
@return The sampled result which is lazy computed upon input elements. | [
"Sample",
"the",
"input",
"elements",
"for",
"each",
"input",
"element",
"take",
"a",
"Bernoulli",
"trail",
"for",
"sampling",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/sampling/BernoulliSampler.java#L82-L144 | train | Sample an iterator of elements from the input. | [
30522,
1030,
2058,
15637,
2270,
2009,
6906,
4263,
1026,
1056,
1028,
7099,
1006,
2345,
2009,
6906,
4263,
1026,
1056,
1028,
7953,
1007,
1063,
2065,
1006,
12884,
1027,
1027,
1014,
1007,
1063,
2709,
4064,
21646,
3085,
1025,
1065,
2709,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java | KeyedStream.timeWindow | public WindowedStream<T, KEY, TimeWindow> timeWindow(Time size) {
if (environment.getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime) {
return window(TumblingProcessingTimeWindows.of(size));
} else {
return window(TumblingEventTimeWindows.of(size));
}
} | java | public WindowedStream<T, KEY, TimeWindow> timeWindow(Time size) {
if (environment.getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime) {
return window(TumblingProcessingTimeWindows.of(size));
} else {
return window(TumblingEventTimeWindows.of(size));
}
} | [
"public",
"WindowedStream",
"<",
"T",
",",
"KEY",
",",
"TimeWindow",
">",
"timeWindow",
"(",
"Time",
"size",
")",
"{",
"if",
"(",
"environment",
".",
"getStreamTimeCharacteristic",
"(",
")",
"==",
"TimeCharacteristic",
".",
"ProcessingTime",
")",
"{",
"return"... | Windows this {@code KeyedStream} into tumbling time windows.
<p>This is a shortcut for either {@code .window(TumblingEventTimeWindows.of(size))} or
{@code .window(TumblingProcessingTimeWindows.of(size))} depending on the time characteristic
set using
{@link org.apache.flink.streaming.api.environment.StreamExecutionEnvironment#setStreamTimeCharacteristic(org.apache.flink.streaming.api.TimeCharacteristic)}
@param size The size of the window. | [
"Windows",
"this",
"{",
"@code",
"KeyedStream",
"}",
"into",
"tumbling",
"time",
"windows",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java#L611-L617 | train | Create a time window stream. | [
30522,
2270,
3332,
2098,
21422,
1026,
1056,
1010,
3145,
1010,
2051,
11101,
5004,
1028,
2051,
11101,
5004,
1006,
2051,
2946,
1007,
1063,
2065,
1006,
4044,
1012,
4152,
25379,
7292,
7507,
22648,
3334,
6553,
1006,
1007,
1027,
1027,
2051,
7507,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/jdbc/DataSourceInitializer.java | DataSourceInitializer.initSchema | public void initSchema() {
List<Resource> scripts = getScripts("spring.datasource.data",
this.properties.getData(), "data");
if (!scripts.isEmpty()) {
if (!isEnabled()) {
logger.debug("Initialization disabled (not running data scripts)");
return;
}
String username = this.properties.getDataUsername();
String password = this.properties.getDataPassword();
runScripts(scripts, username, password);
}
} | java | public void initSchema() {
List<Resource> scripts = getScripts("spring.datasource.data",
this.properties.getData(), "data");
if (!scripts.isEmpty()) {
if (!isEnabled()) {
logger.debug("Initialization disabled (not running data scripts)");
return;
}
String username = this.properties.getDataUsername();
String password = this.properties.getDataPassword();
runScripts(scripts, username, password);
}
} | [
"public",
"void",
"initSchema",
"(",
")",
"{",
"List",
"<",
"Resource",
">",
"scripts",
"=",
"getScripts",
"(",
"\"spring.datasource.data\"",
",",
"this",
".",
"properties",
".",
"getData",
"(",
")",
",",
"\"data\"",
")",
";",
"if",
"(",
"!",
"scripts",
... | Initialize the schema if necessary.
@see DataSourceProperties#getData() | [
"Initialize",
"the",
"schema",
"if",
"necessary",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java#L113-L125 | train | Initialize the schema. | [
30522,
2270,
11675,
1999,
12762,
5403,
2863,
1006,
1007,
1063,
2862,
1026,
7692,
1028,
14546,
1027,
4152,
23235,
2015,
1006,
1000,
3500,
1012,
2951,
6499,
3126,
3401,
1012,
2951,
1000,
1010,
2023,
1012,
5144,
1012,
2131,
2850,
2696,
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/io/IoUtil.java | IoUtil.copy | public static long copy(InputStream in, OutputStream out, int bufferSize) throws IORuntimeException {
return copy(in, out, bufferSize, null);
} | java | public static long copy(InputStream in, OutputStream out, int bufferSize) throws IORuntimeException {
return copy(in, out, bufferSize, null);
} | [
"public",
"static",
"long",
"copy",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
",",
"int",
"bufferSize",
")",
"throws",
"IORuntimeException",
"{",
"return",
"copy",
"(",
"in",
",",
"out",
",",
"bufferSize",
",",
"null",
")",
";",
"}"
] | 拷贝流
@param in 输入流
@param out 输出流
@param bufferSize 缓存大小
@return 传输的byte数
@throws IORuntimeException IO异常 | [
"拷贝流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L146-L148 | train | Copies the contents of the input stream to the output stream using the default encoding. | [
30522,
2270,
10763,
2146,
6100,
1006,
20407,
25379,
1999,
1010,
27852,
25379,
2041,
1010,
20014,
17698,
5332,
4371,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
6100,
1006,
1999,
1010,
2041,
1010,
17698,
5332,
4371,
1010,
19701,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/CharsetUtil.java | CharsetUtil.charset | public static Charset charset(String charsetName) throws UnsupportedCharsetException{
return StrUtil.isBlank(charsetName) ? Charset.defaultCharset() : Charset.forName(charsetName);
} | java | public static Charset charset(String charsetName) throws UnsupportedCharsetException{
return StrUtil.isBlank(charsetName) ? Charset.defaultCharset() : Charset.forName(charsetName);
} | [
"public",
"static",
"Charset",
"charset",
"(",
"String",
"charsetName",
")",
"throws",
"UnsupportedCharsetException",
"{",
"return",
"StrUtil",
".",
"isBlank",
"(",
"charsetName",
")",
"?",
"Charset",
".",
"defaultCharset",
"(",
")",
":",
"Charset",
".",
"forNam... | 转换为Charset对象
@param charsetName 字符集,为空则返回默认字符集
@return Charset
@throws UnsupportedCharsetException 编码不支持 | [
"转换为Charset对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/CharsetUtil.java#L37-L39 | train | Returns the charset for the given name. | [
30522,
2270,
10763,
25869,
13462,
25869,
13462,
1006,
5164,
25869,
13462,
18442,
1007,
11618,
4895,
6342,
9397,
15613,
7507,
22573,
2618,
2595,
24422,
1063,
2709,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
25869,
13462,
18442,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | client/src/main/java/com/networknt/client/oauth/OauthHelper.java | OauthHelper.populateCCToken | public static Result<Jwt> populateCCToken(final Jwt jwt) {
boolean isInRenewWindow = jwt.getExpire() - System.currentTimeMillis() < jwt.getTokenRenewBeforeExpired();
logger.trace("isInRenewWindow = " + isInRenewWindow);
//if not in renew window, return the current jwt.
if(!isInRenewWindow) { return Success.of(jwt); }
//the same jwt shouldn't be renew at the same time. different jwt shouldn't affect each other's renew activity.
synchronized (jwt) {
//if token expired, try to renew synchronously
if(jwt.getExpire() <= System.currentTimeMillis()) {
Result<Jwt> result = renewCCTokenSync(jwt);
if(logger.isTraceEnabled()) logger.trace("Check secondary token is done!");
return result;
} else {
//otherwise renew token silently
renewCCTokenAsync(jwt);
if(logger.isTraceEnabled()) logger.trace("Check secondary token is done!");
return Success.of(jwt);
}
}
} | java | public static Result<Jwt> populateCCToken(final Jwt jwt) {
boolean isInRenewWindow = jwt.getExpire() - System.currentTimeMillis() < jwt.getTokenRenewBeforeExpired();
logger.trace("isInRenewWindow = " + isInRenewWindow);
//if not in renew window, return the current jwt.
if(!isInRenewWindow) { return Success.of(jwt); }
//the same jwt shouldn't be renew at the same time. different jwt shouldn't affect each other's renew activity.
synchronized (jwt) {
//if token expired, try to renew synchronously
if(jwt.getExpire() <= System.currentTimeMillis()) {
Result<Jwt> result = renewCCTokenSync(jwt);
if(logger.isTraceEnabled()) logger.trace("Check secondary token is done!");
return result;
} else {
//otherwise renew token silently
renewCCTokenAsync(jwt);
if(logger.isTraceEnabled()) logger.trace("Check secondary token is done!");
return Success.of(jwt);
}
}
} | [
"public",
"static",
"Result",
"<",
"Jwt",
">",
"populateCCToken",
"(",
"final",
"Jwt",
"jwt",
")",
"{",
"boolean",
"isInRenewWindow",
"=",
"jwt",
".",
"getExpire",
"(",
")",
"-",
"System",
".",
"currentTimeMillis",
"(",
")",
"<",
"jwt",
".",
"getTokenRenew... | populate/renew jwt info to the give jwt object.
based on the expire time of the jwt, to determine if need to renew jwt or not.
to avoid modifying class member which will case thread-safe problem, move this method from Http2Client to this helper class.
@param jwt the given jwt needs to renew or populate
@return When success return Jwt; When fail return Status. | [
"populate",
"/",
"renew",
"jwt",
"info",
"to",
"the",
"give",
"jwt",
"object",
".",
"based",
"on",
"the",
"expire",
"time",
"of",
"the",
"jwt",
"to",
"determine",
"if",
"need",
"to",
"renew",
"jwt",
"or",
"not",
".",
"to",
"avoid",
"modifying",
"class"... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/OauthHelper.java#L565-L584 | train | Populate a jwt with a token. | [
30522,
2270,
10763,
2765,
1026,
1046,
26677,
1028,
3769,
9869,
9468,
18715,
2368,
1006,
2345,
1046,
26677,
1046,
26677,
1007,
1063,
22017,
20898,
2003,
2378,
7389,
7974,
11101,
5004,
1027,
1046,
26677,
1012,
2131,
10288,
20781,
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... |
alibaba/canal | client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/monitor/remote/DbRemoteConfigLoader.java | DbRemoteConfigLoader.destroy | @Override
public void destroy() {
executor.shutdownNow();
try {
dataSource.close();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
} | java | @Override
public void destroy() {
executor.shutdownNow();
try {
dataSource.close();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
} | [
"@",
"Override",
"public",
"void",
"destroy",
"(",
")",
"{",
"executor",
".",
"shutdownNow",
"(",
")",
";",
"try",
"{",
"dataSource",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"e",
".",... | 销毁 | [
"销毁"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/monitor/remote/DbRemoteConfigLoader.java#L242-L250 | train | Destroy the managed data source. | [
30522,
1030,
2058,
15637,
2270,
11675,
6033,
1006,
1007,
1063,
4654,
8586,
16161,
2099,
1012,
3844,
7698,
19779,
1006,
1007,
1025,
3046,
1063,
2951,
6499,
3126,
3401,
1012,
30524,
2131,
7834,
3736,
3351,
1006,
1007,
1010,
1041,
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-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java | MetricConfig.getBoolean | public boolean getBoolean(String key, boolean defaultValue) {
String argument = getProperty(key, null);
return argument == null
? defaultValue
: Boolean.parseBoolean(argument);
} | java | public boolean getBoolean(String key, boolean defaultValue) {
String argument = getProperty(key, null);
return argument == null
? defaultValue
: Boolean.parseBoolean(argument);
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"argument",
"=",
"getProperty",
"(",
"key",
",",
"null",
")",
";",
"return",
"argument",
"==",
"null",
"?",
"defaultValue",
":",
"Boolean",
".",
"p... | Searches for the property with the specified key in this property list.
If the key is not found in this property list, the default property list,
and its defaults, recursively, are then checked. The method returns the
default value argument if the property is not found.
@param key the hashtable key.
@param defaultValue a default value.
@return the value in this property list with the specified key value parsed as a boolean. | [
"Searches",
"for",
"the",
"property",
"with",
"the",
"specified",
"key",
"in",
"this",
"property",
"list",
".",
"If",
"the",
"key",
"is",
"not",
"found",
"in",
"this",
"property",
"list",
"the",
"default",
"property",
"list",
"and",
"its",
"defaults",
"rec... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java#L110-L115 | train | Returns the value of the property as a boolean. | [
30522,
2270,
22017,
20898,
2131,
5092,
9890,
2319,
1006,
5164,
3145,
1010,
22017,
20898,
12398,
10175,
5657,
1007,
1063,
5164,
6685,
1027,
2131,
21572,
4842,
3723,
1006,
3145,
1010,
19701,
1007,
1025,
2709,
6685,
1027,
1027,
19701,
1029,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/StreamingFileSink.java | StreamingFileSink.forRowFormat | public static <IN> StreamingFileSink.RowFormatBuilder<IN, String> forRowFormat(
final Path basePath, final Encoder<IN> encoder) {
return new StreamingFileSink.RowFormatBuilder<>(basePath, encoder, new DateTimeBucketAssigner<>());
} | java | public static <IN> StreamingFileSink.RowFormatBuilder<IN, String> forRowFormat(
final Path basePath, final Encoder<IN> encoder) {
return new StreamingFileSink.RowFormatBuilder<>(basePath, encoder, new DateTimeBucketAssigner<>());
} | [
"public",
"static",
"<",
"IN",
">",
"StreamingFileSink",
".",
"RowFormatBuilder",
"<",
"IN",
",",
"String",
">",
"forRowFormat",
"(",
"final",
"Path",
"basePath",
",",
"final",
"Encoder",
"<",
"IN",
">",
"encoder",
")",
"{",
"return",
"new",
"StreamingFileSi... | Creates the builder for a {@code StreamingFileSink} with row-encoding format.
@param basePath the base path where all the buckets are going to be created as sub-directories.
@param encoder the {@link Encoder} to be used when writing elements in the buckets.
@param <IN> the type of incoming elements
@return The builder where the remaining of the configuration parameters for the sink can be configured.
In order to instantiate the sink, call {@link RowFormatBuilder#build()} after specifying the desired parameters. | [
"Creates",
"the",
"builder",
"for",
"a",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/StreamingFileSink.java#L152-L155 | train | Create a builder for a row format. | [
30522,
2270,
10763,
1026,
1999,
1028,
11058,
8873,
4244,
19839,
1012,
5216,
14192,
4017,
8569,
23891,
2099,
1026,
1999,
1010,
5164,
1028,
2005,
10524,
14192,
4017,
1006,
2345,
4130,
2918,
15069,
1010,
2345,
4372,
16044,
2099,
1026,
1999,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/BooleanUtil.java | BooleanUtil.xor | public static Boolean xor(Boolean... array) {
if (ArrayUtil.isEmpty(array)) {
throw new IllegalArgumentException("The Array must not be empty !");
}
final boolean[] primitive = Convert.convert(boolean[].class, array);
return Boolean.valueOf(xor(primitive));
} | java | public static Boolean xor(Boolean... array) {
if (ArrayUtil.isEmpty(array)) {
throw new IllegalArgumentException("The Array must not be empty !");
}
final boolean[] primitive = Convert.convert(boolean[].class, array);
return Boolean.valueOf(xor(primitive));
} | [
"public",
"static",
"Boolean",
"xor",
"(",
"Boolean",
"...",
"array",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"array",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The Array must not be empty !\"",
")",
";",
"}",
"final",
... | 对Boolean数组取异或
<pre>
BooleanUtil.xor(new Boolean[] { Boolean.TRUE, Boolean.TRUE }) = Boolean.FALSE
BooleanUtil.xor(new Boolean[] { Boolean.FALSE, Boolean.FALSE }) = Boolean.FALSE
BooleanUtil.xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE }) = Boolean.TRUE
</pre>
@param array {@code Boolean} 数组
@return 异或为真取{@code true} | [
"对Boolean数组取异或"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/BooleanUtil.java#L429-L435 | train | XOR two boolean arrays. | [
30522,
2270,
10763,
22017,
20898,
1060,
2953,
1006,
22017,
20898,
1012,
1012,
1012,
9140,
1007,
1063,
2065,
1006,
9140,
21823,
2140,
1012,
2003,
6633,
13876,
2100,
1006,
9140,
1007,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java | KeyMap.getLongestChainLength | int getLongestChainLength() {
int maxLen = 0;
for (Entry<?, ?> entry : table) {
int thisLen = 0;
while (entry != null) {
thisLen++;
entry = entry.next;
}
maxLen = Math.max(maxLen, thisLen);
}
return maxLen;
} | java | int getLongestChainLength() {
int maxLen = 0;
for (Entry<?, ?> entry : table) {
int thisLen = 0;
while (entry != null) {
thisLen++;
entry = entry.next;
}
maxLen = Math.max(maxLen, thisLen);
}
return maxLen;
} | [
"int",
"getLongestChainLength",
"(",
")",
"{",
"int",
"maxLen",
"=",
"0",
";",
"for",
"(",
"Entry",
"<",
"?",
",",
"?",
">",
"entry",
":",
"table",
")",
"{",
"int",
"thisLen",
"=",
"0",
";",
"while",
"(",
"entry",
"!=",
"null",
")",
"{",
"thisLen... | For testing only: Gets the length of the longest overflow chain.
This method has linear complexity.
@return The length of the longest overflow chain. | [
"For",
"testing",
"only",
":",
"Gets",
"the",
"length",
"of",
"the",
"longest",
"overflow",
"chain",
".",
"This",
"method",
"has",
"linear",
"complexity",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/KeyMap.java#L435-L448 | train | Returns the length of the longest chain. | [
30522,
20014,
2131,
10052,
4355,
24925,
20554,
13159,
2705,
1006,
1007,
1063,
20014,
4098,
7770,
1027,
1014,
1025,
2005,
1006,
4443,
1026,
1029,
1010,
1029,
1028,
4443,
1024,
2795,
1007,
1063,
20014,
2023,
7770,
1027,
1014,
1025,
2096,
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/SM2.java | SM2.sign | public byte[] sign(byte[] data, byte[] id) {
lock.lock();
final SM2Signer signer = getSigner();
try {
CipherParameters param = new ParametersWithRandom(getCipherParameters(KeyType.PrivateKey));
if (id != null) {
param = new ParametersWithID(param, id);
}
signer.init(true, param);
signer.update(data, 0, data.length);
return signer.generateSignature();
} catch (Exception e) {
throw new CryptoException(e);
} finally {
lock.unlock();
}
} | java | public byte[] sign(byte[] data, byte[] id) {
lock.lock();
final SM2Signer signer = getSigner();
try {
CipherParameters param = new ParametersWithRandom(getCipherParameters(KeyType.PrivateKey));
if (id != null) {
param = new ParametersWithID(param, id);
}
signer.init(true, param);
signer.update(data, 0, data.length);
return signer.generateSignature();
} catch (Exception e) {
throw new CryptoException(e);
} finally {
lock.unlock();
}
} | [
"public",
"byte",
"[",
"]",
"sign",
"(",
"byte",
"[",
"]",
"data",
",",
"byte",
"[",
"]",
"id",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"final",
"SM2Signer",
"signer",
"=",
"getSigner",
"(",
")",
";",
"try",
"{",
"CipherParameters",
"param",
... | 用私钥对信息生成数字签名
@param data 加密数据
@param id 可以为null,若为null,则默认withId为字节数组:"1234567812345678".getBytes()
@return 签名 | [
"用私钥对信息生成数字签名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2.java#L182-L198 | train | Creates a signature using the specified private key. | [
30522,
2270,
24880,
1031,
1033,
3696,
1006,
24880,
1031,
1033,
2951,
1010,
24880,
1031,
1033,
8909,
1007,
1063,
5843,
1012,
5843,
1006,
1007,
1025,
2345,
15488,
2475,
5332,
10177,
2099,
3696,
2121,
1027,
4152,
23773,
2121,
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... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/MultipartFormData.java | MultipartFormData.getFile | public UploadFile getFile(String paramName) {
UploadFile[] values = getFiles(paramName);
if ((values != null) && (values.length > 0)) {
return values[0];
}
return null;
} | java | public UploadFile getFile(String paramName) {
UploadFile[] values = getFiles(paramName);
if ((values != null) && (values.length > 0)) {
return values[0];
}
return null;
} | [
"public",
"UploadFile",
"getFile",
"(",
"String",
"paramName",
")",
"{",
"UploadFile",
"[",
"]",
"values",
"=",
"getFiles",
"(",
"paramName",
")",
";",
"if",
"(",
"(",
"values",
"!=",
"null",
")",
"&&",
"(",
"values",
".",
"length",
">",
"0",
")",
")... | 获取上传的文件
@param paramName 文件参数名称
@return 上传的文件, 如果无为null | [
"获取上传的文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/MultipartFormData.java#L167-L173 | train | Gets the value of the
UploadFile parameter with the given name. | [
30522,
2270,
2039,
11066,
8873,
2571,
2131,
8873,
2571,
1006,
5164,
11498,
2213,
18442,
1007,
1063,
2039,
11066,
8873,
2571,
1031,
1033,
5300,
1027,
2131,
8873,
4244,
1006,
11498,
2213,
18442,
1007,
1025,
2065,
1006,
1006,
5300,
999,
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/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/array/ByteArrayMethods.java | ByteArrayMethods.nextPowerOf2 | public static long nextPowerOf2(long num) {
final long highBit = Long.highestOneBit(num);
return (highBit == num) ? num : highBit << 1;
} | java | public static long nextPowerOf2(long num) {
final long highBit = Long.highestOneBit(num);
return (highBit == num) ? num : highBit << 1;
} | [
"public",
"static",
"long",
"nextPowerOf2",
"(",
"long",
"num",
")",
"{",
"final",
"long",
"highBit",
"=",
"Long",
".",
"highestOneBit",
"(",
"num",
")",
";",
"return",
"(",
"highBit",
"==",
"num",
")",
"?",
"num",
":",
"highBit",
"<<",
"1",
";",
"}"... | Returns the next number greater or equal num that is power of 2. | [
"Returns",
"the",
"next",
"number",
"greater",
"or",
"equal",
"num",
"that",
"is",
"power",
"of",
"2",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/array/ByteArrayMethods.java#L29-L32 | train | Returns the next power of 2 of the given number. | [
30522,
2270,
10763,
2146,
2279,
11452,
11253,
2475,
1006,
2146,
16371,
2213,
1007,
1063,
2345,
2146,
2152,
16313,
1027,
2146,
1012,
3284,
5643,
16313,
1006,
16371,
2213,
1007,
1025,
2709,
1006,
2152,
16313,
1027,
1027,
16371,
2213,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.isAllAssignableFrom | public static boolean isAllAssignableFrom(Class<?>[] types1, Class<?>[] types2) {
if (ArrayUtil.isEmpty(types1) && ArrayUtil.isEmpty(types2)) {
return true;
}
if (null == types1 || null == types2) {
// 任何一个为null不相等(之前已判断两个都为null的情况)
return false;
}
if (types1.length != types2.length) {
return false;
}
Class<?> type1;
Class<?> type2;
for (int i = 0; i < types1.length; i++) {
type1 = types1[i];
type2 = types2[i];
if (isBasicType(type1) && isBasicType(type2)) {
// 原始类型和包装类型存在不一致情况
if (BasicType.unWrap(type1) != BasicType.unWrap(type2)) {
return false;
}
} else if (false == type1.isAssignableFrom(type2)) {
return false;
}
}
return true;
} | java | public static boolean isAllAssignableFrom(Class<?>[] types1, Class<?>[] types2) {
if (ArrayUtil.isEmpty(types1) && ArrayUtil.isEmpty(types2)) {
return true;
}
if (null == types1 || null == types2) {
// 任何一个为null不相等(之前已判断两个都为null的情况)
return false;
}
if (types1.length != types2.length) {
return false;
}
Class<?> type1;
Class<?> type2;
for (int i = 0; i < types1.length; i++) {
type1 = types1[i];
type2 = types2[i];
if (isBasicType(type1) && isBasicType(type2)) {
// 原始类型和包装类型存在不一致情况
if (BasicType.unWrap(type1) != BasicType.unWrap(type2)) {
return false;
}
} else if (false == type1.isAssignableFrom(type2)) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isAllAssignableFrom",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"types1",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"types2",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"types1",
")",
"&&",
"ArrayUtil",
".",
"isE... | 比较判断types1和types2两组类,如果types1中所有的类都与types2对应位置的类相同,或者是其父类或接口,则返回<code>true</code>
@param types1 类组1
@param types2 类组2
@return 是否相同、父类或接口 | [
"比较判断types1和types2两组类,如果types1中所有的类都与types2对应位置的类相同,或者是其父类或接口,则返回<code",
">",
"true<",
"/",
"code",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L554-L581 | train | Checks if all the types in the given array are assignable from all the types in the given array. | [
30522,
2270,
10763,
22017,
20898,
18061,
25816,
5332,
16989,
3468,
19699,
5358,
1006,
2465,
1026,
1029,
1028,
1031,
1033,
4127,
2487,
1010,
2465,
1026,
1029,
1028,
1031,
1033,
4127,
2475,
1007,
1063,
2065,
1006,
9140,
21823,
2140,
1012,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/qrcode/QrCodeUtil.java | QrCodeUtil.generate | public static File generate(String content, int width, int height, File targetFile) {
final BufferedImage image = generate(content, width, height);
ImgUtil.write(image, targetFile);
return targetFile;
} | java | public static File generate(String content, int width, int height, File targetFile) {
final BufferedImage image = generate(content, width, height);
ImgUtil.write(image, targetFile);
return targetFile;
} | [
"public",
"static",
"File",
"generate",
"(",
"String",
"content",
",",
"int",
"width",
",",
"int",
"height",
",",
"File",
"targetFile",
")",
"{",
"final",
"BufferedImage",
"image",
"=",
"generate",
"(",
"content",
",",
"width",
",",
"height",
")",
";",
"... | 生成二维码到文件,二维码图片格式取决于文件的扩展名
@param content 文本内容
@param width 宽度
@param height 高度
@param targetFile 目标文件,扩展名决定输出格式
@return 目标文件 | [
"生成二维码到文件,二维码图片格式取决于文件的扩展名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L76-L80 | train | Generates a image of the specified content and writes it to the specified file. | [
30522,
2270,
10763,
5371,
9699,
1006,
5164,
4180,
1010,
20014,
9381,
1010,
20014,
4578,
1010,
5371,
4539,
8873,
2571,
1007,
1063,
2345,
17698,
2098,
9581,
3351,
3746,
1027,
9699,
1006,
4180,
1010,
9381,
1010,
4578,
1007,
1025,
10047,
27920,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java | ByteToMessageDecoder.decodeRemovalReentryProtection | final void decodeRemovalReentryProtection(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
throws Exception {
decodeState = STATE_CALLING_CHILD_DECODE;
try {
decode(ctx, in, out);
} finally {
boolean removePending = decodeState == STATE_HANDLER_REMOVED_PENDING;
decodeState = STATE_INIT;
if (removePending) {
handlerRemoved(ctx);
}
}
} | java | final void decodeRemovalReentryProtection(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
throws Exception {
decodeState = STATE_CALLING_CHILD_DECODE;
try {
decode(ctx, in, out);
} finally {
boolean removePending = decodeState == STATE_HANDLER_REMOVED_PENDING;
decodeState = STATE_INIT;
if (removePending) {
handlerRemoved(ctx);
}
}
} | [
"final",
"void",
"decodeRemovalReentryProtection",
"(",
"ChannelHandlerContext",
"ctx",
",",
"ByteBuf",
"in",
",",
"List",
"<",
"Object",
">",
"out",
")",
"throws",
"Exception",
"{",
"decodeState",
"=",
"STATE_CALLING_CHILD_DECODE",
";",
"try",
"{",
"decode",
"(",... | Decode the from one {@link ByteBuf} to an other. This method will be called till either the input
{@link ByteBuf} has nothing to read when return from this method or till nothing was read from the input
{@link ByteBuf}.
@param ctx the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to
@param in the {@link ByteBuf} from which to read data
@param out the {@link List} to which decoded messages should be added
@throws Exception is thrown if an error occurs | [
"Decode",
"the",
"from",
"one",
"{",
"@link",
"ByteBuf",
"}",
"to",
"an",
"other",
".",
"This",
"method",
"will",
"be",
"called",
"till",
"either",
"the",
"input",
"{",
"@link",
"ByteBuf",
"}",
"has",
"nothing",
"to",
"read",
"when",
"return",
"from",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java#L498-L510 | train | Decode removal protection. | [
30522,
2345,
11675,
21933,
4063,
6633,
7103,
20974,
12129,
11129,
21572,
26557,
3508,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
24880,
8569,
2546,
1999,
1010,
2862,
1026,
4874,
1028,
2041,
1007,
11618,
6453,
1063,
21933,
6155,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/algorithm/MaxHeap.java | MaxHeap.toList | public List<E> toList()
{
ArrayList<E> list = new ArrayList<E>(queue.size());
while (!queue.isEmpty())
{
list.add(0, queue.poll());
}
return list;
} | java | public List<E> toList()
{
ArrayList<E> list = new ArrayList<E>(queue.size());
while (!queue.isEmpty())
{
list.add(0, queue.poll());
}
return list;
} | [
"public",
"List",
"<",
"E",
">",
"toList",
"(",
")",
"{",
"ArrayList",
"<",
"E",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"E",
">",
"(",
"queue",
".",
"size",
"(",
")",
")",
";",
"while",
"(",
"!",
"queue",
".",
"isEmpty",
"(",
")",
")",
"{... | 转为有序列表,自毁性操作
@return | [
"转为有序列表,自毁性操作"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/MaxHeap.java#L88-L97 | train | Get a list of all the tokens in this sequence. | [
30522,
2270,
2862,
1026,
1041,
1028,
2000,
9863,
1006,
1007,
1063,
9140,
9863,
1026,
1041,
1028,
2862,
1027,
2047,
9140,
9863,
1026,
1041,
1028,
1006,
24240,
1012,
2946,
1006,
1007,
1007,
1025,
2096,
1006,
999,
24240,
1012,
2003,
6633,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/handler/BeanListHandler.java | BeanListHandler.create | public static <E> BeanListHandler<E> create(Class<E> beanType) {
return new BeanListHandler<E>(beanType);
} | java | public static <E> BeanListHandler<E> create(Class<E> beanType) {
return new BeanListHandler<E>(beanType);
} | [
"public",
"static",
"<",
"E",
">",
"BeanListHandler",
"<",
"E",
">",
"create",
"(",
"Class",
"<",
"E",
">",
"beanType",
")",
"{",
"return",
"new",
"BeanListHandler",
"<",
"E",
">",
"(",
"beanType",
")",
";",
"}"
] | 创建一个 BeanListHandler对象
@param <E> 处理对象类型
@param beanType Bean类型
@return BeanListHandler对象 | [
"创建一个",
"BeanListHandler对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/handler/BeanListHandler.java#L26-L28 | train | Creates a new instance of the BeanListHandler class. | [
30522,
2270,
10763,
1026,
1041,
1028,
14068,
9863,
11774,
3917,
1026,
1041,
1028,
3443,
1006,
2465,
1026,
1041,
1028,
14068,
13874,
1007,
1063,
2709,
2047,
14068,
9863,
11774,
3917,
1026,
1041,
1028,
1006,
14068,
13874,
1007,
1025,
1065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java | Bzip2BitWriter.writeUnary | void writeUnary(ByteBuf out, int value) {
if (value < 0) {
throw new IllegalArgumentException("value: " + value + " (expected 0 or more)");
}
while (value-- > 0) {
writeBoolean(out, true);
}
writeBoolean(out, false);
} | java | void writeUnary(ByteBuf out, int value) {
if (value < 0) {
throw new IllegalArgumentException("value: " + value + " (expected 0 or more)");
}
while (value-- > 0) {
writeBoolean(out, true);
}
writeBoolean(out, false);
} | [
"void",
"writeUnary",
"(",
"ByteBuf",
"out",
",",
"int",
"value",
")",
"{",
"if",
"(",
"value",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"value: \"",
"+",
"value",
"+",
"\" (expected 0 or more)\"",
")",
";",
"}",
"while",
"(",... | Writes a zero-terminated unary number to the output {@link ByteBuf}.
Example of the output for value = 6: {@code 1111110}
@param value The number of {@code 1} to write | [
"Writes",
"a",
"zero",
"-",
"terminated",
"unary",
"number",
"to",
"the",
"output",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java#L80-L88 | train | Write a single unary integer to the given byte buffer. | [
30522,
11675,
4339,
9521,
2854,
1006,
24880,
8569,
2546,
2041,
1010,
20014,
3643,
1007,
1063,
2065,
1006,
3643,
1026,
1014,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
3643,
1024,
1000,
1009,
3643,
1009,
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... |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java | StatementExecutor.init | public void init(final SQLRouteResult routeResult) throws SQLException {
setSqlStatement(routeResult.getSqlStatement());
getExecuteGroups().addAll(obtainExecuteGroups(routeResult.getRouteUnits()));
cacheStatements();
} | java | public void init(final SQLRouteResult routeResult) throws SQLException {
setSqlStatement(routeResult.getSqlStatement());
getExecuteGroups().addAll(obtainExecuteGroups(routeResult.getRouteUnits()));
cacheStatements();
} | [
"public",
"void",
"init",
"(",
"final",
"SQLRouteResult",
"routeResult",
")",
"throws",
"SQLException",
"{",
"setSqlStatement",
"(",
"routeResult",
".",
"getSqlStatement",
"(",
")",
")",
";",
"getExecuteGroups",
"(",
")",
".",
"addAll",
"(",
"obtainExecuteGroups",... | Initialize executor.
@param routeResult route result
@throws SQLException SQL exception | [
"Initialize",
"executor",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/StatementExecutor.java#L62-L66 | train | Initialize the class. | [
30522,
2270,
11675,
1999,
4183,
1006,
2345,
29296,
22494,
3334,
2229,
11314,
2799,
6072,
11314,
1007,
11618,
29296,
10288,
24422,
1063,
4520,
4160,
4877,
12259,
3672,
1006,
2799,
6072,
11314,
1012,
4152,
4160,
4877,
12259,
3672,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java | TaskSlotTable.freeSlot | public int freeSlot(AllocationID allocationId, Throwable cause) throws SlotNotFoundException {
checkInit();
TaskSlot taskSlot = getTaskSlot(allocationId);
if (taskSlot != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Free slot {}.", taskSlot, cause);
} else {
LOG.info("Free slot {}.", taskSlot);
}
final JobID jobId = taskSlot.getJobId();
if (taskSlot.markFree()) {
// remove the allocation id to task slot mapping
allocationIDTaskSlotMap.remove(allocationId);
// unregister a potential timeout
timerService.unregisterTimeout(allocationId);
Set<AllocationID> slots = slotsPerJob.get(jobId);
if (slots == null) {
throw new IllegalStateException("There are no more slots allocated for the job " + jobId +
". This indicates a programming bug.");
}
slots.remove(allocationId);
if (slots.isEmpty()) {
slotsPerJob.remove(jobId);
}
return taskSlot.getIndex();
} else {
// we couldn't free the task slot because it still contains task, fail the tasks
// and set the slot state to releasing so that it gets eventually freed
taskSlot.markReleasing();
Iterator<Task> taskIterator = taskSlot.getTasks();
while (taskIterator.hasNext()) {
taskIterator.next().failExternally(cause);
}
return -1;
}
} else {
throw new SlotNotFoundException(allocationId);
}
} | java | public int freeSlot(AllocationID allocationId, Throwable cause) throws SlotNotFoundException {
checkInit();
TaskSlot taskSlot = getTaskSlot(allocationId);
if (taskSlot != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Free slot {}.", taskSlot, cause);
} else {
LOG.info("Free slot {}.", taskSlot);
}
final JobID jobId = taskSlot.getJobId();
if (taskSlot.markFree()) {
// remove the allocation id to task slot mapping
allocationIDTaskSlotMap.remove(allocationId);
// unregister a potential timeout
timerService.unregisterTimeout(allocationId);
Set<AllocationID> slots = slotsPerJob.get(jobId);
if (slots == null) {
throw new IllegalStateException("There are no more slots allocated for the job " + jobId +
". This indicates a programming bug.");
}
slots.remove(allocationId);
if (slots.isEmpty()) {
slotsPerJob.remove(jobId);
}
return taskSlot.getIndex();
} else {
// we couldn't free the task slot because it still contains task, fail the tasks
// and set the slot state to releasing so that it gets eventually freed
taskSlot.markReleasing();
Iterator<Task> taskIterator = taskSlot.getTasks();
while (taskIterator.hasNext()) {
taskIterator.next().failExternally(cause);
}
return -1;
}
} else {
throw new SlotNotFoundException(allocationId);
}
} | [
"public",
"int",
"freeSlot",
"(",
"AllocationID",
"allocationId",
",",
"Throwable",
"cause",
")",
"throws",
"SlotNotFoundException",
"{",
"checkInit",
"(",
")",
";",
"TaskSlot",
"taskSlot",
"=",
"getTaskSlot",
"(",
"allocationId",
")",
";",
"if",
"(",
"taskSlot"... | Tries to free the slot. If the slot is empty it will set the state of the task slot to free
and return its index. If the slot is not empty, then it will set the state of the task slot
to releasing, fail all tasks and return -1.
@param allocationId identifying the task slot to be freed
@param cause to fail the tasks with if slot is not empty
@throws SlotNotFoundException if there is not task slot for the given allocation id
@return The freed TaskSlot. If the TaskSlot cannot be freed then null. | [
"Tries",
"to",
"free",
"the",
"slot",
".",
"If",
"the",
"slot",
"is",
"empty",
"it",
"will",
"set",
"the",
"state",
"of",
"the",
"task",
"slot",
"to",
"free",
"and",
"return",
"its",
"index",
".",
"If",
"the",
"slot",
"is",
"not",
"empty",
"then",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java#L301-L352 | train | Free the specified slot. | [
30522,
2270,
20014,
2489,
14540,
4140,
1006,
16169,
3593,
16169,
3593,
1010,
5466,
3085,
3426,
1007,
11618,
10453,
17048,
14876,
8630,
10288,
24422,
1063,
4638,
5498,
2102,
1006,
1007,
1025,
8518,
10994,
8518,
10994,
1027,
2131,
10230,
5705,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpoint.java | ConfigurationPropertiesReportEndpoint.configureObjectMapper | protected void configureObjectMapper(ObjectMapper mapper) {
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(MapperFeature.USE_STD_BEAN_NAMING, true);
mapper.setSerializationInclusion(Include.NON_NULL);
applyConfigurationPropertiesFilter(mapper);
applySerializationModifier(mapper);
} | java | protected void configureObjectMapper(ObjectMapper mapper) {
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(MapperFeature.USE_STD_BEAN_NAMING, true);
mapper.setSerializationInclusion(Include.NON_NULL);
applyConfigurationPropertiesFilter(mapper);
applySerializationModifier(mapper);
} | [
"protected",
"void",
"configureObjectMapper",
"(",
"ObjectMapper",
"mapper",
")",
"{",
"mapper",
".",
"configure",
"(",
"SerializationFeature",
".",
"FAIL_ON_EMPTY_BEANS",
",",
"false",
")",
";",
"mapper",
".",
"configure",
"(",
"MapperFeature",
".",
"USE_STD_BEAN_N... | Configure Jackson's {@link ObjectMapper} to be used to serialize the
{@link ConfigurationProperties @ConfigurationProperties} objects into a {@link Map}
structure.
@param mapper the object mapper | [
"Configure",
"Jackson",
"s",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpoint.java#L173-L179 | train | Configure the given object mapper. | [
30522,
5123,
11675,
9530,
8873,
27390,
8780,
2497,
20614,
2863,
18620,
1006,
4874,
2863,
18620,
4949,
4842,
1007,
1063,
4949,
4842,
1012,
9530,
8873,
27390,
2063,
1006,
7642,
3989,
7959,
4017,
5397,
1012,
8246,
1035,
2006,
1035,
4064,
1035,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/DualInputOperator.java | DualInputOperator.getOperatorInfo | @Override
@SuppressWarnings("unchecked")
public BinaryOperatorInformation<IN1, IN2, OUT> getOperatorInfo() {
return (BinaryOperatorInformation<IN1, IN2, OUT>) this.operatorInfo;
} | java | @Override
@SuppressWarnings("unchecked")
public BinaryOperatorInformation<IN1, IN2, OUT> getOperatorInfo() {
return (BinaryOperatorInformation<IN1, IN2, OUT>) this.operatorInfo;
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"BinaryOperatorInformation",
"<",
"IN1",
",",
"IN2",
",",
"OUT",
">",
"getOperatorInfo",
"(",
")",
"{",
"return",
"(",
"BinaryOperatorInformation",
"<",
"IN1",
",",
"IN2",
",",
"OUT... | Gets the information about the operators input/output types. | [
"Gets",
"the",
"information",
"about",
"the",
"operators",
"input",
"/",
"output",
"types",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/DualInputOperator.java#L100-L104 | train | Returns the binary operator information. | [
30522,
1030,
2058,
15637,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
12441,
25918,
8844,
2378,
14192,
3370,
1026,
1999,
2487,
1010,
1999,
2475,
1010,
2041,
1028,
2131,
25918,
8844,
2378,
14876,
1006,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/EnumUtil.java | EnumUtil.getNameFieldMap | public static Map<String, Object> getNameFieldMap(Class<? extends Enum<?>> clazz, String fieldName) {
final Enum<?>[] enums = clazz.getEnumConstants();
if (null == enums) {
return null;
}
final Map<String, Object> map = MapUtil.newHashMap(enums.length);
for (Enum<?> e : enums) {
map.put(e.name(), ReflectUtil.getFieldValue(e, fieldName));
}
return map;
} | java | public static Map<String, Object> getNameFieldMap(Class<? extends Enum<?>> clazz, String fieldName) {
final Enum<?>[] enums = clazz.getEnumConstants();
if (null == enums) {
return null;
}
final Map<String, Object> map = MapUtil.newHashMap(enums.length);
for (Enum<?> e : enums) {
map.put(e.name(), ReflectUtil.getFieldValue(e, fieldName));
}
return map;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"getNameFieldMap",
"(",
"Class",
"<",
"?",
"extends",
"Enum",
"<",
"?",
">",
">",
"clazz",
",",
"String",
"fieldName",
")",
"{",
"final",
"Enum",
"<",
"?",
">",
"[",
"]",
"enums",
"=",
"... | 获得枚举名对应指定字段值的Map<br>
键为枚举名,值为字段值
@param clazz 枚举类
@param fieldName 字段名,最终调用getXXX方法
@return 枚举名对应指定字段值的Map | [
"获得枚举名对应指定字段值的Map<br",
">",
"键为枚举名,值为字段值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/EnumUtil.java#L186-L196 | train | Gets the name field map. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
4874,
1028,
2131,
18442,
3790,
2863,
2361,
1006,
2465,
1026,
1029,
8908,
4372,
2819,
1026,
1029,
1028,
1028,
18856,
10936,
2480,
1010,
5164,
2492,
18442,
1007,
1063,
2345,
4372,
2819,
1026,
1029,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/document/sentence/Sentence.java | Sentence.translateLabels | public Sentence translateLabels()
{
for (IWord word : wordList)
{
word.setLabel(PartOfSpeechTagDictionary.translate(word.getLabel()));
if (word instanceof CompoundWord)
{
for (Word child : ((CompoundWord) word).innerList)
{
child.setLabel(PartOfSpeechTagDictionary.translate(child.getLabel()));
}
}
}
return this;
} | java | public Sentence translateLabels()
{
for (IWord word : wordList)
{
word.setLabel(PartOfSpeechTagDictionary.translate(word.getLabel()));
if (word instanceof CompoundWord)
{
for (Word child : ((CompoundWord) word).innerList)
{
child.setLabel(PartOfSpeechTagDictionary.translate(child.getLabel()));
}
}
}
return this;
} | [
"public",
"Sentence",
"translateLabels",
"(",
")",
"{",
"for",
"(",
"IWord",
"word",
":",
"wordList",
")",
"{",
"word",
".",
"setLabel",
"(",
"PartOfSpeechTagDictionary",
".",
"translate",
"(",
"word",
".",
"getLabel",
"(",
")",
")",
")",
";",
"if",
"(",... | 按照 PartOfSpeechTagDictionary 指定的映射表将词语词性翻译过去
@return | [
"按照",
"PartOfSpeechTagDictionary",
"指定的映射表将词语词性翻译过去"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/document/sentence/Sentence.java#L149-L163 | train | Translate the label of the words in the sentence. | [
30522,
2270,
6251,
17637,
20470,
9050,
1006,
1007,
1063,
2005,
1006,
1045,
18351,
2773,
1024,
2773,
9863,
1007,
1063,
2773,
1012,
2275,
20470,
2884,
1006,
2112,
11253,
13102,
4402,
10143,
8490,
29201,
3258,
5649,
1012,
17637,
1006,
2773,
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-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.fromCsvReader | public static GraphCsvReader fromCsvReader(String verticesPath, String edgesPath, ExecutionEnvironment context) {
return new GraphCsvReader(verticesPath, edgesPath, context);
} | java | public static GraphCsvReader fromCsvReader(String verticesPath, String edgesPath, ExecutionEnvironment context) {
return new GraphCsvReader(verticesPath, edgesPath, context);
} | [
"public",
"static",
"GraphCsvReader",
"fromCsvReader",
"(",
"String",
"verticesPath",
",",
"String",
"edgesPath",
",",
"ExecutionEnvironment",
"context",
")",
"{",
"return",
"new",
"GraphCsvReader",
"(",
"verticesPath",
",",
"edgesPath",
",",
"context",
")",
";",
... | Creates a Graph from a CSV file of vertices and a CSV file of edges.
@param verticesPath path to a CSV file with the Vertex data.
@param edgesPath path to a CSV file with the Edge data
@param context the Flink execution environment.
@return An instance of {@link org.apache.flink.graph.GraphCsvReader},
on which calling methods to specify types of the Vertex ID, Vertex value and Edge value returns a Graph.
@see org.apache.flink.graph.GraphCsvReader#types(Class, Class, Class)
@see org.apache.flink.graph.GraphCsvReader#vertexTypes(Class, Class)
@see org.apache.flink.graph.GraphCsvReader#edgeTypes(Class, Class)
@see org.apache.flink.graph.GraphCsvReader#keyType(Class) | [
"Creates",
"a",
"Graph",
"from",
"a",
"CSV",
"file",
"of",
"vertices",
"and",
"a",
"CSV",
"file",
"of",
"edges",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L391-L393 | train | Creates a new Graph from CSV files. | [
30522,
2270,
10763,
10629,
6169,
12229,
9648,
2099,
2013,
6169,
12229,
9648,
2099,
1006,
5164,
18984,
15069,
1010,
5164,
7926,
15069,
1010,
7781,
2368,
21663,
2239,
3672,
6123,
1007,
1063,
2709,
2047,
10629,
6169,
12229,
9648,
2099,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readLines | public static <T extends Collection<String>> T readLines(URL url, Charset charset, T collection) throws IORuntimeException {
InputStream in = null;
try {
in = url.openStream();
return IoUtil.readLines(in, charset, collection);
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
IoUtil.close(in);
}
} | java | public static <T extends Collection<String>> T readLines(URL url, Charset charset, T collection) throws IORuntimeException {
InputStream in = null;
try {
in = url.openStream();
return IoUtil.readLines(in, charset, collection);
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
IoUtil.close(in);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"String",
">",
">",
"T",
"readLines",
"(",
"URL",
"url",
",",
"Charset",
"charset",
",",
"T",
"collection",
")",
"throws",
"IORuntimeException",
"{",
"InputStream",
"in",
"=",
"null",
";",
"try",
... | 从文件中读取每一行数据
@param <T> 集合类型
@param url 文件的URL
@param charset 字符集
@param collection 集合
@return 文件中的每行内容的集合
@throws IORuntimeException IO异常
@since 3.1.1 | [
"从文件中读取每一行数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2276-L2286 | train | Reads the contents of the specified URL into the specified collection. | [
30522,
2270,
10763,
1026,
1056,
8908,
3074,
1026,
5164,
1028,
1028,
1056,
3191,
12735,
1006,
24471,
2140,
24471,
2140,
1010,
25869,
13462,
25869,
13462,
1010,
1056,
3074,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
20407,
25379,
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-runtime/src/main/java/org/apache/flink/runtime/query/KvStateLocationRegistry.java | KvStateLocationRegistry.notifyKvStateRegistered | public void notifyKvStateRegistered(
JobVertexID jobVertexId,
KeyGroupRange keyGroupRange,
String registrationName,
KvStateID kvStateId,
InetSocketAddress kvStateServerAddress) {
KvStateLocation location = lookupTable.get(registrationName);
if (location == null) {
// First registration for this operator, create the location info
ExecutionJobVertex vertex = jobVertices.get(jobVertexId);
if (vertex != null) {
int parallelism = vertex.getMaxParallelism();
location = new KvStateLocation(jobId, jobVertexId, parallelism, registrationName);
lookupTable.put(registrationName, location);
} else {
throw new IllegalArgumentException("Unknown JobVertexID " + jobVertexId);
}
}
// Duplicated name if vertex IDs don't match
if (!location.getJobVertexId().equals(jobVertexId)) {
IllegalStateException duplicate = new IllegalStateException(
"Registration name clash. KvState with name '" + registrationName +
"' has already been registered by another operator (" +
location.getJobVertexId() + ").");
ExecutionJobVertex vertex = jobVertices.get(jobVertexId);
if (vertex != null) {
vertex.fail(new SuppressRestartsException(duplicate));
}
throw duplicate;
}
location.registerKvState(keyGroupRange, kvStateId, kvStateServerAddress);
} | java | public void notifyKvStateRegistered(
JobVertexID jobVertexId,
KeyGroupRange keyGroupRange,
String registrationName,
KvStateID kvStateId,
InetSocketAddress kvStateServerAddress) {
KvStateLocation location = lookupTable.get(registrationName);
if (location == null) {
// First registration for this operator, create the location info
ExecutionJobVertex vertex = jobVertices.get(jobVertexId);
if (vertex != null) {
int parallelism = vertex.getMaxParallelism();
location = new KvStateLocation(jobId, jobVertexId, parallelism, registrationName);
lookupTable.put(registrationName, location);
} else {
throw new IllegalArgumentException("Unknown JobVertexID " + jobVertexId);
}
}
// Duplicated name if vertex IDs don't match
if (!location.getJobVertexId().equals(jobVertexId)) {
IllegalStateException duplicate = new IllegalStateException(
"Registration name clash. KvState with name '" + registrationName +
"' has already been registered by another operator (" +
location.getJobVertexId() + ").");
ExecutionJobVertex vertex = jobVertices.get(jobVertexId);
if (vertex != null) {
vertex.fail(new SuppressRestartsException(duplicate));
}
throw duplicate;
}
location.registerKvState(keyGroupRange, kvStateId, kvStateServerAddress);
} | [
"public",
"void",
"notifyKvStateRegistered",
"(",
"JobVertexID",
"jobVertexId",
",",
"KeyGroupRange",
"keyGroupRange",
",",
"String",
"registrationName",
",",
"KvStateID",
"kvStateId",
",",
"InetSocketAddress",
"kvStateServerAddress",
")",
"{",
"KvStateLocation",
"location"... | Notifies the registry about a registered KvState instance.
@param jobVertexId JobVertexID the KvState instance belongs to
@param keyGroupRange Key group range the KvState instance belongs to
@param registrationName Name under which the KvState has been registered
@param kvStateId ID of the registered KvState instance
@param kvStateServerAddress Server address where to find the KvState instance
@throws IllegalArgumentException If JobVertexID does not belong to job
@throws IllegalArgumentException If state has been registered with same
name by another operator.
@throws IndexOutOfBoundsException If key group index is out of bounds. | [
"Notifies",
"the",
"registry",
"about",
"a",
"registered",
"KvState",
"instance",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateLocationRegistry.java#L89-L126 | train | Notifies the KvState instance that a KvState has been registered. | [
30522,
2270,
11675,
2025,
8757,
2243,
15088,
12259,
2890,
24063,
6850,
1006,
3105,
16874,
10288,
3593,
3105,
16874,
10288,
3593,
1010,
3145,
17058,
24388,
2063,
3145,
17058,
24388,
2063,
1010,
5164,
8819,
18442,
1010,
24888,
9153,
2618,
3593,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.forEach | public static <K, V> void forEach(Map<K, V> map, KVConsumer<K, V> kvConsumer) {
int index = 0;
for (Entry<K, V> entry : map.entrySet()) {
kvConsumer.accept(entry.getKey(), entry.getValue(), index);
index++;
}
} | java | public static <K, V> void forEach(Map<K, V> map, KVConsumer<K, V> kvConsumer) {
int index = 0;
for (Entry<K, V> entry : map.entrySet()) {
kvConsumer.accept(entry.getKey(), entry.getValue(), index);
index++;
}
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"void",
"forEach",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"KVConsumer",
"<",
"K",
",",
"V",
">",
"kvConsumer",
")",
"{",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"Entry",
"<",
"K",
",",... | 循环遍历Map,使用{@link KVConsumer} 接受遍历的每条数据,并针对每条数据做处理
@param <K> Key类型
@param <V> Value类型
@param map {@link Map}
@param kvConsumer {@link KVConsumer} 遍历的每条数据处理器 | [
"循环遍历Map,使用",
"{",
"@link",
"KVConsumer",
"}",
"接受遍历的每条数据,并针对每条数据做处理"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2270-L2276 | train | Iterates over the given map and calls the given KVConsumer for each entry. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
11675,
18921,
6776,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
4949,
1010,
24888,
8663,
23545,
2099,
1026,
1047,
1010,
1058,
1028,
24888,
8663,
23545,
2099,
1007,
1063,
20014,
5950,
1027,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/copier/BeanCopier.java | BeanCopier.beanToMap | @SuppressWarnings({ "rawtypes", "unchecked" })
private void beanToMap(Object bean, Map targetMap) {
final Collection<PropDesc> props = BeanUtil.getBeanDesc(bean.getClass()).getProps();
final HashSet<String> ignoreSet = (null != copyOptions.ignoreProperties) ? CollUtil.newHashSet(copyOptions.ignoreProperties) : null;
final CopyOptions copyOptions = this.copyOptions;
String key;
Method getter;
Object value;
for (PropDesc prop : props) {
key = prop.getFieldName();
// 过滤class属性
// 得到property对应的getter方法
getter = prop.getGetter();
if (null != getter) {
// 只读取有getter方法的属性
try {
value = getter.invoke(bean);
} catch (Exception e) {
if (copyOptions.ignoreError) {
continue;// 忽略反射失败
} else {
throw new UtilException(e, "Get value of [{}] error!", prop.getFieldName());
}
}
if (CollUtil.contains(ignoreSet, key)) {
// 目标属性值被忽略或值提供者无此key时跳过
continue;
}
if (null == value && copyOptions.ignoreNullValue) {
continue;// 当允许跳过空时,跳过
}
if (bean.equals(value)) {
continue;// 值不能为bean本身,防止循环引用
}
targetMap.put(mappingKey(copyOptions.fieldMapping, key), value);
}
}
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
private void beanToMap(Object bean, Map targetMap) {
final Collection<PropDesc> props = BeanUtil.getBeanDesc(bean.getClass()).getProps();
final HashSet<String> ignoreSet = (null != copyOptions.ignoreProperties) ? CollUtil.newHashSet(copyOptions.ignoreProperties) : null;
final CopyOptions copyOptions = this.copyOptions;
String key;
Method getter;
Object value;
for (PropDesc prop : props) {
key = prop.getFieldName();
// 过滤class属性
// 得到property对应的getter方法
getter = prop.getGetter();
if (null != getter) {
// 只读取有getter方法的属性
try {
value = getter.invoke(bean);
} catch (Exception e) {
if (copyOptions.ignoreError) {
continue;// 忽略反射失败
} else {
throw new UtilException(e, "Get value of [{}] error!", prop.getFieldName());
}
}
if (CollUtil.contains(ignoreSet, key)) {
// 目标属性值被忽略或值提供者无此key时跳过
continue;
}
if (null == value && copyOptions.ignoreNullValue) {
continue;// 当允许跳过空时,跳过
}
if (bean.equals(value)) {
continue;// 值不能为bean本身,防止循环引用
}
targetMap.put(mappingKey(copyOptions.fieldMapping, key), value);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"private",
"void",
"beanToMap",
"(",
"Object",
"bean",
",",
"Map",
"targetMap",
")",
"{",
"final",
"Collection",
"<",
"PropDesc",
">",
"props",
"=",
"BeanUtil",
".",
"getBeanD... | 对象转Map
@param bean bean对象
@param targetMap 目标的Map
@return Map
@since 4.1.22 | [
"对象转Map"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/copier/BeanCopier.java#L152-L190 | train | Handles the creation of a map from a bean to a map. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
6315,
13874,
2015,
1000,
1010,
1000,
4895,
5403,
18141,
1000,
1065,
1007,
2797,
11675,
14068,
20389,
9331,
1006,
4874,
14068,
1010,
4949,
4539,
2863,
2361,
1007,
1063,
2345,
3074,
1026... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java | JavaUtils.stringToBytes | public static ByteBuffer stringToBytes(String s) {
return Unpooled.wrappedBuffer(s.getBytes(StandardCharsets.UTF_8)).nioBuffer();
} | java | public static ByteBuffer stringToBytes(String s) {
return Unpooled.wrappedBuffer(s.getBytes(StandardCharsets.UTF_8)).nioBuffer();
} | [
"public",
"static",
"ByteBuffer",
"stringToBytes",
"(",
"String",
"s",
")",
"{",
"return",
"Unpooled",
".",
"wrappedBuffer",
"(",
"s",
".",
"getBytes",
"(",
"StandardCharsets",
".",
"UTF_8",
")",
")",
".",
"nioBuffer",
"(",
")",
";",
"}"
] | Convert the given string to a byte buffer. The resulting buffer can be
converted back to the same string through {@link #bytesToString(ByteBuffer)}. | [
"Convert",
"the",
"given",
"string",
"to",
"a",
"byte",
"buffer",
".",
"The",
"resulting",
"buffer",
"can",
"be",
"converted",
"back",
"to",
"the",
"same",
"string",
"through",
"{"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java#L71-L73 | train | Converts a string to a ByteBuffer. | [
30522,
2270,
10763,
24880,
8569,
12494,
5164,
3406,
3762,
4570,
1006,
5164,
1055,
1007,
1063,
2709,
4895,
16869,
2098,
1012,
5058,
8569,
12494,
1006,
1055,
1012,
2131,
3762,
4570,
1006,
3115,
7507,
22573,
3215,
1012,
21183,
2546,
1035,
1022... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageEncoder.java | Bzip2HuffmanStageEncoder.encode | void encode(ByteBuf out) {
// Create optimised selector list and Huffman tables
generateHuffmanOptimisationSeeds();
for (int i = 3; i >= 0; i--) {
optimiseSelectorsAndHuffmanTables(i == 0);
}
assignHuffmanCodeSymbols();
// Write out the tables and the block data encoded with them
writeSelectorsAndHuffmanTables(out);
writeBlockData(out);
} | java | void encode(ByteBuf out) {
// Create optimised selector list and Huffman tables
generateHuffmanOptimisationSeeds();
for (int i = 3; i >= 0; i--) {
optimiseSelectorsAndHuffmanTables(i == 0);
}
assignHuffmanCodeSymbols();
// Write out the tables and the block data encoded with them
writeSelectorsAndHuffmanTables(out);
writeBlockData(out);
} | [
"void",
"encode",
"(",
"ByteBuf",
"out",
")",
"{",
"// Create optimised selector list and Huffman tables",
"generateHuffmanOptimisationSeeds",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"3",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"optimiseSelectorsAndHu... | Encodes and writes the block data. | [
"Encodes",
"and",
"writes",
"the",
"block",
"data",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageEncoder.java#L362-L373 | train | Encode the C ++ record set into the given output buffer. | [
30522,
11675,
4372,
16044,
1006,
24880,
8569,
2546,
2041,
1007,
1063,
1013,
1013,
3443,
23569,
27605,
6924,
27000,
2862,
1998,
21301,
2386,
7251,
9699,
6979,
4246,
2386,
7361,
3775,
15630,
10708,
13089,
2015,
1006,
1007,
1025,
2005,
1006,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java | DnsNameResolver.newRedirectDnsServerStream | protected DnsServerAddressStream newRedirectDnsServerStream(
@SuppressWarnings("unused") String hostname, List<InetSocketAddress> nameservers) {
DnsServerAddressStream cached = authoritativeDnsServerCache().get(hostname);
if (cached == null || cached.size() == 0) {
// If there is no cache hit (which may be the case for example when a NoopAuthoritativeDnsServerCache
// is used), we will just directly use the provided nameservers.
Collections.sort(nameservers, nameServerComparator);
return new SequentialDnsServerAddressStream(nameservers, 0);
}
return cached;
} | java | protected DnsServerAddressStream newRedirectDnsServerStream(
@SuppressWarnings("unused") String hostname, List<InetSocketAddress> nameservers) {
DnsServerAddressStream cached = authoritativeDnsServerCache().get(hostname);
if (cached == null || cached.size() == 0) {
// If there is no cache hit (which may be the case for example when a NoopAuthoritativeDnsServerCache
// is used), we will just directly use the provided nameservers.
Collections.sort(nameservers, nameServerComparator);
return new SequentialDnsServerAddressStream(nameservers, 0);
}
return cached;
} | [
"protected",
"DnsServerAddressStream",
"newRedirectDnsServerStream",
"(",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"String",
"hostname",
",",
"List",
"<",
"InetSocketAddress",
">",
"nameservers",
")",
"{",
"DnsServerAddressStream",
"cached",
"=",
"authoritativeDns... | Creates a new {@link DnsServerAddressStream} to following a redirected DNS query. By overriding this
it provides the opportunity to sort the name servers before following a redirected DNS query.
@param hostname the hostname.
@param nameservers The addresses of the DNS servers which are used in the event of a redirect. This may
contain resolved and unresolved addresses so the used {@link DnsServerAddressStream} must
allow unresolved addresses if you want to include these as well.
@return A {@link DnsServerAddressStream} which will be used to follow the DNS redirect or {@code null} if
none should be followed. | [
"Creates",
"a",
"new",
"{",
"@link",
"DnsServerAddressStream",
"}",
"to",
"following",
"a",
"redirected",
"DNS",
"query",
".",
"By",
"overriding",
"this",
"it",
"provides",
"the",
"opportunity",
"to",
"sort",
"the",
"name",
"servers",
"before",
"following",
"a... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java#L477-L487 | train | Creates a new DNS server stream for a redirect. | [
30522,
5123,
1040,
3619,
8043,
26061,
14141,
8303,
21422,
2047,
5596,
7442,
6593,
2094,
3619,
8043,
14028,
25379,
1006,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
15171,
1000,
1007,
5164,
3677,
18442,
1010,
2862,
1026,
1999,
8454,
7432,
129... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FileUtils.java | FileUtils.readFile | public static String readFile(File file, String charsetName) throws IOException {
byte[] bytes = readAllBytes(file.toPath());
return new String(bytes, charsetName);
} | java | public static String readFile(File file, String charsetName) throws IOException {
byte[] bytes = readAllBytes(file.toPath());
return new String(bytes, charsetName);
} | [
"public",
"static",
"String",
"readFile",
"(",
"File",
"file",
",",
"String",
"charsetName",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"readAllBytes",
"(",
"file",
".",
"toPath",
"(",
")",
")",
";",
"return",
"new",
"String",
"("... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/FileUtils.java#L105-L108 | train | Read the contents of the file into a String. | [
30522,
2270,
10763,
5164,
3191,
8873,
2571,
1006,
5371,
5371,
1010,
5164,
25869,
13462,
18442,
1007,
11618,
22834,
10288,
24422,
1063,
24880,
1031,
1033,
27507,
1027,
3191,
8095,
3762,
4570,
1006,
5371,
1012,
2327,
8988,
1006,
1007,
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.addBuilderCustomizers | @Override
public void addBuilderCustomizers(UndertowBuilderCustomizer... customizers) {
Assert.notNull(customizers, "Customizers must not be null");
this.builderCustomizers.addAll(Arrays.asList(customizers));
} | java | @Override
public void addBuilderCustomizers(UndertowBuilderCustomizer... customizers) {
Assert.notNull(customizers, "Customizers must not be null");
this.builderCustomizers.addAll(Arrays.asList(customizers));
} | [
"@",
"Override",
"public",
"void",
"addBuilderCustomizers",
"(",
"UndertowBuilderCustomizer",
"...",
"customizers",
")",
"{",
"Assert",
".",
"notNull",
"(",
"customizers",
",",
"\"Customizers must not be null\"",
")",
";",
"this",
".",
"builderCustomizers",
".",
"addA... | Add {@link UndertowBuilderCustomizer}s that should be used to customize the
Undertow {@link io.undertow.Undertow.Builder Builder}.
@param customizers the customizers to add | [
"Add",
"{"
] | 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#L322-L326 | train | Add customizers to the builder. | [
30522,
1030,
2058,
15637,
2270,
11675,
5587,
8569,
23891,
29006,
20389,
17629,
2015,
1006,
2104,
18790,
8569,
23891,
29006,
20389,
17629,
1012,
1012,
1012,
7661,
17629,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
7661,
17629,
2015... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/TransitionSystem.java | TransitionSystem.transform | Action transform(int act)
{
if (act == 0)
{
return ActionFactory.make_shift();
}
else if (act < 1 + L)
{
return ActionFactory.make_left_arc(act - 1);
}
else if (act < 1 + 2 * L)
{
return ActionFactory.make_right_arc(act - 1 - L);
}
else
{
System.err.printf("unknown transition in transform(int): %d", act);
}
return new Action();
} | java | Action transform(int act)
{
if (act == 0)
{
return ActionFactory.make_shift();
}
else if (act < 1 + L)
{
return ActionFactory.make_left_arc(act - 1);
}
else if (act < 1 + 2 * L)
{
return ActionFactory.make_right_arc(act - 1 - L);
}
else
{
System.err.printf("unknown transition in transform(int): %d", act);
}
return new Action();
} | [
"Action",
"transform",
"(",
"int",
"act",
")",
"{",
"if",
"(",
"act",
"==",
"0",
")",
"{",
"return",
"ActionFactory",
".",
"make_shift",
"(",
")",
";",
"}",
"else",
"if",
"(",
"act",
"<",
"1",
"+",
"L",
")",
"{",
"return",
"ActionFactory",
".",
"... | 转换动作id为动作
@param act 动作类型的依存关系id
@return 动作 | [
"转换动作id为动作"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/TransitionSystem.java#L185-L204 | train | Transform an int to an action. | [
30522,
2895,
10938,
1006,
20014,
2552,
1007,
1063,
2065,
1006,
2552,
1027,
1027,
1014,
1007,
1063,
2709,
2895,
21450,
1012,
2191,
1035,
5670,
1006,
1007,
1025,
1065,
2842,
2065,
1006,
2552,
1026,
1015,
1009,
1048,
1007,
1063,
2709,
2895,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.readObjectFromXml | @SuppressWarnings("unchecked")
public static <T> T readObjectFromXml(InputSource source) throws IOException {
Object result = null;
XMLDecoder xmldec = null;
try {
xmldec = new XMLDecoder(source);
result = xmldec.readObject();
} finally {
IoUtil.close(xmldec);
}
return (T) result;
} | java | @SuppressWarnings("unchecked")
public static <T> T readObjectFromXml(InputSource source) throws IOException {
Object result = null;
XMLDecoder xmldec = null;
try {
xmldec = new XMLDecoder(source);
result = xmldec.readObject();
} finally {
IoUtil.close(xmldec);
}
return (T) result;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"readObjectFromXml",
"(",
"InputSource",
"source",
")",
"throws",
"IOException",
"{",
"Object",
"result",
"=",
"null",
";",
"XMLDecoder",
"xmldec",
"=",
"null",
";",
... | 从XML中读取对象 Reads serialized object from the XML file.
@param <T> 对象类型
@param source {@link InputSource}
@return 对象
@throws IOException IO异常
@since 3.2.0 | [
"从XML中读取对象",
"Reads",
"serialized",
"object",
"from",
"the",
"XML",
"file",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L199-L210 | train | Reads a
Object object from an XML input stream. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
1056,
3191,
16429,
20614,
19699,
5358,
2595,
19968,
1006,
20407,
8162,
3401,
3120,
1007,
11618,
22834,
10288,
24422,
1063,
4874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.appendChild | public static Element appendChild(Node node, String tagName) {
Document doc = (node instanceof Document) ? (Document) node : node.getOwnerDocument();
Element child = doc.createElement(tagName);
node.appendChild(child);
return child;
} | java | public static Element appendChild(Node node, String tagName) {
Document doc = (node instanceof Document) ? (Document) node : node.getOwnerDocument();
Element child = doc.createElement(tagName);
node.appendChild(child);
return child;
} | [
"public",
"static",
"Element",
"appendChild",
"(",
"Node",
"node",
",",
"String",
"tagName",
")",
"{",
"Document",
"doc",
"=",
"(",
"node",
"instanceof",
"Document",
")",
"?",
"(",
"Document",
")",
"node",
":",
"node",
".",
"getOwnerDocument",
"(",
")",
... | 在已有节点上创建子节点
@param node 节点
@param tagName 标签名
@return 子节点
@since 4.0.9 | [
"在已有节点上创建子节点"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L777-L782 | train | Append a child to a node. | [
30522,
2270,
10763,
5783,
10439,
10497,
19339,
1006,
13045,
13045,
1010,
5164,
6415,
18442,
1007,
1063,
6254,
9986,
1027,
1006,
13045,
6013,
11253,
6254,
1007,
1029,
1006,
6254,
1007,
13045,
1024,
13045,
1012,
2131,
12384,
2121,
3527,
24894,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getBeLong64 | public final long getBeLong64(final int pos) {
final int position = origin + pos;
if (pos + 7 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 7)));
byte[] buf = buffer;
return ((long) (0xff & buf[position + 7])) | ((long) (0xff & buf[position + 6]) << 8)
| ((long) (0xff & buf[position + 5]) << 16) | ((long) (0xff & buf[position + 4]) << 24)
| ((long) (0xff & buf[position + 3]) << 32) | ((long) (0xff & buf[position + 2]) << 40)
| ((long) (0xff & buf[position + 1]) << 48) | ((long) (buf[position]) << 56);
} | java | public final long getBeLong64(final int pos) {
final int position = origin + pos;
if (pos + 7 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 7)));
byte[] buf = buffer;
return ((long) (0xff & buf[position + 7])) | ((long) (0xff & buf[position + 6]) << 8)
| ((long) (0xff & buf[position + 5]) << 16) | ((long) (0xff & buf[position + 4]) << 24)
| ((long) (0xff & buf[position + 3]) << 32) | ((long) (0xff & buf[position + 2]) << 40)
| ((long) (0xff & buf[position + 1]) << 48) | ((long) (buf[position]) << 56);
} | [
"public",
"final",
"long",
"getBeLong64",
"(",
"final",
"int",
"pos",
")",
"{",
"final",
"int",
"position",
"=",
"origin",
"+",
"pos",
";",
"if",
"(",
"pos",
"+",
"7",
">=",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException... | Return 64-bit signed long from buffer. (big-endian)
@see mysql-5.6.10/include/myisampack.h - mi_sint8korr | [
"Return",
"64",
"-",
"bit",
"signed",
"long",
"from",
"buffer",
".",
"(",
"big",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L855-L866 | train | Gets a long from the buffer starting at the given position in the buffer as an unsigned long. | [
30522,
2270,
2345,
2146,
2131,
8671,
5063,
21084,
1006,
2345,
20014,
13433,
2015,
1007,
1063,
2345,
20014,
2597,
1027,
4761,
1009,
13433,
2015,
1025,
2065,
1006,
13433,
2015,
1009,
1021,
1028,
1027,
5787,
1064,
1064,
13433,
2015,
1026,
1014... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.unzip | public static File unzip(String zipFilePath, String outFileDir) throws UtilException {
return unzip(zipFilePath, outFileDir, DEFAULT_CHARSET);
} | java | public static File unzip(String zipFilePath, String outFileDir) throws UtilException {
return unzip(zipFilePath, outFileDir, DEFAULT_CHARSET);
} | [
"public",
"static",
"File",
"unzip",
"(",
"String",
"zipFilePath",
",",
"String",
"outFileDir",
")",
"throws",
"UtilException",
"{",
"return",
"unzip",
"(",
"zipFilePath",
",",
"outFileDir",
",",
"DEFAULT_CHARSET",
")",
";",
"}"
] | 解压,默认UTF-8编码
@param zipFilePath 压缩文件的路径
@param outFileDir 解压到的目录
@return 解压的目录
@throws UtilException IO异常 | [
"解压,默认UTF",
"-",
"8编码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L345-L347 | train | Unzip a file into a file system. | [
30522,
2270,
10763,
5371,
4895,
5831,
2361,
1006,
5164,
14101,
8873,
2571,
15069,
1010,
5164,
2041,
8873,
3709,
4313,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
2709,
4895,
5831,
2361,
1006,
14101,
8873,
2571,
15069,
1010,
2041,
8873,
370... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.writeRow | public static void writeRow(Row row, Iterable<?> rowData, StyleSet styleSet, boolean isHeader) {
int i = 0;
Cell cell;
for (Object value : rowData) {
cell = row.createCell(i);
CellUtil.setCellValue(cell, value, styleSet, isHeader);
i++;
}
} | java | public static void writeRow(Row row, Iterable<?> rowData, StyleSet styleSet, boolean isHeader) {
int i = 0;
Cell cell;
for (Object value : rowData) {
cell = row.createCell(i);
CellUtil.setCellValue(cell, value, styleSet, isHeader);
i++;
}
} | [
"public",
"static",
"void",
"writeRow",
"(",
"Row",
"row",
",",
"Iterable",
"<",
"?",
">",
"rowData",
",",
"StyleSet",
"styleSet",
",",
"boolean",
"isHeader",
")",
"{",
"int",
"i",
"=",
"0",
";",
"Cell",
"cell",
";",
"for",
"(",
"Object",
"value",
":... | 写一行数据
@param row 行
@param rowData 一行的数据
@param styleSet 单元格样式集,包括日期等样式
@param isHeader 是否为标题行 | [
"写一行数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/RowUtil.java#L76-L84 | train | Write a row. | [
30522,
2270,
10763,
11675,
3213,
5004,
1006,
5216,
5216,
1010,
2009,
6906,
3468,
1026,
1029,
1028,
5216,
2850,
2696,
1010,
6782,
3388,
6782,
3388,
1010,
22017,
20898,
2003,
4974,
2121,
1007,
1063,
20014,
1045,
1027,
1014,
1025,
3526,
3526,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/RestServerEndpoint.java | RestServerEndpoint.shutDownInternal | protected CompletableFuture<Void> shutDownInternal() {
synchronized (lock) {
CompletableFuture<?> channelFuture = new CompletableFuture<>();
if (serverChannel != null) {
serverChannel.close().addListener(finished -> {
if (finished.isSuccess()) {
channelFuture.complete(null);
} else {
channelFuture.completeExceptionally(finished.cause());
}
});
serverChannel = null;
}
final CompletableFuture<Void> channelTerminationFuture = new CompletableFuture<>();
channelFuture.thenRun(() -> {
CompletableFuture<?> groupFuture = new CompletableFuture<>();
CompletableFuture<?> childGroupFuture = new CompletableFuture<>();
final Time gracePeriod = Time.seconds(10L);
if (bootstrap != null) {
final ServerBootstrapConfig config = bootstrap.config();
final EventLoopGroup group = config.group();
if (group != null) {
group.shutdownGracefully(0L, gracePeriod.toMilliseconds(), TimeUnit.MILLISECONDS)
.addListener(finished -> {
if (finished.isSuccess()) {
groupFuture.complete(null);
} else {
groupFuture.completeExceptionally(finished.cause());
}
});
} else {
groupFuture.complete(null);
}
final EventLoopGroup childGroup = config.childGroup();
if (childGroup != null) {
childGroup.shutdownGracefully(0L, gracePeriod.toMilliseconds(), TimeUnit.MILLISECONDS)
.addListener(finished -> {
if (finished.isSuccess()) {
childGroupFuture.complete(null);
} else {
childGroupFuture.completeExceptionally(finished.cause());
}
});
} else {
childGroupFuture.complete(null);
}
bootstrap = null;
} else {
// complete the group futures since there is nothing to stop
groupFuture.complete(null);
childGroupFuture.complete(null);
}
CompletableFuture<Void> combinedFuture = FutureUtils.completeAll(Arrays.asList(groupFuture, childGroupFuture));
combinedFuture.whenComplete(
(Void ignored, Throwable throwable) -> {
if (throwable != null) {
channelTerminationFuture.completeExceptionally(throwable);
} else {
channelTerminationFuture.complete(null);
}
});
});
return channelTerminationFuture;
}
} | java | protected CompletableFuture<Void> shutDownInternal() {
synchronized (lock) {
CompletableFuture<?> channelFuture = new CompletableFuture<>();
if (serverChannel != null) {
serverChannel.close().addListener(finished -> {
if (finished.isSuccess()) {
channelFuture.complete(null);
} else {
channelFuture.completeExceptionally(finished.cause());
}
});
serverChannel = null;
}
final CompletableFuture<Void> channelTerminationFuture = new CompletableFuture<>();
channelFuture.thenRun(() -> {
CompletableFuture<?> groupFuture = new CompletableFuture<>();
CompletableFuture<?> childGroupFuture = new CompletableFuture<>();
final Time gracePeriod = Time.seconds(10L);
if (bootstrap != null) {
final ServerBootstrapConfig config = bootstrap.config();
final EventLoopGroup group = config.group();
if (group != null) {
group.shutdownGracefully(0L, gracePeriod.toMilliseconds(), TimeUnit.MILLISECONDS)
.addListener(finished -> {
if (finished.isSuccess()) {
groupFuture.complete(null);
} else {
groupFuture.completeExceptionally(finished.cause());
}
});
} else {
groupFuture.complete(null);
}
final EventLoopGroup childGroup = config.childGroup();
if (childGroup != null) {
childGroup.shutdownGracefully(0L, gracePeriod.toMilliseconds(), TimeUnit.MILLISECONDS)
.addListener(finished -> {
if (finished.isSuccess()) {
childGroupFuture.complete(null);
} else {
childGroupFuture.completeExceptionally(finished.cause());
}
});
} else {
childGroupFuture.complete(null);
}
bootstrap = null;
} else {
// complete the group futures since there is nothing to stop
groupFuture.complete(null);
childGroupFuture.complete(null);
}
CompletableFuture<Void> combinedFuture = FutureUtils.completeAll(Arrays.asList(groupFuture, childGroupFuture));
combinedFuture.whenComplete(
(Void ignored, Throwable throwable) -> {
if (throwable != null) {
channelTerminationFuture.completeExceptionally(throwable);
} else {
channelTerminationFuture.complete(null);
}
});
});
return channelTerminationFuture;
}
} | [
"protected",
"CompletableFuture",
"<",
"Void",
">",
"shutDownInternal",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"CompletableFuture",
"<",
"?",
">",
"channelFuture",
"=",
"new",
"CompletableFuture",
"<>",
"(",
")",
";",
"if",
"(",
"serverChannel",... | Stops this REST server endpoint.
@return Future which is completed once the shut down has been finished. | [
"Stops",
"this",
"REST",
"server",
"endpoint",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestServerEndpoint.java#L329-L403 | train | Shuts down the server channel and all child channels. | [
30522,
30524,
1027,
2047,
4012,
10814,
10880,
11263,
11244,
1026,
1028,
1006,
1007,
1025,
2065,
1006,
8241,
26058,
999,
1027,
19701,
1007,
1063,
8241,
26058,
1012,
2485,
1006,
1007,
1012,
5587,
9863,
24454,
1006,
2736,
1011,
1028,
1063,
206... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Http2ConnectionHandler.java | Http2ConnectionHandler.exceptionCaught | @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (getEmbeddedHttp2Exception(cause) != null) {
// Some exception in the causality chain is an Http2Exception - handle it.
onError(ctx, false, cause);
} else {
super.exceptionCaught(ctx, cause);
}
} | java | @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (getEmbeddedHttp2Exception(cause) != null) {
// Some exception in the causality chain is an Http2Exception - handle it.
onError(ctx, false, cause);
} else {
super.exceptionCaught(ctx, cause);
}
} | [
"@",
"Override",
"public",
"void",
"exceptionCaught",
"(",
"ChannelHandlerContext",
"ctx",
",",
"Throwable",
"cause",
")",
"throws",
"Exception",
"{",
"if",
"(",
"getEmbeddedHttp2Exception",
"(",
"cause",
")",
"!=",
"null",
")",
"{",
"// Some exception in the causal... | Handles {@link Http2Exception} objects that were thrown from other handlers. Ignores all other exceptions. | [
"Handles",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L553-L561 | train | Override exceptionCaught to handle Http2Exception. | [
30522,
1030,
2058,
15637,
2270,
11675,
6453,
3540,
18533,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
5466,
3085,
3426,
1007,
11618,
6453,
1063,
2065,
1006,
2131,
6633,
8270,
5732,
11039,
25856,
2475,
10288,
24422,
1006,
3426,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.randomEleSet | public static <T> Set<T> randomEleSet(Collection<T> collection, int count) {
ArrayList<T> source = new ArrayList<>(new HashSet<>(collection));
if (count > source.size()) {
throw new IllegalArgumentException("Count is larger than collection distinct size !");
}
final HashSet<T> result = new HashSet<T>(count);
int limit = collection.size();
while (result.size() < count) {
result.add(randomEle(source, limit));
}
return result;
} | java | public static <T> Set<T> randomEleSet(Collection<T> collection, int count) {
ArrayList<T> source = new ArrayList<>(new HashSet<>(collection));
if (count > source.size()) {
throw new IllegalArgumentException("Count is larger than collection distinct size !");
}
final HashSet<T> result = new HashSet<T>(count);
int limit = collection.size();
while (result.size() < count) {
result.add(randomEle(source, limit));
}
return result;
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"randomEleSet",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"int",
"count",
")",
"{",
"ArrayList",
"<",
"T",
">",
"source",
"=",
"new",
"ArrayList",
"<>",
"(",
"new",
"HashSet",
"<>",
... | 随机获得列表中的一定量的不重复元素,返回Set
@param <T> 元素类型
@param collection 列表
@param count 随机取出的个数
@return 随机元素
@throws IllegalArgumentException 需要的长度大于给定集合非重复总数 | [
"随机获得列表中的一定量的不重复元素,返回Set"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java#L330-L343 | train | Returns a random set of elements from the given collection. | [
30522,
2270,
10763,
1026,
1056,
1028,
2275,
1026,
1056,
1028,
6721,
26741,
3388,
1006,
3074,
1026,
1056,
1028,
3074,
1010,
20014,
4175,
1007,
1063,
9140,
9863,
1026,
1056,
1028,
3120,
1027,
2047,
9140,
9863,
1026,
1028,
1006,
2047,
23325,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-api-java/src/main/java/org/apache/flink/table/api/StreamQueryConfig.java | StreamQueryConfig.withIdleStateRetentionTime | public StreamQueryConfig withIdleStateRetentionTime(Time minTime, Time maxTime) {
if (maxTime.toMilliseconds() - minTime.toMilliseconds() < 300000 &&
!(maxTime.toMilliseconds() == 0 && minTime.toMilliseconds() == 0)) {
throw new IllegalArgumentException(
"Difference between minTime: " + minTime.toString() + " and maxTime: " + maxTime.toString() +
"shoud be at least 5 minutes.");
}
minIdleStateRetentionTime = minTime.toMilliseconds();
maxIdleStateRetentionTime = maxTime.toMilliseconds();
return this;
} | java | public StreamQueryConfig withIdleStateRetentionTime(Time minTime, Time maxTime) {
if (maxTime.toMilliseconds() - minTime.toMilliseconds() < 300000 &&
!(maxTime.toMilliseconds() == 0 && minTime.toMilliseconds() == 0)) {
throw new IllegalArgumentException(
"Difference between minTime: " + minTime.toString() + " and maxTime: " + maxTime.toString() +
"shoud be at least 5 minutes.");
}
minIdleStateRetentionTime = minTime.toMilliseconds();
maxIdleStateRetentionTime = maxTime.toMilliseconds();
return this;
} | [
"public",
"StreamQueryConfig",
"withIdleStateRetentionTime",
"(",
"Time",
"minTime",
",",
"Time",
"maxTime",
")",
"{",
"if",
"(",
"maxTime",
".",
"toMilliseconds",
"(",
")",
"-",
"minTime",
".",
"toMilliseconds",
"(",
")",
"<",
"300000",
"&&",
"!",
"(",
"max... | Specifies a minimum and a maximum time interval for how long idle state, i.e., state which
was not updated, will be retained.
State will never be cleared until it was idle for less than the minimum time and will never
be kept if it was idle for more than the maximum time.
<p>When new data arrives for previously cleaned-up state, the new data will be handled as if it
was the first data. This can result in previous results being overwritten.
<p>Set to 0 (zero) to never clean-up the state.
<p>NOTE: Cleaning up state requires additional bookkeeping which becomes less expensive for
larger differences of minTime and maxTime. The difference between minTime and maxTime must be
at least 5 minutes.
@param minTime The minimum time interval for which idle state is retained. Set to 0 (zero) to
never clean-up the state.
@param maxTime The maximum time interval for which idle state is retained. Must be at least
5 minutes greater than minTime. Set to 0 (zero) to never clean-up the state. | [
"Specifies",
"a",
"minimum",
"and",
"a",
"maximum",
"time",
"interval",
"for",
"how",
"long",
"idle",
"state",
"i",
".",
"e",
".",
"state",
"which",
"was",
"not",
"updated",
"will",
"be",
"retained",
".",
"State",
"will",
"never",
"be",
"cleared",
"until... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/StreamQueryConfig.java#L62-L73 | train | Sets the idle state retention time. | [
30522,
2270,
5460,
4226,
2854,
8663,
8873,
2290,
2007,
3593,
4244,
12259,
13465,
4765,
3258,
7292,
1006,
2051,
12927,
14428,
1010,
2051,
4098,
7292,
1007,
1063,
2065,
1006,
4098,
7292,
1012,
3419,
8591,
5562,
8663,
5104,
1006,
1007,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java | KeyUtil.getAlgorithmAfterWith | public static String getAlgorithmAfterWith(String algorithm) {
Assert.notNull(algorithm, "algorithm must be not null !");
int indexOfWith = StrUtil.lastIndexOfIgnoreCase(algorithm, "with");
if (indexOfWith > 0) {
algorithm = StrUtil.subSuf(algorithm, indexOfWith + "with".length());
}
if ("ECDSA".equalsIgnoreCase(algorithm) || "SM2".equalsIgnoreCase(algorithm)) {
algorithm = "EC";
}
return algorithm;
} | java | public static String getAlgorithmAfterWith(String algorithm) {
Assert.notNull(algorithm, "algorithm must be not null !");
int indexOfWith = StrUtil.lastIndexOfIgnoreCase(algorithm, "with");
if (indexOfWith > 0) {
algorithm = StrUtil.subSuf(algorithm, indexOfWith + "with".length());
}
if ("ECDSA".equalsIgnoreCase(algorithm) || "SM2".equalsIgnoreCase(algorithm)) {
algorithm = "EC";
}
return algorithm;
} | [
"public",
"static",
"String",
"getAlgorithmAfterWith",
"(",
"String",
"algorithm",
")",
"{",
"Assert",
".",
"notNull",
"(",
"algorithm",
",",
"\"algorithm must be not null !\"",
")",
";",
"int",
"indexOfWith",
"=",
"StrUtil",
".",
"lastIndexOfIgnoreCase",
"(",
"algo... | 获取用于密钥生成的算法<br>
获取XXXwithXXX算法的后半部分算法,如果为ECDSA或SM2,返回算法为EC
@param algorithm XXXwithXXX算法
@return 算法 | [
"获取用于密钥生成的算法<br",
">",
"获取XXXwithXXX算法的后半部分算法,如果为ECDSA或SM2,返回算法为EC"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L536-L546 | train | Returns the algorithm after the given string. | [
30522,
2270,
10763,
5164,
2131,
2389,
20255,
8939,
2863,
6199,
2121,
24415,
1006,
5164,
9896,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
9896,
1010,
1000,
9896,
2442,
2022,
2025,
19701,
999,
1000,
1007,
1025,
20014,
5950,
11253,
2441... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/word2vec/AbstractVectorModel.java | AbstractVectorModel.vector | final public Vector vector(K key)
{
Vector vector = storage.get(key);
if (vector == null) return null;
return vector;
} | java | final public Vector vector(K key)
{
Vector vector = storage.get(key);
if (vector == null) return null;
return vector;
} | [
"final",
"public",
"Vector",
"vector",
"(",
"K",
"key",
")",
"{",
"Vector",
"vector",
"=",
"storage",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"vector",
"==",
"null",
")",
"return",
"null",
";",
"return",
"vector",
";",
"}"
] | 获取一个键的向量(键不会被预处理)
@param key 键
@return 向量 | [
"获取一个键的向量(键不会被预处理)"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/AbstractVectorModel.java#L42-L47 | train | Get a single record vector from the cache. | [
30522,
2345,
2270,
9207,
9207,
1006,
1047,
3145,
1007,
1063,
9207,
9207,
1027,
5527,
1012,
2131,
1006,
3145,
1007,
1025,
2065,
1006,
9207,
1027,
1027,
19701,
1007,
2709,
19701,
1025,
2709,
9207,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/LambdaUtil.java | LambdaUtil.withContextClassLoader | public static <R, E extends Throwable> R withContextClassLoader(
final ClassLoader cl,
final SupplierWithException<R, E> s) throws E {
try (TemporaryClassLoaderContext tmpCl = new TemporaryClassLoaderContext(cl)) {
return s.get();
}
} | java | public static <R, E extends Throwable> R withContextClassLoader(
final ClassLoader cl,
final SupplierWithException<R, E> s) throws E {
try (TemporaryClassLoaderContext tmpCl = new TemporaryClassLoaderContext(cl)) {
return s.get();
}
} | [
"public",
"static",
"<",
"R",
",",
"E",
"extends",
"Throwable",
">",
"R",
"withContextClassLoader",
"(",
"final",
"ClassLoader",
"cl",
",",
"final",
"SupplierWithException",
"<",
"R",
",",
"E",
">",
"s",
")",
"throws",
"E",
"{",
"try",
"(",
"TemporaryClass... | Runs the given runnable with the given ClassLoader as the thread's
{@link Thread#setContextClassLoader(ClassLoader) context class loader}.
<p>The method will make sure to set the context class loader of the calling thread
back to what it was before after the runnable completed. | [
"Runs",
"the",
"given",
"runnable",
"with",
"the",
"given",
"ClassLoader",
"as",
"the",
"thread",
"s",
"{",
"@link",
"Thread#setContextClassLoader",
"(",
"ClassLoader",
")",
"context",
"class",
"loader",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/LambdaUtil.java#L92-L99 | train | Create a new instance of the class loader with the specified context classloader. | [
30522,
2270,
10763,
1026,
1054,
1010,
1041,
8908,
5466,
3085,
1028,
1054,
2007,
8663,
18209,
26266,
11066,
2121,
1006,
2345,
2465,
11066,
2121,
18856,
1010,
2345,
17024,
24415,
10288,
24422,
1026,
1054,
1010,
1041,
1028,
1055,
1007,
11618,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.sub | public static byte[] sub(byte[] array, int start, int end) {
int length = length(array);
if (start < 0) {
start += length;
}
if (end < 0) {
end += length;
}
if (start == length) {
return new byte[0];
}
if (start > end) {
int tmp = start;
start = end;
end = tmp;
}
if (end > length) {
if (start >= length) {
return new byte[0];
}
end = length;
}
return Arrays.copyOfRange(array, start, end);
} | java | public static byte[] sub(byte[] array, int start, int end) {
int length = length(array);
if (start < 0) {
start += length;
}
if (end < 0) {
end += length;
}
if (start == length) {
return new byte[0];
}
if (start > end) {
int tmp = start;
start = end;
end = tmp;
}
if (end > length) {
if (start >= length) {
return new byte[0];
}
end = length;
}
return Arrays.copyOfRange(array, start, end);
} | [
"public",
"static",
"byte",
"[",
"]",
"sub",
"(",
"byte",
"[",
"]",
"array",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"int",
"length",
"=",
"length",
"(",
"array",
")",
";",
"if",
"(",
"start",
"<",
"0",
")",
"{",
"start",
"+=",
"lengt... | 获取子数组
@param array 数组
@param start 开始位置(包括)
@param end 结束位置(不包括)
@return 新的数组
@since 4.5.2
@see Arrays#copyOfRange(Object[], int, int) | [
"获取子数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L1891-L1914 | train | Returns a subrange of the specified range of the specified byte array. | [
30522,
2270,
10763,
24880,
1031,
1033,
4942,
1006,
24880,
1031,
1033,
9140,
1010,
20014,
2707,
1010,
20014,
2203,
1007,
1063,
20014,
3091,
1027,
3091,
1006,
9140,
1007,
1025,
2065,
1006,
2707,
1026,
1014,
1007,
1063,
2707,
1009,
1027,
3091,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/cors/CorsConfigBuilder.java | CorsConfigBuilder.exposeHeaders | public CorsConfigBuilder exposeHeaders(final CharSequence... headers) {
for (CharSequence header: headers) {
exposeHeaders.add(header.toString());
}
return this;
} | java | public CorsConfigBuilder exposeHeaders(final CharSequence... headers) {
for (CharSequence header: headers) {
exposeHeaders.add(header.toString());
}
return this;
} | [
"public",
"CorsConfigBuilder",
"exposeHeaders",
"(",
"final",
"CharSequence",
"...",
"headers",
")",
"{",
"for",
"(",
"CharSequence",
"header",
":",
"headers",
")",
"{",
"exposeHeaders",
".",
"add",
"(",
"header",
".",
"toString",
"(",
")",
")",
";",
"}",
... | Specifies the headers to be exposed to calling clients.
During a simple CORS request, only certain response headers are made available by the
browser, for example using:
<pre>
xhr.getResponseHeader(HttpHeaderNames.CONTENT_TYPE);
</pre>
The headers that are available by default are:
<ul>
<li>Cache-Control</li>
<li>Content-Language</li>
<li>Content-Type</li>
<li>Expires</li>
<li>Last-Modified</li>
<li>Pragma</li>
</ul>
To expose other headers they need to be specified which is what this method enables by
adding the headers to the CORS 'Access-Control-Expose-Headers' response header.
@param headers the values to be added to the 'Access-Control-Expose-Headers' response header
@return {@link CorsConfigBuilder} to support method chaining. | [
"Specifies",
"the",
"headers",
"to",
"be",
"exposed",
"to",
"calling",
"clients",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/cors/CorsConfigBuilder.java#L176-L181 | train | Expose headers. | [
30522,
2270,
2522,
2869,
8663,
8873,
18259,
19231,
4063,
14451,
4974,
2545,
1006,
2345,
25869,
3366,
4226,
5897,
1012,
1012,
1012,
20346,
2015,
1007,
1063,
2005,
1006,
25869,
3366,
4226,
5897,
20346,
1024,
20346,
2015,
1007,
1063,
14451,
49... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.