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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamFrameToHttpObjectCodec.java | Http2StreamFrameToHttpObjectCodec.encode | @Override
protected void encode(ChannelHandlerContext ctx, HttpObject obj, List<Object> out) throws Exception {
// 100-continue is typically a FullHttpResponse, but the decoded
// Http2HeadersFrame should not be marked as endStream=true
if (obj instanceof HttpResponse) {
final HttpResponse res = (HttpResponse) obj;
if (res.status().equals(HttpResponseStatus.CONTINUE)) {
if (res instanceof FullHttpResponse) {
final Http2Headers headers = toHttp2Headers(ctx, res);
out.add(new DefaultHttp2HeadersFrame(headers, false));
return;
} else {
throw new EncoderException(
HttpResponseStatus.CONTINUE.toString() + " must be a FullHttpResponse");
}
}
}
if (obj instanceof HttpMessage) {
Http2Headers headers = toHttp2Headers(ctx, (HttpMessage) obj);
boolean noMoreFrames = false;
if (obj instanceof FullHttpMessage) {
FullHttpMessage full = (FullHttpMessage) obj;
noMoreFrames = !full.content().isReadable() && full.trailingHeaders().isEmpty();
}
out.add(new DefaultHttp2HeadersFrame(headers, noMoreFrames));
}
if (obj instanceof LastHttpContent) {
LastHttpContent last = (LastHttpContent) obj;
encodeLastContent(last, out);
} else if (obj instanceof HttpContent) {
HttpContent cont = (HttpContent) obj;
out.add(new DefaultHttp2DataFrame(cont.content().retain(), false));
}
} | java | @Override
protected void encode(ChannelHandlerContext ctx, HttpObject obj, List<Object> out) throws Exception {
// 100-continue is typically a FullHttpResponse, but the decoded
// Http2HeadersFrame should not be marked as endStream=true
if (obj instanceof HttpResponse) {
final HttpResponse res = (HttpResponse) obj;
if (res.status().equals(HttpResponseStatus.CONTINUE)) {
if (res instanceof FullHttpResponse) {
final Http2Headers headers = toHttp2Headers(ctx, res);
out.add(new DefaultHttp2HeadersFrame(headers, false));
return;
} else {
throw new EncoderException(
HttpResponseStatus.CONTINUE.toString() + " must be a FullHttpResponse");
}
}
}
if (obj instanceof HttpMessage) {
Http2Headers headers = toHttp2Headers(ctx, (HttpMessage) obj);
boolean noMoreFrames = false;
if (obj instanceof FullHttpMessage) {
FullHttpMessage full = (FullHttpMessage) obj;
noMoreFrames = !full.content().isReadable() && full.trailingHeaders().isEmpty();
}
out.add(new DefaultHttp2HeadersFrame(headers, noMoreFrames));
}
if (obj instanceof LastHttpContent) {
LastHttpContent last = (LastHttpContent) obj;
encodeLastContent(last, out);
} else if (obj instanceof HttpContent) {
HttpContent cont = (HttpContent) obj;
out.add(new DefaultHttp2DataFrame(cont.content().retain(), false));
}
} | [
"@",
"Override",
"protected",
"void",
"encode",
"(",
"ChannelHandlerContext",
"ctx",
",",
"HttpObject",
"obj",
",",
"List",
"<",
"Object",
">",
"out",
")",
"throws",
"Exception",
"{",
"// 100-continue is typically a FullHttpResponse, but the decoded",
"// Http2HeadersFram... | Encode from an {@link HttpObject} to an {@link Http2StreamFrame}. This method will
be called for each written message that can be handled by this encoder.
NOTE: 100-Continue responses that are NOT {@link FullHttpResponse} will be rejected.
@param ctx the {@link ChannelHandlerContext} which this handler belongs to
@param obj the {@link HttpObject} message to encode
@param out the {@link List} into which the encoded msg should be added
needs to do some kind of aggregation
@throws Exception is thrown if an error occurs | [
"Encode",
"from",
"an",
"{",
"@link",
"HttpObject",
"}",
"to",
"an",
"{",
"@link",
"Http2StreamFrame",
"}",
".",
"This",
"method",
"will",
"be",
"called",
"for",
"each",
"written",
"message",
"that",
"can",
"be",
"handled",
"by",
"this",
"encoder",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamFrameToHttpObjectCodec.java#L152-L188 | train | Encode a HttpObject into a List of objects. | [
30522,
1030,
2058,
15637,
5123,
11675,
4372,
16044,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
8299,
16429,
20614,
27885,
3501,
1010,
2862,
1026,
4874,
1028,
2041,
1007,
11618,
6453,
1063,
1013,
1013,
2531,
1011,
3613,
2003,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBIncrementalRestoreOperation.java | RocksDBIncrementalRestoreOperation.restoreWithoutRescaling | private void restoreWithoutRescaling(KeyedStateHandle keyedStateHandle) throws Exception {
if (keyedStateHandle instanceof IncrementalRemoteKeyedStateHandle) {
IncrementalRemoteKeyedStateHandle incrementalRemoteKeyedStateHandle =
(IncrementalRemoteKeyedStateHandle) keyedStateHandle;
restorePreviousIncrementalFilesStatus(incrementalRemoteKeyedStateHandle);
restoreFromRemoteState(incrementalRemoteKeyedStateHandle);
} else if (keyedStateHandle instanceof IncrementalLocalKeyedStateHandle) {
IncrementalLocalKeyedStateHandle incrementalLocalKeyedStateHandle =
(IncrementalLocalKeyedStateHandle) keyedStateHandle;
restorePreviousIncrementalFilesStatus(incrementalLocalKeyedStateHandle);
restoreFromLocalState(incrementalLocalKeyedStateHandle);
} else {
throw new BackendBuildingException("Unexpected state handle type, " +
"expected " + IncrementalRemoteKeyedStateHandle.class + " or " + IncrementalLocalKeyedStateHandle.class +
", but found " + keyedStateHandle.getClass());
}
} | java | private void restoreWithoutRescaling(KeyedStateHandle keyedStateHandle) throws Exception {
if (keyedStateHandle instanceof IncrementalRemoteKeyedStateHandle) {
IncrementalRemoteKeyedStateHandle incrementalRemoteKeyedStateHandle =
(IncrementalRemoteKeyedStateHandle) keyedStateHandle;
restorePreviousIncrementalFilesStatus(incrementalRemoteKeyedStateHandle);
restoreFromRemoteState(incrementalRemoteKeyedStateHandle);
} else if (keyedStateHandle instanceof IncrementalLocalKeyedStateHandle) {
IncrementalLocalKeyedStateHandle incrementalLocalKeyedStateHandle =
(IncrementalLocalKeyedStateHandle) keyedStateHandle;
restorePreviousIncrementalFilesStatus(incrementalLocalKeyedStateHandle);
restoreFromLocalState(incrementalLocalKeyedStateHandle);
} else {
throw new BackendBuildingException("Unexpected state handle type, " +
"expected " + IncrementalRemoteKeyedStateHandle.class + " or " + IncrementalLocalKeyedStateHandle.class +
", but found " + keyedStateHandle.getClass());
}
} | [
"private",
"void",
"restoreWithoutRescaling",
"(",
"KeyedStateHandle",
"keyedStateHandle",
")",
"throws",
"Exception",
"{",
"if",
"(",
"keyedStateHandle",
"instanceof",
"IncrementalRemoteKeyedStateHandle",
")",
"{",
"IncrementalRemoteKeyedStateHandle",
"incrementalRemoteKeyedStat... | Recovery from a single remote incremental state without rescaling. | [
"Recovery",
"from",
"a",
"single",
"remote",
"incremental",
"state",
"without",
"rescaling",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBIncrementalRestoreOperation.java#L157-L173 | train | Restore the state without rescaling. | [
30522,
2797,
11675,
9239,
24415,
5833,
6072,
9289,
2075,
1006,
3145,
2098,
9153,
2618,
11774,
2571,
3145,
2098,
9153,
2618,
11774,
2571,
1007,
11618,
6453,
1063,
2065,
1006,
3145,
2098,
9153,
2618,
11774,
2571,
6013,
11253,
4297,
28578,
210... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java | TypeUtil.getType | public static Type getType(Field field) {
if (null == field) {
return null;
}
Type type = field.getGenericType();
if (null == type) {
type = field.getType();
}
return type;
} | java | public static Type getType(Field field) {
if (null == field) {
return null;
}
Type type = field.getGenericType();
if (null == type) {
type = field.getType();
}
return type;
} | [
"public",
"static",
"Type",
"getType",
"(",
"Field",
"field",
")",
"{",
"if",
"(",
"null",
"==",
"field",
")",
"{",
"return",
"null",
";",
"}",
"Type",
"type",
"=",
"field",
".",
"getGenericType",
"(",
")",
";",
"if",
"(",
"null",
"==",
"type",
")"... | 获取字段对应的Type类型<br>
方法优先获取GenericType,获取不到则获取Type
@param field 字段
@return {@link Type},可能为{@code null} | [
"获取字段对应的Type类型<br",
">",
"方法优先获取GenericType,获取不到则获取Type"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java#L58-L67 | train | Gets the Type of the given field. | [
30522,
2270,
10763,
2828,
2131,
13874,
1006,
2492,
2492,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
2492,
1007,
1063,
2709,
19701,
1025,
1065,
2828,
2828,
1027,
2492,
1012,
2131,
6914,
22420,
13874,
1006,
1007,
1025,
2065,
1006,
19701,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java | Launcher.launch | protected void launch(String[] args) throws Exception {
JarFile.registerUrlProtocolHandler();
ClassLoader classLoader = createClassLoader(getClassPathArchives());
launch(args, getMainClass(), classLoader);
} | java | protected void launch(String[] args) throws Exception {
JarFile.registerUrlProtocolHandler();
ClassLoader classLoader = createClassLoader(getClassPathArchives());
launch(args, getMainClass(), classLoader);
} | [
"protected",
"void",
"launch",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"JarFile",
".",
"registerUrlProtocolHandler",
"(",
")",
";",
"ClassLoader",
"classLoader",
"=",
"createClassLoader",
"(",
"getClassPathArchives",
"(",
")",
")",
";",... | Launch the application. This method is the initial entry point that should be
called by a subclass {@code public static void main(String[] args)} method.
@param args the incoming arguments
@throws Exception if the application fails to launch | [
"Launch",
"the",
"application",
".",
"This",
"method",
"is",
"the",
"initial",
"entry",
"point",
"that",
"should",
"be",
"called",
"by",
"a",
"subclass",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/Launcher.java#L47-L51 | train | Launch the application. | [
30522,
5123,
11675,
4888,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
15723,
8873,
2571,
1012,
4236,
3126,
14277,
21709,
24163,
2140,
11774,
3917,
1006,
1007,
1025,
2465,
11066,
2121,
2465,
11066,
2121,
1027,
3443,
26266,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/dialect/jdk/JdkLogFactory.java | JdkLogFactory.readConfig | private void readConfig() {
//避免循环引用,Log初始化的时候不使用相关工具类
InputStream in = ResourceUtil.getStreamSafe("logging.properties");
if(null == in){
System.err.println("[WARN] Can not find [logging.properties], use [%JRE_HOME%/lib/logging.properties] as default!");
return;
}
try {
LogManager.getLogManager().readConfiguration(in);
} catch (Exception e) {
Console.error(e, "Read [logging.properties] from classpath error!");
try {
LogManager.getLogManager().readConfiguration();
} catch (Exception e1) {
Console.error(e, "Read [logging.properties] from [%JRE_HOME%/lib/logging.properties] error!");
}
} finally {
IoUtil.close(in);
}
} | java | private void readConfig() {
//避免循环引用,Log初始化的时候不使用相关工具类
InputStream in = ResourceUtil.getStreamSafe("logging.properties");
if(null == in){
System.err.println("[WARN] Can not find [logging.properties], use [%JRE_HOME%/lib/logging.properties] as default!");
return;
}
try {
LogManager.getLogManager().readConfiguration(in);
} catch (Exception e) {
Console.error(e, "Read [logging.properties] from classpath error!");
try {
LogManager.getLogManager().readConfiguration();
} catch (Exception e1) {
Console.error(e, "Read [logging.properties] from [%JRE_HOME%/lib/logging.properties] error!");
}
} finally {
IoUtil.close(in);
}
} | [
"private",
"void",
"readConfig",
"(",
")",
"{",
"//避免循环引用,Log初始化的时候不使用相关工具类\r",
"InputStream",
"in",
"=",
"ResourceUtil",
".",
"getStreamSafe",
"(",
"\"logging.properties\"",
")",
";",
"if",
"(",
"null",
"==",
"in",
")",
"{",
"System",
".",
"err",
".",
"printl... | 读取ClassPath下的logging.properties配置文件 | [
"读取ClassPath下的logging",
".",
"properties配置文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/dialect/jdk/JdkLogFactory.java#L38-L58 | train | Read the logging. properties file. | [
30522,
2797,
11675,
3191,
8663,
8873,
2290,
1006,
1007,
1063,
1013,
1013,
100,
100,
100,
100,
100,
100,
1989,
8833,
100,
100,
100,
1916,
100,
100,
1744,
100,
100,
1919,
100,
100,
100,
100,
20407,
25379,
1999,
1027,
7692,
21823,
2140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | example/src/main/java/io/netty/example/http2/helloworld/multiplex/server/HelloWorldHttp2Handler.java | HelloWorldHttp2Handler.onHeadersRead | private static void onHeadersRead(ChannelHandlerContext ctx, Http2HeadersFrame headers)
throws Exception {
if (headers.isEndStream()) {
ByteBuf content = ctx.alloc().buffer();
content.writeBytes(RESPONSE_BYTES.duplicate());
ByteBufUtil.writeAscii(content, " - via HTTP/2");
sendResponse(ctx, content);
}
} | java | private static void onHeadersRead(ChannelHandlerContext ctx, Http2HeadersFrame headers)
throws Exception {
if (headers.isEndStream()) {
ByteBuf content = ctx.alloc().buffer();
content.writeBytes(RESPONSE_BYTES.duplicate());
ByteBufUtil.writeAscii(content, " - via HTTP/2");
sendResponse(ctx, content);
}
} | [
"private",
"static",
"void",
"onHeadersRead",
"(",
"ChannelHandlerContext",
"ctx",
",",
"Http2HeadersFrame",
"headers",
")",
"throws",
"Exception",
"{",
"if",
"(",
"headers",
".",
"isEndStream",
"(",
")",
")",
"{",
"ByteBuf",
"content",
"=",
"ctx",
".",
"alloc... | If receive a frame with end-of-stream set, send a pre-canned response. | [
"If",
"receive",
"a",
"frame",
"with",
"end",
"-",
"of",
"-",
"stream",
"set",
"send",
"a",
"pre",
"-",
"canned",
"response",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http2/helloworld/multiplex/server/HelloWorldHttp2Handler.java#L83-L91 | train | On headers read. | [
30522,
2797,
10763,
11675,
2006,
4974,
2545,
16416,
2094,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
30524,
4339,
3762,
4570,
1006,
3433,
1035,
27507,
1012,
24473,
1006,
1007,
1007,
1025,
24880,
8569,
11263,
3775,
2140,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java | DaoTemplate.del | public <T> int del(T pk) throws SQLException {
if (pk == null) {
return 0;
}
return this.del(Entity.create(tableName).set(primaryKeyField, pk));
} | java | public <T> int del(T pk) throws SQLException {
if (pk == null) {
return 0;
}
return this.del(Entity.create(tableName).set(primaryKeyField, pk));
} | [
"public",
"<",
"T",
">",
"int",
"del",
"(",
"T",
"pk",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"pk",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"return",
"this",
".",
"del",
"(",
"Entity",
".",
"create",
"(",
"tableName",
")",
".",
... | 删除
@param <T> 主键类型
@param pk 主键
@return 删除行数
@throws SQLException SQL执行异常 | [
"删除",
"@param",
"<T",
">",
"主键类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java#L120-L125 | train | Delete the entity with the specified primary key. | [
30522,
2270,
1026,
1056,
1028,
20014,
3972,
1006,
1056,
1052,
2243,
1007,
11618,
29296,
10288,
24422,
1063,
2065,
1006,
1052,
2243,
1027,
1027,
19701,
1007,
1063,
2709,
1014,
1025,
1065,
2709,
2023,
1012,
3972,
1006,
9178,
1012,
3443,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/LoadableComponent.java | LoadableComponent.get | @SuppressWarnings("unchecked")
public T get() {
try {
isLoaded();
return (T) this;
} catch (Error e) {
load();
}
isLoaded();
return (T) this;
} | java | @SuppressWarnings("unchecked")
public T get() {
try {
isLoaded();
return (T) this;
} catch (Error e) {
load();
}
isLoaded();
return (T) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"get",
"(",
")",
"{",
"try",
"{",
"isLoaded",
"(",
")",
";",
"return",
"(",
"T",
")",
"this",
";",
"}",
"catch",
"(",
"Error",
"e",
")",
"{",
"load",
"(",
")",
";",
"}",
"isLoaded... | Ensure that the component is currently loaded.
@return The component.
@throws Error when the component cannot be loaded. | [
"Ensure",
"that",
"the",
"component",
"is",
"currently",
"loaded",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/LoadableComponent.java#L43-L55 | train | Get the CID object. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
1056,
2131,
1006,
1007,
1063,
3046,
1063,
2003,
17468,
1006,
1007,
1025,
2709,
1006,
1056,
1007,
2023,
1025,
1065,
4608,
1006,
7561,
1041,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.unZlib | public static String unZlib(byte[] buf, String charset) {
return StrUtil.str(unZlib(buf), charset);
} | java | public static String unZlib(byte[] buf, String charset) {
return StrUtil.str(unZlib(buf), charset);
} | [
"public",
"static",
"String",
"unZlib",
"(",
"byte",
"[",
"]",
"buf",
",",
"String",
"charset",
")",
"{",
"return",
"StrUtil",
".",
"str",
"(",
"unZlib",
"(",
"buf",
")",
",",
"charset",
")",
";",
"}"
] | Zlib解压缩处理
@param buf 压缩过的字节流
@param charset 编码
@return 解压后的字符串
@since 4.1.4 | [
"Zlib解压缩处理"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L698-L700 | train | Returns the UTF - 8 encoded string from the given byte array. | [
30522,
2270,
10763,
5164,
4895,
2480,
29521,
1006,
24880,
1031,
1033,
20934,
2546,
1010,
5164,
25869,
13462,
1007,
1063,
2709,
2358,
22134,
4014,
1012,
2358,
2099,
1006,
4895,
2480,
29521,
1006,
20934,
2546,
1007,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/util/HandlerUtils.java | HandlerUtils.sendErrorResponse | public static CompletableFuture<Void> sendErrorResponse(
ChannelHandlerContext channelHandlerContext,
HttpRequest httpRequest,
ErrorResponseBody errorMessage,
HttpResponseStatus statusCode,
Map<String, String> headers) {
return sendErrorResponse(
channelHandlerContext,
HttpHeaders.isKeepAlive(httpRequest),
errorMessage,
statusCode,
headers);
} | java | public static CompletableFuture<Void> sendErrorResponse(
ChannelHandlerContext channelHandlerContext,
HttpRequest httpRequest,
ErrorResponseBody errorMessage,
HttpResponseStatus statusCode,
Map<String, String> headers) {
return sendErrorResponse(
channelHandlerContext,
HttpHeaders.isKeepAlive(httpRequest),
errorMessage,
statusCode,
headers);
} | [
"public",
"static",
"CompletableFuture",
"<",
"Void",
">",
"sendErrorResponse",
"(",
"ChannelHandlerContext",
"channelHandlerContext",
",",
"HttpRequest",
"httpRequest",
",",
"ErrorResponseBody",
"errorMessage",
",",
"HttpResponseStatus",
"statusCode",
",",
"Map",
"<",
"S... | Sends the given error response and status code to the given channel.
@param channelHandlerContext identifying the open channel
@param httpRequest originating http request
@param errorMessage which should be sent
@param statusCode of the message to send
@param headers additional header values | [
"Sends",
"the",
"given",
"error",
"response",
"and",
"status",
"code",
"to",
"the",
"given",
"channel",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/util/HandlerUtils.java#L108-L121 | train | Sends an error response to the client. | [
30522,
2270,
10763,
4012,
10814,
10880,
11263,
11244,
1026,
11675,
1028,
4604,
2121,
29165,
6072,
26029,
3366,
1006,
3149,
11774,
3917,
8663,
18209,
3149,
11774,
3917,
8663,
18209,
1010,
8299,
2890,
15500,
8299,
2890,
15500,
1010,
7561,
6072,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
redisson/redisson | redisson/src/main/java/org/redisson/misc/HighwayHash.java | HighwayHash.finalize128 | public long[] finalize128() {
permuteAndUpdate();
permuteAndUpdate();
permuteAndUpdate();
permuteAndUpdate();
permuteAndUpdate();
permuteAndUpdate();
done = true;
long[] hash = new long[2];
hash[0] = v0[0] + mul0[0] + v1[2] + mul1[2];
hash[1] = v0[1] + mul0[1] + v1[3] + mul1[3];
return hash;
} | java | public long[] finalize128() {
permuteAndUpdate();
permuteAndUpdate();
permuteAndUpdate();
permuteAndUpdate();
permuteAndUpdate();
permuteAndUpdate();
done = true;
long[] hash = new long[2];
hash[0] = v0[0] + mul0[0] + v1[2] + mul1[2];
hash[1] = v0[1] + mul0[1] + v1[3] + mul1[3];
return hash;
} | [
"public",
"long",
"[",
"]",
"finalize128",
"(",
")",
"{",
"permuteAndUpdate",
"(",
")",
";",
"permuteAndUpdate",
"(",
")",
";",
"permuteAndUpdate",
"(",
")",
";",
"permuteAndUpdate",
"(",
")",
";",
"permuteAndUpdate",
"(",
")",
";",
"permuteAndUpdate",
"(",
... | Computes the hash value after all bytes were processed. Invalidates the
state.
NOTE: The 128-bit HighwayHash algorithm is not yet frozen and subject to change.
@return array of size 2 containing 128-bit hash | [
"Computes",
"the",
"hash",
"value",
"after",
"all",
"bytes",
"were",
"processed",
".",
"Invalidates",
"the",
"state",
"."
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/misc/HighwayHash.java#L171-L183 | train | Finalize the sequence by permuting the sequence and then computing the hash. | [
30522,
2270,
2146,
1031,
1033,
2345,
4697,
12521,
2620,
1006,
1007,
1063,
2566,
26746,
5685,
6279,
13701,
1006,
1007,
1025,
2566,
26746,
5685,
6279,
13701,
1006,
1007,
1025,
2566,
26746,
5685,
6279,
13701,
1006,
1007,
1025,
2566,
26746,
568... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.toBuffered | public static BufferedInputStream toBuffered(InputStream in) {
return (in instanceof BufferedInputStream) ? (BufferedInputStream) in : new BufferedInputStream(in);
} | java | public static BufferedInputStream toBuffered(InputStream in) {
return (in instanceof BufferedInputStream) ? (BufferedInputStream) in : new BufferedInputStream(in);
} | [
"public",
"static",
"BufferedInputStream",
"toBuffered",
"(",
"InputStream",
"in",
")",
"{",
"return",
"(",
"in",
"instanceof",
"BufferedInputStream",
")",
"?",
"(",
"BufferedInputStream",
")",
"in",
":",
"new",
"BufferedInputStream",
"(",
"in",
")",
";",
"}"
] | 转换为{@link BufferedInputStream}
@param in {@link InputStream}
@return {@link BufferedInputStream}
@since 4.0.10 | [
"转换为",
"{",
"@link",
"BufferedInputStream",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L803-L805 | train | Converts an input stream to a buffered input stream. | [
30522,
2270,
10763,
17698,
2098,
2378,
18780,
21422,
2000,
8569,
12494,
2098,
1006,
20407,
25379,
1999,
1007,
1063,
2709,
1006,
1999,
6013,
11253,
17698,
2098,
2378,
18780,
21422,
1007,
1029,
1006,
17698,
2098,
2378,
18780,
21422,
1007,
1999,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/IncrementalRemoteKeyedStateHandle.java | IncrementalRemoteKeyedStateHandle.createSharedStateRegistryKeyFromFileName | @VisibleForTesting
public SharedStateRegistryKey createSharedStateRegistryKeyFromFileName(StateHandleID shId) {
return new SharedStateRegistryKey(String.valueOf(backendIdentifier) + '-' + keyGroupRange, shId);
} | java | @VisibleForTesting
public SharedStateRegistryKey createSharedStateRegistryKeyFromFileName(StateHandleID shId) {
return new SharedStateRegistryKey(String.valueOf(backendIdentifier) + '-' + keyGroupRange, shId);
} | [
"@",
"VisibleForTesting",
"public",
"SharedStateRegistryKey",
"createSharedStateRegistryKeyFromFileName",
"(",
"StateHandleID",
"shId",
")",
"{",
"return",
"new",
"SharedStateRegistryKey",
"(",
"String",
".",
"valueOf",
"(",
"backendIdentifier",
")",
"+",
"'",
"'",
"+",... | Create a unique key to register one of our shared state handles. | [
"Create",
"a",
"unique",
"key",
"to",
"register",
"one",
"of",
"our",
"shared",
"state",
"handles",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/IncrementalRemoteKeyedStateHandle.java#L267-L270 | train | Create a SharedStateRegistryKey from the given state handle ID. | [
30522,
1030,
5710,
13028,
4355,
2075,
2270,
4207,
9153,
3334,
13910,
2923,
2854,
14839,
9005,
8167,
2098,
9153,
3334,
13910,
2923,
2854,
14839,
19699,
5358,
8873,
20844,
4168,
1006,
2110,
11774,
23057,
2094,
11895,
2094,
1007,
1063,
2709,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java | AbstractFetcher.updateMinPunctuatedWatermark | private void updateMinPunctuatedWatermark(Watermark nextWatermark) {
if (nextWatermark.getTimestamp() > maxWatermarkSoFar) {
long newMin = Long.MAX_VALUE;
for (KafkaTopicPartitionState<?> state : subscribedPartitionStates) {
@SuppressWarnings("unchecked")
final KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH> withWatermarksState =
(KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH>) state;
newMin = Math.min(newMin, withWatermarksState.getCurrentPartitionWatermark());
}
// double-check locking pattern
if (newMin > maxWatermarkSoFar) {
synchronized (checkpointLock) {
if (newMin > maxWatermarkSoFar) {
maxWatermarkSoFar = newMin;
sourceContext.emitWatermark(new Watermark(newMin));
}
}
}
}
} | java | private void updateMinPunctuatedWatermark(Watermark nextWatermark) {
if (nextWatermark.getTimestamp() > maxWatermarkSoFar) {
long newMin = Long.MAX_VALUE;
for (KafkaTopicPartitionState<?> state : subscribedPartitionStates) {
@SuppressWarnings("unchecked")
final KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH> withWatermarksState =
(KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH>) state;
newMin = Math.min(newMin, withWatermarksState.getCurrentPartitionWatermark());
}
// double-check locking pattern
if (newMin > maxWatermarkSoFar) {
synchronized (checkpointLock) {
if (newMin > maxWatermarkSoFar) {
maxWatermarkSoFar = newMin;
sourceContext.emitWatermark(new Watermark(newMin));
}
}
}
}
} | [
"private",
"void",
"updateMinPunctuatedWatermark",
"(",
"Watermark",
"nextWatermark",
")",
"{",
"if",
"(",
"nextWatermark",
".",
"getTimestamp",
"(",
")",
">",
"maxWatermarkSoFar",
")",
"{",
"long",
"newMin",
"=",
"Long",
".",
"MAX_VALUE",
";",
"for",
"(",
"Ka... | Checks whether a new per-partition watermark is also a new cross-partition watermark. | [
"Checks",
"whether",
"a",
"new",
"per",
"-",
"partition",
"watermark",
"is",
"also",
"a",
"new",
"cross",
"-",
"partition",
"watermark",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java#L473-L495 | train | Update the min pure watermark | [
30522,
2797,
11675,
10651,
10020,
14289,
12273,
26302,
3064,
5880,
10665,
1006,
2300,
10665,
2279,
5880,
10665,
1007,
1063,
2065,
1006,
2279,
5880,
10665,
1012,
2131,
7292,
9153,
8737,
1006,
1007,
1028,
4098,
5880,
27373,
11253,
2906,
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... |
networknt/light-4j | body/src/main/java/com/networknt/body/BodyHandler.java | BodyHandler.attachFormDataBody | private void attachFormDataBody(final HttpServerExchange exchange) throws IOException {
Object data;
FormParserFactory formParserFactory = FormParserFactory.builder().build();
FormDataParser parser = formParserFactory.createParser(exchange);
if (parser != null) {
FormData formData = parser.parseBlocking();
data = BodyConverter.convert(formData);
exchange.putAttachment(REQUEST_BODY, data);
}
} | java | private void attachFormDataBody(final HttpServerExchange exchange) throws IOException {
Object data;
FormParserFactory formParserFactory = FormParserFactory.builder().build();
FormDataParser parser = formParserFactory.createParser(exchange);
if (parser != null) {
FormData formData = parser.parseBlocking();
data = BodyConverter.convert(formData);
exchange.putAttachment(REQUEST_BODY, data);
}
} | [
"private",
"void",
"attachFormDataBody",
"(",
"final",
"HttpServerExchange",
"exchange",
")",
"throws",
"IOException",
"{",
"Object",
"data",
";",
"FormParserFactory",
"formParserFactory",
"=",
"FormParserFactory",
".",
"builder",
"(",
")",
".",
"build",
"(",
")",
... | Method used to parse the body into FormData and attach it into exchange
@param exchange exchange to be attached
@throws IOException | [
"Method",
"used",
"to",
"parse",
"the",
"body",
"into",
"FormData",
"and",
"attach",
"it",
"into",
"exchange"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/body/src/main/java/com/networknt/body/BodyHandler.java#L125-L134 | train | Attach the form data body to the HttpServerExchange | [
30522,
2797,
11675,
22476,
14192,
2850,
2696,
23684,
1006,
2345,
16770,
2121,
28943,
2595,
22305,
2063,
3863,
1007,
11618,
22834,
10288,
24422,
1063,
4874,
2951,
1025,
2433,
19362,
8043,
21450,
2433,
19362,
8043,
21450,
1027,
2433,
19362,
804... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.toUpperCase | public UTF8String toUpperCase() {
if (numBytes == 0) {
return EMPTY_UTF8;
}
byte[] bytes = new byte[numBytes];
bytes[0] = (byte) Character.toTitleCase(getByte(0));
for (int i = 0; i < numBytes; i++) {
byte b = getByte(i);
if (numBytesForFirstByte(b) != 1) {
// fallback
return toUpperCaseSlow();
}
int upper = Character.toUpperCase((int) b);
if (upper > 127) {
// fallback
return toUpperCaseSlow();
}
bytes[i] = (byte) upper;
}
return fromBytes(bytes);
} | java | public UTF8String toUpperCase() {
if (numBytes == 0) {
return EMPTY_UTF8;
}
byte[] bytes = new byte[numBytes];
bytes[0] = (byte) Character.toTitleCase(getByte(0));
for (int i = 0; i < numBytes; i++) {
byte b = getByte(i);
if (numBytesForFirstByte(b) != 1) {
// fallback
return toUpperCaseSlow();
}
int upper = Character.toUpperCase((int) b);
if (upper > 127) {
// fallback
return toUpperCaseSlow();
}
bytes[i] = (byte) upper;
}
return fromBytes(bytes);
} | [
"public",
"UTF8String",
"toUpperCase",
"(",
")",
"{",
"if",
"(",
"numBytes",
"==",
"0",
")",
"{",
"return",
"EMPTY_UTF8",
";",
"}",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"numBytes",
"]",
";",
"bytes",
"[",
"0",
"]",
"=",
"(",
"byte",
... | Returns the upper case of this string | [
"Returns",
"the",
"upper",
"case",
"of",
"this",
"string"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L390-L411 | train | Get the upper case of this string. | [
30522,
2270,
21183,
2546,
2620,
3367,
4892,
2000,
29547,
18992,
3366,
1006,
1007,
1063,
2065,
1006,
15903,
17250,
2015,
1027,
1027,
1014,
1007,
1063,
2709,
4064,
1035,
21183,
2546,
2620,
1025,
1065,
24880,
1031,
1033,
27507,
1027,
2047,
248... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/utils/proxy/GraphAlgorithmWrappingBase.java | GraphAlgorithmWrappingBase.mergeConfiguration | protected void mergeConfiguration(GraphAlgorithmWrappingBase other) {
Preconditions.checkNotNull(other);
parallelism = (parallelism == PARALLELISM_DEFAULT) ? other.parallelism :
((other.parallelism == PARALLELISM_DEFAULT) ? parallelism : Math.min(parallelism, other.parallelism));
} | java | protected void mergeConfiguration(GraphAlgorithmWrappingBase other) {
Preconditions.checkNotNull(other);
parallelism = (parallelism == PARALLELISM_DEFAULT) ? other.parallelism :
((other.parallelism == PARALLELISM_DEFAULT) ? parallelism : Math.min(parallelism, other.parallelism));
} | [
"protected",
"void",
"mergeConfiguration",
"(",
"GraphAlgorithmWrappingBase",
"other",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"other",
")",
";",
"parallelism",
"=",
"(",
"parallelism",
"==",
"PARALLELISM_DEFAULT",
")",
"?",
"other",
".",
"parallelism",... | Merge the other configuration into this algorithm's after the call to
{@link #canMergeConfigurationWith} has checked that the configurations
can be merged.
@param other the algorithm from which to merge configuration
@see #canMergeConfigurationWith(GraphAlgorithmWrappingBase) | [
"Merge",
"the",
"other",
"configuration",
"into",
"this",
"algorithm",
"s",
"after",
"the",
"call",
"to",
"{",
"@link",
"#canMergeConfigurationWith",
"}",
"has",
"checked",
"that",
"the",
"configurations",
"can",
"be",
"merged",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/proxy/GraphAlgorithmWrappingBase.java#L103-L108 | train | Merges the configuration of this algorithm with the given configuration. | [
30522,
5123,
11675,
13590,
8663,
8873,
27390,
3370,
1006,
10629,
2389,
20255,
8939,
2213,
13088,
29098,
2075,
15058,
2060,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
2060,
1007,
1025,
5903,
2964,
1027,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java | RestTemplateBuilder.rootUri | public RestTemplateBuilder rootUri(String rootUri) {
return new RestTemplateBuilder(this.detectRequestFactory, rootUri,
this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.requestFactoryCustomizer,
this.interceptors);
} | java | public RestTemplateBuilder rootUri(String rootUri) {
return new RestTemplateBuilder(this.detectRequestFactory, rootUri,
this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.requestFactoryCustomizer,
this.interceptors);
} | [
"public",
"RestTemplateBuilder",
"rootUri",
"(",
"String",
"rootUri",
")",
"{",
"return",
"new",
"RestTemplateBuilder",
"(",
"this",
".",
"detectRequestFactory",
",",
"rootUri",
",",
"this",
".",
"messageConverters",
",",
"this",
".",
"requestFactorySupplier",
",",
... | Set a root URL that should be applied to each request that starts with {@code '/'}.
See {@link RootUriTemplateHandler} for details.
@param rootUri the root URI or {@code null}
@return a new builder instance | [
"Set",
"a",
"root",
"URL",
"that",
"should",
"be",
"applied",
"to",
"each",
"request",
"that",
"starts",
"with",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java#L146-L152 | train | Create a new RestTemplateBuilder with the specified root URI. | [
30522,
2270,
2717,
18532,
15725,
8569,
23891,
2099,
7117,
9496,
1006,
5164,
7117,
9496,
1007,
1063,
2709,
2047,
2717,
18532,
15725,
8569,
23891,
2099,
1006,
2023,
1012,
11487,
2890,
15500,
21450,
1010,
7117,
9496,
1010,
2023,
1012,
4471,
86... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateUUID | public static <T extends CharSequence> T validateUUID(T value, String errorMsg) throws ValidateException {
if (false == isUUID(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validateUUID(T value, String errorMsg) throws ValidateException {
if (false == isUUID(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateUUID",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isUUID",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"Va... | 验证是否为UUID<br>
包括带横线标准格式和不带横线的简单模式
@param <T> 字符串类型
@param value 值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证是否为UUID<br",
">",
"包括带横线标准格式和不带横线的简单模式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L1002-L1007 | train | Validate UUID. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
9398,
3686,
2226,
21272,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
1027,
2003,
2226,
21272... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java | HttpPostMultipartRequestDecoder.parseBody | private void parseBody() {
if (currentStatus == MultiPartStatus.PREEPILOGUE || currentStatus == MultiPartStatus.EPILOGUE) {
if (isLastChunk) {
currentStatus = MultiPartStatus.EPILOGUE;
}
return;
}
parseBodyMultipart();
} | java | private void parseBody() {
if (currentStatus == MultiPartStatus.PREEPILOGUE || currentStatus == MultiPartStatus.EPILOGUE) {
if (isLastChunk) {
currentStatus = MultiPartStatus.EPILOGUE;
}
return;
}
parseBodyMultipart();
} | [
"private",
"void",
"parseBody",
"(",
")",
"{",
"if",
"(",
"currentStatus",
"==",
"MultiPartStatus",
".",
"PREEPILOGUE",
"||",
"currentStatus",
"==",
"MultiPartStatus",
".",
"EPILOGUE",
")",
"{",
"if",
"(",
"isLastChunk",
")",
"{",
"currentStatus",
"=",
"MultiP... | This getMethod will parse as much as possible data and fill the list and map
@throws ErrorDataDecoderException
if there is a problem with the charset decoding or other
errors | [
"This",
"getMethod",
"will",
"parse",
"as",
"much",
"as",
"possible",
"data",
"and",
"fill",
"the",
"list",
"and",
"map"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L404-L412 | train | Parse the body of the request. | [
30522,
2797,
11675,
11968,
3366,
23684,
1006,
1007,
1063,
2065,
1006,
14731,
29336,
2271,
1027,
1027,
4800,
26950,
29336,
2271,
1012,
3653,
13699,
22360,
9077,
1064,
1064,
14731,
29336,
30524,
8950,
1007,
1063,
14731,
29336,
2271,
1027,
4800,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.generateKeyPair | public static KeyPair generateKeyPair(String algorithm, AlgorithmParameterSpec params) {
return generateKeyPair(algorithm, null, params);
} | java | public static KeyPair generateKeyPair(String algorithm, AlgorithmParameterSpec params) {
return generateKeyPair(algorithm, null, params);
} | [
"public",
"static",
"KeyPair",
"generateKeyPair",
"(",
"String",
"algorithm",
",",
"AlgorithmParameterSpec",
"params",
")",
"{",
"return",
"generateKeyPair",
"(",
"algorithm",
",",
"null",
",",
"params",
")",
";",
"}"
] | 生成用于非对称加密的公钥和私钥<br>
密钥对生成算法见:https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#KeyPairGenerator
@param algorithm 非对称加密算法
@param params {@link AlgorithmParameterSpec}
@return {@link KeyPair}
@since 4.3.3 | [
"生成用于非对称加密的公钥和私钥<br",
">",
"密钥对生成算法见:https",
":",
"//",
"docs",
".",
"oracle",
".",
"com",
"/",
"javase",
"/",
"7",
"/",
"docs",
"/",
"technotes",
"/",
"guides",
"/",
"security",
"/",
"StandardNames",
".",
"html#KeyPairGenerator"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L364-L366 | train | Generates a key pair using the specified algorithm and parameters. | [
30522,
2270,
10763,
3145,
4502,
4313,
9699,
14839,
4502,
4313,
1006,
5164,
9896,
1010,
9896,
28689,
22828,
13102,
8586,
11498,
5244,
1007,
1063,
2709,
9699,
14839,
4502,
4313,
1006,
9896,
1010,
19701,
1010,
11498,
5244,
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... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshotData.java | PojoSerializerSnapshotData.createFrom | static <T> PojoSerializerSnapshotData<T> createFrom(
Class<T> pojoClass,
Field[] fields,
TypeSerializerSnapshot<?>[] existingFieldSerializerSnapshots,
LinkedHashMap<Class<?>, TypeSerializerSnapshot<?>> existingRegisteredSubclassSerializerSnapshots,
Map<Class<?>, TypeSerializerSnapshot<?>> existingNonRegisteredSubclassSerializerSnapshots) {
final LinkedOptionalMap<Field, TypeSerializerSnapshot<?>> fieldSerializerSnapshots = new LinkedOptionalMap<>(fields.length);
for (int i = 0; i < fields.length; i++) {
Field field = fields[i];
String fieldName = (field == null) ? getDummyNameForMissingField(i) : field.getName();
fieldSerializerSnapshots.put(fieldName, field, existingFieldSerializerSnapshots[i]);
}
return new PojoSerializerSnapshotData<>(
pojoClass,
fieldSerializerSnapshots,
optionalMapOf(existingRegisteredSubclassSerializerSnapshots, Class::getName),
optionalMapOf(existingNonRegisteredSubclassSerializerSnapshots, Class::getName));
} | java | static <T> PojoSerializerSnapshotData<T> createFrom(
Class<T> pojoClass,
Field[] fields,
TypeSerializerSnapshot<?>[] existingFieldSerializerSnapshots,
LinkedHashMap<Class<?>, TypeSerializerSnapshot<?>> existingRegisteredSubclassSerializerSnapshots,
Map<Class<?>, TypeSerializerSnapshot<?>> existingNonRegisteredSubclassSerializerSnapshots) {
final LinkedOptionalMap<Field, TypeSerializerSnapshot<?>> fieldSerializerSnapshots = new LinkedOptionalMap<>(fields.length);
for (int i = 0; i < fields.length; i++) {
Field field = fields[i];
String fieldName = (field == null) ? getDummyNameForMissingField(i) : field.getName();
fieldSerializerSnapshots.put(fieldName, field, existingFieldSerializerSnapshots[i]);
}
return new PojoSerializerSnapshotData<>(
pojoClass,
fieldSerializerSnapshots,
optionalMapOf(existingRegisteredSubclassSerializerSnapshots, Class::getName),
optionalMapOf(existingNonRegisteredSubclassSerializerSnapshots, Class::getName));
} | [
"static",
"<",
"T",
">",
"PojoSerializerSnapshotData",
"<",
"T",
">",
"createFrom",
"(",
"Class",
"<",
"T",
">",
"pojoClass",
",",
"Field",
"[",
"]",
"fields",
",",
"TypeSerializerSnapshot",
"<",
"?",
">",
"[",
"]",
"existingFieldSerializerSnapshots",
",",
"... | Creates a {@link PojoSerializerSnapshotData} from existing snapshotted configuration of a {@link PojoSerializer}. | [
"Creates",
"a",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshotData.java#L128-L147 | train | Creates a new instance of the PojoSerializerSnapshotData class. | [
30522,
10763,
1026,
1056,
1028,
13433,
19929,
11610,
28863,
2015,
2532,
4523,
12326,
2850,
2696,
1026,
1056,
1028,
3443,
19699,
5358,
1006,
2465,
1026,
1056,
1028,
13433,
5558,
26266,
1010,
2492,
1031,
1033,
4249,
1010,
4127,
11610,
28863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/pattern/CronPattern.java | CronPattern.match | public boolean match(TimeZone timezone, long millis, boolean isMatchSecond) {
final GregorianCalendar calendar = new GregorianCalendar(timezone);
calendar.setTimeInMillis(millis);
return match(calendar, isMatchSecond);
} | java | public boolean match(TimeZone timezone, long millis, boolean isMatchSecond) {
final GregorianCalendar calendar = new GregorianCalendar(timezone);
calendar.setTimeInMillis(millis);
return match(calendar, isMatchSecond);
} | [
"public",
"boolean",
"match",
"(",
"TimeZone",
"timezone",
",",
"long",
"millis",
",",
"boolean",
"isMatchSecond",
")",
"{",
"final",
"GregorianCalendar",
"calendar",
"=",
"new",
"GregorianCalendar",
"(",
"timezone",
")",
";",
"calendar",
".",
"setTimeInMillis",
... | 给定时间是否匹配定时任务表达式
@param timezone 时区 {@link TimeZone}
@param millis 时间毫秒数
@param isMatchSecond 是否匹配秒
@return 如果匹配返回 <code>true</code>, 否则返回 <code>false</code> | [
"给定时间是否匹配定时任务表达式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/CronPattern.java#L144-L148 | train | Returns true if this calendar object matches the given time. | [
30522,
2270,
22017,
20898,
2674,
1006,
2051,
15975,
2051,
15975,
1010,
2146,
4971,
2483,
1010,
22017,
20898,
2003,
18900,
18069,
8586,
15422,
1007,
1063,
2345,
25847,
9289,
10497,
2906,
8094,
1027,
2047,
25847,
9289,
10497,
2906,
1006,
2051,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java | ColumnVector.getBytes | public byte[] getBytes(int rowId, int count) {
byte[] res = new byte[count];
for (int i = 0; i < count; i++) {
res[i] = getByte(rowId + i);
}
return res;
} | java | public byte[] getBytes(int rowId, int count) {
byte[] res = new byte[count];
for (int i = 0; i < count; i++) {
res[i] = getByte(rowId + i);
}
return res;
} | [
"public",
"byte",
"[",
"]",
"getBytes",
"(",
"int",
"rowId",
",",
"int",
"count",
")",
"{",
"byte",
"[",
"]",
"res",
"=",
"new",
"byte",
"[",
"count",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
... | Gets byte type values from [rowId, rowId + count). The return values for the null slots
are undefined and can be anything. | [
"Gets",
"byte",
"type",
"values",
"from",
"[",
"rowId",
"rowId",
"+",
"count",
")",
".",
"The",
"return",
"values",
"for",
"the",
"null",
"slots",
"are",
"undefined",
"and",
"can",
"be",
"anything",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L110-L116 | train | Gets the bytes from the specified row. | [
30522,
2270,
24880,
1031,
1033,
2131,
3762,
4570,
1006,
20014,
5216,
3593,
1010,
20014,
4175,
1007,
1063,
24880,
1031,
1033,
24501,
1027,
2047,
24880,
1031,
4175,
1033,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
4175,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | SpringApplication.postProcessApplicationContext | protected void postProcessApplicationContext(ConfigurableApplicationContext context) {
if (this.beanNameGenerator != null) {
context.getBeanFactory().registerSingleton(
AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR,
this.beanNameGenerator);
}
if (this.resourceLoader != null) {
if (context instanceof GenericApplicationContext) {
((GenericApplicationContext) context)
.setResourceLoader(this.resourceLoader);
}
if (context instanceof DefaultResourceLoader) {
((DefaultResourceLoader) context)
.setClassLoader(this.resourceLoader.getClassLoader());
}
}
if (this.addConversionService) {
context.getBeanFactory().setConversionService(
ApplicationConversionService.getSharedInstance());
}
} | java | protected void postProcessApplicationContext(ConfigurableApplicationContext context) {
if (this.beanNameGenerator != null) {
context.getBeanFactory().registerSingleton(
AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR,
this.beanNameGenerator);
}
if (this.resourceLoader != null) {
if (context instanceof GenericApplicationContext) {
((GenericApplicationContext) context)
.setResourceLoader(this.resourceLoader);
}
if (context instanceof DefaultResourceLoader) {
((DefaultResourceLoader) context)
.setClassLoader(this.resourceLoader.getClassLoader());
}
}
if (this.addConversionService) {
context.getBeanFactory().setConversionService(
ApplicationConversionService.getSharedInstance());
}
} | [
"protected",
"void",
"postProcessApplicationContext",
"(",
"ConfigurableApplicationContext",
"context",
")",
"{",
"if",
"(",
"this",
".",
"beanNameGenerator",
"!=",
"null",
")",
"{",
"context",
".",
"getBeanFactory",
"(",
")",
".",
"registerSingleton",
"(",
"Annotat... | Apply any relevant post processing the {@link ApplicationContext}. Subclasses can
apply additional processing as required.
@param context the application context | [
"Apply",
"any",
"relevant",
"post",
"processing",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L622-L642 | train | Post process the application context. | [
30522,
5123,
11675,
2695,
21572,
9623,
3736,
9397,
19341,
3508,
8663,
18209,
1006,
9530,
8873,
27390,
3085,
29098,
19341,
3508,
8663,
18209,
6123,
1007,
1063,
2065,
1006,
2023,
1012,
14068,
18442,
6914,
6906,
4263,
999,
1027,
19701,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java | Router.removePathPattern | public void removePathPattern(String pathPattern) {
for (MethodlessRouter<T> router : routers.values()) {
router.removePathPattern(pathPattern);
}
anyMethodRouter.removePathPattern(pathPattern);
} | java | public void removePathPattern(String pathPattern) {
for (MethodlessRouter<T> router : routers.values()) {
router.removePathPattern(pathPattern);
}
anyMethodRouter.removePathPattern(pathPattern);
} | [
"public",
"void",
"removePathPattern",
"(",
"String",
"pathPattern",
")",
"{",
"for",
"(",
"MethodlessRouter",
"<",
"T",
">",
"router",
":",
"routers",
".",
"values",
"(",
")",
")",
"{",
"router",
".",
"removePathPattern",
"(",
"pathPattern",
")",
";",
"}"... | Removes the route specified by the path pattern. | [
"Removes",
"the",
"route",
"specified",
"by",
"the",
"path",
"pattern",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java#L207-L212 | train | Removes a path pattern from the router. | [
30522,
2270,
11675,
6366,
15069,
4502,
12079,
2078,
1006,
5164,
30524,
2099,
1012,
6366,
15069,
4502,
12079,
2078,
1006,
4130,
4502,
12079,
2078,
1007,
1025,
1065,
2151,
11368,
6806,
22196,
19901,
1012,
6366,
15069,
4502,
12079,
2078,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java | EmbeddedChannel.checkException | private ChannelFuture checkException(ChannelPromise promise) {
Throwable t = lastException;
if (t != null) {
lastException = null;
if (promise.isVoid()) {
PlatformDependent.throwException(t);
}
return promise.setFailure(t);
}
return promise.setSuccess();
} | java | private ChannelFuture checkException(ChannelPromise promise) {
Throwable t = lastException;
if (t != null) {
lastException = null;
if (promise.isVoid()) {
PlatformDependent.throwException(t);
}
return promise.setFailure(t);
}
return promise.setSuccess();
} | [
"private",
"ChannelFuture",
"checkException",
"(",
"ChannelPromise",
"promise",
")",
"{",
"Throwable",
"t",
"=",
"lastException",
";",
"if",
"(",
"t",
"!=",
"null",
")",
"{",
"lastException",
"=",
"null",
";",
"if",
"(",
"promise",
".",
"isVoid",
"(",
")",... | Checks for the presence of an {@link Exception}. | [
"Checks",
"for",
"the",
"presence",
"of",
"an",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java#L623-L636 | train | Check the exception. | [
30522,
2797,
3149,
11263,
11244,
4638,
10288,
24422,
1006,
3149,
21572,
28732,
4872,
1007,
1063,
5466,
3085,
1056,
1027,
2197,
10288,
24422,
1025,
2065,
1006,
1056,
999,
1027,
19701,
1007,
1063,
2197,
10288,
24422,
1027,
19701,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java | HashUtil.tianlHash | public static long tianlHash(String str) {
long hash = 0;
int iLength = str.length();
if (iLength == 0) {
return 0;
}
if (iLength <= 256) {
hash = 16777216L * (iLength - 1);
} else {
hash = 4278190080L;
}
int i;
char ucChar;
if (iLength <= 96) {
for (i = 1; i <= iLength; i++) {
ucChar = str.charAt(i - 1);
if (ucChar <= 'Z' && ucChar >= 'A') {
ucChar = (char) (ucChar + 32);
}
hash += (3 * i * ucChar * ucChar + 5 * i * ucChar + 7 * i + 11 * ucChar) % 16777216;
}
} else {
for (i = 1; i <= 96; i++) {
ucChar = str.charAt(i + iLength - 96 - 1);
if (ucChar <= 'Z' && ucChar >= 'A') {
ucChar = (char) (ucChar + 32);
}
hash += (3 * i * ucChar * ucChar + 5 * i * ucChar + 7 * i + 11 * ucChar) % 16777216;
}
}
if (hash < 0) {
hash *= -1;
}
return hash;
} | java | public static long tianlHash(String str) {
long hash = 0;
int iLength = str.length();
if (iLength == 0) {
return 0;
}
if (iLength <= 256) {
hash = 16777216L * (iLength - 1);
} else {
hash = 4278190080L;
}
int i;
char ucChar;
if (iLength <= 96) {
for (i = 1; i <= iLength; i++) {
ucChar = str.charAt(i - 1);
if (ucChar <= 'Z' && ucChar >= 'A') {
ucChar = (char) (ucChar + 32);
}
hash += (3 * i * ucChar * ucChar + 5 * i * ucChar + 7 * i + 11 * ucChar) % 16777216;
}
} else {
for (i = 1; i <= 96; i++) {
ucChar = str.charAt(i + iLength - 96 - 1);
if (ucChar <= 'Z' && ucChar >= 'A') {
ucChar = (char) (ucChar + 32);
}
hash += (3 * i * ucChar * ucChar + 5 * i * ucChar + 7 * i + 11 * ucChar) % 16777216;
}
}
if (hash < 0) {
hash *= -1;
}
return hash;
} | [
"public",
"static",
"long",
"tianlHash",
"(",
"String",
"str",
")",
"{",
"long",
"hash",
"=",
"0",
";",
"int",
"iLength",
"=",
"str",
".",
"length",
"(",
")",
";",
"if",
"(",
"iLength",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"... | TianL Hash算法
@param str 字符串
@return Hash值 | [
"TianL",
"Hash算法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java#L363-L402 | train | Returns the Tianl hash of the given String. | [
30522,
2270,
10763,
2146,
23401,
2140,
14949,
2232,
1006,
5164,
2358,
2099,
1007,
1063,
2146,
23325,
1027,
1014,
1025,
20014,
17869,
3070,
2705,
1027,
2358,
2099,
1012,
3091,
1006,
1007,
1025,
2065,
1006,
17869,
3070,
2705,
1027,
1027,
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... |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java | KinesisDataFetcher.createShardConsumer | protected ShardConsumer createShardConsumer(
Integer subscribedShardStateIndex,
StreamShardHandle subscribedShard,
SequenceNumber lastSequenceNum,
ShardMetricsReporter shardMetricsReporter) {
return new ShardConsumer<>(
this,
subscribedShardStateIndex,
subscribedShard,
lastSequenceNum,
this.kinesisProxyFactory.create(configProps),
shardMetricsReporter);
} | java | protected ShardConsumer createShardConsumer(
Integer subscribedShardStateIndex,
StreamShardHandle subscribedShard,
SequenceNumber lastSequenceNum,
ShardMetricsReporter shardMetricsReporter) {
return new ShardConsumer<>(
this,
subscribedShardStateIndex,
subscribedShard,
lastSequenceNum,
this.kinesisProxyFactory.create(configProps),
shardMetricsReporter);
} | [
"protected",
"ShardConsumer",
"createShardConsumer",
"(",
"Integer",
"subscribedShardStateIndex",
",",
"StreamShardHandle",
"subscribedShard",
",",
"SequenceNumber",
"lastSequenceNum",
",",
"ShardMetricsReporter",
"shardMetricsReporter",
")",
"{",
"return",
"new",
"ShardConsume... | Create a new shard consumer.
Override this method to customize shard consumer behavior in subclasses.
@param subscribedShardStateIndex the state index of the shard this consumer is subscribed to
@param subscribedShard the shard this consumer is subscribed to
@param lastSequenceNum the sequence number in the shard to start consuming
@param shardMetricsReporter the reporter to report metrics to
@return shard consumer | [
"Create",
"a",
"new",
"shard",
"consumer",
".",
"Override",
"this",
"method",
"to",
"customize",
"shard",
"consumer",
"behavior",
"in",
"subclasses",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java#L298-L310 | train | Create a new instance of the ShardConsumer class. | [
30522,
5123,
21146,
4103,
8663,
23545,
2099,
9005,
11783,
8663,
23545,
2099,
1006,
16109,
4942,
29234,
5104,
11783,
9153,
9589,
3207,
2595,
1010,
9199,
11783,
11774,
2571,
4942,
29234,
5104,
11783,
1010,
5537,
19172,
5677,
16180,
2063,
4226,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java | SoapClient.sendForResponse | private HttpResponse sendForResponse() {
return HttpRequest.post(this.url)//
.setFollowRedirects(true)//
.contentType(getXmlContentType())//
.body(getMsgStr(false))//
.executeAsync();
} | java | private HttpResponse sendForResponse() {
return HttpRequest.post(this.url)//
.setFollowRedirects(true)//
.contentType(getXmlContentType())//
.body(getMsgStr(false))//
.executeAsync();
} | [
"private",
"HttpResponse",
"sendForResponse",
"(",
")",
"{",
"return",
"HttpRequest",
".",
"post",
"(",
"this",
".",
"url",
")",
"//\r",
".",
"setFollowRedirects",
"(",
"true",
")",
"//\r",
".",
"contentType",
"(",
"getXmlContentType",
"(",
")",
")",
"//\r",... | 发送请求,获取异步响应
@return 响应对象 | [
"发送请求,获取异步响应"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L438-L444 | train | Send a request for a response. | [
30522,
2797,
8299,
6072,
26029,
3366,
4604,
29278,
6072,
26029,
3366,
1006,
1007,
1063,
2709,
8299,
2890,
15500,
1012,
2695,
1006,
2023,
1012,
24471,
2140,
1007,
1013,
1013,
1012,
2275,
14876,
7174,
13088,
2098,
7442,
16649,
1006,
2995,
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/lang/Assert.java | Assert.badIndexMsg | private static String badIndexMsg(int index, int size, String desc, Object... params) {
if (index < 0) {
return StrUtil.format("{} ({}) must not be negative", StrUtil.format(desc, params), index);
} else if (size < 0) {
throw new IllegalArgumentException("negative size: " + size);
} else { // index >= size
return StrUtil.format("{} ({}) must be less than size ({})", StrUtil.format(desc, params), index, size);
}
} | java | private static String badIndexMsg(int index, int size, String desc, Object... params) {
if (index < 0) {
return StrUtil.format("{} ({}) must not be negative", StrUtil.format(desc, params), index);
} else if (size < 0) {
throw new IllegalArgumentException("negative size: " + size);
} else { // index >= size
return StrUtil.format("{} ({}) must be less than size ({})", StrUtil.format(desc, params), index, size);
}
} | [
"private",
"static",
"String",
"badIndexMsg",
"(",
"int",
"index",
",",
"int",
"size",
",",
"String",
"desc",
",",
"Object",
"...",
"params",
")",
"{",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"return",
"StrUtil",
".",
"format",
"(",
"\"{} ({}) must not b... | 错误的下标时显示的消息
@param index 下标
@param size 长度
@param desc 异常时的消息模板
@param params 参数列表
@return 消息 | [
"错误的下标时显示的消息"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L645-L653 | train | Returns a message for a bad index. | [
30522,
2797,
10763,
5164,
2919,
22254,
10288,
5244,
2290,
1006,
20014,
5950,
1010,
20014,
2946,
1010,
5164,
4078,
2278,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
1063,
2065,
1006,
5950,
1026,
1014,
1007,
1063,
2709,
2358,
22134,
4014... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/RoundRobinOperatorStateRepartitioner.java | RoundRobinOperatorStateRepartitioner.collectUnionStates | private Map<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> collectUnionStates(
List<List<OperatorStateHandle>> parallelSubtaskStates) {
Map<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> unionStates =
new HashMap<>(parallelSubtaskStates.size());
for (List<OperatorStateHandle> subTaskState : parallelSubtaskStates) {
for (OperatorStateHandle operatorStateHandle : subTaskState) {
if (operatorStateHandle == null) {
continue;
}
final Set<Map.Entry<String, OperatorStateHandle.StateMetaInfo>> partitionOffsetEntries =
operatorStateHandle.getStateNameToPartitionOffsets().entrySet();
partitionOffsetEntries.stream()
.filter(entry -> entry.getValue().getDistributionMode().equals(OperatorStateHandle.Mode.UNION))
.forEach(entry -> {
List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>> stateLocations =
unionStates.computeIfAbsent(entry.getKey(), k -> new ArrayList<>(parallelSubtaskStates.size() * partitionOffsetEntries.size()));
stateLocations.add(Tuple2.of(operatorStateHandle.getDelegateStateHandle(), entry.getValue()));
});
}
}
return unionStates;
} | java | private Map<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> collectUnionStates(
List<List<OperatorStateHandle>> parallelSubtaskStates) {
Map<String, List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>>> unionStates =
new HashMap<>(parallelSubtaskStates.size());
for (List<OperatorStateHandle> subTaskState : parallelSubtaskStates) {
for (OperatorStateHandle operatorStateHandle : subTaskState) {
if (operatorStateHandle == null) {
continue;
}
final Set<Map.Entry<String, OperatorStateHandle.StateMetaInfo>> partitionOffsetEntries =
operatorStateHandle.getStateNameToPartitionOffsets().entrySet();
partitionOffsetEntries.stream()
.filter(entry -> entry.getValue().getDistributionMode().equals(OperatorStateHandle.Mode.UNION))
.forEach(entry -> {
List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>> stateLocations =
unionStates.computeIfAbsent(entry.getKey(), k -> new ArrayList<>(parallelSubtaskStates.size() * partitionOffsetEntries.size()));
stateLocations.add(Tuple2.of(operatorStateHandle.getDelegateStateHandle(), entry.getValue()));
});
}
}
return unionStates;
} | [
"private",
"Map",
"<",
"String",
",",
"List",
"<",
"Tuple2",
"<",
"StreamStateHandle",
",",
"OperatorStateHandle",
".",
"StateMetaInfo",
">",
">",
">",
"collectUnionStates",
"(",
"List",
"<",
"List",
"<",
"OperatorStateHandle",
">",
">",
"parallelSubtaskStates",
... | Collect union states from given parallelSubtaskStates. | [
"Collect",
"union",
"states",
"from",
"given",
"parallelSubtaskStates",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/RoundRobinOperatorStateRepartitioner.java#L116-L143 | train | Collect union states. | [
30522,
2797,
4949,
1026,
5164,
1010,
2862,
1026,
10722,
10814,
2475,
1026,
9199,
12259,
11774,
2571,
1010,
9224,
12259,
11774,
2571,
1012,
2110,
11368,
8113,
14876,
1028,
1028,
1028,
30524,
1028,
1028,
1028,
9209,
12259,
2015,
1027,
2047,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java | ConditionMessage.append | public ConditionMessage append(String message) {
if (!StringUtils.hasLength(message)) {
return this;
}
if (!StringUtils.hasLength(this.message)) {
return new ConditionMessage(message);
}
return new ConditionMessage(this.message + " " + message);
} | java | public ConditionMessage append(String message) {
if (!StringUtils.hasLength(message)) {
return this;
}
if (!StringUtils.hasLength(this.message)) {
return new ConditionMessage(message);
}
return new ConditionMessage(this.message + " " + message);
} | [
"public",
"ConditionMessage",
"append",
"(",
"String",
"message",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"hasLength",
"(",
"message",
")",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"!",
"StringUtils",
".",
"hasLength",
"(",
"this",
".",
"... | Return a new {@link ConditionMessage} based on the instance and an appended
message.
@param message the message to append
@return a new {@link ConditionMessage} instance | [
"Return",
"a",
"new",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java#L89-L98 | train | Append a message to this one. | [
30522,
2270,
4650,
7834,
3736,
3351,
10439,
10497,
1006,
5164,
4471,
1007,
1063,
2065,
1006,
999,
5164,
21823,
4877,
1012,
2038,
7770,
13512,
2232,
1006,
4471,
1007,
1007,
1063,
2709,
2023,
1025,
1065,
2065,
1006,
999,
5164,
21823,
4877,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/mail/InternalMailUtil.java | InternalMailUtil.parseFirstAddress | public static InternetAddress parseFirstAddress(String address, Charset charset) {
final InternetAddress[] internetAddresses = parseAddress(address, charset);
if (ArrayUtil.isEmpty(internetAddresses)) {
try {
return new InternetAddress(address);
} catch (AddressException e) {
throw new MailException(e);
}
}
return internetAddresses[0];
} | java | public static InternetAddress parseFirstAddress(String address, Charset charset) {
final InternetAddress[] internetAddresses = parseAddress(address, charset);
if (ArrayUtil.isEmpty(internetAddresses)) {
try {
return new InternetAddress(address);
} catch (AddressException e) {
throw new MailException(e);
}
}
return internetAddresses[0];
} | [
"public",
"static",
"InternetAddress",
"parseFirstAddress",
"(",
"String",
"address",
",",
"Charset",
"charset",
")",
"{",
"final",
"InternetAddress",
"[",
"]",
"internetAddresses",
"=",
"parseAddress",
"(",
"address",
",",
"charset",
")",
";",
"if",
"(",
"Array... | 解析第一个地址
@param address 地址字符串
@param charset 编码
@return 地址列表 | [
"解析第一个地址"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/InternalMailUtil.java#L51-L61 | train | Parses the given string and returns the first InternetAddress in the array. | [
30522,
2270,
10763,
4274,
4215,
16200,
4757,
11968,
20106,
18894,
17713,
16200,
4757,
1006,
5164,
4769,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2345,
4274,
4215,
16200,
4757,
1031,
1033,
4274,
4215,
16200,
11393,
2015,
1027,
11968,
1731... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.toLong | public boolean toLong(LongWrapper toLongResult) {
if (numBytes == 0) {
return false;
}
byte b = getByte(0);
final boolean negative = b == '-';
int offset = 0;
if (negative || b == '+') {
offset++;
if (numBytes == 1) {
return false;
}
}
final byte separator = '.';
final int radix = 10;
final long stopValue = Long.MIN_VALUE / radix;
long result = 0;
while (offset < numBytes) {
b = getByte(offset);
offset++;
if (b == separator) {
// We allow decimals and will return a truncated integral in that case.
// Therefore we won't throw an exception here (checking the fractional
// part happens below.)
break;
}
int digit;
if (b >= '0' && b <= '9') {
digit = b - '0';
} else {
return false;
}
// We are going to process the new digit and accumulate the result. However, before doing
// this, if the result is already smaller than the stopValue(Long.MIN_VALUE / radix), then
// result * 10 will definitely be smaller than minValue, and we can stop.
if (result < stopValue) {
return false;
}
result = result * radix - digit;
// Since the previous result is less than or equal to stopValue(Long.MIN_VALUE / radix), we
// can just use `result > 0` to check overflow. If result overflows, we should stop.
if (result > 0) {
return false;
}
}
// This is the case when we've encountered a decimal separator. The fractional
// part will not change the number, but we will verify that the fractional part
// is well formed.
while (offset < numBytes) {
byte currentByte = getByte(offset);
if (currentByte < '0' || currentByte > '9') {
return false;
}
offset++;
}
if (!negative) {
result = -result;
if (result < 0) {
return false;
}
}
toLongResult.value = result;
return true;
} | java | public boolean toLong(LongWrapper toLongResult) {
if (numBytes == 0) {
return false;
}
byte b = getByte(0);
final boolean negative = b == '-';
int offset = 0;
if (negative || b == '+') {
offset++;
if (numBytes == 1) {
return false;
}
}
final byte separator = '.';
final int radix = 10;
final long stopValue = Long.MIN_VALUE / radix;
long result = 0;
while (offset < numBytes) {
b = getByte(offset);
offset++;
if (b == separator) {
// We allow decimals and will return a truncated integral in that case.
// Therefore we won't throw an exception here (checking the fractional
// part happens below.)
break;
}
int digit;
if (b >= '0' && b <= '9') {
digit = b - '0';
} else {
return false;
}
// We are going to process the new digit and accumulate the result. However, before doing
// this, if the result is already smaller than the stopValue(Long.MIN_VALUE / radix), then
// result * 10 will definitely be smaller than minValue, and we can stop.
if (result < stopValue) {
return false;
}
result = result * radix - digit;
// Since the previous result is less than or equal to stopValue(Long.MIN_VALUE / radix), we
// can just use `result > 0` to check overflow. If result overflows, we should stop.
if (result > 0) {
return false;
}
}
// This is the case when we've encountered a decimal separator. The fractional
// part will not change the number, but we will verify that the fractional part
// is well formed.
while (offset < numBytes) {
byte currentByte = getByte(offset);
if (currentByte < '0' || currentByte > '9') {
return false;
}
offset++;
}
if (!negative) {
result = -result;
if (result < 0) {
return false;
}
}
toLongResult.value = result;
return true;
} | [
"public",
"boolean",
"toLong",
"(",
"LongWrapper",
"toLongResult",
")",
"{",
"if",
"(",
"numBytes",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"byte",
"b",
"=",
"getByte",
"(",
"0",
")",
";",
"final",
"boolean",
"negative",
"=",
"b",
"==",
"'"... | Parses this UTF8String to long.
Note that, in this method we accumulate the result in negative format, and convert it to
positive format at the end, if this string is not started with '-'. This is because min value
is bigger than max value in digits, e.g. Long.MAX_VALUE is '9223372036854775807' and
Long.MIN_VALUE is '-9223372036854775808'.
This code is mostly copied from LazyLong.parseLong in Hive.
@param toLongResult If a valid `long` was parsed from this UTF8String, then its value would
be set in `toLongResult`
@return true if the parsing was successful else false | [
"Parses",
"this",
"UTF8String",
"to",
"long",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L1032-L1104 | train | Returns true if the data is a long. | [
30522,
2270,
22017,
20898,
2000,
10052,
1006,
2146,
13088,
29098,
2121,
2000,
10052,
6072,
11314,
1007,
1063,
2065,
1006,
15903,
17250,
2015,
1027,
1027,
1014,
1007,
1063,
2709,
6270,
1025,
1065,
24880,
1038,
1027,
2131,
3762,
2618,
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... |
SeleniumHQ/selenium | java/server/src/org/openqa/selenium/remote/server/rest/Responses.java | Responses.failure | public static Response failure(SessionId sessionId, Throwable reason) {
Response response = new Response();
response.setSessionId(sessionId != null ? sessionId.toString() : null);
response.setValue(reason);
response.setStatus(ERROR_CODES.toStatusCode(reason));
response.setState(ERROR_CODES.toState(response.getStatus()));
return response;
} | java | public static Response failure(SessionId sessionId, Throwable reason) {
Response response = new Response();
response.setSessionId(sessionId != null ? sessionId.toString() : null);
response.setValue(reason);
response.setStatus(ERROR_CODES.toStatusCode(reason));
response.setState(ERROR_CODES.toState(response.getStatus()));
return response;
} | [
"public",
"static",
"Response",
"failure",
"(",
"SessionId",
"sessionId",
",",
"Throwable",
"reason",
")",
"{",
"Response",
"response",
"=",
"new",
"Response",
"(",
")",
";",
"response",
".",
"setSessionId",
"(",
"sessionId",
"!=",
"null",
"?",
"sessionId",
... | Creates a response object for a failed command execution.
@param sessionId ID of the session that executed the command.
@param reason the failure reason.
@return the new response object. | [
"Creates",
"a",
"response",
"object",
"for",
"a",
"failed",
"command",
"execution",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/selenium/remote/server/rest/Responses.java#L62-L69 | train | Create a response object with a failure. | [
30522,
2270,
10763,
3433,
4945,
1006,
5219,
3593,
5219,
3593,
1010,
5466,
3085,
3114,
1007,
1063,
3433,
3433,
1027,
2047,
3433,
1006,
1007,
1025,
3433,
1012,
4520,
7971,
3258,
3593,
1006,
5219,
3593,
999,
1027,
19701,
1029,
5219,
3593,
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... |
SeleniumHQ/selenium | java/server/src/org/openqa/selenium/remote/server/xdrpc/CrossDomainRpcLoader.java | CrossDomainRpcLoader.loadRpc | public CrossDomainRpc loadRpc(HttpServletRequest request) throws IOException {
Charset encoding;
try {
String enc = request.getCharacterEncoding();
encoding = Charset.forName(enc);
} catch (IllegalArgumentException | NullPointerException e) {
encoding = UTF_8;
}
// We tend to look at the input stream, rather than the reader.
try (InputStream in = request.getInputStream();
Reader reader = new InputStreamReader(in, encoding);
JsonInput jsonInput = json.newInput(reader)) {
Map<String, Object> read = jsonInput.read(MAP_TYPE);
return new CrossDomainRpc(
getField(read, Field.METHOD),
getField(read, Field.PATH),
getField(read, Field.DATA));
} catch (JsonException e) {
throw new IllegalArgumentException(
"Failed to parse JSON request: " + e.getMessage(), e);
}
} | java | public CrossDomainRpc loadRpc(HttpServletRequest request) throws IOException {
Charset encoding;
try {
String enc = request.getCharacterEncoding();
encoding = Charset.forName(enc);
} catch (IllegalArgumentException | NullPointerException e) {
encoding = UTF_8;
}
// We tend to look at the input stream, rather than the reader.
try (InputStream in = request.getInputStream();
Reader reader = new InputStreamReader(in, encoding);
JsonInput jsonInput = json.newInput(reader)) {
Map<String, Object> read = jsonInput.read(MAP_TYPE);
return new CrossDomainRpc(
getField(read, Field.METHOD),
getField(read, Field.PATH),
getField(read, Field.DATA));
} catch (JsonException e) {
throw new IllegalArgumentException(
"Failed to parse JSON request: " + e.getMessage(), e);
}
} | [
"public",
"CrossDomainRpc",
"loadRpc",
"(",
"HttpServletRequest",
"request",
")",
"throws",
"IOException",
"{",
"Charset",
"encoding",
";",
"try",
"{",
"String",
"enc",
"=",
"request",
".",
"getCharacterEncoding",
"(",
")",
";",
"encoding",
"=",
"Charset",
".",
... | Parses the request for a CrossDomainRpc.
@param request The request to parse.
@return The parsed RPC.
@throws IOException If an error occurs reading from the request.
@throws IllegalArgumentException If an occurs while parsing the request
data. | [
"Parses",
"the",
"request",
"for",
"a",
"CrossDomainRpc",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/selenium/remote/server/xdrpc/CrossDomainRpcLoader.java#L52-L75 | train | Load the CrossDomainRpc object from the request. | [
30522,
2270,
2892,
9527,
8113,
14536,
2278,
7170,
14536,
2278,
1006,
16770,
2121,
2615,
7485,
2890,
15500,
5227,
1007,
11618,
22834,
10288,
24422,
1063,
25869,
13462,
17181,
1025,
3046,
1063,
5164,
4372,
2278,
1027,
5227,
1012,
2131,
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... |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONUtil.java | JSONUtil.quote | public static Writer quote(String str, Writer writer) throws IOException {
return quote(str, writer, true);
} | java | public static Writer quote(String str, Writer writer) throws IOException {
return quote(str, writer, true);
} | [
"public",
"static",
"Writer",
"quote",
"(",
"String",
"str",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"return",
"quote",
"(",
"str",
",",
"writer",
",",
"true",
")",
";",
"}"
] | 对所有双引号做转义处理(使用双反斜杠做转义)<br>
为了能在HTML中较好的显示,会将</转义为<\/<br>
JSON字符串中不能包含控制字符和未经转义的引号和反斜杠
@param str 字符串
@param writer Writer
@return Writer
@throws IOException IO异常 | [
"对所有双引号做转义处理(使用双反斜杠做转义)<br",
">",
"为了能在HTML中较好的显示,会将<",
";",
"/",
"转义为<",
";",
"\\",
"/",
"<br",
">",
"JSON字符串中不能包含控制字符和未经转义的引号和反斜杠"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L482-L484 | train | Quote a string and write it to a Writer. | [
30522,
2270,
10763,
3213,
14686,
1006,
5164,
2358,
2099,
1010,
3213,
3213,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
14686,
1006,
2358,
2099,
1010,
3213,
1010,
2995,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/RestartPipelinedRegionStrategy.java | RestartPipelinedRegionStrategy.onTaskFailure | @Override
public void onTaskFailure(Execution taskExecution, Throwable cause) {
final ExecutionVertex ev = taskExecution.getVertex();
final FailoverRegion failoverRegion = vertexToRegion.get(ev);
if (failoverRegion == null) {
executionGraph.failGlobal(new FlinkException(
"Can not find a failover region for the execution " + ev.getTaskNameWithSubtaskIndex(), cause));
}
else {
LOG.info("Recovering task failure for {} #{} ({}) via restart of failover region",
taskExecution.getVertex().getTaskNameWithSubtaskIndex(),
taskExecution.getAttemptNumber(),
taskExecution.getAttemptId());
failoverRegion.onExecutionFail(taskExecution, cause);
}
} | java | @Override
public void onTaskFailure(Execution taskExecution, Throwable cause) {
final ExecutionVertex ev = taskExecution.getVertex();
final FailoverRegion failoverRegion = vertexToRegion.get(ev);
if (failoverRegion == null) {
executionGraph.failGlobal(new FlinkException(
"Can not find a failover region for the execution " + ev.getTaskNameWithSubtaskIndex(), cause));
}
else {
LOG.info("Recovering task failure for {} #{} ({}) via restart of failover region",
taskExecution.getVertex().getTaskNameWithSubtaskIndex(),
taskExecution.getAttemptNumber(),
taskExecution.getAttemptId());
failoverRegion.onExecutionFail(taskExecution, cause);
}
} | [
"@",
"Override",
"public",
"void",
"onTaskFailure",
"(",
"Execution",
"taskExecution",
",",
"Throwable",
"cause",
")",
"{",
"final",
"ExecutionVertex",
"ev",
"=",
"taskExecution",
".",
"getVertex",
"(",
")",
";",
"final",
"FailoverRegion",
"failoverRegion",
"=",
... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/RestartPipelinedRegionStrategy.java#L75-L92 | train | Called when a failure occurs in the task execution. | [
30522,
1030,
2058,
15637,
2270,
11675,
2006,
10230,
2243,
7011,
4014,
5397,
1006,
7781,
4708,
10288,
8586,
13700,
1010,
5466,
3085,
3426,
1007,
1063,
2345,
7781,
16874,
10288,
23408,
1027,
4708,
10288,
8586,
13700,
1012,
2131,
16874,
10288,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.read | public static FastByteArrayOutputStream read(ReadableByteChannel channel) throws IORuntimeException {
final FastByteArrayOutputStream out = new FastByteArrayOutputStream();
copy(channel, Channels.newChannel(out));
return out;
} | java | public static FastByteArrayOutputStream read(ReadableByteChannel channel) throws IORuntimeException {
final FastByteArrayOutputStream out = new FastByteArrayOutputStream();
copy(channel, Channels.newChannel(out));
return out;
} | [
"public",
"static",
"FastByteArrayOutputStream",
"read",
"(",
"ReadableByteChannel",
"channel",
")",
"throws",
"IORuntimeException",
"{",
"final",
"FastByteArrayOutputStream",
"out",
"=",
"new",
"FastByteArrayOutputStream",
"(",
")",
";",
"copy",
"(",
"channel",
",",
... | 从流中读取内容,读到输出流中
@param channel 可读通道,读取完毕后并不关闭通道
@return 输出流
@throws IORuntimeException IO异常 | [
"从流中读取内容,读到输出流中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L448-L452 | train | Reads a sequence of bytes from the specified channel. | [
30522,
2270,
10763,
3435,
3762,
27058,
11335,
29337,
25856,
16446,
25379,
3191,
1006,
3191,
3085,
3762,
15007,
20147,
2140,
3149,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2345,
3435,
3762,
27058,
11335,
29337,
25856,
16446,
25379,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java | IOUtil.newInputStream | public static InputStream newInputStream(String path) throws IOException
{
if (IOAdapter == null) return new FileInputStream(path);
return IOAdapter.open(path);
} | java | public static InputStream newInputStream(String path) throws IOException
{
if (IOAdapter == null) return new FileInputStream(path);
return IOAdapter.open(path);
} | [
"public",
"static",
"InputStream",
"newInputStream",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"IOAdapter",
"==",
"null",
")",
"return",
"new",
"FileInputStream",
"(",
"path",
")",
";",
"return",
"IOAdapter",
".",
"open",
"(",
"pat... | 创建输入流(经过IO适配器创建)
@param path
@return
@throws IOException | [
"创建输入流(经过IO适配器创建)"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java#L623-L627 | train | Returns an InputStream for the given path. | [
30522,
2270,
10763,
20407,
25379,
2047,
2378,
18780,
21422,
1006,
5164,
4130,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
22834,
8447,
13876,
2121,
1027,
1027,
19701,
1007,
2709,
2047,
5371,
2378,
18780,
21422,
1006,
4130,
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.sortByProperty | public static <T> List<T> sortByProperty(List<T> list, String property) {
return sort(list, new PropertyComparator<>(property));
} | java | public static <T> List<T> sortByProperty(List<T> list, String property) {
return sort(list, new PropertyComparator<>(property));
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"sortByProperty",
"(",
"List",
"<",
"T",
">",
"list",
",",
"String",
"property",
")",
"{",
"return",
"sort",
"(",
"list",
",",
"new",
"PropertyComparator",
"<>",
"(",
"property",
")",
")",
";"... | 根据Bean的属性排序
@param <T> 元素类型
@param list List
@param property 属性名
@return 排序后的List
@since 4.0.6 | [
"根据Bean的属性排序"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2125-L2127 | train | Sort a list of objects by a property. | [
30522,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
4066,
3762,
21572,
4842,
3723,
1006,
2862,
1026,
1056,
1028,
2862,
1010,
5164,
3200,
1007,
1063,
2709,
4066,
1006,
2862,
1010,
2047,
3200,
9006,
28689,
4263,
1026,
1028,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java | JettyServletWebServerFactory.getErrorPageConfiguration | private Configuration getErrorPageConfiguration() {
return new AbstractConfiguration() {
@Override
public void configure(WebAppContext context) throws Exception {
ErrorHandler errorHandler = context.getErrorHandler();
context.setErrorHandler(new JettyEmbeddedErrorHandler(errorHandler));
addJettyErrorPages(errorHandler, getErrorPages());
}
};
} | java | private Configuration getErrorPageConfiguration() {
return new AbstractConfiguration() {
@Override
public void configure(WebAppContext context) throws Exception {
ErrorHandler errorHandler = context.getErrorHandler();
context.setErrorHandler(new JettyEmbeddedErrorHandler(errorHandler));
addJettyErrorPages(errorHandler, getErrorPages());
}
};
} | [
"private",
"Configuration",
"getErrorPageConfiguration",
"(",
")",
"{",
"return",
"new",
"AbstractConfiguration",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"configure",
"(",
"WebAppContext",
"context",
")",
"throws",
"Exception",
"{",
"ErrorHandler",
"errorH... | Create a configuration object that adds error handlers.
@return a configuration object for adding error pages | [
"Create",
"a",
"configuration",
"object",
"that",
"adds",
"error",
"handlers",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java#L348-L359 | train | Returns an instance of the configuration object that will be used to configure the error page. | [
30522,
2797,
9563,
2131,
2121,
29165,
13704,
8663,
8873,
27390,
3370,
1006,
1007,
1063,
2709,
2047,
10061,
8663,
8873,
27390,
3370,
1006,
1007,
1063,
1030,
2058,
15637,
2270,
11675,
9530,
8873,
27390,
2063,
1006,
4773,
29098,
8663,
18209,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/server/HandshakeInitializationPacket.java | HandshakeInitializationPacket.fromBytes | public void fromBytes(byte[] data) {
int index = 0;
// 1. read protocol_version
protocolVersion = data[index];
index++;
// 2. read server_version
byte[] serverVersionBytes = ByteHelper.readNullTerminatedBytes(data, index);
serverVersion = new String(serverVersionBytes);
index += (serverVersionBytes.length + 1);
// 3. read thread_id
threadId = ByteHelper.readUnsignedIntLittleEndian(data, index);
index += 4;
// 4. read scramble_buff
seed = ByteHelper.readFixedLengthBytes(data, index, 8);
index += 8;
index += 1; // 1 byte (filler) always 0x00
// 5. read server_capabilities
this.serverCapabilities = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
if (data.length > index) {
// 6. read server_language
this.serverCharsetNumber = data[index];
index++;
// 7. read server_status
this.serverStatus = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
// 8. bypass filtered bytes
int capabilityFlags2 = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
int capabilities = (capabilityFlags2 << 16) | this.serverCapabilities;
// int authPluginDataLen = -1;
// if ((capabilities & Capability.CLIENT_PLUGIN_AUTH) != 0) {
// authPluginDataLen = data[index];
// }
index += 1;
index += 10;
// 9. read rest of scramble_buff
if ((capabilities & Capability.CLIENT_SECURE_CONNECTION) != 0) {
// int len = Math.max(13, authPluginDataLen - 8);
// this.authPluginDataPart2 =
// buffer.readFixedLengthString(len);// scramble2
// Packet规定最后13个byte是剩下的scrumble,
// 但实际上最后一个字节是0, 不应该包含在scrumble中.
this.restOfScrambleBuff = ByteHelper.readFixedLengthBytes(data, index, 12);
}
index += 12 + 1;
if ((capabilities & Capability.CLIENT_PLUGIN_AUTH) != 0) {
this.authPluginName = ByteHelper.readNullTerminatedBytes(data, index);
}
// end read
}
} | java | public void fromBytes(byte[] data) {
int index = 0;
// 1. read protocol_version
protocolVersion = data[index];
index++;
// 2. read server_version
byte[] serverVersionBytes = ByteHelper.readNullTerminatedBytes(data, index);
serverVersion = new String(serverVersionBytes);
index += (serverVersionBytes.length + 1);
// 3. read thread_id
threadId = ByteHelper.readUnsignedIntLittleEndian(data, index);
index += 4;
// 4. read scramble_buff
seed = ByteHelper.readFixedLengthBytes(data, index, 8);
index += 8;
index += 1; // 1 byte (filler) always 0x00
// 5. read server_capabilities
this.serverCapabilities = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
if (data.length > index) {
// 6. read server_language
this.serverCharsetNumber = data[index];
index++;
// 7. read server_status
this.serverStatus = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
// 8. bypass filtered bytes
int capabilityFlags2 = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
int capabilities = (capabilityFlags2 << 16) | this.serverCapabilities;
// int authPluginDataLen = -1;
// if ((capabilities & Capability.CLIENT_PLUGIN_AUTH) != 0) {
// authPluginDataLen = data[index];
// }
index += 1;
index += 10;
// 9. read rest of scramble_buff
if ((capabilities & Capability.CLIENT_SECURE_CONNECTION) != 0) {
// int len = Math.max(13, authPluginDataLen - 8);
// this.authPluginDataPart2 =
// buffer.readFixedLengthString(len);// scramble2
// Packet规定最后13个byte是剩下的scrumble,
// 但实际上最后一个字节是0, 不应该包含在scrumble中.
this.restOfScrambleBuff = ByteHelper.readFixedLengthBytes(data, index, 12);
}
index += 12 + 1;
if ((capabilities & Capability.CLIENT_PLUGIN_AUTH) != 0) {
this.authPluginName = ByteHelper.readNullTerminatedBytes(data, index);
}
// end read
}
} | [
"public",
"void",
"fromBytes",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"int",
"index",
"=",
"0",
";",
"// 1. read protocol_version",
"protocolVersion",
"=",
"data",
"[",
"index",
"]",
";",
"index",
"++",
";",
"// 2. read server_version",
"byte",
"[",
"]",
... | <pre>
Bytes Name
----- ----
1 protocol_version
n (Null-Terminated String) server_version
4 thread_id
8 scramble_buff
1 (filler) always 0x00
2 server_capabilities
1 server_language
2 server_status
13 (filler) always 0x00 ...
13 rest of scramble_buff (4.1)
</pre> | [
"<pre",
">",
"Bytes",
"Name",
"-----",
"----",
"1",
"protocol_version",
"n",
"(",
"Null",
"-",
"Terminated",
"String",
")",
"server_version",
"4",
"thread_id",
"8",
"scramble_buff",
"1",
"(",
"filler",
")",
"always",
"0x00",
"2",
"server_capabilities",
"1",
... | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/server/HandshakeInitializationPacket.java#L52-L105 | train | Reads the data from the 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,
8778,
1035,
2544,
8778,
27774,
1027,
2951,
1031,
5950,
1033,
1025,
5950,
1009,
1009,
1025,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/style/StyleUtil.java | StyleUtil.createDefaultCellStyle | public static CellStyle createDefaultCellStyle(Workbook workbook) {
final CellStyle cellStyle = workbook.createCellStyle();
setAlign(cellStyle, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
setBorder(cellStyle, BorderStyle.THIN, IndexedColors.BLACK);
return cellStyle;
} | java | public static CellStyle createDefaultCellStyle(Workbook workbook) {
final CellStyle cellStyle = workbook.createCellStyle();
setAlign(cellStyle, HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
setBorder(cellStyle, BorderStyle.THIN, IndexedColors.BLACK);
return cellStyle;
} | [
"public",
"static",
"CellStyle",
"createDefaultCellStyle",
"(",
"Workbook",
"workbook",
")",
"{",
"final",
"CellStyle",
"cellStyle",
"=",
"workbook",
".",
"createCellStyle",
"(",
")",
";",
"setAlign",
"(",
"cellStyle",
",",
"HorizontalAlignment",
".",
"CENTER",
",... | 创建默认普通单元格样式
<pre>
1. 文字上下左右居中
2. 细边框,黑色
</pre>
@param workbook {@link Workbook} 工作簿
@return {@link CellStyle} | [
"创建默认普通单元格样式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java#L158-L163 | train | Creates a default cell style for a given workbook. | [
30522,
2270,
10763,
4442,
27983,
2580,
12879,
23505,
29109,
4877,
27983,
1006,
2147,
8654,
2147,
8654,
1007,
1063,
2345,
4442,
27983,
4442,
27983,
1027,
2147,
8654,
1012,
3443,
29109,
4877,
27983,
1006,
1007,
1025,
2275,
11475,
16206,
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-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java | PojoSerializer.findField | private int findField(String fieldName) {
int foundIndex = 0;
for (Field field : fields) {
if (field != null && fieldName.equals(field.getName())) {
return foundIndex;
}
foundIndex++;
}
return -1;
} | java | private int findField(String fieldName) {
int foundIndex = 0;
for (Field field : fields) {
if (field != null && fieldName.equals(field.getName())) {
return foundIndex;
}
foundIndex++;
}
return -1;
} | [
"private",
"int",
"findField",
"(",
"String",
"fieldName",
")",
"{",
"int",
"foundIndex",
"=",
"0",
";",
"for",
"(",
"Field",
"field",
":",
"fields",
")",
"{",
"if",
"(",
"field",
"!=",
"null",
"&&",
"fieldName",
".",
"equals",
"(",
"field",
".",
"ge... | Finds and returns the order (0-based) of a POJO field.
Returns -1 if the field does not exist for this POJO. | [
"Finds",
"and",
"returns",
"the",
"order",
"(",
"0",
"-",
"based",
")",
"of",
"a",
"POJO",
"field",
".",
"Returns",
"-",
"1",
"if",
"the",
"field",
"does",
"not",
"exist",
"for",
"this",
"POJO",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java#L1085-L1096 | train | Find the index of the field with the given name. | [
30522,
2797,
20014,
2424,
3790,
1006,
5164,
2492,
18442,
1007,
1063,
20014,
2179,
22254,
10288,
1027,
1014,
1025,
2005,
1006,
2492,
2492,
1024,
4249,
1007,
1063,
2065,
1006,
2492,
999,
1027,
19701,
1004,
1004,
2492,
18442,
1012,
19635,
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-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBIncrementalRestoreOperation.java | RocksDBIncrementalRestoreOperation.restore | @Override
public RocksDBRestoreResult restore() throws Exception {
if (restoreStateHandles == null || restoreStateHandles.isEmpty()) {
return null;
}
final KeyedStateHandle theFirstStateHandle = restoreStateHandles.iterator().next();
boolean isRescaling = (restoreStateHandles.size() > 1 ||
!Objects.equals(theFirstStateHandle.getKeyGroupRange(), keyGroupRange));
if (isRescaling) {
restoreWithRescaling(restoreStateHandles);
} else {
restoreWithoutRescaling(theFirstStateHandle);
}
return new RocksDBRestoreResult(this.db, defaultColumnFamilyHandle,
nativeMetricMonitor, lastCompletedCheckpointId, backendUID, restoredSstFiles);
} | java | @Override
public RocksDBRestoreResult restore() throws Exception {
if (restoreStateHandles == null || restoreStateHandles.isEmpty()) {
return null;
}
final KeyedStateHandle theFirstStateHandle = restoreStateHandles.iterator().next();
boolean isRescaling = (restoreStateHandles.size() > 1 ||
!Objects.equals(theFirstStateHandle.getKeyGroupRange(), keyGroupRange));
if (isRescaling) {
restoreWithRescaling(restoreStateHandles);
} else {
restoreWithoutRescaling(theFirstStateHandle);
}
return new RocksDBRestoreResult(this.db, defaultColumnFamilyHandle,
nativeMetricMonitor, lastCompletedCheckpointId, backendUID, restoredSstFiles);
} | [
"@",
"Override",
"public",
"RocksDBRestoreResult",
"restore",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"restoreStateHandles",
"==",
"null",
"||",
"restoreStateHandles",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"final",
"KeyedStat... | Root method that branches for different implementations of {@link KeyedStateHandle}. | [
"Root",
"method",
"that",
"branches",
"for",
"different",
"implementations",
"of",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBIncrementalRestoreOperation.java#L133-L152 | train | Restore the RocksDB database. | [
30522,
1030,
2058,
15637,
2270,
5749,
18939,
28533,
5686,
6072,
11314,
9239,
1006,
1007,
11618,
6453,
1063,
2065,
1006,
9239,
9153,
2618,
11774,
4244,
1027,
1027,
19701,
1064,
1064,
9239,
9153,
2618,
11774,
4244,
1012,
2003,
6633,
13876,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java | ExcelUtil.read03BySax | public static Excel03SaxReader read03BySax(File file, int sheetIndex, RowHandler rowHandler) {
try {
return new Excel03SaxReader(rowHandler).read(file, sheetIndex);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | java | public static Excel03SaxReader read03BySax(File file, int sheetIndex, RowHandler rowHandler) {
try {
return new Excel03SaxReader(rowHandler).read(file, sheetIndex);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | [
"public",
"static",
"Excel03SaxReader",
"read03BySax",
"(",
"File",
"file",
",",
"int",
"sheetIndex",
",",
"RowHandler",
"rowHandler",
")",
"{",
"try",
"{",
"return",
"new",
"Excel03SaxReader",
"(",
"rowHandler",
")",
".",
"read",
"(",
"file",
",",
"sheetIndex... | Sax方式读取Excel03
@param file 文件
@param sheetIndex Sheet索引,-1表示全部Sheet, 0表示第一个Sheet
@param rowHandler 行处理器
@return {@link Excel03SaxReader}
@since 3.2.0 | [
"Sax方式读取Excel03"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L157-L163 | train | Reads an Excel 3. 0 file by SAX. | [
30522,
2270,
10763,
24970,
2692,
2509,
3736,
2595,
16416,
4063,
3191,
2692,
2509,
3762,
3736,
2595,
1006,
5371,
5371,
1010,
20014,
7123,
22254,
10288,
1010,
5216,
11774,
3917,
5216,
11774,
30524,
2509,
3736,
2595,
16416,
4063,
1006,
5216,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerConfiguration.java | TaskManagerConfiguration.fromConfiguration | public static TaskManagerConfiguration fromConfiguration(Configuration configuration) {
int numberSlots = configuration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS, 1);
if (numberSlots == -1) {
numberSlots = 1;
}
final String[] tmpDirPaths = ConfigurationUtils.parseTempDirectories(configuration);
final Time timeout;
try {
timeout = Time.milliseconds(AkkaUtils.getTimeout(configuration).toMillis());
} catch (Exception e) {
throw new IllegalArgumentException(
"Invalid format for '" + AkkaOptions.ASK_TIMEOUT.key() +
"'.Use formats like '50 s' or '1 min' to specify the timeout.");
}
LOG.info("Messages have a max timeout of " + timeout);
final Time finiteRegistrationDuration;
try {
Duration maxRegistrationDuration = Duration.create(configuration.getString(TaskManagerOptions.REGISTRATION_TIMEOUT));
if (maxRegistrationDuration.isFinite()) {
finiteRegistrationDuration = Time.milliseconds(maxRegistrationDuration.toMillis());
} else {
finiteRegistrationDuration = null;
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid format for parameter " +
TaskManagerOptions.REGISTRATION_TIMEOUT.key(), e);
}
final Time initialRegistrationPause;
try {
Duration pause = Duration.create(configuration.getString(TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF));
if (pause.isFinite()) {
initialRegistrationPause = Time.milliseconds(pause.toMillis());
} else {
throw new IllegalArgumentException("The initial registration pause must be finite: " + pause);
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid format for parameter " +
TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF.key(), e);
}
final Time maxRegistrationPause;
try {
Duration pause = Duration.create(configuration.getString(
TaskManagerOptions.REGISTRATION_MAX_BACKOFF));
if (pause.isFinite()) {
maxRegistrationPause = Time.milliseconds(pause.toMillis());
} else {
throw new IllegalArgumentException("The maximum registration pause must be finite: " + pause);
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid format for parameter " +
TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF.key(), e);
}
final Time refusedRegistrationPause;
try {
Duration pause = Duration.create(configuration.getString(TaskManagerOptions.REFUSED_REGISTRATION_BACKOFF));
if (pause.isFinite()) {
refusedRegistrationPause = Time.milliseconds(pause.toMillis());
} else {
throw new IllegalArgumentException("The refused registration pause must be finite: " + pause);
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid format for parameter " +
TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF.key(), e);
}
final boolean exitOnOom = configuration.getBoolean(TaskManagerOptions.KILL_ON_OUT_OF_MEMORY);
final String classLoaderResolveOrder =
configuration.getString(CoreOptions.CLASSLOADER_RESOLVE_ORDER);
final String[] alwaysParentFirstLoaderPatterns = CoreOptions.getParentFirstLoaderPatterns(configuration);
final String taskManagerLogPath = configuration.getString(ConfigConstants.TASK_MANAGER_LOG_PATH_KEY, System.getProperty("log.file"));
final String taskManagerStdoutPath;
if (taskManagerLogPath != null) {
final int extension = taskManagerLogPath.lastIndexOf('.');
if (extension > 0) {
taskManagerStdoutPath = taskManagerLogPath.substring(0, extension) + ".out";
} else {
taskManagerStdoutPath = null;
}
} else {
taskManagerStdoutPath = null;
}
final RetryingRegistrationConfiguration retryingRegistrationConfiguration = RetryingRegistrationConfiguration.fromConfiguration(configuration);
return new TaskManagerConfiguration(
numberSlots,
tmpDirPaths,
timeout,
finiteRegistrationDuration,
initialRegistrationPause,
maxRegistrationPause,
refusedRegistrationPause,
configuration,
exitOnOom,
FlinkUserCodeClassLoaders.ResolveOrder.fromString(classLoaderResolveOrder),
alwaysParentFirstLoaderPatterns,
taskManagerLogPath,
taskManagerStdoutPath,
retryingRegistrationConfiguration);
} | java | public static TaskManagerConfiguration fromConfiguration(Configuration configuration) {
int numberSlots = configuration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS, 1);
if (numberSlots == -1) {
numberSlots = 1;
}
final String[] tmpDirPaths = ConfigurationUtils.parseTempDirectories(configuration);
final Time timeout;
try {
timeout = Time.milliseconds(AkkaUtils.getTimeout(configuration).toMillis());
} catch (Exception e) {
throw new IllegalArgumentException(
"Invalid format for '" + AkkaOptions.ASK_TIMEOUT.key() +
"'.Use formats like '50 s' or '1 min' to specify the timeout.");
}
LOG.info("Messages have a max timeout of " + timeout);
final Time finiteRegistrationDuration;
try {
Duration maxRegistrationDuration = Duration.create(configuration.getString(TaskManagerOptions.REGISTRATION_TIMEOUT));
if (maxRegistrationDuration.isFinite()) {
finiteRegistrationDuration = Time.milliseconds(maxRegistrationDuration.toMillis());
} else {
finiteRegistrationDuration = null;
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid format for parameter " +
TaskManagerOptions.REGISTRATION_TIMEOUT.key(), e);
}
final Time initialRegistrationPause;
try {
Duration pause = Duration.create(configuration.getString(TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF));
if (pause.isFinite()) {
initialRegistrationPause = Time.milliseconds(pause.toMillis());
} else {
throw new IllegalArgumentException("The initial registration pause must be finite: " + pause);
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid format for parameter " +
TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF.key(), e);
}
final Time maxRegistrationPause;
try {
Duration pause = Duration.create(configuration.getString(
TaskManagerOptions.REGISTRATION_MAX_BACKOFF));
if (pause.isFinite()) {
maxRegistrationPause = Time.milliseconds(pause.toMillis());
} else {
throw new IllegalArgumentException("The maximum registration pause must be finite: " + pause);
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid format for parameter " +
TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF.key(), e);
}
final Time refusedRegistrationPause;
try {
Duration pause = Duration.create(configuration.getString(TaskManagerOptions.REFUSED_REGISTRATION_BACKOFF));
if (pause.isFinite()) {
refusedRegistrationPause = Time.milliseconds(pause.toMillis());
} else {
throw new IllegalArgumentException("The refused registration pause must be finite: " + pause);
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid format for parameter " +
TaskManagerOptions.INITIAL_REGISTRATION_BACKOFF.key(), e);
}
final boolean exitOnOom = configuration.getBoolean(TaskManagerOptions.KILL_ON_OUT_OF_MEMORY);
final String classLoaderResolveOrder =
configuration.getString(CoreOptions.CLASSLOADER_RESOLVE_ORDER);
final String[] alwaysParentFirstLoaderPatterns = CoreOptions.getParentFirstLoaderPatterns(configuration);
final String taskManagerLogPath = configuration.getString(ConfigConstants.TASK_MANAGER_LOG_PATH_KEY, System.getProperty("log.file"));
final String taskManagerStdoutPath;
if (taskManagerLogPath != null) {
final int extension = taskManagerLogPath.lastIndexOf('.');
if (extension > 0) {
taskManagerStdoutPath = taskManagerLogPath.substring(0, extension) + ".out";
} else {
taskManagerStdoutPath = null;
}
} else {
taskManagerStdoutPath = null;
}
final RetryingRegistrationConfiguration retryingRegistrationConfiguration = RetryingRegistrationConfiguration.fromConfiguration(configuration);
return new TaskManagerConfiguration(
numberSlots,
tmpDirPaths,
timeout,
finiteRegistrationDuration,
initialRegistrationPause,
maxRegistrationPause,
refusedRegistrationPause,
configuration,
exitOnOom,
FlinkUserCodeClassLoaders.ResolveOrder.fromString(classLoaderResolveOrder),
alwaysParentFirstLoaderPatterns,
taskManagerLogPath,
taskManagerStdoutPath,
retryingRegistrationConfiguration);
} | [
"public",
"static",
"TaskManagerConfiguration",
"fromConfiguration",
"(",
"Configuration",
"configuration",
")",
"{",
"int",
"numberSlots",
"=",
"configuration",
".",
"getInteger",
"(",
"TaskManagerOptions",
".",
"NUM_TASK_SLOTS",
",",
"1",
")",
";",
"if",
"(",
"num... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerConfiguration.java#L178-L292 | train | Creates a new TaskManagerConfiguration from the given configuration. | [
30522,
2270,
10763,
4708,
24805,
4590,
8663,
8873,
27390,
3370,
2013,
8663,
8873,
27390,
3370,
1006,
9563,
9563,
1007,
1063,
20014,
3616,
10994,
2015,
1027,
9563,
1012,
2131,
18447,
26320,
1006,
4708,
24805,
4590,
7361,
9285,
1012,
16371,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java | TableFactoryService.find | public static <T> T find(Class<T> factoryClass, Map<String, String> propertyMap, ClassLoader classLoader) {
Preconditions.checkNotNull(classLoader);
return findInternal(factoryClass, propertyMap, Optional.of(classLoader));
} | java | public static <T> T find(Class<T> factoryClass, Map<String, String> propertyMap, ClassLoader classLoader) {
Preconditions.checkNotNull(classLoader);
return findInternal(factoryClass, propertyMap, Optional.of(classLoader));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"find",
"(",
"Class",
"<",
"T",
">",
"factoryClass",
",",
"Map",
"<",
"String",
",",
"String",
">",
"propertyMap",
",",
"ClassLoader",
"classLoader",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"classLoader"... | Finds a table factory of the given class, property map, and classloader.
@param factoryClass desired factory class
@param propertyMap properties that describe the factory configuration
@param classLoader classloader for service loading
@param <T> factory class type
@return the matching factory | [
"Finds",
"a",
"table",
"factory",
"of",
"the",
"given",
"class",
"property",
"map",
"and",
"classloader",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java#L106-L109 | train | Find a factory object from a class with a map of properties. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
2424,
1006,
2465,
1026,
1056,
1028,
4713,
26266,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
3200,
2863,
2361,
1010,
2465,
11066,
2121,
2465,
11066,
2121,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java | DataSetUtils.sample | public static <T> MapPartitionOperator<T, T> sample(
DataSet <T> input,
final boolean withReplacement,
final double fraction,
final long seed) {
return input.mapPartition(new SampleWithFraction<T>(withReplacement, fraction, seed));
} | java | public static <T> MapPartitionOperator<T, T> sample(
DataSet <T> input,
final boolean withReplacement,
final double fraction,
final long seed) {
return input.mapPartition(new SampleWithFraction<T>(withReplacement, fraction, seed));
} | [
"public",
"static",
"<",
"T",
">",
"MapPartitionOperator",
"<",
"T",
",",
"T",
">",
"sample",
"(",
"DataSet",
"<",
"T",
">",
"input",
",",
"final",
"boolean",
"withReplacement",
",",
"final",
"double",
"fraction",
",",
"final",
"long",
"seed",
")",
"{",
... | Generate a sample of DataSet by the probability fraction of each element.
@param withReplacement Whether element can be selected more than once.
@param fraction Probability that each element is chosen, should be [0,1] without replacement,
and [0, ∞) with replacement. While fraction is larger than 1, the elements are
expected to be selected multi times into sample on average.
@param seed random number generator seed.
@return The sampled DataSet | [
"Generate",
"a",
"sample",
"of",
"DataSet",
"by",
"the",
"probability",
"fraction",
"of",
"each",
"element",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java#L213-L220 | train | Sample a DataSet using the specified seed. | [
30522,
2270,
10763,
1026,
1056,
1028,
4949,
19362,
3775,
3508,
25918,
8844,
1026,
1056,
1010,
1056,
1028,
7099,
1006,
2951,
13462,
1026,
1056,
1028,
7953,
1010,
2345,
22017,
20898,
2007,
2890,
24759,
10732,
3672,
1010,
2345,
3313,
12884,
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/JSONObject.java | JSONObject.toBean | public <T> T toBean(Type type, boolean ignoreError) {
return JSONConverter.jsonConvert(type, this, ignoreError);
} | java | public <T> T toBean(Type type, boolean ignoreError) {
return JSONConverter.jsonConvert(type, this, ignoreError);
} | [
"public",
"<",
"T",
">",
"T",
"toBean",
"(",
"Type",
"type",
",",
"boolean",
"ignoreError",
")",
"{",
"return",
"JSONConverter",
".",
"jsonConvert",
"(",
"type",
",",
"this",
",",
"ignoreError",
")",
";",
"}"
] | 转为实体类对象
@param <T> Bean类型
@param type {@link Type}
@param ignoreError 是否忽略转换错误
@return 实体类对象
@since 4.3.2 | [
"转为实体类对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONObject.java#L321-L323 | train | Converts this object to a bean. | [
30522,
2270,
1026,
1056,
1028,
1056,
2000,
4783,
2319,
1006,
2828,
2828,
1010,
22017,
20898,
8568,
2121,
29165,
1007,
1063,
2709,
1046,
3385,
8663,
16874,
2121,
1012,
1046,
3385,
8663,
16874,
1006,
2828,
1010,
2023,
1010,
8568,
2121,
29165,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.adjustNoChunkedEncoding | public static void adjustNoChunkedEncoding(ClientRequest request, String requestBody) {
String fixedLengthString = request.getRequestHeaders().getFirst(Headers.CONTENT_LENGTH);
String transferEncodingString = request.getRequestHeaders().getLast(Headers.TRANSFER_ENCODING);
if(transferEncodingString != null) {
request.getRequestHeaders().remove(Headers.TRANSFER_ENCODING);
}
//if already specify a content-length, should use what they provided
if(fixedLengthString != null && Long.parseLong(fixedLengthString) > 0) {
return;
}
if(!StringUtils.isEmpty(requestBody)) {
long contentLength = requestBody.getBytes(UTF_8).length;
request.getRequestHeaders().put(Headers.CONTENT_LENGTH, contentLength);
}
} | java | public static void adjustNoChunkedEncoding(ClientRequest request, String requestBody) {
String fixedLengthString = request.getRequestHeaders().getFirst(Headers.CONTENT_LENGTH);
String transferEncodingString = request.getRequestHeaders().getLast(Headers.TRANSFER_ENCODING);
if(transferEncodingString != null) {
request.getRequestHeaders().remove(Headers.TRANSFER_ENCODING);
}
//if already specify a content-length, should use what they provided
if(fixedLengthString != null && Long.parseLong(fixedLengthString) > 0) {
return;
}
if(!StringUtils.isEmpty(requestBody)) {
long contentLength = requestBody.getBytes(UTF_8).length;
request.getRequestHeaders().put(Headers.CONTENT_LENGTH, contentLength);
}
} | [
"public",
"static",
"void",
"adjustNoChunkedEncoding",
"(",
"ClientRequest",
"request",
",",
"String",
"requestBody",
")",
"{",
"String",
"fixedLengthString",
"=",
"request",
".",
"getRequestHeaders",
"(",
")",
".",
"getFirst",
"(",
"Headers",
".",
"CONTENT_LENGTH",... | this method is to support sending a server which doesn't support chunked transfer encoding. | [
"this",
"method",
"is",
"to",
"support",
"sending",
"a",
"server",
"which",
"doesn",
"t",
"support",
"chunked",
"transfer",
"encoding",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/OauthHelper.java#L736-L751 | train | Adjusts the no - chunked encoding header in the request. | [
30522,
2270,
10763,
11675,
14171,
3630,
20760,
8950,
14728,
15305,
4667,
1006,
7396,
2890,
15500,
5227,
1010,
5164,
5227,
23684,
1007,
1063,
5164,
4964,
7770,
13512,
7898,
18886,
3070,
1027,
5227,
1012,
2131,
2890,
15500,
4974,
2545,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/GraphicsUtil.java | GraphicsUtil.createGraphics | public static Graphics2D createGraphics(BufferedImage image, Color color) {
final Graphics2D g = image.createGraphics();
// 填充背景
g.setColor(color);
g.fillRect(0, 0, image.getWidth(), image.getHeight());
return g;
} | java | public static Graphics2D createGraphics(BufferedImage image, Color color) {
final Graphics2D g = image.createGraphics();
// 填充背景
g.setColor(color);
g.fillRect(0, 0, image.getWidth(), image.getHeight());
return g;
} | [
"public",
"static",
"Graphics2D",
"createGraphics",
"(",
"BufferedImage",
"image",
",",
"Color",
"color",
")",
"{",
"final",
"Graphics2D",
"g",
"=",
"image",
".",
"createGraphics",
"(",
")",
";",
"// 填充背景\r",
"g",
".",
"setColor",
"(",
"color",
")",
";",
"... | 创建{@link Graphics2D}
@param image {@link BufferedImage}
@param color {@link Color}背景颜色以及当前画笔颜色
@return {@link Graphics2D}
@since 4.5.2 | [
"创建",
"{",
"@link",
"Graphics2D",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/GraphicsUtil.java#L25-L32 | train | Create a graphics object that will fill the image with the specified color. | [
30522,
2270,
10763,
8389,
2475,
2094,
3443,
14773,
2015,
1006,
17698,
2098,
9581,
3351,
3746,
1010,
3609,
3609,
1007,
1063,
2345,
8389,
2475,
2094,
1043,
1027,
3746,
1012,
3443,
14773,
2015,
1006,
1007,
1025,
1013,
1013,
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-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.getPropertyDescriptor | public static PropertyDescriptor getPropertyDescriptor(Class<?> clazz, final String fieldName, boolean ignoreCase) throws BeanException {
final Map<String, PropertyDescriptor> map = getPropertyDescriptorMap(clazz, ignoreCase);
return (null == map) ? null : map.get(fieldName);
} | java | public static PropertyDescriptor getPropertyDescriptor(Class<?> clazz, final String fieldName, boolean ignoreCase) throws BeanException {
final Map<String, PropertyDescriptor> map = getPropertyDescriptorMap(clazz, ignoreCase);
return (null == map) ? null : map.get(fieldName);
} | [
"public",
"static",
"PropertyDescriptor",
"getPropertyDescriptor",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"String",
"fieldName",
",",
"boolean",
"ignoreCase",
")",
"throws",
"BeanException",
"{",
"final",
"Map",
"<",
"String",
",",
"PropertyDescriptor... | 获得Bean类属性描述
@param clazz Bean类
@param fieldName 字段名
@param ignoreCase 是否忽略大小写
@return PropertyDescriptor
@throws BeanException 获取属性异常 | [
"获得Bean类属性描述"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L241-L244 | train | Returns the PropertyDescriptor for the given field name. | [
30522,
2270,
10763,
3200,
6155,
23235,
2953,
2131,
21572,
4842,
3723,
6155,
23235,
2953,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
2345,
5164,
2492,
18442,
1010,
22017,
20898,
8568,
18382,
1007,
11618,
14068,
10288,
24422,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java | Router.maxLength | private static int maxLength(List<String> coll) {
int max = 0;
for (String e : coll) {
int length = e.length();
if (length > max) {
max = length;
}
}
return max;
} | java | private static int maxLength(List<String> coll) {
int max = 0;
for (String e : coll) {
int length = e.length();
if (length > max) {
max = length;
}
}
return max;
} | [
"private",
"static",
"int",
"maxLength",
"(",
"List",
"<",
"String",
">",
"coll",
")",
"{",
"int",
"max",
"=",
"0",
";",
"for",
"(",
"String",
"e",
":",
"coll",
")",
"{",
"int",
"length",
"=",
"e",
".",
"length",
"(",
")",
";",
"if",
"(",
"leng... | Helper for toString. | [
"Helper",
"for",
"toString",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java#L119-L128 | train | Returns the maximum length of a list of strings. | [
30522,
2797,
10763,
20014,
4098,
7770,
13512,
2232,
1006,
2862,
1026,
5164,
1028,
8902,
2140,
1007,
1063,
20014,
4098,
1027,
1014,
1025,
2005,
1006,
5164,
1041,
1024,
8902,
2140,
1007,
1063,
20014,
3091,
1027,
1041,
1012,
3091,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.newClientContext | @Deprecated
public static SslContext newClientContext(
SslProvider provider, File certChainFile, TrustManagerFactory trustManagerFactory) throws SSLException {
return newClientContext(provider, certChainFile, trustManagerFactory, null, IdentityCipherSuiteFilter.INSTANCE,
null, 0, 0);
} | java | @Deprecated
public static SslContext newClientContext(
SslProvider provider, File certChainFile, TrustManagerFactory trustManagerFactory) throws SSLException {
return newClientContext(provider, certChainFile, trustManagerFactory, null, IdentityCipherSuiteFilter.INSTANCE,
null, 0, 0);
} | [
"@",
"Deprecated",
"public",
"static",
"SslContext",
"newClientContext",
"(",
"SslProvider",
"provider",
",",
"File",
"certChainFile",
",",
"TrustManagerFactory",
"trustManagerFactory",
")",
"throws",
"SSLException",
"{",
"return",
"newClientContext",
"(",
"provider",
"... | Creates a new client-side {@link SslContext}.
@param provider the {@link SslContext} implementation to use.
{@code null} to use the current default one.
@param certChainFile an X.509 certificate chain file in PEM format.
{@code null} to use the system default
@param trustManagerFactory the {@link TrustManagerFactory} that provides the {@link TrustManager}s
that verifies the certificates sent from servers.
{@code null} to use the default.
@return a new client-side {@link SslContext}
@deprecated Replaced by {@link SslContextBuilder} | [
"Creates",
"a",
"new",
"client",
"-",
"side",
"{",
"@link",
"SslContext",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L623-L628 | train | Create a new SslContext using the specified provider and trust manager. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
7020,
22499,
10111,
18413,
2047,
20464,
11638,
8663,
18209,
1006,
7020,
14277,
12298,
18688,
10802,
1010,
5371,
8292,
5339,
24925,
2078,
8873,
2571,
1010,
3404,
24805,
4590,
21450,
3404,
24805,
45... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java | HttpPostRequestEncoder.addBodyFileUploads | public void addBodyFileUploads(String name, File[] file, String[] contentType, boolean[] isText)
throws ErrorDataEncoderException {
if (file.length != contentType.length && file.length != isText.length) {
throw new IllegalArgumentException("Different array length");
}
for (int i = 0; i < file.length; i++) {
addBodyFileUpload(name, file[i], contentType[i], isText[i]);
}
} | java | public void addBodyFileUploads(String name, File[] file, String[] contentType, boolean[] isText)
throws ErrorDataEncoderException {
if (file.length != contentType.length && file.length != isText.length) {
throw new IllegalArgumentException("Different array length");
}
for (int i = 0; i < file.length; i++) {
addBodyFileUpload(name, file[i], contentType[i], isText[i]);
}
} | [
"public",
"void",
"addBodyFileUploads",
"(",
"String",
"name",
",",
"File",
"[",
"]",
"file",
",",
"String",
"[",
"]",
"contentType",
",",
"boolean",
"[",
"]",
"isText",
")",
"throws",
"ErrorDataEncoderException",
"{",
"if",
"(",
"file",
".",
"length",
"!=... | Add a series of Files associated with one File parameter
@param name
the name of the parameter
@param file
the array of files
@param contentType
the array of content Types associated with each file
@param isText
the array of isText attribute (False meaning binary mode) for each file
@throws IllegalArgumentException
also throws if array have different sizes
@throws ErrorDataEncoderException
if the encoding is in error or if the finalize were already done | [
"Add",
"a",
"series",
"of",
"Files",
"associated",
"with",
"one",
"File",
"parameter"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java#L429-L437 | train | Add a file array to the application. | [
30522,
2270,
11675,
5587,
23684,
8873,
2571,
6279,
11066,
2015,
1006,
5164,
2171,
1010,
5371,
1031,
1033,
5371,
1010,
5164,
1031,
1033,
4180,
13874,
1010,
22017,
20898,
1031,
1033,
21541,
10288,
2102,
1007,
11618,
7561,
2850,
2696,
2368,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.getHeaderIgnoreCase | public final static String getHeaderIgnoreCase(HttpServletRequest request, String nameIgnoreCase) {
Enumeration<String> names = request.getHeaderNames();
String name = null;
while (names.hasMoreElements()) {
name = names.nextElement();
if (name != null && name.equalsIgnoreCase(nameIgnoreCase)) {
return request.getHeader(name);
}
}
return null;
} | java | public final static String getHeaderIgnoreCase(HttpServletRequest request, String nameIgnoreCase) {
Enumeration<String> names = request.getHeaderNames();
String name = null;
while (names.hasMoreElements()) {
name = names.nextElement();
if (name != null && name.equalsIgnoreCase(nameIgnoreCase)) {
return request.getHeader(name);
}
}
return null;
} | [
"public",
"final",
"static",
"String",
"getHeaderIgnoreCase",
"(",
"HttpServletRequest",
"request",
",",
"String",
"nameIgnoreCase",
")",
"{",
"Enumeration",
"<",
"String",
">",
"names",
"=",
"request",
".",
"getHeaderNames",
"(",
")",
";",
"String",
"name",
"="... | 忽略大小写获得请求header中的信息
@param request 请求对象{@link HttpServletRequest}
@param nameIgnoreCase 忽略大小写头信息的KEY
@return header值 | [
"忽略大小写获得请求header中的信息"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L277-L288 | train | Gets the value of the
header in the HttpServletRequest ignoring case. | [
30522,
2270,
2345,
10763,
5164,
2131,
4974,
11124,
26745,
2890,
18382,
1006,
16770,
2121,
2615,
7485,
2890,
15500,
5227,
1010,
5164,
2171,
23773,
5686,
18382,
1007,
1063,
4372,
17897,
8156,
1026,
5164,
1028,
3415,
1027,
5227,
1012,
2131,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/comparator/ComparatorChain.java | ComparatorChain.setComparator | public ComparatorChain<E> setComparator(final int index, final Comparator<E> comparator, final boolean reverse) {
checkLocked();
chain.set(index, comparator);
if (reverse == true) {
orderingBits.set(index);
} else {
orderingBits.clear(index);
}
return this;
} | java | public ComparatorChain<E> setComparator(final int index, final Comparator<E> comparator, final boolean reverse) {
checkLocked();
chain.set(index, comparator);
if (reverse == true) {
orderingBits.set(index);
} else {
orderingBits.clear(index);
}
return this;
} | [
"public",
"ComparatorChain",
"<",
"E",
">",
"setComparator",
"(",
"final",
"int",
"index",
",",
"final",
"Comparator",
"<",
"E",
">",
"comparator",
",",
"final",
"boolean",
"reverse",
")",
"{",
"checkLocked",
"(",
")",
";",
"chain",
".",
"set",
"(",
"ind... | 替换指定位置的比较器,替换指定排序方式
@param index 位置
@param comparator {@link Comparator}
@param reverse 是否反序,true表示正序,false反序
@return this | [
"替换指定位置的比较器,替换指定排序方式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/comparator/ComparatorChain.java#L131-L141 | train | Sets the Comparator at the specified index. | [
30522,
2270,
4012,
28689,
4263,
24925,
2078,
1026,
1041,
1028,
2275,
9006,
28689,
4263,
1006,
2345,
20014,
5950,
1010,
2345,
4012,
28689,
4263,
1026,
1041,
1028,
4012,
28689,
4263,
1010,
2345,
22017,
20898,
7901,
1007,
1063,
4638,
7878,
209... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateNull | public static <T> T validateNull(T value, String errorMsgTemplate, Object... params) throws ValidateException {
if (isNotNull(value)) {
throw new ValidateException(errorMsgTemplate, params);
}
return value;
} | java | public static <T> T validateNull(T value, String errorMsgTemplate, Object... params) throws ValidateException {
if (isNotNull(value)) {
throw new ValidateException(errorMsgTemplate, params);
}
return value;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"validateNull",
"(",
"T",
"value",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"isNotNull",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"V... | 检查指定值是否为<code>null</code>
@param <T> 被检查的对象类型
@param value 值
@param errorMsgTemplate 错误消息内容模板(变量使用{}表示)
@param params 模板中变量替换后的值
@return 检查过后的值
@throws ValidateException 检查不满足条件抛出的异常
@since 4.4.5 | [
"检查指定值是否为<code",
">",
"null<",
"/",
"code",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L147-L152 | train | Validate null. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
9398,
3686,
11231,
3363,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
13512,
6633,
15725,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
3475,
414... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/execution/librarycache/BlobLibraryCacheManager.java | BlobLibraryCacheManager.getNumberOfReferenceHolders | int getNumberOfReferenceHolders(JobID jobId) {
synchronized (lockObject) {
LibraryCacheEntry entry = cacheEntries.get(jobId);
return entry == null ? 0 : entry.getNumberOfReferenceHolders();
}
} | java | int getNumberOfReferenceHolders(JobID jobId) {
synchronized (lockObject) {
LibraryCacheEntry entry = cacheEntries.get(jobId);
return entry == null ? 0 : entry.getNumberOfReferenceHolders();
}
} | [
"int",
"getNumberOfReferenceHolders",
"(",
"JobID",
"jobId",
")",
"{",
"synchronized",
"(",
"lockObject",
")",
"{",
"LibraryCacheEntry",
"entry",
"=",
"cacheEntries",
".",
"get",
"(",
"jobId",
")",
";",
"return",
"entry",
"==",
"null",
"?",
"0",
":",
"entry"... | Gets the number of tasks holding {@link ClassLoader} references for the given job.
@param jobId ID of a job
@return number of reference holders | [
"Gets",
"the",
"number",
"of",
"tasks",
"holding",
"{",
"@link",
"ClassLoader",
"}",
"references",
"for",
"the",
"given",
"job",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/execution/librarycache/BlobLibraryCacheManager.java#L188-L193 | train | Returns the number of reference holders for the specified job. | [
30522,
20014,
2131,
19172,
5677,
11253,
2890,
25523,
17794,
1006,
3105,
3593,
3105,
3593,
1007,
1063,
25549,
1006,
5843,
16429,
20614,
1007,
1063,
3075,
3540,
25923,
3372,
2854,
4443,
1027,
17053,
4765,
5134,
1012,
2131,
1006,
3105,
3593,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | resolver-dns/src/main/java/io/netty/resolver/dns/DnsServerAddresses.java | DnsServerAddresses.singleton | public static DnsServerAddresses singleton(final InetSocketAddress address) {
if (address == null) {
throw new NullPointerException("address");
}
if (address.isUnresolved()) {
throw new IllegalArgumentException("cannot use an unresolved DNS server address: " + address);
}
return new SingletonDnsServerAddresses(address);
} | java | public static DnsServerAddresses singleton(final InetSocketAddress address) {
if (address == null) {
throw new NullPointerException("address");
}
if (address.isUnresolved()) {
throw new IllegalArgumentException("cannot use an unresolved DNS server address: " + address);
}
return new SingletonDnsServerAddresses(address);
} | [
"public",
"static",
"DnsServerAddresses",
"singleton",
"(",
"final",
"InetSocketAddress",
"address",
")",
"{",
"if",
"(",
"address",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"address\"",
")",
";",
"}",
"if",
"(",
"address",
".",
... | Returns the {@link DnsServerAddresses} that yields only a single {@code address}. | [
"Returns",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsServerAddresses.java#L151-L160 | train | Returns a singleton instance of DnsServerAddresses. | [
30522,
2270,
10763,
1040,
3619,
8043,
26061,
14141,
25932,
28159,
30524,
1000,
1007,
1025,
1065,
2065,
1006,
4769,
1012,
2003,
4609,
6072,
16116,
1006,
1007,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
3685,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java | CommandBuilderUtils.findJarsDir | static String findJarsDir(String sparkHome, String scalaVersion, boolean failIfNotFound) {
// TODO: change to the correct directory once the assembly build is changed.
File libdir = new File(sparkHome, "jars");
if (!libdir.isDirectory()) {
libdir = new File(sparkHome, String.format("assembly/target/scala-%s/jars", scalaVersion));
if (!libdir.isDirectory()) {
checkState(!failIfNotFound,
"Library directory '%s' does not exist; make sure Spark is built.",
libdir.getAbsolutePath());
return null;
}
}
return libdir.getAbsolutePath();
} | java | static String findJarsDir(String sparkHome, String scalaVersion, boolean failIfNotFound) {
// TODO: change to the correct directory once the assembly build is changed.
File libdir = new File(sparkHome, "jars");
if (!libdir.isDirectory()) {
libdir = new File(sparkHome, String.format("assembly/target/scala-%s/jars", scalaVersion));
if (!libdir.isDirectory()) {
checkState(!failIfNotFound,
"Library directory '%s' does not exist; make sure Spark is built.",
libdir.getAbsolutePath());
return null;
}
}
return libdir.getAbsolutePath();
} | [
"static",
"String",
"findJarsDir",
"(",
"String",
"sparkHome",
",",
"String",
"scalaVersion",
",",
"boolean",
"failIfNotFound",
")",
"{",
"// TODO: change to the correct directory once the assembly build is changed.",
"File",
"libdir",
"=",
"new",
"File",
"(",
"sparkHome",
... | Find the location of the Spark jars dir, depending on whether we're looking at a build
or a distribution directory. | [
"Find",
"the",
"location",
"of",
"the",
"Spark",
"jars",
"dir",
"depending",
"on",
"whether",
"we",
"re",
"looking",
"at",
"a",
"build",
"or",
"a",
"distribution",
"directory",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L316-L329 | train | Find the jars directory. | [
30522,
10763,
5164,
2424,
16084,
16150,
4313,
1006,
5164,
12125,
23393,
2063,
1010,
5164,
26743,
27774,
1010,
22017,
20898,
8246,
10128,
17048,
14876,
8630,
1007,
1063,
1013,
1013,
28681,
2080,
1024,
2689,
2000,
1996,
6149,
14176,
2320,
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... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/program/OptimizerPlanEnvironment.java | OptimizerPlanEnvironment.setAsContext | private void setAsContext() {
ExecutionEnvironmentFactory factory = new ExecutionEnvironmentFactory() {
@Override
public ExecutionEnvironment createExecutionEnvironment() {
return OptimizerPlanEnvironment.this;
}
};
initializeContextEnvironment(factory);
} | java | private void setAsContext() {
ExecutionEnvironmentFactory factory = new ExecutionEnvironmentFactory() {
@Override
public ExecutionEnvironment createExecutionEnvironment() {
return OptimizerPlanEnvironment.this;
}
};
initializeContextEnvironment(factory);
} | [
"private",
"void",
"setAsContext",
"(",
")",
"{",
"ExecutionEnvironmentFactory",
"factory",
"=",
"new",
"ExecutionEnvironmentFactory",
"(",
")",
"{",
"@",
"Override",
"public",
"ExecutionEnvironment",
"createExecutionEnvironment",
"(",
")",
"{",
"return",
"OptimizerPlan... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/OptimizerPlanEnvironment.java#L112-L121 | train | Sets the environment as context. | [
30522,
2797,
11675,
2275,
28187,
10111,
18413,
1006,
1007,
1063,
7781,
2368,
21663,
2239,
3672,
21450,
4713,
1027,
2047,
7781,
2368,
21663,
2239,
3672,
21450,
1006,
1007,
1063,
1030,
2058,
15637,
2270,
7781,
2368,
21663,
2239,
3672,
3443,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport-native-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueStreamChannel.java | AbstractKQueueStreamChannel.writeBytesMultiple | private int writeBytesMultiple(ChannelOutboundBuffer in, IovArray array) throws IOException {
final long expectedWrittenBytes = array.size();
assert expectedWrittenBytes != 0;
final int cnt = array.count();
assert cnt != 0;
final long localWrittenBytes = socket.writevAddresses(array.memoryAddress(0), cnt);
if (localWrittenBytes > 0) {
adjustMaxBytesPerGatheringWrite(expectedWrittenBytes, localWrittenBytes, array.maxBytes());
in.removeBytes(localWrittenBytes);
return 1;
}
return WRITE_STATUS_SNDBUF_FULL;
} | java | private int writeBytesMultiple(ChannelOutboundBuffer in, IovArray array) throws IOException {
final long expectedWrittenBytes = array.size();
assert expectedWrittenBytes != 0;
final int cnt = array.count();
assert cnt != 0;
final long localWrittenBytes = socket.writevAddresses(array.memoryAddress(0), cnt);
if (localWrittenBytes > 0) {
adjustMaxBytesPerGatheringWrite(expectedWrittenBytes, localWrittenBytes, array.maxBytes());
in.removeBytes(localWrittenBytes);
return 1;
}
return WRITE_STATUS_SNDBUF_FULL;
} | [
"private",
"int",
"writeBytesMultiple",
"(",
"ChannelOutboundBuffer",
"in",
",",
"IovArray",
"array",
")",
"throws",
"IOException",
"{",
"final",
"long",
"expectedWrittenBytes",
"=",
"array",
".",
"size",
"(",
")",
";",
"assert",
"expectedWrittenBytes",
"!=",
"0",... | Write multiple bytes via {@link IovArray}.
@param in the collection which contains objects to write.
@param array The array which contains the content to write.
@return The value that should be decremented from the write quantum which starts at
{@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows:
<ul>
<li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content)
is encountered</li>
<li>1 - if a single call to write data was made to the OS</li>
<li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but
no data was accepted</li>
</ul>
@throws IOException If an I/O exception occurs during write. | [
"Write",
"multiple",
"bytes",
"via",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueStreamChannel.java#L147-L160 | train | Write multiple bytes. | [
30522,
2797,
20014,
4339,
3762,
4570,
12274,
7096,
11514,
2571,
1006,
3149,
5833,
15494,
8569,
12494,
1999,
1010,
22834,
10755,
9447,
9140,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
2146,
3517,
15773,
3762,
4570,
1027,
9140,
1012,
2946,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.mainName | public static String mainName(File file) {
if (file.isDirectory()) {
return file.getName();
}
return mainName(file.getName());
} | java | public static String mainName(File file) {
if (file.isDirectory()) {
return file.getName();
}
return mainName(file.getName());
} | [
"public",
"static",
"String",
"mainName",
"(",
"File",
"file",
")",
"{",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"file",
".",
"getName",
"(",
")",
";",
"}",
"return",
"mainName",
"(",
"file",
".",
"getName",
"(",
")",
"... | 返回主文件名
@param file 文件
@return 主文件名 | [
"返回主文件名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1754-L1759 | train | Returns the main name of the file. | [
30522,
2270,
10763,
5164,
2364,
18442,
1006,
5371,
5371,
1007,
1063,
2065,
1006,
5371,
1012,
2003,
4305,
2890,
16761,
2100,
1006,
1007,
1007,
1063,
2709,
5371,
1012,
2131,
18442,
1006,
1007,
1025,
1065,
2709,
2364,
18442,
1006,
5371,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | http-url/src/main/java/com/networknt/url/QueryString.java | QueryString.applyOnURL | public String applyOnURL(String url) {
if (StringUtils.isBlank(url)) {
return url;
}
return StringUtils.substringBefore(url, "?") + toString();
} | java | public String applyOnURL(String url) {
if (StringUtils.isBlank(url)) {
return url;
}
return StringUtils.substringBefore(url, "?") + toString();
} | [
"public",
"String",
"applyOnURL",
"(",
"String",
"url",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"url",
")",
")",
"{",
"return",
"url",
";",
"}",
"return",
"StringUtils",
".",
"substringBefore",
"(",
"url",
",",
"\"?\"",
")",
"+",
"toSt... | Apply this url QueryString on the given URL. If a query string already
exists, it is replaced by this one.
@param url the URL to apply this query string.
@return url with query string added | [
"Apply",
"this",
"url",
"QueryString",
"on",
"the",
"given",
"URL",
".",
"If",
"a",
"query",
"string",
"already",
"exists",
"it",
"is",
"replaced",
"by",
"this",
"one",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/QueryString.java#L170-L175 | train | Apply the filter on the URL. | [
30522,
2270,
5164,
6611,
2239,
3126,
2140,
1006,
5164,
24471,
2140,
1007,
1063,
2065,
1006,
5164,
21823,
4877,
1012,
2003,
28522,
8950,
1006,
24471,
2140,
1007,
1007,
1063,
2709,
24471,
2140,
1025,
1065,
2709,
5164,
21823,
4877,
1012,
4942,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/TimeWindow.java | TimeWindow.mergeWindows | public static void mergeWindows(Collection<TimeWindow> windows, MergingWindowAssigner.MergeCallback<TimeWindow> c) {
// sort the windows by the start time and then merge overlapping windows
List<TimeWindow> sortedWindows = new ArrayList<>(windows);
Collections.sort(sortedWindows, new Comparator<TimeWindow>() {
@Override
public int compare(TimeWindow o1, TimeWindow o2) {
return Long.compare(o1.getStart(), o2.getStart());
}
});
List<Tuple2<TimeWindow, Set<TimeWindow>>> merged = new ArrayList<>();
Tuple2<TimeWindow, Set<TimeWindow>> currentMerge = null;
for (TimeWindow candidate: sortedWindows) {
if (currentMerge == null) {
currentMerge = new Tuple2<>();
currentMerge.f0 = candidate;
currentMerge.f1 = new HashSet<>();
currentMerge.f1.add(candidate);
} else if (currentMerge.f0.intersects(candidate)) {
currentMerge.f0 = currentMerge.f0.cover(candidate);
currentMerge.f1.add(candidate);
} else {
merged.add(currentMerge);
currentMerge = new Tuple2<>();
currentMerge.f0 = candidate;
currentMerge.f1 = new HashSet<>();
currentMerge.f1.add(candidate);
}
}
if (currentMerge != null) {
merged.add(currentMerge);
}
for (Tuple2<TimeWindow, Set<TimeWindow>> m: merged) {
if (m.f1.size() > 1) {
c.merge(m.f1, m.f0);
}
}
} | java | public static void mergeWindows(Collection<TimeWindow> windows, MergingWindowAssigner.MergeCallback<TimeWindow> c) {
// sort the windows by the start time and then merge overlapping windows
List<TimeWindow> sortedWindows = new ArrayList<>(windows);
Collections.sort(sortedWindows, new Comparator<TimeWindow>() {
@Override
public int compare(TimeWindow o1, TimeWindow o2) {
return Long.compare(o1.getStart(), o2.getStart());
}
});
List<Tuple2<TimeWindow, Set<TimeWindow>>> merged = new ArrayList<>();
Tuple2<TimeWindow, Set<TimeWindow>> currentMerge = null;
for (TimeWindow candidate: sortedWindows) {
if (currentMerge == null) {
currentMerge = new Tuple2<>();
currentMerge.f0 = candidate;
currentMerge.f1 = new HashSet<>();
currentMerge.f1.add(candidate);
} else if (currentMerge.f0.intersects(candidate)) {
currentMerge.f0 = currentMerge.f0.cover(candidate);
currentMerge.f1.add(candidate);
} else {
merged.add(currentMerge);
currentMerge = new Tuple2<>();
currentMerge.f0 = candidate;
currentMerge.f1 = new HashSet<>();
currentMerge.f1.add(candidate);
}
}
if (currentMerge != null) {
merged.add(currentMerge);
}
for (Tuple2<TimeWindow, Set<TimeWindow>> m: merged) {
if (m.f1.size() > 1) {
c.merge(m.f1, m.f0);
}
}
} | [
"public",
"static",
"void",
"mergeWindows",
"(",
"Collection",
"<",
"TimeWindow",
">",
"windows",
",",
"MergingWindowAssigner",
".",
"MergeCallback",
"<",
"TimeWindow",
">",
"c",
")",
"{",
"// sort the windows by the start time and then merge overlapping windows",
"List",
... | Merge overlapping {@link TimeWindow}s. For use by merging
{@link org.apache.flink.streaming.api.windowing.assigners.WindowAssigner WindowAssigners}. | [
"Merge",
"overlapping",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/windows/TimeWindow.java#L216-L259 | train | Merge windows. | [
30522,
2270,
10763,
11675,
13590,
11101,
15568,
1006,
3074,
1026,
2051,
11101,
5004,
1028,
3645,
1010,
16468,
11101,
21293,
18719,
10177,
2099,
1012,
13590,
9289,
20850,
8684,
1026,
2051,
11101,
5004,
1028,
1039,
1007,
1063,
1013,
1013,
4066,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/map/MapUtil.java | MapUtil.newTreeMap | public static <K, V> TreeMap<K, V> newTreeMap(Map<K, V> map, Comparator<? super K> comparator) {
final TreeMap<K, V> treeMap = new TreeMap<>(comparator);
if (false == isEmpty(map)) {
treeMap.putAll(map);
}
return treeMap;
} | java | public static <K, V> TreeMap<K, V> newTreeMap(Map<K, V> map, Comparator<? super K> comparator) {
final TreeMap<K, V> treeMap = new TreeMap<>(comparator);
if (false == isEmpty(map)) {
treeMap.putAll(map);
}
return treeMap;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"TreeMap",
"<",
"K",
",",
"V",
">",
"newTreeMap",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"Comparator",
"<",
"?",
"super",
"K",
">",
"comparator",
")",
"{",
"final",
"TreeMap",
"<",
"K",
","... | 新建TreeMap,Key有序的Map
@param map Map
@param comparator Key比较器
@return TreeMap
@since 3.2.3 | [
"新建TreeMap,Key有序的Map"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L129-L135 | train | Creates a new TreeMap from the given map. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
3392,
2863,
2361,
1026,
1047,
1010,
1058,
1028,
25597,
9910,
2863,
2361,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
4949,
1010,
4012,
28689,
4263,
1026,
1029,
3565,
1047,
1028,
4012,
28689,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ts/BaseChineseDictionary.java | BaseChineseDictionary.load | static boolean load(String path, AhoCorasickDoubleArrayTrie<String> trie)
{
return load(path, trie, false);
} | java | static boolean load(String path, AhoCorasickDoubleArrayTrie<String> trie)
{
return load(path, trie, false);
} | [
"static",
"boolean",
"load",
"(",
"String",
"path",
",",
"AhoCorasickDoubleArrayTrie",
"<",
"String",
">",
"trie",
")",
"{",
"return",
"load",
"(",
"path",
",",
"trie",
",",
"false",
")",
";",
"}"
] | 将path的内容载入trie中
@param path
@param trie
@return | [
"将path的内容载入trie中"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/ts/BaseChineseDictionary.java#L97-L100 | train | Load a CID from a file. | [
30522,
10763,
22017,
20898,
7170,
1006,
5164,
4130,
1010,
6289,
24163,
8180,
6799,
26797,
3468,
2906,
9447,
18886,
2063,
1026,
5164,
1028,
13012,
2063,
1007,
1063,
2709,
7170,
1006,
4130,
1010,
13012,
2063,
1010,
6270,
1007,
1025,
1065,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.fromCollection | public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, TypeInformation<OUT> typeInfo) {
Preconditions.checkNotNull(data, "The iterator must not be null");
SourceFunction<OUT> function = new FromIteratorFunction<>(data);
return addSource(function, "Collection Source", typeInfo);
} | java | public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, TypeInformation<OUT> typeInfo) {
Preconditions.checkNotNull(data, "The iterator must not be null");
SourceFunction<OUT> function = new FromIteratorFunction<>(data);
return addSource(function, "Collection Source", typeInfo);
} | [
"public",
"<",
"OUT",
">",
"DataStreamSource",
"<",
"OUT",
">",
"fromCollection",
"(",
"Iterator",
"<",
"OUT",
">",
"data",
",",
"TypeInformation",
"<",
"OUT",
">",
"typeInfo",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"data",
",",
"\"The iterator... | Creates a data stream from the given iterator.
<p>Because the iterator will remain unmodified until the actual execution happens,
the type of data returned by the iterator must be given explicitly in the form of the type
information. This method is useful for cases where the type is generic.
In that case, the type class (as given in
{@link #fromCollection(java.util.Iterator, Class)} does not supply all type information.
<p>Note that this operation will result in a non-parallel data stream source, i.e.,
a data stream source with parallelism one.
@param data
The iterator of elements to create the data stream from
@param typeInfo
The TypeInformation for the produced data stream
@param <OUT>
The type of the returned data stream
@return The data stream representing the elements in the iterator | [
"Creates",
"a",
"data",
"stream",
"from",
"the",
"given",
"iterator",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L864-L869 | train | Creates a data stream source from a collection. | [
30522,
2270,
1026,
2041,
1028,
2951,
21422,
6499,
3126,
3401,
1026,
2041,
1028,
2013,
26895,
18491,
1006,
2009,
6906,
4263,
1026,
2041,
1028,
2951,
1010,
2828,
2378,
14192,
3370,
1026,
2041,
1028,
2828,
2378,
14876,
1007,
1063,
3653,
8663,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.getBytes | @SuppressWarnings("EqualsBetweenInconvertibleTypes")
public byte[] getBytes(String key, byte[] defaultValue) {
Object o = getRawValue(key);
if (o == null) {
return defaultValue;
}
else if (o.getClass().equals(byte[].class)) {
return (byte[]) o;
}
else {
LOG.warn("Configuration cannot evaluate value {} as a byte[] value", o);
return defaultValue;
}
} | java | @SuppressWarnings("EqualsBetweenInconvertibleTypes")
public byte[] getBytes(String key, byte[] defaultValue) {
Object o = getRawValue(key);
if (o == null) {
return defaultValue;
}
else if (o.getClass().equals(byte[].class)) {
return (byte[]) o;
}
else {
LOG.warn("Configuration cannot evaluate value {} as a byte[] value", o);
return defaultValue;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"EqualsBetweenInconvertibleTypes\"",
")",
"public",
"byte",
"[",
"]",
"getBytes",
"(",
"String",
"key",
",",
"byte",
"[",
"]",
"defaultValue",
")",
"{",
"Object",
"o",
"=",
"getRawValue",
"(",
"key",
")",
";",
"if",
"(",
"o"... | Returns the value associated with the given key as a byte array.
@param key
The key pointing to the associated value.
@param defaultValue
The default value which is returned in case there is no value associated with the given key.
@return the (default) value associated with the given key. | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"key",
"as",
"a",
"byte",
"array",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L574-L588 | train | Returns the value of the configuration property as a byte array. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
19635,
20915,
28394,
11483,
8663,
16874,
7028,
13874,
2015,
1000,
1007,
2270,
24880,
1031,
1033,
2131,
3762,
4570,
1006,
5164,
3145,
1010,
24880,
1031,
1033,
12398,
10175,
5657,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/GatherFunction.java | GatherFunction.updateVertexFromScatterGatherIteration | @SuppressWarnings("unchecked")
<VertexWithDegree> void updateVertexFromScatterGatherIteration(Vertex<K, VertexWithDegree> vertexState,
MessageIterator<Message> inMessages) throws Exception {
Vertex<K, VV> vertex = new Vertex<>(vertexState.f0,
((Tuple3<VV, Long, Long>) vertexState.getValue()).f0);
updateVertex(vertex, inMessages);
} | java | @SuppressWarnings("unchecked")
<VertexWithDegree> void updateVertexFromScatterGatherIteration(Vertex<K, VertexWithDegree> vertexState,
MessageIterator<Message> inMessages) throws Exception {
Vertex<K, VV> vertex = new Vertex<>(vertexState.f0,
((Tuple3<VV, Long, Long>) vertexState.getValue()).f0);
updateVertex(vertex, inMessages);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"<",
"VertexWithDegree",
">",
"void",
"updateVertexFromScatterGatherIteration",
"(",
"Vertex",
"<",
"K",
",",
"VertexWithDegree",
">",
"vertexState",
",",
"MessageIterator",
"<",
"Message",
">",
"inMessages",
")",
... | In order to hide the Tuple3(actualValue, inDegree, OutDegree) vertex value from the user,
another function will be called from {@link org.apache.flink.graph.spargel.ScatterGatherIteration}.
<p>This function will retrieve the vertex from the vertexState and will set its degrees, afterwards calling
the regular updateVertex function.
@param vertexState
@param inMessages
@throws Exception | [
"In",
"order",
"to",
"hide",
"the",
"Tuple3",
"(",
"actualValue",
"inDegree",
"OutDegree",
")",
"vertex",
"value",
"from",
"the",
"user",
"another",
"function",
"will",
"be",
"called",
"from",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"graph",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/GatherFunction.java#L242-L250 | train | Update a vertex from a scatter gather iteration. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
1026,
19449,
24415,
3207,
28637,
1028,
11675,
10651,
16874,
10288,
19699,
22225,
11266,
3334,
20697,
5886,
21646,
3370,
1006,
19449,
1026,
1047,
1010,
19449,
244... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.split | public static byte[][] split(byte[] array, int len) {
int x = array.length / len;
int y = array.length % len;
int z = 0;
if (y != 0) {
z = 1;
}
byte[][] arrays = new byte[x + z][];
byte[] arr;
for (int i = 0; i < x + z; i++) {
arr = new byte[len];
if (i == x + z - 1 && y != 0) {
System.arraycopy(array, i * len, arr, 0, y);
} else {
System.arraycopy(array, i * len, arr, 0, len);
}
arrays[i] = arr;
}
return arrays;
} | java | public static byte[][] split(byte[] array, int len) {
int x = array.length / len;
int y = array.length % len;
int z = 0;
if (y != 0) {
z = 1;
}
byte[][] arrays = new byte[x + z][];
byte[] arr;
for (int i = 0; i < x + z; i++) {
arr = new byte[len];
if (i == x + z - 1 && y != 0) {
System.arraycopy(array, i * len, arr, 0, y);
} else {
System.arraycopy(array, i * len, arr, 0, len);
}
arrays[i] = arr;
}
return arrays;
} | [
"public",
"static",
"byte",
"[",
"]",
"[",
"]",
"split",
"(",
"byte",
"[",
"]",
"array",
",",
"int",
"len",
")",
"{",
"int",
"x",
"=",
"array",
".",
"length",
"/",
"len",
";",
"int",
"y",
"=",
"array",
".",
"length",
"%",
"len",
";",
"int",
"... | 拆分byte数组为几个等份(最后一份可能小于len)
@param array 数组
@param len 每个小节的长度
@return 拆分后的数组 | [
"拆分byte数组为几个等份(最后一份可能小于len)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L698-L717 | train | Splits the given byte array into smaller array of bytes. | [
30522,
2270,
10763,
24880,
1031,
1033,
1031,
1033,
3975,
1006,
24880,
1031,
1033,
9140,
1010,
20014,
18798,
1007,
1063,
20014,
1060,
1027,
9140,
1012,
3091,
1013,
18798,
1025,
20014,
1061,
1027,
9140,
1012,
3091,
1003,
18798,
1025,
20014,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Range.java | Range.safeStep | private T safeStep(T base) {
T next = null;
try {
next = steper.step(base, this.end, this.index);
} catch (Exception e) {
// ignore
}
return next;
} | java | private T safeStep(T base) {
T next = null;
try {
next = steper.step(base, this.end, this.index);
} catch (Exception e) {
// ignore
}
return next;
} | [
"private",
"T",
"safeStep",
"(",
"T",
"base",
")",
"{",
"T",
"next",
"=",
"null",
";",
"try",
"{",
"next",
"=",
"steper",
".",
"step",
"(",
"base",
",",
"this",
".",
"end",
",",
"this",
".",
"index",
")",
";",
"}",
"catch",
"(",
"Exception",
"e... | 不抛异常的获取下一步进的元素,如果获取失败返回{@code null}
@param base 上一个元素
@return 下一步进 | [
"不抛异常的获取下一步进的元素,如果获取失败返回",
"{",
"@code",
"null",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Range.java#L147-L155 | train | This method is called by the steper to perform a step on a base object. | [
30522,
2797,
1056,
3647,
13473,
2361,
1006,
1056,
2918,
1007,
1063,
1056,
2279,
1027,
19701,
1025,
3046,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.fromDataSet | public static <K, VV, EV> Graph<K, VV, EV> fromDataSet(DataSet<Edge<K, EV>> edges,
final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) {
TypeInformation<K> keyType = ((TupleTypeInfo<?>) edges.getType()).getTypeAt(0);
TypeInformation<VV> valueType = TypeExtractor.createTypeInfo(
MapFunction.class, vertexValueInitializer.getClass(), 1, keyType, null);
@SuppressWarnings({ "unchecked", "rawtypes" })
TypeInformation<Vertex<K, VV>> returnType = (TypeInformation<Vertex<K, VV>>) new TupleTypeInfo(
Vertex.class, keyType, valueType);
DataSet<Vertex<K, VV>> vertices = edges
.flatMap(new EmitSrcAndTargetAsTuple1<>())
.name("Source and target IDs")
.distinct()
.name("IDs")
.map(new MapFunction<Tuple1<K>, Vertex<K, VV>>() {
private Vertex<K, VV> output = new Vertex<>();
public Vertex<K, VV> map(Tuple1<K> value) throws Exception {
output.f0 = value.f0;
output.f1 = vertexValueInitializer.map(value.f0);
return output;
}
}).returns(returnType).withForwardedFields("f0").name("Initialize vertex values");
return new Graph<>(vertices, edges, context);
} | java | public static <K, VV, EV> Graph<K, VV, EV> fromDataSet(DataSet<Edge<K, EV>> edges,
final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) {
TypeInformation<K> keyType = ((TupleTypeInfo<?>) edges.getType()).getTypeAt(0);
TypeInformation<VV> valueType = TypeExtractor.createTypeInfo(
MapFunction.class, vertexValueInitializer.getClass(), 1, keyType, null);
@SuppressWarnings({ "unchecked", "rawtypes" })
TypeInformation<Vertex<K, VV>> returnType = (TypeInformation<Vertex<K, VV>>) new TupleTypeInfo(
Vertex.class, keyType, valueType);
DataSet<Vertex<K, VV>> vertices = edges
.flatMap(new EmitSrcAndTargetAsTuple1<>())
.name("Source and target IDs")
.distinct()
.name("IDs")
.map(new MapFunction<Tuple1<K>, Vertex<K, VV>>() {
private Vertex<K, VV> output = new Vertex<>();
public Vertex<K, VV> map(Tuple1<K> value) throws Exception {
output.f0 = value.f0;
output.f1 = vertexValueInitializer.map(value.f0);
return output;
}
}).returns(returnType).withForwardedFields("f0").name("Initialize vertex values");
return new Graph<>(vertices, edges, context);
} | [
"public",
"static",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"fromDataSet",
"(",
"DataSet",
"<",
"Edge",
"<",
"K",
",",
"EV",
">",
">",
"edges",
",",
"final",
"MapFunction",
"<",
"K",
",",
"VV",
">",
... | Creates a graph from a DataSet of edges.
Vertices are created automatically and their values are set
by applying the provided map function to the vertex IDs.
@param edges a DataSet of edges.
@param vertexValueInitializer the mapper function that initializes the vertex values.
It allows to apply a map transformation on the vertex ID to produce an initial vertex value.
@param context the flink execution environment.
@return the newly created graph. | [
"Creates",
"a",
"graph",
"from",
"a",
"DataSet",
"of",
"edges",
".",
"Vertices",
"are",
"created",
"automatically",
"and",
"their",
"values",
"are",
"set",
"by",
"applying",
"the",
"provided",
"map",
"function",
"to",
"the",
"vertex",
"IDs",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L211-L239 | train | Creates a graph from a DataSet of edges and a MapFunction. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
2013,
2850,
18260,
2102,
1006,
2951,
13462,
1026,
3341,
1026,
1047,
1010,
23408,
1028,
1028,
7926,
1010,
30524,
176... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcActor.java | AkkaRpcActor.stop | private void stop(RpcEndpointTerminationResult rpcEndpointTerminationResult) {
if (rpcEndpointStopped.compareAndSet(false, true)) {
this.rpcEndpointTerminationResult = rpcEndpointTerminationResult;
getContext().stop(getSelf());
}
} | java | private void stop(RpcEndpointTerminationResult rpcEndpointTerminationResult) {
if (rpcEndpointStopped.compareAndSet(false, true)) {
this.rpcEndpointTerminationResult = rpcEndpointTerminationResult;
getContext().stop(getSelf());
}
} | [
"private",
"void",
"stop",
"(",
"RpcEndpointTerminationResult",
"rpcEndpointTerminationResult",
")",
"{",
"if",
"(",
"rpcEndpointStopped",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"this",
".",
"rpcEndpointTerminationResult",
"=",
"rpcEndpointTer... | Stop the actor immediately. | [
"Stop",
"the",
"actor",
"immediately",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcActor.java#L452-L457 | train | Stop the context. | [
30522,
2797,
11675,
2644,
1006,
1054,
15042,
10497,
8400,
3334,
22311,
3508,
6072,
11314,
1054,
15042,
10497,
8400,
3334,
22311,
3508,
6072,
11314,
1007,
1063,
2065,
1006,
1054,
15042,
10497,
26521,
14399,
5669,
1012,
12826,
29560,
3388,
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/SM2Engine.java | SM2Engine.encrypt | private byte[] encrypt(byte[] in, int inOff, int inLen) {
// 加密数据
byte[] c2 = new byte[inLen];
System.arraycopy(in, inOff, c2, 0, c2.length);
final ECMultiplier multiplier = createBasePointMultiplier();
byte[] c1;
ECPoint kPB;
BigInteger k;
do {
k = nextK();
// 产生随机数计算出曲线点C1
c1 = multiplier.multiply(ecParams.getG(), k).normalize().getEncoded(false);
kPB = ((ECPublicKeyParameters) ecKey).getQ().multiply(k).normalize();
kdf(kPB, c2);
} while (notEncrypted(c2, in, inOff));
// 杂凑值,效验数据
byte[] c3 = new byte[digest.getDigestSize()];
addFieldElement(kPB.getAffineXCoord());
this.digest.update(in, inOff, inLen);
addFieldElement(kPB.getAffineYCoord());
this.digest.doFinal(c3, 0);
// 按照对应模式输出结果
switch (mode) {
case C1C3C2:
return Arrays.concatenate(c1, c3, c2);
default:
return Arrays.concatenate(c1, c2, c3);
}
} | java | private byte[] encrypt(byte[] in, int inOff, int inLen) {
// 加密数据
byte[] c2 = new byte[inLen];
System.arraycopy(in, inOff, c2, 0, c2.length);
final ECMultiplier multiplier = createBasePointMultiplier();
byte[] c1;
ECPoint kPB;
BigInteger k;
do {
k = nextK();
// 产生随机数计算出曲线点C1
c1 = multiplier.multiply(ecParams.getG(), k).normalize().getEncoded(false);
kPB = ((ECPublicKeyParameters) ecKey).getQ().multiply(k).normalize();
kdf(kPB, c2);
} while (notEncrypted(c2, in, inOff));
// 杂凑值,效验数据
byte[] c3 = new byte[digest.getDigestSize()];
addFieldElement(kPB.getAffineXCoord());
this.digest.update(in, inOff, inLen);
addFieldElement(kPB.getAffineYCoord());
this.digest.doFinal(c3, 0);
// 按照对应模式输出结果
switch (mode) {
case C1C3C2:
return Arrays.concatenate(c1, c3, c2);
default:
return Arrays.concatenate(c1, c2, c3);
}
} | [
"private",
"byte",
"[",
"]",
"encrypt",
"(",
"byte",
"[",
"]",
"in",
",",
"int",
"inOff",
",",
"int",
"inLen",
")",
"{",
"// 加密数据\r",
"byte",
"[",
"]",
"c2",
"=",
"new",
"byte",
"[",
"inLen",
"]",
";",
"System",
".",
"arraycopy",
"(",
"in",
",",
... | 加密
@param in 数据
@param inOff 位置
@param inLen 长度
@return 密文 | [
"加密"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java#L174-L208 | train | Encrypt a byte array. | [
30522,
2797,
24880,
1031,
1033,
4372,
26775,
22571,
2102,
1006,
24880,
1031,
1033,
1999,
1010,
20014,
1999,
7245,
1010,
20014,
1999,
7770,
1007,
1063,
1013,
1013,
1779,
100,
100,
100,
24880,
1031,
1033,
29248,
1027,
2047,
24880,
1031,
1999,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.query | public List<Entity> query(String sql, Object... params) throws SQLException {
return query(sql, new EntityListHandler(), params);
} | java | public List<Entity> query(String sql, Object... params) throws SQLException {
return query(sql, new EntityListHandler(), params);
} | [
"public",
"List",
"<",
"Entity",
">",
"query",
"(",
"String",
"sql",
",",
"Object",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"return",
"query",
"(",
"sql",
",",
"new",
"EntityListHandler",
"(",
")",
",",
"params",
")",
";",
"}"
] | 查询
@param sql 查询语句
@param params 参数
@return 结果对象
@throws SQLException SQL执行异常
@since 3.1.1 | [
"查询"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L78-L80 | train | Query for entities. | [
30522,
2270,
2862,
1026,
9178,
1028,
23032,
1006,
5164,
29296,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
23032,
1006,
29296,
1010,
2047,
9178,
9863,
11774,
3917,
1006,
1007,
1010,
11498,
5244,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/rank/TopNBuffer.java | TopNBuffer.removeAll | void removeAll(BaseRow sortKey) {
Collection<BaseRow> list = treeMap.get(sortKey);
if (list != null) {
currentTopNum -= list.size();
treeMap.remove(sortKey);
}
} | java | void removeAll(BaseRow sortKey) {
Collection<BaseRow> list = treeMap.get(sortKey);
if (list != null) {
currentTopNum -= list.size();
treeMap.remove(sortKey);
}
} | [
"void",
"removeAll",
"(",
"BaseRow",
"sortKey",
")",
"{",
"Collection",
"<",
"BaseRow",
">",
"list",
"=",
"treeMap",
".",
"get",
"(",
"sortKey",
")",
";",
"if",
"(",
"list",
"!=",
"null",
")",
"{",
"currentTopNum",
"-=",
"list",
".",
"size",
"(",
")"... | Removes all record list from the buffer under the sortKey.
@param sortKey key to remove | [
"Removes",
"all",
"record",
"list",
"from",
"the",
"buffer",
"under",
"the",
"sortKey",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/rank/TopNBuffer.java#L109-L115 | train | Removes all rows from the tree. | [
30522,
11675,
6366,
8095,
1006,
2918,
10524,
4066,
14839,
1007,
1063,
3074,
1026,
2918,
10524,
1028,
2862,
1027,
3392,
2863,
2361,
1012,
2131,
1006,
4066,
14839,
1007,
1025,
2065,
1006,
2862,
999,
1027,
19701,
1007,
1063,
2783,
14399,
19172... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.getLong | @PublicEvolving
public long getLong(ConfigOption<Long> configOption, long overrideDefault) {
Object o = getRawValueFromOption(configOption);
if (o == null) {
return overrideDefault;
}
return convertToLong(o, configOption.defaultValue());
} | java | @PublicEvolving
public long getLong(ConfigOption<Long> configOption, long overrideDefault) {
Object o = getRawValueFromOption(configOption);
if (o == null) {
return overrideDefault;
}
return convertToLong(o, configOption.defaultValue());
} | [
"@",
"PublicEvolving",
"public",
"long",
"getLong",
"(",
"ConfigOption",
"<",
"Long",
">",
"configOption",
",",
"long",
"overrideDefault",
")",
"{",
"Object",
"o",
"=",
"getRawValueFromOption",
"(",
"configOption",
")",
";",
"if",
"(",
"o",
"==",
"null",
")"... | Returns the value associated with the given config option as a long integer.
If no value is mapped under any key of the option, it returns the specified
default instead of the option's default value.
@param configOption The configuration option
@param overrideDefault The value to return if no value was mapper for any key of the option
@return the configured value associated with the given config option, or the overrideDefault | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"config",
"option",
"as",
"a",
"long",
"integer",
".",
"If",
"no",
"value",
"is",
"mapped",
"under",
"any",
"key",
"of",
"the",
"option",
"it",
"returns",
"the",
"specified",
"default",
"inst... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L308-L315 | train | Returns the value associated with the given config option as a long. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
2146,
2131,
10052,
1006,
9530,
8873,
3995,
16790,
1026,
2146,
1028,
9530,
8873,
3995,
16790,
1010,
2146,
2058,
15637,
3207,
7011,
11314,
1007,
1063,
4874,
1051,
1027,
2131,
2527,
2860,
10175,
5657,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/factories/TableFactoryService.java | TableFactoryService.discoverFactories | private static List<TableFactory> discoverFactories(Optional<ClassLoader> classLoader) {
try {
List<TableFactory> result = new LinkedList<>();
if (classLoader.isPresent()) {
ServiceLoader
.load(TableFactory.class, classLoader.get())
.iterator()
.forEachRemaining(result::add);
} else {
defaultLoader.iterator().forEachRemaining(result::add);
}
return result;
} catch (ServiceConfigurationError e) {
LOG.error("Could not load service provider for table factories.", e);
throw new TableException("Could not load service provider for table factories.", e);
}
} | java | private static List<TableFactory> discoverFactories(Optional<ClassLoader> classLoader) {
try {
List<TableFactory> result = new LinkedList<>();
if (classLoader.isPresent()) {
ServiceLoader
.load(TableFactory.class, classLoader.get())
.iterator()
.forEachRemaining(result::add);
} else {
defaultLoader.iterator().forEachRemaining(result::add);
}
return result;
} catch (ServiceConfigurationError e) {
LOG.error("Could not load service provider for table factories.", e);
throw new TableException("Could not load service provider for table factories.", e);
}
} | [
"private",
"static",
"List",
"<",
"TableFactory",
">",
"discoverFactories",
"(",
"Optional",
"<",
"ClassLoader",
">",
"classLoader",
")",
"{",
"try",
"{",
"List",
"<",
"TableFactory",
">",
"result",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"if",
"(",... | Searches for factories using Java service providers.
@return all factories in the classpath | [
"Searches",
"for",
"factories",
"using",
"Java",
"service",
"providers",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java#L150-L167 | train | Discover the table factories. | [
30522,
2797,
10763,
2862,
1026,
2795,
21450,
1028,
7523,
7011,
16761,
3111,
1006,
11887,
1026,
2465,
11066,
2121,
1028,
2465,
11066,
2121,
1007,
1063,
3046,
1063,
2862,
1026,
2795,
21450,
1028,
2765,
1027,
2047,
5799,
9863,
1026,
1028,
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-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/WordCountTable.java | WordCountTable.main | public static void main(String[] args) throws Exception {
ExecutionEnvironment env = ExecutionEnvironment.createCollectionsEnvironment();
BatchTableEnvironment tEnv = BatchTableEnvironment.create(env);
DataSet<WC> input = env.fromElements(
new WC("Hello", 1),
new WC("Ciao", 1),
new WC("Hello", 1));
Table table = tEnv.fromDataSet(input);
Table filtered = table
.groupBy("word")
.select("word, frequency.sum as frequency")
.filter("frequency = 2");
DataSet<WC> result = tEnv.toDataSet(filtered, WC.class);
result.print();
} | java | public static void main(String[] args) throws Exception {
ExecutionEnvironment env = ExecutionEnvironment.createCollectionsEnvironment();
BatchTableEnvironment tEnv = BatchTableEnvironment.create(env);
DataSet<WC> input = env.fromElements(
new WC("Hello", 1),
new WC("Ciao", 1),
new WC("Hello", 1));
Table table = tEnv.fromDataSet(input);
Table filtered = table
.groupBy("word")
.select("word, frequency.sum as frequency")
.filter("frequency = 2");
DataSet<WC> result = tEnv.toDataSet(filtered, WC.class);
result.print();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"ExecutionEnvironment",
"env",
"=",
"ExecutionEnvironment",
".",
"createCollectionsEnvironment",
"(",
")",
";",
"BatchTableEnvironment",
"tEnv",
"=",
"BatchTableEnv... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/WordCountTable.java#L39-L58 | train | Example of the test. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
7781,
2368,
21663,
2239,
3672,
4372,
2615,
1027,
7781,
2368,
21663,
2239,
3672,
1012,
3443,
26895,
18491,
5054,
21663,
2239,
3672,
1006,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/CrossDriver.java | CrossDriver.setup | @Override
public void setup(TaskContext<CrossFunction<T1, T2, OT>, OT> context) {
this.taskContext = context;
this.running = true;
} | java | @Override
public void setup(TaskContext<CrossFunction<T1, T2, OT>, OT> context) {
this.taskContext = context;
this.running = true;
} | [
"@",
"Override",
"public",
"void",
"setup",
"(",
"TaskContext",
"<",
"CrossFunction",
"<",
"T1",
",",
"T2",
",",
"OT",
">",
",",
"OT",
">",
"context",
")",
"{",
"this",
".",
"taskContext",
"=",
"context",
";",
"this",
".",
"running",
"=",
"true",
";"... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/CrossDriver.java#L75-L79 | train | Setup the task context. | [
30522,
1030,
2058,
15637,
2270,
11675,
16437,
1006,
4708,
8663,
18209,
1026,
2892,
11263,
27989,
1026,
1056,
2487,
1010,
1056,
2475,
1010,
27178,
1028,
1010,
27178,
1028,
6123,
1007,
1063,
2023,
1012,
4708,
8663,
18209,
1027,
6123,
1025,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonStreamer.java | PythonStreamer.close | public void close() throws IOException {
Throwable throwable = null;
try {
socket.close();
sender.close();
receiver.close();
} catch (Throwable t) {
throwable = t;
}
try {
destroyProcess(process);
} catch (Throwable t) {
throwable = ExceptionUtils.firstOrSuppressed(t, throwable);
}
ShutdownHookUtil.removeShutdownHook(shutdownThread, getClass().getSimpleName(), LOG);
ExceptionUtils.tryRethrowIOException(throwable);
} | java | public void close() throws IOException {
Throwable throwable = null;
try {
socket.close();
sender.close();
receiver.close();
} catch (Throwable t) {
throwable = t;
}
try {
destroyProcess(process);
} catch (Throwable t) {
throwable = ExceptionUtils.firstOrSuppressed(t, throwable);
}
ShutdownHookUtil.removeShutdownHook(shutdownThread, getClass().getSimpleName(), LOG);
ExceptionUtils.tryRethrowIOException(throwable);
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"Throwable",
"throwable",
"=",
"null",
";",
"try",
"{",
"socket",
".",
"close",
"(",
")",
";",
"sender",
".",
"close",
"(",
")",
";",
"receiver",
".",
"close",
"(",
")",
";",
"}",
"... | Closes this streamer.
@throws IOException | [
"Closes",
"this",
"streamer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonStreamer.java#L186-L206 | train | Close the connection. | [
30522,
2270,
11675,
2485,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
5466,
3085,
5466,
3085,
1027,
19701,
1025,
3046,
1063,
22278,
1012,
2485,
1006,
1007,
1025,
4604,
2121,
1012,
2485,
1006,
1007,
1025,
8393,
1012,
2485,
1006,
1007,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/SerializedThrowable.java | SerializedThrowable.get | public static Throwable get(Throwable serThrowable, ClassLoader loader) {
if (serThrowable instanceof SerializedThrowable) {
return ((SerializedThrowable) serThrowable).deserializeError(loader);
} else {
return serThrowable;
}
} | java | public static Throwable get(Throwable serThrowable, ClassLoader loader) {
if (serThrowable instanceof SerializedThrowable) {
return ((SerializedThrowable) serThrowable).deserializeError(loader);
} else {
return serThrowable;
}
} | [
"public",
"static",
"Throwable",
"get",
"(",
"Throwable",
"serThrowable",
",",
"ClassLoader",
"loader",
")",
"{",
"if",
"(",
"serThrowable",
"instanceof",
"SerializedThrowable",
")",
"{",
"return",
"(",
"(",
"SerializedThrowable",
")",
"serThrowable",
")",
".",
... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/SerializedThrowable.java#L172-L178 | train | Get the Throwable from the given Throwable. | [
30522,
2270,
10763,
5466,
3085,
2131,
1006,
5466,
3085,
14262,
2705,
10524,
3085,
1010,
2465,
11066,
2121,
7170,
2121,
1007,
1063,
2065,
1006,
14262,
2705,
10524,
3085,
6013,
11253,
27289,
2705,
10524,
3085,
1007,
1063,
2709,
1006,
1006,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | SpringApplication.setApplicationContextClass | public void setApplicationContextClass(
Class<? extends ConfigurableApplicationContext> applicationContextClass) {
this.applicationContextClass = applicationContextClass;
this.webApplicationType = WebApplicationType
.deduceFromApplicationContext(applicationContextClass);
} | java | public void setApplicationContextClass(
Class<? extends ConfigurableApplicationContext> applicationContextClass) {
this.applicationContextClass = applicationContextClass;
this.webApplicationType = WebApplicationType
.deduceFromApplicationContext(applicationContextClass);
} | [
"public",
"void",
"setApplicationContextClass",
"(",
"Class",
"<",
"?",
"extends",
"ConfigurableApplicationContext",
">",
"applicationContextClass",
")",
"{",
"this",
".",
"applicationContextClass",
"=",
"applicationContextClass",
";",
"this",
".",
"webApplicationType",
"... | Sets the type of Spring {@link ApplicationContext} that will be created. If not
specified defaults to {@link #DEFAULT_SERVLET_WEB_CONTEXT_CLASS} for web based
applications or {@link AnnotationConfigApplicationContext} for non web based
applications.
@param applicationContextClass the context class to set | [
"Sets",
"the",
"type",
"of",
"Spring",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L1191-L1196 | train | Sets the application context class. | [
30522,
2270,
11675,
2275,
29098,
19341,
3508,
8663,
18209,
26266,
1006,
2465,
1026,
1029,
8908,
9530,
8873,
27390,
3085,
29098,
19341,
3508,
8663,
18209,
1028,
4646,
8663,
18209,
26266,
1007,
1063,
2023,
1012,
4646,
8663,
18209,
26266,
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-formats/flink-csv/src/main/java/org/apache/flink/table/descriptors/Csv.java | Csv.nullLiteral | public Csv nullLiteral(String nullLiteral) {
Preconditions.checkNotNull(nullLiteral);
internalProperties.putString(FORMAT_NULL_LITERAL, nullLiteral);
return this;
} | java | public Csv nullLiteral(String nullLiteral) {
Preconditions.checkNotNull(nullLiteral);
internalProperties.putString(FORMAT_NULL_LITERAL, nullLiteral);
return this;
} | [
"public",
"Csv",
"nullLiteral",
"(",
"String",
"nullLiteral",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"nullLiteral",
")",
";",
"internalProperties",
".",
"putString",
"(",
"FORMAT_NULL_LITERAL",
",",
"nullLiteral",
")",
";",
"return",
"this",
";",
"... | Sets the null literal string that is interpreted as a null value (disabled by default).
@param nullLiteral null literal (e.g. "null" or "n/a") | [
"Sets",
"the",
"null",
"literal",
"string",
"that",
"is",
"interpreted",
"as",
"a",
"null",
"value",
"(",
"disabled",
"by",
"default",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-csv/src/main/java/org/apache/flink/table/descriptors/Csv.java#L143-L147 | train | Sets the nullLiteral property. | [
30522,
2270,
20116,
2615,
19701,
22779,
7941,
1006,
5164,
19701,
22779,
7941,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
19701,
22779,
7941,
1007,
1025,
4722,
21572,
4842,
7368,
1012,
8509,
18886,
3070,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.formatChineseDate | public static String formatChineseDate(Date date, boolean isUppercase) {
if (null == date) {
return null;
}
String format = DatePattern.CHINESE_DATE_FORMAT.format(date);
if (isUppercase) {
final StringBuilder builder = StrUtil.builder(format.length());
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(0, 1)), false));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(1, 2)), false));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(2, 3)), false));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(3, 4)), false));
builder.append(format.substring(4, 5));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(5, 7)), false));
builder.append(format.substring(7, 8));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(8, 10)), false));
builder.append(format.substring(10));
format = builder.toString().replace('零', '〇');
}
return format;
} | java | public static String formatChineseDate(Date date, boolean isUppercase) {
if (null == date) {
return null;
}
String format = DatePattern.CHINESE_DATE_FORMAT.format(date);
if (isUppercase) {
final StringBuilder builder = StrUtil.builder(format.length());
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(0, 1)), false));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(1, 2)), false));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(2, 3)), false));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(3, 4)), false));
builder.append(format.substring(4, 5));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(5, 7)), false));
builder.append(format.substring(7, 8));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(8, 10)), false));
builder.append(format.substring(10));
format = builder.toString().replace('零', '〇');
}
return format;
} | [
"public",
"static",
"String",
"formatChineseDate",
"(",
"Date",
"date",
",",
"boolean",
"isUppercase",
")",
"{",
"if",
"(",
"null",
"==",
"date",
")",
"{",
"return",
"null",
";",
"}",
"String",
"format",
"=",
"DatePattern",
".",
"CHINESE_DATE_FORMAT",
".",
... | 格式化为中文日期格式,如果isUppercase为false,则返回类似:2018年10月24日,否则返回二〇一八年十月二十四日
@param date 被格式化的日期
@param isUppercase 是否采用大写形式
@return 中文日期字符串
@since 4.1.19 | [
"格式化为中文日期格式,如果isUppercase为false,则返回类似:2018年10月24日,否则返回二〇一八年十月二十四日"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L565-L585 | train | Formats a date in Chinese format. | [
30522,
2270,
10763,
5164,
4289,
17231,
6810,
13701,
1006,
3058,
3058,
1010,
22017,
20898,
2003,
29547,
18992,
3366,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
3058,
1007,
1063,
2709,
19701,
1025,
1065,
5164,
4289,
1027,
3058,
4502,
12079,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/GroupedMap.java | GroupedMap.values | public Collection<String> values(String group) {
group = StrUtil.nullToEmpty(group).trim();
readLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
return valueMap.values();
}
} finally {
readLock.unlock();
}
return Collections.emptyList();
} | java | public Collection<String> values(String group) {
group = StrUtil.nullToEmpty(group).trim();
readLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
return valueMap.values();
}
} finally {
readLock.unlock();
}
return Collections.emptyList();
} | [
"public",
"Collection",
"<",
"String",
">",
"values",
"(",
"String",
"group",
")",
"{",
"group",
"=",
"StrUtil",
".",
"nullToEmpty",
"(",
"group",
")",
".",
"trim",
"(",
")",
";",
"readLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"final",
"LinkedHa... | 指定分组下所有值
@param group 分组
@return 值 | [
"指定分组下所有值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/GroupedMap.java#L268-L280 | train | Returns the values of the specified group. | [
30522,
2270,
3074,
1026,
5164,
1028,
5300,
1006,
5164,
2177,
1007,
1063,
2177,
1027,
2358,
22134,
4014,
1012,
19701,
3406,
6633,
13876,
2100,
1006,
2177,
1007,
1012,
12241,
1006,
1007,
1025,
3191,
7878,
1012,
5843,
1006,
1007,
1025,
3046,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.next | public Pattern<T, T> next(final String name) {
return new Pattern<>(name, this, ConsumingStrategy.STRICT, afterMatchSkipStrategy);
} | java | public Pattern<T, T> next(final String name) {
return new Pattern<>(name, this, ConsumingStrategy.STRICT, afterMatchSkipStrategy);
} | [
"public",
"Pattern",
"<",
"T",
",",
"T",
">",
"next",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"new",
"Pattern",
"<>",
"(",
"name",
",",
"this",
",",
"ConsumingStrategy",
".",
"STRICT",
",",
"afterMatchSkipStrategy",
")",
";",
"}"
] | Appends a new pattern to the existing one. The new pattern enforces strict
temporal contiguity. This means that the whole pattern sequence matches only
if an event which matches this pattern directly follows the preceding matching
event. Thus, there cannot be any events in between two matching events.
@param name Name of the new pattern
@return A new pattern which is appended to this one | [
"Appends",
"a",
"new",
"pattern",
"to",
"the",
"existing",
"one",
".",
"The",
"new",
"pattern",
"enforces",
"strict",
"temporal",
"contiguity",
".",
"This",
"means",
"that",
"the",
"whole",
"pattern",
"sequence",
"matches",
"only",
"if",
"an",
"event",
"whic... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L261-L263 | train | Create a new pattern that matches the next character of the current sequence. | [
30522,
2270,
5418,
1026,
1056,
1010,
1056,
1028,
2279,
1006,
2345,
5164,
2171,
1007,
1063,
2709,
2047,
5418,
1026,
1028,
1006,
2171,
1010,
2023,
1010,
15077,
20528,
2618,
6292,
1012,
9384,
1010,
2044,
18900,
18069,
3211,
4523,
6494,
2618,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/RollingSink.java | RollingSink.openNewPartFile | private void openNewPartFile() throws Exception {
closeCurrentPartFile();
Path newBucketDirectory = bucketer.getNextBucketPath(new Path(basePath));
if (!newBucketDirectory.equals(currentBucketDirectory)) {
currentBucketDirectory = newBucketDirectory;
try {
if (fs.mkdirs(currentBucketDirectory)) {
LOG.debug("Created new bucket directory: {}", currentBucketDirectory);
}
} catch (IOException e) {
throw new RuntimeException("Could not create base path for new rolling file.", e);
}
}
int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask();
currentPartPath = new Path(currentBucketDirectory, partPrefix + "-" + subtaskIndex + "-" + partCounter);
// This should work since there is only one parallel subtask that tries names with
// our subtask id. Otherwise we would run into concurrency issues here.
while (fs.exists(currentPartPath) ||
fs.exists(getPendingPathFor(currentPartPath)) ||
fs.exists(getInProgressPathFor(currentPartPath))) {
partCounter++;
currentPartPath = new Path(currentBucketDirectory, partPrefix + "-" + subtaskIndex + "-" + partCounter);
}
// increase, so we don't have to check for this name next time
partCounter++;
LOG.debug("Next part path is {}", currentPartPath.toString());
Path inProgressPath = getInProgressPathFor(currentPartPath);
writer.open(fs, inProgressPath);
isWriterOpen = true;
} | java | private void openNewPartFile() throws Exception {
closeCurrentPartFile();
Path newBucketDirectory = bucketer.getNextBucketPath(new Path(basePath));
if (!newBucketDirectory.equals(currentBucketDirectory)) {
currentBucketDirectory = newBucketDirectory;
try {
if (fs.mkdirs(currentBucketDirectory)) {
LOG.debug("Created new bucket directory: {}", currentBucketDirectory);
}
} catch (IOException e) {
throw new RuntimeException("Could not create base path for new rolling file.", e);
}
}
int subtaskIndex = getRuntimeContext().getIndexOfThisSubtask();
currentPartPath = new Path(currentBucketDirectory, partPrefix + "-" + subtaskIndex + "-" + partCounter);
// This should work since there is only one parallel subtask that tries names with
// our subtask id. Otherwise we would run into concurrency issues here.
while (fs.exists(currentPartPath) ||
fs.exists(getPendingPathFor(currentPartPath)) ||
fs.exists(getInProgressPathFor(currentPartPath))) {
partCounter++;
currentPartPath = new Path(currentBucketDirectory, partPrefix + "-" + subtaskIndex + "-" + partCounter);
}
// increase, so we don't have to check for this name next time
partCounter++;
LOG.debug("Next part path is {}", currentPartPath.toString());
Path inProgressPath = getInProgressPathFor(currentPartPath);
writer.open(fs, inProgressPath);
isWriterOpen = true;
} | [
"private",
"void",
"openNewPartFile",
"(",
")",
"throws",
"Exception",
"{",
"closeCurrentPartFile",
"(",
")",
";",
"Path",
"newBucketDirectory",
"=",
"bucketer",
".",
"getNextBucketPath",
"(",
"new",
"Path",
"(",
"basePath",
")",
")",
";",
"if",
"(",
"!",
"n... | Opens a new part file.
<p>This closes the old bucket file and retrieves a new bucket path from the {@code Bucketer}. | [
"Opens",
"a",
"new",
"part",
"file",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/RollingSink.java#L446-L482 | train | Open the new part file. | [
30522,
2797,
11675,
2330,
2638,
2860,
19362,
24475,
9463,
1006,
1007,
11618,
6453,
1063,
2485,
10841,
14343,
3372,
19362,
24475,
9463,
1006,
1007,
1025,
4130,
2047,
24204,
3388,
4305,
2890,
16761,
2100,
1027,
13610,
2121,
1012,
2131,
2638,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.getPropertyDescriptors | public static PropertyDescriptor[] getPropertyDescriptors(Class<?> clazz) throws BeanException {
BeanInfo beanInfo;
try {
beanInfo = Introspector.getBeanInfo(clazz);
} catch (IntrospectionException e) {
throw new BeanException(e);
}
return ArrayUtil.filter(beanInfo.getPropertyDescriptors(), new Filter<PropertyDescriptor>() {
@Override
public boolean accept(PropertyDescriptor t) {
// 过滤掉getClass方法
return false == "class".equals(t.getName());
}
});
} | java | public static PropertyDescriptor[] getPropertyDescriptors(Class<?> clazz) throws BeanException {
BeanInfo beanInfo;
try {
beanInfo = Introspector.getBeanInfo(clazz);
} catch (IntrospectionException e) {
throw new BeanException(e);
}
return ArrayUtil.filter(beanInfo.getPropertyDescriptors(), new Filter<PropertyDescriptor>() {
@Override
public boolean accept(PropertyDescriptor t) {
// 过滤掉getClass方法
return false == "class".equals(t.getName());
}
});
} | [
"public",
"static",
"PropertyDescriptor",
"[",
"]",
"getPropertyDescriptors",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"throws",
"BeanException",
"{",
"BeanInfo",
"beanInfo",
";",
"try",
"{",
"beanInfo",
"=",
"Introspector",
".",
"getBeanInfo",
"(",
"clazz",
... | 获得Bean字段描述数组
@param clazz Bean类
@return 字段描述数组
@throws BeanException 获取属性异常 | [
"获得Bean字段描述数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L168-L182 | train | Gets the property descriptors of the specified class. | [
30522,
2270,
10763,
3200,
6155,
23235,
2953,
1031,
1033,
2131,
21572,
4842,
3723,
6155,
23235,
5668,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1007,
11618,
14068,
10288,
24422,
1063,
14068,
2378,
14876,
14068,
2378,
14876,
1025,
3046,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AsyncDataStream.java | AsyncDataStream.orderedWait | public static <IN, OUT> SingleOutputStreamOperator<OUT> orderedWait(
DataStream<IN> in,
AsyncFunction<IN, OUT> func,
long timeout,
TimeUnit timeUnit,
int capacity) {
return addOperator(in, func, timeUnit.toMillis(timeout), capacity, OutputMode.ORDERED);
} | java | public static <IN, OUT> SingleOutputStreamOperator<OUT> orderedWait(
DataStream<IN> in,
AsyncFunction<IN, OUT> func,
long timeout,
TimeUnit timeUnit,
int capacity) {
return addOperator(in, func, timeUnit.toMillis(timeout), capacity, OutputMode.ORDERED);
} | [
"public",
"static",
"<",
"IN",
",",
"OUT",
">",
"SingleOutputStreamOperator",
"<",
"OUT",
">",
"orderedWait",
"(",
"DataStream",
"<",
"IN",
">",
"in",
",",
"AsyncFunction",
"<",
"IN",
",",
"OUT",
">",
"func",
",",
"long",
"timeout",
",",
"TimeUnit",
"tim... | Add an AsyncWaitOperator. The order to process input records is guaranteed to be the same as
input ones.
@param in Input {@link DataStream}
@param func {@link AsyncFunction}
@param timeout for the asynchronous operation to complete
@param timeUnit of the given timeout
@param capacity The max number of async i/o operation that can be triggered
@param <IN> Type of input record
@param <OUT> Type of output record
@return A new {@link SingleOutputStreamOperator}. | [
"Add",
"an",
"AsyncWaitOperator",
".",
"The",
"order",
"to",
"process",
"input",
"records",
"is",
"guaranteed",
"to",
"be",
"the",
"same",
"as",
"input",
"ones",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AsyncDataStream.java#L147-L154 | train | Create an ordered wait operator. | [
30522,
2270,
10763,
1026,
1999,
1010,
2041,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
2041,
1028,
3641,
21547,
2102,
1006,
2951,
21422,
1026,
1999,
1028,
1999,
1010,
2004,
6038,
2278,
11263,
27989,
1026,
1999,
1010,
2041,
1028,
456... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.getString | @PublicEvolving
public String getString(ConfigOption<String> configOption, String overrideDefault) {
Object o = getRawValueFromOption(configOption);
return o == null ? overrideDefault : o.toString();
} | java | @PublicEvolving
public String getString(ConfigOption<String> configOption, String overrideDefault) {
Object o = getRawValueFromOption(configOption);
return o == null ? overrideDefault : o.toString();
} | [
"@",
"PublicEvolving",
"public",
"String",
"getString",
"(",
"ConfigOption",
"<",
"String",
">",
"configOption",
",",
"String",
"overrideDefault",
")",
"{",
"Object",
"o",
"=",
"getRawValueFromOption",
"(",
"configOption",
")",
";",
"return",
"o",
"==",
"null",
... | Returns the value associated with the given config option as a string.
If no value is mapped under any key of the option, it returns the specified
default instead of the option's default value.
@param configOption The configuration option
@return the (default) value associated with the given config option | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"config",
"option",
"as",
"a",
"string",
".",
"If",
"no",
"value",
"is",
"mapped",
"under",
"any",
"key",
"of",
"the",
"option",
"it",
"returns",
"the",
"specified",
"default",
"instead",
"of... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L163-L167 | train | Returns the value associated with the given config option as a String. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
5164,
4152,
18886,
3070,
1006,
9530,
8873,
3995,
16790,
1026,
5164,
1028,
9530,
8873,
3995,
16790,
1010,
5164,
2058,
15637,
3207,
7011,
11314,
1007,
1063,
4874,
1051,
1027,
2131,
2527,
2860,
10175,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/NetworkEnvironment.java | NetworkEnvironment.registerTask | public void registerTask(Task task) throws IOException {
final ResultPartition[] producedPartitions = task.getProducedPartitions();
synchronized (lock) {
if (isShutdown) {
throw new IllegalStateException("NetworkEnvironment is shut down");
}
for (final ResultPartition partition : producedPartitions) {
setupPartition(partition);
}
// Setup the buffer pool for each buffer reader
final SingleInputGate[] inputGates = task.getAllInputGates();
for (SingleInputGate gate : inputGates) {
setupInputGate(gate);
}
}
} | java | public void registerTask(Task task) throws IOException {
final ResultPartition[] producedPartitions = task.getProducedPartitions();
synchronized (lock) {
if (isShutdown) {
throw new IllegalStateException("NetworkEnvironment is shut down");
}
for (final ResultPartition partition : producedPartitions) {
setupPartition(partition);
}
// Setup the buffer pool for each buffer reader
final SingleInputGate[] inputGates = task.getAllInputGates();
for (SingleInputGate gate : inputGates) {
setupInputGate(gate);
}
}
} | [
"public",
"void",
"registerTask",
"(",
"Task",
"task",
")",
"throws",
"IOException",
"{",
"final",
"ResultPartition",
"[",
"]",
"producedPartitions",
"=",
"task",
".",
"getProducedPartitions",
"(",
")",
";",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/NetworkEnvironment.java#L132-L150 | train | Registers a task with the network environment. | [
30522,
2270,
11675,
4236,
10230,
2243,
1006,
4708,
4708,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
2765,
19362,
3775,
3508,
1031,
1033,
2550,
19362,
3775,
9285,
1027,
4708,
1012,
2131,
21572,
28901,
19362,
3775,
9285,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/tokenizer/lexical/AbstractLexicalAnalyzer.java | AbstractLexicalAnalyzer.acceptCustomWord | protected boolean acceptCustomWord(int begin, int end, CoreDictionary.Attribute value)
{
return config.forceCustomDictionary || (end - begin >= 4 && !value.hasNatureStartsWith("nr") && !value.hasNatureStartsWith("ns") && !value.hasNatureStartsWith("nt"));
} | java | protected boolean acceptCustomWord(int begin, int end, CoreDictionary.Attribute value)
{
return config.forceCustomDictionary || (end - begin >= 4 && !value.hasNatureStartsWith("nr") && !value.hasNatureStartsWith("ns") && !value.hasNatureStartsWith("nt"));
} | [
"protected",
"boolean",
"acceptCustomWord",
"(",
"int",
"begin",
",",
"int",
"end",
",",
"CoreDictionary",
".",
"Attribute",
"value",
")",
"{",
"return",
"config",
".",
"forceCustomDictionary",
"||",
"(",
"end",
"-",
"begin",
">=",
"4",
"&&",
"!",
"value",
... | 分词时查询到一个用户词典中的词语,此处控制是否接受它
@param begin 起始位置
@param end 终止位置
@param value 词性
@return true 表示接受
@deprecated 自1.6.7起废弃,强制模式下为最长匹配,否则按分词结果合并 | [
"分词时查询到一个用户词典中的词语,此处控制是否接受它"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/tokenizer/lexical/AbstractLexicalAnalyzer.java#L325-L328 | train | Accept a custom word. | [
30522,
5123,
22017,
20898,
5138,
7874,
20389,
18351,
1006,
20014,
4088,
1010,
20014,
2203,
1010,
4563,
29201,
3258,
5649,
1012,
17961,
3643,
1007,
1063,
2709,
9530,
8873,
2290,
1012,
2486,
7874,
20389,
29201,
3258,
5649,
1064,
1064,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/dartsclone/details/AutoBytePool.java | AutoBytePool.resize | void resize(int size, byte value)
{
if (size > _capacity)
{
resizeBuf(size);
}
while (_size < size)
{
_buf[_size++] = value;
}
} | java | void resize(int size, byte value)
{
if (size > _capacity)
{
resizeBuf(size);
}
while (_size < size)
{
_buf[_size++] = value;
}
} | [
"void",
"resize",
"(",
"int",
"size",
",",
"byte",
"value",
")",
"{",
"if",
"(",
"size",
">",
"_capacity",
")",
"{",
"resizeBuf",
"(",
"size",
")",
";",
"}",
"while",
"(",
"_size",
"<",
"size",
")",
"{",
"_buf",
"[",
"_size",
"++",
"]",
"=",
"v... | 重设大小,并且在末尾加一个值
@param size 大小
@param value 值 | [
"重设大小,并且在末尾加一个值"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/dartsclone/details/AutoBytePool.java#L112-L122 | train | Resize the buffer to a given size. | [
30522,
11675,
24501,
4697,
1006,
20014,
2946,
1010,
24880,
3643,
1007,
1063,
2065,
1006,
2946,
1028,
1035,
3977,
1007,
1063,
24501,
4697,
8569,
2546,
1006,
2946,
1007,
1025,
1065,
2096,
1006,
1035,
2946,
1026,
2946,
1007,
1063,
1035,
20934,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/PoiChecker.java | PoiChecker.checkPoiImport | public static void checkPoiImport() {
try {
Class.forName("org.apache.poi.ss.usermodel.Workbook", false, ClassLoaderUtil.getClassLoader());
} catch (ClassNotFoundException | NoClassDefFoundError e) {
throw new DependencyException(e, NO_POI_ERROR_MSG);
}
} | java | public static void checkPoiImport() {
try {
Class.forName("org.apache.poi.ss.usermodel.Workbook", false, ClassLoaderUtil.getClassLoader());
} catch (ClassNotFoundException | NoClassDefFoundError e) {
throw new DependencyException(e, NO_POI_ERROR_MSG);
}
} | [
"public",
"static",
"void",
"checkPoiImport",
"(",
")",
"{",
"try",
"{",
"Class",
".",
"forName",
"(",
"\"org.apache.poi.ss.usermodel.Workbook\"",
",",
"false",
",",
"ClassLoaderUtil",
".",
"getClassLoader",
"(",
")",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundE... | 检查POI包的引入情况 | [
"检查POI包的引入情况"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/PoiChecker.java#L20-L26 | train | Check if the POI library is available. | [
30522,
2270,
10763,
30524,
1006,
1007,
1063,
3046,
1063,
2465,
1012,
2005,
18442,
1006,
1000,
8917,
1012,
15895,
1012,
13433,
2072,
1012,
7020,
1012,
5310,
5302,
9247,
1012,
2147,
8654,
1000,
1010,
6270,
1010,
2465,
11066,
2121,
21823,
2140... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.