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 | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.isText | public static boolean isText(ByteBuf buf, int index, int length, Charset charset) {
checkNotNull(buf, "buf");
checkNotNull(charset, "charset");
final int maxIndex = buf.readerIndex() + buf.readableBytes();
if (index < 0 || length < 0 || index > maxIndex - length) {
throw new IndexOutOfBoundsException("index: " + index + " length: " + length);
}
if (charset.equals(CharsetUtil.UTF_8)) {
return isUtf8(buf, index, length);
} else if (charset.equals(CharsetUtil.US_ASCII)) {
return isAscii(buf, index, length);
} else {
CharsetDecoder decoder = CharsetUtil.decoder(charset, CodingErrorAction.REPORT, CodingErrorAction.REPORT);
try {
if (buf.nioBufferCount() == 1) {
decoder.decode(buf.nioBuffer(index, length));
} else {
ByteBuf heapBuffer = buf.alloc().heapBuffer(length);
try {
heapBuffer.writeBytes(buf, index, length);
decoder.decode(heapBuffer.internalNioBuffer(heapBuffer.readerIndex(), length));
} finally {
heapBuffer.release();
}
}
return true;
} catch (CharacterCodingException ignore) {
return false;
}
}
} | java | public static boolean isText(ByteBuf buf, int index, int length, Charset charset) {
checkNotNull(buf, "buf");
checkNotNull(charset, "charset");
final int maxIndex = buf.readerIndex() + buf.readableBytes();
if (index < 0 || length < 0 || index > maxIndex - length) {
throw new IndexOutOfBoundsException("index: " + index + " length: " + length);
}
if (charset.equals(CharsetUtil.UTF_8)) {
return isUtf8(buf, index, length);
} else if (charset.equals(CharsetUtil.US_ASCII)) {
return isAscii(buf, index, length);
} else {
CharsetDecoder decoder = CharsetUtil.decoder(charset, CodingErrorAction.REPORT, CodingErrorAction.REPORT);
try {
if (buf.nioBufferCount() == 1) {
decoder.decode(buf.nioBuffer(index, length));
} else {
ByteBuf heapBuffer = buf.alloc().heapBuffer(length);
try {
heapBuffer.writeBytes(buf, index, length);
decoder.decode(heapBuffer.internalNioBuffer(heapBuffer.readerIndex(), length));
} finally {
heapBuffer.release();
}
}
return true;
} catch (CharacterCodingException ignore) {
return false;
}
}
} | [
"public",
"static",
"boolean",
"isText",
"(",
"ByteBuf",
"buf",
",",
"int",
"index",
",",
"int",
"length",
",",
"Charset",
"charset",
")",
"{",
"checkNotNull",
"(",
"buf",
",",
"\"buf\"",
")",
";",
"checkNotNull",
"(",
"charset",
",",
"\"charset\"",
")",
... | Returns {@code true} if the specified {@link ByteBuf} starting at {@code index} with {@code length} is valid
text using the given {@link Charset}, otherwise return {@code false}.
@param buf The given {@link ByteBuf}.
@param index The start index of the specified buffer.
@param length The length of the specified buffer.
@param charset The specified {@link Charset}.
@throws IndexOutOfBoundsException if {@code index} + {@code length} is greater than {@code buf.readableBytes} | [
"Returns",
"{",
"@code",
"true",
"}",
"if",
"the",
"specified",
"{",
"@link",
"ByteBuf",
"}",
"starting",
"at",
"{",
"@code",
"index",
"}",
"with",
"{",
"@code",
"length",
"}",
"is",
"valid",
"text",
"using",
"the",
"given",
"{",
"@link",
"Charset",
"}... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L1219-L1249 | train | Check if a buffer is text. | [
30522,
2270,
10763,
22017,
20898,
21541,
10288,
2102,
1006,
24880,
8569,
2546,
20934,
2546,
1010,
20014,
5950,
1010,
20014,
3091,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
20934,
2546,
1010,
1000,
20934,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSerializer.java | AvroSerializer.snapshotConfiguration | @Override
public TypeSerializerSnapshot<T> snapshotConfiguration() {
if (configSnapshot == null) {
checkAvroInitialized();
configSnapshot = new AvroSerializerSnapshot<>(runtimeSchema, type);
}
return configSnapshot;
} | java | @Override
public TypeSerializerSnapshot<T> snapshotConfiguration() {
if (configSnapshot == null) {
checkAvroInitialized();
configSnapshot = new AvroSerializerSnapshot<>(runtimeSchema, type);
}
return configSnapshot;
} | [
"@",
"Override",
"public",
"TypeSerializerSnapshot",
"<",
"T",
">",
"snapshotConfiguration",
"(",
")",
"{",
"if",
"(",
"configSnapshot",
"==",
"null",
")",
"{",
"checkAvroInitialized",
"(",
")",
";",
"configSnapshot",
"=",
"new",
"AvroSerializerSnapshot",
"<>",
... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSerializer.java#L268-L275 | train | Returns the configuration of the Avro serializer. | [
30522,
1030,
2058,
15637,
2270,
4127,
11610,
28863,
2015,
2532,
4523,
12326,
1026,
1056,
1028,
20057,
12326,
8663,
8873,
27390,
3370,
1006,
1007,
1063,
2065,
1006,
9530,
8873,
5620,
2532,
4523,
12326,
1027,
1027,
19701,
1007,
1063,
4638,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/AsynchronousBlockWriter.java | AsynchronousBlockWriter.getNextReturnedBlock | @Override
public MemorySegment getNextReturnedBlock() throws IOException {
try {
while (true) {
final MemorySegment next = returnSegments.poll(1000, TimeUnit.MILLISECONDS);
if (next != null) {
return next;
} else {
if (this.closed) {
throw new IOException("The writer has been closed.");
}
checkErroneous();
}
}
} catch (InterruptedException e) {
throw new IOException("Writer was interrupted while waiting for the next returning segment.");
}
} | java | @Override
public MemorySegment getNextReturnedBlock() throws IOException {
try {
while (true) {
final MemorySegment next = returnSegments.poll(1000, TimeUnit.MILLISECONDS);
if (next != null) {
return next;
} else {
if (this.closed) {
throw new IOException("The writer has been closed.");
}
checkErroneous();
}
}
} catch (InterruptedException e) {
throw new IOException("Writer was interrupted while waiting for the next returning segment.");
}
} | [
"@",
"Override",
"public",
"MemorySegment",
"getNextReturnedBlock",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"while",
"(",
"true",
")",
"{",
"final",
"MemorySegment",
"next",
"=",
"returnSegments",
".",
"poll",
"(",
"1000",
",",
"TimeUnit",
".",
"... | Gets the next memory segment that has been written and is available again.
This method blocks until such a segment is available, or until an error occurs in the writer, or the
writer is closed.
<p>
NOTE: If this method is invoked without any segment ever returning (for example, because the
{@link #writeBlock(MemorySegment)} method has not been invoked accordingly), the method may block
forever.
@return The next memory segment from the writers's return queue.
@throws IOException Thrown, if an I/O error occurs in the writer while waiting for the request to return. | [
"Gets",
"the",
"next",
"memory",
"segment",
"that",
"has",
"been",
"written",
"and",
"is",
"available",
"again",
".",
"This",
"method",
"blocks",
"until",
"such",
"a",
"segment",
"is",
"available",
"or",
"until",
"an",
"error",
"occurs",
"in",
"the",
"writ... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/AsynchronousBlockWriter.java#L60-L77 | train | Get the next block of data that was returned by this writer. | [
30522,
1030,
2058,
15637,
2270,
3638,
3366,
21693,
4765,
2131,
2638,
18413,
13465,
30524,
999,
1027,
19701,
1007,
1063,
2709,
2279,
1025,
1065,
2842,
1063,
2065,
1006,
2023,
1012,
2701,
1007,
1063,
5466,
2047,
22834,
10288,
24422,
1006,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java | URLUtil.encodeAll | public static String encodeAll(String url, Charset charset) throws UtilException {
try {
return java.net.URLEncoder.encode(url, charset.toString());
} catch (UnsupportedEncodingException e) {
throw new UtilException(e);
}
} | java | public static String encodeAll(String url, Charset charset) throws UtilException {
try {
return java.net.URLEncoder.encode(url, charset.toString());
} catch (UnsupportedEncodingException e) {
throw new UtilException(e);
}
} | [
"public",
"static",
"String",
"encodeAll",
"(",
"String",
"url",
",",
"Charset",
"charset",
")",
"throws",
"UtilException",
"{",
"try",
"{",
"return",
"java",
".",
"net",
".",
"URLEncoder",
".",
"encode",
"(",
"url",
",",
"charset",
".",
"toString",
"(",
... | 编码URL<br>
将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。
@param url URL
@param charset 编码
@return 编码后的URL
@exception UtilException UnsupportedEncodingException | [
"编码URL<br",
">",
"将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L229-L235 | train | Encode all characters in the URL. | [
30522,
2270,
10763,
5164,
4372,
16044,
8095,
1006,
5164,
24471,
2140,
1010,
25869,
13462,
25869,
13462,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
3046,
1063,
2709,
9262,
1012,
5658,
1012,
24471,
7770,
16044,
2099,
1012,
4372,
16044,
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/ImgUtil.java | ImgUtil.slice | public static void slice(File srcImageFile, File descDir, int destWidth, int destHeight) {
slice(read(srcImageFile), descDir, destWidth, destHeight);
} | java | public static void slice(File srcImageFile, File descDir, int destWidth, int destHeight) {
slice(read(srcImageFile), descDir, destWidth, destHeight);
} | [
"public",
"static",
"void",
"slice",
"(",
"File",
"srcImageFile",
",",
"File",
"descDir",
",",
"int",
"destWidth",
",",
"int",
"destHeight",
")",
"{",
"slice",
"(",
"read",
"(",
"srcImageFile",
")",
",",
"descDir",
",",
"destWidth",
",",
"destHeight",
")",... | 图像切片(指定切片的宽度和高度)
@param srcImageFile 源图像
@param descDir 切片目标文件夹
@param destWidth 目标切片宽度。默认200
@param destHeight 目标切片高度。默认150 | [
"图像切片(指定切片的宽度和高度)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L370-L372 | train | Copies the image from srcImageFile to destImageFile. | [
30522,
2270,
10763,
11675,
14704,
1006,
5371,
5034,
6895,
26860,
8873,
2571,
1010,
5371,
4078,
19797,
4313,
1010,
20014,
4078,
2102,
9148,
11927,
2232,
1010,
20014,
4078,
10760,
18743,
1007,
1063,
14704,
1006,
3191,
1006,
5034,
6895,
26860,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/InfoPropertiesInfoContributor.java | InfoPropertiesInfoContributor.generateContent | protected Map<String, Object> generateContent() {
Map<String, Object> content = extractContent(toPropertySource());
postProcessContent(content);
return content;
} | java | protected Map<String, Object> generateContent() {
Map<String, Object> content = extractContent(toPropertySource());
postProcessContent(content);
return content;
} | [
"protected",
"Map",
"<",
"String",
",",
"Object",
">",
"generateContent",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"content",
"=",
"extractContent",
"(",
"toPropertySource",
"(",
")",
")",
";",
"postProcessContent",
"(",
"content",
")",
";"... | Extract the content to contribute to the info endpoint.
@return the content to expose
@see #extractContent(PropertySource)
@see #postProcessContent(Map) | [
"Extract",
"the",
"content",
"to",
"contribute",
"to",
"the",
"info",
"endpoint",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/InfoPropertiesInfoContributor.java#L83-L87 | train | Generate the content map. | [
30522,
5123,
4949,
1026,
5164,
1010,
4874,
1028,
9699,
8663,
6528,
2102,
1006,
1007,
1063,
4949,
1026,
5164,
1010,
4874,
1028,
4180,
1027,
14817,
8663,
6528,
2102,
1006,
2327,
18981,
15010,
6499,
3126,
3401,
1006,
1007,
1007,
1025,
2695,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | examples/src/main/java/org/apache/spark/examples/sql/JavaSQLDataSourceExample.java | JavaSQLDataSourceExample.main | public static void main(String[] args) {
SparkSession spark = SparkSession
.builder()
.appName("Java Spark SQL data sources example")
.config("spark.some.config.option", "some-value")
.getOrCreate();
runBasicDataSourceExample(spark);
runBasicParquetExample(spark);
runParquetSchemaMergingExample(spark);
runJsonDatasetExample(spark);
runJdbcDatasetExample(spark);
spark.stop();
} | java | public static void main(String[] args) {
SparkSession spark = SparkSession
.builder()
.appName("Java Spark SQL data sources example")
.config("spark.some.config.option", "some-value")
.getOrCreate();
runBasicDataSourceExample(spark);
runBasicParquetExample(spark);
runParquetSchemaMergingExample(spark);
runJsonDatasetExample(spark);
runJdbcDatasetExample(spark);
spark.stop();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"SparkSession",
"spark",
"=",
"SparkSession",
".",
"builder",
"(",
")",
".",
"appName",
"(",
"\"Java Spark SQL data sources example\"",
")",
".",
"config",
"(",
"\"spark.some.config.o... | $example off:schema_merging$ | [
"$example",
"off",
":",
"schema_merging$"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/examples/src/main/java/org/apache/spark/examples/sql/JavaSQLDataSourceExample.java#L93-L107 | train | Main method for testing. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
12300,
7971,
3258,
12125,
1027,
12300,
7971,
3258,
1012,
12508,
1006,
1007,
1012,
10439,
18442,
1006,
1000,
9262,
12125,
29296,
2951,
4216,
2742,
1000,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | utility/src/main/java/com/networknt/utility/RegExUtils.java | RegExUtils.replaceAll | public static String replaceAll(final String text, final String regex, final String replacement) {
if (text == null || regex == null || replacement == null) {
return text;
}
return text.replaceAll(regex, replacement);
} | java | public static String replaceAll(final String text, final String regex, final String replacement) {
if (text == null || regex == null || replacement == null) {
return text;
}
return text.replaceAll(regex, replacement);
} | [
"public",
"static",
"String",
"replaceAll",
"(",
"final",
"String",
"text",
",",
"final",
"String",
"regex",
",",
"final",
"String",
"replacement",
")",
"{",
"if",
"(",
"text",
"==",
"null",
"||",
"regex",
"==",
"null",
"||",
"replacement",
"==",
"null",
... | <p>Replaces each substring of the text String that matches the given regular expression
with the given replacement.</p>
This method is a {@code null} safe equivalent to:
<ul>
<li>{@code text.replaceAll(regex, replacement)}</li>
<li>{@code Pattern.compile(regex).matcher(text).replaceAll(replacement)}</li>
</ul>
<p>A {@code null} reference passed to this method is a no-op.</p>
<p>Unlike in the {@link #replacePattern(String, String, String)} method, the {@link Pattern#DOTALL} option
is NOT automatically added.
To use the DOTALL option prepend <code>"(?s)"</code> to the regex.
DOTALL is also known as single-line mode in Perl.</p>
<pre>
StringUtils.replaceAll(null, *, *) = null
StringUtils.replaceAll("any", (String) null, *) = "any"
StringUtils.replaceAll("any", *, null) = "any"
StringUtils.replaceAll("", "", "zzz") = "zzz"
StringUtils.replaceAll("", ".*", "zzz") = "zzz"
StringUtils.replaceAll("", ".+", "zzz") = ""
StringUtils.replaceAll("abc", "", "ZZ") = "ZZaZZbZZcZZ"
StringUtils.replaceAll("<__>\n<__>", "<.*>", "z") = "z\nz"
StringUtils.replaceAll("<__>\n<__>", "(?s)<.*>", "z") = "z"
StringUtils.replaceAll("ABCabc123", "[a-z]", "_") = "ABC___123"
StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123"
StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "") = "ABC123"
StringUtils.replaceAll("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum_dolor_sit"
</pre>
@param text text to search and replace in, may be null
@param regex the regular expression to which this string is to be matched
@param replacement the string to be substituted for each match
@return the text with any replacements processed,
{@code null} if null String input
@throws java.util.regex.PatternSyntaxException
if the regular expression's syntax is invalid
@see #replacePattern(String, String, String)
@see String#replaceAll(String, String)
@see java.util.regex.Pattern
@see java.util.regex.Pattern#DOTALL | [
"<p",
">",
"Replaces",
"each",
"substring",
"of",
"the",
"text",
"String",
"that",
"matches",
"the",
"given",
"regular",
"expression",
"with",
"the",
"given",
"replacement",
".",
"<",
"/",
"p",
">"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/RegExUtils.java#L312-L317 | train | Replace all occurrences of a regular expression with a replacement string. | [
30522,
2270,
10763,
5164,
5672,
8095,
1006,
2345,
5164,
3793,
1010,
2345,
5164,
19723,
10288,
1010,
2345,
5164,
6110,
1007,
1063,
2065,
1006,
3793,
1027,
1027,
19701,
1064,
1064,
19723,
10288,
1027,
1027,
19701,
1064,
1064,
6110,
1027,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/Dijkstra/DijkstraSegment.java | DijkstraSegment.dijkstra | private static List<Vertex> dijkstra(Graph graph)
{
List<Vertex> resultList = new LinkedList<Vertex>();
Vertex[] vertexes = graph.getVertexes();
List<EdgeFrom>[] edgesTo = graph.getEdgesTo();
double[] d = new double[vertexes.length];
Arrays.fill(d, Double.MAX_VALUE);
d[d.length - 1] = 0;
int[] path = new int[vertexes.length];
Arrays.fill(path, -1);
PriorityQueue<State> que = new PriorityQueue<State>();
que.add(new State(0, vertexes.length - 1));
while (!que.isEmpty())
{
State p = que.poll();
if (d[p.vertex] < p.cost) continue;
for (EdgeFrom edgeFrom : edgesTo[p.vertex])
{
if (d[edgeFrom.from] > d[p.vertex] + edgeFrom.weight)
{
d[edgeFrom.from] = d[p.vertex] + edgeFrom.weight;
que.add(new State(d[edgeFrom.from], edgeFrom.from));
path[edgeFrom.from] = p.vertex;
}
}
}
for (int t = 0; t != -1; t = path[t])
{
resultList.add(vertexes[t]);
}
return resultList;
} | java | private static List<Vertex> dijkstra(Graph graph)
{
List<Vertex> resultList = new LinkedList<Vertex>();
Vertex[] vertexes = graph.getVertexes();
List<EdgeFrom>[] edgesTo = graph.getEdgesTo();
double[] d = new double[vertexes.length];
Arrays.fill(d, Double.MAX_VALUE);
d[d.length - 1] = 0;
int[] path = new int[vertexes.length];
Arrays.fill(path, -1);
PriorityQueue<State> que = new PriorityQueue<State>();
que.add(new State(0, vertexes.length - 1));
while (!que.isEmpty())
{
State p = que.poll();
if (d[p.vertex] < p.cost) continue;
for (EdgeFrom edgeFrom : edgesTo[p.vertex])
{
if (d[edgeFrom.from] > d[p.vertex] + edgeFrom.weight)
{
d[edgeFrom.from] = d[p.vertex] + edgeFrom.weight;
que.add(new State(d[edgeFrom.from], edgeFrom.from));
path[edgeFrom.from] = p.vertex;
}
}
}
for (int t = 0; t != -1; t = path[t])
{
resultList.add(vertexes[t]);
}
return resultList;
} | [
"private",
"static",
"List",
"<",
"Vertex",
">",
"dijkstra",
"(",
"Graph",
"graph",
")",
"{",
"List",
"<",
"Vertex",
">",
"resultList",
"=",
"new",
"LinkedList",
"<",
"Vertex",
">",
"(",
")",
";",
"Vertex",
"[",
"]",
"vertexes",
"=",
"graph",
".",
"g... | dijkstra最短路径
@param graph
@return | [
"dijkstra最短路径"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Dijkstra/DijkstraSegment.java#L129-L160 | train | dijkstra. | [
30522,
2797,
10763,
2862,
1026,
19449,
1028,
4487,
15992,
20528,
1006,
10629,
10629,
1007,
1063,
2862,
1026,
19449,
1028,
2765,
9863,
1027,
2047,
5799,
9863,
1026,
19449,
1028,
1006,
1007,
1025,
19449,
1031,
1033,
19449,
2229,
1027,
10629,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/SymmetricCrypto.java | SymmetricCrypto.encrypt | public byte[] encrypt(byte[] data) {
lock.lock();
try {
if (null == this.params) {
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
} else {
cipher.init(Cipher.ENCRYPT_MODE, secretKey, params);
}
return cipher.doFinal(data);
} catch (Exception e) {
throw new CryptoException(e);
} finally {
lock.unlock();
}
} | java | public byte[] encrypt(byte[] data) {
lock.lock();
try {
if (null == this.params) {
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
} else {
cipher.init(Cipher.ENCRYPT_MODE, secretKey, params);
}
return cipher.doFinal(data);
} catch (Exception e) {
throw new CryptoException(e);
} finally {
lock.unlock();
}
} | [
"public",
"byte",
"[",
"]",
"encrypt",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"null",
"==",
"this",
".",
"params",
")",
"{",
"cipher",
".",
"init",
"(",
"Cipher",
".",
"ENCRYPT_MODE",
... | 加密
@param data 被加密的bytes
@return 加密后的bytes | [
"加密"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/SymmetricCrypto.java#L155-L169 | train | Encrypts the given data using the specified key. | [
30522,
2270,
24880,
1031,
1033,
4372,
26775,
22571,
2102,
1006,
24880,
1031,
1033,
2951,
1007,
1063,
5843,
1012,
5843,
1006,
1007,
1025,
3046,
1063,
2065,
1006,
19701,
1027,
1027,
2023,
1012,
11498,
5244,
1007,
1063,
27715,
1012,
1999,
4183... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/utility/LexiconUtility.java | LexiconUtility.setAttribute | public static boolean setAttribute(String word, Nature... natures)
{
if (natures == null) return false;
CoreDictionary.Attribute attribute = new CoreDictionary.Attribute(natures, new int[natures.length]);
Arrays.fill(attribute.frequency, 1);
return setAttribute(word, attribute);
} | java | public static boolean setAttribute(String word, Nature... natures)
{
if (natures == null) return false;
CoreDictionary.Attribute attribute = new CoreDictionary.Attribute(natures, new int[natures.length]);
Arrays.fill(attribute.frequency, 1);
return setAttribute(word, attribute);
} | [
"public",
"static",
"boolean",
"setAttribute",
"(",
"String",
"word",
",",
"Nature",
"...",
"natures",
")",
"{",
"if",
"(",
"natures",
"==",
"null",
")",
"return",
"false",
";",
"CoreDictionary",
".",
"Attribute",
"attribute",
"=",
"new",
"CoreDictionary",
"... | 设置某个单词的属性
@param word
@param natures
@return | [
"设置某个单词的属性"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/LexiconUtility.java#L101-L109 | train | Sets the attribute for a CIS tag word. | [
30522,
2270,
10763,
22017,
20898,
2275,
19321,
3089,
8569,
2618,
1006,
5164,
2773,
1010,
3267,
1012,
1012,
1012,
3267,
2015,
1007,
1063,
2065,
1006,
3267,
2015,
1027,
1027,
19701,
1007,
2709,
6270,
1025,
4563,
29201,
3258,
5649,
1012,
17961... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | utility/src/main/java/com/networknt/utility/StringUtils.java | StringUtils.inputStreamToString | public static String inputStreamToString(InputStream inputStream, Charset charset) throws IOException {
if (inputStream != null && inputStream.available() != -1) {
ByteArrayOutputStream result = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) != -1) {
result.write(buffer, 0, length);
}
if (charset != null) {
return result.toString(charset.name());
}
return result.toString(StandardCharsets.UTF_8.name());
}
return null;
} | java | public static String inputStreamToString(InputStream inputStream, Charset charset) throws IOException {
if (inputStream != null && inputStream.available() != -1) {
ByteArrayOutputStream result = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) != -1) {
result.write(buffer, 0, length);
}
if (charset != null) {
return result.toString(charset.name());
}
return result.toString(StandardCharsets.UTF_8.name());
}
return null;
} | [
"public",
"static",
"String",
"inputStreamToString",
"(",
"InputStream",
"inputStream",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inputStream",
"!=",
"null",
"&&",
"inputStream",
".",
"available",
"(",
")",
"!=",
"-",
"1",
")",
... | Convert an InputStream into a String.
Highest performing conversion per: https://stackoverflow.com/a/35446009
@param inputStream The input stream to be converted.
@param charset The decoding charset to use.
@return The string value of the input stream, null otherwise.
@throws IOException If there are any issues in reading from the stream. | [
"Convert",
"an",
"InputStream",
"into",
"a",
"String",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/StringUtils.java#L1265-L1279 | train | This method is used to convert an input stream to a string. | [
30522,
2270,
10763,
5164,
20407,
25379,
13122,
18886,
3070,
1006,
20407,
25379,
20407,
25379,
1010,
25869,
13462,
25869,
13462,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
20407,
25379,
999,
1027,
19701,
1004,
1004,
20407,
25379,
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-setting/src/main/java/cn/hutool/setting/GroupedSet.java | GroupedSet.init | public boolean init(URL groupedSetUrl, Charset charset) {
if (groupedSetUrl == null) {
throw new RuntimeException("Null GroupSet url or charset define!");
}
this.charset = charset;
this.groupedSetUrl = groupedSetUrl;
return this.load(groupedSetUrl);
} | java | public boolean init(URL groupedSetUrl, Charset charset) {
if (groupedSetUrl == null) {
throw new RuntimeException("Null GroupSet url or charset define!");
}
this.charset = charset;
this.groupedSetUrl = groupedSetUrl;
return this.load(groupedSetUrl);
} | [
"public",
"boolean",
"init",
"(",
"URL",
"groupedSetUrl",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"groupedSetUrl",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Null GroupSet url or charset define!\"",
")",
";",
"}",
"this",
".",
... | 初始化设定文件
@param groupedSetUrl 设定文件的URL
@param charset 字符集
@return 成功初始化与否 | [
"初始化设定文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/GroupedSet.java#L148-L156 | train | Initializes the object with the contents of the specified GroupSet URL and Charset. | [
30522,
2270,
22017,
20898,
1999,
4183,
1006,
24471,
2140,
15131,
13462,
3126,
2140,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2065,
1006,
15131,
13462,
3126,
2140,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
2448,
7292,
10288,
24422,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java | NativeLibraryLoader.patchShadedLibraryId | private static boolean patchShadedLibraryId(byte[] bytes, String originalName, String name) {
// Our native libs always have the name as part of their id so we can search for it and replace it
// to make the ID unique if shading is used.
byte[] nameBytes = originalName.getBytes(CharsetUtil.UTF_8);
int idIdx = -1;
// Be aware this is a really raw way of patching a dylib but it does all we need without implementing
// a full mach-o parser and writer. Basically we just replace the the original bytes with some
// random bytes as part of the ID regeneration. The important thing here is that we need to use the same
// length to not corrupt the mach-o header.
outerLoop: for (int i = 0; i < bytes.length && bytes.length - i >= nameBytes.length; i++) {
int idx = i;
for (int j = 0; j < nameBytes.length;) {
if (bytes[idx++] != nameBytes[j++]) {
// Did not match the name, increase the index and try again.
break;
} else if (j == nameBytes.length) {
// We found the index within the id.
idIdx = i;
break outerLoop;
}
}
}
if (idIdx == -1) {
logger.debug("Was not able to find the ID of the shaded native library {}, can't adjust it.", name);
return false;
} else {
// We found our ID... now monkey-patch it!
for (int i = 0; i < nameBytes.length; i++) {
// We should only use bytes as replacement that are in our UNIQUE_ID_BYTES array.
bytes[idIdx + i] = UNIQUE_ID_BYTES[PlatformDependent.threadLocalRandom()
.nextInt(UNIQUE_ID_BYTES.length)];
}
if (logger.isDebugEnabled()) {
logger.debug(
"Found the ID of the shaded native library {}. Replacing ID part {} with {}",
name, originalName, new String(bytes, idIdx, nameBytes.length, CharsetUtil.UTF_8));
}
return true;
}
} | java | private static boolean patchShadedLibraryId(byte[] bytes, String originalName, String name) {
// Our native libs always have the name as part of their id so we can search for it and replace it
// to make the ID unique if shading is used.
byte[] nameBytes = originalName.getBytes(CharsetUtil.UTF_8);
int idIdx = -1;
// Be aware this is a really raw way of patching a dylib but it does all we need without implementing
// a full mach-o parser and writer. Basically we just replace the the original bytes with some
// random bytes as part of the ID regeneration. The important thing here is that we need to use the same
// length to not corrupt the mach-o header.
outerLoop: for (int i = 0; i < bytes.length && bytes.length - i >= nameBytes.length; i++) {
int idx = i;
for (int j = 0; j < nameBytes.length;) {
if (bytes[idx++] != nameBytes[j++]) {
// Did not match the name, increase the index and try again.
break;
} else if (j == nameBytes.length) {
// We found the index within the id.
idIdx = i;
break outerLoop;
}
}
}
if (idIdx == -1) {
logger.debug("Was not able to find the ID of the shaded native library {}, can't adjust it.", name);
return false;
} else {
// We found our ID... now monkey-patch it!
for (int i = 0; i < nameBytes.length; i++) {
// We should only use bytes as replacement that are in our UNIQUE_ID_BYTES array.
bytes[idIdx + i] = UNIQUE_ID_BYTES[PlatformDependent.threadLocalRandom()
.nextInt(UNIQUE_ID_BYTES.length)];
}
if (logger.isDebugEnabled()) {
logger.debug(
"Found the ID of the shaded native library {}. Replacing ID part {} with {}",
name, originalName, new String(bytes, idIdx, nameBytes.length, CharsetUtil.UTF_8));
}
return true;
}
} | [
"private",
"static",
"boolean",
"patchShadedLibraryId",
"(",
"byte",
"[",
"]",
"bytes",
",",
"String",
"originalName",
",",
"String",
"name",
")",
"{",
"// Our native libs always have the name as part of their id so we can search for it and replace it",
"// to make the ID unique ... | Try to patch shaded library to ensure it uses a unique ID. | [
"Try",
"to",
"patch",
"shaded",
"library",
"to",
"ensure",
"it",
"uses",
"a",
"unique",
"ID",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java#L283-L325 | train | This method is used to patch the ID of the shaded native library. | [
30522,
2797,
10763,
22017,
20898,
8983,
7377,
5732,
29521,
19848,
10139,
2094,
1006,
24880,
1031,
1033,
27507,
1010,
5164,
2434,
18442,
1010,
5164,
2171,
1007,
1063,
1013,
1013,
2256,
3128,
5622,
5910,
2467,
2031,
1996,
2171,
2004,
2112,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java | AbstractDependencyFilterMojo.getFilters | protected final FilterArtifacts getFilters(ArtifactsFilter... additionalFilters) {
FilterArtifacts filters = new FilterArtifacts();
for (ArtifactsFilter additionalFilter : additionalFilters) {
filters.addFilter(additionalFilter);
}
filters.addFilter(
new MatchingGroupIdFilter(cleanFilterConfig(this.excludeGroupIds)));
if (this.includes != null && !this.includes.isEmpty()) {
filters.addFilter(new IncludeFilter(this.includes));
}
if (this.excludes != null && !this.excludes.isEmpty()) {
filters.addFilter(new ExcludeFilter(this.excludes));
}
return filters;
} | java | protected final FilterArtifacts getFilters(ArtifactsFilter... additionalFilters) {
FilterArtifacts filters = new FilterArtifacts();
for (ArtifactsFilter additionalFilter : additionalFilters) {
filters.addFilter(additionalFilter);
}
filters.addFilter(
new MatchingGroupIdFilter(cleanFilterConfig(this.excludeGroupIds)));
if (this.includes != null && !this.includes.isEmpty()) {
filters.addFilter(new IncludeFilter(this.includes));
}
if (this.excludes != null && !this.excludes.isEmpty()) {
filters.addFilter(new ExcludeFilter(this.excludes));
}
return filters;
} | [
"protected",
"final",
"FilterArtifacts",
"getFilters",
"(",
"ArtifactsFilter",
"...",
"additionalFilters",
")",
"{",
"FilterArtifacts",
"filters",
"=",
"new",
"FilterArtifacts",
"(",
")",
";",
"for",
"(",
"ArtifactsFilter",
"additionalFilter",
":",
"additionalFilters",
... | Return artifact filters configured for this MOJO.
@param additionalFilters optional additional filters to apply
@return the filters | [
"Return",
"artifact",
"filters",
"configured",
"for",
"this",
"MOJO",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractDependencyFilterMojo.java#L95-L109 | train | Gets the filters. | [
30522,
5123,
2345,
11307,
8445,
10128,
18908,
2015,
2131,
8873,
21928,
2015,
1006,
10471,
8873,
21928,
1012,
1012,
1012,
3176,
8873,
21928,
2015,
1007,
1063,
11307,
8445,
10128,
18908,
2015,
17736,
1027,
2047,
11307,
8445,
10128,
18908,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java | ExcelReader.readAll | public <T> List<T> readAll(Class<T> beanType) {
return read(0, 1, Integer.MAX_VALUE, beanType);
} | java | public <T> List<T> readAll(Class<T> beanType) {
return read(0, 1, Integer.MAX_VALUE, beanType);
} | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"readAll",
"(",
"Class",
"<",
"T",
">",
"beanType",
")",
"{",
"return",
"read",
"(",
"0",
",",
"1",
",",
"Integer",
".",
"MAX_VALUE",
",",
"beanType",
")",
";",
"}"
] | 读取Excel为Bean的列表,读取所有行,默认第一行做为标题,数据从第二行开始
@param <T> Bean类型
@param beanType 每行对应Bean的类型
@return Map的列表 | [
"读取Excel为Bean的列表,读取所有行,默认第一行做为标题,数据从第二行开始"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java#L320-L322 | train | Reads all records of the specified type from the database. | [
30522,
2270,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
3191,
8095,
1006,
2465,
1026,
1056,
1028,
14068,
13874,
1007,
1063,
2709,
3191,
1006,
1014,
1010,
1015,
1010,
16109,
1012,
4098,
1035,
3643,
1010,
14068,
13874,
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-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TimerService.java | TimerService.unregisterTimeout | public void unregisterTimeout(K key) {
Timeout<K> timeout = timeouts.remove(key);
if (timeout != null) {
timeout.cancel();
}
} | java | public void unregisterTimeout(K key) {
Timeout<K> timeout = timeouts.remove(key);
if (timeout != null) {
timeout.cancel();
}
} | [
"public",
"void",
"unregisterTimeout",
"(",
"K",
"key",
")",
"{",
"Timeout",
"<",
"K",
">",
"timeout",
"=",
"timeouts",
".",
"remove",
"(",
"key",
")",
";",
"if",
"(",
"timeout",
"!=",
"null",
")",
"{",
"timeout",
".",
"cancel",
"(",
")",
";",
"}",... | Unregister the timeout for the given key.
@param key for which to unregister the timeout | [
"Unregister",
"the",
"timeout",
"for",
"the",
"given",
"key",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TimerService.java#L117-L123 | train | Unregister a timeout. | [
30522,
2270,
11675,
4895,
2890,
24063,
8743,
14428,
5833,
1006,
1047,
3145,
1007,
1063,
2051,
5833,
1026,
1047,
1028,
2051,
5833,
1027,
2051,
12166,
1012,
6366,
1006,
3145,
1007,
1025,
2065,
1006,
2051,
5833,
999,
1027,
19701,
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-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.isValuesWithDefault | private boolean isValuesWithDefault(SqlNode source, int column) {
switch (source.getKind()) {
case VALUES:
for (SqlNode operand : ((SqlCall) source).getOperandList()) {
if (!isRowWithDefault(operand, column)) {
return false;
}
}
return true;
}
return false;
} | java | private boolean isValuesWithDefault(SqlNode source, int column) {
switch (source.getKind()) {
case VALUES:
for (SqlNode operand : ((SqlCall) source).getOperandList()) {
if (!isRowWithDefault(operand, column)) {
return false;
}
}
return true;
}
return false;
} | [
"private",
"boolean",
"isValuesWithDefault",
"(",
"SqlNode",
"source",
",",
"int",
"column",
")",
"{",
"switch",
"(",
"source",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"VALUES",
":",
"for",
"(",
"SqlNode",
"operand",
":",
"(",
"(",
"SqlCall",
")",
... | Returns whether a query uses {@code DEFAULT} to populate a given
column. | [
"Returns",
"whether",
"a",
"query",
"uses",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L4407-L4418 | train | Checks if the given source is a VALUES or VALUES_WITHOUT_DEFAULT clause. | [
30522,
2797,
22017,
20898,
2003,
10175,
15808,
24415,
3207,
7011,
11314,
1006,
29296,
3630,
3207,
3120,
1010,
20014,
5930,
1007,
1063,
6942,
1006,
3120,
1012,
2131,
18824,
1006,
1007,
1007,
1063,
2553,
5300,
1024,
2005,
1006,
29296,
3630,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java | AbstractStreamOperator.getPartitionedState | protected <S extends State> S getPartitionedState(StateDescriptor<S, ?> stateDescriptor) throws Exception {
return getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, stateDescriptor);
} | java | protected <S extends State> S getPartitionedState(StateDescriptor<S, ?> stateDescriptor) throws Exception {
return getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, stateDescriptor);
} | [
"protected",
"<",
"S",
"extends",
"State",
">",
"S",
"getPartitionedState",
"(",
"StateDescriptor",
"<",
"S",
",",
"?",
">",
"stateDescriptor",
")",
"throws",
"Exception",
"{",
"return",
"getPartitionedState",
"(",
"VoidNamespace",
".",
"INSTANCE",
",",
"VoidNam... | Creates a partitioned state handle, using the state backend configured for this task.
@throws IllegalStateException Thrown, if the key/value state was already initialized.
@throws Exception Thrown, if the state backend cannot create the key/value state. | [
"Creates",
"a",
"partitioned",
"state",
"handle",
"using",
"the",
"state",
"backend",
"configured",
"for",
"this",
"task",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java#L559-L561 | train | Get the partitioned state. | [
30522,
5123,
1026,
1055,
8908,
2110,
1028,
1055,
2131,
19362,
3775,
3508,
2098,
9153,
2618,
1006,
3090,
2229,
23235,
2953,
1026,
1055,
1010,
1029,
1028,
3090,
2229,
23235,
2953,
1007,
11618,
6453,
1063,
2709,
2131,
19362,
3775,
3508,
2098,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/concurrent/AbstractScheduledEventExecutor.java | AbstractScheduledEventExecutor.hasScheduledTasks | protected final boolean hasScheduledTasks() {
Queue<ScheduledFutureTask<?>> scheduledTaskQueue = this.scheduledTaskQueue;
ScheduledFutureTask<?> scheduledTask = scheduledTaskQueue == null ? null : scheduledTaskQueue.peek();
return scheduledTask != null && scheduledTask.deadlineNanos() <= nanoTime();
} | java | protected final boolean hasScheduledTasks() {
Queue<ScheduledFutureTask<?>> scheduledTaskQueue = this.scheduledTaskQueue;
ScheduledFutureTask<?> scheduledTask = scheduledTaskQueue == null ? null : scheduledTaskQueue.peek();
return scheduledTask != null && scheduledTask.deadlineNanos() <= nanoTime();
} | [
"protected",
"final",
"boolean",
"hasScheduledTasks",
"(",
")",
"{",
"Queue",
"<",
"ScheduledFutureTask",
"<",
"?",
">",
">",
"scheduledTaskQueue",
"=",
"this",
".",
"scheduledTaskQueue",
";",
"ScheduledFutureTask",
"<",
"?",
">",
"scheduledTask",
"=",
"scheduledT... | Returns {@code true} if a scheduled task is ready for processing. | [
"Returns",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/AbstractScheduledEventExecutor.java#L140-L144 | train | Returns true if there are scheduled tasks in the queue. | [
30522,
5123,
2345,
22017,
20898,
2038,
22842,
8566,
3709,
10230,
5705,
1006,
1007,
1063,
24240,
1026,
5115,
11263,
11244,
10230,
2243,
1026,
1029,
1028,
1028,
5115,
10230,
2243,
4226,
5657,
1027,
2023,
1012,
5115,
10230,
2243,
4226,
5657,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/Operator.java | Operator.createUnionCascade | @SuppressWarnings("unchecked")
public static <T> Operator<T> createUnionCascade(List<? extends Operator<T>> operators) {
return createUnionCascade((Operator<T>[]) operators.toArray(new Operator[operators.size()]));
} | java | @SuppressWarnings("unchecked")
public static <T> Operator<T> createUnionCascade(List<? extends Operator<T>> operators) {
return createUnionCascade((Operator<T>[]) operators.toArray(new Operator[operators.size()]));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Operator",
"<",
"T",
">",
"createUnionCascade",
"(",
"List",
"<",
"?",
"extends",
"Operator",
"<",
"T",
">",
">",
"operators",
")",
"{",
"return",
"createUnionCascade",
... | Takes a list of operators and creates a cascade of unions of this inputs, if needed.
If not needed (there was only one operator in the list), then that operator is returned.
@param operators The operators.
@return The single operator or a cascade of unions of the operators. | [
"Takes",
"a",
"list",
"of",
"operators",
"and",
"creates",
"a",
"cascade",
"of",
"unions",
"of",
"this",
"inputs",
"if",
"needed",
".",
"If",
"not",
"needed",
"(",
"there",
"was",
"only",
"one",
"operator",
"in",
"the",
"list",
")",
"then",
"that",
"op... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/Operator.java#L247-L250 | train | Create an Union of the given operators cascading | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
6872,
1026,
1056,
1028,
3443,
19496,
2239,
15671,
21869,
1006,
2862,
1026,
1029,
8908,
6872,
1026,
1056,
1028,
1028,
9224,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.createXml | public static Document createXml(String rootElementName) {
final Document doc = createXml();
doc.appendChild(doc.createElement(rootElementName));
return doc;
} | java | public static Document createXml(String rootElementName) {
final Document doc = createXml();
doc.appendChild(doc.createElement(rootElementName));
return doc;
} | [
"public",
"static",
"Document",
"createXml",
"(",
"String",
"rootElementName",
")",
"{",
"final",
"Document",
"doc",
"=",
"createXml",
"(",
")",
";",
"doc",
".",
"appendChild",
"(",
"doc",
".",
"createElement",
"(",
"rootElementName",
")",
")",
";",
"return"... | 创建XML文档<br>
创建的XML默认是utf8编码,修改编码的过程是在toStr和toFile方法里,既XML在转为文本的时候才定义编码
@param rootElementName 根节点名称
@return XML文档 | [
"创建XML文档<br",
">",
"创建的XML默认是utf8编码,修改编码的过程是在toStr和toFile方法里,既XML在转为文本的时候才定义编码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L405-L410 | train | Create an XML document with the specified root element name. | [
30522,
2270,
10763,
6254,
3443,
2595,
19968,
1006,
5164,
7117,
12260,
3672,
18442,
1007,
1063,
2345,
6254,
9986,
1027,
3443,
2595,
19968,
1006,
1007,
1025,
9986,
1012,
10439,
10497,
19339,
1006,
9986,
1012,
3443,
12260,
3672,
1006,
7117,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/plan/SingleInputPlanNode.java | SingleInputPlanNode.setDriverKeyInfo | public void setDriverKeyInfo(FieldList keys, int id) {
this.setDriverKeyInfo(keys, getTrueArray(keys.size()), id);
} | java | public void setDriverKeyInfo(FieldList keys, int id) {
this.setDriverKeyInfo(keys, getTrueArray(keys.size()), id);
} | [
"public",
"void",
"setDriverKeyInfo",
"(",
"FieldList",
"keys",
",",
"int",
"id",
")",
"{",
"this",
".",
"setDriverKeyInfo",
"(",
"keys",
",",
"getTrueArray",
"(",
"keys",
".",
"size",
"(",
")",
")",
",",
"id",
")",
";",
"}"
] | Sets the key field indexes for the specified driver comparator.
@param keys The key field indexes for the specified driver comparator.
@param id The ID of the driver comparator. | [
"Sets",
"the",
"key",
"field",
"indexes",
"for",
"the",
"specified",
"driver",
"comparator",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/plan/SingleInputPlanNode.java#L132-L134 | train | Sets the driver key info. | [
30522,
2270,
11675,
2275,
23663,
25074,
25811,
14876,
1006,
2492,
9863,
6309,
1010,
20014,
8909,
1007,
1063,
2023,
1012,
2275,
23663,
25074,
25811,
14876,
1006,
6309,
1010,
2131,
16344,
5657,
2906,
9447,
1006,
6309,
1012,
2946,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/Sign.java | Sign.setCertificate | public Sign setCertificate(Certificate certificate) {
// If the certificate is of type X509Certificate,
// we should check whether it has a Key Usage
// extension marked as critical.
if (certificate instanceof X509Certificate) {
// Check whether the cert has a key usage extension
// marked as a critical extension.
// The OID for KeyUsage extension is 2.5.29.15.
final X509Certificate cert = (X509Certificate) certificate;
final Set<String> critSet = cert.getCriticalExtensionOIDs();
if (CollUtil.isNotEmpty(critSet) && critSet.contains("2.5.29.15")) {
final boolean[] keyUsageInfo = cert.getKeyUsage();
// keyUsageInfo[0] is for digitalSignature.
if ((keyUsageInfo != null) && (keyUsageInfo[0] == false)) {
throw new CryptoException("Wrong key usage");
}
}
}
this.publicKey = certificate.getPublicKey();
return this;
} | java | public Sign setCertificate(Certificate certificate) {
// If the certificate is of type X509Certificate,
// we should check whether it has a Key Usage
// extension marked as critical.
if (certificate instanceof X509Certificate) {
// Check whether the cert has a key usage extension
// marked as a critical extension.
// The OID for KeyUsage extension is 2.5.29.15.
final X509Certificate cert = (X509Certificate) certificate;
final Set<String> critSet = cert.getCriticalExtensionOIDs();
if (CollUtil.isNotEmpty(critSet) && critSet.contains("2.5.29.15")) {
final boolean[] keyUsageInfo = cert.getKeyUsage();
// keyUsageInfo[0] is for digitalSignature.
if ((keyUsageInfo != null) && (keyUsageInfo[0] == false)) {
throw new CryptoException("Wrong key usage");
}
}
}
this.publicKey = certificate.getPublicKey();
return this;
} | [
"public",
"Sign",
"setCertificate",
"(",
"Certificate",
"certificate",
")",
"{",
"// If the certificate is of type X509Certificate,\r",
"// we should check whether it has a Key Usage\r",
"// extension marked as critical.\r",
"if",
"(",
"certificate",
"instanceof",
"X509Certificate",
... | 设置{@link Certificate} 为PublicKey<br>
如果Certificate是X509Certificate,我们需要检查是否有密钥扩展
@param certificate {@link Certificate}
@return this | [
"设置",
"{",
"@link",
"Certificate",
"}",
"为PublicKey<br",
">",
"如果Certificate是X509Certificate,我们需要检查是否有密钥扩展"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/Sign.java#L235-L256 | train | Sets the certificate that this signature is associated with. | [
30522,
2270,
3696,
2275,
17119,
3775,
8873,
16280,
1006,
8196,
8196,
1007,
1063,
1013,
1013,
2065,
1996,
8196,
2003,
1997,
2828,
1060,
12376,
2683,
17119,
3775,
8873,
16280,
1010,
1013,
1013,
2057,
2323,
4638,
3251,
2009,
2038,
1037,
3145,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/ExecutionConfig.java | ExecutionConfig.addDefaultKryoSerializer | public <T extends Serializer<?> & Serializable>void addDefaultKryoSerializer(Class<?> type, T serializer) {
if (type == null || serializer == null) {
throw new NullPointerException("Cannot register null class or serializer.");
}
defaultKryoSerializers.put(type, new SerializableSerializer<>(serializer));
} | java | public <T extends Serializer<?> & Serializable>void addDefaultKryoSerializer(Class<?> type, T serializer) {
if (type == null || serializer == null) {
throw new NullPointerException("Cannot register null class or serializer.");
}
defaultKryoSerializers.put(type, new SerializableSerializer<>(serializer));
} | [
"public",
"<",
"T",
"extends",
"Serializer",
"<",
"?",
">",
"&",
"Serializable",
">",
"void",
"addDefaultKryoSerializer",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"T",
"serializer",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"serializer",
"==",
... | Adds a new Kryo default serializer to the Runtime.
Note that the serializer instance must be serializable (as defined by java.io.Serializable),
because it may be distributed to the worker nodes by java serialization.
@param type The class of the types serialized with the given serializer.
@param serializer The serializer to use. | [
"Adds",
"a",
"new",
"Kryo",
"default",
"serializer",
"to",
"the",
"Runtime",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/ExecutionConfig.java#L768-L774 | train | Register a default serializer for a given class. | [
30522,
2270,
1026,
1056,
8908,
7642,
17629,
1026,
1029,
1028,
1004,
7642,
21335,
3468,
1028,
11675,
5587,
3207,
7011,
11314,
21638,
7677,
8043,
4818,
17629,
1006,
2465,
1026,
1029,
1028,
2828,
1010,
1056,
7642,
17629,
1007,
1063,
2065,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java | EnvironmentInformation.getSizeOfFreeHeapMemory | public static long getSizeOfFreeHeapMemory() {
Runtime r = Runtime.getRuntime();
return getMaxJvmHeapMemory() - r.totalMemory() + r.freeMemory();
} | java | public static long getSizeOfFreeHeapMemory() {
Runtime r = Runtime.getRuntime();
return getMaxJvmHeapMemory() - r.totalMemory() + r.freeMemory();
} | [
"public",
"static",
"long",
"getSizeOfFreeHeapMemory",
"(",
")",
"{",
"Runtime",
"r",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
";",
"return",
"getMaxJvmHeapMemory",
"(",
")",
"-",
"r",
".",
"totalMemory",
"(",
")",
"+",
"r",
".",
"freeMemory",
"(",
"... | Gets an estimate of the size of the free heap memory. The estimate may vary, depending on the current
level of memory fragmentation and the number of dead objects. For a better (but more heavy-weight)
estimate, use {@link #getSizeOfFreeHeapMemoryWithDefrag()}.
@return An estimate of the size of the free heap memory, in bytes. | [
"Gets",
"an",
"estimate",
"of",
"the",
"size",
"of",
"the",
"free",
"heap",
"memory",
".",
"The",
"estimate",
"may",
"vary",
"depending",
"on",
"the",
"current",
"level",
"of",
"memory",
"fragmentation",
"and",
"the",
"number",
"of",
"dead",
"objects",
"."... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java#L164-L167 | train | Get the size of free heap memory. | [
30522,
2270,
10763,
2146,
4152,
4697,
7245,
9910,
20192,
9737,
6633,
10253,
1006,
1007,
1063,
2448,
7292,
1054,
1027,
2448,
7292,
1012,
2131,
15532,
7292,
1006,
1007,
1025,
2709,
2131,
17848,
3501,
2615,
2213,
20192,
9737,
6633,
10253,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/file/FileAppender.java | FileAppender.append | public FileAppender append(String line) {
if (list.size() >= capacity) {
flush();
}
list.add(line);
return this;
} | java | public FileAppender append(String line) {
if (list.size() >= capacity) {
flush();
}
list.add(line);
return this;
} | [
"public",
"FileAppender",
"append",
"(",
"String",
"line",
")",
"{",
"if",
"(",
"list",
".",
"size",
"(",
")",
">=",
"capacity",
")",
"{",
"flush",
"(",
")",
";",
"}",
"list",
".",
"add",
"(",
"line",
")",
";",
"return",
"this",
";",
"}"
] | 追加
@param line 行
@return this | [
"追加"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileAppender.java#L60-L66 | train | Append a line to the end of the file. | [
30522,
2270,
5371,
29098,
10497,
2121,
10439,
10497,
1006,
5164,
2240,
1007,
1063,
2065,
1006,
2862,
1012,
2946,
1006,
1007,
1028,
1027,
3977,
1007,
1063,
13862,
1006,
1007,
1025,
1065,
2862,
1012,
5587,
1006,
2240,
1007,
1025,
2709,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.writePng | public static void writePng(Image image, ImageOutputStream destImageStream) throws IORuntimeException {
write(image, IMAGE_TYPE_PNG, destImageStream);
} | java | public static void writePng(Image image, ImageOutputStream destImageStream) throws IORuntimeException {
write(image, IMAGE_TYPE_PNG, destImageStream);
} | [
"public",
"static",
"void",
"writePng",
"(",
"Image",
"image",
",",
"ImageOutputStream",
"destImageStream",
")",
"throws",
"IORuntimeException",
"{",
"write",
"(",
"image",
",",
"IMAGE_TYPE_PNG",
",",
"destImageStream",
")",
";",
"}"
] | 写出图像为PNG格式
@param image {@link Image}
@param destImageStream 写出到的目标流
@throws IORuntimeException IO异常 | [
"写出图像为PNG格式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1365-L1367 | train | Write a PNG image to an image output stream. | [
30522,
2270,
10763,
11675,
4339,
2361,
3070,
1006,
3746,
3746,
1010,
3746,
5833,
18780,
21422,
4078,
3775,
26860,
21422,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
4339,
1006,
3746,
1010,
3746,
1035,
2828,
1035,
1052,
3070,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java | SpringApplicationBuilder.properties | public SpringApplicationBuilder properties(Map<String, Object> defaults) {
this.defaultProperties.putAll(defaults);
this.application.setDefaultProperties(this.defaultProperties);
if (this.parent != null) {
this.parent.properties(this.defaultProperties);
this.parent.environment(this.environment);
}
return this;
} | java | public SpringApplicationBuilder properties(Map<String, Object> defaults) {
this.defaultProperties.putAll(defaults);
this.application.setDefaultProperties(this.defaultProperties);
if (this.parent != null) {
this.parent.properties(this.defaultProperties);
this.parent.environment(this.environment);
}
return this;
} | [
"public",
"SpringApplicationBuilder",
"properties",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"defaults",
")",
"{",
"this",
".",
"defaultProperties",
".",
"putAll",
"(",
"defaults",
")",
";",
"this",
".",
"application",
".",
"setDefaultProperties",
"(",
"... | Default properties for the environment. Multiple calls to this method are
cumulative.
@param defaults the default properties
@return the current builder
@see SpringApplicationBuilder#properties(String...) | [
"Default",
"properties",
"for",
"the",
"environment",
".",
"Multiple",
"calls",
"to",
"this",
"method",
"are",
"cumulative",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java#L456-L464 | train | Sets the properties for this application. | [
30522,
2270,
3500,
29098,
19341,
3508,
8569,
23891,
2099,
5144,
1006,
4949,
1026,
5164,
1010,
4874,
1028,
12398,
2015,
1007,
1063,
2023,
1012,
12398,
21572,
4842,
7368,
1012,
2404,
8095,
1006,
12398,
2015,
1007,
1025,
30524,
1007,
1025,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.createInput | @PublicEvolving
public <OUT> DataStreamSource<OUT> createInput(InputFormat<OUT, ?> inputFormat) {
return createInput(inputFormat, TypeExtractor.getInputFormatTypes(inputFormat));
} | java | @PublicEvolving
public <OUT> DataStreamSource<OUT> createInput(InputFormat<OUT, ?> inputFormat) {
return createInput(inputFormat, TypeExtractor.getInputFormatTypes(inputFormat));
} | [
"@",
"PublicEvolving",
"public",
"<",
"OUT",
">",
"DataStreamSource",
"<",
"OUT",
">",
"createInput",
"(",
"InputFormat",
"<",
"OUT",
",",
"?",
">",
"inputFormat",
")",
"{",
"return",
"createInput",
"(",
"inputFormat",
",",
"TypeExtractor",
".",
"getInputForma... | Generic method to create an input data stream with {@link org.apache.flink.api.common.io.InputFormat}.
<p>Since all data streams need specific information about their types, this method needs to determine the
type of the data produced by the input format. It will attempt to determine the data type by reflection,
unless the input format implements the {@link org.apache.flink.api.java.typeutils.ResultTypeQueryable} interface.
In the latter case, this method will invoke the
{@link org.apache.flink.api.java.typeutils.ResultTypeQueryable#getProducedType()} method to determine data
type produced by the input format.
<p><b>NOTES ON CHECKPOINTING: </b> In the case of a {@link FileInputFormat}, the source
(which executes the {@link ContinuousFileMonitoringFunction}) monitors the path, creates the
{@link org.apache.flink.core.fs.FileInputSplit FileInputSplits} to be processed, forwards
them to the downstream {@link ContinuousFileReaderOperator} to read the actual data, and exits,
without waiting for the readers to finish reading. This implies that no more checkpoint
barriers are going to be forwarded after the source exits, thus having no checkpoints.
@param inputFormat
The input format used to create the data stream
@param <OUT>
The type of the returned data stream
@return The data stream that represents the data created by the input format | [
"Generic",
"method",
"to",
"create",
"an",
"input",
"data",
"stream",
"with",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"api",
".",
"common",
".",
"io",
".",
"InputFormat",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1299-L1302 | train | Creates a data stream source for the given input format. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
1026,
2041,
1028,
2951,
21422,
6499,
3126,
3401,
1026,
2041,
1028,
3443,
2378,
18780,
1006,
7953,
14192,
4017,
1026,
2041,
1010,
1029,
1028,
7953,
14192,
4017,
1007,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java | ThriftCLIServiceClient.getSchemas | @Override
public OperationHandle getSchemas(SessionHandle sessionHandle, String catalogName,
String schemaName)
throws HiveSQLException {
try {
TGetSchemasReq req = new TGetSchemasReq(sessionHandle.toTSessionHandle());
req.setCatalogName(catalogName);
req.setSchemaName(schemaName);
TGetSchemasResp resp = cliService.GetSchemas(req);
checkStatus(resp.getStatus());
TProtocolVersion protocol = sessionHandle.getProtocolVersion();
return new OperationHandle(resp.getOperationHandle(), protocol);
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | java | @Override
public OperationHandle getSchemas(SessionHandle sessionHandle, String catalogName,
String schemaName)
throws HiveSQLException {
try {
TGetSchemasReq req = new TGetSchemasReq(sessionHandle.toTSessionHandle());
req.setCatalogName(catalogName);
req.setSchemaName(schemaName);
TGetSchemasResp resp = cliService.GetSchemas(req);
checkStatus(resp.getStatus());
TProtocolVersion protocol = sessionHandle.getProtocolVersion();
return new OperationHandle(resp.getOperationHandle(), protocol);
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | [
"@",
"Override",
"public",
"OperationHandle",
"getSchemas",
"(",
"SessionHandle",
"sessionHandle",
",",
"String",
"catalogName",
",",
"String",
"schemaName",
")",
"throws",
"HiveSQLException",
"{",
"try",
"{",
"TGetSchemasReq",
"req",
"=",
"new",
"TGetSchemasReq",
"... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#getSchemas(org.apache.hive.service.cli.SessionHandle, java.lang.String, java.lang.String) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java#L189-L206 | train | Get the schemas for the catalog and schema name. | [
30522,
1030,
2058,
15637,
2270,
3169,
11774,
2571,
4152,
5403,
9335,
1006,
5219,
11774,
2571,
5219,
11774,
2571,
1010,
5164,
12105,
18442,
1010,
5164,
8040,
28433,
18442,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
3046,
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/img/ImgUtil.java | ImgUtil.convert | public static void convert(Image srcImage, String formatName, ImageOutputStream destImageStream, boolean isSrcPng) {
try {
ImageIO.write(isSrcPng ? copyImage(srcImage, BufferedImage.TYPE_INT_RGB) : toBufferedImage(srcImage), formatName, destImageStream);
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static void convert(Image srcImage, String formatName, ImageOutputStream destImageStream, boolean isSrcPng) {
try {
ImageIO.write(isSrcPng ? copyImage(srcImage, BufferedImage.TYPE_INT_RGB) : toBufferedImage(srcImage), formatName, destImageStream);
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"void",
"convert",
"(",
"Image",
"srcImage",
",",
"String",
"formatName",
",",
"ImageOutputStream",
"destImageStream",
",",
"boolean",
"isSrcPng",
")",
"{",
"try",
"{",
"ImageIO",
".",
"write",
"(",
"isSrcPng",
"?",
"copyImage",
"(",
"srcIm... | 图像类型转换:GIF=》JPG、GIF=》PNG、PNG=》JPG、PNG=》GIF(X)、BMP=》PNG<br>
此方法并不关闭流
@param srcImage 源图像流
@param formatName 包含格式非正式名称的 String:如JPG、JPEG、GIF等
@param destImageStream 目标图像输出流
@param isSrcPng 源图片是否为PNG格式
@since 4.1.14 | [
"图像类型转换:GIF",
"=",
"》JPG、GIF",
"=",
"》PNG、PNG",
"=",
"》JPG、PNG",
"=",
"》GIF",
"(",
"X",
")",
"、BMP",
"=",
"》PNG<br",
">",
"此方法并不关闭流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L565-L571 | train | Converts the given image to a BufferedImage and writes it to the given output stream. | [
30522,
2270,
10763,
11675,
10463,
1006,
3746,
5034,
6895,
26860,
1010,
5164,
4289,
18442,
1010,
3746,
5833,
18780,
21422,
4078,
3775,
26860,
21422,
1010,
22017,
20898,
26354,
11890,
2361,
3070,
1007,
1063,
3046,
1063,
3746,
3695,
1012,
4339,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java | DescriptorProperties.putClass | public void putClass(String key, Class<?> clazz) {
checkNotNull(key);
checkNotNull(clazz);
final String error = InstantiationUtil.checkForInstantiationError(clazz);
if (error != null) {
throw new ValidationException("Class '" + clazz.getName() + "' is not supported: " + error);
}
put(key, clazz.getName());
} | java | public void putClass(String key, Class<?> clazz) {
checkNotNull(key);
checkNotNull(clazz);
final String error = InstantiationUtil.checkForInstantiationError(clazz);
if (error != null) {
throw new ValidationException("Class '" + clazz.getName() + "' is not supported: " + error);
}
put(key, clazz.getName());
} | [
"public",
"void",
"putClass",
"(",
"String",
"key",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"checkNotNull",
"(",
"key",
")",
";",
"checkNotNull",
"(",
"clazz",
")",
";",
"final",
"String",
"error",
"=",
"InstantiationUtil",
".",
"checkForInstantiat... | Adds a class under the given key. | [
"Adds",
"a",
"class",
"under",
"the",
"given",
"key",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java#L109-L117 | train | Put a Class into the map. | [
30522,
2270,
11675,
2404,
26266,
1006,
5164,
3145,
1010,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
3145,
1007,
1025,
4638,
17048,
11231,
3363,
1006,
18856,
10936,
2480,
1007,
1025,
2345,
5164,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/file/FileReader.java | FileReader.readLines | public <T extends Collection<String>> T readLines(T collection) throws IORuntimeException {
BufferedReader reader = null;
try {
reader = FileUtil.getReader(file, charset);
String line;
while (true) {
line = reader.readLine();
if (line == null) {
break;
}
collection.add(line);
}
return collection;
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
IoUtil.close(reader);
}
} | java | public <T extends Collection<String>> T readLines(T collection) throws IORuntimeException {
BufferedReader reader = null;
try {
reader = FileUtil.getReader(file, charset);
String line;
while (true) {
line = reader.readLine();
if (line == null) {
break;
}
collection.add(line);
}
return collection;
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
IoUtil.close(reader);
}
} | [
"public",
"<",
"T",
"extends",
"Collection",
"<",
"String",
">",
">",
"T",
"readLines",
"(",
"T",
"collection",
")",
"throws",
"IORuntimeException",
"{",
"BufferedReader",
"reader",
"=",
"null",
";",
"try",
"{",
"reader",
"=",
"FileUtil",
".",
"getReader",
... | 从文件中读取每一行数据
@param <T> 集合类型
@param collection 集合
@return 文件中的每行内容的集合
@throws IORuntimeException IO异常 | [
"从文件中读取每一行数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileReader.java#L154-L172 | train | Reads the contents of the file into the specified collection. | [
30522,
2270,
1026,
1056,
8908,
3074,
1026,
5164,
1028,
1028,
1056,
3191,
12735,
1006,
1056,
3074,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
17698,
2098,
16416,
4063,
8068,
1027,
19701,
1025,
3046,
1063,
8068,
1027,
5371,
21823,
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/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java | RestTemplateBuilder.additionalCustomizers | public RestTemplateBuilder additionalCustomizers(
Collection<? extends RestTemplateCustomizer> customizers) {
Assert.notNull(customizers, "RestTemplateCustomizers must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
append(this.restTemplateCustomizers, customizers),
this.requestFactoryCustomizer, this.interceptors);
} | java | public RestTemplateBuilder additionalCustomizers(
Collection<? extends RestTemplateCustomizer> customizers) {
Assert.notNull(customizers, "RestTemplateCustomizers must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
append(this.restTemplateCustomizers, customizers),
this.requestFactoryCustomizer, this.interceptors);
} | [
"public",
"RestTemplateBuilder",
"additionalCustomizers",
"(",
"Collection",
"<",
"?",
"extends",
"RestTemplateCustomizer",
">",
"customizers",
")",
"{",
"Assert",
".",
"notNull",
"(",
"customizers",
",",
"\"RestTemplateCustomizers must not be null\"",
")",
";",
"return",... | Add {@link RestTemplateCustomizer RestTemplateCustomizers} that should be applied
to the {@link RestTemplate}. Customizers are applied in the order that they were
added after builder configuration has been applied.
@param customizers the customizers to add
@return a new builder instance
@see #customizers(RestTemplateCustomizer...) | [
"Add",
"{"
] | 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#L450-L458 | train | Add additional customizers to the builder. | [
30522,
2270,
2717,
18532,
15725,
8569,
23891,
2099,
3176,
7874,
20389,
17629,
2015,
1006,
3074,
1026,
1029,
8908,
2717,
18532,
15725,
7874,
20389,
17629,
1028,
7661,
17629,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
7661,
17629,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/URLUtil.java | URLUtil.encodeQuery | public static String encodeQuery(String url, Charset charset) {
if (StrUtil.isEmpty(url)) {
return url;
}
if (null == charset) {
charset = CharsetUtil.defaultCharset();
}
return URLEncoder.QUERY.encode(url, charset);
} | java | public static String encodeQuery(String url, Charset charset) {
if (StrUtil.isEmpty(url)) {
return url;
}
if (null == charset) {
charset = CharsetUtil.defaultCharset();
}
return URLEncoder.QUERY.encode(url, charset);
} | [
"public",
"static",
"String",
"encodeQuery",
"(",
"String",
"url",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isEmpty",
"(",
"url",
")",
")",
"{",
"return",
"url",
";",
"}",
"if",
"(",
"null",
"==",
"charset",
")",
"{",
"charset... | 编码字符为URL中查询语句<br>
将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。<br>
此方法用于POST请求中的请求体自动编码,转义大部分特殊字符
@param url 被编码内容
@param charset 编码
@return 编码后的字符
@since 4.4.1 | [
"编码字符为URL中查询语句<br",
">",
"将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。<br",
">",
"此方法用于POST请求中的请求体自动编码,转义大部分特殊字符"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L295-L303 | train | Encodes the given URL with the given charset. | [
30522,
2270,
10763,
5164,
4372,
16044,
4226,
2854,
1006,
5164,
24471,
2140,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
6633,
13876,
2100,
1006,
24471,
2140,
1007,
1007,
1063,
2709,
24471,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.writeBytes | public static File writeBytes(byte[] data, File dest) throws IORuntimeException {
return writeBytes(data, dest, 0, data.length, false);
} | java | public static File writeBytes(byte[] data, File dest) throws IORuntimeException {
return writeBytes(data, dest, 0, data.length, false);
} | [
"public",
"static",
"File",
"writeBytes",
"(",
"byte",
"[",
"]",
"data",
",",
"File",
"dest",
")",
"throws",
"IORuntimeException",
"{",
"return",
"writeBytes",
"(",
"data",
",",
"dest",
",",
"0",
",",
"data",
".",
"length",
",",
"false",
")",
";",
"}"
... | 写数据到文件中
@param dest 目标文件
@param data 数据
@return 目标文件
@throws IORuntimeException IO异常 | [
"写数据到文件中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3126-L3128 | train | Write the byte array to the destination file. | [
30522,
2270,
10763,
5371,
4339,
3762,
4570,
1006,
24880,
1031,
1033,
2951,
1010,
5371,
4078,
2102,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
4339,
3762,
4570,
1006,
2951,
1010,
4078,
2102,
1010,
1014,
1010,
2951,
1012,
3091... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/DataSinkNode.java | DataSinkNode.computeUnclosedBranchStack | @Override
public void computeUnclosedBranchStack() {
if (this.openBranches != null) {
return;
}
// we need to track open branches even in the sinks, because they get "closed" when
// we build a single "root" for the data flow plan
addClosedBranches(getPredecessorNode().closedBranchingNodes);
this.openBranches = getPredecessorNode().getBranchesForParent(this.input);
} | java | @Override
public void computeUnclosedBranchStack() {
if (this.openBranches != null) {
return;
}
// we need to track open branches even in the sinks, because they get "closed" when
// we build a single "root" for the data flow plan
addClosedBranches(getPredecessorNode().closedBranchingNodes);
this.openBranches = getPredecessorNode().getBranchesForParent(this.input);
} | [
"@",
"Override",
"public",
"void",
"computeUnclosedBranchStack",
"(",
")",
"{",
"if",
"(",
"this",
".",
"openBranches",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"// we need to track open branches even in the sinks, because they get \"closed\" when",
"// we build a single... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/DataSinkNode.java#L163-L173 | train | Compute the unclosed branch stack. | [
30522,
1030,
2058,
15637,
2270,
11675,
24134,
4609,
20464,
24768,
10024,
12680,
9153,
3600,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
2330,
10024,
26091,
2015,
999,
1027,
19701,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
2057,
2342,
2000,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.writeAsCsv | public DataSink<T> writeAsCsv(String filePath, String rowDelimiter, String fieldDelimiter) {
return internalWriteAsCsv(new Path(filePath), rowDelimiter, fieldDelimiter, null);
} | java | public DataSink<T> writeAsCsv(String filePath, String rowDelimiter, String fieldDelimiter) {
return internalWriteAsCsv(new Path(filePath), rowDelimiter, fieldDelimiter, null);
} | [
"public",
"DataSink",
"<",
"T",
">",
"writeAsCsv",
"(",
"String",
"filePath",
",",
"String",
"rowDelimiter",
",",
"String",
"fieldDelimiter",
")",
"{",
"return",
"internalWriteAsCsv",
"(",
"new",
"Path",
"(",
"filePath",
")",
",",
"rowDelimiter",
",",
"fieldDe... | Writes a {@link Tuple} DataSet as CSV file(s) to the specified location with the specified field and line delimiters.
<p><b>Note: Only a Tuple DataSet can written as a CSV file.</b>
<p>For each Tuple field the result of {@link Object#toString()} is written.
@param filePath The path pointing to the location the CSV file is written to.
@param rowDelimiter The row delimiter to separate Tuples.
@param fieldDelimiter The field delimiter to separate Tuple fields.
@see Tuple
@see CsvOutputFormat
@see DataSet#writeAsText(String) Output files and directories | [
"Writes",
"a",
"{",
"@link",
"Tuple",
"}",
"DataSet",
"as",
"CSV",
"file",
"(",
"s",
")",
"to",
"the",
"specified",
"location",
"with",
"the",
"specified",
"field",
"and",
"line",
"delimiters",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1605-L1607 | train | Write data to a file in CSV format. | [
30522,
2270,
2951,
11493,
2243,
1026,
1056,
1028,
4339,
3022,
6169,
2615,
1006,
5164,
5371,
15069,
1010,
5164,
5216,
9247,
27605,
3334,
1010,
5164,
2492,
9247,
27605,
3334,
1007,
1063,
2709,
4722,
26373,
3022,
6169,
2615,
1006,
2047,
4130,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpRequest.java | HttpRequest.isIgnoreResponseBody | private boolean isIgnoreResponseBody() {
if (Method.HEAD == this.method || Method.CONNECT == this.method || Method.OPTIONS == this.method || Method.TRACE == this.method) {
return true;
}
return false;
} | java | private boolean isIgnoreResponseBody() {
if (Method.HEAD == this.method || Method.CONNECT == this.method || Method.OPTIONS == this.method || Method.TRACE == this.method) {
return true;
}
return false;
} | [
"private",
"boolean",
"isIgnoreResponseBody",
"(",
")",
"{",
"if",
"(",
"Method",
".",
"HEAD",
"==",
"this",
".",
"method",
"||",
"Method",
".",
"CONNECT",
"==",
"this",
".",
"method",
"||",
"Method",
".",
"OPTIONS",
"==",
"this",
".",
"method",
"||",
... | 是否忽略读取响应body部分<br>
HEAD、CONNECT、OPTIONS、TRACE方法将不读取响应体
@return 是否需要忽略响应body部分
@since 3.1.2 | [
"是否忽略读取响应body部分<br",
">",
"HEAD、CONNECT、OPTIONS、TRACE方法将不读取响应体"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpRequest.java#L1128-L1133 | train | Returns true if the response body should be ignored. | [
30522,
2797,
22017,
20898,
2003,
23773,
5686,
6072,
26029,
3366,
23684,
1006,
1007,
1063,
2065,
1006,
4118,
1012,
2132,
1027,
1027,
2023,
1012,
4118,
1064,
1064,
4118,
1012,
7532,
1027,
1027,
2023,
1012,
4118,
1064,
1064,
4118,
1012,
7047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ChannelOutboundBuffer.java | ChannelOutboundBuffer.removeBytes | public void removeBytes(long writtenBytes) {
for (;;) {
Object msg = current();
if (!(msg instanceof ByteBuf)) {
assert writtenBytes == 0;
break;
}
final ByteBuf buf = (ByteBuf) msg;
final int readerIndex = buf.readerIndex();
final int readableBytes = buf.writerIndex() - readerIndex;
if (readableBytes <= writtenBytes) {
if (writtenBytes != 0) {
progress(readableBytes);
writtenBytes -= readableBytes;
}
remove();
} else { // readableBytes > writtenBytes
if (writtenBytes != 0) {
buf.readerIndex(readerIndex + (int) writtenBytes);
progress(writtenBytes);
}
break;
}
}
clearNioBuffers();
} | java | public void removeBytes(long writtenBytes) {
for (;;) {
Object msg = current();
if (!(msg instanceof ByteBuf)) {
assert writtenBytes == 0;
break;
}
final ByteBuf buf = (ByteBuf) msg;
final int readerIndex = buf.readerIndex();
final int readableBytes = buf.writerIndex() - readerIndex;
if (readableBytes <= writtenBytes) {
if (writtenBytes != 0) {
progress(readableBytes);
writtenBytes -= readableBytes;
}
remove();
} else { // readableBytes > writtenBytes
if (writtenBytes != 0) {
buf.readerIndex(readerIndex + (int) writtenBytes);
progress(writtenBytes);
}
break;
}
}
clearNioBuffers();
} | [
"public",
"void",
"removeBytes",
"(",
"long",
"writtenBytes",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"Object",
"msg",
"=",
"current",
"(",
")",
";",
"if",
"(",
"!",
"(",
"msg",
"instanceof",
"ByteBuf",
")",
")",
"{",
"assert",
"writtenBytes",
"=="... | Removes the fully written entries and update the reader index of the partially written entry.
This operation assumes all messages in this buffer is {@link ByteBuf}. | [
"Removes",
"the",
"fully",
"written",
"entries",
"and",
"update",
"the",
"reader",
"index",
"of",
"the",
"partially",
"written",
"entry",
".",
"This",
"operation",
"assumes",
"all",
"messages",
"in",
"this",
"buffer",
"is",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/ChannelOutboundBuffer.java#L333-L360 | train | Remove bytes from the buffer. | [
30522,
2270,
11675,
6366,
3762,
4570,
1006,
2146,
2517,
3762,
4570,
1007,
1063,
2005,
1006,
1025,
1025,
1007,
1063,
4874,
5796,
2290,
1027,
2783,
1006,
1007,
1025,
2065,
1006,
999,
1006,
5796,
2290,
6013,
11253,
24880,
8569,
2546,
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-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java | BinaryString.trimRight | public BinaryString trimRight(BinaryString trimStr) {
ensureMaterialized();
if (trimStr == null) {
return null;
}
trimStr.ensureMaterialized();
if (trimStr.isSpaceString()) {
return trimRight();
}
if (inFirstSegment()) {
int charIdx = 0;
int byteIdx = 0;
// each element in charLens is length of character in the source string
int[] charLens = new int[sizeInBytes];
// each element in charStartPos is start position of first byte in the source string
int[] charStartPos = new int[sizeInBytes];
while (byteIdx < sizeInBytes) {
charStartPos[charIdx] = byteIdx;
charLens[charIdx] = numBytesForFirstByte(getByteOneSegment(byteIdx));
byteIdx += charLens[charIdx];
charIdx++;
}
// searchIdx points to the first character which is not in trim string from the right
// end.
int searchIdx = sizeInBytes - 1;
charIdx -= 1;
while (charIdx >= 0) {
BinaryString currentChar = copyBinaryStringInOneSeg(
charStartPos[charIdx],
charStartPos[charIdx] + charLens[charIdx] - 1);
if (trimStr.contains(currentChar)) {
searchIdx -= charLens[charIdx];
} else {
break;
}
charIdx--;
}
if (searchIdx < 0) {
// empty string
return EMPTY_UTF8;
} else {
return copyBinaryStringInOneSeg(0, searchIdx);
}
} else {
return trimRightSlow(trimStr);
}
} | java | public BinaryString trimRight(BinaryString trimStr) {
ensureMaterialized();
if (trimStr == null) {
return null;
}
trimStr.ensureMaterialized();
if (trimStr.isSpaceString()) {
return trimRight();
}
if (inFirstSegment()) {
int charIdx = 0;
int byteIdx = 0;
// each element in charLens is length of character in the source string
int[] charLens = new int[sizeInBytes];
// each element in charStartPos is start position of first byte in the source string
int[] charStartPos = new int[sizeInBytes];
while (byteIdx < sizeInBytes) {
charStartPos[charIdx] = byteIdx;
charLens[charIdx] = numBytesForFirstByte(getByteOneSegment(byteIdx));
byteIdx += charLens[charIdx];
charIdx++;
}
// searchIdx points to the first character which is not in trim string from the right
// end.
int searchIdx = sizeInBytes - 1;
charIdx -= 1;
while (charIdx >= 0) {
BinaryString currentChar = copyBinaryStringInOneSeg(
charStartPos[charIdx],
charStartPos[charIdx] + charLens[charIdx] - 1);
if (trimStr.contains(currentChar)) {
searchIdx -= charLens[charIdx];
} else {
break;
}
charIdx--;
}
if (searchIdx < 0) {
// empty string
return EMPTY_UTF8;
} else {
return copyBinaryStringInOneSeg(0, searchIdx);
}
} else {
return trimRightSlow(trimStr);
}
} | [
"public",
"BinaryString",
"trimRight",
"(",
"BinaryString",
"trimStr",
")",
"{",
"ensureMaterialized",
"(",
")",
";",
"if",
"(",
"trimStr",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"trimStr",
".",
"ensureMaterialized",
"(",
")",
";",
"if",
"(",
... | Walk each character of current string from right end, remove the character if it
is in trim string. Stops at the first character which is not in trim string.
Return the new substring.
@param trimStr the trim string
@return A subString which removes all of the character from the right side that is in
trim string. | [
"Walk",
"each",
"character",
"of",
"current",
"string",
"from",
"right",
"end",
"remove",
"the",
"character",
"if",
"it",
"is",
"in",
"trim",
"string",
".",
"Stops",
"at",
"the",
"first",
"character",
"which",
"is",
"not",
"in",
"trim",
"string",
".",
"R... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L818-L864 | train | Trims the string from the right. | [
30522,
2270,
12441,
3367,
4892,
12241,
15950,
1006,
12441,
3367,
4892,
12241,
3367,
2099,
1007,
1063,
5676,
8585,
14482,
3550,
1006,
1007,
1025,
2065,
1006,
12241,
3367,
2099,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
12241,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.convert | public static void convert(InputStream srcStream, String formatName, OutputStream destStream) {
write(read(srcStream), formatName, getImageOutputStream(destStream));
} | java | public static void convert(InputStream srcStream, String formatName, OutputStream destStream) {
write(read(srcStream), formatName, getImageOutputStream(destStream));
} | [
"public",
"static",
"void",
"convert",
"(",
"InputStream",
"srcStream",
",",
"String",
"formatName",
",",
"OutputStream",
"destStream",
")",
"{",
"write",
"(",
"read",
"(",
"srcStream",
")",
",",
"formatName",
",",
"getImageOutputStream",
"(",
"destStream",
")",... | 图像类型转换:GIF=》JPG、GIF=》PNG、PNG=》JPG、PNG=》GIF(X)、BMP=》PNG<br>
此方法并不关闭流
@param srcStream 源图像流
@param formatName 包含格式非正式名称的 String:如JPG、JPEG、GIF等
@param destStream 目标图像输出流
@since 3.0.9 | [
"图像类型转换:GIF",
"=",
"》JPG、GIF",
"=",
"》PNG、PNG",
"=",
"》JPG、PNG",
"=",
"》GIF",
"(",
"X",
")",
"、BMP",
"=",
"》PNG<br",
">",
"此方法并不关闭流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L521-L523 | train | Convert the image data from the source stream to the destination stream. | [
30522,
2270,
10763,
11675,
10463,
1006,
20407,
25379,
5034,
6169,
25379,
1010,
5164,
4289,
18442,
1010,
27852,
25379,
4078,
3215,
25379,
1007,
1063,
4339,
1006,
3191,
1006,
5034,
6169,
25379,
1007,
1010,
4289,
18442,
1010,
2131,
9581,
3351,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/types/StringValue.java | StringValue.append | @Override
public Appendable append(CharSequence csq, int start, int end) {
final int otherLen = end - start;
grow(this.len + otherLen);
for (int pos = start; pos < end; pos++) {
this.value[this.len + pos] = csq.charAt(pos);
}
this.len += otherLen;
return this;
} | java | @Override
public Appendable append(CharSequence csq, int start, int end) {
final int otherLen = end - start;
grow(this.len + otherLen);
for (int pos = start; pos < end; pos++) {
this.value[this.len + pos] = csq.charAt(pos);
}
this.len += otherLen;
return this;
} | [
"@",
"Override",
"public",
"Appendable",
"append",
"(",
"CharSequence",
"csq",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"final",
"int",
"otherLen",
"=",
"end",
"-",
"start",
";",
"grow",
"(",
"this",
".",
"len",
"+",
"otherLen",
")",
";",
"f... | /*
(non-Javadoc)
@see java.lang.Appendable#append(java.lang.CharSequence, int, int) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/StringValue.java#L441-L450 | train | Append a sequence of characters to this buffer. | [
30522,
1030,
2058,
15637,
2270,
10439,
10497,
3085,
10439,
10497,
1006,
25869,
3366,
4226,
5897,
20116,
4160,
1010,
20014,
2707,
1010,
20014,
2203,
1007,
1063,
2345,
20014,
2060,
7770,
1027,
2203,
1011,
2707,
1025,
4982,
1006,
2023,
1012,
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-http/src/main/java/cn/hutool/http/HttpBase.java | HttpBase.header | public T header(String name, String value) {
return header(name, value, true);
} | java | public T header(String name, String value) {
return header(name, value, true);
} | [
"public",
"T",
"header",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"return",
"header",
"(",
"name",
",",
"value",
",",
"true",
")",
";",
"}"
] | 设置一个header<br>
覆盖模式,则替换之前的值
@param name Header名
@param value Header值
@return T 本身 | [
"设置一个header<br",
">",
"覆盖模式,则替换之前的值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpBase.java#L133-L135 | train | Add a header with the specified name and value. | [
30522,
2270,
1056,
20346,
1006,
5164,
2171,
1010,
5164,
3643,
1007,
1063,
2709,
20346,
1006,
2171,
1010,
3643,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.bindToSpringApplication | protected void bindToSpringApplication(ConfigurableEnvironment environment) {
try {
Binder.get(environment).bind("spring.main", Bindable.ofInstance(this));
}
catch (Exception ex) {
throw new IllegalStateException("Cannot bind to SpringApplication", ex);
}
} | java | protected void bindToSpringApplication(ConfigurableEnvironment environment) {
try {
Binder.get(environment).bind("spring.main", Bindable.ofInstance(this));
}
catch (Exception ex) {
throw new IllegalStateException("Cannot bind to SpringApplication", ex);
}
} | [
"protected",
"void",
"bindToSpringApplication",
"(",
"ConfigurableEnvironment",
"environment",
")",
"{",
"try",
"{",
"Binder",
".",
"get",
"(",
"environment",
")",
".",
"bind",
"(",
"\"spring.main\"",
",",
"Bindable",
".",
"ofInstance",
"(",
"this",
")",
")",
... | Bind the environment to the {@link SpringApplication}.
@param environment the environment to bind | [
"Bind",
"the",
"environment",
"to",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L562-L569 | train | Binds this instance to the Spring Application. | [
30522,
5123,
11675,
14187,
13122,
18098,
28234,
9397,
19341,
3508,
1006,
9530,
8873,
27390,
3085,
2368,
21663,
2239,
3672,
4044,
1007,
1063,
3046,
1063,
14187,
2121,
1012,
2131,
1006,
4044,
1007,
1012,
14187,
1006,
1000,
3500,
1012,
2364,
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/incubator-shardingsphere | sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/ShardingOrchestrationFacade.java | ShardingOrchestrationFacade.init | public void init(final Map<String, Map<String, DataSourceConfiguration>> dataSourceConfigurationMap,
final Map<String, RuleConfiguration> schemaRuleMap, final Authentication authentication, final Properties props) {
for (Entry<String, Map<String, DataSourceConfiguration>> entry : dataSourceConfigurationMap.entrySet()) {
configService.persistConfiguration(entry.getKey(), dataSourceConfigurationMap.get(entry.getKey()), schemaRuleMap.get(entry.getKey()), authentication, props, isOverwrite);
}
stateService.persistInstanceOnline();
stateService.persistDataSourcesNode();
listenerManager.initListeners();
} | java | public void init(final Map<String, Map<String, DataSourceConfiguration>> dataSourceConfigurationMap,
final Map<String, RuleConfiguration> schemaRuleMap, final Authentication authentication, final Properties props) {
for (Entry<String, Map<String, DataSourceConfiguration>> entry : dataSourceConfigurationMap.entrySet()) {
configService.persistConfiguration(entry.getKey(), dataSourceConfigurationMap.get(entry.getKey()), schemaRuleMap.get(entry.getKey()), authentication, props, isOverwrite);
}
stateService.persistInstanceOnline();
stateService.persistDataSourcesNode();
listenerManager.initListeners();
} | [
"public",
"void",
"init",
"(",
"final",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"DataSourceConfiguration",
">",
">",
"dataSourceConfigurationMap",
",",
"final",
"Map",
"<",
"String",
",",
"RuleConfiguration",
">",
"schemaRuleMap",
",",
"final",
"... | Initialize for orchestration.
@param dataSourceConfigurationMap schema data source configuration map
@param schemaRuleMap schema rule map
@param authentication authentication
@param props properties | [
"Initialize",
"for",
"orchestration",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/ShardingOrchestrationFacade.java#L74-L82 | train | Initialize the class. | [
30522,
2270,
11675,
1999,
4183,
1006,
2345,
4949,
1026,
5164,
1010,
4949,
1026,
5164,
1010,
2951,
6499,
3126,
3401,
8663,
8873,
27390,
3370,
1028,
1028,
2951,
6499,
3126,
3401,
8663,
8873,
27390,
3370,
2863,
2361,
1010,
2345,
4949,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.betweenMs | public static long betweenMs(Date beginDate, Date endDate) {
return new DateBetween(beginDate, endDate).between(DateUnit.MS);
} | java | public static long betweenMs(Date beginDate, Date endDate) {
return new DateBetween(beginDate, endDate).between(DateUnit.MS);
} | [
"public",
"static",
"long",
"betweenMs",
"(",
"Date",
"beginDate",
",",
"Date",
"endDate",
")",
"{",
"return",
"new",
"DateBetween",
"(",
"beginDate",
",",
"endDate",
")",
".",
"between",
"(",
"DateUnit",
".",
"MS",
")",
";",
"}"
] | 判断两个日期相差的毫秒数
@param beginDate 起始日期
@param endDate 结束日期
@return 日期差
@since 3.0.1 | [
"判断两个日期相差的毫秒数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1254-L1256 | train | Gets the milliseconds between two dates. | [
30522,
2270,
10763,
2146,
2090,
5244,
1006,
3058,
4088,
13701,
1010,
3058,
2203,
13701,
1007,
1063,
2709,
2047,
3058,
20915,
28394,
2078,
1006,
4088,
13701,
1010,
2203,
13701,
1007,
1012,
2090,
1006,
3058,
19496,
2102,
1012,
5796,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqProperties.java | JooqProperties.determineSqlDialect | public SQLDialect determineSqlDialect(DataSource dataSource) {
if (this.sqlDialect != null) {
return this.sqlDialect;
}
return SqlDialectLookup.getDialect(dataSource);
} | java | public SQLDialect determineSqlDialect(DataSource dataSource) {
if (this.sqlDialect != null) {
return this.sqlDialect;
}
return SqlDialectLookup.getDialect(dataSource);
} | [
"public",
"SQLDialect",
"determineSqlDialect",
"(",
"DataSource",
"dataSource",
")",
"{",
"if",
"(",
"this",
".",
"sqlDialect",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"sqlDialect",
";",
"}",
"return",
"SqlDialectLookup",
".",
"getDialect",
"(",
"dataSo... | Determine the {@link SQLDialect} to use based on this configuration and the primary
{@link DataSource}.
@param dataSource the data source
@return the {@code SQLDialect} to use for that {@link DataSource} | [
"Determine",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqProperties.java#L54-L59 | train | Determine the SQL dialect to use for the given data source. | [
30522,
2270,
29296,
27184,
22471,
16463,
4160,
6392,
4818,
22471,
1006,
2951,
6499,
3126,
3401,
2951,
6499,
3126,
3401,
1007,
1063,
2065,
1006,
2023,
1012,
29296,
27184,
22471,
999,
1027,
19701,
1007,
1063,
2709,
2023,
1012,
29296,
27184,
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-planner/src/main/java/org/apache/flink/table/descriptors/ConnectTableDescriptor.java | ConnectTableDescriptor.registerTableSink | @Override
public void registerTableSink(String name) {
Preconditions.checkNotNull(name);
TableSink<?> tableSink = TableFactoryUtil.findAndCreateTableSink(this);
tableEnv.registerTableSink(name, tableSink);
} | java | @Override
public void registerTableSink(String name) {
Preconditions.checkNotNull(name);
TableSink<?> tableSink = TableFactoryUtil.findAndCreateTableSink(this);
tableEnv.registerTableSink(name, tableSink);
} | [
"@",
"Override",
"public",
"void",
"registerTableSink",
"(",
"String",
"name",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"name",
")",
";",
"TableSink",
"<",
"?",
">",
"tableSink",
"=",
"TableFactoryUtil",
".",
"findAndCreateTableSink",
"(",
"this",
... | Searches for the specified table sink, configures it accordingly, and registers it as
a table under the given name.
@param name table name to be registered in the table environment | [
"Searches",
"for",
"the",
"specified",
"table",
"sink",
"configures",
"it",
"accordingly",
"and",
"registers",
"it",
"as",
"a",
"table",
"under",
"the",
"given",
"name",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/descriptors/ConnectTableDescriptor.java#L70-L75 | train | Registers a table sink. | [
30522,
1030,
2058,
15637,
2270,
30524,
1007,
1025,
7251,
19839,
1026,
1029,
1028,
7251,
19839,
1027,
2795,
21450,
21823,
2140,
1012,
2424,
5685,
16748,
3686,
10880,
11493,
2243,
1006,
2023,
1007,
1025,
2795,
2368,
2615,
1012,
4236,
10880,
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/convert/NumberWordFormater.java | NumberWordFormater.transTwo | private static String transTwo(String s) {
String value = "";
// 判断位数
if (s.length() > 2) {
s = s.substring(0, 2);
} else if (s.length() < 2) {
s = "0" + s;
}
if (s.startsWith("0")) {// 07 - seven 是否小於10
value = parseFirst(s);
} else if (s.startsWith("1")) {// 17 seventeen 是否在10和20之间
value = parseTeen(s);
} else if (s.endsWith("0")) {// 是否在10与100之间的能被10整除的数
value = parseTen(s);
} else {
value = parseTen(s) + " " + parseFirst(s);
}
return value;
} | java | private static String transTwo(String s) {
String value = "";
// 判断位数
if (s.length() > 2) {
s = s.substring(0, 2);
} else if (s.length() < 2) {
s = "0" + s;
}
if (s.startsWith("0")) {// 07 - seven 是否小於10
value = parseFirst(s);
} else if (s.startsWith("1")) {// 17 seventeen 是否在10和20之间
value = parseTeen(s);
} else if (s.endsWith("0")) {// 是否在10与100之间的能被10整除的数
value = parseTen(s);
} else {
value = parseTen(s) + " " + parseFirst(s);
}
return value;
} | [
"private",
"static",
"String",
"transTwo",
"(",
"String",
"s",
")",
"{",
"String",
"value",
"=",
"\"\"",
";",
"// 判断位数\r",
"if",
"(",
"s",
".",
"length",
"(",
")",
">",
"2",
")",
"{",
"s",
"=",
"s",
".",
"substring",
"(",
"0",
",",
"2",
")",
";... | 两位 | [
"两位"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/NumberWordFormater.java#L109-L128 | train | Trans two string. | [
30522,
2797,
10763,
5164,
9099,
2102,
12155,
1006,
5164,
1055,
1007,
1063,
5164,
3643,
1027,
1000,
1000,
1025,
1013,
1013,
100,
100,
100,
100,
2065,
1006,
1055,
1012,
3091,
1006,
1007,
1028,
1016,
1007,
1063,
1055,
1027,
1055,
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... |
netty/netty | handler/src/main/java/io/netty/handler/flow/FlowControlHandler.java | FlowControlHandler.dequeue | private int dequeue(ChannelHandlerContext ctx, int minConsume) {
if (queue != null) {
int consumed = 0;
Object msg;
while ((consumed < minConsume) || config.isAutoRead()) {
msg = queue.poll();
if (msg == null) {
break;
}
++consumed;
ctx.fireChannelRead(msg);
}
// We're firing a completion event every time one (or more)
// messages were consumed and the queue ended up being drained
// to an empty state.
if (queue.isEmpty() && consumed > 0) {
ctx.fireChannelReadComplete();
}
return consumed;
}
return 0;
} | java | private int dequeue(ChannelHandlerContext ctx, int minConsume) {
if (queue != null) {
int consumed = 0;
Object msg;
while ((consumed < minConsume) || config.isAutoRead()) {
msg = queue.poll();
if (msg == null) {
break;
}
++consumed;
ctx.fireChannelRead(msg);
}
// We're firing a completion event every time one (or more)
// messages were consumed and the queue ended up being drained
// to an empty state.
if (queue.isEmpty() && consumed > 0) {
ctx.fireChannelReadComplete();
}
return consumed;
}
return 0;
} | [
"private",
"int",
"dequeue",
"(",
"ChannelHandlerContext",
"ctx",
",",
"int",
"minConsume",
")",
"{",
"if",
"(",
"queue",
"!=",
"null",
")",
"{",
"int",
"consumed",
"=",
"0",
";",
"Object",
"msg",
";",
"while",
"(",
"(",
"consumed",
"<",
"minConsume",
... | Dequeues one or many (or none) messages depending on the channel's auto
reading state and returns the number of messages that were consumed from
the internal queue.
The {@code minConsume} argument is used to force {@code dequeue()} into
consuming that number of messages regardless of the channel's auto
reading configuration.
@see #read(ChannelHandlerContext)
@see #channelRead(ChannelHandlerContext, Object) | [
"Dequeues",
"one",
"or",
"many",
"(",
"or",
"none",
")",
"messages",
"depending",
"on",
"the",
"channel",
"s",
"auto",
"reading",
"state",
"and",
"returns",
"the",
"number",
"of",
"messages",
"that",
"were",
"consumed",
"from",
"the",
"internal",
"queue",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/flow/FlowControlHandler.java#L174-L201 | train | Dequeue messages from the queue. | [
30522,
2797,
20014,
2139,
4226,
5657,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
20014,
8117,
8663,
23545,
1007,
1063,
2065,
1006,
24240,
999,
1027,
19701,
1007,
1063,
20014,
10202,
1027,
1014,
1025,
4874,
5796,
2290,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.joinIgnoreNull | public static <K, V> String joinIgnoreNull(Map<K, V> map, String separator, String keyValueSeparator) {
return join(map, separator, keyValueSeparator, true);
} | java | public static <K, V> String joinIgnoreNull(Map<K, V> map, String separator, String keyValueSeparator) {
return join(map, separator, keyValueSeparator, true);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"String",
"joinIgnoreNull",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"String",
"separator",
",",
"String",
"keyValueSeparator",
")",
"{",
"return",
"join",
"(",
"map",
",",
"separator",
",",
"keyValu... | 将map转成字符串,忽略null的键和值
@param <K> 键类型
@param <V> 值类型
@param map Map
@param separator entry之间的连接符
@param keyValueSeparator kv之间的连接符
@return 连接后的字符串
@since 3.1.1 | [
"将map转成字符串,忽略null的键和值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L442-L444 | train | Joins the given map ignoring null entries. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
5164,
3693,
23773,
5686,
11231,
3363,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
4949,
1010,
5164,
19802,
25879,
2953,
1010,
5164,
3145,
10175,
15808,
13699,
25879,
2953,
1007,
1063,
2709,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java | SqlFunctionUtils.splitIndex | public static String splitIndex(String str, String separator, int index) {
if (index < 0) {
return null;
}
String[] values = StringUtils.splitByWholeSeparatorPreserveAllTokens(str, separator);
if (index >= values.length) {
return null;
} else {
return values[index];
}
} | java | public static String splitIndex(String str, String separator, int index) {
if (index < 0) {
return null;
}
String[] values = StringUtils.splitByWholeSeparatorPreserveAllTokens(str, separator);
if (index >= values.length) {
return null;
} else {
return values[index];
}
} | [
"public",
"static",
"String",
"splitIndex",
"(",
"String",
"str",
",",
"String",
"separator",
",",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"values",
"=",
"StringUtils",
".",
"s... | Split target string with custom separator and pick the index-th(start with 0) result.
@param str target string.
@param separator custom separator.
@param index index of the result which you want.
@return the string at the index of split results. | [
"Split",
"target",
"string",
"with",
"custom",
"separator",
"and",
"pick",
"the",
"index",
"-",
"th",
"(",
"start",
"with",
"0",
")",
"result",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java#L310-L320 | train | Splits the given string by the given separator at the given index. | [
30522,
2270,
10763,
5164,
3975,
22254,
10288,
1006,
5164,
2358,
2099,
1010,
5164,
19802,
25879,
2953,
1010,
20014,
5950,
1007,
1063,
2065,
1006,
5950,
1026,
1014,
1007,
1063,
2709,
19701,
1025,
1065,
5164,
1031,
1033,
5300,
1027,
5164,
2182... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java | DataStream.countWindowAll | public AllWindowedStream<T, GlobalWindow> countWindowAll(long size) {
return windowAll(GlobalWindows.create()).trigger(PurgingTrigger.of(CountTrigger.of(size)));
} | java | public AllWindowedStream<T, GlobalWindow> countWindowAll(long size) {
return windowAll(GlobalWindows.create()).trigger(PurgingTrigger.of(CountTrigger.of(size)));
} | [
"public",
"AllWindowedStream",
"<",
"T",
",",
"GlobalWindow",
">",
"countWindowAll",
"(",
"long",
"size",
")",
"{",
"return",
"windowAll",
"(",
"GlobalWindows",
".",
"create",
"(",
")",
")",
".",
"trigger",
"(",
"PurgingTrigger",
".",
"of",
"(",
"CountTrigge... | Windows this {@code DataStream} into tumbling count windows.
<p>Note: This operation is inherently non-parallel since all elements have to pass through
the same operator instance.
@param size The size of the windows in number of elements. | [
"Windows",
"this",
"{",
"@code",
"DataStream",
"}",
"into",
"tumbling",
"count",
"windows",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L780-L782 | train | Count all windows in the stream. | [
30522,
2270,
2035,
11101,
15096,
21422,
1026,
1056,
1010,
3795,
11101,
5004,
1028,
4175,
11101,
21293,
3363,
1006,
2146,
2946,
1007,
1063,
2709,
3332,
8095,
1006,
3795,
11101,
15568,
1012,
3443,
1006,
1007,
1007,
1012,
9495,
1006,
16405,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/datrie/MutableDoubleArrayTrieInteger.java | MutableDoubleArrayTrieInteger.getEmptySize | public int getEmptySize()
{
int size = 0;
for (int i = 0; i < getBaseArraySize(); i++)
{
if (isEmpty(i))
{
++size;
}
}
return size;
} | java | public int getEmptySize()
{
int size = 0;
for (int i = 0; i < getBaseArraySize(); i++)
{
if (isEmpty(i))
{
++size;
}
}
return size;
} | [
"public",
"int",
"getEmptySize",
"(",
")",
"{",
"int",
"size",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getBaseArraySize",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"i",
")",
")",
"{",
"++",
"size"... | 获取空闲的数组元素个数
@return | [
"获取空闲的数组元素个数"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/datrie/MutableDoubleArrayTrieInteger.java#L919-L930 | train | Get the size of the empty array. | [
30522,
2270,
20014,
2131,
6633,
13876,
7274,
4697,
1006,
1007,
1063,
20014,
2946,
1027,
1014,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
2131,
15058,
2906,
9447,
5332,
4371,
1006,
1007,
1025,
1045,
1009,
1009,
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-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopOutputFormatBase.java | HadoopOutputFormatBase.open | @Override
public void open(int taskNumber, int numTasks) throws IOException {
// enforce sequential open() calls
synchronized (OPEN_MUTEX) {
if (Integer.toString(taskNumber + 1).length() > 6) {
throw new IOException("Task id too large.");
}
this.taskNumber = taskNumber + 1;
// for hadoop 2.2
this.configuration.set("mapreduce.output.basename", "tmp");
TaskAttemptID taskAttemptID = TaskAttemptID.forName("attempt__0000_r_"
+ String.format("%" + (6 - Integer.toString(taskNumber + 1).length()) + "s", " ").replace(" ", "0")
+ Integer.toString(taskNumber + 1)
+ "_0");
this.configuration.set("mapred.task.id", taskAttemptID.toString());
this.configuration.setInt("mapred.task.partition", taskNumber + 1);
// for hadoop 2.2
this.configuration.set("mapreduce.task.attempt.id", taskAttemptID.toString());
this.configuration.setInt("mapreduce.task.partition", taskNumber + 1);
try {
this.context = new TaskAttemptContextImpl(this.configuration, taskAttemptID);
this.outputCommitter = this.mapreduceOutputFormat.getOutputCommitter(this.context);
this.outputCommitter.setupJob(new JobContextImpl(this.configuration, new JobID()));
} catch (Exception e) {
throw new RuntimeException(e);
}
this.context.getCredentials().addAll(this.credentials);
Credentials currentUserCreds = getCredentialsFromUGI(UserGroupInformation.getCurrentUser());
if (currentUserCreds != null) {
this.context.getCredentials().addAll(currentUserCreds);
}
// compatible for hadoop 2.2.0, the temporary output directory is different from hadoop 1.2.1
if (outputCommitter instanceof FileOutputCommitter) {
this.configuration.set("mapreduce.task.output.dir", ((FileOutputCommitter) this.outputCommitter).getWorkPath().toString());
}
try {
this.recordWriter = this.mapreduceOutputFormat.getRecordWriter(this.context);
} catch (InterruptedException e) {
throw new IOException("Could not create RecordWriter.", e);
}
}
} | java | @Override
public void open(int taskNumber, int numTasks) throws IOException {
// enforce sequential open() calls
synchronized (OPEN_MUTEX) {
if (Integer.toString(taskNumber + 1).length() > 6) {
throw new IOException("Task id too large.");
}
this.taskNumber = taskNumber + 1;
// for hadoop 2.2
this.configuration.set("mapreduce.output.basename", "tmp");
TaskAttemptID taskAttemptID = TaskAttemptID.forName("attempt__0000_r_"
+ String.format("%" + (6 - Integer.toString(taskNumber + 1).length()) + "s", " ").replace(" ", "0")
+ Integer.toString(taskNumber + 1)
+ "_0");
this.configuration.set("mapred.task.id", taskAttemptID.toString());
this.configuration.setInt("mapred.task.partition", taskNumber + 1);
// for hadoop 2.2
this.configuration.set("mapreduce.task.attempt.id", taskAttemptID.toString());
this.configuration.setInt("mapreduce.task.partition", taskNumber + 1);
try {
this.context = new TaskAttemptContextImpl(this.configuration, taskAttemptID);
this.outputCommitter = this.mapreduceOutputFormat.getOutputCommitter(this.context);
this.outputCommitter.setupJob(new JobContextImpl(this.configuration, new JobID()));
} catch (Exception e) {
throw new RuntimeException(e);
}
this.context.getCredentials().addAll(this.credentials);
Credentials currentUserCreds = getCredentialsFromUGI(UserGroupInformation.getCurrentUser());
if (currentUserCreds != null) {
this.context.getCredentials().addAll(currentUserCreds);
}
// compatible for hadoop 2.2.0, the temporary output directory is different from hadoop 1.2.1
if (outputCommitter instanceof FileOutputCommitter) {
this.configuration.set("mapreduce.task.output.dir", ((FileOutputCommitter) this.outputCommitter).getWorkPath().toString());
}
try {
this.recordWriter = this.mapreduceOutputFormat.getRecordWriter(this.context);
} catch (InterruptedException e) {
throw new IOException("Could not create RecordWriter.", e);
}
}
} | [
"@",
"Override",
"public",
"void",
"open",
"(",
"int",
"taskNumber",
",",
"int",
"numTasks",
")",
"throws",
"IOException",
"{",
"// enforce sequential open() calls",
"synchronized",
"(",
"OPEN_MUTEX",
")",
"{",
"if",
"(",
"Integer",
".",
"toString",
"(",
"taskNu... | create the temporary output file for hadoop RecordWriter.
@param taskNumber The number of the parallel instance.
@param numTasks The number of parallel tasks.
@throws java.io.IOException | [
"create",
"the",
"temporary",
"output",
"file",
"for",
"hadoop",
"RecordWriter",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopOutputFormatBase.java#L104-L154 | train | This method is called by the TaskManager to open the job. | [
30522,
1030,
2058,
15637,
2270,
11675,
2330,
1006,
20014,
4708,
19172,
5677,
1010,
20014,
16371,
20492,
19895,
2015,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
16306,
25582,
2330,
1006,
1007,
4455,
25549,
1006,
2330,
1035,
20101,
259... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/compiler/NFACompiler.java | NFACompiler.canProduceEmptyMatches | public static boolean canProduceEmptyMatches(final Pattern<?, ?> pattern) {
NFAFactoryCompiler<?> compiler = new NFAFactoryCompiler<>(checkNotNull(pattern));
compiler.compileFactory();
State<?> startState = compiler.getStates().stream().filter(State::isStart).findFirst().orElseThrow(
() -> new IllegalStateException("Compiler produced no start state. It is a bug. File a jira."));
Set<State<?>> visitedStates = new HashSet<>();
final Stack<State<?>> statesToCheck = new Stack<>();
statesToCheck.push(startState);
while (!statesToCheck.isEmpty()) {
final State<?> currentState = statesToCheck.pop();
if (visitedStates.contains(currentState)) {
continue;
} else {
visitedStates.add(currentState);
}
for (StateTransition<?> transition : currentState.getStateTransitions()) {
if (transition.getAction() == StateTransitionAction.PROCEED) {
if (transition.getTargetState().isFinal()) {
return true;
} else {
statesToCheck.push(transition.getTargetState());
}
}
}
}
return false;
} | java | public static boolean canProduceEmptyMatches(final Pattern<?, ?> pattern) {
NFAFactoryCompiler<?> compiler = new NFAFactoryCompiler<>(checkNotNull(pattern));
compiler.compileFactory();
State<?> startState = compiler.getStates().stream().filter(State::isStart).findFirst().orElseThrow(
() -> new IllegalStateException("Compiler produced no start state. It is a bug. File a jira."));
Set<State<?>> visitedStates = new HashSet<>();
final Stack<State<?>> statesToCheck = new Stack<>();
statesToCheck.push(startState);
while (!statesToCheck.isEmpty()) {
final State<?> currentState = statesToCheck.pop();
if (visitedStates.contains(currentState)) {
continue;
} else {
visitedStates.add(currentState);
}
for (StateTransition<?> transition : currentState.getStateTransitions()) {
if (transition.getAction() == StateTransitionAction.PROCEED) {
if (transition.getTargetState().isFinal()) {
return true;
} else {
statesToCheck.push(transition.getTargetState());
}
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"canProduceEmptyMatches",
"(",
"final",
"Pattern",
"<",
"?",
",",
"?",
">",
"pattern",
")",
"{",
"NFAFactoryCompiler",
"<",
"?",
">",
"compiler",
"=",
"new",
"NFAFactoryCompiler",
"<>",
"(",
"checkNotNull",
"(",
"pattern",
")",
... | Verifies if the provided pattern can possibly generate empty match. Example of patterns that can possibly
generate empty matches are: A*, A?, A* B? etc.
@param pattern pattern to check
@return true if empty match could potentially match the pattern, false otherwise | [
"Verifies",
"if",
"the",
"provided",
"pattern",
"can",
"possibly",
"generate",
"empty",
"match",
".",
"Example",
"of",
"patterns",
"that",
"can",
"possibly",
"generate",
"empty",
"matches",
"are",
":",
"A",
"*",
"A?",
"A",
"*",
"B?",
"etc",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/compiler/NFACompiler.java#L89-L118 | train | Checks if the pattern can produce empty matches. | [
30522,
2270,
10763,
22017,
20898,
2064,
21572,
8566,
3401,
6633,
30524,
9006,
22090,
2099,
1026,
1029,
1028,
21624,
1027,
2047,
1050,
7011,
21450,
9006,
22090,
2099,
1026,
1028,
1006,
4638,
17048,
11231,
3363,
1006,
5418,
1007,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostBodyUtil.java | HttpPostBodyUtil.findEndOfString | static int findEndOfString(String sb) {
int result;
for (result = sb.length(); result > 0; result --) {
if (!Character.isWhitespace(sb.charAt(result - 1))) {
break;
}
}
return result;
} | java | static int findEndOfString(String sb) {
int result;
for (result = sb.length(); result > 0; result --) {
if (!Character.isWhitespace(sb.charAt(result - 1))) {
break;
}
}
return result;
} | [
"static",
"int",
"findEndOfString",
"(",
"String",
"sb",
")",
"{",
"int",
"result",
";",
"for",
"(",
"result",
"=",
"sb",
".",
"length",
"(",
")",
";",
"result",
">",
"0",
";",
"result",
"--",
")",
"{",
"if",
"(",
"!",
"Character",
".",
"isWhitespa... | Find the end of String
@return the rank of the end of string | [
"Find",
"the",
"end",
"of",
"String"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostBodyUtil.java#L143-L151 | train | Find the end of string. | [
30522,
10763,
20014,
2424,
10497,
11253,
3367,
4892,
1006,
5164,
24829,
1007,
1063,
20014,
2765,
1025,
2005,
1006,
2765,
1027,
24829,
1012,
3091,
1006,
1007,
1025,
2765,
1028,
1014,
1025,
2765,
1011,
1011,
1007,
1063,
2065,
1006,
999,
2839,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/heap/NestedMapsStateTable.java | NestedMapsStateTable.containsKey | private boolean containsKey(K key, int keyGroupIndex, N namespace) {
checkKeyNamespacePreconditions(key, namespace);
Map<N, Map<K, S>> namespaceMap = getMapForKeyGroup(keyGroupIndex);
if (namespaceMap == null) {
return false;
}
Map<K, S> keyedMap = namespaceMap.get(namespace);
return keyedMap != null && keyedMap.containsKey(key);
} | java | private boolean containsKey(K key, int keyGroupIndex, N namespace) {
checkKeyNamespacePreconditions(key, namespace);
Map<N, Map<K, S>> namespaceMap = getMapForKeyGroup(keyGroupIndex);
if (namespaceMap == null) {
return false;
}
Map<K, S> keyedMap = namespaceMap.get(namespace);
return keyedMap != null && keyedMap.containsKey(key);
} | [
"private",
"boolean",
"containsKey",
"(",
"K",
"key",
",",
"int",
"keyGroupIndex",
",",
"N",
"namespace",
")",
"{",
"checkKeyNamespacePreconditions",
"(",
"key",
",",
"namespace",
")",
";",
"Map",
"<",
"N",
",",
"Map",
"<",
"K",
",",
"S",
">",
">",
"na... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/NestedMapsStateTable.java#L204-L217 | train | Checks if the given key is present in the given namespace. | [
30522,
2797,
22017,
20898,
3397,
14839,
1006,
1047,
3145,
1010,
20014,
3145,
17058,
22254,
10288,
1010,
1050,
3415,
15327,
1007,
1063,
4638,
14839,
18442,
23058,
28139,
8663,
20562,
2015,
1006,
3145,
1010,
3415,
15327,
1007,
1025,
4949,
1026,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/sampling/DistributedRandomSampler.java | DistributedRandomSampler.sampleInCoordinator | public Iterator<T> sampleInCoordinator(Iterator<IntermediateSampleData<T>> input) {
if (numSamples == 0) {
return emptyIterable;
}
// This queue holds fixed number elements with the top K weight for the coordinator.
PriorityQueue<IntermediateSampleData<T>> reservoir = new PriorityQueue<IntermediateSampleData<T>>(numSamples);
int index = 0;
IntermediateSampleData<T> smallest = null;
while (input.hasNext()) {
IntermediateSampleData<T> element = input.next();
if (index < numSamples) {
// Fill the queue with first K elements from input.
reservoir.add(element);
smallest = reservoir.peek();
} else {
// If current element weight is larger than the smallest one in queue, remove the element
// with the smallest weight, and append current element into the queue.
if (element.getWeight() > smallest.getWeight()) {
reservoir.remove();
reservoir.add(element);
smallest = reservoir.peek();
}
}
index++;
}
final Iterator<IntermediateSampleData<T>> itr = reservoir.iterator();
return new Iterator<T>() {
@Override
public boolean hasNext() {
return itr.hasNext();
}
@Override
public T next() {
return itr.next().getElement();
}
@Override
public void remove() {
itr.remove();
}
};
} | java | public Iterator<T> sampleInCoordinator(Iterator<IntermediateSampleData<T>> input) {
if (numSamples == 0) {
return emptyIterable;
}
// This queue holds fixed number elements with the top K weight for the coordinator.
PriorityQueue<IntermediateSampleData<T>> reservoir = new PriorityQueue<IntermediateSampleData<T>>(numSamples);
int index = 0;
IntermediateSampleData<T> smallest = null;
while (input.hasNext()) {
IntermediateSampleData<T> element = input.next();
if (index < numSamples) {
// Fill the queue with first K elements from input.
reservoir.add(element);
smallest = reservoir.peek();
} else {
// If current element weight is larger than the smallest one in queue, remove the element
// with the smallest weight, and append current element into the queue.
if (element.getWeight() > smallest.getWeight()) {
reservoir.remove();
reservoir.add(element);
smallest = reservoir.peek();
}
}
index++;
}
final Iterator<IntermediateSampleData<T>> itr = reservoir.iterator();
return new Iterator<T>() {
@Override
public boolean hasNext() {
return itr.hasNext();
}
@Override
public T next() {
return itr.next().getElement();
}
@Override
public void remove() {
itr.remove();
}
};
} | [
"public",
"Iterator",
"<",
"T",
">",
"sampleInCoordinator",
"(",
"Iterator",
"<",
"IntermediateSampleData",
"<",
"T",
">",
">",
"input",
")",
"{",
"if",
"(",
"numSamples",
"==",
"0",
")",
"{",
"return",
"emptyIterable",
";",
"}",
"// This queue holds fixed num... | Sample algorithm for the second phase. This operation should be executed as the UDF of
an all reduce operation.
@param input The intermediate sample output generated in the first phase.
@return The sampled output. | [
"Sample",
"algorithm",
"for",
"the",
"second",
"phase",
".",
"This",
"operation",
"should",
"be",
"executed",
"as",
"the",
"UDF",
"of",
"an",
"all",
"reduce",
"operation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/sampling/DistributedRandomSampler.java#L73-L117 | train | Samples the elements in the input iterator in the coordinator. | [
30522,
2270,
2009,
6906,
4263,
1026,
1056,
1028,
7099,
2378,
3597,
8551,
23207,
1006,
2009,
6906,
4263,
1026,
7783,
21559,
21132,
6790,
1026,
1056,
1028,
1028,
7953,
1007,
1063,
2065,
1006,
16371,
5244,
16613,
4244,
1027,
1027,
1014,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationUtil.java | AnnotationUtil.getAnnotationValueMap | public static Map<String, Object> getAnnotationValueMap(AnnotatedElement annotationEle, Class<? extends Annotation> annotationType) throws UtilException {
final Annotation annotation = getAnnotation(annotationEle, annotationType);
if (null == annotation) {
return null;
}
final Method[] methods = ReflectUtil.getMethods(annotationType, new Filter<Method>() {
@Override
public boolean accept(Method t) {
if (ArrayUtil.isEmpty(t.getParameterTypes())) {
// 只读取无参方法
final String name = t.getName();
if ("hashCode".equals(name) || "toString".equals(name) || "annotationType".equals(name)) {
// 跳过自有的几个方法
return false;
}
return true;
}
return false;
}
});
final HashMap<String, Object> result = new HashMap<>(methods.length, 1);
for (Method method : methods) {
result.put(method.getName(), ReflectUtil.invoke(annotation, method));
}
return result;
} | java | public static Map<String, Object> getAnnotationValueMap(AnnotatedElement annotationEle, Class<? extends Annotation> annotationType) throws UtilException {
final Annotation annotation = getAnnotation(annotationEle, annotationType);
if (null == annotation) {
return null;
}
final Method[] methods = ReflectUtil.getMethods(annotationType, new Filter<Method>() {
@Override
public boolean accept(Method t) {
if (ArrayUtil.isEmpty(t.getParameterTypes())) {
// 只读取无参方法
final String name = t.getName();
if ("hashCode".equals(name) || "toString".equals(name) || "annotationType".equals(name)) {
// 跳过自有的几个方法
return false;
}
return true;
}
return false;
}
});
final HashMap<String, Object> result = new HashMap<>(methods.length, 1);
for (Method method : methods) {
result.put(method.getName(), ReflectUtil.invoke(annotation, method));
}
return result;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"getAnnotationValueMap",
"(",
"AnnotatedElement",
"annotationEle",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
")",
"throws",
"UtilException",
"{",
"final",
"Annotation",
"an... | 获取指定注解中所有属性值<br>
如果无指定的属性方法返回null
@param annotationEle {@link AnnotatedElement},可以是Class、Method、Field、Constructor、ReflectPermission
@param annotationType 注解类型
@return 注解对象
@throws UtilException 调用注解中的方法时执行异常 | [
"获取指定注解中所有属性值<br",
">",
"如果无指定的属性方法返回null"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationUtil.java#L112-L139 | train | Gets the value of the annotation from the given annotated element. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
4874,
1028,
2131,
11639,
17287,
3508,
10175,
5657,
2863,
2361,
1006,
5754,
17287,
3064,
12260,
3672,
5754,
17287,
3508,
12260,
1010,
2465,
1026,
1029,
8908,
5754,
17287,
3508,
1028,
5754,
17287,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/codec/Morse.java | Morse.decode | public String decode(String morse) {
Assert.notNull(morse, "Morse should not be null.");
final char dit = this.dit;
final char dah = this.dah;
final char split = this.split;
if (false == StrUtil.containsOnly(morse, dit, dah, split)) {
throw new IllegalArgumentException("Incorrect morse.");
}
final List<String> words = StrUtil.split(morse, split);
final StringBuilder textBuilder = new StringBuilder();
Integer codePoint;
for (String word : words) {
if(StrUtil.isEmpty(word)){
continue;
}
word = word.replace(dit, '0').replace(dah, '1');
codePoint = dictionaries.get(word);
if (codePoint == null) {
codePoint = Integer.valueOf(word, 2);
}
textBuilder.appendCodePoint(codePoint);
}
return textBuilder.toString();
} | java | public String decode(String morse) {
Assert.notNull(morse, "Morse should not be null.");
final char dit = this.dit;
final char dah = this.dah;
final char split = this.split;
if (false == StrUtil.containsOnly(morse, dit, dah, split)) {
throw new IllegalArgumentException("Incorrect morse.");
}
final List<String> words = StrUtil.split(morse, split);
final StringBuilder textBuilder = new StringBuilder();
Integer codePoint;
for (String word : words) {
if(StrUtil.isEmpty(word)){
continue;
}
word = word.replace(dit, '0').replace(dah, '1');
codePoint = dictionaries.get(word);
if (codePoint == null) {
codePoint = Integer.valueOf(word, 2);
}
textBuilder.appendCodePoint(codePoint);
}
return textBuilder.toString();
} | [
"public",
"String",
"decode",
"(",
"String",
"morse",
")",
"{",
"Assert",
".",
"notNull",
"(",
"morse",
",",
"\"Morse should not be null.\"",
")",
";",
"final",
"char",
"dit",
"=",
"this",
".",
"dit",
";",
"final",
"char",
"dah",
"=",
"this",
".",
"dah",... | 解码
@param morse 莫尔斯电码
@return 明文 | [
"解码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/Morse.java#L147-L171 | train | Decodes a string from UTF - 8. | [
30522,
2270,
5164,
21933,
3207,
1006,
5164,
17107,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
17107,
1010,
1000,
17107,
2323,
2025,
2022,
19701,
1012,
1000,
1007,
1025,
2345,
25869,
4487,
2102,
1027,
2023,
1012,
4487,
2102,
1025,
234... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/DirectLogFetcher.java | DirectLogFetcher.putInt32 | protected final void putInt32(long i32) {
ensureCapacity(position + 4);
byte[] buf = buffer;
buf[position++] = (byte) (i32 & 0xff);
buf[position++] = (byte) (i32 >>> 8);
buf[position++] = (byte) (i32 >>> 16);
buf[position++] = (byte) (i32 >>> 24);
} | java | protected final void putInt32(long i32) {
ensureCapacity(position + 4);
byte[] buf = buffer;
buf[position++] = (byte) (i32 & 0xff);
buf[position++] = (byte) (i32 >>> 8);
buf[position++] = (byte) (i32 >>> 16);
buf[position++] = (byte) (i32 >>> 24);
} | [
"protected",
"final",
"void",
"putInt32",
"(",
"long",
"i32",
")",
"{",
"ensureCapacity",
"(",
"position",
"+",
"4",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"buffer",
";",
"buf",
"[",
"position",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"i32",
"&",
... | Put 32-bit integer in the buffer.
@param i32 the integer to put in the buffer | [
"Put",
"32",
"-",
"bit",
"integer",
"in",
"the",
"buffer",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/DirectLogFetcher.java#L229-L237 | train | Puts the 32 - bit integer into the buffer. | [
30522,
5123,
2345,
11675,
22072,
2102,
16703,
1006,
2146,
1045,
16703,
1007,
1063,
5676,
17695,
6305,
3012,
1006,
2597,
1009,
1018,
1007,
1025,
24880,
1031,
1033,
20934,
2546,
1027,
17698,
1025,
20934,
2546,
1031,
2597,
1009,
1009,
1033,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java | IOUtil.loadDictionary | public static TreeMap<String, CoreDictionary.Attribute> loadDictionary(String... pathArray) throws IOException
{
TreeMap<String, CoreDictionary.Attribute> map = new TreeMap<String, CoreDictionary.Attribute>();
for (String path : pathArray)
{
File file = new File(path);
String fileName = file.getName();
int natureIndex = fileName.lastIndexOf(' ');
Nature defaultNature = Nature.n;
if (natureIndex > 0)
{
String natureString = fileName.substring(natureIndex + 1);
path = file.getParent() + File.separator + fileName.substring(0, natureIndex);
if (natureString.length() > 0 && !natureString.endsWith(".txt") && !natureString.endsWith(".csv"))
{
defaultNature = Nature.create(natureString);
}
}
BufferedReader br = new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8"));
loadDictionary(br, map, path.endsWith(".csv"), defaultNature);
}
return map;
} | java | public static TreeMap<String, CoreDictionary.Attribute> loadDictionary(String... pathArray) throws IOException
{
TreeMap<String, CoreDictionary.Attribute> map = new TreeMap<String, CoreDictionary.Attribute>();
for (String path : pathArray)
{
File file = new File(path);
String fileName = file.getName();
int natureIndex = fileName.lastIndexOf(' ');
Nature defaultNature = Nature.n;
if (natureIndex > 0)
{
String natureString = fileName.substring(natureIndex + 1);
path = file.getParent() + File.separator + fileName.substring(0, natureIndex);
if (natureString.length() > 0 && !natureString.endsWith(".txt") && !natureString.endsWith(".csv"))
{
defaultNature = Nature.create(natureString);
}
}
BufferedReader br = new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8"));
loadDictionary(br, map, path.endsWith(".csv"), defaultNature);
}
return map;
} | [
"public",
"static",
"TreeMap",
"<",
"String",
",",
"CoreDictionary",
".",
"Attribute",
">",
"loadDictionary",
"(",
"String",
"...",
"pathArray",
")",
"throws",
"IOException",
"{",
"TreeMap",
"<",
"String",
",",
"CoreDictionary",
".",
"Attribute",
">",
"map",
"... | 加载词典,词典必须遵守HanLP核心词典格式
@param pathArray 词典路径,可以有任意个。每个路径支持用空格表示默认词性,比如“全国地名大全.txt ns”
@return 一个储存了词条的map
@throws IOException 异常表示加载失败 | [
"加载词典,词典必须遵守HanLP核心词典格式"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java#L674-L697 | train | Load a list of CoreDictionary. Attribute objects from a file array. | [
30522,
2270,
10763,
3392,
2863,
2361,
1026,
5164,
1010,
4563,
29201,
3258,
5649,
1012,
17961,
1028,
7170,
29201,
3258,
5649,
1006,
5164,
1012,
1012,
1012,
4130,
2906,
9447,
1007,
11618,
22834,
10288,
24422,
1063,
3392,
2863,
2361,
1026,
516... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Entity.java | Entity.addFieldNames | public Entity addFieldNames(String... fieldNames) {
if (ArrayUtil.isNotEmpty(fieldNames)) {
if (null == this.fieldNames) {
return setFieldNames(fieldNames);
} else {
for (String fieldName : fieldNames) {
this.fieldNames.add(fieldName);
}
}
}
return this;
} | java | public Entity addFieldNames(String... fieldNames) {
if (ArrayUtil.isNotEmpty(fieldNames)) {
if (null == this.fieldNames) {
return setFieldNames(fieldNames);
} else {
for (String fieldName : fieldNames) {
this.fieldNames.add(fieldName);
}
}
}
return this;
} | [
"public",
"Entity",
"addFieldNames",
"(",
"String",
"...",
"fieldNames",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isNotEmpty",
"(",
"fieldNames",
")",
")",
"{",
"if",
"(",
"null",
"==",
"this",
".",
"fieldNames",
")",
"{",
"return",
"setFieldNames",
"(",
... | 添加字段列表
@param fieldNames 字段列表
@return 自身 | [
"添加字段列表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Entity.java#L171-L182 | train | Adds the given field names to the entity. | [
30522,
2270,
9178,
5587,
3790,
18442,
2015,
1006,
5164,
1012,
1012,
1012,
2492,
18442,
2015,
1007,
1063,
2065,
1006,
9140,
21823,
2140,
1012,
3475,
12184,
27718,
2100,
1006,
2492,
18442,
2015,
1007,
1007,
1063,
2065,
1006,
19701,
1027,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java | HashCodeBuilder.reflectionAppend | private static void reflectionAppend(final Object object, final Class<?> clazz, final HashCodeBuilder builder, final boolean useTransients,
final String[] excludeFields) {
if (isRegistered(object)) {
return;
}
try {
register(object);
final Field[] fields = clazz.getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
for (final Field field : fields) {
if (false == ArrayUtil.contains(excludeFields, field.getName())
&& (field.getName().indexOf('$') == -1)
&& (useTransients || !Modifier.isTransient(field.getModifiers()))
&& (!Modifier.isStatic(field.getModifiers()))) {
try {
final Object fieldValue = field.get(object);
builder.append(fieldValue);
} catch (final IllegalAccessException e) {
// this can't happen. Would get a Security exception instead
// throw a runtime exception in case the impossible happens.
throw new InternalError("Unexpected IllegalAccessException");
}
}
}
} finally {
unregister(object);
}
} | java | private static void reflectionAppend(final Object object, final Class<?> clazz, final HashCodeBuilder builder, final boolean useTransients,
final String[] excludeFields) {
if (isRegistered(object)) {
return;
}
try {
register(object);
final Field[] fields = clazz.getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
for (final Field field : fields) {
if (false == ArrayUtil.contains(excludeFields, field.getName())
&& (field.getName().indexOf('$') == -1)
&& (useTransients || !Modifier.isTransient(field.getModifiers()))
&& (!Modifier.isStatic(field.getModifiers()))) {
try {
final Object fieldValue = field.get(object);
builder.append(fieldValue);
} catch (final IllegalAccessException e) {
// this can't happen. Would get a Security exception instead
// throw a runtime exception in case the impossible happens.
throw new InternalError("Unexpected IllegalAccessException");
}
}
}
} finally {
unregister(object);
}
} | [
"private",
"static",
"void",
"reflectionAppend",
"(",
"final",
"Object",
"object",
",",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"HashCodeBuilder",
"builder",
",",
"final",
"boolean",
"useTransients",
",",
"final",
"String",
"[",
"]",
"excludeFi... | <p>
Appends the fields and values defined by the given object of the given <code>Class</code>.
</p>
@param object
the object to append details of
@param clazz
the class to append details of
@param builder
the builder to append to
@param useTransients
whether to use transient fields
@param excludeFields
Collection of String field names to exclude from use in calculation of hash code | [
"<p",
">",
"Appends",
"the",
"fields",
"and",
"values",
"defined",
"by",
"the",
"given",
"object",
"of",
"the",
"given",
"<code",
">",
"Class<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java#L167-L194 | train | Append the object to the HashCodeBuilder. | [
30522,
2797,
10763,
11675,
9185,
29098,
10497,
1006,
2345,
4874,
4874,
1010,
2345,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
2345,
23325,
16044,
8569,
23891,
2099,
12508,
1010,
2345,
22017,
20898,
2224,
6494,
3619,
11638,
2015,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-merge/src/main/java/org/apache/shardingsphere/core/merge/dql/common/MemoryQueryResultRow.java | MemoryQueryResultRow.getCell | public Object getCell(final int columnIndex) {
Preconditions.checkArgument(columnIndex > 0 && columnIndex < data.length + 1);
return data[columnIndex - 1];
} | java | public Object getCell(final int columnIndex) {
Preconditions.checkArgument(columnIndex > 0 && columnIndex < data.length + 1);
return data[columnIndex - 1];
} | [
"public",
"Object",
"getCell",
"(",
"final",
"int",
"columnIndex",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"columnIndex",
">",
"0",
"&&",
"columnIndex",
"<",
"data",
".",
"length",
"+",
"1",
")",
";",
"return",
"data",
"[",
"columnIndex",
"-"... | Get data from cell.
@param columnIndex column index
@return data from cell | [
"Get",
"data",
"from",
"cell",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-merge/src/main/java/org/apache/shardingsphere/core/merge/dql/common/MemoryQueryResultRow.java#L53-L56 | train | Gets the cell at the specified column index. | [
30522,
2270,
4874,
2131,
29109,
2140,
1006,
2345,
20014,
5930,
22254,
10288,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
5930,
22254,
10288,
1028,
1014,
1004,
1004,
5930,
22254,
10288,
1026,
2951,
1012,
3091,
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/math/Arrangement.java | Arrangement.select | public List<String[]> select(int m) {
final List<String[]> result = new ArrayList<>((int) count(this.datas.length, m));
select(new String[m], 0, result);
return result;
} | java | public List<String[]> select(int m) {
final List<String[]> result = new ArrayList<>((int) count(this.datas.length, m));
select(new String[m], 0, result);
return result;
} | [
"public",
"List",
"<",
"String",
"[",
"]",
">",
"select",
"(",
"int",
"m",
")",
"{",
"final",
"List",
"<",
"String",
"[",
"]",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
"(",
"int",
")",
"count",
"(",
"this",
".",
"datas",
".",
"length",
... | 排列选择(从列表中选择m个排列)
@param m 选择个数
@return 所有排列列表 | [
"排列选择(从列表中选择m个排列)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/math/Arrangement.java#L81-L85 | train | Select m elements from the list of datas. | [
30522,
2270,
2862,
1026,
5164,
1031,
1033,
1028,
7276,
1006,
20014,
1049,
1007,
1063,
2345,
2862,
1026,
5164,
1031,
1033,
1028,
2765,
1027,
30524,
1049,
1033,
1010,
1014,
1010,
2765,
1007,
1025,
2709,
2765,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/traffic/GlobalChannelTrafficShapingHandler.java | GlobalChannelTrafficShapingHandler.channelTrafficCounters | public Collection<TrafficCounter> channelTrafficCounters() {
return new AbstractCollection<TrafficCounter>() {
@Override
public Iterator<TrafficCounter> iterator() {
return new Iterator<TrafficCounter>() {
final Iterator<PerChannel> iter = channelQueues.values().iterator();
@Override
public boolean hasNext() {
return iter.hasNext();
}
@Override
public TrafficCounter next() {
return iter.next().channelTrafficCounter;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
@Override
public int size() {
return channelQueues.size();
}
};
} | java | public Collection<TrafficCounter> channelTrafficCounters() {
return new AbstractCollection<TrafficCounter>() {
@Override
public Iterator<TrafficCounter> iterator() {
return new Iterator<TrafficCounter>() {
final Iterator<PerChannel> iter = channelQueues.values().iterator();
@Override
public boolean hasNext() {
return iter.hasNext();
}
@Override
public TrafficCounter next() {
return iter.next().channelTrafficCounter;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
@Override
public int size() {
return channelQueues.size();
}
};
} | [
"public",
"Collection",
"<",
"TrafficCounter",
">",
"channelTrafficCounters",
"(",
")",
"{",
"return",
"new",
"AbstractCollection",
"<",
"TrafficCounter",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iterator",
"<",
"TrafficCounter",
">",
"iterator",
"(",
")"... | To allow for instance doAccounting to use the TrafficCounter per channel.
@return the list of TrafficCounters that exists at the time of the call. | [
"To",
"allow",
"for",
"instance",
"doAccounting",
"to",
"use",
"the",
"TrafficCounter",
"per",
"channel",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/GlobalChannelTrafficShapingHandler.java#L626-L651 | train | Returns a collection of traffic counters for all channels. | [
30522,
2270,
3074,
1026,
4026,
3597,
16671,
2121,
1028,
3149,
6494,
26989,
21408,
16671,
2545,
1006,
1007,
1063,
2709,
2047,
10061,
26895,
18491,
1026,
4026,
3597,
16671,
2121,
1028,
1006,
1007,
1063,
1030,
2058,
15637,
2270,
2009,
6906,
42... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/DomainNameMapping.java | DomainNameMapping.normalizeHostname | static String normalizeHostname(String hostname) {
if (needsNormalization(hostname)) {
hostname = IDN.toASCII(hostname, IDN.ALLOW_UNASSIGNED);
}
return hostname.toLowerCase(Locale.US);
} | java | static String normalizeHostname(String hostname) {
if (needsNormalization(hostname)) {
hostname = IDN.toASCII(hostname, IDN.ALLOW_UNASSIGNED);
}
return hostname.toLowerCase(Locale.US);
} | [
"static",
"String",
"normalizeHostname",
"(",
"String",
"hostname",
")",
"{",
"if",
"(",
"needsNormalization",
"(",
"hostname",
")",
")",
"{",
"hostname",
"=",
"IDN",
".",
"toASCII",
"(",
"hostname",
",",
"IDN",
".",
"ALLOW_UNASSIGNED",
")",
";",
"}",
"ret... | IDNA ASCII conversion and case normalization | [
"IDNA",
"ASCII",
"conversion",
"and",
"case",
"normalization"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/DomainNameMapping.java#L107-L112 | train | Normalize a hostname. | [
30522,
10763,
5164,
3671,
4697,
15006,
2102,
18442,
1006,
5164,
3677,
18442,
1007,
1063,
2065,
1006,
3791,
12131,
9067,
3989,
1006,
3677,
18442,
1007,
1007,
1063,
3677,
18442,
1027,
8909,
2078,
1012,
2000,
3022,
6895,
2072,
1006,
3677,
1844... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/LiveReloadServer.java | LiveReloadServer.triggerReload | public void triggerReload() {
synchronized (this.monitor) {
synchronized (this.connections) {
for (Connection connection : this.connections) {
try {
connection.triggerReload();
}
catch (Exception ex) {
logger.debug("Unable to send reload message", ex);
}
}
}
}
} | java | public void triggerReload() {
synchronized (this.monitor) {
synchronized (this.connections) {
for (Connection connection : this.connections) {
try {
connection.triggerReload();
}
catch (Exception ex) {
logger.debug("Unable to send reload message", ex);
}
}
}
}
} | [
"public",
"void",
"triggerReload",
"(",
")",
"{",
"synchronized",
"(",
"this",
".",
"monitor",
")",
"{",
"synchronized",
"(",
"this",
".",
"connections",
")",
"{",
"for",
"(",
"Connection",
"connection",
":",
"this",
".",
"connections",
")",
"{",
"try",
... | Trigger livereload of all connected clients. | [
"Trigger",
"livereload",
"of",
"all",
"connected",
"clients",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/LiveReloadServer.java#L201-L214 | train | Trigger a reload event. | [
30522,
2270,
11675,
9495,
16570,
10441,
2094,
1006,
1007,
1063,
25549,
1006,
2023,
1012,
8080,
1007,
1063,
25549,
1006,
2023,
1012,
7264,
1007,
1063,
2005,
1006,
4434,
4434,
1024,
2023,
1012,
7264,
1007,
1063,
3046,
1063,
4434,
1012,
9495,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | instance/core/src/main/java/com/alibaba/otter/canal/instance/core/AbstractCanalInstance.java | AbstractCanalInstance.subscribeChange | @Override
public boolean subscribeChange(ClientIdentity identity) {
if (StringUtils.isNotEmpty(identity.getFilter())) {
logger.info("subscribe filter change to " + identity.getFilter());
AviaterRegexFilter aviaterFilter = new AviaterRegexFilter(identity.getFilter());
boolean isGroup = (eventParser instanceof GroupEventParser);
if (isGroup) {
// 处理group的模式
List<CanalEventParser> eventParsers = ((GroupEventParser) eventParser).getEventParsers();
for (CanalEventParser singleEventParser : eventParsers) {// 需要遍历启动
((AbstractEventParser) singleEventParser).setEventFilter(aviaterFilter);
}
} else {
((AbstractEventParser) eventParser).setEventFilter(aviaterFilter);
}
}
// filter的处理规则
// a. parser处理数据过滤处理
// b. sink处理数据的路由&分发,一份parse数据经过sink后可以分发为多份,每份的数据可以根据自己的过滤规则不同而有不同的数据
// 后续内存版的一对多分发,可以考虑
return true;
} | java | @Override
public boolean subscribeChange(ClientIdentity identity) {
if (StringUtils.isNotEmpty(identity.getFilter())) {
logger.info("subscribe filter change to " + identity.getFilter());
AviaterRegexFilter aviaterFilter = new AviaterRegexFilter(identity.getFilter());
boolean isGroup = (eventParser instanceof GroupEventParser);
if (isGroup) {
// 处理group的模式
List<CanalEventParser> eventParsers = ((GroupEventParser) eventParser).getEventParsers();
for (CanalEventParser singleEventParser : eventParsers) {// 需要遍历启动
((AbstractEventParser) singleEventParser).setEventFilter(aviaterFilter);
}
} else {
((AbstractEventParser) eventParser).setEventFilter(aviaterFilter);
}
}
// filter的处理规则
// a. parser处理数据过滤处理
// b. sink处理数据的路由&分发,一份parse数据经过sink后可以分发为多份,每份的数据可以根据自己的过滤规则不同而有不同的数据
// 后续内存版的一对多分发,可以考虑
return true;
} | [
"@",
"Override",
"public",
"boolean",
"subscribeChange",
"(",
"ClientIdentity",
"identity",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"identity",
".",
"getFilter",
"(",
")",
")",
")",
"{",
"logger",
".",
"info",
"(",
"\"subscribe filter chang... | mq的配置 | [
"mq的配置"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/instance/core/src/main/java/com/alibaba/otter/canal/instance/core/AbstractCanalInstance.java#L45-L69 | train | subscribeChange is called to subscribe to a change to a CBE event. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
4942,
29234,
22305,
2063,
1006,
7396,
5178,
16778,
3723,
4767,
1007,
1063,
2065,
1006,
5164,
21823,
4877,
1012,
3475,
12184,
27718,
2100,
1006,
4767,
1012,
2131,
8873,
21928,
1006,
1007,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java | WebSocketClientHandshaker.handshake | public ChannelFuture handshake(Channel channel) {
if (channel == null) {
throw new NullPointerException("channel");
}
return handshake(channel, channel.newPromise());
} | java | public ChannelFuture handshake(Channel channel) {
if (channel == null) {
throw new NullPointerException("channel");
}
return handshake(channel, channel.newPromise());
} | [
"public",
"ChannelFuture",
"handshake",
"(",
"Channel",
"channel",
")",
"{",
"if",
"(",
"channel",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"channel\"",
")",
";",
"}",
"return",
"handshake",
"(",
"channel",
",",
"channel",
".",
... | Begins the opening handshake
@param channel
Channel | [
"Begins",
"the",
"opening",
"handshake"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java#L209-L214 | train | Handshake the channel. | [
30522,
2270,
3149,
11263,
11244,
2398,
20459,
2063,
1006,
3149,
3149,
1007,
1063,
2065,
1006,
3149,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
3149,
1000,
1007,
1025,
1065,
2709,
2398,
20459,
2063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/instance/Instance.java | Instance.allocateSharedSlot | public SharedSlot allocateSharedSlot(SlotSharingGroupAssignment sharingGroupAssignment)
throws InstanceDiedException {
synchronized (instanceLock) {
if (isDead) {
throw new InstanceDiedException(this);
}
Integer nextSlot = availableSlots.poll();
if (nextSlot == null) {
return null;
}
else {
SharedSlot slot = new SharedSlot(
this,
location,
nextSlot,
taskManagerGateway,
sharingGroupAssignment);
allocatedSlots.add(slot);
return slot;
}
}
} | java | public SharedSlot allocateSharedSlot(SlotSharingGroupAssignment sharingGroupAssignment)
throws InstanceDiedException {
synchronized (instanceLock) {
if (isDead) {
throw new InstanceDiedException(this);
}
Integer nextSlot = availableSlots.poll();
if (nextSlot == null) {
return null;
}
else {
SharedSlot slot = new SharedSlot(
this,
location,
nextSlot,
taskManagerGateway,
sharingGroupAssignment);
allocatedSlots.add(slot);
return slot;
}
}
} | [
"public",
"SharedSlot",
"allocateSharedSlot",
"(",
"SlotSharingGroupAssignment",
"sharingGroupAssignment",
")",
"throws",
"InstanceDiedException",
"{",
"synchronized",
"(",
"instanceLock",
")",
"{",
"if",
"(",
"isDead",
")",
"{",
"throw",
"new",
"InstanceDiedException",
... | Allocates a shared slot on this TaskManager instance. This method returns {@code null}, if no slot
is available at the moment. The shared slot will be managed by the given SlotSharingGroupAssignment.
@param sharingGroupAssignment The assignment group that manages this shared slot.
@return A shared slot that represents a task slot on this TaskManager instance and can hold other
(shared) slots, or null, if the TaskManager instance has no more slots available.
@throws InstanceDiedException Thrown if the instance is no longer alive by the time the slot is allocated. | [
"Allocates",
"a",
"shared",
"slot",
"on",
"this",
"TaskManager",
"instance",
".",
"This",
"method",
"returns",
"{",
"@code",
"null",
"}",
"if",
"no",
"slot",
"is",
"available",
"at",
"the",
"moment",
".",
"The",
"shared",
"slot",
"will",
"be",
"managed",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/Instance.java#L249-L272 | train | Allocate a SharedSlot. | [
30522,
2270,
4207,
14540,
4140,
2035,
24755,
4570,
8167,
2098,
14540,
4140,
1006,
19832,
18428,
3070,
17058,
12054,
24838,
6631,
17058,
12054,
24838,
1007,
11618,
6013,
10265,
3207,
2595,
24422,
1063,
25549,
1006,
6013,
7878,
1007,
1063,
2065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/InProcessLauncher.java | InProcessLauncher.findSparkSubmit | Method findSparkSubmit() throws IOException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = getClass().getClassLoader();
}
Class<?> sparkSubmit;
// SPARK-22941: first try the new SparkSubmit interface that has better error handling,
// but fall back to the old interface in case someone is mixing & matching launcher and
// Spark versions.
try {
sparkSubmit = cl.loadClass("org.apache.spark.deploy.InProcessSparkSubmit");
} catch (Exception e1) {
try {
sparkSubmit = cl.loadClass("org.apache.spark.deploy.SparkSubmit");
} catch (Exception e2) {
throw new IOException("Cannot find SparkSubmit; make sure necessary jars are available.",
e2);
}
}
Method main;
try {
main = sparkSubmit.getMethod("main", String[].class);
} catch (Exception e) {
throw new IOException("Cannot find SparkSubmit main method.", e);
}
CommandBuilderUtils.checkState(Modifier.isStatic(main.getModifiers()),
"main method is not static.");
return main;
} | java | Method findSparkSubmit() throws IOException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = getClass().getClassLoader();
}
Class<?> sparkSubmit;
// SPARK-22941: first try the new SparkSubmit interface that has better error handling,
// but fall back to the old interface in case someone is mixing & matching launcher and
// Spark versions.
try {
sparkSubmit = cl.loadClass("org.apache.spark.deploy.InProcessSparkSubmit");
} catch (Exception e1) {
try {
sparkSubmit = cl.loadClass("org.apache.spark.deploy.SparkSubmit");
} catch (Exception e2) {
throw new IOException("Cannot find SparkSubmit; make sure necessary jars are available.",
e2);
}
}
Method main;
try {
main = sparkSubmit.getMethod("main", String[].class);
} catch (Exception e) {
throw new IOException("Cannot find SparkSubmit main method.", e);
}
CommandBuilderUtils.checkState(Modifier.isStatic(main.getModifiers()),
"main method is not static.");
return main;
} | [
"Method",
"findSparkSubmit",
"(",
")",
"throws",
"IOException",
"{",
"ClassLoader",
"cl",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"if",
"(",
"cl",
"==",
"null",
")",
"{",
"cl",
"=",
"getClass",
"(",
")"... | Visible for testing. | [
"Visible",
"for",
"testing",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/InProcessLauncher.java#L85-L116 | train | Find SparkSubmit. | [
30522,
4118,
4858,
14432,
6342,
25526,
4183,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
2465,
11066,
2121,
18856,
1027,
11689,
1012,
2783,
2705,
16416,
2094,
1006,
1007,
1012,
2131,
8663,
18209,
26266,
11066,
2121,
1006,
1007,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.readFileStream | @Deprecated
@SuppressWarnings("deprecation")
public DataStream<String> readFileStream(String filePath, long intervalMillis, FileMonitoringFunction.WatchType watchType) {
DataStream<Tuple3<String, Long, Long>> source = addSource(new FileMonitoringFunction(
filePath, intervalMillis, watchType), "Read File Stream source");
return source.flatMap(new FileReadFunction());
} | java | @Deprecated
@SuppressWarnings("deprecation")
public DataStream<String> readFileStream(String filePath, long intervalMillis, FileMonitoringFunction.WatchType watchType) {
DataStream<Tuple3<String, Long, Long>> source = addSource(new FileMonitoringFunction(
filePath, intervalMillis, watchType), "Read File Stream source");
return source.flatMap(new FileReadFunction());
} | [
"@",
"Deprecated",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"DataStream",
"<",
"String",
">",
"readFileStream",
"(",
"String",
"filePath",
",",
"long",
"intervalMillis",
",",
"FileMonitoringFunction",
".",
"WatchType",
"watchType",
")",
"{",
... | Creates a data stream that contains the contents of file created while system watches the given path. The file
will be read with the system's default character set.
@param filePath
The path of the file, as a URI (e.g., "file:///some/local/file" or "hdfs://host:port/file/path/")
@param intervalMillis
The interval of file watching in milliseconds
@param watchType
The watch type of file stream. When watchType is {@link org.apache.flink.streaming.api.functions.source.FileMonitoringFunction.WatchType#ONLY_NEW_FILES}, the system processes
only
new files. {@link org.apache.flink.streaming.api.functions.source.FileMonitoringFunction.WatchType#REPROCESS_WITH_APPENDED} means that the system re-processes all contents of
appended file. {@link org.apache.flink.streaming.api.functions.source.FileMonitoringFunction.WatchType#PROCESS_ONLY_APPENDED} means that the system processes only appended
contents
of files.
@return The DataStream containing the given directory.
@deprecated Use {@link #readFile(FileInputFormat, String, FileProcessingMode, long)} instead. | [
"Creates",
"a",
"data",
"stream",
"that",
"contains",
"the",
"contents",
"of",
"file",
"created",
"while",
"system",
"watches",
"the",
"given",
"path",
".",
"The",
"file",
"will",
"be",
"read",
"with",
"the",
"system",
"s",
"default",
"character",
"set",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1112-L1119 | train | Read a file stream. | [
30522,
1030,
2139,
28139,
12921,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
2139,
28139,
10719,
1000,
1007,
2270,
2951,
21422,
1026,
5164,
1028,
3191,
8873,
4244,
25379,
1006,
5164,
5371,
15069,
1010,
2146,
13483,
19912,
2483,
1010,
5371,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/plugin/PluginLoader.java | PluginLoader.load | public <P extends Plugin> Iterator<P> load(Class<P> service) {
try (TemporaryClassLoaderContext classLoaderContext = new TemporaryClassLoaderContext(pluginClassLoader)) {
return new ContextClassLoaderSettingIterator<>(
ServiceLoader.load(service, pluginClassLoader).iterator(),
pluginClassLoader);
}
} | java | public <P extends Plugin> Iterator<P> load(Class<P> service) {
try (TemporaryClassLoaderContext classLoaderContext = new TemporaryClassLoaderContext(pluginClassLoader)) {
return new ContextClassLoaderSettingIterator<>(
ServiceLoader.load(service, pluginClassLoader).iterator(),
pluginClassLoader);
}
} | [
"public",
"<",
"P",
"extends",
"Plugin",
">",
"Iterator",
"<",
"P",
">",
"load",
"(",
"Class",
"<",
"P",
">",
"service",
")",
"{",
"try",
"(",
"TemporaryClassLoaderContext",
"classLoaderContext",
"=",
"new",
"TemporaryClassLoaderContext",
"(",
"pluginClassLoader... | Returns in iterator over all available implementations of the given service interface (SPI) for the plugin.
@param service the service interface (SPI) for which implementations are requested.
@param <P> Type of the requested plugin service.
@return An iterator of all implementations of the given service interface that could be loaded from the plugin. | [
"Returns",
"in",
"iterator",
"over",
"all",
"available",
"implementations",
"of",
"the",
"given",
"service",
"interface",
"(",
"SPI",
")",
"for",
"the",
"plugin",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/plugin/PluginLoader.java#L57-L63 | train | Load the plugin service. | [
30522,
2270,
1026,
1052,
8908,
13354,
2378,
1028,
2009,
6906,
4263,
1026,
1052,
1028,
7170,
1006,
2465,
1026,
1052,
1028,
2326,
1007,
1063,
3046,
1006,
5741,
26266,
11066,
2121,
8663,
18209,
2465,
11066,
2121,
8663,
18209,
1027,
2047,
5741,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dictionary/TFDictionary.java | TFDictionary.values | public TreeSet<TermFrequency> values()
{
TreeSet<TermFrequency> set = new TreeSet<TermFrequency>(Collections.reverseOrder());
for (Map.Entry<String, TermFrequency> entry : entrySet())
{
set.add(entry.getValue());
}
return set;
} | java | public TreeSet<TermFrequency> values()
{
TreeSet<TermFrequency> set = new TreeSet<TermFrequency>(Collections.reverseOrder());
for (Map.Entry<String, TermFrequency> entry : entrySet())
{
set.add(entry.getValue());
}
return set;
} | [
"public",
"TreeSet",
"<",
"TermFrequency",
">",
"values",
"(",
")",
"{",
"TreeSet",
"<",
"TermFrequency",
">",
"set",
"=",
"new",
"TreeSet",
"<",
"TermFrequency",
">",
"(",
"Collections",
".",
"reverseOrder",
"(",
")",
")",
";",
"for",
"(",
"Map",
".",
... | 按照频率从高到低排序的条目
@return | [
"按照频率从高到低排序的条目"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/TFDictionary.java#L181-L191 | train | Get the values of the CRARA SEGMENTS. | [
30522,
2270,
3628,
3388,
1026,
2744,
19699,
2063,
4226,
9407,
1028,
5300,
1006,
1007,
1063,
3628,
3388,
1026,
2744,
19699,
2063,
4226,
9407,
1028,
2275,
1027,
2047,
3628,
3388,
1026,
2744,
19699,
2063,
4226,
9407,
1028,
1006,
6407,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/dartsclone/details/DawgBuilder.java | DawgBuilder.init | void init()
{
_table.resize(INITIAL_TABLE_SIZE, 0);
appendNode();
appendUnit();
_numStates = 1;
_nodes.get(0).label = (byte) 0xFF;
_nodeStack.add(0);
} | java | void init()
{
_table.resize(INITIAL_TABLE_SIZE, 0);
appendNode();
appendUnit();
_numStates = 1;
_nodes.get(0).label = (byte) 0xFF;
_nodeStack.add(0);
} | [
"void",
"init",
"(",
")",
"{",
"_table",
".",
"resize",
"(",
"INITIAL_TABLE_SIZE",
",",
"0",
")",
";",
"appendNode",
"(",
")",
";",
"appendUnit",
"(",
")",
";",
"_numStates",
"=",
"1",
";",
"_nodes",
".",
"get",
"(",
"0",
")",
".",
"label",
"=",
... | 初始化 | [
"初始化"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/dartsclone/details/DawgBuilder.java#L105-L116 | train | Initializes the base class. | [
30522,
11675,
1999,
4183,
1006,
1007,
1063,
1035,
2795,
1012,
24501,
4697,
1006,
3988,
1035,
2795,
1035,
2946,
1010,
1014,
1007,
1025,
10439,
10497,
3630,
3207,
1006,
1007,
1025,
10439,
10497,
19496,
2102,
1006,
1007,
1025,
1035,
16371,
524... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/types/IntValue.java | IntValue.compareTo | @Override
public int compareTo(IntValue o) {
final int other = o.value;
return this.value < other ? -1 : this.value > other ? 1 : 0;
} | java | @Override
public int compareTo(IntValue o) {
final int other = o.value;
return this.value < other ? -1 : this.value > other ? 1 : 0;
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"IntValue",
"o",
")",
"{",
"final",
"int",
"other",
"=",
"o",
".",
"value",
";",
"return",
"this",
".",
"value",
"<",
"other",
"?",
"-",
"1",
":",
"this",
".",
"value",
">",
"other",
"?",
"1",
"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/IntValue.java#L98-L102 | train | Compares two IntValues. | [
30522,
1030,
2058,
15637,
2270,
20014,
12826,
3406,
1006,
20014,
10175,
5657,
1051,
1007,
1063,
2345,
20014,
2060,
1027,
1051,
1012,
3643,
1025,
2709,
2023,
1012,
3643,
1026,
2060,
1029,
1011,
1015,
1024,
2023,
1012,
3643,
1028,
2060,
1029,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateEqual | public static Object validateEqual(Object t1, Object t2, String errorMsg) throws ValidateException {
if (false == equal(t1, t2)) {
throw new ValidateException(errorMsg);
}
return t1;
} | java | public static Object validateEqual(Object t1, Object t2, String errorMsg) throws ValidateException {
if (false == equal(t1, t2)) {
throw new ValidateException(errorMsg);
}
return t1;
} | [
"public",
"static",
"Object",
"validateEqual",
"(",
"Object",
"t1",
",",
"Object",
"t2",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"equal",
"(",
"t1",
",",
"t2",
")",
")",
"{",
"throw",
"new",
"Validate... | 验证是否相等,不相等抛出异常<br>
@param t1 对象1
@param t2 对象2
@param errorMsg 错误信息
@return 相同值
@throws ValidateException 验证异常 | [
"验证是否相等,不相等抛出异常<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L248-L253 | train | Validate equal. | [
30522,
2270,
10763,
4874,
9398,
3686,
2063,
26426,
1006,
4874,
1056,
2487,
1010,
4874,
1056,
2475,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
1027,
5020,
1006,
1056,
2487,
1010,
1056,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphHasherV2.java | StreamGraphHasherV2.generateNodeHash | private boolean generateNodeHash(
StreamNode node,
HashFunction hashFunction,
Map<Integer, byte[]> hashes,
boolean isChainingEnabled,
StreamGraph streamGraph) {
// Check for user-specified ID
String userSpecifiedHash = node.getTransformationUID();
if (userSpecifiedHash == null) {
// Check that all input nodes have their hashes computed
for (StreamEdge inEdge : node.getInEdges()) {
// If the input node has not been visited yet, the current
// node will be visited again at a later point when all input
// nodes have been visited and their hashes set.
if (!hashes.containsKey(inEdge.getSourceId())) {
return false;
}
}
Hasher hasher = hashFunction.newHasher();
byte[] hash = generateDeterministicHash(node, hasher, hashes, isChainingEnabled, streamGraph);
if (hashes.put(node.getId(), hash) != null) {
// Sanity check
throw new IllegalStateException("Unexpected state. Tried to add node hash " +
"twice. This is probably a bug in the JobGraph generator.");
}
return true;
} else {
Hasher hasher = hashFunction.newHasher();
byte[] hash = generateUserSpecifiedHash(node, hasher);
for (byte[] previousHash : hashes.values()) {
if (Arrays.equals(previousHash, hash)) {
throw new IllegalArgumentException("Hash collision on user-specified ID " +
"\"" + userSpecifiedHash + "\". " +
"Most likely cause is a non-unique ID. Please check that all IDs " +
"specified via `uid(String)` are unique.");
}
}
if (hashes.put(node.getId(), hash) != null) {
// Sanity check
throw new IllegalStateException("Unexpected state. Tried to add node hash " +
"twice. This is probably a bug in the JobGraph generator.");
}
return true;
}
} | java | private boolean generateNodeHash(
StreamNode node,
HashFunction hashFunction,
Map<Integer, byte[]> hashes,
boolean isChainingEnabled,
StreamGraph streamGraph) {
// Check for user-specified ID
String userSpecifiedHash = node.getTransformationUID();
if (userSpecifiedHash == null) {
// Check that all input nodes have their hashes computed
for (StreamEdge inEdge : node.getInEdges()) {
// If the input node has not been visited yet, the current
// node will be visited again at a later point when all input
// nodes have been visited and their hashes set.
if (!hashes.containsKey(inEdge.getSourceId())) {
return false;
}
}
Hasher hasher = hashFunction.newHasher();
byte[] hash = generateDeterministicHash(node, hasher, hashes, isChainingEnabled, streamGraph);
if (hashes.put(node.getId(), hash) != null) {
// Sanity check
throw new IllegalStateException("Unexpected state. Tried to add node hash " +
"twice. This is probably a bug in the JobGraph generator.");
}
return true;
} else {
Hasher hasher = hashFunction.newHasher();
byte[] hash = generateUserSpecifiedHash(node, hasher);
for (byte[] previousHash : hashes.values()) {
if (Arrays.equals(previousHash, hash)) {
throw new IllegalArgumentException("Hash collision on user-specified ID " +
"\"" + userSpecifiedHash + "\". " +
"Most likely cause is a non-unique ID. Please check that all IDs " +
"specified via `uid(String)` are unique.");
}
}
if (hashes.put(node.getId(), hash) != null) {
// Sanity check
throw new IllegalStateException("Unexpected state. Tried to add node hash " +
"twice. This is probably a bug in the JobGraph generator.");
}
return true;
}
} | [
"private",
"boolean",
"generateNodeHash",
"(",
"StreamNode",
"node",
",",
"HashFunction",
"hashFunction",
",",
"Map",
"<",
"Integer",
",",
"byte",
"[",
"]",
">",
"hashes",
",",
"boolean",
"isChainingEnabled",
",",
"StreamGraph",
"streamGraph",
")",
"{",
"// Chec... | Generates a hash for the node and returns whether the operation was
successful.
@param node The node to generate the hash for
@param hashFunction The hash function to use
@param hashes The current state of generated hashes
@return <code>true</code> if the node hash has been generated.
<code>false</code>, otherwise. If the operation is not successful, the
hash needs be generated at a later point when all input is available.
@throws IllegalStateException If node has user-specified hash and is
intermediate node of a chain | [
"Generates",
"a",
"hash",
"for",
"the",
"node",
"and",
"returns",
"whether",
"the",
"operation",
"was",
"successful",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphHasherV2.java#L144-L196 | train | Generate a node hash. | [
30522,
2797,
22017,
20898,
9699,
3630,
25383,
11823,
1006,
5460,
3630,
3207,
13045,
1010,
23325,
11263,
27989,
23325,
11263,
27989,
1010,
4949,
1026,
16109,
1010,
24880,
1031,
1033,
1028,
23325,
2229,
1010,
22017,
20898,
2003,
24925,
5582,
81... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/Convert.java | Convert.convertCharset | public static String convertCharset(String str, String sourceCharset, String destCharset) {
if (StrUtil.hasBlank(str, sourceCharset, destCharset)) {
return str;
}
return CharsetUtil.convert(str, sourceCharset, destCharset);
} | java | public static String convertCharset(String str, String sourceCharset, String destCharset) {
if (StrUtil.hasBlank(str, sourceCharset, destCharset)) {
return str;
}
return CharsetUtil.convert(str, sourceCharset, destCharset);
} | [
"public",
"static",
"String",
"convertCharset",
"(",
"String",
"str",
",",
"String",
"sourceCharset",
",",
"String",
"destCharset",
")",
"{",
"if",
"(",
"StrUtil",
".",
"hasBlank",
"(",
"str",
",",
"sourceCharset",
",",
"destCharset",
")",
")",
"{",
"return"... | 给定字符串转换字符编码<br>
如果参数为空,则返回原字符串,不报错。
@param str 被转码的字符串
@param sourceCharset 原字符集
@param destCharset 目标字符集
@return 转换后的字符串
@see CharsetUtil#convert(String, String, String) | [
"给定字符串转换字符编码<br",
">",
"如果参数为空,则返回原字符串,不报错。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L780-L786 | train | Convert the given string to the given charset. | [
30522,
2270,
10763,
5164,
10463,
7507,
22573,
2102,
1006,
5164,
2358,
2099,
1010,
5164,
3120,
7507,
22573,
2102,
1010,
5164,
4078,
10649,
11650,
3388,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2038,
28522,
8950,
1006,
2358,
2099,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java | FileWriter.getWriter | public BufferedWriter getWriter(boolean isAppend) throws IORuntimeException {
try {
return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(FileUtil.touch(file), isAppend), charset));
} catch (Exception e) {
throw new IORuntimeException(e);
}
} | java | public BufferedWriter getWriter(boolean isAppend) throws IORuntimeException {
try {
return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(FileUtil.touch(file), isAppend), charset));
} catch (Exception e) {
throw new IORuntimeException(e);
}
} | [
"public",
"BufferedWriter",
"getWriter",
"(",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"try",
"{",
"return",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"new",
"FileOutputStream",
"(",
"FileUtil",
".",
"touch",
"(",
"fil... | 获得一个带缓存的写入对象
@param isAppend 是否追加
@return BufferedReader对象
@throws IORuntimeException IO异常 | [
"获得一个带缓存的写入对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java#L343-L349 | train | Returns a BufferedWriter for writing to the file. | [
30522,
2270,
17698,
2098,
15994,
2131,
15994,
1006,
22017,
20898,
18061,
21512,
4859,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
3046,
1063,
2709,
2047,
17698,
2098,
15994,
1006,
2047,
27852,
30524,
5466,
2047,
22834,
15532,
7292,
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/resourcemanager/slotmanager/SlotManager.java | SlotManager.checkTaskManagerTimeouts | @VisibleForTesting
void checkTaskManagerTimeouts() {
if (!taskManagerRegistrations.isEmpty()) {
long currentTime = System.currentTimeMillis();
ArrayList<TaskManagerRegistration> timedOutTaskManagers = new ArrayList<>(taskManagerRegistrations.size());
// first retrieve the timed out TaskManagers
for (TaskManagerRegistration taskManagerRegistration : taskManagerRegistrations.values()) {
if (currentTime - taskManagerRegistration.getIdleSince() >= taskManagerTimeout.toMilliseconds()) {
// we collect the instance ids first in order to avoid concurrent modifications by the
// ResourceActions.releaseResource call
timedOutTaskManagers.add(taskManagerRegistration);
}
}
// second we trigger the release resource callback which can decide upon the resource release
for (TaskManagerRegistration taskManagerRegistration : timedOutTaskManagers) {
InstanceID timedOutTaskManagerId = taskManagerRegistration.getInstanceId();
if (waitResultConsumedBeforeRelease) {
// checking whether TaskManagers can be safely removed
taskManagerRegistration.getTaskManagerConnection().getTaskExecutorGateway().canBeReleased()
.thenAcceptAsync(canBeReleased -> {
if (canBeReleased) {
releaseTaskExecutor(timedOutTaskManagerId);
}},
mainThreadExecutor);
} else {
releaseTaskExecutor(timedOutTaskManagerId);
}
}
}
} | java | @VisibleForTesting
void checkTaskManagerTimeouts() {
if (!taskManagerRegistrations.isEmpty()) {
long currentTime = System.currentTimeMillis();
ArrayList<TaskManagerRegistration> timedOutTaskManagers = new ArrayList<>(taskManagerRegistrations.size());
// first retrieve the timed out TaskManagers
for (TaskManagerRegistration taskManagerRegistration : taskManagerRegistrations.values()) {
if (currentTime - taskManagerRegistration.getIdleSince() >= taskManagerTimeout.toMilliseconds()) {
// we collect the instance ids first in order to avoid concurrent modifications by the
// ResourceActions.releaseResource call
timedOutTaskManagers.add(taskManagerRegistration);
}
}
// second we trigger the release resource callback which can decide upon the resource release
for (TaskManagerRegistration taskManagerRegistration : timedOutTaskManagers) {
InstanceID timedOutTaskManagerId = taskManagerRegistration.getInstanceId();
if (waitResultConsumedBeforeRelease) {
// checking whether TaskManagers can be safely removed
taskManagerRegistration.getTaskManagerConnection().getTaskExecutorGateway().canBeReleased()
.thenAcceptAsync(canBeReleased -> {
if (canBeReleased) {
releaseTaskExecutor(timedOutTaskManagerId);
}},
mainThreadExecutor);
} else {
releaseTaskExecutor(timedOutTaskManagerId);
}
}
}
} | [
"@",
"VisibleForTesting",
"void",
"checkTaskManagerTimeouts",
"(",
")",
"{",
"if",
"(",
"!",
"taskManagerRegistrations",
".",
"isEmpty",
"(",
")",
")",
"{",
"long",
"currentTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"ArrayList",
"<",
"TaskM... | --------------------------------------------------------------------------------------------- | [
"---------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java#L1008-L1040 | train | Check the timeout of the TaskManagers that have timed out. | [
30522,
1030,
5710,
13028,
4355,
2075,
11675,
4638,
10230,
22287,
5162,
4590,
7292,
12166,
1006,
1007,
1063,
2065,
1006,
999,
4708,
24805,
4590,
2890,
24063,
28893,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1007,
1063,
2146,
2783,
7292,
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-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/AbstractServerBase.java | AbstractServerBase.shutdownServer | public CompletableFuture<Void> shutdownServer() {
CompletableFuture<Void> shutdownFuture = new CompletableFuture<>();
if (serverShutdownFuture.compareAndSet(null, shutdownFuture)) {
log.info("Shutting down {} @ {}", serverName, serverAddress);
final CompletableFuture<Void> groupShutdownFuture = new CompletableFuture<>();
if (bootstrap != null) {
EventLoopGroup group = bootstrap.group();
if (group != null && !group.isShutdown()) {
group.shutdownGracefully(0L, 0L, TimeUnit.MILLISECONDS)
.addListener(finished -> {
if (finished.isSuccess()) {
groupShutdownFuture.complete(null);
} else {
groupShutdownFuture.completeExceptionally(finished.cause());
}
});
} else {
groupShutdownFuture.complete(null);
}
} else {
groupShutdownFuture.complete(null);
}
final CompletableFuture<Void> handlerShutdownFuture = new CompletableFuture<>();
if (handler == null) {
handlerShutdownFuture.complete(null);
} else {
handler.shutdown().whenComplete((result, throwable) -> {
if (throwable != null) {
handlerShutdownFuture.completeExceptionally(throwable);
} else {
handlerShutdownFuture.complete(null);
}
});
}
final CompletableFuture<Void> queryExecShutdownFuture = CompletableFuture.runAsync(() -> {
if (queryExecutor != null) {
ExecutorUtils.gracefulShutdown(10L, TimeUnit.MINUTES, queryExecutor);
}
});
CompletableFuture.allOf(
queryExecShutdownFuture, groupShutdownFuture, handlerShutdownFuture
).whenComplete((result, throwable) -> {
if (throwable != null) {
shutdownFuture.completeExceptionally(throwable);
} else {
shutdownFuture.complete(null);
}
});
}
return serverShutdownFuture.get();
} | java | public CompletableFuture<Void> shutdownServer() {
CompletableFuture<Void> shutdownFuture = new CompletableFuture<>();
if (serverShutdownFuture.compareAndSet(null, shutdownFuture)) {
log.info("Shutting down {} @ {}", serverName, serverAddress);
final CompletableFuture<Void> groupShutdownFuture = new CompletableFuture<>();
if (bootstrap != null) {
EventLoopGroup group = bootstrap.group();
if (group != null && !group.isShutdown()) {
group.shutdownGracefully(0L, 0L, TimeUnit.MILLISECONDS)
.addListener(finished -> {
if (finished.isSuccess()) {
groupShutdownFuture.complete(null);
} else {
groupShutdownFuture.completeExceptionally(finished.cause());
}
});
} else {
groupShutdownFuture.complete(null);
}
} else {
groupShutdownFuture.complete(null);
}
final CompletableFuture<Void> handlerShutdownFuture = new CompletableFuture<>();
if (handler == null) {
handlerShutdownFuture.complete(null);
} else {
handler.shutdown().whenComplete((result, throwable) -> {
if (throwable != null) {
handlerShutdownFuture.completeExceptionally(throwable);
} else {
handlerShutdownFuture.complete(null);
}
});
}
final CompletableFuture<Void> queryExecShutdownFuture = CompletableFuture.runAsync(() -> {
if (queryExecutor != null) {
ExecutorUtils.gracefulShutdown(10L, TimeUnit.MINUTES, queryExecutor);
}
});
CompletableFuture.allOf(
queryExecShutdownFuture, groupShutdownFuture, handlerShutdownFuture
).whenComplete((result, throwable) -> {
if (throwable != null) {
shutdownFuture.completeExceptionally(throwable);
} else {
shutdownFuture.complete(null);
}
});
}
return serverShutdownFuture.get();
} | [
"public",
"CompletableFuture",
"<",
"Void",
">",
"shutdownServer",
"(",
")",
"{",
"CompletableFuture",
"<",
"Void",
">",
"shutdownFuture",
"=",
"new",
"CompletableFuture",
"<>",
"(",
")",
";",
"if",
"(",
"serverShutdownFuture",
".",
"compareAndSet",
"(",
"null",... | Shuts down the server and all related thread pools.
@return A {@link CompletableFuture} that will be completed upon termination of the shutdown process. | [
"Shuts",
"down",
"the",
"server",
"and",
"all",
"related",
"thread",
"pools",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/AbstractServerBase.java#L285-L339 | train | Shutdowns the server. | [
30522,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
11675,
1028,
3844,
7698,
8043,
6299,
1006,
1007,
1063,
4012,
10814,
10880,
11263,
11244,
1026,
11675,
1028,
3844,
7698,
11263,
11244,
1027,
2047,
4012,
10814,
10880,
11263,
11244,
1026,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateProperties.java | HibernateProperties.determineHibernateProperties | public Map<String, Object> determineHibernateProperties(
Map<String, String> jpaProperties, HibernateSettings settings) {
Assert.notNull(jpaProperties, "JpaProperties must not be null");
Assert.notNull(settings, "Settings must not be null");
return getAdditionalProperties(jpaProperties, settings);
} | java | public Map<String, Object> determineHibernateProperties(
Map<String, String> jpaProperties, HibernateSettings settings) {
Assert.notNull(jpaProperties, "JpaProperties must not be null");
Assert.notNull(settings, "Settings must not be null");
return getAdditionalProperties(jpaProperties, settings);
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"determineHibernateProperties",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"jpaProperties",
",",
"HibernateSettings",
"settings",
")",
"{",
"Assert",
".",
"notNull",
"(",
"jpaProperties",
",",
"\"JpaPropert... | Determine the configuration properties for the initialization of the main Hibernate
EntityManagerFactory based on standard JPA properties and
{@link HibernateSettings}.
@param jpaProperties standard JPA properties
@param settings the settings to apply when determining the configuration properties
@return the Hibernate properties to use | [
"Determine",
"the",
"configuration",
"properties",
"for",
"the",
"initialization",
"of",
"the",
"main",
"Hibernate",
"EntityManagerFactory",
"based",
"on",
"standard",
"JPA",
"properties",
"and",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateProperties.java#L90-L95 | train | Determine the Hibernate properties for the given JPA properties. | [
30522,
2270,
4949,
1026,
5164,
1010,
4874,
1028,
5646,
4048,
5677,
12556,
21572,
4842,
7368,
1006,
4949,
1026,
5164,
1010,
5164,
1028,
16545,
9331,
18981,
8743,
3111,
1010,
7632,
5677,
12556,
21678,
8613,
10906,
1007,
1063,
20865,
1012,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.writeUtf8Lines | public static <T> File writeUtf8Lines(Collection<T> list, String path) throws IORuntimeException {
return writeLines(list, path, CharsetUtil.CHARSET_UTF_8);
} | java | public static <T> File writeUtf8Lines(Collection<T> list, String path) throws IORuntimeException {
return writeLines(list, path, CharsetUtil.CHARSET_UTF_8);
} | [
"public",
"static",
"<",
"T",
">",
"File",
"writeUtf8Lines",
"(",
"Collection",
"<",
"T",
">",
"list",
",",
"String",
"path",
")",
"throws",
"IORuntimeException",
"{",
"return",
"writeLines",
"(",
"list",
",",
"path",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8"... | 将列表写入文件,覆盖模式,编码为UTF-8
@param <T> 集合元素类型
@param list 列表
@param path 绝对路径
@return 目标文件
@throws IORuntimeException IO异常
@since 3.2.0 | [
"将列表写入文件,覆盖模式,编码为UTF",
"-",
"8"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2853-L2855 | train | Write a collection of UTF - 8 lines to a file. | [
30522,
2270,
10763,
1026,
1056,
30524,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/word2vec/Corpus.java | Corpus.addWordToVocab | protected int addWordToVocab(String word)
{
vocab[vocabSize] = new VocabWord(word);
vocabSize++;
// Reallocate memory if needed
if (vocabSize + 2 >= vocabMaxSize)
{
vocabMaxSize += 1000;
VocabWord[] temp = new VocabWord[vocabMaxSize];
System.arraycopy(vocab, 0, temp, 0, vocabSize);
vocab = temp;
}
vocabIndexMap.put(word, vocabSize - 1);
return vocabSize - 1;
} | java | protected int addWordToVocab(String word)
{
vocab[vocabSize] = new VocabWord(word);
vocabSize++;
// Reallocate memory if needed
if (vocabSize + 2 >= vocabMaxSize)
{
vocabMaxSize += 1000;
VocabWord[] temp = new VocabWord[vocabMaxSize];
System.arraycopy(vocab, 0, temp, 0, vocabSize);
vocab = temp;
}
vocabIndexMap.put(word, vocabSize - 1);
return vocabSize - 1;
} | [
"protected",
"int",
"addWordToVocab",
"(",
"String",
"word",
")",
"{",
"vocab",
"[",
"vocabSize",
"]",
"=",
"new",
"VocabWord",
"(",
"word",
")",
";",
"vocabSize",
"++",
";",
"// Reallocate memory if needed",
"if",
"(",
"vocabSize",
"+",
"2",
">=",
"vocabMax... | Adds a word to the vocabulary
@param word
@return | [
"Adds",
"a",
"word",
"to",
"the",
"vocabulary"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/Corpus.java#L46-L61 | train | Add a word to the vocabulary. | [
30522,
5123,
20014,
5587,
18351,
26525,
24755,
2497,
1006,
5164,
2773,
1007,
1063,
29536,
3540,
2497,
1031,
29536,
3540,
5910,
4697,
1033,
1027,
2047,
29536,
3540,
2497,
18351,
1006,
2773,
1007,
1025,
29536,
3540,
5910,
4697,
1009,
1009,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java | SpringApplicationRunner.compileAndRun | public void compileAndRun() throws Exception {
synchronized (this.monitor) {
try {
stop();
Class<?>[] compiledSources = compile();
monitorForChanges();
// Run in new thread to ensure that the context classloader is setup
this.runThread = new RunThread(compiledSources);
this.runThread.start();
this.runThread.join();
}
catch (Exception ex) {
if (this.fileWatchThread == null) {
throw ex;
}
else {
ex.printStackTrace();
}
}
}
} | java | public void compileAndRun() throws Exception {
synchronized (this.monitor) {
try {
stop();
Class<?>[] compiledSources = compile();
monitorForChanges();
// Run in new thread to ensure that the context classloader is setup
this.runThread = new RunThread(compiledSources);
this.runThread.start();
this.runThread.join();
}
catch (Exception ex) {
if (this.fileWatchThread == null) {
throw ex;
}
else {
ex.printStackTrace();
}
}
}
} | [
"public",
"void",
"compileAndRun",
"(",
")",
"throws",
"Exception",
"{",
"synchronized",
"(",
"this",
".",
"monitor",
")",
"{",
"try",
"{",
"stop",
"(",
")",
";",
"Class",
"<",
"?",
">",
"[",
"]",
"compiledSources",
"=",
"compile",
"(",
")",
";",
"mo... | Compile and run the application.
@throws Exception on error | [
"Compile",
"and",
"run",
"the",
"application",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/run/SpringApplicationRunner.java#L97-L117 | train | Compile and run the compiler. | [
30522,
2270,
11675,
4012,
22090,
5685,
15532,
1006,
1007,
11618,
6453,
1063,
25549,
1006,
2023,
1012,
8080,
1007,
1063,
3046,
1063,
2644,
1006,
1007,
1025,
2465,
1026,
1029,
1028,
1031,
1033,
9227,
6499,
3126,
9623,
1027,
4012,
22090,
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/SpringApplication.java | SpringApplication.configureEnvironment | protected void configureEnvironment(ConfigurableEnvironment environment,
String[] args) {
if (this.addConversionService) {
ConversionService conversionService = ApplicationConversionService
.getSharedInstance();
environment.setConversionService(
(ConfigurableConversionService) conversionService);
}
configurePropertySources(environment, args);
configureProfiles(environment, args);
} | java | protected void configureEnvironment(ConfigurableEnvironment environment,
String[] args) {
if (this.addConversionService) {
ConversionService conversionService = ApplicationConversionService
.getSharedInstance();
environment.setConversionService(
(ConfigurableConversionService) conversionService);
}
configurePropertySources(environment, args);
configureProfiles(environment, args);
} | [
"protected",
"void",
"configureEnvironment",
"(",
"ConfigurableEnvironment",
"environment",
",",
"String",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"this",
".",
"addConversionService",
")",
"{",
"ConversionService",
"conversionService",
"=",
"ApplicationConversionService"... | Template method delegating to
{@link #configurePropertySources(ConfigurableEnvironment, String[])} and
{@link #configureProfiles(ConfigurableEnvironment, String[])} in that order.
Override this method for complete control over Environment customization, or one of
the above for fine-grained control over property sources or profiles, respectively.
@param environment this application's environment
@param args arguments passed to the {@code run} method
@see #configureProfiles(ConfigurableEnvironment, String[])
@see #configurePropertySources(ConfigurableEnvironment, String[]) | [
"Template",
"method",
"delegating",
"to",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L489-L499 | train | Configure the environment. | [
30522,
5123,
11675,
9530,
8873,
27390,
12129,
21663,
2239,
3672,
1006,
9530,
8873,
27390,
3085,
2368,
21663,
2239,
3672,
4044,
1010,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
2065,
1006,
2023,
1012,
5587,
8663,
27774,
8043,
7903,
2063,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroRowDeserializationSchema.java | AvroRowDeserializationSchema.convertAvroRecordToRow | private Row convertAvroRecordToRow(Schema schema, RowTypeInfo typeInfo, IndexedRecord record) {
final List<Schema.Field> fields = schema.getFields();
final TypeInformation<?>[] fieldInfo = typeInfo.getFieldTypes();
final int length = fields.size();
final Row row = new Row(length);
for (int i = 0; i < length; i++) {
final Schema.Field field = fields.get(i);
row.setField(i, convertAvroType(field.schema(), fieldInfo[i], record.get(i)));
}
return row;
} | java | private Row convertAvroRecordToRow(Schema schema, RowTypeInfo typeInfo, IndexedRecord record) {
final List<Schema.Field> fields = schema.getFields();
final TypeInformation<?>[] fieldInfo = typeInfo.getFieldTypes();
final int length = fields.size();
final Row row = new Row(length);
for (int i = 0; i < length; i++) {
final Schema.Field field = fields.get(i);
row.setField(i, convertAvroType(field.schema(), fieldInfo[i], record.get(i)));
}
return row;
} | [
"private",
"Row",
"convertAvroRecordToRow",
"(",
"Schema",
"schema",
",",
"RowTypeInfo",
"typeInfo",
",",
"IndexedRecord",
"record",
")",
"{",
"final",
"List",
"<",
"Schema",
".",
"Field",
">",
"fields",
"=",
"schema",
".",
"getFields",
"(",
")",
";",
"final... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroRowDeserializationSchema.java#L199-L209 | train | Convert an Avro record to a Row. | [
30522,
2797,
5216,
10463,
11431,
29165,
8586,
8551,
4263,
5004,
1006,
8040,
28433,
8040,
28433,
1010,
5216,
13874,
2378,
14876,
2828,
2378,
14876,
1010,
25331,
2890,
27108,
2094,
2501,
1007,
1063,
2345,
2862,
1026,
8040,
28433,
1012,
2492,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/CookieSigner.java | CookieSigner.signCookie | public String signCookie(String str) {
if (str == null || str.isEmpty()) {
throw new IllegalArgumentException("NULL or empty string to sign");
}
String signature = getSignature(str);
if (LOG.isDebugEnabled()) {
LOG.debug("Signature generated for " + str + " is " + signature);
}
return str + SIGNATURE + signature;
} | java | public String signCookie(String str) {
if (str == null || str.isEmpty()) {
throw new IllegalArgumentException("NULL or empty string to sign");
}
String signature = getSignature(str);
if (LOG.isDebugEnabled()) {
LOG.debug("Signature generated for " + str + " is " + signature);
}
return str + SIGNATURE + signature;
} | [
"public",
"String",
"signCookie",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"str",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"NULL or empty string to sign\"",
")",
";",
"}",
"String",
... | Sign the cookie given the string token as input.
@param str Input token
@return Signed token that can be used to create a cookie | [
"Sign",
"the",
"cookie",
"given",
"the",
"string",
"token",
"as",
"input",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/CookieSigner.java#L55-L65 | train | Sign a cookie string. | [
30522,
2270,
5164,
3696,
3597,
23212,
2063,
1006,
5164,
2358,
2099,
1007,
1063,
2065,
1006,
2358,
2099,
1027,
1027,
19701,
1064,
1064,
2358,
2099,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HexUtil.java | HexUtil.encodeHex | private static char[] encodeHex(byte[] data, char[] toDigits) {
final int len = data.length;
final char[] out = new char[len << 1];//len*2
// two characters from the hex value.
for (int i = 0, j = 0; i < len; i++) {
out[j++] = toDigits[(0xF0 & data[i]) >>> 4];// 高位
out[j++] = toDigits[0x0F & data[i]];// 低位
}
return out;
} | java | private static char[] encodeHex(byte[] data, char[] toDigits) {
final int len = data.length;
final char[] out = new char[len << 1];//len*2
// two characters from the hex value.
for (int i = 0, j = 0; i < len; i++) {
out[j++] = toDigits[(0xF0 & data[i]) >>> 4];// 高位
out[j++] = toDigits[0x0F & data[i]];// 低位
}
return out;
} | [
"private",
"static",
"char",
"[",
"]",
"encodeHex",
"(",
"byte",
"[",
"]",
"data",
",",
"char",
"[",
"]",
"toDigits",
")",
"{",
"final",
"int",
"len",
"=",
"data",
".",
"length",
";",
"final",
"char",
"[",
"]",
"out",
"=",
"new",
"char",
"[",
"le... | 将字节数组转换为十六进制字符数组
@param data byte[]
@param toDigits 用于控制输出的char[]
@return 十六进制char[] | [
"将字节数组转换为十六进制字符数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java#L358-L367 | train | Encodes a byte array into a byte array of characters that are encoded in hexadecimal. | [
30522,
2797,
10763,
25869,
1031,
1033,
4372,
16044,
5369,
2595,
30524,
1013,
18798,
1008,
1016,
1013,
1013,
2048,
3494,
2013,
1996,
2002,
2595,
3643,
1012,
2005,
1006,
20014,
1045,
1027,
1014,
1010,
1046,
1027,
1014,
1025,
1045,
1026,
18798... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java | CheckpointCoordinator.completePendingCheckpoint | private void completePendingCheckpoint(PendingCheckpoint pendingCheckpoint) throws CheckpointException {
final long checkpointId = pendingCheckpoint.getCheckpointId();
final CompletedCheckpoint completedCheckpoint;
// As a first step to complete the checkpoint, we register its state with the registry
Map<OperatorID, OperatorState> operatorStates = pendingCheckpoint.getOperatorStates();
sharedStateRegistry.registerAll(operatorStates.values());
try {
try {
completedCheckpoint = pendingCheckpoint.finalizeCheckpoint();
}
catch (Exception e1) {
// abort the current pending checkpoint if we fails to finalize the pending checkpoint.
if (!pendingCheckpoint.isDiscarded()) {
pendingCheckpoint.abort(CheckpointFailureReason.FINALIZE_CHECKPOINT_FAILURE, e1);
}
throw new CheckpointException("Could not finalize the pending checkpoint " + checkpointId + '.',
CheckpointFailureReason.FINALIZE_CHECKPOINT_FAILURE, e1);
}
// the pending checkpoint must be discarded after the finalization
Preconditions.checkState(pendingCheckpoint.isDiscarded() && completedCheckpoint != null);
try {
completedCheckpointStore.addCheckpoint(completedCheckpoint);
} catch (Exception exception) {
// we failed to store the completed checkpoint. Let's clean up
executor.execute(new Runnable() {
@Override
public void run() {
try {
completedCheckpoint.discardOnFailedStoring();
} catch (Throwable t) {
LOG.warn("Could not properly discard completed checkpoint {}.", completedCheckpoint.getCheckpointID(), t);
}
}
});
throw new CheckpointException("Could not complete the pending checkpoint " + checkpointId + '.',
CheckpointFailureReason.FINALIZE_CHECKPOINT_FAILURE, exception);
}
} finally {
pendingCheckpoints.remove(checkpointId);
triggerQueuedRequests();
}
rememberRecentCheckpointId(checkpointId);
// drop those pending checkpoints that are at prior to the completed one
dropSubsumedCheckpoints(checkpointId);
// record the time when this was completed, to calculate
// the 'min delay between checkpoints'
lastCheckpointCompletionNanos = System.nanoTime();
LOG.info("Completed checkpoint {} for job {} ({} bytes in {} ms).", checkpointId, job,
completedCheckpoint.getStateSize(), completedCheckpoint.getDuration());
if (LOG.isDebugEnabled()) {
StringBuilder builder = new StringBuilder();
builder.append("Checkpoint state: ");
for (OperatorState state : completedCheckpoint.getOperatorStates().values()) {
builder.append(state);
builder.append(", ");
}
// Remove last two chars ", "
builder.setLength(builder.length() - 2);
LOG.debug(builder.toString());
}
// send the "notify complete" call to all vertices
final long timestamp = completedCheckpoint.getTimestamp();
for (ExecutionVertex ev : tasksToCommitTo) {
Execution ee = ev.getCurrentExecutionAttempt();
if (ee != null) {
ee.notifyCheckpointComplete(checkpointId, timestamp);
}
}
} | java | private void completePendingCheckpoint(PendingCheckpoint pendingCheckpoint) throws CheckpointException {
final long checkpointId = pendingCheckpoint.getCheckpointId();
final CompletedCheckpoint completedCheckpoint;
// As a first step to complete the checkpoint, we register its state with the registry
Map<OperatorID, OperatorState> operatorStates = pendingCheckpoint.getOperatorStates();
sharedStateRegistry.registerAll(operatorStates.values());
try {
try {
completedCheckpoint = pendingCheckpoint.finalizeCheckpoint();
}
catch (Exception e1) {
// abort the current pending checkpoint if we fails to finalize the pending checkpoint.
if (!pendingCheckpoint.isDiscarded()) {
pendingCheckpoint.abort(CheckpointFailureReason.FINALIZE_CHECKPOINT_FAILURE, e1);
}
throw new CheckpointException("Could not finalize the pending checkpoint " + checkpointId + '.',
CheckpointFailureReason.FINALIZE_CHECKPOINT_FAILURE, e1);
}
// the pending checkpoint must be discarded after the finalization
Preconditions.checkState(pendingCheckpoint.isDiscarded() && completedCheckpoint != null);
try {
completedCheckpointStore.addCheckpoint(completedCheckpoint);
} catch (Exception exception) {
// we failed to store the completed checkpoint. Let's clean up
executor.execute(new Runnable() {
@Override
public void run() {
try {
completedCheckpoint.discardOnFailedStoring();
} catch (Throwable t) {
LOG.warn("Could not properly discard completed checkpoint {}.", completedCheckpoint.getCheckpointID(), t);
}
}
});
throw new CheckpointException("Could not complete the pending checkpoint " + checkpointId + '.',
CheckpointFailureReason.FINALIZE_CHECKPOINT_FAILURE, exception);
}
} finally {
pendingCheckpoints.remove(checkpointId);
triggerQueuedRequests();
}
rememberRecentCheckpointId(checkpointId);
// drop those pending checkpoints that are at prior to the completed one
dropSubsumedCheckpoints(checkpointId);
// record the time when this was completed, to calculate
// the 'min delay between checkpoints'
lastCheckpointCompletionNanos = System.nanoTime();
LOG.info("Completed checkpoint {} for job {} ({} bytes in {} ms).", checkpointId, job,
completedCheckpoint.getStateSize(), completedCheckpoint.getDuration());
if (LOG.isDebugEnabled()) {
StringBuilder builder = new StringBuilder();
builder.append("Checkpoint state: ");
for (OperatorState state : completedCheckpoint.getOperatorStates().values()) {
builder.append(state);
builder.append(", ");
}
// Remove last two chars ", "
builder.setLength(builder.length() - 2);
LOG.debug(builder.toString());
}
// send the "notify complete" call to all vertices
final long timestamp = completedCheckpoint.getTimestamp();
for (ExecutionVertex ev : tasksToCommitTo) {
Execution ee = ev.getCurrentExecutionAttempt();
if (ee != null) {
ee.notifyCheckpointComplete(checkpointId, timestamp);
}
}
} | [
"private",
"void",
"completePendingCheckpoint",
"(",
"PendingCheckpoint",
"pendingCheckpoint",
")",
"throws",
"CheckpointException",
"{",
"final",
"long",
"checkpointId",
"=",
"pendingCheckpoint",
".",
"getCheckpointId",
"(",
")",
";",
"final",
"CompletedCheckpoint",
"com... | Try to complete the given pending checkpoint.
<p>Important: This method should only be called in the checkpoint lock scope.
@param pendingCheckpoint to complete
@throws CheckpointException if the completion failed | [
"Try",
"to",
"complete",
"the",
"given",
"pending",
"checkpoint",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java#L872-L955 | train | Completes the given pending checkpoint. | [
30522,
2797,
11675,
3143,
11837,
4667,
5403,
3600,
8400,
1006,
14223,
5403,
3600,
8400,
14223,
5403,
3600,
8400,
1007,
11618,
26520,
10288,
24422,
1063,
2345,
2146,
26520,
3593,
1027,
14223,
5403,
3600,
8400,
1012,
2131,
5403,
3600,
8400,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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(Collection<OUT> data) {
Preconditions.checkNotNull(data, "Collection must not be null");
if (data.isEmpty()) {
throw new IllegalArgumentException("Collection must not be empty");
}
OUT first = data.iterator().next();
if (first == null) {
throw new IllegalArgumentException("Collection must not contain null elements");
}
TypeInformation<OUT> typeInfo;
try {
typeInfo = TypeExtractor.getForObject(first);
}
catch (Exception e) {
throw new RuntimeException("Could not create TypeInformation for type " + first.getClass()
+ "; please specify the TypeInformation manually via "
+ "StreamExecutionEnvironment#fromElements(Collection, TypeInformation)", e);
}
return fromCollection(data, typeInfo);
} | java | public <OUT> DataStreamSource<OUT> fromCollection(Collection<OUT> data) {
Preconditions.checkNotNull(data, "Collection must not be null");
if (data.isEmpty()) {
throw new IllegalArgumentException("Collection must not be empty");
}
OUT first = data.iterator().next();
if (first == null) {
throw new IllegalArgumentException("Collection must not contain null elements");
}
TypeInformation<OUT> typeInfo;
try {
typeInfo = TypeExtractor.getForObject(first);
}
catch (Exception e) {
throw new RuntimeException("Could not create TypeInformation for type " + first.getClass()
+ "; please specify the TypeInformation manually via "
+ "StreamExecutionEnvironment#fromElements(Collection, TypeInformation)", e);
}
return fromCollection(data, typeInfo);
} | [
"public",
"<",
"OUT",
">",
"DataStreamSource",
"<",
"OUT",
">",
"fromCollection",
"(",
"Collection",
"<",
"OUT",
">",
"data",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"data",
",",
"\"Collection must not be null\"",
")",
";",
"if",
"(",
"data",
".... | Creates a data stream from the given non-empty collection. The type of the data stream is that of the
elements in the collection.
<p>The framework will try and determine the exact type from the collection elements. In case of generic
elements, it may be necessary to manually supply the type information via
{@link #fromCollection(java.util.Collection, org.apache.flink.api.common.typeinfo.TypeInformation)}.
<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 collection of elements to create the data stream from.
@param <OUT>
The generic type of the returned data stream.
@return
The data stream representing the given collection | [
"Creates",
"a",
"data",
"stream",
"from",
"the",
"given",
"non",
"-",
"empty",
"collection",
".",
"The",
"type",
"of",
"the",
"data",
"stream",
"is",
"that",
"of",
"the",
"elements",
"in",
"the",
"collection",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L768-L789 | train | Creates a data stream from a collection of objects. | [
30522,
2270,
1026,
2041,
1028,
2951,
21422,
6499,
3126,
3401,
1026,
2041,
1028,
2013,
26895,
18491,
1006,
3074,
1026,
2041,
1028,
2951,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
2951,
1010,
1000,
3074,
2442,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/emoji/EmojiUtil.java | EmojiUtil.toAlias | public static String toAlias(String str, FitzpatrickAction fitzpatrickAction) {
return EmojiParser.parseToAliases(str, fitzpatrickAction);
} | java | public static String toAlias(String str, FitzpatrickAction fitzpatrickAction) {
return EmojiParser.parseToAliases(str, fitzpatrickAction);
} | [
"public",
"static",
"String",
"toAlias",
"(",
"String",
"str",
",",
"FitzpatrickAction",
"fitzpatrickAction",
")",
"{",
"return",
"EmojiParser",
".",
"parseToAliases",
"(",
"str",
",",
"fitzpatrickAction",
")",
";",
"}"
] | 将字符串中的Unicode Emoji字符转换为别名表现形式(两个":"包围的格式),别名后会增加"|"并追加fitzpatrick类型
<p>
例如:<code>👦🏿</code> 转换为 <code>:boy|type_6:</code>
@param str 包含Emoji Unicode字符的字符串
@return 替换后的字符串 | [
"将字符串中的Unicode",
"Emoji字符转换为别名表现形式(两个",
":",
"包围的格式),别名后会增加",
"|",
"并追加fitzpatrick类型",
"<p",
">",
"例如:<code",
">",
"👦🏿<",
"/",
"code",
">",
"转换为",
"<code",
">",
":",
"boy|type_6",
":",
"<",
"/",
"code",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/emoji/EmojiUtil.java#L104-L106 | train | Converts a string to an alias. | [
30522,
2270,
10763,
5164,
2000,
22786,
2015,
1006,
5164,
2358,
2099,
1010,
26249,
18908,
3258,
26249,
18908,
3258,
1007,
1063,
2709,
7861,
29147,
11514,
11650,
2121,
1012,
11968,
13462,
10441,
6632,
8583,
1006,
2358,
2099,
1010,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java | SqlBuilder.delete | public SqlBuilder delete(String tableName) {
if (StrUtil.isBlank(tableName)) {
throw new DbRuntimeException("Table name is blank !");
}
if (null != wrapper) {
// 包装表名
tableName = wrapper.wrap(tableName);
}
sql.append("DELETE FROM ").append(tableName);
return this;
} | java | public SqlBuilder delete(String tableName) {
if (StrUtil.isBlank(tableName)) {
throw new DbRuntimeException("Table name is blank !");
}
if (null != wrapper) {
// 包装表名
tableName = wrapper.wrap(tableName);
}
sql.append("DELETE FROM ").append(tableName);
return this;
} | [
"public",
"SqlBuilder",
"delete",
"(",
"String",
"tableName",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"tableName",
")",
")",
"{",
"throw",
"new",
"DbRuntimeException",
"(",
"\"Table name is blank !\"",
")",
";",
"}",
"if",
"(",
"null",
"!=",
"... | 删除
@param tableName 表名
@return 自己 | [
"删除"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java#L159-L172 | train | Delete a table. | [
30522,
2270,
29296,
8569,
23891,
2099,
3972,
12870,
1006,
5164,
2795,
18442,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
2795,
18442,
1007,
1007,
1063,
5466,
2047,
16962,
15532,
7292,
10288,
24422,
1006,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java | ExcelUtil.read03BySax | public static Excel03SaxReader read03BySax(String path, int sheetIndex, RowHandler rowHandler) {
try {
return new Excel03SaxReader(rowHandler).read(path, sheetIndex);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | java | public static Excel03SaxReader read03BySax(String path, int sheetIndex, RowHandler rowHandler) {
try {
return new Excel03SaxReader(rowHandler).read(path, sheetIndex);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | [
"public",
"static",
"Excel03SaxReader",
"read03BySax",
"(",
"String",
"path",
",",
"int",
"sheetIndex",
",",
"RowHandler",
"rowHandler",
")",
"{",
"try",
"{",
"return",
"new",
"Excel03SaxReader",
"(",
"rowHandler",
")",
".",
"read",
"(",
"path",
",",
"sheetInd... | Sax方式读取Excel03
@param path 路径
@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#L174-L180 | train | Reads an Excel 3. 0 file from a file in a SAX file. | [
30522,
2270,
10763,
24970,
2692,
2509,
3736,
2595,
16416,
4063,
3191,
2692,
2509,
3762,
3736,
2595,
1006,
5164,
4130,
1010,
20014,
7123,
22254,
10288,
1010,
5216,
11774,
3917,
5216,
11774,
3917,
30524,
2053,
26266,
3207,
4246,
28819,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.