repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-core/src/main/java/cn/hutool/core/net/URLEncoder.java | URLEncoder.createQuery | public static URLEncoder createQuery() {
final URLEncoder encoder = new URLEncoder();
// Special encoding for space
encoder.setEncodeSpaceAsPlus(true);
// Alpha and digit are safe by default
// Add the other permitted characters
encoder.addSafeCharacter('*');
encoder.addSafeCharacter('-');
encoder.addSafeCharacter('.');
encoder.addSafeCharacter('_');
encoder.addSafeCharacter('=');
encoder.addSafeCharacter('&');
return encoder;
} | java | public static URLEncoder createQuery() {
final URLEncoder encoder = new URLEncoder();
// Special encoding for space
encoder.setEncodeSpaceAsPlus(true);
// Alpha and digit are safe by default
// Add the other permitted characters
encoder.addSafeCharacter('*');
encoder.addSafeCharacter('-');
encoder.addSafeCharacter('.');
encoder.addSafeCharacter('_');
encoder.addSafeCharacter('=');
encoder.addSafeCharacter('&');
return encoder;
} | [
"public",
"static",
"URLEncoder",
"createQuery",
"(",
")",
"{",
"final",
"URLEncoder",
"encoder",
"=",
"new",
"URLEncoder",
"(",
")",
";",
"// Special encoding for space\r",
"encoder",
".",
"setEncodeSpaceAsPlus",
"(",
"true",
")",
";",
"// Alpha and digit are safe by... | 创建用于查询语句的{@link URLEncoder}<br>
编码器针对URI路径编码,定义如下:
<pre>
0x20 ' ' =》 '+'
0x2A, 0x2D, 0x2E, 0x30 to 0x39, 0x41 to 0x5A, 0x5F, 0x61 to 0x7A as-is
'*', '-', '.', '0' to '9', 'A' to 'Z', '_', 'a' to 'z' Also '=' and '&' 不编码
其它编码为 %nn 形式
</pre>
详细见:https://www.w3.org/TR/html5/forms.html#application/x-www-form-urlencoded-encoding-algorithm
@return {@link URLEncoder} | [
"创建用于查询语句的",
"{",
"@link",
"URLEncoder",
"}",
"<br",
">",
"编码器针对URI路径编码,定义如下:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/URLEncoder.java#L109-L123 | train | Creates a new URLEncoder for use with the URL Query class. | [
30522,
2270,
10763,
24471,
7770,
16044,
2099,
3443,
4226,
2854,
1006,
1007,
1063,
2345,
24471,
7770,
16044,
2099,
4372,
16044,
2099,
1027,
2047,
24471,
7770,
16044,
2099,
1006,
1007,
1025,
1013,
1013,
2569,
17181,
2005,
2686,
4372,
16044,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalStater.java | CanalStater.buildMQProperties | private static MQProperties buildMQProperties(Properties properties) {
MQProperties mqProperties = new MQProperties();
String servers = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_SERVERS);
if (!StringUtils.isEmpty(servers)) {
mqProperties.setServers(servers);
}
String retires = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_RETRIES);
if (!StringUtils.isEmpty(retires)) {
mqProperties.setRetries(Integer.valueOf(retires));
}
String batchSize = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_BATCHSIZE);
if (!StringUtils.isEmpty(batchSize)) {
mqProperties.setBatchSize(Integer.valueOf(batchSize));
}
String lingerMs = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_LINGERMS);
if (!StringUtils.isEmpty(lingerMs)) {
mqProperties.setLingerMs(Integer.valueOf(lingerMs));
}
String maxRequestSize = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_MAXREQUESTSIZE);
if (!StringUtils.isEmpty(maxRequestSize)) {
mqProperties.setMaxRequestSize(Integer.valueOf(maxRequestSize));
}
String bufferMemory = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_BUFFERMEMORY);
if (!StringUtils.isEmpty(bufferMemory)) {
mqProperties.setBufferMemory(Long.valueOf(bufferMemory));
}
String canalBatchSize = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_CANALBATCHSIZE);
if (!StringUtils.isEmpty(canalBatchSize)) {
mqProperties.setCanalBatchSize(Integer.valueOf(canalBatchSize));
}
String canalGetTimeout = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_CANALGETTIMEOUT);
if (!StringUtils.isEmpty(canalGetTimeout)) {
mqProperties.setCanalGetTimeout(Long.valueOf(canalGetTimeout));
}
String flatMessage = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_FLATMESSAGE);
if (!StringUtils.isEmpty(flatMessage)) {
mqProperties.setFlatMessage(Boolean.valueOf(flatMessage));
}
String compressionType = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_COMPRESSION_TYPE);
if (!StringUtils.isEmpty(compressionType)) {
mqProperties.setCompressionType(compressionType);
}
String acks = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_ACKS);
if (!StringUtils.isEmpty(acks)) {
mqProperties.setAcks(acks);
}
String aliyunAccessKey = CanalController.getProperty(properties, CanalConstants.CANAL_ALIYUN_ACCESSKEY);
if (!StringUtils.isEmpty(aliyunAccessKey)) {
mqProperties.setAliyunAccessKey(aliyunAccessKey);
}
String aliyunSecretKey = CanalController.getProperty(properties, CanalConstants.CANAL_ALIYUN_SECRETKEY);
if (!StringUtils.isEmpty(aliyunSecretKey)) {
mqProperties.setAliyunSecretKey(aliyunSecretKey);
}
String transaction = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_TRANSACTION);
if (!StringUtils.isEmpty(transaction)) {
mqProperties.setTransaction(Boolean.valueOf(transaction));
}
String producerGroup = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_PRODUCERGROUP);
if (!StringUtils.isEmpty(producerGroup)) {
mqProperties.setProducerGroup(producerGroup);
}
for (Object key : properties.keySet()) {
key = StringUtils.trim(key.toString());
if (((String) key).startsWith(CanalConstants.CANAL_MQ_PROPERTIES)) {
String value = CanalController.getProperty(properties, (String) key);
String subKey = ((String) key).substring(CanalConstants.CANAL_MQ_PROPERTIES.length() + 1);
mqProperties.getProperties().put(subKey, value);
}
}
return mqProperties;
} | java | private static MQProperties buildMQProperties(Properties properties) {
MQProperties mqProperties = new MQProperties();
String servers = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_SERVERS);
if (!StringUtils.isEmpty(servers)) {
mqProperties.setServers(servers);
}
String retires = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_RETRIES);
if (!StringUtils.isEmpty(retires)) {
mqProperties.setRetries(Integer.valueOf(retires));
}
String batchSize = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_BATCHSIZE);
if (!StringUtils.isEmpty(batchSize)) {
mqProperties.setBatchSize(Integer.valueOf(batchSize));
}
String lingerMs = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_LINGERMS);
if (!StringUtils.isEmpty(lingerMs)) {
mqProperties.setLingerMs(Integer.valueOf(lingerMs));
}
String maxRequestSize = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_MAXREQUESTSIZE);
if (!StringUtils.isEmpty(maxRequestSize)) {
mqProperties.setMaxRequestSize(Integer.valueOf(maxRequestSize));
}
String bufferMemory = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_BUFFERMEMORY);
if (!StringUtils.isEmpty(bufferMemory)) {
mqProperties.setBufferMemory(Long.valueOf(bufferMemory));
}
String canalBatchSize = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_CANALBATCHSIZE);
if (!StringUtils.isEmpty(canalBatchSize)) {
mqProperties.setCanalBatchSize(Integer.valueOf(canalBatchSize));
}
String canalGetTimeout = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_CANALGETTIMEOUT);
if (!StringUtils.isEmpty(canalGetTimeout)) {
mqProperties.setCanalGetTimeout(Long.valueOf(canalGetTimeout));
}
String flatMessage = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_FLATMESSAGE);
if (!StringUtils.isEmpty(flatMessage)) {
mqProperties.setFlatMessage(Boolean.valueOf(flatMessage));
}
String compressionType = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_COMPRESSION_TYPE);
if (!StringUtils.isEmpty(compressionType)) {
mqProperties.setCompressionType(compressionType);
}
String acks = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_ACKS);
if (!StringUtils.isEmpty(acks)) {
mqProperties.setAcks(acks);
}
String aliyunAccessKey = CanalController.getProperty(properties, CanalConstants.CANAL_ALIYUN_ACCESSKEY);
if (!StringUtils.isEmpty(aliyunAccessKey)) {
mqProperties.setAliyunAccessKey(aliyunAccessKey);
}
String aliyunSecretKey = CanalController.getProperty(properties, CanalConstants.CANAL_ALIYUN_SECRETKEY);
if (!StringUtils.isEmpty(aliyunSecretKey)) {
mqProperties.setAliyunSecretKey(aliyunSecretKey);
}
String transaction = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_TRANSACTION);
if (!StringUtils.isEmpty(transaction)) {
mqProperties.setTransaction(Boolean.valueOf(transaction));
}
String producerGroup = CanalController.getProperty(properties, CanalConstants.CANAL_MQ_PRODUCERGROUP);
if (!StringUtils.isEmpty(producerGroup)) {
mqProperties.setProducerGroup(producerGroup);
}
for (Object key : properties.keySet()) {
key = StringUtils.trim(key.toString());
if (((String) key).startsWith(CanalConstants.CANAL_MQ_PROPERTIES)) {
String value = CanalController.getProperty(properties, (String) key);
String subKey = ((String) key).substring(CanalConstants.CANAL_MQ_PROPERTIES.length() + 1);
mqProperties.getProperties().put(subKey, value);
}
}
return mqProperties;
} | [
"private",
"static",
"MQProperties",
"buildMQProperties",
"(",
"Properties",
"properties",
")",
"{",
"MQProperties",
"mqProperties",
"=",
"new",
"MQProperties",
"(",
")",
";",
"String",
"servers",
"=",
"CanalController",
".",
"getProperty",
"(",
"properties",
",",
... | 构造MQ对应的配置
@param properties canal.properties 配置
@return | [
"构造MQ对应的配置"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalStater.java#L146-L220 | train | Build MQProperties from properties | [
30522,
2797,
10763,
1049,
4160,
21572,
4842,
7368,
3857,
2213,
4160,
21572,
4842,
7368,
1006,
5144,
5144,
1007,
1063,
1049,
4160,
21572,
4842,
7368,
1049,
4160,
21572,
4842,
7368,
1027,
2047,
1049,
4160,
21572,
4842,
7368,
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/DataSet.java | DataSet.partitionByHash | public <K extends Comparable<K>> PartitionOperator<T> partitionByHash(KeySelector<T, K> keyExtractor) {
final TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keyExtractor, getType());
return new PartitionOperator<>(this, PartitionMethod.HASH, new Keys.SelectorFunctionKeys<>(clean(keyExtractor), this.getType(), keyType), Utils.getCallLocationName());
} | java | public <K extends Comparable<K>> PartitionOperator<T> partitionByHash(KeySelector<T, K> keyExtractor) {
final TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keyExtractor, getType());
return new PartitionOperator<>(this, PartitionMethod.HASH, new Keys.SelectorFunctionKeys<>(clean(keyExtractor), this.getType(), keyType), Utils.getCallLocationName());
} | [
"public",
"<",
"K",
"extends",
"Comparable",
"<",
"K",
">",
">",
"PartitionOperator",
"<",
"T",
">",
"partitionByHash",
"(",
"KeySelector",
"<",
"T",
",",
"K",
">",
"keyExtractor",
")",
"{",
"final",
"TypeInformation",
"<",
"K",
">",
"keyType",
"=",
"Typ... | Partitions a DataSet using the specified KeySelector.
<p><b>Important:</b>This operation shuffles the whole DataSet over the network and can take significant amount of time.
@param keyExtractor The KeyExtractor with which the DataSet is hash-partitioned.
@return The partitioned DataSet.
@see KeySelector | [
"Partitions",
"a",
"DataSet",
"using",
"the",
"specified",
"KeySelector",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1283-L1286 | train | Partitions this DataSet by a hash function. | [
30522,
2270,
1026,
1047,
8908,
12435,
1026,
1047,
1028,
1028,
13571,
25918,
8844,
1026,
1056,
1028,
13571,
3762,
14949,
2232,
1006,
6309,
12260,
16761,
1026,
1056,
1010,
1047,
1028,
3145,
10288,
6494,
16761,
1007,
1063,
2345,
2828,
2378,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getSocketAddr | public InetSocketAddress getSocketAddr(
String hostProperty,
String addressProperty,
String defaultAddressValue,
int defaultPort) {
InetSocketAddress bindAddr = getSocketAddr(
addressProperty, defaultAddressValue, defaultPort);
final String host = get(hostProperty);
if (host == null || host.isEmpty()) {
return bindAddr;
}
return NetUtils.createSocketAddr(
host, bindAddr.getPort(), hostProperty);
} | java | public InetSocketAddress getSocketAddr(
String hostProperty,
String addressProperty,
String defaultAddressValue,
int defaultPort) {
InetSocketAddress bindAddr = getSocketAddr(
addressProperty, defaultAddressValue, defaultPort);
final String host = get(hostProperty);
if (host == null || host.isEmpty()) {
return bindAddr;
}
return NetUtils.createSocketAddr(
host, bindAddr.getPort(), hostProperty);
} | [
"public",
"InetSocketAddress",
"getSocketAddr",
"(",
"String",
"hostProperty",
",",
"String",
"addressProperty",
",",
"String",
"defaultAddressValue",
",",
"int",
"defaultPort",
")",
"{",
"InetSocketAddress",
"bindAddr",
"=",
"getSocketAddr",
"(",
"addressProperty",
","... | Get the socket address for <code>hostProperty</code> as a
<code>InetSocketAddress</code>. If <code>hostProperty</code> is
<code>null</code>, <code>addressProperty</code> will be used. This
is useful for cases where we want to differentiate between host
bind address and address clients should use to establish connection.
@param hostProperty bind host property name.
@param addressProperty address property name.
@param defaultAddressValue the default value
@param defaultPort the default port
@return InetSocketAddress | [
"Get",
"the",
"socket",
"address",
"for",
"<code",
">",
"hostProperty<",
"/",
"code",
">",
"as",
"a",
"<code",
">",
"InetSocketAddress<",
"/",
"code",
">",
".",
"If",
"<code",
">",
"hostProperty<",
"/",
"code",
">",
"is",
"<code",
">",
"null<",
"/",
"c... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2275-L2292 | train | Get the SocketAddress from the properties. | [
30522,
2270,
1999,
8454,
30524,
21572,
4842,
3723,
1010,
5164,
12398,
4215,
16200,
4757,
10175,
5657,
1010,
20014,
12398,
6442,
1007,
1063,
1999,
8454,
7432,
12928,
14141,
8303,
14187,
4215,
13626,
1027,
4152,
7432,
12928,
14141,
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-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.newHashSet | public static <T> HashSet<T> newHashSet(boolean isSorted, Collection<T> collection) {
return isSorted ? new LinkedHashSet<T>(collection) : new HashSet<T>(collection);
} | java | public static <T> HashSet<T> newHashSet(boolean isSorted, Collection<T> collection) {
return isSorted ? new LinkedHashSet<T>(collection) : new HashSet<T>(collection);
} | [
"public",
"static",
"<",
"T",
">",
"HashSet",
"<",
"T",
">",
"newHashSet",
"(",
"boolean",
"isSorted",
",",
"Collection",
"<",
"T",
">",
"collection",
")",
"{",
"return",
"isSorted",
"?",
"new",
"LinkedHashSet",
"<",
"T",
">",
"(",
"collection",
")",
"... | 新建一个HashSet
@param <T> 集合元素类型
@param isSorted 是否有序,有序返回 {@link LinkedHashSet},否则返回{@link HashSet}
@param collection 集合,用于初始化Set
@return HashSet对象 | [
"新建一个HashSet"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L459-L461 | train | Creates a new set of objects from the given collection. | [
30522,
2270,
10763,
1026,
1056,
1028,
23325,
13462,
1026,
1056,
1028,
2047,
14949,
7898,
3388,
1006,
22017,
20898,
26354,
15613,
1010,
3074,
1026,
1056,
1028,
3074,
1007,
1063,
2709,
26354,
15613,
1029,
2047,
5799,
14949,
7898,
3388,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java | MysqlEventParser.buildMysqlConnection | private MysqlConnection buildMysqlConnection(AuthenticationInfo runningInfo) {
MysqlConnection connection = new MysqlConnection(runningInfo.getAddress(),
runningInfo.getUsername(),
runningInfo.getPassword(),
connectionCharsetNumber,
runningInfo.getDefaultDatabaseName());
connection.getConnector().setReceiveBufferSize(receiveBufferSize);
connection.getConnector().setSendBufferSize(sendBufferSize);
connection.getConnector().setSoTimeout(defaultConnectionTimeoutInSeconds * 1000);
connection.setCharset(connectionCharset);
connection.setReceivedBinlogBytes(receivedBinlogBytes);
// 随机生成slaveId
if (this.slaveId <= 0) {
this.slaveId = generateUniqueServerId();
}
connection.setSlaveId(this.slaveId);
return connection;
} | java | private MysqlConnection buildMysqlConnection(AuthenticationInfo runningInfo) {
MysqlConnection connection = new MysqlConnection(runningInfo.getAddress(),
runningInfo.getUsername(),
runningInfo.getPassword(),
connectionCharsetNumber,
runningInfo.getDefaultDatabaseName());
connection.getConnector().setReceiveBufferSize(receiveBufferSize);
connection.getConnector().setSendBufferSize(sendBufferSize);
connection.getConnector().setSoTimeout(defaultConnectionTimeoutInSeconds * 1000);
connection.setCharset(connectionCharset);
connection.setReceivedBinlogBytes(receivedBinlogBytes);
// 随机生成slaveId
if (this.slaveId <= 0) {
this.slaveId = generateUniqueServerId();
}
connection.setSlaveId(this.slaveId);
return connection;
} | [
"private",
"MysqlConnection",
"buildMysqlConnection",
"(",
"AuthenticationInfo",
"runningInfo",
")",
"{",
"MysqlConnection",
"connection",
"=",
"new",
"MysqlConnection",
"(",
"runningInfo",
".",
"getAddress",
"(",
")",
",",
"runningInfo",
".",
"getUsername",
"(",
")",... | =================== helper method ================= | [
"===================",
"helper",
"method",
"================="
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java#L313-L330 | train | Build a MysqlConnection object. | [
30522,
2797,
2026,
2015,
4160,
22499,
10087,
7542,
3857,
8029,
2015,
4160,
22499,
10087,
7542,
1006,
27280,
2378,
14876,
2770,
2378,
14876,
1007,
1063,
2026,
2015,
4160,
22499,
10087,
7542,
4434,
1027,
2047,
2026,
2015,
4160,
22499,
10087,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java | HttpPostRequestEncoder.setBodyHttpDatas | public void setBodyHttpDatas(List<InterfaceHttpData> datas) throws ErrorDataEncoderException {
if (datas == null) {
throw new NullPointerException("datas");
}
globalBodySize = 0;
bodyListDatas.clear();
currentFileUpload = null;
duringMixedMode = false;
multipartHttpDatas.clear();
for (InterfaceHttpData data : datas) {
addBodyHttpData(data);
}
} | java | public void setBodyHttpDatas(List<InterfaceHttpData> datas) throws ErrorDataEncoderException {
if (datas == null) {
throw new NullPointerException("datas");
}
globalBodySize = 0;
bodyListDatas.clear();
currentFileUpload = null;
duringMixedMode = false;
multipartHttpDatas.clear();
for (InterfaceHttpData data : datas) {
addBodyHttpData(data);
}
} | [
"public",
"void",
"setBodyHttpDatas",
"(",
"List",
"<",
"InterfaceHttpData",
">",
"datas",
")",
"throws",
"ErrorDataEncoderException",
"{",
"if",
"(",
"datas",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"datas\"",
")",
";",
"}",
"gl... | Set the Body HttpDatas list
@throws NullPointerException
for datas
@throws ErrorDataEncoderException
if the encoding is in error or if the finalize were already done | [
"Set",
"the",
"Body",
"HttpDatas",
"list"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java#L312-L324 | train | Sets the body http datas. | [
30522,
2270,
30524,
1000,
1007,
1025,
1065,
3795,
23684,
5332,
4371,
1027,
1014,
1025,
2303,
9863,
2850,
10230,
1012,
3154,
1006,
1007,
1025,
2783,
8873,
2571,
6279,
11066,
1027,
19701,
1025,
2076,
4328,
19068,
5302,
3207,
1027,
6270,
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... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getPackedLong | public final long getPackedLong(final int pos) {
final int lead = getUint8(pos);
if (lead < 251) return lead;
switch (lead) {
case 251:
return NULL_LENGTH;
case 252:
return getUint16(pos + 1);
case 253:
return getUint24(pos + 1);
default: /* Must be 254 when here */
return getUint32(pos + 1);
}
} | java | public final long getPackedLong(final int pos) {
final int lead = getUint8(pos);
if (lead < 251) return lead;
switch (lead) {
case 251:
return NULL_LENGTH;
case 252:
return getUint16(pos + 1);
case 253:
return getUint24(pos + 1);
default: /* Must be 254 when here */
return getUint32(pos + 1);
}
} | [
"public",
"final",
"long",
"getPackedLong",
"(",
"final",
"int",
"pos",
")",
"{",
"final",
"int",
"lead",
"=",
"getUint8",
"(",
"pos",
")",
";",
"if",
"(",
"lead",
"<",
"251",
")",
"return",
"lead",
";",
"switch",
"(",
"lead",
")",
"{",
"case",
"25... | Return packed number from buffer. (little-endian) A Packed Integer has
the capacity of storing up to 8-byte integers, while small integers still
can use 1, 3, or 4 bytes. The value of the first byte determines how to
read the number, according to the following table.
<ul>
<li>0-250 The first byte is the number (in the range 0-250). No
additional bytes are used.</li>
<li>252 Two more bytes are used. The number is in the range 251-0xffff.</li>
<li>253 Three more bytes are used. The number is in the range
0xffff-0xffffff.</li>
<li>254 Eight more bytes are used. The number is in the range
0xffffff-0xffffffffffffffff.</li>
</ul>
That representation allows a first byte value of 251 to represent the SQL
NULL value. | [
"Return",
"packed",
"number",
"from",
"buffer",
".",
"(",
"little",
"-",
"endian",
")",
"A",
"Packed",
"Integer",
"has",
"the",
"capacity",
"of",
"storing",
"up",
"to",
"8",
"-",
"byte",
"integers",
"while",
"small",
"integers",
"still",
"can",
"use",
"1... | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L1002-L1016 | train | Gets the packed long value of a
record. | [
30522,
2270,
2345,
2146,
2131,
23947,
2098,
10052,
1006,
2345,
20014,
13433,
2015,
1007,
1063,
2345,
20014,
2599,
1027,
2131,
20023,
2102,
2620,
1006,
13433,
2015,
1007,
1025,
2065,
1006,
2599,
1026,
22582,
1007,
2709,
2599,
1025,
6942,
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... |
networknt/light-4j | server/src/main/java/com/networknt/server/Server.java | Server.register | public static URL register(String serviceId, int port) {
try {
registry = SingletonServiceFactory.getBean(Registry.class);
if (registry == null)
throw new RuntimeException("Could not find registry instance in service map");
// in kubernetes pod, the hostIP is passed in as STATUS_HOST_IP environment
// variable. If this is null
// then get the current server IP as it is not running in Kubernetes.
String ipAddress = System.getenv(STATUS_HOST_IP);
logger.info("Registry IP from STATUS_HOST_IP is " + ipAddress);
if (ipAddress == null) {
InetAddress inetAddress = Util.getInetAddress();
ipAddress = inetAddress.getHostAddress();
logger.info("Could not find IP from STATUS_HOST_IP, use the InetAddress " + ipAddress);
}
ServerConfig serverConfig = getServerConfig();
Map parameters = new HashMap<>();
if (serverConfig.getEnvironment() != null)
parameters.put(ENV_PROPERTY_KEY, serverConfig.getEnvironment());
URL serviceUrl = new URLImpl("light", ipAddress, port, serviceId, parameters);
if (logger.isInfoEnabled()) logger.info("register service: " + serviceUrl.toFullStr());
registry.register(serviceUrl);
return serviceUrl;
// handle the registration exception separately to eliminate confusion
} catch (Exception e) {
System.out.println("Failed to register service, the server stopped.");
e.printStackTrace();
if (logger.isInfoEnabled())
logger.info("Failed to register service, the server stopped.", e);
throw new RuntimeException(e.getMessage());
}
} | java | public static URL register(String serviceId, int port) {
try {
registry = SingletonServiceFactory.getBean(Registry.class);
if (registry == null)
throw new RuntimeException("Could not find registry instance in service map");
// in kubernetes pod, the hostIP is passed in as STATUS_HOST_IP environment
// variable. If this is null
// then get the current server IP as it is not running in Kubernetes.
String ipAddress = System.getenv(STATUS_HOST_IP);
logger.info("Registry IP from STATUS_HOST_IP is " + ipAddress);
if (ipAddress == null) {
InetAddress inetAddress = Util.getInetAddress();
ipAddress = inetAddress.getHostAddress();
logger.info("Could not find IP from STATUS_HOST_IP, use the InetAddress " + ipAddress);
}
ServerConfig serverConfig = getServerConfig();
Map parameters = new HashMap<>();
if (serverConfig.getEnvironment() != null)
parameters.put(ENV_PROPERTY_KEY, serverConfig.getEnvironment());
URL serviceUrl = new URLImpl("light", ipAddress, port, serviceId, parameters);
if (logger.isInfoEnabled()) logger.info("register service: " + serviceUrl.toFullStr());
registry.register(serviceUrl);
return serviceUrl;
// handle the registration exception separately to eliminate confusion
} catch (Exception e) {
System.out.println("Failed to register service, the server stopped.");
e.printStackTrace();
if (logger.isInfoEnabled())
logger.info("Failed to register service, the server stopped.", e);
throw new RuntimeException(e.getMessage());
}
} | [
"public",
"static",
"URL",
"register",
"(",
"String",
"serviceId",
",",
"int",
"port",
")",
"{",
"try",
"{",
"registry",
"=",
"SingletonServiceFactory",
".",
"getBean",
"(",
"Registry",
".",
"class",
")",
";",
"if",
"(",
"registry",
"==",
"null",
")",
"t... | Register the service to the Consul or other service registry. Make it as a separate static method so that it
can be called from light-hybrid-4j to register individual service.
@param serviceId Service Id that is registered
@param port Port number of the service | [
"Register",
"the",
"service",
"to",
"the",
"Consul",
"or",
"other",
"service",
"registry",
".",
"Make",
"it",
"as",
"a",
"separate",
"static",
"method",
"so",
"that",
"it",
"can",
"be",
"called",
"from",
"light",
"-",
"hybrid",
"-",
"4j",
"to",
"register... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/server/src/main/java/com/networknt/server/Server.java#L473-L506 | train | Register a service with the service registry. | [
30522,
2270,
10763,
24471,
2140,
4236,
1006,
5164,
2326,
3593,
1010,
20014,
3417,
1007,
1063,
3046,
1063,
15584,
1027,
28159,
8043,
7903,
12879,
18908,
10253,
1012,
2131,
4783,
2319,
1006,
15584,
1012,
2465,
1007,
1025,
2065,
1006,
15584,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java | ServiceOperations.init | public static void init(Service service, HiveConf configuration) {
Service.STATE state = service.getServiceState();
ensureCurrentState(state, Service.STATE.NOTINITED);
service.init(configuration);
} | java | public static void init(Service service, HiveConf configuration) {
Service.STATE state = service.getServiceState();
ensureCurrentState(state, Service.STATE.NOTINITED);
service.init(configuration);
} | [
"public",
"static",
"void",
"init",
"(",
"Service",
"service",
",",
"HiveConf",
"configuration",
")",
"{",
"Service",
".",
"STATE",
"state",
"=",
"service",
".",
"getServiceState",
"(",
")",
";",
"ensureCurrentState",
"(",
"state",
",",
"Service",
".",
"STAT... | Initialize a service.
The service state is checked <i>before</i> the operation begins.
This process is <i>not</i> thread safe.
@param service a service that must be in the state
{@link Service.STATE#NOTINITED}
@param configuration the configuration to initialize the service with
@throws RuntimeException on a state change failure
@throws IllegalStateException if the service is in the wrong state | [
"Initialize",
"a",
"service",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java#L64-L68 | train | Initializes the service with the given configuration. | [
30522,
2270,
10763,
11675,
1999,
4183,
1006,
2326,
2326,
1010,
26736,
8663,
2546,
9563,
1007,
1063,
2326,
1012,
2110,
2110,
1027,
2326,
1012,
4152,
2121,
7903,
4355,
3686,
1006,
1007,
1025,
5676,
10841,
14343,
7666,
12259,
1006,
2110,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.resize | public static <T> T[] resize(T[] buffer, int newSize, Class<?> componentType) {
T[] newArray = newArray(componentType, newSize);
if (isNotEmpty(buffer)) {
System.arraycopy(buffer, 0, newArray, 0, Math.min(buffer.length, newSize));
}
return newArray;
} | java | public static <T> T[] resize(T[] buffer, int newSize, Class<?> componentType) {
T[] newArray = newArray(componentType, newSize);
if (isNotEmpty(buffer)) {
System.arraycopy(buffer, 0, newArray, 0, Math.min(buffer.length, newSize));
}
return newArray;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"resize",
"(",
"T",
"[",
"]",
"buffer",
",",
"int",
"newSize",
",",
"Class",
"<",
"?",
">",
"componentType",
")",
"{",
"T",
"[",
"]",
"newArray",
"=",
"newArray",
"(",
"componentType",
",",
"newSize... | 生成一个新的重新设置大小的数组<br>
调整大小后拷贝原数组到新数组下。扩大则占位前N个位置,缩小则截断
@param <T> 数组元素类型
@param buffer 原数组
@param newSize 新的数组大小
@param componentType 数组元素类型
@return 调整后的新数组 | [
"生成一个新的重新设置大小的数组<br",
">",
"调整大小后拷贝原数组到新数组下。扩大则占位前N个位置,缩小则截断"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L506-L512 | train | Resize the given array to the given size. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
1031,
1033,
24501,
4697,
1006,
1056,
1031,
1033,
17698,
1010,
20014,
2739,
4697,
1010,
30524,
6922,
13874,
1010,
2739,
4697,
1007,
1025,
2065,
1006,
3475,
12184,
27718,
2100,
1006,
17698,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dictionary/DictionaryMaker.java | DictionaryMaker.add | public void add(IWord word)
{
Item item = trie.get(word.getValue());
if (item == null)
{
item = new Item(word.getValue(), word.getLabel());
trie.put(item.key, item);
}
else
{
item.addLabel(word.getLabel());
}
} | java | public void add(IWord word)
{
Item item = trie.get(word.getValue());
if (item == null)
{
item = new Item(word.getValue(), word.getLabel());
trie.put(item.key, item);
}
else
{
item.addLabel(word.getLabel());
}
} | [
"public",
"void",
"add",
"(",
"IWord",
"word",
")",
"{",
"Item",
"item",
"=",
"trie",
".",
"get",
"(",
"word",
".",
"getValue",
"(",
")",
")",
";",
"if",
"(",
"item",
"==",
"null",
")",
"{",
"item",
"=",
"new",
"Item",
"(",
"word",
".",
"getVal... | 向词典中加入一个词语
@param word 词语 | [
"向词典中加入一个词语"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/DictionaryMaker.java#L44-L56 | train | Add a single entry to the CRA. | [
30522,
2270,
11675,
5587,
1006,
1045,
18351,
2773,
1007,
1063,
8875,
8875,
1027,
13012,
2063,
1012,
2131,
1006,
2773,
1012,
2131,
10175,
5657,
1006,
1007,
1007,
1025,
2065,
1006,
8875,
1027,
1027,
19701,
1007,
1063,
8875,
1027,
2047,
8875,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.initializeLocationForSavepoint | @Override
public CheckpointStorageLocation initializeLocationForSavepoint(
@SuppressWarnings("unused") long checkpointId,
@Nullable String externalLocationPointer) throws IOException {
// determine where to write the savepoint to
final Path savepointBasePath;
if (externalLocationPointer != null) {
savepointBasePath = new Path(externalLocationPointer);
}
else if (defaultSavepointDirectory != null) {
savepointBasePath = defaultSavepointDirectory;
}
else {
throw new IllegalArgumentException("No savepoint location given and no default location configured.");
}
// generate the savepoint directory
final FileSystem fs = savepointBasePath.getFileSystem();
final String prefix = "savepoint-" + jobId.toString().substring(0, 6) + '-';
Exception latestException = null;
for (int attempt = 0; attempt < 10; attempt++) {
final Path path = new Path(savepointBasePath, FileUtils.getRandomFilename(prefix));
try {
if (fs.mkdirs(path)) {
// we make the path qualified, to make it independent of default schemes and authorities
final Path qp = path.makeQualified(fs);
return createSavepointLocation(fs, qp);
}
} catch (Exception e) {
latestException = e;
}
}
throw new IOException("Failed to create savepoint directory at " + savepointBasePath, latestException);
} | java | @Override
public CheckpointStorageLocation initializeLocationForSavepoint(
@SuppressWarnings("unused") long checkpointId,
@Nullable String externalLocationPointer) throws IOException {
// determine where to write the savepoint to
final Path savepointBasePath;
if (externalLocationPointer != null) {
savepointBasePath = new Path(externalLocationPointer);
}
else if (defaultSavepointDirectory != null) {
savepointBasePath = defaultSavepointDirectory;
}
else {
throw new IllegalArgumentException("No savepoint location given and no default location configured.");
}
// generate the savepoint directory
final FileSystem fs = savepointBasePath.getFileSystem();
final String prefix = "savepoint-" + jobId.toString().substring(0, 6) + '-';
Exception latestException = null;
for (int attempt = 0; attempt < 10; attempt++) {
final Path path = new Path(savepointBasePath, FileUtils.getRandomFilename(prefix));
try {
if (fs.mkdirs(path)) {
// we make the path qualified, to make it independent of default schemes and authorities
final Path qp = path.makeQualified(fs);
return createSavepointLocation(fs, qp);
}
} catch (Exception e) {
latestException = e;
}
}
throw new IOException("Failed to create savepoint directory at " + savepointBasePath, latestException);
} | [
"@",
"Override",
"public",
"CheckpointStorageLocation",
"initializeLocationForSavepoint",
"(",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"long",
"checkpointId",
",",
"@",
"Nullable",
"String",
"externalLocationPointer",
")",
"throws",
"IOException",
"{",
"// determ... | Creates a file system based storage location for a savepoint.
<p>This methods implements the logic that decides which location to use (given optional
parameters for a configured location and a location passed for this specific savepoint)
and how to name and initialize the savepoint directory.
@param externalLocationPointer The target location pointer for the savepoint.
Must be a valid URI. Null, if not supplied.
@param checkpointId The checkpoint ID of the savepoint.
@return The checkpoint storage location for the savepoint.
@throws IOException Thrown if the target directory could not be created. | [
"Creates",
"a",
"file",
"system",
"based",
"storage",
"location",
"for",
"a",
"savepoint",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/AbstractFsCheckpointStorage.java#L127-L167 | train | Initialize the location for a savepoint. | [
30522,
1030,
2058,
15637,
2270,
26520,
23809,
4270,
4135,
10719,
3988,
4697,
4135,
10719,
29278,
3736,
3726,
8400,
1006,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
15171,
1000,
1007,
2146,
26520,
3593,
1010,
1030,
19701,
3085,
5164,
6327,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/Unpooled.java | Unpooled.wrappedBuffer | public static ByteBuf wrappedBuffer(int maxNumComponents, ByteBuffer... buffers) {
return wrappedBuffer(maxNumComponents, CompositeByteBuf.BYTE_BUFFER_WRAPPER, buffers);
} | java | public static ByteBuf wrappedBuffer(int maxNumComponents, ByteBuffer... buffers) {
return wrappedBuffer(maxNumComponents, CompositeByteBuf.BYTE_BUFFER_WRAPPER, buffers);
} | [
"public",
"static",
"ByteBuf",
"wrappedBuffer",
"(",
"int",
"maxNumComponents",
",",
"ByteBuffer",
"...",
"buffers",
")",
"{",
"return",
"wrappedBuffer",
"(",
"maxNumComponents",
",",
"CompositeByteBuf",
".",
"BYTE_BUFFER_WRAPPER",
",",
"buffers",
")",
";",
"}"
] | Creates a new big-endian composite buffer which wraps the slices of the specified
NIO buffers without copying them. A modification on the content of the
specified buffers will be visible to the returned buffer. | [
"Creates",
"a",
"new",
"big",
"-",
"endian",
"composite",
"buffer",
"which",
"wraps",
"the",
"slices",
"of",
"the",
"specified",
"NIO",
"buffers",
"without",
"copying",
"them",
".",
"A",
"modification",
"on",
"the",
"content",
"of",
"the",
"specified",
"buff... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L336-L338 | train | Creates a new byte buffer that wraps the given byte buffers. | [
30522,
2270,
10763,
24880,
8569,
2546,
5058,
8569,
12494,
1006,
20014,
4098,
19172,
9006,
29513,
7666,
1010,
24880,
8569,
12494,
1012,
1012,
1012,
17698,
2015,
1007,
1063,
2709,
5058,
8569,
12494,
1006,
4098,
19172,
9006,
29513,
7666,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java | HashCodeBuilder.reflectionHashCode | public static int reflectionHashCode(final Object object, final String... excludeFields) {
return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object, false,
null, excludeFields);
} | java | public static int reflectionHashCode(final Object object, final String... excludeFields) {
return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object, false,
null, excludeFields);
} | [
"public",
"static",
"int",
"reflectionHashCode",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"...",
"excludeFields",
")",
"{",
"return",
"reflectionHashCode",
"(",
"DEFAULT_INITIAL_VALUE",
",",
"DEFAULT_MULTIPLIER_VALUE",
",",
"object",
",",
"false",
"... | <p>
Uses reflection to build a valid hash code from the fields of {@code object}.
</p>
<p>
This constructor uses two hard coded choices for the constants needed to build a hash code.
</p>
<p>
It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
also not as efficient as testing explicitly.
</p>
<p>
Transient members will be not be used, as they are likely derived fields, and not part of the value of the
<code>Object</code>.
</p>
<p>
Static fields will not be tested. Superclass fields will be included. If no fields are found to include
in the hash code, the result of this method will be constant.
</p>
@param object
the Object to create a <code>hashCode</code> for
@param excludeFields
array of field names to exclude from use in calculation of hash code
@return int hash code
@throws IllegalArgumentException
if the object is <code>null</code> | [
"<p",
">",
"Uses",
"reflection",
"to",
"build",
"a",
"valid",
"hash",
"code",
"from",
"the",
"fields",
"of",
"{",
"@code",
"object",
"}",
".",
"<",
"/",
"p",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java#L457-L460 | train | Get the hashCode of the given object using reflection. | [
30522,
2270,
10763,
20014,
9185,
14949,
16257,
10244,
1006,
2345,
4874,
4874,
1010,
2345,
5164,
1012,
1012,
1012,
23329,
15155,
1007,
1063,
2709,
9185,
14949,
16257,
10244,
1006,
12398,
1035,
3988,
1035,
3643,
1010,
12398,
1035,
4800,
24759,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | service/src/main/java/com/networknt/service/ServiceUtil.java | ServiceUtil.constructByNamedParams | public static Object constructByNamedParams(Class clazz, Map params) throws Exception {
Object obj = clazz.getConstructor().newInstance();
Method[] allMethods = clazz.getMethods();
for(Method method : allMethods) {
if(method.getName().startsWith("set")) {
Object [] o = new Object [1];
String propertyName = Introspector.decapitalize(method.getName().substring(3));
if (params.containsKey(propertyName)) {
o[0] = params.get(propertyName);
method.invoke(obj, o);
}
}
}
return obj;
} | java | public static Object constructByNamedParams(Class clazz, Map params) throws Exception {
Object obj = clazz.getConstructor().newInstance();
Method[] allMethods = clazz.getMethods();
for(Method method : allMethods) {
if(method.getName().startsWith("set")) {
Object [] o = new Object [1];
String propertyName = Introspector.decapitalize(method.getName().substring(3));
if (params.containsKey(propertyName)) {
o[0] = params.get(propertyName);
method.invoke(obj, o);
}
}
}
return obj;
} | [
"public",
"static",
"Object",
"constructByNamedParams",
"(",
"Class",
"clazz",
",",
"Map",
"params",
")",
"throws",
"Exception",
"{",
"Object",
"obj",
"=",
"clazz",
".",
"getConstructor",
"(",
")",
".",
"newInstance",
"(",
")",
";",
"Method",
"[",
"]",
"al... | Build an object out of a given class and a map for field names to values.
@param clazz The class to be created.
@param params A map of the parameters.
@return An instantiated object.
@throws Exception when constructor fails. | [
"Build",
"an",
"object",
"out",
"of",
"a",
"given",
"class",
"and",
"a",
"map",
"for",
"field",
"names",
"to",
"values",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/ServiceUtil.java#L66-L81 | train | Construct by named params. | [
30522,
2270,
10763,
4874,
9570,
3762,
18442,
18927,
5400,
5244,
1006,
2465,
18856,
10936,
2480,
1010,
4949,
11498,
5244,
1007,
11618,
6453,
1063,
4874,
27885,
3501,
1027,
18856,
10936,
2480,
1012,
2131,
8663,
3367,
6820,
16761,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.list | public static <T> List<T> list(boolean isLinked, Enumeration<T> enumration) {
final List<T> list = list(isLinked);
if (null != enumration) {
while (enumration.hasMoreElements()) {
list.add(enumration.nextElement());
}
}
return list;
} | java | public static <T> List<T> list(boolean isLinked, Enumeration<T> enumration) {
final List<T> list = list(isLinked);
if (null != enumration) {
while (enumration.hasMoreElements()) {
list.add(enumration.nextElement());
}
}
return list;
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"list",
"(",
"boolean",
"isLinked",
",",
"Enumeration",
"<",
"T",
">",
"enumration",
")",
"{",
"final",
"List",
"<",
"T",
">",
"list",
"=",
"list",
"(",
"isLinked",
")",
";",
"if",
"(",
"n... | 新建一个List<br>
提供的参数为null时返回空{@link ArrayList}
@param <T> 集合元素类型
@param isLinked 是否新建LinkedList
@param enumration {@link Enumeration}
@return ArrayList对象
@since 3.0.8 | [
"新建一个List<br",
">",
"提供的参数为null时返回空",
"{",
"@link",
"ArrayList",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L600-L608 | train | Creates a list of objects from an enumeration. | [
30522,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
2862,
1006,
22017,
20898,
2003,
13767,
2098,
1010,
4372,
17897,
8156,
1026,
1056,
1028,
4372,
2819,
8156,
1007,
1063,
2345,
2862,
1026,
1056,
1028,
2862,
1027,
2862,
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-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java | ParameterTool.fromPropertiesFile | public static ParameterTool fromPropertiesFile(InputStream inputStream) throws IOException {
Properties props = new Properties();
props.load(inputStream);
return fromMap((Map) props);
} | java | public static ParameterTool fromPropertiesFile(InputStream inputStream) throws IOException {
Properties props = new Properties();
props.load(inputStream);
return fromMap((Map) props);
} | [
"public",
"static",
"ParameterTool",
"fromPropertiesFile",
"(",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"props",
".",
"load",
"(",
"inputStream",
")",
";",
"return",
"fromMa... | Returns {@link ParameterTool} for the given InputStream from {@link Properties} file.
@param inputStream InputStream from the properties file
@return A {@link ParameterTool}
@throws IOException If the file does not exist
@see Properties | [
"Returns",
"{",
"@link",
"ParameterTool",
"}",
"for",
"the",
"given",
"InputStream",
"from",
"{",
"@link",
"Properties",
"}",
"file",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L150-L154 | train | Creates a ParameterTool from a properties file. | [
30522,
2270,
10763,
16381,
3406,
4747,
2013,
21572,
4842,
7368,
8873,
2571,
1006,
20407,
25379,
20407,
25379,
1007,
11618,
22834,
10288,
24422,
1063,
5144,
24387,
1027,
2047,
5144,
1006,
1007,
1025,
24387,
1012,
7170,
1006,
20407,
25379,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/dialect/sqlserver/clause/SQLServerTopClauseParser.java | SQLServerTopClauseParser.parse | public void parse(final SelectStatement selectStatement) {
if (!lexerEngine.skipIfEqual(SQLServerKeyword.TOP)) {
return;
}
int beginPosition = lexerEngine.getCurrentToken().getEndPosition();
if (!lexerEngine.skipIfEqual(Symbol.LEFT_PAREN)) {
beginPosition = lexerEngine.getCurrentToken().getEndPosition() - lexerEngine.getCurrentToken().getLiterals().length();
}
SQLExpression sqlExpression = basicExpressionParser.parse(selectStatement);
lexerEngine.skipIfEqual(Symbol.RIGHT_PAREN);
LimitValue rowCountValue;
if (sqlExpression instanceof SQLNumberExpression) {
int rowCount = ((SQLNumberExpression) sqlExpression).getNumber().intValue();
rowCountValue = new LimitValue(rowCount, -1, false);
selectStatement.addSQLToken(new RowCountToken(beginPosition, rowCount));
} else if (sqlExpression instanceof SQLParameterMarkerExpression) {
rowCountValue = new LimitValue(-1, ((SQLParameterMarkerExpression) sqlExpression).getIndex(), false);
} else {
throw new SQLParsingException(lexerEngine);
}
lexerEngine.unsupportedIfEqual(SQLServerKeyword.PERCENT);
lexerEngine.skipIfEqual(DefaultKeyword.WITH, SQLServerKeyword.TIES);
if (null == selectStatement.getLimit()) {
Limit limit = new Limit();
limit.setRowCount(rowCountValue);
selectStatement.setLimit(limit);
} else {
selectStatement.getLimit().setRowCount(rowCountValue);
}
} | java | public void parse(final SelectStatement selectStatement) {
if (!lexerEngine.skipIfEqual(SQLServerKeyword.TOP)) {
return;
}
int beginPosition = lexerEngine.getCurrentToken().getEndPosition();
if (!lexerEngine.skipIfEqual(Symbol.LEFT_PAREN)) {
beginPosition = lexerEngine.getCurrentToken().getEndPosition() - lexerEngine.getCurrentToken().getLiterals().length();
}
SQLExpression sqlExpression = basicExpressionParser.parse(selectStatement);
lexerEngine.skipIfEqual(Symbol.RIGHT_PAREN);
LimitValue rowCountValue;
if (sqlExpression instanceof SQLNumberExpression) {
int rowCount = ((SQLNumberExpression) sqlExpression).getNumber().intValue();
rowCountValue = new LimitValue(rowCount, -1, false);
selectStatement.addSQLToken(new RowCountToken(beginPosition, rowCount));
} else if (sqlExpression instanceof SQLParameterMarkerExpression) {
rowCountValue = new LimitValue(-1, ((SQLParameterMarkerExpression) sqlExpression).getIndex(), false);
} else {
throw new SQLParsingException(lexerEngine);
}
lexerEngine.unsupportedIfEqual(SQLServerKeyword.PERCENT);
lexerEngine.skipIfEqual(DefaultKeyword.WITH, SQLServerKeyword.TIES);
if (null == selectStatement.getLimit()) {
Limit limit = new Limit();
limit.setRowCount(rowCountValue);
selectStatement.setLimit(limit);
} else {
selectStatement.getLimit().setRowCount(rowCountValue);
}
} | [
"public",
"void",
"parse",
"(",
"final",
"SelectStatement",
"selectStatement",
")",
"{",
"if",
"(",
"!",
"lexerEngine",
".",
"skipIfEqual",
"(",
"SQLServerKeyword",
".",
"TOP",
")",
")",
"{",
"return",
";",
"}",
"int",
"beginPosition",
"=",
"lexerEngine",
".... | Parse top.
@param selectStatement select statement | [
"Parse",
"top",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/dialect/sqlserver/clause/SQLServerTopClauseParser.java#L57-L86 | train | Parse the SQL statement. | [
30522,
2270,
11675,
11968,
3366,
1006,
2345,
27034,
12259,
3672,
27034,
12259,
3672,
1007,
1063,
2065,
1006,
999,
17244,
7869,
3070,
3170,
1012,
13558,
29323,
26426,
1006,
29296,
8043,
6299,
14839,
18351,
1012,
2327,
1007,
1007,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcUtils.java | RpcUtils.extractImplementedRpcGateways | public static Set<Class<? extends RpcGateway>> extractImplementedRpcGateways(Class<?> clazz) {
HashSet<Class<? extends RpcGateway>> interfaces = new HashSet<>();
while (clazz != null) {
for (Class<?> interfaze : clazz.getInterfaces()) {
if (RpcGateway.class.isAssignableFrom(interfaze)) {
interfaces.add((Class<? extends RpcGateway>) interfaze);
}
}
clazz = clazz.getSuperclass();
}
return interfaces;
} | java | public static Set<Class<? extends RpcGateway>> extractImplementedRpcGateways(Class<?> clazz) {
HashSet<Class<? extends RpcGateway>> interfaces = new HashSet<>();
while (clazz != null) {
for (Class<?> interfaze : clazz.getInterfaces()) {
if (RpcGateway.class.isAssignableFrom(interfaze)) {
interfaces.add((Class<? extends RpcGateway>) interfaze);
}
}
clazz = clazz.getSuperclass();
}
return interfaces;
} | [
"public",
"static",
"Set",
"<",
"Class",
"<",
"?",
"extends",
"RpcGateway",
">",
">",
"extractImplementedRpcGateways",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"HashSet",
"<",
"Class",
"<",
"?",
"extends",
"RpcGateway",
">",
">",
"interfaces",
"=",
... | Extracts all {@link RpcGateway} interfaces implemented by the given clazz.
@param clazz from which to extract the implemented RpcGateway interfaces
@return A set of all implemented RpcGateway interfaces | [
"Extracts",
"all",
"{",
"@link",
"RpcGateway",
"}",
"interfaces",
"implemented",
"by",
"the",
"given",
"clazz",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcUtils.java#L51-L65 | train | Extract all implemented RpcGateways from a class. | [
30522,
2270,
10763,
2275,
1026,
2465,
1026,
1029,
8908,
1054,
15042,
5867,
4576,
1028,
1028,
14817,
5714,
10814,
3672,
2098,
14536,
2278,
5867,
14035,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1007,
1063,
23325,
13462,
1026,
2465,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java | RabbitProperties.determinePassword | public String determinePassword() {
if (CollectionUtils.isEmpty(this.parsedAddresses)) {
return getPassword();
}
Address address = this.parsedAddresses.get(0);
return (address.password != null) ? address.password : getPassword();
} | java | public String determinePassword() {
if (CollectionUtils.isEmpty(this.parsedAddresses)) {
return getPassword();
}
Address address = this.parsedAddresses.get(0);
return (address.password != null) ? address.password : getPassword();
} | [
"public",
"String",
"determinePassword",
"(",
")",
"{",
"if",
"(",
"CollectionUtils",
".",
"isEmpty",
"(",
"this",
".",
"parsedAddresses",
")",
")",
"{",
"return",
"getPassword",
"(",
")",
";",
"}",
"Address",
"address",
"=",
"this",
".",
"parsedAddresses",
... | If addresses have been set and the first address has a password it is returned.
Otherwise returns the result of calling {@code getPassword()}.
@return the password or {@code null}
@see #setAddresses(String)
@see #getPassword() | [
"If",
"addresses",
"have",
"been",
"set",
"and",
"the",
"first",
"address",
"has",
"a",
"password",
"it",
"is",
"returned",
".",
"Otherwise",
"returns",
"the",
"result",
"of",
"calling",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java#L228-L234 | train | Determine the password for the user. | [
30522,
2270,
5164,
5646,
15194,
18351,
1006,
1007,
1063,
2065,
1006,
3074,
21823,
4877,
1012,
2003,
6633,
13876,
2100,
1006,
2023,
1012,
11968,
6924,
4215,
16200,
11393,
2015,
1007,
1007,
1063,
2709,
2131,
15194,
18351,
1006,
1007,
1025,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java | MDAG.addTransitionPath | private void addTransitionPath(MDAGNode originNode, String str)
{
if (!str.isEmpty())
{
MDAGNode currentNode = originNode;
int charCount = str.length();
//Loop through the characters in str, iteratevely adding
// a _transition path corresponding to it from originNode
for (int i = 0; i < charCount; i++, transitionCount++)
{
char currentChar = str.charAt(i);
boolean isLastChar = (i == charCount - 1);
currentNode = currentNode.addOutgoingTransition(currentChar, isLastChar);
charTreeSet.add(currentChar);
}
/////
}
else
originNode.setAcceptStateStatus(true);
} | java | private void addTransitionPath(MDAGNode originNode, String str)
{
if (!str.isEmpty())
{
MDAGNode currentNode = originNode;
int charCount = str.length();
//Loop through the characters in str, iteratevely adding
// a _transition path corresponding to it from originNode
for (int i = 0; i < charCount; i++, transitionCount++)
{
char currentChar = str.charAt(i);
boolean isLastChar = (i == charCount - 1);
currentNode = currentNode.addOutgoingTransition(currentChar, isLastChar);
charTreeSet.add(currentChar);
}
/////
}
else
originNode.setAcceptStateStatus(true);
} | [
"private",
"void",
"addTransitionPath",
"(",
"MDAGNode",
"originNode",
",",
"String",
"str",
")",
"{",
"if",
"(",
"!",
"str",
".",
"isEmpty",
"(",
")",
")",
"{",
"MDAGNode",
"currentNode",
"=",
"originNode",
";",
"int",
"charCount",
"=",
"str",
".",
"len... | 给节点添加一个转移路径<br>
Adds a _transition path starting from a specific node in the MDAG.
@param originNode the MDAGNode which will serve as the start point of the to-be-created _transition path
@param str the String to be used to create a new _transition path from {@code originNode} | [
"给节点添加一个转移路径<br",
">",
"Adds",
"a",
"_transition",
"path",
"starting",
"from",
"a",
"specific",
"node",
"in",
"the",
"MDAG",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L574-L595 | train | Add a _transition path to the MDAGNode. | [
30522,
2797,
11675,
30524,
9108,
8490,
3630,
3207,
2783,
3630,
3207,
1027,
4761,
3630,
3207,
1025,
20014,
25869,
3597,
16671,
1027,
2358,
2099,
1012,
3091,
1006,
1007,
1025,
1013,
1013,
7077,
2083,
1996,
3494,
1999,
2358,
2099,
1010,
2009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java | HashUtil.rotatingHash | public static int rotatingHash(String key, int prime) {
int hash, i;
for (hash = key.length(), i = 0; i < key.length(); ++i) {
hash = (hash << 4) ^ (hash >> 28) ^ key.charAt(i);
}
// 使用:hash = (hash ^ (hash>>10) ^ (hash>>20)) & mask;
// 替代:hash %= prime;
// return (hash ^ (hash>>10) ^ (hash>>20));
return hash % prime;
} | java | public static int rotatingHash(String key, int prime) {
int hash, i;
for (hash = key.length(), i = 0; i < key.length(); ++i) {
hash = (hash << 4) ^ (hash >> 28) ^ key.charAt(i);
}
// 使用:hash = (hash ^ (hash>>10) ^ (hash>>20)) & mask;
// 替代:hash %= prime;
// return (hash ^ (hash>>10) ^ (hash>>20));
return hash % prime;
} | [
"public",
"static",
"int",
"rotatingHash",
"(",
"String",
"key",
",",
"int",
"prime",
")",
"{",
"int",
"hash",
",",
"i",
";",
"for",
"(",
"hash",
"=",
"key",
".",
"length",
"(",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"key",
".",
"length",
"(",... | 旋转hash
@param key 输入字符串
@param prime 质数
@return hash值 | [
"旋转hash"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java#L35-L45 | train | Returns the hash value of the given key. | [
30522,
2270,
10763,
20014,
13618,
14949,
2232,
1006,
5164,
3145,
1010,
20014,
3539,
1007,
1063,
20014,
23325,
1010,
1045,
1025,
2005,
1006,
23325,
1027,
3145,
1012,
3091,
1006,
1007,
1010,
1045,
1027,
1014,
1025,
1045,
1026,
3145,
1012,
309... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AvroDeserializationSchema.java | AvroDeserializationSchema.forSpecific | public static <T extends SpecificRecord> AvroDeserializationSchema<T> forSpecific(Class<T> tClass) {
return new AvroDeserializationSchema<>(tClass, null);
} | java | public static <T extends SpecificRecord> AvroDeserializationSchema<T> forSpecific(Class<T> tClass) {
return new AvroDeserializationSchema<>(tClass, null);
} | [
"public",
"static",
"<",
"T",
"extends",
"SpecificRecord",
">",
"AvroDeserializationSchema",
"<",
"T",
">",
"forSpecific",
"(",
"Class",
"<",
"T",
">",
"tClass",
")",
"{",
"return",
"new",
"AvroDeserializationSchema",
"<>",
"(",
"tClass",
",",
"null",
")",
"... | Creates {@link AvroDeserializationSchema} that produces classes that were generated from avro schema.
@param tClass class of record to be produced
@return deserialized record | [
"Creates",
"{",
"@link",
"AvroDeserializationSchema",
"}",
"that",
"produces",
"classes",
"that",
"were",
"generated",
"from",
"avro",
"schema",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroDeserializationSchema.java#L65-L67 | train | Create an AvroDeserializationSchema for a specific class. | [
30522,
2270,
10763,
1026,
1056,
8908,
3563,
2890,
27108,
2094,
1028,
20704,
14127,
6810,
14482,
22318,
5403,
2863,
1026,
1056,
1028,
2005,
13102,
8586,
18513,
1006,
2465,
1026,
1056,
1028,
22975,
27102,
1007,
1063,
2709,
2047,
20704,
14127,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/GraphCsvReader.java | GraphCsvReader.types | @SuppressWarnings("unchecked")
public <K, VV, EV> Graph<K, VV, EV> types(Class<K> vertexKey, Class<VV> vertexValue,
Class<EV> edgeValue) {
if (edgeReader == null) {
throw new RuntimeException("The edge input file cannot be null!");
}
DataSet<Tuple3<K, K, EV>> edges = edgeReader.types(vertexKey, vertexKey, edgeValue);
// the vertex value can be provided by an input file or a user-defined mapper
if (vertexReader != null) {
DataSet<Tuple2<K, VV>> vertices = vertexReader
.types(vertexKey, vertexValue)
.name(GraphCsvReader.class.getName());
return Graph.fromTupleDataSet(vertices, edges, executionContext);
}
else if (mapper != null) {
return Graph.fromTupleDataSet(edges, (MapFunction<K, VV>) mapper, executionContext);
}
else {
throw new RuntimeException("Vertex values have to be specified through a vertices input file"
+ "or a user-defined map function.");
}
} | java | @SuppressWarnings("unchecked")
public <K, VV, EV> Graph<K, VV, EV> types(Class<K> vertexKey, Class<VV> vertexValue,
Class<EV> edgeValue) {
if (edgeReader == null) {
throw new RuntimeException("The edge input file cannot be null!");
}
DataSet<Tuple3<K, K, EV>> edges = edgeReader.types(vertexKey, vertexKey, edgeValue);
// the vertex value can be provided by an input file or a user-defined mapper
if (vertexReader != null) {
DataSet<Tuple2<K, VV>> vertices = vertexReader
.types(vertexKey, vertexValue)
.name(GraphCsvReader.class.getName());
return Graph.fromTupleDataSet(vertices, edges, executionContext);
}
else if (mapper != null) {
return Graph.fromTupleDataSet(edges, (MapFunction<K, VV>) mapper, executionContext);
}
else {
throw new RuntimeException("Vertex values have to be specified through a vertices input file"
+ "or a user-defined map function.");
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"types",
"(",
"Class",
"<",
"K",
">",
"vertexKey",
",",
"Class",
"<",
"VV",
">",
"vertexValue",
",",
... | Creates a Graph from CSV input with vertex values and edge values.
The vertex values are specified through a vertices input file or a user-defined map function.
@param vertexKey the type of the vertex IDs
@param vertexValue the type of the vertex values
@param edgeValue the type of the edge values
@return a Graph with vertex and edge values. | [
"Creates",
"a",
"Graph",
"from",
"CSV",
"input",
"with",
"vertex",
"values",
"and",
"edge",
"values",
".",
"The",
"vertex",
"values",
"are",
"specified",
"through",
"a",
"vertices",
"input",
"file",
"or",
"a",
"user",
"-",
"defined",
"map",
"function",
"."... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/GraphCsvReader.java#L101-L126 | train | Returns a Graph from CSV input data set of vertex values and edge values. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
4127,
1006,
2465,
1026,
1047,
1028,
19449,
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... |
apache/flink | flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/utils/HadoopUtils.java | HadoopUtils.getHadoopConfiguration | public static Configuration getHadoopConfiguration(org.apache.flink.configuration.Configuration flinkConfiguration) {
Configuration retConf = new Configuration();
// We need to load both core-site.xml and hdfs-site.xml to determine the default fs path and
// the hdfs configuration
// Try to load HDFS configuration from Hadoop's own configuration files
// 1. approach: Flink configuration
final String hdfsDefaultPath = flinkConfiguration.getString(ConfigConstants
.HDFS_DEFAULT_CONFIG, null);
if (hdfsDefaultPath != null) {
retConf.addResource(new org.apache.hadoop.fs.Path(hdfsDefaultPath));
} else {
LOG.debug("Cannot find hdfs-default configuration file");
}
final String hdfsSitePath = flinkConfiguration.getString(ConfigConstants.HDFS_SITE_CONFIG, null);
if (hdfsSitePath != null) {
retConf.addResource(new org.apache.hadoop.fs.Path(hdfsSitePath));
} else {
LOG.debug("Cannot find hdfs-site configuration file");
}
// 2. Approach environment variables
String[] possibleHadoopConfPaths = new String[4];
possibleHadoopConfPaths[0] = flinkConfiguration.getString(ConfigConstants.PATH_HADOOP_CONFIG, null);
possibleHadoopConfPaths[1] = System.getenv("HADOOP_CONF_DIR");
if (System.getenv("HADOOP_HOME") != null) {
possibleHadoopConfPaths[2] = System.getenv("HADOOP_HOME") + "/conf";
possibleHadoopConfPaths[3] = System.getenv("HADOOP_HOME") + "/etc/hadoop"; // hadoop 2.2
}
for (String possibleHadoopConfPath : possibleHadoopConfPaths) {
if (possibleHadoopConfPath != null) {
if (new File(possibleHadoopConfPath).exists()) {
if (new File(possibleHadoopConfPath + "/core-site.xml").exists()) {
retConf.addResource(new org.apache.hadoop.fs.Path(possibleHadoopConfPath + "/core-site.xml"));
if (LOG.isDebugEnabled()) {
LOG.debug("Adding " + possibleHadoopConfPath + "/core-site.xml to hadoop configuration");
}
}
if (new File(possibleHadoopConfPath + "/hdfs-site.xml").exists()) {
retConf.addResource(new org.apache.hadoop.fs.Path(possibleHadoopConfPath + "/hdfs-site.xml"));
if (LOG.isDebugEnabled()) {
LOG.debug("Adding " + possibleHadoopConfPath + "/hdfs-site.xml to hadoop configuration");
}
}
}
}
}
return retConf;
} | java | public static Configuration getHadoopConfiguration(org.apache.flink.configuration.Configuration flinkConfiguration) {
Configuration retConf = new Configuration();
// We need to load both core-site.xml and hdfs-site.xml to determine the default fs path and
// the hdfs configuration
// Try to load HDFS configuration from Hadoop's own configuration files
// 1. approach: Flink configuration
final String hdfsDefaultPath = flinkConfiguration.getString(ConfigConstants
.HDFS_DEFAULT_CONFIG, null);
if (hdfsDefaultPath != null) {
retConf.addResource(new org.apache.hadoop.fs.Path(hdfsDefaultPath));
} else {
LOG.debug("Cannot find hdfs-default configuration file");
}
final String hdfsSitePath = flinkConfiguration.getString(ConfigConstants.HDFS_SITE_CONFIG, null);
if (hdfsSitePath != null) {
retConf.addResource(new org.apache.hadoop.fs.Path(hdfsSitePath));
} else {
LOG.debug("Cannot find hdfs-site configuration file");
}
// 2. Approach environment variables
String[] possibleHadoopConfPaths = new String[4];
possibleHadoopConfPaths[0] = flinkConfiguration.getString(ConfigConstants.PATH_HADOOP_CONFIG, null);
possibleHadoopConfPaths[1] = System.getenv("HADOOP_CONF_DIR");
if (System.getenv("HADOOP_HOME") != null) {
possibleHadoopConfPaths[2] = System.getenv("HADOOP_HOME") + "/conf";
possibleHadoopConfPaths[3] = System.getenv("HADOOP_HOME") + "/etc/hadoop"; // hadoop 2.2
}
for (String possibleHadoopConfPath : possibleHadoopConfPaths) {
if (possibleHadoopConfPath != null) {
if (new File(possibleHadoopConfPath).exists()) {
if (new File(possibleHadoopConfPath + "/core-site.xml").exists()) {
retConf.addResource(new org.apache.hadoop.fs.Path(possibleHadoopConfPath + "/core-site.xml"));
if (LOG.isDebugEnabled()) {
LOG.debug("Adding " + possibleHadoopConfPath + "/core-site.xml to hadoop configuration");
}
}
if (new File(possibleHadoopConfPath + "/hdfs-site.xml").exists()) {
retConf.addResource(new org.apache.hadoop.fs.Path(possibleHadoopConfPath + "/hdfs-site.xml"));
if (LOG.isDebugEnabled()) {
LOG.debug("Adding " + possibleHadoopConfPath + "/hdfs-site.xml to hadoop configuration");
}
}
}
}
}
return retConf;
} | [
"public",
"static",
"Configuration",
"getHadoopConfiguration",
"(",
"org",
".",
"apache",
".",
"flink",
".",
"configuration",
".",
"Configuration",
"flinkConfiguration",
")",
"{",
"Configuration",
"retConf",
"=",
"new",
"Configuration",
"(",
")",
";",
"// We need to... | Returns a new Hadoop Configuration object using the path to the hadoop conf configured
in the main configuration (flink-conf.yaml).
This method is public because its being used in the HadoopDataSource.
@param flinkConfiguration Flink configuration object
@return A Hadoop configuration instance | [
"Returns",
"a",
"new",
"Hadoop",
"Configuration",
"object",
"using",
"the",
"path",
"to",
"the",
"hadoop",
"conf",
"configured",
"in",
"the",
"main",
"configuration",
"(",
"flink",
"-",
"conf",
".",
"yaml",
")",
".",
"This",
"method",
"is",
"public",
"beca... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/utils/HadoopUtils.java#L65-L119 | train | Get the Hadoop configuration from the given Flink configuration | [
30522,
2270,
10763,
9563,
2131,
16102,
18589,
8663,
8873,
27390,
3370,
1006,
8917,
1012,
15895,
1012,
13109,
19839,
1012,
9563,
1012,
9563,
13109,
19839,
8663,
8873,
27390,
3370,
1007,
1063,
9563,
2128,
13535,
2239,
2546,
1027,
2047,
9563,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | core/src/main/java/org/apache/spark/shuffle/sort/ShuffleInMemorySorter.java | ShuffleInMemorySorter.insertRecord | public void insertRecord(long recordPointer, int partitionId) {
if (!hasSpaceForAnotherRecord()) {
throw new IllegalStateException("There is no space for new record");
}
array.set(pos, PackedRecordPointer.packPointer(recordPointer, partitionId));
pos++;
} | java | public void insertRecord(long recordPointer, int partitionId) {
if (!hasSpaceForAnotherRecord()) {
throw new IllegalStateException("There is no space for new record");
}
array.set(pos, PackedRecordPointer.packPointer(recordPointer, partitionId));
pos++;
} | [
"public",
"void",
"insertRecord",
"(",
"long",
"recordPointer",
",",
"int",
"partitionId",
")",
"{",
"if",
"(",
"!",
"hasSpaceForAnotherRecord",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"There is no space for new record\"",
")",
";",
"}"... | Inserts a record to be sorted.
@param recordPointer a pointer to the record, encoded by the task memory manager. Due to
certain pointer compression techniques used by the sorter, the sort can
only operate on pointers that point to locations in the first
{@link PackedRecordPointer#MAXIMUM_PAGE_SIZE_BYTES} bytes of a data page.
@param partitionId the partition id, which must be less than or equal to
{@link PackedRecordPointer#MAXIMUM_PARTITION_ID}. | [
"Inserts",
"a",
"record",
"to",
"be",
"sorted",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/shuffle/sort/ShuffleInMemorySorter.java#L146-L152 | train | Insert a record into the record array. | [
30522,
2270,
11675,
19274,
2890,
27108,
2094,
1006,
2146,
2501,
8400,
2121,
1010,
20014,
13571,
3593,
1007,
1063,
2065,
1006,
999,
2038,
23058,
29278,
6761,
12399,
2890,
27108,
2094,
1006,
1007,
1007,
1063,
5466,
2047,
6206,
9153,
17389,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | resolver/src/main/java/io/netty/resolver/AddressResolverGroup.java | AddressResolverGroup.getResolver | public AddressResolver<T> getResolver(final EventExecutor executor) {
if (executor == null) {
throw new NullPointerException("executor");
}
if (executor.isShuttingDown()) {
throw new IllegalStateException("executor not accepting a task");
}
AddressResolver<T> r;
synchronized (resolvers) {
r = resolvers.get(executor);
if (r == null) {
final AddressResolver<T> newResolver;
try {
newResolver = newResolver(executor);
} catch (Exception e) {
throw new IllegalStateException("failed to create a new resolver", e);
}
resolvers.put(executor, newResolver);
executor.terminationFuture().addListener(new FutureListener<Object>() {
@Override
public void operationComplete(Future<Object> future) throws Exception {
synchronized (resolvers) {
resolvers.remove(executor);
}
newResolver.close();
}
});
r = newResolver;
}
}
return r;
} | java | public AddressResolver<T> getResolver(final EventExecutor executor) {
if (executor == null) {
throw new NullPointerException("executor");
}
if (executor.isShuttingDown()) {
throw new IllegalStateException("executor not accepting a task");
}
AddressResolver<T> r;
synchronized (resolvers) {
r = resolvers.get(executor);
if (r == null) {
final AddressResolver<T> newResolver;
try {
newResolver = newResolver(executor);
} catch (Exception e) {
throw new IllegalStateException("failed to create a new resolver", e);
}
resolvers.put(executor, newResolver);
executor.terminationFuture().addListener(new FutureListener<Object>() {
@Override
public void operationComplete(Future<Object> future) throws Exception {
synchronized (resolvers) {
resolvers.remove(executor);
}
newResolver.close();
}
});
r = newResolver;
}
}
return r;
} | [
"public",
"AddressResolver",
"<",
"T",
">",
"getResolver",
"(",
"final",
"EventExecutor",
"executor",
")",
"{",
"if",
"(",
"executor",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"executor\"",
")",
";",
"}",
"if",
"(",
"executor",
... | Returns the {@link AddressResolver} associated with the specified {@link EventExecutor}. If there's no associated
resolved found, this method creates and returns a new resolver instance created by
{@link #newResolver(EventExecutor)} so that the new resolver is reused on another
{@link #getResolver(EventExecutor)} call with the same {@link EventExecutor}. | [
"Returns",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver/src/main/java/io/netty/resolver/AddressResolverGroup.java#L54-L90 | train | Get a new AddressResolver for the given executor. | [
30522,
2270,
4769,
6072,
4747,
6299,
1026,
1056,
1028,
2131,
6072,
4747,
6299,
1006,
2345,
2724,
10288,
8586,
16161,
2099,
4654,
8586,
16161,
2099,
1007,
1063,
2065,
1006,
4654,
8586,
16161,
2099,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/HadoopOutputFormatBase.java | HadoopOutputFormatBase.configure | @Override
public void configure(Configuration parameters) {
// enforce sequential configure() calls
synchronized (CONFIGURE_MUTEX) {
// configure MR OutputFormat if necessary
if (this.mapredOutputFormat instanceof Configurable) {
((Configurable) this.mapredOutputFormat).setConf(this.jobConf);
} else if (this.mapredOutputFormat instanceof JobConfigurable) {
((JobConfigurable) this.mapredOutputFormat).configure(this.jobConf);
}
}
} | java | @Override
public void configure(Configuration parameters) {
// enforce sequential configure() calls
synchronized (CONFIGURE_MUTEX) {
// configure MR OutputFormat if necessary
if (this.mapredOutputFormat instanceof Configurable) {
((Configurable) this.mapredOutputFormat).setConf(this.jobConf);
} else if (this.mapredOutputFormat instanceof JobConfigurable) {
((JobConfigurable) this.mapredOutputFormat).configure(this.jobConf);
}
}
} | [
"@",
"Override",
"public",
"void",
"configure",
"(",
"Configuration",
"parameters",
")",
"{",
"// enforce sequential configure() calls",
"synchronized",
"(",
"CONFIGURE_MUTEX",
")",
"{",
"// configure MR OutputFormat if necessary",
"if",
"(",
"this",
".",
"mapredOutputForma... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/HadoopOutputFormatBase.java#L91-L103 | train | Override this method to configure the MR OutputFormat. | [
30522,
1030,
2058,
15637,
2270,
11675,
9530,
8873,
27390,
2063,
1006,
9563,
11709,
1007,
1063,
1013,
1013,
16306,
25582,
9530,
8873,
27390,
2063,
1006,
1007,
4455,
25549,
1006,
9530,
8873,
27390,
2063,
1035,
20101,
2595,
1007,
1063,
1013,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.appendLines | public static <T> File appendLines(Collection<T> list, File file, String charset) throws IORuntimeException {
return writeLines(list, file, charset, true);
} | java | public static <T> File appendLines(Collection<T> list, File file, String charset) throws IORuntimeException {
return writeLines(list, file, charset, true);
} | [
"public",
"static",
"<",
"T",
">",
"File",
"appendLines",
"(",
"Collection",
"<",
"T",
">",
"list",
",",
"File",
"file",
",",
"String",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"writeLines",
"(",
"list",
",",
"file",
",",
"charset",
... | 将列表写入文件,追加模式
@param <T> 集合元素类型
@param list 列表
@param file 文件
@param charset 字符集
@return 目标文件
@throws IORuntimeException IO异常
@since 3.1.2 | [
"将列表写入文件,追加模式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2982-L2984 | train | Append the lines of the collection to the file. | [
30522,
2270,
10763,
1026,
1056,
1028,
5371,
10439,
10497,
12735,
1006,
3074,
1026,
1056,
1028,
2862,
1010,
5371,
5371,
1010,
5164,
25869,
13462,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
4339,
12735,
1006,
2862,
1010,
5371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.pressImage | public static BufferedImage pressImage(Image srcImage, Image pressImg, int x, int y, float alpha) {
return Img.from(srcImage).pressImage(pressImg, x, y, alpha).getImg();
} | java | public static BufferedImage pressImage(Image srcImage, Image pressImg, int x, int y, float alpha) {
return Img.from(srcImage).pressImage(pressImg, x, y, alpha).getImg();
} | [
"public",
"static",
"BufferedImage",
"pressImage",
"(",
"Image",
"srcImage",
",",
"Image",
"pressImg",
",",
"int",
"x",
",",
"int",
"y",
",",
"float",
"alpha",
")",
"{",
"return",
"Img",
".",
"from",
"(",
"srcImage",
")",
".",
"pressImage",
"(",
"pressIm... | 给图片添加图片水印<br>
此方法并不关闭流
@param srcImage 源图像流
@param pressImg 水印图片,可以使用{@link ImageIO#read(File)}方法读取文件
@param x 修正值。 默认在中间,偏移量相对于中间偏移
@param y 修正值。 默认在中间,偏移量相对于中间偏移
@param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
@return 结果图片 | [
"给图片添加图片水印<br",
">",
"此方法并不关闭流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L972-L974 | train | Press an image on the specified coordinates. | [
30522,
2270,
10763,
17698,
2098,
9581,
3351,
2811,
9581,
3351,
1006,
3746,
5034,
6895,
26860,
1010,
3746,
2811,
5714,
2290,
1010,
20014,
1060,
1010,
20014,
1061,
1010,
14257,
6541,
1007,
1063,
2709,
10047,
2290,
1012,
2013,
1006,
5034,
6895... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java | ExceptionUtils.findThrowableWithMessage | public static Optional<Throwable> findThrowableWithMessage(Throwable throwable, String searchMessage) {
if (throwable == null || searchMessage == null) {
return Optional.empty();
}
Throwable t = throwable;
while (t != null) {
if (t.getMessage() != null && t.getMessage().contains(searchMessage)) {
return Optional.of(t);
} else {
t = t.getCause();
}
}
return Optional.empty();
} | java | public static Optional<Throwable> findThrowableWithMessage(Throwable throwable, String searchMessage) {
if (throwable == null || searchMessage == null) {
return Optional.empty();
}
Throwable t = throwable;
while (t != null) {
if (t.getMessage() != null && t.getMessage().contains(searchMessage)) {
return Optional.of(t);
} else {
t = t.getCause();
}
}
return Optional.empty();
} | [
"public",
"static",
"Optional",
"<",
"Throwable",
">",
"findThrowableWithMessage",
"(",
"Throwable",
"throwable",
",",
"String",
"searchMessage",
")",
"{",
"if",
"(",
"throwable",
"==",
"null",
"||",
"searchMessage",
"==",
"null",
")",
"{",
"return",
"Optional",... | Checks whether a throwable chain contains a specific error message and returns the corresponding throwable.
@param throwable the throwable chain to check.
@param searchMessage the error message to search for in the chain.
@return Optional throwable containing the search message if available, otherwise empty | [
"Checks",
"whether",
"a",
"throwable",
"chain",
"contains",
"a",
"specific",
"error",
"message",
"and",
"returns",
"the",
"corresponding",
"throwable",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java#L372-L387 | train | Find a Throwable with a message. | [
30522,
2270,
10763,
11887,
1026,
5466,
3085,
1028,
2424,
2705,
10524,
3085,
24415,
7834,
3736,
3351,
1006,
5466,
3085,
5466,
3085,
1010,
5164,
3945,
7834,
3736,
3351,
1007,
1063,
2065,
1006,
5466,
3085,
1027,
1027,
19701,
1064,
1064,
3945,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/internal/DefaultGridRegistry.java | DefaultGridRegistry.newInstance | public static GridRegistry newInstance(Hub hub) {
DefaultGridRegistry registry = new DefaultGridRegistry(hub);
registry.start();
return registry;
} | java | public static GridRegistry newInstance(Hub hub) {
DefaultGridRegistry registry = new DefaultGridRegistry(hub);
registry.start();
return registry;
} | [
"public",
"static",
"GridRegistry",
"newInstance",
"(",
"Hub",
"hub",
")",
"{",
"DefaultGridRegistry",
"registry",
"=",
"new",
"DefaultGridRegistry",
"(",
"hub",
")",
";",
"registry",
".",
"start",
"(",
")",
";",
"return",
"registry",
";",
"}"
] | Creates a new {@link GridRegistry} and starts it.
@param hub the {@link Hub} to associate this registry with
@return the registry | [
"Creates",
"a",
"new",
"{",
"@link",
"GridRegistry",
"}",
"and",
"starts",
"it",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/DefaultGridRegistry.java#L98-L102 | train | Create a new instance of the default grid registry. | [
30522,
2270,
10763,
8370,
2890,
24063,
2854,
2047,
7076,
26897,
1006,
9594,
9594,
1007,
1063,
12398,
16523,
3593,
2890,
24063,
2854,
15584,
1027,
2047,
12398,
16523,
3593,
2890,
24063,
2854,
1006,
9594,
1007,
1025,
15584,
1012,
2707,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/DynaBean.java | DynaBean.invoke | public Object invoke(String methodName, Object... params){
return ReflectUtil.invoke(this.bean, methodName, params);
} | java | public Object invoke(String methodName, Object... params){
return ReflectUtil.invoke(this.bean, methodName, params);
} | [
"public",
"Object",
"invoke",
"(",
"String",
"methodName",
",",
"Object",
"...",
"params",
")",
"{",
"return",
"ReflectUtil",
".",
"invoke",
"(",
"this",
".",
"bean",
",",
"methodName",
",",
"params",
")",
";",
"}"
] | 执行原始Bean中的方法
@param methodName 方法名
@param params 参数
@return 执行结果,可能为null | [
"执行原始Bean中的方法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/DynaBean.java#L137-L139 | train | Invoke the specified method on the bean. | [
30522,
2270,
4874,
1999,
6767,
3489,
1006,
5164,
4118,
18442,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
1063,
2709,
8339,
21823,
2140,
1012,
1999,
6767,
3489,
1006,
2023,
1012,
14068,
1010,
4118,
18442,
1010,
11498,
5244,
1007,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java | AbstractAsymmetricCrypto.encrypt | public byte[] encrypt(String data, String charset, KeyType keyType) {
return encrypt(StrUtil.bytes(data, charset), keyType);
} | java | public byte[] encrypt(String data, String charset, KeyType keyType) {
return encrypt(StrUtil.bytes(data, charset), keyType);
} | [
"public",
"byte",
"[",
"]",
"encrypt",
"(",
"String",
"data",
",",
"String",
"charset",
",",
"KeyType",
"keyType",
")",
"{",
"return",
"encrypt",
"(",
"StrUtil",
".",
"bytes",
"(",
"data",
",",
"charset",
")",
",",
"keyType",
")",
";",
"}"
] | 加密
@param data 被加密的字符串
@param charset 编码
@param keyType 私钥或公钥 {@link KeyType}
@return 加密后的bytes | [
"加密"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L77-L79 | train | Encrypts the given data using the specified key type. | [
30522,
2270,
24880,
1031,
1033,
4372,
26775,
22571,
2102,
1006,
5164,
2951,
1010,
5164,
25869,
13462,
1010,
3145,
13874,
3145,
13874,
1007,
1063,
2709,
4372,
26775,
22571,
2102,
1006,
2358,
22134,
4014,
1012,
27507,
1006,
2951,
1010,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.inverse | @Deprecated
public static <K, V> Map<V, K> inverse(Map<K, V> map) {
Map<V, K> inverseMap;
if (map instanceof LinkedHashMap) {
inverseMap = new LinkedHashMap<>(map.size());
} else if (map instanceof TreeMap) {
inverseMap = new TreeMap<>();
} else {
inverseMap = new HashMap<>(map.size());
}
for (Entry<K, V> entry : map.entrySet()) {
inverseMap.put(entry.getValue(), entry.getKey());
}
return inverseMap;
} | java | @Deprecated
public static <K, V> Map<V, K> inverse(Map<K, V> map) {
Map<V, K> inverseMap;
if (map instanceof LinkedHashMap) {
inverseMap = new LinkedHashMap<>(map.size());
} else if (map instanceof TreeMap) {
inverseMap = new TreeMap<>();
} else {
inverseMap = new HashMap<>(map.size());
}
for (Entry<K, V> entry : map.entrySet()) {
inverseMap.put(entry.getValue(), entry.getKey());
}
return inverseMap;
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"V",
",",
"K",
">",
"inverse",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
")",
"{",
"Map",
"<",
"V",
",",
"K",
">",
"inverseMap",
";",
"if",
"(",
"map",
"instanceof"... | 逆转Map的key和value
@param <K> 键类型,目标的值类型
@param <V> 值类型,目标的键类型
@param map 被转换的Map
@return 逆转后的Map
@deprecated 请使用{@link MapUtil#reverse(Map)} 代替 | [
"逆转Map的key和value"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L613-L628 | train | Returns the inverse of the given map. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
4949,
1026,
1058,
1010,
1047,
1028,
19262,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
4949,
1007,
1063,
4949,
1026,
1058,
1010,
1047,
1028,
19262,
2863,
2361,
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-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/util/KeySelectorUtil.java | KeySelectorUtil.getBaseRowSelector | public static BaseRowKeySelector getBaseRowSelector(int[] keyFields, BaseRowTypeInfo rowType) {
if (keyFields.length > 0) {
InternalType[] inputFieldTypes = rowType.getInternalTypes();
String[] inputFieldNames = rowType.getFieldNames();
InternalType[] keyFieldTypes = new InternalType[keyFields.length];
String[] keyFieldNames = new String[keyFields.length];
for (int i = 0; i < keyFields.length; ++i) {
keyFieldTypes[i] = inputFieldTypes[keyFields[i]];
keyFieldNames[i] = inputFieldNames[keyFields[i]];
}
RowType returnType = new RowType(keyFieldTypes, keyFieldNames);
RowType inputType = new RowType(inputFieldTypes, rowType.getFieldNames());
GeneratedProjection generatedProjection = ProjectionCodeGenerator.generateProjection(
CodeGeneratorContext.apply(new TableConfig()),
"KeyProjection",
inputType,
returnType, keyFields);
BaseRowTypeInfo keyRowType = returnType.toTypeInfo();
// check if type implements proper equals/hashCode
TypeCheckUtils.validateEqualsHashCode("grouping", keyRowType);
return new BinaryRowKeySelector(keyRowType, generatedProjection);
} else {
return NullBinaryRowKeySelector.INSTANCE;
}
} | java | public static BaseRowKeySelector getBaseRowSelector(int[] keyFields, BaseRowTypeInfo rowType) {
if (keyFields.length > 0) {
InternalType[] inputFieldTypes = rowType.getInternalTypes();
String[] inputFieldNames = rowType.getFieldNames();
InternalType[] keyFieldTypes = new InternalType[keyFields.length];
String[] keyFieldNames = new String[keyFields.length];
for (int i = 0; i < keyFields.length; ++i) {
keyFieldTypes[i] = inputFieldTypes[keyFields[i]];
keyFieldNames[i] = inputFieldNames[keyFields[i]];
}
RowType returnType = new RowType(keyFieldTypes, keyFieldNames);
RowType inputType = new RowType(inputFieldTypes, rowType.getFieldNames());
GeneratedProjection generatedProjection = ProjectionCodeGenerator.generateProjection(
CodeGeneratorContext.apply(new TableConfig()),
"KeyProjection",
inputType,
returnType, keyFields);
BaseRowTypeInfo keyRowType = returnType.toTypeInfo();
// check if type implements proper equals/hashCode
TypeCheckUtils.validateEqualsHashCode("grouping", keyRowType);
return new BinaryRowKeySelector(keyRowType, generatedProjection);
} else {
return NullBinaryRowKeySelector.INSTANCE;
}
} | [
"public",
"static",
"BaseRowKeySelector",
"getBaseRowSelector",
"(",
"int",
"[",
"]",
"keyFields",
",",
"BaseRowTypeInfo",
"rowType",
")",
"{",
"if",
"(",
"keyFields",
".",
"length",
">",
"0",
")",
"{",
"InternalType",
"[",
"]",
"inputFieldTypes",
"=",
"rowTyp... | Create a BaseRowKeySelector to extract keys from DataStream which type is BaseRowTypeInfo.
@param keyFields key fields
@param rowType type of DataStream to extract keys
@return the BaseRowKeySelector to extract keys from DataStream which type is BaseRowTypeInfo. | [
"Create",
"a",
"BaseRowKeySelector",
"to",
"extract",
"keys",
"from",
"DataStream",
"which",
"type",
"is",
"BaseRowTypeInfo",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/util/KeySelectorUtil.java#L45-L69 | train | Get a BaseRowKeySelector for the given key fields and row type. | [
30522,
2270,
10763,
2918,
10524,
14839,
11246,
22471,
2953,
2131,
15058,
10524,
11246,
22471,
2953,
1006,
20014,
1031,
1033,
3145,
15155,
1010,
2918,
10524,
13874,
2378,
14876,
5216,
13874,
1007,
1063,
2065,
1006,
3145,
15155,
1012,
3091,
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... |
netty/netty | common/src/main/java/io/netty/util/AttributeKey.java | AttributeKey.newInstance | @SuppressWarnings("unchecked")
public static <T> AttributeKey<T> newInstance(String name) {
return (AttributeKey<T>) pool.newInstance(name);
} | java | @SuppressWarnings("unchecked")
public static <T> AttributeKey<T> newInstance(String name) {
return (AttributeKey<T>) pool.newInstance(name);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"AttributeKey",
"<",
"T",
">",
"newInstance",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"AttributeKey",
"<",
"T",
">",
")",
"pool",
".",
"newInstance",
"(",
"nam... | Creates a new {@link AttributeKey} for the given {@code name} or fail with an
{@link IllegalArgumentException} if a {@link AttributeKey} for the given {@code name} exists. | [
"Creates",
"a",
"new",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AttributeKey.java#L53-L56 | train | Create an instance of an attribute key. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
17961,
14839,
1026,
1056,
1028,
2047,
7076,
26897,
1006,
5164,
2171,
1007,
1063,
2709,
1006,
17961,
14839,
1026,
1056,
1028,
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... |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/common/RegistrationRequest.java | RegistrationRequest.fromJson | public static RegistrationRequest fromJson(Map<String, Object> raw) throws JsonException {
// If we could, we'd just get Json to coerce this for us, but that would lead to endless
// recursion as the first thing it would do would be to call this very method. *sigh*
Json json = new Json();
RegistrationRequest request = new RegistrationRequest();
if (raw.get("name") instanceof String) {
request.name = (String) raw.get("name");
}
if (raw.get("description") instanceof String) {
request.description = (String) raw.get("description");
}
if (raw.get("configuration") instanceof Map) {
// This is nasty. Look away now!
String converted = json.toJson(raw.get("configuration"));
request.configuration = GridConfiguredJson.toType(converted, GridNodeConfiguration.class);
}
if (raw.get("configuration") instanceof GridNodeConfiguration) {
request.configuration = (GridNodeConfiguration)raw.get("configuration");
}
return request;
} | java | public static RegistrationRequest fromJson(Map<String, Object> raw) throws JsonException {
// If we could, we'd just get Json to coerce this for us, but that would lead to endless
// recursion as the first thing it would do would be to call this very method. *sigh*
Json json = new Json();
RegistrationRequest request = new RegistrationRequest();
if (raw.get("name") instanceof String) {
request.name = (String) raw.get("name");
}
if (raw.get("description") instanceof String) {
request.description = (String) raw.get("description");
}
if (raw.get("configuration") instanceof Map) {
// This is nasty. Look away now!
String converted = json.toJson(raw.get("configuration"));
request.configuration = GridConfiguredJson.toType(converted, GridNodeConfiguration.class);
}
if (raw.get("configuration") instanceof GridNodeConfiguration) {
request.configuration = (GridNodeConfiguration)raw.get("configuration");
}
return request;
} | [
"public",
"static",
"RegistrationRequest",
"fromJson",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"raw",
")",
"throws",
"JsonException",
"{",
"// If we could, we'd just get Json to coerce this for us, but that would lead to endless",
"// recursion as the first thing it would do... | Create an object from a registration request formatted as a json string. | [
"Create",
"an",
"object",
"from",
"a",
"registration",
"request",
"formatted",
"as",
"a",
"json",
"string",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/common/RegistrationRequest.java#L119-L144 | train | Convert a JSON object to a RegistrationRequest object | [
30522,
2270,
10763,
8819,
2890,
15500,
2013,
22578,
2239,
1006,
4949,
1026,
5164,
1010,
4874,
1028,
6315,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
1013,
1013,
2065,
2057,
2071,
1010,
2057,
1005,
1040,
2074,
2131,
1046,
3385,
2000,
24873... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/TransactionalIdsGenerator.java | TransactionalIdsGenerator.generateIdsToUse | public Set<String> generateIdsToUse(long nextFreeTransactionalId) {
Set<String> transactionalIds = new HashSet<>();
for (int i = 0; i < poolSize; i++) {
long transactionalId = nextFreeTransactionalId + subtaskIndex * poolSize + i;
transactionalIds.add(generateTransactionalId(transactionalId));
}
return transactionalIds;
} | java | public Set<String> generateIdsToUse(long nextFreeTransactionalId) {
Set<String> transactionalIds = new HashSet<>();
for (int i = 0; i < poolSize; i++) {
long transactionalId = nextFreeTransactionalId + subtaskIndex * poolSize + i;
transactionalIds.add(generateTransactionalId(transactionalId));
}
return transactionalIds;
} | [
"public",
"Set",
"<",
"String",
">",
"generateIdsToUse",
"(",
"long",
"nextFreeTransactionalId",
")",
"{",
"Set",
"<",
"String",
">",
"transactionalIds",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pool... | Range of available transactional ids to use is:
[nextFreeTransactionalId, nextFreeTransactionalId + parallelism * kafkaProducersPoolSize)
loop below picks in a deterministic way a subrange of those available transactional ids based on index of
this subtask. | [
"Range",
"of",
"available",
"transactional",
"ids",
"to",
"use",
"is",
":",
"[",
"nextFreeTransactionalId",
"nextFreeTransactionalId",
"+",
"parallelism",
"*",
"kafkaProducersPoolSize",
")",
"loop",
"below",
"picks",
"in",
"a",
"deterministic",
"way",
"a",
"subrange... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/TransactionalIdsGenerator.java#L71-L78 | train | Generate transactional ids to use. | [
30522,
2270,
2275,
1026,
5164,
1028,
9699,
9821,
24826,
3366,
1006,
2146,
2279,
23301,
6494,
3619,
18908,
19301,
3593,
1007,
1063,
2275,
1026,
5164,
1028,
12598,
11475,
5104,
1027,
2047,
23325,
13462,
1026,
1028,
1006,
1007,
1025,
2005,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.putCharBigEndian | public final void putCharBigEndian(int index, char value) {
if (LITTLE_ENDIAN) {
putChar(index, Character.reverseBytes(value));
} else {
putChar(index, value);
}
} | java | public final void putCharBigEndian(int index, char value) {
if (LITTLE_ENDIAN) {
putChar(index, Character.reverseBytes(value));
} else {
putChar(index, value);
}
} | [
"public",
"final",
"void",
"putCharBigEndian",
"(",
"int",
"index",
",",
"char",
"value",
")",
"{",
"if",
"(",
"LITTLE_ENDIAN",
")",
"{",
"putChar",
"(",
"index",
",",
"Character",
".",
"reverseBytes",
"(",
"value",
")",
")",
";",
"}",
"else",
"{",
"pu... | Writes the given character (16 bit, 2 bytes) to the given position in big-endian
byte order. This method's speed depends on the system's native byte order, and it
is possibly slower than {@link #putChar(int, char)}. For most cases (such as
transient storage in memory or serialization for I/O and network),
it suffices to know that the byte order in which the value is written is the same as the
one in which it is read, and {@link #putChar(int, char)} is the preferable choice.
@param index The position at which the value will be written.
@param value The char value to be written.
@throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 2. | [
"Writes",
"the",
"given",
"character",
"(",
"16",
"bit",
"2",
"bytes",
")",
"to",
"the",
"given",
"position",
"in",
"big",
"-",
"endian",
"byte",
"order",
".",
"This",
"method",
"s",
"speed",
"depends",
"on",
"the",
"system",
"s",
"native",
"byte",
"or... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L536-L542 | train | Puts a char value in Big Endian byte order. | [
30522,
2270,
2345,
11675,
2404,
7507,
15185,
29206,
11692,
1006,
20014,
5950,
1010,
25869,
3643,
1007,
1063,
2065,
1006,
2210,
1035,
2203,
2937,
1007,
1063,
2404,
7507,
2099,
1006,
5950,
1010,
2839,
1012,
7901,
3762,
4570,
1006,
3643,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.union | @SafeVarargs
public static <T> Collection<T> union(Collection<T> coll1, Collection<T> coll2, Collection<T>... otherColls) {
Collection<T> union = union(coll1, coll2);
for (Collection<T> coll : otherColls) {
union = union(union, coll);
}
return union;
} | java | @SafeVarargs
public static <T> Collection<T> union(Collection<T> coll1, Collection<T> coll2, Collection<T>... otherColls) {
Collection<T> union = union(coll1, coll2);
for (Collection<T> coll : otherColls) {
union = union(union, coll);
}
return union;
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"union",
"(",
"Collection",
"<",
"T",
">",
"coll1",
",",
"Collection",
"<",
"T",
">",
"coll2",
",",
"Collection",
"<",
"T",
">",
"...",
"otherColls",
")",
"{",
"Colle... | 多个集合的并集<br>
针对一个集合中存在多个相同元素的情况,计算两个集合中此元素的个数,保留最多的个数<br>
例如:集合1:[a, b, c, c, c],集合2:[a, b, c, c]<br>
结果:[a, b, c, c, c],此结果中只保留了三个c
@param <T> 集合元素类型
@param coll1 集合1
@param coll2 集合2
@param otherColls 其它集合
@return 并集的集合,返回 {@link ArrayList} | [
"多个集合的并集<br",
">",
"针对一个集合中存在多个相同元素的情况,计算两个集合中此元素的个数,保留最多的个数<br",
">",
"例如:集合1:",
"[",
"a",
"b",
"c",
"c",
"c",
"]",
",集合2:",
"[",
"a",
"b",
"c",
"c",
"]",
"<br",
">",
"结果:",
"[",
"a",
"b",
"c",
"c",
"c",
"]",
",此结果中只保留了三个c"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L108-L115 | train | Returns the union of the specified collections. | [
30522,
1030,
3647,
24516,
10623,
2015,
2270,
10763,
1026,
1056,
1028,
3074,
1026,
1056,
1028,
2586,
1006,
3074,
1026,
1056,
1028,
8902,
2140,
2487,
1010,
3074,
1026,
1056,
1028,
8902,
2140,
2475,
1010,
3074,
1026,
1056,
1028,
1012,
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... |
netty/netty | handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java | TrafficCounter.writeTimeToWait | @Deprecated
public long writeTimeToWait(final long size, final long limitTraffic, final long maxTime) {
return writeTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano());
} | java | @Deprecated
public long writeTimeToWait(final long size, final long limitTraffic, final long maxTime) {
return writeTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano());
} | [
"@",
"Deprecated",
"public",
"long",
"writeTimeToWait",
"(",
"final",
"long",
"size",
",",
"final",
"long",
"limitTraffic",
",",
"final",
"long",
"maxTime",
")",
"{",
"return",
"writeTimeToWait",
"(",
"size",
",",
"limitTraffic",
",",
"maxTime",
",",
"milliSec... | Returns the time to wait (if any) for the given length message, using the given limitTraffic and
the max wait time.
@param size
the write size
@param limitTraffic
the traffic limit in bytes per second.
@param maxTime
the max time in ms to wait in case of excess of traffic.
@return the current time to wait (in ms) if needed for Write operation. | [
"Returns",
"the",
"time",
"to",
"wait",
"(",
"if",
"any",
")",
"for",
"the",
"given",
"length",
"message",
"using",
"the",
"given",
"limitTraffic",
"and",
"the",
"max",
"wait",
"time",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java#L555-L558 | train | Write time to wait. | [
30522,
1030,
2139,
28139,
12921,
2270,
2146,
4339,
7292,
18790,
4886,
2102,
1006,
2345,
2146,
2946,
1010,
2345,
2146,
5787,
6494,
26989,
2278,
1010,
2345,
2146,
4098,
7292,
1007,
1063,
2709,
4339,
7292,
18790,
4886,
2102,
1006,
2946,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.setShortBE | @SuppressWarnings("deprecation")
public static ByteBuf setShortBE(ByteBuf buf, int index, int shortValue) {
return buf.order() == ByteOrder.BIG_ENDIAN? buf.setShort(index, shortValue) : buf.setShortLE(index, shortValue);
} | java | @SuppressWarnings("deprecation")
public static ByteBuf setShortBE(ByteBuf buf, int index, int shortValue) {
return buf.order() == ByteOrder.BIG_ENDIAN? buf.setShort(index, shortValue) : buf.setShortLE(index, shortValue);
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"static",
"ByteBuf",
"setShortBE",
"(",
"ByteBuf",
"buf",
",",
"int",
"index",
",",
"int",
"shortValue",
")",
"{",
"return",
"buf",
".",
"order",
"(",
")",
"==",
"ByteOrder",
".",
"BIG_ENDIAN",
... | Sets a big-endian 16-bit short integer to the buffer. | [
"Sets",
"a",
"big",
"-",
"endian",
"16",
"-",
"bit",
"short",
"integer",
"to",
"the",
"buffer",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L426-L429 | train | Sets a signed short value in the buffer. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
2139,
28139,
10719,
1000,
1007,
2270,
10763,
24880,
8569,
2546,
4520,
27794,
4783,
1006,
24880,
8569,
2546,
20934,
2546,
1010,
20014,
5950,
1010,
20014,
2460,
10175,
5657,
1007,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperator.java | AsyncWaitOperator.stopResources | private void stopResources(boolean waitForShutdown) throws InterruptedException {
emitter.stop();
emitterThread.interrupt();
executor.shutdown();
if (waitForShutdown) {
try {
if (!executor.awaitTermination(365L, TimeUnit.DAYS)) {
executor.shutdownNow();
}
} catch (InterruptedException e) {
executor.shutdownNow();
Thread.currentThread().interrupt();
}
/*
* FLINK-5638: If we have the checkpoint lock we might have to free it for a while so
* that the emitter thread can complete/react to the interrupt signal.
*/
if (Thread.holdsLock(checkpointingLock)) {
while (emitterThread.isAlive()) {
checkpointingLock.wait(100L);
}
}
emitterThread.join();
} else {
executor.shutdownNow();
}
} | java | private void stopResources(boolean waitForShutdown) throws InterruptedException {
emitter.stop();
emitterThread.interrupt();
executor.shutdown();
if (waitForShutdown) {
try {
if (!executor.awaitTermination(365L, TimeUnit.DAYS)) {
executor.shutdownNow();
}
} catch (InterruptedException e) {
executor.shutdownNow();
Thread.currentThread().interrupt();
}
/*
* FLINK-5638: If we have the checkpoint lock we might have to free it for a while so
* that the emitter thread can complete/react to the interrupt signal.
*/
if (Thread.holdsLock(checkpointingLock)) {
while (emitterThread.isAlive()) {
checkpointingLock.wait(100L);
}
}
emitterThread.join();
} else {
executor.shutdownNow();
}
} | [
"private",
"void",
"stopResources",
"(",
"boolean",
"waitForShutdown",
")",
"throws",
"InterruptedException",
"{",
"emitter",
".",
"stop",
"(",
")",
";",
"emitterThread",
".",
"interrupt",
"(",
")",
";",
"executor",
".",
"shutdown",
"(",
")",
";",
"if",
"(",... | Close the operator's resources. They include the emitter thread and the executor to run
the queue's complete operation.
@param waitForShutdown is true if the method should wait for the resources to be freed;
otherwise false.
@throws InterruptedException if current thread has been interrupted | [
"Close",
"the",
"operator",
"s",
"resources",
".",
"They",
"include",
"the",
"emitter",
"thread",
"and",
"the",
"executor",
"to",
"run",
"the",
"queue",
"s",
"complete",
"operation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/AsyncWaitOperator.java#L350-L381 | train | Stop all the resources and wait for shutdown | [
30522,
2797,
11675,
2644,
6072,
8162,
9623,
1006,
22017,
20898,
3524,
29278,
14235,
2102,
7698,
1007,
11618,
7153,
10288,
24422,
1063,
12495,
12079,
1012,
2644,
1006,
1007,
1025,
12495,
12079,
2705,
16416,
2094,
1012,
17938,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.invisibilityOf | public static ExpectedCondition<Boolean> invisibilityOf(final WebElement element) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver webDriver) {
return isInvisible(element);
}
@Override
public String toString() {
return "invisibility of " + element;
}
};
} | java | public static ExpectedCondition<Boolean> invisibilityOf(final WebElement element) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver webDriver) {
return isInvisible(element);
}
@Override
public String toString() {
return "invisibility of " + element;
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"Boolean",
">",
"invisibilityOf",
"(",
"final",
"WebElement",
"element",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolean",
"apply",
"(",
"WebD... | An expectation for checking the element to be invisible
@param element used to check its invisibility
@return Boolean true when elements is not visible anymore | [
"An",
"expectation",
"for",
"checking",
"the",
"element",
"to",
"be",
"invisible"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L1331-L1344 | train | An expectation for checking that an element is invisible. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
1999,
11365,
13464,
11253,
1006,
2345,
4773,
12260,
3672,
5783,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
1006,
1007,
1063,
1030,
2058,
15637,
2270,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java | BinTrie.entrySet | public Set<Map.Entry<String, V>> entrySet()
{
Set<Map.Entry<String, V>> entrySet = new TreeSet<Map.Entry<String, V>>();
StringBuilder sb = new StringBuilder();
for (BaseNode node : child)
{
if (node == null) continue;
node.walk(new StringBuilder(sb.toString()), entrySet);
}
return entrySet;
} | java | public Set<Map.Entry<String, V>> entrySet()
{
Set<Map.Entry<String, V>> entrySet = new TreeSet<Map.Entry<String, V>>();
StringBuilder sb = new StringBuilder();
for (BaseNode node : child)
{
if (node == null) continue;
node.walk(new StringBuilder(sb.toString()), entrySet);
}
return entrySet;
} | [
"public",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"V",
">",
">",
"entrySet",
"(",
")",
"{",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"V",
">",
">",
"entrySet",
"=",
"new",
"TreeSet",
"<",
"Map",
".",
"Entry",
"<",
"Stri... | 获取键值对集合
@return | [
"获取键值对集合"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java#L185-L195 | train | Get the EntrySet for this BaseNode. | [
30522,
2270,
2275,
1026,
4949,
1012,
4443,
1026,
5164,
1010,
1058,
1028,
1028,
4443,
13462,
1006,
1007,
1063,
2275,
1026,
4949,
1012,
4443,
1026,
5164,
1010,
1058,
1028,
1028,
4443,
13462,
1027,
2047,
3628,
3388,
1026,
4949,
1012,
4443,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.getName | public static String getName(String filePath) {
if (null == filePath) {
return filePath;
}
int len = filePath.length();
if (0 == len) {
return filePath;
}
if (CharUtil.isFileSeparator(filePath.charAt(len - 1))) {
// 以分隔符结尾的去掉结尾分隔符
len--;
}
int begin = 0;
char c;
for (int i = len - 1; i > -1; i--) {
c = filePath.charAt(i);
if (CharUtil.isFileSeparator(c)) {
// 查找最后一个路径分隔符(/或者\)
begin = i + 1;
break;
}
}
return filePath.substring(begin, len);
} | java | public static String getName(String filePath) {
if (null == filePath) {
return filePath;
}
int len = filePath.length();
if (0 == len) {
return filePath;
}
if (CharUtil.isFileSeparator(filePath.charAt(len - 1))) {
// 以分隔符结尾的去掉结尾分隔符
len--;
}
int begin = 0;
char c;
for (int i = len - 1; i > -1; i--) {
c = filePath.charAt(i);
if (CharUtil.isFileSeparator(c)) {
// 查找最后一个路径分隔符(/或者\)
begin = i + 1;
break;
}
}
return filePath.substring(begin, len);
} | [
"public",
"static",
"String",
"getName",
"(",
"String",
"filePath",
")",
"{",
"if",
"(",
"null",
"==",
"filePath",
")",
"{",
"return",
"filePath",
";",
"}",
"int",
"len",
"=",
"filePath",
".",
"length",
"(",
")",
";",
"if",
"(",
"0",
"==",
"len",
"... | 返回文件名
@param filePath 文件
@return 文件名
@since 4.1.13 | [
"返回文件名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1721-L1746 | train | Gets the name of the file. | [
30522,
2270,
10763,
5164,
2131,
18442,
1006,
5164,
5371,
15069,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
5371,
15069,
1007,
1063,
2709,
5371,
15069,
1025,
1065,
20014,
18798,
1027,
5371,
15069,
1012,
3091,
1006,
1007,
1025,
2065,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java | RandomUtil.randomEles | public static <T> List<T> randomEles(List<T> list, int count) {
final List<T> result = new ArrayList<T>(count);
int limit = list.size();
while (result.size() < count) {
result.add(randomEle(list, limit));
}
return result;
} | java | public static <T> List<T> randomEles(List<T> list, int count) {
final List<T> result = new ArrayList<T>(count);
int limit = list.size();
while (result.size() < count) {
result.add(randomEle(list, limit));
}
return result;
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"randomEles",
"(",
"List",
"<",
"T",
">",
"list",
",",
"int",
"count",
")",
"{",
"final",
"List",
"<",
"T",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"T",
">",
"(",
"count",
")",
";",... | 随机获得列表中的一定量元素
@param <T> 元素类型
@param list 列表
@param count 随机取出的个数
@return 随机元素 | [
"随机获得列表中的一定量元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java#L311-L319 | train | Returns a random subset of the specified list of elements. | [
30522,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
6721,
26741,
1006,
2862,
1026,
1056,
1028,
2862,
1010,
20014,
4175,
1007,
1063,
2345,
2862,
1026,
1056,
1028,
2765,
1027,
2047,
9140,
9863,
1026,
1056,
1028,
1006,
4175,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyProtocol.java | NettyProtocol.getClientChannelHandlers | public ChannelHandler[] getClientChannelHandlers() {
NetworkClientHandler networkClientHandler =
creditBasedEnabled ? new CreditBasedPartitionRequestClientHandler() :
new PartitionRequestClientHandler();
return new ChannelHandler[] {
messageEncoder,
new NettyMessage.NettyMessageDecoder(!creditBasedEnabled),
networkClientHandler};
} | java | public ChannelHandler[] getClientChannelHandlers() {
NetworkClientHandler networkClientHandler =
creditBasedEnabled ? new CreditBasedPartitionRequestClientHandler() :
new PartitionRequestClientHandler();
return new ChannelHandler[] {
messageEncoder,
new NettyMessage.NettyMessageDecoder(!creditBasedEnabled),
networkClientHandler};
} | [
"public",
"ChannelHandler",
"[",
"]",
"getClientChannelHandlers",
"(",
")",
"{",
"NetworkClientHandler",
"networkClientHandler",
"=",
"creditBasedEnabled",
"?",
"new",
"CreditBasedPartitionRequestClientHandler",
"(",
")",
":",
"new",
"PartitionRequestClientHandler",
"(",
")... | Returns the client channel handlers.
<pre>
+-----------+----------+ +----------------------+
| Remote input channel | | request client |
+-----------+----------+ +-----------+----------+
| | (1) write
+---------------+-----------------------------------+---------------+
| | CLIENT CHANNEL PIPELINE | |
| | \|/ |
| +----------+----------+ +----------------------+ |
| | Request handler + | Message encoder | |
| +----------+----------+ +-----------+----------+ |
| /|\ \|/ |
| | | |
| +----------+------------+ | |
| | Message+Frame decoder | | |
| +----------+------------+ | |
| /|\ | |
+---------------+-----------------------------------+---------------+
| | (3) server response \|/ (2) client request
+---------------+-----------------------------------+---------------+
| | | |
| [ Socket.read() ] [ Socket.write() ] |
| |
| Netty Internal I/O Threads (Transport Implementation) |
+-------------------------------------------------------------------+
</pre>
@return channel handlers | [
"Returns",
"the",
"client",
"channel",
"handlers",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyProtocol.java#L124-L132 | train | Returns an array of ChannelHandlers that can be used to handle the request. | [
30522,
2270,
3149,
11774,
3917,
1031,
1033,
2131,
20464,
11638,
26058,
11774,
12910,
1006,
1007,
1063,
2897,
20464,
11638,
11774,
3917,
2897,
20464,
11638,
11774,
3917,
1027,
4923,
15058,
4181,
3085,
2094,
1029,
2047,
4923,
15058,
18927,
8445... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/PartitionOperator.java | PartitionOperator.withOrders | @PublicEvolving
public PartitionOperator<T> withOrders(Order... orders) {
Preconditions.checkState(pMethod == PartitionMethod.RANGE, "Orders cannot be applied for %s partition " +
"method", pMethod);
Preconditions.checkArgument(pKeys.getOriginalKeyFieldTypes().length == orders.length, "The number of key " +
"fields and orders should be the same.");
this.orders = orders;
return this;
} | java | @PublicEvolving
public PartitionOperator<T> withOrders(Order... orders) {
Preconditions.checkState(pMethod == PartitionMethod.RANGE, "Orders cannot be applied for %s partition " +
"method", pMethod);
Preconditions.checkArgument(pKeys.getOriginalKeyFieldTypes().length == orders.length, "The number of key " +
"fields and orders should be the same.");
this.orders = orders;
return this;
} | [
"@",
"PublicEvolving",
"public",
"PartitionOperator",
"<",
"T",
">",
"withOrders",
"(",
"Order",
"...",
"orders",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"pMethod",
"==",
"PartitionMethod",
".",
"RANGE",
",",
"\"Orders cannot be applied for %s partition \""... | Sets the order of keys for range partitioning.
NOTE: Only valid for {@link PartitionMethod#RANGE}.
@param orders array of orders for each specified partition key
@return The partitioneOperator with properly set orders for given keys | [
"Sets",
"the",
"order",
"of",
"keys",
"for",
"range",
"partitioning",
".",
"NOTE",
":",
"Only",
"valid",
"for",
"{",
"@link",
"PartitionMethod#RANGE",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/PartitionOperator.java#L110-L119 | train | Sets the order of the results of the operation. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
13571,
25918,
8844,
1026,
1056,
1028,
2007,
8551,
2545,
1006,
2344,
1012,
1012,
1012,
4449,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
14148,
12259,
1006,
7610,
11031,
7716,
1027,
1027,
13571,
1136... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/concurrent/DefaultPromise.java | DefaultPromise.notifyListener | protected static void notifyListener(
EventExecutor eventExecutor, final Future<?> future, final GenericFutureListener<?> listener) {
checkNotNull(eventExecutor, "eventExecutor");
checkNotNull(future, "future");
checkNotNull(listener, "listener");
notifyListenerWithStackOverFlowProtection(eventExecutor, future, listener);
} | java | protected static void notifyListener(
EventExecutor eventExecutor, final Future<?> future, final GenericFutureListener<?> listener) {
checkNotNull(eventExecutor, "eventExecutor");
checkNotNull(future, "future");
checkNotNull(listener, "listener");
notifyListenerWithStackOverFlowProtection(eventExecutor, future, listener);
} | [
"protected",
"static",
"void",
"notifyListener",
"(",
"EventExecutor",
"eventExecutor",
",",
"final",
"Future",
"<",
"?",
">",
"future",
",",
"final",
"GenericFutureListener",
"<",
"?",
">",
"listener",
")",
"{",
"checkNotNull",
"(",
"eventExecutor",
",",
"\"eve... | Notify a listener that a future has completed.
<p>
This method has a fixed depth of {@link #MAX_LISTENER_STACK_DEPTH} that will limit recursion to prevent
{@link StackOverflowError} and will stop notifying listeners added after this threshold is exceeded.
@param eventExecutor the executor to use to notify the listener {@code listener}.
@param future the future that is complete.
@param listener the listener to notify. | [
"Notify",
"a",
"listener",
"that",
"a",
"future",
"has",
"completed",
".",
"<p",
">",
"This",
"method",
"has",
"a",
"fixed",
"depth",
"of",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java#L399-L405 | train | Notify a GenericFutureListener with a stack over flow protection. | [
30522,
5123,
10763,
11675,
2025,
8757,
9863,
24454,
1006,
2724,
10288,
8586,
16161,
2099,
2724,
10288,
8586,
16161,
2099,
1010,
2345,
2925,
1026,
1029,
1028,
2925,
1010,
2345,
12391,
11263,
11244,
9863,
24454,
1026,
1029,
1028,
19373,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/UnilateralSortMerger.java | UnilateralSortMerger.getIterator | @Override
public MutableObjectIterator<E> getIterator() throws InterruptedException {
synchronized (this.iteratorLock) {
// wait while both the iterator and the exception are not set
while (this.iterator == null && this.iteratorException == null) {
this.iteratorLock.wait();
}
if (this.iteratorException != null) {
throw new RuntimeException("Error obtaining the sorted input: " + this.iteratorException.getMessage(),
this.iteratorException);
}
else {
return this.iterator;
}
}
} | java | @Override
public MutableObjectIterator<E> getIterator() throws InterruptedException {
synchronized (this.iteratorLock) {
// wait while both the iterator and the exception are not set
while (this.iterator == null && this.iteratorException == null) {
this.iteratorLock.wait();
}
if (this.iteratorException != null) {
throw new RuntimeException("Error obtaining the sorted input: " + this.iteratorException.getMessage(),
this.iteratorException);
}
else {
return this.iterator;
}
}
} | [
"@",
"Override",
"public",
"MutableObjectIterator",
"<",
"E",
">",
"getIterator",
"(",
")",
"throws",
"InterruptedException",
"{",
"synchronized",
"(",
"this",
".",
"iteratorLock",
")",
"{",
"// wait while both the iterator and the exception are not set",
"while",
"(",
... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/UnilateralSortMerger.java#L641-L657 | train | Returns an iterator that returns the sorted object iterator. | [
30522,
1030,
2058,
15637,
2270,
14163,
10880,
16429,
20614,
21646,
8844,
1026,
1041,
1028,
2131,
21646,
8844,
1006,
1007,
11618,
7153,
10288,
24422,
1063,
25549,
1006,
2023,
1012,
2009,
6906,
4263,
7878,
1007,
1063,
1013,
1013,
3524,
2096,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java | AbstractEpollStreamChannel.spliceTo | public final ChannelFuture spliceTo(final FileDescriptor ch, final int offset, final int len,
final ChannelPromise promise) {
checkPositiveOrZero(len, "len");
checkPositiveOrZero(offset, "offser");
if (config().getEpollMode() != EpollMode.LEVEL_TRIGGERED) {
throw new IllegalStateException("spliceTo() supported only when using " + EpollMode.LEVEL_TRIGGERED);
}
checkNotNull(promise, "promise");
if (!isOpen()) {
promise.tryFailure(SPLICE_TO_CLOSED_CHANNEL_EXCEPTION);
} else {
addToSpliceQueue(new SpliceFdTask(ch, offset, len, promise));
failSpliceIfClosed(promise);
}
return promise;
} | java | public final ChannelFuture spliceTo(final FileDescriptor ch, final int offset, final int len,
final ChannelPromise promise) {
checkPositiveOrZero(len, "len");
checkPositiveOrZero(offset, "offser");
if (config().getEpollMode() != EpollMode.LEVEL_TRIGGERED) {
throw new IllegalStateException("spliceTo() supported only when using " + EpollMode.LEVEL_TRIGGERED);
}
checkNotNull(promise, "promise");
if (!isOpen()) {
promise.tryFailure(SPLICE_TO_CLOSED_CHANNEL_EXCEPTION);
} else {
addToSpliceQueue(new SpliceFdTask(ch, offset, len, promise));
failSpliceIfClosed(promise);
}
return promise;
} | [
"public",
"final",
"ChannelFuture",
"spliceTo",
"(",
"final",
"FileDescriptor",
"ch",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"len",
",",
"final",
"ChannelPromise",
"promise",
")",
"{",
"checkPositiveOrZero",
"(",
"len",
",",
"\"len\"",
")",
";",
... | Splice from this {@link AbstractEpollStreamChannel} to another {@link FileDescriptor}.
The {@code offset} is the offset for the {@link FileDescriptor} and {@code len} is the
number of bytes to splice. If using {@link Integer#MAX_VALUE} it will splice until the
{@link ChannelFuture} was canceled or it was failed.
Please note:
<ul>
<li>{@link EpollChannelConfig#getEpollMode()} must be {@link EpollMode#LEVEL_TRIGGERED} for this
{@link AbstractEpollStreamChannel}</li>
<li>the {@link FileDescriptor} will not be closed after the {@link ChannelPromise} is notified</li>
<li>this channel must be registered to an event loop or {@link IllegalStateException} will be thrown.</li>
</ul> | [
"Splice",
"from",
"this",
"{",
"@link",
"AbstractEpollStreamChannel",
"}",
"to",
"another",
"{",
"@link",
"FileDescriptor",
"}",
".",
"The",
"{",
"@code",
"offset",
"}",
"is",
"the",
"offset",
"for",
"the",
"{",
"@link",
"FileDescriptor",
"}",
"and",
"{",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java#L214-L229 | train | Splice to a file. | [
30522,
2270,
2345,
3149,
11263,
11244,
11867,
13231,
3406,
1006,
2345,
6406,
2229,
23235,
2953,
10381,
1010,
2345,
20014,
16396,
1010,
2345,
20014,
18798,
1010,
2345,
3149,
21572,
28732,
4872,
1007,
1063,
4638,
6873,
28032,
3512,
2953,
6290,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/KeyGroupPartitioner.java | KeyGroupPartitioner.reportAllElementKeyGroups | protected void reportAllElementKeyGroups() {
Preconditions.checkState(partitioningSource.length >= numberOfElements);
for (int i = 0; i < numberOfElements; ++i) {
int keyGroup = KeyGroupRangeAssignment.assignToKeyGroup(
keyExtractorFunction.extractKeyFromElement(partitioningSource[i]), totalKeyGroups);
reportKeyGroupOfElementAtIndex(i, keyGroup);
}
} | java | protected void reportAllElementKeyGroups() {
Preconditions.checkState(partitioningSource.length >= numberOfElements);
for (int i = 0; i < numberOfElements; ++i) {
int keyGroup = KeyGroupRangeAssignment.assignToKeyGroup(
keyExtractorFunction.extractKeyFromElement(partitioningSource[i]), totalKeyGroups);
reportKeyGroupOfElementAtIndex(i, keyGroup);
}
} | [
"protected",
"void",
"reportAllElementKeyGroups",
"(",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"partitioningSource",
".",
"length",
">=",
"numberOfElements",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numberOfElements",
";",
"++",
... | This method iterates over the input data and reports the key-group for each element. | [
"This",
"method",
"iterates",
"over",
"the",
"input",
"data",
"and",
"reports",
"the",
"key",
"-",
"group",
"for",
"each",
"element",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupPartitioner.java#L147-L156 | train | Report all key groups of the elements in the partitioning source. | [
30522,
5123,
11675,
3189,
24164,
16930,
4765,
14839,
17058,
2015,
1006,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
14148,
12259,
1006,
13571,
8613,
8162,
3401,
1012,
3091,
1028,
1027,
2193,
11253,
12260,
8163,
1007,
1025,
2005,
1006,
20014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java | BinaryString.trimLeft | public BinaryString trimLeft(BinaryString trimStr) {
ensureMaterialized();
if (trimStr == null) {
return null;
}
trimStr.ensureMaterialized();
if (trimStr.isSpaceString()) {
return trimLeft();
}
if (inFirstSegment()) {
int searchIdx = 0;
while (searchIdx < this.sizeInBytes) {
int charBytes = numBytesForFirstByte(getByteOneSegment(searchIdx));
BinaryString currentChar = copyBinaryStringInOneSeg(searchIdx,
searchIdx + charBytes - 1);
// try to find the matching for the character in the trimString characters.
if (trimStr.contains(currentChar)) {
searchIdx += charBytes;
} else {
break;
}
}
// empty string
if (searchIdx >= sizeInBytes) {
return EMPTY_UTF8;
} else {
return copyBinaryStringInOneSeg(searchIdx, sizeInBytes - 1);
}
} else {
return trimLeftSlow(trimStr);
}
} | java | public BinaryString trimLeft(BinaryString trimStr) {
ensureMaterialized();
if (trimStr == null) {
return null;
}
trimStr.ensureMaterialized();
if (trimStr.isSpaceString()) {
return trimLeft();
}
if (inFirstSegment()) {
int searchIdx = 0;
while (searchIdx < this.sizeInBytes) {
int charBytes = numBytesForFirstByte(getByteOneSegment(searchIdx));
BinaryString currentChar = copyBinaryStringInOneSeg(searchIdx,
searchIdx + charBytes - 1);
// try to find the matching for the character in the trimString characters.
if (trimStr.contains(currentChar)) {
searchIdx += charBytes;
} else {
break;
}
}
// empty string
if (searchIdx >= sizeInBytes) {
return EMPTY_UTF8;
} else {
return copyBinaryStringInOneSeg(searchIdx, sizeInBytes - 1);
}
} else {
return trimLeftSlow(trimStr);
}
} | [
"public",
"BinaryString",
"trimLeft",
"(",
"BinaryString",
"trimStr",
")",
"{",
"ensureMaterialized",
"(",
")",
";",
"if",
"(",
"trimStr",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"trimStr",
".",
"ensureMaterialized",
"(",
")",
";",
"if",
"(",
... | Walk each character of current string from left end, remove the character if it
is in trim string. Stops at the first character which is not in trim string.
Return the new substring.
@param trimStr the trim string
@return A subString which removes all of the character from the left side that is in
trim string. | [
"Walk",
"each",
"character",
"of",
"current",
"string",
"from",
"left",
"end",
"remove",
"the",
"character",
"if",
"it",
"is",
"in",
"trim",
"string",
".",
"Stops",
"at",
"the",
"first",
"character",
"which",
"is",
"not",
"in",
"trim",
"string",
".",
"Re... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L716-L747 | train | Returns a new string with characters from this string that are not in the trim string. | [
30522,
2270,
12441,
3367,
4892,
12241,
2571,
6199,
1006,
12441,
3367,
4892,
12241,
3367,
2099,
1007,
1063,
5676,
8585,
14482,
3550,
1006,
1007,
1025,
2065,
1006,
12241,
3367,
2099,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
122... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/tokenizer/lexical/AbstractLexicalAnalyzer.java | AbstractLexicalAnalyzer.segment | protected void segment(final String sentence, final String normalized, final List<String> wordList, final List<CoreDictionary.Attribute> attributeList)
{
if (attributeList != null)
{
final int[] offset = new int[]{0};
CustomDictionary.parseLongestText(sentence, new AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute>()
{
@Override
public void hit(int begin, int end, CoreDictionary.Attribute value)
{
if (begin != offset[0])
{
segmentAfterRule(sentence.substring(offset[0], begin), normalized.substring(offset[0], begin), wordList);
}
while (attributeList.size() < wordList.size())
attributeList.add(null);
wordList.add(sentence.substring(begin, end));
attributeList.add(value);
assert wordList.size() == attributeList.size() : "词语列表与属性列表不等长";
offset[0] = end;
}
});
if (offset[0] != sentence.length())
{
segmentAfterRule(sentence.substring(offset[0]), normalized.substring(offset[0]), wordList);
}
}
else
{
segmentAfterRule(sentence, normalized, wordList);
}
} | java | protected void segment(final String sentence, final String normalized, final List<String> wordList, final List<CoreDictionary.Attribute> attributeList)
{
if (attributeList != null)
{
final int[] offset = new int[]{0};
CustomDictionary.parseLongestText(sentence, new AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute>()
{
@Override
public void hit(int begin, int end, CoreDictionary.Attribute value)
{
if (begin != offset[0])
{
segmentAfterRule(sentence.substring(offset[0], begin), normalized.substring(offset[0], begin), wordList);
}
while (attributeList.size() < wordList.size())
attributeList.add(null);
wordList.add(sentence.substring(begin, end));
attributeList.add(value);
assert wordList.size() == attributeList.size() : "词语列表与属性列表不等长";
offset[0] = end;
}
});
if (offset[0] != sentence.length())
{
segmentAfterRule(sentence.substring(offset[0]), normalized.substring(offset[0]), wordList);
}
}
else
{
segmentAfterRule(sentence, normalized, wordList);
}
} | [
"protected",
"void",
"segment",
"(",
"final",
"String",
"sentence",
",",
"final",
"String",
"normalized",
",",
"final",
"List",
"<",
"String",
">",
"wordList",
",",
"final",
"List",
"<",
"CoreDictionary",
".",
"Attribute",
">",
"attributeList",
")",
"{",
"if... | 分词
@param sentence 文本
@param normalized 正规化后的文本
@param wordList 储存单词列表
@param attributeList 储存用户词典中的词性,设为null表示不查询用户词典 | [
"分词"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/tokenizer/lexical/AbstractLexicalAnalyzer.java#L109-L140 | train | segmentAfterRule This method is called after the sentence is parsed. | [
30522,
5123,
11675,
6903,
1006,
2345,
5164,
6251,
1010,
2345,
5164,
3671,
3550,
1010,
2345,
2862,
1026,
5164,
1028,
2773,
9863,
1010,
2345,
2862,
1026,
4563,
29201,
3258,
5649,
1012,
17961,
1028,
17961,
9863,
1007,
1063,
2065,
1006,
17961,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | Bindable.of | public static <T> Bindable<T> of(ResolvableType type) {
Assert.notNull(type, "Type must not be null");
ResolvableType boxedType = box(type);
return new Bindable<>(type, boxedType, null, NO_ANNOTATIONS);
} | java | public static <T> Bindable<T> of(ResolvableType type) {
Assert.notNull(type, "Type must not be null");
ResolvableType boxedType = box(type);
return new Bindable<>(type, boxedType, null, NO_ANNOTATIONS);
} | [
"public",
"static",
"<",
"T",
">",
"Bindable",
"<",
"T",
">",
"of",
"(",
"ResolvableType",
"type",
")",
"{",
"Assert",
".",
"notNull",
"(",
"type",
",",
"\"Type must not be null\"",
")",
";",
"ResolvableType",
"boxedType",
"=",
"box",
"(",
"type",
")",
"... | Create a new {@link Bindable} of the specified type.
@param <T> the source type
@param type the type (must not be {@code null})
@return a {@link Bindable} instance
@see #of(Class) | [
"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#L246-L250 | train | Creates a new instance of the specified type. | [
30522,
2270,
10763,
1026,
1056,
1028,
14187,
3085,
1026,
1056,
1028,
1997,
1006,
24501,
4747,
12423,
13874,
2828,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
2828,
1010,
1000,
2828,
2442,
2025,
2022,
19701,
1000,
1007,
1025,
24501,
47... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.wrap | public static Long[] wrap(long... values) {
if (null == values) {
return null;
}
final int length = values.length;
if (0 == length) {
return new Long[0];
}
final Long[] array = new Long[length];
for (int i = 0; i < length; i++) {
array[i] = Long.valueOf(values[i]);
}
return array;
} | java | public static Long[] wrap(long... values) {
if (null == values) {
return null;
}
final int length = values.length;
if (0 == length) {
return new Long[0];
}
final Long[] array = new Long[length];
for (int i = 0; i < length; i++) {
array[i] = Long.valueOf(values[i]);
}
return array;
} | [
"public",
"static",
"Long",
"[",
"]",
"wrap",
"(",
"long",
"...",
"values",
")",
"{",
"if",
"(",
"null",
"==",
"values",
")",
"{",
"return",
"null",
";",
"}",
"final",
"int",
"length",
"=",
"values",
".",
"length",
";",
"if",
"(",
"0",
"==",
"len... | 将原始类型数组包装为包装类型
@param values 原始类型数组
@return 包装类型数组 | [
"将原始类型数组包装为包装类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L1443-L1457 | train | Wraps the specified long array in a new array. | [
30522,
2270,
10763,
2146,
1031,
1033,
10236,
1006,
2146,
1012,
1012,
1012,
5300,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
5300,
1007,
1063,
2709,
19701,
1025,
1065,
2345,
20014,
3091,
1027,
5300,
1012,
3091,
1025,
2065,
1006,
1014,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/compiler/NFACompiler.java | NFACompiler.compileFactory | @SuppressWarnings("unchecked")
public static <T> NFAFactory<T> compileFactory(
final Pattern<T, ?> pattern,
boolean timeoutHandling) {
if (pattern == null) {
// return a factory for empty NFAs
return new NFAFactoryImpl<>(0, Collections.<State<T>>emptyList(), timeoutHandling);
} else {
final NFAFactoryCompiler<T> nfaFactoryCompiler = new NFAFactoryCompiler<>(pattern);
nfaFactoryCompiler.compileFactory();
return new NFAFactoryImpl<>(nfaFactoryCompiler.getWindowTime(), nfaFactoryCompiler.getStates(), timeoutHandling);
}
} | java | @SuppressWarnings("unchecked")
public static <T> NFAFactory<T> compileFactory(
final Pattern<T, ?> pattern,
boolean timeoutHandling) {
if (pattern == null) {
// return a factory for empty NFAs
return new NFAFactoryImpl<>(0, Collections.<State<T>>emptyList(), timeoutHandling);
} else {
final NFAFactoryCompiler<T> nfaFactoryCompiler = new NFAFactoryCompiler<>(pattern);
nfaFactoryCompiler.compileFactory();
return new NFAFactoryImpl<>(nfaFactoryCompiler.getWindowTime(), nfaFactoryCompiler.getStates(), timeoutHandling);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"NFAFactory",
"<",
"T",
">",
"compileFactory",
"(",
"final",
"Pattern",
"<",
"T",
",",
"?",
">",
"pattern",
",",
"boolean",
"timeoutHandling",
")",
"{",
"if",
"(",
"pa... | Compiles the given pattern into a {@link NFAFactory}. The NFA factory can be used to create
multiple NFAs.
@param pattern Definition of sequence pattern
@param timeoutHandling True if the NFA shall return timed out event patterns
@param <T> Type of the input events
@return Factory for NFAs corresponding to the given pattern | [
"Compiles",
"the",
"given",
"pattern",
"into",
"a",
"{",
"@link",
"NFAFactory",
"}",
".",
"The",
"NFA",
"factory",
"can",
"be",
"used",
"to",
"create",
"multiple",
"NFAs",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/compiler/NFACompiler.java#L68-L80 | train | Compile a NFAFactory for a given pattern. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
1050,
7011,
21450,
1026,
1056,
1028,
4012,
22090,
21450,
1006,
2345,
5418,
1026,
1056,
1010,
1029,
1028,
5418,
1010,
22017,
2089... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DbUtil.java | DbUtil.getJndiDs | public static DataSource getJndiDs(String jndiName) {
try {
return (DataSource) new InitialContext().lookup(jndiName);
} catch (NamingException e) {
throw new DbRuntimeException(e);
}
} | java | public static DataSource getJndiDs(String jndiName) {
try {
return (DataSource) new InitialContext().lookup(jndiName);
} catch (NamingException e) {
throw new DbRuntimeException(e);
}
} | [
"public",
"static",
"DataSource",
"getJndiDs",
"(",
"String",
"jndiName",
")",
"{",
"try",
"{",
"return",
"(",
"DataSource",
")",
"new",
"InitialContext",
"(",
")",
".",
"lookup",
"(",
"jndiName",
")",
";",
"}",
"catch",
"(",
"NamingException",
"e",
")",
... | 获得JNDI数据源
@param jndiName JNDI名称
@return 数据源 | [
"获得JNDI数据源"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/DbUtil.java#L223-L229 | train | Returns a DataSource object for the specified JNDI name. | [
30522,
2270,
10763,
2951,
6499,
3126,
3401,
2131,
22895,
4305,
5104,
1006,
5164,
1046,
16089,
18442,
1007,
1063,
3046,
1063,
2709,
1006,
2951,
6499,
3126,
3401,
1007,
2047,
3988,
8663,
18209,
1006,
1007,
1012,
2298,
6279,
1006,
1046,
16089,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateMoney | public static <T extends CharSequence> T validateMoney(T value, String errorMsg) throws ValidateException {
if (false == isMoney(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validateMoney(T value, String errorMsg) throws ValidateException {
if (false == isMoney(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateMoney",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isMoney",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"... | 验证是否为货币
@param <T> 字符串类型
@param value 值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证是否为货币"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L598-L604 | train | Validate a money value. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
9398,
3686,
8202,
3240,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
1027,
2003,
8202,
3240,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.urlWithForm | public static String urlWithForm(String url, Map<String, Object> form, Charset charset, boolean isEncodeParams) {
if (isEncodeParams && StrUtil.contains(url, '?')) {
// 在需要编码的情况下,如果url中已经有部分参数,则编码之
url = encodeParams(url, charset);
}
// url和参数是分别编码的
return urlWithForm(url, toParams(form, charset), charset, false);
} | java | public static String urlWithForm(String url, Map<String, Object> form, Charset charset, boolean isEncodeParams) {
if (isEncodeParams && StrUtil.contains(url, '?')) {
// 在需要编码的情况下,如果url中已经有部分参数,则编码之
url = encodeParams(url, charset);
}
// url和参数是分别编码的
return urlWithForm(url, toParams(form, charset), charset, false);
} | [
"public",
"static",
"String",
"urlWithForm",
"(",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"form",
",",
"Charset",
"charset",
",",
"boolean",
"isEncodeParams",
")",
"{",
"if",
"(",
"isEncodeParams",
"&&",
"StrUtil",
".",
"contains",
... | 将表单数据加到URL中(用于GET表单提交)<br>
表单的键值对会被url编码,但是url中原参数不会被编码
@param url URL
@param form 表单数据
@param charset 编码
@param isEncodeParams 是否对键和值做转义处理
@return 合成后的URL | [
"将表单数据加到URL中(用于GET表单提交)<br",
">",
"表单的键值对会被url编码,但是url中原参数不会被编码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L604-L612 | train | Returns a URL with the specified form data. | [
30522,
2270,
10763,
5164,
24471,
2140,
24415,
14192,
1006,
5164,
24471,
2140,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
2433,
1010,
25869,
13462,
25869,
13462,
1010,
22017,
20898,
2003,
2368,
16044,
28689,
5244,
1007,
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... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/MultipartFormData.java | MultipartFormData.parseRequestStream | public void parseRequestStream(InputStream inputStream, String charset) throws IOException {
setLoaded();
MultipartRequestInputStream input = new MultipartRequestInputStream(inputStream);
input.readBoundary();
while (true) {
UploadFileHeader header = input.readDataHeader(charset);
if (header == null) {
break;
}
if (header.isFile == true) {
// 文件类型的表单项
String fileName = header.fileName;
if (fileName.length() > 0 && header.contentType.contains("application/x-macbinary")) {
input.skipBytes(128);
}
UploadFile newFile = new UploadFile(header, setting);
newFile.processStream(input);
putFile(header.formFieldName, newFile);
} else {
// 标准表单项
ByteArrayOutputStream fbos = new ByteArrayOutputStream(1024);
input.copy(fbos);
String value = (charset != null) ? new String(fbos.toByteArray(), charset) : new String(fbos.toByteArray());
putParameter(header.formFieldName, value);
}
input.skipBytes(1);
input.mark(1);
// read byte, but may be end of stream
int nextByte = input.read();
if (nextByte == -1 || nextByte == '-') {
input.reset();
break;
}
input.reset();
}
} | java | public void parseRequestStream(InputStream inputStream, String charset) throws IOException {
setLoaded();
MultipartRequestInputStream input = new MultipartRequestInputStream(inputStream);
input.readBoundary();
while (true) {
UploadFileHeader header = input.readDataHeader(charset);
if (header == null) {
break;
}
if (header.isFile == true) {
// 文件类型的表单项
String fileName = header.fileName;
if (fileName.length() > 0 && header.contentType.contains("application/x-macbinary")) {
input.skipBytes(128);
}
UploadFile newFile = new UploadFile(header, setting);
newFile.processStream(input);
putFile(header.formFieldName, newFile);
} else {
// 标准表单项
ByteArrayOutputStream fbos = new ByteArrayOutputStream(1024);
input.copy(fbos);
String value = (charset != null) ? new String(fbos.toByteArray(), charset) : new String(fbos.toByteArray());
putParameter(header.formFieldName, value);
}
input.skipBytes(1);
input.mark(1);
// read byte, but may be end of stream
int nextByte = input.read();
if (nextByte == -1 || nextByte == '-') {
input.reset();
break;
}
input.reset();
}
} | [
"public",
"void",
"parseRequestStream",
"(",
"InputStream",
"inputStream",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"setLoaded",
"(",
")",
";",
"MultipartRequestInputStream",
"input",
"=",
"new",
"MultipartRequestInputStream",
"(",
"inputStream",
"... | 提取上传的文件和表单数据
@param inputStream HttpRequest流
@param charset 编码
@throws IOException IO异常 | [
"提取上传的文件和表单数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/MultipartFormData.java#L68-L108 | train | Parses an input stream and populates the related fields. | [
30522,
2270,
11675,
11968,
8043,
2063,
15500,
21422,
1006,
20407,
25379,
20407,
25379,
1010,
5164,
25869,
13462,
1007,
11618,
22834,
10288,
24422,
1063,
2275,
17468,
1006,
1007,
1025,
4800,
19362,
7913,
15500,
2378,
18780,
21422,
7953,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java | InitializrServiceMetadata.getDefaultType | public ProjectType getDefaultType() {
if (this.projectTypes.getDefaultItem() != null) {
return this.projectTypes.getDefaultItem();
}
String defaultTypeId = getDefaults().get("type");
if (defaultTypeId != null) {
return this.projectTypes.getContent().get(defaultTypeId);
}
return null;
} | java | public ProjectType getDefaultType() {
if (this.projectTypes.getDefaultItem() != null) {
return this.projectTypes.getDefaultItem();
}
String defaultTypeId = getDefaults().get("type");
if (defaultTypeId != null) {
return this.projectTypes.getContent().get(defaultTypeId);
}
return null;
} | [
"public",
"ProjectType",
"getDefaultType",
"(",
")",
"{",
"if",
"(",
"this",
".",
"projectTypes",
".",
"getDefaultItem",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"projectTypes",
".",
"getDefaultItem",
"(",
")",
";",
"}",
"String",
"defaultT... | Return the default type to use or {@code null} if the metadata does not define any
default.
@return the default project type or {@code null} | [
"Return",
"the",
"default",
"type",
"to",
"use",
"or",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrServiceMetadata.java#L110-L119 | train | Get the default type. | [
30522,
2270,
2622,
13874,
2131,
3207,
7011,
11314,
13874,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
2622,
13874,
2015,
1012,
2131,
3207,
7011,
11314,
4221,
2213,
1006,
1007,
999,
1027,
19701,
1007,
1063,
2709,
2023,
1012,
2622,
13874,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java | WebSocketServerHandshaker.handshake | public ChannelFuture handshake(Channel channel, FullHttpRequest req) {
return handshake(channel, req, null, channel.newPromise());
} | java | public ChannelFuture handshake(Channel channel, FullHttpRequest req) {
return handshake(channel, req, null, channel.newPromise());
} | [
"public",
"ChannelFuture",
"handshake",
"(",
"Channel",
"channel",
",",
"FullHttpRequest",
"req",
")",
"{",
"return",
"handshake",
"(",
"channel",
",",
"req",
",",
"null",
",",
"channel",
".",
"newPromise",
"(",
")",
")",
";",
"}"
] | Performs the opening handshake. When call this method you <strong>MUST NOT</strong> retain the
{@link FullHttpRequest} which is passed in.
@param channel
Channel
@param req
HTTP Request
@return future
The {@link ChannelFuture} which is notified once the opening handshake completes | [
"Performs",
"the",
"opening",
"handshake",
".",
"When",
"call",
"this",
"method",
"you",
"<strong",
">",
"MUST",
"NOT<",
"/",
"strong",
">",
"retain",
"the",
"{",
"@link",
"FullHttpRequest",
"}",
"which",
"is",
"passed",
"in",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java#L141-L143 | train | Handshake the request. | [
30522,
2270,
3149,
11263,
11244,
2398,
20459,
2063,
1006,
3149,
3149,
1010,
2440,
11039,
25856,
2890,
15500,
2128,
4160,
1007,
1063,
2709,
2398,
20459,
2063,
1006,
3149,
1010,
2128,
4160,
1010,
19701,
1010,
3149,
1012,
2047,
21572,
28732,
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... |
alibaba/canal | store/src/main/java/com/alibaba/otter/canal/store/helper/CanalEventUtils.java | CanalEventUtils.createPosition | public static LogPosition createPosition(Event event) {
EntryPosition position = new EntryPosition();
position.setJournalName(event.getJournalName());
position.setPosition(event.getPosition());
position.setTimestamp(event.getExecuteTime());
// add serverId at 2016-06-28
position.setServerId(event.getServerId());
// add gtid
position.setGtid(event.getGtid());
LogPosition logPosition = new LogPosition();
logPosition.setPostion(position);
logPosition.setIdentity(event.getLogIdentity());
return logPosition;
} | java | public static LogPosition createPosition(Event event) {
EntryPosition position = new EntryPosition();
position.setJournalName(event.getJournalName());
position.setPosition(event.getPosition());
position.setTimestamp(event.getExecuteTime());
// add serverId at 2016-06-28
position.setServerId(event.getServerId());
// add gtid
position.setGtid(event.getGtid());
LogPosition logPosition = new LogPosition();
logPosition.setPostion(position);
logPosition.setIdentity(event.getLogIdentity());
return logPosition;
} | [
"public",
"static",
"LogPosition",
"createPosition",
"(",
"Event",
"event",
")",
"{",
"EntryPosition",
"position",
"=",
"new",
"EntryPosition",
"(",
")",
";",
"position",
".",
"setJournalName",
"(",
"event",
".",
"getJournalName",
"(",
")",
")",
";",
"position... | 根据entry创建对应的Position对象 | [
"根据entry创建对应的Position对象"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/store/src/main/java/com/alibaba/otter/canal/store/helper/CanalEventUtils.java#L48-L62 | train | Create a log position object from an event. | [
30522,
2270,
10763,
8833,
26994,
3443,
26994,
1006,
2724,
2724,
1007,
1063,
4443,
26994,
2597,
1027,
2047,
4443,
26994,
1006,
1007,
1025,
2597,
1012,
2275,
23099,
12789,
19666,
14074,
1006,
2724,
1012,
2131,
23099,
12789,
19666,
14074,
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-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/LongHashPartition.java | LongHashPartition.updateIndex | private void updateIndex(
long key,
int hashCode,
long address,
int size,
MemorySegment dataSegment,
int currentPositionInSegment) throws IOException {
assert (numKeys <= numBuckets / 2);
int bucketId = hashCode & numBucketsMask;
// each bucket occupied 16 bytes (long key + long pointer to data address)
int bucketOffset = bucketId * SPARSE_BUCKET_ELEMENT_SIZE_IN_BYTES;
MemorySegment segment = buckets[bucketOffset >>> segmentSizeBits];
int segOffset = bucketOffset & segmentSizeMask;
long currAddress;
while (true) {
currAddress = segment.getLong(segOffset + 8);
if (segment.getLong(segOffset) != key && currAddress != INVALID_ADDRESS) {
// hash conflicts, the bucket is occupied by another key
// TODO test Conflict resolution:
// now: +1 +1 +1... cache friendly but more conflict, so we set factor to 0.5
// other1: +1 +2 +3... less conflict, factor can be 0.75
// other2: Secondary hashCode... less and less conflict, but need compute hash again
bucketId = (bucketId + 1) & numBucketsMask;
if (segOffset + SPARSE_BUCKET_ELEMENT_SIZE_IN_BYTES < segmentSize) {
// if the new bucket still in current segment, we only need to update offset
// within this segment
segOffset += SPARSE_BUCKET_ELEMENT_SIZE_IN_BYTES;
} else {
// otherwise, we should re-calculate segment and offset
bucketOffset = bucketId * 16;
segment = buckets[bucketOffset >>> segmentSizeBits];
segOffset = bucketOffset & segmentSizeMask;
}
} else {
break;
}
}
if (currAddress == INVALID_ADDRESS) {
// this is the first value for this key, put the address in array.
segment.putLong(segOffset, key);
segment.putLong(segOffset + 8, address);
numKeys += 1;
// dataSegment may be null if we only have to rehash bucket area
if (dataSegment != null) {
dataSegment.putLong(currentPositionInSegment, toAddrAndLen(INVALID_ADDRESS, size));
}
if (numKeys * 2 > numBuckets) {
resize();
}
} else {
// there are some values for this key, put the address in the front of them.
dataSegment.putLong(currentPositionInSegment, toAddrAndLen(currAddress, size));
segment.putLong(segOffset + 8, address);
}
} | java | private void updateIndex(
long key,
int hashCode,
long address,
int size,
MemorySegment dataSegment,
int currentPositionInSegment) throws IOException {
assert (numKeys <= numBuckets / 2);
int bucketId = hashCode & numBucketsMask;
// each bucket occupied 16 bytes (long key + long pointer to data address)
int bucketOffset = bucketId * SPARSE_BUCKET_ELEMENT_SIZE_IN_BYTES;
MemorySegment segment = buckets[bucketOffset >>> segmentSizeBits];
int segOffset = bucketOffset & segmentSizeMask;
long currAddress;
while (true) {
currAddress = segment.getLong(segOffset + 8);
if (segment.getLong(segOffset) != key && currAddress != INVALID_ADDRESS) {
// hash conflicts, the bucket is occupied by another key
// TODO test Conflict resolution:
// now: +1 +1 +1... cache friendly but more conflict, so we set factor to 0.5
// other1: +1 +2 +3... less conflict, factor can be 0.75
// other2: Secondary hashCode... less and less conflict, but need compute hash again
bucketId = (bucketId + 1) & numBucketsMask;
if (segOffset + SPARSE_BUCKET_ELEMENT_SIZE_IN_BYTES < segmentSize) {
// if the new bucket still in current segment, we only need to update offset
// within this segment
segOffset += SPARSE_BUCKET_ELEMENT_SIZE_IN_BYTES;
} else {
// otherwise, we should re-calculate segment and offset
bucketOffset = bucketId * 16;
segment = buckets[bucketOffset >>> segmentSizeBits];
segOffset = bucketOffset & segmentSizeMask;
}
} else {
break;
}
}
if (currAddress == INVALID_ADDRESS) {
// this is the first value for this key, put the address in array.
segment.putLong(segOffset, key);
segment.putLong(segOffset + 8, address);
numKeys += 1;
// dataSegment may be null if we only have to rehash bucket area
if (dataSegment != null) {
dataSegment.putLong(currentPositionInSegment, toAddrAndLen(INVALID_ADDRESS, size));
}
if (numKeys * 2 > numBuckets) {
resize();
}
} else {
// there are some values for this key, put the address in the front of them.
dataSegment.putLong(currentPositionInSegment, toAddrAndLen(currAddress, size));
segment.putLong(segOffset + 8, address);
}
} | [
"private",
"void",
"updateIndex",
"(",
"long",
"key",
",",
"int",
"hashCode",
",",
"long",
"address",
",",
"int",
"size",
",",
"MemorySegment",
"dataSegment",
",",
"int",
"currentPositionInSegment",
")",
"throws",
"IOException",
"{",
"assert",
"(",
"numKeys",
... | Update the address in array for given key. | [
"Update",
"the",
"address",
"in",
"array",
"for",
"given",
"key",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/LongHashPartition.java#L286-L343 | train | Update the index of the key in the array. | [
30522,
2797,
11675,
10651,
22254,
10288,
1006,
2146,
3145,
1010,
20014,
23325,
16044,
1010,
2146,
4769,
1010,
20014,
2946,
1010,
3638,
3366,
21693,
4765,
2951,
3366,
21693,
4765,
1010,
20014,
2783,
26994,
7076,
13910,
3672,
1007,
11618,
22834... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/metrics/dump/MetricQueryService.java | MetricQueryService.replaceInvalidChars | private static String replaceInvalidChars(String str) {
char[] chars = null;
final int strLen = str.length();
int pos = 0;
for (int i = 0; i < strLen; i++) {
final char c = str.charAt(i);
switch (c) {
case ' ':
case '.':
case ':':
case ',':
if (chars == null) {
chars = str.toCharArray();
}
chars[pos++] = '_';
break;
default:
if (chars != null) {
chars[pos] = c;
}
pos++;
}
}
return chars == null ? str : new String(chars, 0, pos);
} | java | private static String replaceInvalidChars(String str) {
char[] chars = null;
final int strLen = str.length();
int pos = 0;
for (int i = 0; i < strLen; i++) {
final char c = str.charAt(i);
switch (c) {
case ' ':
case '.':
case ':':
case ',':
if (chars == null) {
chars = str.toCharArray();
}
chars[pos++] = '_';
break;
default:
if (chars != null) {
chars[pos] = c;
}
pos++;
}
}
return chars == null ? str : new String(chars, 0, pos);
} | [
"private",
"static",
"String",
"replaceInvalidChars",
"(",
"String",
"str",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"null",
";",
"final",
"int",
"strLen",
"=",
"str",
".",
"length",
"(",
")",
";",
"int",
"pos",
"=",
"0",
";",
"for",
"(",
"int",
"... | Lightweight method to replace unsupported characters.
If the string does not contain any unsupported characters, this method creates no
new string (and in fact no new objects at all).
<p>Replacements:
<ul>
<li>{@code space : . ,} are replaced by {@code _} (underscore)</li>
</ul> | [
"Lightweight",
"method",
"to",
"replace",
"unsupported",
"characters",
".",
"If",
"the",
"string",
"does",
"not",
"contain",
"any",
"unsupported",
"characters",
"this",
"method",
"creates",
"no",
"new",
"string",
"(",
"and",
"in",
"fact",
"no",
"new",
"objects... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/dump/MetricQueryService.java#L208-L234 | train | Replaces invalid characters in the string. | [
30522,
2797,
10763,
5164,
5672,
2378,
10175,
3593,
7507,
2869,
1006,
5164,
2358,
2099,
1007,
1063,
25869,
1031,
1033,
25869,
2015,
1027,
19701,
1025,
2345,
20014,
2358,
20927,
2078,
1027,
2358,
2099,
1012,
3091,
1006,
1007,
1025,
20014,
134... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java | DoubleArrayTrie.get | public V get(String key)
{
int index = exactMatchSearch(key);
if (index >= 0)
{
return getValueAt(index);
}
return null;
} | java | public V get(String key)
{
int index = exactMatchSearch(key);
if (index >= 0)
{
return getValueAt(index);
}
return null;
} | [
"public",
"V",
"get",
"(",
"String",
"key",
")",
"{",
"int",
"index",
"=",
"exactMatchSearch",
"(",
"key",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"return",
"getValueAt",
"(",
"index",
")",
";",
"}",
"return",
"null",
";",
"}"
] | 精确查询
@param key 键
@return 值 | [
"精确查询"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L989-L998 | train | Gets the value of the appid. | [
30522,
2270,
1058,
2131,
1006,
5164,
3145,
1007,
1063,
20014,
5950,
1027,
6635,
18900,
18069,
14644,
2818,
1006,
3145,
1007,
1025,
2065,
1006,
5950,
1028,
1027,
1014,
1007,
1063,
2709,
2131,
10175,
5657,
4017,
1006,
5950,
1007,
1025,
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... |
netty/netty | example/src/main/java/io/netty/example/http2/helloworld/server/HelloWorldHttp2Handler.java | HelloWorldHttp2Handler.sendResponse | private void sendResponse(ChannelHandlerContext ctx, int streamId, ByteBuf payload) {
// Send a frame for the response status
Http2Headers headers = new DefaultHttp2Headers().status(OK.codeAsText());
encoder().writeHeaders(ctx, streamId, headers, 0, false, ctx.newPromise());
encoder().writeData(ctx, streamId, payload, 0, true, ctx.newPromise());
// no need to call flush as channelReadComplete(...) will take care of it.
} | java | private void sendResponse(ChannelHandlerContext ctx, int streamId, ByteBuf payload) {
// Send a frame for the response status
Http2Headers headers = new DefaultHttp2Headers().status(OK.codeAsText());
encoder().writeHeaders(ctx, streamId, headers, 0, false, ctx.newPromise());
encoder().writeData(ctx, streamId, payload, 0, true, ctx.newPromise());
// no need to call flush as channelReadComplete(...) will take care of it.
} | [
"private",
"void",
"sendResponse",
"(",
"ChannelHandlerContext",
"ctx",
",",
"int",
"streamId",
",",
"ByteBuf",
"payload",
")",
"{",
"// Send a frame for the response status",
"Http2Headers",
"headers",
"=",
"new",
"DefaultHttp2Headers",
"(",
")",
".",
"status",
"(",
... | Sends a "Hello World" DATA frame to the client. | [
"Sends",
"a",
"Hello",
"World",
"DATA",
"frame",
"to",
"the",
"client",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http2/helloworld/server/HelloWorldHttp2Handler.java#L88-L95 | train | Sends a response frame to the server. | [
30522,
2797,
11675,
4604,
6072,
26029,
3366,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
20014,
5460,
3593,
1010,
24880,
8569,
2546,
18093,
1007,
1063,
1013,
1013,
4604,
1037,
4853,
2005,
1996,
3433,
3570,
8299,
2475,
4974,
254... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.cut | public static void cut(InputStream srcStream, OutputStream destStream, Rectangle rectangle) {
cut(read(srcStream), destStream, rectangle);
} | java | public static void cut(InputStream srcStream, OutputStream destStream, Rectangle rectangle) {
cut(read(srcStream), destStream, rectangle);
} | [
"public",
"static",
"void",
"cut",
"(",
"InputStream",
"srcStream",
",",
"OutputStream",
"destStream",
",",
"Rectangle",
"rectangle",
")",
"{",
"cut",
"(",
"read",
"(",
"srcStream",
")",
",",
"destStream",
",",
"rectangle",
")",
";",
"}"
] | 图像切割(按指定起点坐标和宽高切割),此方法并不关闭流
@param srcStream 源图像流
@param destStream 切片后的图像输出流
@param rectangle 矩形对象,表示矩形区域的x,y,width,height
@since 3.1.0 | [
"图像切割",
"(",
"按指定起点坐标和宽高切割",
")",
",此方法并不关闭流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L268-L270 | train | Cut the contents of srcStream to destStream using the specified rectangle. | [
30522,
2270,
10763,
11675,
3013,
1006,
20407,
25379,
5034,
6169,
25379,
1010,
27852,
25379,
4078,
3215,
25379,
1010,
28667,
23395,
28667,
23395,
1007,
1063,
3013,
1006,
3191,
1006,
5034,
6169,
25379,
1007,
1010,
4078,
3215,
25379,
1010,
28667... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java | StyleUtil.createFont | public static Font createFont(Workbook workbook, short color, short fontSize, String fontName) {
final Font font = workbook.createFont();
return setFontStyle(font, color, fontSize, fontName);
} | java | public static Font createFont(Workbook workbook, short color, short fontSize, String fontName) {
final Font font = workbook.createFont();
return setFontStyle(font, color, fontSize, fontName);
} | [
"public",
"static",
"Font",
"createFont",
"(",
"Workbook",
"workbook",
",",
"short",
"color",
",",
"short",
"fontSize",
",",
"String",
"fontName",
")",
"{",
"final",
"Font",
"font",
"=",
"workbook",
".",
"createFont",
"(",
")",
";",
"return",
"setFontStyle",... | 创建字体
@param workbook {@link Workbook}
@param color 字体颜色
@param fontSize 字体大小
@param fontName 字体名称,可以为null使用默认字体
@return {@link Font} | [
"创建字体"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java#L120-L123 | train | Creates a font with the specified color and font size and font name. | [
30522,
2270,
10763,
15489,
3443,
14876,
3372,
1006,
2147,
8654,
2147,
8654,
1010,
2460,
3609,
1010,
2460,
15489,
5332,
4371,
1010,
5164,
15489,
18442,
1007,
1063,
2345,
15489,
15489,
1027,
2147,
8654,
1012,
3443,
14876,
3372,
1006,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupPartitioner.java | KeyGroupPartitioner.buildHistogramByAccumulatingCounts | private int buildHistogramByAccumulatingCounts() {
int sum = 0;
for (int i = 0; i < counterHistogram.length; ++i) {
int currentSlotValue = counterHistogram[i];
counterHistogram[i] = sum;
sum += currentSlotValue;
}
return sum;
} | java | private int buildHistogramByAccumulatingCounts() {
int sum = 0;
for (int i = 0; i < counterHistogram.length; ++i) {
int currentSlotValue = counterHistogram[i];
counterHistogram[i] = sum;
sum += currentSlotValue;
}
return sum;
} | [
"private",
"int",
"buildHistogramByAccumulatingCounts",
"(",
")",
"{",
"int",
"sum",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"counterHistogram",
".",
"length",
";",
"++",
"i",
")",
"{",
"int",
"currentSlotValue",
"=",
"counterHist... | This method creates a histogram from the counts per key-group in {@link #counterHistogram}. | [
"This",
"method",
"creates",
"a",
"histogram",
"from",
"the",
"counts",
"per",
"key",
"-",
"group",
"in",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupPartitioner.java#L170-L178 | train | Builds the histogram by accumulating counts. | [
30522,
2797,
20014,
3857,
24158,
3406,
13113,
3762,
6305,
24894,
10924,
3597,
16671,
2015,
1006,
1007,
1063,
20014,
7680,
1027,
1014,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
4675,
24158,
3406,
13113,
1012,
3091,
1025,
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/checkpoint/PendingCheckpoint.java | PendingCheckpoint.reportFailedCheckpoint | private void reportFailedCheckpoint(Exception cause) {
// to prevent null-pointers from concurrent modification, copy reference onto stack
final PendingCheckpointStats statsCallback = this.statsCallback;
if (statsCallback != null) {
long failureTimestamp = System.currentTimeMillis();
statsCallback.reportFailedCheckpoint(failureTimestamp, cause);
}
} | java | private void reportFailedCheckpoint(Exception cause) {
// to prevent null-pointers from concurrent modification, copy reference onto stack
final PendingCheckpointStats statsCallback = this.statsCallback;
if (statsCallback != null) {
long failureTimestamp = System.currentTimeMillis();
statsCallback.reportFailedCheckpoint(failureTimestamp, cause);
}
} | [
"private",
"void",
"reportFailedCheckpoint",
"(",
"Exception",
"cause",
")",
"{",
"// to prevent null-pointers from concurrent modification, copy reference onto stack",
"final",
"PendingCheckpointStats",
"statsCallback",
"=",
"this",
".",
"statsCallback",
";",
"if",
"(",
"stats... | Reports a failed checkpoint with the given optional cause.
@param cause The failure cause or <code>null</code>. | [
"Reports",
"a",
"failed",
"checkpoint",
"with",
"the",
"given",
"optional",
"cause",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpoint.java#L486-L493 | train | Reports a failed checkpoint. | [
30522,
2797,
11675,
3189,
7011,
18450,
5403,
3600,
8400,
1006,
6453,
3426,
1007,
1063,
1013,
1013,
2000,
4652,
19701,
1011,
20884,
2015,
2013,
16483,
14080,
1010,
6100,
4431,
3031,
9991,
2345,
14223,
5403,
3600,
26521,
29336,
2015,
26319,
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... |
apache/flink | flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/DefaultConfigurableOptionsFactory.java | DefaultConfigurableOptionsFactory.configure | @Override
public DefaultConfigurableOptionsFactory configure(Configuration configuration) {
for (String key : CANDIDATE_CONFIGS) {
String newValue = configuration.getString(key, null);
if (newValue != null) {
if (checkArgumentValid(key, newValue)) {
this.configuredOptions.put(key, newValue);
}
}
}
return this;
} | java | @Override
public DefaultConfigurableOptionsFactory configure(Configuration configuration) {
for (String key : CANDIDATE_CONFIGS) {
String newValue = configuration.getString(key, null);
if (newValue != null) {
if (checkArgumentValid(key, newValue)) {
this.configuredOptions.put(key, newValue);
}
}
}
return this;
} | [
"@",
"Override",
"public",
"DefaultConfigurableOptionsFactory",
"configure",
"(",
"Configuration",
"configuration",
")",
"{",
"for",
"(",
"String",
"key",
":",
"CANDIDATE_CONFIGS",
")",
"{",
"String",
"newValue",
"=",
"configuration",
".",
"getString",
"(",
"key",
... | Creates a {@link DefaultConfigurableOptionsFactory} instance from a {@link Configuration}.
<p>If no options within {@link RocksDBConfigurableOptions} has ever been configured,
the created OptionsFactory would not override anything defined in {@link PredefinedOptions}.
@param configuration Configuration to be used for the ConfigurableOptionsFactory creation
@return A ConfigurableOptionsFactory created from the given configuration | [
"Creates",
"a",
"{",
"@link",
"DefaultConfigurableOptionsFactory",
"}",
"instance",
"from",
"a",
"{",
"@link",
"Configuration",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/DefaultConfigurableOptionsFactory.java#L351-L363 | train | Override this to configure the options based on the configuration. | [
30522,
1030,
2058,
15637,
2270,
12398,
8663,
8873,
27390,
3085,
7361,
9285,
21450,
9530,
8873,
27390,
2063,
1006,
9563,
9563,
1007,
1063,
2005,
1006,
5164,
3145,
1024,
4018,
1035,
9530,
8873,
5620,
1007,
1063,
5164,
2047,
10175,
5657,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/JobLeaderIdService.java | JobLeaderIdService.addJob | public void addJob(JobID jobId) throws Exception {
Preconditions.checkNotNull(jobLeaderIdActions);
LOG.debug("Add job {} to job leader id monitoring.", jobId);
if (!jobLeaderIdListeners.containsKey(jobId)) {
LeaderRetrievalService leaderRetrievalService = highAvailabilityServices.getJobManagerLeaderRetriever(jobId);
JobLeaderIdListener jobIdListener = new JobLeaderIdListener(jobId, jobLeaderIdActions, leaderRetrievalService);
jobLeaderIdListeners.put(jobId, jobIdListener);
}
} | java | public void addJob(JobID jobId) throws Exception {
Preconditions.checkNotNull(jobLeaderIdActions);
LOG.debug("Add job {} to job leader id monitoring.", jobId);
if (!jobLeaderIdListeners.containsKey(jobId)) {
LeaderRetrievalService leaderRetrievalService = highAvailabilityServices.getJobManagerLeaderRetriever(jobId);
JobLeaderIdListener jobIdListener = new JobLeaderIdListener(jobId, jobLeaderIdActions, leaderRetrievalService);
jobLeaderIdListeners.put(jobId, jobIdListener);
}
} | [
"public",
"void",
"addJob",
"(",
"JobID",
"jobId",
")",
"throws",
"Exception",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"jobLeaderIdActions",
")",
";",
"LOG",
".",
"debug",
"(",
"\"Add job {} to job leader id monitoring.\"",
",",
"jobId",
")",
";",
"if",
... | Add a job to be monitored to retrieve the job leader id.
@param jobId identifying the job to monitor
@throws Exception if the job could not be added to the service | [
"Add",
"a",
"job",
"to",
"be",
"monitored",
"to",
"retrieve",
"the",
"job",
"leader",
"id",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/JobLeaderIdService.java#L145-L156 | train | Add a job to the job leader id monitoring. | [
30522,
2270,
11675,
5587,
5558,
2497,
1006,
3105,
3593,
3105,
3593,
1007,
11618,
6453,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
3105,
19000,
8524,
22014,
1007,
1025,
8833,
1012,
2139,
8569,
2290,
1006,
1000,
5587... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/api/CronSchedule.java | CronSchedule.monthlyOnDayAndHourAndMinute | public static CronSchedule monthlyOnDayAndHourAndMinute(int dayOfMonth, int hour, int minute) {
String expression = String.format("0 %d %d %d * ?", minute, hour, dayOfMonth);
return of(expression);
} | java | public static CronSchedule monthlyOnDayAndHourAndMinute(int dayOfMonth, int hour, int minute) {
String expression = String.format("0 %d %d %d * ?", minute, hour, dayOfMonth);
return of(expression);
} | [
"public",
"static",
"CronSchedule",
"monthlyOnDayAndHourAndMinute",
"(",
"int",
"dayOfMonth",
",",
"int",
"hour",
",",
"int",
"minute",
")",
"{",
"String",
"expression",
"=",
"String",
".",
"format",
"(",
"\"0 %d %d %d * ?\"",
",",
"minute",
",",
"hour",
",",
... | Creates cron expression which schedule task execution
every given day of the month at the given time
@param hour of schedule
@param minute of schedule
@param dayOfMonth of schedule
@return object | [
"Creates",
"cron",
"expression",
"which",
"schedule",
"task",
"execution",
"every",
"given",
"day",
"of",
"the",
"month",
"at",
"the",
"given",
"time"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/CronSchedule.java#L97-L100 | train | Gets the CronSchedule for a monthly on day. | [
30522,
2270,
10763,
13675,
5644,
7690,
9307,
7058,
29067,
7054,
16425,
8162,
5685,
10020,
10421,
1006,
20014,
2154,
11253,
9629,
2232,
1010,
20014,
3178,
1010,
20014,
3371,
1007,
1063,
5164,
3670,
1027,
5164,
1012,
4289,
1006,
1000,
1014,
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/net/SSLUtils.java | SSLUtils.createSSLClientSocketFactory | public static SocketFactory createSSLClientSocketFactory(Configuration config) throws Exception {
SSLContext sslContext = createInternalSSLContext(config);
if (sslContext == null) {
throw new IllegalConfigurationException("SSL is not enabled");
}
return sslContext.getSocketFactory();
} | java | public static SocketFactory createSSLClientSocketFactory(Configuration config) throws Exception {
SSLContext sslContext = createInternalSSLContext(config);
if (sslContext == null) {
throw new IllegalConfigurationException("SSL is not enabled");
}
return sslContext.getSocketFactory();
} | [
"public",
"static",
"SocketFactory",
"createSSLClientSocketFactory",
"(",
"Configuration",
"config",
")",
"throws",
"Exception",
"{",
"SSLContext",
"sslContext",
"=",
"createInternalSSLContext",
"(",
"config",
")",
";",
"if",
"(",
"sslContext",
"==",
"null",
")",
"{... | Creates a factory for SSL Client Sockets from the given configuration.
SSL Client Sockets are always part of internal communication. | [
"Creates",
"a",
"factory",
"for",
"SSL",
"Client",
"Sockets",
"from",
"the",
"given",
"configuration",
".",
"SSL",
"Client",
"Sockets",
"are",
"always",
"part",
"of",
"internal",
"communication",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java#L101-L108 | train | Creates a SocketFactory for SSL client. | [
30522,
2270,
10763,
22278,
21450,
9005,
14540,
20464,
11638,
6499,
19869,
24475,
18908,
10253,
1006,
9563,
9530,
8873,
2290,
1007,
11618,
6453,
1063,
7020,
22499,
10111,
18413,
7020,
22499,
10111,
18413,
1027,
3443,
18447,
11795,
9777,
14540,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/algorithm/Viterbi.java | Viterbi.computeEnum | public static <E extends Enum<E>> List<E> computeEnum(List<EnumItem<E>> roleTagList, TransformMatrixDictionary<E> transformMatrixDictionary)
{
int length = roleTagList.size() - 1;
List<E> tagList = new ArrayList<E>(roleTagList.size());
double[][] cost = new double[2][]; // 滚动数组
Iterator<EnumItem<E>> iterator = roleTagList.iterator();
EnumItem<E> start = iterator.next();
E pre = start.labelMap.entrySet().iterator().next().getKey();
// 第一个是确定的
tagList.add(pre);
// 第二个也可以简单地算出来
Set<E> preTagSet;
{
EnumItem<E> item = iterator.next();
cost[0] = new double[item.labelMap.size()];
int j = 0;
for (E cur : item.labelMap.keySet())
{
cost[0][j] = transformMatrixDictionary.transititon_probability[pre.ordinal()][cur.ordinal()] - Math.log((item.getFrequency(cur) + 1e-8) / transformMatrixDictionary.getTotalFrequency(cur));
++j;
}
preTagSet = item.labelMap.keySet();
}
// 第三个开始复杂一些
for (int i = 1; i < length; ++i)
{
int index_i = i & 1;
int index_i_1 = 1 - index_i;
EnumItem<E> item = iterator.next();
cost[index_i] = new double[item.labelMap.size()];
double perfect_cost_line = Double.MAX_VALUE;
int k = 0;
Set<E> curTagSet = item.labelMap.keySet();
for (E cur : curTagSet)
{
cost[index_i][k] = Double.MAX_VALUE;
int j = 0;
for (E p : preTagSet)
{
double now = cost[index_i_1][j] + transformMatrixDictionary.transititon_probability[p.ordinal()][cur.ordinal()] - Math.log((item.getFrequency(cur) + 1e-8) / transformMatrixDictionary.getTotalFrequency(cur));
if (now < cost[index_i][k])
{
cost[index_i][k] = now;
if (now < perfect_cost_line)
{
perfect_cost_line = now;
pre = p;
}
}
++j;
}
++k;
}
tagList.add(pre);
preTagSet = curTagSet;
}
tagList.add(tagList.get(0)); // 对于最后一个##末##
return tagList;
} | java | public static <E extends Enum<E>> List<E> computeEnum(List<EnumItem<E>> roleTagList, TransformMatrixDictionary<E> transformMatrixDictionary)
{
int length = roleTagList.size() - 1;
List<E> tagList = new ArrayList<E>(roleTagList.size());
double[][] cost = new double[2][]; // 滚动数组
Iterator<EnumItem<E>> iterator = roleTagList.iterator();
EnumItem<E> start = iterator.next();
E pre = start.labelMap.entrySet().iterator().next().getKey();
// 第一个是确定的
tagList.add(pre);
// 第二个也可以简单地算出来
Set<E> preTagSet;
{
EnumItem<E> item = iterator.next();
cost[0] = new double[item.labelMap.size()];
int j = 0;
for (E cur : item.labelMap.keySet())
{
cost[0][j] = transformMatrixDictionary.transititon_probability[pre.ordinal()][cur.ordinal()] - Math.log((item.getFrequency(cur) + 1e-8) / transformMatrixDictionary.getTotalFrequency(cur));
++j;
}
preTagSet = item.labelMap.keySet();
}
// 第三个开始复杂一些
for (int i = 1; i < length; ++i)
{
int index_i = i & 1;
int index_i_1 = 1 - index_i;
EnumItem<E> item = iterator.next();
cost[index_i] = new double[item.labelMap.size()];
double perfect_cost_line = Double.MAX_VALUE;
int k = 0;
Set<E> curTagSet = item.labelMap.keySet();
for (E cur : curTagSet)
{
cost[index_i][k] = Double.MAX_VALUE;
int j = 0;
for (E p : preTagSet)
{
double now = cost[index_i_1][j] + transformMatrixDictionary.transititon_probability[p.ordinal()][cur.ordinal()] - Math.log((item.getFrequency(cur) + 1e-8) / transformMatrixDictionary.getTotalFrequency(cur));
if (now < cost[index_i][k])
{
cost[index_i][k] = now;
if (now < perfect_cost_line)
{
perfect_cost_line = now;
pre = p;
}
}
++j;
}
++k;
}
tagList.add(pre);
preTagSet = curTagSet;
}
tagList.add(tagList.get(0)); // 对于最后一个##末##
return tagList;
} | [
"public",
"static",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"List",
"<",
"E",
">",
"computeEnum",
"(",
"List",
"<",
"EnumItem",
"<",
"E",
">",
">",
"roleTagList",
",",
"TransformMatrixDictionary",
"<",
"E",
">",
"transformMatrixDictionary",
")",
... | 标准版的Viterbi算法,查准率高,效率稍低
@param roleTagList 观测序列
@param transformMatrixDictionary 转移矩阵
@param <E> EnumItem的具体类型
@return 预测结果 | [
"标准版的Viterbi算法,查准率高,效率稍低"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/Viterbi.java#L175-L233 | train | Compute the enumeration of the class. | [
30522,
2270,
10763,
1026,
1041,
8908,
4372,
2819,
1026,
1041,
1028,
1028,
2862,
1026,
1041,
1028,
24134,
2368,
2819,
1006,
2862,
1026,
4372,
12717,
18532,
1026,
1041,
1028,
1028,
2535,
15900,
9863,
1010,
10938,
18900,
17682,
29201,
3258,
56... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.randomDouble | public static double randomDouble(int scale, RoundingMode roundingMode) {
return NumberUtil.round(randomDouble(), scale, roundingMode).doubleValue();
} | java | public static double randomDouble(int scale, RoundingMode roundingMode) {
return NumberUtil.round(randomDouble(), scale, roundingMode).doubleValue();
} | [
"public",
"static",
"double",
"randomDouble",
"(",
"int",
"scale",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"NumberUtil",
".",
"round",
"(",
"randomDouble",
"(",
")",
",",
"scale",
",",
"roundingMode",
")",
".",
"doubleValue",
"(",
")",
";",
... | 获得指定范围内的随机数
@param scale 保留小数位数
@param roundingMode 保留小数的模式 {@link RoundingMode}
@return 随机数
@since 4.0.8 | [
"获得指定范围内的随机数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java#L182-L184 | train | Returns a random double with the specified scale and roundingMode rounded to the specified scale. | [
30522,
2270,
10763,
3313,
6721,
26797,
3468,
1006,
20014,
4094,
1010,
26939,
5302,
3207,
26939,
5302,
3207,
1007,
1063,
2709,
2193,
21823,
2140,
1012,
2461,
1006,
6721,
26797,
3468,
1006,
1007,
1010,
4094,
1010,
26939,
5302,
3207,
1007,
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/lang/SimpleCache.java | SimpleCache.get | public V get(K key) {
// 尝试读取缓存
readLock.lock();
V value;
try {
value = cache.get(key);
} finally {
readLock.unlock();
}
return value;
} | java | public V get(K key) {
// 尝试读取缓存
readLock.lock();
V value;
try {
value = cache.get(key);
} finally {
readLock.unlock();
}
return value;
} | [
"public",
"V",
"get",
"(",
"K",
"key",
")",
"{",
"// 尝试读取缓存\r",
"readLock",
".",
"lock",
"(",
")",
";",
"V",
"value",
";",
"try",
"{",
"value",
"=",
"cache",
".",
"get",
"(",
"key",
")",
";",
"}",
"finally",
"{",
"readLock",
".",
"unlock",
"(",
... | 从缓存池中查找值
@param key 键
@return 值 | [
"从缓存池中查找值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/SimpleCache.java#L30-L40 | train | Gets the value associated with the specified key from the cache. | [
30522,
2270,
1058,
2131,
1006,
1047,
3145,
1007,
1063,
1013,
1013,
100,
100,
100,
100,
100,
100,
3191,
7878,
1012,
5843,
1006,
1007,
1025,
1058,
3643,
1025,
3046,
1063,
3643,
1027,
17053,
1012,
2131,
1006,
3145,
1007,
1025,
1065,
2633,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.copyImage | public static BufferedImage copyImage(Image img, int imageType) {
final BufferedImage bimage = new BufferedImage(img.getWidth(null), img.getHeight(null), imageType);
final Graphics2D bGr = bimage.createGraphics();
bGr.drawImage(img, 0, 0, null);
bGr.dispose();
return bimage;
} | java | public static BufferedImage copyImage(Image img, int imageType) {
final BufferedImage bimage = new BufferedImage(img.getWidth(null), img.getHeight(null), imageType);
final Graphics2D bGr = bimage.createGraphics();
bGr.drawImage(img, 0, 0, null);
bGr.dispose();
return bimage;
} | [
"public",
"static",
"BufferedImage",
"copyImage",
"(",
"Image",
"img",
",",
"int",
"imageType",
")",
"{",
"final",
"BufferedImage",
"bimage",
"=",
"new",
"BufferedImage",
"(",
"img",
".",
"getWidth",
"(",
"null",
")",
",",
"img",
".",
"getHeight",
"(",
"nu... | 将已有Image复制新的一份出来
@param img {@link Image}
@param imageType {@link BufferedImage}中的常量,图像类型,例如黑白等
@return {@link BufferedImage}
@see BufferedImage#TYPE_INT_RGB
@see BufferedImage#TYPE_INT_ARGB
@see BufferedImage#TYPE_INT_ARGB_PRE
@see BufferedImage#TYPE_INT_BGR
@see BufferedImage#TYPE_3BYTE_BGR
@see BufferedImage#TYPE_4BYTE_ABGR
@see BufferedImage#TYPE_4BYTE_ABGR_PRE
@see BufferedImage#TYPE_BYTE_GRAY
@see BufferedImage#TYPE_USHORT_GRAY
@see BufferedImage#TYPE_BYTE_BINARY
@see BufferedImage#TYPE_BYTE_INDEXED
@see BufferedImage#TYPE_USHORT_565_RGB
@see BufferedImage#TYPE_USHORT_555_RGB | [
"将已有Image复制新的一份出来"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1213-L1220 | train | Copy an image to a new BufferedImage. | [
30522,
2270,
10763,
17698,
2098,
9581,
3351,
6100,
9581,
3351,
1006,
3746,
10047,
2290,
1010,
20014,
3746,
13874,
1007,
1063,
2345,
17698,
2098,
9581,
3351,
12170,
26860,
1027,
2047,
17698,
2098,
9581,
3351,
1006,
10047,
2290,
1012,
2131,
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... |
networknt/light-4j | metrics/src/main/java/io/dropwizard/metrics/MetricName.java | MetricName.tagged | public MetricName tagged(String... pairs) {
if (pairs == null) {
return this;
}
if (pairs.length % 2 != 0) {
throw new IllegalArgumentException("Argument count must be even");
}
final Map<String, String> add = new HashMap<>();
for (int i = 0; i < pairs.length; i += 2) {
add.put(pairs[i], pairs[i+1]);
}
return tagged(add);
} | java | public MetricName tagged(String... pairs) {
if (pairs == null) {
return this;
}
if (pairs.length % 2 != 0) {
throw new IllegalArgumentException("Argument count must be even");
}
final Map<String, String> add = new HashMap<>();
for (int i = 0; i < pairs.length; i += 2) {
add.put(pairs[i], pairs[i+1]);
}
return tagged(add);
} | [
"public",
"MetricName",
"tagged",
"(",
"String",
"...",
"pairs",
")",
"{",
"if",
"(",
"pairs",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"if",
"(",
"pairs",
".",
"length",
"%",
"2",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentExcep... | Same as {@link #tagged(Map)}, but takes a variadic list
of arguments.
@see #tagged(Map)
@param pairs An even list of strings acting as key-value pairs.
@return A newly created metric name with the specified tags associated
with it. | [
"Same",
"as",
"{",
"@link",
"#tagged",
"(",
"Map",
")",
"}",
"but",
"takes",
"a",
"variadic",
"list",
"of",
"arguments",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/MetricName.java#L119-L135 | train | Get a tagged name with the specified tag pairs. | [
30522,
2270,
12046,
18442,
26610,
1006,
5164,
1012,
1012,
1012,
7689,
1007,
1063,
2065,
1006,
7689,
1027,
1027,
19701,
1007,
1063,
2709,
2023,
1025,
1065,
2065,
1006,
7689,
1012,
3091,
1003,
1016,
999,
1027,
1014,
1007,
1063,
5466,
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-setting/src/main/java/cn/hutool/setting/GroupedMap.java | GroupedMap.containsValue | public boolean containsValue(String group, String value) {
group = StrUtil.nullToEmpty(group).trim();
readLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
return valueMap.containsValue(value);
}
} finally {
readLock.unlock();
}
return false;
} | java | public boolean containsValue(String group, String value) {
group = StrUtil.nullToEmpty(group).trim();
readLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
return valueMap.containsValue(value);
}
} finally {
readLock.unlock();
}
return false;
} | [
"public",
"boolean",
"containsValue",
"(",
"String",
"group",
",",
"String",
"value",
")",
"{",
"group",
"=",
"StrUtil",
".",
"nullToEmpty",
"(",
"group",
")",
".",
"trim",
"(",
")",
";",
"readLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"final",
"... | 指定分组中是否包含指定值
@param group 分组
@param value 值
@return 是否包含值 | [
"指定分组中是否包含指定值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/GroupedMap.java#L198-L210 | train | Checks if the specified group contains the specified value. | [
30522,
2270,
22017,
20898,
3397,
10175,
5657,
1006,
5164,
2177,
1010,
5164,
3643,
1007,
1063,
2177,
1027,
2358,
22134,
4014,
1012,
19701,
3406,
6633,
13876,
2100,
1006,
2177,
1007,
1012,
12241,
1006,
1007,
1025,
3191,
7878,
1012,
5843,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.isNumber | public static boolean isNumber(String str) {
if (StrUtil.isBlank(str)) {
return false;
}
char[] chars = str.toCharArray();
int sz = chars.length;
boolean hasExp = false;
boolean hasDecPoint = false;
boolean allowSigns = false;
boolean foundDigit = false;
// deal with any possible sign up front
int start = (chars[0] == '-') ? 1 : 0;
if (sz > start + 1) {
if (chars[start] == '0' && chars[start + 1] == 'x') {
int i = start + 2;
if (i == sz) {
return false; // str == "0x"
}
// checking hex (it can't be anything else)
for (; i < chars.length; i++) {
if ((chars[i] < '0' || chars[i] > '9') && (chars[i] < 'a' || chars[i] > 'f') && (chars[i] < 'A' || chars[i] > 'F')) {
return false;
}
}
return true;
}
}
sz--; // don't want to loop to the last char, check it afterwords
// for type qualifiers
int i = start;
// loop to the next to last char or to the last char if we need another digit to
// make a valid number (e.g. chars[0..5] = "1234E")
while (i < sz || (i < sz + 1 && allowSigns && !foundDigit)) {
if (chars[i] >= '0' && chars[i] <= '9') {
foundDigit = true;
allowSigns = false;
} else if (chars[i] == '.') {
if (hasDecPoint || hasExp) {
// two decimal points or dec in exponent
return false;
}
hasDecPoint = true;
} else if (chars[i] == 'e' || chars[i] == 'E') {
// we've already taken care of hex.
if (hasExp) {
// two E's
return false;
}
if (!foundDigit) {
return false;
}
hasExp = true;
allowSigns = true;
} else if (chars[i] == '+' || chars[i] == '-') {
if (!allowSigns) {
return false;
}
allowSigns = false;
foundDigit = false; // we need a digit after the E
} else {
return false;
}
i++;
}
if (i < chars.length) {
if (chars[i] >= '0' && chars[i] <= '9') {
// no type qualifier, OK
return true;
}
if (chars[i] == 'e' || chars[i] == 'E') {
// can't have an E at the last byte
return false;
}
if (chars[i] == '.') {
if (hasDecPoint || hasExp) {
// two decimal points or dec in exponent
return false;
}
// single trailing decimal point after non-exponent is ok
return foundDigit;
}
if (!allowSigns && (chars[i] == 'd' || chars[i] == 'D' || chars[i] == 'f' || chars[i] == 'F')) {
return foundDigit;
}
if (chars[i] == 'l' || chars[i] == 'L') {
// not allowing L with an exponent
return foundDigit && !hasExp;
}
// last character is illegal
return false;
}
// allowSigns is true iff the val ends in 'E'
// found digit it to make sure weird stuff like '.' and '1E-' doesn't pass
return !allowSigns && foundDigit;
} | java | public static boolean isNumber(String str) {
if (StrUtil.isBlank(str)) {
return false;
}
char[] chars = str.toCharArray();
int sz = chars.length;
boolean hasExp = false;
boolean hasDecPoint = false;
boolean allowSigns = false;
boolean foundDigit = false;
// deal with any possible sign up front
int start = (chars[0] == '-') ? 1 : 0;
if (sz > start + 1) {
if (chars[start] == '0' && chars[start + 1] == 'x') {
int i = start + 2;
if (i == sz) {
return false; // str == "0x"
}
// checking hex (it can't be anything else)
for (; i < chars.length; i++) {
if ((chars[i] < '0' || chars[i] > '9') && (chars[i] < 'a' || chars[i] > 'f') && (chars[i] < 'A' || chars[i] > 'F')) {
return false;
}
}
return true;
}
}
sz--; // don't want to loop to the last char, check it afterwords
// for type qualifiers
int i = start;
// loop to the next to last char or to the last char if we need another digit to
// make a valid number (e.g. chars[0..5] = "1234E")
while (i < sz || (i < sz + 1 && allowSigns && !foundDigit)) {
if (chars[i] >= '0' && chars[i] <= '9') {
foundDigit = true;
allowSigns = false;
} else if (chars[i] == '.') {
if (hasDecPoint || hasExp) {
// two decimal points or dec in exponent
return false;
}
hasDecPoint = true;
} else if (chars[i] == 'e' || chars[i] == 'E') {
// we've already taken care of hex.
if (hasExp) {
// two E's
return false;
}
if (!foundDigit) {
return false;
}
hasExp = true;
allowSigns = true;
} else if (chars[i] == '+' || chars[i] == '-') {
if (!allowSigns) {
return false;
}
allowSigns = false;
foundDigit = false; // we need a digit after the E
} else {
return false;
}
i++;
}
if (i < chars.length) {
if (chars[i] >= '0' && chars[i] <= '9') {
// no type qualifier, OK
return true;
}
if (chars[i] == 'e' || chars[i] == 'E') {
// can't have an E at the last byte
return false;
}
if (chars[i] == '.') {
if (hasDecPoint || hasExp) {
// two decimal points or dec in exponent
return false;
}
// single trailing decimal point after non-exponent is ok
return foundDigit;
}
if (!allowSigns && (chars[i] == 'd' || chars[i] == 'D' || chars[i] == 'f' || chars[i] == 'F')) {
return foundDigit;
}
if (chars[i] == 'l' || chars[i] == 'L') {
// not allowing L with an exponent
return foundDigit && !hasExp;
}
// last character is illegal
return false;
}
// allowSigns is true iff the val ends in 'E'
// found digit it to make sure weird stuff like '.' and '1E-' doesn't pass
return !allowSigns && foundDigit;
} | [
"public",
"static",
"boolean",
"isNumber",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"str",
")",
")",
"{",
"return",
"false",
";",
"}",
"char",
"[",
"]",
"chars",
"=",
"str",
".",
"toCharArray",
"(",
")",
";",
"int"... | 是否为数字
@param str 字符串值
@return 是否为数字 | [
"是否为数字"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L1051-L1146 | train | Checks if the given string is a number. | [
30522,
2270,
10763,
22017,
20898,
3475,
29440,
1006,
5164,
2358,
2099,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
2358,
2099,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
25869,
1031,
1033,
25869,
2015,
1027,
235... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-socket/src/main/java/cn/hutool/socket/aio/AioServer.java | AioServer.setOption | public <T> AioServer setOption(SocketOption<T> name, T value) throws IOException {
this.channel.setOption(name, value);
return this;
} | java | public <T> AioServer setOption(SocketOption<T> name, T value) throws IOException {
this.channel.setOption(name, value);
return this;
} | [
"public",
"<",
"T",
">",
"AioServer",
"setOption",
"(",
"SocketOption",
"<",
"T",
">",
"name",
",",
"T",
"value",
")",
"throws",
"IOException",
"{",
"this",
".",
"channel",
".",
"setOption",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
... | 设置 Socket 的 Option 选项<br>
选项见:{@link java.net.StandardSocketOptions}
@param <T> 选项泛型
@param name {@link SocketOption} 枚举
@param value SocketOption参数
@throws IOException IO异常 | [
"设置",
"Socket",
"的",
"Option",
"选项<br",
">",
"选项见:",
"{",
"@link",
"java",
".",
"net",
".",
"StandardSocketOptions",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-socket/src/main/java/cn/hutool/socket/aio/AioServer.java#L95-L98 | train | Sets a socket option. | [
30522,
2270,
1026,
1056,
1028,
9932,
9232,
2099,
6299,
2275,
7361,
3508,
1006,
22278,
7361,
3508,
1026,
1056,
1028,
2171,
1010,
1056,
3643,
1007,
11618,
22834,
10288,
24422,
1063,
2023,
1012,
3149,
1012,
2275,
7361,
3508,
1006,
2171,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java | BeetlUtil.renderFromStr | public static Writer renderFromStr(String templateContent, Map<String, Object> bindingMap, Writer writer) {
return render(getStrTemplate(templateContent), bindingMap, writer);
} | java | public static Writer renderFromStr(String templateContent, Map<String, Object> bindingMap, Writer writer) {
return render(getStrTemplate(templateContent), bindingMap, writer);
} | [
"public",
"static",
"Writer",
"renderFromStr",
"(",
"String",
"templateContent",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"bindingMap",
",",
"Writer",
"writer",
")",
"{",
"return",
"render",
"(",
"getStrTemplate",
"(",
"templateContent",
")",
",",
"bindi... | 渲染模板
@param templateContent 模板内容
@param bindingMap 绑定参数
@param writer {@link Writer} 渲染后写入的目标Writer
@return {@link Writer} | [
"渲染模板"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java#L237-L239 | train | Renders a string template into a Writer. | [
30522,
2270,
10763,
3213,
17552,
19699,
22225,
16344,
1006,
5164,
23561,
8663,
6528,
2102,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
8031,
2863,
2361,
1010,
3213,
3213,
1007,
1063,
2709,
17552,
1006,
4152,
16344,
18532,
15725,
1006,
23561,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java | Task.releaseNetworkResources | private void releaseNetworkResources() {
LOG.debug("Release task {} network resources (state: {}).", taskNameWithSubtask, getExecutionState());
for (ResultPartition partition : producedPartitions) {
taskEventDispatcher.unregisterPartition(partition.getPartitionId());
if (isCanceledOrFailed()) {
partition.fail(getFailureCause());
}
}
closeNetworkResources();
} | java | private void releaseNetworkResources() {
LOG.debug("Release task {} network resources (state: {}).", taskNameWithSubtask, getExecutionState());
for (ResultPartition partition : producedPartitions) {
taskEventDispatcher.unregisterPartition(partition.getPartitionId());
if (isCanceledOrFailed()) {
partition.fail(getFailureCause());
}
}
closeNetworkResources();
} | [
"private",
"void",
"releaseNetworkResources",
"(",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Release task {} network resources (state: {}).\"",
",",
"taskNameWithSubtask",
",",
"getExecutionState",
"(",
")",
")",
";",
"for",
"(",
"ResultPartition",
"partition",
":",
"pro... | Releases network resources before task exits. We should also fail the partition to release if the task
has failed, is canceled, or is being canceled at the moment. | [
"Releases",
"network",
"resources",
"before",
"task",
"exits",
".",
"We",
"should",
"also",
"fail",
"the",
"partition",
"to",
"release",
"if",
"the",
"task",
"has",
"failed",
"is",
"canceled",
"or",
"is",
"being",
"canceled",
"at",
"the",
"moment",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java#L881-L892 | train | Release the network resources associated with this task. | [
30522,
2797,
11675,
2713,
7159,
6198,
6072,
8162,
9623,
1006,
1007,
1063,
8833,
1012,
2139,
8569,
2290,
1006,
1000,
2713,
4708,
1063,
1065,
2897,
4219,
1006,
2110,
1024,
1063,
1065,
1007,
1012,
1000,
1010,
4708,
18442,
24415,
6342,
19279,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.from_collection | public PythonDataStream from_collection(Iterator<Object> iter) throws Exception {
return new PythonDataStream<>(env.addSource(new PythonIteratorFunction(iter), TypeExtractor.getForClass(Object.class))
.map(new AdapterMap<>()));
} | java | public PythonDataStream from_collection(Iterator<Object> iter) throws Exception {
return new PythonDataStream<>(env.addSource(new PythonIteratorFunction(iter), TypeExtractor.getForClass(Object.class))
.map(new AdapterMap<>()));
} | [
"public",
"PythonDataStream",
"from_collection",
"(",
"Iterator",
"<",
"Object",
">",
"iter",
")",
"throws",
"Exception",
"{",
"return",
"new",
"PythonDataStream",
"<>",
"(",
"env",
".",
"addSource",
"(",
"new",
"PythonIteratorFunction",
"(",
"iter",
")",
",",
... | Creates a python data stream from the given iterator.
<p>Note that this operation will result in a non-parallel data stream source, i.e.,
a data stream source with a parallelism of one.</p>
@param iter The iterator of elements to create the data stream from
@return The data stream representing the elements in the iterator
@see StreamExecutionEnvironment#fromCollection(java.util.Iterator, org.apache.flink.api.common.typeinfo.TypeInformation) | [
"Creates",
"a",
"python",
"data",
"stream",
"from",
"the",
"given",
"iterator",
"."
] | 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#L164-L167 | train | Creates a PythonDataStream from an iterator. | [
30522,
2270,
18750,
2850,
10230,
25379,
2013,
1035,
3074,
1006,
2009,
6906,
4263,
1026,
4874,
1028,
2009,
2121,
1007,
11618,
6453,
1063,
2709,
2047,
18750,
2850,
10230,
25379,
1026,
1028,
1006,
4372,
2615,
1012,
9909,
8162,
3401,
1006,
2047... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/crypto/TransportCipher.java | TransportCipher.addToChannel | public void addToChannel(Channel ch) throws IOException {
ch.pipeline()
.addFirst(ENCRYPTION_HANDLER_NAME, new EncryptionHandler(this))
.addFirst(DECRYPTION_HANDLER_NAME, new DecryptionHandler(this));
} | java | public void addToChannel(Channel ch) throws IOException {
ch.pipeline()
.addFirst(ENCRYPTION_HANDLER_NAME, new EncryptionHandler(this))
.addFirst(DECRYPTION_HANDLER_NAME, new DecryptionHandler(this));
} | [
"public",
"void",
"addToChannel",
"(",
"Channel",
"ch",
")",
"throws",
"IOException",
"{",
"ch",
".",
"pipeline",
"(",
")",
".",
"addFirst",
"(",
"ENCRYPTION_HANDLER_NAME",
",",
"new",
"EncryptionHandler",
"(",
"this",
")",
")",
".",
"addFirst",
"(",
"DECRYP... | Add handlers to channel.
@param ch the channel for adding handlers
@throws IOException | [
"Add",
"handlers",
"to",
"channel",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/crypto/TransportCipher.java#L103-L107 | train | Add this encryption handler to the channel. | [
30522,
2270,
11675,
5587,
3406,
26058,
1006,
3149,
10381,
1007,
11618,
22834,
10288,
24422,
1063,
10381,
1012,
13117,
1006,
1007,
1012,
5587,
8873,
12096,
1006,
21999,
1035,
28213,
1035,
2171,
1010,
2047,
21999,
11774,
3917,
1006,
2023,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.writeXml | public void writeXml(String propertyName, Writer out)
throws IOException, IllegalArgumentException {
Document doc = asXmlDocument(propertyName);
try {
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(out);
TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer = transFactory.newTransformer();
// Important to not hold Configuration log while writing result, since
// 'out' may be an HDFS stream which needs to lock this configuration
// from another thread.
transformer.transform(source, result);
} catch (TransformerException te) {
throw new IOException(te);
}
} | java | public void writeXml(String propertyName, Writer out)
throws IOException, IllegalArgumentException {
Document doc = asXmlDocument(propertyName);
try {
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(out);
TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer = transFactory.newTransformer();
// Important to not hold Configuration log while writing result, since
// 'out' may be an HDFS stream which needs to lock this configuration
// from another thread.
transformer.transform(source, result);
} catch (TransformerException te) {
throw new IOException(te);
}
} | [
"public",
"void",
"writeXml",
"(",
"String",
"propertyName",
",",
"Writer",
"out",
")",
"throws",
"IOException",
",",
"IllegalArgumentException",
"{",
"Document",
"doc",
"=",
"asXmlDocument",
"(",
"propertyName",
")",
";",
"try",
"{",
"DOMSource",
"source",
"=",... | Write out the non-default properties in this configuration to the
given {@link Writer}.
<li>
When property name is not empty and the property exists in the
configuration, this method writes the property and its attributes
to the {@link Writer}.
</li>
<p>
<li>
When property name is null or empty, this method writes all the
configuration properties and their attributes to the {@link Writer}.
</li>
<p>
<li>
When property name is not empty but the property doesn't exist in
the configuration, this method throws an {@link IllegalArgumentException}.
</li>
<p>
@param out the writer to write to. | [
"Write",
"out",
"the",
"non",
"-",
"default",
"properties",
"in",
"this",
"configuration",
"to",
"the",
"given",
"{",
"@link",
"Writer",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L3124-L3141 | train | Write XML to a writer. | [
30522,
2270,
11675,
4339,
2595,
19968,
1006,
5164,
3200,
18442,
1010,
3213,
2041,
1007,
11618,
22834,
10288,
24422,
1010,
6206,
2906,
22850,
15781,
2595,
24422,
1063,
6254,
9986,
1027,
2004,
2595,
19968,
3527,
24894,
4765,
1006,
3200,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/writer/RecordWriter.java | RecordWriter.getBufferBuilder | private BufferBuilder getBufferBuilder(int targetChannel) throws IOException, InterruptedException {
if (bufferBuilders[targetChannel].isPresent()) {
return bufferBuilders[targetChannel].get();
} else {
return requestNewBufferBuilder(targetChannel);
}
} | java | private BufferBuilder getBufferBuilder(int targetChannel) throws IOException, InterruptedException {
if (bufferBuilders[targetChannel].isPresent()) {
return bufferBuilders[targetChannel].get();
} else {
return requestNewBufferBuilder(targetChannel);
}
} | [
"private",
"BufferBuilder",
"getBufferBuilder",
"(",
"int",
"targetChannel",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"bufferBuilders",
"[",
"targetChannel",
"]",
".",
"isPresent",
"(",
")",
")",
"{",
"return",
"bufferBuilders",
"... | The {@link BufferBuilder} may already exist if not filled up last time, otherwise we need
request a new one for this target channel. | [
"The",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/writer/RecordWriter.java#L245-L251 | train | Get the buffer builder for the given channel. | [
30522,
2797,
17698,
8569,
23891,
2099,
2131,
8569,
12494,
8569,
23891,
2099,
1006,
20014,
4539,
26058,
1007,
11618,
22834,
10288,
24422,
1010,
7153,
10288,
24422,
1063,
2065,
1006,
17698,
8569,
23891,
2869,
1031,
4539,
26058,
1033,
1012,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readLines | public static <T extends Collection<String>> T readLines(File file, String charset, T collection) throws IORuntimeException {
return FileReader.create(file, CharsetUtil.charset(charset)).readLines(collection);
} | java | public static <T extends Collection<String>> T readLines(File file, String charset, T collection) throws IORuntimeException {
return FileReader.create(file, CharsetUtil.charset(charset)).readLines(collection);
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"String",
">",
">",
"T",
"readLines",
"(",
"File",
"file",
",",
"String",
"charset",
",",
"T",
"collection",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileReader",
".",
"create",
"(",
"... | 从文件中读取每一行数据
@param <T> 集合类型
@param file 文件路径
@param charset 字符集
@param collection 集合
@return 文件中的每行内容的集合
@throws IORuntimeException IO异常 | [
"从文件中读取每一行数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2220-L2222 | train | Reads the contents of the file into the collection. | [
30522,
2270,
10763,
1026,
1056,
8908,
3074,
1026,
5164,
1028,
1028,
1056,
3191,
12735,
1006,
5371,
5371,
1010,
5164,
25869,
13462,
1010,
1056,
3074,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
5371,
16416,
4063,
1012,
3443,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java | StateDescriptor.initializeSerializerUnlessSet | public void initializeSerializerUnlessSet(ExecutionConfig executionConfig) {
if (serializer == null) {
checkState(typeInfo != null, "no serializer and no type info");
// instantiate the serializer
serializer = typeInfo.createSerializer(executionConfig);
// we can drop the type info now, no longer needed
typeInfo = null;
}
} | java | public void initializeSerializerUnlessSet(ExecutionConfig executionConfig) {
if (serializer == null) {
checkState(typeInfo != null, "no serializer and no type info");
// instantiate the serializer
serializer = typeInfo.createSerializer(executionConfig);
// we can drop the type info now, no longer needed
typeInfo = null;
}
} | [
"public",
"void",
"initializeSerializerUnlessSet",
"(",
"ExecutionConfig",
"executionConfig",
")",
"{",
"if",
"(",
"serializer",
"==",
"null",
")",
"{",
"checkState",
"(",
"typeInfo",
"!=",
"null",
",",
"\"no serializer and no type info\"",
")",
";",
"// instantiate t... | Initializes the serializer, unless it has been initialized before.
@param executionConfig The execution config to use when creating the serializer. | [
"Initializes",
"the",
"serializer",
"unless",
"it",
"has",
"been",
"initialized",
"before",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java#L283-L293 | train | Initialize the serializer if it is not set. | [
30522,
2270,
11675,
3988,
10057,
11610,
28863,
4609,
3238,
13462,
1006,
7781,
8663,
8873,
2290,
7781,
8663,
8873,
2290,
1007,
1063,
2065,
1006,
7642,
17629,
1027,
1027,
19701,
1007,
1063,
14148,
12259,
1006,
2828,
2378,
14876,
999,
1027,
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... |
networknt/light-4j | http-url/src/main/java/com/networknt/url/URLNormalizer.java | URLNormalizer.removeWWW | public URLNormalizer removeWWW() {
String host = toURL().getHost();
String newHost = StringUtils.removeStartIgnoreCase(host, "www.");
url = StringUtils.replaceOnce(url, host, newHost);
return this;
} | java | public URLNormalizer removeWWW() {
String host = toURL().getHost();
String newHost = StringUtils.removeStartIgnoreCase(host, "www.");
url = StringUtils.replaceOnce(url, host, newHost);
return this;
} | [
"public",
"URLNormalizer",
"removeWWW",
"(",
")",
"{",
"String",
"host",
"=",
"toURL",
"(",
")",
".",
"getHost",
"(",
")",
";",
"String",
"newHost",
"=",
"StringUtils",
".",
"removeStartIgnoreCase",
"(",
"host",
",",
"\"www.\"",
")",
";",
"url",
"=",
"St... | <p>Removes "www." domain name prefix.</p>
<code>http://www.example.com/ → http://example.com/</code>
@return this instance | [
"<p",
">",
"Removes",
"www",
".",
"domain",
"name",
"prefix",
".",
"<",
"/",
"p",
">",
"<code",
">",
"http",
":",
"//",
"www",
".",
"example",
".",
"com",
"/",
"&rarr",
";",
"http",
":",
"//",
"example",
".",
"com",
"/",
"<",
"/",
"code",
">"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/URLNormalizer.java#L635-L640 | train | Remove www. from the URL. | [
30522,
2270,
24471,
19666,
2953,
9067,
17629,
6366,
2860,
2860,
2860,
30524,
21823,
4877,
1012,
20362,
7559,
3775,
26745,
2890,
18382,
1006,
3677,
1010,
1000,
7479,
1012,
1000,
1007,
1025,
24471,
2140,
1027,
5164,
21823,
4877,
1012,
5672,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/math/Combination.java | Combination.select | private void select(int dataIndex, String[] resultList, int resultIndex, List<String[]> result) {
int resultLen = resultList.length;
int resultCount = resultIndex + 1;
if (resultCount > resultLen) { // 全部选择完时,输出组合结果
result.add(Arrays.copyOf(resultList, resultList.length));
return;
}
// 递归选择下一个
for (int i = dataIndex; i < datas.length + resultCount - resultLen; i++) {
resultList[resultIndex] = datas[i];
select(i + 1, resultList, resultIndex + 1, result);
}
} | java | private void select(int dataIndex, String[] resultList, int resultIndex, List<String[]> result) {
int resultLen = resultList.length;
int resultCount = resultIndex + 1;
if (resultCount > resultLen) { // 全部选择完时,输出组合结果
result.add(Arrays.copyOf(resultList, resultList.length));
return;
}
// 递归选择下一个
for (int i = dataIndex; i < datas.length + resultCount - resultLen; i++) {
resultList[resultIndex] = datas[i];
select(i + 1, resultList, resultIndex + 1, result);
}
} | [
"private",
"void",
"select",
"(",
"int",
"dataIndex",
",",
"String",
"[",
"]",
"resultList",
",",
"int",
"resultIndex",
",",
"List",
"<",
"String",
"[",
"]",
">",
"result",
")",
"{",
"int",
"resultLen",
"=",
"resultList",
".",
"length",
";",
"int",
"re... | 组合选择
@param dataList 待选列表
@param dataIndex 待选开始索引
@param resultList 前面(resultIndex-1)个的组合结果
@param resultIndex 选择索引,从0开始 | [
"组合选择"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/math/Combination.java#L94-L107 | train | Select a list of strings from the array. | [
30522,
2797,
11675,
7276,
1006,
20014,
2951,
22254,
10288,
1010,
5164,
1031,
1033,
2765,
9863,
1010,
20014,
2765,
22254,
10288,
1010,
2862,
1026,
5164,
1031,
1033,
1028,
2765,
1007,
1063,
20014,
2765,
7770,
1027,
2765,
9863,
1012,
3091,
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... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/Page.java | Page.addOrder | public void addOrder(Order... orders) {
if(null != this.orders){
ArrayUtil.append(this.orders, orders);
}
this.orders = orders;
} | java | public void addOrder(Order... orders) {
if(null != this.orders){
ArrayUtil.append(this.orders, orders);
}
this.orders = orders;
} | [
"public",
"void",
"addOrder",
"(",
"Order",
"...",
"orders",
")",
"{",
"if",
"(",
"null",
"!=",
"this",
".",
"orders",
")",
"{",
"ArrayUtil",
".",
"append",
"(",
"this",
".",
"orders",
",",
"orders",
")",
";",
"}",
"this",
".",
"orders",
"=",
"orde... | 设置排序
@param orders 排序 | [
"设置排序"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Page.java#L123-L128 | train | Adds the given orders to the end of the list. | [
30522,
2270,
11675,
5587,
8551,
2121,
1006,
2344,
1012,
1012,
1012,
4449,
1007,
1063,
2065,
1006,
19701,
999,
1027,
2023,
1012,
4449,
1007,
1063,
9140,
21823,
2140,
1012,
10439,
10497,
1006,
2023,
1012,
4449,
1010,
4449,
1007,
1025,
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... |
apache/flink | flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSink.java | CassandraSink.setParallelism | public CassandraSink<IN> setParallelism(int parallelism) {
if (useDataStreamSink) {
getSinkTransformation().setParallelism(parallelism);
} else {
getStreamTransformation().setParallelism(parallelism);
}
return this;
} | java | public CassandraSink<IN> setParallelism(int parallelism) {
if (useDataStreamSink) {
getSinkTransformation().setParallelism(parallelism);
} else {
getStreamTransformation().setParallelism(parallelism);
}
return this;
} | [
"public",
"CassandraSink",
"<",
"IN",
">",
"setParallelism",
"(",
"int",
"parallelism",
")",
"{",
"if",
"(",
"useDataStreamSink",
")",
"{",
"getSinkTransformation",
"(",
")",
".",
"setParallelism",
"(",
"parallelism",
")",
";",
"}",
"else",
"{",
"getStreamTran... | Sets the parallelism for this sink. The degree must be higher than zero.
@param parallelism The parallelism for this sink.
@return The sink with set parallelism. | [
"Sets",
"the",
"parallelism",
"for",
"this",
"sink",
".",
"The",
"degree",
"must",
"be",
"higher",
"than",
"zero",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSink.java#L143-L150 | train | Sets the parallelism for this sink. | [
30522,
2270,
15609,
11493,
2243,
1026,
1999,
1028,
2275,
28689,
6216,
28235,
1006,
20014,
5903,
2964,
1007,
1063,
2065,
1006,
2109,
6790,
21422,
11493,
2243,
1007,
1063,
4152,
19839,
6494,
3619,
14192,
3370,
1006,
1007,
1012,
2275,
28689,
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... |
netty/netty | resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolverBuilder.java | DnsNameResolverBuilder.copy | public DnsNameResolverBuilder copy() {
DnsNameResolverBuilder copiedBuilder = new DnsNameResolverBuilder();
if (eventLoop != null) {
copiedBuilder.eventLoop(eventLoop);
}
if (channelFactory != null) {
copiedBuilder.channelFactory(channelFactory);
}
if (resolveCache != null) {
copiedBuilder.resolveCache(resolveCache);
}
if (cnameCache != null) {
copiedBuilder.cnameCache(cnameCache);
}
if (maxTtl != null && minTtl != null) {
copiedBuilder.ttl(minTtl, maxTtl);
}
if (negativeTtl != null) {
copiedBuilder.negativeTtl(negativeTtl);
}
if (authoritativeDnsServerCache != null) {
copiedBuilder.authoritativeDnsServerCache(authoritativeDnsServerCache);
}
if (dnsQueryLifecycleObserverFactory != null) {
copiedBuilder.dnsQueryLifecycleObserverFactory(dnsQueryLifecycleObserverFactory);
}
copiedBuilder.queryTimeoutMillis(queryTimeoutMillis);
copiedBuilder.resolvedAddressTypes(resolvedAddressTypes);
copiedBuilder.recursionDesired(recursionDesired);
copiedBuilder.maxQueriesPerResolve(maxQueriesPerResolve);
copiedBuilder.traceEnabled(traceEnabled);
copiedBuilder.maxPayloadSize(maxPayloadSize);
copiedBuilder.optResourceEnabled(optResourceEnabled);
copiedBuilder.hostsFileEntriesResolver(hostsFileEntriesResolver);
if (dnsServerAddressStreamProvider != null) {
copiedBuilder.nameServerProvider(dnsServerAddressStreamProvider);
}
if (searchDomains != null) {
copiedBuilder.searchDomains(Arrays.asList(searchDomains));
}
copiedBuilder.ndots(ndots);
copiedBuilder.decodeIdn(decodeIdn);
return copiedBuilder;
} | java | public DnsNameResolverBuilder copy() {
DnsNameResolverBuilder copiedBuilder = new DnsNameResolverBuilder();
if (eventLoop != null) {
copiedBuilder.eventLoop(eventLoop);
}
if (channelFactory != null) {
copiedBuilder.channelFactory(channelFactory);
}
if (resolveCache != null) {
copiedBuilder.resolveCache(resolveCache);
}
if (cnameCache != null) {
copiedBuilder.cnameCache(cnameCache);
}
if (maxTtl != null && minTtl != null) {
copiedBuilder.ttl(minTtl, maxTtl);
}
if (negativeTtl != null) {
copiedBuilder.negativeTtl(negativeTtl);
}
if (authoritativeDnsServerCache != null) {
copiedBuilder.authoritativeDnsServerCache(authoritativeDnsServerCache);
}
if (dnsQueryLifecycleObserverFactory != null) {
copiedBuilder.dnsQueryLifecycleObserverFactory(dnsQueryLifecycleObserverFactory);
}
copiedBuilder.queryTimeoutMillis(queryTimeoutMillis);
copiedBuilder.resolvedAddressTypes(resolvedAddressTypes);
copiedBuilder.recursionDesired(recursionDesired);
copiedBuilder.maxQueriesPerResolve(maxQueriesPerResolve);
copiedBuilder.traceEnabled(traceEnabled);
copiedBuilder.maxPayloadSize(maxPayloadSize);
copiedBuilder.optResourceEnabled(optResourceEnabled);
copiedBuilder.hostsFileEntriesResolver(hostsFileEntriesResolver);
if (dnsServerAddressStreamProvider != null) {
copiedBuilder.nameServerProvider(dnsServerAddressStreamProvider);
}
if (searchDomains != null) {
copiedBuilder.searchDomains(Arrays.asList(searchDomains));
}
copiedBuilder.ndots(ndots);
copiedBuilder.decodeIdn(decodeIdn);
return copiedBuilder;
} | [
"public",
"DnsNameResolverBuilder",
"copy",
"(",
")",
"{",
"DnsNameResolverBuilder",
"copiedBuilder",
"=",
"new",
"DnsNameResolverBuilder",
"(",
")",
";",
"if",
"(",
"eventLoop",
"!=",
"null",
")",
"{",
"copiedBuilder",
".",
"eventLoop",
"(",
"eventLoop",
")",
"... | Creates a copy of this {@link DnsNameResolverBuilder}
@return {@link DnsNameResolverBuilder} | [
"Creates",
"a",
"copy",
"of",
"this",
"{",
"@link",
"DnsNameResolverBuilder",
"}"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolverBuilder.java#L456-L511 | train | Copy the DnsNameResolverBuilder. | [
30522,
2270,
1040,
3619,
18442,
6072,
4747,
6299,
8569,
23891,
2099,
6100,
1006,
1007,
1063,
1040,
3619,
18442,
6072,
4747,
6299,
8569,
23891,
2099,
15826,
8569,
23891,
2099,
1027,
2047,
1040,
3619,
18442,
6072,
4747,
6299,
8569,
23891,
209... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.