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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel07SaxReader.java | Excel07SaxReader.read | public Excel07SaxReader read(OPCPackage opcPackage, int sheetIndex) throws POIException {
InputStream sheetInputStream = null;
try {
final XSSFReader xssfReader = new XSSFReader(opcPackage);
// 获取共享样式表
stylesTable = xssfReader.getStylesTable();
// 获取共享字符串表
this.sharedStringsTable = xssfReader.getSharedStringsTable();
if (sheetIndex > -1) {
this.sheetIndex = sheetIndex;
// 根据 rId# 或 rSheet# 查找sheet
sheetInputStream = xssfReader.getSheet(RID_PREFIX + (sheetIndex + 1));
parse(sheetInputStream);
} else {
this.sheetIndex = -1;
// 遍历所有sheet
final Iterator<InputStream> sheetInputStreams = xssfReader.getSheetsData();
while (sheetInputStreams.hasNext()) {
// 重新读取一个sheet时行归零
curRow = 0;
this.sheetIndex++;
sheetInputStream = sheetInputStreams.next();
parse(sheetInputStream);
}
}
} catch (DependencyException e) {
throw e;
} catch (Exception e) {
throw ExceptionUtil.wrap(e, POIException.class);
} finally {
IoUtil.close(sheetInputStream);
}
return this;
} | java | public Excel07SaxReader read(OPCPackage opcPackage, int sheetIndex) throws POIException {
InputStream sheetInputStream = null;
try {
final XSSFReader xssfReader = new XSSFReader(opcPackage);
// 获取共享样式表
stylesTable = xssfReader.getStylesTable();
// 获取共享字符串表
this.sharedStringsTable = xssfReader.getSharedStringsTable();
if (sheetIndex > -1) {
this.sheetIndex = sheetIndex;
// 根据 rId# 或 rSheet# 查找sheet
sheetInputStream = xssfReader.getSheet(RID_PREFIX + (sheetIndex + 1));
parse(sheetInputStream);
} else {
this.sheetIndex = -1;
// 遍历所有sheet
final Iterator<InputStream> sheetInputStreams = xssfReader.getSheetsData();
while (sheetInputStreams.hasNext()) {
// 重新读取一个sheet时行归零
curRow = 0;
this.sheetIndex++;
sheetInputStream = sheetInputStreams.next();
parse(sheetInputStream);
}
}
} catch (DependencyException e) {
throw e;
} catch (Exception e) {
throw ExceptionUtil.wrap(e, POIException.class);
} finally {
IoUtil.close(sheetInputStream);
}
return this;
} | [
"public",
"Excel07SaxReader",
"read",
"(",
"OPCPackage",
"opcPackage",
",",
"int",
"sheetIndex",
")",
"throws",
"POIException",
"{",
"InputStream",
"sheetInputStream",
"=",
"null",
";",
"try",
"{",
"final",
"XSSFReader",
"xssfReader",
"=",
"new",
"XSSFReader",
"("... | 开始读取Excel,Sheet编号从0开始计数
@param opcPackage {@link OPCPackage},Excel包
@param sheetIndex Excel中的sheet编号,如果为-1处理所有编号的sheet
@return this
@throws POIException POI异常 | [
"开始读取Excel,Sheet编号从0开始计数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel07SaxReader.java#L138-L173 | train | Reads an Excel file from an OPCPackage. | [
30522,
2270,
24970,
2692,
2581,
3736,
2595,
16416,
4063,
3191,
1006,
6728,
21906,
8684,
4270,
6728,
21906,
8684,
4270,
1010,
20014,
7123,
22254,
10288,
1007,
11618,
13433,
2666,
2595,
24422,
1063,
20407,
25379,
7123,
2378,
18780,
21422,
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... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslUtils.java | SslUtils.unsignedShortBE | @SuppressWarnings("deprecation")
private static int unsignedShortBE(ByteBuf buffer, int offset) {
return buffer.order() == ByteOrder.BIG_ENDIAN ?
buffer.getUnsignedShort(offset) : buffer.getUnsignedShortLE(offset);
} | java | @SuppressWarnings("deprecation")
private static int unsignedShortBE(ByteBuf buffer, int offset) {
return buffer.order() == ByteOrder.BIG_ENDIAN ?
buffer.getUnsignedShort(offset) : buffer.getUnsignedShortLE(offset);
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"static",
"int",
"unsignedShortBE",
"(",
"ByteBuf",
"buffer",
",",
"int",
"offset",
")",
"{",
"return",
"buffer",
".",
"order",
"(",
")",
"==",
"ByteOrder",
".",
"BIG_ENDIAN",
"?",
"buffer",
".... | Reads a big-endian unsigned short integer from the buffer | [
"Reads",
"a",
"big",
"-",
"endian",
"unsigned",
"short",
"integer",
"from",
"the",
"buffer"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslUtils.java#L239-L243 | train | Get unsigned short from buffer. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
2139,
28139,
10719,
1000,
1007,
2797,
10763,
20014,
27121,
22231,
5339,
4783,
1006,
24880,
8569,
2546,
17698,
1010,
20014,
16396,
1007,
1063,
2709,
17698,
1012,
2344,
1006,
1007,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionMetrics.java | ResultPartitionMetrics.refreshAndGetTotal | long refreshAndGetTotal() {
long total = 0;
for (ResultSubpartition part : partition.getAllPartitions()) {
total += part.unsynchronizedGetNumberOfQueuedBuffers();
}
return total;
} | java | long refreshAndGetTotal() {
long total = 0;
for (ResultSubpartition part : partition.getAllPartitions()) {
total += part.unsynchronizedGetNumberOfQueuedBuffers();
}
return total;
} | [
"long",
"refreshAndGetTotal",
"(",
")",
"{",
"long",
"total",
"=",
"0",
";",
"for",
"(",
"ResultSubpartition",
"part",
":",
"partition",
".",
"getAllPartitions",
"(",
")",
")",
"{",
"total",
"+=",
"part",
".",
"unsynchronizedGetNumberOfQueuedBuffers",
"(",
")"... | Iterates over all sub-partitions and collects the total number of queued buffers in a
best-effort way.
@return total number of queued buffers | [
"Iterates",
"over",
"all",
"sub",
"-",
"partitions",
"and",
"collects",
"the",
"total",
"number",
"of",
"queued",
"buffers",
"in",
"a",
"best",
"-",
"effort",
"way",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionMetrics.java#L49-L57 | train | This method is used to refresh the result and return the total number of queued buffers in the result. | [
30522,
2146,
25416,
21898,
5685,
18150,
3406,
9080,
1006,
1007,
1063,
2146,
2561,
1027,
1014,
1025,
2005,
1006,
3463,
12083,
19362,
3775,
3508,
2112,
1024,
13571,
1012,
2131,
8095,
19362,
3775,
9285,
1006,
1007,
1007,
1063,
2561,
1009,
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/lang/Validator.java | Validator.validateIpv4 | public static <T extends CharSequence> T validateIpv4(T value, String errorMsg) throws ValidateException {
if (false == isIpv4(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validateIpv4(T value, String errorMsg) throws ValidateException {
if (false == isIpv4(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateIpv4",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isIpv4",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"Va... | 验证是否为IPV4地址
@param <T> 字符串类型
@param value 值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证是否为IPV4地址"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L809-L814 | train | Validate an IPv4 address. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
9398,
3686,
11514,
2615,
2549,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
1027,
2003,
11514... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/summarize/aggregation/NumericSummaryAggregator.java | NumericSummaryAggregator.aggregate | @Override
public void aggregate(T value) {
if (value == null) {
nullCount++;
}
else if (isNan(value)) {
nanCount++;
}
else if (isInfinite(value)) {
infinityCount++;
}
else {
nonMissingCount++;
min.aggregate(value);
max.aggregate(value);
sum.aggregate(value);
double doubleValue = value.doubleValue();
double delta = doubleValue - mean.value();
mean = mean.add(delta / nonMissingCount);
m2 = m2.add(delta * (doubleValue - mean.value()));
}
} | java | @Override
public void aggregate(T value) {
if (value == null) {
nullCount++;
}
else if (isNan(value)) {
nanCount++;
}
else if (isInfinite(value)) {
infinityCount++;
}
else {
nonMissingCount++;
min.aggregate(value);
max.aggregate(value);
sum.aggregate(value);
double doubleValue = value.doubleValue();
double delta = doubleValue - mean.value();
mean = mean.add(delta / nonMissingCount);
m2 = m2.add(delta * (doubleValue - mean.value()));
}
} | [
"@",
"Override",
"public",
"void",
"aggregate",
"(",
"T",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"nullCount",
"++",
";",
"}",
"else",
"if",
"(",
"isNan",
"(",
"value",
")",
")",
"{",
"nanCount",
"++",
";",
"}",
"else",
"if... | Add a value to the current aggregation. | [
"Add",
"a",
"value",
"to",
"the",
"current",
"aggregation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/summarize/aggregation/NumericSummaryAggregator.java#L66-L90 | train | This method is called to aggregate the value into the internal data structures. | [
30522,
1030,
2058,
15637,
2270,
11675,
9572,
1006,
1056,
3643,
1007,
1063,
2065,
1006,
3643,
1027,
1027,
19701,
1007,
1063,
19701,
3597,
16671,
1009,
1009,
1025,
1065,
2842,
2065,
1006,
3475,
2319,
1006,
3643,
1007,
1007,
1063,
16660,
3597,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.toTitleCase | public UTF8String toTitleCase() {
if (numBytes == 0) {
return EMPTY_UTF8;
}
byte[] bytes = new byte[numBytes];
for (int i = 0; i < numBytes; i++) {
byte b = getByte(i);
if (i == 0 || getByte(i - 1) == ' ') {
if (numBytesForFirstByte(b) != 1) {
// fallback
return toTitleCaseSlow();
}
int upper = Character.toTitleCase(b);
if (upper > 127) {
// fallback
return toTitleCaseSlow();
}
bytes[i] = (byte) upper;
} else {
bytes[i] = b;
}
}
return fromBytes(bytes);
} | java | public UTF8String toTitleCase() {
if (numBytes == 0) {
return EMPTY_UTF8;
}
byte[] bytes = new byte[numBytes];
for (int i = 0; i < numBytes; i++) {
byte b = getByte(i);
if (i == 0 || getByte(i - 1) == ' ') {
if (numBytesForFirstByte(b) != 1) {
// fallback
return toTitleCaseSlow();
}
int upper = Character.toTitleCase(b);
if (upper > 127) {
// fallback
return toTitleCaseSlow();
}
bytes[i] = (byte) upper;
} else {
bytes[i] = b;
}
}
return fromBytes(bytes);
} | [
"public",
"UTF8String",
"toTitleCase",
"(",
")",
"{",
"if",
"(",
"numBytes",
"==",
"0",
")",
"{",
"return",
"EMPTY_UTF8",
";",
"}",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"numBytes",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"... | Returns the title case of this string, that could be used as title. | [
"Returns",
"the",
"title",
"case",
"of",
"this",
"string",
"that",
"could",
"be",
"used",
"as",
"title",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L450-L474 | train | Convert this object to a title case string. | [
30522,
2270,
21183,
2546,
2620,
3367,
4892,
2000,
3775,
9286,
18382,
1006,
1007,
1063,
2065,
1006,
15903,
17250,
2015,
1027,
1027,
1014,
1007,
1063,
2709,
4064,
1035,
21183,
2546,
2620,
1025,
1065,
24880,
1031,
1033,
27507,
1027,
2047,
2488... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/service/RdbEtlService.java | RdbEtlService.executeSqlImport | protected boolean executeSqlImport(DataSource srcDS, String sql, List<Object> values,
AdapterConfig.AdapterMapping mapping, AtomicLong impCount, List<String> errMsg) {
try {
DbMapping dbMapping = (DbMapping) mapping;
Map<String, String> columnsMap = new LinkedHashMap<>();
Map<String, Integer> columnType = new LinkedHashMap<>();
Util.sqlRS(targetDS, "SELECT * FROM " + SyncUtil.getDbTableName(dbMapping) + " LIMIT 1 ", rs -> {
try {
ResultSetMetaData rsd = rs.getMetaData();
int columnCount = rsd.getColumnCount();
List<String> columns = new ArrayList<>();
for (int i = 1; i <= columnCount; i++) {
columnType.put(rsd.getColumnName(i).toLowerCase(), rsd.getColumnType(i));
columns.add(rsd.getColumnName(i));
}
columnsMap.putAll(SyncUtil.getColumnsMap(dbMapping, columns));
return true;
} catch (Exception e) {
logger.error(e.getMessage(), e);
return false;
}
});
Util.sqlRS(srcDS, sql, values, rs -> {
int idx = 1;
try {
boolean completed = false;
StringBuilder insertSql = new StringBuilder();
insertSql.append("INSERT INTO ").append(SyncUtil.getDbTableName(dbMapping)).append(" (");
columnsMap
.forEach((targetColumnName, srcColumnName) -> insertSql.append(targetColumnName).append(","));
int len = insertSql.length();
insertSql.delete(len - 1, len).append(") VALUES (");
int mapLen = columnsMap.size();
for (int i = 0; i < mapLen; i++) {
insertSql.append("?,");
}
len = insertSql.length();
insertSql.delete(len - 1, len).append(")");
try (Connection connTarget = targetDS.getConnection();
PreparedStatement pstmt = connTarget.prepareStatement(insertSql.toString())) {
connTarget.setAutoCommit(false);
while (rs.next()) {
completed = false;
pstmt.clearParameters();
// 删除数据
Map<String, Object> pkVal = new LinkedHashMap<>();
StringBuilder deleteSql = new StringBuilder(
"DELETE FROM " + SyncUtil.getDbTableName(dbMapping) + " WHERE ");
appendCondition(dbMapping, deleteSql, pkVal, rs);
try (PreparedStatement pstmt2 = connTarget.prepareStatement(deleteSql.toString())) {
int k = 1;
for (Object val : pkVal.values()) {
pstmt2.setObject(k++, val);
}
pstmt2.execute();
}
int i = 1;
for (Map.Entry<String, String> entry : columnsMap.entrySet()) {
String targetClolumnName = entry.getKey();
String srcColumnName = entry.getValue();
if (srcColumnName == null) {
srcColumnName = targetClolumnName;
}
Integer type = columnType.get(targetClolumnName.toLowerCase());
Object value = rs.getObject(srcColumnName);
if (value != null) {
SyncUtil.setPStmt(type, pstmt, value, i);
} else {
pstmt.setNull(i, type);
}
i++;
}
pstmt.execute();
if (logger.isTraceEnabled()) {
logger.trace("Insert into target table, sql: {}", insertSql);
}
if (idx % dbMapping.getCommitBatch() == 0) {
connTarget.commit();
completed = true;
}
idx++;
impCount.incrementAndGet();
if (logger.isDebugEnabled()) {
logger.debug("successful import count:" + impCount.get());
}
}
if (!completed) {
connTarget.commit();
}
}
} catch (Exception e) {
logger.error(dbMapping.getTable() + " etl failed! ==>" + e.getMessage(), e);
errMsg.add(dbMapping.getTable() + " etl failed! ==>" + e.getMessage());
}
return idx;
});
return true;
} catch (Exception e) {
logger.error(e.getMessage(), e);
return false;
}
} | java | protected boolean executeSqlImport(DataSource srcDS, String sql, List<Object> values,
AdapterConfig.AdapterMapping mapping, AtomicLong impCount, List<String> errMsg) {
try {
DbMapping dbMapping = (DbMapping) mapping;
Map<String, String> columnsMap = new LinkedHashMap<>();
Map<String, Integer> columnType = new LinkedHashMap<>();
Util.sqlRS(targetDS, "SELECT * FROM " + SyncUtil.getDbTableName(dbMapping) + " LIMIT 1 ", rs -> {
try {
ResultSetMetaData rsd = rs.getMetaData();
int columnCount = rsd.getColumnCount();
List<String> columns = new ArrayList<>();
for (int i = 1; i <= columnCount; i++) {
columnType.put(rsd.getColumnName(i).toLowerCase(), rsd.getColumnType(i));
columns.add(rsd.getColumnName(i));
}
columnsMap.putAll(SyncUtil.getColumnsMap(dbMapping, columns));
return true;
} catch (Exception e) {
logger.error(e.getMessage(), e);
return false;
}
});
Util.sqlRS(srcDS, sql, values, rs -> {
int idx = 1;
try {
boolean completed = false;
StringBuilder insertSql = new StringBuilder();
insertSql.append("INSERT INTO ").append(SyncUtil.getDbTableName(dbMapping)).append(" (");
columnsMap
.forEach((targetColumnName, srcColumnName) -> insertSql.append(targetColumnName).append(","));
int len = insertSql.length();
insertSql.delete(len - 1, len).append(") VALUES (");
int mapLen = columnsMap.size();
for (int i = 0; i < mapLen; i++) {
insertSql.append("?,");
}
len = insertSql.length();
insertSql.delete(len - 1, len).append(")");
try (Connection connTarget = targetDS.getConnection();
PreparedStatement pstmt = connTarget.prepareStatement(insertSql.toString())) {
connTarget.setAutoCommit(false);
while (rs.next()) {
completed = false;
pstmt.clearParameters();
// 删除数据
Map<String, Object> pkVal = new LinkedHashMap<>();
StringBuilder deleteSql = new StringBuilder(
"DELETE FROM " + SyncUtil.getDbTableName(dbMapping) + " WHERE ");
appendCondition(dbMapping, deleteSql, pkVal, rs);
try (PreparedStatement pstmt2 = connTarget.prepareStatement(deleteSql.toString())) {
int k = 1;
for (Object val : pkVal.values()) {
pstmt2.setObject(k++, val);
}
pstmt2.execute();
}
int i = 1;
for (Map.Entry<String, String> entry : columnsMap.entrySet()) {
String targetClolumnName = entry.getKey();
String srcColumnName = entry.getValue();
if (srcColumnName == null) {
srcColumnName = targetClolumnName;
}
Integer type = columnType.get(targetClolumnName.toLowerCase());
Object value = rs.getObject(srcColumnName);
if (value != null) {
SyncUtil.setPStmt(type, pstmt, value, i);
} else {
pstmt.setNull(i, type);
}
i++;
}
pstmt.execute();
if (logger.isTraceEnabled()) {
logger.trace("Insert into target table, sql: {}", insertSql);
}
if (idx % dbMapping.getCommitBatch() == 0) {
connTarget.commit();
completed = true;
}
idx++;
impCount.incrementAndGet();
if (logger.isDebugEnabled()) {
logger.debug("successful import count:" + impCount.get());
}
}
if (!completed) {
connTarget.commit();
}
}
} catch (Exception e) {
logger.error(dbMapping.getTable() + " etl failed! ==>" + e.getMessage(), e);
errMsg.add(dbMapping.getTable() + " etl failed! ==>" + e.getMessage());
}
return idx;
});
return true;
} catch (Exception e) {
logger.error(e.getMessage(), e);
return false;
}
} | [
"protected",
"boolean",
"executeSqlImport",
"(",
"DataSource",
"srcDS",
",",
"String",
"sql",
",",
"List",
"<",
"Object",
">",
"values",
",",
"AdapterConfig",
".",
"AdapterMapping",
"mapping",
",",
"AtomicLong",
"impCount",
",",
"List",
"<",
"String",
">",
"er... | 执行导入 | [
"执行导入"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/service/RdbEtlService.java#L49-L167 | train | Execute SQL import. | [
30522,
5123,
22017,
20898,
15389,
2015,
4160,
17960,
6442,
1006,
2951,
6499,
3126,
3401,
5034,
19797,
2015,
1010,
5164,
29296,
1010,
2862,
1026,
4874,
1028,
5300,
1010,
15581,
2121,
8663,
8873,
2290,
1012,
15581,
2121,
2863,
14853,
12375,
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/BinaryFormat.java | BinaryFormat.readBinaryStringFieldFromSegments | static BinaryString readBinaryStringFieldFromSegments(
MemorySegment[] segments, int baseOffset, int fieldOffset,
long variablePartOffsetAndLen) {
long mark = variablePartOffsetAndLen & HIGHEST_FIRST_BIT;
if (mark == 0) {
final int subOffset = (int) (variablePartOffsetAndLen >> 32);
final int len = (int) variablePartOffsetAndLen;
return new BinaryString(segments, baseOffset + subOffset, len);
} else {
int len = (int) ((variablePartOffsetAndLen & HIGHEST_SECOND_TO_EIGHTH_BIT) >>> 56);
if (SegmentsUtil.LITTLE_ENDIAN) {
return new BinaryString(segments, fieldOffset, len);
} else {
// fieldOffset + 1 to skip header.
return new BinaryString(segments, fieldOffset + 1, len);
}
}
} | java | static BinaryString readBinaryStringFieldFromSegments(
MemorySegment[] segments, int baseOffset, int fieldOffset,
long variablePartOffsetAndLen) {
long mark = variablePartOffsetAndLen & HIGHEST_FIRST_BIT;
if (mark == 0) {
final int subOffset = (int) (variablePartOffsetAndLen >> 32);
final int len = (int) variablePartOffsetAndLen;
return new BinaryString(segments, baseOffset + subOffset, len);
} else {
int len = (int) ((variablePartOffsetAndLen & HIGHEST_SECOND_TO_EIGHTH_BIT) >>> 56);
if (SegmentsUtil.LITTLE_ENDIAN) {
return new BinaryString(segments, fieldOffset, len);
} else {
// fieldOffset + 1 to skip header.
return new BinaryString(segments, fieldOffset + 1, len);
}
}
} | [
"static",
"BinaryString",
"readBinaryStringFieldFromSegments",
"(",
"MemorySegment",
"[",
"]",
"segments",
",",
"int",
"baseOffset",
",",
"int",
"fieldOffset",
",",
"long",
"variablePartOffsetAndLen",
")",
"{",
"long",
"mark",
"=",
"variablePartOffsetAndLen",
"&",
"HI... | Get binary string, if len less than 8, will be include in variablePartOffsetAndLen.
<p>Note: Need to consider the ByteOrder.
@param baseOffset base offset of composite binary format.
@param fieldOffset absolute start offset of 'variablePartOffsetAndLen'.
@param variablePartOffsetAndLen a long value, real data or offset and len. | [
"Get",
"binary",
"string",
"if",
"len",
"less",
"than",
"8",
"will",
"be",
"include",
"in",
"variablePartOffsetAndLen",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryFormat.java#L147-L164 | train | Reads a binary string field from the given array of memory segments. | [
30522,
10763,
12441,
3367,
4892,
3191,
21114,
24769,
18886,
3070,
3790,
19699,
22225,
13910,
8163,
1006,
3638,
3366,
21693,
4765,
1031,
1033,
9214,
1010,
20014,
2918,
27475,
3388,
1010,
20014,
2492,
27475,
3388,
1010,
2146,
8023,
19362,
3406,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | handler/src/main/java/com/networknt/handler/Handler.java | Handler.addPathChain | private static void addPathChain(PathChain pathChain) {
HttpString method = new HttpString(pathChain.getMethod());
// Use a random integer as the id for a given path.
Integer randInt = new Random().nextInt();
while (handlerListById.containsKey(randInt.toString())) {
randInt = new Random().nextInt();
}
// Flatten out the execution list from a mix of middleware chains and handlers.
List<HttpHandler> handlers = getHandlersFromExecList(pathChain.getExec());
if(handlers.size() > 0) {
// If a matcher already exists for the given type, at to that instead of
// creating a new one.
PathTemplateMatcher<String> pathTemplateMatcher = methodToMatcherMap.containsKey(method)
? methodToMatcherMap.get(method)
: new PathTemplateMatcher<>();
if(pathTemplateMatcher.get(pathChain.getPath()) == null) { pathTemplateMatcher.add(pathChain.getPath(), randInt.toString()); }
methodToMatcherMap.put(method, pathTemplateMatcher);
handlerListById.put(randInt.toString(), handlers);
}
} | java | private static void addPathChain(PathChain pathChain) {
HttpString method = new HttpString(pathChain.getMethod());
// Use a random integer as the id for a given path.
Integer randInt = new Random().nextInt();
while (handlerListById.containsKey(randInt.toString())) {
randInt = new Random().nextInt();
}
// Flatten out the execution list from a mix of middleware chains and handlers.
List<HttpHandler> handlers = getHandlersFromExecList(pathChain.getExec());
if(handlers.size() > 0) {
// If a matcher already exists for the given type, at to that instead of
// creating a new one.
PathTemplateMatcher<String> pathTemplateMatcher = methodToMatcherMap.containsKey(method)
? methodToMatcherMap.get(method)
: new PathTemplateMatcher<>();
if(pathTemplateMatcher.get(pathChain.getPath()) == null) { pathTemplateMatcher.add(pathChain.getPath(), randInt.toString()); }
methodToMatcherMap.put(method, pathTemplateMatcher);
handlerListById.put(randInt.toString(), handlers);
}
} | [
"private",
"static",
"void",
"addPathChain",
"(",
"PathChain",
"pathChain",
")",
"{",
"HttpString",
"method",
"=",
"new",
"HttpString",
"(",
"pathChain",
".",
"getMethod",
"(",
")",
")",
";",
"// Use a random integer as the id for a given path.",
"Integer",
"randInt",... | Add a PathChain (having a non-null path) to the handler data structures. | [
"Add",
"a",
"PathChain",
"(",
"having",
"a",
"non",
"-",
"null",
"path",
")",
"to",
"the",
"handler",
"data",
"structures",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/handler/src/main/java/com/networknt/handler/Handler.java#L172-L194 | train | Adds a path chain to the internal map. | [
30522,
2797,
10763,
11675,
5587,
15069,
24925,
2078,
1006,
4130,
24925,
2078,
4130,
24925,
2078,
1007,
1063,
16770,
18886,
3070,
4118,
1027,
2047,
16770,
18886,
3070,
1006,
4130,
24925,
2078,
1012,
2131,
11368,
6806,
2094,
1006,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/plan/PlanNode.java | PlanNode.setCosts | public void setCosts(Costs nodeCosts) {
// set the node costs
this.nodeCosts = nodeCosts;
// the cumulative costs are the node costs plus the costs of all inputs
this.cumulativeCosts = nodeCosts.clone();
// add all the normal inputs
for (PlanNode pred : getPredecessors()) {
Costs parentCosts = pred.getCumulativeCostsShare();
if (parentCosts != null) {
this.cumulativeCosts.addCosts(parentCosts);
} else {
throw new CompilerException("Trying to set the costs of an operator before the predecessor costs are computed.");
}
}
// add all broadcast variable inputs
if (this.broadcastInputs != null) {
for (NamedChannel nc : this.broadcastInputs) {
Costs bcInputCost = nc.getSource().getCumulativeCostsShare();
if (bcInputCost != null) {
this.cumulativeCosts.addCosts(bcInputCost);
} else {
throw new CompilerException("Trying to set the costs of an operator before the broadcast input costs are computed.");
}
}
}
} | java | public void setCosts(Costs nodeCosts) {
// set the node costs
this.nodeCosts = nodeCosts;
// the cumulative costs are the node costs plus the costs of all inputs
this.cumulativeCosts = nodeCosts.clone();
// add all the normal inputs
for (PlanNode pred : getPredecessors()) {
Costs parentCosts = pred.getCumulativeCostsShare();
if (parentCosts != null) {
this.cumulativeCosts.addCosts(parentCosts);
} else {
throw new CompilerException("Trying to set the costs of an operator before the predecessor costs are computed.");
}
}
// add all broadcast variable inputs
if (this.broadcastInputs != null) {
for (NamedChannel nc : this.broadcastInputs) {
Costs bcInputCost = nc.getSource().getCumulativeCostsShare();
if (bcInputCost != null) {
this.cumulativeCosts.addCosts(bcInputCost);
} else {
throw new CompilerException("Trying to set the costs of an operator before the broadcast input costs are computed.");
}
}
}
} | [
"public",
"void",
"setCosts",
"(",
"Costs",
"nodeCosts",
")",
"{",
"// set the node costs",
"this",
".",
"nodeCosts",
"=",
"nodeCosts",
";",
"// the cumulative costs are the node costs plus the costs of all inputs",
"this",
".",
"cumulativeCosts",
"=",
"nodeCosts",
".",
"... | Sets the basic cost for this node to the given value, and sets the cumulative costs
to those costs plus the cost shares of all inputs (regular and broadcast).
@param nodeCosts The already knows costs for this node
(this cost a produces by a concrete {@code OptimizerNode} subclass. | [
"Sets",
"the",
"basic",
"cost",
"for",
"this",
"node",
"to",
"the",
"given",
"value",
"and",
"sets",
"the",
"cumulative",
"costs",
"to",
"those",
"costs",
"plus",
"the",
"cost",
"shares",
"of",
"all",
"inputs",
"(",
"regular",
"and",
"broadcast",
")",
".... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/plan/PlanNode.java#L274-L303 | train | Sets the costs of the operator. | [
30522,
2270,
11675,
2275,
13186,
3215,
1006,
5366,
13045,
13186,
3215,
1007,
1063,
1013,
1013,
2275,
1996,
13045,
5366,
2023,
1012,
13045,
13186,
3215,
1027,
13045,
13186,
3215,
1025,
1013,
1013,
1996,
23260,
5366,
2024,
1996,
13045,
5366,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java | HashUtil.apHash | public static int apHash(String str) {
int hash = 0;
for (int i = 0; i < str.length(); i++) {
hash ^= ((i & 1) == 0) ? ((hash << 7) ^ str.charAt(i) ^ (hash >> 3)) : (~((hash << 11) ^ str.charAt(i) ^ (hash >> 5)));
}
// return (hash & 0x7FFFFFFF);
return hash;
} | java | public static int apHash(String str) {
int hash = 0;
for (int i = 0; i < str.length(); i++) {
hash ^= ((i & 1) == 0) ? ((hash << 7) ^ str.charAt(i) ^ (hash >> 3)) : (~((hash << 11) ^ str.charAt(i) ^ (hash >> 5)));
}
// return (hash & 0x7FFFFFFF);
return hash;
} | [
"public",
"static",
"int",
"apHash",
"(",
"String",
"str",
")",
"{",
"int",
"hash",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"hash",
"^=",
"(",
"(",
"i",
"&",
... | AP算法
@param str 字符串
@return hash值 | [
"AP算法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java#L346-L355 | train | Returns a hash code for a given string. | [
30522,
2270,
10763,
20014,
9706,
14949,
2232,
1006,
5164,
2358,
2099,
1007,
1063,
20014,
23325,
1027,
1014,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
2358,
2099,
1012,
3091,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.offset | public static DateTime offset(Date date, DateField dateField, int offset) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(dateField.getValue(), offset);
return new DateTime(cal.getTime());
} | java | public static DateTime offset(Date date, DateField dateField, int offset) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(dateField.getValue(), offset);
return new DateTime(cal.getTime());
} | [
"public",
"static",
"DateTime",
"offset",
"(",
"Date",
"date",
",",
"DateField",
"dateField",
",",
"int",
"offset",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"date",
")",
";",
"cal",
".... | 获取指定日期偏移指定时间后的时间
@param date 基准日期
@param dateField 偏移的粒度大小(小时、天、月等){@link DateField}
@param offset 偏移量,正数为向后偏移,负数为向前偏移
@return 偏移后的日期 | [
"获取指定日期偏移指定时间后的时间"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1198-L1203 | train | Creates a DateTime object that represents a date in the specified DateField with the specified offset. | [
30522,
2270,
10763,
3058,
7292,
16396,
1006,
3058,
3058,
1010,
3058,
3790,
3058,
3790,
1010,
20014,
16396,
1007,
1063,
8094,
10250,
1027,
8094,
1012,
2131,
7076,
26897,
1006,
1007,
1025,
10250,
1012,
2275,
7292,
1006,
3058,
1007,
1025,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/AhoCorasick/AhoCorasickDoubleArrayTrie.java | AhoCorasickDoubleArrayTrie.transitionWithRoot | protected int transitionWithRoot(int nodePos, char c)
{
int b = base[nodePos];
int p;
p = b + c + 1;
if (b != check[p])
{
if (nodePos == 0) return 0;
return -1;
}
return p;
} | java | protected int transitionWithRoot(int nodePos, char c)
{
int b = base[nodePos];
int p;
p = b + c + 1;
if (b != check[p])
{
if (nodePos == 0) return 0;
return -1;
}
return p;
} | [
"protected",
"int",
"transitionWithRoot",
"(",
"int",
"nodePos",
",",
"char",
"c",
")",
"{",
"int",
"b",
"=",
"base",
"[",
"nodePos",
"]",
";",
"int",
"p",
";",
"p",
"=",
"b",
"+",
"c",
"+",
"1",
";",
"if",
"(",
"b",
"!=",
"check",
"[",
"p",
... | c转移,如果是根节点则返回自己
@param nodePos
@param c
@return | [
"c转移,如果是根节点则返回自己"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/AhoCorasick/AhoCorasickDoubleArrayTrie.java#L455-L468 | train | transitionWithRoot This is a helper method that is used to determine the root node position. | [
30522,
5123,
20014,
6653,
24415,
3217,
4140,
1006,
20014,
13045,
6873,
2015,
1010,
25869,
1039,
1007,
1063,
20014,
1038,
1027,
2918,
1031,
13045,
6873,
2015,
1033,
1025,
20014,
1052,
1025,
1052,
1027,
1038,
1009,
1039,
1009,
1015,
1025,
206... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/util/SetCache.java | SetCache.add | public <U extends UnsortedGrouping<?>> void add(int id, U set) {
cacheSetType(id, SetType.UNSORTED_GROUPING);
unsortedGroupings.put(id, set);
} | java | public <U extends UnsortedGrouping<?>> void add(int id, U set) {
cacheSetType(id, SetType.UNSORTED_GROUPING);
unsortedGroupings.put(id, set);
} | [
"public",
"<",
"U",
"extends",
"UnsortedGrouping",
"<",
"?",
">",
">",
"void",
"add",
"(",
"int",
"id",
",",
"U",
"set",
")",
"{",
"cacheSetType",
"(",
"id",
",",
"SetType",
".",
"UNSORTED_GROUPING",
")",
";",
"unsortedGroupings",
".",
"put",
"(",
"id"... | Adds the given {@link UnsortedGrouping} to this cache for the given ID.
@param id Set ID
@param set UnsortedGrouping to add
@param <U> UnsortedGrouping class | [
"Adds",
"the",
"given",
"{",
"@link",
"UnsortedGrouping",
"}",
"to",
"this",
"cache",
"for",
"the",
"given",
"ID",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/util/SetCache.java#L83-L86 | train | Adds the given unsorted grouping to the set. | [
30522,
2270,
1026,
1057,
8908,
4895,
21748,
3064,
17058,
2075,
1026,
1029,
1028,
1028,
11675,
5587,
1006,
20014,
8909,
1010,
1057,
2275,
1007,
1063,
17053,
21678,
18863,
1006,
8909,
1010,
2275,
13874,
1012,
4895,
21748,
3064,
1035,
19765,
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/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/array/ByteArrayMethods.java | ByteArrayMethods.arrayEquals | public static boolean arrayEquals(
Object leftBase, long leftOffset, Object rightBase, long rightOffset, final long length) {
int i = 0;
// check if stars align and we can get both offsets to be aligned
if ((leftOffset % 8) == (rightOffset % 8)) {
while ((leftOffset + i) % 8 != 0 && i < length) {
if (Platform.getByte(leftBase, leftOffset + i) !=
Platform.getByte(rightBase, rightOffset + i)) {
return false;
}
i += 1;
}
}
// for architectures that support unaligned accesses, chew it up 8 bytes at a time
if (unaligned || (((leftOffset + i) % 8 == 0) && ((rightOffset + i) % 8 == 0))) {
while (i <= length - 8) {
if (Platform.getLong(leftBase, leftOffset + i) !=
Platform.getLong(rightBase, rightOffset + i)) {
return false;
}
i += 8;
}
}
// this will finish off the unaligned comparisons, or do the entire aligned
// comparison whichever is needed.
while (i < length) {
if (Platform.getByte(leftBase, leftOffset + i) !=
Platform.getByte(rightBase, rightOffset + i)) {
return false;
}
i += 1;
}
return true;
} | java | public static boolean arrayEquals(
Object leftBase, long leftOffset, Object rightBase, long rightOffset, final long length) {
int i = 0;
// check if stars align and we can get both offsets to be aligned
if ((leftOffset % 8) == (rightOffset % 8)) {
while ((leftOffset + i) % 8 != 0 && i < length) {
if (Platform.getByte(leftBase, leftOffset + i) !=
Platform.getByte(rightBase, rightOffset + i)) {
return false;
}
i += 1;
}
}
// for architectures that support unaligned accesses, chew it up 8 bytes at a time
if (unaligned || (((leftOffset + i) % 8 == 0) && ((rightOffset + i) % 8 == 0))) {
while (i <= length - 8) {
if (Platform.getLong(leftBase, leftOffset + i) !=
Platform.getLong(rightBase, rightOffset + i)) {
return false;
}
i += 8;
}
}
// this will finish off the unaligned comparisons, or do the entire aligned
// comparison whichever is needed.
while (i < length) {
if (Platform.getByte(leftBase, leftOffset + i) !=
Platform.getByte(rightBase, rightOffset + i)) {
return false;
}
i += 1;
}
return true;
} | [
"public",
"static",
"boolean",
"arrayEquals",
"(",
"Object",
"leftBase",
",",
"long",
"leftOffset",
",",
"Object",
"rightBase",
",",
"long",
"rightOffset",
",",
"final",
"long",
"length",
")",
"{",
"int",
"i",
"=",
"0",
";",
"// check if stars align and we can g... | Optimized byte array equality check for byte arrays.
@return true if the arrays are equal, false otherwise | [
"Optimized",
"byte",
"array",
"equality",
"check",
"for",
"byte",
"arrays",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/array/ByteArrayMethods.java#L59-L93 | train | Checks if two arrays are equal. | [
30522,
2270,
10763,
22017,
20898,
9140,
2063,
26426,
2015,
1006,
4874,
2187,
15058,
1010,
2146,
2187,
27475,
3388,
1010,
4874,
2157,
15058,
1010,
2146,
2157,
27475,
3388,
1010,
2345,
2146,
3091,
1007,
1063,
20014,
1045,
1027,
1014,
1025,
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/shell/AnsiString.java | AnsiString.append | AnsiString append(String text, Code... codes) {
if (codes.length == 0 || !isAnsiSupported()) {
this.value.append(text);
return this;
}
Ansi ansi = Ansi.ansi();
for (Code code : codes) {
ansi = applyCode(ansi, code);
}
this.value.append(ansi.a(text).reset().toString());
return this;
} | java | AnsiString append(String text, Code... codes) {
if (codes.length == 0 || !isAnsiSupported()) {
this.value.append(text);
return this;
}
Ansi ansi = Ansi.ansi();
for (Code code : codes) {
ansi = applyCode(ansi, code);
}
this.value.append(ansi.a(text).reset().toString());
return this;
} | [
"AnsiString",
"append",
"(",
"String",
"text",
",",
"Code",
"...",
"codes",
")",
"{",
"if",
"(",
"codes",
".",
"length",
"==",
"0",
"||",
"!",
"isAnsiSupported",
"(",
")",
")",
"{",
"this",
".",
"value",
".",
"append",
"(",
"text",
")",
";",
"retur... | Append text with the given ANSI codes.
@param text the text to append
@param codes the ANSI codes
@return this string | [
"Append",
"text",
"with",
"the",
"given",
"ANSI",
"codes",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/AnsiString.java#L49-L60 | train | Append the text to this ANSI string using the specified codes. | [
30522,
2019,
6190,
18886,
3070,
10439,
10497,
1006,
5164,
3793,
1010,
3642,
1012,
1012,
1012,
9537,
1007,
1063,
2065,
1006,
9537,
1012,
3091,
1027,
1027,
1014,
1064,
1064,
999,
18061,
11745,
6279,
6442,
2098,
1006,
1007,
1007,
1063,
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/bean/BeanUtil.java | BeanUtil.copyProperties | public static void copyProperties(Object source, Object target, boolean ignoreCase) {
BeanCopier.create(source, target, CopyOptions.create().setIgnoreCase(ignoreCase)).copy();
} | java | public static void copyProperties(Object source, Object target, boolean ignoreCase) {
BeanCopier.create(source, target, CopyOptions.create().setIgnoreCase(ignoreCase)).copy();
} | [
"public",
"static",
"void",
"copyProperties",
"(",
"Object",
"source",
",",
"Object",
"target",
",",
"boolean",
"ignoreCase",
")",
"{",
"BeanCopier",
".",
"create",
"(",
"source",
",",
"target",
",",
"CopyOptions",
".",
"create",
"(",
")",
".",
"setIgnoreCas... | 复制Bean对象属性<br>
@param source 源Bean对象
@param target 目标Bean对象
@param ignoreCase 是否忽略大小写 | [
"复制Bean对象属性<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L605-L607 | train | Copies properties from source to target. | [
30522,
2270,
10763,
11675,
6100,
21572,
4842,
7368,
1006,
4874,
3120,
1010,
4874,
4539,
1010,
22017,
20898,
8568,
18382,
1007,
1063,
14068,
3597,
14756,
2099,
1012,
3443,
1006,
3120,
1010,
4539,
1010,
6100,
7361,
9285,
1012,
3443,
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-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java | SqlExecutor.executeBatch | public static int[] executeBatch(Connection conn, String sql, Object[]... paramsBatch) throws SQLException {
return executeBatch(conn, sql, new ArrayIter<Object[]>(paramsBatch));
} | java | public static int[] executeBatch(Connection conn, String sql, Object[]... paramsBatch) throws SQLException {
return executeBatch(conn, sql, new ArrayIter<Object[]>(paramsBatch));
} | [
"public",
"static",
"int",
"[",
"]",
"executeBatch",
"(",
"Connection",
"conn",
",",
"String",
"sql",
",",
"Object",
"[",
"]",
"...",
"paramsBatch",
")",
"throws",
"SQLException",
"{",
"return",
"executeBatch",
"(",
"conn",
",",
"sql",
",",
"new",
"ArrayIt... | 批量执行非查询语句<br>
语句包括 插入、更新、删除<br>
此方法不会关闭Connection
@param conn 数据库连接对象
@param sql SQL
@param paramsBatch 批量的参数
@return 每个SQL执行影响的行数
@throws SQLException SQL执行异常 | [
"批量执行非查询语句<br",
">",
"语句包括",
"插入、更新、删除<br",
">",
"此方法不会关闭Connection"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L164-L166 | train | Execute a batch of SQL statements. | [
30522,
2270,
10763,
20014,
1031,
1033,
15389,
14479,
2818,
1006,
4434,
9530,
2078,
1010,
5164,
29296,
1010,
4874,
1031,
1033,
1012,
1012,
1012,
11498,
5244,
14479,
2818,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
15389,
14479,
2818,
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/FileUtil.java | FileUtil.checksum | public static Checksum checksum(File file, Checksum checksum) throws IORuntimeException {
Assert.notNull(file, "File is null !");
if (file.isDirectory()) {
throw new IllegalArgumentException("Checksums can't be computed on directories");
}
try {
return IoUtil.checksum(new FileInputStream(file), checksum);
} catch (FileNotFoundException e) {
throw new IORuntimeException(e);
}
} | java | public static Checksum checksum(File file, Checksum checksum) throws IORuntimeException {
Assert.notNull(file, "File is null !");
if (file.isDirectory()) {
throw new IllegalArgumentException("Checksums can't be computed on directories");
}
try {
return IoUtil.checksum(new FileInputStream(file), checksum);
} catch (FileNotFoundException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"Checksum",
"checksum",
"(",
"File",
"file",
",",
"Checksum",
"checksum",
")",
"throws",
"IORuntimeException",
"{",
"Assert",
".",
"notNull",
"(",
"file",
",",
"\"File is null !\"",
")",
";",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")... | 计算文件校验码
@param file 文件,不能为目录
@param checksum {@link Checksum}
@return Checksum
@throws IORuntimeException IO异常
@since 4.0.6 | [
"计算文件校验码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3291-L3301 | train | Computes the checksum of the given file. | [
30522,
2270,
10763,
14148,
2819,
14148,
2819,
1006,
5371,
5371,
1010,
14148,
2819,
14148,
2819,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
5371,
1010,
1000,
5371,
2003,
19701,
999,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java | URLUtil.getStream | public static InputStream getStream(URL url) {
Assert.notNull(url);
try {
return url.openStream();
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static InputStream getStream(URL url) {
Assert.notNull(url);
try {
return url.openStream();
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"InputStream",
"getStream",
"(",
"URL",
"url",
")",
"{",
"Assert",
".",
"notNull",
"(",
"url",
")",
";",
"try",
"{",
"return",
"url",
".",
"openStream",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new... | 从URL中获取流
@param url {@link URL}
@return InputStream流
@since 3.2.1 | [
"从URL中获取流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L506-L513 | train | Gets an input stream from the specified URL. | [
30522,
2270,
10763,
20407,
25379,
4152,
25379,
1006,
24471,
2140,
24471,
2140,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
24471,
2140,
1007,
1025,
3046,
1063,
2709,
24471,
2140,
1012,
7480,
25379,
1006,
1007,
1025,
1065,
4608,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java | ExceptionUtils.firstOrSuppressed | public static <T extends Throwable> T firstOrSuppressed(T newException, @Nullable T previous) {
checkNotNull(newException, "newException");
if (previous == null) {
return newException;
} else {
previous.addSuppressed(newException);
return previous;
}
} | java | public static <T extends Throwable> T firstOrSuppressed(T newException, @Nullable T previous) {
checkNotNull(newException, "newException");
if (previous == null) {
return newException;
} else {
previous.addSuppressed(newException);
return previous;
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Throwable",
">",
"T",
"firstOrSuppressed",
"(",
"T",
"newException",
",",
"@",
"Nullable",
"T",
"previous",
")",
"{",
"checkNotNull",
"(",
"newException",
",",
"\"newException\"",
")",
";",
"if",
"(",
"previous",
"==... | Adds a new exception as a {@link Throwable#addSuppressed(Throwable) suppressed exception}
to a prior exception, or returns the new exception, if no prior exception exists.
<pre>{@code
public void closeAllThings() throws Exception {
Exception ex = null;
try {
component.shutdown();
} catch (Exception e) {
ex = firstOrSuppressed(e, ex);
}
try {
anotherComponent.stop();
} catch (Exception e) {
ex = firstOrSuppressed(e, ex);
}
try {
lastComponent.shutdown();
} catch (Exception e) {
ex = firstOrSuppressed(e, ex);
}
if (ex != null) {
throw ex;
}
}
}</pre>
@param newException The newly occurred exception
@param previous The previously occurred exception, possibly null.
@return The new exception, if no previous exception exists, or the previous exception with the
new exception in the list of suppressed exceptions. | [
"Adds",
"a",
"new",
"exception",
"as",
"a",
"{",
"@link",
"Throwable#addSuppressed",
"(",
"Throwable",
")",
"suppressed",
"exception",
"}",
"to",
"a",
"prior",
"exception",
"or",
"returns",
"the",
"new",
"exception",
"if",
"no",
"prior",
"exception",
"exists",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java#L173-L182 | train | Add a new exception to the first exception or suppressed exception. | [
30522,
2270,
10763,
1026,
1056,
8908,
5466,
3085,
1028,
1056,
2034,
5668,
6279,
19811,
1006,
1056,
2047,
10288,
24422,
1010,
1030,
19701,
3085,
1056,
3025,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
2047,
10288,
24422,
1010,
1000,
2047,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | example/src/main/java/io/netty/example/ocsp/OcspUtils.java | OcspUtils.ocspUri | public static URI ocspUri(X509Certificate certificate) throws IOException {
byte[] value = certificate.getExtensionValue(Extension.authorityInfoAccess.getId());
if (value == null) {
return null;
}
ASN1Primitive authorityInfoAccess = X509ExtensionUtil.fromExtensionValue(value);
if (!(authorityInfoAccess instanceof DLSequence)) {
return null;
}
DLSequence aiaSequence = (DLSequence) authorityInfoAccess;
DERTaggedObject taggedObject = findObject(aiaSequence, OCSP_RESPONDER_OID, DERTaggedObject.class);
if (taggedObject == null) {
return null;
}
if (taggedObject.getTagNo() != BERTags.OBJECT_IDENTIFIER) {
return null;
}
byte[] encoded = taggedObject.getEncoded();
int length = (int) encoded[1] & 0xFF;
String uri = new String(encoded, 2, length, CharsetUtil.UTF_8);
return URI.create(uri);
} | java | public static URI ocspUri(X509Certificate certificate) throws IOException {
byte[] value = certificate.getExtensionValue(Extension.authorityInfoAccess.getId());
if (value == null) {
return null;
}
ASN1Primitive authorityInfoAccess = X509ExtensionUtil.fromExtensionValue(value);
if (!(authorityInfoAccess instanceof DLSequence)) {
return null;
}
DLSequence aiaSequence = (DLSequence) authorityInfoAccess;
DERTaggedObject taggedObject = findObject(aiaSequence, OCSP_RESPONDER_OID, DERTaggedObject.class);
if (taggedObject == null) {
return null;
}
if (taggedObject.getTagNo() != BERTags.OBJECT_IDENTIFIER) {
return null;
}
byte[] encoded = taggedObject.getEncoded();
int length = (int) encoded[1] & 0xFF;
String uri = new String(encoded, 2, length, CharsetUtil.UTF_8);
return URI.create(uri);
} | [
"public",
"static",
"URI",
"ocspUri",
"(",
"X509Certificate",
"certificate",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"value",
"=",
"certificate",
".",
"getExtensionValue",
"(",
"Extension",
".",
"authorityInfoAccess",
".",
"getId",
"(",
")",
")",
... | Returns the OCSP responder {@link URI} or {@code null} if it doesn't have one. | [
"Returns",
"the",
"OCSP",
"responder",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/ocsp/OcspUtils.java#L63-L88 | train | Get the OCSP URI from the certificate. | [
30522,
2270,
10763,
24471,
2072,
1051,
6169,
24661,
1006,
1060,
12376,
2683,
17119,
3775,
8873,
16280,
8196,
1007,
11618,
30524,
1033,
3643,
1027,
8196,
1012,
2131,
10288,
29048,
10175,
5657,
1006,
5331,
1012,
3691,
2378,
14876,
6305,
9623,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/codegen/BufferHolder.java | BufferHolder.grow | void grow(int neededSize) {
if (neededSize < 0) {
throw new IllegalArgumentException(
"Cannot grow BufferHolder by size " + neededSize + " because the size is negative");
}
if (neededSize > ARRAY_MAX - totalSize()) {
throw new IllegalArgumentException(
"Cannot grow BufferHolder by size " + neededSize + " because the size after growing " +
"exceeds size limitation " + ARRAY_MAX);
}
final int length = totalSize() + neededSize;
if (buffer.length < length) {
// This will not happen frequently, because the buffer is re-used.
int newLength = length < ARRAY_MAX / 2 ? length * 2 : ARRAY_MAX;
int roundedSize = ByteArrayMethods.roundNumberOfBytesToNearestWord(newLength);
final byte[] tmp = new byte[roundedSize];
Platform.copyMemory(
buffer,
Platform.BYTE_ARRAY_OFFSET,
tmp,
Platform.BYTE_ARRAY_OFFSET,
totalSize());
buffer = tmp;
row.pointTo(buffer, buffer.length);
}
} | java | void grow(int neededSize) {
if (neededSize < 0) {
throw new IllegalArgumentException(
"Cannot grow BufferHolder by size " + neededSize + " because the size is negative");
}
if (neededSize > ARRAY_MAX - totalSize()) {
throw new IllegalArgumentException(
"Cannot grow BufferHolder by size " + neededSize + " because the size after growing " +
"exceeds size limitation " + ARRAY_MAX);
}
final int length = totalSize() + neededSize;
if (buffer.length < length) {
// This will not happen frequently, because the buffer is re-used.
int newLength = length < ARRAY_MAX / 2 ? length * 2 : ARRAY_MAX;
int roundedSize = ByteArrayMethods.roundNumberOfBytesToNearestWord(newLength);
final byte[] tmp = new byte[roundedSize];
Platform.copyMemory(
buffer,
Platform.BYTE_ARRAY_OFFSET,
tmp,
Platform.BYTE_ARRAY_OFFSET,
totalSize());
buffer = tmp;
row.pointTo(buffer, buffer.length);
}
} | [
"void",
"grow",
"(",
"int",
"neededSize",
")",
"{",
"if",
"(",
"neededSize",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot grow BufferHolder by size \"",
"+",
"neededSize",
"+",
"\" because the size is negative\"",
")",
";",
"}",
"... | Grows the buffer by at least neededSize and points the row to the buffer. | [
"Grows",
"the",
"buffer",
"by",
"at",
"least",
"neededSize",
"and",
"points",
"the",
"row",
"to",
"the",
"buffer",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/codegen/BufferHolder.java#L65-L90 | train | Grows the BufferHolder by the specified size. | [
30522,
11675,
4982,
1006,
20014,
2734,
5332,
4371,
1007,
1063,
2065,
1006,
2734,
5332,
4371,
1026,
1014,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
3685,
4982,
17698,
14528,
2011,
2946,
1000,
1009,
2734,
5332... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInformation.java | TypeInformation.of | public static <T> TypeInformation<T> of(Class<T> typeClass) {
try {
return TypeExtractor.createTypeInfo(typeClass);
}
catch (InvalidTypesException e) {
throw new FlinkRuntimeException(
"Cannot extract TypeInformation from Class alone, because generic parameters are missing. " +
"Please use TypeInformation.of(TypeHint) instead, or another equivalent method in the API that " +
"accepts a TypeHint instead of a Class. " +
"For example for a Tuple2<Long, String> pass a 'new TypeHint<Tuple2<Long, String>>(){}'.");
}
} | java | public static <T> TypeInformation<T> of(Class<T> typeClass) {
try {
return TypeExtractor.createTypeInfo(typeClass);
}
catch (InvalidTypesException e) {
throw new FlinkRuntimeException(
"Cannot extract TypeInformation from Class alone, because generic parameters are missing. " +
"Please use TypeInformation.of(TypeHint) instead, or another equivalent method in the API that " +
"accepts a TypeHint instead of a Class. " +
"For example for a Tuple2<Long, String> pass a 'new TypeHint<Tuple2<Long, String>>(){}'.");
}
} | [
"public",
"static",
"<",
"T",
">",
"TypeInformation",
"<",
"T",
">",
"of",
"(",
"Class",
"<",
"T",
">",
"typeClass",
")",
"{",
"try",
"{",
"return",
"TypeExtractor",
".",
"createTypeInfo",
"(",
"typeClass",
")",
";",
"}",
"catch",
"(",
"InvalidTypesExcep... | Creates a TypeInformation for the type described by the given class.
<p>This method only works for non-generic types. For generic types, use the
{@link #of(TypeHint)} method.
@param typeClass The class of the type.
@param <T> The generic type.
@return The TypeInformation object for the type described by the hint. | [
"Creates",
"a",
"TypeInformation",
"for",
"the",
"type",
"described",
"by",
"the",
"given",
"class",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/TypeInformation.java#L209-L220 | train | Returns a TypeInformation for the given type class. | [
30522,
2270,
10763,
1026,
1056,
1028,
2828,
2378,
14192,
3370,
1026,
1056,
1028,
1997,
1006,
2465,
1026,
1056,
1028,
2828,
26266,
1007,
1063,
3046,
1063,
2709,
2828,
10288,
6494,
16761,
1012,
3443,
13874,
2378,
14876,
1006,
2828,
26266,
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/io/FileUtil.java | FileUtil.getPrintWriter | public static PrintWriter getPrintWriter(File file, String charset, boolean isAppend) throws IORuntimeException {
return new PrintWriter(getWriter(file, charset, isAppend));
} | java | public static PrintWriter getPrintWriter(File file, String charset, boolean isAppend) throws IORuntimeException {
return new PrintWriter(getWriter(file, charset, isAppend));
} | [
"public",
"static",
"PrintWriter",
"getPrintWriter",
"(",
"File",
"file",
",",
"String",
"charset",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"new",
"PrintWriter",
"(",
"getWriter",
"(",
"file",
",",
"charset",
",",
"isAppen... | 获得一个打印写入对象,可以有print
@param file 文件
@param charset 字符集
@param isAppend 是否追加
@return 打印对象
@throws IORuntimeException IO异常 | [
"获得一个打印写入对象,可以有print"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2664-L2666 | train | Get a PrintWriter for a file. | [
30522,
2270,
10763,
6140,
15994,
2131,
16550,
15994,
1006,
5371,
5371,
1010,
5164,
25869,
13462,
1010,
22017,
20898,
18061,
21512,
4859,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
2047,
6140,
15994,
1006,
2131,
15994,
1006,
53... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ftp/AbstractFtp.java | AbstractFtp.exist | public boolean exist(String path) {
final String fileName = FileUtil.getName(path);
final String dir = StrUtil.removeSuffix(path, fileName);
final List<String> names = ls(dir);
return containsIgnoreCase(names, fileName);
} | java | public boolean exist(String path) {
final String fileName = FileUtil.getName(path);
final String dir = StrUtil.removeSuffix(path, fileName);
final List<String> names = ls(dir);
return containsIgnoreCase(names, fileName);
} | [
"public",
"boolean",
"exist",
"(",
"String",
"path",
")",
"{",
"final",
"String",
"fileName",
"=",
"FileUtil",
".",
"getName",
"(",
"path",
")",
";",
"final",
"String",
"dir",
"=",
"StrUtil",
".",
"removeSuffix",
"(",
"path",
",",
"fileName",
")",
";",
... | 文件或目录是否存在
@param path 目录
@return 是否存在 | [
"文件或目录是否存在"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/AbstractFtp.java#L78-L83 | train | Checks if a file exists in the directory. | [
30522,
2270,
22017,
20898,
4839,
1006,
5164,
4130,
1007,
1063,
2345,
5164,
5371,
18442,
1027,
5371,
21823,
2140,
1012,
2131,
18442,
1006,
4130,
1007,
1025,
2345,
5164,
16101,
1027,
2358,
22134,
4014,
1012,
20362,
16093,
8873,
2595,
1006,
41... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/GenericHiveMetastoreCatalog.java | GenericHiveMetastoreCatalog.createPartition | @Override
public void createPartition(ObjectPath tablePath, CatalogPartitionSpec partitionSpec, CatalogPartition partition, boolean ignoreIfExists)
throws TableNotExistException, TableNotPartitionedException, PartitionSpecInvalidException, PartitionAlreadyExistsException, CatalogException {
throw new UnsupportedOperationException();
} | java | @Override
public void createPartition(ObjectPath tablePath, CatalogPartitionSpec partitionSpec, CatalogPartition partition, boolean ignoreIfExists)
throws TableNotExistException, TableNotPartitionedException, PartitionSpecInvalidException, PartitionAlreadyExistsException, CatalogException {
throw new UnsupportedOperationException();
} | [
"@",
"Override",
"public",
"void",
"createPartition",
"(",
"ObjectPath",
"tablePath",
",",
"CatalogPartitionSpec",
"partitionSpec",
",",
"CatalogPartition",
"partition",
",",
"boolean",
"ignoreIfExists",
")",
"throws",
"TableNotExistException",
",",
"TableNotPartitionedExce... | ------ partitions ------ | [
"------",
"partitions",
"------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/GenericHiveMetastoreCatalog.java#L276-L280 | train | Create a partition. | [
30522,
1030,
2058,
15637,
2270,
11675,
3443,
19362,
3775,
3508,
1006,
4874,
15069,
2795,
15069,
1010,
12105,
19362,
3775,
9285,
5051,
2278,
13571,
13102,
8586,
1010,
12105,
19362,
3775,
3508,
13571,
1010,
22017,
20898,
8568,
29323,
9048,
1283... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/MultipartFormData.java | MultipartFormData.getFiles | public UploadFile[] getFiles(String paramName) {
if (requestFiles == null) {
return null;
}
return requestFiles.get(paramName);
} | java | public UploadFile[] getFiles(String paramName) {
if (requestFiles == null) {
return null;
}
return requestFiles.get(paramName);
} | [
"public",
"UploadFile",
"[",
"]",
"getFiles",
"(",
"String",
"paramName",
")",
"{",
"if",
"(",
"requestFiles",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"requestFiles",
".",
"get",
"(",
"paramName",
")",
";",
"}"
] | 获得某个属性名的所有文件<br>
当表单中两个文件使用同一个name的时候
@param paramName 属性名
@return 上传的文件列表 | [
"获得某个属性名的所有文件<br",
">",
"当表单中两个文件使用同一个name的时候"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/MultipartFormData.java#L182-L187 | train | Gets the files parameter with the given name. | [
30522,
2270,
2039,
11066,
8873,
2571,
1031,
1033,
2131,
8873,
4244,
1006,
5164,
11498,
2213,
18442,
1007,
1063,
2065,
1006,
5227,
8873,
4244,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
5227,
8873,
4244,
1012,
2131,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoFieldUtils.java | PojoFieldUtils.readField | static Field readField(DataInputView in, ClassLoader userCodeClassLoader) throws IOException {
Class<?> declaringClass = InstantiationUtil.resolveClassByName(in, userCodeClassLoader);
String fieldName = in.readUTF();
return getField(fieldName, declaringClass);
} | java | static Field readField(DataInputView in, ClassLoader userCodeClassLoader) throws IOException {
Class<?> declaringClass = InstantiationUtil.resolveClassByName(in, userCodeClassLoader);
String fieldName = in.readUTF();
return getField(fieldName, declaringClass);
} | [
"static",
"Field",
"readField",
"(",
"DataInputView",
"in",
",",
"ClassLoader",
"userCodeClassLoader",
")",
"throws",
"IOException",
"{",
"Class",
"<",
"?",
">",
"declaringClass",
"=",
"InstantiationUtil",
".",
"resolveClassByName",
"(",
"in",
",",
"userCodeClassLoa... | Reads a field from the given {@link DataInputView}.
<p>This read methods avoids Java serialization, by reading the classname of the field's declaring class
and dynamically loading it. The field is also read by field name and obtained via reflection.
@param in the input view to read from.
@param userCodeClassLoader the user classloader.
@return the read field. | [
"Reads",
"a",
"field",
"from",
"the",
"given",
"{",
"@link",
"DataInputView",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoFieldUtils.java#L62-L66 | train | Reads a field from the given input view. | [
30522,
10763,
2492,
3191,
3790,
1006,
2951,
2378,
18780,
8584,
1999,
1010,
2465,
11066,
2121,
5310,
16044,
26266,
11066,
2121,
1007,
11618,
22834,
10288,
24422,
1063,
2465,
1026,
1029,
1028,
13752,
26266,
1027,
7107,
18963,
21823,
2140,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CirculantGraph.java | CirculantGraph.addRange | public CirculantGraph addRange(long offset, long length) {
Preconditions.checkArgument(offset >= MINIMUM_OFFSET,
"Range offset must be at least " + MINIMUM_OFFSET);
Preconditions.checkArgument(length <= vertexCount - offset,
"Range length must not be greater than the vertex count minus the range offset.");
offsetRanges.add(new OffsetRange(offset, length));
return this;
} | java | public CirculantGraph addRange(long offset, long length) {
Preconditions.checkArgument(offset >= MINIMUM_OFFSET,
"Range offset must be at least " + MINIMUM_OFFSET);
Preconditions.checkArgument(length <= vertexCount - offset,
"Range length must not be greater than the vertex count minus the range offset.");
offsetRanges.add(new OffsetRange(offset, length));
return this;
} | [
"public",
"CirculantGraph",
"addRange",
"(",
"long",
"offset",
",",
"long",
"length",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"offset",
">=",
"MINIMUM_OFFSET",
",",
"\"Range offset must be at least \"",
"+",
"MINIMUM_OFFSET",
")",
";",
"Preconditions",
... | Required configuration for each range of offsets in the graph.
@param offset first offset appointing the vertices' position
@param length number of contiguous offsets in range
@return this | [
"Required",
"configuration",
"for",
"each",
"range",
"of",
"offsets",
"in",
"the",
"graph",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CirculantGraph.java#L81-L90 | train | Adds a range to the CirculantGraph. | [
30522,
2270,
25022,
11890,
7068,
3372,
14413,
5587,
24388,
2063,
1006,
2146,
16396,
1010,
2146,
3091,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
16396,
1028,
1027,
6263,
1035,
16396,
1010,
1000,
2846,
16396,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/ParameterizedTypeImpl.java | ParameterizedTypeImpl.appendAllTo | private static StringBuilder appendAllTo(final StringBuilder buf, final String sep, final Type... types) {
if (ArrayUtil.isNotEmpty(types)) {
boolean isFirst = true;
for (Type type : types) {
if (isFirst) {
isFirst = false;
} else {
buf.append(sep);
}
String typeStr;
if(type instanceof Class) {
typeStr = ((Class<?>)type).getName();
}else {
typeStr = StrUtil.toString(type);
}
buf.append(typeStr);
}
}
return buf;
} | java | private static StringBuilder appendAllTo(final StringBuilder buf, final String sep, final Type... types) {
if (ArrayUtil.isNotEmpty(types)) {
boolean isFirst = true;
for (Type type : types) {
if (isFirst) {
isFirst = false;
} else {
buf.append(sep);
}
String typeStr;
if(type instanceof Class) {
typeStr = ((Class<?>)type).getName();
}else {
typeStr = StrUtil.toString(type);
}
buf.append(typeStr);
}
}
return buf;
} | [
"private",
"static",
"StringBuilder",
"appendAllTo",
"(",
"final",
"StringBuilder",
"buf",
",",
"final",
"String",
"sep",
",",
"final",
"Type",
"...",
"types",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isNotEmpty",
"(",
"types",
")",
")",
"{",
"boolean",
"is... | 追加 {@code types} 到 @{code buf},使用 {@code sep} 分隔
@param buf 目标
@param sep 分隔符
@param types 加入的类型
@return {@code buf} | [
"追加",
"{",
"@code",
"types",
"}",
"到",
"@",
"{",
"code",
"buf",
"}",
",使用",
"{",
"@code",
"sep",
"}",
"分隔"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/ParameterizedTypeImpl.java#L79-L100 | train | Append all the types to the StringBuilder. | [
30522,
2797,
10763,
5164,
8569,
23891,
2099,
10439,
10497,
8095,
3406,
1006,
2345,
5164,
8569,
23891,
2099,
20934,
2546,
1010,
2345,
5164,
19802,
1010,
2345,
2828,
1012,
1012,
1012,
4127,
1007,
1063,
2065,
1006,
9140,
21823,
2140,
1012,
347... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getString | public final String getString(final int pos, String charsetName) {
if (pos >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: " + pos);
byte[] buf = buffer;
final int len = (0xff & buf[origin + pos]);
if (pos + len + 1 > limit) throw new IllegalArgumentException("limit excceed: " + (pos + len + 1));
try {
return new String(buf, origin + pos + 1, len, charsetName);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException("Unsupported encoding: " + charsetName, e);
}
} | java | public final String getString(final int pos, String charsetName) {
if (pos >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: " + pos);
byte[] buf = buffer;
final int len = (0xff & buf[origin + pos]);
if (pos + len + 1 > limit) throw new IllegalArgumentException("limit excceed: " + (pos + len + 1));
try {
return new String(buf, origin + pos + 1, len, charsetName);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException("Unsupported encoding: " + charsetName, e);
}
} | [
"public",
"final",
"String",
"getString",
"(",
"final",
"int",
"pos",
",",
"String",
"charsetName",
")",
"{",
"if",
"(",
"pos",
">=",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"pos",
"... | Return dynamic length string from buffer. | [
"Return",
"dynamic",
"length",
"string",
"from",
"buffer",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L1152-L1164 | train | Gets a string in the buffer starting at the given position in the buffer. | [
30522,
2270,
2345,
5164,
4152,
18886,
3070,
1006,
2345,
20014,
13433,
2015,
1010,
5164,
25869,
13462,
18442,
1007,
1063,
2065,
1006,
13433,
30524,
1006,
1000,
5787,
4654,
9468,
13089,
1024,
1000,
1009,
13433,
2015,
1007,
1025,
24880,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/recognition/nr/JapanesePersonRecognition.java | JapanesePersonRecognition.isBadCase | public static boolean isBadCase(String name)
{
Character label = JapanesePersonDictionary.get(name);
if (label == null) return false;
return label.equals(JapanesePersonDictionary.A);
} | java | public static boolean isBadCase(String name)
{
Character label = JapanesePersonDictionary.get(name);
if (label == null) return false;
return label.equals(JapanesePersonDictionary.A);
} | [
"public",
"static",
"boolean",
"isBadCase",
"(",
"String",
"name",
")",
"{",
"Character",
"label",
"=",
"JapanesePersonDictionary",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"label",
"==",
"null",
")",
"return",
"false",
";",
"return",
"label",
".",
... | 是否是bad case
@param name
@return | [
"是否是bad",
"case"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/recognition/nr/JapanesePersonRecognition.java#L107-L112 | train | Checks if the name is a bad case. | [
30522,
2270,
10763,
22017,
20898,
2003,
9024,
18382,
1006,
5164,
2171,
1007,
1063,
2839,
3830,
1027,
2887,
27576,
29201,
3258,
5649,
1012,
2131,
1006,
2171,
1007,
1025,
2065,
1006,
3830,
1027,
1027,
19701,
1007,
2709,
6270,
1025,
2709,
3830... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/NumberUtil.java | NumberUtil.toStr | public static String toStr(Number number, String defaultValue) {
return (null == number) ? defaultValue : toStr(number);
} | java | public static String toStr(Number number, String defaultValue) {
return (null == number) ? defaultValue : toStr(number);
} | [
"public",
"static",
"String",
"toStr",
"(",
"Number",
"number",
",",
"String",
"defaultValue",
")",
"{",
"return",
"(",
"null",
"==",
"number",
")",
"?",
"defaultValue",
":",
"toStr",
"(",
"number",
")",
";",
"}"
] | 数字转字符串<br>
调用{@link Number#toString()},并去除尾小数点儿后多余的0
@param number A Number
@param defaultValue 如果number参数为{@code null},返回此默认值
@return A String.
@since 3.0.9 | [
"数字转字符串<br",
">",
"调用",
"{",
"@link",
"Number#toString",
"()",
"}",
",并去除尾小数点儿后多余的0"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L1856-L1858 | train | Converts a Number to a String. | [
30522,
2270,
10763,
5164,
2000,
3367,
2099,
1006,
2193,
2193,
1010,
5164,
12398,
10175,
5657,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/common/expression/impl/CommonExpressionExtractor.java | CommonExpressionExtractor.extract | @Override
public Optional<CommonExpressionSegment> extract(final ParserRuleContext expressionNode, final Map<ParserRuleContext, Integer> parameterMarkerIndexes) {
return Optional.of(new CommonExpressionSegment(expressionNode.getStart().getStartIndex(), expressionNode.getStop().getStopIndex()));
} | java | @Override
public Optional<CommonExpressionSegment> extract(final ParserRuleContext expressionNode, final Map<ParserRuleContext, Integer> parameterMarkerIndexes) {
return Optional.of(new CommonExpressionSegment(expressionNode.getStart().getStartIndex(), expressionNode.getStop().getStopIndex()));
} | [
"@",
"Override",
"public",
"Optional",
"<",
"CommonExpressionSegment",
">",
"extract",
"(",
"final",
"ParserRuleContext",
"expressionNode",
",",
"final",
"Map",
"<",
"ParserRuleContext",
",",
"Integer",
">",
"parameterMarkerIndexes",
")",
"{",
"return",
"Optional",
... | TODO extract column name and value from expression | [
"TODO",
"extract",
"column",
"name",
"and",
"value",
"from",
"expression"
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/common/expression/impl/CommonExpressionExtractor.java#L35-L38 | train | Extract a CommonExpressionSegment from the given expression node. | [
30522,
1030,
2058,
15637,
2270,
11887,
1026,
2691,
10288,
20110,
8496,
13910,
3672,
1028,
14817,
1006,
2345,
11968,
8043,
6820,
2571,
8663,
18209,
3670,
3630,
3207,
1010,
2345,
4949,
1026,
11968,
8043,
6820,
2571,
8663,
18209,
1010,
16109,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.removeSlotRequestFromSlot | private void removeSlotRequestFromSlot(SlotID slotId, AllocationID allocationId) {
TaskManagerSlot taskManagerSlot = slots.get(slotId);
if (null != taskManagerSlot) {
if (taskManagerSlot.getState() == TaskManagerSlot.State.PENDING && Objects.equals(allocationId, taskManagerSlot.getAssignedSlotRequest().getAllocationId())) {
TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations.get(taskManagerSlot.getInstanceId());
if (taskManagerRegistration == null) {
throw new IllegalStateException("Trying to remove slot request from slot for which there is no TaskManager " + taskManagerSlot.getInstanceId() + " is registered.");
}
// clear the pending slot request
taskManagerSlot.clearPendingSlotRequest();
updateSlotState(taskManagerSlot, taskManagerRegistration, null, null);
} else {
LOG.debug("Ignore slot request removal for slot {}.", slotId);
}
} else {
LOG.debug("There was no slot with {} registered. Probably this slot has been already freed.", slotId);
}
} | java | private void removeSlotRequestFromSlot(SlotID slotId, AllocationID allocationId) {
TaskManagerSlot taskManagerSlot = slots.get(slotId);
if (null != taskManagerSlot) {
if (taskManagerSlot.getState() == TaskManagerSlot.State.PENDING && Objects.equals(allocationId, taskManagerSlot.getAssignedSlotRequest().getAllocationId())) {
TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations.get(taskManagerSlot.getInstanceId());
if (taskManagerRegistration == null) {
throw new IllegalStateException("Trying to remove slot request from slot for which there is no TaskManager " + taskManagerSlot.getInstanceId() + " is registered.");
}
// clear the pending slot request
taskManagerSlot.clearPendingSlotRequest();
updateSlotState(taskManagerSlot, taskManagerRegistration, null, null);
} else {
LOG.debug("Ignore slot request removal for slot {}.", slotId);
}
} else {
LOG.debug("There was no slot with {} registered. Probably this slot has been already freed.", slotId);
}
} | [
"private",
"void",
"removeSlotRequestFromSlot",
"(",
"SlotID",
"slotId",
",",
"AllocationID",
"allocationId",
")",
"{",
"TaskManagerSlot",
"taskManagerSlot",
"=",
"slots",
".",
"get",
"(",
"slotId",
")",
";",
"if",
"(",
"null",
"!=",
"taskManagerSlot",
")",
"{",... | Removes a pending slot request identified by the given allocation id from a slot identified
by the given slot id.
@param slotId identifying the slot
@param allocationId identifying the presumable assigned pending slot request | [
"Removes",
"a",
"pending",
"slot",
"request",
"identified",
"by",
"the",
"given",
"allocation",
"id",
"from",
"a",
"slot",
"identified",
"by",
"the",
"given",
"slot",
"id",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java#L917-L939 | train | Removes the slot request from the slot. | [
30522,
2797,
11675,
20362,
10994,
2890,
15500,
19699,
22225,
10994,
1006,
10453,
3593,
10453,
3593,
1010,
16169,
3593,
16169,
3593,
1007,
1063,
4708,
24805,
15776,
10994,
4708,
24805,
15776,
10994,
1027,
19832,
1012,
2131,
1006,
10453,
3593,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/bitset/BitSetMethods.java | BitSetMethods.anySet | public static boolean anySet(Object baseObject, long baseOffset, long bitSetWidthInWords) {
long addr = baseOffset;
for (int i = 0; i < bitSetWidthInWords; i++, addr += WORD_SIZE) {
if (Platform.getLong(baseObject, addr) != 0) {
return true;
}
}
return false;
} | java | public static boolean anySet(Object baseObject, long baseOffset, long bitSetWidthInWords) {
long addr = baseOffset;
for (int i = 0; i < bitSetWidthInWords; i++, addr += WORD_SIZE) {
if (Platform.getLong(baseObject, addr) != 0) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"anySet",
"(",
"Object",
"baseObject",
",",
"long",
"baseOffset",
",",
"long",
"bitSetWidthInWords",
")",
"{",
"long",
"addr",
"=",
"baseOffset",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"bitSetWidthInWords",
";"... | Returns {@code true} if any bit is set. | [
"Returns",
"{"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/bitset/BitSetMethods.java#L73-L81 | train | Checks if any set bits are set in the given base object. | [
30522,
2270,
10763,
22017,
20898,
2151,
13462,
1006,
4874,
2918,
16429,
20614,
1010,
2146,
2918,
27475,
3388,
1010,
2146,
9017,
3388,
9148,
11927,
10606,
22104,
1007,
1063,
2146,
5587,
2099,
1027,
2918,
27475,
3388,
1025,
2005,
1006,
20014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java | Http2ConnectionHandler.onStreamError | protected void onStreamError(ChannelHandlerContext ctx, boolean outbound,
@SuppressWarnings("unused") Throwable cause, StreamException http2Ex) {
final int streamId = http2Ex.streamId();
Http2Stream stream = connection().stream(streamId);
//if this is caused by reading headers that are too large, send a header with status 431
if (http2Ex instanceof Http2Exception.HeaderListSizeException &&
((Http2Exception.HeaderListSizeException) http2Ex).duringDecode() &&
connection().isServer()) {
// NOTE We have to check to make sure that a stream exists before we send our reply.
// We likely always create the stream below as the stream isn't created until the
// header block is completely processed.
// The case of a streamId referring to a stream which was already closed is handled
// by createStream and will land us in the catch block below
if (stream == null) {
try {
stream = encoder.connection().remote().createStream(streamId, true);
} catch (Http2Exception e) {
resetUnknownStream(ctx, streamId, http2Ex.error().code(), ctx.newPromise());
return;
}
}
// ensure that we have not already sent headers on this stream
if (stream != null && !stream.isHeadersSent()) {
try {
handleServerHeaderDecodeSizeError(ctx, stream);
} catch (Throwable cause2) {
onError(ctx, outbound, connectionError(INTERNAL_ERROR, cause2, "Error DecodeSizeError"));
}
}
}
if (stream == null) {
if (!outbound || connection().local().mayHaveCreatedStream(streamId)) {
resetUnknownStream(ctx, streamId, http2Ex.error().code(), ctx.newPromise());
}
} else {
resetStream(ctx, stream, http2Ex.error().code(), ctx.newPromise());
}
} | java | protected void onStreamError(ChannelHandlerContext ctx, boolean outbound,
@SuppressWarnings("unused") Throwable cause, StreamException http2Ex) {
final int streamId = http2Ex.streamId();
Http2Stream stream = connection().stream(streamId);
//if this is caused by reading headers that are too large, send a header with status 431
if (http2Ex instanceof Http2Exception.HeaderListSizeException &&
((Http2Exception.HeaderListSizeException) http2Ex).duringDecode() &&
connection().isServer()) {
// NOTE We have to check to make sure that a stream exists before we send our reply.
// We likely always create the stream below as the stream isn't created until the
// header block is completely processed.
// The case of a streamId referring to a stream which was already closed is handled
// by createStream and will land us in the catch block below
if (stream == null) {
try {
stream = encoder.connection().remote().createStream(streamId, true);
} catch (Http2Exception e) {
resetUnknownStream(ctx, streamId, http2Ex.error().code(), ctx.newPromise());
return;
}
}
// ensure that we have not already sent headers on this stream
if (stream != null && !stream.isHeadersSent()) {
try {
handleServerHeaderDecodeSizeError(ctx, stream);
} catch (Throwable cause2) {
onError(ctx, outbound, connectionError(INTERNAL_ERROR, cause2, "Error DecodeSizeError"));
}
}
}
if (stream == null) {
if (!outbound || connection().local().mayHaveCreatedStream(streamId)) {
resetUnknownStream(ctx, streamId, http2Ex.error().code(), ctx.newPromise());
}
} else {
resetStream(ctx, stream, http2Ex.error().code(), ctx.newPromise());
}
} | [
"protected",
"void",
"onStreamError",
"(",
"ChannelHandlerContext",
"ctx",
",",
"boolean",
"outbound",
",",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"Throwable",
"cause",
",",
"StreamException",
"http2Ex",
")",
"{",
"final",
"int",
"streamId",
"=",
"http2E... | Handler for a stream error. Sends a {@code RST_STREAM} frame to the remote endpoint and closes the
stream.
@param ctx the channel context
@param outbound {@code true} if the error was caused by an outbound operation.
@param cause the exception that was caught
@param http2Ex the {@link StreamException} that is embedded in the causality chain. | [
"Handler",
"for",
"a",
"stream",
"error",
".",
"Sends",
"a",
"{",
"@code",
"RST_STREAM",
"}",
"frame",
"to",
"the",
"remote",
"endpoint",
"and",
"closes",
"the",
"stream",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L681-L723 | train | Handle a stream error. | [
30522,
5123,
11675,
2006,
21422,
2121,
29165,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
22017,
20898,
2041,
15494,
1010,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
15171,
1000,
1007,
5466,
3085,
3426,
1010,
5460,
10288,
24422,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ServiceOperations.java | ServiceOperations.deploy | public static void deploy(Service service, HiveConf configuration) {
init(service, configuration);
start(service);
} | java | public static void deploy(Service service, HiveConf configuration) {
init(service, configuration);
start(service);
} | [
"public",
"static",
"void",
"deploy",
"(",
"Service",
"service",
",",
"HiveConf",
"configuration",
")",
"{",
"init",
"(",
"service",
",",
"configuration",
")",
";",
"start",
"(",
"service",
")",
";",
"}"
] | Initialize then start a service.
The service state is checked <i>before</i> the operation begins.
This process is <i>not</i> thread safe.
@param service a service that must be in the state
{@link Service.STATE#NOTINITED}
@param configuration the configuration to initialize the service with
@throws RuntimeException on a state change failure
@throws IllegalStateException if the service is in the wrong state | [
"Initialize",
"then",
"start",
"a",
"service",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java#L98-L101 | train | Deploy a service with the given configuration. | [
30522,
2270,
10763,
11675,
21296,
1006,
2326,
2326,
1010,
26736,
8663,
2546,
9563,
1007,
1063,
1999,
4183,
1006,
2326,
1010,
9563,
1007,
1025,
2707,
1006,
2326,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InMemoryPartition.java | InMemoryPartition.allocateSegments | public void allocateSegments(int numberOfSegments) {
while (getBlockCount() < numberOfSegments) {
MemorySegment next = this.availableMemory.nextSegment();
if (next != null) {
this.partitionPages.add(next);
} else {
return;
}
}
} | java | public void allocateSegments(int numberOfSegments) {
while (getBlockCount() < numberOfSegments) {
MemorySegment next = this.availableMemory.nextSegment();
if (next != null) {
this.partitionPages.add(next);
} else {
return;
}
}
} | [
"public",
"void",
"allocateSegments",
"(",
"int",
"numberOfSegments",
")",
"{",
"while",
"(",
"getBlockCount",
"(",
")",
"<",
"numberOfSegments",
")",
"{",
"MemorySegment",
"next",
"=",
"this",
".",
"availableMemory",
".",
"nextSegment",
"(",
")",
";",
"if",
... | attempts to allocate specified number of segments and should only be used by compaction partition
fails silently if not enough segments are available since next compaction could still succeed
@param numberOfSegments allocation count | [
"attempts",
"to",
"allocate",
"specified",
"number",
"of",
"segments",
"and",
"should",
"only",
"be",
"used",
"by",
"compaction",
"partition",
"fails",
"silently",
"if",
"not",
"enough",
"segments",
"are",
"available",
"since",
"next",
"compaction",
"could",
"st... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InMemoryPartition.java#L285-L294 | train | Allocate segments. | [
30522,
2270,
11675,
2035,
24755,
4570,
13910,
8163,
1006,
20014,
2193,
11253,
3366,
21693,
11187,
1007,
1063,
2096,
1006,
2131,
23467,
3597,
16671,
1006,
1007,
1026,
2193,
11253,
3366,
21693,
11187,
1007,
1063,
3638,
3366,
21693,
4765,
2279,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.tail | public static void tail(File file, Charset charset, LineHandler handler) {
new Tailer(file, charset, handler).start();
} | java | public static void tail(File file, Charset charset, LineHandler handler) {
new Tailer(file, charset, handler).start();
} | [
"public",
"static",
"void",
"tail",
"(",
"File",
"file",
",",
"Charset",
"charset",
",",
"LineHandler",
"handler",
")",
"{",
"new",
"Tailer",
"(",
"file",
",",
"charset",
",",
"handler",
")",
".",
"start",
"(",
")",
";",
"}"
] | 文件内容跟随器,实现类似Linux下"tail -f"命令功能<br>
此方法会阻塞当前线程
@param file 文件
@param charset 编码
@param handler 行处理器 | [
"文件内容跟随器,实现类似Linux下",
"tail",
"-",
"f",
"命令功能<br",
">",
"此方法会阻塞当前线程"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3484-L3486 | train | Creates a tailer for the specified file. | [
30522,
2270,
10763,
11675,
5725,
1006,
5371,
5371,
1010,
25869,
13462,
25869,
13462,
1010,
2240,
11774,
3917,
28213,
1007,
1063,
2047,
5725,
2121,
1006,
5371,
1010,
25869,
13462,
1010,
28213,
1007,
1012,
2707,
1006,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeutils/NestedSerializersSnapshotDelegate.java | NestedSerializersSnapshotDelegate.resolveCompatibility | @SuppressWarnings("unchecked")
private static <E> TypeSerializerSchemaCompatibility<E> resolveCompatibility(
TypeSerializer<?> serializer,
TypeSerializerSnapshot<?> snapshot) {
TypeSerializer<E> typedSerializer = (TypeSerializer<E>) serializer;
TypeSerializerSnapshot<E> typedSnapshot = (TypeSerializerSnapshot<E>) snapshot;
return typedSnapshot.resolveSchemaCompatibility(typedSerializer);
} | java | @SuppressWarnings("unchecked")
private static <E> TypeSerializerSchemaCompatibility<E> resolveCompatibility(
TypeSerializer<?> serializer,
TypeSerializerSnapshot<?> snapshot) {
TypeSerializer<E> typedSerializer = (TypeSerializer<E>) serializer;
TypeSerializerSnapshot<E> typedSnapshot = (TypeSerializerSnapshot<E>) snapshot;
return typedSnapshot.resolveSchemaCompatibility(typedSerializer);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"<",
"E",
">",
"TypeSerializerSchemaCompatibility",
"<",
"E",
">",
"resolveCompatibility",
"(",
"TypeSerializer",
"<",
"?",
">",
"serializer",
",",
"TypeSerializerSnapshot",
"<",
"?",
">",
"s... | Utility method to conjure up a new scope for the generic parameters. | [
"Utility",
"method",
"to",
"conjure",
"up",
"a",
"new",
"scope",
"for",
"the",
"generic",
"parameters",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/NestedSerializersSnapshotDelegate.java#L211-L220 | train | Resolve the compatibility of two serializers. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2797,
10763,
1026,
1041,
1028,
4127,
11610,
28863,
22842,
22911,
25377,
10450,
8553,
1026,
1041,
1028,
10663,
9006,
24952,
8553,
1006,
4127,
11610,
28863,
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-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java | Types.ROW_NAMED | public static TypeInformation<Row> ROW_NAMED(String[] fieldNames, TypeInformation<?>... types) {
return new RowTypeInfo(types, fieldNames);
} | java | public static TypeInformation<Row> ROW_NAMED(String[] fieldNames, TypeInformation<?>... types) {
return new RowTypeInfo(types, fieldNames);
} | [
"public",
"static",
"TypeInformation",
"<",
"Row",
">",
"ROW_NAMED",
"(",
"String",
"[",
"]",
"fieldNames",
",",
"TypeInformation",
"<",
"?",
">",
"...",
"types",
")",
"{",
"return",
"new",
"RowTypeInfo",
"(",
"types",
",",
"fieldNames",
")",
";",
"}"
] | Returns type information for {@link org.apache.flink.types.Row} with fields of the given types and
with given names. A row must not be null.
<p>A row is a fixed-length, null-aware composite type for storing multiple values in a
deterministic field order. Every field can be null independent of the field's type.
The type of row fields cannot be automatically inferred; therefore, it is required to provide
type information whenever a row is used.
<p>The schema of rows can have up to <code>Integer.MAX_VALUE</code> fields, however, all row instances
must strictly adhere to the schema defined by the type info.
<p>Example use: {@code ROW_NAMED(new String[]{"name", "number"}, Types.STRING, Types.INT)}.
@param fieldNames array of field names
@param types array of field types | [
"Returns",
"type",
"information",
"for",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"types",
".",
"Row",
"}",
"with",
"fields",
"of",
"the",
"given",
"types",
"and",
"with",
"given",
"names",
".",
"A",
"row",
"must",
"not",
"be",
"null",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java#L200-L202 | train | Returns a new row type information for the given field names. | [
30522,
2270,
10763,
2828,
2378,
14192,
3370,
1026,
5216,
1028,
5216,
1035,
2315,
1006,
5164,
1031,
1033,
2492,
18442,
2015,
1010,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
1012,
1012,
1012,
4127,
1007,
1063,
2709,
2047,
5216,
13874,
2378,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Plan.java | Plan.accept | @Override
public void accept(Visitor<Operator<?>> visitor) {
for (GenericDataSinkBase<?> sink : this.sinks) {
sink.accept(visitor);
}
} | java | @Override
public void accept(Visitor<Operator<?>> visitor) {
for (GenericDataSinkBase<?> sink : this.sinks) {
sink.accept(visitor);
}
} | [
"@",
"Override",
"public",
"void",
"accept",
"(",
"Visitor",
"<",
"Operator",
"<",
"?",
">",
">",
"visitor",
")",
"{",
"for",
"(",
"GenericDataSinkBase",
"<",
"?",
">",
"sink",
":",
"this",
".",
"sinks",
")",
"{",
"sink",
".",
"accept",
"(",
"visitor... | Traverses the job depth first from all data sinks on towards the sources.
@see Visitable#accept(Visitor) | [
"Traverses",
"the",
"job",
"depth",
"first",
"from",
"all",
"data",
"sinks",
"on",
"towards",
"the",
"sources",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/Plan.java#L326-L331 | train | Visit all the sinks of this operator. | [
30522,
1030,
2058,
15637,
2270,
11675,
5138,
1006,
10367,
1026,
6872,
1026,
1029,
1028,
1028,
10367,
1007,
1063,
2005,
1006,
12391,
2850,
10230,
19839,
15058,
1026,
1029,
1028,
7752,
1024,
2023,
1012,
23462,
1007,
1063,
7752,
1012,
5138,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/StreamTransformation.java | StreamTransformation.getOutputType | public TypeInformation<T> getOutputType() {
if (outputType instanceof MissingTypeInfo) {
MissingTypeInfo typeInfo = (MissingTypeInfo) this.outputType;
throw new InvalidTypesException(
"The return type of function '"
+ typeInfo.getFunctionName()
+ "' could not be determined automatically, due to type erasure. "
+ "You can give type information hints by using the returns(...) "
+ "method on the result of the transformation call, or by letting "
+ "your function implement the 'ResultTypeQueryable' "
+ "interface.", typeInfo.getTypeException());
}
typeUsed = true;
return this.outputType;
} | java | public TypeInformation<T> getOutputType() {
if (outputType instanceof MissingTypeInfo) {
MissingTypeInfo typeInfo = (MissingTypeInfo) this.outputType;
throw new InvalidTypesException(
"The return type of function '"
+ typeInfo.getFunctionName()
+ "' could not be determined automatically, due to type erasure. "
+ "You can give type information hints by using the returns(...) "
+ "method on the result of the transformation call, or by letting "
+ "your function implement the 'ResultTypeQueryable' "
+ "interface.", typeInfo.getTypeException());
}
typeUsed = true;
return this.outputType;
} | [
"public",
"TypeInformation",
"<",
"T",
">",
"getOutputType",
"(",
")",
"{",
"if",
"(",
"outputType",
"instanceof",
"MissingTypeInfo",
")",
"{",
"MissingTypeInfo",
"typeInfo",
"=",
"(",
"MissingTypeInfo",
")",
"this",
".",
"outputType",
";",
"throw",
"new",
"In... | Returns the output type of this {@code StreamTransformation} as a {@link TypeInformation}. Once
this is used once the output type cannot be changed anymore using {@link #setOutputType}.
@return The output type of this {@code StreamTransformation} | [
"Returns",
"the",
"output",
"type",
"of",
"this",
"{",
"@code",
"StreamTransformation",
"}",
"as",
"a",
"{",
"@link",
"TypeInformation",
"}",
".",
"Once",
"this",
"is",
"used",
"once",
"the",
"output",
"type",
"cannot",
"be",
"changed",
"anymore",
"using",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/StreamTransformation.java#L410-L424 | train | Returns the output type of the transformation. | [
30522,
2270,
2828,
2378,
14192,
3370,
1026,
1056,
1028,
2131,
5833,
18780,
13874,
1006,
1007,
1063,
2065,
1006,
6434,
13874,
6013,
11253,
4394,
13874,
2378,
14876,
1007,
1063,
4394,
13874,
2378,
14876,
2828,
2378,
14876,
1027,
1006,
4394,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/HpackStaticTable.java | HpackStaticTable.getIndex | static int getIndex(CharSequence name) {
Integer index = STATIC_INDEX_BY_NAME.get(name);
if (index == null) {
return -1;
}
return index;
} | java | static int getIndex(CharSequence name) {
Integer index = STATIC_INDEX_BY_NAME.get(name);
if (index == null) {
return -1;
}
return index;
} | [
"static",
"int",
"getIndex",
"(",
"CharSequence",
"name",
")",
"{",
"Integer",
"index",
"=",
"STATIC_INDEX_BY_NAME",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"index",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"index",
";",
... | Returns the lowest index value for the given header field name in the static table. Returns
-1 if the header field name is not in the static table. | [
"Returns",
"the",
"lowest",
"index",
"value",
"for",
"the",
"given",
"header",
"field",
"name",
"in",
"the",
"static",
"table",
".",
"Returns",
"-",
"1",
"if",
"the",
"header",
"field",
"name",
"is",
"not",
"in",
"the",
"static",
"table",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackStaticTable.java#L136-L142 | train | Gets the index of a class by name. | [
30522,
10763,
20014,
2131,
22254,
10288,
1006,
25869,
3366,
4226,
5897,
2171,
1007,
1063,
16109,
5950,
1027,
10763,
1035,
5950,
1035,
2011,
1035,
2171,
1012,
2131,
1006,
2171,
1007,
1025,
2065,
1006,
5950,
1027,
1027,
19701,
1007,
1063,
270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONGetter.java | JSONGetter.getBean | public <T> T getBean(K key, Class<T> beanType) {
final JSONObject obj = getJSONObject(key);
return (null == obj) ? null : obj.toBean(beanType);
} | java | public <T> T getBean(K key, Class<T> beanType) {
final JSONObject obj = getJSONObject(key);
return (null == obj) ? null : obj.toBean(beanType);
} | [
"public",
"<",
"T",
">",
"T",
"getBean",
"(",
"K",
"key",
",",
"Class",
"<",
"T",
">",
"beanType",
")",
"{",
"final",
"JSONObject",
"obj",
"=",
"getJSONObject",
"(",
"key",
")",
";",
"return",
"(",
"null",
"==",
"obj",
")",
"?",
"null",
":",
"obj... | 从JSON中直接获取Bean对象<br>
先获取JSONObject对象,然后转为Bean对象
@param <T> Bean类型
@param key KEY
@param beanType Bean类型
@return Bean对象,如果值为null或者非JSONObject类型,返回null
@since 3.1.1 | [
"从JSON中直接获取Bean对象<br",
">",
"先获取JSONObject对象,然后转为Bean对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONGetter.java#L95-L98 | train | Get a bean from the JSONObject. | [
30522,
2270,
1026,
1056,
1028,
1056,
2131,
4783,
2319,
1006,
1047,
3145,
1010,
2465,
1026,
1056,
1028,
14068,
13874,
1007,
1063,
2345,
1046,
3385,
16429,
20614,
27885,
3501,
1027,
2131,
22578,
17175,
2497,
20614,
1006,
3145,
1007,
1025,
270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/IncrementalSSSP.java | IncrementalSSSP.isInSSSP | public static boolean isInSSSP(final Edge<Long, Double> edgeToBeRemoved, DataSet<Edge<Long, Double>> edgesInSSSP) throws Exception {
return edgesInSSSP.filter(new FilterFunction<Edge<Long, Double>>() {
@Override
public boolean filter(Edge<Long, Double> edge) throws Exception {
return edge.equals(edgeToBeRemoved);
}
}).count() > 0;
} | java | public static boolean isInSSSP(final Edge<Long, Double> edgeToBeRemoved, DataSet<Edge<Long, Double>> edgesInSSSP) throws Exception {
return edgesInSSSP.filter(new FilterFunction<Edge<Long, Double>>() {
@Override
public boolean filter(Edge<Long, Double> edge) throws Exception {
return edge.equals(edgeToBeRemoved);
}
}).count() > 0;
} | [
"public",
"static",
"boolean",
"isInSSSP",
"(",
"final",
"Edge",
"<",
"Long",
",",
"Double",
">",
"edgeToBeRemoved",
",",
"DataSet",
"<",
"Edge",
"<",
"Long",
",",
"Double",
">",
">",
"edgesInSSSP",
")",
"throws",
"Exception",
"{",
"return",
"edgesInSSSP",
... | Function that verifies whether the edge to be removed is part of the SSSP or not.
If it is, the src vertex will be invalidated.
@param edgeToBeRemoved
@param edgesInSSSP
@return true or false | [
"Function",
"that",
"verifies",
"whether",
"the",
"edge",
"to",
"be",
"removed",
"is",
"part",
"of",
"the",
"SSSP",
"or",
"not",
".",
"If",
"it",
"is",
"the",
"src",
"vertex",
"will",
"be",
"invalidated",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/IncrementalSSSP.java#L140-L148 | train | Checks if the edgeToBeRemoved is in the SSSP DataSet. | [
30522,
2270,
10763,
22017,
20898,
2003,
7076,
4757,
2361,
1006,
2345,
3341,
1026,
2146,
1010,
3313,
1028,
3341,
3406,
5677,
6633,
21818,
2094,
1010,
2951,
13462,
1026,
3341,
1026,
2146,
1010,
3313,
1028,
1028,
7926,
7076,
4757,
2361,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/model/LinearModel.java | LinearModel.viterbiDecode | public double viterbiDecode(Instance instance, int[] guessLabel)
{
final int[] allLabel = featureMap.allLabels();
final int bos = featureMap.bosTag();
final int sentenceLength = instance.tagArray.length;
final int labelSize = allLabel.length;
int[][] preMatrix = new int[sentenceLength][labelSize];
double[][] scoreMatrix = new double[2][labelSize];
for (int i = 0; i < sentenceLength; i++)
{
int _i = i & 1;
int _i_1 = 1 - _i;
int[] allFeature = instance.getFeatureAt(i);
final int transitionFeatureIndex = allFeature.length - 1;
if (0 == i)
{
allFeature[transitionFeatureIndex] = bos;
for (int j = 0; j < allLabel.length; j++)
{
preMatrix[0][j] = j;
double score = score(allFeature, j);
scoreMatrix[0][j] = score;
}
}
else
{
for (int curLabel = 0; curLabel < allLabel.length; curLabel++)
{
double maxScore = Integer.MIN_VALUE;
for (int preLabel = 0; preLabel < allLabel.length; preLabel++)
{
allFeature[transitionFeatureIndex] = preLabel;
double score = score(allFeature, curLabel);
double curScore = scoreMatrix[_i_1][preLabel] + score;
if (maxScore < curScore)
{
maxScore = curScore;
preMatrix[i][curLabel] = preLabel;
scoreMatrix[_i][curLabel] = maxScore;
}
}
}
}
}
int maxIndex = 0;
double maxScore = scoreMatrix[(sentenceLength - 1) & 1][0];
for (int index = 1; index < allLabel.length; index++)
{
if (maxScore < scoreMatrix[(sentenceLength - 1) & 1][index])
{
maxIndex = index;
maxScore = scoreMatrix[(sentenceLength - 1) & 1][index];
}
}
for (int i = sentenceLength - 1; i >= 0; --i)
{
guessLabel[i] = allLabel[maxIndex];
maxIndex = preMatrix[i][maxIndex];
}
return maxScore;
} | java | public double viterbiDecode(Instance instance, int[] guessLabel)
{
final int[] allLabel = featureMap.allLabels();
final int bos = featureMap.bosTag();
final int sentenceLength = instance.tagArray.length;
final int labelSize = allLabel.length;
int[][] preMatrix = new int[sentenceLength][labelSize];
double[][] scoreMatrix = new double[2][labelSize];
for (int i = 0; i < sentenceLength; i++)
{
int _i = i & 1;
int _i_1 = 1 - _i;
int[] allFeature = instance.getFeatureAt(i);
final int transitionFeatureIndex = allFeature.length - 1;
if (0 == i)
{
allFeature[transitionFeatureIndex] = bos;
for (int j = 0; j < allLabel.length; j++)
{
preMatrix[0][j] = j;
double score = score(allFeature, j);
scoreMatrix[0][j] = score;
}
}
else
{
for (int curLabel = 0; curLabel < allLabel.length; curLabel++)
{
double maxScore = Integer.MIN_VALUE;
for (int preLabel = 0; preLabel < allLabel.length; preLabel++)
{
allFeature[transitionFeatureIndex] = preLabel;
double score = score(allFeature, curLabel);
double curScore = scoreMatrix[_i_1][preLabel] + score;
if (maxScore < curScore)
{
maxScore = curScore;
preMatrix[i][curLabel] = preLabel;
scoreMatrix[_i][curLabel] = maxScore;
}
}
}
}
}
int maxIndex = 0;
double maxScore = scoreMatrix[(sentenceLength - 1) & 1][0];
for (int index = 1; index < allLabel.length; index++)
{
if (maxScore < scoreMatrix[(sentenceLength - 1) & 1][index])
{
maxIndex = index;
maxScore = scoreMatrix[(sentenceLength - 1) & 1][index];
}
}
for (int i = sentenceLength - 1; i >= 0; --i)
{
guessLabel[i] = allLabel[maxIndex];
maxIndex = preMatrix[i][maxIndex];
}
return maxScore;
} | [
"public",
"double",
"viterbiDecode",
"(",
"Instance",
"instance",
",",
"int",
"[",
"]",
"guessLabel",
")",
"{",
"final",
"int",
"[",
"]",
"allLabel",
"=",
"featureMap",
".",
"allLabels",
"(",
")",
";",
"final",
"int",
"bos",
"=",
"featureMap",
".",
"bosT... | 维特比解码
@param instance 实例
@param guessLabel 输出标签
@return | [
"维特比解码"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/model/LinearModel.java#L273-L347 | train | ViterbiDecode method. | [
30522,
2270,
3313,
6819,
3334,
17062,
8586,
10244,
1006,
6013,
6013,
1010,
20014,
1031,
1033,
3984,
20470,
2884,
1007,
1063,
2345,
20014,
1031,
1033,
2035,
20470,
2884,
1027,
3444,
2863,
2361,
1012,
2035,
20470,
9050,
1006,
1007,
1025,
2345... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
redisson/redisson | redisson/src/main/java/org/redisson/RedissonNode.java | RedissonNode.start | public void start() {
if (hasRedissonInstance) {
redisson = Redisson.create(config);
}
retrieveAddresses();
if (config.getRedissonNodeInitializer() != null) {
config.getRedissonNodeInitializer().onStartup(this);
}
int mapReduceWorkers = config.getMapReduceWorkers();
if (mapReduceWorkers != -1) {
if (mapReduceWorkers == 0) {
mapReduceWorkers = Runtime.getRuntime().availableProcessors();
}
redisson.getExecutorService(RExecutorService.MAPREDUCE_NAME).registerWorkers(mapReduceWorkers);
log.info("{} map reduce worker(s) registered", mapReduceWorkers);
}
for (Entry<String, Integer> entry : config.getExecutorServiceWorkers().entrySet()) {
String name = entry.getKey();
int workers = entry.getValue();
redisson.getExecutorService(name).registerWorkers(workers);
log.info("{} worker(s) for '{}' ExecutorService registered", workers, name);
}
log.info("Redisson node started!");
} | java | public void start() {
if (hasRedissonInstance) {
redisson = Redisson.create(config);
}
retrieveAddresses();
if (config.getRedissonNodeInitializer() != null) {
config.getRedissonNodeInitializer().onStartup(this);
}
int mapReduceWorkers = config.getMapReduceWorkers();
if (mapReduceWorkers != -1) {
if (mapReduceWorkers == 0) {
mapReduceWorkers = Runtime.getRuntime().availableProcessors();
}
redisson.getExecutorService(RExecutorService.MAPREDUCE_NAME).registerWorkers(mapReduceWorkers);
log.info("{} map reduce worker(s) registered", mapReduceWorkers);
}
for (Entry<String, Integer> entry : config.getExecutorServiceWorkers().entrySet()) {
String name = entry.getKey();
int workers = entry.getValue();
redisson.getExecutorService(name).registerWorkers(workers);
log.info("{} worker(s) for '{}' ExecutorService registered", workers, name);
}
log.info("Redisson node started!");
} | [
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"hasRedissonInstance",
")",
"{",
"redisson",
"=",
"Redisson",
".",
"create",
"(",
"config",
")",
";",
"}",
"retrieveAddresses",
"(",
")",
";",
"if",
"(",
"config",
".",
"getRedissonNodeInitializer",
"(",... | Start Redisson node instance | [
"Start",
"Redisson",
"node",
"instance"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/RedissonNode.java#L126-L154 | train | Start Redisson node. | [
30522,
2270,
11675,
2707,
1006,
1007,
1063,
2065,
1006,
2038,
5596,
24077,
7076,
26897,
1007,
1063,
2417,
24077,
1027,
2417,
24077,
1012,
3443,
1006,
9530,
8873,
2290,
1007,
1025,
1065,
12850,
4215,
16200,
11393,
2015,
1006,
1007,
1025,
206... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/rules/logical/FlinkAggregateExpandDistinctAggregatesRule.java | FlinkAggregateExpandDistinctAggregatesRule.createSelectDistinct | private RelBuilder createSelectDistinct(RelBuilder relBuilder,
Aggregate aggregate, List<Integer> argList, int filterArg,
Map<Integer, Integer> sourceOf) {
relBuilder.push(aggregate.getInput());
final List<Pair<RexNode, String>> projects = new ArrayList<>();
final List<RelDataTypeField> childFields =
relBuilder.peek().getRowType().getFieldList();
for (int i : aggregate.getGroupSet()) {
sourceOf.put(i, projects.size());
projects.add(RexInputRef.of2(i, childFields));
}
if (filterArg >= 0) {
sourceOf.put(filterArg, projects.size());
projects.add(RexInputRef.of2(filterArg, childFields));
}
for (Integer arg : argList) {
if (filterArg >= 0) {
// Implement
// agg(DISTINCT arg) FILTER $f
// by generating
// SELECT DISTINCT ... CASE WHEN $f THEN arg ELSE NULL END AS arg
// and then applying
// agg(arg)
// as usual.
//
// It works except for (rare) agg functions that need to see null
// values.
final RexBuilder rexBuilder = aggregate.getCluster().getRexBuilder();
final RexInputRef filterRef = RexInputRef.of(filterArg, childFields);
final Pair<RexNode, String> argRef = RexInputRef.of2(arg, childFields);
RexNode condition =
rexBuilder.makeCall(SqlStdOperatorTable.CASE, filterRef,
argRef.left,
rexBuilder.ensureType(argRef.left.getType(),
rexBuilder.makeCast(argRef.left.getType(),
rexBuilder.constantNull()),
true));
sourceOf.put(arg, projects.size());
projects.add(Pair.of(condition, "i$" + argRef.right));
continue;
}
if (sourceOf.get(arg) != null) {
continue;
}
sourceOf.put(arg, projects.size());
projects.add(RexInputRef.of2(arg, childFields));
}
relBuilder.project(Pair.left(projects), Pair.right(projects));
// Get the distinct values of the GROUP BY fields and the arguments
// to the agg functions.
relBuilder.push(
aggregate.copy(aggregate.getTraitSet(), relBuilder.build(), false,
ImmutableBitSet.range(projects.size()),
null, com.google.common.collect.ImmutableList.<AggregateCall>of()));
return relBuilder;
} | java | private RelBuilder createSelectDistinct(RelBuilder relBuilder,
Aggregate aggregate, List<Integer> argList, int filterArg,
Map<Integer, Integer> sourceOf) {
relBuilder.push(aggregate.getInput());
final List<Pair<RexNode, String>> projects = new ArrayList<>();
final List<RelDataTypeField> childFields =
relBuilder.peek().getRowType().getFieldList();
for (int i : aggregate.getGroupSet()) {
sourceOf.put(i, projects.size());
projects.add(RexInputRef.of2(i, childFields));
}
if (filterArg >= 0) {
sourceOf.put(filterArg, projects.size());
projects.add(RexInputRef.of2(filterArg, childFields));
}
for (Integer arg : argList) {
if (filterArg >= 0) {
// Implement
// agg(DISTINCT arg) FILTER $f
// by generating
// SELECT DISTINCT ... CASE WHEN $f THEN arg ELSE NULL END AS arg
// and then applying
// agg(arg)
// as usual.
//
// It works except for (rare) agg functions that need to see null
// values.
final RexBuilder rexBuilder = aggregate.getCluster().getRexBuilder();
final RexInputRef filterRef = RexInputRef.of(filterArg, childFields);
final Pair<RexNode, String> argRef = RexInputRef.of2(arg, childFields);
RexNode condition =
rexBuilder.makeCall(SqlStdOperatorTable.CASE, filterRef,
argRef.left,
rexBuilder.ensureType(argRef.left.getType(),
rexBuilder.makeCast(argRef.left.getType(),
rexBuilder.constantNull()),
true));
sourceOf.put(arg, projects.size());
projects.add(Pair.of(condition, "i$" + argRef.right));
continue;
}
if (sourceOf.get(arg) != null) {
continue;
}
sourceOf.put(arg, projects.size());
projects.add(RexInputRef.of2(arg, childFields));
}
relBuilder.project(Pair.left(projects), Pair.right(projects));
// Get the distinct values of the GROUP BY fields and the arguments
// to the agg functions.
relBuilder.push(
aggregate.copy(aggregate.getTraitSet(), relBuilder.build(), false,
ImmutableBitSet.range(projects.size()),
null, com.google.common.collect.ImmutableList.<AggregateCall>of()));
return relBuilder;
} | [
"private",
"RelBuilder",
"createSelectDistinct",
"(",
"RelBuilder",
"relBuilder",
",",
"Aggregate",
"aggregate",
",",
"List",
"<",
"Integer",
">",
"argList",
",",
"int",
"filterArg",
",",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"sourceOf",
")",
"{",
"relBu... | Given an {@link org.apache.calcite.rel.core.Aggregate}
and the ordinals of the arguments to a
particular call to an aggregate function, creates a 'select distinct'
relational expression which projects the group columns and those
arguments but nothing else.
<p>For example, given
<blockquote>
<pre>select f0, count(distinct f1), count(distinct f2)
from t group by f0</pre>
</blockquote>
<p>and the argument list
<blockquote>{2}</blockquote>
<p>returns
<blockquote>
<pre>select distinct f0, f2 from t</pre>
</blockquote>
<p>The <code>sourceOf</code> map is populated with the source of each
column; in this case sourceOf.get(0) = 0, and sourceOf.get(1) = 2.
@param relBuilder Relational expression builder
@param aggregate Aggregate relational expression
@param argList Ordinals of columns to make distinct
@param filterArg Ordinal of column to filter on, or -1
@param sourceOf Out parameter, is populated with a map of where each
output field came from
@return Aggregate relational expression which projects the required
columns | [
"Given",
"an",
"{",
"@link",
"org",
".",
"apache",
".",
"calcite",
".",
"rel",
".",
"core",
".",
"Aggregate",
"}",
"and",
"the",
"ordinals",
"of",
"the",
"arguments",
"to",
"a",
"particular",
"call",
"to",
"an",
"aggregate",
"function",
"creates",
"a",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/rules/logical/FlinkAggregateExpandDistinctAggregatesRule.java#L866-L922 | train | Create a SELECT DISTINCT statement. | [
30522,
2797,
2128,
20850,
19231,
4063,
9005,
12260,
6593,
10521,
7629,
6593,
1006,
2128,
20850,
19231,
4063,
2128,
20850,
19231,
4063,
1010,
9572,
9572,
1010,
2862,
1026,
16109,
1028,
12098,
25394,
3367,
1010,
20014,
11307,
2906,
2290,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBNativeMetricOptions.java | RocksDBNativeMetricOptions.fromConfig | public static RocksDBNativeMetricOptions fromConfig(Configuration config) {
RocksDBNativeMetricOptions options = new RocksDBNativeMetricOptions();
if (config.getBoolean(MONITOR_NUM_IMMUTABLE_MEM_TABLES)) {
options.enableNumImmutableMemTable();
}
if (config.getBoolean(MONITOR_MEM_TABLE_FLUSH_PENDING)) {
options.enableMemTableFlushPending();
}
if (config.getBoolean(TRACK_COMPACTION_PENDING)) {
options.enableCompactionPending();
}
if (config.getBoolean(MONITOR_BACKGROUND_ERRORS)) {
options.enableBackgroundErrors();
}
if (config.getBoolean(MONITOR_CUR_SIZE_ACTIVE_MEM_TABLE)) {
options.enableCurSizeActiveMemTable();
}
if (config.getBoolean(MONITOR_CUR_SIZE_ALL_MEM_TABLE)) {
options.enableCurSizeAllMemTables();
}
if (config.getBoolean(MONITOR_SIZE_ALL_MEM_TABLES)) {
options.enableSizeAllMemTables();
}
if (config.getBoolean(MONITOR_NUM_ENTRIES_ACTIVE_MEM_TABLE)) {
options.enableNumEntriesActiveMemTable();
}
if (config.getBoolean(MONITOR_NUM_ENTRIES_IMM_MEM_TABLES)) {
options.enableNumEntriesImmMemTables();
}
if (config.getBoolean(MONITOR_NUM_DELETES_ACTIVE_MEM_TABLE)) {
options.enableNumDeletesActiveMemTable();
}
if (config.getBoolean(MONITOR_NUM_DELETES_IMM_MEM_TABLE)) {
options.enableNumDeletesImmMemTables();
}
if (config.getBoolean(ESTIMATE_NUM_KEYS)) {
options.enableEstimateNumKeys();
}
if (config.getBoolean(ESTIMATE_TABLE_READERS_MEM)) {
options.enableEstimateTableReadersMem();
}
if (config.getBoolean(MONITOR_NUM_SNAPSHOTS)) {
options.enableNumSnapshots();
}
if (config.getBoolean(MONITOR_NUM_LIVE_VERSIONS)) {
options.enableNumLiveVersions();
}
if (config.getBoolean(ESTIMATE_LIVE_DATA_SIZE)) {
options.enableEstimateLiveDataSize();
}
if (config.getBoolean(MONITOR_TOTAL_SST_FILES_SIZE)) {
options.enableTotalSstFilesSize();
}
if (config.getBoolean(ESTIMATE_PENDING_COMPACTION_BYTES)) {
options.enableEstimatePendingCompactionBytes();
}
if (config.getBoolean(MONITOR_NUM_RUNNING_COMPACTIONS)) {
options.enableNumRunningCompactions();
}
if (config.getBoolean(MONITOR_NUM_RUNNING_FLUSHES)) {
options.enableNumRunningFlushes();
}
if (config.getBoolean(MONITOR_ACTUAL_DELAYED_WRITE_RATE)) {
options.enableActualDelayedWriteRate();
}
return options;
} | java | public static RocksDBNativeMetricOptions fromConfig(Configuration config) {
RocksDBNativeMetricOptions options = new RocksDBNativeMetricOptions();
if (config.getBoolean(MONITOR_NUM_IMMUTABLE_MEM_TABLES)) {
options.enableNumImmutableMemTable();
}
if (config.getBoolean(MONITOR_MEM_TABLE_FLUSH_PENDING)) {
options.enableMemTableFlushPending();
}
if (config.getBoolean(TRACK_COMPACTION_PENDING)) {
options.enableCompactionPending();
}
if (config.getBoolean(MONITOR_BACKGROUND_ERRORS)) {
options.enableBackgroundErrors();
}
if (config.getBoolean(MONITOR_CUR_SIZE_ACTIVE_MEM_TABLE)) {
options.enableCurSizeActiveMemTable();
}
if (config.getBoolean(MONITOR_CUR_SIZE_ALL_MEM_TABLE)) {
options.enableCurSizeAllMemTables();
}
if (config.getBoolean(MONITOR_SIZE_ALL_MEM_TABLES)) {
options.enableSizeAllMemTables();
}
if (config.getBoolean(MONITOR_NUM_ENTRIES_ACTIVE_MEM_TABLE)) {
options.enableNumEntriesActiveMemTable();
}
if (config.getBoolean(MONITOR_NUM_ENTRIES_IMM_MEM_TABLES)) {
options.enableNumEntriesImmMemTables();
}
if (config.getBoolean(MONITOR_NUM_DELETES_ACTIVE_MEM_TABLE)) {
options.enableNumDeletesActiveMemTable();
}
if (config.getBoolean(MONITOR_NUM_DELETES_IMM_MEM_TABLE)) {
options.enableNumDeletesImmMemTables();
}
if (config.getBoolean(ESTIMATE_NUM_KEYS)) {
options.enableEstimateNumKeys();
}
if (config.getBoolean(ESTIMATE_TABLE_READERS_MEM)) {
options.enableEstimateTableReadersMem();
}
if (config.getBoolean(MONITOR_NUM_SNAPSHOTS)) {
options.enableNumSnapshots();
}
if (config.getBoolean(MONITOR_NUM_LIVE_VERSIONS)) {
options.enableNumLiveVersions();
}
if (config.getBoolean(ESTIMATE_LIVE_DATA_SIZE)) {
options.enableEstimateLiveDataSize();
}
if (config.getBoolean(MONITOR_TOTAL_SST_FILES_SIZE)) {
options.enableTotalSstFilesSize();
}
if (config.getBoolean(ESTIMATE_PENDING_COMPACTION_BYTES)) {
options.enableEstimatePendingCompactionBytes();
}
if (config.getBoolean(MONITOR_NUM_RUNNING_COMPACTIONS)) {
options.enableNumRunningCompactions();
}
if (config.getBoolean(MONITOR_NUM_RUNNING_FLUSHES)) {
options.enableNumRunningFlushes();
}
if (config.getBoolean(MONITOR_ACTUAL_DELAYED_WRITE_RATE)) {
options.enableActualDelayedWriteRate();
}
return options;
} | [
"public",
"static",
"RocksDBNativeMetricOptions",
"fromConfig",
"(",
"Configuration",
"config",
")",
"{",
"RocksDBNativeMetricOptions",
"options",
"=",
"new",
"RocksDBNativeMetricOptions",
"(",
")",
";",
"if",
"(",
"config",
".",
"getBoolean",
"(",
"MONITOR_NUM_IMMUTABL... | Creates a {@link RocksDBNativeMetricOptions} based on an
external configuration. | [
"Creates",
"a",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBNativeMetricOptions.java#L156-L243 | train | Creates a new instance of RocksDBNativeMetricOptions from the configuration. | [
30522,
2270,
10763,
5749,
18939,
19833,
3512,
12589,
7361,
9285,
2013,
8663,
8873,
2290,
1006,
9563,
9530,
8873,
2290,
1007,
1063,
5749,
18939,
19833,
3512,
12589,
7361,
9285,
7047,
1027,
2047,
5749,
18939,
19833,
3512,
12589,
7361,
9285,
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-db/src/main/java/cn/hutool/db/ActiveEntity.java | ActiveEntity.parseWithUnderlineCase | public static <T> ActiveEntity parseWithUnderlineCase(T bean) {
return create(null).parseBean(bean, true, true);
} | java | public static <T> ActiveEntity parseWithUnderlineCase(T bean) {
return create(null).parseBean(bean, true, true);
} | [
"public",
"static",
"<",
"T",
">",
"ActiveEntity",
"parseWithUnderlineCase",
"(",
"T",
"bean",
")",
"{",
"return",
"create",
"(",
"null",
")",
".",
"parseBean",
"(",
"bean",
",",
"true",
",",
"true",
")",
";",
"}"
] | 将PO对象转为ActiveEntity,并采用下划线法转换字段
@param <T> Bean对象类型
@param bean Bean对象
@return ActiveEntity | [
"将PO对象转为ActiveEntity",
"并采用下划线法转换字段"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/ActiveEntity.java#L71-L73 | train | Parses the given bean with underline case. | [
30522,
2270,
10763,
1026,
1056,
1028,
3161,
4765,
3012,
11968,
3366,
24415,
20824,
4179,
18382,
1006,
1056,
14068,
1007,
1063,
2709,
3443,
1006,
19701,
1007,
1012,
11968,
3366,
4783,
2319,
1006,
14068,
1010,
2995,
1010,
2995,
1007,
1025,
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/MDAG/MDAG.java | MDAG.contains | public boolean contains(String str)
{
if (sourceNode != null) //if the MDAG hasn't been simplified
{
MDAGNode targetNode = sourceNode.transition(str.toCharArray());
return (targetNode != null && targetNode.isAcceptNode());
}
else
{
SimpleMDAGNode targetNode = simplifiedSourceNode.transition(mdagDataArray, str.toCharArray());
return (targetNode != null && targetNode.isAcceptNode());
}
} | java | public boolean contains(String str)
{
if (sourceNode != null) //if the MDAG hasn't been simplified
{
MDAGNode targetNode = sourceNode.transition(str.toCharArray());
return (targetNode != null && targetNode.isAcceptNode());
}
else
{
SimpleMDAGNode targetNode = simplifiedSourceNode.transition(mdagDataArray, str.toCharArray());
return (targetNode != null && targetNode.isAcceptNode());
}
} | [
"public",
"boolean",
"contains",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"sourceNode",
"!=",
"null",
")",
"//if the MDAG hasn't been simplified",
"{",
"MDAGNode",
"targetNode",
"=",
"sourceNode",
".",
"transition",
"(",
"str",
".",
"toCharArray",
"(",
")",
... | 是否包含<br>
Determines whether a String is present in the MDAG.
@param str the String to be searched for
@return true if {@code str} is present in the MDAG, and false otherwise | [
"是否包含<br",
">",
"Determines",
"whether",
"a",
"String",
"is",
"present",
"in",
"the",
"MDAG",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L834-L846 | train | Check if the source and target nodes are present in the source MDAG. | [
30522,
2270,
22017,
20898,
3397,
1006,
5164,
2358,
2099,
1007,
1063,
2065,
1006,
3120,
3630,
3207,
999,
1027,
19701,
1007,
1013,
1013,
2065,
1996,
9108,
8490,
8440,
1005,
1056,
2042,
11038,
1063,
9108,
8490,
3630,
3207,
4539,
3630,
3207,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/MacAddressUtil.java | MacAddressUtil.compareAddresses | static int compareAddresses(byte[] current, byte[] candidate) {
if (candidate == null || candidate.length < EUI48_MAC_ADDRESS_LENGTH) {
return 1;
}
// Must not be filled with only 0 and 1.
boolean onlyZeroAndOne = true;
for (byte b: candidate) {
if (b != 0 && b != 1) {
onlyZeroAndOne = false;
break;
}
}
if (onlyZeroAndOne) {
return 1;
}
// Must not be a multicast address
if ((candidate[0] & 1) != 0) {
return 1;
}
// Prefer globally unique address.
if ((candidate[0] & 2) == 0) {
if (current.length != 0 && (current[0] & 2) == 0) {
// Both current and candidate are globally unique addresses.
return 0;
} else {
// Only candidate is globally unique.
return -1;
}
} else {
if (current.length != 0 && (current[0] & 2) == 0) {
// Only current is globally unique.
return 1;
} else {
// Both current and candidate are non-unique.
return 0;
}
}
} | java | static int compareAddresses(byte[] current, byte[] candidate) {
if (candidate == null || candidate.length < EUI48_MAC_ADDRESS_LENGTH) {
return 1;
}
// Must not be filled with only 0 and 1.
boolean onlyZeroAndOne = true;
for (byte b: candidate) {
if (b != 0 && b != 1) {
onlyZeroAndOne = false;
break;
}
}
if (onlyZeroAndOne) {
return 1;
}
// Must not be a multicast address
if ((candidate[0] & 1) != 0) {
return 1;
}
// Prefer globally unique address.
if ((candidate[0] & 2) == 0) {
if (current.length != 0 && (current[0] & 2) == 0) {
// Both current and candidate are globally unique addresses.
return 0;
} else {
// Only candidate is globally unique.
return -1;
}
} else {
if (current.length != 0 && (current[0] & 2) == 0) {
// Only current is globally unique.
return 1;
} else {
// Both current and candidate are non-unique.
return 0;
}
}
} | [
"static",
"int",
"compareAddresses",
"(",
"byte",
"[",
"]",
"current",
",",
"byte",
"[",
"]",
"candidate",
")",
"{",
"if",
"(",
"candidate",
"==",
"null",
"||",
"candidate",
".",
"length",
"<",
"EUI48_MAC_ADDRESS_LENGTH",
")",
"{",
"return",
"1",
";",
"}... | visible for testing | [
"visible",
"for",
"testing"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/MacAddressUtil.java#L210-L251 | train | Compare addresses. | [
30522,
10763,
20014,
12826,
4215,
16200,
11393,
2015,
1006,
24880,
1031,
1033,
2783,
1010,
24880,
1031,
1033,
4018,
1007,
1063,
2065,
1006,
4018,
1027,
1027,
19701,
1064,
1064,
4018,
1012,
3091,
1026,
7327,
2072,
18139,
1035,
6097,
1035,
47... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/AllocatedSlot.java | AllocatedSlot.releasePayload | public void releasePayload(Throwable cause) {
final Payload payload = payloadReference.get();
if (payload != null) {
payload.release(cause);
payloadReference.set(null);
}
} | java | public void releasePayload(Throwable cause) {
final Payload payload = payloadReference.get();
if (payload != null) {
payload.release(cause);
payloadReference.set(null);
}
} | [
"public",
"void",
"releasePayload",
"(",
"Throwable",
"cause",
")",
"{",
"final",
"Payload",
"payload",
"=",
"payloadReference",
".",
"get",
"(",
")",
";",
"if",
"(",
"payload",
"!=",
"null",
")",
"{",
"payload",
".",
"release",
"(",
"cause",
")",
";",
... | Triggers the release of the assigned payload. If the payload could be released,
then it is removed from the slot.
@param cause of the release operation | [
"Triggers",
"the",
"release",
"of",
"the",
"assigned",
"payload",
".",
"If",
"the",
"payload",
"could",
"be",
"released",
"then",
"it",
"is",
"removed",
"from",
"the",
"slot",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/AllocatedSlot.java#L145-L152 | train | Release the payload. | [
30522,
2270,
11675,
2713,
4502,
8516,
10441,
2094,
1006,
5466,
3085,
3426,
1007,
1063,
2345,
18093,
18093,
1027,
18093,
2890,
25523,
1012,
2131,
1006,
1007,
1025,
2065,
1006,
18093,
999,
1027,
19701,
1007,
1063,
18093,
30524,
1025,
18093,
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-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java | Execution.calculatePreferredLocations | @VisibleForTesting
public CompletableFuture<Collection<TaskManagerLocation>> calculatePreferredLocations(LocationPreferenceConstraint locationPreferenceConstraint) {
final Collection<CompletableFuture<TaskManagerLocation>> preferredLocationFutures = getVertex().getPreferredLocations();
final CompletableFuture<Collection<TaskManagerLocation>> preferredLocationsFuture;
switch(locationPreferenceConstraint) {
case ALL:
preferredLocationsFuture = FutureUtils.combineAll(preferredLocationFutures);
break;
case ANY:
final ArrayList<TaskManagerLocation> completedTaskManagerLocations = new ArrayList<>(preferredLocationFutures.size());
for (CompletableFuture<TaskManagerLocation> preferredLocationFuture : preferredLocationFutures) {
if (preferredLocationFuture.isDone() && !preferredLocationFuture.isCompletedExceptionally()) {
final TaskManagerLocation taskManagerLocation = preferredLocationFuture.getNow(null);
if (taskManagerLocation == null) {
throw new FlinkRuntimeException("TaskManagerLocationFuture was completed with null. This indicates a programming bug.");
}
completedTaskManagerLocations.add(taskManagerLocation);
}
}
preferredLocationsFuture = CompletableFuture.completedFuture(completedTaskManagerLocations);
break;
default:
throw new RuntimeException("Unknown LocationPreferenceConstraint " + locationPreferenceConstraint + '.');
}
return preferredLocationsFuture;
} | java | @VisibleForTesting
public CompletableFuture<Collection<TaskManagerLocation>> calculatePreferredLocations(LocationPreferenceConstraint locationPreferenceConstraint) {
final Collection<CompletableFuture<TaskManagerLocation>> preferredLocationFutures = getVertex().getPreferredLocations();
final CompletableFuture<Collection<TaskManagerLocation>> preferredLocationsFuture;
switch(locationPreferenceConstraint) {
case ALL:
preferredLocationsFuture = FutureUtils.combineAll(preferredLocationFutures);
break;
case ANY:
final ArrayList<TaskManagerLocation> completedTaskManagerLocations = new ArrayList<>(preferredLocationFutures.size());
for (CompletableFuture<TaskManagerLocation> preferredLocationFuture : preferredLocationFutures) {
if (preferredLocationFuture.isDone() && !preferredLocationFuture.isCompletedExceptionally()) {
final TaskManagerLocation taskManagerLocation = preferredLocationFuture.getNow(null);
if (taskManagerLocation == null) {
throw new FlinkRuntimeException("TaskManagerLocationFuture was completed with null. This indicates a programming bug.");
}
completedTaskManagerLocations.add(taskManagerLocation);
}
}
preferredLocationsFuture = CompletableFuture.completedFuture(completedTaskManagerLocations);
break;
default:
throw new RuntimeException("Unknown LocationPreferenceConstraint " + locationPreferenceConstraint + '.');
}
return preferredLocationsFuture;
} | [
"@",
"VisibleForTesting",
"public",
"CompletableFuture",
"<",
"Collection",
"<",
"TaskManagerLocation",
">",
">",
"calculatePreferredLocations",
"(",
"LocationPreferenceConstraint",
"locationPreferenceConstraint",
")",
"{",
"final",
"Collection",
"<",
"CompletableFuture",
"<"... | Calculates the preferred locations based on the location preference constraint.
@param locationPreferenceConstraint constraint for the location preference
@return Future containing the collection of preferred locations. This might not be completed if not all inputs
have been a resource assigned. | [
"Calculates",
"the",
"preferred",
"locations",
"based",
"on",
"the",
"location",
"preference",
"constraint",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java#L1295-L1326 | train | Calculates the preferred locations for this vertex. | [
30522,
1030,
5710,
13028,
4355,
2075,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
3074,
1026,
4708,
24805,
4590,
4135,
10719,
1028,
1028,
18422,
28139,
7512,
5596,
4135,
10719,
2015,
1006,
3295,
28139,
25523,
8663,
20528,
18447,
3295,
28139... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/format/FastDatePrinter.java | FastDatePrinter.appendDigits | private static void appendDigits(final Appendable buffer, final int value) throws IOException {
buffer.append((char) (value / 10 + '0'));
buffer.append((char) (value % 10 + '0'));
} | java | private static void appendDigits(final Appendable buffer, final int value) throws IOException {
buffer.append((char) (value / 10 + '0'));
buffer.append((char) (value % 10 + '0'));
} | [
"private",
"static",
"void",
"appendDigits",
"(",
"final",
"Appendable",
"buffer",
",",
"final",
"int",
"value",
")",
"throws",
"IOException",
"{",
"buffer",
".",
"append",
"(",
"(",
"char",
")",
"(",
"value",
"/",
"10",
"+",
"'",
"'",
")",
")",
";",
... | Appends two digits to the given buffer.
@param buffer the buffer to append to.
@param value the value to append digits from. | [
"Appends",
"two",
"digits",
"to",
"the",
"given",
"buffer",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java#L413-L416 | train | Append digits to the given Appendable. | [
30522,
2797,
10763,
11675,
10439,
10497,
4305,
23806,
2015,
1006,
2345,
10439,
10497,
3085,
17698,
1010,
2345,
20014,
3643,
1007,
11618,
22834,
10288,
24422,
1063,
17698,
1012,
10439,
10497,
1006,
1006,
25869,
1007,
1006,
3643,
1013,
2184,
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/src/main/java/org/springframework/boot/web/servlet/ServletRegistrationBean.java | ServletRegistrationBean.setUrlMappings | public void setUrlMappings(Collection<String> urlMappings) {
Assert.notNull(urlMappings, "UrlMappings must not be null");
this.urlMappings = new LinkedHashSet<>(urlMappings);
} | java | public void setUrlMappings(Collection<String> urlMappings) {
Assert.notNull(urlMappings, "UrlMappings must not be null");
this.urlMappings = new LinkedHashSet<>(urlMappings);
} | [
"public",
"void",
"setUrlMappings",
"(",
"Collection",
"<",
"String",
">",
"urlMappings",
")",
"{",
"Assert",
".",
"notNull",
"(",
"urlMappings",
",",
"\"UrlMappings must not be null\"",
")",
";",
"this",
".",
"urlMappings",
"=",
"new",
"LinkedHashSet",
"<>",
"(... | Set the URL mappings for the servlet. If not specified the mapping will default to
'/'. This will replace any previously specified mappings.
@param urlMappings the mappings to set
@see #addUrlMappings(String...) | [
"Set",
"the",
"URL",
"mappings",
"for",
"the",
"servlet",
".",
"If",
"not",
"specified",
"the",
"mapping",
"will",
"default",
"to",
"/",
".",
"This",
"will",
"replace",
"any",
"previously",
"specified",
"mappings",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/ServletRegistrationBean.java#L121-L124 | train | Sets the url mappings. | [
30522,
2270,
11675,
2275,
3126,
19145,
14853,
2015,
1006,
3074,
1026,
5164,
1028,
24471,
19145,
14853,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
24471,
19145,
14853,
2015,
1010,
1000,
24471,
19145,
14853,
2015,
2442,
2025,
2022,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java | HashUtil.universal | public static int universal(char[] key, int mask, int[] tab) {
int hash = key.length, i, len = key.length;
for (i = 0; i < (len << 3); i += 8) {
char k = key[i >> 3];
if ((k & 0x01) == 0) {
hash ^= tab[i + 0];
}
if ((k & 0x02) == 0) {
hash ^= tab[i + 1];
}
if ((k & 0x04) == 0) {
hash ^= tab[i + 2];
}
if ((k & 0x08) == 0) {
hash ^= tab[i + 3];
}
if ((k & 0x10) == 0) {
hash ^= tab[i + 4];
}
if ((k & 0x20) == 0) {
hash ^= tab[i + 5];
}
if ((k & 0x40) == 0) {
hash ^= tab[i + 6];
}
if ((k & 0x80) == 0) {
hash ^= tab[i + 7];
}
}
return (hash & mask);
} | java | public static int universal(char[] key, int mask, int[] tab) {
int hash = key.length, i, len = key.length;
for (i = 0; i < (len << 3); i += 8) {
char k = key[i >> 3];
if ((k & 0x01) == 0) {
hash ^= tab[i + 0];
}
if ((k & 0x02) == 0) {
hash ^= tab[i + 1];
}
if ((k & 0x04) == 0) {
hash ^= tab[i + 2];
}
if ((k & 0x08) == 0) {
hash ^= tab[i + 3];
}
if ((k & 0x10) == 0) {
hash ^= tab[i + 4];
}
if ((k & 0x20) == 0) {
hash ^= tab[i + 5];
}
if ((k & 0x40) == 0) {
hash ^= tab[i + 6];
}
if ((k & 0x80) == 0) {
hash ^= tab[i + 7];
}
}
return (hash & mask);
} | [
"public",
"static",
"int",
"universal",
"(",
"char",
"[",
"]",
"key",
",",
"int",
"mask",
",",
"int",
"[",
"]",
"tab",
")",
"{",
"int",
"hash",
"=",
"key",
".",
"length",
",",
"i",
",",
"len",
"=",
"key",
".",
"length",
";",
"for",
"(",
"i",
... | Universal Hashing
@param key 字节数组
@param mask 掩码
@param tab tab
@return hash值 | [
"Universal",
"Hashing"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java#L90-L120 | train | Private helper method for creating a hash value from a UTF16 encoded string. | [
30522,
2270,
10763,
20014,
5415,
1006,
25869,
1031,
1033,
3145,
1010,
20014,
7308,
1010,
20014,
1031,
1033,
21628,
1007,
1063,
20014,
23325,
1027,
3145,
1012,
3091,
1010,
1045,
1010,
18798,
1027,
3145,
1012,
3091,
1025,
2005,
1006,
1045,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | dump/src/main/java/com/networknt/dump/CookiesDumper.java | CookiesDumper.dumpResponse | @Override
public void dumpResponse(Map<String, Object> result) {
Map<String, Cookie> cookiesMap = exchange.getResponseCookies();
dumpCookies(cookiesMap, "responseCookies");
this.putDumpInfoTo(result);
} | java | @Override
public void dumpResponse(Map<String, Object> result) {
Map<String, Cookie> cookiesMap = exchange.getResponseCookies();
dumpCookies(cookiesMap, "responseCookies");
this.putDumpInfoTo(result);
} | [
"@",
"Override",
"public",
"void",
"dumpResponse",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"Map",
"<",
"String",
",",
"Cookie",
">",
"cookiesMap",
"=",
"exchange",
".",
"getResponseCookies",
"(",
")",
";",
"dumpCookies",
"(",
"... | impl of dumping response cookies to result
@param result A map you want to put dump information to | [
"impl",
"of",
"dumping",
"response",
"cookies",
"to",
"result"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/CookiesDumper.java#L50-L55 | train | Dump response cookies to result | [
30522,
1030,
2058,
15637,
2270,
11675,
15653,
6072,
26029,
3366,
1006,
4949,
1026,
5164,
1010,
4874,
1028,
2765,
1007,
1063,
4949,
1026,
5164,
1010,
17387,
1028,
16324,
2863,
2361,
1027,
3863,
1012,
2131,
6072,
26029,
3366,
3597,
23212,
222... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/time/Deadline.java | Deadline.fromNow | public static Deadline fromNow(Duration duration) {
return new Deadline(Math.addExact(System.nanoTime(), duration.toNanos()));
} | java | public static Deadline fromNow(Duration duration) {
return new Deadline(Math.addExact(System.nanoTime(), duration.toNanos()));
} | [
"public",
"static",
"Deadline",
"fromNow",
"(",
"Duration",
"duration",
")",
"{",
"return",
"new",
"Deadline",
"(",
"Math",
".",
"addExact",
"(",
"System",
".",
"nanoTime",
"(",
")",
",",
"duration",
".",
"toNanos",
"(",
")",
")",
")",
";",
"}"
] | Constructs a Deadline that is a given duration after now. | [
"Constructs",
"a",
"Deadline",
"that",
"is",
"a",
"given",
"duration",
"after",
"now",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/time/Deadline.java#L79-L81 | train | Creates a Deadline from the given duration. | [
30522,
2270,
10763,
15117,
2013,
19779,
1006,
9367,
9367,
1007,
1063,
2709,
2047,
15117,
1006,
8785,
1012,
5587,
10288,
18908,
1006,
2291,
1012,
28991,
7292,
1006,
1007,
1010,
9367,
1012,
10228,
6761,
2015,
1006,
1007,
1007,
1007,
1025,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.writeAscii | static int writeAscii(AbstractByteBuf buffer, int writerIndex, CharSequence seq, int len) {
// We can use the _set methods as these not need to do any index checks and reference checks.
// This is possible as we called ensureWritable(...) before.
for (int i = 0; i < len; i++) {
buffer._setByte(writerIndex++, AsciiString.c2b(seq.charAt(i)));
}
return len;
} | java | static int writeAscii(AbstractByteBuf buffer, int writerIndex, CharSequence seq, int len) {
// We can use the _set methods as these not need to do any index checks and reference checks.
// This is possible as we called ensureWritable(...) before.
for (int i = 0; i < len; i++) {
buffer._setByte(writerIndex++, AsciiString.c2b(seq.charAt(i)));
}
return len;
} | [
"static",
"int",
"writeAscii",
"(",
"AbstractByteBuf",
"buffer",
",",
"int",
"writerIndex",
",",
"CharSequence",
"seq",
",",
"int",
"len",
")",
"{",
"// We can use the _set methods as these not need to do any index checks and reference checks.",
"// This is possible as we called ... | Fast-Path implementation | [
"Fast",
"-",
"Path",
"implementation"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L712-L720 | train | Write a sequence of ASCII characters to the buffer. | [
30522,
10763,
20014,
4339,
3022,
6895,
2072,
1006,
10061,
3762,
2618,
8569,
2546,
17698,
1010,
20014,
3213,
22254,
10288,
1010,
25869,
3366,
4226,
5897,
7367,
4160,
1010,
20014,
18798,
1007,
1063,
1013,
1013,
2057,
2064,
2224,
1996,
1035,
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-core/src/main/java/org/apache/flink/util/AbstractCloseableRegistry.java | AbstractCloseableRegistry.unregisterCloseable | public final boolean unregisterCloseable(C closeable) {
if (null == closeable) {
return false;
}
synchronized (getSynchronizationLock()) {
return doUnRegister(closeable, closeableToRef);
}
} | java | public final boolean unregisterCloseable(C closeable) {
if (null == closeable) {
return false;
}
synchronized (getSynchronizationLock()) {
return doUnRegister(closeable, closeableToRef);
}
} | [
"public",
"final",
"boolean",
"unregisterCloseable",
"(",
"C",
"closeable",
")",
"{",
"if",
"(",
"null",
"==",
"closeable",
")",
"{",
"return",
"false",
";",
"}",
"synchronized",
"(",
"getSynchronizationLock",
"(",
")",
")",
"{",
"return",
"doUnRegister",
"(... | Removes a {@link Closeable} from the registry.
@param closeable instance to remove from the registry.
@return true if the closeable was previously registered and became unregistered through this call. | [
"Removes",
"a",
"{",
"@link",
"Closeable",
"}",
"from",
"the",
"registry",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/AbstractCloseableRegistry.java#L94-L103 | train | Unregisters a closeable. | [
30522,
2270,
2345,
22017,
20898,
4895,
2890,
24063,
2121,
20464,
9232,
3085,
1006,
1039,
2485,
3085,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
2485,
3085,
1007,
1063,
2709,
6270,
1025,
1065,
25549,
1006,
4152,
6038,
2818,
4948,
3989,
7878,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/io/CsvReader.java | CsvReader.configureInputFormat | private void configureInputFormat(CsvInputFormat<?> format) {
format.setCharset(this.charset);
format.setDelimiter(this.lineDelimiter);
format.setFieldDelimiter(this.fieldDelimiter);
format.setCommentPrefix(this.commentPrefix);
format.setSkipFirstLineAsHeader(skipFirstLineAsHeader);
format.setLenient(ignoreInvalidLines);
if (this.parseQuotedStrings) {
format.enableQuotedStringParsing(this.quoteCharacter);
}
} | java | private void configureInputFormat(CsvInputFormat<?> format) {
format.setCharset(this.charset);
format.setDelimiter(this.lineDelimiter);
format.setFieldDelimiter(this.fieldDelimiter);
format.setCommentPrefix(this.commentPrefix);
format.setSkipFirstLineAsHeader(skipFirstLineAsHeader);
format.setLenient(ignoreInvalidLines);
if (this.parseQuotedStrings) {
format.enableQuotedStringParsing(this.quoteCharacter);
}
} | [
"private",
"void",
"configureInputFormat",
"(",
"CsvInputFormat",
"<",
"?",
">",
"format",
")",
"{",
"format",
".",
"setCharset",
"(",
"this",
".",
"charset",
")",
";",
"format",
".",
"setDelimiter",
"(",
"this",
".",
"lineDelimiter",
")",
";",
"format",
"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/io/CsvReader.java#L365-L375 | train | Configures the CSV input format. | [
30522,
2797,
11675,
9530,
8873,
27390,
12377,
18780,
14192,
4017,
1006,
20116,
6371,
18780,
14192,
4017,
1026,
1029,
1028,
4289,
1007,
1063,
4289,
1012,
2275,
7507,
22573,
2102,
1006,
2023,
1012,
25869,
13462,
1007,
1025,
4289,
1012,
2275,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/windowing/WindowWordCount.java | WindowWordCount.main | public static void main(String[] args) throws Exception {
final ParameterTool params = ParameterTool.fromArgs(args);
// set up the execution environment
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
// get input data
DataStream<String> text;
if (params.has("input")) {
// read the text file from given input path
text = env.readTextFile(params.get("input"));
} else {
System.out.println("Executing WindowWordCount example with default input data set.");
System.out.println("Use --input to specify file input.");
// get default test text data
text = env.fromElements(WordCountData.WORDS);
}
// make parameters available in the web interface
env.getConfig().setGlobalJobParameters(params);
final int windowSize = params.getInt("window", 10);
final int slideSize = params.getInt("slide", 5);
DataStream<Tuple2<String, Integer>> counts =
// split up the lines in pairs (2-tuples) containing: (word,1)
text.flatMap(new WordCount.Tokenizer())
// create windows of windowSize records slided every slideSize records
.keyBy(0)
.countWindow(windowSize, slideSize)
// group by the tuple field "0" and sum up tuple field "1"
.sum(1);
// emit result
if (params.has("output")) {
counts.writeAsText(params.get("output"));
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
counts.print();
}
// execute program
env.execute("WindowWordCount");
} | java | public static void main(String[] args) throws Exception {
final ParameterTool params = ParameterTool.fromArgs(args);
// set up the execution environment
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
// get input data
DataStream<String> text;
if (params.has("input")) {
// read the text file from given input path
text = env.readTextFile(params.get("input"));
} else {
System.out.println("Executing WindowWordCount example with default input data set.");
System.out.println("Use --input to specify file input.");
// get default test text data
text = env.fromElements(WordCountData.WORDS);
}
// make parameters available in the web interface
env.getConfig().setGlobalJobParameters(params);
final int windowSize = params.getInt("window", 10);
final int slideSize = params.getInt("slide", 5);
DataStream<Tuple2<String, Integer>> counts =
// split up the lines in pairs (2-tuples) containing: (word,1)
text.flatMap(new WordCount.Tokenizer())
// create windows of windowSize records slided every slideSize records
.keyBy(0)
.countWindow(windowSize, slideSize)
// group by the tuple field "0" and sum up tuple field "1"
.sum(1);
// emit result
if (params.has("output")) {
counts.writeAsText(params.get("output"));
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
counts.print();
}
// execute program
env.execute("WindowWordCount");
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"final",
"ParameterTool",
"params",
"=",
"ParameterTool",
".",
"fromArgs",
"(",
"args",
")",
";",
"// set up the execution environment",
"final",
"StreamExecution... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/windowing/WindowWordCount.java#L49-L93 | train | Main method to run the WindowWordCount example. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
2345,
16381,
3406,
4747,
11498,
5244,
1027,
16381,
3406,
4747,
1012,
2013,
30524,
5460,
10288,
8586,
13700,
2368,
21663,
2239,
3672,
1012,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.textToBe | public static ExpectedCondition<Boolean> textToBe(final By locator, final String value) {
return new ExpectedCondition<Boolean>() {
private String currentValue = null;
@Override
public Boolean apply(WebDriver driver) {
try {
currentValue = driver.findElement(locator).getText();
return currentValue.equals(value);
} catch (Exception e) {
return false;
}
}
@Override
public String toString() {
return String.format("element found by %s to have text \"%s\". Current text: \"%s\"",
locator, value, currentValue);
}
};
} | java | public static ExpectedCondition<Boolean> textToBe(final By locator, final String value) {
return new ExpectedCondition<Boolean>() {
private String currentValue = null;
@Override
public Boolean apply(WebDriver driver) {
try {
currentValue = driver.findElement(locator).getText();
return currentValue.equals(value);
} catch (Exception e) {
return false;
}
}
@Override
public String toString() {
return String.format("element found by %s to have text \"%s\". Current text: \"%s\"",
locator, value, currentValue);
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"Boolean",
">",
"textToBe",
"(",
"final",
"By",
"locator",
",",
"final",
"String",
"value",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"Boolean",
">",
"(",
")",
"{",
"private",
"String",
"currentValue",
... | An expectation for checking WebElement with given locator has specific text
@param locator used to find the element
@param value used as expected text
@return Boolean true when element has text value equal to @value | [
"An",
"expectation",
"for",
"checking",
"WebElement",
"with",
"given",
"locator",
"has",
"specific",
"text"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L900-L920 | train | An expectation for checking WebElement with specified locator has text equal to the given value. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
3793,
3406,
4783,
1006,
2345,
2011,
8840,
11266,
2953,
1010,
2345,
5164,
3643,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
1006,
1007,
1063,
2797,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/ApplicationConversionService.java | ApplicationConversionService.configure | public static void configure(FormatterRegistry registry) {
DefaultConversionService.addDefaultConverters(registry);
DefaultFormattingConversionService.addDefaultFormatters(registry);
addApplicationFormatters(registry);
addApplicationConverters(registry);
} | java | public static void configure(FormatterRegistry registry) {
DefaultConversionService.addDefaultConverters(registry);
DefaultFormattingConversionService.addDefaultFormatters(registry);
addApplicationFormatters(registry);
addApplicationConverters(registry);
} | [
"public",
"static",
"void",
"configure",
"(",
"FormatterRegistry",
"registry",
")",
"{",
"DefaultConversionService",
".",
"addDefaultConverters",
"(",
"registry",
")",
";",
"DefaultFormattingConversionService",
".",
"addDefaultFormatters",
"(",
"registry",
")",
";",
"ad... | Configure the given {@link FormatterRegistry} with formatters and converters
appropriate for most Spring Boot applications.
@param registry the registry of converters to add to (must also be castable to
ConversionService, e.g. being a {@link ConfigurableConversionService})
@throws ClassCastException if the given FormatterRegistry could not be cast to a
ConversionService | [
"Configure",
"the",
"given",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/ApplicationConversionService.java#L87-L92 | train | Configure the given formatter registry. | [
30522,
2270,
10763,
11675,
9530,
8873,
27390,
2063,
1006,
4289,
3334,
2890,
24063,
2854,
15584,
1007,
1063,
12398,
8663,
27774,
8043,
7903,
2063,
1012,
5587,
3207,
7011,
11314,
8663,
16874,
2545,
1006,
15584,
1007,
1025,
12398,
14192,
19321,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/csv/CsvWriter.java | CsvWriter.write | public CsvWriter write(Collection<String[]> lines) throws IORuntimeException {
if (CollUtil.isNotEmpty(lines)) {
for (final String[] values : lines) {
appendLine(values);
}
flush();
}
return this;
} | java | public CsvWriter write(Collection<String[]> lines) throws IORuntimeException {
if (CollUtil.isNotEmpty(lines)) {
for (final String[] values : lines) {
appendLine(values);
}
flush();
}
return this;
} | [
"public",
"CsvWriter",
"write",
"(",
"Collection",
"<",
"String",
"[",
"]",
">",
"lines",
")",
"throws",
"IORuntimeException",
"{",
"if",
"(",
"CollUtil",
".",
"isNotEmpty",
"(",
"lines",
")",
")",
"{",
"for",
"(",
"final",
"String",
"[",
"]",
"values",
... | 将多行写出到Writer
@param lines 多行数据
@return this
@throws IORuntimeException IO异常 | [
"将多行写出到Writer"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvWriter.java#L188-L196 | train | Write a collection of strings to the writer. | [
30522,
2270,
20116,
2615,
15994,
4339,
1006,
3074,
1026,
5164,
1031,
1033,
1028,
3210,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2065,
1006,
8902,
7630,
3775,
2140,
1012,
3475,
12184,
27718,
2100,
1006,
3210,
1007,
1007,
1063,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/messages/MessageSerializer.java | MessageSerializer.serializeServerFailure | public static ByteBuf serializeServerFailure(
final ByteBufAllocator alloc,
final Throwable cause) throws IOException {
final ByteBuf buf = alloc.ioBuffer();
// Frame length is set at end
buf.writeInt(0);
writeHeader(buf, MessageType.SERVER_FAILURE);
try (ByteBufOutputStream bbos = new ByteBufOutputStream(buf);
ObjectOutput out = new ObjectOutputStream(bbos)) {
out.writeObject(cause);
}
// Set frame length
int frameLength = buf.readableBytes() - Integer.BYTES;
buf.setInt(0, frameLength);
return buf;
} | java | public static ByteBuf serializeServerFailure(
final ByteBufAllocator alloc,
final Throwable cause) throws IOException {
final ByteBuf buf = alloc.ioBuffer();
// Frame length is set at end
buf.writeInt(0);
writeHeader(buf, MessageType.SERVER_FAILURE);
try (ByteBufOutputStream bbos = new ByteBufOutputStream(buf);
ObjectOutput out = new ObjectOutputStream(bbos)) {
out.writeObject(cause);
}
// Set frame length
int frameLength = buf.readableBytes() - Integer.BYTES;
buf.setInt(0, frameLength);
return buf;
} | [
"public",
"static",
"ByteBuf",
"serializeServerFailure",
"(",
"final",
"ByteBufAllocator",
"alloc",
",",
"final",
"Throwable",
"cause",
")",
"throws",
"IOException",
"{",
"final",
"ByteBuf",
"buf",
"=",
"alloc",
".",
"ioBuffer",
"(",
")",
";",
"// Frame length is ... | Serializes the failure message sent to the
{@link org.apache.flink.queryablestate.network.Client} in case of
server related errors.
@param alloc The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into.
@param cause The exception thrown at the server.
@return The failure message. | [
"Serializes",
"the",
"failure",
"message",
"sent",
"to",
"the",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"queryablestate",
".",
"network",
".",
"Client",
"}",
"in",
"case",
"of",
"server",
"related",
"errors",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/messages/MessageSerializer.java#L158-L177 | train | Serialize server failure. | [
30522,
2270,
10763,
24880,
8569,
2546,
7642,
10057,
2121,
6299,
7011,
4014,
5397,
1006,
2345,
24880,
8569,
13976,
24755,
4263,
2035,
10085,
1010,
2345,
5466,
3085,
3426,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
24880,
8569,
2546,
20934,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.readBytes | public static byte[] readBytes(InputStream in) throws IORuntimeException {
final FastByteArrayOutputStream out = new FastByteArrayOutputStream();
copy(in, out);
return out.toByteArray();
} | java | public static byte[] readBytes(InputStream in) throws IORuntimeException {
final FastByteArrayOutputStream out = new FastByteArrayOutputStream();
copy(in, out);
return out.toByteArray();
} | [
"public",
"static",
"byte",
"[",
"]",
"readBytes",
"(",
"InputStream",
"in",
")",
"throws",
"IORuntimeException",
"{",
"final",
"FastByteArrayOutputStream",
"out",
"=",
"new",
"FastByteArrayOutputStream",
"(",
")",
";",
"copy",
"(",
"in",
",",
"out",
")",
";",... | 从流中读取bytes
@param in {@link InputStream}
@return bytes
@throws IORuntimeException IO异常 | [
"从流中读取bytes"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L522-L526 | train | Reads a byte array from an input stream. | [
30522,
2270,
10763,
24880,
1031,
1033,
3191,
3762,
4570,
1006,
20407,
25379,
1999,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2345,
3435,
3762,
27058,
11335,
29337,
25856,
16446,
25379,
2041,
1027,
2047,
3435,
3762,
27058,
11335,
29... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/result/MaterializedCollectStreamResult.java | MaterializedCollectStreamResult.processInsert | private void processInsert(Row row) {
// limit the materialized table
if (materializedTable.size() - validRowPosition >= maxRowCount) {
cleanUp();
}
materializedTable.add(row);
rowPositionCache.put(row, materializedTable.size() - 1);
} | java | private void processInsert(Row row) {
// limit the materialized table
if (materializedTable.size() - validRowPosition >= maxRowCount) {
cleanUp();
}
materializedTable.add(row);
rowPositionCache.put(row, materializedTable.size() - 1);
} | [
"private",
"void",
"processInsert",
"(",
"Row",
"row",
")",
"{",
"// limit the materialized table",
"if",
"(",
"materializedTable",
".",
"size",
"(",
")",
"-",
"validRowPosition",
">=",
"maxRowCount",
")",
"{",
"cleanUp",
"(",
")",
";",
"}",
"materializedTable",... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/result/MaterializedCollectStreamResult.java#L204-L211 | train | Insert a new row into the materialized table. | [
30522,
2797,
11675,
2832,
7076,
8743,
1006,
5216,
5216,
1007,
1063,
1013,
1013,
5787,
1996,
27075,
2795,
2065,
1006,
27075,
10880,
1012,
2946,
1006,
1007,
1011,
9398,
10524,
26994,
1028,
1027,
4098,
10524,
3597,
16671,
1007,
1063,
27686,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/QueryStringDecoder.java | QueryStringDecoder.parameters | public Map<String, List<String>> parameters() {
if (params == null) {
params = decodeParams(uri, pathEndIdx(), charset, maxParams);
}
return params;
} | java | public Map<String, List<String>> parameters() {
if (params == null) {
params = decodeParams(uri, pathEndIdx(), charset, maxParams);
}
return params;
} | [
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"parameters",
"(",
")",
"{",
"if",
"(",
"params",
"==",
"null",
")",
"{",
"params",
"=",
"decodeParams",
"(",
"uri",
",",
"pathEndIdx",
"(",
")",
",",
"charset",
",",
"maxParams",
... | Returns the decoded key-value parameter pairs of the URI. | [
"Returns",
"the",
"decoded",
"key",
"-",
"value",
"parameter",
"pairs",
"of",
"the",
"URI",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/QueryStringDecoder.java#L178-L183 | train | Get the parameters for this request. | [
30522,
2270,
4949,
1026,
5164,
1010,
2862,
1026,
5164,
1028,
1028,
11709,
1006,
1007,
1063,
2065,
1006,
11498,
5244,
1027,
1027,
19701,
1007,
1063,
11498,
5244,
1027,
21933,
3207,
28689,
5244,
1006,
24471,
2072,
1010,
4130,
10497,
3593,
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... |
networknt/light-4j | config/src/main/java/com/networknt/config/CentralizedManagement.java | CentralizedManagement.mergeObject | public static Object mergeObject(Object config, Class clazz) {
merge(config);
return convertMapToObj((Map<String, Object>) config, clazz);
} | java | public static Object mergeObject(Object config, Class clazz) {
merge(config);
return convertMapToObj((Map<String, Object>) config, clazz);
} | [
"public",
"static",
"Object",
"mergeObject",
"(",
"Object",
"config",
",",
"Class",
"clazz",
")",
"{",
"merge",
"(",
"config",
")",
";",
"return",
"convertMapToObj",
"(",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"config",
",",
"clazz",
")",
... | Merge map config with values generated by ConfigInjection.class and return mapping object | [
"Merge",
"map",
"config",
"with",
"values",
"generated",
"by",
"ConfigInjection",
".",
"class",
"and",
"return",
"mapping",
"object"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/config/src/main/java/com/networknt/config/CentralizedManagement.java#L42-L45 | train | Merge object. | [
30522,
2270,
10763,
4874,
13590,
16429,
20614,
1006,
4874,
9530,
8873,
2290,
1010,
2465,
18856,
10936,
2480,
1007,
1063,
13590,
1006,
9530,
8873,
2290,
1007,
1025,
2709,
10463,
2863,
13876,
9541,
2497,
3501,
1006,
1006,
4949,
1026,
5164,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java | HpackEncoder.getIndex | private int getIndex(CharSequence name) {
if (length() == 0 || name == null) {
return -1;
}
int h = AsciiString.hashCode(name);
int i = index(h);
for (HeaderEntry e = headerFields[i]; e != null; e = e.next) {
if (e.hash == h && equalsConstantTime(name, e.name) != 0) {
return getIndex(e.index);
}
}
return -1;
} | java | private int getIndex(CharSequence name) {
if (length() == 0 || name == null) {
return -1;
}
int h = AsciiString.hashCode(name);
int i = index(h);
for (HeaderEntry e = headerFields[i]; e != null; e = e.next) {
if (e.hash == h && equalsConstantTime(name, e.name) != 0) {
return getIndex(e.index);
}
}
return -1;
} | [
"private",
"int",
"getIndex",
"(",
"CharSequence",
"name",
")",
"{",
"if",
"(",
"length",
"(",
")",
"==",
"0",
"||",
"name",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"int",
"h",
"=",
"AsciiString",
".",
"hashCode",
"(",
"name",
")",
... | Returns the lowest index value for the header field name in the dynamic table. Returns -1 if
the header field name is not in the dynamic table. | [
"Returns",
"the",
"lowest",
"index",
"value",
"for",
"the",
"header",
"field",
"name",
"in",
"the",
"dynamic",
"table",
".",
"Returns",
"-",
"1",
"if",
"the",
"header",
"field",
"name",
"is",
"not",
"in",
"the",
"dynamic",
"table",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L369-L381 | train | Gets the index of the name in the header. | [
30522,
2797,
20014,
2131,
22254,
10288,
1006,
25869,
3366,
4226,
5897,
2171,
1007,
1063,
2065,
1006,
3091,
1006,
1007,
1027,
1027,
1014,
1064,
1064,
2171,
1027,
1027,
19701,
1007,
1063,
2709,
1011,
1015,
1025,
1065,
20014,
1044,
1027,
2004,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java | SimpleConfigurationMetadataRepository.add | public void add(Collection<ConfigurationMetadataSource> sources) {
for (ConfigurationMetadataSource source : sources) {
String groupId = source.getGroupId();
ConfigurationMetadataGroup group = this.allGroups.get(groupId);
if (group == null) {
group = new ConfigurationMetadataGroup(groupId);
this.allGroups.put(groupId, group);
}
String sourceType = source.getType();
if (sourceType != null) {
putIfAbsent(group.getSources(), sourceType, source);
}
}
} | java | public void add(Collection<ConfigurationMetadataSource> sources) {
for (ConfigurationMetadataSource source : sources) {
String groupId = source.getGroupId();
ConfigurationMetadataGroup group = this.allGroups.get(groupId);
if (group == null) {
group = new ConfigurationMetadataGroup(groupId);
this.allGroups.put(groupId, group);
}
String sourceType = source.getType();
if (sourceType != null) {
putIfAbsent(group.getSources(), sourceType, source);
}
}
} | [
"public",
"void",
"add",
"(",
"Collection",
"<",
"ConfigurationMetadataSource",
">",
"sources",
")",
"{",
"for",
"(",
"ConfigurationMetadataSource",
"source",
":",
"sources",
")",
"{",
"String",
"groupId",
"=",
"source",
".",
"getGroupId",
"(",
")",
";",
"Conf... | Register the specified {@link ConfigurationMetadataSource sources}.
@param sources the sources to add | [
"Register",
"the",
"specified",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/SimpleConfigurationMetadataRepository.java#L55-L68 | train | Adds the collection of configuration metadata sources to this configuration metadata. | [
30522,
2270,
11675,
5587,
1006,
3074,
1026,
9563,
11368,
8447,
10230,
8162,
3401,
1028,
4216,
1007,
1063,
2005,
1006,
9563,
11368,
8447,
10230,
8162,
3401,
3120,
1024,
4216,
1007,
1063,
5164,
2177,
3593,
1027,
3120,
1012,
2131,
17058,
3593,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/NFAStateSerializer.java | NFAStateSerializer.readObject | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
// the nested serializer will be null if this was read from a savepoint taken with versions
// lower than Flink 1.7; in this case, we explicitly create instance for the nested serializer.
if (versionSerializer == null || nodeIdSerializer == null || eventIdSerializer == null) {
this.versionSerializer = DeweyNumber.DeweyNumberSerializer.INSTANCE;
this.eventIdSerializer = EventId.EventIdSerializer.INSTANCE;
this.nodeIdSerializer = new NodeId.NodeIdSerializer();
}
} | java | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
// the nested serializer will be null if this was read from a savepoint taken with versions
// lower than Flink 1.7; in this case, we explicitly create instance for the nested serializer.
if (versionSerializer == null || nodeIdSerializer == null || eventIdSerializer == null) {
this.versionSerializer = DeweyNumber.DeweyNumberSerializer.INSTANCE;
this.eventIdSerializer = EventId.EventIdSerializer.INSTANCE;
this.nodeIdSerializer = new NodeId.NodeIdSerializer();
}
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"in",
".",
"defaultReadObject",
"(",
")",
";",
"// the nested serializer will be null if this was read from a savepoint taken with versions",
"// l... | /*
Backwards compatible deserializing of NFAStateSerializer. | [
"/",
"*",
"Backwards",
"compatible",
"deserializing",
"of",
"NFAStateSerializer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/NFAStateSerializer.java#L255-L265 | train | This method is called to read the object from an ObjectInputStream. | [
30522,
2797,
11675,
3191,
16429,
20614,
1006,
4874,
2378,
18780,
21422,
1999,
1007,
11618,
22834,
10288,
24422,
1010,
2465,
17048,
14876,
8630,
10288,
24422,
1063,
1999,
1012,
12398,
16416,
3527,
2497,
20614,
1006,
1007,
1025,
1013,
1013,
199... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.isIE | public static boolean isIE(HttpServletRequest request) {
String userAgent = getHeaderIgnoreCase(request, "User-Agent");
if (StrUtil.isNotBlank(userAgent)) {
userAgent = userAgent.toUpperCase();
if (userAgent.contains("MSIE") || userAgent.contains("TRIDENT")) {
return true;
}
}
return false;
} | java | public static boolean isIE(HttpServletRequest request) {
String userAgent = getHeaderIgnoreCase(request, "User-Agent");
if (StrUtil.isNotBlank(userAgent)) {
userAgent = userAgent.toUpperCase();
if (userAgent.contains("MSIE") || userAgent.contains("TRIDENT")) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isIE",
"(",
"HttpServletRequest",
"request",
")",
"{",
"String",
"userAgent",
"=",
"getHeaderIgnoreCase",
"(",
"request",
",",
"\"User-Agent\"",
")",
";",
"if",
"(",
"StrUtil",
".",
"isNotBlank",
"(",
"userAgent",
")",
")",
"{",... | 客户浏览器是否为IE
@param request 请求对象{@link HttpServletRequest}
@return 客户浏览器是否为IE | [
"客户浏览器是否为IE"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L316-L325 | train | Checks if the user agent is IE or not. | [
30522,
2270,
10763,
22017,
20898,
2003,
2666,
1006,
16770,
2121,
2615,
7485,
2890,
15500,
5227,
1007,
1063,
5164,
5310,
4270,
3372,
1027,
2131,
4974,
11124,
26745,
2890,
18382,
1006,
5227,
1010,
1000,
5310,
1011,
4005,
1000,
1007,
1025,
206... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.get | public String get(String name) {
String[] names = handleDeprecation(deprecationContext.get(), name);
String result = null;
for(String n : names) {
result = substituteVars(getProps().getProperty(n));
}
return result;
} | java | public String get(String name) {
String[] names = handleDeprecation(deprecationContext.get(), name);
String result = null;
for(String n : names) {
result = substituteVars(getProps().getProperty(n));
}
return result;
} | [
"public",
"String",
"get",
"(",
"String",
"name",
")",
"{",
"String",
"[",
"]",
"names",
"=",
"handleDeprecation",
"(",
"deprecationContext",
".",
"get",
"(",
")",
",",
"name",
")",
";",
"String",
"result",
"=",
"null",
";",
"for",
"(",
"String",
"n",
... | Get the value of the <code>name</code> property, <code>null</code> if
no such property exists. If the key is deprecated, it returns the value of
the first key which replaces the deprecated key and is not null.
Values are processed for <a href="#VariableExpansion">variable expansion</a>
before being returned.
@param name the property name, will be trimmed before get value.
@return the value of the <code>name</code> or its replacing property,
or null if no such property exists. | [
"Get",
"the",
"value",
"of",
"the",
"<code",
">",
"name<",
"/",
"code",
">",
"property",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"no",
"such",
"property",
"exists",
".",
"If",
"the",
"key",
"is",
"deprecated",
"it",
"returns",
"the",
"value",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1071-L1078 | train | Returns the value of the property with the given name. | [
30522,
2270,
5164,
2131,
1006,
5164,
2171,
1007,
1063,
5164,
1031,
1033,
3415,
1027,
8971,
13699,
2890,
10719,
1006,
2139,
28139,
10719,
8663,
18209,
1012,
2131,
1006,
1007,
1010,
2171,
1007,
1025,
5164,
2765,
1027,
19701,
1025,
2005,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-formats/flink-csv/src/main/java/org/apache/flink/table/descriptors/Csv.java | Csv.lineDelimiter | public Csv lineDelimiter(String delimiter) {
Preconditions.checkNotNull(delimiter);
internalProperties.putString(FORMAT_LINE_DELIMITER, delimiter);
return this;
} | java | public Csv lineDelimiter(String delimiter) {
Preconditions.checkNotNull(delimiter);
internalProperties.putString(FORMAT_LINE_DELIMITER, delimiter);
return this;
} | [
"public",
"Csv",
"lineDelimiter",
"(",
"String",
"delimiter",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"delimiter",
")",
";",
"internalProperties",
".",
"putString",
"(",
"FORMAT_LINE_DELIMITER",
",",
"delimiter",
")",
";",
"return",
"this",
";",
"}"... | Sets the line delimiter ("\n" by default; otherwise "\r" or "\r\n" are allowed).
@param delimiter the line delimiter | [
"Sets",
"the",
"line",
"delimiter",
"(",
"\\",
"n",
"by",
"default",
";",
"otherwise",
"\\",
"r",
"or",
"\\",
"r",
"\\",
"n",
"are",
"allowed",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-csv/src/main/java/org/apache/flink/table/descriptors/Csv.java#L82-L86 | train | Sets the line delimiter. | [
30522,
2270,
20116,
2615,
7732,
20806,
23419,
2099,
1006,
5164,
3972,
27605,
3334,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
3972,
27605,
3334,
1007,
1025,
4722,
21572,
4842,
7368,
1012,
8509,
18886,
3070,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java | AbstractBootstrap.handler | public B handler(ChannelHandler handler) {
if (handler == null) {
throw new NullPointerException("handler");
}
this.handler = handler;
return self();
} | java | public B handler(ChannelHandler handler) {
if (handler == null) {
throw new NullPointerException("handler");
}
this.handler = handler;
return self();
} | [
"public",
"B",
"handler",
"(",
"ChannelHandler",
"handler",
")",
"{",
"if",
"(",
"handler",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"handler\"",
")",
";",
"}",
"this",
".",
"handler",
"=",
"handler",
";",
"return",
"self",
... | the {@link ChannelHandler} to use for serving the requests. | [
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java#L377-L383 | train | Sets the channel handler. | [
30522,
2270,
1038,
28213,
1006,
3149,
11774,
3917,
28213,
1007,
1063,
2065,
1006,
28213,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
28213,
1000,
1007,
1025,
1065,
2023,
1012,
28213,
1027,
28213,
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/executiongraph/Execution.java | Execution.sendUpdatePartitionInfoRpcCall | private void sendUpdatePartitionInfoRpcCall(
final Iterable<PartitionInfo> partitionInfos) {
final LogicalSlot slot = assignedResource;
if (slot != null) {
final TaskManagerGateway taskManagerGateway = slot.getTaskManagerGateway();
final TaskManagerLocation taskManagerLocation = slot.getTaskManagerLocation();
CompletableFuture<Acknowledge> updatePartitionsResultFuture = taskManagerGateway.updatePartitions(attemptId, partitionInfos, rpcTimeout);
updatePartitionsResultFuture.whenCompleteAsync(
(ack, failure) -> {
// fail if there was a failure
if (failure != null) {
fail(new IllegalStateException("Update task on TaskManager " + taskManagerLocation +
" failed due to:", failure));
}
}, getVertex().getExecutionGraph().getJobMasterMainThreadExecutor());
}
} | java | private void sendUpdatePartitionInfoRpcCall(
final Iterable<PartitionInfo> partitionInfos) {
final LogicalSlot slot = assignedResource;
if (slot != null) {
final TaskManagerGateway taskManagerGateway = slot.getTaskManagerGateway();
final TaskManagerLocation taskManagerLocation = slot.getTaskManagerLocation();
CompletableFuture<Acknowledge> updatePartitionsResultFuture = taskManagerGateway.updatePartitions(attemptId, partitionInfos, rpcTimeout);
updatePartitionsResultFuture.whenCompleteAsync(
(ack, failure) -> {
// fail if there was a failure
if (failure != null) {
fail(new IllegalStateException("Update task on TaskManager " + taskManagerLocation +
" failed due to:", failure));
}
}, getVertex().getExecutionGraph().getJobMasterMainThreadExecutor());
}
} | [
"private",
"void",
"sendUpdatePartitionInfoRpcCall",
"(",
"final",
"Iterable",
"<",
"PartitionInfo",
">",
"partitionInfos",
")",
"{",
"final",
"LogicalSlot",
"slot",
"=",
"assignedResource",
";",
"if",
"(",
"slot",
"!=",
"null",
")",
"{",
"final",
"TaskManagerGate... | Update the partition infos on the assigned resource.
@param partitionInfos for the remote task | [
"Update",
"the",
"partition",
"infos",
"on",
"the",
"assigned",
"resource",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java#L1231-L1251 | train | Send update partition info rpc call. | [
30522,
2797,
11675,
4604,
6279,
13701,
19362,
3775,
3508,
2378,
29278,
15042,
9289,
2140,
1006,
2345,
2009,
6906,
3468,
1026,
13571,
2378,
14876,
1028,
13571,
2378,
14876,
2015,
1007,
1063,
2345,
11177,
14540,
4140,
10453,
1027,
4137,
6072,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java | DoubleArrayTrie.transition | public int transition(String path, int from)
{
int b = from;
int p;
for (int i = 0; i < path.length(); ++i)
{
p = b + (int) (path.charAt(i)) + 1;
if (b == check[p])
b = base[p];
else
return -1;
}
p = b;
return p;
} | java | public int transition(String path, int from)
{
int b = from;
int p;
for (int i = 0; i < path.length(); ++i)
{
p = b + (int) (path.charAt(i)) + 1;
if (b == check[p])
b = base[p];
else
return -1;
}
p = b;
return p;
} | [
"public",
"int",
"transition",
"(",
"String",
"path",
",",
"int",
"from",
")",
"{",
"int",
"b",
"=",
"from",
";",
"int",
"p",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"path",
".",
"length",
"(",
")",
";",
"++",
"i",
")",
"{",
"... | 沿着路径转移状态
@param path 路径
@param from 起点(根起点为base[0]=1)
@return 转移后的状态(双数组下标) | [
"沿着路径转移状态"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L1069-L1085 | train | transition to a specific from | [
30522,
30524,
3091,
1006,
1007,
1025,
1009,
1009,
1045,
1007,
1063,
1052,
1027,
1038,
1009,
1006,
20014,
1007,
1006,
4130,
1012,
25869,
4017,
1006,
1045,
1007,
1007,
1009,
1015,
1025,
2065,
1006,
1038,
1027,
1027,
4638,
1031,
1052,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.newHashSet | public static <T> HashSet<T> newHashSet(boolean isSorted, Iterator<T> iter) {
if (null == iter) {
return newHashSet(isSorted, (T[]) null);
}
final HashSet<T> set = isSorted ? new LinkedHashSet<T>() : new HashSet<T>();
while (iter.hasNext()) {
set.add(iter.next());
}
return set;
} | java | public static <T> HashSet<T> newHashSet(boolean isSorted, Iterator<T> iter) {
if (null == iter) {
return newHashSet(isSorted, (T[]) null);
}
final HashSet<T> set = isSorted ? new LinkedHashSet<T>() : new HashSet<T>();
while (iter.hasNext()) {
set.add(iter.next());
}
return set;
} | [
"public",
"static",
"<",
"T",
">",
"HashSet",
"<",
"T",
">",
"newHashSet",
"(",
"boolean",
"isSorted",
",",
"Iterator",
"<",
"T",
">",
"iter",
")",
"{",
"if",
"(",
"null",
"==",
"iter",
")",
"{",
"return",
"newHashSet",
"(",
"isSorted",
",",
"(",
"... | 新建一个HashSet
@param <T> 集合元素类型
@param isSorted 是否有序,有序返回 {@link LinkedHashSet},否则返回{@link HashSet}
@param iter {@link Iterator}
@return HashSet对象
@since 3.0.8 | [
"新建一个HashSet"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L472-L481 | train | Creates a new HashSet from the given iterator. | [
30522,
2270,
10763,
1026,
1056,
1028,
23325,
13462,
1026,
1056,
1028,
2047,
14949,
7898,
3388,
1006,
22017,
20898,
26354,
15613,
1010,
2009,
6906,
4263,
1026,
1056,
1028,
2009,
2121,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
2009,
2121,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/StatementUtil.java | StatementUtil.prepareStatementForBatch | public static PreparedStatement prepareStatementForBatch(Connection conn, String sql, Iterable<Object[]> paramsBatch) throws SQLException {
Assert.notBlank(sql, "Sql String must be not blank!");
sql = sql.trim();
SqlLog.INSTASNCE.log(sql, paramsBatch);
PreparedStatement ps = conn.prepareStatement(sql);
for (Object[] params : paramsBatch) {
StatementUtil.fillParams(ps, params);
ps.addBatch();
}
return ps;
} | java | public static PreparedStatement prepareStatementForBatch(Connection conn, String sql, Iterable<Object[]> paramsBatch) throws SQLException {
Assert.notBlank(sql, "Sql String must be not blank!");
sql = sql.trim();
SqlLog.INSTASNCE.log(sql, paramsBatch);
PreparedStatement ps = conn.prepareStatement(sql);
for (Object[] params : paramsBatch) {
StatementUtil.fillParams(ps, params);
ps.addBatch();
}
return ps;
} | [
"public",
"static",
"PreparedStatement",
"prepareStatementForBatch",
"(",
"Connection",
"conn",
",",
"String",
"sql",
",",
"Iterable",
"<",
"Object",
"[",
"]",
">",
"paramsBatch",
")",
"throws",
"SQLException",
"{",
"Assert",
".",
"notBlank",
"(",
"sql",
",",
... | 创建批量操作的{@link PreparedStatement}
@param conn 数据库连接
@param sql SQL语句,使用"?"做为占位符
@param paramsBatch "?"对应参数批次列表
@return {@link PreparedStatement}
@throws SQLException SQL异常
@since 4.1.13 | [
"创建批量操作的",
"{",
"@link",
"PreparedStatement",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/StatementUtil.java#L177-L188 | train | Creates a PreparedStatement for a batch of objects. | [
30522,
2270,
10763,
4810,
9153,
18532,
4765,
20776,
12259,
3672,
29278,
14479,
2818,
1006,
4434,
9530,
2078,
1010,
5164,
29296,
1010,
2009,
6906,
3468,
1026,
4874,
1031,
1033,
1028,
11498,
5244,
14479,
2818,
1007,
11618,
29296,
10288,
24422,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java | Types.LIST | public static <E> TypeInformation<List<E>> LIST(TypeInformation<E> elementType) {
return new ListTypeInfo<>(elementType);
} | java | public static <E> TypeInformation<List<E>> LIST(TypeInformation<E> elementType) {
return new ListTypeInfo<>(elementType);
} | [
"public",
"static",
"<",
"E",
">",
"TypeInformation",
"<",
"List",
"<",
"E",
">",
">",
"LIST",
"(",
"TypeInformation",
"<",
"E",
">",
"elementType",
")",
"{",
"return",
"new",
"ListTypeInfo",
"<>",
"(",
"elementType",
")",
";",
"}"
] | Returns type information for a Java {@link java.util.List}. A list must not be null. Null values
in elements are not supported.
<p>By default, lists are untyped and treated as a generic type in Flink; therefore, it is useful
to pass type information whenever a list is used.
<p><strong>Note:</strong> Flink does not preserve the concrete {@link List} type. It converts a list into {@link ArrayList} when
copying or deserializing.
@param elementType type information for the list's elements | [
"Returns",
"type",
"information",
"for",
"a",
"Java",
"{",
"@link",
"java",
".",
"util",
".",
"List",
"}",
".",
"A",
"list",
"must",
"not",
"be",
"null",
".",
"Null",
"values",
"in",
"elements",
"are",
"not",
"supported",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java#L431-L433 | train | Returns a type information for a list type. | [
30522,
2270,
10763,
1026,
1041,
1028,
2828,
2378,
14192,
3370,
1026,
2862,
1026,
1041,
1028,
1028,
2862,
1006,
2828,
2378,
14192,
3370,
1026,
1041,
1028,
5783,
13874,
1007,
1063,
2709,
2047,
2862,
13874,
2378,
14876,
1026,
1028,
1006,
5783,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/server/src/org/openqa/selenium/remote/server/log/PerSessionLogHandler.java | PerSessionLogHandler.configureLogging | public void configureLogging(LoggingPreferences prefs) {
if (prefs == null) {
return;
}
if (prefs.getEnabledLogTypes().contains(LogType.SERVER)) {
serverLogLevel = prefs.getLevel(LogType.SERVER);
}
} | java | public void configureLogging(LoggingPreferences prefs) {
if (prefs == null) {
return;
}
if (prefs.getEnabledLogTypes().contains(LogType.SERVER)) {
serverLogLevel = prefs.getLevel(LogType.SERVER);
}
} | [
"public",
"void",
"configureLogging",
"(",
"LoggingPreferences",
"prefs",
")",
"{",
"if",
"(",
"prefs",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"prefs",
".",
"getEnabledLogTypes",
"(",
")",
".",
"contains",
"(",
"LogType",
".",
"SERVER",
"... | TODO(simons): Of course, this effects all loggers, not just the one for the session. | [
"TODO",
"(",
"simons",
")",
":",
"Of",
"course",
"this",
"effects",
"all",
"loggers",
"not",
"just",
"the",
"one",
"for",
"the",
"session",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/selenium/remote/server/log/PerSessionLogHandler.java#L257-L264 | train | Configure logging. | [
30522,
2270,
11675,
9530,
8873,
27390,
18349,
12588,
1006,
15899,
28139,
25523,
2015,
3653,
10343,
1007,
1063,
2065,
1006,
3653,
10343,
1027,
1027,
19701,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
3653,
10343,
1012,
2131,
8189,
23242,
21197,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getBigWriter | public static BigExcelWriter getBigWriter(File destFile) {
try {
return new BigExcelWriter(destFile);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | java | public static BigExcelWriter getBigWriter(File destFile) {
try {
return new BigExcelWriter(destFile);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | [
"public",
"static",
"BigExcelWriter",
"getBigWriter",
"(",
"File",
"destFile",
")",
"{",
"try",
"{",
"return",
"new",
"BigExcelWriter",
"(",
"destFile",
")",
";",
"}",
"catch",
"(",
"NoClassDefFoundError",
"e",
")",
"{",
"throw",
"new",
"DependencyException",
... | 获得{@link BigExcelWriter},默认写出到第一个sheet,名字为sheet1
@param destFile 目标文件
@return {@link BigExcelWriter} | [
"获得",
"{",
"@link",
"BigExcelWriter",
"}",
",默认写出到第一个sheet,名字为sheet1"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L492-L498 | train | Returns a new BigExcelWriter object. | [
30522,
2270,
10763,
2502,
10288,
29109,
15994,
2131,
5638,
2290,
15994,
1006,
5371,
4078,
24475,
9463,
1007,
1063,
3046,
1063,
2709,
2047,
2502,
10288,
29109,
15994,
1006,
4078,
24475,
9463,
1007,
1025,
1065,
4608,
1006,
2053,
26266,
3207,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | sink/src/main/java/com/alibaba/otter/canal/sink/entry/group/TimelineBarrier.java | TimelineBarrier.single | private void single(long timestamp) throws InterruptedException {
lastTimestamps.add(timestamp);
if (timestamp < state()) {
// 针对mysql事务中会出现时间跳跃
// 例子:
// 2012-08-08 16:24:26 事务头
// 2012-08-08 16:24:24 变更记录
// 2012-08-08 16:24:25 变更记录
// 2012-08-08 16:24:26 事务尾
// 针对这种case,一旦发现timestamp有回退的情况,直接更新threshold,强制阻塞其他的操作,等待最小数据优先处理完成
threshold = timestamp; // 更新为最小值
}
if (lastTimestamps.size() >= groupSize) {// 判断队列是否需要触发
// 触发下一个出队列的数据
Long minTimestamp = this.lastTimestamps.peek();
if (minTimestamp != null) {
threshold = minTimestamp;
notify(minTimestamp);
}
} else {
threshold = Long.MIN_VALUE;// 如果不满足队列长度,需要阻塞等待
}
} | java | private void single(long timestamp) throws InterruptedException {
lastTimestamps.add(timestamp);
if (timestamp < state()) {
// 针对mysql事务中会出现时间跳跃
// 例子:
// 2012-08-08 16:24:26 事务头
// 2012-08-08 16:24:24 变更记录
// 2012-08-08 16:24:25 变更记录
// 2012-08-08 16:24:26 事务尾
// 针对这种case,一旦发现timestamp有回退的情况,直接更新threshold,强制阻塞其他的操作,等待最小数据优先处理完成
threshold = timestamp; // 更新为最小值
}
if (lastTimestamps.size() >= groupSize) {// 判断队列是否需要触发
// 触发下一个出队列的数据
Long minTimestamp = this.lastTimestamps.peek();
if (minTimestamp != null) {
threshold = minTimestamp;
notify(minTimestamp);
}
} else {
threshold = Long.MIN_VALUE;// 如果不满足队列长度,需要阻塞等待
}
} | [
"private",
"void",
"single",
"(",
"long",
"timestamp",
")",
"throws",
"InterruptedException",
"{",
"lastTimestamps",
".",
"add",
"(",
"timestamp",
")",
";",
"if",
"(",
"timestamp",
"<",
"state",
"(",
")",
")",
"{",
"// 针对mysql事务中会出现时间跳跃",
"// 例子:",
"// 2012-08... | 通知下一个minTimestamp数据出队列
@throws InterruptedException | [
"通知下一个minTimestamp数据出队列"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/sink/src/main/java/com/alibaba/otter/canal/sink/entry/group/TimelineBarrier.java#L114-L139 | train | single timestamp. | [
30522,
2797,
11675,
2309,
1006,
2146,
2335,
15464,
2361,
1007,
11618,
7153,
10288,
24422,
1063,
2197,
7292,
9153,
25370,
1012,
5587,
1006,
2335,
15464,
2361,
1007,
1025,
2065,
1006,
2335,
15464,
2361,
1026,
2110,
1006,
1007,
1007,
1063,
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... |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.concat | public AsciiString concat(CharSequence string) {
int thisLen = length();
int thatLen = string.length();
if (thatLen == 0) {
return this;
}
if (string.getClass() == AsciiString.class) {
AsciiString that = (AsciiString) string;
if (isEmpty()) {
return that;
}
byte[] newValue = PlatformDependent.allocateUninitializedArray(thisLen + thatLen);
System.arraycopy(value, arrayOffset(), newValue, 0, thisLen);
System.arraycopy(that.value, that.arrayOffset(), newValue, thisLen, thatLen);
return new AsciiString(newValue, false);
}
if (isEmpty()) {
return new AsciiString(string);
}
byte[] newValue = PlatformDependent.allocateUninitializedArray(thisLen + thatLen);
System.arraycopy(value, arrayOffset(), newValue, 0, thisLen);
for (int i = thisLen, j = 0; i < newValue.length; i++, j++) {
newValue[i] = c2b(string.charAt(j));
}
return new AsciiString(newValue, false);
} | java | public AsciiString concat(CharSequence string) {
int thisLen = length();
int thatLen = string.length();
if (thatLen == 0) {
return this;
}
if (string.getClass() == AsciiString.class) {
AsciiString that = (AsciiString) string;
if (isEmpty()) {
return that;
}
byte[] newValue = PlatformDependent.allocateUninitializedArray(thisLen + thatLen);
System.arraycopy(value, arrayOffset(), newValue, 0, thisLen);
System.arraycopy(that.value, that.arrayOffset(), newValue, thisLen, thatLen);
return new AsciiString(newValue, false);
}
if (isEmpty()) {
return new AsciiString(string);
}
byte[] newValue = PlatformDependent.allocateUninitializedArray(thisLen + thatLen);
System.arraycopy(value, arrayOffset(), newValue, 0, thisLen);
for (int i = thisLen, j = 0; i < newValue.length; i++, j++) {
newValue[i] = c2b(string.charAt(j));
}
return new AsciiString(newValue, false);
} | [
"public",
"AsciiString",
"concat",
"(",
"CharSequence",
"string",
")",
"{",
"int",
"thisLen",
"=",
"length",
"(",
")",
";",
"int",
"thatLen",
"=",
"string",
".",
"length",
"(",
")",
";",
"if",
"(",
"thatLen",
"==",
"0",
")",
"{",
"return",
"this",
";... | Concatenates this string and the specified string.
@param string the string to concatenate
@return a new string which is the concatenation of this string and the specified string. | [
"Concatenates",
"this",
"string",
"and",
"the",
"specified",
"string",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L473-L503 | train | concat this string with another string. | [
30522,
2270,
2004,
6895,
2923,
4892,
9530,
11266,
1006,
25869,
3366,
4226,
5897,
5164,
1007,
1063,
20014,
2023,
7770,
1027,
3091,
1006,
1007,
1025,
20014,
2008,
7770,
1027,
5164,
1012,
3091,
1006,
1007,
1025,
2065,
1006,
2008,
7770,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java | JSONTokener.nextValue | public Object nextValue() throws JSONException {
int c = nextCleanInternal();
switch (c) {
case -1:
throw syntaxError("End of input");
case '{':
return readObject();
case '[':
return readArray();
case '\'':
case '"':
return nextString((char) c);
default:
this.pos--;
return readLiteral();
}
} | java | public Object nextValue() throws JSONException {
int c = nextCleanInternal();
switch (c) {
case -1:
throw syntaxError("End of input");
case '{':
return readObject();
case '[':
return readArray();
case '\'':
case '"':
return nextString((char) c);
default:
this.pos--;
return readLiteral();
}
} | [
"public",
"Object",
"nextValue",
"(",
")",
"throws",
"JSONException",
"{",
"int",
"c",
"=",
"nextCleanInternal",
"(",
")",
";",
"switch",
"(",
"c",
")",
"{",
"case",
"-",
"1",
":",
"throw",
"syntaxError",
"(",
"\"End of input\"",
")",
";",
"case",
"'",
... | Returns the next value from the input.
@return a {@link JSONObject}, {@link JSONArray}, String, Boolean, Integer, Long,
Double or {@link JSONObject#NULL}.
@throws JSONException if the input is malformed. | [
"Returns",
"the",
"next",
"value",
"from",
"the",
"input",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java#L91-L111 | train | Returns the next value. | [
30522,
2270,
4874,
2279,
10175,
5657,
1006,
1007,
11618,
1046,
3385,
10288,
30524,
1005,
1063,
1005,
1024,
2709,
3191,
16429,
20614,
1006,
1007,
1025,
2553,
1005,
1031,
1005,
1024,
2709,
3191,
2906,
9447,
1006,
1007,
1025,
2553,
1005,
1032,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/NumberUtil.java | NumberUtil.toUnsignedByteArray | public static byte[] toUnsignedByteArray(int length, BigInteger value) {
byte[] bytes = value.toByteArray();
if (bytes.length == length) {
return bytes;
}
int start = bytes[0] == 0 ? 1 : 0;
int count = bytes.length - start;
if (count > length) {
throw new IllegalArgumentException("standard length exceeded for value");
}
byte[] tmp = new byte[length];
System.arraycopy(bytes, start, tmp, tmp.length - count, count);
return tmp;
} | java | public static byte[] toUnsignedByteArray(int length, BigInteger value) {
byte[] bytes = value.toByteArray();
if (bytes.length == length) {
return bytes;
}
int start = bytes[0] == 0 ? 1 : 0;
int count = bytes.length - start;
if (count > length) {
throw new IllegalArgumentException("standard length exceeded for value");
}
byte[] tmp = new byte[length];
System.arraycopy(bytes, start, tmp, tmp.length - count, count);
return tmp;
} | [
"public",
"static",
"byte",
"[",
"]",
"toUnsignedByteArray",
"(",
"int",
"length",
",",
"BigInteger",
"value",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"value",
".",
"toByteArray",
"(",
")",
";",
"if",
"(",
"bytes",
".",
"length",
"==",
"length",
")",... | 以无符号字节数组的形式返回传入值。
@param length bytes长度
@param value 需要转换的值
@return 无符号bytes
@since 4.5.0 | [
"以无符号字节数组的形式返回传入值。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L2256-L2272 | train | Converts a BigInteger to a byte array of the specified length. | [
30522,
2270,
10763,
24880,
1031,
1033,
2000,
4609,
5332,
19225,
3762,
27058,
11335,
2100,
1006,
20014,
3091,
1010,
2502,
18447,
26320,
3643,
1007,
1063,
24880,
1031,
1033,
27507,
1027,
3643,
1012,
11291,
27058,
11335,
2100,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.transElements | public static List<Element> transElements(Element parentEle, NodeList nodeList) {
int length = nodeList.getLength();
final ArrayList<Element> elements = new ArrayList<Element>(length);
Node node;
Element element;
for (int i = 0; i < length; i++) {
node = nodeList.item(i);
if (Node.ELEMENT_NODE == node.getNodeType()) {
element = (Element) nodeList.item(i);
if (parentEle == null || element.getParentNode() == parentEle) {
elements.add(element);
}
}
}
return elements;
} | java | public static List<Element> transElements(Element parentEle, NodeList nodeList) {
int length = nodeList.getLength();
final ArrayList<Element> elements = new ArrayList<Element>(length);
Node node;
Element element;
for (int i = 0; i < length; i++) {
node = nodeList.item(i);
if (Node.ELEMENT_NODE == node.getNodeType()) {
element = (Element) nodeList.item(i);
if (parentEle == null || element.getParentNode() == parentEle) {
elements.add(element);
}
}
}
return elements;
} | [
"public",
"static",
"List",
"<",
"Element",
">",
"transElements",
"(",
"Element",
"parentEle",
",",
"NodeList",
"nodeList",
")",
"{",
"int",
"length",
"=",
"nodeList",
".",
"getLength",
"(",
")",
";",
"final",
"ArrayList",
"<",
"Element",
">",
"elements",
... | 将NodeList转换为Element列表<br>
非Element节点将被忽略
@param parentEle 父节点,如果指定将返回此节点的所有直接子节点,nul返回所有就节点
@param nodeList NodeList
@return Element列表 | [
"将NodeList转换为Element列表<br",
">",
"非Element节点将被忽略"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L515-L531 | train | Trans elements. | [
30522,
2270,
10763,
2862,
1026,
5783,
1028,
9099,
12260,
8163,
1006,
5783,
6687,
12260,
1010,
13045,
9863,
13045,
9863,
1007,
1063,
20014,
3091,
1027,
13045,
9863,
1012,
2131,
7770,
13512,
2232,
1006,
1007,
1025,
2345,
9140,
9863,
1026,
578... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java | Http2ConnectionHandler.closeStreamLocal | @Override
public void closeStreamLocal(Http2Stream stream, ChannelFuture future) {
switch (stream.state()) {
case HALF_CLOSED_LOCAL:
case OPEN:
stream.closeLocalSide();
break;
default:
closeStream(stream, future);
break;
}
} | java | @Override
public void closeStreamLocal(Http2Stream stream, ChannelFuture future) {
switch (stream.state()) {
case HALF_CLOSED_LOCAL:
case OPEN:
stream.closeLocalSide();
break;
default:
closeStream(stream, future);
break;
}
} | [
"@",
"Override",
"public",
"void",
"closeStreamLocal",
"(",
"Http2Stream",
"stream",
",",
"ChannelFuture",
"future",
")",
"{",
"switch",
"(",
"stream",
".",
"state",
"(",
")",
")",
"{",
"case",
"HALF_CLOSED_LOCAL",
":",
"case",
"OPEN",
":",
"stream",
".",
... | Closes the local side of the given stream. If this causes the stream to be closed, adds a
hook to close the channel after the given future completes.
@param stream the stream to be half closed.
@param future If closing, the future after which to close the channel. | [
"Closes",
"the",
"local",
"side",
"of",
"the",
"given",
"stream",
".",
"If",
"this",
"causes",
"the",
"stream",
"to",
"be",
"closed",
"adds",
"a",
"hook",
"to",
"close",
"the",
"channel",
"after",
"the",
"given",
"future",
"completes",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L570-L581 | train | Close the local side of the stream. | [
30522,
1030,
2058,
15637,
2270,
11675,
7541,
16416,
19968,
24755,
2140,
1006,
8299,
2475,
21422,
5460,
1010,
3149,
11263,
11244,
2925,
1007,
1063,
6942,
1006,
5460,
1012,
2110,
1006,
1007,
1007,
1063,
2553,
2431,
1035,
2701,
1035,
2334,
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-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/functions/aggfunctions/LastValueWithRetractAggFunction.java | LastValueWithRetractAggFunction.getValueToOrderMapViewSerializer | private MapViewSerializer<T, List<Long>> getValueToOrderMapViewSerializer() {
return new MapViewSerializer<>(
new MapSerializer<>(
createValueSerializer(),
new ListSerializer<>(LongSerializer.INSTANCE)));
} | java | private MapViewSerializer<T, List<Long>> getValueToOrderMapViewSerializer() {
return new MapViewSerializer<>(
new MapSerializer<>(
createValueSerializer(),
new ListSerializer<>(LongSerializer.INSTANCE)));
} | [
"private",
"MapViewSerializer",
"<",
"T",
",",
"List",
"<",
"Long",
">",
">",
"getValueToOrderMapViewSerializer",
"(",
")",
"{",
"return",
"new",
"MapViewSerializer",
"<>",
"(",
"new",
"MapSerializer",
"<>",
"(",
"createValueSerializer",
"(",
")",
",",
"new",
... | MapView<T, List<Long>> | [
"MapView<T",
"List<Long",
">>"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/functions/aggfunctions/LastValueWithRetractAggFunction.java#L221-L226 | train | Get the value to order map view serializer. | [
30522,
2797,
4949,
8584,
8043,
4818,
17629,
1026,
1056,
1010,
2862,
1026,
2146,
1028,
1028,
2131,
10175,
23361,
16506,
4063,
2863,
2361,
8584,
8043,
4818,
17629,
1006,
1007,
1063,
2709,
2047,
4949,
8584,
8043,
4818,
17629,
1026,
1028,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/datrie/MutableDoubleArrayTrieInteger.java | MutableDoubleArrayTrieInteger.searchFreeBase | private int searchFreeBase(SortedSet<Integer> children)
{
int minChild = children.first();
int maxChild = children.last();
int current = 0;
while (getCheck(current) != 0) // 循环链表回到了头,说明没有符合要求的“连续”区间
{
if (current > minChild + 1)
{
int base = current - minChild;
boolean ok = true;
for (Iterator<Integer> it = children.iterator(); it.hasNext(); ) // 检查是否每个子节点的位置都空闲(“连续”区间)
{
int to = base + it.next();
if (to >= getBaseArraySize())
{
ok = false;
break;
}
if (!isEmpty(to))
{
ok = false;
break;
}
}
if (ok)
{
return base;
}
}
current = -getCheck(current); // 从链表中取出下一个空闲位置
}
int oldSize = getBaseArraySize(); // 没有足够长的“连续”空闲区间,所以在双数组尾部额外分配一块
expandArray(oldSize + maxChild);
return oldSize;
} | java | private int searchFreeBase(SortedSet<Integer> children)
{
int minChild = children.first();
int maxChild = children.last();
int current = 0;
while (getCheck(current) != 0) // 循环链表回到了头,说明没有符合要求的“连续”区间
{
if (current > minChild + 1)
{
int base = current - minChild;
boolean ok = true;
for (Iterator<Integer> it = children.iterator(); it.hasNext(); ) // 检查是否每个子节点的位置都空闲(“连续”区间)
{
int to = base + it.next();
if (to >= getBaseArraySize())
{
ok = false;
break;
}
if (!isEmpty(to))
{
ok = false;
break;
}
}
if (ok)
{
return base;
}
}
current = -getCheck(current); // 从链表中取出下一个空闲位置
}
int oldSize = getBaseArraySize(); // 没有足够长的“连续”空闲区间,所以在双数组尾部额外分配一块
expandArray(oldSize + maxChild);
return oldSize;
} | [
"private",
"int",
"searchFreeBase",
"(",
"SortedSet",
"<",
"Integer",
">",
"children",
")",
"{",
"int",
"minChild",
"=",
"children",
".",
"first",
"(",
")",
";",
"int",
"maxChild",
"=",
"children",
".",
"last",
"(",
")",
";",
"int",
"current",
"=",
"0"... | 寻找可以放下子节点集合的“连续”空闲区间
@param children 子节点集合
@return base值 | [
"寻找可以放下子节点集合的“连续”空闲区间"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/datrie/MutableDoubleArrayTrieInteger.java#L312-L347 | train | Search free base. | [
30522,
2797,
20014,
3945,
23301,
15058,
1006,
19616,
13462,
1026,
16109,
1028,
2336,
1007,
1063,
20014,
8117,
19339,
1027,
2336,
1012,
2034,
1006,
1007,
1025,
20014,
4098,
19339,
1027,
2336,
1012,
2197,
1006,
1007,
1025,
20014,
2783,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.runVertexCentricIteration | public <M> Graph<K, VV, EV> runVertexCentricIteration(
ComputeFunction<K, VV, EV, M> computeFunction,
MessageCombiner<K, M> combiner, int maximumNumberOfIterations) {
return this.runVertexCentricIteration(computeFunction, combiner, maximumNumberOfIterations, null);
} | java | public <M> Graph<K, VV, EV> runVertexCentricIteration(
ComputeFunction<K, VV, EV, M> computeFunction,
MessageCombiner<K, M> combiner, int maximumNumberOfIterations) {
return this.runVertexCentricIteration(computeFunction, combiner, maximumNumberOfIterations, null);
} | [
"public",
"<",
"M",
">",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"runVertexCentricIteration",
"(",
"ComputeFunction",
"<",
"K",
",",
"VV",
",",
"EV",
",",
"M",
">",
"computeFunction",
",",
"MessageCombiner",
"<",
"K",
",",
"M",
">",
"combiner",
... | Runs a {@link VertexCentricIteration} on the graph.
No configuration options are provided.
@param computeFunction the vertex compute function
@param combiner an optional message combiner
@param maximumNumberOfIterations maximum number of iterations to perform
@return the updated Graph after the vertex-centric iteration has converged or
after maximumNumberOfIterations. | [
"Runs",
"a",
"{",
"@link",
"VertexCentricIteration",
"}",
"on",
"the",
"graph",
".",
"No",
"configuration",
"options",
"are",
"provided",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1825-L1830 | train | Run a Centric iteration on the graph. | [
30522,
2270,
1026,
1049,
1028,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
2448,
16874,
10288,
22461,
21646,
3370,
1006,
24134,
11263,
27989,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1010,
1049,
1028,
24134,
11263,
27989,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.insertForGeneratedKeys | public List<Object> insertForGeneratedKeys(Entity record) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return runner.insertForGeneratedKeys(conn, record);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | java | public List<Object> insertForGeneratedKeys(Entity record) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return runner.insertForGeneratedKeys(conn, record);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | [
"public",
"List",
"<",
"Object",
">",
"insertForGeneratedKeys",
"(",
"Entity",
"record",
")",
"throws",
"SQLException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"try",
"{",
"conn",
"=",
"this",
".",
"getConnection",
"(",
")",
";",
"return",
"runner",
"... | 插入数据
@param record 记录
@return 主键列表
@throws SQLException SQL执行异常 | [
"插入数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L308-L318 | train | Insert a single entity into the database. | [
30522,
2270,
2862,
1026,
4874,
1028,
19274,
29278,
6914,
16848,
14839,
2015,
1006,
9178,
2501,
1007,
11618,
29296,
10288,
24422,
1063,
4434,
9530,
2078,
1027,
19701,
1025,
3046,
1063,
9530,
2078,
1027,
2023,
1012,
2131,
8663,
2638,
7542,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-yarn/src/main/java/org/apache/flink/yarn/AbstractYarnClusterDescriptor.java | AbstractYarnClusterDescriptor.retrieve | @Override
public ClusterClient<ApplicationId> retrieve(ApplicationId applicationId) throws ClusterRetrieveException {
try {
// check if required Hadoop environment variables are set. If not, warn user
if (System.getenv("HADOOP_CONF_DIR") == null &&
System.getenv("YARN_CONF_DIR") == null) {
LOG.warn("Neither the HADOOP_CONF_DIR nor the YARN_CONF_DIR environment variable is set." +
"The Flink YARN Client needs one of these to be set to properly load the Hadoop " +
"configuration for accessing YARN.");
}
final ApplicationReport appReport = yarnClient.getApplicationReport(applicationId);
if (appReport.getFinalApplicationStatus() != FinalApplicationStatus.UNDEFINED) {
// Flink cluster is not running anymore
LOG.error("The application {} doesn't run anymore. It has previously completed with final status: {}",
applicationId, appReport.getFinalApplicationStatus());
throw new RuntimeException("The Yarn application " + applicationId + " doesn't run anymore.");
}
final String host = appReport.getHost();
final int rpcPort = appReport.getRpcPort();
LOG.info("Found application JobManager host name '{}' and port '{}' from supplied application id '{}'",
host, rpcPort, applicationId);
flinkConfiguration.setString(JobManagerOptions.ADDRESS, host);
flinkConfiguration.setInteger(JobManagerOptions.PORT, rpcPort);
flinkConfiguration.setString(RestOptions.ADDRESS, host);
flinkConfiguration.setInteger(RestOptions.PORT, rpcPort);
return createYarnClusterClient(
this,
-1, // we don't know the number of task managers of a started Flink cluster
-1, // we don't know how many slots each task manager has for a started Flink cluster
appReport,
flinkConfiguration,
false);
} catch (Exception e) {
throw new ClusterRetrieveException("Couldn't retrieve Yarn cluster", e);
}
} | java | @Override
public ClusterClient<ApplicationId> retrieve(ApplicationId applicationId) throws ClusterRetrieveException {
try {
// check if required Hadoop environment variables are set. If not, warn user
if (System.getenv("HADOOP_CONF_DIR") == null &&
System.getenv("YARN_CONF_DIR") == null) {
LOG.warn("Neither the HADOOP_CONF_DIR nor the YARN_CONF_DIR environment variable is set." +
"The Flink YARN Client needs one of these to be set to properly load the Hadoop " +
"configuration for accessing YARN.");
}
final ApplicationReport appReport = yarnClient.getApplicationReport(applicationId);
if (appReport.getFinalApplicationStatus() != FinalApplicationStatus.UNDEFINED) {
// Flink cluster is not running anymore
LOG.error("The application {} doesn't run anymore. It has previously completed with final status: {}",
applicationId, appReport.getFinalApplicationStatus());
throw new RuntimeException("The Yarn application " + applicationId + " doesn't run anymore.");
}
final String host = appReport.getHost();
final int rpcPort = appReport.getRpcPort();
LOG.info("Found application JobManager host name '{}' and port '{}' from supplied application id '{}'",
host, rpcPort, applicationId);
flinkConfiguration.setString(JobManagerOptions.ADDRESS, host);
flinkConfiguration.setInteger(JobManagerOptions.PORT, rpcPort);
flinkConfiguration.setString(RestOptions.ADDRESS, host);
flinkConfiguration.setInteger(RestOptions.PORT, rpcPort);
return createYarnClusterClient(
this,
-1, // we don't know the number of task managers of a started Flink cluster
-1, // we don't know how many slots each task manager has for a started Flink cluster
appReport,
flinkConfiguration,
false);
} catch (Exception e) {
throw new ClusterRetrieveException("Couldn't retrieve Yarn cluster", e);
}
} | [
"@",
"Override",
"public",
"ClusterClient",
"<",
"ApplicationId",
">",
"retrieve",
"(",
"ApplicationId",
"applicationId",
")",
"throws",
"ClusterRetrieveException",
"{",
"try",
"{",
"// check if required Hadoop environment variables are set. If not, warn user",
"if",
"(",
"Sy... | ------------------------------------------------------------- | [
"-------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-yarn/src/main/java/org/apache/flink/yarn/AbstractYarnClusterDescriptor.java#L333-L376 | train | Retrieve the YARN cluster client for the given application id. | [
30522,
1030,
2058,
15637,
2270,
9324,
20464,
11638,
1026,
4646,
3593,
1028,
12850,
1006,
4646,
3593,
4646,
3593,
1007,
11618,
9324,
13465,
7373,
3726,
10288,
24422,
1063,
3046,
1063,
1013,
1013,
4638,
2065,
3223,
2018,
18589,
4044,
10857,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java | Matrix.setMatrix | public void setMatrix(int[] r, int[] c, Matrix X)
{
try
{
for (int i = 0; i < r.length; i++)
{
for (int j = 0; j < c.length; j++)
{
A[r[i]][c[j]] = X.get(i, j);
}
}
}
catch (ArrayIndexOutOfBoundsException e)
{
throw new ArrayIndexOutOfBoundsException("Submatrix indices");
}
} | java | public void setMatrix(int[] r, int[] c, Matrix X)
{
try
{
for (int i = 0; i < r.length; i++)
{
for (int j = 0; j < c.length; j++)
{
A[r[i]][c[j]] = X.get(i, j);
}
}
}
catch (ArrayIndexOutOfBoundsException e)
{
throw new ArrayIndexOutOfBoundsException("Submatrix indices");
}
} | [
"public",
"void",
"setMatrix",
"(",
"int",
"[",
"]",
"r",
",",
"int",
"[",
"]",
"c",
",",
"Matrix",
"X",
")",
"{",
"try",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"r",
".",
"length",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int... | Set a submatrix.
@param r Array of row indices.
@param c Array of column indices.
@param X A(r(:),c(:))
@throws ArrayIndexOutOfBoundsException Submatrix indices | [
"Set",
"a",
"submatrix",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L527-L543 | train | Sets the matrix A. | [
30522,
2270,
11675,
2275,
18900,
17682,
1006,
20014,
1031,
1033,
1054,
1010,
20014,
1031,
1033,
1039,
1010,
8185,
1060,
1007,
1063,
3046,
1063,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
1054,
1012,
3091,
1025,
1045,
1009,
1009,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.