repo stringclasses 11 values | path stringlengths 41 234 | func_name stringlengths 5 78 | original_string stringlengths 71 14.1k | language stringclasses 1 value | code stringlengths 71 14.1k | code_tokens listlengths 22 2.65k | docstring stringlengths 2 5.35k | docstring_tokens listlengths 1 369 | sha stringclasses 11 values | url stringlengths 129 339 | partition stringclasses 1 value | summary stringlengths 7 175 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/incubator-shardingsphere | sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/connection/ConnectionStateHandler.java | ConnectionStateHandler.waitUntilConnectionReleasedIfNecessary | public void waitUntilConnectionReleasedIfNecessary() throws InterruptedException {
if (ConnectionStatus.RUNNING == status.get() || ConnectionStatus.TERMINATED == status.get()) {
while (!status.compareAndSet(ConnectionStatus.RELEASE, ConnectionStatus.RUNNING)) {
resourceSynchronizer.doAwaitUntil();
}
}
} | java | public void waitUntilConnectionReleasedIfNecessary() throws InterruptedException {
if (ConnectionStatus.RUNNING == status.get() || ConnectionStatus.TERMINATED == status.get()) {
while (!status.compareAndSet(ConnectionStatus.RELEASE, ConnectionStatus.RUNNING)) {
resourceSynchronizer.doAwaitUntil();
}
}
} | [
"public",
"void",
"waitUntilConnectionReleasedIfNecessary",
"(",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"ConnectionStatus",
".",
"RUNNING",
"==",
"status",
".",
"get",
"(",
")",
"||",
"ConnectionStatus",
".",
"TERMINATED",
"==",
"status",
".",
"get... | Wait until connection is released if necessary.
@throws InterruptedException interrupted exception | [
"Wait",
"until",
"connection",
"is",
"released",
"if",
"necessary",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/connection/ConnectionStateHandler.java#L89-L95 | train | Wait until connection released if necessary. | [
30522,
2270,
11675,
3524,
16671,
4014,
8663,
2638,
7542,
16570,
25063,
10128,
2638,
9623,
10286,
2100,
1006,
1007,
11618,
7153,
10288,
24422,
1063,
2065,
1006,
7264,
29336,
2271,
1012,
2770,
1027,
1027,
3570,
1012,
2131,
1006,
30524,
10830,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.join | public static MetricName join(MetricName... parts) {
final StringBuilder nameBuilder = new StringBuilder();
final Map<String, String> tags = new HashMap<>();
boolean first = true;
for (MetricName part : parts) {
final String name = part.getKey();
if (name != null && !name.isEmpty()) {
if (first) {
first = false;
} else {
nameBuilder.append(SEPARATOR);
}
nameBuilder.append(name);
}
if (!part.getTags().isEmpty())
tags.putAll(part.getTags());
}
return new MetricName(nameBuilder.toString(), tags);
} | java | public static MetricName join(MetricName... parts) {
final StringBuilder nameBuilder = new StringBuilder();
final Map<String, String> tags = new HashMap<>();
boolean first = true;
for (MetricName part : parts) {
final String name = part.getKey();
if (name != null && !name.isEmpty()) {
if (first) {
first = false;
} else {
nameBuilder.append(SEPARATOR);
}
nameBuilder.append(name);
}
if (!part.getTags().isEmpty())
tags.putAll(part.getTags());
}
return new MetricName(nameBuilder.toString(), tags);
} | [
"public",
"static",
"MetricName",
"join",
"(",
"MetricName",
"...",
"parts",
")",
"{",
"final",
"StringBuilder",
"nameBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
"=",
"new",
"HashMap",
"<... | Join the specified set of metric names.
@param parts Multiple metric names to join using the separator.
@return A newly created metric name which has the name of the specified
parts and includes all tags of all child metric names. | [
"Join",
"the",
"specified",
"set",
"of",
"metric",
"names",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/MetricName.java#L144-L168 | train | Join the given metric names together. | [
30522,
2270,
10763,
12046,
18442,
3693,
1006,
12046,
18442,
1012,
1012,
1012,
3033,
1007,
1063,
2345,
5164,
8569,
23891,
2099,
2171,
8569,
23891,
2099,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
1007,
1025,
2345,
4949,
1026,
5164,
1010,
516... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/NetworkEnvironment.java | NetworkEnvironment.releasePartitions | public void releasePartitions(Collection<ResultPartitionID> partitionIds) {
for (ResultPartitionID partitionId : partitionIds) {
resultPartitionManager.releasePartition(partitionId, null);
}
} | java | public void releasePartitions(Collection<ResultPartitionID> partitionIds) {
for (ResultPartitionID partitionId : partitionIds) {
resultPartitionManager.releasePartition(partitionId, null);
}
} | [
"public",
"void",
"releasePartitions",
"(",
"Collection",
"<",
"ResultPartitionID",
">",
"partitionIds",
")",
"{",
"for",
"(",
"ResultPartitionID",
"partitionId",
":",
"partitionIds",
")",
"{",
"resultPartitionManager",
".",
"releasePartition",
"(",
"partitionId",
","... | Batch release intermediate result partitions.
@param partitionIds partition ids to release | [
"Batch",
"release",
"intermediate",
"result",
"partitions",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/NetworkEnvironment.java#L217-L221 | train | Release the partitions. | [
30522,
2270,
11675,
2713,
19362,
3775,
9285,
1006,
3074,
1026,
2765,
19362,
3775,
3508,
3593,
1028,
13571,
9821,
1007,
1063,
2005,
1006,
2765,
19362,
3775,
3508,
3593,
13571,
3593,
1024,
13571,
9821,
1007,
1063,
2765,
19362,
3775,
3508,
248... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/LongHybridHashTable.java | LongHybridHashTable.tryDenseMode | private void tryDenseMode() {
if (numSpillFiles != 0) {
return;
}
long minKey = Long.MAX_VALUE;
long maxKey = Long.MIN_VALUE;
long recordCount = 0;
for (LongHashPartition p : this.partitionsBeingBuilt) {
long partitionRecords = p.getBuildSideRecordCount();
recordCount += partitionRecords;
if (partitionRecords > 0) {
if (p.getMinKey() < minKey) {
minKey = p.getMinKey();
}
if (p.getMaxKey() > maxKey) {
maxKey = p.getMaxKey();
}
}
}
if (buildSpillRetBufferNumbers != 0) {
throw new RuntimeException("buildSpillRetBufferNumbers should be 0: " + buildSpillRetBufferNumbers);
}
long range = maxKey - minKey + 1;
if (range <= recordCount * 4 || range <= segmentSize / 8) {
// try to request memory.
int buffers = (int) Math.ceil(((double) (range * 8)) / segmentSize);
// TODO MemoryManager needs to support flexible larger segment, so that the index area of the
// build side is placed on a segment to avoid the overhead of addressing.
MemorySegment[] denseBuckets = new MemorySegment[buffers];
for (int i = 0; i < buffers; i++) {
MemorySegment seg = getNextBuffer();
if (seg == null) {
returnAll(Arrays.asList(denseBuckets));
return;
}
denseBuckets[i] = seg;
for (int j = 0; j < segmentSize; j += 8) {
seg.putLong(j, INVALID_ADDRESS);
}
}
denseMode = true;
LOG.info("LongHybridHashTable: Use dense mode!");
this.minKey = minKey;
this.maxKey = maxKey;
buildSpillReturnBuffers.drainTo(availableMemory);
ArrayList<MemorySegment> dataBuffers = new ArrayList<>();
long addressOffset = 0;
for (LongHashPartition p : this.partitionsBeingBuilt) {
p.iteratorToDenseBucket(denseBuckets, addressOffset, minKey);
p.updateDenseAddressOffset(addressOffset);
dataBuffers.addAll(Arrays.asList(p.getPartitionBuffers()));
addressOffset += (p.getPartitionBuffers().length << segmentSizeBits);
returnAll(Arrays.asList(p.getBuckets()));
}
this.denseBuckets = denseBuckets;
this.densePartition = new LongHashPartition(this, buildSideSerializer,
dataBuffers.toArray(new MemorySegment[dataBuffers.size()]));
freeCurrent();
}
} | java | private void tryDenseMode() {
if (numSpillFiles != 0) {
return;
}
long minKey = Long.MAX_VALUE;
long maxKey = Long.MIN_VALUE;
long recordCount = 0;
for (LongHashPartition p : this.partitionsBeingBuilt) {
long partitionRecords = p.getBuildSideRecordCount();
recordCount += partitionRecords;
if (partitionRecords > 0) {
if (p.getMinKey() < minKey) {
minKey = p.getMinKey();
}
if (p.getMaxKey() > maxKey) {
maxKey = p.getMaxKey();
}
}
}
if (buildSpillRetBufferNumbers != 0) {
throw new RuntimeException("buildSpillRetBufferNumbers should be 0: " + buildSpillRetBufferNumbers);
}
long range = maxKey - minKey + 1;
if (range <= recordCount * 4 || range <= segmentSize / 8) {
// try to request memory.
int buffers = (int) Math.ceil(((double) (range * 8)) / segmentSize);
// TODO MemoryManager needs to support flexible larger segment, so that the index area of the
// build side is placed on a segment to avoid the overhead of addressing.
MemorySegment[] denseBuckets = new MemorySegment[buffers];
for (int i = 0; i < buffers; i++) {
MemorySegment seg = getNextBuffer();
if (seg == null) {
returnAll(Arrays.asList(denseBuckets));
return;
}
denseBuckets[i] = seg;
for (int j = 0; j < segmentSize; j += 8) {
seg.putLong(j, INVALID_ADDRESS);
}
}
denseMode = true;
LOG.info("LongHybridHashTable: Use dense mode!");
this.minKey = minKey;
this.maxKey = maxKey;
buildSpillReturnBuffers.drainTo(availableMemory);
ArrayList<MemorySegment> dataBuffers = new ArrayList<>();
long addressOffset = 0;
for (LongHashPartition p : this.partitionsBeingBuilt) {
p.iteratorToDenseBucket(denseBuckets, addressOffset, minKey);
p.updateDenseAddressOffset(addressOffset);
dataBuffers.addAll(Arrays.asList(p.getPartitionBuffers()));
addressOffset += (p.getPartitionBuffers().length << segmentSizeBits);
returnAll(Arrays.asList(p.getBuckets()));
}
this.denseBuckets = denseBuckets;
this.densePartition = new LongHashPartition(this, buildSideSerializer,
dataBuffers.toArray(new MemorySegment[dataBuffers.size()]));
freeCurrent();
}
} | [
"private",
"void",
"tryDenseMode",
"(",
")",
"{",
"if",
"(",
"numSpillFiles",
"!=",
"0",
")",
"{",
"return",
";",
"}",
"long",
"minKey",
"=",
"Long",
".",
"MAX_VALUE",
";",
"long",
"maxKey",
"=",
"Long",
".",
"MIN_VALUE",
";",
"long",
"recordCount",
"=... | After build end, try to use dense mode. | [
"After",
"build",
"end",
"try",
"to",
"use",
"dense",
"mode",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/LongHybridHashTable.java#L182-L252 | train | Try to use dense mode. | [
30522,
2797,
11675,
3046,
4181,
3366,
5302,
3207,
1006,
1007,
1063,
2065,
1006,
16371,
5244,
8197,
3363,
8873,
4244,
999,
1027,
1014,
1007,
1063,
2709,
1025,
1065,
2146,
8117,
14839,
1027,
2146,
1012,
4098,
1035,
3643,
1025,
2146,
4098,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/StreamTransformation.java | StreamTransformation.setUidHash | public void setUidHash(String uidHash) {
Preconditions.checkNotNull(uidHash);
Preconditions.checkArgument(uidHash.matches("^[0-9A-Fa-f]{32}$"),
"Node hash must be a 32 character String that describes a hex code. Found: " + uidHash);
this.userProvidedNodeHash = uidHash;
} | java | public void setUidHash(String uidHash) {
Preconditions.checkNotNull(uidHash);
Preconditions.checkArgument(uidHash.matches("^[0-9A-Fa-f]{32}$"),
"Node hash must be a 32 character String that describes a hex code. Found: " + uidHash);
this.userProvidedNodeHash = uidHash;
} | [
"public",
"void",
"setUidHash",
"(",
"String",
"uidHash",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"uidHash",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"uidHash",
".",
"matches",
"(",
"\"^[0-9A-Fa-f]{32}$\"",
")",
",",
"\"Node hash must be ... | Sets an user provided hash for this operator. This will be used AS IS the create the
JobVertexID.
<p>The user provided hash is an alternative to the generated hashes, that is considered when
identifying an operator through the default hash mechanics fails (e.g. because of changes
between Flink versions).
<p><strong>Important</strong>: this should be used as a workaround or for trouble shooting.
The provided hash needs to be unique per transformation and job. Otherwise, job submission
will fail. Furthermore, you cannot assign user-specified hash to intermediate nodes in an
operator chain and trying so will let your job fail.
<p>A use case for this is in migration between Flink versions or changing the jobs in a way
that changes the automatically generated hashes. In this case, providing the previous hashes
directly through this method (e.g. obtained from old logs) can help to reestablish a lost
mapping from states to their target operator.
@param uidHash The user provided hash for this operator. This will become the JobVertexID, which is shown in the
logs and web ui. | [
"Sets",
"an",
"user",
"provided",
"hash",
"for",
"this",
"operator",
".",
"This",
"will",
"be",
"used",
"AS",
"IS",
"the",
"create",
"the",
"JobVertexID",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/transformations/StreamTransformation.java#L286-L293 | train | Sets the uidHash. | [
30522,
2270,
11675,
2275,
21272,
14949,
2232,
1006,
5164,
21318,
17516,
4095,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
21318,
17516,
4095,
1007,
1025,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.normalize | private static String normalize(String dateStr) {
if (StrUtil.isBlank(dateStr)) {
return dateStr;
}
// 日期时间分开处理
final List<String> dateAndTime = StrUtil.splitTrim(dateStr, ' ');
final int size = dateAndTime.size();
if (size < 1 || size > 2) {
// 非可被标准处理的格式
return dateStr;
}
final StringBuilder builder = StrUtil.builder();
// 日期部分("\"、"/"、"."、"年"、"月"都替换为"-")
String datePart = dateAndTime.get(0).replaceAll("[\\/.年月]", "-");
datePart = StrUtil.removeSuffix(datePart, "日");
builder.append(datePart);
// 时间部分
if (size == 2) {
builder.append(' ');
String timePart = dateAndTime.get(1).replaceAll("[时分秒]", ":");
timePart = StrUtil.removeSuffix(timePart, ":");
builder.append(timePart);
}
return builder.toString();
} | java | private static String normalize(String dateStr) {
if (StrUtil.isBlank(dateStr)) {
return dateStr;
}
// 日期时间分开处理
final List<String> dateAndTime = StrUtil.splitTrim(dateStr, ' ');
final int size = dateAndTime.size();
if (size < 1 || size > 2) {
// 非可被标准处理的格式
return dateStr;
}
final StringBuilder builder = StrUtil.builder();
// 日期部分("\"、"/"、"."、"年"、"月"都替换为"-")
String datePart = dateAndTime.get(0).replaceAll("[\\/.年月]", "-");
datePart = StrUtil.removeSuffix(datePart, "日");
builder.append(datePart);
// 时间部分
if (size == 2) {
builder.append(' ');
String timePart = dateAndTime.get(1).replaceAll("[时分秒]", ":");
timePart = StrUtil.removeSuffix(timePart, ":");
builder.append(timePart);
}
return builder.toString();
} | [
"private",
"static",
"String",
"normalize",
"(",
"String",
"dateStr",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"dateStr",
")",
")",
"{",
"return",
"dateStr",
";",
"}",
"// 日期时间分开处理\r",
"final",
"List",
"<",
"String",
">",
"dateAndTime",
"=",
... | 标准化日期,默认处理以空格区分的日期时间格式,空格前为日期,空格后为时间:<br>
将以下字符替换为"-"
<pre>
"."
"/"
"年"
"月"
</pre>
将以下字符去除
<pre>
"日"
</pre>
将以下字符替换为":"
<pre>
"时"
"分"
"秒"
</pre>
当末位是":"时去除之(不存在毫秒时)
@param dateStr 日期时间字符串
@return 格式化后的日期字符串 | [
"标准化日期,默认处理以空格区分的日期时间格式,空格前为日期,空格后为时间:<br",
">",
"将以下字符替换为",
"-"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1744-L1773 | train | Normalize a date string. | [
30522,
2797,
10763,
5164,
3671,
4697,
1006,
5164,
5246,
16344,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
5246,
16344,
1007,
1007,
1063,
2709,
5246,
16344,
1025,
1065,
1013,
1013,
1864,
100,
100,
30524,
2946,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/util/StringUtil.java | StringUtil.isIntValue | public static boolean isIntValue(final String value) {
try {
Integer.parseInt(value);
return true;
} catch (final NumberFormatException ex) {
return false;
}
} | java | public static boolean isIntValue(final String value) {
try {
Integer.parseInt(value);
return true;
} catch (final NumberFormatException ex) {
return false;
}
} | [
"public",
"static",
"boolean",
"isIntValue",
"(",
"final",
"String",
"value",
")",
"{",
"try",
"{",
"Integer",
".",
"parseInt",
"(",
"value",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"final",
"NumberFormatException",
"ex",
")",
"{",
"return",
... | Judge is int value or not.
@param value to be judged string value
@return is int value or not | [
"Judge",
"is",
"int",
"value",
"or",
"not",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/util/StringUtil.java#L47-L54 | train | Is int value. | [
30522,
2270,
10763,
22017,
20898,
2003,
18447,
10175,
5657,
1006,
2345,
5164,
3643,
1007,
1063,
3046,
1063,
16109,
1012,
11968,
20240,
3372,
1006,
3643,
1007,
1025,
2709,
2995,
1025,
1065,
4608,
1006,
2345,
2193,
14192,
3686,
2595,
24422,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.ls | public static File[] ls(String path) {
if (path == null) {
return null;
}
path = getAbsolutePath(path);
File file = file(path);
if (file.isDirectory()) {
return file.listFiles();
}
throw new IORuntimeException(StrUtil.format("Path [{}] is not directory!", path));
} | java | public static File[] ls(String path) {
if (path == null) {
return null;
}
path = getAbsolutePath(path);
File file = file(path);
if (file.isDirectory()) {
return file.listFiles();
}
throw new IORuntimeException(StrUtil.format("Path [{}] is not directory!", path));
} | [
"public",
"static",
"File",
"[",
"]",
"ls",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"path",
"=",
"getAbsolutePath",
"(",
"path",
")",
";",
"File",
"file",
"=",
"file",
"(",
"path",
"... | 列出目录文件<br>
给定的绝对路径不能是压缩包中的路径
@param path 目录绝对路径或者相对路径
@return 文件列表(包含目录) | [
"列出目录文件<br",
">",
"给定的绝对路径不能是压缩包中的路径"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L105-L117 | train | Returns an array of files in the specified path. | [
30522,
2270,
10763,
5371,
1031,
1033,
1048,
2015,
1006,
5164,
4130,
1007,
1063,
2065,
1006,
4130,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
4130,
1027,
2131,
7875,
19454,
10421,
15069,
1006,
4130,
1007,
1025,
5371,
5371,
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-core/src/main/java/org/apache/flink/core/fs/FileSystemSafetyNet.java | FileSystemSafetyNet.initializeSafetyNetForThread | @Internal
public static void initializeSafetyNetForThread() {
SafetyNetCloseableRegistry oldRegistry = REGISTRIES.get();
checkState(null == oldRegistry, "Found an existing FileSystem safety net for this thread: %s " +
"This may indicate an accidental repeated initialization, or a leak of the" +
"(Inheritable)ThreadLocal through a ThreadPool.", oldRegistry);
SafetyNetCloseableRegistry newRegistry = new SafetyNetCloseableRegistry();
REGISTRIES.set(newRegistry);
} | java | @Internal
public static void initializeSafetyNetForThread() {
SafetyNetCloseableRegistry oldRegistry = REGISTRIES.get();
checkState(null == oldRegistry, "Found an existing FileSystem safety net for this thread: %s " +
"This may indicate an accidental repeated initialization, or a leak of the" +
"(Inheritable)ThreadLocal through a ThreadPool.", oldRegistry);
SafetyNetCloseableRegistry newRegistry = new SafetyNetCloseableRegistry();
REGISTRIES.set(newRegistry);
} | [
"@",
"Internal",
"public",
"static",
"void",
"initializeSafetyNetForThread",
"(",
")",
"{",
"SafetyNetCloseableRegistry",
"oldRegistry",
"=",
"REGISTRIES",
".",
"get",
"(",
")",
";",
"checkState",
"(",
"null",
"==",
"oldRegistry",
",",
"\"Found an existing FileSystem ... | Activates the safety net for a thread. {@link FileSystem} instances obtained by the thread
that called this method will be guarded, meaning that their created streams are tracked and can
be closed via the safety net closing hook.
<p>This method should be called at the beginning of a thread that should be guarded.
@throws IllegalStateException Thrown, if a safety net was already registered for the thread. | [
"Activates",
"the",
"safety",
"net",
"for",
"a",
"thread",
".",
"{",
"@link",
"FileSystem",
"}",
"instances",
"obtained",
"by",
"the",
"thread",
"that",
"called",
"this",
"method",
"will",
"be",
"guarded",
"meaning",
"that",
"their",
"created",
"streams",
"a... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/FileSystemSafetyNet.java#L81-L91 | train | Initializes the FileSystem safety net registry for the current thread. | [
30522,
1030,
4722,
2270,
10763,
11675,
3988,
10057,
10354,
27405,
7159,
15628,
16416,
2094,
1006,
1007,
1063,
3808,
7159,
20464,
9232,
3085,
2890,
24063,
2854,
2214,
2890,
24063,
2854,
1027,
20588,
21011,
1012,
2131,
1006,
1007,
1025,
14148,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/thread/ExecutorBuilder.java | ExecutorBuilder.build | private static ThreadPoolExecutor build(ExecutorBuilder builder) {
final int corePoolSize = builder.corePoolSize;
final int maxPoolSize = builder.maxPoolSize;
final long keepAliveTime = builder.keepAliveTime;
final BlockingQueue<Runnable> workQueue;
if (null != builder.workQueue) {
workQueue = builder.workQueue;
} else {
// corePoolSize为0则要使用SynchronousQueue避免无限阻塞
workQueue = (corePoolSize <= 0) ? new SynchronousQueue<Runnable>() : new LinkedBlockingQueue<Runnable>();
}
final ThreadFactory threadFactory = (null != builder.threadFactory) ? builder.threadFactory : Executors.defaultThreadFactory();
RejectedExecutionHandler handler = ObjectUtil.defaultIfNull(builder.handler, new ThreadPoolExecutor.AbortPolicy());
final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(//
corePoolSize, //
maxPoolSize, //
keepAliveTime, TimeUnit.NANOSECONDS, //
workQueue, //
threadFactory, //
handler//
);
if (null != builder.allowCoreThreadTimeOut) {
threadPoolExecutor.allowCoreThreadTimeOut(builder.allowCoreThreadTimeOut);
}
return threadPoolExecutor;
} | java | private static ThreadPoolExecutor build(ExecutorBuilder builder) {
final int corePoolSize = builder.corePoolSize;
final int maxPoolSize = builder.maxPoolSize;
final long keepAliveTime = builder.keepAliveTime;
final BlockingQueue<Runnable> workQueue;
if (null != builder.workQueue) {
workQueue = builder.workQueue;
} else {
// corePoolSize为0则要使用SynchronousQueue避免无限阻塞
workQueue = (corePoolSize <= 0) ? new SynchronousQueue<Runnable>() : new LinkedBlockingQueue<Runnable>();
}
final ThreadFactory threadFactory = (null != builder.threadFactory) ? builder.threadFactory : Executors.defaultThreadFactory();
RejectedExecutionHandler handler = ObjectUtil.defaultIfNull(builder.handler, new ThreadPoolExecutor.AbortPolicy());
final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(//
corePoolSize, //
maxPoolSize, //
keepAliveTime, TimeUnit.NANOSECONDS, //
workQueue, //
threadFactory, //
handler//
);
if (null != builder.allowCoreThreadTimeOut) {
threadPoolExecutor.allowCoreThreadTimeOut(builder.allowCoreThreadTimeOut);
}
return threadPoolExecutor;
} | [
"private",
"static",
"ThreadPoolExecutor",
"build",
"(",
"ExecutorBuilder",
"builder",
")",
"{",
"final",
"int",
"corePoolSize",
"=",
"builder",
".",
"corePoolSize",
";",
"final",
"int",
"maxPoolSize",
"=",
"builder",
".",
"maxPoolSize",
";",
"final",
"long",
"k... | 构建ThreadPoolExecutor
@param builder {@link ExecutorBuilder}
@return {@link ThreadPoolExecutor} | [
"构建ThreadPoolExecutor"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/ExecutorBuilder.java#L183-L209 | train | Build a ThreadPoolExecutor. | [
30522,
2797,
10763,
11689,
16869,
10288,
8586,
16161,
30524,
4063,
12508,
1007,
1063,
2345,
20014,
4563,
16869,
5332,
4371,
1027,
12508,
1012,
4563,
16869,
5332,
4371,
1025,
2345,
20014,
4098,
16869,
5332,
4371,
1027,
12508,
1012,
4098,
16869... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java | Tuple12.copy | @Override
@SuppressWarnings("unchecked")
public Tuple12<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> copy() {
return new Tuple12<>(this.f0,
this.f1,
this.f2,
this.f3,
this.f4,
this.f5,
this.f6,
this.f7,
this.f8,
this.f9,
this.f10,
this.f11);
} | java | @Override
@SuppressWarnings("unchecked")
public Tuple12<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> copy() {
return new Tuple12<>(this.f0,
this.f1,
this.f2,
this.f3,
this.f4,
this.f5,
this.f6,
this.f7,
this.f8,
this.f9,
this.f10,
this.f11);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Tuple12",
"<",
"T0",
",",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"T7",
",",
"T8",
",",
"T9",
",",
"T10",
",",
"T11",
">",
"copy",
"(",
")... | Shallow tuple copy.
@return A new Tuple with the same fields as this. | [
"Shallow",
"tuple",
"copy",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple12.java#L328-L343 | train | Creates a copy of this tuple. | [
30522,
1030,
2058,
15637,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10722,
10814,
12521,
1026,
1056,
2692,
1010,
1056,
2487,
1010,
1056,
2475,
1010,
1056,
2509,
1010,
1056,
2549,
1010,
1056,
2629,
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... |
alibaba/canal | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/utils/CharsetUtil.java | CharsetUtil.collateCharset | public static final String collateCharset(String charset) {
String[] output = StringUtils.split(charset, "COLLATE");
return output[0].replace('\'', ' ').trim();
} | java | public static final String collateCharset(String charset) {
String[] output = StringUtils.split(charset, "COLLATE");
return output[0].replace('\'', ' ').trim();
} | [
"public",
"static",
"final",
"String",
"collateCharset",
"(",
"String",
"charset",
")",
"{",
"String",
"[",
"]",
"output",
"=",
"StringUtils",
".",
"split",
"(",
"charset",
",",
"\"COLLATE\"",
")",
";",
"return",
"output",
"[",
"0",
"]",
".",
"replace",
... | 'utf8' COLLATE 'utf8_general_ci'
@param charset
@return | [
"utf8",
"COLLATE",
"utf8_general_ci"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/utils/CharsetUtil.java#L238-L241 | train | Returns the charset of the given charset. | [
30522,
2270,
10763,
2345,
5164,
8902,
13806,
7507,
22573,
2102,
1006,
5164,
25869,
13462,
1007,
1063,
5164,
1031,
1033,
6434,
1027,
5164,
21823,
4877,
1012,
3975,
1006,
25869,
13462,
1010,
1000,
8902,
13806,
1000,
1007,
1025,
2709,
6434,
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-extra/src/main/java/cn/hutool/extra/mail/Mail.java | Mail.getSession | private Session getSession(boolean isSingleton) {
final MailAccount mailAccount = this.mailAccount;
Authenticator authenticator = null;
if (mailAccount.isAuth()) {
authenticator = new UserPassAuthenticator(mailAccount.getUser(), mailAccount.getPass());
}
return isSingleton ? Session.getDefaultInstance(mailAccount.getSmtpProps(), authenticator) //
: Session.getInstance(mailAccount.getSmtpProps(), authenticator);
} | java | private Session getSession(boolean isSingleton) {
final MailAccount mailAccount = this.mailAccount;
Authenticator authenticator = null;
if (mailAccount.isAuth()) {
authenticator = new UserPassAuthenticator(mailAccount.getUser(), mailAccount.getPass());
}
return isSingleton ? Session.getDefaultInstance(mailAccount.getSmtpProps(), authenticator) //
: Session.getInstance(mailAccount.getSmtpProps(), authenticator);
} | [
"private",
"Session",
"getSession",
"(",
"boolean",
"isSingleton",
")",
"{",
"final",
"MailAccount",
"mailAccount",
"=",
"this",
".",
"mailAccount",
";",
"Authenticator",
"authenticator",
"=",
"null",
";",
"if",
"(",
"mailAccount",
".",
"isAuth",
"(",
")",
")"... | 获取默认邮件会话<br>
如果为全局单例的会话,则全局只允许一个邮件帐号,否则每次发送邮件会新建一个新的会话
@param isSingleton 是否使用单例Session
@return 邮件会话 {@link Session}
@since 4.0.2 | [
"获取默认邮件会话<br",
">",
"如果为全局单例的会话,则全局只允许一个邮件帐号,否则每次发送邮件会新建一个新的会话"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/Mail.java#L318-L327 | train | Gets the Session. | [
30522,
2797,
5219,
4152,
7971,
3258,
1006,
22017,
20898,
26354,
2075,
19263,
1007,
1063,
2345,
5653,
6305,
3597,
16671,
5653,
6305,
3597,
16671,
1027,
2023,
1012,
5653,
6305,
3597,
16671,
1025,
14469,
8844,
14469,
8844,
1027,
19701,
1025,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraph.java | StreamGraph.clear | public void clear() {
streamNodes = new HashMap<>();
virtualSelectNodes = new HashMap<>();
virtualSideOutputNodes = new HashMap<>();
virtualPartitionNodes = new HashMap<>();
vertexIDtoBrokerID = new HashMap<>();
vertexIDtoLoopTimeout = new HashMap<>();
iterationSourceSinkPairs = new HashSet<>();
sources = new HashSet<>();
sinks = new HashSet<>();
} | java | public void clear() {
streamNodes = new HashMap<>();
virtualSelectNodes = new HashMap<>();
virtualSideOutputNodes = new HashMap<>();
virtualPartitionNodes = new HashMap<>();
vertexIDtoBrokerID = new HashMap<>();
vertexIDtoLoopTimeout = new HashMap<>();
iterationSourceSinkPairs = new HashSet<>();
sources = new HashSet<>();
sinks = new HashSet<>();
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"streamNodes",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"virtualSelectNodes",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"virtualSideOutputNodes",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"virtualPartitionNo... | Remove all registered nodes etc. | [
"Remove",
"all",
"registered",
"nodes",
"etc",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraph.java#L111-L121 | train | Clear all the nodes. | [
30522,
2270,
11675,
3154,
1006,
1007,
1063,
5460,
3630,
6155,
1027,
2047,
23325,
2863,
2361,
1026,
1028,
1006,
1007,
1025,
7484,
11246,
22471,
3630,
6155,
1027,
2047,
23325,
2863,
2361,
1026,
1028,
1006,
1007,
1025,
7484,
7363,
5833,
18780,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.newClientContext | @Deprecated
public static SslContext newClientContext(
SslProvider provider,
File trustCertCollectionFile, TrustManagerFactory trustManagerFactory,
File keyCertChainFile, File keyFile, String keyPassword,
KeyManagerFactory keyManagerFactory,
Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
long sessionCacheSize, long sessionTimeout) throws SSLException {
try {
return newClientContextInternal(provider, null,
toX509Certificates(trustCertCollectionFile), trustManagerFactory,
toX509Certificates(keyCertChainFile), toPrivateKey(keyFile, keyPassword),
keyPassword, keyManagerFactory, ciphers, cipherFilter,
apn, null, sessionCacheSize, sessionTimeout, false);
} catch (Exception e) {
if (e instanceof SSLException) {
throw (SSLException) e;
}
throw new SSLException("failed to initialize the client-side SSL context", e);
}
} | java | @Deprecated
public static SslContext newClientContext(
SslProvider provider,
File trustCertCollectionFile, TrustManagerFactory trustManagerFactory,
File keyCertChainFile, File keyFile, String keyPassword,
KeyManagerFactory keyManagerFactory,
Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
long sessionCacheSize, long sessionTimeout) throws SSLException {
try {
return newClientContextInternal(provider, null,
toX509Certificates(trustCertCollectionFile), trustManagerFactory,
toX509Certificates(keyCertChainFile), toPrivateKey(keyFile, keyPassword),
keyPassword, keyManagerFactory, ciphers, cipherFilter,
apn, null, sessionCacheSize, sessionTimeout, false);
} catch (Exception e) {
if (e instanceof SSLException) {
throw (SSLException) e;
}
throw new SSLException("failed to initialize the client-side SSL context", e);
}
} | [
"@",
"Deprecated",
"public",
"static",
"SslContext",
"newClientContext",
"(",
"SslProvider",
"provider",
",",
"File",
"trustCertCollectionFile",
",",
"TrustManagerFactory",
"trustManagerFactory",
",",
"File",
"keyCertChainFile",
",",
"File",
"keyFile",
",",
"String",
"k... | Creates a new client-side {@link SslContext}.
@param provider the {@link SslContext} implementation to use.
{@code null} to use the current default one.
@param trustCertCollectionFile an X.509 certificate collection file in PEM format.
{@code null} to use the system default
@param trustManagerFactory the {@link TrustManagerFactory} that provides the {@link TrustManager}s
that verifies the certificates sent from servers.
{@code null} to use the default or the results of parsing
{@code trustCertCollectionFile}.
This parameter is ignored if {@code provider} is not {@link SslProvider#JDK}.
@param keyCertChainFile an X.509 certificate chain file in PEM format.
This provides the public key for mutual authentication.
{@code null} to use the system default
@param keyFile a PKCS#8 private key file in PEM format.
This provides the private key for mutual authentication.
{@code null} for no mutual authentication.
@param keyPassword the password of the {@code keyFile}.
{@code null} if it's not password-protected.
Ignored if {@code keyFile} is {@code null}.
@param keyManagerFactory the {@link KeyManagerFactory} that provides the {@link KeyManager}s
that is used to encrypt data being sent to servers.
{@code null} to use the default or the results of parsing
{@code keyCertChainFile} and {@code keyFile}.
This parameter is ignored if {@code provider} is not {@link SslProvider#JDK}.
@param ciphers the cipher suites to enable, in the order of preference.
{@code null} to use the default cipher suites.
@param cipherFilter a filter to apply over the supplied list of ciphers
@param apn Provides a means to configure parameters related to application protocol negotiation.
@param sessionCacheSize the size of the cache used for storing SSL session objects.
{@code 0} to use the default value.
@param sessionTimeout the timeout for the cached SSL session objects, in seconds.
{@code 0} to use the default value.
@return a new client-side {@link SslContext}
@deprecated Replaced by {@link SslContextBuilder} | [
"Creates",
"a",
"new",
"client",
"-",
"side",
"{",
"@link",
"SslContext",
"}",
".",
"@param",
"provider",
"the",
"{",
"@link",
"SslContext",
"}",
"implementation",
"to",
"use",
".",
"{",
"@code",
"null",
"}",
"to",
"use",
"the",
"current",
"default",
"on... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L735-L755 | train | Create a new client - side SSL context. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
7020,
22499,
10111,
18413,
2047,
20464,
11638,
8663,
18209,
1006,
7020,
14277,
12298,
18688,
10802,
1010,
5371,
3404,
17119,
13535,
14511,
18491,
8873,
2571,
1010,
3404,
24805,
4590,
21450,
3404,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SimpleMDAGNode.java | SimpleMDAGNode.transition | public SimpleMDAGNode transition(SimpleMDAGNode[] mdagDataArray, char letter)
{
SimpleMDAGNode targetNode = null;
int offset = binarySearch(mdagDataArray, letter);
if (offset >= 0)
{
targetNode = mdagDataArray[offset];
}
/////
return targetNode;
} | java | public SimpleMDAGNode transition(SimpleMDAGNode[] mdagDataArray, char letter)
{
SimpleMDAGNode targetNode = null;
int offset = binarySearch(mdagDataArray, letter);
if (offset >= 0)
{
targetNode = mdagDataArray[offset];
}
/////
return targetNode;
} | [
"public",
"SimpleMDAGNode",
"transition",
"(",
"SimpleMDAGNode",
"[",
"]",
"mdagDataArray",
",",
"char",
"letter",
")",
"{",
"SimpleMDAGNode",
"targetNode",
"=",
"null",
";",
"int",
"offset",
"=",
"binarySearch",
"(",
"mdagDataArray",
",",
"letter",
")",
";",
... | Follows an outgoing _transition from this node.
@param mdagDataArray the array of SimpleMDAGNodes containing this node
@param letter the char representation of the desired _transition's label
@return the SimpleMDAGNode that is the target of the _transition labeled with {@code letter},
or null if there is no such labeled _transition from this node | [
"Follows",
"an",
"outgoing",
"_transition",
"from",
"this",
"node",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/SimpleMDAGNode.java#L135-L146 | train | Transition to a single character | [
30522,
2270,
3722,
26876,
8490,
3630,
3207,
6653,
1006,
3722,
26876,
8490,
3630,
3207,
1031,
1033,
9108,
8490,
2850,
2696,
2906,
9447,
1010,
25869,
3661,
1007,
1063,
3722,
26876,
8490,
3630,
3207,
4539,
3630,
3207,
1027,
19701,
1025,
20014,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/concurrent/DefaultPromise.java | DefaultPromise.notifyListenerWithStackOverFlowProtection | private static void notifyListenerWithStackOverFlowProtection(final EventExecutor executor,
final Future<?> future,
final GenericFutureListener<?> listener) {
if (executor.inEventLoop()) {
final InternalThreadLocalMap threadLocals = InternalThreadLocalMap.get();
final int stackDepth = threadLocals.futureListenerStackDepth();
if (stackDepth < MAX_LISTENER_STACK_DEPTH) {
threadLocals.setFutureListenerStackDepth(stackDepth + 1);
try {
notifyListener0(future, listener);
} finally {
threadLocals.setFutureListenerStackDepth(stackDepth);
}
return;
}
}
safeExecute(executor, new Runnable() {
@Override
public void run() {
notifyListener0(future, listener);
}
});
} | java | private static void notifyListenerWithStackOverFlowProtection(final EventExecutor executor,
final Future<?> future,
final GenericFutureListener<?> listener) {
if (executor.inEventLoop()) {
final InternalThreadLocalMap threadLocals = InternalThreadLocalMap.get();
final int stackDepth = threadLocals.futureListenerStackDepth();
if (stackDepth < MAX_LISTENER_STACK_DEPTH) {
threadLocals.setFutureListenerStackDepth(stackDepth + 1);
try {
notifyListener0(future, listener);
} finally {
threadLocals.setFutureListenerStackDepth(stackDepth);
}
return;
}
}
safeExecute(executor, new Runnable() {
@Override
public void run() {
notifyListener0(future, listener);
}
});
} | [
"private",
"static",
"void",
"notifyListenerWithStackOverFlowProtection",
"(",
"final",
"EventExecutor",
"executor",
",",
"final",
"Future",
"<",
"?",
">",
"future",
",",
"final",
"GenericFutureListener",
"<",
"?",
">",
"listener",
")",
"{",
"if",
"(",
"executor",... | The logic in this method should be identical to {@link #notifyListeners()} but
cannot share code because the listener(s) cannot be cached for an instance of {@link DefaultPromise} since the
listener(s) may be changed and is protected by a synchronized operation. | [
"The",
"logic",
"in",
"this",
"method",
"should",
"be",
"identical",
"to",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java#L436-L459 | train | Notify listener with stack over flow protection. | [
30522,
2797,
10763,
11675,
2025,
8757,
9863,
24454,
24415,
9153,
19665,
6299,
12314,
21572,
26557,
3508,
1006,
2345,
2724,
10288,
8586,
16161,
2099,
4654,
8586,
16161,
2099,
1010,
2345,
2925,
1026,
1029,
1028,
2925,
1010,
2345,
12391,
11263,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DataSource.java | DataSource.translateToDataFlow | protected GenericDataSourceBase<OUT, ?> translateToDataFlow() {
String name = this.name != null ? this.name : "at " + dataSourceLocationName + " (" + inputFormat.getClass().getName() + ")";
if (name.length() > 150) {
name = name.substring(0, 150);
}
@SuppressWarnings({"unchecked", "rawtypes"})
GenericDataSourceBase<OUT, ?> source = new GenericDataSourceBase(this.inputFormat,
new OperatorInformation<OUT>(getType()), name);
source.setParallelism(parallelism);
if (this.parameters != null) {
source.getParameters().addAll(this.parameters);
}
if (this.splitDataProperties != null) {
source.setSplitDataProperties(this.splitDataProperties);
}
return source;
} | java | protected GenericDataSourceBase<OUT, ?> translateToDataFlow() {
String name = this.name != null ? this.name : "at " + dataSourceLocationName + " (" + inputFormat.getClass().getName() + ")";
if (name.length() > 150) {
name = name.substring(0, 150);
}
@SuppressWarnings({"unchecked", "rawtypes"})
GenericDataSourceBase<OUT, ?> source = new GenericDataSourceBase(this.inputFormat,
new OperatorInformation<OUT>(getType()), name);
source.setParallelism(parallelism);
if (this.parameters != null) {
source.getParameters().addAll(this.parameters);
}
if (this.splitDataProperties != null) {
source.setSplitDataProperties(this.splitDataProperties);
}
return source;
} | [
"protected",
"GenericDataSourceBase",
"<",
"OUT",
",",
"?",
">",
"translateToDataFlow",
"(",
")",
"{",
"String",
"name",
"=",
"this",
".",
"name",
"!=",
"null",
"?",
"this",
".",
"name",
":",
"\"at \"",
"+",
"dataSourceLocationName",
"+",
"\" (\"",
"+",
"i... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/DataSource.java#L126-L143 | train | Translate this data source to a data flow. | [
30522,
5123,
12391,
2850,
10230,
8162,
3401,
15058,
1026,
2041,
1010,
1029,
1028,
17637,
3406,
2850,
2696,
12314,
1006,
1007,
1063,
5164,
2171,
1027,
2023,
1012,
2171,
999,
1027,
19701,
1029,
2023,
1012,
2171,
1024,
1000,
2012,
1000,
1009,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple5.java | Tuple5.of | public static <T0, T1, T2, T3, T4> Tuple5<T0, T1, T2, T3, T4> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4) {
return new Tuple5<>(value0,
value1,
value2,
value3,
value4);
} | java | public static <T0, T1, T2, T3, T4> Tuple5<T0, T1, T2, T3, T4> of(T0 value0, T1 value1, T2 value2, T3 value3, T4 value4) {
return new Tuple5<>(value0,
value1,
value2,
value3,
value4);
} | [
"public",
"static",
"<",
"T0",
",",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
">",
"Tuple5",
"<",
"T0",
",",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
">",
"of",
"(",
"T0",
"value0",
",",
"T1",
"value1",
",",
"T2",
"value2",
",",
"T3",
"value3",
... | Creates a new tuple and assigns the given values to the tuple's fields.
This is more convenient than using the constructor, because the compiler can
infer the generic type arguments implicitly. For example:
{@code Tuple3.of(n, x, s)}
instead of
{@code new Tuple3<Integer, Double, String>(n, x, s)} | [
"Creates",
"a",
"new",
"tuple",
"and",
"assigns",
"the",
"given",
"values",
"to",
"the",
"tuple",
"s",
"fields",
".",
"This",
"is",
"more",
"convenient",
"than",
"using",
"the",
"constructor",
"because",
"the",
"compiler",
"can",
"infer",
"the",
"generic",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple5.java#L234-L240 | train | Construct a tuple of size 5. | [
30522,
2270,
10763,
1026,
1056,
2692,
1010,
1056,
2487,
1010,
1056,
2475,
1010,
1056,
2509,
1010,
1056,
2549,
1028,
10722,
10814,
2629,
1026,
1056,
2692,
1010,
1056,
2487,
1010,
1056,
2475,
1010,
1056,
2509,
1010,
1056,
2549,
1028,
1997,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/bitset/BitSetMethods.java | BitSetMethods.nextSetBit | public static int nextSetBit(
Object baseObject,
long baseOffset,
int fromIndex,
int bitsetSizeInWords) {
int wi = fromIndex >> 6;
if (wi >= bitsetSizeInWords) {
return -1;
}
// Try to find the next set bit in the current word
final int subIndex = fromIndex & 0x3f;
long word = Platform.getLong(baseObject, baseOffset + wi * WORD_SIZE) >> subIndex;
if (word != 0) {
return (wi << 6) + subIndex + java.lang.Long.numberOfTrailingZeros(word);
}
// Find the next set bit in the rest of the words
wi += 1;
while (wi < bitsetSizeInWords) {
word = Platform.getLong(baseObject, baseOffset + wi * WORD_SIZE);
if (word != 0) {
return (wi << 6) + java.lang.Long.numberOfTrailingZeros(word);
}
wi += 1;
}
return -1;
} | java | public static int nextSetBit(
Object baseObject,
long baseOffset,
int fromIndex,
int bitsetSizeInWords) {
int wi = fromIndex >> 6;
if (wi >= bitsetSizeInWords) {
return -1;
}
// Try to find the next set bit in the current word
final int subIndex = fromIndex & 0x3f;
long word = Platform.getLong(baseObject, baseOffset + wi * WORD_SIZE) >> subIndex;
if (word != 0) {
return (wi << 6) + subIndex + java.lang.Long.numberOfTrailingZeros(word);
}
// Find the next set bit in the rest of the words
wi += 1;
while (wi < bitsetSizeInWords) {
word = Platform.getLong(baseObject, baseOffset + wi * WORD_SIZE);
if (word != 0) {
return (wi << 6) + java.lang.Long.numberOfTrailingZeros(word);
}
wi += 1;
}
return -1;
} | [
"public",
"static",
"int",
"nextSetBit",
"(",
"Object",
"baseObject",
",",
"long",
"baseOffset",
",",
"int",
"fromIndex",
",",
"int",
"bitsetSizeInWords",
")",
"{",
"int",
"wi",
"=",
"fromIndex",
">>",
"6",
";",
"if",
"(",
"wi",
">=",
"bitsetSizeInWords",
... | Returns the index of the first bit that is set to true that occurs on or after the
specified starting index. If no such bit exists then {@code -1} is returned.
<p>
To iterate over the true bits in a BitSet, use the following loop:
<pre>
<code>
for (long i = bs.nextSetBit(0, sizeInWords); i >= 0;
i = bs.nextSetBit(i + 1, sizeInWords)) {
// operate on index i here
}
</code>
</pre>
@param fromIndex the index to start checking from (inclusive)
@param bitsetSizeInWords the size of the bitset, measured in 8-byte words
@return the index of the next set bit, or -1 if there is no such bit | [
"Returns",
"the",
"index",
"of",
"the",
"first",
"bit",
"that",
"is",
"set",
"to",
"true",
"that",
"occurs",
"on",
"or",
"after",
"the",
"specified",
"starting",
"index",
".",
"If",
"no",
"such",
"bit",
"exists",
"then",
"{",
"@code",
"-",
"1",
"}",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/bitset/BitSetMethods.java#L101-L129 | train | Gets the next set bit in the specified bitset. | [
30522,
2270,
10763,
20014,
2279,
13462,
16313,
1006,
4874,
2918,
16429,
20614,
1010,
2146,
2918,
27475,
3388,
1010,
20014,
2013,
22254,
10288,
1010,
20014,
9017,
8454,
4697,
2378,
22104,
1007,
1063,
20014,
15536,
1027,
2013,
22254,
10288,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/NestedRow.java | NestedRow.setNullAt | @Override
public void setNullAt(int i) {
assertIndexIsValid(i);
SegmentsUtil.bitSet(segments, offset, i + 8);
SegmentsUtil.setLong(segments, getFieldOffset(i), 0);
} | java | @Override
public void setNullAt(int i) {
assertIndexIsValid(i);
SegmentsUtil.bitSet(segments, offset, i + 8);
SegmentsUtil.setLong(segments, getFieldOffset(i), 0);
} | [
"@",
"Override",
"public",
"void",
"setNullAt",
"(",
"int",
"i",
")",
"{",
"assertIndexIsValid",
"(",
"i",
")",
";",
"SegmentsUtil",
".",
"bitSet",
"(",
"segments",
",",
"offset",
",",
"i",
"+",
"8",
")",
";",
"SegmentsUtil",
".",
"setLong",
"(",
"segm... | See {@link BinaryRow#setNullAt(int)}. | [
"See",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/NestedRow.java#L83-L88 | train | Sets the value of the null field at the given index. | [
30522,
1030,
2058,
15637,
2270,
11675,
2275,
11231,
4571,
2102,
1006,
20014,
1045,
1007,
1063,
20865,
22254,
10288,
2483,
10175,
3593,
1006,
1045,
1007,
1025,
9214,
21823,
2140,
1012,
9017,
3388,
1006,
9214,
1010,
16396,
1010,
1045,
1009,
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/webmonitor/WebMonitorUtils.java | WebMonitorUtils.tryLoadWebContent | public static <T extends RestfulGateway> Optional<StaticFileServerHandler<T>> tryLoadWebContent(
GatewayRetriever<? extends T> leaderRetriever,
Time timeout,
File tmpDir) throws IOException {
if (isFlinkRuntimeWebInClassPath()) {
return Optional.of(new StaticFileServerHandler<>(
leaderRetriever,
timeout,
tmpDir));
} else {
return Optional.empty();
}
} | java | public static <T extends RestfulGateway> Optional<StaticFileServerHandler<T>> tryLoadWebContent(
GatewayRetriever<? extends T> leaderRetriever,
Time timeout,
File tmpDir) throws IOException {
if (isFlinkRuntimeWebInClassPath()) {
return Optional.of(new StaticFileServerHandler<>(
leaderRetriever,
timeout,
tmpDir));
} else {
return Optional.empty();
}
} | [
"public",
"static",
"<",
"T",
"extends",
"RestfulGateway",
">",
"Optional",
"<",
"StaticFileServerHandler",
"<",
"T",
">",
">",
"tryLoadWebContent",
"(",
"GatewayRetriever",
"<",
"?",
"extends",
"T",
">",
"leaderRetriever",
",",
"Time",
"timeout",
",",
"File",
... | Checks whether the flink-runtime-web dependency is available and if so returns a
StaticFileServerHandler which can serve the static file contents.
@param leaderRetriever to be used by the StaticFileServerHandler
@param timeout for lookup requests
@param tmpDir to be used by the StaticFileServerHandler to store temporary files
@param <T> type of the gateway to retrieve
@return StaticFileServerHandler if flink-runtime-web is in the classpath; Otherwise Optional.empty
@throws IOException if we cannot create the StaticFileServerHandler | [
"Checks",
"whether",
"the",
"flink",
"-",
"runtime",
"-",
"web",
"dependency",
"is",
"available",
"and",
"if",
"so",
"returns",
"a",
"StaticFileServerHandler",
"which",
"can",
"serve",
"the",
"static",
"file",
"contents",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java#L130-L143 | train | Tries to load the static file content from the web. xml file. | [
30522,
2270,
10763,
1026,
1056,
8908,
2717,
3993,
5867,
4576,
1028,
11887,
1026,
10763,
8873,
24527,
2099,
6299,
11774,
3917,
1026,
1056,
1028,
1028,
3046,
11066,
8545,
9818,
28040,
3372,
1006,
11909,
13465,
7373,
6299,
1026,
1029,
8908,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/cookie/CookieUtil.java | CookieUtil.validCookieValueOctets | private static BitSet validCookieValueOctets() {
BitSet bits = new BitSet();
bits.set(0x21);
for (int i = 0x23; i <= 0x2B; i++) {
bits.set(i);
}
for (int i = 0x2D; i <= 0x3A; i++) {
bits.set(i);
}
for (int i = 0x3C; i <= 0x5B; i++) {
bits.set(i);
}
for (int i = 0x5D; i <= 0x7E; i++) {
bits.set(i);
}
return bits;
} | java | private static BitSet validCookieValueOctets() {
BitSet bits = new BitSet();
bits.set(0x21);
for (int i = 0x23; i <= 0x2B; i++) {
bits.set(i);
}
for (int i = 0x2D; i <= 0x3A; i++) {
bits.set(i);
}
for (int i = 0x3C; i <= 0x5B; i++) {
bits.set(i);
}
for (int i = 0x5D; i <= 0x7E; i++) {
bits.set(i);
}
return bits;
} | [
"private",
"static",
"BitSet",
"validCookieValueOctets",
"(",
")",
"{",
"BitSet",
"bits",
"=",
"new",
"BitSet",
"(",
")",
";",
"bits",
".",
"set",
"(",
"0x21",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0x23",
";",
"i",
"<=",
"0x2B",
";",
"i",
"++",
... | US-ASCII characters excluding CTLs, whitespace, DQUOTE, comma, semicolon, and backslash | [
"US",
"-",
"ASCII",
"characters",
"excluding",
"CTLs",
"whitespace",
"DQUOTE",
"comma",
"semicolon",
"and",
"backslash"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/cookie/CookieUtil.java#L51-L67 | train | validCookieValueOctets This method returns a BitSet of valid cookie value octets. | [
30522,
2797,
10763,
9017,
3388,
9398,
3597,
23212,
13331,
7630,
8780,
6593,
8454,
1006,
1007,
1063,
9017,
3388,
9017,
1027,
2047,
9017,
3388,
1006,
1007,
1025,
9017,
1012,
2275,
1006,
1014,
2595,
17465,
1007,
1025,
2005,
1006,
20014,
1045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java | NeuralNetworkParser.get_distance_features | void get_distance_features(final Context ctx,
List<Integer> features)
{
if (!use_distance)
{
return;
}
int dist = 8;
if (ctx.S0 >= 0 && ctx.S1 >= 0)
{
dist = math.binned_1_2_3_4_5_6_10[ctx.S0 - ctx.S1];
if (dist == 10)
{
dist = 7;
}
}
features.add(dist + kDistanceInFeaturespace);
} | java | void get_distance_features(final Context ctx,
List<Integer> features)
{
if (!use_distance)
{
return;
}
int dist = 8;
if (ctx.S0 >= 0 && ctx.S1 >= 0)
{
dist = math.binned_1_2_3_4_5_6_10[ctx.S0 - ctx.S1];
if (dist == 10)
{
dist = 7;
}
}
features.add(dist + kDistanceInFeaturespace);
} | [
"void",
"get_distance_features",
"(",
"final",
"Context",
"ctx",
",",
"List",
"<",
"Integer",
">",
"features",
")",
"{",
"if",
"(",
"!",
"use_distance",
")",
"{",
"return",
";",
"}",
"int",
"dist",
"=",
"8",
";",
"if",
"(",
"ctx",
".",
"S0",
">=",
... | 获取距离特征
@param ctx 当前特征
@param features 输出特征 | [
"获取距离特征"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java#L734-L752 | train | Get distance features. | [
30522,
11675,
2131,
1035,
3292,
1035,
2838,
1006,
2345,
6123,
14931,
2595,
1010,
2862,
1026,
16109,
1028,
2838,
1007,
1063,
2065,
1006,
999,
2224,
1035,
3292,
1007,
1063,
2709,
1025,
1065,
20014,
4487,
3367,
1027,
1022,
1025,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java | JSONArray.optJSONArray | public JSONArray optJSONArray(int index) {
Object object = opt(index);
return object instanceof JSONArray ? (JSONArray) object : null;
} | java | public JSONArray optJSONArray(int index) {
Object object = opt(index);
return object instanceof JSONArray ? (JSONArray) object : null;
} | [
"public",
"JSONArray",
"optJSONArray",
"(",
"int",
"index",
")",
"{",
"Object",
"object",
"=",
"opt",
"(",
"index",
")",
";",
"return",
"object",
"instanceof",
"JSONArray",
"?",
"(",
"JSONArray",
")",
"object",
":",
"null",
";",
"}"
] | Returns the value at {@code index} if it exists and is a {@code
JSONArray}. Returns null otherwise.
@param index the index to get the value from
@return the array at {@code index} or {@code null} | [
"Returns",
"the",
"value",
"at",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java#L545-L548 | train | Get the optional JSONArray associated with an index. | [
30522,
2270,
1046,
3385,
2906,
9447,
23569,
22578,
7856,
11335,
2100,
1006,
20014,
5950,
1007,
1063,
4874,
4874,
1027,
23569,
1006,
5950,
1007,
1025,
2709,
4874,
6013,
11253,
1046,
3385,
2906,
9447,
1029,
1006,
1046,
3385,
2906,
9447,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java | CustomDictionary.commonPrefixSearch | public static LinkedList<Map.Entry<String, CoreDictionary.Attribute>> commonPrefixSearch(String key)
{
return trie.commonPrefixSearchWithValue(key);
} | java | public static LinkedList<Map.Entry<String, CoreDictionary.Attribute>> commonPrefixSearch(String key)
{
return trie.commonPrefixSearchWithValue(key);
} | [
"public",
"static",
"LinkedList",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"CoreDictionary",
".",
"Attribute",
">",
">",
"commonPrefixSearch",
"(",
"String",
"key",
")",
"{",
"return",
"trie",
".",
"commonPrefixSearchWithValue",
"(",
"key",
")",
";",
"}... | 前缀查询
@param key
@return | [
"前缀查询"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L446-L449 | train | Returns a list of entries that are common prefixes of the given key. | [
30522,
2270,
10763,
5799,
9863,
1026,
4949,
1012,
4443,
1026,
5164,
1010,
4563,
29201,
3258,
5649,
1012,
17961,
1028,
1028,
2691,
28139,
8873,
2595,
17310,
11140,
1006,
5164,
3145,
1007,
1063,
2709,
13012,
2063,
1012,
2691,
28139,
8873,
259... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.removeEmpty | public static <T extends CharSequence> Collection<T> removeEmpty(Collection<T> collection) {
return filter(collection, new Filter<T>() {
@Override
public boolean accept(T t) {
return false == StrUtil.isEmpty(t);
}
});
} | java | public static <T extends CharSequence> Collection<T> removeEmpty(Collection<T> collection) {
return filter(collection, new Filter<T>() {
@Override
public boolean accept(T t) {
return false == StrUtil.isEmpty(t);
}
});
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"Collection",
"<",
"T",
">",
"removeEmpty",
"(",
"Collection",
"<",
"T",
">",
"collection",
")",
"{",
"return",
"filter",
"(",
"collection",
",",
"new",
"Filter",
"<",
"T",
">",
"(",
")",
"{... | 去除{@code null}或者"" 元素
@param collection 集合
@return 处理后的集合
@since 3.2.2 | [
"去除",
"{",
"@code",
"null",
"}",
"或者",
"元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1090-L1097 | train | Removes all empty elements from the given collection. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
3074,
1026,
1056,
1028,
6366,
6633,
13876,
2100,
1006,
3074,
1026,
1056,
1028,
3074,
1007,
1063,
2709,
11307,
1006,
3074,
1010,
2047,
11307,
1026,
1056,
1028,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketChunkedInput.java | WebSocketChunkedInput.readChunk | @Deprecated
@Override
public WebSocketFrame readChunk(ChannelHandlerContext ctx) throws Exception {
return readChunk(ctx.alloc());
} | java | @Deprecated
@Override
public WebSocketFrame readChunk(ChannelHandlerContext ctx) throws Exception {
return readChunk(ctx.alloc());
} | [
"@",
"Deprecated",
"@",
"Override",
"public",
"WebSocketFrame",
"readChunk",
"(",
"ChannelHandlerContext",
"ctx",
")",
"throws",
"Exception",
"{",
"return",
"readChunk",
"(",
"ctx",
".",
"alloc",
"(",
")",
")",
";",
"}"
] | @deprecated Use {@link #readChunk(ByteBufAllocator)}.
Fetches a chunked data from the stream. Once this method returns the last chunk
and thus the stream has reached at its end, any subsequent {@link #isEndOfInput()}
call must return {@code true}.
@param ctx {@link ChannelHandlerContext} context of channelHandler
@return {@link WebSocketFrame} contain chunk of data | [
"@deprecated",
"Use",
"{",
"@link",
"#readChunk",
"(",
"ByteBufAllocator",
")",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketChunkedInput.java#L82-L86 | train | Read a chunk of data from the channel. | [
30522,
1030,
2139,
28139,
12921,
1030,
2058,
15637,
2270,
4773,
6499,
19869,
24475,
6444,
2063,
3191,
20760,
8950,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1007,
11618,
6453,
1063,
2709,
3191,
20760,
8950,
1006,
14931,
2595,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslServer.java | SparkSaslServer.dispose | @Override
public synchronized void dispose() {
if (saslServer != null) {
try {
saslServer.dispose();
} catch (SaslException e) {
// ignore
} finally {
saslServer = null;
}
}
} | java | @Override
public synchronized void dispose() {
if (saslServer != null) {
try {
saslServer.dispose();
} catch (SaslException e) {
// ignore
} finally {
saslServer = null;
}
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"dispose",
"(",
")",
"{",
"if",
"(",
"saslServer",
"!=",
"null",
")",
"{",
"try",
"{",
"saslServer",
".",
"dispose",
"(",
")",
";",
"}",
"catch",
"(",
"SaslException",
"e",
")",
"{",
"// ignore",
"}",
... | Disposes of any system resources or security-sensitive information the
SaslServer might be using. | [
"Disposes",
"of",
"any",
"system",
"resources",
"or",
"security",
"-",
"sensitive",
"information",
"the",
"SaslServer",
"might",
"be",
"using",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslServer.java#L129-L140 | train | Dispose of the SASL server. | [
30522,
1030,
2058,
15637,
2270,
25549,
11675,
27764,
1006,
1007,
1063,
2065,
1006,
21871,
4877,
2121,
6299,
999,
1027,
19701,
1007,
1063,
3046,
1063,
21871,
4877,
2121,
6299,
1012,
27764,
1006,
1007,
1025,
1065,
4608,
1006,
21871,
2571,
259... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.file | public static File file(String parent, String path) {
return file(new File(parent), path);
} | java | public static File file(String parent, String path) {
return file(new File(parent), path);
} | [
"public",
"static",
"File",
"file",
"(",
"String",
"parent",
",",
"String",
"path",
")",
"{",
"return",
"file",
"(",
"new",
"File",
"(",
"parent",
")",
",",
"path",
")",
";",
"}"
] | 创建File对象<br>
此方法会检查slip漏洞,漏洞说明见http://blog.nsfocus.net/zip-slip-2/
@param parent 父目录
@param path 文件路径
@return File | [
"创建File对象<br",
">",
"此方法会检查slip漏洞,漏洞说明见http",
":",
"//",
"blog",
".",
"nsfocus",
".",
"net",
"/",
"zip",
"-",
"slip",
"-",
"2",
"/"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L329-L331 | train | Create a File object from a parent directory and a path. | [
30522,
2270,
10763,
5371,
5371,
1006,
5164,
6687,
1010,
5164,
4130,
1007,
1063,
2709,
5371,
1006,
2047,
5371,
1006,
6687,
1007,
1010,
4130,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/server/OneForOneStreamManager.java | OneForOneStreamManager.registerStream | public long registerStream(String appId, Iterator<ManagedBuffer> buffers, Channel channel) {
long myStreamId = nextStreamId.getAndIncrement();
streams.put(myStreamId, new StreamState(appId, buffers, channel));
return myStreamId;
} | java | public long registerStream(String appId, Iterator<ManagedBuffer> buffers, Channel channel) {
long myStreamId = nextStreamId.getAndIncrement();
streams.put(myStreamId, new StreamState(appId, buffers, channel));
return myStreamId;
} | [
"public",
"long",
"registerStream",
"(",
"String",
"appId",
",",
"Iterator",
"<",
"ManagedBuffer",
">",
"buffers",
",",
"Channel",
"channel",
")",
"{",
"long",
"myStreamId",
"=",
"nextStreamId",
".",
"getAndIncrement",
"(",
")",
";",
"streams",
".",
"put",
"... | Registers a stream of ManagedBuffers which are served as individual chunks one at a time to
callers. Each ManagedBuffer will be release()'d after it is transferred on the wire. If a
client connection is closed before the iterator is fully drained, then the remaining buffers
will all be release()'d.
If an app ID is provided, only callers who've authenticated with the given app ID will be
allowed to fetch from this stream.
This method also associates the stream with a single client connection, which is guaranteed
to be the only reader of the stream. Once the connection is closed, the stream will never
be used again, enabling cleanup by `connectionTerminated`. | [
"Registers",
"a",
"stream",
"of",
"ManagedBuffers",
"which",
"are",
"served",
"as",
"individual",
"chunks",
"one",
"at",
"a",
"time",
"to",
"callers",
".",
"Each",
"ManagedBuffer",
"will",
"be",
"release",
"()",
"d",
"after",
"it",
"is",
"transferred",
"on",... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/server/OneForOneStreamManager.java#L198-L202 | train | Registers a new stream. | [
30522,
2270,
2146,
18687,
25379,
1006,
5164,
10439,
3593,
1010,
2009,
6906,
4263,
1026,
3266,
8569,
12494,
1028,
17698,
2015,
1010,
3149,
3149,
1007,
1063,
2146,
2026,
21422,
3593,
1027,
2279,
21422,
3593,
1012,
2131,
5685,
2378,
16748,
367... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/MetricRegistry.java | MetricRegistry.remove | public boolean remove(MetricName name) {
final Metric metric = metrics.remove(name);
if (metric != null) {
onMetricRemoved(name, metric);
return true;
}
return false;
} | java | public boolean remove(MetricName name) {
final Metric metric = metrics.remove(name);
if (metric != null) {
onMetricRemoved(name, metric);
return true;
}
return false;
} | [
"public",
"boolean",
"remove",
"(",
"MetricName",
"name",
")",
"{",
"final",
"Metric",
"metric",
"=",
"metrics",
".",
"remove",
"(",
"name",
")",
";",
"if",
"(",
"metric",
"!=",
"null",
")",
"{",
"onMetricRemoved",
"(",
"name",
",",
"metric",
")",
";",... | Removes the metric with the given name.
@param name the name of the metric
@return whether or not the metric was removed | [
"Removes",
"the",
"metric",
"with",
"the",
"given",
"name",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/MetricRegistry.java#L233-L240 | train | Remove a metric from the set. | [
30522,
2270,
22017,
20898,
6366,
1006,
12046,
18442,
2171,
1007,
1063,
2345,
12046,
12046,
1027,
12046,
2015,
1012,
6366,
1006,
2171,
1007,
1025,
2065,
1006,
12046,
999,
1027,
19701,
1007,
1063,
2006,
12589,
28578,
21818,
2094,
1006,
2171,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.newHashMap | public static <K, V> HashMap<K, V> newHashMap(int size) {
return newHashMap(size, false);
} | java | public static <K, V> HashMap<K, V> newHashMap(int size) {
return newHashMap(size, false);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"HashMap",
"<",
"K",
",",
"V",
">",
"newHashMap",
"(",
"int",
"size",
")",
"{",
"return",
"newHashMap",
"(",
"size",
",",
"false",
")",
";",
"}"
] | 新建一个HashMap
@param <K> Key类型
@param <V> Value类型
@param size 初始大小,由于默认负载因子0.75,传入的size会实际初始大小为size / 0.75
@return HashMap对象 | [
"新建一个HashMap"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L94-L96 | train | Creates a new HashMap with the specified size. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
23325,
2863,
2361,
1026,
1047,
1010,
1058,
1028,
2047,
14949,
22444,
2361,
1006,
20014,
2946,
1007,
1063,
2709,
2047,
14949,
22444,
2361,
1006,
2946,
1010,
6270,
1007,
1025,
1065,
102,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-dfa/src/main/java/cn/hutool/dfa/WordTree.java | WordTree.matchAll | public List<String> matchAll(String text, int limit) {
return matchAll(text, limit, false, false);
} | java | public List<String> matchAll(String text, int limit) {
return matchAll(text, limit, false, false);
} | [
"public",
"List",
"<",
"String",
">",
"matchAll",
"(",
"String",
"text",
",",
"int",
"limit",
")",
"{",
"return",
"matchAll",
"(",
"text",
",",
"limit",
",",
"false",
",",
"false",
")",
";",
"}"
] | 找出所有匹配的关键字
@param text 被检查的文本
@param limit 限制匹配个数
@return 匹配的词列表 | [
"找出所有匹配的关键字"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java#L142-L144 | train | Match all the characters in text. | [
30522,
2270,
2862,
1026,
5164,
1028,
2674,
8095,
1006,
5164,
3793,
1010,
20014,
5787,
1007,
1063,
2709,
2674,
8095,
1006,
3793,
1010,
5787,
1010,
6270,
1010,
6270,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-yarn/src/main/java/org/apache/flink/yarn/AbstractYarnClusterDescriptor.java | AbstractYarnClusterDescriptor.failSessionDuringDeployment | private void failSessionDuringDeployment(YarnClient yarnClient, YarnClientApplication yarnApplication) {
LOG.info("Killing YARN application");
try {
yarnClient.killApplication(yarnApplication.getNewApplicationResponse().getApplicationId());
} catch (Exception e) {
// we only log a debug message here because the "killApplication" call is a best-effort
// call (we don't know if the application has been deployed when the error occured).
LOG.debug("Error while killing YARN application", e);
}
yarnClient.stop();
} | java | private void failSessionDuringDeployment(YarnClient yarnClient, YarnClientApplication yarnApplication) {
LOG.info("Killing YARN application");
try {
yarnClient.killApplication(yarnApplication.getNewApplicationResponse().getApplicationId());
} catch (Exception e) {
// we only log a debug message here because the "killApplication" call is a best-effort
// call (we don't know if the application has been deployed when the error occured).
LOG.debug("Error while killing YARN application", e);
}
yarnClient.stop();
} | [
"private",
"void",
"failSessionDuringDeployment",
"(",
"YarnClient",
"yarnClient",
",",
"YarnClientApplication",
"yarnApplication",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Killing YARN application\"",
")",
";",
"try",
"{",
"yarnClient",
".",
"killApplication",
"(",
"yar... | Kills YARN application and stops YARN client.
<p>Use this method to kill the App before it has been properly deployed | [
"Kills",
"YARN",
"application",
"and",
"stops",
"YARN",
"client",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-yarn/src/main/java/org/apache/flink/yarn/AbstractYarnClusterDescriptor.java#L1196-L1207 | train | Fail session during deployment. | [
30522,
2797,
11675,
11896,
7971,
3258,
24979,
2075,
3207,
24759,
6977,
3672,
1006,
27158,
20464,
11638,
27158,
20464,
11638,
1010,
27158,
20464,
11638,
29098,
19341,
3508,
27158,
29098,
19341,
3508,
1007,
1063,
8833,
1012,
18558,
1006,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.sign | public static Sign sign(SignAlgorithm algorithm, byte[] privateKey, byte[] publicKey) {
return new Sign(algorithm, privateKey, publicKey);
} | java | public static Sign sign(SignAlgorithm algorithm, byte[] privateKey, byte[] publicKey) {
return new Sign(algorithm, privateKey, publicKey);
} | [
"public",
"static",
"Sign",
"sign",
"(",
"SignAlgorithm",
"algorithm",
",",
"byte",
"[",
"]",
"privateKey",
",",
"byte",
"[",
"]",
"publicKey",
")",
"{",
"return",
"new",
"Sign",
"(",
"algorithm",
",",
"privateKey",
",",
"publicKey",
")",
";",
"}"
] | 创建Sign算法对象<br>
私钥和公钥同时为空时生成一对新的私钥和公钥<br>
私钥和公钥可以单独传入一个,如此则只能使用此钥匙来做签名或验证
@param privateKey 私钥
@param publicKey 公钥
@return {@link Sign}
@since 3.3.0 | [
"创建Sign算法对象<br",
">",
"私钥和公钥同时为空时生成一对新的私钥和公钥<br",
">",
"私钥和公钥可以单独传入一个,如此则只能使用此钥匙来做签名或验证"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L817-L819 | train | Creates a sign object. | [
30522,
2270,
10763,
3696,
3696,
1006,
4742,
20255,
8939,
2213,
9896,
1010,
24880,
1031,
1033,
2797,
14839,
1010,
24880,
1031,
1033,
2270,
14839,
1007,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | dump/src/main/java/com/networknt/dump/CookiesDumper.java | CookiesDumper.putDumpInfoTo | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
if(this.cookieMap.size() > 0) {
result.put(DumpConstants.COOKIES, cookieMap);
}
} | java | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
if(this.cookieMap.size() > 0) {
result.put(DumpConstants.COOKIES, cookieMap);
}
} | [
"@",
"Override",
"protected",
"void",
"putDumpInfoTo",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"if",
"(",
"this",
".",
"cookieMap",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"result",
".",
"put",
"(",
"DumpConstants",
".",... | put cookieMap to result
@param result a Map you want to put dumping info to. | [
"put",
"cookieMap",
"to",
"result"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/CookiesDumper.java#L80-L85 | train | Put the dump info to the result map. | [
30522,
1030,
2058,
15637,
5123,
11675,
2404,
8566,
8737,
2378,
14876,
3406,
1006,
4949,
1026,
5164,
1010,
4874,
1028,
2765,
1007,
1063,
2065,
1006,
2023,
1012,
17387,
2863,
2361,
1012,
2946,
1006,
1007,
1028,
1014,
1007,
1063,
2765,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java | TomcatReactiveWebServerFactory.setTomcatProtocolHandlerCustomizers | public void setTomcatProtocolHandlerCustomizers(
Collection<? extends TomcatProtocolHandlerCustomizer<?>> tomcatProtocolHandlerCustomizers) {
Assert.notNull(tomcatProtocolHandlerCustomizers,
"TomcatProtocolHandlerCustomizers must not be null");
this.tomcatProtocolHandlerCustomizers = new ArrayList<>(
tomcatProtocolHandlerCustomizers);
} | java | public void setTomcatProtocolHandlerCustomizers(
Collection<? extends TomcatProtocolHandlerCustomizer<?>> tomcatProtocolHandlerCustomizers) {
Assert.notNull(tomcatProtocolHandlerCustomizers,
"TomcatProtocolHandlerCustomizers must not be null");
this.tomcatProtocolHandlerCustomizers = new ArrayList<>(
tomcatProtocolHandlerCustomizers);
} | [
"public",
"void",
"setTomcatProtocolHandlerCustomizers",
"(",
"Collection",
"<",
"?",
"extends",
"TomcatProtocolHandlerCustomizer",
"<",
"?",
">",
">",
"tomcatProtocolHandlerCustomizers",
")",
"{",
"Assert",
".",
"notNull",
"(",
"tomcatProtocolHandlerCustomizers",
",",
"\... | Set {@link TomcatProtocolHandlerCustomizer}s that should be applied to the Tomcat
{@link Connector}. Calling this method will replace any existing customizers.
@param tomcatProtocolHandlerCustomizers the customizers to set
@since 2.2.0 | [
"Set",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java#L297-L303 | train | Sets the collection of TomcatProtocolHandlerCustomizers to use. | [
30522,
2270,
11675,
2275,
20389,
11266,
21572,
3406,
25778,
11774,
3917,
7874,
20389,
17629,
2015,
1006,
3074,
1026,
1029,
8908,
3419,
11266,
21572,
3406,
25778,
11774,
3917,
7874,
20389,
17629,
1026,
1029,
1028,
1028,
3419,
11266,
21572,
340... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.findLike | public List<Entity> findLike(String tableName, String field, String value, LikeType likeType) throws SQLException {
return findAll(Entity.create(tableName).set(field, SqlUtil.buildLikeValue(value, likeType, true)));
} | java | public List<Entity> findLike(String tableName, String field, String value, LikeType likeType) throws SQLException {
return findAll(Entity.create(tableName).set(field, SqlUtil.buildLikeValue(value, likeType, true)));
} | [
"public",
"List",
"<",
"Entity",
">",
"findLike",
"(",
"String",
"tableName",
",",
"String",
"field",
",",
"String",
"value",
",",
"LikeType",
"likeType",
")",
"throws",
"SQLException",
"{",
"return",
"findAll",
"(",
"Entity",
".",
"create",
"(",
"tableName"... | 根据某个字段名条件查询数据列表,返回所有字段
@param tableName 表名
@param field 字段名
@param value 字段值
@param likeType {@link LikeType}
@return 数据对象列表
@throws SQLException SQL执行异常 | [
"根据某个字段名条件查询数据列表,返回所有字段"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L583-L585 | train | Find all entities that match a given like clause. | [
30522,
2270,
2862,
1026,
9178,
1028,
2424,
10359,
1006,
5164,
2795,
18442,
1010,
5164,
2492,
1010,
5164,
3643,
1010,
2066,
13874,
2066,
13874,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
2424,
8095,
1006,
9178,
1012,
3443,
1006,
2795,
184... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/types/StringValue.java | StringValue.substring | public void substring(StringValue target, int start, int end) {
target.setValue(this, start, end - start);
} | java | public void substring(StringValue target, int start, int end) {
target.setValue(this, start, end - start);
} | [
"public",
"void",
"substring",
"(",
"StringValue",
"target",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"target",
".",
"setValue",
"(",
"this",
",",
"start",
",",
"end",
"-",
"start",
")",
";",
"}"
] | Copies a substring of this string into the given target StringValue. The
substring begins at the given <code>start</code> index and ends at <code>end - 1</code>.
@param target The StringValue object to copy the substring to.
@param start The beginning index, inclusive.
@param end The ending index, exclusive.
@exception IndexOutOfBoundsException
Thrown, if the start is negative, or the end is larger than the length. | [
"Copies",
"a",
"substring",
"of",
"this",
"string",
"into",
"the",
"given",
"target",
"StringValue",
".",
"The",
"substring",
"begins",
"at",
"the",
"given",
"<code",
">",
"start<",
"/",
"code",
">",
"index",
"and",
"ends",
"at",
"<code",
">",
"end",
"-"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/StringValue.java#L312-L314 | train | Sets the substring of this string value to the specified target string value. | [
30522,
2270,
11675,
4942,
3367,
4892,
1006,
5164,
10175,
5657,
4539,
1010,
20014,
2707,
1010,
20014,
2203,
1007,
1063,
4539,
1012,
2275,
10175,
5657,
1006,
2023,
1010,
2707,
1010,
2203,
1011,
2707,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DefaultHttpDataFactory.java | DefaultHttpDataFactory.checkHttpDataSize | private static void checkHttpDataSize(HttpData data) {
try {
data.checkSize(data.length());
} catch (IOException ignored) {
throw new IllegalArgumentException("Attribute bigger than maxSize allowed");
}
} | java | private static void checkHttpDataSize(HttpData data) {
try {
data.checkSize(data.length());
} catch (IOException ignored) {
throw new IllegalArgumentException("Attribute bigger than maxSize allowed");
}
} | [
"private",
"static",
"void",
"checkHttpDataSize",
"(",
"HttpData",
"data",
")",
"{",
"try",
"{",
"data",
".",
"checkSize",
"(",
"data",
".",
"length",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"ignored",
")",
"{",
"throw",
"new",
"IllegalArgu... | Utility method | [
"Utility",
"method"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DefaultHttpDataFactory.java#L176-L182 | train | Check the data size. | [
30522,
2797,
10763,
11675,
4638,
11039,
25856,
2850,
10230,
4697,
1006,
8299,
2850,
2696,
2951,
1007,
1063,
3046,
1063,
2951,
1012,
14148,
4697,
1006,
2951,
1012,
3091,
1006,
1007,
1007,
1025,
1065,
4608,
1006,
22834,
10288,
24422,
6439,
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-optimizer/src/main/java/org/apache/flink/optimizer/plantranslate/JobGraphGenerator.java | JobGraphGenerator.preVisit | @Override
public boolean preVisit(PlanNode node) {
// check if we have visited this node before. in non-tree graphs, this happens
if (this.vertices.containsKey(node) || this.chainedTasks.containsKey(node) || this.iterations.containsKey(node)) {
// return false to prevent further descend
return false;
}
// the vertex to be created for the current node
final JobVertex vertex;
try {
if (node instanceof SinkPlanNode) {
vertex = createDataSinkVertex((SinkPlanNode) node);
}
else if (node instanceof SourcePlanNode) {
vertex = createDataSourceVertex((SourcePlanNode) node);
}
else if (node instanceof BulkIterationPlanNode) {
BulkIterationPlanNode iterationNode = (BulkIterationPlanNode) node;
// for the bulk iteration, we skip creating anything for now. we create the graph
// for the step function in the post visit.
// check that the root of the step function has the same parallelism as the iteration.
// because the tail must have the same parallelism as the head, we can only merge the last
// operator with the tail, if they have the same parallelism. not merging is currently not
// implemented
PlanNode root = iterationNode.getRootOfStepFunction();
if (root.getParallelism() != node.getParallelism())
{
throw new CompilerException("Error: The final operator of the step " +
"function has a different parallelism than the iteration operator itself.");
}
IterationDescriptor descr = new IterationDescriptor(iterationNode, this.iterationIdEnumerator++);
this.iterations.put(iterationNode, descr);
vertex = null;
}
else if (node instanceof WorksetIterationPlanNode) {
WorksetIterationPlanNode iterationNode = (WorksetIterationPlanNode) node;
// we have the same constraints as for the bulk iteration
PlanNode nextWorkSet = iterationNode.getNextWorkSetPlanNode();
PlanNode solutionSetDelta = iterationNode.getSolutionSetDeltaPlanNode();
if (nextWorkSet.getParallelism() != node.getParallelism())
{
throw new CompilerException("It is currently not supported that the final operator of the step " +
"function has a different parallelism than the iteration operator itself.");
}
if (solutionSetDelta.getParallelism() != node.getParallelism())
{
throw new CompilerException("It is currently not supported that the final operator of the step " +
"function has a different parallelism than the iteration operator itself.");
}
IterationDescriptor descr = new IterationDescriptor(iterationNode, this.iterationIdEnumerator++);
this.iterations.put(iterationNode, descr);
vertex = null;
}
else if (node instanceof SingleInputPlanNode) {
vertex = createSingleInputVertex((SingleInputPlanNode) node);
}
else if (node instanceof DualInputPlanNode) {
vertex = createDualInputVertex((DualInputPlanNode) node);
}
else if (node instanceof NAryUnionPlanNode) {
// skip the union for now
vertex = null;
}
else if (node instanceof BulkPartialSolutionPlanNode) {
// create a head node (or not, if it is merged into its successor)
vertex = createBulkIterationHead((BulkPartialSolutionPlanNode) node);
}
else if (node instanceof SolutionSetPlanNode) {
// this represents an access into the solution set index.
// we do not create a vertex for the solution set here (we create the head at the workset place holder)
// we adjust the joins / cogroups that go into the solution set here
for (Channel c : node.getOutgoingChannels()) {
DualInputPlanNode target = (DualInputPlanNode) c.getTarget();
JobVertex accessingVertex = this.vertices.get(target);
TaskConfig conf = new TaskConfig(accessingVertex.getConfiguration());
int inputNum = c == target.getInput1() ? 0 : c == target.getInput2() ? 1 : -1;
// sanity checks
if (inputNum == -1) {
throw new CompilerException();
}
// adjust the driver
if (conf.getDriver().equals(JoinDriver.class)) {
conf.setDriver(inputNum == 0 ? JoinWithSolutionSetFirstDriver.class : JoinWithSolutionSetSecondDriver.class);
}
else if (conf.getDriver().equals(CoGroupDriver.class)) {
conf.setDriver(inputNum == 0 ? CoGroupWithSolutionSetFirstDriver.class : CoGroupWithSolutionSetSecondDriver.class);
}
else {
throw new CompilerException("Found join with solution set using incompatible operator (only Join/CoGroup are valid).");
}
}
// make sure we do not visit this node again. for that, we add a 'already seen' entry into one of the sets
this.chainedTasks.put(node, ALREADY_VISITED_PLACEHOLDER);
vertex = null;
}
else if (node instanceof WorksetPlanNode) {
// create the iteration head here
vertex = createWorksetIterationHead((WorksetPlanNode) node);
}
else {
throw new CompilerException("Unrecognized node type: " + node.getClass().getName());
}
}
catch (Exception e) {
throw new CompilerException("Error translating node '" + node + "': " + e.getMessage(), e);
}
// check if a vertex was created, or if it was chained or skipped
if (vertex != null) {
// set parallelism
int pd = node.getParallelism();
vertex.setParallelism(pd);
vertex.setMaxParallelism(pd);
vertex.setSlotSharingGroup(sharingGroup);
// check whether this vertex is part of an iteration step function
if (this.currentIteration != null) {
// check that the task has the same parallelism as the iteration as such
PlanNode iterationNode = (PlanNode) this.currentIteration;
if (iterationNode.getParallelism() < pd) {
throw new CompilerException("Error: All functions that are part of an iteration must have the same, or a lower, parallelism than the iteration operator.");
}
// store the id of the iterations the step functions participate in
IterationDescriptor descr = this.iterations.get(this.currentIteration);
new TaskConfig(vertex.getConfiguration()).setIterationId(descr.getId());
}
// store in the map
this.vertices.put(node, vertex);
}
// returning true causes deeper descend
return true;
} | java | @Override
public boolean preVisit(PlanNode node) {
// check if we have visited this node before. in non-tree graphs, this happens
if (this.vertices.containsKey(node) || this.chainedTasks.containsKey(node) || this.iterations.containsKey(node)) {
// return false to prevent further descend
return false;
}
// the vertex to be created for the current node
final JobVertex vertex;
try {
if (node instanceof SinkPlanNode) {
vertex = createDataSinkVertex((SinkPlanNode) node);
}
else if (node instanceof SourcePlanNode) {
vertex = createDataSourceVertex((SourcePlanNode) node);
}
else if (node instanceof BulkIterationPlanNode) {
BulkIterationPlanNode iterationNode = (BulkIterationPlanNode) node;
// for the bulk iteration, we skip creating anything for now. we create the graph
// for the step function in the post visit.
// check that the root of the step function has the same parallelism as the iteration.
// because the tail must have the same parallelism as the head, we can only merge the last
// operator with the tail, if they have the same parallelism. not merging is currently not
// implemented
PlanNode root = iterationNode.getRootOfStepFunction();
if (root.getParallelism() != node.getParallelism())
{
throw new CompilerException("Error: The final operator of the step " +
"function has a different parallelism than the iteration operator itself.");
}
IterationDescriptor descr = new IterationDescriptor(iterationNode, this.iterationIdEnumerator++);
this.iterations.put(iterationNode, descr);
vertex = null;
}
else if (node instanceof WorksetIterationPlanNode) {
WorksetIterationPlanNode iterationNode = (WorksetIterationPlanNode) node;
// we have the same constraints as for the bulk iteration
PlanNode nextWorkSet = iterationNode.getNextWorkSetPlanNode();
PlanNode solutionSetDelta = iterationNode.getSolutionSetDeltaPlanNode();
if (nextWorkSet.getParallelism() != node.getParallelism())
{
throw new CompilerException("It is currently not supported that the final operator of the step " +
"function has a different parallelism than the iteration operator itself.");
}
if (solutionSetDelta.getParallelism() != node.getParallelism())
{
throw new CompilerException("It is currently not supported that the final operator of the step " +
"function has a different parallelism than the iteration operator itself.");
}
IterationDescriptor descr = new IterationDescriptor(iterationNode, this.iterationIdEnumerator++);
this.iterations.put(iterationNode, descr);
vertex = null;
}
else if (node instanceof SingleInputPlanNode) {
vertex = createSingleInputVertex((SingleInputPlanNode) node);
}
else if (node instanceof DualInputPlanNode) {
vertex = createDualInputVertex((DualInputPlanNode) node);
}
else if (node instanceof NAryUnionPlanNode) {
// skip the union for now
vertex = null;
}
else if (node instanceof BulkPartialSolutionPlanNode) {
// create a head node (or not, if it is merged into its successor)
vertex = createBulkIterationHead((BulkPartialSolutionPlanNode) node);
}
else if (node instanceof SolutionSetPlanNode) {
// this represents an access into the solution set index.
// we do not create a vertex for the solution set here (we create the head at the workset place holder)
// we adjust the joins / cogroups that go into the solution set here
for (Channel c : node.getOutgoingChannels()) {
DualInputPlanNode target = (DualInputPlanNode) c.getTarget();
JobVertex accessingVertex = this.vertices.get(target);
TaskConfig conf = new TaskConfig(accessingVertex.getConfiguration());
int inputNum = c == target.getInput1() ? 0 : c == target.getInput2() ? 1 : -1;
// sanity checks
if (inputNum == -1) {
throw new CompilerException();
}
// adjust the driver
if (conf.getDriver().equals(JoinDriver.class)) {
conf.setDriver(inputNum == 0 ? JoinWithSolutionSetFirstDriver.class : JoinWithSolutionSetSecondDriver.class);
}
else if (conf.getDriver().equals(CoGroupDriver.class)) {
conf.setDriver(inputNum == 0 ? CoGroupWithSolutionSetFirstDriver.class : CoGroupWithSolutionSetSecondDriver.class);
}
else {
throw new CompilerException("Found join with solution set using incompatible operator (only Join/CoGroup are valid).");
}
}
// make sure we do not visit this node again. for that, we add a 'already seen' entry into one of the sets
this.chainedTasks.put(node, ALREADY_VISITED_PLACEHOLDER);
vertex = null;
}
else if (node instanceof WorksetPlanNode) {
// create the iteration head here
vertex = createWorksetIterationHead((WorksetPlanNode) node);
}
else {
throw new CompilerException("Unrecognized node type: " + node.getClass().getName());
}
}
catch (Exception e) {
throw new CompilerException("Error translating node '" + node + "': " + e.getMessage(), e);
}
// check if a vertex was created, or if it was chained or skipped
if (vertex != null) {
// set parallelism
int pd = node.getParallelism();
vertex.setParallelism(pd);
vertex.setMaxParallelism(pd);
vertex.setSlotSharingGroup(sharingGroup);
// check whether this vertex is part of an iteration step function
if (this.currentIteration != null) {
// check that the task has the same parallelism as the iteration as such
PlanNode iterationNode = (PlanNode) this.currentIteration;
if (iterationNode.getParallelism() < pd) {
throw new CompilerException("Error: All functions that are part of an iteration must have the same, or a lower, parallelism than the iteration operator.");
}
// store the id of the iterations the step functions participate in
IterationDescriptor descr = this.iterations.get(this.currentIteration);
new TaskConfig(vertex.getConfiguration()).setIterationId(descr.getId());
}
// store in the map
this.vertices.put(node, vertex);
}
// returning true causes deeper descend
return true;
} | [
"@",
"Override",
"public",
"boolean",
"preVisit",
"(",
"PlanNode",
"node",
")",
"{",
"// check if we have visited this node before. in non-tree graphs, this happens",
"if",
"(",
"this",
".",
"vertices",
".",
"containsKey",
"(",
"node",
")",
"||",
"this",
".",
"chained... | This methods implements the pre-visiting during a depth-first traversal. It create the job vertex and
sets local strategy.
@param node
The node that is currently processed.
@return True, if the visitor should descend to the node's children, false if not.
@see org.apache.flink.util.Visitor#preVisit(org.apache.flink.util.Visitable) | [
"This",
"methods",
"implements",
"the",
"pre",
"-",
"visiting",
"during",
"a",
"depth",
"-",
"first",
"traversal",
".",
"It",
"create",
"the",
"job",
"vertex",
"and",
"sets",
"local",
"strategy",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/plantranslate/JobGraphGenerator.java#L315-L461 | train | This method is called before the node is visited. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
3653,
11365,
4183,
1006,
2933,
3630,
3207,
13045,
1007,
1063,
1013,
1013,
4638,
2065,
2057,
2031,
4716,
2023,
13045,
2077,
1012,
1999,
2512,
30524,
1064,
1064,
2023,
1012,
22075,
10230,
5705,
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/text/csv/CsvReader.java | CsvReader.read | public CsvData read(File file, Charset charset) throws IORuntimeException {
return read(Objects.requireNonNull(file.toPath(), "file must not be null"), charset);
} | java | public CsvData read(File file, Charset charset) throws IORuntimeException {
return read(Objects.requireNonNull(file.toPath(), "file must not be null"), charset);
} | [
"public",
"CsvData",
"read",
"(",
"File",
"file",
",",
"Charset",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"read",
"(",
"Objects",
".",
"requireNonNull",
"(",
"file",
".",
"toPath",
"(",
")",
",",
"\"file must not be null\"",
")",
",",
... | 读取CSV文件
@param file CSV文件
@param charset 文件编码,默认系统编码
@return {@link CsvData},包含数据列表和行信息
@throws IORuntimeException IO异常 | [
"读取CSV文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvReader.java#L108-L110 | train | Reads a CSV file from a file. | [
30522,
2270,
20116,
16872,
6790,
3191,
1006,
5371,
5371,
1010,
25869,
13462,
25869,
13462,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
3191,
1006,
5200,
1012,
5478,
8540,
11231,
3363,
1006,
5371,
1012,
2327,
8988,
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-cache/src/main/java/cn/hutool/cache/impl/TimedCache.java | TimedCache.schedulePrune | public void schedulePrune(long delay) {
this.pruneJobFuture = GlobalPruneTimer.INSTANCE.schedule(new Runnable() {
@Override
public void run() {
prune();
}
}, delay);
} | java | public void schedulePrune(long delay) {
this.pruneJobFuture = GlobalPruneTimer.INSTANCE.schedule(new Runnable() {
@Override
public void run() {
prune();
}
}, delay);
} | [
"public",
"void",
"schedulePrune",
"(",
"long",
"delay",
")",
"{",
"this",
".",
"pruneJobFuture",
"=",
"GlobalPruneTimer",
".",
"INSTANCE",
".",
"schedule",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"... | 定时清理
@param delay 间隔时长,单位毫秒 | [
"定时清理"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cache/src/main/java/cn/hutool/cache/impl/TimedCache.java#L73-L80 | train | Schedules a prune job to be executed. | [
30522,
2270,
11675,
6134,
18098,
9816,
1006,
2146,
8536,
1007,
1063,
2023,
1012,
10975,
9816,
5558,
29292,
4904,
5397,
1027,
3795,
18098,
9816,
7292,
2099,
1012,
6013,
1012,
6134,
1006,
2047,
2448,
22966,
1006,
1007,
1063,
1030,
2058,
15637... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Redisson.java | Redisson.create | public static RedissonClient create(Config config) {
Redisson redisson = new Redisson(config);
if (config.isReferenceEnabled()) {
redisson.enableRedissonReferenceSupport();
}
return redisson;
} | java | public static RedissonClient create(Config config) {
Redisson redisson = new Redisson(config);
if (config.isReferenceEnabled()) {
redisson.enableRedissonReferenceSupport();
}
return redisson;
} | [
"public",
"static",
"RedissonClient",
"create",
"(",
"Config",
"config",
")",
"{",
"Redisson",
"redisson",
"=",
"new",
"Redisson",
"(",
"config",
")",
";",
"if",
"(",
"config",
".",
"isReferenceEnabled",
"(",
")",
")",
"{",
"redisson",
".",
"enableRedissonRe... | Create sync/async Redisson instance with provided config
@param config for Redisson
@return Redisson instance | [
"Create",
"sync",
"/",
"async",
"Redisson",
"instance",
"with",
"provided",
"config"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/Redisson.java#L158-L164 | train | Create a Redisson client with the specified configuration. | [
30522,
2270,
10763,
2417,
24077,
20464,
11638,
3443,
1006,
9530,
8873,
2290,
9530,
8873,
2290,
1007,
1063,
2417,
24077,
2417,
24077,
1027,
2047,
2417,
24077,
1006,
9530,
8873,
2290,
1007,
1025,
2065,
1006,
9530,
8873,
2290,
1012,
2003,
2890... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.validateNoAggs | private void validateNoAggs(AggFinder aggFinder, SqlNode node,
String clause) {
final SqlCall agg = aggFinder.findAgg(node);
if (agg == null) {
return;
}
final SqlOperator op = agg.getOperator();
if (op == SqlStdOperatorTable.OVER) {
throw newValidationError(agg,
RESOURCE.windowedAggregateIllegalInClause(clause));
} else if (op.isGroup() || op.isGroupAuxiliary()) {
throw newValidationError(agg,
RESOURCE.groupFunctionMustAppearInGroupByClause(op.getName()));
} else {
throw newValidationError(agg,
RESOURCE.aggregateIllegalInClause(clause));
}
} | java | private void validateNoAggs(AggFinder aggFinder, SqlNode node,
String clause) {
final SqlCall agg = aggFinder.findAgg(node);
if (agg == null) {
return;
}
final SqlOperator op = agg.getOperator();
if (op == SqlStdOperatorTable.OVER) {
throw newValidationError(agg,
RESOURCE.windowedAggregateIllegalInClause(clause));
} else if (op.isGroup() || op.isGroupAuxiliary()) {
throw newValidationError(agg,
RESOURCE.groupFunctionMustAppearInGroupByClause(op.getName()));
} else {
throw newValidationError(agg,
RESOURCE.aggregateIllegalInClause(clause));
}
} | [
"private",
"void",
"validateNoAggs",
"(",
"AggFinder",
"aggFinder",
",",
"SqlNode",
"node",
",",
"String",
"clause",
")",
"{",
"final",
"SqlCall",
"agg",
"=",
"aggFinder",
".",
"findAgg",
"(",
"node",
")",
";",
"if",
"(",
"agg",
"==",
"null",
")",
"{",
... | Throws an error if there is an aggregate or windowed aggregate in the
given clause.
@param aggFinder Finder for the particular kind(s) of aggregate function
@param node Parse tree
@param clause Name of clause: "WHERE", "GROUP BY", "ON" | [
"Throws",
"an",
"error",
"if",
"there",
"is",
"an",
"aggregate",
"or",
"windowed",
"aggregate",
"in",
"the",
"given",
"clause",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3208-L3225 | train | Validate no aggregation. | [
30522,
2797,
11675,
9398,
3686,
3630,
8490,
5620,
1006,
12943,
25708,
22254,
2121,
12943,
25708,
22254,
2121,
1010,
29296,
3630,
3207,
13045,
1010,
5164,
11075,
1007,
1063,
2345,
29296,
9289,
2140,
12943,
2290,
1027,
12943,
25708,
22254,
2121... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dml/PredicateUtils.java | PredicateUtils.findTableName | public static Optional<String> findTableName(final PredicateSegment predicateSegment, final SQLStatement sqlStatement, final ShardingTableMetaData shardingTableMetaData) {
if (!(sqlStatement instanceof SelectStatement)) {
return Optional.of(sqlStatement.getTables().getSingleTableName());
}
SelectStatement currentSelectStatement = (SelectStatement) sqlStatement;
while (null != currentSelectStatement.getParentStatement()) {
currentSelectStatement = currentSelectStatement.getParentStatement();
Optional<String> tableName = findTableName(predicateSegment, currentSelectStatement.getTables(), shardingTableMetaData);
if (tableName.isPresent()) {
return tableName;
}
}
return findTableName(predicateSegment, currentSelectStatement.getTables(), shardingTableMetaData);
} | java | public static Optional<String> findTableName(final PredicateSegment predicateSegment, final SQLStatement sqlStatement, final ShardingTableMetaData shardingTableMetaData) {
if (!(sqlStatement instanceof SelectStatement)) {
return Optional.of(sqlStatement.getTables().getSingleTableName());
}
SelectStatement currentSelectStatement = (SelectStatement) sqlStatement;
while (null != currentSelectStatement.getParentStatement()) {
currentSelectStatement = currentSelectStatement.getParentStatement();
Optional<String> tableName = findTableName(predicateSegment, currentSelectStatement.getTables(), shardingTableMetaData);
if (tableName.isPresent()) {
return tableName;
}
}
return findTableName(predicateSegment, currentSelectStatement.getTables(), shardingTableMetaData);
} | [
"public",
"static",
"Optional",
"<",
"String",
">",
"findTableName",
"(",
"final",
"PredicateSegment",
"predicateSegment",
",",
"final",
"SQLStatement",
"sqlStatement",
",",
"final",
"ShardingTableMetaData",
"shardingTableMetaData",
")",
"{",
"if",
"(",
"!",
"(",
"s... | TODO hongjun: find table from parent select statement, should find table in subquery level only | [
"TODO",
"hongjun",
":",
"find",
"table",
"from",
"parent",
"select",
"statement",
"should",
"find",
"table",
"in",
"subquery",
"level",
"only"
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dml/PredicateUtils.java#L58-L71 | train | Find table name. | [
30522,
2270,
10763,
11887,
1026,
5164,
1028,
2424,
10880,
18442,
1006,
2345,
3653,
16467,
3366,
21693,
4765,
3653,
16467,
3366,
21693,
4765,
1010,
2345,
29296,
9153,
18532,
4765,
29296,
9153,
18532,
4765,
1010,
2345,
21146,
17080,
3070,
10880... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/UnsortedGrouping.java | UnsortedGrouping.sortGroup | public SortedGrouping<T> sortGroup(int field, Order order) {
if (this.getKeys() instanceof Keys.SelectorFunctionKeys) {
throw new InvalidProgramException("KeySelector grouping keys and field index group-sorting keys cannot be used together.");
}
SortedGrouping<T> sg = new SortedGrouping<T>(this.inputDataSet, this.keys, field, order);
sg.customPartitioner = getCustomPartitioner();
return sg;
} | java | public SortedGrouping<T> sortGroup(int field, Order order) {
if (this.getKeys() instanceof Keys.SelectorFunctionKeys) {
throw new InvalidProgramException("KeySelector grouping keys and field index group-sorting keys cannot be used together.");
}
SortedGrouping<T> sg = new SortedGrouping<T>(this.inputDataSet, this.keys, field, order);
sg.customPartitioner = getCustomPartitioner();
return sg;
} | [
"public",
"SortedGrouping",
"<",
"T",
">",
"sortGroup",
"(",
"int",
"field",
",",
"Order",
"order",
")",
"{",
"if",
"(",
"this",
".",
"getKeys",
"(",
")",
"instanceof",
"Keys",
".",
"SelectorFunctionKeys",
")",
"{",
"throw",
"new",
"InvalidProgramException",... | Sorts {@link org.apache.flink.api.java.tuple.Tuple} elements within a group on the specified field in the specified {@link Order}.
<p><b>Note: Only groups of Tuple elements and Pojos can be sorted.</b>
<p>Groups can be sorted by multiple fields by chaining {@link #sortGroup(int, Order)} calls.
@param field The Tuple field on which the group is sorted.
@param order The Order in which the specified Tuple field is sorted.
@return A SortedGrouping with specified order of group element.
@see org.apache.flink.api.java.tuple.Tuple
@see Order | [
"Sorts",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"api",
".",
"java",
".",
"tuple",
".",
"Tuple",
"}",
"elements",
"within",
"a",
"group",
"on",
"the",
"specified",
"field",
"in",
"the",
"specified",
"{",
"@link",
"Order",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/UnsortedGrouping.java#L271-L279 | train | Sort the data set using the specified field and order. | [
30522,
2270,
19616,
17058,
2075,
1026,
1056,
1028,
4066,
17058,
1006,
20014,
2492,
1010,
2344,
2344,
1007,
1063,
2065,
1006,
2023,
1012,
2131,
14839,
2015,
1006,
1007,
6013,
11253,
6309,
1012,
27000,
11263,
27989,
14839,
2015,
1007,
1063,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.subPath | public static String subPath(String dirPath, String filePath) {
if (StrUtil.isNotEmpty(dirPath) && StrUtil.isNotEmpty(filePath)) {
dirPath = StrUtil.removeSuffix(normalize(dirPath), "/");
filePath = normalize(filePath);
final String result = StrUtil.removePrefixIgnoreCase(filePath, dirPath);
return StrUtil.removePrefix(result, "/");
}
return filePath;
} | java | public static String subPath(String dirPath, String filePath) {
if (StrUtil.isNotEmpty(dirPath) && StrUtil.isNotEmpty(filePath)) {
dirPath = StrUtil.removeSuffix(normalize(dirPath), "/");
filePath = normalize(filePath);
final String result = StrUtil.removePrefixIgnoreCase(filePath, dirPath);
return StrUtil.removePrefix(result, "/");
}
return filePath;
} | [
"public",
"static",
"String",
"subPath",
"(",
"String",
"dirPath",
",",
"String",
"filePath",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isNotEmpty",
"(",
"dirPath",
")",
"&&",
"StrUtil",
".",
"isNotEmpty",
"(",
"filePath",
")",
")",
"{",
"dirPath",
"=",
"Str... | 获得相对子路径,忽略大小写
栗子:
<pre>
dirPath: d:/aaa/bbb filePath: d:/aaa/bbb/ccc =》 ccc
dirPath: d:/Aaa/bbb filePath: d:/aaa/bbb/ccc.txt =》 ccc.txt
dirPath: d:/Aaa/bbb filePath: d:/aaa/bbb/ =》 ""
</pre>
@param dirPath 父路径
@param filePath 文件路径
@return 相对子路径 | [
"获得相对子路径,忽略大小写"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1622-L1632 | train | Returns the sub path of the given directory and file path. | [
30522,
2270,
10763,
5164,
4942,
15069,
1006,
5164,
16101,
15069,
1010,
5164,
5371,
15069,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
3475,
12184,
27718,
2100,
1006,
16101,
15069,
1007,
1004,
1004,
2358,
22134,
4014,
1012,
3475,
12184,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java | FastDateFormat.getInstance | public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone, final Locale locale) {
return cache.getInstance(pattern, timeZone, locale);
} | java | public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone, final Locale locale) {
return cache.getInstance(pattern, timeZone, locale);
} | [
"public",
"static",
"FastDateFormat",
"getInstance",
"(",
"final",
"String",
"pattern",
",",
"final",
"TimeZone",
"timeZone",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"cache",
".",
"getInstance",
"(",
"pattern",
",",
"timeZone",
",",
"locale",
")"... | 获得 {@link FastDateFormat} 实例<br>
支持缓存
@param pattern 使用{@link java.text.SimpleDateFormat} 相同的日期格式
@param timeZone 时区{@link TimeZone}
@param locale {@link Locale} 日期地理位置
@return {@link FastDateFormat}
@throws IllegalArgumentException 日期格式问题 | [
"获得",
"{",
"@link",
"FastDateFormat",
"}",
"实例<br",
">",
"支持缓存"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L109-L111 | train | Gets the FastDateFormat instance. | [
30522,
2270,
10763,
3435,
13701,
14192,
4017,
2131,
7076,
26897,
1006,
2345,
5164,
5418,
1010,
2345,
2051,
15975,
2051,
15975,
1010,
2345,
2334,
2063,
2334,
2063,
1007,
1063,
2709,
17053,
1012,
2131,
7076,
26897,
1006,
5418,
1010,
2051,
159... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/Buckets.java | Buckets.initializeState | void initializeState(final ListState<byte[]> bucketStates, final ListState<Long> partCounterState) throws Exception {
initializePartCounter(partCounterState);
LOG.info("Subtask {} initializing its state (max part counter={}).", subtaskIndex, maxPartCounter);
initializeActiveBuckets(bucketStates);
} | java | void initializeState(final ListState<byte[]> bucketStates, final ListState<Long> partCounterState) throws Exception {
initializePartCounter(partCounterState);
LOG.info("Subtask {} initializing its state (max part counter={}).", subtaskIndex, maxPartCounter);
initializeActiveBuckets(bucketStates);
} | [
"void",
"initializeState",
"(",
"final",
"ListState",
"<",
"byte",
"[",
"]",
">",
"bucketStates",
",",
"final",
"ListState",
"<",
"Long",
">",
"partCounterState",
")",
"throws",
"Exception",
"{",
"initializePartCounter",
"(",
"partCounterState",
")",
";",
"LOG",... | Initializes the state after recovery from a failure.
<p>During this process:
<ol>
<li>we set the initial value for part counter to the maximum value used before across all tasks and buckets.
This guarantees that we do not overwrite valid data,</li>
<li>we commit any pending files for previous checkpoints (previous to the last successful one from which we restore),</li>
<li>we resume writing to the previous in-progress file of each bucket, and</li>
<li>if we receive multiple states for the same bucket, we merge them.</li>
</ol>
@param bucketStates the state holding recovered state about active buckets.
@param partCounterState the state holding the max previously used part counters.
@throws Exception if anything goes wrong during retrieving the state or restoring/committing of any
in-progress/pending part files | [
"Initializes",
"the",
"state",
"after",
"recovery",
"from",
"a",
"failure",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/Buckets.java#L143-L150 | train | Initialize the state of the subtask. | [
30522,
11675,
3988,
10057,
12259,
1006,
2345,
7201,
12259,
1026,
24880,
1031,
1033,
1028,
13610,
9153,
4570,
1010,
2345,
7201,
12259,
1026,
2146,
1028,
2112,
3597,
16671,
2545,
12259,
1007,
11618,
6453,
1063,
3988,
4697,
19362,
13535,
21723,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java | ExecutionGraph.scheduleOrUpdateConsumers | public void scheduleOrUpdateConsumers(ResultPartitionID partitionId) throws ExecutionGraphException {
assertRunningInJobMasterMainThread();
final Execution execution = currentExecutions.get(partitionId.getProducerId());
if (execution == null) {
throw new ExecutionGraphException("Cannot find execution for execution Id " +
partitionId.getPartitionId() + '.');
}
else if (execution.getVertex() == null){
throw new ExecutionGraphException("Execution with execution Id " +
partitionId.getPartitionId() + " has no vertex assigned.");
} else {
execution.getVertex().scheduleOrUpdateConsumers(partitionId);
}
} | java | public void scheduleOrUpdateConsumers(ResultPartitionID partitionId) throws ExecutionGraphException {
assertRunningInJobMasterMainThread();
final Execution execution = currentExecutions.get(partitionId.getProducerId());
if (execution == null) {
throw new ExecutionGraphException("Cannot find execution for execution Id " +
partitionId.getPartitionId() + '.');
}
else if (execution.getVertex() == null){
throw new ExecutionGraphException("Execution with execution Id " +
partitionId.getPartitionId() + " has no vertex assigned.");
} else {
execution.getVertex().scheduleOrUpdateConsumers(partitionId);
}
} | [
"public",
"void",
"scheduleOrUpdateConsumers",
"(",
"ResultPartitionID",
"partitionId",
")",
"throws",
"ExecutionGraphException",
"{",
"assertRunningInJobMasterMainThread",
"(",
")",
";",
"final",
"Execution",
"execution",
"=",
"currentExecutions",
".",
"get",
"(",
"parti... | Schedule or updates consumers of the given result partition.
@param partitionId specifying the result partition whose consumer shall be scheduled or updated
@throws ExecutionGraphException if the schedule or update consumers operation could not be executed | [
"Schedule",
"or",
"updates",
"consumers",
"of",
"the",
"given",
"result",
"partition",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java#L1622-L1638 | train | Schedules or updates consumers for the given partition. | [
30522,
2270,
11675,
6134,
2953,
6279,
13701,
8663,
23545,
2869,
1006,
2765,
19362,
3775,
3508,
3593,
13571,
3593,
1007,
11618,
7781,
14413,
10288,
24422,
1063,
20865,
15532,
5582,
2378,
5558,
25526,
24268,
24238,
2705,
16416,
2094,
1006,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java | CompositeByteBuf.consolidate | public CompositeByteBuf consolidate() {
ensureAccessible();
final int numComponents = componentCount;
if (numComponents <= 1) {
return this;
}
final int capacity = components[numComponents - 1].endOffset;
final ByteBuf consolidated = allocBuffer(capacity);
for (int i = 0; i < numComponents; i ++) {
components[i].transferTo(consolidated);
}
lastAccessed = null;
components[0] = new Component(consolidated, 0, 0, capacity, consolidated);
removeCompRange(1, numComponents);
return this;
} | java | public CompositeByteBuf consolidate() {
ensureAccessible();
final int numComponents = componentCount;
if (numComponents <= 1) {
return this;
}
final int capacity = components[numComponents - 1].endOffset;
final ByteBuf consolidated = allocBuffer(capacity);
for (int i = 0; i < numComponents; i ++) {
components[i].transferTo(consolidated);
}
lastAccessed = null;
components[0] = new Component(consolidated, 0, 0, capacity, consolidated);
removeCompRange(1, numComponents);
return this;
} | [
"public",
"CompositeByteBuf",
"consolidate",
"(",
")",
"{",
"ensureAccessible",
"(",
")",
";",
"final",
"int",
"numComponents",
"=",
"componentCount",
";",
"if",
"(",
"numComponents",
"<=",
"1",
")",
"{",
"return",
"this",
";",
"}",
"final",
"int",
"capacity... | Consolidate the composed {@link ByteBuf}s | [
"Consolidate",
"the",
"composed",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L1684-L1701 | train | Consolidates this CompositeByteBuf. | [
30522,
2270,
12490,
3762,
2618,
8569,
2546,
24939,
1006,
1007,
1063,
5676,
6305,
9623,
19307,
1006,
1007,
1025,
2345,
20014,
16371,
12458,
25377,
5643,
7666,
1027,
6922,
3597,
16671,
1025,
2065,
1006,
16371,
12458,
25377,
5643,
7666,
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... |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannelConfig.java | EpollDatagramChannelConfig.setReusePort | public EpollDatagramChannelConfig setReusePort(boolean reusePort) {
try {
((EpollDatagramChannel) channel).socket.setReusePort(reusePort);
return this;
} catch (IOException e) {
throw new ChannelException(e);
}
} | java | public EpollDatagramChannelConfig setReusePort(boolean reusePort) {
try {
((EpollDatagramChannel) channel).socket.setReusePort(reusePort);
return this;
} catch (IOException e) {
throw new ChannelException(e);
}
} | [
"public",
"EpollDatagramChannelConfig",
"setReusePort",
"(",
"boolean",
"reusePort",
")",
"{",
"try",
"{",
"(",
"(",
"EpollDatagramChannel",
")",
"channel",
")",
".",
"socket",
".",
"setReusePort",
"(",
"reusePort",
")",
";",
"return",
"this",
";",
"}",
"catch... | Set the SO_REUSEPORT option on the underlying Channel. This will allow to bind multiple
{@link EpollSocketChannel}s to the same port and so accept connections with multiple threads.
Be aware this method needs be called before {@link EpollDatagramChannel#bind(java.net.SocketAddress)} to have
any affect. | [
"Set",
"the",
"SO_REUSEPORT",
"option",
"on",
"the",
"underlying",
"Channel",
".",
"This",
"will",
"allow",
"to",
"bind",
"multiple",
"{",
"@link",
"EpollSocketChannel",
"}",
"s",
"to",
"the",
"same",
"port",
"and",
"so",
"accept",
"connections",
"with",
"mu... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannelConfig.java#L381-L388 | train | Sets whether the socket should be used to reuse the port. | [
30522,
2270,
4958,
14511,
2850,
23091,
26058,
8663,
8873,
2290,
2275,
23446,
13699,
11589,
1006,
22017,
20898,
2128,
8557,
6442,
1007,
1063,
3046,
1063,
1006,
1006,
4958,
14511,
2850,
23091,
26058,
1007,
3149,
1007,
1012,
22278,
1012,
2275,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/TaskTable.java | TaskTable.getTask | public Task getTask(int index) {
final Lock readLock = lock.readLock();
try {
readLock.lock();
return tasks.get(index);
} finally {
readLock.unlock();
}
} | java | public Task getTask(int index) {
final Lock readLock = lock.readLock();
try {
readLock.lock();
return tasks.get(index);
} finally {
readLock.unlock();
}
} | [
"public",
"Task",
"getTask",
"(",
"int",
"index",
")",
"{",
"final",
"Lock",
"readLock",
"=",
"lock",
".",
"readLock",
"(",
")",
";",
"try",
"{",
"readLock",
".",
"lock",
"(",
")",
";",
"return",
"tasks",
".",
"get",
"(",
"index",
")",
";",
"}",
... | 获得指定位置的{@link Task}
@param index 位置
@return {@link Task}
@since 3.1.1 | [
"获得指定位置的",
"{",
"@link",
"Task",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/TaskTable.java#L118-L126 | train | Gets the Task with the specified index from this object. | [
30522,
2270,
4708,
2131,
10230,
2243,
1006,
20014,
5950,
1007,
1063,
2345,
5843,
3191,
7878,
1027,
5843,
1012,
3191,
7878,
1006,
1007,
1025,
3046,
1063,
3191,
7878,
1012,
5843,
1006,
1007,
1025,
2709,
8518,
1012,
2131,
1006,
5950,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimersSnapshotReaderWriters.java | InternalTimersSnapshotReaderWriters.getReaderForVersion | public static <K, N> InternalTimersSnapshotReader<K, N> getReaderForVersion(
int version, ClassLoader userCodeClassLoader) {
switch (version) {
case NO_VERSION:
return new InternalTimersSnapshotReaderPreVersioned<>(userCodeClassLoader);
case 1:
return new InternalTimersSnapshotReaderV1<>(userCodeClassLoader);
case InternalTimerServiceSerializationProxy.VERSION:
return new InternalTimersSnapshotReaderV2<>(userCodeClassLoader);
default:
// guard for future
throw new IllegalStateException(
"Unrecognized internal timers snapshot writer version: " + version);
}
} | java | public static <K, N> InternalTimersSnapshotReader<K, N> getReaderForVersion(
int version, ClassLoader userCodeClassLoader) {
switch (version) {
case NO_VERSION:
return new InternalTimersSnapshotReaderPreVersioned<>(userCodeClassLoader);
case 1:
return new InternalTimersSnapshotReaderV1<>(userCodeClassLoader);
case InternalTimerServiceSerializationProxy.VERSION:
return new InternalTimersSnapshotReaderV2<>(userCodeClassLoader);
default:
// guard for future
throw new IllegalStateException(
"Unrecognized internal timers snapshot writer version: " + version);
}
} | [
"public",
"static",
"<",
"K",
",",
"N",
">",
"InternalTimersSnapshotReader",
"<",
"K",
",",
"N",
">",
"getReaderForVersion",
"(",
"int",
"version",
",",
"ClassLoader",
"userCodeClassLoader",
")",
"{",
"switch",
"(",
"version",
")",
"{",
"case",
"NO_VERSION",
... | ------------------------------------------------------------------------------- | [
"-------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimersSnapshotReaderWriters.java#L210-L228 | train | Returns an instance of the reader for the given version. | [
30522,
2270,
10763,
1026,
1047,
1010,
1050,
1028,
4722,
7292,
2869,
2015,
2532,
4523,
12326,
16416,
4063,
1026,
1047,
1010,
1050,
1028,
2131,
16416,
4063,
29278,
27774,
1006,
20014,
2544,
1010,
2465,
11066,
2121,
5310,
16044,
26266,
11066,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.sub | public static BigDecimal sub(Number v1, Number v2) {
return sub(new Number[] { v1, v2 });
} | java | public static BigDecimal sub(Number v1, Number v2) {
return sub(new Number[] { v1, v2 });
} | [
"public",
"static",
"BigDecimal",
"sub",
"(",
"Number",
"v1",
",",
"Number",
"v2",
")",
"{",
"return",
"sub",
"(",
"new",
"Number",
"[",
"]",
"{",
"v1",
",",
"v2",
"}",
")",
";",
"}"
] | 提供精确的减法运算<br>
如果传入多个值为null或者空,则返回0
@param v1 被减数
@param v2 减数
@return 差 | [
"提供精确的减法运算<br",
">",
"如果传入多个值为null或者空,则返回0"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L248-L250 | train | Returns the subtraction of two numbers. | [
30522,
2270,
10763,
2502,
3207,
6895,
9067,
4942,
1006,
2193,
1058,
2487,
1010,
2193,
1058,
2475,
1007,
1063,
2709,
4942,
1006,
2047,
2193,
1031,
1033,
1063,
1058,
2487,
1010,
1058,
2475,
1065,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.fillBean | public static <T> T fillBean(T bean, ValueProvider<String> valueProvider, CopyOptions copyOptions) {
if (null == valueProvider) {
return bean;
}
return BeanCopier.create(valueProvider, bean, copyOptions).copy();
} | java | public static <T> T fillBean(T bean, ValueProvider<String> valueProvider, CopyOptions copyOptions) {
if (null == valueProvider) {
return bean;
}
return BeanCopier.create(valueProvider, bean, copyOptions).copy();
} | [
"public",
"static",
"<",
"T",
">",
"T",
"fillBean",
"(",
"T",
"bean",
",",
"ValueProvider",
"<",
"String",
">",
"valueProvider",
",",
"CopyOptions",
"copyOptions",
")",
"{",
"if",
"(",
"null",
"==",
"valueProvider",
")",
"{",
"return",
"bean",
";",
"}",
... | 填充Bean的核心方法
@param <T> Bean类型
@param bean Bean
@param valueProvider 值提供者
@param copyOptions 拷贝选项,见 {@link CopyOptions}
@return Bean | [
"填充Bean的核心方法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L470-L476 | train | Fill a bean with the values from the value provider. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
6039,
4783,
2319,
1006,
1056,
14068,
1010,
3643,
21572,
17258,
2121,
1026,
5164,
1028,
3643,
21572,
17258,
2121,
1010,
6100,
7361,
9285,
6100,
7361,
9285,
1007,
1063,
2065,
1006,
19701,
1027,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionJobVertex.java | ExecutionJobVertex.getAggregatedUserAccumulatorsStringified | public StringifiedAccumulatorResult[] getAggregatedUserAccumulatorsStringified() {
Map<String, OptionalFailure<Accumulator<?, ?>>> userAccumulators = new HashMap<>();
for (ExecutionVertex vertex : taskVertices) {
Map<String, Accumulator<?, ?>> next = vertex.getCurrentExecutionAttempt().getUserAccumulators();
if (next != null) {
AccumulatorHelper.mergeInto(userAccumulators, next);
}
}
return StringifiedAccumulatorResult.stringifyAccumulatorResults(userAccumulators);
} | java | public StringifiedAccumulatorResult[] getAggregatedUserAccumulatorsStringified() {
Map<String, OptionalFailure<Accumulator<?, ?>>> userAccumulators = new HashMap<>();
for (ExecutionVertex vertex : taskVertices) {
Map<String, Accumulator<?, ?>> next = vertex.getCurrentExecutionAttempt().getUserAccumulators();
if (next != null) {
AccumulatorHelper.mergeInto(userAccumulators, next);
}
}
return StringifiedAccumulatorResult.stringifyAccumulatorResults(userAccumulators);
} | [
"public",
"StringifiedAccumulatorResult",
"[",
"]",
"getAggregatedUserAccumulatorsStringified",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"OptionalFailure",
"<",
"Accumulator",
"<",
"?",
",",
"?",
">",
">",
">",
"userAccumulators",
"=",
"new",
"HashMap",
"<>",
"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionJobVertex.java#L610-L621 | train | Returns an array of StringifiedAccumulatorResult objects containing the user accumulators for all the execution vertices. | [
30522,
2270,
5164,
7810,
6305,
24894,
20350,
6072,
11314,
1031,
1033,
2131,
8490,
17603,
11644,
20330,
6305,
24894,
20350,
4757,
18886,
3070,
7810,
1006,
1007,
1063,
4949,
1026,
5164,
1010,
11887,
7011,
4014,
5397,
1026,
16222,
2819,
20350,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/sasl/SparkSaslClient.java | SparkSaslClient.dispose | @Override
public synchronized void dispose() {
if (saslClient != null) {
try {
saslClient.dispose();
} catch (SaslException e) {
// ignore
} finally {
saslClient = null;
}
}
} | java | @Override
public synchronized void dispose() {
if (saslClient != null) {
try {
saslClient.dispose();
} catch (SaslException e) {
// ignore
} finally {
saslClient = null;
}
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"dispose",
"(",
")",
"{",
"if",
"(",
"saslClient",
"!=",
"null",
")",
"{",
"try",
"{",
"saslClient",
".",
"dispose",
"(",
")",
";",
"}",
"catch",
"(",
"SaslException",
"e",
")",
"{",
"// ignore",
"}",
... | Disposes of any system resources or security-sensitive information the
SaslClient might be using. | [
"Disposes",
"of",
"any",
"system",
"resources",
"or",
"security",
"-",
"sensitive",
"information",
"the",
"SaslClient",
"might",
"be",
"using",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SparkSaslClient.java#L108-L119 | train | Dispose of the SASL client. | [
30522,
1030,
2058,
15637,
2270,
25549,
11675,
27764,
1006,
1007,
1063,
2065,
1006,
21871,
15472,
8751,
3372,
999,
1027,
19701,
1007,
1063,
3046,
1063,
21871,
15472,
8751,
3372,
1012,
27764,
1006,
1007,
1025,
1065,
4608,
1006,
21871,
2571,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/util/collections/DoubleHashSet.java | DoubleHashSet.add | public boolean add(final double k) {
long longKey = Double.doubleToLongBits(k);
if (longKey == 0L) {
if (this.containsZero) {
return false;
}
this.containsZero = true;
} else {
double[] key = this.key;
int pos;
long curr;
if ((curr = Double.doubleToLongBits(key[pos = (int) MurmurHashUtil.fmix(longKey) & this.mask])) != 0L) {
if (curr == longKey) {
return false;
}
while ((curr = Double.doubleToLongBits(key[pos = pos + 1 & this.mask])) != 0L) {
if (curr == longKey) {
return false;
}
}
}
key[pos] = k;
}
if (this.size++ >= this.maxFill) {
this.rehash(OptimizableHashSet.arraySize(this.size + 1, this.f));
}
return true;
} | java | public boolean add(final double k) {
long longKey = Double.doubleToLongBits(k);
if (longKey == 0L) {
if (this.containsZero) {
return false;
}
this.containsZero = true;
} else {
double[] key = this.key;
int pos;
long curr;
if ((curr = Double.doubleToLongBits(key[pos = (int) MurmurHashUtil.fmix(longKey) & this.mask])) != 0L) {
if (curr == longKey) {
return false;
}
while ((curr = Double.doubleToLongBits(key[pos = pos + 1 & this.mask])) != 0L) {
if (curr == longKey) {
return false;
}
}
}
key[pos] = k;
}
if (this.size++ >= this.maxFill) {
this.rehash(OptimizableHashSet.arraySize(this.size + 1, this.f));
}
return true;
} | [
"public",
"boolean",
"add",
"(",
"final",
"double",
"k",
")",
"{",
"long",
"longKey",
"=",
"Double",
".",
"doubleToLongBits",
"(",
"k",
")",
";",
"if",
"(",
"longKey",
"==",
"0L",
")",
"{",
"if",
"(",
"this",
".",
"containsZero",
")",
"{",
"return",
... | See {@link Double#equals(Object)}. | [
"See",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/util/collections/DoubleHashSet.java#L45-L77 | train | Add a value to the set. | [
30522,
2270,
22017,
20898,
5587,
1006,
2345,
3313,
1047,
1007,
1063,
2146,
2146,
14839,
1027,
3313,
1012,
3313,
3406,
10052,
16313,
2015,
1006,
1047,
1007,
1025,
2065,
1006,
2146,
14839,
1027,
1027,
1014,
2140,
1007,
1063,
2065,
1006,
2023,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java | ThriftHttpCLIService.run | @Override
public void run() {
try {
// Server thread pool
// Start with minWorkerThreads, expand till maxWorkerThreads and reject subsequent requests
String threadPoolName = "HiveServer2-HttpHandler-Pool";
ThreadPoolExecutor executorService = new ThreadPoolExecutor(minWorkerThreads, maxWorkerThreads,
workerKeepAliveTime, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
new ThreadFactoryWithGarbageCleanup(threadPoolName));
ExecutorThreadPool threadPool = new ExecutorThreadPool(executorService);
// HTTP Server
httpServer = new org.eclipse.jetty.server.Server(threadPool);
// Connector configs
ConnectionFactory[] connectionFactories;
boolean useSsl = hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_USE_SSL);
String schemeName = useSsl ? "https" : "http";
// Change connector if SSL is used
if (useSsl) {
String keyStorePath = hiveConf.getVar(ConfVars.HIVE_SERVER2_SSL_KEYSTORE_PATH).trim();
String keyStorePassword = ShimLoader.getHadoopShims().getPassword(hiveConf,
HiveConf.ConfVars.HIVE_SERVER2_SSL_KEYSTORE_PASSWORD.varname);
if (keyStorePath.isEmpty()) {
throw new IllegalArgumentException(ConfVars.HIVE_SERVER2_SSL_KEYSTORE_PATH.varname
+ " Not configured for SSL connection");
}
SslContextFactory sslContextFactory = new SslContextFactory();
String[] excludedProtocols = hiveConf.getVar(ConfVars.HIVE_SSL_PROTOCOL_BLACKLIST).split(",");
LOG.info("HTTP Server SSL: adding excluded protocols: " + Arrays.toString(excludedProtocols));
sslContextFactory.addExcludeProtocols(excludedProtocols);
LOG.info("HTTP Server SSL: SslContextFactory.getExcludeProtocols = " +
Arrays.toString(sslContextFactory.getExcludeProtocols()));
sslContextFactory.setKeyStorePath(keyStorePath);
sslContextFactory.setKeyStorePassword(keyStorePassword);
connectionFactories = AbstractConnectionFactory.getFactories(
sslContextFactory, new HttpConnectionFactory());
} else {
connectionFactories = new ConnectionFactory[] { new HttpConnectionFactory() };
}
ServerConnector connector = new ServerConnector(
httpServer,
null,
// Call this full constructor to set this, which forces daemon threads:
new ScheduledExecutorScheduler("HiveServer2-HttpHandler-JettyScheduler", true),
null,
-1,
-1,
connectionFactories);
connector.setPort(portNum);
// Linux:yes, Windows:no
connector.setReuseAddress(!Shell.WINDOWS);
int maxIdleTime = (int) hiveConf.getTimeVar(ConfVars.HIVE_SERVER2_THRIFT_HTTP_MAX_IDLE_TIME,
TimeUnit.MILLISECONDS);
connector.setIdleTimeout(maxIdleTime);
httpServer.addConnector(connector);
// Thrift configs
hiveAuthFactory = new HiveAuthFactory(hiveConf);
TProcessor processor = new TCLIService.Processor<Iface>(this);
TProtocolFactory protocolFactory = new TBinaryProtocol.Factory();
// Set during the init phase of HiveServer2 if auth mode is kerberos
// UGI for the hive/_HOST (kerberos) principal
UserGroupInformation serviceUGI = cliService.getServiceUGI();
// UGI for the http/_HOST (SPNego) principal
UserGroupInformation httpUGI = cliService.getHttpUGI();
String authType = hiveConf.getVar(ConfVars.HIVE_SERVER2_AUTHENTICATION);
TServlet thriftHttpServlet = new ThriftHttpServlet(processor, protocolFactory, authType,
serviceUGI, httpUGI);
// Context handler
final ServletContextHandler context = new ServletContextHandler(
ServletContextHandler.SESSIONS);
context.setContextPath("/");
String httpPath = getHttpPath(hiveConf
.getVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_HTTP_PATH));
httpServer.setHandler(context);
context.addServlet(new ServletHolder(thriftHttpServlet), httpPath);
// TODO: check defaults: maxTimeout, keepalive, maxBodySize, bodyRecieveDuration, etc.
// Finally, start the server
httpServer.start();
String msg = "Started " + ThriftHttpCLIService.class.getSimpleName() + " in " + schemeName
+ " mode on port " + connector.getLocalPort()+ " path=" + httpPath + " with " + minWorkerThreads + "..."
+ maxWorkerThreads + " worker threads";
LOG.info(msg);
httpServer.join();
} catch (Throwable t) {
LOG.fatal(
"Error starting HiveServer2: could not start "
+ ThriftHttpCLIService.class.getSimpleName(), t);
System.exit(-1);
}
} | java | @Override
public void run() {
try {
// Server thread pool
// Start with minWorkerThreads, expand till maxWorkerThreads and reject subsequent requests
String threadPoolName = "HiveServer2-HttpHandler-Pool";
ThreadPoolExecutor executorService = new ThreadPoolExecutor(minWorkerThreads, maxWorkerThreads,
workerKeepAliveTime, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
new ThreadFactoryWithGarbageCleanup(threadPoolName));
ExecutorThreadPool threadPool = new ExecutorThreadPool(executorService);
// HTTP Server
httpServer = new org.eclipse.jetty.server.Server(threadPool);
// Connector configs
ConnectionFactory[] connectionFactories;
boolean useSsl = hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_USE_SSL);
String schemeName = useSsl ? "https" : "http";
// Change connector if SSL is used
if (useSsl) {
String keyStorePath = hiveConf.getVar(ConfVars.HIVE_SERVER2_SSL_KEYSTORE_PATH).trim();
String keyStorePassword = ShimLoader.getHadoopShims().getPassword(hiveConf,
HiveConf.ConfVars.HIVE_SERVER2_SSL_KEYSTORE_PASSWORD.varname);
if (keyStorePath.isEmpty()) {
throw new IllegalArgumentException(ConfVars.HIVE_SERVER2_SSL_KEYSTORE_PATH.varname
+ " Not configured for SSL connection");
}
SslContextFactory sslContextFactory = new SslContextFactory();
String[] excludedProtocols = hiveConf.getVar(ConfVars.HIVE_SSL_PROTOCOL_BLACKLIST).split(",");
LOG.info("HTTP Server SSL: adding excluded protocols: " + Arrays.toString(excludedProtocols));
sslContextFactory.addExcludeProtocols(excludedProtocols);
LOG.info("HTTP Server SSL: SslContextFactory.getExcludeProtocols = " +
Arrays.toString(sslContextFactory.getExcludeProtocols()));
sslContextFactory.setKeyStorePath(keyStorePath);
sslContextFactory.setKeyStorePassword(keyStorePassword);
connectionFactories = AbstractConnectionFactory.getFactories(
sslContextFactory, new HttpConnectionFactory());
} else {
connectionFactories = new ConnectionFactory[] { new HttpConnectionFactory() };
}
ServerConnector connector = new ServerConnector(
httpServer,
null,
// Call this full constructor to set this, which forces daemon threads:
new ScheduledExecutorScheduler("HiveServer2-HttpHandler-JettyScheduler", true),
null,
-1,
-1,
connectionFactories);
connector.setPort(portNum);
// Linux:yes, Windows:no
connector.setReuseAddress(!Shell.WINDOWS);
int maxIdleTime = (int) hiveConf.getTimeVar(ConfVars.HIVE_SERVER2_THRIFT_HTTP_MAX_IDLE_TIME,
TimeUnit.MILLISECONDS);
connector.setIdleTimeout(maxIdleTime);
httpServer.addConnector(connector);
// Thrift configs
hiveAuthFactory = new HiveAuthFactory(hiveConf);
TProcessor processor = new TCLIService.Processor<Iface>(this);
TProtocolFactory protocolFactory = new TBinaryProtocol.Factory();
// Set during the init phase of HiveServer2 if auth mode is kerberos
// UGI for the hive/_HOST (kerberos) principal
UserGroupInformation serviceUGI = cliService.getServiceUGI();
// UGI for the http/_HOST (SPNego) principal
UserGroupInformation httpUGI = cliService.getHttpUGI();
String authType = hiveConf.getVar(ConfVars.HIVE_SERVER2_AUTHENTICATION);
TServlet thriftHttpServlet = new ThriftHttpServlet(processor, protocolFactory, authType,
serviceUGI, httpUGI);
// Context handler
final ServletContextHandler context = new ServletContextHandler(
ServletContextHandler.SESSIONS);
context.setContextPath("/");
String httpPath = getHttpPath(hiveConf
.getVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_HTTP_PATH));
httpServer.setHandler(context);
context.addServlet(new ServletHolder(thriftHttpServlet), httpPath);
// TODO: check defaults: maxTimeout, keepalive, maxBodySize, bodyRecieveDuration, etc.
// Finally, start the server
httpServer.start();
String msg = "Started " + ThriftHttpCLIService.class.getSimpleName() + " in " + schemeName
+ " mode on port " + connector.getLocalPort()+ " path=" + httpPath + " with " + minWorkerThreads + "..."
+ maxWorkerThreads + " worker threads";
LOG.info(msg);
httpServer.join();
} catch (Throwable t) {
LOG.fatal(
"Error starting HiveServer2: could not start "
+ ThriftHttpCLIService.class.getSimpleName(), t);
System.exit(-1);
}
} | [
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"// Server thread pool",
"// Start with minWorkerThreads, expand till maxWorkerThreads and reject subsequent requests",
"String",
"threadPoolName",
"=",
"\"HiveServer2-HttpHandler-Pool\"",
";",
"ThreadPoolExecutor... | Configure Jetty to serve http requests. Example of a client connection URL:
http://localhost:10000/servlets/thrifths2/ A gateway may cause actual target URL to differ,
e.g. http://gateway:port/hive2/servlets/thrifths2/ | [
"Configure",
"Jetty",
"to",
"serve",
"http",
"requests",
".",
"Example",
"of",
"a",
"client",
"connection",
"URL",
":",
"http",
":",
"//",
"localhost",
":",
"10000",
"/",
"servlets",
"/",
"thrifths2",
"/",
"A",
"gateway",
"may",
"cause",
"actual",
"target"... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java#L61-L157 | train | Run the server. | [
30522,
1030,
2058,
15637,
2270,
11675,
2448,
1006,
1007,
1063,
3046,
1063,
1013,
1013,
8241,
11689,
4770,
1013,
1013,
2707,
2007,
8117,
6198,
8743,
28362,
19303,
1010,
7818,
6229,
4098,
6198,
8743,
28362,
19303,
1998,
15454,
4745,
11186,
51... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlot.java | TaskSlot.markActive | public boolean markActive() {
if (TaskSlotState.ALLOCATED == state || TaskSlotState.ACTIVE == state) {
state = TaskSlotState.ACTIVE;
return true;
} else {
return false;
}
} | java | public boolean markActive() {
if (TaskSlotState.ALLOCATED == state || TaskSlotState.ACTIVE == state) {
state = TaskSlotState.ACTIVE;
return true;
} else {
return false;
}
} | [
"public",
"boolean",
"markActive",
"(",
")",
"{",
"if",
"(",
"TaskSlotState",
".",
"ALLOCATED",
"==",
"state",
"||",
"TaskSlotState",
".",
"ACTIVE",
"==",
"state",
")",
"{",
"state",
"=",
"TaskSlotState",
".",
"ACTIVE",
";",
"return",
"true",
";",
"}",
"... | Mark this slot as active. A slot can only be marked active if it's in state allocated.
<p>The method returns true if the slot was set to active. Otherwise it returns false.
@return True if the new state of the slot is active; otherwise false | [
"Mark",
"this",
"slot",
"as",
"active",
".",
"A",
"slot",
"can",
"only",
"be",
"marked",
"active",
"if",
"it",
"s",
"in",
"state",
"allocated",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlot.java#L237-L245 | train | Mark this slot as active. | [
30522,
2270,
22017,
20898,
2928,
19620,
1006,
1007,
1063,
2065,
1006,
8518,
10994,
9153,
2618,
1012,
11095,
1027,
1027,
2110,
1064,
1064,
8518,
10994,
9153,
2618,
1012,
3161,
1027,
1027,
2110,
1007,
1063,
2110,
1027,
8518,
10994,
9153,
2618... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.downloadFile | public static long downloadFile(String url, File destFile, StreamProgress streamProgress) {
return downloadFile(url, destFile, -1, streamProgress);
} | java | public static long downloadFile(String url, File destFile, StreamProgress streamProgress) {
return downloadFile(url, destFile, -1, streamProgress);
} | [
"public",
"static",
"long",
"downloadFile",
"(",
"String",
"url",
",",
"File",
"destFile",
",",
"StreamProgress",
"streamProgress",
")",
"{",
"return",
"downloadFile",
"(",
"url",
",",
"destFile",
",",
"-",
"1",
",",
"streamProgress",
")",
";",
"}"
] | 下载远程文件
@param url 请求的url
@param destFile 目标文件或目录,当为目录时,取URL中的文件名,取不到使用编码后的URL做为文件名
@param streamProgress 进度条
@return 文件大小 | [
"下载远程文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L290-L292 | train | Downloads the file from the given URL to the given destination file. | [
30522,
2270,
10763,
2146,
8816,
8873,
2571,
1006,
5164,
24471,
2140,
1010,
5371,
4078,
24475,
9463,
1010,
5460,
21572,
17603,
4757,
5460,
21572,
17603,
4757,
1007,
1063,
2709,
8816,
8873,
2571,
1006,
24471,
2140,
1010,
4078,
24475,
9463,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java | DataStream.split | @Deprecated
public SplitStream<T> split(OutputSelector<T> outputSelector) {
return new SplitStream<>(this, clean(outputSelector));
} | java | @Deprecated
public SplitStream<T> split(OutputSelector<T> outputSelector) {
return new SplitStream<>(this, clean(outputSelector));
} | [
"@",
"Deprecated",
"public",
"SplitStream",
"<",
"T",
">",
"split",
"(",
"OutputSelector",
"<",
"T",
">",
"outputSelector",
")",
"{",
"return",
"new",
"SplitStream",
"<>",
"(",
"this",
",",
"clean",
"(",
"outputSelector",
")",
")",
";",
"}"
] | Operator used for directing tuples to specific named outputs using an
{@link org.apache.flink.streaming.api.collector.selector.OutputSelector}.
Calling this method on an operator creates a new {@link SplitStream}.
@param outputSelector
The user defined
{@link org.apache.flink.streaming.api.collector.selector.OutputSelector}
for directing the tuples.
@return The {@link SplitStream}
@deprecated Please use side output instead. | [
"Operator",
"used",
"for",
"directing",
"tuples",
"to",
"specific",
"named",
"outputs",
"using",
"an",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"streaming",
".",
"api",
".",
"collector",
".",
"selector",
".",
"OutputSelector",
"}",
".",
"Call... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L239-L242 | train | Creates a new split stream from this stream and the given output selector. | [
30522,
1030,
2139,
28139,
12921,
2270,
19584,
25379,
1026,
1056,
1028,
3975,
1006,
27852,
12260,
16761,
1026,
1056,
1028,
27852,
12260,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/UnixResolverDnsServerAddressStreamProvider.java | UnixResolverDnsServerAddressStreamProvider.parseEtcResolverSearchDomains | static List<String> parseEtcResolverSearchDomains(File etcResolvConf) throws IOException {
String localDomain = null;
List<String> searchDomains = new ArrayList<String>();
FileReader fr = new FileReader(etcResolvConf);
BufferedReader br = null;
try {
br = new BufferedReader(fr);
String line;
while ((line = br.readLine()) != null) {
if (localDomain == null && line.startsWith(DOMAIN_ROW_LABEL)) {
int i = indexOfNonWhiteSpace(line, DOMAIN_ROW_LABEL.length());
if (i >= 0) {
localDomain = line.substring(i);
}
} else if (line.startsWith(SEARCH_ROW_LABEL)) {
int i = indexOfNonWhiteSpace(line, SEARCH_ROW_LABEL.length());
if (i >= 0) {
// May contain more then one entry, either seperated by whitespace or tab.
// See https://linux.die.net/man/5/resolver
String[] domains = SEARCH_DOMAIN_PATTERN.split(line.substring(i));
Collections.addAll(searchDomains, domains);
}
}
}
} finally {
if (br == null) {
fr.close();
} else {
br.close();
}
}
// return what was on the 'domain' line only if there were no 'search' lines
return localDomain != null && searchDomains.isEmpty()
? Collections.singletonList(localDomain)
: searchDomains;
} | java | static List<String> parseEtcResolverSearchDomains(File etcResolvConf) throws IOException {
String localDomain = null;
List<String> searchDomains = new ArrayList<String>();
FileReader fr = new FileReader(etcResolvConf);
BufferedReader br = null;
try {
br = new BufferedReader(fr);
String line;
while ((line = br.readLine()) != null) {
if (localDomain == null && line.startsWith(DOMAIN_ROW_LABEL)) {
int i = indexOfNonWhiteSpace(line, DOMAIN_ROW_LABEL.length());
if (i >= 0) {
localDomain = line.substring(i);
}
} else if (line.startsWith(SEARCH_ROW_LABEL)) {
int i = indexOfNonWhiteSpace(line, SEARCH_ROW_LABEL.length());
if (i >= 0) {
// May contain more then one entry, either seperated by whitespace or tab.
// See https://linux.die.net/man/5/resolver
String[] domains = SEARCH_DOMAIN_PATTERN.split(line.substring(i));
Collections.addAll(searchDomains, domains);
}
}
}
} finally {
if (br == null) {
fr.close();
} else {
br.close();
}
}
// return what was on the 'domain' line only if there were no 'search' lines
return localDomain != null && searchDomains.isEmpty()
? Collections.singletonList(localDomain)
: searchDomains;
} | [
"static",
"List",
"<",
"String",
">",
"parseEtcResolverSearchDomains",
"(",
"File",
"etcResolvConf",
")",
"throws",
"IOException",
"{",
"String",
"localDomain",
"=",
"null",
";",
"List",
"<",
"String",
">",
"searchDomains",
"=",
"new",
"ArrayList",
"<",
"String"... | Parse a file of the format <a href="https://linux.die.net/man/5/resolver">/etc/resolv.conf</a> and return the
list of search domains found in it or an empty list if not found.
@param etcResolvConf a file of the format <a href="https://linux.die.net/man/5/resolver">/etc/resolv.conf</a>.
@return List of search domains.
@throws IOException If a failure occurs parsing the file. | [
"Parse",
"a",
"file",
"of",
"the",
"format",
"<a",
"href",
"=",
"https",
":",
"//",
"linux",
".",
"die",
".",
"net",
"/",
"man",
"/",
"5",
"/",
"resolver",
">",
"/",
"etc",
"/",
"resolv",
".",
"conf<",
"/",
"a",
">",
"and",
"return",
"the",
"li... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/UnixResolverDnsServerAddressStreamProvider.java#L309-L346 | train | Parses the etcResolvConf file to get the list of search domains. | [
30522,
10763,
2862,
1026,
5164,
1028,
11968,
19763,
13535,
6072,
4747,
16070,
2906,
2818,
9527,
28247,
1006,
5371,
4385,
6072,
4747,
25465,
2239,
2546,
1007,
11618,
22834,
10288,
24422,
1063,
5164,
2334,
9527,
8113,
1027,
19701,
1025,
2862,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Setting.java | Setting.remove | @Override
public String remove(Object key) {
return this.groupedMap.remove(DEFAULT_GROUP, Convert.toStr(key));
} | java | @Override
public String remove(Object key) {
return this.groupedMap.remove(DEFAULT_GROUP, Convert.toStr(key));
} | [
"@",
"Override",
"public",
"String",
"remove",
"(",
"Object",
"key",
")",
"{",
"return",
"this",
".",
"groupedMap",
".",
"remove",
"(",
"DEFAULT_GROUP",
",",
"Convert",
".",
"toStr",
"(",
"key",
")",
")",
";",
"}"
] | 移除默认分组(空分组)中指定值
@param key 键
@return 移除的值 | [
"移除默认分组(空分组)中指定值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L572-L575 | train | Removes the specified object from the group. | [
30522,
1030,
2058,
15637,
2270,
5164,
6366,
1006,
4874,
3145,
1007,
1063,
2709,
2023,
1012,
15131,
2863,
2361,
1012,
6366,
1006,
12398,
1035,
2177,
1010,
10463,
1012,
2000,
3367,
2099,
1006,
3145,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/PlatformDependent.java | PlatformDependent.hashCodeAsciiSanitizeInt | private static int hashCodeAsciiSanitizeInt(CharSequence value, int offset) {
if (BIG_ENDIAN_NATIVE_ORDER) {
// mimic a unsafe.getInt call on a big endian machine
return (value.charAt(offset + 3) & 0x1f) |
(value.charAt(offset + 2) & 0x1f) << 8 |
(value.charAt(offset + 1) & 0x1f) << 16 |
(value.charAt(offset) & 0x1f) << 24;
}
return (value.charAt(offset + 3) & 0x1f) << 24 |
(value.charAt(offset + 2) & 0x1f) << 16 |
(value.charAt(offset + 1) & 0x1f) << 8 |
(value.charAt(offset) & 0x1f);
} | java | private static int hashCodeAsciiSanitizeInt(CharSequence value, int offset) {
if (BIG_ENDIAN_NATIVE_ORDER) {
// mimic a unsafe.getInt call on a big endian machine
return (value.charAt(offset + 3) & 0x1f) |
(value.charAt(offset + 2) & 0x1f) << 8 |
(value.charAt(offset + 1) & 0x1f) << 16 |
(value.charAt(offset) & 0x1f) << 24;
}
return (value.charAt(offset + 3) & 0x1f) << 24 |
(value.charAt(offset + 2) & 0x1f) << 16 |
(value.charAt(offset + 1) & 0x1f) << 8 |
(value.charAt(offset) & 0x1f);
} | [
"private",
"static",
"int",
"hashCodeAsciiSanitizeInt",
"(",
"CharSequence",
"value",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"BIG_ENDIAN_NATIVE_ORDER",
")",
"{",
"// mimic a unsafe.getInt call on a big endian machine",
"return",
"(",
"value",
".",
"charAt",
"(",
"... | Identical to {@link PlatformDependent0#hashCodeAsciiSanitize(int)} but for {@link CharSequence}. | [
"Identical",
"to",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L521-L533 | train | Sanitize a char sequence to a 32 - bit integer. | [
30522,
2797,
10763,
20014,
23325,
16044,
3022,
6895,
29196,
25090,
4371,
18447,
1006,
25869,
3366,
4226,
5897,
3643,
1010,
20014,
16396,
1007,
1063,
2065,
1006,
2502,
1035,
2203,
2937,
1035,
3128,
1035,
2344,
1007,
1063,
1013,
1013,
23150,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java | SqlBuilder.query | public SqlBuilder query(Query query) {
return this.select(query.getFields()).from(query.getTableNames()).where(LogicalOperator.AND, query.getWhere());
} | java | public SqlBuilder query(Query query) {
return this.select(query.getFields()).from(query.getTableNames()).where(LogicalOperator.AND, query.getWhere());
} | [
"public",
"SqlBuilder",
"query",
"(",
"Query",
"query",
")",
"{",
"return",
"this",
".",
"select",
"(",
"query",
".",
"getFields",
"(",
")",
")",
".",
"from",
"(",
"query",
".",
"getTableNames",
"(",
")",
")",
".",
"where",
"(",
"LogicalOperator",
".",... | 构建查询SQL
@param query {@link Query}
@return this | [
"构建查询SQL"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java#L522-L524 | train | Create a query statement | [
30522,
2270,
29296,
8569,
23891,
2099,
23032,
1006,
23032,
23032,
1007,
1063,
2709,
2023,
1012,
7276,
1006,
23032,
1012,
2131,
15155,
1006,
1007,
1007,
1012,
2013,
1006,
23032,
1012,
2131,
10880,
18442,
2015,
1006,
1007,
1007,
1012,
2073,
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-setting/src/main/java/cn/hutool/setting/GroupedMap.java | GroupedMap.put | public String put(String group, String key, String value) {
group = StrUtil.nullToEmpty(group).trim();
writeLock.lock();
try {
LinkedHashMap<String, String> valueMap = this.get(group);
if (null == valueMap) {
valueMap = new LinkedHashMap<>();
this.put(group, valueMap);
}
this.size = -1;
return valueMap.put(key, value);
} finally {
writeLock.unlock();
}
} | java | public String put(String group, String key, String value) {
group = StrUtil.nullToEmpty(group).trim();
writeLock.lock();
try {
LinkedHashMap<String, String> valueMap = this.get(group);
if (null == valueMap) {
valueMap = new LinkedHashMap<>();
this.put(group, valueMap);
}
this.size = -1;
return valueMap.put(key, value);
} finally {
writeLock.unlock();
}
} | [
"public",
"String",
"put",
"(",
"String",
"group",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"group",
"=",
"StrUtil",
".",
"nullToEmpty",
"(",
"group",
")",
".",
"trim",
"(",
")",
";",
"writeLock",
".",
"lock",
"(",
")",
";",
"try",
"... | 将键值对加入到对应分组中
@param group 分组
@param key 键
@param value 值
@return 此key之前存在的值,如果没有返回null | [
"将键值对加入到对应分组中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/GroupedMap.java#L89-L103 | train | Associates the specified value with the specified group and key. If the group does not exist or if the key does not exist it will be created. | [
30522,
2270,
5164,
2404,
1006,
5164,
2177,
1010,
5164,
3145,
1010,
5164,
3643,
1007,
1063,
2177,
1027,
2358,
22134,
4014,
1012,
19701,
3406,
6633,
13876,
2100,
1006,
2177,
1007,
1012,
12241,
1006,
1007,
1025,
4339,
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/date/format/FormatCache.java | FormatCache.getDateInstance | F getDateInstance(final int dateStyle, final TimeZone timeZone, final Locale locale) {
return getDateTimeInstance(Integer.valueOf(dateStyle), null, timeZone, locale);
} | java | F getDateInstance(final int dateStyle, final TimeZone timeZone, final Locale locale) {
return getDateTimeInstance(Integer.valueOf(dateStyle), null, timeZone, locale);
} | [
"F",
"getDateInstance",
"(",
"final",
"int",
"dateStyle",
",",
"final",
"TimeZone",
"timeZone",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"getDateTimeInstance",
"(",
"Integer",
".",
"valueOf",
"(",
"dateStyle",
")",
",",
"null",
",",
"timeZone",
... | package protected, for access from FastDateFormat; do not make public or protected | [
"package",
"protected",
"for",
"access",
"from",
"FastDateFormat",
";",
"do",
"not",
"make",
"public",
"or",
"protected"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FormatCache.java#L131-L133 | train | Gets the date instance. | [
30522,
1042,
2131,
13701,
7076,
26897,
1006,
2345,
20014,
5246,
27983,
1010,
2345,
2051,
15975,
2051,
15975,
1010,
2345,
2334,
2063,
2334,
2063,
1007,
1063,
2709,
2131,
13701,
7292,
7076,
26897,
1006,
16109,
1012,
3643,
11253,
1006,
5246,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/proxy/OptionalBoolean.java | OptionalBoolean.get | public boolean get() {
switch (state) {
case UNSET:
return valueIfUnset;
case FALSE:
return false;
case TRUE:
return true;
case CONFLICTING:
return valueIfConflicting;
default:
throw new RuntimeException("Unknown state");
}
} | java | public boolean get() {
switch (state) {
case UNSET:
return valueIfUnset;
case FALSE:
return false;
case TRUE:
return true;
case CONFLICTING:
return valueIfConflicting;
default:
throw new RuntimeException("Unknown state");
}
} | [
"public",
"boolean",
"get",
"(",
")",
"{",
"switch",
"(",
"state",
")",
"{",
"case",
"UNSET",
":",
"return",
"valueIfUnset",
";",
"case",
"FALSE",
":",
"return",
"false",
";",
"case",
"TRUE",
":",
"return",
"true",
";",
"case",
"CONFLICTING",
":",
"ret... | Get the boolean state.
@return boolean state | [
"Get",
"the",
"boolean",
"state",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/proxy/OptionalBoolean.java#L66-L79 | train | Get the value of the property. | [
30522,
2270,
22017,
20898,
2131,
1006,
1007,
1063,
6942,
1006,
2110,
1007,
1063,
2553,
4895,
13462,
1024,
2709,
3643,
10128,
4609,
13462,
1025,
2553,
6270,
1024,
2709,
6270,
1025,
2553,
2995,
1024,
2709,
2995,
1025,
2553,
19326,
1024,
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/taskexecutor/TaskManagerRunner.java | TaskManagerRunner.createRpcService | public static RpcService createRpcService(
final Configuration configuration,
final HighAvailabilityServices haServices) throws Exception {
checkNotNull(configuration);
checkNotNull(haServices);
final String taskManagerAddress = determineTaskManagerBindAddress(configuration, haServices);
final String portRangeDefinition = configuration.getString(TaskManagerOptions.RPC_PORT);
return AkkaRpcServiceUtils.createRpcService(taskManagerAddress, portRangeDefinition, configuration);
} | java | public static RpcService createRpcService(
final Configuration configuration,
final HighAvailabilityServices haServices) throws Exception {
checkNotNull(configuration);
checkNotNull(haServices);
final String taskManagerAddress = determineTaskManagerBindAddress(configuration, haServices);
final String portRangeDefinition = configuration.getString(TaskManagerOptions.RPC_PORT);
return AkkaRpcServiceUtils.createRpcService(taskManagerAddress, portRangeDefinition, configuration);
} | [
"public",
"static",
"RpcService",
"createRpcService",
"(",
"final",
"Configuration",
"configuration",
",",
"final",
"HighAvailabilityServices",
"haServices",
")",
"throws",
"Exception",
"{",
"checkNotNull",
"(",
"configuration",
")",
";",
"checkNotNull",
"(",
"haService... | Create a RPC service for the task manager.
@param configuration The configuration for the TaskManager.
@param haServices to use for the task manager hostname retrieval | [
"Create",
"a",
"RPC",
"service",
"for",
"the",
"task",
"manager",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerRunner.java#L397-L408 | train | Create a RpcService. | [
30522,
2270,
10763,
1054,
15042,
8043,
7903,
2063,
3443,
14536,
6169,
2121,
7903,
2063,
1006,
2345,
9563,
9563,
1010,
2345,
2152,
12462,
11733,
8553,
8043,
7903,
2229,
2038,
2121,
7903,
2229,
1007,
11618,
6453,
1063,
4638,
17048,
11231,
336... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/resource/ResourceUtil.java | ResourceUtil.getReader | public static BufferedReader getReader(String resurce, Charset charset) {
return getResourceObj(resurce).getReader(charset);
} | java | public static BufferedReader getReader(String resurce, Charset charset) {
return getResourceObj(resurce).getReader(charset);
} | [
"public",
"static",
"BufferedReader",
"getReader",
"(",
"String",
"resurce",
",",
"Charset",
"charset",
")",
"{",
"return",
"getResourceObj",
"(",
"resurce",
")",
".",
"getReader",
"(",
"charset",
")",
";",
"}"
] | 从ClassPath资源中获取{@link BufferedReader}
@param resurce ClassPath资源
@param charset 编码
@return {@link InputStream}
@since 3.1.2 | [
"从ClassPath资源中获取",
"{",
"@link",
"BufferedReader",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java#L87-L89 | train | Get a BufferedReader for a given resource. | [
30522,
2270,
10763,
17698,
2098,
16416,
4063,
2131,
16416,
4063,
1006,
5164,
24501,
3126,
3401,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2709,
2131,
6072,
8162,
3401,
16429,
3501,
1006,
24501,
3126,
3401,
1007,
1012,
2131,
16416,
4063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java | TomcatServletWebServerFactory.setContextValves | public void setContextValves(Collection<? extends Valve> contextValves) {
Assert.notNull(contextValves, "Valves must not be null");
this.contextValves = new ArrayList<>(contextValves);
} | java | public void setContextValves(Collection<? extends Valve> contextValves) {
Assert.notNull(contextValves, "Valves must not be null");
this.contextValves = new ArrayList<>(contextValves);
} | [
"public",
"void",
"setContextValves",
"(",
"Collection",
"<",
"?",
"extends",
"Valve",
">",
"contextValves",
")",
"{",
"Assert",
".",
"notNull",
"(",
"contextValves",
",",
"\"Valves must not be null\"",
")",
";",
"this",
".",
"contextValves",
"=",
"new",
"ArrayL... | Set {@link Valve}s that should be applied to the Tomcat {@link Context}. Calling
this method will replace any existing valves.
@param contextValves the valves to set | [
"Set",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java#L521-L524 | train | Sets the context valves. | [
30522,
2270,
11675,
2275,
8663,
18209,
10175,
6961,
1006,
3074,
1026,
1029,
8908,
10764,
1028,
6123,
10175,
6961,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
6123,
10175,
6961,
1010,
1000,
17355,
2442,
2025,
2022,
19701,
1000,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/bintrie/util/ArrayTool.java | ArrayTool.binarySearch | public static int binarySearch(BaseNode[] branches, BaseNode node)
{
int high = branches.length - 1;
if (branches.length < 1)
{
return high;
}
int low = 0;
while (low <= high)
{
int mid = (low + high) >>> 1;
int cmp = branches[mid].compareTo(node);
if (cmp < 0)
low = mid + 1;
else if (cmp > 0)
high = mid - 1;
else
return mid;
}
return -(low + 1);
} | java | public static int binarySearch(BaseNode[] branches, BaseNode node)
{
int high = branches.length - 1;
if (branches.length < 1)
{
return high;
}
int low = 0;
while (low <= high)
{
int mid = (low + high) >>> 1;
int cmp = branches[mid].compareTo(node);
if (cmp < 0)
low = mid + 1;
else if (cmp > 0)
high = mid - 1;
else
return mid;
}
return -(low + 1);
} | [
"public",
"static",
"int",
"binarySearch",
"(",
"BaseNode",
"[",
"]",
"branches",
",",
"BaseNode",
"node",
")",
"{",
"int",
"high",
"=",
"branches",
".",
"length",
"-",
"1",
";",
"if",
"(",
"branches",
".",
"length",
"<",
"1",
")",
"{",
"return",
"hi... | 二分查找
@param branches 数组
@param node 要查找的node
@return 数组下标,小于0表示没找到 | [
"二分查找"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/bintrie/util/ArrayTool.java#L28-L49 | train | Gets the index of the BaseNode in the BaseNode array that is greater than or equal to the given BaseNode. | [
30522,
2270,
10763,
20014,
12441,
17310,
11140,
1006,
2918,
3630,
3207,
1031,
1033,
5628,
1010,
2918,
3630,
3207,
13045,
1007,
1063,
20014,
2152,
1027,
5628,
1012,
3091,
1011,
1015,
1025,
2065,
1006,
5628,
1012,
3091,
1026,
1015,
1007,
1063... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/impl/Jdk8DateConverter.java | Jdk8DateConverter.parseFromCharSequence | private Object parseFromCharSequence(CharSequence value) {
Method method;
if (null != this.format) {
final Object dateTimeFormatter = getDateTimeFormatter();
method = ReflectUtil.getMethod(this.targetType, "parse", CharSequence.class, dateTimeFormatter.getClass());
return ReflectUtil.invokeStatic(method, value, dateTimeFormatter);
} else {
method = ReflectUtil.getMethod(this.targetType, "parse", CharSequence.class);
return ReflectUtil.invokeStatic(method, value);
}
} | java | private Object parseFromCharSequence(CharSequence value) {
Method method;
if (null != this.format) {
final Object dateTimeFormatter = getDateTimeFormatter();
method = ReflectUtil.getMethod(this.targetType, "parse", CharSequence.class, dateTimeFormatter.getClass());
return ReflectUtil.invokeStatic(method, value, dateTimeFormatter);
} else {
method = ReflectUtil.getMethod(this.targetType, "parse", CharSequence.class);
return ReflectUtil.invokeStatic(method, value);
}
} | [
"private",
"Object",
"parseFromCharSequence",
"(",
"CharSequence",
"value",
")",
"{",
"Method",
"method",
";",
"if",
"(",
"null",
"!=",
"this",
".",
"format",
")",
"{",
"final",
"Object",
"dateTimeFormatter",
"=",
"getDateTimeFormatter",
"(",
")",
";",
"method... | 通过反射从字符串转java.time中的对象
@param value 字符串值
@return 日期对象 | [
"通过反射从字符串转java",
".",
"time中的对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/impl/Jdk8DateConverter.java#L98-L108 | train | Parse a single value from a CharSequence. | [
30522,
2797,
4874,
11968,
20106,
21716,
7507,
22573,
4226,
5897,
1006,
25869,
3366,
4226,
5897,
3643,
1007,
1063,
4118,
4118,
1025,
2065,
1006,
19701,
999,
1027,
2023,
1012,
4289,
1007,
1063,
2345,
4874,
3058,
7292,
14192,
20097,
1027,
2131... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java | HashUtil.javaDefaultHash | public static int javaDefaultHash(String str) {
int h = 0;
int off = 0;
int len = str.length();
for (int i = 0; i < len; i++) {
h = 31 * h + str.charAt(off++);
}
return h;
} | java | public static int javaDefaultHash(String str) {
int h = 0;
int off = 0;
int len = str.length();
for (int i = 0; i < len; i++) {
h = 31 * h + str.charAt(off++);
}
return h;
} | [
"public",
"static",
"int",
"javaDefaultHash",
"(",
"String",
"str",
")",
"{",
"int",
"h",
"=",
"0",
";",
"int",
"off",
"=",
"0",
";",
"int",
"len",
"=",
"str",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"le... | JAVA自己带的算法
@param str 字符串
@return hash值 | [
"JAVA自己带的算法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java#L410-L418 | train | Returns the java default hash value for a String. | [
30522,
2270,
10763,
20014,
9262,
3207,
7011,
11314,
14949,
2232,
1006,
5164,
2358,
2099,
1007,
1063,
20014,
1044,
1027,
1014,
1025,
20014,
2125,
1027,
1014,
1025,
20014,
18798,
1027,
2358,
2099,
1012,
3091,
1006,
1007,
1025,
2005,
1006,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java | EmbeddedChannel.writeInbound | public boolean writeInbound(Object... msgs) {
ensureOpen();
if (msgs.length == 0) {
return isNotEmpty(inboundMessages);
}
ChannelPipeline p = pipeline();
for (Object m: msgs) {
p.fireChannelRead(m);
}
flushInbound(false, voidPromise());
return isNotEmpty(inboundMessages);
} | java | public boolean writeInbound(Object... msgs) {
ensureOpen();
if (msgs.length == 0) {
return isNotEmpty(inboundMessages);
}
ChannelPipeline p = pipeline();
for (Object m: msgs) {
p.fireChannelRead(m);
}
flushInbound(false, voidPromise());
return isNotEmpty(inboundMessages);
} | [
"public",
"boolean",
"writeInbound",
"(",
"Object",
"...",
"msgs",
")",
"{",
"ensureOpen",
"(",
")",
";",
"if",
"(",
"msgs",
".",
"length",
"==",
"0",
")",
"{",
"return",
"isNotEmpty",
"(",
"inboundMessages",
")",
";",
"}",
"ChannelPipeline",
"p",
"=",
... | Write messages to the inbound of this {@link Channel}.
@param msgs the messages to be written
@return {@code true} if the write operation did add something to the inbound buffer | [
"Write",
"messages",
"to",
"the",
"inbound",
"of",
"this",
"{",
"@link",
"Channel",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java#L317-L330 | train | Write inbound messages to the session. | [
30522,
2270,
22017,
20898,
4339,
2378,
15494,
1006,
4874,
1012,
1012,
1012,
5796,
5620,
1007,
1063,
5676,
26915,
1006,
1007,
1025,
2065,
1006,
5796,
5620,
1012,
3091,
1027,
1027,
1014,
1007,
1063,
2709,
3475,
12184,
27718,
2100,
1006,
1999,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/instance/SharedSlot.java | SharedSlot.allocateSubSlot | SimpleSlot allocateSubSlot(AbstractID groupId) {
if (isAlive()) {
SimpleSlot slot = new SimpleSlot(
getOwner(),
getTaskManagerLocation(),
subSlots.size(),
getTaskManagerGateway(),
this,
groupId);
subSlots.add(slot);
return slot;
}
else {
return null;
}
} | java | SimpleSlot allocateSubSlot(AbstractID groupId) {
if (isAlive()) {
SimpleSlot slot = new SimpleSlot(
getOwner(),
getTaskManagerLocation(),
subSlots.size(),
getTaskManagerGateway(),
this,
groupId);
subSlots.add(slot);
return slot;
}
else {
return null;
}
} | [
"SimpleSlot",
"allocateSubSlot",
"(",
"AbstractID",
"groupId",
")",
"{",
"if",
"(",
"isAlive",
"(",
")",
")",
"{",
"SimpleSlot",
"slot",
"=",
"new",
"SimpleSlot",
"(",
"getOwner",
"(",
")",
",",
"getTaskManagerLocation",
"(",
")",
",",
"subSlots",
".",
"si... | Creates a new sub slot if the slot is not dead, yet. This method should only be called from
the assignment group instance to guarantee synchronization.
<b>NOTE:</b> This method is not synchronized and must only be called from
the slot's assignment group.
@param groupId The ID to identify tasks which can be deployed in this sub slot.
@return The new sub slot if the shared slot is still alive, otherwise null. | [
"Creates",
"a",
"new",
"sub",
"slot",
"if",
"the",
"slot",
"is",
"not",
"dead",
"yet",
".",
"This",
"method",
"should",
"only",
"be",
"called",
"from",
"the",
"assignment",
"group",
"instance",
"to",
"guarantee",
"synchronization",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/SharedSlot.java#L248-L263 | train | Allocate a sub slot. | [
30522,
3722,
14540,
4140,
2035,
24755,
4570,
12083,
14540,
4140,
1006,
10061,
3593,
2177,
3593,
1007,
1063,
2065,
1006,
18061,
3669,
3726,
1006,
1007,
1007,
1063,
3722,
14540,
4140,
10453,
1027,
2047,
3722,
14540,
4140,
1006,
2131,
12384,
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-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java | MailUtil.send | public static void send(Collection<String> tos, String subject, String content, boolean isHtml, File... files) {
send(GlobalMailAccount.INSTANCE.getAccount(), tos, subject, content, isHtml, files);
} | java | public static void send(Collection<String> tos, String subject, String content, boolean isHtml, File... files) {
send(GlobalMailAccount.INSTANCE.getAccount(), tos, subject, content, isHtml, files);
} | [
"public",
"static",
"void",
"send",
"(",
"Collection",
"<",
"String",
">",
"tos",
",",
"String",
"subject",
",",
"String",
"content",
",",
"boolean",
"isHtml",
",",
"File",
"...",
"files",
")",
"{",
"send",
"(",
"GlobalMailAccount",
".",
"INSTANCE",
".",
... | 使用配置文件中设置的账户发送邮件,发送给多人
@param tos 收件人列表
@param subject 标题
@param content 正文
@param isHtml 是否为HTML
@param files 附件列表 | [
"使用配置文件中设置的账户发送邮件,发送给多人"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java#L111-L113 | train | Creates a mail with the specified tos subject and content. | [
30522,
2270,
10763,
11675,
4604,
1006,
3074,
1026,
5164,
1028,
2000,
2015,
1010,
5164,
3395,
1010,
5164,
4180,
1010,
22017,
20898,
2003,
11039,
19968,
1010,
5371,
1012,
1012,
1012,
6764,
1007,
1063,
4604,
1006,
3795,
21397,
6305,
3597,
1667... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.abort | public void abort(CheckpointFailureReason reason, Throwable cause) {
try {
CheckpointException exception = new CheckpointException(reason, cause);
onCompletionPromise.completeExceptionally(exception);
reportFailedCheckpoint(exception);
assertAbortSubsumedForced(reason);
} finally {
dispose(true);
}
} | java | public void abort(CheckpointFailureReason reason, Throwable cause) {
try {
CheckpointException exception = new CheckpointException(reason, cause);
onCompletionPromise.completeExceptionally(exception);
reportFailedCheckpoint(exception);
assertAbortSubsumedForced(reason);
} finally {
dispose(true);
}
} | [
"public",
"void",
"abort",
"(",
"CheckpointFailureReason",
"reason",
",",
"Throwable",
"cause",
")",
"{",
"try",
"{",
"CheckpointException",
"exception",
"=",
"new",
"CheckpointException",
"(",
"reason",
",",
"cause",
")",
";",
"onCompletionPromise",
".",
"complet... | Aborts a checkpoint with reason and cause. | [
"Aborts",
"a",
"checkpoint",
"with",
"reason",
"and",
"cause",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpoint.java#L409-L418 | train | Aborts the checkpoint with the given reason and cause. | [
30522,
2270,
11675,
11113,
11589,
1006,
26520,
7011,
4014,
27595,
5243,
3385,
3114,
1010,
5466,
3085,
3426,
1007,
1063,
3046,
1063,
26520,
10288,
24422,
6453,
1027,
2047,
26520,
10288,
24422,
1006,
3114,
1010,
3426,
1007,
1025,
2006,
9006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FileTypeUtil.java | FileTypeUtil.getType | public static String getType(File file) throws IORuntimeException {
FileInputStream in = null;
try {
in = IoUtil.toStream(file);
return getType(in);
} finally {
IoUtil.close(in);
}
} | java | public static String getType(File file) throws IORuntimeException {
FileInputStream in = null;
try {
in = IoUtil.toStream(file);
return getType(in);
} finally {
IoUtil.close(in);
}
} | [
"public",
"static",
"String",
"getType",
"(",
"File",
"file",
")",
"throws",
"IORuntimeException",
"{",
"FileInputStream",
"in",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"IoUtil",
".",
"toStream",
"(",
"file",
")",
";",
"return",
"getType",
"(",
"in",
")... | 根据文件流的头部信息获得文件类型
@param file 文件 {@link File}
@return 类型,文件的扩展名,未找到为<code>null</code>
@throws IORuntimeException 读取文件引起的异常 | [
"根据文件流的头部信息获得文件类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileTypeUtil.java#L136-L144 | train | Returns the type of the file. | [
30522,
2270,
10763,
5164,
2131,
13874,
1006,
5371,
5371,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
5371,
2378,
18780,
21422,
1999,
1027,
19701,
1025,
3046,
1063,
1999,
1027,
22834,
21823,
2140,
1012,
2000,
21422,
1006,
5371,
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/io/IoUtil.java | IoUtil.toStream | public static FileInputStream toStream(File file) {
try {
return new FileInputStream(file);
} catch (FileNotFoundException e) {
throw new IORuntimeException(e);
}
} | java | public static FileInputStream toStream(File file) {
try {
return new FileInputStream(file);
} catch (FileNotFoundException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"FileInputStream",
"toStream",
"(",
"File",
"file",
")",
"{",
"try",
"{",
"return",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"throw",
"new",
"IORuntimeException",
"(",
"e"... | 文件转为流
@param file 文件
@return {@link FileInputStream} | [
"文件转为流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L788-L794 | train | Returns a stream that reads the contents of the specified file. | [
30522,
2270,
10763,
5371,
2378,
18780,
21422,
2000,
21422,
1006,
5371,
5371,
1007,
1063,
3046,
1063,
2709,
2047,
5371,
2378,
18780,
21422,
1006,
5371,
1007,
1025,
1065,
4608,
1006,
5371,
17048,
14876,
8630,
10288,
24422,
1041,
1007,
1063,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ahocorasick/interval/IntervalNode.java | IntervalNode.addToOverlaps | protected void addToOverlaps(Intervalable interval, List<Intervalable> overlaps, List<Intervalable> newOverlaps)
{
for (Intervalable currentInterval : newOverlaps)
{
if (!currentInterval.equals(interval))
{
overlaps.add(currentInterval);
}
}
} | java | protected void addToOverlaps(Intervalable interval, List<Intervalable> overlaps, List<Intervalable> newOverlaps)
{
for (Intervalable currentInterval : newOverlaps)
{
if (!currentInterval.equals(interval))
{
overlaps.add(currentInterval);
}
}
} | [
"protected",
"void",
"addToOverlaps",
"(",
"Intervalable",
"interval",
",",
"List",
"<",
"Intervalable",
">",
"overlaps",
",",
"List",
"<",
"Intervalable",
">",
"newOverlaps",
")",
"{",
"for",
"(",
"Intervalable",
"currentInterval",
":",
"newOverlaps",
")",
"{",... | 添加到重叠区间列表中
@param interval 跟此区间重叠
@param overlaps 重叠区间列表
@param newOverlaps 希望将这些区间加入 | [
"添加到重叠区间列表中"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/interval/IntervalNode.java#L138-L147 | train | Add to the list of overlapping intervals. | [
30522,
5123,
11675,
5587,
3406,
7840,
2721,
4523,
1006,
13483,
3085,
13483,
1010,
2862,
1026,
13483,
3085,
1028,
17702,
2015,
1010,
2862,
1026,
13483,
3085,
1028,
2047,
7840,
2721,
4523,
1007,
1063,
2005,
1006,
13483,
3085,
2783,
18447,
212... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java | DescriptorProperties.putLong | public void putLong(String key, long l) {
checkNotNull(key);
put(key, Long.toString(l));
} | java | public void putLong(String key, long l) {
checkNotNull(key);
put(key, Long.toString(l));
} | [
"public",
"void",
"putLong",
"(",
"String",
"key",
",",
"long",
"l",
")",
"{",
"checkNotNull",
"(",
"key",
")",
";",
"put",
"(",
"key",
",",
"Long",
".",
"toString",
"(",
"l",
")",
")",
";",
"}"
] | Adds a long under the given key. | [
"Adds",
"a",
"long",
"under",
"the",
"given",
"key",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java#L139-L142 | train | Put a long value into the mapping. | [
30522,
2270,
11675,
2404,
10052,
1006,
5164,
3145,
1010,
2146,
1048,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
3145,
1007,
1025,
2404,
1006,
3145,
1010,
2146,
1012,
2000,
3367,
4892,
1006,
1048,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.unWrap | public static short[] unWrap(Short... values) {
if (null == values) {
return null;
}
final int length = values.length;
if (0 == length) {
return new short[0];
}
final short[] array = new short[length];
for (int i = 0; i < length; i++) {
array[i] = values[i].shortValue();
}
return array;
} | java | public static short[] unWrap(Short... values) {
if (null == values) {
return null;
}
final int length = values.length;
if (0 == length) {
return new short[0];
}
final short[] array = new short[length];
for (int i = 0; i < length; i++) {
array[i] = values[i].shortValue();
}
return array;
} | [
"public",
"static",
"short",
"[",
"]",
"unWrap",
"(",
"Short",
"...",
"values",
")",
"{",
"if",
"(",
"null",
"==",
"values",
")",
"{",
"return",
"null",
";",
"}",
"final",
"int",
"length",
"=",
"values",
".",
"length",
";",
"if",
"(",
"0",
"==",
... | 包装类数组转为原始类型数组
@param values 包装类型数组
@return 原始类型数组 | [
"包装类数组转为原始类型数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L1597-L1611 | train | Creates an array of shorts that are wrapped in a sequence of shorts. | [
30522,
2270,
10763,
2460,
1031,
1033,
4895,
13088,
9331,
1006,
2460,
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,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java | CharArrayBuffer.append | public void append(final CharArrayBuffer b, final int off, final int len) {
if (b == null) {
return;
}
append(b.array, off, len);
} | java | public void append(final CharArrayBuffer b, final int off, final int len) {
if (b == null) {
return;
}
append(b.array, off, len);
} | [
"public",
"void",
"append",
"(",
"final",
"CharArrayBuffer",
"b",
",",
"final",
"int",
"off",
",",
"final",
"int",
"len",
")",
"{",
"if",
"(",
"b",
"==",
"null",
")",
"{",
"return",
";",
"}",
"append",
"(",
"b",
".",
"array",
",",
"off",
",",
"le... | Appends {@code len} chars to this buffer from the given source
buffer starting at index {@code off}. The capacity of the
destination buffer is increased, if necessary, to accommodate all
{@code len} chars.
@param b the source buffer to be appended.
@param off the index of the first char to append.
@param len the number of chars to append.
@throws IndexOutOfBoundsException if {@code off} is out of
range, {@code len} is negative, or
{@code off} + {@code len} is out of range. | [
"Appends",
"{",
"@code",
"len",
"}",
"chars",
"to",
"this",
"buffer",
"from",
"the",
"given",
"source",
"buffer",
"starting",
"at",
"index",
"{",
"@code",
"off",
"}",
".",
"The",
"capacity",
"of",
"the",
"destination",
"buffer",
"is",
"increased",
"if",
... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java#L126-L131 | train | Append a char array buffer to the end of the log. | [
30522,
2270,
11675,
10439,
10497,
1006,
2345,
25869,
2906,
9447,
8569,
12494,
1038,
1010,
2345,
20014,
2125,
1010,
2345,
20014,
18798,
1007,
1063,
2065,
1006,
1038,
1027,
1027,
19701,
1007,
1063,
2709,
1025,
1065,
10439,
10497,
1006,
1038,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitReader.java | Bzip2BitReader.hasReadableBits | boolean hasReadableBits(int count) {
if (count < 0) {
throw new IllegalArgumentException("count: " + count + " (expected value greater than 0)");
}
return bitCount >= count || (in.readableBytes() << 3 & Integer.MAX_VALUE) >= count - bitCount;
} | java | boolean hasReadableBits(int count) {
if (count < 0) {
throw new IllegalArgumentException("count: " + count + " (expected value greater than 0)");
}
return bitCount >= count || (in.readableBytes() << 3 & Integer.MAX_VALUE) >= count - bitCount;
} | [
"boolean",
"hasReadableBits",
"(",
"int",
"count",
")",
"{",
"if",
"(",
"count",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"count: \"",
"+",
"count",
"+",
"\" (expected value greater than 0)\"",
")",
";",
"}",
"return",
"bitCount",
... | Checks that the specified number of bits available for reading.
@param count The number of bits to check
@return {@code true} if {@code count} bits are available for reading, otherwise {@code false} | [
"Checks",
"that",
"the",
"specified",
"number",
"of",
"bits",
"available",
"for",
"reading",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitReader.java#L138-L143 | train | Check if the input stream has at least the specified number of bits. | [
30522,
22017,
20898,
2038,
16416,
20782,
16313,
2015,
1006,
20014,
4175,
1007,
1063,
2065,
1006,
4175,
1026,
1014,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
4175,
1024,
1000,
1009,
4175,
1009,
1000,
1006,
35... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/jobmanager/scheduler/Scheduler.java | Scheduler.scheduleTask | private Object scheduleTask(ScheduledUnit task, boolean queueIfNoResource, Iterable<TaskManagerLocation> preferredLocations) throws NoResourceAvailableException {
if (task == null) {
throw new NullPointerException();
}
if (LOG.isDebugEnabled()) {
LOG.debug("Scheduling task " + task);
}
final ExecutionVertex vertex = task.getTaskToExecute().getVertex();
final boolean forceExternalLocation = false &&
preferredLocations != null && preferredLocations.iterator().hasNext();
synchronized (globalLock) {
SlotSharingGroup sharingUnit = vertex.getJobVertex().getSlotSharingGroup();
if (sharingUnit != null) {
// 1) === If the task has a slot sharing group, schedule with shared slots ===
if (queueIfNoResource) {
throw new IllegalArgumentException(
"A task with a vertex sharing group was scheduled in a queued fashion.");
}
final SlotSharingGroupAssignment assignment = sharingUnit.getTaskAssignment();
final CoLocationConstraint constraint = task.getCoLocationConstraint();
// sanity check that we do not use an externally forced location and a co-location constraint together
if (constraint != null && forceExternalLocation) {
throw new IllegalArgumentException("The scheduling cannot be constrained simultaneously by a "
+ "co-location constraint and an external location constraint.");
}
// get a slot from the group, if the group has one for us (and can fulfill the constraint)
final SimpleSlot slotFromGroup;
if (constraint == null) {
slotFromGroup = assignment.getSlotForTask(vertex.getJobvertexId(), preferredLocations);
}
else {
slotFromGroup = assignment.getSlotForTask(constraint, preferredLocations);
}
SimpleSlot newSlot = null;
SimpleSlot toUse = null;
// the following needs to make sure any allocated slot is released in case of an error
try {
// check whether the slot from the group is already what we want.
// any slot that is local, or where the assignment was unconstrained is good!
if (slotFromGroup != null && slotFromGroup.getLocality() != Locality.NON_LOCAL) {
// if this is the first slot for the co-location constraint, we lock
// the location, because we are quite happy with the slot
if (constraint != null && !constraint.isAssigned()) {
constraint.lockLocation();
}
updateLocalityCounters(slotFromGroup, vertex);
return slotFromGroup;
}
// the group did not have a local slot for us. see if we can one (or a better one)
// our location preference is either determined by the location constraint, or by the
// vertex's preferred locations
final Iterable<TaskManagerLocation> locations;
final boolean localOnly;
if (constraint != null && constraint.isAssigned()) {
locations = Collections.singleton(constraint.getLocation());
localOnly = true;
}
else {
locations = preferredLocations;
localOnly = forceExternalLocation;
}
newSlot = getNewSlotForSharingGroup(vertex, locations, assignment, constraint, localOnly);
if (newSlot == null) {
if (slotFromGroup == null) {
// both null, which means there is nothing available at all
if (constraint != null && constraint.isAssigned()) {
// nothing is available on the node where the co-location constraint forces us to
throw new NoResourceAvailableException("Could not allocate a slot on instance " +
constraint.getLocation() + ", as required by the co-location constraint.");
}
else if (forceExternalLocation) {
// could not satisfy the external location constraint
String hosts = getHostnamesFromInstances(preferredLocations);
throw new NoResourceAvailableException("Could not schedule task " + vertex
+ " to any of the required hosts: " + hosts);
}
else {
// simply nothing is available
throw new NoResourceAvailableException(task, getNumberOfAvailableInstances(),
getTotalNumberOfSlots(), getNumberOfAvailableSlots());
}
}
else {
// got a non-local from the group, and no new one, so we use the non-local
// slot from the sharing group
toUse = slotFromGroup;
}
}
else if (slotFromGroup == null || !slotFromGroup.isAlive() || newSlot.getLocality() == Locality.LOCAL) {
// if there is no slot from the group, or the new slot is local,
// then we use the new slot
if (slotFromGroup != null) {
slotFromGroup.releaseSlot(null);
}
toUse = newSlot;
}
else {
// both are available and usable. neither is local. in that case, we may
// as well use the slot from the sharing group, to minimize the number of
// instances that the job occupies
newSlot.releaseSlot(null);
toUse = slotFromGroup;
}
// if this is the first slot for the co-location constraint, we lock
// the location, because we are going to use that slot
if (constraint != null && !constraint.isAssigned()) {
constraint.lockLocation();
}
updateLocalityCounters(toUse, vertex);
}
catch (NoResourceAvailableException e) {
throw e;
}
catch (Throwable t) {
if (slotFromGroup != null) {
slotFromGroup.releaseSlot(t);
}
if (newSlot != null) {
newSlot.releaseSlot(t);
}
ExceptionUtils.rethrow(t, "An error occurred while allocating a slot in a sharing group");
}
return toUse;
}
else {
// 2) === schedule without hints and sharing ===
SimpleSlot slot = getFreeSlotForTask(vertex, preferredLocations, forceExternalLocation);
if (slot != null) {
updateLocalityCounters(slot, vertex);
return slot;
}
else {
// no resource available now, so queue the request
if (queueIfNoResource) {
CompletableFuture<LogicalSlot> future = new CompletableFuture<>();
this.taskQueue.add(new QueuedTask(task, future));
return future;
}
else if (forceExternalLocation) {
String hosts = getHostnamesFromInstances(preferredLocations);
throw new NoResourceAvailableException("Could not schedule task " + vertex
+ " to any of the required hosts: " + hosts);
}
else {
throw new NoResourceAvailableException(getNumberOfAvailableInstances(),
getTotalNumberOfSlots(), getNumberOfAvailableSlots());
}
}
}
}
} | java | private Object scheduleTask(ScheduledUnit task, boolean queueIfNoResource, Iterable<TaskManagerLocation> preferredLocations) throws NoResourceAvailableException {
if (task == null) {
throw new NullPointerException();
}
if (LOG.isDebugEnabled()) {
LOG.debug("Scheduling task " + task);
}
final ExecutionVertex vertex = task.getTaskToExecute().getVertex();
final boolean forceExternalLocation = false &&
preferredLocations != null && preferredLocations.iterator().hasNext();
synchronized (globalLock) {
SlotSharingGroup sharingUnit = vertex.getJobVertex().getSlotSharingGroup();
if (sharingUnit != null) {
// 1) === If the task has a slot sharing group, schedule with shared slots ===
if (queueIfNoResource) {
throw new IllegalArgumentException(
"A task with a vertex sharing group was scheduled in a queued fashion.");
}
final SlotSharingGroupAssignment assignment = sharingUnit.getTaskAssignment();
final CoLocationConstraint constraint = task.getCoLocationConstraint();
// sanity check that we do not use an externally forced location and a co-location constraint together
if (constraint != null && forceExternalLocation) {
throw new IllegalArgumentException("The scheduling cannot be constrained simultaneously by a "
+ "co-location constraint and an external location constraint.");
}
// get a slot from the group, if the group has one for us (and can fulfill the constraint)
final SimpleSlot slotFromGroup;
if (constraint == null) {
slotFromGroup = assignment.getSlotForTask(vertex.getJobvertexId(), preferredLocations);
}
else {
slotFromGroup = assignment.getSlotForTask(constraint, preferredLocations);
}
SimpleSlot newSlot = null;
SimpleSlot toUse = null;
// the following needs to make sure any allocated slot is released in case of an error
try {
// check whether the slot from the group is already what we want.
// any slot that is local, or where the assignment was unconstrained is good!
if (slotFromGroup != null && slotFromGroup.getLocality() != Locality.NON_LOCAL) {
// if this is the first slot for the co-location constraint, we lock
// the location, because we are quite happy with the slot
if (constraint != null && !constraint.isAssigned()) {
constraint.lockLocation();
}
updateLocalityCounters(slotFromGroup, vertex);
return slotFromGroup;
}
// the group did not have a local slot for us. see if we can one (or a better one)
// our location preference is either determined by the location constraint, or by the
// vertex's preferred locations
final Iterable<TaskManagerLocation> locations;
final boolean localOnly;
if (constraint != null && constraint.isAssigned()) {
locations = Collections.singleton(constraint.getLocation());
localOnly = true;
}
else {
locations = preferredLocations;
localOnly = forceExternalLocation;
}
newSlot = getNewSlotForSharingGroup(vertex, locations, assignment, constraint, localOnly);
if (newSlot == null) {
if (slotFromGroup == null) {
// both null, which means there is nothing available at all
if (constraint != null && constraint.isAssigned()) {
// nothing is available on the node where the co-location constraint forces us to
throw new NoResourceAvailableException("Could not allocate a slot on instance " +
constraint.getLocation() + ", as required by the co-location constraint.");
}
else if (forceExternalLocation) {
// could not satisfy the external location constraint
String hosts = getHostnamesFromInstances(preferredLocations);
throw new NoResourceAvailableException("Could not schedule task " + vertex
+ " to any of the required hosts: " + hosts);
}
else {
// simply nothing is available
throw new NoResourceAvailableException(task, getNumberOfAvailableInstances(),
getTotalNumberOfSlots(), getNumberOfAvailableSlots());
}
}
else {
// got a non-local from the group, and no new one, so we use the non-local
// slot from the sharing group
toUse = slotFromGroup;
}
}
else if (slotFromGroup == null || !slotFromGroup.isAlive() || newSlot.getLocality() == Locality.LOCAL) {
// if there is no slot from the group, or the new slot is local,
// then we use the new slot
if (slotFromGroup != null) {
slotFromGroup.releaseSlot(null);
}
toUse = newSlot;
}
else {
// both are available and usable. neither is local. in that case, we may
// as well use the slot from the sharing group, to minimize the number of
// instances that the job occupies
newSlot.releaseSlot(null);
toUse = slotFromGroup;
}
// if this is the first slot for the co-location constraint, we lock
// the location, because we are going to use that slot
if (constraint != null && !constraint.isAssigned()) {
constraint.lockLocation();
}
updateLocalityCounters(toUse, vertex);
}
catch (NoResourceAvailableException e) {
throw e;
}
catch (Throwable t) {
if (slotFromGroup != null) {
slotFromGroup.releaseSlot(t);
}
if (newSlot != null) {
newSlot.releaseSlot(t);
}
ExceptionUtils.rethrow(t, "An error occurred while allocating a slot in a sharing group");
}
return toUse;
}
else {
// 2) === schedule without hints and sharing ===
SimpleSlot slot = getFreeSlotForTask(vertex, preferredLocations, forceExternalLocation);
if (slot != null) {
updateLocalityCounters(slot, vertex);
return slot;
}
else {
// no resource available now, so queue the request
if (queueIfNoResource) {
CompletableFuture<LogicalSlot> future = new CompletableFuture<>();
this.taskQueue.add(new QueuedTask(task, future));
return future;
}
else if (forceExternalLocation) {
String hosts = getHostnamesFromInstances(preferredLocations);
throw new NoResourceAvailableException("Could not schedule task " + vertex
+ " to any of the required hosts: " + hosts);
}
else {
throw new NoResourceAvailableException(getNumberOfAvailableInstances(),
getTotalNumberOfSlots(), getNumberOfAvailableSlots());
}
}
}
}
} | [
"private",
"Object",
"scheduleTask",
"(",
"ScheduledUnit",
"task",
",",
"boolean",
"queueIfNoResource",
",",
"Iterable",
"<",
"TaskManagerLocation",
">",
"preferredLocations",
")",
"throws",
"NoResourceAvailableException",
"{",
"if",
"(",
"task",
"==",
"null",
")",
... | Returns either a {@link SimpleSlot}, or a {@link CompletableFuture}. | [
"Returns",
"either",
"a",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/scheduler/Scheduler.java#L180-L356 | train | Schedule a task. | [
30522,
2797,
4874,
6134,
10230,
2243,
1006,
5115,
19496,
2102,
4708,
1010,
22017,
20898,
24240,
10128,
12131,
2229,
8162,
3401,
1010,
2009,
6906,
3468,
1026,
4708,
24805,
4590,
4135,
10719,
1028,
6871,
4135,
10719,
2015,
1007,
11618,
4496,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SingletonServiceFactory.java | SingletonServiceFactory.getBeans | public static <T> T[] getBeans(Class<T> interfaceClass) {
Object object = serviceMap.get(interfaceClass.getName());
if(object == null) return null;
if(object instanceof Object[]) {
return (T[])object;
} else {
Object array = Array.newInstance(interfaceClass, 1);
Array.set(array, 0, object);
return (T[])array;
}
} | java | public static <T> T[] getBeans(Class<T> interfaceClass) {
Object object = serviceMap.get(interfaceClass.getName());
if(object == null) return null;
if(object instanceof Object[]) {
return (T[])object;
} else {
Object array = Array.newInstance(interfaceClass, 1);
Array.set(array, 0, object);
return (T[])array;
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"getBeans",
"(",
"Class",
"<",
"T",
">",
"interfaceClass",
")",
"{",
"Object",
"object",
"=",
"serviceMap",
".",
"get",
"(",
"interfaceClass",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"object",
... | Get a list of cached singleton objects from service map by interface class. If there
is only one object in the serviceMap, then construct the list with this only object.
@param interfaceClass Interface class
@param <T> class type
@return The array of implementation objects | [
"Get",
"a",
"list",
"of",
"cached",
"singleton",
"objects",
"from",
"service",
"map",
"by",
"interface",
"class",
".",
"If",
"there",
"is",
"only",
"one",
"object",
"in",
"the",
"serviceMap",
"then",
"construct",
"the",
"list",
"with",
"this",
"only",
"obj... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/SingletonServiceFactory.java#L321-L331 | train | Get the beans of the specified interface class. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
1031,
1033,
2131,
4783,
6962,
1006,
2465,
1026,
1056,
1028,
8278,
26266,
1007,
1063,
4874,
4874,
1027,
2326,
2863,
2361,
1012,
2131,
1006,
8278,
26266,
1012,
2131,
18442,
1006,
1007,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/concurrent/FastThreadLocal.java | FastThreadLocal.removeAll | public static void removeAll() {
InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap.getIfSet();
if (threadLocalMap == null) {
return;
}
try {
Object v = threadLocalMap.indexedVariable(variablesToRemoveIndex);
if (v != null && v != InternalThreadLocalMap.UNSET) {
@SuppressWarnings("unchecked")
Set<FastThreadLocal<?>> variablesToRemove = (Set<FastThreadLocal<?>>) v;
FastThreadLocal<?>[] variablesToRemoveArray =
variablesToRemove.toArray(new FastThreadLocal[0]);
for (FastThreadLocal<?> tlv: variablesToRemoveArray) {
tlv.remove(threadLocalMap);
}
}
} finally {
InternalThreadLocalMap.remove();
}
} | java | public static void removeAll() {
InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap.getIfSet();
if (threadLocalMap == null) {
return;
}
try {
Object v = threadLocalMap.indexedVariable(variablesToRemoveIndex);
if (v != null && v != InternalThreadLocalMap.UNSET) {
@SuppressWarnings("unchecked")
Set<FastThreadLocal<?>> variablesToRemove = (Set<FastThreadLocal<?>>) v;
FastThreadLocal<?>[] variablesToRemoveArray =
variablesToRemove.toArray(new FastThreadLocal[0]);
for (FastThreadLocal<?> tlv: variablesToRemoveArray) {
tlv.remove(threadLocalMap);
}
}
} finally {
InternalThreadLocalMap.remove();
}
} | [
"public",
"static",
"void",
"removeAll",
"(",
")",
"{",
"InternalThreadLocalMap",
"threadLocalMap",
"=",
"InternalThreadLocalMap",
".",
"getIfSet",
"(",
")",
";",
"if",
"(",
"threadLocalMap",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"Object",
... | Removes all {@link FastThreadLocal} variables bound to the current thread. This operation is useful when you
are in a container environment, and you don't want to leave the thread local variables in the threads you do not
manage. | [
"Removes",
"all",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/FastThreadLocal.java#L53-L73 | train | Removes all the FastThreadLocal objects from the thread local map. | [
30522,
2270,
10763,
11675,
6366,
8095,
1006,
1007,
1063,
4722,
2705,
16416,
19422,
24755,
19145,
2361,
11689,
4135,
9289,
2863,
2361,
1027,
4722,
2705,
16416,
19422,
24755,
19145,
2361,
1012,
2131,
10128,
13462,
1006,
1007,
1025,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/cluster/SparseVector.java | SparseVector.cosine | double cosine(SparseVector vec1, SparseVector vec2)
{
double norm1 = vec1.norm();
double norm2 = vec2.norm();
double result = 0.0f;
if (norm1 == 0 && norm2 == 0)
{
return result;
}
else
{
double prod = inner_product(vec1, vec2);
result = prod / (norm1 * norm2);
return Double.isNaN(result) ? 0.0f : result;
}
} | java | double cosine(SparseVector vec1, SparseVector vec2)
{
double norm1 = vec1.norm();
double norm2 = vec2.norm();
double result = 0.0f;
if (norm1 == 0 && norm2 == 0)
{
return result;
}
else
{
double prod = inner_product(vec1, vec2);
result = prod / (norm1 * norm2);
return Double.isNaN(result) ? 0.0f : result;
}
} | [
"double",
"cosine",
"(",
"SparseVector",
"vec1",
",",
"SparseVector",
"vec2",
")",
"{",
"double",
"norm1",
"=",
"vec1",
".",
"norm",
"(",
")",
";",
"double",
"norm2",
"=",
"vec2",
".",
"norm",
"(",
")",
";",
"double",
"result",
"=",
"0.0f",
";",
"if"... | Calculate the cosine value between vectors. | [
"Calculate",
"the",
"cosine",
"value",
"between",
"vectors",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/SparseVector.java#L167-L182 | train | Cosine of two vectors. | [
30522,
3313,
2522,
11493,
2063,
1006,
20288,
3726,
16761,
2310,
2278,
2487,
1010,
20288,
3726,
16761,
2310,
2278,
2475,
1007,
1063,
3313,
13373,
2487,
1027,
2310,
2278,
2487,
1012,
13373,
1006,
1007,
1025,
3313,
13373,
2475,
1027,
2310,
227... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java | SslContextBuilder.forServer | public static SslContextBuilder forServer(
InputStream keyCertChainInputStream, InputStream keyInputStream, String keyPassword) {
return new SslContextBuilder(true).keyManager(keyCertChainInputStream, keyInputStream, keyPassword);
} | java | public static SslContextBuilder forServer(
InputStream keyCertChainInputStream, InputStream keyInputStream, String keyPassword) {
return new SslContextBuilder(true).keyManager(keyCertChainInputStream, keyInputStream, keyPassword);
} | [
"public",
"static",
"SslContextBuilder",
"forServer",
"(",
"InputStream",
"keyCertChainInputStream",
",",
"InputStream",
"keyInputStream",
",",
"String",
"keyPassword",
")",
"{",
"return",
"new",
"SslContextBuilder",
"(",
"true",
")",
".",
"keyManager",
"(",
"keyCertC... | Creates a builder for new server-side {@link SslContext}.
@param keyCertChainInputStream an input stream for an X.509 certificate chain in PEM format
@param keyInputStream an input stream for a PKCS#8 private key in PEM format
@param keyPassword the password of the {@code keyFile}, or {@code null} if it's not
password-protected
@see #keyManager(InputStream, InputStream, String) | [
"Creates",
"a",
"builder",
"for",
"new",
"server",
"-",
"side",
"{",
"@link",
"SslContext",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L102-L105 | train | Create a SslContextBuilder for a server using the specified key certificates. | [
30522,
2270,
10763,
7020,
22499,
10111,
18413,
8569,
23891,
2099,
2005,
8043,
6299,
1006,
20407,
25379,
3145,
17119,
10649,
8113,
2378,
18780,
21422,
1010,
20407,
25379,
3145,
2378,
18780,
21422,
1010,
5164,
3145,
15194,
18351,
1007,
1063,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getShortClassName | public static String getShortClassName(String className) {
final List<String> packages = StrUtil.split(className, CharUtil.DOT);
if (null == packages || packages.size() < 2) {
return className;
}
final int size = packages.size();
final StringBuilder result = StrUtil.builder();
result.append(packages.get(0).charAt(0));
for (int i = 1; i < size - 1; i++) {
result.append(CharUtil.DOT).append(packages.get(i).charAt(0));
}
result.append(CharUtil.DOT).append(packages.get(size - 1));
return result.toString();
} | java | public static String getShortClassName(String className) {
final List<String> packages = StrUtil.split(className, CharUtil.DOT);
if (null == packages || packages.size() < 2) {
return className;
}
final int size = packages.size();
final StringBuilder result = StrUtil.builder();
result.append(packages.get(0).charAt(0));
for (int i = 1; i < size - 1; i++) {
result.append(CharUtil.DOT).append(packages.get(i).charAt(0));
}
result.append(CharUtil.DOT).append(packages.get(size - 1));
return result.toString();
} | [
"public",
"static",
"String",
"getShortClassName",
"(",
"String",
"className",
")",
"{",
"final",
"List",
"<",
"String",
">",
"packages",
"=",
"StrUtil",
".",
"split",
"(",
"className",
",",
"CharUtil",
".",
"DOT",
")",
";",
"if",
"(",
"null",
"==",
"pac... | 获取完整类名的短格式如:<br>
cn.hutool.core.util.StrUtil -》c.h.c.u.StrUtil
@param className 类名
@return 短格式类名
@since 4.1.9 | [
"获取完整类名的短格式如:<br",
">",
"cn",
".",
"hutool",
".",
"core",
".",
"util",
".",
"StrUtil",
"-",
"》c",
".",
"h",
".",
"c",
".",
"u",
".",
"StrUtil"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L119-L133 | train | Returns the short class name. | [
30522,
2270,
10763,
5164,
4152,
27794,
26266,
18442,
1006,
5164,
2465,
18442,
1007,
1063,
2345,
2862,
1026,
5164,
1028,
14555,
1027,
2358,
22134,
4014,
1012,
3975,
1006,
2465,
18442,
1010,
25869,
21823,
2140,
1012,
11089,
1007,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/algorithm/EditDistance.java | EditDistance.ed | public static int ed(String wrongWord, String rightWord)
{
final int m = wrongWord.length();
final int n = rightWord.length();
int[][] d = new int[m + 1][n + 1];
for (int j = 0; j <= n; ++j)
{
d[0][j] = j;
}
for (int i = 0; i <= m; ++i)
{
d[i][0] = i;
}
for (int i = 1; i <= m; ++i)
{
char ci = wrongWord.charAt(i - 1);
for (int j = 1; j <= n; ++j)
{
char cj = rightWord.charAt(j - 1);
if (ci == cj)
{
d[i][j] = d[i - 1][j - 1];
}
else if (i > 1 && j > 1 && ci == rightWord.charAt(j - 2) && cj == wrongWord.charAt(i - 2))
{
// 交错相等
d[i][j] = 1 + Math.min(d[i - 2][j - 2], Math.min(d[i][j - 1], d[i - 1][j]));
}
else
{
// 等号右边的分别代表 将ci改成cj 错串加cj 错串删ci
d[i][j] = Math.min(d[i - 1][j - 1] + 1, Math.min(d[i][j - 1] + 1, d[i - 1][j] + 1));
}
}
}
return d[m][n];
} | java | public static int ed(String wrongWord, String rightWord)
{
final int m = wrongWord.length();
final int n = rightWord.length();
int[][] d = new int[m + 1][n + 1];
for (int j = 0; j <= n; ++j)
{
d[0][j] = j;
}
for (int i = 0; i <= m; ++i)
{
d[i][0] = i;
}
for (int i = 1; i <= m; ++i)
{
char ci = wrongWord.charAt(i - 1);
for (int j = 1; j <= n; ++j)
{
char cj = rightWord.charAt(j - 1);
if (ci == cj)
{
d[i][j] = d[i - 1][j - 1];
}
else if (i > 1 && j > 1 && ci == rightWord.charAt(j - 2) && cj == wrongWord.charAt(i - 2))
{
// 交错相等
d[i][j] = 1 + Math.min(d[i - 2][j - 2], Math.min(d[i][j - 1], d[i - 1][j]));
}
else
{
// 等号右边的分别代表 将ci改成cj 错串加cj 错串删ci
d[i][j] = Math.min(d[i - 1][j - 1] + 1, Math.min(d[i][j - 1] + 1, d[i - 1][j] + 1));
}
}
}
return d[m][n];
} | [
"public",
"static",
"int",
"ed",
"(",
"String",
"wrongWord",
",",
"String",
"rightWord",
")",
"{",
"final",
"int",
"m",
"=",
"wrongWord",
".",
"length",
"(",
")",
";",
"final",
"int",
"n",
"=",
"rightWord",
".",
"length",
"(",
")",
";",
"int",
"[",
... | 编辑距离
@param wrongWord 串A,其实它们两个调换位置还是一样的
@param rightWord 串B
@return 它们之间的距离 | [
"编辑距离"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/EditDistance.java#L144-L183 | train | Get the EE value of the 2 - digit CRS. | [
30522,
2270,
10763,
20014,
3968,
1006,
5164,
3308,
18351,
1010,
5164,
2157,
18351,
1007,
1063,
2345,
20014,
1049,
1027,
3308,
18351,
1012,
3091,
1006,
1007,
1025,
2345,
20014,
1050,
1027,
2157,
18351,
1012,
3091,
1006,
1007,
1025,
20014,
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/NumberUtil.java | NumberUtil.add | public static double add(float v1, float v2) {
return add(Float.toString(v1), Float.toString(v2)).doubleValue();
} | java | public static double add(float v1, float v2) {
return add(Float.toString(v1), Float.toString(v2)).doubleValue();
} | [
"public",
"static",
"double",
"add",
"(",
"float",
"v1",
",",
"float",
"v2",
")",
"{",
"return",
"add",
"(",
"Float",
".",
"toString",
"(",
"v1",
")",
",",
"Float",
".",
"toString",
"(",
"v2",
")",
")",
".",
"doubleValue",
"(",
")",
";",
"}"
] | 提供精确的加法运算
@param v1 被加数
@param v2 加数
@return 和 | [
"提供精确的加法运算"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L52-L54 | train | Add two floats. | [
30522,
2270,
10763,
3313,
5587,
1006,
14257,
1058,
2487,
1010,
14257,
1058,
2475,
1007,
1063,
2709,
5587,
1006,
14257,
1012,
2000,
3367,
4892,
1006,
1058,
2487,
1007,
1010,
14257,
1012,
2000,
3367,
4892,
1006,
1058,
2475,
1007,
1007,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/model/LinearModel.java | LinearModel.score | public double score(int[] featureVector, int currentTag)
{
double score = 0;
for (int index : featureVector)
{
if (index == -1)
{
continue;
}
else if (index < -1 || index >= featureMap.size())
{
throw new IllegalArgumentException("在打分时传入了非法的下标");
}
else
{
index = index * featureMap.tagSet.size() + currentTag;
score += parameter[index]; // 其实就是特征权重的累加
}
}
return score;
} | java | public double score(int[] featureVector, int currentTag)
{
double score = 0;
for (int index : featureVector)
{
if (index == -1)
{
continue;
}
else if (index < -1 || index >= featureMap.size())
{
throw new IllegalArgumentException("在打分时传入了非法的下标");
}
else
{
index = index * featureMap.tagSet.size() + currentTag;
score += parameter[index]; // 其实就是特征权重的累加
}
}
return score;
} | [
"public",
"double",
"score",
"(",
"int",
"[",
"]",
"featureVector",
",",
"int",
"currentTag",
")",
"{",
"double",
"score",
"=",
"0",
";",
"for",
"(",
"int",
"index",
":",
"featureVector",
")",
"{",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"con... | 通过命中的特征函数计算得分
@param featureVector 压缩形式的特征id构成的特征向量
@return | [
"通过命中的特征函数计算得分"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/model/LinearModel.java#L355-L375 | train | Score a vector of features with a specific tag. | [
30522,
2270,
3313,
3556,
1006,
20014,
1031,
1033,
3444,
3726,
16761,
1010,
20014,
2783,
15900,
1007,
1063,
3313,
3556,
1027,
1014,
1025,
2005,
1006,
20014,
5950,
1024,
3444,
3726,
16761,
1007,
1063,
2065,
1006,
5950,
1027,
1027,
1011,
1015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.