repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanAllocator.java | Bzip2HuffmanAllocator.allocateHuffmanCodeLengths | static void allocateHuffmanCodeLengths(final int[] array, final int maximumLength) {
switch (array.length) {
case 2:
array[1] = 1;
// fall through
case 1:
array[0] = 1;
return;
}
/* Pass 1 : Set extended parent pointers */
setExtendedParentPointers(array);
/* Pass 2 : Find number of nodes to relocate in order to achieve maximum code length */
int nodesToRelocate = findNodesToRelocate(array, maximumLength);
/* Pass 3 : Generate code lengths */
if (array[0] % array.length >= nodesToRelocate) {
allocateNodeLengths(array);
} else {
int insertDepth = maximumLength - (32 - Integer.numberOfLeadingZeros(nodesToRelocate - 1));
allocateNodeLengthsWithRelocation(array, nodesToRelocate, insertDepth);
}
} | java | static void allocateHuffmanCodeLengths(final int[] array, final int maximumLength) {
switch (array.length) {
case 2:
array[1] = 1;
// fall through
case 1:
array[0] = 1;
return;
}
/* Pass 1 : Set extended parent pointers */
setExtendedParentPointers(array);
/* Pass 2 : Find number of nodes to relocate in order to achieve maximum code length */
int nodesToRelocate = findNodesToRelocate(array, maximumLength);
/* Pass 3 : Generate code lengths */
if (array[0] % array.length >= nodesToRelocate) {
allocateNodeLengths(array);
} else {
int insertDepth = maximumLength - (32 - Integer.numberOfLeadingZeros(nodesToRelocate - 1));
allocateNodeLengthsWithRelocation(array, nodesToRelocate, insertDepth);
}
} | [
"static",
"void",
"allocateHuffmanCodeLengths",
"(",
"final",
"int",
"[",
"]",
"array",
",",
"final",
"int",
"maximumLength",
")",
"{",
"switch",
"(",
"array",
".",
"length",
")",
"{",
"case",
"2",
":",
"array",
"[",
"1",
"]",
"=",
"1",
";",
"// fall t... | Allocates Canonical Huffman code lengths in place based on a sorted frequency array.
@param array On input, a sorted array of symbol frequencies; On output, an array of Canonical
Huffman code lengths
@param maximumLength The maximum code length. Must be at least {@code ceil(log2(array.length))} | [
"Allocates",
"Canonical",
"Huffman",
"code",
"lengths",
"in",
"place",
"based",
"on",
"a",
"sorted",
"frequency",
"array",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanAllocator.java#L158-L181 | train | Allocate Huffman code lengths. | [
30522,
10763,
11675,
2035,
24755,
2618,
6979,
4246,
2386,
16044,
7770,
13512,
7898,
1006,
2345,
20014,
1031,
1033,
9140,
1010,
2345,
20014,
4555,
7770,
13512,
2232,
1007,
1063,
6942,
1006,
9140,
1012,
3091,
1007,
1063,
2553,
1016,
1024,
914... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | server/src/main/java/com/alibaba/otter/canal/common/MQMessageUtils.java | MQMessageUtils.messageTopics | public static Map<String, Message> messageTopics(Message message, String defaultTopic, String dynamicTopicConfigs) {
List<CanalEntry.Entry> entries;
if (message.isRaw()) {
List<ByteString> rawEntries = message.getRawEntries();
entries = new ArrayList<>(rawEntries.size());
for (ByteString byteString : rawEntries) {
CanalEntry.Entry entry;
try {
entry = CanalEntry.Entry.parseFrom(byteString);
} catch (InvalidProtocolBufferException e) {
throw new RuntimeException(e);
}
entries.add(entry);
}
} else {
entries = message.getEntries();
}
Map<String, Message> messages = new HashMap<>();
for (CanalEntry.Entry entry : entries) {
if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN
|| entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONEND) {
continue;
}
String schemaName = entry.getHeader().getSchemaName();
String tableName = entry.getHeader().getTableName();
if (StringUtils.isEmpty(schemaName) || StringUtils.isEmpty(tableName)) {
put2MapMessage(messages, message.getId(), defaultTopic, entry);
} else {
Set<String> topics = matchTopics(schemaName + "." + tableName, dynamicTopicConfigs);
if (topics != null) {
for (String topic : topics) {
put2MapMessage(messages, message.getId(), topic, entry);
}
} else {
topics = matchTopics(schemaName, dynamicTopicConfigs);
if (topics != null) {
for (String topic : topics) {
put2MapMessage(messages, message.getId(), topic, entry);
}
} else {
put2MapMessage(messages, message.getId(), defaultTopic, entry);
}
}
}
}
return messages;
} | java | public static Map<String, Message> messageTopics(Message message, String defaultTopic, String dynamicTopicConfigs) {
List<CanalEntry.Entry> entries;
if (message.isRaw()) {
List<ByteString> rawEntries = message.getRawEntries();
entries = new ArrayList<>(rawEntries.size());
for (ByteString byteString : rawEntries) {
CanalEntry.Entry entry;
try {
entry = CanalEntry.Entry.parseFrom(byteString);
} catch (InvalidProtocolBufferException e) {
throw new RuntimeException(e);
}
entries.add(entry);
}
} else {
entries = message.getEntries();
}
Map<String, Message> messages = new HashMap<>();
for (CanalEntry.Entry entry : entries) {
if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN
|| entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONEND) {
continue;
}
String schemaName = entry.getHeader().getSchemaName();
String tableName = entry.getHeader().getTableName();
if (StringUtils.isEmpty(schemaName) || StringUtils.isEmpty(tableName)) {
put2MapMessage(messages, message.getId(), defaultTopic, entry);
} else {
Set<String> topics = matchTopics(schemaName + "." + tableName, dynamicTopicConfigs);
if (topics != null) {
for (String topic : topics) {
put2MapMessage(messages, message.getId(), topic, entry);
}
} else {
topics = matchTopics(schemaName, dynamicTopicConfigs);
if (topics != null) {
for (String topic : topics) {
put2MapMessage(messages, message.getId(), topic, entry);
}
} else {
put2MapMessage(messages, message.getId(), defaultTopic, entry);
}
}
}
}
return messages;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Message",
">",
"messageTopics",
"(",
"Message",
"message",
",",
"String",
"defaultTopic",
",",
"String",
"dynamicTopicConfigs",
")",
"{",
"List",
"<",
"CanalEntry",
".",
"Entry",
">",
"entries",
";",
"if",
"(",... | 按 schema 或者 schema+table 将 message 分配到对应topic
@param message 原message
@param defaultTopic 默认topic
@param dynamicTopicConfigs 动态topic规则
@return 分隔后的message map | [
"按",
"schema",
"或者",
"schema",
"+",
"table",
"将",
"message",
"分配到对应topic"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/server/src/main/java/com/alibaba/otter/canal/common/MQMessageUtils.java#L113-L161 | train | Gets the message topics. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
4471,
1028,
4471,
14399,
6558,
1006,
4471,
4471,
1010,
5164,
12398,
14399,
2594,
1010,
5164,
8790,
14399,
2594,
8663,
8873,
5620,
1007,
1063,
2862,
1026,
5033,
4765,
2854,
1012,
4443,
1028,
10445,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/flink/table/expressions/rules/ExpandColumnFunctionsRule.java | ExpandColumnFunctionsRule.indexOfName | private static int indexOfName(List<UnresolvedReferenceExpression> inputFieldReferences, String targetName) {
int i;
for (i = 0; i < inputFieldReferences.size(); ++i) {
if (inputFieldReferences.get(i).getName().equals(targetName)) {
break;
}
}
return i == inputFieldReferences.size() ? -1 : i;
} | java | private static int indexOfName(List<UnresolvedReferenceExpression> inputFieldReferences, String targetName) {
int i;
for (i = 0; i < inputFieldReferences.size(); ++i) {
if (inputFieldReferences.get(i).getName().equals(targetName)) {
break;
}
}
return i == inputFieldReferences.size() ? -1 : i;
} | [
"private",
"static",
"int",
"indexOfName",
"(",
"List",
"<",
"UnresolvedReferenceExpression",
">",
"inputFieldReferences",
",",
"String",
"targetName",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"inputFieldReferences",
".",
"size",
... | Find the index of targetName in the list. Return -1 if not found. | [
"Find",
"the",
"index",
"of",
"targetName",
"in",
"the",
"list",
".",
"Return",
"-",
"1",
"if",
"not",
"found",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/expressions/rules/ExpandColumnFunctionsRule.java#L226-L234 | train | Gets the index of targetName in inputFieldReferences. | [
30522,
2797,
10763,
20014,
5950,
11253,
18442,
1006,
2862,
1026,
4895,
6072,
16116,
2890,
25523,
10288,
20110,
3258,
1028,
7953,
3790,
2890,
25523,
2015,
1010,
5164,
4539,
18442,
1007,
1063,
20014,
1045,
1025,
2005,
1006,
1045,
1027,
1014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-mesos/src/main/java/org/apache/flink/mesos/Utils.java | Utils.variable | public static Protos.Environment.Variable variable(String name, String value) {
checkNotNull(name);
return Protos.Environment.Variable.newBuilder()
.setName(name)
.setValue(value)
.build();
} | java | public static Protos.Environment.Variable variable(String name, String value) {
checkNotNull(name);
return Protos.Environment.Variable.newBuilder()
.setName(name)
.setValue(value)
.build();
} | [
"public",
"static",
"Protos",
".",
"Environment",
".",
"Variable",
"variable",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"checkNotNull",
"(",
"name",
")",
";",
"return",
"Protos",
".",
"Environment",
".",
"Variable",
".",
"newBuilder",
"(",
... | Construct a Mesos environment variable. | [
"Construct",
"a",
"Mesos",
"environment",
"variable",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/Utils.java#L50-L56 | train | Construct a variable from a string. | [
30522,
2270,
10763,
15053,
2015,
1012,
4044,
1012,
8023,
8023,
1006,
5164,
2171,
1010,
5164,
3643,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
2171,
1007,
1025,
2709,
15053,
2015,
1012,
4044,
1012,
8023,
1012,
2047,
8569,
23891,
2099,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java | ExcelBase.setSheet | @SuppressWarnings("unchecked")
public T setSheet(String sheetName) {
this.sheet = this.workbook.getSheet(sheetName);
if (null == this.sheet) {
this.sheet = this.workbook.createSheet(sheetName);
}
return (T) this;
} | java | @SuppressWarnings("unchecked")
public T setSheet(String sheetName) {
this.sheet = this.workbook.getSheet(sheetName);
if (null == this.sheet) {
this.sheet = this.workbook.createSheet(sheetName);
}
return (T) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"setSheet",
"(",
"String",
"sheetName",
")",
"{",
"this",
".",
"sheet",
"=",
"this",
".",
"workbook",
".",
"getSheet",
"(",
"sheetName",
")",
";",
"if",
"(",
"null",
"==",
"this",
".",
... | 自定义需要读取或写出的Sheet,如果给定的sheet不存在,创建之。<br>
在读取中,此方法用于切换读取的sheet,在写出时,此方法用于新建或者切换sheet。
@param sheetName sheet名
@return this
@since 4.0.10 | [
"自定义需要读取或写出的Sheet,如果给定的sheet不存在,创建之。<br",
">",
"在读取中,此方法用于切换读取的sheet,在写出时,此方法用于新建或者切换sheet。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java#L109-L116 | train | Sets the name of the worksheet to be used. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
1056,
4520,
21030,
2102,
1006,
5164,
7123,
18442,
1007,
1063,
2023,
1012,
7123,
1027,
2023,
1012,
2147,
8654,
1012,
4152,
21030,
2102,
1006,
7123,
18442,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseConfiguration.java | CouchbaseConfiguration.initializeEnvironmentBuilder | protected DefaultCouchbaseEnvironment.Builder initializeEnvironmentBuilder(
CouchbaseProperties properties) {
CouchbaseProperties.Endpoints endpoints = properties.getEnv().getEndpoints();
CouchbaseProperties.Timeouts timeouts = properties.getEnv().getTimeouts();
DefaultCouchbaseEnvironment.Builder builder = DefaultCouchbaseEnvironment
.builder();
if (timeouts.getConnect() != null) {
builder = builder.connectTimeout(timeouts.getConnect().toMillis());
}
builder = builder.keyValueServiceConfig(
KeyValueServiceConfig.create(endpoints.getKeyValue()));
if (timeouts.getKeyValue() != null) {
builder = builder.kvTimeout(timeouts.getKeyValue().toMillis());
}
if (timeouts.getQuery() != null) {
builder = builder.queryTimeout(timeouts.getQuery().toMillis());
builder = builder.queryServiceConfig(getQueryServiceConfig(endpoints));
builder = builder.viewServiceConfig(getViewServiceConfig(endpoints));
}
if (timeouts.getSocketConnect() != null) {
builder = builder
.socketConnectTimeout((int) timeouts.getSocketConnect().toMillis());
}
if (timeouts.getView() != null) {
builder = builder.viewTimeout(timeouts.getView().toMillis());
}
CouchbaseProperties.Ssl ssl = properties.getEnv().getSsl();
if (ssl.getEnabled()) {
builder = builder.sslEnabled(true);
if (ssl.getKeyStore() != null) {
builder = builder.sslKeystoreFile(ssl.getKeyStore());
}
if (ssl.getKeyStorePassword() != null) {
builder = builder.sslKeystorePassword(ssl.getKeyStorePassword());
}
}
return builder;
} | java | protected DefaultCouchbaseEnvironment.Builder initializeEnvironmentBuilder(
CouchbaseProperties properties) {
CouchbaseProperties.Endpoints endpoints = properties.getEnv().getEndpoints();
CouchbaseProperties.Timeouts timeouts = properties.getEnv().getTimeouts();
DefaultCouchbaseEnvironment.Builder builder = DefaultCouchbaseEnvironment
.builder();
if (timeouts.getConnect() != null) {
builder = builder.connectTimeout(timeouts.getConnect().toMillis());
}
builder = builder.keyValueServiceConfig(
KeyValueServiceConfig.create(endpoints.getKeyValue()));
if (timeouts.getKeyValue() != null) {
builder = builder.kvTimeout(timeouts.getKeyValue().toMillis());
}
if (timeouts.getQuery() != null) {
builder = builder.queryTimeout(timeouts.getQuery().toMillis());
builder = builder.queryServiceConfig(getQueryServiceConfig(endpoints));
builder = builder.viewServiceConfig(getViewServiceConfig(endpoints));
}
if (timeouts.getSocketConnect() != null) {
builder = builder
.socketConnectTimeout((int) timeouts.getSocketConnect().toMillis());
}
if (timeouts.getView() != null) {
builder = builder.viewTimeout(timeouts.getView().toMillis());
}
CouchbaseProperties.Ssl ssl = properties.getEnv().getSsl();
if (ssl.getEnabled()) {
builder = builder.sslEnabled(true);
if (ssl.getKeyStore() != null) {
builder = builder.sslKeystoreFile(ssl.getKeyStore());
}
if (ssl.getKeyStorePassword() != null) {
builder = builder.sslKeystorePassword(ssl.getKeyStorePassword());
}
}
return builder;
} | [
"protected",
"DefaultCouchbaseEnvironment",
".",
"Builder",
"initializeEnvironmentBuilder",
"(",
"CouchbaseProperties",
"properties",
")",
"{",
"CouchbaseProperties",
".",
"Endpoints",
"endpoints",
"=",
"properties",
".",
"getEnv",
"(",
")",
".",
"getEndpoints",
"(",
")... | Initialize an environment builder based on the specified settings.
@param properties the couchbase properties to use
@return the {@link DefaultCouchbaseEnvironment} builder. | [
"Initialize",
"an",
"environment",
"builder",
"based",
"on",
"the",
"specified",
"settings",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/couchbase/CouchbaseConfiguration.java#L91-L128 | train | Initialize the environment builder. | [
30522,
5123,
12398,
3597,
10875,
15058,
2368,
21663,
30524,
21572,
4842,
7368,
5144,
1007,
1063,
6411,
15058,
21572,
4842,
7368,
1012,
2203,
26521,
2203,
26521,
1027,
5144,
1012,
2131,
2368,
2615,
1006,
1007,
1012,
2131,
10497,
26521,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationHead.java | StreamIterationHead.createBrokerIdString | public static String createBrokerIdString(JobID jid, String iterationID, int subtaskIndex) {
return jid + "-" + iterationID + "-" + subtaskIndex;
} | java | public static String createBrokerIdString(JobID jid, String iterationID, int subtaskIndex) {
return jid + "-" + iterationID + "-" + subtaskIndex;
} | [
"public",
"static",
"String",
"createBrokerIdString",
"(",
"JobID",
"jid",
",",
"String",
"iterationID",
",",
"int",
"subtaskIndex",
")",
"{",
"return",
"jid",
"+",
"\"-\"",
"+",
"iterationID",
"+",
"\"-\"",
"+",
"subtaskIndex",
";",
"}"
] | Creates the identification string with which head and tail task find the shared blocking
queue for the back channel. The identification string is unique per parallel head/tail pair
per iteration per job.
@param jid The job ID.
@param iterationID The id of the iteration in the job.
@param subtaskIndex The parallel subtask number
@return The identification string. | [
"Creates",
"the",
"identification",
"string",
"with",
"which",
"head",
"and",
"tail",
"task",
"find",
"the",
"shared",
"blocking",
"queue",
"for",
"the",
"back",
"channel",
".",
"The",
"identification",
"string",
"is",
"unique",
"per",
"parallel",
"head",
"/",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationHead.java#L142-L144 | train | Creates a broker ID string. | [
30522,
2270,
10763,
5164,
3443,
12618,
5484,
9821,
18886,
3070,
1006,
3105,
3593,
10147,
2094,
1010,
5164,
27758,
3593,
1010,
20014,
4942,
10230,
18824,
10288,
1007,
1063,
2709,
10147,
2094,
1009,
1000,
1011,
1000,
1009,
27758,
3593,
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... |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/common/RegistrationRequest.java | RegistrationRequest.build | public static RegistrationRequest build(GridNodeConfiguration configuration, String name, String description) {
RegistrationRequest pendingRequest = new RegistrationRequest(configuration, name, description);
GridNodeConfiguration pendingConfiguration = pendingRequest.configuration;
if (pendingConfiguration.nodeConfigFile != null) {
pendingRequest.configuration = GridNodeConfiguration.loadFromJSON(pendingConfiguration.nodeConfigFile);
}
pendingRequest.configuration.merge(pendingConfiguration);
//update important merge protected values for the pendingRequest we are building.
if (pendingConfiguration.host != null) {
pendingRequest.configuration.host = pendingConfiguration.host;
}
if (pendingConfiguration.port != null) {
pendingRequest.configuration.port = pendingConfiguration.port;
}
// make sure we have a valid host
pendingRequest.configuration.fixUpHost();
// make sure the capabilities are updated with required fields
pendingRequest.configuration.fixUpCapabilities();
pendingRequest.configuration.dropCapabilitiesThatDoesNotMatchCurrentPlatform();
return pendingRequest;
} | java | public static RegistrationRequest build(GridNodeConfiguration configuration, String name, String description) {
RegistrationRequest pendingRequest = new RegistrationRequest(configuration, name, description);
GridNodeConfiguration pendingConfiguration = pendingRequest.configuration;
if (pendingConfiguration.nodeConfigFile != null) {
pendingRequest.configuration = GridNodeConfiguration.loadFromJSON(pendingConfiguration.nodeConfigFile);
}
pendingRequest.configuration.merge(pendingConfiguration);
//update important merge protected values for the pendingRequest we are building.
if (pendingConfiguration.host != null) {
pendingRequest.configuration.host = pendingConfiguration.host;
}
if (pendingConfiguration.port != null) {
pendingRequest.configuration.port = pendingConfiguration.port;
}
// make sure we have a valid host
pendingRequest.configuration.fixUpHost();
// make sure the capabilities are updated with required fields
pendingRequest.configuration.fixUpCapabilities();
pendingRequest.configuration.dropCapabilitiesThatDoesNotMatchCurrentPlatform();
return pendingRequest;
} | [
"public",
"static",
"RegistrationRequest",
"build",
"(",
"GridNodeConfiguration",
"configuration",
",",
"String",
"name",
",",
"String",
"description",
")",
"{",
"RegistrationRequest",
"pendingRequest",
"=",
"new",
"RegistrationRequest",
"(",
"configuration",
",",
"name... | Build a RegistrationRequest from the provided {@link GridNodeConfiguration}, use the provided
name and description. This is different than {@code new RegistrationRequest(GridNodeConfiguration,
String, String)} because it will first load any specified {@link
GridNodeConfiguration#nodeConfigFile} and then merge the provided configuration onto it.
@param configuration the {@link GridNodeConfiguration} to use. Internally calls {@code new
GridNodeConfiguration()} if a {@code null} value is provided since a
request without configuration is not valid.
@param name the name for the remote
@param description the description for the remote host | [
"Build",
"a",
"RegistrationRequest",
"from",
"the",
"provided",
"{",
"@link",
"GridNodeConfiguration",
"}",
"use",
"the",
"provided",
"name",
"and",
"description",
".",
"This",
"is",
"different",
"than",
"{",
"@code",
"new",
"RegistrationRequest",
"(",
"GridNodeCo... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/common/RegistrationRequest.java#L194-L218 | train | Build a RegistrationRequest object from a given configuration object. | [
30522,
2270,
10763,
8819,
2890,
15500,
3857,
1006,
8370,
3630,
3207,
8663,
8873,
27390,
3370,
9563,
1010,
5164,
2171,
1010,
5164,
6412,
1007,
1063,
8819,
2890,
15500,
14223,
2890,
15500,
1027,
2047,
8819,
2890,
15500,
1006,
9563,
1010,
2171... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/MDAGMap.java | MDAGMap.commonPrefixSearchWithValue | public LinkedList<Entry<String, V>> commonPrefixSearchWithValue(char[] key, int begin)
{
LinkedList<Entry<String, Integer>> valueIndex = mdag.commonPrefixSearchWithValueIndex(key, begin);
LinkedList<Entry<String, V>> entryList = new LinkedList<Entry<String, V>>();
for (Entry<String, Integer> entry : valueIndex)
{
entryList.add(new SimpleEntry<String, V>(entry.getKey(), valueList.get(entry.getValue())));
}
return entryList;
} | java | public LinkedList<Entry<String, V>> commonPrefixSearchWithValue(char[] key, int begin)
{
LinkedList<Entry<String, Integer>> valueIndex = mdag.commonPrefixSearchWithValueIndex(key, begin);
LinkedList<Entry<String, V>> entryList = new LinkedList<Entry<String, V>>();
for (Entry<String, Integer> entry : valueIndex)
{
entryList.add(new SimpleEntry<String, V>(entry.getKey(), valueList.get(entry.getValue())));
}
return entryList;
} | [
"public",
"LinkedList",
"<",
"Entry",
"<",
"String",
",",
"V",
">",
">",
"commonPrefixSearchWithValue",
"(",
"char",
"[",
"]",
"key",
",",
"int",
"begin",
")",
"{",
"LinkedList",
"<",
"Entry",
"<",
"String",
",",
"Integer",
">",
">",
"valueIndex",
"=",
... | 前缀查询
@param key
@param begin
@return | [
"前缀查询"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAGMap.java#L88-L98 | train | Common prefix search with value. | [
30522,
2270,
5799,
9863,
1026,
4443,
1026,
5164,
1010,
1058,
1028,
1028,
2691,
28139,
8873,
2595,
17310,
11140,
24415,
10175,
5657,
1006,
25869,
1031,
1033,
3145,
1010,
20014,
4088,
1007,
1063,
5799,
9863,
1026,
4443,
1026,
5164,
1010,
1610... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.write | public static void write(HttpServletResponse response, InputStream in, int bufferSize) {
ServletOutputStream out = null;
try {
out = response.getOutputStream();
IoUtil.copy(in, out, bufferSize);
} catch (IOException e) {
throw new UtilException(e);
} finally {
IoUtil.close(out);
IoUtil.close(in);
}
} | java | public static void write(HttpServletResponse response, InputStream in, int bufferSize) {
ServletOutputStream out = null;
try {
out = response.getOutputStream();
IoUtil.copy(in, out, bufferSize);
} catch (IOException e) {
throw new UtilException(e);
} finally {
IoUtil.close(out);
IoUtil.close(in);
}
} | [
"public",
"static",
"void",
"write",
"(",
"HttpServletResponse",
"response",
",",
"InputStream",
"in",
",",
"int",
"bufferSize",
")",
"{",
"ServletOutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"response",
".",
"getOutputStream",
"(",
")",
"... | 返回数据给客户端
@param response 响应对象{@link HttpServletResponse}
@param in 需要返回客户端的内容
@param bufferSize 缓存大小 | [
"返回数据给客户端"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L558-L569 | train | Write a stream to a HttpServletResponse. | [
30522,
2270,
10763,
11675,
4339,
1006,
16770,
2121,
2615,
7485,
6072,
26029,
3366,
3433,
1010,
20407,
25379,
1999,
1010,
20014,
17698,
5332,
4371,
1007,
1063,
14262,
2615,
7485,
5833,
18780,
21422,
2041,
1027,
19701,
1025,
3046,
1063,
2041,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.convertToInt | private int convertToInt(Object o, int defaultValue) {
if (o.getClass() == Integer.class) {
return (Integer) o;
}
else if (o.getClass() == Long.class) {
long value = (Long) o;
if (value <= Integer.MAX_VALUE && value >= Integer.MIN_VALUE) {
return (int) value;
} else {
LOG.warn("Configuration value {} overflows/underflows the integer type.", value);
return defaultValue;
}
}
else {
try {
return Integer.parseInt(o.toString());
}
catch (NumberFormatException e) {
LOG.warn("Configuration cannot evaluate value {} as an integer number", o);
return defaultValue;
}
}
} | java | private int convertToInt(Object o, int defaultValue) {
if (o.getClass() == Integer.class) {
return (Integer) o;
}
else if (o.getClass() == Long.class) {
long value = (Long) o;
if (value <= Integer.MAX_VALUE && value >= Integer.MIN_VALUE) {
return (int) value;
} else {
LOG.warn("Configuration value {} overflows/underflows the integer type.", value);
return defaultValue;
}
}
else {
try {
return Integer.parseInt(o.toString());
}
catch (NumberFormatException e) {
LOG.warn("Configuration cannot evaluate value {} as an integer number", o);
return defaultValue;
}
}
} | [
"private",
"int",
"convertToInt",
"(",
"Object",
"o",
",",
"int",
"defaultValue",
")",
"{",
"if",
"(",
"o",
".",
"getClass",
"(",
")",
"==",
"Integer",
".",
"class",
")",
"{",
"return",
"(",
"Integer",
")",
"o",
";",
"}",
"else",
"if",
"(",
"o",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L853-L875 | train | Converts the given object to an integer value. | [
30522,
2797,
20014,
10463,
30524,
1051,
1012,
2131,
26266,
1006,
1007,
1027,
1027,
2146,
1012,
2465,
1007,
1063,
2146,
3643,
1027,
1006,
2146,
1007,
1051,
1025,
2065,
1006,
3643,
1026,
1027,
16109,
1012,
4098,
1035,
3643,
1004,
1004,
3643,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2.java | SM2.verify | public boolean verify(byte[] data, byte[] sign, byte[] id) {
lock.lock();
final SM2Signer signer = getSigner();
try {
CipherParameters param = getCipherParameters(KeyType.PublicKey);
if (id != null) {
param = new ParametersWithID(param, id);
}
signer.init(false, param);
signer.update(data, 0, data.length);
return signer.verifySignature(sign);
} catch (Exception e) {
throw new CryptoException(e);
} finally {
lock.unlock();
}
} | java | public boolean verify(byte[] data, byte[] sign, byte[] id) {
lock.lock();
final SM2Signer signer = getSigner();
try {
CipherParameters param = getCipherParameters(KeyType.PublicKey);
if (id != null) {
param = new ParametersWithID(param, id);
}
signer.init(false, param);
signer.update(data, 0, data.length);
return signer.verifySignature(sign);
} catch (Exception e) {
throw new CryptoException(e);
} finally {
lock.unlock();
}
} | [
"public",
"boolean",
"verify",
"(",
"byte",
"[",
"]",
"data",
",",
"byte",
"[",
"]",
"sign",
",",
"byte",
"[",
"]",
"id",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"final",
"SM2Signer",
"signer",
"=",
"getSigner",
"(",
")",
";",
"try",
"{",
... | 用公钥检验数字签名的合法性
@param data 数据
@param sign 签名
@param id 可以为null,若为null,则默认withId为字节数组:"1234567812345678".getBytes()
@return 是否验证通过 | [
"用公钥检验数字签名的合法性"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2.java#L219-L235 | train | Verifies the signature of the specified data. | [
30522,
2270,
22017,
20898,
20410,
1006,
24880,
1031,
1033,
2951,
1010,
24880,
1031,
1033,
3696,
1010,
24880,
1031,
1033,
8909,
1007,
1063,
5843,
1012,
5843,
1006,
1007,
1025,
2345,
15488,
2475,
5332,
10177,
2099,
3696,
2121,
1027,
4152,
237... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/AbstractFsCheckpointStorage.java | AbstractFsCheckpointStorage.resolveCheckpointPointer | protected static CompletedCheckpointStorageLocation resolveCheckpointPointer(String checkpointPointer) throws IOException {
checkNotNull(checkpointPointer, "checkpointPointer");
checkArgument(!checkpointPointer.isEmpty(), "empty checkpoint pointer");
// check if the pointer is in fact a valid file path
final Path path;
try {
path = new Path(checkpointPointer);
}
catch (Exception e) {
throw new IOException("Checkpoint/savepoint path '" + checkpointPointer + "' is not a valid file URI. " +
"Either the pointer path is invalid, or the checkpoint was created by a different state backend.");
}
// check if the file system can be accessed
final FileSystem fs;
try {
fs = path.getFileSystem();
}
catch (IOException e) {
throw new IOException("Cannot access file system for checkpoint/savepoint path '" +
checkpointPointer + "'.", e);
}
final FileStatus status;
try {
status = fs.getFileStatus(path);
}
catch (FileNotFoundException e) {
throw new FileNotFoundException("Cannot find checkpoint or savepoint " +
"file/directory '" + checkpointPointer + "' on file system '" + fs.getUri().getScheme() + "'.");
}
// if we are here, the file / directory exists
final Path checkpointDir;
final FileStatus metadataFileStatus;
// If this is a directory, we need to find the meta data file
if (status.isDir()) {
checkpointDir = status.getPath();
final Path metadataFilePath = new Path(path, METADATA_FILE_NAME);
try {
metadataFileStatus = fs.getFileStatus(metadataFilePath);
}
catch (FileNotFoundException e) {
throw new FileNotFoundException("Cannot find meta data file '" + METADATA_FILE_NAME +
"' in directory '" + path + "'. Please try to load the checkpoint/savepoint " +
"directly from the metadata file instead of the directory.");
}
}
else {
// this points to a file and we either do no name validation, or
// the name is actually correct, so we can return the path
metadataFileStatus = status;
checkpointDir = status.getPath().getParent();
}
final FileStateHandle metaDataFileHandle = new FileStateHandle(
metadataFileStatus.getPath(), metadataFileStatus.getLen());
final String pointer = checkpointDir.makeQualified(fs).toString();
return new FsCompletedCheckpointStorageLocation(
fs,
checkpointDir,
metaDataFileHandle,
pointer);
} | java | protected static CompletedCheckpointStorageLocation resolveCheckpointPointer(String checkpointPointer) throws IOException {
checkNotNull(checkpointPointer, "checkpointPointer");
checkArgument(!checkpointPointer.isEmpty(), "empty checkpoint pointer");
// check if the pointer is in fact a valid file path
final Path path;
try {
path = new Path(checkpointPointer);
}
catch (Exception e) {
throw new IOException("Checkpoint/savepoint path '" + checkpointPointer + "' is not a valid file URI. " +
"Either the pointer path is invalid, or the checkpoint was created by a different state backend.");
}
// check if the file system can be accessed
final FileSystem fs;
try {
fs = path.getFileSystem();
}
catch (IOException e) {
throw new IOException("Cannot access file system for checkpoint/savepoint path '" +
checkpointPointer + "'.", e);
}
final FileStatus status;
try {
status = fs.getFileStatus(path);
}
catch (FileNotFoundException e) {
throw new FileNotFoundException("Cannot find checkpoint or savepoint " +
"file/directory '" + checkpointPointer + "' on file system '" + fs.getUri().getScheme() + "'.");
}
// if we are here, the file / directory exists
final Path checkpointDir;
final FileStatus metadataFileStatus;
// If this is a directory, we need to find the meta data file
if (status.isDir()) {
checkpointDir = status.getPath();
final Path metadataFilePath = new Path(path, METADATA_FILE_NAME);
try {
metadataFileStatus = fs.getFileStatus(metadataFilePath);
}
catch (FileNotFoundException e) {
throw new FileNotFoundException("Cannot find meta data file '" + METADATA_FILE_NAME +
"' in directory '" + path + "'. Please try to load the checkpoint/savepoint " +
"directly from the metadata file instead of the directory.");
}
}
else {
// this points to a file and we either do no name validation, or
// the name is actually correct, so we can return the path
metadataFileStatus = status;
checkpointDir = status.getPath().getParent();
}
final FileStateHandle metaDataFileHandle = new FileStateHandle(
metadataFileStatus.getPath(), metadataFileStatus.getLen());
final String pointer = checkpointDir.makeQualified(fs).toString();
return new FsCompletedCheckpointStorageLocation(
fs,
checkpointDir,
metaDataFileHandle,
pointer);
} | [
"protected",
"static",
"CompletedCheckpointStorageLocation",
"resolveCheckpointPointer",
"(",
"String",
"checkpointPointer",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"checkpointPointer",
",",
"\"checkpointPointer\"",
")",
";",
"checkArgument",
"(",
"!",
"chec... | Takes the given string (representing a pointer to a checkpoint) and resolves it to a file
status for the checkpoint's metadata file.
@param checkpointPointer The pointer to resolve.
@return A state handle to checkpoint/savepoint's metadata.
@throws IOException Thrown, if the pointer cannot be resolved, the file system not accessed, or
the pointer points to a location that does not seem to be a checkpoint/savepoint. | [
"Takes",
"the",
"given",
"string",
"(",
"representing",
"a",
"pointer",
"to",
"a",
"checkpoint",
")",
"and",
"resolves",
"it",
"to",
"a",
"file",
"status",
"for",
"the",
"checkpoint",
"s",
"metadata",
"file",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/AbstractFsCheckpointStorage.java#L211-L278 | train | Resolves the checkpoint pointer. | [
30522,
5123,
10763,
2949,
5403,
3600,
26521,
4263,
4270,
4135,
10719,
10663,
5403,
3600,
8400,
8400,
2121,
1006,
5164,
26520,
8400,
2121,
1007,
11618,
22834,
10288,
24422,
1063,
4638,
17048,
11231,
3363,
1006,
26520,
8400,
2121,
1010,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/thread/SyncFinisher.java | SyncFinisher.start | public void start() {
countDownLatch = new CountDownLatch(workers.size());
for (Worker worker : workers) {
worker.start();
}
} | java | public void start() {
countDownLatch = new CountDownLatch(workers.size());
for (Worker worker : workers) {
worker.start();
}
} | [
"public",
"void",
"start",
"(",
")",
"{",
"countDownLatch",
"=",
"new",
"CountDownLatch",
"(",
"workers",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Worker",
"worker",
":",
"workers",
")",
"{",
"worker",
".",
"start",
"(",
")",
";",
"}",
"}"
] | 开始工作 | [
"开始工作"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/SyncFinisher.java#L34-L39 | train | Starts the worker threads. | [
30522,
2270,
11675,
2707,
1006,
1007,
1063,
18144,
20051,
2818,
1027,
2047,
18144,
20051,
2818,
1006,
3667,
1012,
2946,
1006,
1007,
1007,
1025,
2005,
1006,
7309,
7309,
1024,
3667,
1007,
1063,
7309,
1012,
2707,
1006,
1007,
1025,
1065,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateTime.java | DateTime.toDateStr | public String toDateStr() {
if (null != this.timeZone) {
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DatePattern.NORM_DATE_PATTERN);
simpleDateFormat.setTimeZone(this.timeZone);
return toString(simpleDateFormat);
}
return toString(DatePattern.NORM_DATE_FORMAT);
} | java | public String toDateStr() {
if (null != this.timeZone) {
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DatePattern.NORM_DATE_PATTERN);
simpleDateFormat.setTimeZone(this.timeZone);
return toString(simpleDateFormat);
}
return toString(DatePattern.NORM_DATE_FORMAT);
} | [
"public",
"String",
"toDateStr",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"this",
".",
"timeZone",
")",
"{",
"final",
"SimpleDateFormat",
"simpleDateFormat",
"=",
"new",
"SimpleDateFormat",
"(",
"DatePattern",
".",
"NORM_DATE_PATTERN",
")",
";",
"simpleDateFormat... | 转为"yyyy-MM-dd " 格式字符串
@return "yyyy-MM-dd " 格式字符串
@since 4.0.0 | [
"转为",
"yyyy",
"-",
"MM",
"-",
"dd",
"格式字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateTime.java#L801-L808 | train | Returns a string representation of this object. | [
30522,
2270,
5164,
28681,
8520,
16344,
1006,
1007,
1063,
2065,
1006,
19701,
999,
1027,
2023,
1012,
2051,
15975,
1007,
1063,
2345,
3722,
13701,
14192,
4017,
3722,
13701,
14192,
4017,
1027,
2047,
3722,
13701,
14192,
4017,
1006,
3058,
4502,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java | ConfigurationPropertyName.append | public ConfigurationPropertyName append(String elementValue) {
if (elementValue == null) {
return this;
}
Elements additionalElements = probablySingleElementOf(elementValue);
return new ConfigurationPropertyName(this.elements.append(additionalElements));
} | java | public ConfigurationPropertyName append(String elementValue) {
if (elementValue == null) {
return this;
}
Elements additionalElements = probablySingleElementOf(elementValue);
return new ConfigurationPropertyName(this.elements.append(additionalElements));
} | [
"public",
"ConfigurationPropertyName",
"append",
"(",
"String",
"elementValue",
")",
"{",
"if",
"(",
"elementValue",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"Elements",
"additionalElements",
"=",
"probablySingleElementOf",
"(",
"elementValue",
")",
";"... | Create a new {@link ConfigurationPropertyName} by appending the given element
value.
@param elementValue the single element value to append
@return a new {@link ConfigurationPropertyName}
@throws InvalidConfigurationPropertyNameException if elementValue is not valid | [
"Create",
"a",
"new",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java#L194-L200 | train | Appends the given element value to this property name. | [
30522,
2270,
9563,
21572,
4842,
25680,
14074,
10439,
10497,
1006,
5164,
5783,
10175,
5657,
1007,
1063,
2065,
1006,
5783,
10175,
5657,
1027,
1027,
19701,
1007,
1063,
2709,
2023,
1025,
1065,
3787,
3176,
12260,
8163,
1027,
2763,
7741,
10559,
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/operators/util/BloomFilter.java | BloomFilter.optimalNumOfBits | public static int optimalNumOfBits(long inputEntries, double fpp) {
int numBits = (int) (-inputEntries * Math.log(fpp) / (Math.log(2) * Math.log(2)));
return numBits;
} | java | public static int optimalNumOfBits(long inputEntries, double fpp) {
int numBits = (int) (-inputEntries * Math.log(fpp) / (Math.log(2) * Math.log(2)));
return numBits;
} | [
"public",
"static",
"int",
"optimalNumOfBits",
"(",
"long",
"inputEntries",
",",
"double",
"fpp",
")",
"{",
"int",
"numBits",
"=",
"(",
"int",
")",
"(",
"-",
"inputEntries",
"*",
"Math",
".",
"log",
"(",
"fpp",
")",
"/",
"(",
"Math",
".",
"log",
"(",... | Compute optimal bits number with given input entries and expected false positive probability.
@param inputEntries
@param fpp
@return optimal bits number | [
"Compute",
"optimal",
"bits",
"number",
"with",
"given",
"input",
"entries",
"and",
"expected",
"false",
"positive",
"probability",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/BloomFilter.java#L69-L72 | train | Returns the optimal number of bits for a given input entries and the given probability. | [
30522,
2270,
10763,
20014,
15502,
19172,
11253,
16313,
2015,
1006,
2146,
7953,
4765,
5134,
1010,
3313,
1042,
9397,
1007,
1063,
20014,
15903,
12762,
1027,
1006,
20014,
1007,
1006,
1011,
7953,
4765,
5134,
1008,
8785,
1012,
8833,
1006,
1042,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | Bindable.ofInstance | @SuppressWarnings("unchecked")
public static <T> Bindable<T> ofInstance(T instance) {
Assert.notNull(instance, "Instance must not be null");
Class<T> type = (Class<T>) instance.getClass();
return of(type).withExistingValue(instance);
} | java | @SuppressWarnings("unchecked")
public static <T> Bindable<T> ofInstance(T instance) {
Assert.notNull(instance, "Instance must not be null");
Class<T> type = (Class<T>) instance.getClass();
return of(type).withExistingValue(instance);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Bindable",
"<",
"T",
">",
"ofInstance",
"(",
"T",
"instance",
")",
"{",
"Assert",
".",
"notNull",
"(",
"instance",
",",
"\"Instance must not be null\"",
")",
";",
"Class"... | Create a new {@link Bindable} of the type of the specified instance with an
existing value equal to the instance.
@param <T> the source type
@param instance the instance (must not be {@code null})
@return a {@link Bindable} instance
@see #of(ResolvableType)
@see #withExistingValue(Object) | [
"Create",
"a",
"new",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java#L188-L193 | train | Create a Bindable instance with the specified instance. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
14187,
3085,
1026,
1056,
1028,
1997,
7076,
26897,
1006,
1056,
6013,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
6013,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerBuilder.java | TaskSchedulerBuilder.customizers | public TaskSchedulerBuilder customizers(TaskSchedulerCustomizer... customizers) {
Assert.notNull(customizers, "Customizers must not be null");
return customizers(Arrays.asList(customizers));
} | java | public TaskSchedulerBuilder customizers(TaskSchedulerCustomizer... customizers) {
Assert.notNull(customizers, "Customizers must not be null");
return customizers(Arrays.asList(customizers));
} | [
"public",
"TaskSchedulerBuilder",
"customizers",
"(",
"TaskSchedulerCustomizer",
"...",
"customizers",
")",
"{",
"Assert",
".",
"notNull",
"(",
"customizers",
",",
"\"Customizers must not be null\"",
")",
";",
"return",
"customizers",
"(",
"Arrays",
".",
"asList",
"("... | Set the {@link TaskSchedulerCustomizer TaskSchedulerCustomizers} that should be
applied to the {@link ThreadPoolTaskScheduler}. Customizers are applied in the
order that they were added after builder configuration has been applied. Setting
this value will replace any previously configured customizers.
@param customizers the customizers to set
@return a new builder instance
@see #additionalCustomizers(TaskSchedulerCustomizer...) | [
"Set",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerBuilder.java#L128-L131 | train | Add custom TaskSchedulerCustomizers to the builder. | [
30522,
2270,
8518,
7690,
9307,
15185,
19231,
4063,
7661,
17629,
2015,
1006,
8518,
7690,
9307,
29006,
20389,
17629,
1012,
1012,
1012,
7661,
17629,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
7661,
17629,
2015,
1010,
1000,
7661,
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-metrics/flink-metrics-statsd/src/main/java/org/apache/flink/metrics/statsd/StatsDReporter.java | StatsDReporter.report | @Override
public void report() {
// instead of locking here, we tolerate exceptions
// we do this to prevent holding the lock for very long and blocking
// operator creation and shutdown
try {
for (Map.Entry<Gauge<?>, String> entry : gauges.entrySet()) {
if (closed) {
return;
}
reportGauge(entry.getValue(), entry.getKey());
}
for (Map.Entry<Counter, String> entry : counters.entrySet()) {
if (closed) {
return;
}
reportCounter(entry.getValue(), entry.getKey());
}
for (Map.Entry<Histogram, String> entry : histograms.entrySet()) {
reportHistogram(entry.getValue(), entry.getKey());
}
for (Map.Entry<Meter, String> entry : meters.entrySet()) {
reportMeter(entry.getValue(), entry.getKey());
}
}
catch (ConcurrentModificationException | NoSuchElementException e) {
// ignore - may happen when metrics are concurrently added or removed
// report next time
}
} | java | @Override
public void report() {
// instead of locking here, we tolerate exceptions
// we do this to prevent holding the lock for very long and blocking
// operator creation and shutdown
try {
for (Map.Entry<Gauge<?>, String> entry : gauges.entrySet()) {
if (closed) {
return;
}
reportGauge(entry.getValue(), entry.getKey());
}
for (Map.Entry<Counter, String> entry : counters.entrySet()) {
if (closed) {
return;
}
reportCounter(entry.getValue(), entry.getKey());
}
for (Map.Entry<Histogram, String> entry : histograms.entrySet()) {
reportHistogram(entry.getValue(), entry.getKey());
}
for (Map.Entry<Meter, String> entry : meters.entrySet()) {
reportMeter(entry.getValue(), entry.getKey());
}
}
catch (ConcurrentModificationException | NoSuchElementException e) {
// ignore - may happen when metrics are concurrently added or removed
// report next time
}
} | [
"@",
"Override",
"public",
"void",
"report",
"(",
")",
"{",
"// instead of locking here, we tolerate exceptions",
"// we do this to prevent holding the lock for very long and blocking",
"// operator creation and shutdown",
"try",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Gaug... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-metrics/flink-metrics-statsd/src/main/java/org/apache/flink/metrics/statsd/StatsDReporter.java#L93-L125 | train | Report the metrics in the metrics store. | [
30522,
1030,
2058,
15637,
2270,
11675,
3189,
1006,
1007,
1063,
1013,
1013,
2612,
1997,
14889,
2182,
1010,
2057,
19242,
11790,
1013,
1013,
2057,
2079,
2023,
2000,
4652,
3173,
1996,
5843,
2005,
2200,
2146,
1998,
10851,
1013,
1013,
6872,
4325,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/TableSchema.java | TableSchema.getFieldType | public Optional<TypeInformation<?>> getFieldType(int fieldIndex) {
if (fieldIndex < 0 || fieldIndex >= fieldTypes.length) {
return Optional.empty();
}
return Optional.of(fieldTypes[fieldIndex]);
} | java | public Optional<TypeInformation<?>> getFieldType(int fieldIndex) {
if (fieldIndex < 0 || fieldIndex >= fieldTypes.length) {
return Optional.empty();
}
return Optional.of(fieldTypes[fieldIndex]);
} | [
"public",
"Optional",
"<",
"TypeInformation",
"<",
"?",
">",
">",
"getFieldType",
"(",
"int",
"fieldIndex",
")",
"{",
"if",
"(",
"fieldIndex",
"<",
"0",
"||",
"fieldIndex",
">=",
"fieldTypes",
".",
"length",
")",
"{",
"return",
"Optional",
".",
"empty",
... | Returns the specified type information for the given field index.
@param fieldIndex the index of the field | [
"Returns",
"the",
"specified",
"type",
"information",
"for",
"the",
"given",
"field",
"index",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/TableSchema.java#L109-L114 | train | Gets the type information for the given field index. | [
30522,
2270,
11887,
1026,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
1028,
2131,
3790,
13874,
1006,
20014,
2492,
22254,
10288,
1007,
1063,
2065,
1006,
2492,
22254,
10288,
1026,
1014,
1064,
1064,
2492,
22254,
10288,
1028,
1027,
2492,
13874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.read | public static String read(Reader reader) throws IORuntimeException {
final StringBuilder builder = StrUtil.builder();
final CharBuffer buffer = CharBuffer.allocate(DEFAULT_BUFFER_SIZE);
try {
while (-1 != reader.read(buffer)) {
builder.append(buffer.flip().toString());
}
} catch (IOException e) {
throw new IORuntimeException(e);
}
return builder.toString();
} | java | public static String read(Reader reader) throws IORuntimeException {
final StringBuilder builder = StrUtil.builder();
final CharBuffer buffer = CharBuffer.allocate(DEFAULT_BUFFER_SIZE);
try {
while (-1 != reader.read(buffer)) {
builder.append(buffer.flip().toString());
}
} catch (IOException e) {
throw new IORuntimeException(e);
}
return builder.toString();
} | [
"public",
"static",
"String",
"read",
"(",
"Reader",
"reader",
")",
"throws",
"IORuntimeException",
"{",
"final",
"StringBuilder",
"builder",
"=",
"StrUtil",
".",
"builder",
"(",
")",
";",
"final",
"CharBuffer",
"buffer",
"=",
"CharBuffer",
".",
"allocate",
"(... | 从Reader中读取String,读取完毕后并不关闭Reader
@param reader Reader
@return String
@throws IORuntimeException IO异常 | [
"从Reader中读取String,读取完毕后并不关闭Reader"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L461-L472 | train | Reads a string from a reader. | [
30522,
2270,
10763,
5164,
3191,
1006,
8068,
8068,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2345,
5164,
8569,
23891,
2099,
12508,
1027,
2358,
22134,
4014,
1012,
12508,
1006,
1007,
1025,
2345,
25869,
8569,
12494,
17698,
1027,
25869,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryFactory.java | ArtemisConnectionFactoryFactory.deduceMode | private ArtemisMode deduceMode() {
if (this.properties.getEmbedded().isEnabled()
&& ClassUtils.isPresent(EMBEDDED_JMS_CLASS, null)) {
return ArtemisMode.EMBEDDED;
}
return ArtemisMode.NATIVE;
} | java | private ArtemisMode deduceMode() {
if (this.properties.getEmbedded().isEnabled()
&& ClassUtils.isPresent(EMBEDDED_JMS_CLASS, null)) {
return ArtemisMode.EMBEDDED;
}
return ArtemisMode.NATIVE;
} | [
"private",
"ArtemisMode",
"deduceMode",
"(",
")",
"{",
"if",
"(",
"this",
".",
"properties",
".",
"getEmbedded",
"(",
")",
".",
"isEnabled",
"(",
")",
"&&",
"ClassUtils",
".",
"isPresent",
"(",
"EMBEDDED_JMS_CLASS",
",",
"null",
")",
")",
"{",
"return",
... | Deduce the {@link ArtemisMode} to use if none has been set.
@return the mode | [
"Deduce",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisConnectionFactoryFactory.java#L99-L105 | train | Deduces the ArtemisMode from the properties. | [
30522,
2797,
19063,
5302,
3207,
2139,
8566,
3401,
5302,
3207,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
5144,
1012,
2131,
6633,
8270,
5732,
1006,
1007,
1012,
2003,
8189,
23242,
1006,
1007,
1004,
1004,
2465,
21823,
4877,
1012,
2003,
28994,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | resolver-dns/src/main/java/io/netty/resolver/dns/DnsAddressResolverGroup.java | DnsAddressResolverGroup.newAddressResolver | protected AddressResolver<InetSocketAddress> newAddressResolver(EventLoop eventLoop,
NameResolver<InetAddress> resolver)
throws Exception {
return new InetSocketAddressResolver(eventLoop, resolver);
} | java | protected AddressResolver<InetSocketAddress> newAddressResolver(EventLoop eventLoop,
NameResolver<InetAddress> resolver)
throws Exception {
return new InetSocketAddressResolver(eventLoop, resolver);
} | [
"protected",
"AddressResolver",
"<",
"InetSocketAddress",
">",
"newAddressResolver",
"(",
"EventLoop",
"eventLoop",
",",
"NameResolver",
"<",
"InetAddress",
">",
"resolver",
")",
"throws",
"Exception",
"{",
"return",
"new",
"InetSocketAddressResolver",
"(",
"eventLoop",... | Creates a new {@link AddressResolver}. Override this method to create an alternative {@link AddressResolver}
implementation or override the default configuration. | [
"Creates",
"a",
"new",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsAddressResolverGroup.java#L121-L125 | train | This method is called to create an InetSocketAddressResolver. | [
30522,
5123,
4769,
6072,
4747,
6299,
1026,
1999,
8454,
7432,
12928,
14141,
8303,
1028,
2047,
4215,
16200,
4757,
6072,
4747,
6299,
1006,
2724,
4135,
7361,
2724,
4135,
7361,
1010,
2171,
6072,
4747,
6299,
1026,
1999,
12928,
14141,
8303,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonStreamExecutionEnvironment.java | PythonStreamExecutionEnvironment.add_java_source | public PythonDataStream add_java_source(SourceFunction<Object> src) {
return new PythonDataStream<>(env.addSource(src).map(new AdapterMap<>()));
} | java | public PythonDataStream add_java_source(SourceFunction<Object> src) {
return new PythonDataStream<>(env.addSource(src).map(new AdapterMap<>()));
} | [
"public",
"PythonDataStream",
"add_java_source",
"(",
"SourceFunction",
"<",
"Object",
">",
"src",
")",
"{",
"return",
"new",
"PythonDataStream",
"<>",
"(",
"env",
".",
"addSource",
"(",
"src",
")",
".",
"map",
"(",
"new",
"AdapterMap",
"<>",
"(",
")",
")"... | Add a java source to the streaming topology. The source expected to be an java based
implementation (.e.g. Kafka connector).
@param src A native java source (e.g. PythonFlinkKafkaConsumer09)
@return Python data stream | [
"Add",
"a",
"java",
"source",
"to",
"the",
"streaming",
"topology",
".",
"The",
"source",
"expected",
"to",
"be",
"an",
"java",
"based",
"implementation",
"(",
".",
"e",
".",
"g",
".",
"Kafka",
"connector",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonStreamExecutionEnvironment.java#L127-L129 | train | Add a Java source function to the Python data stream. | [
30522,
2270,
18750,
2850,
10230,
25379,
5587,
1035,
9262,
1035,
3120,
1006,
3120,
11263,
27989,
1026,
4874,
1028,
5034,
2278,
1007,
1063,
2709,
2047,
18750,
2850,
10230,
25379,
1026,
1028,
1006,
4372,
2615,
1012,
9909,
8162,
3401,
1006,
503... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java | VectorizedRleValuesReader.init | private void init(int bitWidth) {
Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32");
this.bitWidth = bitWidth;
this.bytesWidth = BytesUtils.paddedByteCountFromBits(bitWidth);
this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth);
} | java | private void init(int bitWidth) {
Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32");
this.bitWidth = bitWidth;
this.bytesWidth = BytesUtils.paddedByteCountFromBits(bitWidth);
this.packer = Packer.LITTLE_ENDIAN.newBytePacker(bitWidth);
} | [
"private",
"void",
"init",
"(",
"int",
"bitWidth",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"bitWidth",
">=",
"0",
"&&",
"bitWidth",
"<=",
"32",
",",
"\"bitWidth must be >= 0 and <= 32\"",
")",
";",
"this",
".",
"bitWidth",
"=",
"bitWidth",
";",
... | Initializes the internal state for decoding ints of `bitWidth`. | [
"Initializes",
"the",
"internal",
"state",
"for",
"decoding",
"ints",
"of",
"bitWidth",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedRleValuesReader.java#L122-L127 | train | Initializes the object with the given bit width. | [
30522,
2797,
11675,
1999,
4183,
1006,
20014,
2978,
9148,
11927,
2232,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
2978,
9148,
11927,
2232,
1028,
1027,
1014,
1004,
1004,
2978,
9148,
11927,
2232,
1026,
1027,
3590... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.isAssignable | public static void isAssignable(Class<?> superType, Class<?> subType, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
notNull(superType, "Type to check against must not be null");
if (subType == null || !superType.isAssignableFrom(subType)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
} | java | public static void isAssignable(Class<?> superType, Class<?> subType, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
notNull(superType, "Type to check against must not be null");
if (subType == null || !superType.isAssignableFrom(subType)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
} | [
"public",
"static",
"void",
"isAssignable",
"(",
"Class",
"<",
"?",
">",
"superType",
",",
"Class",
"<",
"?",
">",
"subType",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"IllegalArgumentException",
"{",
"notNull",
"(",
"... | 断言 {@code superType.isAssignableFrom(subType)} 是否为 {@code true}.
<pre class="code">
Assert.isAssignable(Number.class, myClass);
</pre>
@param superType 需要检查的父类或接口
@param subType 需要检查的子类
@param errorMsgTemplate 异常时的消息模板
@param params 参数列表
@throws IllegalArgumentException 如果子类非继承父类,抛出此异常 | [
"断言",
"{",
"@code",
"superType",
".",
"isAssignableFrom",
"(",
"subType",
")",
"}",
"是否为",
"{",
"@code",
"true",
"}",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L485-L490 | train | Checks if the given type is assignable from the given type. | [
30522,
2270,
10763,
11675,
18061,
18719,
16989,
3468,
1006,
2465,
1026,
1029,
1028,
3565,
13874,
1010,
2465,
1026,
1029,
1028,
4942,
13874,
1010,
5164,
7561,
5244,
13512,
6633,
15725,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.format | public static String format(Date date, DateFormat format) {
if (null == format || null == date) {
return null;
}
return format.format(date);
} | java | public static String format(Date date, DateFormat format) {
if (null == format || null == date) {
return null;
}
return format.format(date);
} | [
"public",
"static",
"String",
"format",
"(",
"Date",
"date",
",",
"DateFormat",
"format",
")",
"{",
"if",
"(",
"null",
"==",
"format",
"||",
"null",
"==",
"date",
")",
"{",
"return",
"null",
";",
"}",
"return",
"format",
".",
"format",
"(",
"date",
"... | 根据特定格式格式化日期
@param date 被格式化的日期
@param format {@link SimpleDateFormat}
@return 格式化后的字符串 | [
"根据特定格式格式化日期"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L493-L498 | train | Format a date with a specified format. | [
30522,
2270,
10763,
5164,
4289,
1006,
3058,
3058,
1010,
3058,
14192,
4017,
4289,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
4289,
1064,
1064,
19701,
1027,
1027,
3058,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
4289,
1012,
4289,
1006,
3058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-streaming-python/src/main/java/org/apache/flink/streaming/python/util/InterpreterUtils.java | InterpreterUtils.initAndExecPythonScript | public static void initAndExecPythonScript(PythonEnvironmentFactory factory, java.nio.file.Path scriptDirectory, String scriptName, String[] args) {
String[] fullArgs = new String[args.length + 1];
fullArgs[0] = scriptDirectory.resolve(scriptName).toString();
System.arraycopy(args, 0, fullArgs, 1, args.length);
PythonInterpreter pythonInterpreter = initPythonInterpreter(fullArgs, scriptDirectory.toUri().getPath(), scriptName);
pythonInterpreter.set("__flink_env_factory__", factory);
pythonInterpreter.exec(scriptName + ".main(__flink_env_factory__)");
} | java | public static void initAndExecPythonScript(PythonEnvironmentFactory factory, java.nio.file.Path scriptDirectory, String scriptName, String[] args) {
String[] fullArgs = new String[args.length + 1];
fullArgs[0] = scriptDirectory.resolve(scriptName).toString();
System.arraycopy(args, 0, fullArgs, 1, args.length);
PythonInterpreter pythonInterpreter = initPythonInterpreter(fullArgs, scriptDirectory.toUri().getPath(), scriptName);
pythonInterpreter.set("__flink_env_factory__", factory);
pythonInterpreter.exec(scriptName + ".main(__flink_env_factory__)");
} | [
"public",
"static",
"void",
"initAndExecPythonScript",
"(",
"PythonEnvironmentFactory",
"factory",
",",
"java",
".",
"nio",
".",
"file",
".",
"Path",
"scriptDirectory",
",",
"String",
"scriptName",
",",
"String",
"[",
"]",
"args",
")",
"{",
"String",
"[",
"]",... | Initializes the Jython interpreter and executes a python script.
@param factory environment factory
@param scriptDirectory the directory containing all required user python scripts
@param scriptName the name of the main python script
@param args Command line arguments that will be delivered to the executed python script | [
"Initializes",
"the",
"Jython",
"interpreter",
"and",
"executes",
"a",
"python",
"script",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/util/InterpreterUtils.java#L105-L114 | train | Init and exec a Python script. | [
30522,
2270,
10763,
11675,
1999,
25451,
3207,
2595,
8586,
7685,
2705,
5644,
23235,
1006,
18750,
2368,
21663,
2239,
3672,
21450,
4713,
1010,
9262,
1012,
9152,
2080,
1012,
5371,
1012,
4130,
5896,
4305,
2890,
16761,
2100,
1010,
5164,
5896,
184... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/state/schema/OrchestrationShardingSchemaGroup.java | OrchestrationShardingSchemaGroup.add | public void add(final OrchestrationShardingSchema orchestrationShardingSchema) {
String schemaName = orchestrationShardingSchema.getSchemaName();
if (!schemaGroup.containsKey(schemaName)) {
schemaGroup.put(schemaName, new LinkedList<String>());
}
schemaGroup.get(schemaName).add(orchestrationShardingSchema.getDataSourceName());
} | java | public void add(final OrchestrationShardingSchema orchestrationShardingSchema) {
String schemaName = orchestrationShardingSchema.getSchemaName();
if (!schemaGroup.containsKey(schemaName)) {
schemaGroup.put(schemaName, new LinkedList<String>());
}
schemaGroup.get(schemaName).add(orchestrationShardingSchema.getDataSourceName());
} | [
"public",
"void",
"add",
"(",
"final",
"OrchestrationShardingSchema",
"orchestrationShardingSchema",
")",
"{",
"String",
"schemaName",
"=",
"orchestrationShardingSchema",
".",
"getSchemaName",
"(",
")",
";",
"if",
"(",
"!",
"schemaGroup",
".",
"containsKey",
"(",
"s... | Add orchestration sharding schema.
@param orchestrationShardingSchema orchestration sharding schema | [
"Add",
"orchestration",
"sharding",
"schema",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/state/schema/OrchestrationShardingSchemaGroup.java#L40-L46 | train | Add an orchestration sharding schema to the table. | [
30522,
2270,
11675,
5587,
1006,
2345,
4032,
9285,
11783,
8613,
5403,
2863,
4032,
9285,
11783,
8613,
5403,
2863,
1007,
1063,
5164,
8040,
28433,
18442,
1027,
4032,
9285,
11783,
8613,
5403,
2863,
1012,
4152,
5403,
24805,
4168,
1006,
1007,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/join/JoinOperatorSetsBase.java | JoinOperatorSetsBase.where | public JoinOperatorSetsPredicateBase where(String... fields) {
return new JoinOperatorSetsPredicateBase(new Keys.ExpressionKeys<>(fields, input1.getType()));
} | java | public JoinOperatorSetsPredicateBase where(String... fields) {
return new JoinOperatorSetsPredicateBase(new Keys.ExpressionKeys<>(fields, input1.getType()));
} | [
"public",
"JoinOperatorSetsPredicateBase",
"where",
"(",
"String",
"...",
"fields",
")",
"{",
"return",
"new",
"JoinOperatorSetsPredicateBase",
"(",
"new",
"Keys",
".",
"ExpressionKeys",
"<>",
"(",
"fields",
",",
"input1",
".",
"getType",
"(",
")",
")",
")",
"... | Continues a Join transformation.
<p>Defines the fields of the first join {@link DataSet} that should be used as grouping keys. Fields
are the names of member fields of the underlying type of the data set.
@param fields The fields of the first join DataSets that should be used as keys.
@return An incomplete Join transformation.
Call {@link org.apache.flink.api.java.operators.join.JoinOperatorSetsBase.JoinOperatorSetsPredicateBase#equalTo(int...)} or
{@link org.apache.flink.api.java.operators.join.JoinOperatorSetsBase.JoinOperatorSetsPredicateBase#equalTo(KeySelector)}
to continue the Join.
@see Tuple
@see DataSet | [
"Continues",
"a",
"Join",
"transformation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/join/JoinOperatorSetsBase.java#L109-L111 | train | Create a new JoinOperatorSetsPredicateBase with the given fields. | [
30522,
2270,
3693,
25918,
18926,
8454,
28139,
16467,
15058,
2073,
1006,
5164,
1012,
1012,
1012,
4249,
1007,
1063,
2709,
2047,
3693,
25918,
18926,
8454,
28139,
16467,
15058,
1006,
2047,
6309,
1012,
3670,
14839,
2015,
1026,
1028,
1006,
4249,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/DocumentRoot.java | DocumentRoot.getValidDirectory | public final File getValidDirectory() {
File file = this.directory;
file = (file != null) ? file : getWarFileDocumentRoot();
file = (file != null) ? file : getExplodedWarFileDocumentRoot();
file = (file != null) ? file : getCommonDocumentRoot();
if (file == null && this.logger.isDebugEnabled()) {
logNoDocumentRoots();
}
else if (this.logger.isDebugEnabled()) {
this.logger.debug("Document root: " + file);
}
return file;
} | java | public final File getValidDirectory() {
File file = this.directory;
file = (file != null) ? file : getWarFileDocumentRoot();
file = (file != null) ? file : getExplodedWarFileDocumentRoot();
file = (file != null) ? file : getCommonDocumentRoot();
if (file == null && this.logger.isDebugEnabled()) {
logNoDocumentRoots();
}
else if (this.logger.isDebugEnabled()) {
this.logger.debug("Document root: " + file);
}
return file;
} | [
"public",
"final",
"File",
"getValidDirectory",
"(",
")",
"{",
"File",
"file",
"=",
"this",
".",
"directory",
";",
"file",
"=",
"(",
"file",
"!=",
"null",
")",
"?",
"file",
":",
"getWarFileDocumentRoot",
"(",
")",
";",
"file",
"=",
"(",
"file",
"!=",
... | Returns the absolute document root when it points to a valid directory, logging a
warning and returning {@code null} otherwise.
@return the valid document root | [
"Returns",
"the",
"absolute",
"document",
"root",
"when",
"it",
"points",
"to",
"a",
"valid",
"directory",
"logging",
"a",
"warning",
"and",
"returning",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/DocumentRoot.java#L61-L73 | train | Returns the directory of the WAR file or the WAR file document root. | [
30522,
2270,
2345,
5371,
2131,
10175,
3593,
4305,
2890,
16761,
2100,
1006,
1007,
1063,
5371,
5371,
1027,
2023,
1012,
14176,
1025,
5371,
1027,
1006,
5371,
999,
1027,
19701,
1007,
1029,
5371,
1024,
2131,
9028,
8873,
3709,
10085,
27417,
13181,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcServiceUtils.java | AkkaRpcServiceUtils.createRpcService | public static RpcService createRpcService(
String hostname,
String portRangeDefinition,
Configuration configuration,
String actorSystemName,
@Nonnull BootstrapTools.ActorSystemExecutorConfiguration actorSystemExecutorConfiguration) throws Exception {
final ActorSystem actorSystem = BootstrapTools.startActorSystem(
configuration,
actorSystemName,
hostname,
portRangeDefinition,
LOG,
actorSystemExecutorConfiguration);
return instantiateAkkaRpcService(configuration, actorSystem);
} | java | public static RpcService createRpcService(
String hostname,
String portRangeDefinition,
Configuration configuration,
String actorSystemName,
@Nonnull BootstrapTools.ActorSystemExecutorConfiguration actorSystemExecutorConfiguration) throws Exception {
final ActorSystem actorSystem = BootstrapTools.startActorSystem(
configuration,
actorSystemName,
hostname,
portRangeDefinition,
LOG,
actorSystemExecutorConfiguration);
return instantiateAkkaRpcService(configuration, actorSystem);
} | [
"public",
"static",
"RpcService",
"createRpcService",
"(",
"String",
"hostname",
",",
"String",
"portRangeDefinition",
",",
"Configuration",
"configuration",
",",
"String",
"actorSystemName",
",",
"@",
"Nonnull",
"BootstrapTools",
".",
"ActorSystemExecutorConfiguration",
... | Utility method to create RPC service from configuration and hostname, port.
@param hostname The hostname/address that describes the TaskManager's data location.
@param portRangeDefinition The port range to start TaskManager on.
@param configuration The configuration for the TaskManager.
@param actorSystemName The actor system name of the RpcService.
@param actorSystemExecutorConfiguration The configuration of the executor of the actor system.
@return The rpc service which is used to start and connect to the TaskManager RpcEndpoint .
@throws IOException Thrown, if the actor system can not bind to the address
@throws Exception Thrown is some other error occurs while creating akka actor system | [
"Utility",
"method",
"to",
"create",
"RPC",
"service",
"from",
"configuration",
"and",
"hostname",
"port",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcServiceUtils.java#L118-L134 | train | Creates a RpcService. | [
30522,
2270,
10763,
1054,
15042,
8043,
7903,
2063,
3443,
14536,
6169,
2121,
7903,
2063,
1006,
5164,
3677,
18442,
1010,
5164,
3417,
24388,
14728,
16294,
22753,
1010,
9563,
9563,
1010,
5164,
5889,
27268,
6633,
18442,
1010,
1030,
2512,
11231,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/MDAGNode.java | MDAGNode.getTransitionPathNodes | public Stack<MDAGNode> getTransitionPathNodes(String str)
{
Stack<MDAGNode> nodeStack = new Stack<MDAGNode>();
MDAGNode currentNode = this;
int numberOfChars = str.length();
//Iteratively _transition through the MDAG using the chars in str,
//putting each encountered node in nodeStack
for(int i = 0; i < numberOfChars && currentNode != null; i++)
{
currentNode = currentNode.transition(str.charAt(i));
nodeStack.add(currentNode);
}
/////
return nodeStack;
} | java | public Stack<MDAGNode> getTransitionPathNodes(String str)
{
Stack<MDAGNode> nodeStack = new Stack<MDAGNode>();
MDAGNode currentNode = this;
int numberOfChars = str.length();
//Iteratively _transition through the MDAG using the chars in str,
//putting each encountered node in nodeStack
for(int i = 0; i < numberOfChars && currentNode != null; i++)
{
currentNode = currentNode.transition(str.charAt(i));
nodeStack.add(currentNode);
}
/////
return nodeStack;
} | [
"public",
"Stack",
"<",
"MDAGNode",
">",
"getTransitionPathNodes",
"(",
"String",
"str",
")",
"{",
"Stack",
"<",
"MDAGNode",
">",
"nodeStack",
"=",
"new",
"Stack",
"<",
"MDAGNode",
">",
"(",
")",
";",
"MDAGNode",
"currentNode",
"=",
"this",
";",
"int",
"... | 获取一个字符串路径上经过的节点<br>
Retrieves the nodes in the _transition path starting
from this node corresponding to a given String .
@param str a String corresponding to a _transition path starting from this node
@return a Stack of MDAGNodes containing the nodes in the _transition path
denoted by {@code str}, in the order they are encountered in during transitioning | [
"获取一个字符串路径上经过的节点<br",
">",
"Retrieves",
"the",
"nodes",
"in",
"the",
"_transition",
"path",
"starting",
"from",
"this",
"node",
"corresponding",
"to",
"a",
"given",
"String",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAGNode.java#L332-L349 | train | Get the transition path nodes of this MDAG. | [
30522,
2270,
9991,
1026,
9108,
8490,
3630,
3207,
1028,
2131,
6494,
3619,
22753,
15069,
3630,
6155,
1006,
5164,
2358,
2099,
1007,
1063,
9991,
1026,
9108,
8490,
3630,
3207,
1028,
14164,
2696,
3600,
1027,
2047,
9991,
1026,
9108,
8490,
3630,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getGeneratedKeyOfLong | public static Long getGeneratedKeyOfLong(PreparedStatement ps) throws SQLException {
ResultSet rs = null;
try {
rs = ps.getGeneratedKeys();
Long generatedKey = null;
if (rs != null && rs.next()) {
try {
generatedKey = rs.getLong(1);
} catch (SQLException e) {
// 自增主键不为数字或者为Oracle的rowid,跳过
}
}
return generatedKey;
} catch (SQLException e) {
throw e;
} finally {
DbUtil.close(rs);
}
} | java | public static Long getGeneratedKeyOfLong(PreparedStatement ps) throws SQLException {
ResultSet rs = null;
try {
rs = ps.getGeneratedKeys();
Long generatedKey = null;
if (rs != null && rs.next()) {
try {
generatedKey = rs.getLong(1);
} catch (SQLException e) {
// 自增主键不为数字或者为Oracle的rowid,跳过
}
}
return generatedKey;
} catch (SQLException e) {
throw e;
} finally {
DbUtil.close(rs);
}
} | [
"public",
"static",
"Long",
"getGeneratedKeyOfLong",
"(",
"PreparedStatement",
"ps",
")",
"throws",
"SQLException",
"{",
"ResultSet",
"rs",
"=",
"null",
";",
"try",
"{",
"rs",
"=",
"ps",
".",
"getGeneratedKeys",
"(",
")",
";",
"Long",
"generatedKey",
"=",
"n... | 获得自增键的值<br>
此方法对于Oracle无效
@param ps PreparedStatement
@return 自增键的值
@throws SQLException SQL执行异常 | [
"获得自增键的值<br",
">",
"此方法对于Oracle无效"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/StatementUtil.java#L218-L236 | train | Gets the generated key of long from the result set. | [
30522,
2270,
10763,
2146,
2131,
6914,
16848,
14839,
11253,
10052,
1006,
4810,
9153,
18532,
4765,
8827,
1007,
11618,
29296,
10288,
24422,
1063,
3463,
3388,
12667,
1027,
19701,
1025,
3046,
1063,
12667,
1027,
8827,
1012,
2131,
6914,
16848,
14839... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport-native-unix-common/src/main/java/io/netty/channel/unix/IovArray.java | IovArray.add | public boolean add(ByteBuf buf) {
if (count == IOV_MAX) {
// No more room!
return false;
} else if (buf.nioBufferCount() == 1) {
final int len = buf.readableBytes();
if (len == 0) {
return true;
}
if (buf.hasMemoryAddress()) {
return add(buf.memoryAddress(), buf.readerIndex(), len);
} else {
ByteBuffer nioBuffer = buf.internalNioBuffer(buf.readerIndex(), len);
return add(Buffer.memoryAddress(nioBuffer), nioBuffer.position(), len);
}
} else {
ByteBuffer[] buffers = buf.nioBuffers();
for (ByteBuffer nioBuffer : buffers) {
final int len = nioBuffer.remaining();
if (len != 0 &&
(!add(Buffer.memoryAddress(nioBuffer), nioBuffer.position(), len) || count == IOV_MAX)) {
return false;
}
}
return true;
}
} | java | public boolean add(ByteBuf buf) {
if (count == IOV_MAX) {
// No more room!
return false;
} else if (buf.nioBufferCount() == 1) {
final int len = buf.readableBytes();
if (len == 0) {
return true;
}
if (buf.hasMemoryAddress()) {
return add(buf.memoryAddress(), buf.readerIndex(), len);
} else {
ByteBuffer nioBuffer = buf.internalNioBuffer(buf.readerIndex(), len);
return add(Buffer.memoryAddress(nioBuffer), nioBuffer.position(), len);
}
} else {
ByteBuffer[] buffers = buf.nioBuffers();
for (ByteBuffer nioBuffer : buffers) {
final int len = nioBuffer.remaining();
if (len != 0 &&
(!add(Buffer.memoryAddress(nioBuffer), nioBuffer.position(), len) || count == IOV_MAX)) {
return false;
}
}
return true;
}
} | [
"public",
"boolean",
"add",
"(",
"ByteBuf",
"buf",
")",
"{",
"if",
"(",
"count",
"==",
"IOV_MAX",
")",
"{",
"// No more room!",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"buf",
".",
"nioBufferCount",
"(",
")",
"==",
"1",
")",
"{",
"final",
"int... | Add a {@link ByteBuf} to this {@link IovArray}.
@param buf The {@link ByteBuf} to add.
@return {@code true} if the entire {@link ByteBuf} has been added to this {@link IovArray}. Note in the event
that {@link ByteBuf} is a {@link CompositeByteBuf} {@code false} may be returned even if some of the components
have been added. | [
"Add",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-unix-common/src/main/java/io/netty/channel/unix/IovArray.java#L87-L113 | train | Add a buffer to the buffer. | [
30522,
2270,
22017,
20898,
5587,
1006,
24880,
8569,
2546,
20934,
2546,
1007,
1063,
2065,
1006,
4175,
1027,
1027,
22834,
2615,
1035,
4098,
1007,
1063,
1013,
1013,
2053,
2062,
2282,
999,
2709,
6270,
1025,
1065,
2842,
2065,
1006,
20934,
2546,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java | StrSpliter.split | public static List<String> split(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty){
return split(str, separator, limit, isTrim, ignoreEmpty, false);
} | java | public static List<String> split(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty){
return split(str, separator, limit, isTrim, ignoreEmpty, false);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"split",
"(",
"String",
"str",
",",
"char",
"separator",
",",
"int",
"limit",
",",
"boolean",
"isTrim",
",",
"boolean",
"ignoreEmpty",
")",
"{",
"return",
"split",
"(",
"str",
",",
"separator",
",",
"limit"... | 切分字符串,大小写敏感
@param str 被切分的字符串
@param separator 分隔符字符
@param limit 限制分片数,-1不限制
@param isTrim 是否去除切分字符串后每个元素两边的空格
@param ignoreEmpty 是否忽略空串
@return 切分后的集合
@since 3.0.8 | [
"切分字符串,大小写敏感"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java#L119-L121 | train | Split a string into a list of strings. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
3975,
1006,
5164,
2358,
2099,
1010,
25869,
19802,
25879,
2953,
1010,
20014,
5787,
1010,
22017,
20898,
21541,
20026,
1010,
22017,
20898,
8568,
6633,
13876,
2100,
1007,
1063,
2709,
3975,
1006,
2358,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.toBean | public static <T> T toBean(ServletRequest request, Class<T> beanClass, boolean isIgnoreError) {
return fillBean(request, ReflectUtil.newInstance(beanClass), isIgnoreError);
} | java | public static <T> T toBean(ServletRequest request, Class<T> beanClass, boolean isIgnoreError) {
return fillBean(request, ReflectUtil.newInstance(beanClass), isIgnoreError);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"toBean",
"(",
"ServletRequest",
"request",
",",
"Class",
"<",
"T",
">",
"beanClass",
",",
"boolean",
"isIgnoreError",
")",
"{",
"return",
"fillBean",
"(",
"request",
",",
"ReflectUtil",
".",
"newInstance",
"(",
"bea... | ServletRequest 参数转Bean
@param <T> Bean类型
@param request ServletRequest
@param beanClass Bean Class
@param isIgnoreError 是否忽略注入错误
@return Bean | [
"ServletRequest",
"参数转Bean"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L172-L174 | train | Converts the request to a bean. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
2000,
4783,
2319,
1006,
14262,
2615,
7485,
2890,
15500,
5227,
1010,
2465,
1026,
1056,
1028,
14068,
26266,
1010,
22017,
20898,
2003,
23773,
5686,
2121,
29165,
1007,
1063,
2709,
6039,
4783,
2319,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/Runner.java | Runner.writeJobDetails | private static void writeJobDetails(ExecutionEnvironment env, String jobDetailsPath) throws IOException {
JobExecutionResult result = env.getLastJobExecutionResult();
File jsonFile = new File(jobDetailsPath);
try (JsonGenerator json = new JsonFactory().createGenerator(jsonFile, JsonEncoding.UTF8)) {
json.writeStartObject();
json.writeObjectFieldStart("Apache Flink");
json.writeStringField("version", EnvironmentInformation.getVersion());
json.writeStringField("commit ID", EnvironmentInformation.getRevisionInformation().commitId);
json.writeStringField("commit date", EnvironmentInformation.getRevisionInformation().commitDate);
json.writeEndObject();
json.writeStringField("job_id", result.getJobID().toString());
json.writeNumberField("runtime_ms", result.getNetRuntime());
json.writeObjectFieldStart("parameters");
for (Map.Entry<String, String> entry : env.getConfig().getGlobalJobParameters().toMap().entrySet()) {
json.writeStringField(entry.getKey(), entry.getValue());
}
json.writeEndObject();
json.writeObjectFieldStart("accumulators");
for (Map.Entry<String, Object> entry : result.getAllAccumulatorResults().entrySet()) {
json.writeStringField(entry.getKey(), entry.getValue().toString());
}
json.writeEndObject();
json.writeEndObject();
}
} | java | private static void writeJobDetails(ExecutionEnvironment env, String jobDetailsPath) throws IOException {
JobExecutionResult result = env.getLastJobExecutionResult();
File jsonFile = new File(jobDetailsPath);
try (JsonGenerator json = new JsonFactory().createGenerator(jsonFile, JsonEncoding.UTF8)) {
json.writeStartObject();
json.writeObjectFieldStart("Apache Flink");
json.writeStringField("version", EnvironmentInformation.getVersion());
json.writeStringField("commit ID", EnvironmentInformation.getRevisionInformation().commitId);
json.writeStringField("commit date", EnvironmentInformation.getRevisionInformation().commitDate);
json.writeEndObject();
json.writeStringField("job_id", result.getJobID().toString());
json.writeNumberField("runtime_ms", result.getNetRuntime());
json.writeObjectFieldStart("parameters");
for (Map.Entry<String, String> entry : env.getConfig().getGlobalJobParameters().toMap().entrySet()) {
json.writeStringField(entry.getKey(), entry.getValue());
}
json.writeEndObject();
json.writeObjectFieldStart("accumulators");
for (Map.Entry<String, Object> entry : result.getAllAccumulatorResults().entrySet()) {
json.writeStringField(entry.getKey(), entry.getValue().toString());
}
json.writeEndObject();
json.writeEndObject();
}
} | [
"private",
"static",
"void",
"writeJobDetails",
"(",
"ExecutionEnvironment",
"env",
",",
"String",
"jobDetailsPath",
")",
"throws",
"IOException",
"{",
"JobExecutionResult",
"result",
"=",
"env",
".",
"getLastJobExecutionResult",
"(",
")",
";",
"File",
"jsonFile",
"... | Write the following job details as a JSON encoded file: runtime environment
job ID, runtime, parameters, and accumulators.
@param env the execution environment
@param jobDetailsPath filesystem path to write job details
@throws IOException on error writing to jobDetailsPath | [
"Write",
"the",
"following",
"job",
"details",
"as",
"a",
"JSON",
"encoded",
"file",
":",
"runtime",
"environment",
"job",
"ID",
"runtime",
"parameters",
"and",
"accumulators",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/Runner.java#L473-L504 | train | Write job details to a JSON file | [
30522,
2797,
10763,
11675,
4339,
5558,
2497,
3207,
22081,
1006,
7781,
2368,
21663,
2239,
3672,
4372,
2615,
1010,
5164,
3105,
3207,
22081,
15069,
1007,
11618,
22834,
10288,
24422,
1063,
3105,
10288,
8586,
13700,
6072,
11314,
2765,
1027,
4372,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Channel.java | Channel.getEstimatedOutputSize | @Override
public long getEstimatedOutputSize() {
long estimate = this.source.template.getEstimatedOutputSize();
return estimate < 0 ? estimate : estimate * this.replicationFactor;
} | java | @Override
public long getEstimatedOutputSize() {
long estimate = this.source.template.getEstimatedOutputSize();
return estimate < 0 ? estimate : estimate * this.replicationFactor;
} | [
"@",
"Override",
"public",
"long",
"getEstimatedOutputSize",
"(",
")",
"{",
"long",
"estimate",
"=",
"this",
".",
"source",
".",
"template",
".",
"getEstimatedOutputSize",
"(",
")",
";",
"return",
"estimate",
"<",
"0",
"?",
"estimate",
":",
"estimate",
"*",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/plan/Channel.java#L380-L384 | train | Get the estimated output size of this template. | [
30522,
1030,
2058,
15637,
2270,
2146,
2131,
4355,
20592,
5833,
18780,
5332,
4371,
1006,
1007,
1063,
2146,
10197,
1027,
2023,
1012,
3120,
1012,
23561,
1012,
2131,
4355,
20592,
5833,
18780,
5332,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/AbstractCommandBuilder.java | AbstractCommandBuilder.buildJavaCommand | List<String> buildJavaCommand(String extraClassPath) throws IOException {
List<String> cmd = new ArrayList<>();
String[] candidateJavaHomes = new String[] {
javaHome,
childEnv.get("JAVA_HOME"),
System.getenv("JAVA_HOME"),
System.getProperty("java.home")
};
for (String javaHome : candidateJavaHomes) {
if (javaHome != null) {
cmd.add(join(File.separator, javaHome, "bin", "java"));
break;
}
}
// Load extra JAVA_OPTS from conf/java-opts, if it exists.
File javaOpts = new File(join(File.separator, getConfDir(), "java-opts"));
if (javaOpts.isFile()) {
try (BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(javaOpts), StandardCharsets.UTF_8))) {
String line;
while ((line = br.readLine()) != null) {
addOptionString(cmd, line);
}
}
}
cmd.add("-cp");
cmd.add(join(File.pathSeparator, buildClassPath(extraClassPath)));
return cmd;
} | java | List<String> buildJavaCommand(String extraClassPath) throws IOException {
List<String> cmd = new ArrayList<>();
String[] candidateJavaHomes = new String[] {
javaHome,
childEnv.get("JAVA_HOME"),
System.getenv("JAVA_HOME"),
System.getProperty("java.home")
};
for (String javaHome : candidateJavaHomes) {
if (javaHome != null) {
cmd.add(join(File.separator, javaHome, "bin", "java"));
break;
}
}
// Load extra JAVA_OPTS from conf/java-opts, if it exists.
File javaOpts = new File(join(File.separator, getConfDir(), "java-opts"));
if (javaOpts.isFile()) {
try (BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(javaOpts), StandardCharsets.UTF_8))) {
String line;
while ((line = br.readLine()) != null) {
addOptionString(cmd, line);
}
}
}
cmd.add("-cp");
cmd.add(join(File.pathSeparator, buildClassPath(extraClassPath)));
return cmd;
} | [
"List",
"<",
"String",
">",
"buildJavaCommand",
"(",
"String",
"extraClassPath",
")",
"throws",
"IOException",
"{",
"List",
"<",
"String",
">",
"cmd",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"String",
"[",
"]",
"candidateJavaHomes",
"=",
"new",
"Stri... | Builds a list of arguments to run java.
This method finds the java executable to use and appends JVM-specific options for running a
class with Spark in the classpath. It also loads options from the "java-opts" file in the
configuration directory being used.
Callers should still add at least the class to run, as well as any arguments to pass to the
class. | [
"Builds",
"a",
"list",
"of",
"arguments",
"to",
"run",
"java",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractCommandBuilder.java#L92-L123 | train | Build the java command. | [
30522,
2862,
1026,
5164,
1028,
3857,
3900,
24887,
5358,
2386,
2094,
1006,
5164,
4469,
26266,
15069,
1007,
11618,
22834,
10288,
24422,
1063,
2862,
1026,
5164,
1028,
4642,
2094,
1027,
2047,
9140,
9863,
1026,
1028,
1006,
1007,
1025,
5164,
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... |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.translate | public UTF8String translate(Map<Character, Character> dict) {
String srcStr = this.toString();
StringBuilder sb = new StringBuilder();
for(int k = 0; k< srcStr.length(); k++) {
if (null == dict.get(srcStr.charAt(k))) {
sb.append(srcStr.charAt(k));
} else if ('\0' != dict.get(srcStr.charAt(k))){
sb.append(dict.get(srcStr.charAt(k)));
}
}
return fromString(sb.toString());
} | java | public UTF8String translate(Map<Character, Character> dict) {
String srcStr = this.toString();
StringBuilder sb = new StringBuilder();
for(int k = 0; k< srcStr.length(); k++) {
if (null == dict.get(srcStr.charAt(k))) {
sb.append(srcStr.charAt(k));
} else if ('\0' != dict.get(srcStr.charAt(k))){
sb.append(dict.get(srcStr.charAt(k)));
}
}
return fromString(sb.toString());
} | [
"public",
"UTF8String",
"translate",
"(",
"Map",
"<",
"Character",
",",
"Character",
">",
"dict",
")",
"{",
"String",
"srcStr",
"=",
"this",
".",
"toString",
"(",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
... | TODO: Need to use `Code Point` here instead of Char in case the character longer than 2 bytes | [
"TODO",
":",
"Need",
"to",
"use",
"Code",
"Point",
"here",
"instead",
"of",
"Char",
"in",
"case",
"the",
"character",
"longer",
"than",
"2",
"bytes"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L985-L997 | train | Translate this string to a UTF8String using the specified dictionary. | [
30522,
2270,
21183,
2546,
2620,
3367,
4892,
17637,
1006,
4949,
1026,
2839,
1010,
2839,
1028,
4487,
6593,
1007,
1063,
5164,
5034,
6169,
16344,
1027,
2023,
1012,
2000,
3367,
4892,
1006,
1007,
1025,
5164,
8569,
23891,
2099,
24829,
1027,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.containsAllContentEqualsIgnoreCase | public static boolean containsAllContentEqualsIgnoreCase(Collection<CharSequence> a, Collection<CharSequence> b) {
for (CharSequence v : b) {
if (!containsContentEqualsIgnoreCase(a, v)) {
return false;
}
}
return true;
} | java | public static boolean containsAllContentEqualsIgnoreCase(Collection<CharSequence> a, Collection<CharSequence> b) {
for (CharSequence v : b) {
if (!containsContentEqualsIgnoreCase(a, v)) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"containsAllContentEqualsIgnoreCase",
"(",
"Collection",
"<",
"CharSequence",
">",
"a",
",",
"Collection",
"<",
"CharSequence",
">",
"b",
")",
"{",
"for",
"(",
"CharSequence",
"v",
":",
"b",
")",
"{",
"if",
"(",
"!",
"containsC... | Determine if {@code a} contains all of the values in {@code b} using
{@link #contentEqualsIgnoreCase(CharSequence, CharSequence)} to compare values.
@param a The collection under test.
@param b The values to test for.
@return {@code true} if {@code a} contains all of the values in {@code b} using
{@link #contentEqualsIgnoreCase(CharSequence, CharSequence)} to compare values. {@code false} otherwise.
@see #contentEqualsIgnoreCase(CharSequence, CharSequence) | [
"Determine",
"if",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L1490-L1497 | train | Checks if all CharSequences in Collection are equal ignoring case. | [
30522,
2270,
10763,
22017,
20898,
3397,
8095,
8663,
6528,
2618,
26426,
5332,
26745,
2890,
18382,
1006,
3074,
1026,
25869,
3366,
4226,
5897,
1028,
1037,
1010,
3074,
1026,
25869,
3366,
4226,
5897,
1028,
1038,
1007,
1063,
2005,
1006,
25869,
30... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java | FileInputFormat.getStatistics | @Override
public FileBaseStatistics getStatistics(BaseStatistics cachedStats) throws IOException {
final FileBaseStatistics cachedFileStats = cachedStats instanceof FileBaseStatistics ?
(FileBaseStatistics) cachedStats : null;
try {
return getFileStats(cachedFileStats, getFilePaths(), new ArrayList<>(getFilePaths().length));
} catch (IOException ioex) {
if (LOG.isWarnEnabled()) {
LOG.warn("Could not determine statistics for paths '" + Arrays.toString(getFilePaths()) + "' due to an io error: "
+ ioex.getMessage());
}
}
catch (Throwable t) {
if (LOG.isErrorEnabled()) {
LOG.error("Unexpected problem while getting the file statistics for paths '" + Arrays.toString(getFilePaths()) + "': "
+ t.getMessage(), t);
}
}
// no statistics available
return null;
} | java | @Override
public FileBaseStatistics getStatistics(BaseStatistics cachedStats) throws IOException {
final FileBaseStatistics cachedFileStats = cachedStats instanceof FileBaseStatistics ?
(FileBaseStatistics) cachedStats : null;
try {
return getFileStats(cachedFileStats, getFilePaths(), new ArrayList<>(getFilePaths().length));
} catch (IOException ioex) {
if (LOG.isWarnEnabled()) {
LOG.warn("Could not determine statistics for paths '" + Arrays.toString(getFilePaths()) + "' due to an io error: "
+ ioex.getMessage());
}
}
catch (Throwable t) {
if (LOG.isErrorEnabled()) {
LOG.error("Unexpected problem while getting the file statistics for paths '" + Arrays.toString(getFilePaths()) + "': "
+ t.getMessage(), t);
}
}
// no statistics available
return null;
} | [
"@",
"Override",
"public",
"FileBaseStatistics",
"getStatistics",
"(",
"BaseStatistics",
"cachedStats",
")",
"throws",
"IOException",
"{",
"final",
"FileBaseStatistics",
"cachedFileStats",
"=",
"cachedStats",
"instanceof",
"FileBaseStatistics",
"?",
"(",
"FileBaseStatistics... | Obtains basic file statistics containing only file size. If the input is a directory, then the size is the sum of all contained files.
@see org.apache.flink.api.common.io.InputFormat#getStatistics(org.apache.flink.api.common.io.statistics.BaseStatistics) | [
"Obtains",
"basic",
"file",
"statistics",
"containing",
"only",
"file",
"size",
".",
"If",
"the",
"input",
"is",
"a",
"directory",
"then",
"the",
"size",
"is",
"the",
"sum",
"of",
"all",
"contained",
"files",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java#L473-L496 | train | Get the file statistics. | [
30522,
1030,
2058,
15637,
2270,
5371,
15058,
9153,
16774,
6558,
4152,
29336,
6553,
2015,
1006,
7888,
29336,
6553,
2015,
17053,
5104,
29336,
2015,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
5371,
15058,
9153,
16774,
6558,
17053,
20952,
9463... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/nio/NioEventLoop.java | NioEventLoop.register | public void register(final SelectableChannel ch, final int interestOps, final NioTask<?> task) {
if (ch == null) {
throw new NullPointerException("ch");
}
if (interestOps == 0) {
throw new IllegalArgumentException("interestOps must be non-zero.");
}
if ((interestOps & ~ch.validOps()) != 0) {
throw new IllegalArgumentException(
"invalid interestOps: " + interestOps + "(validOps: " + ch.validOps() + ')');
}
if (task == null) {
throw new NullPointerException("task");
}
if (isShutdown()) {
throw new IllegalStateException("event loop shut down");
}
if (inEventLoop()) {
register0(ch, interestOps, task);
} else {
try {
// Offload to the EventLoop as otherwise java.nio.channels.spi.AbstractSelectableChannel.register
// may block for a long time while trying to obtain an internal lock that may be hold while selecting.
submit(new Runnable() {
@Override
public void run() {
register0(ch, interestOps, task);
}
}).sync();
} catch (InterruptedException ignore) {
// Even if interrupted we did schedule it so just mark the Thread as interrupted.
Thread.currentThread().interrupt();
}
}
} | java | public void register(final SelectableChannel ch, final int interestOps, final NioTask<?> task) {
if (ch == null) {
throw new NullPointerException("ch");
}
if (interestOps == 0) {
throw new IllegalArgumentException("interestOps must be non-zero.");
}
if ((interestOps & ~ch.validOps()) != 0) {
throw new IllegalArgumentException(
"invalid interestOps: " + interestOps + "(validOps: " + ch.validOps() + ')');
}
if (task == null) {
throw new NullPointerException("task");
}
if (isShutdown()) {
throw new IllegalStateException("event loop shut down");
}
if (inEventLoop()) {
register0(ch, interestOps, task);
} else {
try {
// Offload to the EventLoop as otherwise java.nio.channels.spi.AbstractSelectableChannel.register
// may block for a long time while trying to obtain an internal lock that may be hold while selecting.
submit(new Runnable() {
@Override
public void run() {
register0(ch, interestOps, task);
}
}).sync();
} catch (InterruptedException ignore) {
// Even if interrupted we did schedule it so just mark the Thread as interrupted.
Thread.currentThread().interrupt();
}
}
} | [
"public",
"void",
"register",
"(",
"final",
"SelectableChannel",
"ch",
",",
"final",
"int",
"interestOps",
",",
"final",
"NioTask",
"<",
"?",
">",
"task",
")",
"{",
"if",
"(",
"ch",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"... | Registers an arbitrary {@link SelectableChannel}, not necessarily created by Netty, to the {@link Selector}
of this event loop. Once the specified {@link SelectableChannel} is registered, the specified {@code task} will
be executed by this event loop when the {@link SelectableChannel} is ready. | [
"Registers",
"an",
"arbitrary",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/nio/NioEventLoop.java#L278-L314 | train | Registers a new NioTask with the given SelectableChannel. | [
30522,
2270,
11675,
4236,
1006,
2345,
7276,
3085,
26058,
10381,
1010,
2345,
20014,
3037,
11923,
1010,
2345,
9152,
17287,
6711,
1026,
1029,
1028,
4708,
1007,
1063,
2065,
1006,
10381,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
78... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-swift-fs-hadoop/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.asXmlDocument | private synchronized Document asXmlDocument() throws IOException {
Document doc;
try {
doc =
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
} catch (ParserConfigurationException pe) {
throw new IOException(pe);
}
Element conf = doc.createElement("configuration");
doc.appendChild(conf);
conf.appendChild(doc.createTextNode("\n"));
handleDeprecation(); //ensure properties is set and deprecation is handled
for (Enumeration<Object> e = properties.keys(); e.hasMoreElements();) {
String name = (String)e.nextElement();
Object object = properties.get(name);
String value = null;
if (object instanceof String) {
value = (String) object;
}else {
continue;
}
Element propNode = doc.createElement("property");
conf.appendChild(propNode);
Element nameNode = doc.createElement("name");
nameNode.appendChild(doc.createTextNode(name));
propNode.appendChild(nameNode);
Element valueNode = doc.createElement("value");
valueNode.appendChild(doc.createTextNode(value));
propNode.appendChild(valueNode);
if (updatingResource != null) {
String[] sources = updatingResource.get(name);
if(sources != null) {
for(String s : sources) {
Element sourceNode = doc.createElement("source");
sourceNode.appendChild(doc.createTextNode(s));
propNode.appendChild(sourceNode);
}
}
}
conf.appendChild(doc.createTextNode("\n"));
}
return doc;
} | java | private synchronized Document asXmlDocument() throws IOException {
Document doc;
try {
doc =
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
} catch (ParserConfigurationException pe) {
throw new IOException(pe);
}
Element conf = doc.createElement("configuration");
doc.appendChild(conf);
conf.appendChild(doc.createTextNode("\n"));
handleDeprecation(); //ensure properties is set and deprecation is handled
for (Enumeration<Object> e = properties.keys(); e.hasMoreElements();) {
String name = (String)e.nextElement();
Object object = properties.get(name);
String value = null;
if (object instanceof String) {
value = (String) object;
}else {
continue;
}
Element propNode = doc.createElement("property");
conf.appendChild(propNode);
Element nameNode = doc.createElement("name");
nameNode.appendChild(doc.createTextNode(name));
propNode.appendChild(nameNode);
Element valueNode = doc.createElement("value");
valueNode.appendChild(doc.createTextNode(value));
propNode.appendChild(valueNode);
if (updatingResource != null) {
String[] sources = updatingResource.get(name);
if(sources != null) {
for(String s : sources) {
Element sourceNode = doc.createElement("source");
sourceNode.appendChild(doc.createTextNode(s));
propNode.appendChild(sourceNode);
}
}
}
conf.appendChild(doc.createTextNode("\n"));
}
return doc;
} | [
"private",
"synchronized",
"Document",
"asXmlDocument",
"(",
")",
"throws",
"IOException",
"{",
"Document",
"doc",
";",
"try",
"{",
"doc",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
".",
"newDocumentBuilder",
"(",
")",
".",
"newDocument",
"(",
... | Return the XML DOM corresponding to this Configuration. | [
"Return",
"the",
"XML",
"DOM",
"corresponding",
"to",
"this",
"Configuration",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-swift-fs-hadoop/src/main/java/org/apache/hadoop/conf/Configuration.java#L2733-L2779 | train | Returns the XML document for the current file. | [
30522,
2797,
25549,
6254,
2004,
2595,
19968,
3527,
24894,
4765,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
6254,
9986,
1025,
3046,
1063,
9986,
1027,
6254,
8569,
23891,
12881,
18908,
10253,
1012,
2047,
7076,
26897,
1006,
1007,
1012,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java | Matrix.identity | public static Matrix identity(int m, int n)
{
Matrix A = new Matrix(m, n);
double[][] X = A.getArray();
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
X[i][j] = (i == j ? 1.0 : 0.0);
}
}
return A;
} | java | public static Matrix identity(int m, int n)
{
Matrix A = new Matrix(m, n);
double[][] X = A.getArray();
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
X[i][j] = (i == j ? 1.0 : 0.0);
}
}
return A;
} | [
"public",
"static",
"Matrix",
"identity",
"(",
"int",
"m",
",",
"int",
"n",
")",
"{",
"Matrix",
"A",
"=",
"new",
"Matrix",
"(",
"m",
",",
"n",
")",
";",
"double",
"[",
"]",
"[",
"]",
"X",
"=",
"A",
".",
"getArray",
"(",
")",
";",
"for",
"(",
... | Generate identity matrix
@param m Number of rows.
@param n Number of colums.
@return An m-by-n matrix with ones on the diagonal and zeros elsewhere. | [
"Generate",
"identity",
"matrix"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L1017-L1029 | train | Identity Matrix. | [
30522,
2270,
10763,
8185,
4767,
1006,
20014,
1049,
1010,
20014,
1050,
1007,
1063,
8185,
1037,
1027,
2047,
8185,
1006,
1049,
1010,
1050,
1007,
1025,
3313,
1031,
1033,
1031,
1033,
1060,
1027,
1037,
1012,
2131,
2906,
9447,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java | DataStream.writeUsingOutputFormat | @PublicEvolving
public DataStreamSink<T> writeUsingOutputFormat(OutputFormat<T> format) {
return addSink(new OutputFormatSinkFunction<>(format));
} | java | @PublicEvolving
public DataStreamSink<T> writeUsingOutputFormat(OutputFormat<T> format) {
return addSink(new OutputFormatSinkFunction<>(format));
} | [
"@",
"PublicEvolving",
"public",
"DataStreamSink",
"<",
"T",
">",
"writeUsingOutputFormat",
"(",
"OutputFormat",
"<",
"T",
">",
"format",
")",
"{",
"return",
"addSink",
"(",
"new",
"OutputFormatSinkFunction",
"<>",
"(",
"format",
")",
")",
";",
"}"
] | Writes the dataStream into an output, described by an OutputFormat.
<p>The output is not participating in Flink's checkpointing!
<p>For writing to a file system periodically, the use of the "flink-connector-filesystem"
is recommended.
@param format The output format
@return The closed DataStream | [
"Writes",
"the",
"dataStream",
"into",
"an",
"output",
"described",
"by",
"an",
"OutputFormat",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L1157-L1160 | train | Write using output format. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
2951,
21422,
11493,
2243,
1026,
1056,
1028,
4339,
18161,
5833,
18780,
14192,
4017,
1006,
6434,
14192,
4017,
1026,
1056,
1028,
4289,
1007,
1063,
2709,
9909,
19839,
1006,
2047,
6434,
14192,
11149,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumerBase.java | FlinkKafkaConsumerBase.assignTimestampsAndWatermarks | public FlinkKafkaConsumerBase<T> assignTimestampsAndWatermarks(AssignerWithPunctuatedWatermarks<T> assigner) {
checkNotNull(assigner);
if (this.periodicWatermarkAssigner != null) {
throw new IllegalStateException("A periodic watermark emitter has already been set.");
}
try {
ClosureCleaner.clean(assigner, true);
this.punctuatedWatermarkAssigner = new SerializedValue<>(assigner);
return this;
} catch (Exception e) {
throw new IllegalArgumentException("The given assigner is not serializable", e);
}
} | java | public FlinkKafkaConsumerBase<T> assignTimestampsAndWatermarks(AssignerWithPunctuatedWatermarks<T> assigner) {
checkNotNull(assigner);
if (this.periodicWatermarkAssigner != null) {
throw new IllegalStateException("A periodic watermark emitter has already been set.");
}
try {
ClosureCleaner.clean(assigner, true);
this.punctuatedWatermarkAssigner = new SerializedValue<>(assigner);
return this;
} catch (Exception e) {
throw new IllegalArgumentException("The given assigner is not serializable", e);
}
} | [
"public",
"FlinkKafkaConsumerBase",
"<",
"T",
">",
"assignTimestampsAndWatermarks",
"(",
"AssignerWithPunctuatedWatermarks",
"<",
"T",
">",
"assigner",
")",
"{",
"checkNotNull",
"(",
"assigner",
")",
";",
"if",
"(",
"this",
".",
"periodicWatermarkAssigner",
"!=",
"n... | Specifies an {@link AssignerWithPunctuatedWatermarks} to emit watermarks in a punctuated manner.
The watermark extractor will run per Kafka partition, watermarks will be merged across partitions
in the same way as in the Flink runtime, when streams are merged.
<p>When a subtask of a FlinkKafkaConsumer source reads multiple Kafka partitions,
the streams from the partitions are unioned in a "first come first serve" fashion. Per-partition
characteristics are usually lost that way. For example, if the timestamps are strictly ascending
per Kafka partition, they will not be strictly ascending in the resulting Flink DataStream, if the
parallel source subtask reads more that one partition.
<p>Running timestamp extractors / watermark generators directly inside the Kafka source, per Kafka
partition, allows users to let them exploit the per-partition characteristics.
<p>Note: One can use either an {@link AssignerWithPunctuatedWatermarks} or an
{@link AssignerWithPeriodicWatermarks}, not both at the same time.
@param assigner The timestamp assigner / watermark generator to use.
@return The consumer object, to allow function chaining. | [
"Specifies",
"an",
"{",
"@link",
"AssignerWithPunctuatedWatermarks",
"}",
"to",
"emit",
"watermarks",
"in",
"a",
"punctuated",
"manner",
".",
"The",
"watermark",
"extractor",
"will",
"run",
"per",
"Kafka",
"partition",
"watermarks",
"will",
"be",
"merged",
"across... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumerBase.java#L292-L305 | train | Assigns timestamps and watermarks to the consumer. | [
30522,
2270,
13109,
19839,
2912,
24316,
22684,
3619,
17897,
28483,
3366,
1026,
1056,
1028,
23911,
7292,
9153,
25370,
5685,
5880,
27373,
1006,
23911,
2121,
24415,
14289,
12273,
26302,
3064,
5880,
27373,
1026,
1056,
1028,
23911,
2121,
1007,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readLines | public static List<String> readLines(String path, String charset) throws IORuntimeException {
return readLines(path, charset, new ArrayList<String>());
} | java | public static List<String> readLines(String path, String charset) throws IORuntimeException {
return readLines(path, charset, new ArrayList<String>());
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readLines",
"(",
"String",
"path",
",",
"String",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"readLines",
"(",
"path",
",",
"charset",
",",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")... | 从文件中读取每一行数据
@param path 文件路径
@param charset 字符集
@return 文件中的每行内容的集合List
@throws IORuntimeException IO异常 | [
"从文件中读取每一行数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2343-L2345 | train | Reads a file into a list of strings. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
3191,
12735,
1006,
5164,
4130,
1010,
5164,
25869,
13462,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
3191,
12735,
1006,
4130,
1010,
25869,
13462,
1010,
2047,
9140,
9863,
1026,
5164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java | RandomUtil.randomColor | public static Color randomColor() {
final Random random = getRandom();
return new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255));
} | java | public static Color randomColor() {
final Random random = getRandom();
return new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255));
} | [
"public",
"static",
"Color",
"randomColor",
"(",
")",
"{",
"final",
"Random",
"random",
"=",
"getRandom",
"(",
")",
";",
"return",
"new",
"Color",
"(",
"random",
".",
"nextInt",
"(",
"255",
")",
",",
"random",
".",
"nextInt",
"(",
"255",
")",
",",
"r... | 生成随机颜色
@return 随机颜色
@since 4.1.5 | [
"生成随机颜色"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java#L434-L437 | train | Returns a random color. | [
30522,
2270,
10763,
3609,
6721,
18717,
1006,
1007,
1063,
2345,
6721,
6721,
1027,
2131,
13033,
5358,
1006,
1007,
1025,
2709,
2047,
3609,
1006,
6721,
1012,
2279,
18447,
1006,
20637,
1007,
1010,
6721,
1012,
2279,
18447,
1006,
20637,
1007,
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/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java | HttpAuthUtils.createCookieToken | public static String createCookieToken(String clientUserName) {
StringBuffer sb = new StringBuffer();
sb.append(COOKIE_CLIENT_USER_NAME).append(COOKIE_KEY_VALUE_SEPARATOR).append(clientUserName)
.append(COOKIE_ATTR_SEPARATOR);
sb.append(COOKIE_CLIENT_RAND_NUMBER).append(COOKIE_KEY_VALUE_SEPARATOR)
.append((new Random(System.currentTimeMillis())).nextLong());
return sb.toString();
} | java | public static String createCookieToken(String clientUserName) {
StringBuffer sb = new StringBuffer();
sb.append(COOKIE_CLIENT_USER_NAME).append(COOKIE_KEY_VALUE_SEPARATOR).append(clientUserName)
.append(COOKIE_ATTR_SEPARATOR);
sb.append(COOKIE_CLIENT_RAND_NUMBER).append(COOKIE_KEY_VALUE_SEPARATOR)
.append((new Random(System.currentTimeMillis())).nextLong());
return sb.toString();
} | [
"public",
"static",
"String",
"createCookieToken",
"(",
"String",
"clientUserName",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"sb",
".",
"append",
"(",
"COOKIE_CLIENT_USER_NAME",
")",
".",
"append",
"(",
"COOKIE_KEY_VALUE_SEPARATOR... | Creates and returns a HS2 cookie token.
@param clientUserName Client User name.
@return An unsigned cookie token generated from input parameters.
The final cookie generated is of the following format :
{@code cu=<username>&rn=<randomNumber>&s=<cookieSignature>} | [
"Creates",
"and",
"returns",
"a",
"HS2",
"cookie",
"token",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java#L94-L101 | train | Create a cookie token from the client user name and random number | [
30522,
2270,
10763,
5164,
3443,
3597,
23212,
18903,
7520,
1006,
5164,
7396,
20330,
18442,
1007,
1063,
5164,
8569,
12494,
24829,
1027,
2047,
5164,
8569,
12494,
1006,
1007,
1025,
24829,
1012,
10439,
10497,
1006,
17387,
1035,
7396,
1035,
5310,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashTable.java | BinaryHashTable.putBuildRow | public void putBuildRow(BaseRow row) throws IOException {
final int hashCode = hash(this.buildSideProjection.apply(row).hashCode(), 0);
// TODO: combine key projection and build side conversion to code gen.
insertIntoTable(originBuildSideSerializer.baseRowToBinary(row), hashCode);
} | java | public void putBuildRow(BaseRow row) throws IOException {
final int hashCode = hash(this.buildSideProjection.apply(row).hashCode(), 0);
// TODO: combine key projection and build side conversion to code gen.
insertIntoTable(originBuildSideSerializer.baseRowToBinary(row), hashCode);
} | [
"public",
"void",
"putBuildRow",
"(",
"BaseRow",
"row",
")",
"throws",
"IOException",
"{",
"final",
"int",
"hashCode",
"=",
"hash",
"(",
"this",
".",
"buildSideProjection",
".",
"apply",
"(",
"row",
")",
".",
"hashCode",
"(",
")",
",",
"0",
")",
";",
"... | Put a build side row to hash table. | [
"Put",
"a",
"build",
"side",
"row",
"to",
"hash",
"table",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashTable.java#L243-L247 | train | Put a build side row into the build side table. | [
30522,
2270,
11675,
2404,
8569,
4014,
22196,
2860,
1006,
2918,
10524,
5216,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
20014,
23325,
16044,
1027,
23325,
1006,
2023,
1012,
16473,
5178,
21572,
20614,
3258,
1012,
6611,
1006,
5216,
1007,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java | ReflectUtil.getMethod | public static Method getMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException {
return getMethod(clazz, false, methodName, paramTypes);
} | java | public static Method getMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException {
return getMethod(clazz, false, methodName, paramTypes);
} | [
"public",
"static",
"Method",
"getMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"paramTypes",
")",
"throws",
"SecurityException",
"{",
"return",
"getMethod",
"(",
"clazz",
",",
"false",
",",... | 查找指定方法 如果找不到对应的方法则返回<code>null</code>
<p>
此方法为精准获取方法名,即方法名和参数数量和类型必须一致,否则返回<code>null</code>。
</p>
@param clazz 类,如果为{@code null}返回{@code null}
@param methodName 方法名,如果为空字符串返回{@code null}
@param paramTypes 参数类型,指定参数类型如果是方法的子类也算
@return 方法
@throws SecurityException 无权访问抛出异常 | [
"查找指定方法",
"如果找不到对应的方法则返回<code",
">",
"null<",
"/",
"code",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L431-L433 | train | Get a Method object for the given class with the given name and parameter types. | [
30522,
2270,
10763,
4118,
2131,
11368,
6806,
2094,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
5164,
4118,
18442,
1010,
2465,
1026,
1029,
1028,
1012,
1012,
1012,
11498,
20492,
18863,
2015,
1007,
11618,
3036,
10288,
24422,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java | ExternalShuffleBlockResolver.deleteExecutorDirs | private void deleteExecutorDirs(String[] dirs) {
for (String localDir : dirs) {
try {
JavaUtils.deleteRecursively(new File(localDir));
logger.debug("Successfully cleaned up directory: {}", localDir);
} catch (Exception e) {
logger.error("Failed to delete directory: " + localDir, e);
}
}
} | java | private void deleteExecutorDirs(String[] dirs) {
for (String localDir : dirs) {
try {
JavaUtils.deleteRecursively(new File(localDir));
logger.debug("Successfully cleaned up directory: {}", localDir);
} catch (Exception e) {
logger.error("Failed to delete directory: " + localDir, e);
}
}
} | [
"private",
"void",
"deleteExecutorDirs",
"(",
"String",
"[",
"]",
"dirs",
")",
"{",
"for",
"(",
"String",
"localDir",
":",
"dirs",
")",
"{",
"try",
"{",
"JavaUtils",
".",
"deleteRecursively",
"(",
"new",
"File",
"(",
"localDir",
")",
")",
";",
"logger",
... | Synchronously deletes each directory one at a time.
Should be executed in its own thread, as this may take a long time. | [
"Synchronously",
"deletes",
"each",
"directory",
"one",
"at",
"a",
"time",
".",
"Should",
"be",
"executed",
"in",
"its",
"own",
"thread",
"as",
"this",
"may",
"take",
"a",
"long",
"time",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java#L243-L252 | train | Delete all the directories in the executor directory. | [
30522,
2797,
11675,
3972,
12870,
10288,
8586,
16161,
17080,
2869,
1006,
5164,
1031,
1033,
16101,
2015,
1007,
1063,
2005,
1006,
5164,
2334,
4305,
2099,
1024,
16101,
2015,
1007,
1063,
3046,
1063,
9262,
21823,
4877,
1012,
3972,
15141,
8586,
92... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/savepoint/SavepointV2Serializer.java | SavepointV2Serializer.extractSingleton | private static <T> T extractSingleton(Collection<T> collection) {
if (collection == null || collection.isEmpty()) {
return null;
}
if (collection.size() == 1) {
return collection.iterator().next();
} else {
throw new IllegalStateException("Expected singleton collection, but found size: " + collection.size());
}
} | java | private static <T> T extractSingleton(Collection<T> collection) {
if (collection == null || collection.isEmpty()) {
return null;
}
if (collection.size() == 1) {
return collection.iterator().next();
} else {
throw new IllegalStateException("Expected singleton collection, but found size: " + collection.size());
}
} | [
"private",
"static",
"<",
"T",
">",
"T",
"extractSingleton",
"(",
"Collection",
"<",
"T",
">",
"collection",
")",
"{",
"if",
"(",
"collection",
"==",
"null",
"||",
"collection",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/savepoint/SavepointV2Serializer.java#L249-L259 | train | Extract singleton object from collection. | [
30522,
2797,
10763,
1026,
1056,
1028,
1056,
27059,
2075,
19263,
1006,
3074,
1026,
1056,
1028,
3074,
1007,
1063,
2065,
1006,
3074,
1027,
1027,
19701,
1064,
1064,
3074,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1007,
1063,
2709,
19701,
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/io/IoUtil.java | IoUtil.copy | public static long copy(Reader reader, Writer writer) throws IORuntimeException {
return copy(reader, writer, DEFAULT_BUFFER_SIZE);
} | java | public static long copy(Reader reader, Writer writer) throws IORuntimeException {
return copy(reader, writer, DEFAULT_BUFFER_SIZE);
} | [
"public",
"static",
"long",
"copy",
"(",
"Reader",
"reader",
",",
"Writer",
"writer",
")",
"throws",
"IORuntimeException",
"{",
"return",
"copy",
"(",
"reader",
",",
"writer",
",",
"DEFAULT_BUFFER_SIZE",
")",
";",
"}"
] | 将Reader中的内容复制到Writer中 使用默认缓存大小
@param reader Reader
@param writer Writer
@return 拷贝的字节数
@throws IORuntimeException IO异常 | [
"将Reader中的内容复制到Writer中",
"使用默认缓存大小"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L73-L75 | train | Copy the contents of the reader to the writer using the default buffer size. | [
30522,
2270,
10763,
2146,
6100,
1006,
8068,
8068,
1010,
3213,
3213,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
6100,
1006,
8068,
1010,
3213,
1010,
12398,
1035,
17698,
1035,
2946,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.copy | public void copy(int srcIdx, byte[] dst, int dstIdx, int length) {
if (isOutOfBounds(srcIdx, length, length())) {
throw new IndexOutOfBoundsException("expected: " + "0 <= srcIdx(" + srcIdx + ") <= srcIdx + length("
+ length + ") <= srcLen(" + length() + ')');
}
System.arraycopy(value, srcIdx + offset, checkNotNull(dst, "dst"), dstIdx, length);
} | java | public void copy(int srcIdx, byte[] dst, int dstIdx, int length) {
if (isOutOfBounds(srcIdx, length, length())) {
throw new IndexOutOfBoundsException("expected: " + "0 <= srcIdx(" + srcIdx + ") <= srcIdx + length("
+ length + ") <= srcLen(" + length() + ')');
}
System.arraycopy(value, srcIdx + offset, checkNotNull(dst, "dst"), dstIdx, length);
} | [
"public",
"void",
"copy",
"(",
"int",
"srcIdx",
",",
"byte",
"[",
"]",
"dst",
",",
"int",
"dstIdx",
",",
"int",
"length",
")",
"{",
"if",
"(",
"isOutOfBounds",
"(",
"srcIdx",
",",
"length",
",",
"length",
"(",
")",
")",
")",
"{",
"throw",
"new",
... | Copies the content of this string to a byte array.
@param srcIdx the starting offset of characters to copy.
@param dst the destination byte array.
@param dstIdx the starting offset in the destination byte array.
@param length the number of characters to copy. | [
"Copies",
"the",
"content",
"of",
"this",
"string",
"to",
"a",
"byte",
"array",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L410-L417 | train | Copy the contents of this array into the specified byte array. | [
30522,
2270,
11675,
6100,
1006,
20014,
5034,
6895,
2094,
2595,
1010,
24880,
1031,
1033,
16233,
2102,
1010,
20014,
16233,
3775,
2094,
2595,
1010,
20014,
3091,
1007,
1063,
2065,
1006,
11163,
16161,
26337,
28819,
2015,
1006,
5034,
6895,
2094,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/IterUtil.java | IterUtil.hasNull | public static boolean hasNull(Iterator<?> iter) {
if (null == iter) {
return true;
}
while (iter.hasNext()) {
if (null == iter.next()) {
return true;
}
}
return false;
} | java | public static boolean hasNull(Iterator<?> iter) {
if (null == iter) {
return true;
}
while (iter.hasNext()) {
if (null == iter.next()) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"hasNull",
"(",
"Iterator",
"<",
"?",
">",
"iter",
")",
"{",
"if",
"(",
"null",
"==",
"iter",
")",
"{",
"return",
"true",
";",
"}",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"if",
"(",
"null",
"==",
... | 是否包含{@code null}元素
@param iter 被检查的{@link Iterator}对象,如果为{@code null} 返回false
@return 是否包含{@code null}元素 | [
"是否包含",
"{",
"@code",
"null",
"}",
"元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L80-L91 | train | Returns true if the iterator is null. | [
30522,
2270,
10763,
22017,
20898,
8440,
18083,
1006,
2009,
6906,
4263,
1026,
1029,
1028,
2009,
2121,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
2009,
2121,
1007,
1063,
2709,
2995,
1025,
1065,
2096,
1006,
2009,
2121,
1012,
8440,
10288,
2102,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/JSONObject.java | JSONObject.accumulate | public JSONObject accumulate(String name, Object value) throws JSONException {
Object current = this.nameValuePairs.get(checkName(name));
if (current == null) {
return put(name, value);
}
// check in accumulate, since array.put(Object) doesn't do any checking
if (value instanceof Number) {
JSON.checkDouble(((Number) value).doubleValue());
}
if (current instanceof JSONArray) {
JSONArray array = (JSONArray) current;
array.put(value);
}
else {
JSONArray array = new JSONArray();
array.put(current);
array.put(value);
this.nameValuePairs.put(name, array);
}
return this;
} | java | public JSONObject accumulate(String name, Object value) throws JSONException {
Object current = this.nameValuePairs.get(checkName(name));
if (current == null) {
return put(name, value);
}
// check in accumulate, since array.put(Object) doesn't do any checking
if (value instanceof Number) {
JSON.checkDouble(((Number) value).doubleValue());
}
if (current instanceof JSONArray) {
JSONArray array = (JSONArray) current;
array.put(value);
}
else {
JSONArray array = new JSONArray();
array.put(current);
array.put(value);
this.nameValuePairs.put(name, array);
}
return this;
} | [
"public",
"JSONObject",
"accumulate",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"throws",
"JSONException",
"{",
"Object",
"current",
"=",
"this",
".",
"nameValuePairs",
".",
"get",
"(",
"checkName",
"(",
"name",
")",
")",
";",
"if",
"(",
"current... | Appends {@code value} to the array already mapped to {@code name}. If this object
has no mapping for {@code name}, this inserts a new mapping. If the mapping exists
but its value is not an array, the existing and new values are inserted in order
into a new array which is itself mapped to {@code name}. In aggregate, this allows
values to be added to a mapping one at a time.
@param name the name of the property
@param value a {@link JSONObject}, {@link JSONArray}, String, Boolean, Integer,
Long, Double, {@link #NULL} or null. May not be {@link Double#isNaN() NaNs} or
{@link Double#isInfinite() infinities}.
@return this object.
@throws JSONException if an error occurs | [
"Appends",
"{"
] | 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/JSONObject.java#L304-L326 | train | Accumulate a name - value pair into this object. | [
30522,
2270,
1046,
3385,
16429,
20614,
27598,
1006,
5164,
2171,
1010,
4874,
3643,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
4874,
2783,
1027,
2023,
1012,
2171,
10175,
5657,
4502,
18894,
1012,
2131,
1006,
4638,
18442,
1006,
2171,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java | WatchUtil.createAll | public static WatchMonitor createAll(URI uri, int maxDepth, Watcher watcher) {
return createAll(Paths.get(uri), maxDepth, watcher);
} | java | public static WatchMonitor createAll(URI uri, int maxDepth, Watcher watcher) {
return createAll(Paths.get(uri), maxDepth, watcher);
} | [
"public",
"static",
"WatchMonitor",
"createAll",
"(",
"URI",
"uri",
",",
"int",
"maxDepth",
",",
"Watcher",
"watcher",
")",
"{",
"return",
"createAll",
"(",
"Paths",
".",
"get",
"(",
"uri",
")",
",",
"maxDepth",
",",
"watcher",
")",
";",
"}"
] | 创建并初始化监听,监听所有事件
@param uri URI
@param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录
@param watcher {@link Watcher}
@return {@link WatchMonitor} | [
"创建并初始化监听,监听所有事件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java#L178-L180 | train | Creates a WatchMonitor for the given URI and max depth. | [
30522,
2270,
10763,
3422,
8202,
15660,
3443,
8095,
1006,
24471,
2072,
24471,
2072,
1010,
20014,
4098,
3207,
13876,
2232,
1010,
3422,
2121,
3422,
2121,
1007,
1063,
2709,
3443,
8095,
1006,
10425,
1012,
2131,
1006,
24471,
2072,
1007,
1010,
409... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java | ColumnVector.getInterval | public final CalendarInterval getInterval(int rowId) {
if (isNullAt(rowId)) return null;
final int months = getChild(0).getInt(rowId);
final long microseconds = getChild(1).getLong(rowId);
return new CalendarInterval(months, microseconds);
} | java | public final CalendarInterval getInterval(int rowId) {
if (isNullAt(rowId)) return null;
final int months = getChild(0).getInt(rowId);
final long microseconds = getChild(1).getLong(rowId);
return new CalendarInterval(months, microseconds);
} | [
"public",
"final",
"CalendarInterval",
"getInterval",
"(",
"int",
"rowId",
")",
"{",
"if",
"(",
"isNullAt",
"(",
"rowId",
")",
")",
"return",
"null",
";",
"final",
"int",
"months",
"=",
"getChild",
"(",
"0",
")",
".",
"getInt",
"(",
"rowId",
")",
";",
... | Returns the calendar interval type value for rowId. If the slot for rowId is null, it should
return null.
In Spark, calendar interval type value is basically an integer value representing the number of
months in this interval, and a long value representing the number of microseconds in this
interval. An interval type vector is the same as a struct type vector with 2 fields: `months`
and `microseconds`.
To support interval type, implementations must implement {@link #getChild(int)} and define 2
child vectors: the first child vector is an int type vector, containing all the month values of
all the interval values in this vector. The second child vector is a long type vector,
containing all the microsecond values of all the interval values in this vector. | [
"Returns",
"the",
"calendar",
"interval",
"type",
"value",
"for",
"rowId",
".",
"If",
"the",
"slot",
"for",
"rowId",
"is",
"null",
"it",
"should",
"return",
"null",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L280-L285 | train | Gets the calendar interval. | [
30522,
2270,
2345,
8094,
18447,
2121,
10175,
2131,
18447,
2121,
10175,
1006,
20014,
5216,
3593,
1007,
1063,
2065,
1006,
3475,
22187,
2102,
1006,
5216,
3593,
1007,
1007,
2709,
19701,
1025,
2345,
20014,
2706,
1027,
2131,
19339,
1006,
1014,
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/context/properties/source/MapConfigurationPropertySource.java | MapConfigurationPropertySource.put | public void put(Object name, Object value) {
this.source.put((name != null) ? name.toString() : null, value);
} | java | public void put(Object name, Object value) {
this.source.put((name != null) ? name.toString() : null, value);
} | [
"public",
"void",
"put",
"(",
"Object",
"name",
",",
"Object",
"value",
")",
"{",
"this",
".",
"source",
".",
"put",
"(",
"(",
"name",
"!=",
"null",
")",
"?",
"name",
".",
"toString",
"(",
")",
":",
"null",
",",
"value",
")",
";",
"}"
] | Add an individual entry.
@param name the name
@param value the value | [
"Add",
"an",
"individual",
"entry",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java#L77-L79 | train | Sets the value of the specified property. | [
30522,
2270,
11675,
2404,
1006,
4874,
2171,
1010,
4874,
3643,
1007,
1063,
2023,
1012,
3120,
1012,
2404,
1006,
1006,
2171,
999,
1027,
19701,
1007,
1029,
2171,
1012,
2000,
3367,
4892,
1006,
1007,
1024,
19701,
1010,
3643,
1007,
1025,
1065,
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-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/ShardConsumer.java | ShardConsumer.getShardIterator | protected String getShardIterator(SequenceNumber sequenceNumber) throws Exception {
if (isSentinelSequenceNumber(sequenceNumber)) {
return getShardIteratorForSentinel(sequenceNumber);
} else {
// we will be starting from an actual sequence number (due to restore from failure).
return getShardIteratorForRealSequenceNumber(sequenceNumber);
}
} | java | protected String getShardIterator(SequenceNumber sequenceNumber) throws Exception {
if (isSentinelSequenceNumber(sequenceNumber)) {
return getShardIteratorForSentinel(sequenceNumber);
} else {
// we will be starting from an actual sequence number (due to restore from failure).
return getShardIteratorForRealSequenceNumber(sequenceNumber);
}
} | [
"protected",
"String",
"getShardIterator",
"(",
"SequenceNumber",
"sequenceNumber",
")",
"throws",
"Exception",
"{",
"if",
"(",
"isSentinelSequenceNumber",
"(",
"sequenceNumber",
")",
")",
"{",
"return",
"getShardIteratorForSentinel",
"(",
"sequenceNumber",
")",
";",
... | Returns a shard iterator for the given {@link SequenceNumber}.
@return shard iterator
@throws Exception | [
"Returns",
"a",
"shard",
"iterator",
"for",
"the",
"given",
"{",
"@link",
"SequenceNumber",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/ShardConsumer.java#L148-L156 | train | Get the shard iterator for the given sequence number. | [
30522,
5123,
5164,
4152,
11783,
21646,
8844,
1006,
5537,
19172,
5677,
5537,
19172,
5677,
1007,
11618,
6453,
1063,
2065,
1006,
26354,
4765,
3170,
4877,
2063,
4226,
5897,
19172,
5677,
1006,
5537,
19172,
5677,
1007,
1007,
1063,
2709,
4152,
117... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HttpConversionUtil.java | HttpConversionUtil.toHttp2HeadersFilterTE | private static void toHttp2HeadersFilterTE(Entry<CharSequence, CharSequence> entry,
Http2Headers out) {
if (indexOf(entry.getValue(), ',', 0) == -1) {
if (contentEqualsIgnoreCase(trim(entry.getValue()), TRAILERS)) {
out.add(TE, TRAILERS);
}
} else {
List<CharSequence> teValues = unescapeCsvFields(entry.getValue());
for (CharSequence teValue : teValues) {
if (contentEqualsIgnoreCase(trim(teValue), TRAILERS)) {
out.add(TE, TRAILERS);
break;
}
}
}
} | java | private static void toHttp2HeadersFilterTE(Entry<CharSequence, CharSequence> entry,
Http2Headers out) {
if (indexOf(entry.getValue(), ',', 0) == -1) {
if (contentEqualsIgnoreCase(trim(entry.getValue()), TRAILERS)) {
out.add(TE, TRAILERS);
}
} else {
List<CharSequence> teValues = unescapeCsvFields(entry.getValue());
for (CharSequence teValue : teValues) {
if (contentEqualsIgnoreCase(trim(teValue), TRAILERS)) {
out.add(TE, TRAILERS);
break;
}
}
}
} | [
"private",
"static",
"void",
"toHttp2HeadersFilterTE",
"(",
"Entry",
"<",
"CharSequence",
",",
"CharSequence",
">",
"entry",
",",
"Http2Headers",
"out",
")",
"{",
"if",
"(",
"indexOf",
"(",
"entry",
".",
"getValue",
"(",
")",
",",
"'",
"'",
",",
"0",
")"... | Filter the {@link HttpHeaderNames#TE} header according to the
<a href="https://tools.ietf.org/html/rfc7540#section-8.1.2.2">special rules in the HTTP/2 RFC</a>.
@param entry An entry whose name is {@link HttpHeaderNames#TE}.
@param out the resulting HTTP/2 headers. | [
"Filter",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java#L459-L474 | train | toHttp2HeadersFilterTE Method. | [
30522,
2797,
10763,
11675,
2000,
11039,
25856,
2475,
4974,
2545,
8873,
21928,
2618,
1006,
4443,
1026,
25869,
3366,
4226,
5897,
1010,
25869,
3366,
4226,
5897,
1028,
4443,
1010,
8299,
2475,
4974,
2545,
2041,
1007,
1063,
2065,
1006,
5950,
1125... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/info/GitProperties.java | GitProperties.coerceToEpoch | private static String coerceToEpoch(String s) {
Long epoch = parseEpochSecond(s);
if (epoch != null) {
return String.valueOf(epoch);
}
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
try {
return String.valueOf(format.parse(s).getTime());
}
catch (ParseException ex) {
return s;
}
} | java | private static String coerceToEpoch(String s) {
Long epoch = parseEpochSecond(s);
if (epoch != null) {
return String.valueOf(epoch);
}
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
try {
return String.valueOf(format.parse(s).getTime());
}
catch (ParseException ex) {
return s;
}
} | [
"private",
"static",
"String",
"coerceToEpoch",
"(",
"String",
"s",
")",
"{",
"Long",
"epoch",
"=",
"parseEpochSecond",
"(",
"s",
")",
";",
"if",
"(",
"epoch",
"!=",
"null",
")",
"{",
"return",
"String",
".",
"valueOf",
"(",
"epoch",
")",
";",
"}",
"... | Attempt to convert the specified value to epoch time. Git properties information
are known to be specified either as epoch time in seconds or using a specific date
format.
@param s the value to coerce to
@return the epoch time in milliseconds or the original value if it couldn't be
converted | [
"Attempt",
"to",
"convert",
"the",
"specified",
"value",
"to",
"epoch",
"time",
".",
"Git",
"properties",
"information",
"are",
"known",
"to",
"be",
"specified",
"either",
"as",
"epoch",
"time",
"in",
"seconds",
"or",
"using",
"a",
"specific",
"date",
"forma... | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/info/GitProperties.java#L106-L118 | train | Coerces a string to an epoch. | [
30522,
2797,
10763,
5164,
24873,
19170,
3406,
13699,
11663,
1006,
5164,
1055,
1007,
1063,
2146,
25492,
1027,
11968,
19763,
6873,
18069,
8586,
15422,
1006,
1055,
1007,
1025,
2065,
1006,
25492,
999,
1027,
19701,
1007,
1063,
2709,
5164,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/misc/HighwayHash.java | HighwayHash.updatePacket | public void updatePacket(byte[] packet, int pos) {
if (pos < 0) {
throw new IllegalArgumentException(String.format("Pos (%s) must be positive", pos));
}
if (pos + 32 > packet.length) {
throw new IllegalArgumentException("packet must have at least 32 bytes after pos");
}
long a0 = read64(packet, pos + 0);
long a1 = read64(packet, pos + 8);
long a2 = read64(packet, pos + 16);
long a3 = read64(packet, pos + 24);
update(a0, a1, a2, a3);
} | java | public void updatePacket(byte[] packet, int pos) {
if (pos < 0) {
throw new IllegalArgumentException(String.format("Pos (%s) must be positive", pos));
}
if (pos + 32 > packet.length) {
throw new IllegalArgumentException("packet must have at least 32 bytes after pos");
}
long a0 = read64(packet, pos + 0);
long a1 = read64(packet, pos + 8);
long a2 = read64(packet, pos + 16);
long a3 = read64(packet, pos + 24);
update(a0, a1, a2, a3);
} | [
"public",
"void",
"updatePacket",
"(",
"byte",
"[",
"]",
"packet",
",",
"int",
"pos",
")",
"{",
"if",
"(",
"pos",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Pos (%s) must be positive\"",
",",
"pos"... | Updates the hash with 32 bytes of data. If you can read 4 long values
from your data efficiently, prefer using update() instead for more speed.
@param packet data array which has a length of at least pos + 32
@param pos position in the array to read the first of 32 bytes from | [
"Updates",
"the",
"hash",
"with",
"32",
"bytes",
"of",
"data",
".",
"If",
"you",
"can",
"read",
"4",
"long",
"values",
"from",
"your",
"data",
"efficiently",
"prefer",
"using",
"update",
"()",
"instead",
"for",
"more",
"speed",
"."
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/misc/HighwayHash.java#L56-L68 | train | Update the packet with the bytes in the packet. | [
30522,
2270,
11675,
10651,
23947,
3388,
1006,
24880,
1031,
1033,
14771,
1010,
20014,
13433,
2015,
1007,
1063,
2065,
1006,
13433,
2015,
1026,
1014,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
5164,
1012,
4289,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | resolver-dns/src/main/java/io/netty/resolver/dns/DnsAddressDecoder.java | DnsAddressDecoder.decodeAddress | static InetAddress decodeAddress(DnsRecord record, String name, boolean decodeIdn) {
if (!(record instanceof DnsRawRecord)) {
return null;
}
final ByteBuf content = ((ByteBufHolder) record).content();
final int contentLen = content.readableBytes();
if (contentLen != INADDRSZ4 && contentLen != INADDRSZ6) {
return null;
}
final byte[] addrBytes = new byte[contentLen];
content.getBytes(content.readerIndex(), addrBytes);
try {
return InetAddress.getByAddress(decodeIdn ? IDN.toUnicode(name) : name, addrBytes);
} catch (UnknownHostException e) {
// Should never reach here.
throw new Error(e);
}
} | java | static InetAddress decodeAddress(DnsRecord record, String name, boolean decodeIdn) {
if (!(record instanceof DnsRawRecord)) {
return null;
}
final ByteBuf content = ((ByteBufHolder) record).content();
final int contentLen = content.readableBytes();
if (contentLen != INADDRSZ4 && contentLen != INADDRSZ6) {
return null;
}
final byte[] addrBytes = new byte[contentLen];
content.getBytes(content.readerIndex(), addrBytes);
try {
return InetAddress.getByAddress(decodeIdn ? IDN.toUnicode(name) : name, addrBytes);
} catch (UnknownHostException e) {
// Should never reach here.
throw new Error(e);
}
} | [
"static",
"InetAddress",
"decodeAddress",
"(",
"DnsRecord",
"record",
",",
"String",
"name",
",",
"boolean",
"decodeIdn",
")",
"{",
"if",
"(",
"!",
"(",
"record",
"instanceof",
"DnsRawRecord",
")",
")",
"{",
"return",
"null",
";",
"}",
"final",
"ByteBuf",
... | Decodes an {@link InetAddress} from an A or AAAA {@link DnsRawRecord}.
@param record the {@link DnsRecord}, most likely a {@link DnsRawRecord}
@param name the host name of the decoded address
@param decodeIdn whether to convert {@code name} to a unicode host name
@return the {@link InetAddress}, or {@code null} if {@code record} is not a {@link DnsRawRecord} or
its content is malformed | [
"Decodes",
"an",
"{",
"@link",
"InetAddress",
"}",
"from",
"an",
"A",
"or",
"AAAA",
"{",
"@link",
"DnsRawRecord",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsAddressDecoder.java#L45-L64 | train | Decode an InetAddress from a DNS record. | [
30522,
10763,
1999,
12928,
14141,
8303,
21933,
3207,
4215,
16200,
4757,
1006,
1040,
3619,
2890,
27108,
2094,
2501,
1010,
5164,
2171,
1010,
22017,
20898,
21933,
3207,
3593,
2078,
1007,
1063,
2065,
1006,
999,
1006,
2501,
6013,
11253,
1040,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.getParams | public static Map<String, String[]> getParams(ServletRequest request) {
final Map<String, String[]> map = request.getParameterMap();
return Collections.unmodifiableMap(map);
} | java | public static Map<String, String[]> getParams(ServletRequest request) {
final Map<String, String[]> map = request.getParameterMap();
return Collections.unmodifiableMap(map);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"getParams",
"(",
"ServletRequest",
"request",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"map",
"=",
"request",
".",
"getParameterMap",
"(",
")",
";",
... | 获得所有请求参数
@param request 请求对象{@link ServletRequest}
@return Map | [
"获得所有请求参数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L62-L65 | train | Gets the parameters from the request. | [
30522,
2270,
10763,
4949,
1026,
30524,
5227,
1012,
2131,
28689,
22828,
2863,
2361,
1006,
1007,
1025,
2709,
6407,
1012,
4895,
5302,
4305,
22749,
3468,
2863,
2361,
1006,
4949,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/document/sentence/Sentence.java | Sentence.findWordsByLabel | public List<IWord> findWordsByLabel(String label)
{
List<IWord> wordList = new LinkedList<IWord>();
for (IWord word : this)
{
if (label.equals(word.getLabel()))
{
wordList.add(word);
}
}
return wordList;
} | java | public List<IWord> findWordsByLabel(String label)
{
List<IWord> wordList = new LinkedList<IWord>();
for (IWord word : this)
{
if (label.equals(word.getLabel()))
{
wordList.add(word);
}
}
return wordList;
} | [
"public",
"List",
"<",
"IWord",
">",
"findWordsByLabel",
"(",
"String",
"label",
")",
"{",
"List",
"<",
"IWord",
">",
"wordList",
"=",
"new",
"LinkedList",
"<",
"IWord",
">",
"(",
")",
";",
"for",
"(",
"IWord",
"word",
":",
"this",
")",
"{",
"if",
... | 找出所有词性为label的单词(不检查复合词内部的简单词)
@param label
@return | [
"找出所有词性为label的单词(不检查复合词内部的简单词)"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/document/sentence/Sentence.java#L326-L337 | train | Find words by label. | [
30522,
2270,
2862,
1026,
1045,
18351,
1028,
2424,
22104,
3762,
20470,
2884,
1006,
5164,
3830,
1007,
1063,
2862,
1026,
1045,
18351,
1028,
2773,
9863,
1027,
2047,
5799,
9863,
1026,
1045,
18351,
1028,
1006,
1007,
1025,
2005,
1006,
1045,
18351,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.deserializeHeader | public static MessageType deserializeHeader(final ByteBuf buf) {
// checking the version
int version = buf.readInt();
Preconditions.checkState(version == VERSION,
"Version Mismatch: Found " + version + ", Expected: " + VERSION + '.');
// fetching the message type
int msgType = buf.readInt();
MessageType[] values = MessageType.values();
Preconditions.checkState(msgType >= 0 && msgType < values.length,
"Illegal message type with index " + msgType + '.');
return values[msgType];
} | java | public static MessageType deserializeHeader(final ByteBuf buf) {
// checking the version
int version = buf.readInt();
Preconditions.checkState(version == VERSION,
"Version Mismatch: Found " + version + ", Expected: " + VERSION + '.');
// fetching the message type
int msgType = buf.readInt();
MessageType[] values = MessageType.values();
Preconditions.checkState(msgType >= 0 && msgType < values.length,
"Illegal message type with index " + msgType + '.');
return values[msgType];
} | [
"public",
"static",
"MessageType",
"deserializeHeader",
"(",
"final",
"ByteBuf",
"buf",
")",
"{",
"// checking the version",
"int",
"version",
"=",
"buf",
".",
"readInt",
"(",
")",
";",
"Preconditions",
".",
"checkState",
"(",
"version",
"==",
"VERSION",
",",
... | De-serializes the header and returns the {@link MessageType}.
<pre>
<b>The buffer is expected to be at the header position.</b>
</pre>
@param buf The {@link ByteBuf} containing the serialized header.
@return The message type.
@throws IllegalStateException If unexpected message version or message type. | [
"De",
"-",
"serializes",
"the",
"header",
"and",
"returns",
"the",
"{"
] | 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#L228-L241 | train | Deserialize the header of a message. | [
30522,
2270,
10763,
4471,
13874,
4078,
11610,
3669,
4371,
4974,
2121,
1006,
2345,
24880,
8569,
2546,
20934,
2546,
1007,
1063,
1013,
1013,
9361,
1996,
2544,
20014,
2544,
1027,
20934,
2546,
1012,
3191,
18447,
1006,
1007,
1025,
3653,
8663,
205... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/UnsafeRow.java | UnsafeRow.createFromByteArray | public static UnsafeRow createFromByteArray(int numBytes, int numFields) {
final UnsafeRow row = new UnsafeRow(numFields);
row.pointTo(new byte[numBytes], numBytes);
return row;
} | java | public static UnsafeRow createFromByteArray(int numBytes, int numFields) {
final UnsafeRow row = new UnsafeRow(numFields);
row.pointTo(new byte[numBytes], numBytes);
return row;
} | [
"public",
"static",
"UnsafeRow",
"createFromByteArray",
"(",
"int",
"numBytes",
",",
"int",
"numFields",
")",
"{",
"final",
"UnsafeRow",
"row",
"=",
"new",
"UnsafeRow",
"(",
"numFields",
")",
";",
"row",
".",
"pointTo",
"(",
"new",
"byte",
"[",
"numBytes",
... | Creates an empty UnsafeRow from a byte array with specified numBytes and numFields.
The returned row is invalid until we call copyFrom on it. | [
"Creates",
"an",
"empty",
"UnsafeRow",
"from",
"a",
"byte",
"array",
"with",
"specified",
"numBytes",
"and",
"numFields",
".",
"The",
"returned",
"row",
"is",
"invalid",
"until",
"we",
"call",
"copyFrom",
"on",
"it",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java#L475-L479 | train | Create a UnsafeRow from a byte array of bytes. | [
30522,
2270,
10763,
25135,
10524,
3443,
19699,
5358,
3762,
27058,
11335,
2100,
1006,
20014,
15903,
17250,
2015,
1010,
20014,
16371,
2213,
30524,
1006,
16371,
2213,
15155,
1007,
1025,
5216,
1012,
2391,
3406,
1006,
2047,
24880,
1031,
15903,
172... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Holder.java | Holder.of | public static <T> Holder<T> of(T value) throws NullPointerException{
if(null == value){
throw new NullPointerException("Holder can not hold a null value!");
}
return new Holder<>(value);
} | java | public static <T> Holder<T> of(T value) throws NullPointerException{
if(null == value){
throw new NullPointerException("Holder can not hold a null value!");
}
return new Holder<>(value);
} | [
"public",
"static",
"<",
"T",
">",
"Holder",
"<",
"T",
">",
"of",
"(",
"T",
"value",
")",
"throws",
"NullPointerException",
"{",
"if",
"(",
"null",
"==",
"value",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Holder can not hold a null value!\"",
... | 新建Holder类,持有指定值,当值为空时抛出空指针异常
@param <T> 被持有的对象类型
@param value 值,不能为空
@return Holder | [
"新建Holder类,持有指定值,当值为空时抛出空指针异常"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Holder.java#L21-L26 | train | Creates a new holder instance with the specified value. | [
30522,
2270,
10763,
1026,
1056,
1028,
9111,
1026,
1056,
1028,
1997,
1006,
1056,
3643,
1007,
11618,
19701,
8400,
7869,
2595,
24422,
1063,
2065,
1006,
19701,
1027,
1027,
3643,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/StringUtil.java | StringUtil.unescapeCsvFields | public static List<CharSequence> unescapeCsvFields(CharSequence value) {
List<CharSequence> unescaped = new ArrayList<CharSequence>(2);
StringBuilder current = InternalThreadLocalMap.get().stringBuilder();
boolean quoted = false;
int last = value.length() - 1;
for (int i = 0; i <= last; i++) {
char c = value.charAt(i);
if (quoted) {
switch (c) {
case DOUBLE_QUOTE:
if (i == last) {
// Add the last field and return
unescaped.add(current.toString());
return unescaped;
}
char next = value.charAt(++i);
if (next == DOUBLE_QUOTE) {
// 2 double-quotes should be unescaped to one
current.append(DOUBLE_QUOTE);
break;
}
if (next == COMMA) {
// This is the end of a field. Let's start to parse the next field.
quoted = false;
unescaped.add(current.toString());
current.setLength(0);
break;
}
// double-quote followed by other character is invalid
throw newInvalidEscapedCsvFieldException(value, i - 1);
default:
current.append(c);
}
} else {
switch (c) {
case COMMA:
// Start to parse the next field
unescaped.add(current.toString());
current.setLength(0);
break;
case DOUBLE_QUOTE:
if (current.length() == 0) {
quoted = true;
break;
}
// double-quote appears without being enclosed with double-quotes
// fall through
case LINE_FEED:
// fall through
case CARRIAGE_RETURN:
// special characters appears without being enclosed with double-quotes
throw newInvalidEscapedCsvFieldException(value, i);
default:
current.append(c);
}
}
}
if (quoted) {
throw newInvalidEscapedCsvFieldException(value, last);
}
unescaped.add(current.toString());
return unescaped;
} | java | public static List<CharSequence> unescapeCsvFields(CharSequence value) {
List<CharSequence> unescaped = new ArrayList<CharSequence>(2);
StringBuilder current = InternalThreadLocalMap.get().stringBuilder();
boolean quoted = false;
int last = value.length() - 1;
for (int i = 0; i <= last; i++) {
char c = value.charAt(i);
if (quoted) {
switch (c) {
case DOUBLE_QUOTE:
if (i == last) {
// Add the last field and return
unescaped.add(current.toString());
return unescaped;
}
char next = value.charAt(++i);
if (next == DOUBLE_QUOTE) {
// 2 double-quotes should be unescaped to one
current.append(DOUBLE_QUOTE);
break;
}
if (next == COMMA) {
// This is the end of a field. Let's start to parse the next field.
quoted = false;
unescaped.add(current.toString());
current.setLength(0);
break;
}
// double-quote followed by other character is invalid
throw newInvalidEscapedCsvFieldException(value, i - 1);
default:
current.append(c);
}
} else {
switch (c) {
case COMMA:
// Start to parse the next field
unescaped.add(current.toString());
current.setLength(0);
break;
case DOUBLE_QUOTE:
if (current.length() == 0) {
quoted = true;
break;
}
// double-quote appears without being enclosed with double-quotes
// fall through
case LINE_FEED:
// fall through
case CARRIAGE_RETURN:
// special characters appears without being enclosed with double-quotes
throw newInvalidEscapedCsvFieldException(value, i);
default:
current.append(c);
}
}
}
if (quoted) {
throw newInvalidEscapedCsvFieldException(value, last);
}
unescaped.add(current.toString());
return unescaped;
} | [
"public",
"static",
"List",
"<",
"CharSequence",
">",
"unescapeCsvFields",
"(",
"CharSequence",
"value",
")",
"{",
"List",
"<",
"CharSequence",
">",
"unescaped",
"=",
"new",
"ArrayList",
"<",
"CharSequence",
">",
"(",
"2",
")",
";",
"StringBuilder",
"current",... | Unescapes the specified escaped CSV fields according to
<a href="https://tools.ietf.org/html/rfc4180#section-2">RFC-4180</a>.
@param value A string with multiple CSV escaped fields which will be unescaped according to
<a href="https://tools.ietf.org/html/rfc4180#section-2">RFC-4180</a>
@return {@link List} the list of unescaped fields | [
"Unescapes",
"the",
"specified",
"escaped",
"CSV",
"fields",
"according",
"to",
"<a",
"href",
"=",
"https",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc4180#section",
"-",
"2",
">",
"RFC",
"-",
"4180<",
"/",
"a",
">",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L437-L499 | train | Unescapes the CSV fields in the specified value. | [
30522,
2270,
10763,
2862,
1026,
25869,
3366,
4226,
5897,
1028,
16655,
15782,
5051,
6169,
2615,
15155,
1006,
25869,
3366,
4226,
5897,
3643,
1007,
1063,
2862,
1026,
25869,
3366,
4226,
5897,
1028,
16655,
15782,
5669,
1027,
2047,
9140,
9863,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.getType | public TypeInformation<T> getType() {
if (type instanceof MissingTypeInfo) {
MissingTypeInfo typeInfo = (MissingTypeInfo) type;
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.type;
} | java | public TypeInformation<T> getType() {
if (type instanceof MissingTypeInfo) {
MissingTypeInfo typeInfo = (MissingTypeInfo) type;
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.type;
} | [
"public",
"TypeInformation",
"<",
"T",
">",
"getType",
"(",
")",
"{",
"if",
"(",
"type",
"instanceof",
"MissingTypeInfo",
")",
"{",
"MissingTypeInfo",
"typeInfo",
"=",
"(",
"MissingTypeInfo",
")",
"type",
";",
"throw",
"new",
"InvalidTypesException",
"(",
"\"T... | Returns the {@link TypeInformation} for the type of this DataSet.
@return The TypeInformation for the type of this DataSet.
@see TypeInformation | [
"Returns",
"the",
"{",
"@link",
"TypeInformation",
"}",
"for",
"the",
"type",
"of",
"this",
"DataSet",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L171-L182 | train | Returns the type of the result of the transformation. | [
30522,
2270,
2828,
2378,
14192,
3370,
1026,
1056,
1028,
2131,
13874,
1006,
1007,
1063,
2065,
1006,
2828,
6013,
11253,
4394,
13874,
2378,
14876,
1007,
1063,
4394,
13874,
2378,
14876,
2828,
2378,
14876,
1027,
1006,
4394,
13874,
2378,
14876,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/Actions.java | Actions.release | public Actions release() {
if (isBuildingActions()) {
action.addAction(new ButtonReleaseAction(jsonMouse, null));
}
return tick(defaultMouse.createPointerUp(Button.LEFT.asArg()));
} | java | public Actions release() {
if (isBuildingActions()) {
action.addAction(new ButtonReleaseAction(jsonMouse, null));
}
return tick(defaultMouse.createPointerUp(Button.LEFT.asArg()));
} | [
"public",
"Actions",
"release",
"(",
")",
"{",
"if",
"(",
"isBuildingActions",
"(",
")",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"ButtonReleaseAction",
"(",
"jsonMouse",
",",
"null",
")",
")",
";",
"}",
"return",
"tick",
"(",
"defaultMouse",
".... | Releases the depressed left mouse button at the current mouse location.
@see #release(org.openqa.selenium.WebElement)
@return A self reference. | [
"Releases",
"the",
"depressed",
"left",
"mouse",
"button",
"at",
"the",
"current",
"mouse",
"location",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L276-L282 | train | Release the mouse. | [
30522,
2270,
4506,
2713,
1006,
1007,
1063,
2065,
1006,
2003,
25820,
18908,
8496,
1006,
1007,
1007,
1063,
2895,
1012,
5587,
18908,
3258,
1006,
2047,
6462,
16570,
19500,
18908,
3258,
1006,
1046,
3385,
27711,
2063,
1010,
19701,
1007,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
redisson/redisson | redisson/src/main/java/org/redisson/cache/AbstractCacheMap.java | AbstractCacheMap.containsValue | @Override
public boolean containsValue(Object value) {
if (value == null) {
throw new NullPointerException();
}
for (Map.Entry<K, CachedValue<K, V>> entry : map.entrySet()) {
CachedValue<K, V> cachedValue = entry.getValue();
if (cachedValue.getValue().equals(value)) {
if (isValueExpired(cachedValue)) {
if (map.remove(cachedValue.getKey(), cachedValue)) {
onValueRemove(cachedValue);
}
} else {
readValue(cachedValue);
return true;
}
}
}
return false;
} | java | @Override
public boolean containsValue(Object value) {
if (value == null) {
throw new NullPointerException();
}
for (Map.Entry<K, CachedValue<K, V>> entry : map.entrySet()) {
CachedValue<K, V> cachedValue = entry.getValue();
if (cachedValue.getValue().equals(value)) {
if (isValueExpired(cachedValue)) {
if (map.remove(cachedValue.getKey(), cachedValue)) {
onValueRemove(cachedValue);
}
} else {
readValue(cachedValue);
return true;
}
}
}
return false;
} | [
"@",
"Override",
"public",
"boolean",
"containsValue",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"for",
"(",
"Map",
".",
"Entry",
"<",
"K",
",",
"CachedValu... | /*
(non-Javadoc)
@see java.util.Map#containsValue(java.lang.Object) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/cache/AbstractCacheMap.java#L121-L141 | train | Check if the value is contained in the cache. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
3397,
10175,
5657,
1006,
4874,
3643,
1007,
1063,
2065,
1006,
3643,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1007,
1025,
1065,
2005,
1006,
4949,
1012,
4443... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java | VelocityUtil.init | public static void init(String templateDir, String charset, Map<String, Object> initedGlobalContext) {
globalContext.putAll(initedGlobalContext);
init(templateDir, charset);
} | java | public static void init(String templateDir, String charset, Map<String, Object> initedGlobalContext) {
globalContext.putAll(initedGlobalContext);
init(templateDir, charset);
} | [
"public",
"static",
"void",
"init",
"(",
"String",
"templateDir",
",",
"String",
"charset",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"initedGlobalContext",
")",
"{",
"globalContext",
".",
"putAll",
"(",
"initedGlobalContext",
")",
";",
"init",
"(",
"te... | 初始化全局属性
@param templateDir 模板目录
@param charset 字符集编码
@param initedGlobalContext 初始的全局上下文 | [
"初始化全局属性"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L69-L72 | train | Initializes the application with the given template directory and charset. | [
30522,
2270,
10763,
11675,
1999,
4183,
1006,
5164,
23561,
4305,
2099,
1010,
5164,
25869,
13462,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
1999,
17572,
23296,
16429,
2389,
8663,
18209,
1007,
1063,
3795,
8663,
18209,
1012,
2404,
8095,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/web/servlet/console/DefaultProxyHtmlRenderer.java | DefaultProxyHtmlRenderer.getSingleSlotHtml | private String getSingleSlotHtml(TestSlot s, String icon) {
StringBuilder builder = new StringBuilder();
TestSession session = s.getSession();
if (icon != null) {
builder.append("<img ");
builder.append("src='").append(icon).append("' width='16' height='16'");
} else {
builder.append("<a href='#' ");
}
if (session != null) {
builder.append(" class='busy' ");
builder.append(" title='").append(session.get("lastCommand")).append("' ");
} else {
builder.append(" title='").append(s.getCapabilities()).append("'");
}
if (icon != null) {
builder.append(" />\n");
} else {
builder.append(">");
builder.append(s.getCapabilities().get(CapabilityType.BROWSER_NAME));
builder.append("</a>");
}
return builder.toString();
} | java | private String getSingleSlotHtml(TestSlot s, String icon) {
StringBuilder builder = new StringBuilder();
TestSession session = s.getSession();
if (icon != null) {
builder.append("<img ");
builder.append("src='").append(icon).append("' width='16' height='16'");
} else {
builder.append("<a href='#' ");
}
if (session != null) {
builder.append(" class='busy' ");
builder.append(" title='").append(session.get("lastCommand")).append("' ");
} else {
builder.append(" title='").append(s.getCapabilities()).append("'");
}
if (icon != null) {
builder.append(" />\n");
} else {
builder.append(">");
builder.append(s.getCapabilities().get(CapabilityType.BROWSER_NAME));
builder.append("</a>");
}
return builder.toString();
} | [
"private",
"String",
"getSingleSlotHtml",
"(",
"TestSlot",
"s",
",",
"String",
"icon",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"TestSession",
"session",
"=",
"s",
".",
"getSession",
"(",
")",
";",
"if",
"(",
"icon"... | icon ( or generic html if icon not available ) | [
"icon",
"(",
"or",
"generic",
"html",
"if",
"icon",
"not",
"available",
")"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/web/servlet/console/DefaultProxyHtmlRenderer.java#L144-L169 | train | Get single slot html. | [
30522,
2797,
5164,
4152,
2075,
4244,
10994,
11039,
19968,
1006,
5852,
10994,
1055,
1010,
5164,
12696,
1007,
1063,
5164,
8569,
23891,
2099,
12508,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
1007,
1025,
5852,
7971,
3258,
5219,
1027,
1055,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java | ReUtil.findAllGroup1 | public static List<String> findAllGroup1(String regex, CharSequence content) {
return findAll(regex, content, 1);
} | java | public static List<String> findAllGroup1(String regex, CharSequence content) {
return findAll(regex, content, 1);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"findAllGroup1",
"(",
"String",
"regex",
",",
"CharSequence",
"content",
")",
"{",
"return",
"findAll",
"(",
"regex",
",",
"content",
",",
"1",
")",
";",
"}"
] | 取得内容中匹配的所有结果,获得匹配的所有结果中正则对应分组1的内容
@param regex 正则
@param content 被查找的内容
@return 结果列表
@since 3.1.2 | [
"取得内容中匹配的所有结果,获得匹配的所有结果中正则对应分组1的内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L375-L377 | train | Finds all groups of the given regex in the given content. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
2424,
8095,
17058,
2487,
1006,
5164,
19723,
10288,
1010,
25869,
3366,
4226,
5897,
4180,
1007,
1063,
2709,
2424,
8095,
1006,
19723,
10288,
1010,
4180,
1010,
1015,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/TwoPhaseCommitSinkFunction.java | TwoPhaseCommitSinkFunction.enableTransactionTimeoutWarnings | protected TwoPhaseCommitSinkFunction<IN, TXN, CONTEXT> enableTransactionTimeoutWarnings(
double warningRatio) {
checkArgument(warningRatio >= 0 && warningRatio <= 1,
"warningRatio must be in range [0,1]");
this.transactionTimeoutWarningRatio = warningRatio;
return this;
} | java | protected TwoPhaseCommitSinkFunction<IN, TXN, CONTEXT> enableTransactionTimeoutWarnings(
double warningRatio) {
checkArgument(warningRatio >= 0 && warningRatio <= 1,
"warningRatio must be in range [0,1]");
this.transactionTimeoutWarningRatio = warningRatio;
return this;
} | [
"protected",
"TwoPhaseCommitSinkFunction",
"<",
"IN",
",",
"TXN",
",",
"CONTEXT",
">",
"enableTransactionTimeoutWarnings",
"(",
"double",
"warningRatio",
")",
"{",
"checkArgument",
"(",
"warningRatio",
">=",
"0",
"&&",
"warningRatio",
"<=",
"1",
",",
"\"warningRatio... | Enables logging of warnings if a transaction's elapsed time reaches a specified ratio of
the <code>transactionTimeout</code>.
If <code>warningRatio</code> is 0, a warning will be always logged when committing the
transaction.
@param warningRatio A value in the range [0,1].
@return | [
"Enables",
"logging",
"of",
"warnings",
"if",
"a",
"transaction",
"s",
"elapsed",
"time",
"reaches",
"a",
"specified",
"ratio",
"of",
"the",
"<code",
">",
"transactionTimeout<",
"/",
"code",
">",
".",
"If",
"<code",
">",
"warningRatio<",
"/",
"code",
">",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/TwoPhaseCommitSinkFunction.java#L463-L469 | train | Enables the transaction timeout warnings. | [
30522,
5123,
2048,
21890,
3366,
9006,
22930,
11493,
2243,
11263,
27989,
1026,
1999,
1010,
19067,
2078,
1010,
6123,
1028,
9585,
6494,
3619,
18908,
3258,
7292,
5833,
9028,
5582,
2015,
1006,
3313,
5432,
8609,
3695,
1007,
1063,
4638,
2906,
2285... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | metrics/src/main/java/io/dropwizard/metrics/UniformReservoir.java | UniformReservoir.nextLong | @SuppressWarnings("NumericOverflow")
private static long nextLong(long n) {
long bits, val;
do {
bits = ThreadLocalRandom.current().nextLong() & (~(1L << BITS_PER_LONG));
val = bits % n;
} while (bits - val + (n - 1) < 0L);
return val;
} | java | @SuppressWarnings("NumericOverflow")
private static long nextLong(long n) {
long bits, val;
do {
bits = ThreadLocalRandom.current().nextLong() & (~(1L << BITS_PER_LONG));
val = bits % n;
} while (bits - val + (n - 1) < 0L);
return val;
} | [
"@",
"SuppressWarnings",
"(",
"\"NumericOverflow\"",
")",
"private",
"static",
"long",
"nextLong",
"(",
"long",
"n",
")",
"{",
"long",
"bits",
",",
"val",
";",
"do",
"{",
"bits",
"=",
"ThreadLocalRandom",
".",
"current",
"(",
")",
".",
"nextLong",
"(",
"... | Get a pseudo-random long uniformly between 0 and n-1. Stolen from
{@link java.util.Random#nextInt()}.
@param n the bound
@return a value select randomly from the range {@code [0..n)}. | [
"Get",
"a",
"pseudo",
"-",
"random",
"long",
"uniformly",
"between",
"0",
"and",
"n",
"-",
"1",
".",
"Stolen",
"from",
"{",
"@link",
"java",
".",
"util",
".",
"Random#nextInt",
"()",
"}",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/UniformReservoir.java#L85-L93 | train | Returns the next n - 1 long. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
16371,
25531,
7840,
12314,
1000,
1007,
2797,
10763,
2146,
2279,
10052,
1006,
2146,
1050,
1007,
1063,
2146,
9017,
1010,
11748,
1025,
2079,
1063,
9017,
1027,
11689,
4135,
9289,
13033,
5358,
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-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSerializer.java | AvroSerializer.readObject | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
/*
Please see FLINK-11436 for details on why manual deserialization is required.
During the release of Flink 1.7, the value of serialVersionUID was uptick to 2L (was 1L before)
And although the AvroSerializer (along with it's snapshot class) were migrated to the new serialization
abstraction (hence free from Java serialization), there were composite serializers that were not migrated
and were serialized with Java serialization. In case that one of the nested serializers were Avro we would
bump into deserialization exception due to a wrong serialVersionUID. Unfortunately it is not possible to revert
the serialVersionUID back to 1L, because users might have snapshots with 2L present already.
To overcome this we first need to make sure that the AvroSerializer is being Java deserialized with
FailureTolerantObjectInputStream, and then we determine the serialized layout by looking at the fields.
From: https://docs.oracle.com/javase/8/docs/platform/serialization/spec/class.html#a5421
-------------------------------------------------------------------------------------------------------------
The descriptors for primitive typed fields are written first
sorted by field name followed by descriptors for the object typed fields sorted by field name.
The names are sorted using String.compareTo.
-------------------------------------------------------------------------------------------------------------
pre 1.6 field order: [type]
pre 1.7 field order: [schemaString, type]
post 1.7 field order: [previousSchema, schema, type]
We would use the first field to distinguish between the three different layouts.
To complicate things even further in pre 1.7, the field @schemaString could be
null or a string, but, in post 1.7, the field @previousSchema was never set to null, therefore
we can use the first field to determine the version.
this logic should stay here as long as we support Flink 1.6 (along with Java serialized
TypeSerializers)
*/
final Object firstField = in.readObject();
if (firstField == null) {
// first field can only be NULL in 1.6 (schemaString)
read16Layout(null, in);
}
else if (firstField instanceof String) {
// first field is a String only in 1.6 (schemaString)
read16Layout((String) firstField, in);
}
else if (firstField instanceof Class<?>) {
// first field is a Class<?> only in 1.5 (type)
@SuppressWarnings("unchecked") Class<T> type = (Class<T>) firstField;
read15Layout(type);
}
else if (firstField instanceof SerializableAvroSchema) {
readCurrentLayout((SerializableAvroSchema) firstField, in);
}
else {
throw new IllegalStateException("Failed to Java-Deserialize an AvroSerializer instance. " +
"Was expecting a first field to be either a String or SerializableAvroSchema, but got: " +
"" + firstField.getClass());
}
} | java | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
/*
Please see FLINK-11436 for details on why manual deserialization is required.
During the release of Flink 1.7, the value of serialVersionUID was uptick to 2L (was 1L before)
And although the AvroSerializer (along with it's snapshot class) were migrated to the new serialization
abstraction (hence free from Java serialization), there were composite serializers that were not migrated
and were serialized with Java serialization. In case that one of the nested serializers were Avro we would
bump into deserialization exception due to a wrong serialVersionUID. Unfortunately it is not possible to revert
the serialVersionUID back to 1L, because users might have snapshots with 2L present already.
To overcome this we first need to make sure that the AvroSerializer is being Java deserialized with
FailureTolerantObjectInputStream, and then we determine the serialized layout by looking at the fields.
From: https://docs.oracle.com/javase/8/docs/platform/serialization/spec/class.html#a5421
-------------------------------------------------------------------------------------------------------------
The descriptors for primitive typed fields are written first
sorted by field name followed by descriptors for the object typed fields sorted by field name.
The names are sorted using String.compareTo.
-------------------------------------------------------------------------------------------------------------
pre 1.6 field order: [type]
pre 1.7 field order: [schemaString, type]
post 1.7 field order: [previousSchema, schema, type]
We would use the first field to distinguish between the three different layouts.
To complicate things even further in pre 1.7, the field @schemaString could be
null or a string, but, in post 1.7, the field @previousSchema was never set to null, therefore
we can use the first field to determine the version.
this logic should stay here as long as we support Flink 1.6 (along with Java serialized
TypeSerializers)
*/
final Object firstField = in.readObject();
if (firstField == null) {
// first field can only be NULL in 1.6 (schemaString)
read16Layout(null, in);
}
else if (firstField instanceof String) {
// first field is a String only in 1.6 (schemaString)
read16Layout((String) firstField, in);
}
else if (firstField instanceof Class<?>) {
// first field is a Class<?> only in 1.5 (type)
@SuppressWarnings("unchecked") Class<T> type = (Class<T>) firstField;
read15Layout(type);
}
else if (firstField instanceof SerializableAvroSchema) {
readCurrentLayout((SerializableAvroSchema) firstField, in);
}
else {
throw new IllegalStateException("Failed to Java-Deserialize an AvroSerializer instance. " +
"Was expecting a first field to be either a String or SerializableAvroSchema, but got: " +
"" + firstField.getClass());
}
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"/*\n\t\tPlease see FLINK-11436 for details on why manual deserialization is required.\n\n\t\tDuring the release of Flink 1.7, the value of serialVersionUID was ... | -------- backwards compatibility with 1.5, 1.6 ----------- | [
"--------",
"backwards",
"compatibility",
"with",
"1",
".",
"5",
"1",
".",
"6",
"-----------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/typeutils/AvroSerializer.java#L384-L439 | train | This method is called to read the object from an input stream. It is called by the Avro serializer when the serialization fails. | [
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,
1013,
1008,
3531,
2156,
13109,
19839,
1011,
12457,
21619,
2005,
30524,
19839,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java | FileSystem.initOutPathLocalFS | public boolean initOutPathLocalFS(Path outPath, WriteMode writeMode, boolean createDirectory) throws IOException {
if (isDistributedFS()) {
return false;
}
// NOTE: We actually need to lock here (process wide). Otherwise, multiple threads that
// concurrently work in this method (multiple output formats writing locally) might end
// up deleting each other's directories and leave non-retrievable files, without necessarily
// causing an exception. That results in very subtle issues, like output files looking as if
// they are not getting created.
// we acquire the lock interruptibly here, to make sure that concurrent threads waiting
// here can cancel faster
try {
OUTPUT_DIRECTORY_INIT_LOCK.lockInterruptibly();
}
catch (InterruptedException e) {
// restore the interruption state
Thread.currentThread().interrupt();
// leave the method - we don't have the lock anyways
throw new IOException("The thread was interrupted while trying to initialize the output directory");
}
try {
FileStatus status;
try {
status = getFileStatus(outPath);
}
catch (FileNotFoundException e) {
// okay, the file is not there
status = null;
}
// check if path exists
if (status != null) {
// path exists, check write mode
switch (writeMode) {
case NO_OVERWRITE:
if (status.isDir() && createDirectory) {
return true;
} else {
// file may not be overwritten
throw new IOException("File or directory " + outPath + " already exists. Existing files and directories " +
"are not overwritten in " + WriteMode.NO_OVERWRITE.name() + " mode. Use " +
WriteMode.OVERWRITE.name() + " mode to overwrite existing files and directories.");
}
case OVERWRITE:
if (status.isDir()) {
if (createDirectory) {
// directory exists and does not need to be created
return true;
} else {
// we will write in a single file, delete directory
try {
delete(outPath, true);
}
catch (IOException e) {
throw new IOException("Could not remove existing directory '" + outPath +
"' to allow overwrite by result file", e);
}
}
}
else {
// delete file
try {
delete(outPath, false);
}
catch (IOException e) {
throw new IOException("Could not remove existing file '" + outPath +
"' to allow overwrite by result file/directory", e);
}
}
break;
default:
throw new IllegalArgumentException("Invalid write mode: " + writeMode);
}
}
if (createDirectory) {
// Output directory needs to be created
if (!exists(outPath)) {
mkdirs(outPath);
}
// double check that the output directory exists
try {
return getFileStatus(outPath).isDir();
}
catch (FileNotFoundException e) {
return false;
}
}
else {
// check that the output path does not exist and an output file
// can be created by the output format.
return !exists(outPath);
}
}
finally {
OUTPUT_DIRECTORY_INIT_LOCK.unlock();
}
} | java | public boolean initOutPathLocalFS(Path outPath, WriteMode writeMode, boolean createDirectory) throws IOException {
if (isDistributedFS()) {
return false;
}
// NOTE: We actually need to lock here (process wide). Otherwise, multiple threads that
// concurrently work in this method (multiple output formats writing locally) might end
// up deleting each other's directories and leave non-retrievable files, without necessarily
// causing an exception. That results in very subtle issues, like output files looking as if
// they are not getting created.
// we acquire the lock interruptibly here, to make sure that concurrent threads waiting
// here can cancel faster
try {
OUTPUT_DIRECTORY_INIT_LOCK.lockInterruptibly();
}
catch (InterruptedException e) {
// restore the interruption state
Thread.currentThread().interrupt();
// leave the method - we don't have the lock anyways
throw new IOException("The thread was interrupted while trying to initialize the output directory");
}
try {
FileStatus status;
try {
status = getFileStatus(outPath);
}
catch (FileNotFoundException e) {
// okay, the file is not there
status = null;
}
// check if path exists
if (status != null) {
// path exists, check write mode
switch (writeMode) {
case NO_OVERWRITE:
if (status.isDir() && createDirectory) {
return true;
} else {
// file may not be overwritten
throw new IOException("File or directory " + outPath + " already exists. Existing files and directories " +
"are not overwritten in " + WriteMode.NO_OVERWRITE.name() + " mode. Use " +
WriteMode.OVERWRITE.name() + " mode to overwrite existing files and directories.");
}
case OVERWRITE:
if (status.isDir()) {
if (createDirectory) {
// directory exists and does not need to be created
return true;
} else {
// we will write in a single file, delete directory
try {
delete(outPath, true);
}
catch (IOException e) {
throw new IOException("Could not remove existing directory '" + outPath +
"' to allow overwrite by result file", e);
}
}
}
else {
// delete file
try {
delete(outPath, false);
}
catch (IOException e) {
throw new IOException("Could not remove existing file '" + outPath +
"' to allow overwrite by result file/directory", e);
}
}
break;
default:
throw new IllegalArgumentException("Invalid write mode: " + writeMode);
}
}
if (createDirectory) {
// Output directory needs to be created
if (!exists(outPath)) {
mkdirs(outPath);
}
// double check that the output directory exists
try {
return getFileStatus(outPath).isDir();
}
catch (FileNotFoundException e) {
return false;
}
}
else {
// check that the output path does not exist and an output file
// can be created by the output format.
return !exists(outPath);
}
}
finally {
OUTPUT_DIRECTORY_INIT_LOCK.unlock();
}
} | [
"public",
"boolean",
"initOutPathLocalFS",
"(",
"Path",
"outPath",
",",
"WriteMode",
"writeMode",
",",
"boolean",
"createDirectory",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isDistributedFS",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"// NOTE: We ac... | Initializes output directories on local file systems according to the given write mode.
<ul>
<li>WriteMode.NO_OVERWRITE & parallel output:
<ul>
<li>A directory is created if the output path does not exist.</li>
<li>An existing directory is reused, files contained in the directory are NOT deleted.</li>
<li>An existing file raises an exception.</li>
</ul>
</li>
<li>WriteMode.NO_OVERWRITE & NONE parallel output:
<ul>
<li>An existing file or directory raises an exception.</li>
</ul>
</li>
<li>WriteMode.OVERWRITE & parallel output:
<ul>
<li>A directory is created if the output path does not exist.</li>
<li>An existing directory is reused, files contained in the directory are NOT deleted.</li>
<li>An existing file is deleted and replaced by a new directory.</li>
</ul>
</li>
<li>WriteMode.OVERWRITE & NONE parallel output:
<ul>
<li>An existing file or directory (and all its content) is deleted</li>
</ul>
</li>
</ul>
<p>Files contained in an existing directory are not deleted, because multiple instances of a
DataSinkTask might call this function at the same time and hence might perform concurrent
delete operations on the file system (possibly deleting output files of concurrently running tasks).
Since concurrent DataSinkTasks are not aware of each other, coordination of delete and create
operations would be difficult.
@param outPath Output path that should be prepared.
@param writeMode Write mode to consider.
@param createDirectory True, to initialize a directory at the given path, false to prepare space for a file.
@return True, if the path was successfully prepared, false otherwise.
@throws IOException Thrown, if any of the file system access operations failed. | [
"Initializes",
"output",
"directories",
"on",
"local",
"file",
"systems",
"according",
"to",
"the",
"given",
"write",
"mode",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java#L767-L872 | train | Initialize the output directory for local FS. | [
30522,
2270,
22017,
20898,
1999,
9956,
4904,
15069,
4135,
9289,
10343,
1006,
4130,
2041,
15069,
1010,
4339,
5302,
3207,
4339,
5302,
3207,
1010,
22017,
20898,
2580,
7442,
16761,
2100,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.validateNamespace | protected void validateNamespace(final SqlValidatorNamespace namespace,
RelDataType targetRowType) {
namespace.validate(targetRowType);
if (namespace.getNode() != null) {
setValidatedNodeType(namespace.getNode(), namespace.getType());
}
} | java | protected void validateNamespace(final SqlValidatorNamespace namespace,
RelDataType targetRowType) {
namespace.validate(targetRowType);
if (namespace.getNode() != null) {
setValidatedNodeType(namespace.getNode(), namespace.getType());
}
} | [
"protected",
"void",
"validateNamespace",
"(",
"final",
"SqlValidatorNamespace",
"namespace",
",",
"RelDataType",
"targetRowType",
")",
"{",
"namespace",
".",
"validate",
"(",
"targetRowType",
")",
";",
"if",
"(",
"namespace",
".",
"getNode",
"(",
")",
"!=",
"nu... | Validates a namespace.
@param namespace Namespace
@param targetRowType Desired row type, must not be null, may be the data
type 'unknown'. | [
"Validates",
"a",
"namespace",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L980-L986 | train | Validate namespace. | [
30522,
5123,
11675,
9398,
3686,
18442,
23058,
1006,
2345,
29296,
10175,
8524,
4263,
18442,
23058,
3415,
15327,
1010,
2128,
15150,
29336,
18863,
4539,
10524,
13874,
1007,
1063,
3415,
15327,
1012,
9398,
3686,
1006,
4539,
10524,
13874,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/GetColumnsOperation.java | GetColumnsOperation.getNextRowSet | @Override
public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException {
assertState(OperationState.FINISHED);
validateDefaultFetchOrientation(orientation);
if (orientation.equals(FetchOrientation.FETCH_FIRST)) {
rowSet.setStartOffset(0);
}
return rowSet.extractSubset((int)maxRows);
} | java | @Override
public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException {
assertState(OperationState.FINISHED);
validateDefaultFetchOrientation(orientation);
if (orientation.equals(FetchOrientation.FETCH_FIRST)) {
rowSet.setStartOffset(0);
}
return rowSet.extractSubset((int)maxRows);
} | [
"@",
"Override",
"public",
"RowSet",
"getNextRowSet",
"(",
"FetchOrientation",
"orientation",
",",
"long",
"maxRows",
")",
"throws",
"HiveSQLException",
"{",
"assertState",
"(",
"OperationState",
".",
"FINISHED",
")",
";",
"validateDefaultFetchOrientation",
"(",
"orie... | /* (non-Javadoc)
@see org.apache.hive.service.cli.Operation#getNextRowSet(org.apache.hive.service.cli.FetchOrientation, long) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/GetColumnsOperation.java#L224-L232 | train | Get the next row set. | [
30522,
1030,
2058,
15637,
2270,
10281,
3388,
2131,
2638,
18413,
10524,
13462,
1006,
18584,
10050,
19304,
10296,
1010,
2146,
4098,
10524,
2015,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
19514,
12259,
1006,
3136,
12259,
1012,
273... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/net/NetUtil.java | NetUtil.isUsableLocalPort | public static boolean isUsableLocalPort(int port) {
if (false == isValidPort(port)) {
// 给定的IP未在指定端口范围中
return false;
}
try {
ServerSocketFactory.getDefault().createServerSocket(port, 1, InetAddress.getByName(LOCAL_IP)).close();
return true;
} catch (Exception e) {
return false;
}
} | java | public static boolean isUsableLocalPort(int port) {
if (false == isValidPort(port)) {
// 给定的IP未在指定端口范围中
return false;
}
try {
ServerSocketFactory.getDefault().createServerSocket(port, 1, InetAddress.getByName(LOCAL_IP)).close();
return true;
} catch (Exception e) {
return false;
}
} | [
"public",
"static",
"boolean",
"isUsableLocalPort",
"(",
"int",
"port",
")",
"{",
"if",
"(",
"false",
"==",
"isValidPort",
"(",
"port",
")",
")",
"{",
"// 给定的IP未在指定端口范围中\r",
"return",
"false",
";",
"}",
"try",
"{",
"ServerSocketFactory",
".",
"getDefault",
"... | 检测本地端口可用性<br>
来自org.springframework.util.SocketUtils
@param port 被检测的端口
@return 是否可用 | [
"检测本地端口可用性<br",
">",
"来自org",
".",
"springframework",
".",
"util",
".",
"SocketUtils"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L97-L108 | train | Checks if the given port is usable by the local host. | [
30522,
2270,
10763,
22017,
20898,
2003,
10383,
3468,
4135,
9289,
6442,
1006,
20014,
3417,
1007,
1063,
2065,
1006,
6270,
1027,
1027,
2003,
10175,
3593,
6442,
1006,
3417,
1007,
1007,
1063,
1013,
1013,
100,
1822,
1916,
12997,
100,
100,
100,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Book.java | Book.getReferences | @Override
public List<ForeignKey<Record, ?>> getReferences() {
return Arrays.<ForeignKey<Record, ?>>asList(Keys.FK_BOOK_AUTHOR,
Keys.FK_BOOK_LANGUAGE);
} | java | @Override
public List<ForeignKey<Record, ?>> getReferences() {
return Arrays.<ForeignKey<Record, ?>>asList(Keys.FK_BOOK_AUTHOR,
Keys.FK_BOOK_LANGUAGE);
} | [
"@",
"Override",
"public",
"List",
"<",
"ForeignKey",
"<",
"Record",
",",
"?",
">",
">",
"getReferences",
"(",
")",
"{",
"return",
"Arrays",
".",
"<",
"ForeignKey",
"<",
"Record",
",",
"?",
">",
">",
"asList",
"(",
"Keys",
".",
"FK_BOOK_AUTHOR",
",",
... | {@inheritDoc} | [
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-samples/spring-boot-sample-jooq/gensrc/main/java/sample/jooq/domain/Book.java#L122-L126 | train | Returns an array of foreign keys of the record. | [
30522,
1030,
2058,
15637,
2270,
2862,
1026,
3097,
14839,
1026,
2501,
1010,
1029,
1028,
1028,
2131,
2890,
25523,
2015,
1006,
1007,
1063,
2709,
27448,
1012,
1026,
3097,
14839,
1026,
2501,
1010,
1029,
1028,
1028,
2004,
9863,
1006,
6309,
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/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/AbstractService.java | AbstractService.changeState | private void changeState(Service.STATE newState) {
state = newState;
// notify listeners
for (ServiceStateChangeListener l : listeners) {
l.stateChanged(this);
}
} | java | private void changeState(Service.STATE newState) {
state = newState;
// notify listeners
for (ServiceStateChangeListener l : listeners) {
l.stateChanged(this);
}
} | [
"private",
"void",
"changeState",
"(",
"Service",
".",
"STATE",
"newState",
")",
"{",
"state",
"=",
"newState",
";",
"// notify listeners",
"for",
"(",
"ServiceStateChangeListener",
"l",
":",
"listeners",
")",
"{",
"l",
".",
"stateChanged",
"(",
"this",
")",
... | Change to a new state and notify all listeners.
This is a private method that is only invoked from synchronized methods,
which avoid having to clone the listener list. It does imply that
the state change listener methods should be short lived, as they
will delay the state transition.
@param newState
new service state | [
"Change",
"to",
"a",
"new",
"state",
"and",
"notify",
"all",
"listeners",
".",
"This",
"is",
"a",
"private",
"method",
"that",
"is",
"only",
"invoked",
"from",
"synchronized",
"methods",
"which",
"avoid",
"having",
"to",
"clone",
"the",
"listener",
"list",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/AbstractService.java#L176-L182 | train | Change the state of the service. | [
30522,
2797,
11675,
3431,
12259,
1006,
2326,
1012,
2110,
2739,
12259,
1007,
1063,
2110,
1027,
2739,
12259,
1025,
1013,
1013,
2025,
8757,
13810,
2005,
1006,
2578,
12259,
22305,
29282,
6528,
2121,
1048,
1024,
13810,
1007,
1063,
1048,
1012,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java | SslContextBuilder.forServer | public static SslContextBuilder forServer(InputStream keyCertChainInputStream, InputStream keyInputStream) {
return new SslContextBuilder(true).keyManager(keyCertChainInputStream, keyInputStream);
} | java | public static SslContextBuilder forServer(InputStream keyCertChainInputStream, InputStream keyInputStream) {
return new SslContextBuilder(true).keyManager(keyCertChainInputStream, keyInputStream);
} | [
"public",
"static",
"SslContextBuilder",
"forServer",
"(",
"InputStream",
"keyCertChainInputStream",
",",
"InputStream",
"keyInputStream",
")",
"{",
"return",
"new",
"SslContextBuilder",
"(",
"true",
")",
".",
"keyManager",
"(",
"keyCertChainInputStream",
",",
"keyInput... | Creates a builder for new server-side {@link SslContext}.
@param keyCertChainInputStream an input stream for an X.509 certificate chain in PEM format
@param keyInputStream an input stream for a PKCS#8 private key in PEM format
@see #keyManager(InputStream, InputStream) | [
"Creates",
"a",
"builder",
"for",
"new",
"server",
"-",
"side",
"{",
"@link",
"SslContext",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L64-L66 | train | Create a SslContextBuilder for a server using the specified key certificates and key certificates. | [
30522,
2270,
10763,
7020,
22499,
10111,
18413,
8569,
23891,
2099,
2005,
8043,
6299,
1006,
20407,
25379,
3145,
17119,
10649,
8113,
2378,
18780,
21422,
1010,
20407,
25379,
3145,
2378,
18780,
21422,
1007,
1063,
2709,
2047,
7020,
22499,
10111,
18... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageEncoder.java | Bzip2HuffmanStageEncoder.writeSelectorsAndHuffmanTables | private void writeSelectorsAndHuffmanTables(ByteBuf out) {
final Bzip2BitWriter writer = this.writer;
final byte[] selectors = this.selectors;
final int totalSelectors = selectors.length;
final int[][] huffmanCodeLengths = this.huffmanCodeLengths;
final int totalTables = huffmanCodeLengths.length;
final int mtfAlphabetSize = this.mtfAlphabetSize;
writer.writeBits(out, 3, totalTables);
writer.writeBits(out, 15, totalSelectors);
// Write the selectors
Bzip2MoveToFrontTable selectorMTF = new Bzip2MoveToFrontTable();
for (byte selector : selectors) {
writer.writeUnary(out, selectorMTF.valueToFront(selector));
}
// Write the Huffman tables
for (final int[] tableLengths : huffmanCodeLengths) {
int currentLength = tableLengths[0];
writer.writeBits(out, 5, currentLength);
for (int j = 0; j < mtfAlphabetSize; j++) {
final int codeLength = tableLengths[j];
final int value = currentLength < codeLength ? 2 : 3;
int delta = Math.abs(codeLength - currentLength);
while (delta-- > 0) {
writer.writeBits(out, 2, value);
}
writer.writeBoolean(out, false);
currentLength = codeLength;
}
}
} | java | private void writeSelectorsAndHuffmanTables(ByteBuf out) {
final Bzip2BitWriter writer = this.writer;
final byte[] selectors = this.selectors;
final int totalSelectors = selectors.length;
final int[][] huffmanCodeLengths = this.huffmanCodeLengths;
final int totalTables = huffmanCodeLengths.length;
final int mtfAlphabetSize = this.mtfAlphabetSize;
writer.writeBits(out, 3, totalTables);
writer.writeBits(out, 15, totalSelectors);
// Write the selectors
Bzip2MoveToFrontTable selectorMTF = new Bzip2MoveToFrontTable();
for (byte selector : selectors) {
writer.writeUnary(out, selectorMTF.valueToFront(selector));
}
// Write the Huffman tables
for (final int[] tableLengths : huffmanCodeLengths) {
int currentLength = tableLengths[0];
writer.writeBits(out, 5, currentLength);
for (int j = 0; j < mtfAlphabetSize; j++) {
final int codeLength = tableLengths[j];
final int value = currentLength < codeLength ? 2 : 3;
int delta = Math.abs(codeLength - currentLength);
while (delta-- > 0) {
writer.writeBits(out, 2, value);
}
writer.writeBoolean(out, false);
currentLength = codeLength;
}
}
} | [
"private",
"void",
"writeSelectorsAndHuffmanTables",
"(",
"ByteBuf",
"out",
")",
"{",
"final",
"Bzip2BitWriter",
"writer",
"=",
"this",
".",
"writer",
";",
"final",
"byte",
"[",
"]",
"selectors",
"=",
"this",
".",
"selectors",
";",
"final",
"int",
"totalSelect... | Write out the selector list and Huffman tables. | [
"Write",
"out",
"the",
"selector",
"list",
"and",
"Huffman",
"tables",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2HuffmanStageEncoder.java#L301-L335 | train | Write the selectors and Huffman tables. | [
30522,
2797,
11675,
7009,
12260,
24817,
5685,
6979,
4246,
2386,
10880,
2015,
1006,
24880,
8569,
2546,
2041,
1007,
1063,
2345,
1038,
5831,
2361,
2475,
16313,
15994,
3213,
1027,
2023,
1012,
3213,
1025,
2345,
24880,
1031,
1033,
27000,
2015,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/web/servlet/console/DefaultProxyHtmlRenderer.java | DefaultProxyHtmlRenderer.getLines | private String getLines(SlotsLines lines) {
StringBuilder builder = new StringBuilder();
for (MiniCapability cap : lines.getLinesType()) {
String icon = cap.getIcon();
String version = cap.getVersion();
builder.append("<p>");
if (version != null) {
builder.append("v:").append(version);
}
for (TestSlot s : lines.getLine(cap)) {
builder.append(getSingleSlotHtml(s, icon));
}
builder.append("</p>");
}
return builder.toString();
} | java | private String getLines(SlotsLines lines) {
StringBuilder builder = new StringBuilder();
for (MiniCapability cap : lines.getLinesType()) {
String icon = cap.getIcon();
String version = cap.getVersion();
builder.append("<p>");
if (version != null) {
builder.append("v:").append(version);
}
for (TestSlot s : lines.getLine(cap)) {
builder.append(getSingleSlotHtml(s, icon));
}
builder.append("</p>");
}
return builder.toString();
} | [
"private",
"String",
"getLines",
"(",
"SlotsLines",
"lines",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"MiniCapability",
"cap",
":",
"lines",
".",
"getLinesType",
"(",
")",
")",
"{",
"String",
"icon",
"="... | the lines of icon representing the possible slots | [
"the",
"lines",
"of",
"icon",
"representing",
"the",
"possible",
"slots"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/web/servlet/console/DefaultProxyHtmlRenderer.java#L126-L141 | train | Get the lines of the slot table. | [
30522,
2797,
5164,
2131,
12735,
1006,
19832,
12735,
3210,
1007,
1063,
5164,
8569,
23891,
2099,
12508,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
1007,
1025,
2005,
1006,
7163,
17695,
8010,
6178,
1024,
3210,
1012,
2131,
12735,
13874,
1006,
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-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java | WebMvcTags.uri | public static Tag uri(HttpServletRequest request, HttpServletResponse response) {
if (request != null) {
String pattern = getMatchingPattern(request);
if (pattern != null) {
return Tag.of("uri", pattern);
}
if (response != null) {
HttpStatus status = extractStatus(response);
if (status != null) {
if (status.is3xxRedirection()) {
return URI_REDIRECTION;
}
if (status == HttpStatus.NOT_FOUND) {
return URI_NOT_FOUND;
}
}
}
String pathInfo = getPathInfo(request);
if (pathInfo.isEmpty()) {
return URI_ROOT;
}
}
return URI_UNKNOWN;
} | java | public static Tag uri(HttpServletRequest request, HttpServletResponse response) {
if (request != null) {
String pattern = getMatchingPattern(request);
if (pattern != null) {
return Tag.of("uri", pattern);
}
if (response != null) {
HttpStatus status = extractStatus(response);
if (status != null) {
if (status.is3xxRedirection()) {
return URI_REDIRECTION;
}
if (status == HttpStatus.NOT_FOUND) {
return URI_NOT_FOUND;
}
}
}
String pathInfo = getPathInfo(request);
if (pathInfo.isEmpty()) {
return URI_ROOT;
}
}
return URI_UNKNOWN;
} | [
"public",
"static",
"Tag",
"uri",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"{",
"if",
"(",
"request",
"!=",
"null",
")",
"{",
"String",
"pattern",
"=",
"getMatchingPattern",
"(",
"request",
")",
";",
"if",
"(",
"patt... | Creates a {@code uri} tag based on the URI of the given {@code request}. Uses the
{@link HandlerMapping#BEST_MATCHING_PATTERN_ATTRIBUTE} best matching pattern if
available. Falling back to {@code REDIRECTION} for 3xx responses, {@code NOT_FOUND}
for 404 responses, {@code root} for requests with no path info, and {@code UNKNOWN}
for all other requests.
@param request the request
@param response the response
@return the uri tag derived from the request | [
"Creates",
"a",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcTags.java#L109-L132 | train | Returns the URI tag for the given request and response. | [
30522,
2270,
10763,
6415,
24471,
2072,
1006,
16770,
2121,
2615,
7485,
2890,
15500,
5227,
1010,
16770,
2121,
2615,
7485,
6072,
26029,
3366,
3433,
1007,
1063,
2065,
1006,
5227,
999,
1027,
19701,
1007,
1063,
5164,
5418,
1027,
2131,
18900,
8450... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DefaultHttp2Connection.java | DefaultHttp2Connection.removeStream | void removeStream(DefaultStream stream, Iterator<?> itr) {
final boolean removed;
if (itr == null) {
removed = streamMap.remove(stream.id()) != null;
} else {
itr.remove();
removed = true;
}
if (removed) {
for (int i = 0; i < listeners.size(); i++) {
try {
listeners.get(i).onStreamRemoved(stream);
} catch (Throwable cause) {
logger.error("Caught Throwable from listener onStreamRemoved.", cause);
}
}
if (closePromise != null && isStreamMapEmpty()) {
closePromise.trySuccess(null);
}
}
} | java | void removeStream(DefaultStream stream, Iterator<?> itr) {
final boolean removed;
if (itr == null) {
removed = streamMap.remove(stream.id()) != null;
} else {
itr.remove();
removed = true;
}
if (removed) {
for (int i = 0; i < listeners.size(); i++) {
try {
listeners.get(i).onStreamRemoved(stream);
} catch (Throwable cause) {
logger.error("Caught Throwable from listener onStreamRemoved.", cause);
}
}
if (closePromise != null && isStreamMapEmpty()) {
closePromise.trySuccess(null);
}
}
} | [
"void",
"removeStream",
"(",
"DefaultStream",
"stream",
",",
"Iterator",
"<",
"?",
">",
"itr",
")",
"{",
"final",
"boolean",
"removed",
";",
"if",
"(",
"itr",
"==",
"null",
")",
"{",
"removed",
"=",
"streamMap",
".",
"remove",
"(",
"stream",
".",
"id",... | Remove a stream from the {@link #streamMap}.
@param stream the stream to remove.
@param itr an iterator that may be pointing to the stream during iteration and {@link Iterator#remove()} will be
used if non-{@code null}. | [
"Remove",
"a",
"stream",
"from",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2Connection.java#L304-L326 | train | Remove a stream from the cache. | [
30522,
11675,
20362,
25379,
1006,
12398,
21422,
5460,
1010,
2009,
6906,
4263,
1026,
1029,
1028,
2009,
2099,
1007,
1063,
2345,
22017,
20898,
3718,
1025,
2065,
1006,
2009,
2099,
1027,
1027,
19701,
1007,
1063,
3718,
1027,
5460,
2863,
2361,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java | ExceptionUtil.convertFromOrSuppressedThrowable | public static <T extends Throwable> T convertFromOrSuppressedThrowable(Throwable throwable, Class<T> exceptionClass) {
return convertFromOrSuppressedThrowable(throwable, exceptionClass, true);
} | java | public static <T extends Throwable> T convertFromOrSuppressedThrowable(Throwable throwable, Class<T> exceptionClass) {
return convertFromOrSuppressedThrowable(throwable, exceptionClass, true);
} | [
"public",
"static",
"<",
"T",
"extends",
"Throwable",
">",
"T",
"convertFromOrSuppressedThrowable",
"(",
"Throwable",
"throwable",
",",
"Class",
"<",
"T",
">",
"exceptionClass",
")",
"{",
"return",
"convertFromOrSuppressedThrowable",
"(",
"throwable",
",",
"exceptio... | 转化指定异常为来自或者包含指定异常
@param <T> 异常类型
@param throwable 异常
@param exceptionClass 定义的引起异常的类
@return 结果为null 不是来自或者包含
@since 4.3.2 | [
"转化指定异常为来自或者包含指定异常"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java#L282-L284 | train | Convert a throwable to an exception of the given type. | [
30522,
2270,
10763,
1026,
1056,
8908,
5466,
3085,
1028,
1056,
10463,
19699,
19506,
2869,
6279,
19811,
2705,
10524,
3085,
1006,
5466,
3085,
5466,
3085,
1010,
2465,
1026,
1056,
1028,
6453,
26266,
1007,
1063,
2709,
10463,
19699,
19506,
2869,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/StateAssignmentOperation.java | StateAssignmentOperation.reAssignSubKeyedStates | private Tuple2<List<KeyedStateHandle>, List<KeyedStateHandle>> reAssignSubKeyedStates(
OperatorState operatorState,
List<KeyGroupRange> keyGroupPartitions,
int subTaskIndex,
int newParallelism,
int oldParallelism) {
List<KeyedStateHandle> subManagedKeyedState;
List<KeyedStateHandle> subRawKeyedState;
if (newParallelism == oldParallelism) {
if (operatorState.getState(subTaskIndex) != null) {
subManagedKeyedState = operatorState.getState(subTaskIndex).getManagedKeyedState().asList();
subRawKeyedState = operatorState.getState(subTaskIndex).getRawKeyedState().asList();
} else {
subManagedKeyedState = Collections.emptyList();
subRawKeyedState = Collections.emptyList();
}
} else {
subManagedKeyedState = getManagedKeyedStateHandles(operatorState, keyGroupPartitions.get(subTaskIndex));
subRawKeyedState = getRawKeyedStateHandles(operatorState, keyGroupPartitions.get(subTaskIndex));
}
if (subManagedKeyedState.isEmpty() && subRawKeyedState.isEmpty()) {
return new Tuple2<>(Collections.emptyList(), Collections.emptyList());
} else {
return new Tuple2<>(subManagedKeyedState, subRawKeyedState);
}
} | java | private Tuple2<List<KeyedStateHandle>, List<KeyedStateHandle>> reAssignSubKeyedStates(
OperatorState operatorState,
List<KeyGroupRange> keyGroupPartitions,
int subTaskIndex,
int newParallelism,
int oldParallelism) {
List<KeyedStateHandle> subManagedKeyedState;
List<KeyedStateHandle> subRawKeyedState;
if (newParallelism == oldParallelism) {
if (operatorState.getState(subTaskIndex) != null) {
subManagedKeyedState = operatorState.getState(subTaskIndex).getManagedKeyedState().asList();
subRawKeyedState = operatorState.getState(subTaskIndex).getRawKeyedState().asList();
} else {
subManagedKeyedState = Collections.emptyList();
subRawKeyedState = Collections.emptyList();
}
} else {
subManagedKeyedState = getManagedKeyedStateHandles(operatorState, keyGroupPartitions.get(subTaskIndex));
subRawKeyedState = getRawKeyedStateHandles(operatorState, keyGroupPartitions.get(subTaskIndex));
}
if (subManagedKeyedState.isEmpty() && subRawKeyedState.isEmpty()) {
return new Tuple2<>(Collections.emptyList(), Collections.emptyList());
} else {
return new Tuple2<>(subManagedKeyedState, subRawKeyedState);
}
} | [
"private",
"Tuple2",
"<",
"List",
"<",
"KeyedStateHandle",
">",
",",
"List",
"<",
"KeyedStateHandle",
">",
">",
"reAssignSubKeyedStates",
"(",
"OperatorState",
"operatorState",
",",
"List",
"<",
"KeyGroupRange",
">",
"keyGroupPartitions",
",",
"int",
"subTaskIndex",... | TODO rewrite based on operator id | [
"TODO",
"rewrite",
"based",
"on",
"operator",
"id"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/StateAssignmentOperation.java#L291-L319 | train | Reassign the sub - keyed states of the given operator state. | [
30522,
2797,
10722,
10814,
2475,
1026,
2862,
1026,
3145,
2098,
9153,
2618,
11774,
2571,
1028,
1010,
2862,
1026,
3145,
2098,
9153,
2618,
11774,
2571,
1028,
1028,
2128,
12054,
23773,
6342,
2497,
14839,
2098,
9153,
4570,
1006,
9224,
12259,
922... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java | ExternalShuffleBlockResolver.executorRemoved | public void executorRemoved(String executorId, String appId) {
logger.info("Clean up non-shuffle files associated with the finished executor {}", executorId);
AppExecId fullId = new AppExecId(appId, executorId);
final ExecutorShuffleInfo executor = executors.get(fullId);
if (executor == null) {
// Executor not registered, skip clean up of the local directories.
logger.info("Executor is not registered (appId={}, execId={})", appId, executorId);
} else {
logger.info("Cleaning up non-shuffle files in executor {}'s {} local dirs", fullId,
executor.localDirs.length);
// Execute the actual deletion in a different thread, as it may take some time.
directoryCleaner.execute(() -> deleteNonShuffleFiles(executor.localDirs));
}
} | java | public void executorRemoved(String executorId, String appId) {
logger.info("Clean up non-shuffle files associated with the finished executor {}", executorId);
AppExecId fullId = new AppExecId(appId, executorId);
final ExecutorShuffleInfo executor = executors.get(fullId);
if (executor == null) {
// Executor not registered, skip clean up of the local directories.
logger.info("Executor is not registered (appId={}, execId={})", appId, executorId);
} else {
logger.info("Cleaning up non-shuffle files in executor {}'s {} local dirs", fullId,
executor.localDirs.length);
// Execute the actual deletion in a different thread, as it may take some time.
directoryCleaner.execute(() -> deleteNonShuffleFiles(executor.localDirs));
}
} | [
"public",
"void",
"executorRemoved",
"(",
"String",
"executorId",
",",
"String",
"appId",
")",
"{",
"logger",
".",
"info",
"(",
"\"Clean up non-shuffle files associated with the finished executor {}\"",
",",
"executorId",
")",
";",
"AppExecId",
"fullId",
"=",
"new",
"... | Removes all the non-shuffle files in any local directories associated with the finished
executor. | [
"Removes",
"all",
"the",
"non",
"-",
"shuffle",
"files",
"in",
"any",
"local",
"directories",
"associated",
"with",
"the",
"finished",
"executor",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java#L223-L237 | train | Called when an executor is removed from the cache. | [
30522,
2270,
11675,
4654,
8586,
16161,
14343,
5302,
7178,
1006,
5164,
4654,
8586,
16161,
14615,
1010,
5164,
10439,
3593,
1007,
1063,
8833,
4590,
1012,
18558,
1006,
1000,
4550,
2039,
2512,
1011,
23046,
6764,
3378,
2007,
1996,
2736,
4654,
858... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tuple/Tuple4.java | Tuple4.copy | @Override
@SuppressWarnings("unchecked")
public Tuple4<T0, T1, T2, T3> copy() {
return new Tuple4<>(this.f0,
this.f1,
this.f2,
this.f3);
} | java | @Override
@SuppressWarnings("unchecked")
public Tuple4<T0, T1, T2, T3> copy() {
return new Tuple4<>(this.f0,
this.f1,
this.f2,
this.f3);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Tuple4",
"<",
"T0",
",",
"T1",
",",
"T2",
",",
"T3",
">",
"copy",
"(",
")",
"{",
"return",
"new",
"Tuple4",
"<>",
"(",
"this",
".",
"f0",
",",
"this",
".",
"f1",
",",
... | Shallow tuple copy.
@return A new Tuple with the same fields as this. | [
"Shallow",
"tuple",
"copy",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple4.java#L200-L207 | train | Returns a copy of this tuple. | [
30522,
1030,
2058,
15637,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10722,
10814,
2549,
1026,
1056,
2692,
1010,
1056,
2487,
1010,
1056,
2475,
1010,
1056,
2509,
1028,
6100,
1006,
1007,
1063,
2709,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2.java | SM2.decrypt | @Override
public byte[] decrypt(byte[] data, KeyType keyType) throws CryptoException {
if (KeyType.PrivateKey != keyType) {
throw new IllegalArgumentException("Decrypt is only support by private key");
}
ckeckKey(keyType);
lock.lock();
final SM2Engine engine = getEngine();
try {
engine.init(false, getCipherParameters(keyType));
return engine.processBlock(data, 0, data.length);
} finally {
lock.unlock();
}
} | java | @Override
public byte[] decrypt(byte[] data, KeyType keyType) throws CryptoException {
if (KeyType.PrivateKey != keyType) {
throw new IllegalArgumentException("Decrypt is only support by private key");
}
ckeckKey(keyType);
lock.lock();
final SM2Engine engine = getEngine();
try {
engine.init(false, getCipherParameters(keyType));
return engine.processBlock(data, 0, data.length);
} finally {
lock.unlock();
}
} | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"decrypt",
"(",
"byte",
"[",
"]",
"data",
",",
"KeyType",
"keyType",
")",
"throws",
"CryptoException",
"{",
"if",
"(",
"KeyType",
".",
"PrivateKey",
"!=",
"keyType",
")",
"{",
"throw",
"new",
"IllegalArgumentExc... | 解密
@param data SM2密文,实际包含三部分:ECC公钥、真正的密文、公钥和原文的SM3-HASH值
@param keyType 私钥或公钥 {@link KeyType}
@return 加密后的bytes
@throws CryptoException 包括InvalidKeyException和InvalidCipherTextException的包装异常 | [
"解密"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2.java#L147-L162 | train | Decrypt a byte array using the specified key type. | [
30522,
1030,
2058,
15637,
2270,
24880,
1031,
1033,
11703,
2854,
13876,
1006,
24880,
1031,
1033,
2951,
1010,
3145,
13874,
3145,
13874,
1007,
11618,
19888,
8913,
2595,
24422,
1063,
2065,
1006,
3145,
13874,
1012,
2797,
14839,
999,
1027,
3145,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | handler/src/main/java/com/networknt/handler/Handler.java | Handler.splitClassAndName | static Tuple<String, Class> splitClassAndName(String classLabel) {
String[] stringNameSplit = classLabel.split("@");
// If i don't have a @, then no name is provided, use the class as the name.
if (stringNameSplit.length == 1) {
try {
return new Tuple<>(classLabel, Class.forName(classLabel));
} catch (ClassNotFoundException e) {
throw new RuntimeException("Configured class: " + classLabel + " has not been found");
}
} else if (stringNameSplit.length > 1) { // Found a @, use that as the name, and
try {
return new Tuple<>(stringNameSplit[1], Class.forName(stringNameSplit[0]));
} catch (ClassNotFoundException e) {
throw new RuntimeException("Configured class: " + stringNameSplit[0]
+ " has not been found. Declared label was: " + stringNameSplit[1]);
}
}
throw new RuntimeException("Invalid format provided for class label: " + classLabel);
} | java | static Tuple<String, Class> splitClassAndName(String classLabel) {
String[] stringNameSplit = classLabel.split("@");
// If i don't have a @, then no name is provided, use the class as the name.
if (stringNameSplit.length == 1) {
try {
return new Tuple<>(classLabel, Class.forName(classLabel));
} catch (ClassNotFoundException e) {
throw new RuntimeException("Configured class: " + classLabel + " has not been found");
}
} else if (stringNameSplit.length > 1) { // Found a @, use that as the name, and
try {
return new Tuple<>(stringNameSplit[1], Class.forName(stringNameSplit[0]));
} catch (ClassNotFoundException e) {
throw new RuntimeException("Configured class: " + stringNameSplit[0]
+ " has not been found. Declared label was: " + stringNameSplit[1]);
}
}
throw new RuntimeException("Invalid format provided for class label: " + classLabel);
} | [
"static",
"Tuple",
"<",
"String",
",",
"Class",
">",
"splitClassAndName",
"(",
"String",
"classLabel",
")",
"{",
"String",
"[",
"]",
"stringNameSplit",
"=",
"classLabel",
".",
"split",
"(",
"\"@\"",
")",
";",
"// If i don't have a @, then no name is provided, use th... | To support multiple instances of the same class, support a naming
@param classLabel
The label as seen in the config file.
@return A tuple where the first value is the name, and the second is the
class.
@throws Exception
On invalid format of label. | [
"To",
"support",
"multiple",
"instances",
"of",
"the",
"same",
"class",
"support",
"a",
"naming"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/handler/src/main/java/com/networknt/handler/Handler.java#L493-L511 | train | Split a class label into two parts. | [
30522,
10763,
10722,
10814,
1026,
5164,
1010,
2465,
1028,
3975,
26266,
5685,
18442,
1006,
5164,
2465,
20470,
2884,
1007,
1063,
5164,
1031,
1033,
5164,
18442,
13102,
15909,
1027,
2465,
20470,
2884,
1012,
3975,
1006,
1000,
1030,
1000,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.