repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpointStats.java | PendingCheckpointStats.reportCompletedCheckpoint | CompletedCheckpointStats.DiscardCallback reportCompletedCheckpoint(String externalPointer) {
CompletedCheckpointStats completed = new CompletedCheckpointStats(
checkpointId,
triggerTimestamp,
props,
numberOfSubtasks,
new HashMap<>(taskStats),
currentNumAcknowledgedSubtasks,
currentStateSize,
currentAlignmentBuffered,
latestAcknowledgedSubtask,
externalPointer);
trackerCallback.reportCompletedCheckpoint(completed);
return completed.getDiscardCallback();
} | java | CompletedCheckpointStats.DiscardCallback reportCompletedCheckpoint(String externalPointer) {
CompletedCheckpointStats completed = new CompletedCheckpointStats(
checkpointId,
triggerTimestamp,
props,
numberOfSubtasks,
new HashMap<>(taskStats),
currentNumAcknowledgedSubtasks,
currentStateSize,
currentAlignmentBuffered,
latestAcknowledgedSubtask,
externalPointer);
trackerCallback.reportCompletedCheckpoint(completed);
return completed.getDiscardCallback();
} | [
"CompletedCheckpointStats",
".",
"DiscardCallback",
"reportCompletedCheckpoint",
"(",
"String",
"externalPointer",
")",
"{",
"CompletedCheckpointStats",
"completed",
"=",
"new",
"CompletedCheckpointStats",
"(",
"checkpointId",
",",
"triggerTimestamp",
",",
"props",
",",
"nu... | Reports a successfully completed pending checkpoint.
@param externalPointer Optional external storage path if checkpoint was externalized.
@return Callback for the {@link CompletedCheckpoint} instance to notify about disposal. | [
"Reports",
"a",
"successfully",
"completed",
"pending",
"checkpoint",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpointStats.java#L146-L162 | train | Report the completed checkpoint. | [
30522,
2949,
5403,
3600,
26521,
29336,
2015,
1012,
5860,
4232,
9289,
20850,
8684,
3189,
9006,
10814,
3064,
5403,
3600,
8400,
1006,
5164,
6327,
8400,
2121,
1007,
1063,
2949,
5403,
3600,
26521,
29336,
2015,
2949,
1027,
2047,
2949,
5403,
3600,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/writer/S3RecoverableWriter.java | S3RecoverableWriter.castToS3Recoverable | private static S3Recoverable castToS3Recoverable(CommitRecoverable recoverable) {
if (recoverable instanceof S3Recoverable) {
return (S3Recoverable) recoverable;
}
throw new IllegalArgumentException(
"S3 File System cannot recover recoverable for other file system: " + recoverable);
} | java | private static S3Recoverable castToS3Recoverable(CommitRecoverable recoverable) {
if (recoverable instanceof S3Recoverable) {
return (S3Recoverable) recoverable;
}
throw new IllegalArgumentException(
"S3 File System cannot recover recoverable for other file system: " + recoverable);
} | [
"private",
"static",
"S3Recoverable",
"castToS3Recoverable",
"(",
"CommitRecoverable",
"recoverable",
")",
"{",
"if",
"(",
"recoverable",
"instanceof",
"S3Recoverable",
")",
"{",
"return",
"(",
"S3Recoverable",
")",
"recoverable",
";",
"}",
"throw",
"new",
"IllegalA... | --------------------------- Utils --------------------------- | [
"---------------------------",
"Utils",
"---------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/writer/S3RecoverableWriter.java#L135-L141 | train | Casts a commit recoverable to an S3Recoverable object. | [
30522,
2797,
10763,
1055,
2509,
2890,
3597,
26061,
3468,
3459,
13122,
2509,
2890,
3597,
26061,
3468,
1006,
10797,
2890,
3597,
26061,
3468,
8980,
3085,
1007,
1063,
2065,
1006,
8980,
3085,
6013,
11253,
1055,
2509,
2890,
3597,
26061,
3468,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java | VelocityUtil._newInitedProp | private static Properties _newInitedProp(String templateDir, String charset) {
final Properties properties = new Properties();
properties.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, templateDir);
properties.setProperty(Velocity.ENCODING_DEFAULT, charset);
properties.setProperty(Velocity.INPUT_ENCODING, charset);
// properties.setProperty(Velocity.OUTPUT_ENCODING, charset);
return properties;
} | java | private static Properties _newInitedProp(String templateDir, String charset) {
final Properties properties = new Properties();
properties.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, templateDir);
properties.setProperty(Velocity.ENCODING_DEFAULT, charset);
properties.setProperty(Velocity.INPUT_ENCODING, charset);
// properties.setProperty(Velocity.OUTPUT_ENCODING, charset);
return properties;
} | [
"private",
"static",
"Properties",
"_newInitedProp",
"(",
"String",
"templateDir",
",",
"String",
"charset",
")",
"{",
"final",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"properties",
".",
"setProperty",
"(",
"Velocity",
".",
"FILE_RES... | 新建一个初始化后的属性对象
@param templateDir 模板所在目录
@return 初始化后的属性对象 | [
"新建一个初始化后的属性对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L318-L327 | train | Creates a new initialized Properties object. | [
30522,
2797,
10763,
5144,
1035,
2047,
5498,
3064,
21572,
2361,
1006,
5164,
23561,
4305,
2099,
1010,
5164,
25869,
13462,
1007,
1063,
2345,
5144,
5144,
1027,
2047,
5144,
1006,
1007,
1025,
5144,
1012,
2275,
21572,
4842,
3723,
1006,
10146,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/memory/MemoryManager.java | MemoryManager.release | public void release(MemorySegment segment) {
// check if segment is null or has already been freed
if (segment == null || segment.getOwner() == null) {
return;
}
final Object owner = segment.getOwner();
// -------------------- BEGIN CRITICAL SECTION -------------------
synchronized (lock) {
// prevent double return to this memory manager
if (segment.isFreed()) {
return;
}
if (isShutDown) {
throw new IllegalStateException("Memory manager has been shut down.");
}
// remove the reference in the map for the owner
try {
Set<MemorySegment> segsForOwner = this.allocatedSegments.get(owner);
if (segsForOwner != null) {
segsForOwner.remove(segment);
if (segsForOwner.isEmpty()) {
this.allocatedSegments.remove(owner);
}
}
if (isPreAllocated) {
// release the memory in any case
memoryPool.returnSegmentToPool(segment);
}
else {
segment.free();
numNonAllocatedPages++;
}
}
catch (Throwable t) {
throw new RuntimeException("Error removing book-keeping reference to allocated memory segment.", t);
}
}
// -------------------- END CRITICAL SECTION -------------------
} | java | public void release(MemorySegment segment) {
// check if segment is null or has already been freed
if (segment == null || segment.getOwner() == null) {
return;
}
final Object owner = segment.getOwner();
// -------------------- BEGIN CRITICAL SECTION -------------------
synchronized (lock) {
// prevent double return to this memory manager
if (segment.isFreed()) {
return;
}
if (isShutDown) {
throw new IllegalStateException("Memory manager has been shut down.");
}
// remove the reference in the map for the owner
try {
Set<MemorySegment> segsForOwner = this.allocatedSegments.get(owner);
if (segsForOwner != null) {
segsForOwner.remove(segment);
if (segsForOwner.isEmpty()) {
this.allocatedSegments.remove(owner);
}
}
if (isPreAllocated) {
// release the memory in any case
memoryPool.returnSegmentToPool(segment);
}
else {
segment.free();
numNonAllocatedPages++;
}
}
catch (Throwable t) {
throw new RuntimeException("Error removing book-keeping reference to allocated memory segment.", t);
}
}
// -------------------- END CRITICAL SECTION -------------------
} | [
"public",
"void",
"release",
"(",
"MemorySegment",
"segment",
")",
"{",
"// check if segment is null or has already been freed",
"if",
"(",
"segment",
"==",
"null",
"||",
"segment",
".",
"getOwner",
"(",
")",
"==",
"null",
")",
"{",
"return",
";",
"}",
"final",
... | Tries to release the memory for the specified segment. If the segment has already been released or
is null, the request is simply ignored.
<p>If the memory manager manages pre-allocated memory, the memory segment goes back to the memory pool.
Otherwise, the segment is only freed and made eligible for reclamation by the GC.
@param segment The segment to be released.
@throws IllegalArgumentException Thrown, if the given segment is of an incompatible type. | [
"Tries",
"to",
"release",
"the",
"memory",
"for",
"the",
"specified",
"segment",
".",
"If",
"the",
"segment",
"has",
"already",
"been",
"released",
"or",
"is",
"null",
"the",
"request",
"is",
"simply",
"ignored",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/memory/MemoryManager.java#L337-L380 | train | Release the memory segment. | [
30522,
2270,
11675,
2713,
1006,
3638,
3366,
21693,
4765,
6903,
1007,
1063,
1013,
1013,
4638,
2065,
6903,
2003,
19701,
2030,
2038,
2525,
2042,
10650,
2065,
1006,
6903,
1027,
1027,
19701,
1064,
1064,
6903,
1012,
2131,
12384,
2121,
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... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/ClosableBlockingQueue.java | ClosableBlockingQueue.add | public void add(E element) throws IllegalStateException {
requireNonNull(element);
lock.lock();
try {
if (open) {
elements.addLast(element);
if (elements.size() == 1) {
nonEmpty.signalAll();
}
} else {
throw new IllegalStateException("queue is closed");
}
} finally {
lock.unlock();
}
} | java | public void add(E element) throws IllegalStateException {
requireNonNull(element);
lock.lock();
try {
if (open) {
elements.addLast(element);
if (elements.size() == 1) {
nonEmpty.signalAll();
}
} else {
throw new IllegalStateException("queue is closed");
}
} finally {
lock.unlock();
}
} | [
"public",
"void",
"add",
"(",
"E",
"element",
")",
"throws",
"IllegalStateException",
"{",
"requireNonNull",
"(",
"element",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"open",
")",
"{",
"elements",
".",
"addLast",
"(",
"elemen... | Adds the element to the queue, or fails with an exception, if the queue is closed.
Checking whether the queue is open and adding the element is one atomic operation.
@param element The element to add.
@throws IllegalStateException Thrown, if the queue is closed. | [
"Adds",
"the",
"element",
"to",
"the",
"queue",
"or",
"fails",
"with",
"an",
"exception",
"if",
"the",
"queue",
"is",
"closed",
".",
"Checking",
"whether",
"the",
"queue",
"is",
"open",
"and",
"adding",
"the",
"element",
"is",
"one",
"atomic",
"operation",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/ClosableBlockingQueue.java#L200-L216 | train | Adds the specified element to the queue. | [
30522,
2270,
11675,
5587,
1006,
1041,
5783,
1007,
11618,
6206,
9153,
17389,
2595,
24422,
1063,
5478,
8540,
11231,
3363,
1006,
5783,
1007,
1025,
5843,
1012,
5843,
1006,
1007,
1025,
3046,
1063,
2065,
1006,
2330,
1007,
1063,
3787,
1012,
5587,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.indexOfIgnoreCaseAscii | public static int indexOfIgnoreCaseAscii(final CharSequence str, final CharSequence searchStr, int startPos) {
if (str == null || searchStr == null) {
return INDEX_NOT_FOUND;
}
if (startPos < 0) {
startPos = 0;
}
int searchStrLen = searchStr.length();
final int endLimit = str.length() - searchStrLen + 1;
if (startPos > endLimit) {
return INDEX_NOT_FOUND;
}
if (searchStrLen == 0) {
return startPos;
}
for (int i = startPos; i < endLimit; i++) {
if (regionMatchesAscii(str, true, i, searchStr, 0, searchStrLen)) {
return i;
}
}
return INDEX_NOT_FOUND;
} | java | public static int indexOfIgnoreCaseAscii(final CharSequence str, final CharSequence searchStr, int startPos) {
if (str == null || searchStr == null) {
return INDEX_NOT_FOUND;
}
if (startPos < 0) {
startPos = 0;
}
int searchStrLen = searchStr.length();
final int endLimit = str.length() - searchStrLen + 1;
if (startPos > endLimit) {
return INDEX_NOT_FOUND;
}
if (searchStrLen == 0) {
return startPos;
}
for (int i = startPos; i < endLimit; i++) {
if (regionMatchesAscii(str, true, i, searchStr, 0, searchStrLen)) {
return i;
}
}
return INDEX_NOT_FOUND;
} | [
"public",
"static",
"int",
"indexOfIgnoreCaseAscii",
"(",
"final",
"CharSequence",
"str",
",",
"final",
"CharSequence",
"searchStr",
",",
"int",
"startPos",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"searchStr",
"==",
"null",
")",
"{",
"return",
"INDEX... | <p>Case in-sensitive find of the first index within a CharSequence
from the specified position. This method optimized and works correctly for ASCII CharSequences only</p>
<p>A {@code null} CharSequence will return {@code -1}.
A negative start position is treated as zero.
An empty ("") search CharSequence always matches.
A start position greater than the string length only matches
an empty search CharSequence.</p>
<pre>
AsciiString.indexOfIgnoreCase(null, *, *) = -1
AsciiString.indexOfIgnoreCase(*, null, *) = -1
AsciiString.indexOfIgnoreCase("", "", 0) = 0
AsciiString.indexOfIgnoreCase("aabaabaa", "A", 0) = 0
AsciiString.indexOfIgnoreCase("aabaabaa", "B", 0) = 2
AsciiString.indexOfIgnoreCase("aabaabaa", "AB", 0) = 1
AsciiString.indexOfIgnoreCase("aabaabaa", "B", 3) = 5
AsciiString.indexOfIgnoreCase("aabaabaa", "B", 9) = -1
AsciiString.indexOfIgnoreCase("aabaabaa", "B", -1) = 2
AsciiString.indexOfIgnoreCase("aabaabaa", "", 2) = 2
AsciiString.indexOfIgnoreCase("abc", "", 9) = -1
</pre>
@param str the CharSequence to check, may be null
@param searchStr the CharSequence to find, may be null
@param startPos the start position, negative treated as zero
@return the first index of the search CharSequence (always ≥ startPos),
-1 if no match or {@code null} string input | [
"<p",
">",
"Case",
"in",
"-",
"sensitive",
"find",
"of",
"the",
"first",
"index",
"within",
"a",
"CharSequence",
"from",
"the",
"specified",
"position",
".",
"This",
"method",
"optimized",
"and",
"works",
"correctly",
"for",
"ASCII",
"CharSequences",
"only<",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L1766-L1787 | train | Gets the index of the first occurrence of the specified character sequence in the specified string ignoring case. | [
30522,
2270,
10763,
20014,
5950,
11253,
23773,
5686,
18382,
3022,
6895,
2072,
1006,
2345,
25869,
3366,
4226,
5897,
2358,
2099,
1010,
2345,
25869,
3366,
4226,
5897,
3945,
3367,
2099,
1010,
20014,
2707,
6873,
2015,
1007,
1063,
2065,
1006,
235... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | common/src/main/java/com/alibaba/otter/canal/common/utils/CommonUtils.java | CommonUtils.getConfPath | public static String getConfPath() {
String classpath = CommonUtils.class.getResource("/").getPath();
String confPath = classpath + "../conf/";
if (new File(confPath).exists()) {
return confPath;
} else {
return classpath;
}
} | java | public static String getConfPath() {
String classpath = CommonUtils.class.getResource("/").getPath();
String confPath = classpath + "../conf/";
if (new File(confPath).exists()) {
return confPath;
} else {
return classpath;
}
} | [
"public",
"static",
"String",
"getConfPath",
"(",
")",
"{",
"String",
"classpath",
"=",
"CommonUtils",
".",
"class",
".",
"getResource",
"(",
"\"/\"",
")",
".",
"getPath",
"(",
")",
";",
"String",
"confPath",
"=",
"classpath",
"+",
"\"../conf/\"",
";",
"if... | 获取conf文件夹所在路径
@return 路径地址 | [
"获取conf文件夹所在路径"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/common/src/main/java/com/alibaba/otter/canal/common/utils/CommonUtils.java#L18-L26 | train | Get the conf path | [
30522,
2270,
10763,
5164,
2131,
8663,
22540,
8988,
1006,
1007,
1063,
5164,
2465,
15069,
1027,
2691,
21823,
4877,
1012,
2465,
1012,
2131,
6072,
8162,
3401,
1006,
1000,
1013,
1000,
1007,
1012,
2131,
15069,
1006,
1007,
1025,
5164,
9530,
22540,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/BaseHybridHashTable.java | BaseHybridHashTable.getNextBuffer | public MemorySegment getNextBuffer() {
// check if the list directly offers memory
int s = this.availableMemory.size();
if (s > 0) {
return this.availableMemory.remove(s - 1);
}
// check if there are write behind buffers that actually are to be used for the hash table
if (this.buildSpillRetBufferNumbers > 0) {
// grab at least one, no matter what
MemorySegment toReturn;
try {
toReturn = this.buildSpillReturnBuffers.take();
} catch (InterruptedException iex) {
throw new RuntimeException("Hybrid Hash Join was interrupted while taking a buffer.");
}
this.buildSpillRetBufferNumbers--;
// grab as many more buffers as are available directly
MemorySegment currBuff;
while (this.buildSpillRetBufferNumbers > 0 && (currBuff = this.buildSpillReturnBuffers.poll()) != null) {
this.availableMemory.add(currBuff);
this.buildSpillRetBufferNumbers--;
}
return toReturn;
} else {
if (reservedNumBuffers + allocatedFloatingNum >= maxNumBuffers) {
//no more memory.
return null;
} else {
int requestNum = Math.min(perRequestNumBuffers, maxNumBuffers - reservedNumBuffers -
allocatedFloatingNum);
//apply for much more memory.
try {
List<MemorySegment> allocates = memManager.allocatePages(owner, requestNum);
this.availableMemory.addAll(allocates);
allocatedFloatingNum += allocates.size();
allocates.clear();
LOG.info("{} allocate {} floating segments successfully!", owner, requestNum);
} catch (MemoryAllocationException e) {
LOG.warn("BinaryHashMap can't allocate {} floating pages, and now used {} pages",
requestNum, reservedNumBuffers + allocatedFloatingNum, e);
//can't allocate much more memory.
return null;
}
if (this.availableMemory.size() > 0) {
return this.availableMemory.remove(this.availableMemory.size() - 1);
} else {
return null;
}
}
}
} | java | public MemorySegment getNextBuffer() {
// check if the list directly offers memory
int s = this.availableMemory.size();
if (s > 0) {
return this.availableMemory.remove(s - 1);
}
// check if there are write behind buffers that actually are to be used for the hash table
if (this.buildSpillRetBufferNumbers > 0) {
// grab at least one, no matter what
MemorySegment toReturn;
try {
toReturn = this.buildSpillReturnBuffers.take();
} catch (InterruptedException iex) {
throw new RuntimeException("Hybrid Hash Join was interrupted while taking a buffer.");
}
this.buildSpillRetBufferNumbers--;
// grab as many more buffers as are available directly
MemorySegment currBuff;
while (this.buildSpillRetBufferNumbers > 0 && (currBuff = this.buildSpillReturnBuffers.poll()) != null) {
this.availableMemory.add(currBuff);
this.buildSpillRetBufferNumbers--;
}
return toReturn;
} else {
if (reservedNumBuffers + allocatedFloatingNum >= maxNumBuffers) {
//no more memory.
return null;
} else {
int requestNum = Math.min(perRequestNumBuffers, maxNumBuffers - reservedNumBuffers -
allocatedFloatingNum);
//apply for much more memory.
try {
List<MemorySegment> allocates = memManager.allocatePages(owner, requestNum);
this.availableMemory.addAll(allocates);
allocatedFloatingNum += allocates.size();
allocates.clear();
LOG.info("{} allocate {} floating segments successfully!", owner, requestNum);
} catch (MemoryAllocationException e) {
LOG.warn("BinaryHashMap can't allocate {} floating pages, and now used {} pages",
requestNum, reservedNumBuffers + allocatedFloatingNum, e);
//can't allocate much more memory.
return null;
}
if (this.availableMemory.size() > 0) {
return this.availableMemory.remove(this.availableMemory.size() - 1);
} else {
return null;
}
}
}
} | [
"public",
"MemorySegment",
"getNextBuffer",
"(",
")",
"{",
"// check if the list directly offers memory",
"int",
"s",
"=",
"this",
".",
"availableMemory",
".",
"size",
"(",
")",
";",
"if",
"(",
"s",
">",
"0",
")",
"{",
"return",
"this",
".",
"availableMemory",... | Gets the next buffer to be used with the hash-table, either for an in-memory partition, or
for the table buckets. This method returns <tt>null</tt>, if no more buffer is available.
Spilling a partition may free new buffers then.
@return The next buffer to be used by the hash-table, or null, if no buffer remains. | [
"Gets",
"the",
"next",
"buffer",
"to",
"be",
"used",
"with",
"the",
"hash",
"-",
"table",
"either",
"for",
"an",
"in",
"-",
"memory",
"partition",
"or",
"for",
"the",
"table",
"buckets",
".",
"This",
"method",
"returns",
"<tt",
">",
"null<",
"/",
"tt",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BaseHybridHashTable.java#L287-L339 | train | Get the next buffer from the available memory. | [
30522,
2270,
3638,
3366,
21693,
4765,
2131,
2638,
18413,
8569,
12494,
1006,
1007,
1063,
1013,
1013,
4638,
2065,
1996,
2862,
3495,
4107,
3638,
20014,
1055,
1027,
2023,
1012,
2800,
4168,
5302,
2854,
1012,
2946,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.scale | public static void scale(Image srcImg, OutputStream out, float scale) throws IORuntimeException {
scale(srcImg, getImageOutputStream(out), scale);
} | java | public static void scale(Image srcImg, OutputStream out, float scale) throws IORuntimeException {
scale(srcImg, getImageOutputStream(out), scale);
} | [
"public",
"static",
"void",
"scale",
"(",
"Image",
"srcImg",
",",
"OutputStream",
"out",
",",
"float",
"scale",
")",
"throws",
"IORuntimeException",
"{",
"scale",
"(",
"srcImg",
",",
"getImageOutputStream",
"(",
"out",
")",
",",
"scale",
")",
";",
"}"
] | 缩放图像(按比例缩放)<br>
缩放后默认为jpeg格式,此方法并不关闭流
@param srcImg 源图像来源流
@param out 缩放后的图像写出到的流
@param scale 缩放比例。比例大于1时为放大,小于1大于0为缩小
@throws IORuntimeException IO异常
@since 3.2.2 | [
"缩放图像(按比例缩放)<br",
">",
"缩放后默认为jpeg格式,此方法并不关闭流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L129-L131 | train | Scales the image using the specified scale factor. | [
30522,
2270,
10763,
11675,
4094,
1006,
3746,
5034,
6895,
24798,
1010,
27852,
25379,
2041,
1010,
14257,
4094,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
4094,
1006,
5034,
6895,
24798,
1010,
2131,
9581,
3351,
5833,
18780,
21422,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java | WatchMonitor.create | public static WatchMonitor create(URL url, WatchEvent.Kind<?>... events){
return create(url, 0, events);
} | java | public static WatchMonitor create(URL url, WatchEvent.Kind<?>... events){
return create(url, 0, events);
} | [
"public",
"static",
"WatchMonitor",
"create",
"(",
"URL",
"url",
",",
"WatchEvent",
".",
"Kind",
"<",
"?",
">",
"...",
"events",
")",
"{",
"return",
"create",
"(",
"url",
",",
"0",
",",
"events",
")",
";",
"}"
] | 创建并初始化监听
@param url URL
@param events 监听的事件列表
@return 监听对象 | [
"创建并初始化监听"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L88-L90 | train | Creates a new watch monitor that will watch the given URL and register the given events. | [
30522,
2270,
10763,
3422,
8202,
15660,
3443,
1006,
24471,
2140,
24471,
2140,
1010,
3422,
18697,
3372,
1012,
2785,
1026,
1029,
1028,
1012,
1012,
1012,
2824,
1007,
1063,
2709,
3443,
1006,
24471,
2140,
1010,
1014,
1010,
2824,
1007,
1025,
1065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/Actions.java | Actions.keyUp | public Actions keyUp(CharSequence key) {
if (isBuildingActions()) {
action.addAction(new KeyUpAction(jsonKeyboard, jsonMouse, asKeys(key)));
}
return addKeyAction(key, codePoint -> tick(defaultKeyboard.createKeyUp(codePoint)));
} | java | public Actions keyUp(CharSequence key) {
if (isBuildingActions()) {
action.addAction(new KeyUpAction(jsonKeyboard, jsonMouse, asKeys(key)));
}
return addKeyAction(key, codePoint -> tick(defaultKeyboard.createKeyUp(codePoint)));
} | [
"public",
"Actions",
"keyUp",
"(",
"CharSequence",
"key",
")",
"{",
"if",
"(",
"isBuildingActions",
"(",
")",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"KeyUpAction",
"(",
"jsonKeyboard",
",",
"jsonMouse",
",",
"asKeys",
"(",
"key",
")",
")",
")"... | Performs a modifier key release. Releasing a non-depressed modifier key will yield undefined
behaviour.
@param key Either {@link Keys#SHIFT}, {@link Keys#ALT} or {@link Keys#CONTROL}.
@return A self reference. | [
"Performs",
"a",
"modifier",
"key",
"release",
".",
"Releasing",
"a",
"non",
"-",
"depressed",
"modifier",
"key",
"will",
"yield",
"undefined",
"behaviour",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L119-L125 | train | Add a key up action. | [
30522,
2270,
4506,
3145,
6279,
1006,
25869,
3366,
4226,
5897,
3145,
1007,
1063,
2065,
1006,
2003,
25820,
18908,
8496,
1006,
1007,
1007,
1063,
2895,
1012,
5587,
18908,
3258,
1006,
2047,
3145,
6279,
18908,
3258,
1006,
1046,
3385,
14839,
6277,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Path.java | Path.initialize | private void initialize(String scheme, String authority, String path) {
try {
this.uri = new URI(scheme, authority, normalizePath(path), null, null).normalize();
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
} | java | private void initialize(String scheme, String authority, String path) {
try {
this.uri = new URI(scheme, authority, normalizePath(path), null, null).normalize();
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
} | [
"private",
"void",
"initialize",
"(",
"String",
"scheme",
",",
"String",
"authority",
",",
"String",
"path",
")",
"{",
"try",
"{",
"this",
".",
"uri",
"=",
"new",
"URI",
"(",
"scheme",
",",
"authority",
",",
"normalizePath",
"(",
"path",
")",
",",
"nul... | Initializes a path object given the scheme, authority and path string.
@param scheme
the scheme string.
@param authority
the authority string.
@param path
the path string. | [
"Initializes",
"a",
"path",
"object",
"given",
"the",
"scheme",
"authority",
"and",
"path",
"string",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/Path.java#L245-L251 | train | Initialize the URI. | [
30522,
2797,
11675,
3988,
4697,
1006,
5164,
5679,
1010,
5164,
3691,
1010,
5164,
4130,
1007,
1063,
3046,
1063,
2023,
1012,
24471,
2072,
1027,
2047,
24471,
2072,
1006,
5679,
1010,
3691,
1010,
3671,
4697,
15069,
1006,
4130,
1007,
1010,
19701,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/rythm/RythmEngine.java | RythmEngine.createEngine | private static org.rythmengine.RythmEngine createEngine(TemplateConfig config) {
if (null == config) {
config = new TemplateConfig();
}
final Properties props = new Properties();
final String path = config.getPath();
if (null != path) {
props.put("home.template", path);
}
final org.rythmengine.RythmEngine engine = new org.rythmengine.RythmEngine(props);
return engine;
} | java | private static org.rythmengine.RythmEngine createEngine(TemplateConfig config) {
if (null == config) {
config = new TemplateConfig();
}
final Properties props = new Properties();
final String path = config.getPath();
if (null != path) {
props.put("home.template", path);
}
final org.rythmengine.RythmEngine engine = new org.rythmengine.RythmEngine(props);
return engine;
} | [
"private",
"static",
"org",
".",
"rythmengine",
".",
"RythmEngine",
"createEngine",
"(",
"TemplateConfig",
"config",
")",
"{",
"if",
"(",
"null",
"==",
"config",
")",
"{",
"config",
"=",
"new",
"TemplateConfig",
"(",
")",
";",
"}",
"final",
"Properties",
"... | 创建引擎
@param config 模板配置
@return {@link org.rythmengine.RythmEngine} | [
"创建引擎"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/rythm/RythmEngine.java#L58-L71 | train | Creates a new engine based on the given template config. | [
30522,
2797,
10763,
8917,
1012,
29431,
2705,
3549,
11528,
2063,
1012,
29431,
2705,
3549,
11528,
2063,
3443,
13159,
3170,
1006,
23561,
8663,
8873,
2290,
9530,
8873,
2290,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
9530,
8873,
2290,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java | SegmentsUtil.getInt | public static int getInt(MemorySegment[] segments, int offset) {
if (inFirstSegment(segments, offset, 4)) {
return segments[0].getInt(offset);
} else {
return getIntMultiSegments(segments, offset);
}
} | java | public static int getInt(MemorySegment[] segments, int offset) {
if (inFirstSegment(segments, offset, 4)) {
return segments[0].getInt(offset);
} else {
return getIntMultiSegments(segments, offset);
}
} | [
"public",
"static",
"int",
"getInt",
"(",
"MemorySegment",
"[",
"]",
"segments",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"inFirstSegment",
"(",
"segments",
",",
"offset",
",",
"4",
")",
")",
"{",
"return",
"segments",
"[",
"0",
"]",
".",
"getInt",
... | get int from segments.
@param segments target segments.
@param offset value offset. | [
"get",
"int",
"from",
"segments",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L618-L624 | train | get int from segments. | [
30522,
2270,
10763,
20014,
2131,
18447,
1006,
3638,
3366,
21693,
4765,
1031,
1033,
9214,
1010,
20014,
16396,
1007,
1063,
2065,
1006,
1999,
8873,
12096,
3366,
21693,
4765,
1006,
9214,
1010,
16396,
1010,
1018,
1007,
1007,
1063,
2709,
9214,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/instance/SlotSharingGroupAssignment.java | SlotSharingGroupAssignment.addSharedSlotAndAllocateSubSlot | public SimpleSlot addSharedSlotAndAllocateSubSlot(SharedSlot sharedSlot, Locality locality, JobVertexID groupId) {
return addSharedSlotAndAllocateSubSlot(sharedSlot, locality, groupId, null);
} | java | public SimpleSlot addSharedSlotAndAllocateSubSlot(SharedSlot sharedSlot, Locality locality, JobVertexID groupId) {
return addSharedSlotAndAllocateSubSlot(sharedSlot, locality, groupId, null);
} | [
"public",
"SimpleSlot",
"addSharedSlotAndAllocateSubSlot",
"(",
"SharedSlot",
"sharedSlot",
",",
"Locality",
"locality",
",",
"JobVertexID",
"groupId",
")",
"{",
"return",
"addSharedSlotAndAllocateSubSlot",
"(",
"sharedSlot",
",",
"locality",
",",
"groupId",
",",
"null"... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/SlotSharingGroupAssignment.java#L153-L155 | train | Add a shared slot and allocate a sub slot. | [
30522,
2270,
3722,
14540,
4140,
9909,
8167,
2098,
14540,
17287,
8943,
7174,
16280,
6342,
5910,
10994,
1006,
4207,
14540,
4140,
4207,
14540,
4140,
1010,
10246,
10246,
1010,
3105,
16874,
10288,
3593,
2177,
3593,
1007,
1063,
2709,
9909,
8167,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/strategy/encrypt/ShardingEncryptorEngine.java | ShardingEncryptorEngine.getAssistedQueryColumnCount | public Integer getAssistedQueryColumnCount(final String logicTableName) {
for (ShardingEncryptorStrategy each : shardingEncryptorStrategies.values()) {
int result = each.getAssistedQueryColumnCount(logicTableName);
if (result > 0) {
return result;
}
}
return 0;
} | java | public Integer getAssistedQueryColumnCount(final String logicTableName) {
for (ShardingEncryptorStrategy each : shardingEncryptorStrategies.values()) {
int result = each.getAssistedQueryColumnCount(logicTableName);
if (result > 0) {
return result;
}
}
return 0;
} | [
"public",
"Integer",
"getAssistedQueryColumnCount",
"(",
"final",
"String",
"logicTableName",
")",
"{",
"for",
"(",
"ShardingEncryptorStrategy",
"each",
":",
"shardingEncryptorStrategies",
".",
"values",
"(",
")",
")",
"{",
"int",
"result",
"=",
"each",
".",
"getA... | Get assisted query column count.
@param logicTableName logic table name
@return assisted query column count | [
"Get",
"assisted",
"query",
"column",
"count",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorEngine.java#L104-L112 | train | Gets the count of columns in the assisted query. | [
30522,
2270,
16109,
2131,
12054,
27870,
2094,
4226,
2854,
25778,
2819,
15305,
16671,
1006,
2345,
5164,
7961,
10880,
18442,
1007,
1063,
2005,
1006,
21146,
17080,
25997,
26775,
22571,
6591,
6494,
2618,
6292,
2169,
1024,
21146,
17080,
25997,
267... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java | BinaryString.reverse | public BinaryString reverse() {
ensureMaterialized();
if (inFirstSegment()) {
byte[] result = new byte[this.sizeInBytes];
// position in byte
int byteIdx = 0;
while (byteIdx < sizeInBytes) {
int charBytes = numBytesForFirstByte(getByteOneSegment(byteIdx));
segments[0].get(
offset + byteIdx,
result,
result.length - byteIdx - charBytes,
charBytes);
byteIdx += charBytes;
}
return BinaryString.fromBytes(result);
} else {
return reverseSlow();
}
} | java | public BinaryString reverse() {
ensureMaterialized();
if (inFirstSegment()) {
byte[] result = new byte[this.sizeInBytes];
// position in byte
int byteIdx = 0;
while (byteIdx < sizeInBytes) {
int charBytes = numBytesForFirstByte(getByteOneSegment(byteIdx));
segments[0].get(
offset + byteIdx,
result,
result.length - byteIdx - charBytes,
charBytes);
byteIdx += charBytes;
}
return BinaryString.fromBytes(result);
} else {
return reverseSlow();
}
} | [
"public",
"BinaryString",
"reverse",
"(",
")",
"{",
"ensureMaterialized",
"(",
")",
";",
"if",
"(",
"inFirstSegment",
"(",
")",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"this",
".",
"sizeInBytes",
"]",
";",
"// position in byte",
"i... | Reverse each character in current string.
@return a new string which character order is reverse to current string. | [
"Reverse",
"each",
"character",
"in",
"current",
"string",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L1113-L1132 | train | Returns a new string with the characters in reverse order. | [
30522,
2270,
12441,
3367,
4892,
7901,
1006,
1007,
1063,
5676,
8585,
14482,
3550,
1006,
1007,
1025,
2065,
1006,
1999,
8873,
12096,
3366,
21693,
4765,
1006,
1007,
1007,
1063,
24880,
1031,
1033,
2765,
1027,
2047,
24880,
1031,
2023,
1012,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/HanLP.java | HanLP.extractWords | public static List<WordInfo> extractWords(BufferedReader reader, int size) throws IOException
{
return extractWords(reader, size, false);
} | java | public static List<WordInfo> extractWords(BufferedReader reader, int size) throws IOException
{
return extractWords(reader, size, false);
} | [
"public",
"static",
"List",
"<",
"WordInfo",
">",
"extractWords",
"(",
"BufferedReader",
"reader",
",",
"int",
"size",
")",
"throws",
"IOException",
"{",
"return",
"extractWords",
"(",
"reader",
",",
"size",
",",
"false",
")",
";",
"}"
] | 提取词语
@param reader 从reader获取文本
@param size 需要提取词语的数量
@return 一个词语列表 | [
"提取词语"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/HanLP.java#L744-L747 | train | Extract words from a buffered reader. | [
30522,
2270,
10763,
2862,
1026,
2773,
2378,
14876,
1028,
14817,
22104,
1006,
17698,
2098,
16416,
4063,
8068,
1010,
20014,
2946,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
14817,
22104,
1006,
8068,
1010,
2946,
1010,
6270,
1007,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java | AbstractErrorWebExceptionHandler.renderDefaultErrorView | protected Mono<ServerResponse> renderDefaultErrorView(
ServerResponse.BodyBuilder responseBody, Map<String, Object> error) {
StringBuilder builder = new StringBuilder();
Date timestamp = (Date) error.get("timestamp");
Object message = error.get("message");
Object trace = error.get("trace");
Object requestId = error.get("requestId");
builder.append("<html><body><h1>Whitelabel Error Page</h1>").append(
"<p>This application has no configured error view, so you are seeing this as a fallback.</p>")
.append("<div id='created'>").append(timestamp).append("</div>")
.append("<div>[").append(requestId)
.append("] There was an unexpected error (type=")
.append(htmlEscape(error.get("error"))).append(", status=")
.append(htmlEscape(error.get("status"))).append(").</div>");
if (message != null) {
builder.append("<div>").append(htmlEscape(message)).append("</div>");
}
if (trace != null) {
builder.append("<div style='white-space:pre-wrap;'>")
.append(htmlEscape(trace)).append("</div>");
}
builder.append("</body></html>");
return responseBody.syncBody(builder.toString());
} | java | protected Mono<ServerResponse> renderDefaultErrorView(
ServerResponse.BodyBuilder responseBody, Map<String, Object> error) {
StringBuilder builder = new StringBuilder();
Date timestamp = (Date) error.get("timestamp");
Object message = error.get("message");
Object trace = error.get("trace");
Object requestId = error.get("requestId");
builder.append("<html><body><h1>Whitelabel Error Page</h1>").append(
"<p>This application has no configured error view, so you are seeing this as a fallback.</p>")
.append("<div id='created'>").append(timestamp).append("</div>")
.append("<div>[").append(requestId)
.append("] There was an unexpected error (type=")
.append(htmlEscape(error.get("error"))).append(", status=")
.append(htmlEscape(error.get("status"))).append(").</div>");
if (message != null) {
builder.append("<div>").append(htmlEscape(message)).append("</div>");
}
if (trace != null) {
builder.append("<div style='white-space:pre-wrap;'>")
.append(htmlEscape(trace)).append("</div>");
}
builder.append("</body></html>");
return responseBody.syncBody(builder.toString());
} | [
"protected",
"Mono",
"<",
"ServerResponse",
">",
"renderDefaultErrorView",
"(",
"ServerResponse",
".",
"BodyBuilder",
"responseBody",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"error",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
... | Render a default HTML "Whitelabel Error Page".
<p>
Useful when no other error view is available in the application.
@param responseBody the error response being built
@param error the error data as a map
@return a Publisher of the {@link ServerResponse} | [
"Render",
"a",
"default",
"HTML",
"Whitelabel",
"Error",
"Page",
".",
"<p",
">",
"Useful",
"when",
"no",
"other",
"error",
"view",
"is",
"available",
"in",
"the",
"application",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/AbstractErrorWebExceptionHandler.java#L212-L235 | train | Render the error view. | [
30522,
5123,
18847,
1026,
8241,
6072,
26029,
3366,
1028,
17552,
3207,
7011,
11314,
2121,
29165,
8584,
1006,
8241,
6072,
26029,
3366,
1012,
2303,
8569,
23891,
2099,
3433,
23684,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
7561,
1007,
1063,
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/executiongraph/ExecutionGraph.java | ExecutionGraph.deserializeAccumulators | private Map<String, Accumulator<?, ?>> deserializeAccumulators(TaskExecutionState state) {
AccumulatorSnapshot serializedAccumulators = state.getAccumulators();
if (serializedAccumulators != null) {
try {
return serializedAccumulators.deserializeUserAccumulators(userClassLoader);
}
catch (Throwable t) {
// we catch Throwable here to include all form of linking errors that may
// occur if user classes are missing in the classpath
LOG.error("Failed to deserialize final accumulator results.", t);
}
}
return null;
} | java | private Map<String, Accumulator<?, ?>> deserializeAccumulators(TaskExecutionState state) {
AccumulatorSnapshot serializedAccumulators = state.getAccumulators();
if (serializedAccumulators != null) {
try {
return serializedAccumulators.deserializeUserAccumulators(userClassLoader);
}
catch (Throwable t) {
// we catch Throwable here to include all form of linking errors that may
// occur if user classes are missing in the classpath
LOG.error("Failed to deserialize final accumulator results.", t);
}
}
return null;
} | [
"private",
"Map",
"<",
"String",
",",
"Accumulator",
"<",
"?",
",",
"?",
">",
">",
"deserializeAccumulators",
"(",
"TaskExecutionState",
"state",
")",
"{",
"AccumulatorSnapshot",
"serializedAccumulators",
"=",
"state",
".",
"getAccumulators",
"(",
")",
";",
"if"... | Deserializes accumulators from a task state update.
<p>This method never throws an exception!
@param state The task execution state from which to deserialize the accumulators.
@return The deserialized accumulators, of null, if there are no accumulators or an error occurred. | [
"Deserializes",
"accumulators",
"from",
"a",
"task",
"state",
"update",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java#L1600-L1614 | train | Deserialize the accumulators from the given task execution state. | [
30522,
2797,
4949,
1026,
5164,
1010,
16222,
2819,
20350,
1026,
1029,
1010,
1029,
1028,
1028,
4078,
11610,
3669,
4371,
6305,
24894,
20350,
2015,
1006,
4708,
10288,
8586,
13700,
9153,
2618,
2110,
1007,
1063,
16222,
2819,
20350,
2015,
2532,
45... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/wrapper/HadoopInputSplit.java | HadoopInputSplit.writeObject | private void writeObject(ObjectOutputStream out) throws IOException {
// serialize the parent fields and the final fields
out.defaultWriteObject();
// write the input split
((Writable) mapreduceInputSplit).write(out);
} | java | private void writeObject(ObjectOutputStream out) throws IOException {
// serialize the parent fields and the final fields
out.defaultWriteObject();
// write the input split
((Writable) mapreduceInputSplit).write(out);
} | [
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"// serialize the parent fields and the final fields",
"out",
".",
"defaultWriteObject",
"(",
")",
";",
"// write the input split",
"(",
"(",
"Writable",
")",
"mapreduce... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/wrapper/HadoopInputSplit.java#L79-L85 | train | default serialization of the fields to the stream | [
30522,
2797,
11675,
4339,
16429,
20614,
1006,
4874,
5833,
18780,
21422,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
7642,
4697,
1996,
6687,
4249,
1998,
1996,
2345,
4249,
2041,
1012,
12398,
26373,
16429,
20614,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/WordBasedSegment.java | WordBasedSegment.fixResultByRule | protected static void fixResultByRule(List<Vertex> linkedArray)
{
//--------------------------------------------------------------------
//Merge all seperate continue num into one number
mergeContinueNumIntoOne(linkedArray);
//--------------------------------------------------------------------
//The delimiter "--"
changeDelimiterPOS(linkedArray);
//--------------------------------------------------------------------
//如果前一个词是数字,当前词以“-”或“-”开始,并且不止这一个字符,
//那么将此“-”符号从当前词中分离出来。
//例如 “3 / -4 / 月”需要拆分成“3 / - / 4 / 月”
splitMiddleSlashFromDigitalWords(linkedArray);
//--------------------------------------------------------------------
//1、如果当前词是数字,下一个词是“月、日、时、分、秒、月份”中的一个,则合并,且当前词词性是时间
//2、如果当前词是可以作为年份的数字,下一个词是“年”,则合并,词性为时间,否则为数字。
//3、如果最后一个汉字是"点" ,则认为当前数字是时间
//4、如果当前串最后一个汉字不是"∶·./"和半角的'.''/',那么是数
//5、当前串最后一个汉字是"∶·./"和半角的'.''/',且长度大于1,那么去掉最后一个字符。例如"1."
checkDateElements(linkedArray);
} | java | protected static void fixResultByRule(List<Vertex> linkedArray)
{
//--------------------------------------------------------------------
//Merge all seperate continue num into one number
mergeContinueNumIntoOne(linkedArray);
//--------------------------------------------------------------------
//The delimiter "--"
changeDelimiterPOS(linkedArray);
//--------------------------------------------------------------------
//如果前一个词是数字,当前词以“-”或“-”开始,并且不止这一个字符,
//那么将此“-”符号从当前词中分离出来。
//例如 “3 / -4 / 月”需要拆分成“3 / - / 4 / 月”
splitMiddleSlashFromDigitalWords(linkedArray);
//--------------------------------------------------------------------
//1、如果当前词是数字,下一个词是“月、日、时、分、秒、月份”中的一个,则合并,且当前词词性是时间
//2、如果当前词是可以作为年份的数字,下一个词是“年”,则合并,词性为时间,否则为数字。
//3、如果最后一个汉字是"点" ,则认为当前数字是时间
//4、如果当前串最后一个汉字不是"∶·./"和半角的'.''/',那么是数
//5、当前串最后一个汉字是"∶·./"和半角的'.''/',且长度大于1,那么去掉最后一个字符。例如"1."
checkDateElements(linkedArray);
} | [
"protected",
"static",
"void",
"fixResultByRule",
"(",
"List",
"<",
"Vertex",
">",
"linkedArray",
")",
"{",
"//--------------------------------------------------------------------",
"//Merge all seperate continue num into one number",
"mergeContinueNumIntoOne",
"(",
"linkedArray",
... | 通过规则修正一些结果
@param linkedArray | [
"通过规则修正一些结果"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/WordBasedSegment.java#L62-L86 | train | Fix result by rule. | [
30522,
5123,
10763,
11675,
8081,
6072,
11314,
3762,
6820,
2571,
1006,
2862,
1026,
19449,
1028,
5799,
2906,
9447,
1007,
1063,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DumpHelper.java | DumpHelper._logResult | private static <T> void _logResult(T result, int level, int indentSize, StringBuilder info) {
if(result instanceof Map) {
level += 1;
int finalLevel = level;
((Map)result).forEach((k, v) -> {
info.append("\n");
info.append(getTabBasedOnLevel(finalLevel, indentSize))
.append(k.toString())
.append(":");
_logResult(v, finalLevel, indentSize, info);
});
} else if(result instanceof List) {
int finalLevel = level;
((List)result).forEach(element -> _logResult(element, finalLevel, indentSize, info));
} else if(result instanceof String) {
info.append(" ").append(result);
} else if(result != null) {
try {
logger.warn(getTabBasedOnLevel(level, indentSize) + "{}", result);
} catch (Exception e) {
logger.error("Cannot handle this type: {}", result.getClass().getTypeName());
}
}
} | java | private static <T> void _logResult(T result, int level, int indentSize, StringBuilder info) {
if(result instanceof Map) {
level += 1;
int finalLevel = level;
((Map)result).forEach((k, v) -> {
info.append("\n");
info.append(getTabBasedOnLevel(finalLevel, indentSize))
.append(k.toString())
.append(":");
_logResult(v, finalLevel, indentSize, info);
});
} else if(result instanceof List) {
int finalLevel = level;
((List)result).forEach(element -> _logResult(element, finalLevel, indentSize, info));
} else if(result instanceof String) {
info.append(" ").append(result);
} else if(result != null) {
try {
logger.warn(getTabBasedOnLevel(level, indentSize) + "{}", result);
} catch (Exception e) {
logger.error("Cannot handle this type: {}", result.getClass().getTypeName());
}
}
} | [
"private",
"static",
"<",
"T",
">",
"void",
"_logResult",
"(",
"T",
"result",
",",
"int",
"level",
",",
"int",
"indentSize",
",",
"StringBuilder",
"info",
")",
"{",
"if",
"(",
"result",
"instanceof",
"Map",
")",
"{",
"level",
"+=",
"1",
";",
"int",
"... | this method actually append result to result string | [
"this",
"method",
"actually",
"append",
"result",
"to",
"result",
"string"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/DumpHelper.java#L54-L77 | train | _logResult method. | [
30522,
2797,
10763,
1026,
1056,
1028,
11675,
1035,
8833,
6072,
11314,
1006,
1056,
2765,
1010,
20014,
2504,
1010,
20014,
27427,
11187,
4697,
1010,
5164,
8569,
23891,
2099,
18558,
1007,
1063,
2065,
1006,
2765,
6013,
11253,
4949,
1007,
1063,
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-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java | StyleUtil.setColor | public static CellStyle setColor(CellStyle cellStyle, short color, FillPatternType fillPattern) {
cellStyle.setFillForegroundColor(color);
cellStyle.setFillPattern(fillPattern);
return cellStyle;
} | java | public static CellStyle setColor(CellStyle cellStyle, short color, FillPatternType fillPattern) {
cellStyle.setFillForegroundColor(color);
cellStyle.setFillPattern(fillPattern);
return cellStyle;
} | [
"public",
"static",
"CellStyle",
"setColor",
"(",
"CellStyle",
"cellStyle",
",",
"short",
"color",
",",
"FillPatternType",
"fillPattern",
")",
"{",
"cellStyle",
".",
"setFillForegroundColor",
"(",
"color",
")",
";",
"cellStyle",
".",
"setFillPattern",
"(",
"fillPa... | 给cell设置颜色
@param cellStyle {@link CellStyle}
@param color 背景颜色
@param fillPattern 填充方式 {@link FillPatternType}枚举
@return {@link CellStyle} | [
"给cell设置颜色"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java#L105-L109 | train | Sets the color of a cell style. | [
30522,
2270,
10763,
4442,
27983,
2275,
18717,
1006,
4442,
27983,
4442,
27983,
1010,
2460,
3609,
1010,
6039,
4502,
12079,
29405,
5051,
6039,
4502,
12079,
2078,
1007,
1063,
4442,
27983,
1012,
2275,
8873,
3363,
29278,
13910,
22494,
4859,
18717,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/spring/cache/RedissonSpringCacheManager.java | RedissonSpringCacheManager.setCacheNames | public void setCacheNames(Collection<String> names) {
if (names != null) {
for (String name : names) {
getCache(name);
}
dynamic = false;
} else {
dynamic = true;
}
} | java | public void setCacheNames(Collection<String> names) {
if (names != null) {
for (String name : names) {
getCache(name);
}
dynamic = false;
} else {
dynamic = true;
}
} | [
"public",
"void",
"setCacheNames",
"(",
"Collection",
"<",
"String",
">",
"names",
")",
"{",
"if",
"(",
"names",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"name",
":",
"names",
")",
"{",
"getCache",
"(",
"name",
")",
";",
"}",
"dynamic",
"=",
"... | Defines 'fixed' cache names.
A new cache instance will not be created in dynamic for non-defined names.
<p>
`null` parameter setups dynamic mode
@param names of caches | [
"Defines",
"fixed",
"cache",
"names",
".",
"A",
"new",
"cache",
"instance",
"will",
"not",
"be",
"created",
"in",
"dynamic",
"for",
"non",
"-",
"defined",
"names",
".",
"<p",
">",
"null",
"parameter",
"setups",
"dynamic",
"mode"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/spring/cache/RedissonSpringCacheManager.java#L150-L159 | train | Sets the cache names. | [
30522,
2270,
11675,
2275,
3540,
8661,
14074,
2015,
1006,
3074,
1026,
5164,
1028,
3415,
1007,
1063,
2065,
1006,
3415,
999,
1027,
19701,
1007,
1063,
2005,
1006,
5164,
2171,
1024,
3415,
1007,
1063,
2131,
3540,
5403,
1006,
2171,
1007,
1025,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.ceiling | public static Calendar ceiling(Calendar calendar, DateField dateField) {
return DateModifier.modify(calendar, dateField.getValue(), ModifyType.CEILING);
} | java | public static Calendar ceiling(Calendar calendar, DateField dateField) {
return DateModifier.modify(calendar, dateField.getValue(), ModifyType.CEILING);
} | [
"public",
"static",
"Calendar",
"ceiling",
"(",
"Calendar",
"calendar",
",",
"DateField",
"dateField",
")",
"{",
"return",
"DateModifier",
".",
"modify",
"(",
"calendar",
",",
"dateField",
".",
"getValue",
"(",
")",
",",
"ModifyType",
".",
"CEILING",
")",
";... | 修改日期为某个时间字段结束时间
@param calendar {@link Calendar}
@param dateField 时间字段
@return 原{@link Calendar}
@since 4.5.7 | [
"修改日期为某个时间字段结束时间"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L815-L817 | train | Returns a calendar that is the ceiling of the specified date field. | [
30522,
2270,
10763,
8094,
5894,
1006,
8094,
8094,
1010,
3058,
3790,
3058,
3790,
1007,
1063,
2709,
3058,
5302,
4305,
8873,
2121,
1012,
19933,
1006,
8094,
1010,
3058,
3790,
1012,
2131,
10175,
5657,
1006,
1007,
1010,
19933,
13874,
1012,
5894,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java | BinaryString.numChars | public int numChars() {
ensureMaterialized();
if (inFirstSegment()) {
int len = 0;
for (int i = 0; i < sizeInBytes; i += numBytesForFirstByte(getByteOneSegment(i))) {
len++;
}
return len;
} else {
return numCharsSlow();
}
} | java | public int numChars() {
ensureMaterialized();
if (inFirstSegment()) {
int len = 0;
for (int i = 0; i < sizeInBytes; i += numBytesForFirstByte(getByteOneSegment(i))) {
len++;
}
return len;
} else {
return numCharsSlow();
}
} | [
"public",
"int",
"numChars",
"(",
")",
"{",
"ensureMaterialized",
"(",
")",
";",
"if",
"(",
"inFirstSegment",
"(",
")",
")",
"{",
"int",
"len",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sizeInBytes",
";",
"i",
"+=",
"numByt... | Returns the number of code points in it. | [
"Returns",
"the",
"number",
"of",
"code",
"points",
"in",
"it",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L127-L138 | train | Returns the number of characters in this buffer. | [
30522,
2270,
20014,
16371,
12458,
8167,
2015,
1006,
1007,
1063,
5676,
8585,
14482,
3550,
1006,
1007,
1025,
2065,
1006,
1999,
8873,
12096,
3366,
21693,
4765,
1006,
1007,
1007,
1063,
20014,
18798,
1027,
1014,
1025,
2005,
1006,
20014,
1045,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/BinaryInMemorySortBuffer.java | BinaryInMemorySortBuffer.reset | public void reset() {
// reset all offsets
this.numRecords = 0;
this.currentSortIndexOffset = 0;
this.currentDataBufferOffset = 0;
this.sortIndexBytes = 0;
// return all memory
returnToSegmentPool();
// grab first buffers
this.currentSortIndexSegment = nextMemorySegment();
this.sortIndex.add(this.currentSortIndexSegment);
this.recordCollector.reset();
} | java | public void reset() {
// reset all offsets
this.numRecords = 0;
this.currentSortIndexOffset = 0;
this.currentDataBufferOffset = 0;
this.sortIndexBytes = 0;
// return all memory
returnToSegmentPool();
// grab first buffers
this.currentSortIndexSegment = nextMemorySegment();
this.sortIndex.add(this.currentSortIndexSegment);
this.recordCollector.reset();
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"// reset all offsets",
"this",
".",
"numRecords",
"=",
"0",
";",
"this",
".",
"currentSortIndexOffset",
"=",
"0",
";",
"this",
".",
"currentDataBufferOffset",
"=",
"0",
";",
"this",
".",
"sortIndexBytes",
"=",
"0",
... | Resets the sort buffer back to the state where it is empty. All contained data is discarded. | [
"Resets",
"the",
"sort",
"buffer",
"back",
"to",
"the",
"state",
"where",
"it",
"is",
"empty",
".",
"All",
"contained",
"data",
"is",
"discarded",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/BinaryInMemorySortBuffer.java#L96-L111 | train | Resets the internal state of this object. | [
30522,
2270,
11675,
25141,
1006,
1007,
1063,
1013,
1013,
25141,
2035,
16396,
2015,
2023,
1012,
16371,
2213,
2890,
27108,
5104,
1027,
1014,
1025,
2023,
1012,
14731,
11589,
22254,
10288,
27475,
3388,
1027,
1014,
1025,
2023,
1012,
2783,
2850,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/NetUtil.java | NetUtil.validIpV4ToBytes | static byte[] validIpV4ToBytes(String ip) {
int i;
return new byte[] {
ipv4WordToByte(ip, 0, i = ip.indexOf('.', 1)),
ipv4WordToByte(ip, i + 1, i = ip.indexOf('.', i + 2)),
ipv4WordToByte(ip, i + 1, i = ip.indexOf('.', i + 2)),
ipv4WordToByte(ip, i + 1, ip.length())
};
} | java | static byte[] validIpV4ToBytes(String ip) {
int i;
return new byte[] {
ipv4WordToByte(ip, 0, i = ip.indexOf('.', 1)),
ipv4WordToByte(ip, i + 1, i = ip.indexOf('.', i + 2)),
ipv4WordToByte(ip, i + 1, i = ip.indexOf('.', i + 2)),
ipv4WordToByte(ip, i + 1, ip.length())
};
} | [
"static",
"byte",
"[",
"]",
"validIpV4ToBytes",
"(",
"String",
"ip",
")",
"{",
"int",
"i",
";",
"return",
"new",
"byte",
"[",
"]",
"{",
"ipv4WordToByte",
"(",
"ip",
",",
"0",
",",
"i",
"=",
"ip",
".",
"indexOf",
"(",
"'",
"'",
",",
"1",
")",
")... | visible for tests | [
"visible",
"for",
"tests"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/NetUtil.java#L406-L414 | train | validIpV4ToBytes returns a byte array containing the bytes of the IP. | [
30522,
10763,
24880,
1031,
1033,
9398,
11514,
2615,
2549,
3406,
3762,
4570,
1006,
5164,
12997,
1007,
1063,
20014,
1045,
1025,
2709,
2047,
24880,
1031,
1033,
1063,
12997,
2615,
2549,
18351,
3406,
3762,
2618,
1006,
12997,
1010,
1014,
1010,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java | NetworkBufferPool.destroyAllBufferPools | public void destroyAllBufferPools() {
synchronized (factoryLock) {
// create a copy to avoid concurrent modification exceptions
LocalBufferPool[] poolsCopy = allBufferPools.toArray(new LocalBufferPool[allBufferPools.size()]);
for (LocalBufferPool pool : poolsCopy) {
pool.lazyDestroy();
}
// some sanity checks
if (allBufferPools.size() > 0 || numTotalRequiredBuffers > 0) {
throw new IllegalStateException("NetworkBufferPool is not empty after destroying all LocalBufferPools");
}
}
} | java | public void destroyAllBufferPools() {
synchronized (factoryLock) {
// create a copy to avoid concurrent modification exceptions
LocalBufferPool[] poolsCopy = allBufferPools.toArray(new LocalBufferPool[allBufferPools.size()]);
for (LocalBufferPool pool : poolsCopy) {
pool.lazyDestroy();
}
// some sanity checks
if (allBufferPools.size() > 0 || numTotalRequiredBuffers > 0) {
throw new IllegalStateException("NetworkBufferPool is not empty after destroying all LocalBufferPools");
}
}
} | [
"public",
"void",
"destroyAllBufferPools",
"(",
")",
"{",
"synchronized",
"(",
"factoryLock",
")",
"{",
"// create a copy to avoid concurrent modification exceptions",
"LocalBufferPool",
"[",
"]",
"poolsCopy",
"=",
"allBufferPools",
".",
"toArray",
"(",
"new",
"LocalBuffe... | Destroys all buffer pools that allocate their buffers from this
buffer pool (created via {@link #createBufferPool(int, int)}). | [
"Destroys",
"all",
"buffer",
"pools",
"that",
"allocate",
"their",
"buffers",
"from",
"this",
"buffer",
"pool",
"(",
"created",
"via",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java#L328-L342 | train | Destroy all the LocalBufferPools. | [
30522,
2270,
11675,
6033,
8095,
8569,
12494,
16869,
2015,
1006,
1007,
1063,
25549,
1006,
4713,
7878,
1007,
1063,
1013,
1013,
3443,
1037,
6100,
2000,
4468,
16483,
14080,
11790,
2334,
8569,
12494,
16869,
1031,
1033,
12679,
3597,
7685,
1027,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/NetworkEnvironmentConfiguration.java | NetworkEnvironmentConfiguration.checkOldNetworkConfig | @SuppressWarnings("deprecation")
private static void checkOldNetworkConfig(final int numNetworkBuffers) {
ConfigurationParserUtils.checkConfigParameter(numNetworkBuffers > 0, numNetworkBuffers,
TaskManagerOptions.NETWORK_NUM_BUFFERS.key(),
"Must have at least one network buffer");
} | java | @SuppressWarnings("deprecation")
private static void checkOldNetworkConfig(final int numNetworkBuffers) {
ConfigurationParserUtils.checkConfigParameter(numNetworkBuffers > 0, numNetworkBuffers,
TaskManagerOptions.NETWORK_NUM_BUFFERS.key(),
"Must have at least one network buffer");
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"static",
"void",
"checkOldNetworkConfig",
"(",
"final",
"int",
"numNetworkBuffers",
")",
"{",
"ConfigurationParserUtils",
".",
"checkConfigParameter",
"(",
"numNetworkBuffers",
">",
"0",
",",
"numNetworkB... | Validates the (old) network buffer configuration.
@param numNetworkBuffers number of buffers used in the network stack
@throws IllegalConfigurationException if the condition does not hold | [
"Validates",
"the",
"(",
"old",
")",
"network",
"buffer",
"configuration",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/NetworkEnvironmentConfiguration.java#L307-L312 | train | Check if the old network configuration is valid. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
2139,
28139,
10719,
1000,
1007,
2797,
10763,
11675,
4638,
11614,
7159,
6198,
8663,
8873,
2290,
1006,
2345,
20014,
16371,
2213,
7159,
6198,
8569,
12494,
2015,
1007,
1063,
9563,
19362,
8043,
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/runtime/operators/windowing/TimestampedValue.java | TimestampedValue.from | public static <T> TimestampedValue<T> from(StreamRecord<T> streamRecord) {
if (streamRecord.hasTimestamp()) {
return new TimestampedValue<>(streamRecord.getValue(), streamRecord.getTimestamp());
} else {
return new TimestampedValue<>(streamRecord.getValue());
}
} | java | public static <T> TimestampedValue<T> from(StreamRecord<T> streamRecord) {
if (streamRecord.hasTimestamp()) {
return new TimestampedValue<>(streamRecord.getValue(), streamRecord.getTimestamp());
} else {
return new TimestampedValue<>(streamRecord.getValue());
}
} | [
"public",
"static",
"<",
"T",
">",
"TimestampedValue",
"<",
"T",
">",
"from",
"(",
"StreamRecord",
"<",
"T",
">",
"streamRecord",
")",
"{",
"if",
"(",
"streamRecord",
".",
"hasTimestamp",
"(",
")",
")",
"{",
"return",
"new",
"TimestampedValue",
"<>",
"("... | Creates a TimestampedValue from given {@link StreamRecord}.
@param streamRecord The StreamRecord object from which TimestampedValue is to be created. | [
"Creates",
"a",
"TimestampedValue",
"from",
"given",
"{",
"@link",
"StreamRecord",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/TimestampedValue.java#L106-L112 | train | Creates a TimestampedValue from the given StreamRecord. | [
30522,
2270,
10763,
1026,
1056,
1028,
2335,
15464,
5669,
10175,
5657,
1026,
1056,
1028,
2013,
1006,
5460,
2890,
27108,
2094,
1026,
1056,
1028,
5460,
2890,
27108,
2094,
1007,
1063,
2065,
1006,
5460,
2890,
27108,
2094,
1012,
2038,
7292,
9153,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java | DoubleArrayTrie.exactMatchSearch | public int exactMatchSearch(char[] keyChars, int pos, int len, int nodePos)
{
int result = -1;
int b = base[nodePos];
int p;
for (int i = pos; i < len; i++)
{
p = b + (int) (keyChars[i]) + 1;
if (b == check[p])
b = base[p];
else
return result;
}
p = b;
int n = base[p];
if (b == check[p] && n < 0)
{
result = -n - 1;
}
return result;
} | java | public int exactMatchSearch(char[] keyChars, int pos, int len, int nodePos)
{
int result = -1;
int b = base[nodePos];
int p;
for (int i = pos; i < len; i++)
{
p = b + (int) (keyChars[i]) + 1;
if (b == check[p])
b = base[p];
else
return result;
}
p = b;
int n = base[p];
if (b == check[p] && n < 0)
{
result = -n - 1;
}
return result;
} | [
"public",
"int",
"exactMatchSearch",
"(",
"char",
"[",
"]",
"keyChars",
",",
"int",
"pos",
",",
"int",
"len",
",",
"int",
"nodePos",
")",
"{",
"int",
"result",
"=",
"-",
"1",
";",
"int",
"b",
"=",
"base",
"[",
"nodePos",
"]",
";",
"int",
"p",
";"... | 精确查询
@param keyChars 键的char数组
@param pos char数组的起始位置
@param len 键的长度
@param nodePos 开始查找的位置(本参数允许从非根节点查询)
@return 查到的节点代表的value ID,负数表示不存在 | [
"精确查询"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L746-L769 | train | Exact match search. | [
30522,
2270,
20014,
6635,
18900,
18069,
14644,
2818,
1006,
25869,
1031,
1033,
3145,
7507,
2869,
1010,
20014,
13433,
2015,
1010,
20014,
18798,
1010,
20014,
13045,
6873,
2015,
1007,
1063,
20014,
2765,
1027,
1011,
1015,
1025,
20014,
1038,
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/iterative/concurrent/Broker.java | Broker.get | public V get(String key) {
try {
BlockingQueue<V> queue = retrieveSharedQueue(key);
V objToShare = queue.take();
if (!queue.offer(objToShare)) {
throw new RuntimeException("Error: Concurrent modification of the broker slot for key '" + key + "'.");
}
return objToShare;
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
} | java | public V get(String key) {
try {
BlockingQueue<V> queue = retrieveSharedQueue(key);
V objToShare = queue.take();
if (!queue.offer(objToShare)) {
throw new RuntimeException("Error: Concurrent modification of the broker slot for key '" + key + "'.");
}
return objToShare;
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
} | [
"public",
"V",
"get",
"(",
"String",
"key",
")",
"{",
"try",
"{",
"BlockingQueue",
"<",
"V",
">",
"queue",
"=",
"retrieveSharedQueue",
"(",
"key",
")",
";",
"V",
"objToShare",
"=",
"queue",
".",
"take",
"(",
")",
";",
"if",
"(",
"!",
"queue",
".",
... | Blocking retrieval and removal of the object to share. | [
"Blocking",
"retrieval",
"and",
"removal",
"of",
"the",
"object",
"to",
"share",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/iterative/concurrent/Broker.java#L59-L70 | train | Retrieve the object from the shared queue. | [
30522,
2270,
1058,
2131,
1006,
5164,
3145,
1007,
1063,
3046,
1063,
10851,
4226,
5657,
1026,
1058,
1028,
24240,
1027,
12850,
7377,
5596,
4226,
5657,
1006,
3145,
1007,
1025,
1058,
27885,
3501,
13122,
8167,
2063,
1027,
24240,
1012,
2202,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/LocalEnvironment.java | LocalEnvironment.execute | @Override
public JobExecutionResult execute(String jobName) throws Exception {
if (executor == null) {
startNewSession();
}
Plan p = createProgramPlan(jobName);
// Session management is disabled, revert this commit to enable
//p.setJobId(jobID);
//p.setSessionTimeout(sessionTimeout);
JobExecutionResult result = executor.executePlan(p);
this.lastJobExecutionResult = result;
return result;
} | java | @Override
public JobExecutionResult execute(String jobName) throws Exception {
if (executor == null) {
startNewSession();
}
Plan p = createProgramPlan(jobName);
// Session management is disabled, revert this commit to enable
//p.setJobId(jobID);
//p.setSessionTimeout(sessionTimeout);
JobExecutionResult result = executor.executePlan(p);
this.lastJobExecutionResult = result;
return result;
} | [
"@",
"Override",
"public",
"JobExecutionResult",
"execute",
"(",
"String",
"jobName",
")",
"throws",
"Exception",
"{",
"if",
"(",
"executor",
"==",
"null",
")",
"{",
"startNewSession",
"(",
")",
";",
"}",
"Plan",
"p",
"=",
"createProgramPlan",
"(",
"jobName"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/LocalEnvironment.java#L79-L95 | train | Execute the job with the specified job ID. | [
30522,
1030,
2058,
15637,
2270,
3105,
10288,
8586,
13700,
6072,
11314,
15389,
1006,
5164,
3105,
18442,
1007,
11618,
6453,
1063,
2065,
1006,
4654,
8586,
16161,
2099,
1027,
1027,
19701,
1007,
1063,
2707,
2638,
9333,
7971,
3258,
1006,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java | CanalServerWithEmbedded.get | @Override
public Message get(ClientIdentity clientIdentity, int batchSize, Long timeout, TimeUnit unit)
throws CanalServerException {
checkStart(clientIdentity.getDestination());
checkSubscribe(clientIdentity);
CanalInstance canalInstance = canalInstances.get(clientIdentity.getDestination());
synchronized (canalInstance) {
// 获取到流式数据中的最后一批获取的位置
PositionRange<LogPosition> positionRanges = canalInstance.getMetaManager().getLastestBatch(clientIdentity);
if (positionRanges != null) {
throw new CanalServerException(String.format("clientId:%s has last batch:[%s] isn't ack , maybe loss data",
clientIdentity.getClientId(),
positionRanges));
}
Events<Event> events = null;
Position start = canalInstance.getMetaManager().getCursor(clientIdentity);
events = getEvents(canalInstance.getEventStore(), start, batchSize, timeout, unit);
if (CollectionUtils.isEmpty(events.getEvents())) {
logger.debug("get successfully, clientId:{} batchSize:{} but result is null",
clientIdentity.getClientId(),
batchSize);
return new Message(-1, true, new ArrayList()); // 返回空包,避免生成batchId,浪费性能
} else {
// 记录到流式信息
Long batchId = canalInstance.getMetaManager().addBatch(clientIdentity, events.getPositionRange());
boolean raw = isRaw(canalInstance.getEventStore());
List entrys = null;
if (raw) {
entrys = Lists.transform(events.getEvents(), new Function<Event, ByteString>() {
public ByteString apply(Event input) {
return input.getRawEntry();
}
});
} else {
entrys = Lists.transform(events.getEvents(), new Function<Event, CanalEntry.Entry>() {
public CanalEntry.Entry apply(Event input) {
return input.getEntry();
}
});
}
if (logger.isInfoEnabled()) {
logger.info("get successfully, clientId:{} batchSize:{} real size is {} and result is [batchId:{} , position:{}]",
clientIdentity.getClientId(),
batchSize,
entrys.size(),
batchId,
events.getPositionRange());
}
// 直接提交ack
ack(clientIdentity, batchId);
return new Message(batchId, raw, entrys);
}
}
} | java | @Override
public Message get(ClientIdentity clientIdentity, int batchSize, Long timeout, TimeUnit unit)
throws CanalServerException {
checkStart(clientIdentity.getDestination());
checkSubscribe(clientIdentity);
CanalInstance canalInstance = canalInstances.get(clientIdentity.getDestination());
synchronized (canalInstance) {
// 获取到流式数据中的最后一批获取的位置
PositionRange<LogPosition> positionRanges = canalInstance.getMetaManager().getLastestBatch(clientIdentity);
if (positionRanges != null) {
throw new CanalServerException(String.format("clientId:%s has last batch:[%s] isn't ack , maybe loss data",
clientIdentity.getClientId(),
positionRanges));
}
Events<Event> events = null;
Position start = canalInstance.getMetaManager().getCursor(clientIdentity);
events = getEvents(canalInstance.getEventStore(), start, batchSize, timeout, unit);
if (CollectionUtils.isEmpty(events.getEvents())) {
logger.debug("get successfully, clientId:{} batchSize:{} but result is null",
clientIdentity.getClientId(),
batchSize);
return new Message(-1, true, new ArrayList()); // 返回空包,避免生成batchId,浪费性能
} else {
// 记录到流式信息
Long batchId = canalInstance.getMetaManager().addBatch(clientIdentity, events.getPositionRange());
boolean raw = isRaw(canalInstance.getEventStore());
List entrys = null;
if (raw) {
entrys = Lists.transform(events.getEvents(), new Function<Event, ByteString>() {
public ByteString apply(Event input) {
return input.getRawEntry();
}
});
} else {
entrys = Lists.transform(events.getEvents(), new Function<Event, CanalEntry.Entry>() {
public CanalEntry.Entry apply(Event input) {
return input.getEntry();
}
});
}
if (logger.isInfoEnabled()) {
logger.info("get successfully, clientId:{} batchSize:{} real size is {} and result is [batchId:{} , position:{}]",
clientIdentity.getClientId(),
batchSize,
entrys.size(),
batchId,
events.getPositionRange());
}
// 直接提交ack
ack(clientIdentity, batchId);
return new Message(batchId, raw, entrys);
}
}
} | [
"@",
"Override",
"public",
"Message",
"get",
"(",
"ClientIdentity",
"clientIdentity",
",",
"int",
"batchSize",
",",
"Long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"CanalServerException",
"{",
"checkStart",
"(",
"clientIdentity",
".",
"getDestination",
... | 获取数据,可以指定超时时间.
<pre>
几种case:
a. 如果timeout为null,则采用tryGet方式,即时获取
b. 如果timeout不为null
1. timeout为0,则采用get阻塞方式,获取数据,不设置超时,直到有足够的batchSize数据才返回
2. timeout不为0,则采用get+timeout方式,获取数据,超时还没有batchSize足够的数据,有多少返回多少
注意: meta获取和数据的获取需要保证顺序性,优先拿到meta的,一定也会是优先拿到数据,所以需要加同步. (不能出现先拿到meta,拿到第二批数据,这样就会导致数据顺序性出现问题)
</pre> | [
"获取数据,可以指定超时时间",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java#L220-L278 | train | Gets a message from the Canal Instance. | [
30522,
1030,
2058,
15637,
2270,
4471,
2131,
1006,
7396,
5178,
16778,
3723,
7396,
5178,
16778,
3723,
1010,
20014,
14108,
5332,
4371,
1010,
2146,
2051,
5833,
1010,
2051,
19496,
2102,
3131,
1007,
11618,
17263,
2121,
28943,
2595,
24422,
1063,
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/concurrent/FutureUtils.java | FutureUtils.retrySuccessfulWithDelay | public static <T> CompletableFuture<T> retrySuccessfulWithDelay(
final Supplier<CompletableFuture<T>> operation,
final Time retryDelay,
final Deadline deadline,
final Predicate<T> acceptancePredicate,
final ScheduledExecutor scheduledExecutor) {
final CompletableFuture<T> resultFuture = new CompletableFuture<>();
retrySuccessfulOperationWithDelay(
resultFuture,
operation,
retryDelay,
deadline,
acceptancePredicate,
scheduledExecutor);
return resultFuture;
} | java | public static <T> CompletableFuture<T> retrySuccessfulWithDelay(
final Supplier<CompletableFuture<T>> operation,
final Time retryDelay,
final Deadline deadline,
final Predicate<T> acceptancePredicate,
final ScheduledExecutor scheduledExecutor) {
final CompletableFuture<T> resultFuture = new CompletableFuture<>();
retrySuccessfulOperationWithDelay(
resultFuture,
operation,
retryDelay,
deadline,
acceptancePredicate,
scheduledExecutor);
return resultFuture;
} | [
"public",
"static",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"retrySuccessfulWithDelay",
"(",
"final",
"Supplier",
"<",
"CompletableFuture",
"<",
"T",
">",
">",
"operation",
",",
"final",
"Time",
"retryDelay",
",",
"final",
"Deadline",
"deadline",
",... | Retry the given operation with the given delay in between successful completions where the
result does not match a given predicate.
@param operation to retry
@param retryDelay delay between retries
@param deadline A deadline that specifies at what point we should stop retrying
@param acceptancePredicate Predicate to test whether the result is acceptable
@param scheduledExecutor executor to be used for the retry operation
@param <T> type of the result
@return Future which retries the given operation a given amount of times and delays the retry
in case the predicate isn't matched | [
"Retry",
"the",
"given",
"operation",
"with",
"the",
"given",
"delay",
"in",
"between",
"successful",
"completions",
"where",
"the",
"result",
"does",
"not",
"match",
"a",
"given",
"predicate",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java#L246-L264 | train | Creates a new CompletableFuture that is completed when the operation succeeds with a delay. | [
30522,
2270,
10763,
1026,
1056,
1028,
4012,
10814,
10880,
11263,
11244,
1026,
1056,
1028,
2128,
11129,
6342,
9468,
7971,
3993,
24415,
9247,
4710,
1006,
2345,
17024,
1026,
4012,
10814,
10880,
11263,
11244,
1026,
1056,
1028,
1028,
3169,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.toLowerCase | public AsciiString toLowerCase() {
boolean lowercased = true;
int i, j;
final int len = length() + arrayOffset();
for (i = arrayOffset(); i < len; ++i) {
byte b = value[i];
if (b >= 'A' && b <= 'Z') {
lowercased = false;
break;
}
}
// Check if this string does not contain any uppercase characters.
if (lowercased) {
return this;
}
final byte[] newValue = PlatformDependent.allocateUninitializedArray(length());
for (i = 0, j = arrayOffset(); i < newValue.length; ++i, ++j) {
newValue[i] = toLowerCase(value[j]);
}
return new AsciiString(newValue, false);
} | java | public AsciiString toLowerCase() {
boolean lowercased = true;
int i, j;
final int len = length() + arrayOffset();
for (i = arrayOffset(); i < len; ++i) {
byte b = value[i];
if (b >= 'A' && b <= 'Z') {
lowercased = false;
break;
}
}
// Check if this string does not contain any uppercase characters.
if (lowercased) {
return this;
}
final byte[] newValue = PlatformDependent.allocateUninitializedArray(length());
for (i = 0, j = arrayOffset(); i < newValue.length; ++i, ++j) {
newValue[i] = toLowerCase(value[j]);
}
return new AsciiString(newValue, false);
} | [
"public",
"AsciiString",
"toLowerCase",
"(",
")",
"{",
"boolean",
"lowercased",
"=",
"true",
";",
"int",
"i",
",",
"j",
";",
"final",
"int",
"len",
"=",
"length",
"(",
")",
"+",
"arrayOffset",
"(",
")",
";",
"for",
"(",
"i",
"=",
"arrayOffset",
"(",
... | Converts the characters in this string to lowercase, using the default Locale.
@return a new string containing the lowercase characters equivalent to the characters in this string. | [
"Converts",
"the",
"characters",
"in",
"this",
"string",
"to",
"lowercase",
"using",
"the",
"default",
"Locale",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L928-L951 | train | Returns a new string that is lower cased. | [
30522,
2270,
2004,
6895,
2923,
4892,
2000,
27663,
18992,
3366,
1006,
1007,
1063,
22017,
20898,
2896,
28969,
1027,
2995,
1025,
20014,
1045,
1010,
1046,
1025,
2345,
20014,
18798,
1027,
3091,
1006,
1007,
1009,
9140,
27475,
3388,
1006,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java | UnsafeExternalSorter.deleteSpillFiles | private void deleteSpillFiles() {
for (UnsafeSorterSpillWriter spill : spillWriters) {
File file = spill.getFile();
if (file != null && file.exists()) {
if (!file.delete()) {
logger.error("Was unable to delete spill file {}", file.getAbsolutePath());
}
}
}
} | java | private void deleteSpillFiles() {
for (UnsafeSorterSpillWriter spill : spillWriters) {
File file = spill.getFile();
if (file != null && file.exists()) {
if (!file.delete()) {
logger.error("Was unable to delete spill file {}", file.getAbsolutePath());
}
}
}
} | [
"private",
"void",
"deleteSpillFiles",
"(",
")",
"{",
"for",
"(",
"UnsafeSorterSpillWriter",
"spill",
":",
"spillWriters",
")",
"{",
"File",
"file",
"=",
"spill",
".",
"getFile",
"(",
")",
";",
"if",
"(",
"file",
"!=",
"null",
"&&",
"file",
".",
"exists"... | Deletes any spill files created by this sorter. | [
"Deletes",
"any",
"spill",
"files",
"created",
"by",
"this",
"sorter",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L309-L318 | train | Delete all the spill files. | [
30522,
2797,
11675,
3972,
12870,
13102,
8591,
8873,
4244,
1006,
1007,
1063,
2005,
1006,
25135,
21748,
7747,
8197,
3363,
15994,
14437,
1024,
14437,
15994,
2015,
1007,
1063,
5371,
5371,
1027,
14437,
1012,
2131,
8873,
2571,
1006,
1007,
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-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java | AbstractFetcher.emitRecordWithTimestampAndPunctuatedWatermark | private void emitRecordWithTimestampAndPunctuatedWatermark(
T record, KafkaTopicPartitionState<KPH> partitionState, long offset, long kafkaEventTimestamp) {
@SuppressWarnings("unchecked")
final KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH> withWatermarksState =
(KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH>) partitionState;
// only one thread ever works on accessing timestamps and watermarks
// from the punctuated extractor
final long timestamp = withWatermarksState.getTimestampForRecord(record, kafkaEventTimestamp);
final Watermark newWatermark = withWatermarksState.checkAndGetNewWatermark(record, timestamp);
// emit the record with timestamp, using the usual checkpoint lock to guarantee
// atomicity of record emission and offset state update
synchronized (checkpointLock) {
sourceContext.collectWithTimestamp(record, timestamp);
partitionState.setOffset(offset);
}
// if we also have a new per-partition watermark, check if that is also a
// new cross-partition watermark
if (newWatermark != null) {
updateMinPunctuatedWatermark(newWatermark);
}
} | java | private void emitRecordWithTimestampAndPunctuatedWatermark(
T record, KafkaTopicPartitionState<KPH> partitionState, long offset, long kafkaEventTimestamp) {
@SuppressWarnings("unchecked")
final KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH> withWatermarksState =
(KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH>) partitionState;
// only one thread ever works on accessing timestamps and watermarks
// from the punctuated extractor
final long timestamp = withWatermarksState.getTimestampForRecord(record, kafkaEventTimestamp);
final Watermark newWatermark = withWatermarksState.checkAndGetNewWatermark(record, timestamp);
// emit the record with timestamp, using the usual checkpoint lock to guarantee
// atomicity of record emission and offset state update
synchronized (checkpointLock) {
sourceContext.collectWithTimestamp(record, timestamp);
partitionState.setOffset(offset);
}
// if we also have a new per-partition watermark, check if that is also a
// new cross-partition watermark
if (newWatermark != null) {
updateMinPunctuatedWatermark(newWatermark);
}
} | [
"private",
"void",
"emitRecordWithTimestampAndPunctuatedWatermark",
"(",
"T",
"record",
",",
"KafkaTopicPartitionState",
"<",
"KPH",
">",
"partitionState",
",",
"long",
"offset",
",",
"long",
"kafkaEventTimestamp",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\""... | Record emission, if a timestamp will be attached from an assigner that is
also a punctuated watermark generator. | [
"Record",
"emission",
"if",
"a",
"timestamp",
"will",
"be",
"attached",
"from",
"an",
"assigner",
"that",
"is",
"also",
"a",
"punctuated",
"watermark",
"generator",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java#L445-L468 | train | Emit a record with timestamp and punctuated watermark. | [
30522,
2797,
11675,
12495,
7913,
27108,
2094,
24415,
7292,
9153,
8737,
5685,
14289,
12273,
26302,
3064,
5880,
10665,
1006,
1056,
2501,
1010,
10556,
24316,
10610,
24330,
19362,
3775,
9285,
12259,
1026,
1047,
8458,
1028,
13571,
9153,
2618,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/StringValueArray.java | StringValueArray.compareTo | @Override
public int compareTo(ValueArray<StringValue> o) {
StringValueArray other = (StringValueArray) o;
// sorts first on number of data in the array, then comparison between
// the first non-equal element in the arrays
int cmp = Integer.compare(position, other.position);
if (cmp != 0) {
return cmp;
}
for (int i = 0; i < position; i++) {
cmp = Byte.compare(data[i], other.data[i]);
if (cmp != 0) {
return cmp;
}
}
return 0;
} | java | @Override
public int compareTo(ValueArray<StringValue> o) {
StringValueArray other = (StringValueArray) o;
// sorts first on number of data in the array, then comparison between
// the first non-equal element in the arrays
int cmp = Integer.compare(position, other.position);
if (cmp != 0) {
return cmp;
}
for (int i = 0; i < position; i++) {
cmp = Byte.compare(data[i], other.data[i]);
if (cmp != 0) {
return cmp;
}
}
return 0;
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"ValueArray",
"<",
"StringValue",
">",
"o",
")",
"{",
"StringValueArray",
"other",
"=",
"(",
"StringValueArray",
")",
"o",
";",
"// sorts first on number of data in the array, then comparison between",
"// the first non-... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/StringValueArray.java#L292-L313 | train | Compares two value arrays. | [
30522,
1030,
2058,
15637,
2270,
20014,
12826,
3406,
1006,
3643,
2906,
9447,
1026,
5164,
10175,
5657,
1028,
1051,
1007,
1063,
5164,
10175,
5657,
2906,
9447,
2060,
1027,
1006,
5164,
10175,
5657,
2906,
9447,
1007,
1051,
1025,
1013,
1013,
11901... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java | TrafficCounter.stop | public synchronized void stop() {
if (!monitorActive) {
return;
}
monitorActive = false;
resetAccounting(milliSecondFromNano());
if (trafficShapingHandler != null) {
trafficShapingHandler.doAccounting(this);
}
if (scheduledFuture != null) {
scheduledFuture.cancel(true);
}
} | java | public synchronized void stop() {
if (!monitorActive) {
return;
}
monitorActive = false;
resetAccounting(milliSecondFromNano());
if (trafficShapingHandler != null) {
trafficShapingHandler.doAccounting(this);
}
if (scheduledFuture != null) {
scheduledFuture.cancel(true);
}
} | [
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"!",
"monitorActive",
")",
"{",
"return",
";",
"}",
"monitorActive",
"=",
"false",
";",
"resetAccounting",
"(",
"milliSecondFromNano",
"(",
")",
")",
";",
"if",
"(",
"trafficShapingHandler",... | Stop the monitoring process. | [
"Stop",
"the",
"monitoring",
"process",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java#L202-L214 | train | Stop the application. | [
30522,
2270,
25549,
11675,
2644,
1006,
1007,
1063,
2065,
1006,
999,
8080,
19620,
1007,
1063,
2709,
1025,
1065,
8080,
19620,
1027,
6270,
1025,
25141,
6305,
3597,
16671,
2075,
1006,
4971,
5562,
8663,
20952,
21716,
7229,
2080,
1006,
1007,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/word/Word07Writer.java | Word07Writer.flush | public Word07Writer flush(OutputStream out, boolean isCloseOut) throws IORuntimeException {
Assert.isFalse(this.isClosed, "WordWriter has been closed!");
try {
this.doc.write(out);
out.flush();
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
if (isCloseOut) {
IoUtil.close(out);
}
}
return this;
} | java | public Word07Writer flush(OutputStream out, boolean isCloseOut) throws IORuntimeException {
Assert.isFalse(this.isClosed, "WordWriter has been closed!");
try {
this.doc.write(out);
out.flush();
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
if (isCloseOut) {
IoUtil.close(out);
}
}
return this;
} | [
"public",
"Word07Writer",
"flush",
"(",
"OutputStream",
"out",
",",
"boolean",
"isCloseOut",
")",
"throws",
"IORuntimeException",
"{",
"Assert",
".",
"isFalse",
"(",
"this",
".",
"isClosed",
",",
"\"WordWriter has been closed!\"",
")",
";",
"try",
"{",
"this",
"... | 将Word Document刷出到输出流
@param out 输出流
@param isCloseOut 是否关闭输出流
@return this
@throws IORuntimeException IO异常 | [
"将Word",
"Document刷出到输出流"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/word/Word07Writer.java#L174-L187 | train | Flushes the output stream. | [
30522,
2270,
2773,
2692,
2581,
15994,
13862,
1006,
27852,
25379,
2041,
1010,
22017,
20898,
2003,
20464,
9232,
5833,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
20865,
1012,
2003,
7011,
4877,
2063,
1006,
2023,
1012,
2003,
20464,
24768... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ReferenceCountedOpenSslEngine.java | ReferenceCountedOpenSslEngine.toJavaCipherSuitePrefix | private static String toJavaCipherSuitePrefix(String protocolVersion) {
final char c;
if (protocolVersion == null || protocolVersion.isEmpty()) {
c = 0;
} else {
c = protocolVersion.charAt(0);
}
switch (c) {
case 'T':
return "TLS";
case 'S':
return "SSL";
default:
return "UNKNOWN";
}
} | java | private static String toJavaCipherSuitePrefix(String protocolVersion) {
final char c;
if (protocolVersion == null || protocolVersion.isEmpty()) {
c = 0;
} else {
c = protocolVersion.charAt(0);
}
switch (c) {
case 'T':
return "TLS";
case 'S':
return "SSL";
default:
return "UNKNOWN";
}
} | [
"private",
"static",
"String",
"toJavaCipherSuitePrefix",
"(",
"String",
"protocolVersion",
")",
"{",
"final",
"char",
"c",
";",
"if",
"(",
"protocolVersion",
"==",
"null",
"||",
"protocolVersion",
".",
"isEmpty",
"(",
")",
")",
"{",
"c",
"=",
"0",
";",
"}... | Converts the protocol version string returned by {@link SSL#getVersion(long)} to protocol family string. | [
"Converts",
"the",
"protocol",
"version",
"string",
"returned",
"by",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java#L1823-L1839 | train | Returns the Java cipher suite prefix for the protocol version. | [
30522,
2797,
10763,
5164,
2000,
3900,
24887,
11514,
22328,
14663,
13699,
2890,
8873,
2595,
1006,
5164,
8778,
27774,
1007,
1063,
2345,
25869,
1039,
1025,
2065,
1006,
8778,
27774,
1027,
1027,
19701,
1064,
1064,
8778,
27774,
1012,
2003,
6633,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java | HttpAuthUtils.splitCookieToken | private static Map<String, String> splitCookieToken(String tokenStr) {
Map<String, String> map = new HashMap<String, String>();
StringTokenizer st = new StringTokenizer(tokenStr, COOKIE_ATTR_SEPARATOR);
while (st.hasMoreTokens()) {
String part = st.nextToken();
int separator = part.indexOf(COOKIE_KEY_VALUE_SEPARATOR);
if (separator == -1) {
LOG.error("Invalid token string " + tokenStr);
return null;
}
String key = part.substring(0, separator);
String value = part.substring(separator + 1);
map.put(key, value);
}
return map;
} | java | private static Map<String, String> splitCookieToken(String tokenStr) {
Map<String, String> map = new HashMap<String, String>();
StringTokenizer st = new StringTokenizer(tokenStr, COOKIE_ATTR_SEPARATOR);
while (st.hasMoreTokens()) {
String part = st.nextToken();
int separator = part.indexOf(COOKIE_KEY_VALUE_SEPARATOR);
if (separator == -1) {
LOG.error("Invalid token string " + tokenStr);
return null;
}
String key = part.substring(0, separator);
String value = part.substring(separator + 1);
map.put(key, value);
}
return map;
} | [
"private",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"splitCookieToken",
"(",
"String",
"tokenStr",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"StringTok... | Splits the cookie token into attributes pairs.
@param str input token.
@return a map with the attribute pairs of the token if the input is valid.
Else, returns null. | [
"Splits",
"the",
"cookie",
"token",
"into",
"attributes",
"pairs",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java#L124-L140 | train | Split cookie token into map. | [
30522,
2797,
10763,
4949,
1026,
5164,
1010,
5164,
1028,
3975,
3597,
23212,
18903,
7520,
1006,
5164,
19204,
3367,
2099,
1007,
1063,
4949,
1026,
5164,
1010,
5164,
1028,
4949,
1027,
2047,
23325,
2863,
2361,
1026,
5164,
1010,
5164,
1028,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactory.java | AbstractServletWebServerFactory.shouldRegisterJspServlet | protected boolean shouldRegisterJspServlet() {
return this.jsp != null && this.jsp.getRegistered() && ClassUtils
.isPresent(this.jsp.getClassName(), getClass().getClassLoader());
} | java | protected boolean shouldRegisterJspServlet() {
return this.jsp != null && this.jsp.getRegistered() && ClassUtils
.isPresent(this.jsp.getClassName(), getClass().getClassLoader());
} | [
"protected",
"boolean",
"shouldRegisterJspServlet",
"(",
")",
"{",
"return",
"this",
".",
"jsp",
"!=",
"null",
"&&",
"this",
".",
"jsp",
".",
"getRegistered",
"(",
")",
"&&",
"ClassUtils",
".",
"isPresent",
"(",
"this",
".",
"jsp",
".",
"getClassName",
"("... | Returns whether or not the JSP servlet should be registered with the web server.
@return {@code true} if the servlet should be registered, otherwise {@code false} | [
"Returns",
"whether",
"or",
"not",
"the",
"JSP",
"servlet",
"should",
"be",
"registered",
"with",
"the",
"web",
"server",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactory.java#L265-L268 | train | Returns true if the JSP servlet should be registered. | [
30522,
5123,
22017,
20898,
2323,
2890,
24063,
2121,
22578,
29251,
2099,
2615,
7485,
1006,
1007,
1063,
2709,
2023,
1012,
1046,
13102,
999,
1027,
19701,
1004,
1004,
2023,
1012,
1046,
13102,
1012,
2131,
2890,
24063,
6850,
1006,
1007,
1004,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java | Matrix.timesEquals | public Matrix timesEquals(double s)
{
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
A[i][j] = s * A[i][j];
}
}
return this;
} | java | public Matrix timesEquals(double s)
{
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
A[i][j] = s * A[i][j];
}
}
return this;
} | [
"public",
"Matrix",
"timesEquals",
"(",
"double",
"s",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"n",
";",
"j",
"++",
")",
"{",
"A",
"[",
"... | Multiply a matrix by a scalar in place, A = s*A
@param s scalar
@return replace A by s*A | [
"Multiply",
"a",
"matrix",
"by",
"a",
"scalar",
"in",
"place",
"A",
"=",
"s",
"*",
"A"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L921-L931 | train | Multiplies the matrix s by the scalar value. | [
30522,
2270,
8185,
2335,
2063,
26426,
2015,
1006,
3313,
1055,
1007,
1063,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
1049,
1025,
1045,
1009,
1009,
1007,
1063,
2005,
1006,
20014,
1046,
1027,
1014,
1025,
1046,
1026,
1050,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/annotation/CombinationAnnotationElement.java | CombinationAnnotationElement.parse | private void parse(Annotation[] annotations) {
Class<? extends Annotation> annotationType;
for (Annotation annotation : annotations) {
annotationType = annotation.annotationType();
if (false == META_ANNOTATIONS.contains(annotationType)) {
annotationMap.put(annotationType, annotation);
parse(annotationType.getAnnotations());
}
}
} | java | private void parse(Annotation[] annotations) {
Class<? extends Annotation> annotationType;
for (Annotation annotation : annotations) {
annotationType = annotation.annotationType();
if (false == META_ANNOTATIONS.contains(annotationType)) {
annotationMap.put(annotationType, annotation);
parse(annotationType.getAnnotations());
}
}
} | [
"private",
"void",
"parse",
"(",
"Annotation",
"[",
"]",
"annotations",
")",
"{",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
";",
"for",
"(",
"Annotation",
"annotation",
":",
"annotations",
")",
"{",
"annotationType",
"=",
"annotation",... | 进行递归解析注解,直到全部都是元注解为止
@param element Class, Method, Field等 | [
"进行递归解析注解,直到全部都是元注解为止"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/annotation/CombinationAnnotationElement.java#L115-L124 | train | Parses the given annotations and stores them in the map. | [
30522,
2797,
11675,
11968,
3366,
1006,
5754,
17287,
3508,
1031,
1033,
5754,
17287,
9285,
1007,
1063,
2465,
1026,
1029,
8908,
5754,
17287,
3508,
1028,
5754,
17287,
3508,
13874,
1025,
2005,
1006,
5754,
17287,
3508,
5754,
17287,
3508,
1024,
57... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeinfo/BasicTypeInfo.java | BasicTypeInfo.shouldAutocastTo | @PublicEvolving
public boolean shouldAutocastTo(BasicTypeInfo<?> to) {
for (Class<?> possibleTo: possibleCastTargetTypes) {
if (possibleTo.equals(to.getTypeClass())) {
return true;
}
}
return false;
} | java | @PublicEvolving
public boolean shouldAutocastTo(BasicTypeInfo<?> to) {
for (Class<?> possibleTo: possibleCastTargetTypes) {
if (possibleTo.equals(to.getTypeClass())) {
return true;
}
}
return false;
} | [
"@",
"PublicEvolving",
"public",
"boolean",
"shouldAutocastTo",
"(",
"BasicTypeInfo",
"<",
"?",
">",
"to",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
">",
"possibleTo",
":",
"possibleCastTargetTypes",
")",
"{",
"if",
"(",
"possibleTo",
".",
"equals",
"(",
"t... | Returns whether this type should be automatically casted to
the target type in an arithmetic operation. | [
"Returns",
"whether",
"this",
"type",
"should",
"be",
"automatically",
"casted",
"to",
"the",
"target",
"type",
"in",
"an",
"arithmetic",
"operation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/BasicTypeInfo.java#L116-L124 | train | Returns true if the type information should be automatically cast to the given type information. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
22017,
20898,
2323,
4887,
3406,
10526,
3406,
1006,
3937,
13874,
2378,
14876,
1026,
1029,
1028,
2000,
1007,
1063,
2005,
1006,
2465,
1026,
1029,
1028,
2825,
3406,
1024,
2825,
10526,
7559,
18150,
1387... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/utility/LexiconUtility.java | LexiconUtility.getFrequency | public static int getFrequency(String word)
{
CoreDictionary.Attribute attribute = getAttribute(word);
if (attribute == null) return 0;
return attribute.totalFrequency;
} | java | public static int getFrequency(String word)
{
CoreDictionary.Attribute attribute = getAttribute(word);
if (attribute == null) return 0;
return attribute.totalFrequency;
} | [
"public",
"static",
"int",
"getFrequency",
"(",
"String",
"word",
")",
"{",
"CoreDictionary",
".",
"Attribute",
"attribute",
"=",
"getAttribute",
"(",
"word",
")",
";",
"if",
"(",
"attribute",
"==",
"null",
")",
"return",
"0",
";",
"return",
"attribute",
"... | 获取某个单词的词频
@param word
@return | [
"获取某个单词的词频"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/LexiconUtility.java#L68-L73 | train | Gets the frequency of a word. | [
30522,
2270,
10763,
20014,
2131,
19699,
2063,
4226,
9407,
1006,
5164,
2773,
1007,
1063,
4563,
29201,
3258,
5649,
1012,
17961,
17961,
1027,
2131,
19321,
3089,
8569,
2618,
1006,
2773,
1007,
1025,
2065,
1006,
17961,
1027,
1027,
19701,
1007,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpServerUpgradeHandler.java | HttpServerUpgradeHandler.isUpgradeRequest | private static boolean isUpgradeRequest(HttpObject msg) {
return msg instanceof HttpRequest && ((HttpRequest) msg).headers().get(HttpHeaderNames.UPGRADE) != null;
} | java | private static boolean isUpgradeRequest(HttpObject msg) {
return msg instanceof HttpRequest && ((HttpRequest) msg).headers().get(HttpHeaderNames.UPGRADE) != null;
} | [
"private",
"static",
"boolean",
"isUpgradeRequest",
"(",
"HttpObject",
"msg",
")",
"{",
"return",
"msg",
"instanceof",
"HttpRequest",
"&&",
"(",
"(",
"HttpRequest",
")",
"msg",
")",
".",
"headers",
"(",
")",
".",
"get",
"(",
"HttpHeaderNames",
".",
"UPGRADE"... | Determines whether or not the message is an HTTP upgrade request. | [
"Determines",
"whether",
"or",
"not",
"the",
"message",
"is",
"an",
"HTTP",
"upgrade",
"request",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpServerUpgradeHandler.java#L253-L255 | train | Checks if the request is an upgrade request. | [
30522,
2797,
10763,
22017,
20898,
2003,
6279,
24170,
2890,
15500,
1006,
8299,
16429,
20614,
5796,
2290,
1007,
1063,
2709,
5796,
2290,
6013,
11253,
8299,
2890,
15500,
1004,
1004,
1006,
1006,
8299,
2890,
15500,
1007,
5796,
2290,
1007,
1012,
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-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBSerializedCompositeKeyBuilder.java | RocksDBSerializedCompositeKeyBuilder.setKeyAndKeyGroup | public void setKeyAndKeyGroup(@Nonnull K key, @Nonnegative int keyGroupId) {
try {
serializeKeyGroupAndKey(key, keyGroupId);
} catch (IOException shouldNeverHappen) {
throw new FlinkRuntimeException(shouldNeverHappen);
}
} | java | public void setKeyAndKeyGroup(@Nonnull K key, @Nonnegative int keyGroupId) {
try {
serializeKeyGroupAndKey(key, keyGroupId);
} catch (IOException shouldNeverHappen) {
throw new FlinkRuntimeException(shouldNeverHappen);
}
} | [
"public",
"void",
"setKeyAndKeyGroup",
"(",
"@",
"Nonnull",
"K",
"key",
",",
"@",
"Nonnegative",
"int",
"keyGroupId",
")",
"{",
"try",
"{",
"serializeKeyGroupAndKey",
"(",
"key",
",",
"keyGroupId",
")",
";",
"}",
"catch",
"(",
"IOException",
"shouldNeverHappen... | Sets the key and key-group as prefix. This will serialize them into the buffer and the will be used to create
composite keys with provided namespaces.
@param key the key.
@param keyGroupId the key-group id for the key. | [
"Sets",
"the",
"key",
"and",
"key",
"-",
"group",
"as",
"prefix",
".",
"This",
"will",
"serialize",
"them",
"into",
"the",
"buffer",
"and",
"the",
"will",
"be",
"used",
"to",
"create",
"composite",
"keys",
"with",
"provided",
"namespaces",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBSerializedCompositeKeyBuilder.java#L94-L100 | train | Sets the key and keyGroupId. | [
30522,
2270,
11675,
2275,
14839,
5685,
14839,
17058,
1006,
1030,
2512,
11231,
3363,
1047,
3145,
1010,
1030,
2512,
2638,
26792,
20014,
3145,
17058,
3593,
1007,
1063,
3046,
1063,
7642,
4697,
14839,
17058,
5685,
14839,
1006,
3145,
1010,
3145,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java | FastDateFormat.getDateTimeInstance | public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle) {
return cache.getDateTimeInstance(dateStyle, timeStyle, null, null);
} | java | public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle) {
return cache.getDateTimeInstance(dateStyle, timeStyle, null, null);
} | [
"public",
"static",
"FastDateFormat",
"getDateTimeInstance",
"(",
"final",
"int",
"dateStyle",
",",
"final",
"int",
"timeStyle",
")",
"{",
"return",
"cache",
".",
"getDateTimeInstance",
"(",
"dateStyle",
",",
"timeStyle",
",",
"null",
",",
"null",
")",
";",
"}... | 获得 {@link FastDateFormat} 实例<br>
支持缓存
@param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
@param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
@return 本地化 {@link FastDateFormat} | [
"获得",
"{",
"@link",
"FastDateFormat",
"}",
"实例<br",
">",
"支持缓存"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L220-L222 | train | Gets the date time formatter. | [
30522,
2270,
10763,
3435,
13701,
14192,
4017,
2131,
13701,
7292,
7076,
26897,
1006,
2345,
20014,
5246,
27983,
1010,
2345,
20014,
2335,
27983,
1007,
1063,
2709,
17053,
1012,
2131,
13701,
7292,
7076,
26897,
1006,
5246,
27983,
1010,
2335,
27983,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java | SqlExecutor.executeForGeneratedKey | public static Long executeForGeneratedKey(Connection conn, String sql, Object... params) throws SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = StatementUtil.prepareStatement(conn, sql, params);
ps.executeUpdate();
rs = ps.getGeneratedKeys();
if (rs != null && rs.next()) {
try {
return rs.getLong(1);
} catch (SQLException e) {
// 可能会出现没有主键返回的情况
}
}
return null;
} finally {
DbUtil.close(ps);
DbUtil.close(rs);
}
} | java | public static Long executeForGeneratedKey(Connection conn, String sql, Object... params) throws SQLException {
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = StatementUtil.prepareStatement(conn, sql, params);
ps.executeUpdate();
rs = ps.getGeneratedKeys();
if (rs != null && rs.next()) {
try {
return rs.getLong(1);
} catch (SQLException e) {
// 可能会出现没有主键返回的情况
}
}
return null;
} finally {
DbUtil.close(ps);
DbUtil.close(rs);
}
} | [
"public",
"static",
"Long",
"executeForGeneratedKey",
"(",
"Connection",
"conn",
",",
"String",
"sql",
",",
"Object",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"PreparedStatement",
"ps",
"=",
"null",
";",
"ResultSet",
"rs",
"=",
"null",
";",
"try",
... | 执行非查询语句,返回主键<br>
发查询语句包括 插入、更新、删除<br>
此方法不会关闭Connection
@param conn 数据库连接对象
@param sql SQL
@param params 参数
@return 主键
@throws SQLException SQL执行异常 | [
"执行非查询语句,返回主键<br",
">",
"发查询语句包括",
"插入、更新、删除<br",
">",
"此方法不会关闭Connection"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L132-L151 | train | Execute a SQL statement that returns the generated key. | [
30522,
2270,
10763,
2146,
15389,
29278,
6914,
16848,
14839,
1006,
4434,
9530,
2078,
1010,
5164,
29296,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
29296,
10288,
24422,
1063,
4810,
9153,
18532,
4765,
8827,
1027,
19701,
1025,
3463,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/StringUtil.java | StringUtil.substringAfter | public static String substringAfter(String value, char delim) {
int pos = value.indexOf(delim);
if (pos >= 0) {
return value.substring(pos + 1);
}
return null;
} | java | public static String substringAfter(String value, char delim) {
int pos = value.indexOf(delim);
if (pos >= 0) {
return value.substring(pos + 1);
}
return null;
} | [
"public",
"static",
"String",
"substringAfter",
"(",
"String",
"value",
",",
"char",
"delim",
")",
"{",
"int",
"pos",
"=",
"value",
".",
"indexOf",
"(",
"delim",
")",
";",
"if",
"(",
"pos",
">=",
"0",
")",
"{",
"return",
"value",
".",
"substring",
"(... | Get the item after one char delim if the delim is found (else null).
This operation is a simplified and optimized
version of {@link String#split(String, int)}. | [
"Get",
"the",
"item",
"after",
"one",
"char",
"delim",
"if",
"the",
"delim",
"is",
"found",
"(",
"else",
"null",
")",
".",
"This",
"operation",
"is",
"a",
"simplified",
"and",
"optimized",
"version",
"of",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L67-L73 | train | Get substring after a class attribute. | [
30522,
2270,
10763,
5164,
4942,
3367,
4892,
10354,
3334,
1006,
5164,
3643,
1010,
25869,
3972,
5714,
1007,
1063,
20014,
13433,
2015,
1027,
3643,
1012,
5950,
11253,
1006,
3972,
5714,
1007,
1025,
2065,
1006,
13433,
2015,
1028,
1027,
1014,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java | WorkbookUtil.createBook | public static Workbook createBook(File excelFile, String password) {
try {
return WorkbookFactory.create(excelFile, password);
} catch (Exception e) {
throw new POIException(e);
}
} | java | public static Workbook createBook(File excelFile, String password) {
try {
return WorkbookFactory.create(excelFile, password);
} catch (Exception e) {
throw new POIException(e);
}
} | [
"public",
"static",
"Workbook",
"createBook",
"(",
"File",
"excelFile",
",",
"String",
"password",
")",
"{",
"try",
"{",
"return",
"WorkbookFactory",
".",
"create",
"(",
"excelFile",
",",
"password",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",... | 创建或加载工作簿,只读模式
@param excelFile Excel文件
@param password Excel工作簿密码,如果无密码传{@code null}
@return {@link Workbook} | [
"创建或加载工作簿,只读模式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java#L58-L64 | train | Creates a new Excel book from the given file and password. | [
30522,
2270,
10763,
2147,
8654,
3443,
8654,
1006,
5371,
24970,
8873,
2571,
1010,
5164,
20786,
1007,
1063,
3046,
1063,
2709,
2147,
8654,
21450,
1012,
3443,
1006,
24970,
8873,
2571,
1010,
20786,
1007,
1025,
1065,
4608,
1006,
6453,
1041,
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/net/NetUtil.java | NetUtil.localIpv4s | public static LinkedHashSet<String> localIpv4s() {
Enumeration<NetworkInterface> networkInterfaces = null;
try {
networkInterfaces = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
throw new UtilException(e);
}
if (networkInterfaces == null) {
throw new UtilException("Get network interface error!");
}
final LinkedHashSet<String> ipSet = new LinkedHashSet<>();
while (networkInterfaces.hasMoreElements()) {
final NetworkInterface networkInterface = networkInterfaces.nextElement();
final Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
final InetAddress inetAddress = inetAddresses.nextElement();
if (inetAddress != null && inetAddress instanceof Inet4Address) {
ipSet.add(inetAddress.getHostAddress());
}
}
}
return ipSet;
} | java | public static LinkedHashSet<String> localIpv4s() {
Enumeration<NetworkInterface> networkInterfaces = null;
try {
networkInterfaces = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
throw new UtilException(e);
}
if (networkInterfaces == null) {
throw new UtilException("Get network interface error!");
}
final LinkedHashSet<String> ipSet = new LinkedHashSet<>();
while (networkInterfaces.hasMoreElements()) {
final NetworkInterface networkInterface = networkInterfaces.nextElement();
final Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
while (inetAddresses.hasMoreElements()) {
final InetAddress inetAddress = inetAddresses.nextElement();
if (inetAddress != null && inetAddress instanceof Inet4Address) {
ipSet.add(inetAddress.getHostAddress());
}
}
}
return ipSet;
} | [
"public",
"static",
"LinkedHashSet",
"<",
"String",
">",
"localIpv4s",
"(",
")",
"{",
"Enumeration",
"<",
"NetworkInterface",
">",
"networkInterfaces",
"=",
"null",
";",
"try",
"{",
"networkInterfaces",
"=",
"NetworkInterface",
".",
"getNetworkInterfaces",
"(",
")... | 获得本机的IP地址列表<br>
返回的IP列表有序,按照系统设备顺序
@return IP地址列表 {@link LinkedHashSet} | [
"获得本机的IP地址列表<br",
">",
"返回的IP列表有序,按照系统设备顺序"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L316-L342 | train | Returns a set of all IPv4 addresses that are local to the system. | [
30522,
2270,
10763,
5799,
14949,
7898,
3388,
1026,
5164,
1028,
2334,
11514,
2615,
2549,
2015,
1006,
1007,
1063,
4372,
17897,
8156,
1026,
2897,
18447,
2121,
12172,
1028,
2897,
18447,
2121,
12172,
2015,
1027,
19701,
1025,
3046,
1063,
2897,
18... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/StackTraceSampleService.java | StackTraceSampleService.requestStackTraceSample | public CompletableFuture<List<StackTraceElement[]>> requestStackTraceSample(
final StackTraceSampleableTask task,
@Nonnegative final int numSamples,
final Time delayBetweenSamples,
final int maxStackTraceDepth) {
checkNotNull(task, "task must not be null");
checkArgument(numSamples > 0, "numSamples must be positive");
checkNotNull(delayBetweenSamples, "delayBetweenSamples must not be null");
return requestStackTraceSample(
task,
numSamples,
delayBetweenSamples,
maxStackTraceDepth,
new ArrayList<>(numSamples),
new CompletableFuture<>());
} | java | public CompletableFuture<List<StackTraceElement[]>> requestStackTraceSample(
final StackTraceSampleableTask task,
@Nonnegative final int numSamples,
final Time delayBetweenSamples,
final int maxStackTraceDepth) {
checkNotNull(task, "task must not be null");
checkArgument(numSamples > 0, "numSamples must be positive");
checkNotNull(delayBetweenSamples, "delayBetweenSamples must not be null");
return requestStackTraceSample(
task,
numSamples,
delayBetweenSamples,
maxStackTraceDepth,
new ArrayList<>(numSamples),
new CompletableFuture<>());
} | [
"public",
"CompletableFuture",
"<",
"List",
"<",
"StackTraceElement",
"[",
"]",
">",
">",
"requestStackTraceSample",
"(",
"final",
"StackTraceSampleableTask",
"task",
",",
"@",
"Nonnegative",
"final",
"int",
"numSamples",
",",
"final",
"Time",
"delayBetweenSamples",
... | Returns a future that completes with a given number of stack trace samples of a task thread.
@param task The task to be sampled from.
@param numSamples The number of samples.
@param delayBetweenSamples The time to wait between taking samples.
@param maxStackTraceDepth The maximum depth of the returned stack traces.
Negative means unlimited.
@return A future containing the stack trace samples. | [
"Returns",
"a",
"future",
"that",
"completes",
"with",
"a",
"given",
"number",
"of",
"stack",
"trace",
"samples",
"of",
"a",
"task",
"thread",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/StackTraceSampleService.java#L60-L77 | train | Requests a stack trace sample from a task. | [
30522,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
2862,
1026,
9991,
6494,
3401,
12260,
3672,
1031,
1033,
1028,
1028,
11186,
2696,
3600,
6494,
9623,
16613,
2571,
1006,
2345,
9991,
6494,
9623,
16613,
19738,
3468,
10230,
2243,
4708,
1010,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getBeLong48 | public final long getBeLong48() {
if (position + 5 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 5));
byte[] buf = buffer;
return ((long) (buf[position++]) << 40) | ((long) (0xff & buf[position++]) << 32)
| ((long) (0xff & buf[position++]) << 24) | ((long) (0xff & buf[position++]) << 16)
| ((long) (0xff & buf[position++]) << 8) | ((long) (0xff & buf[position++]));
} | java | public final long getBeLong48() {
if (position + 5 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 5));
byte[] buf = buffer;
return ((long) (buf[position++]) << 40) | ((long) (0xff & buf[position++]) << 32)
| ((long) (0xff & buf[position++]) << 24) | ((long) (0xff & buf[position++]) << 16)
| ((long) (0xff & buf[position++]) << 8) | ((long) (0xff & buf[position++]));
} | [
"public",
"final",
"long",
"getBeLong48",
"(",
")",
"{",
"if",
"(",
"position",
"+",
"5",
">=",
"origin",
"+",
"limit",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"(",
"position",
"-",
"origin",
"+",
"5",
")",
")",
... | Return next 48-bit signed long from buffer. (Big-endian)
@see mysql-5.6.10/include/myisampack.h - mi_sint6korr | [
"Return",
"next",
"48",
"-",
"bit",
"signed",
"long",
"from",
"buffer",
".",
"(",
"Big",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L698-L706 | train | Gets a long value in the buffer as encoded in BE long48 format. | [
30522,
2270,
2345,
2146,
2131,
8671,
5063,
18139,
1006,
1007,
1063,
2065,
1006,
2597,
1009,
1019,
1028,
1027,
4761,
1009,
5787,
1007,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
5787,
4654,
9468,
13089,
1024,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Dict.java | Dict.parseBean | public <T> Dict parseBean(T bean, boolean isToUnderlineCase, boolean ignoreNullValue) {
Assert.notNull(bean, "Bean class must be not null");
this.putAll(BeanUtil.beanToMap(bean, isToUnderlineCase, ignoreNullValue));
return this;
} | java | public <T> Dict parseBean(T bean, boolean isToUnderlineCase, boolean ignoreNullValue) {
Assert.notNull(bean, "Bean class must be not null");
this.putAll(BeanUtil.beanToMap(bean, isToUnderlineCase, ignoreNullValue));
return this;
} | [
"public",
"<",
"T",
">",
"Dict",
"parseBean",
"(",
"T",
"bean",
",",
"boolean",
"isToUnderlineCase",
",",
"boolean",
"ignoreNullValue",
")",
"{",
"Assert",
".",
"notNull",
"(",
"bean",
",",
"\"Bean class must be not null\"",
")",
";",
"this",
".",
"putAll",
... | 将值对象转换为Dict<br>
类名会被当作表名,小写第一个字母
@param <T> Bean类型
@param bean 值对象
@param isToUnderlineCase 是否转换为下划线模式
@param ignoreNullValue 是否忽略值为空的字段
@return 自己 | [
"将值对象转换为Dict<br",
">",
"类名会被当作表名,小写第一个字母"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Dict.java#L181-L185 | train | Parse a bean into a map. | [
30522,
2270,
1026,
1056,
1028,
4487,
6593,
11968,
3366,
4783,
2319,
1006,
1056,
14068,
1010,
22017,
20898,
21541,
28819,
2121,
4179,
18382,
1010,
22017,
20898,
8568,
11231,
3363,
10175,
5657,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-metrics/flink-metrics-statsd/src/main/java/org/apache/flink/metrics/statsd/StatsDReporter.java | StatsDReporter.reportCounter | private void reportCounter(final String name, final Counter counter) {
send(name, String.valueOf(counter.getCount()));
} | java | private void reportCounter(final String name, final Counter counter) {
send(name, String.valueOf(counter.getCount()));
} | [
"private",
"void",
"reportCounter",
"(",
"final",
"String",
"name",
",",
"final",
"Counter",
"counter",
")",
"{",
"send",
"(",
"name",
",",
"String",
".",
"valueOf",
"(",
"counter",
".",
"getCount",
"(",
")",
")",
")",
";",
"}"
] | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-metrics/flink-metrics-statsd/src/main/java/org/apache/flink/metrics/statsd/StatsDReporter.java#L129-L131 | train | Reports a counter. | [
30522,
2797,
11675,
3189,
3597,
16671,
2121,
1006,
2345,
5164,
2171,
1010,
2345,
4675,
4675,
1007,
1063,
4604,
1006,
2171,
1010,
5164,
1012,
3643,
11253,
1006,
4675,
1012,
2131,
3597,
16671,
1006,
1007,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.filterOnVertices | public Graph<K, VV, EV> filterOnVertices(FilterFunction<Vertex<K, VV>> vertexFilter) {
DataSet<Vertex<K, VV>> filteredVertices = this.vertices.filter(vertexFilter);
DataSet<Edge<K, EV>> remainingEdges = this.edges.join(filteredVertices)
.where(0).equalTo(0).with(new ProjectEdge<>())
.join(filteredVertices).where(1).equalTo(0)
.with(new ProjectEdge<>()).name("Filter on vertices");
return new Graph<>(filteredVertices, remainingEdges, this.context);
} | java | public Graph<K, VV, EV> filterOnVertices(FilterFunction<Vertex<K, VV>> vertexFilter) {
DataSet<Vertex<K, VV>> filteredVertices = this.vertices.filter(vertexFilter);
DataSet<Edge<K, EV>> remainingEdges = this.edges.join(filteredVertices)
.where(0).equalTo(0).with(new ProjectEdge<>())
.join(filteredVertices).where(1).equalTo(0)
.with(new ProjectEdge<>()).name("Filter on vertices");
return new Graph<>(filteredVertices, remainingEdges, this.context);
} | [
"public",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"filterOnVertices",
"(",
"FilterFunction",
"<",
"Vertex",
"<",
"K",
",",
"VV",
">",
">",
"vertexFilter",
")",
"{",
"DataSet",
"<",
"Vertex",
"<",
"K",
",",
"VV",
">",
">",
"filteredVertices",
"=... | Apply a filtering function to the graph and return a sub-graph that
satisfies the predicates only for the vertices.
@param vertexFilter the filter function for vertices.
@return the resulting sub-graph. | [
"Apply",
"a",
"filtering",
"function",
"to",
"the",
"graph",
"and",
"return",
"a",
"sub",
"-",
"graph",
"that",
"satisfies",
"the",
"predicates",
"only",
"for",
"the",
"vertices",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L888-L898 | train | Returns a new graph that contains only edges that are filtered on the vertices. | [
30522,
2270,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
11307,
2239,
16874,
23522,
1006,
11307,
11263,
27989,
1026,
19449,
1026,
1047,
1010,
1058,
2615,
1028,
1028,
19449,
8873,
21928,
1007,
1063,
2951,
13462,
1026,
19449,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java | Matrix.print | public void print(PrintWriter output, int w, int d)
{
DecimalFormat format = new DecimalFormat();
format.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
format.setMinimumIntegerDigits(1);
format.setMaximumFractionDigits(d);
format.setMinimumFractionDigits(d);
format.setGroupingUsed(false);
print(output, format, w + 2);
} | java | public void print(PrintWriter output, int w, int d)
{
DecimalFormat format = new DecimalFormat();
format.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
format.setMinimumIntegerDigits(1);
format.setMaximumFractionDigits(d);
format.setMinimumFractionDigits(d);
format.setGroupingUsed(false);
print(output, format, w + 2);
} | [
"public",
"void",
"print",
"(",
"PrintWriter",
"output",
",",
"int",
"w",
",",
"int",
"d",
")",
"{",
"DecimalFormat",
"format",
"=",
"new",
"DecimalFormat",
"(",
")",
";",
"format",
".",
"setDecimalFormatSymbols",
"(",
"new",
"DecimalFormatSymbols",
"(",
"Lo... | Print the matrix to the output stream. Line the elements up in
columns with a Fortran-like 'Fw.d' style format.
@param output Output stream.
@param w Column width.
@param d Number of digits after the decimal. | [
"Print",
"the",
"matrix",
"to",
"the",
"output",
"stream",
".",
"Line",
"the",
"elements",
"up",
"in",
"columns",
"with",
"a",
"Fortran",
"-",
"like",
"Fw",
".",
"d",
"style",
"format",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L1054-L1063 | train | Print the base class file. | [
30522,
2270,
11675,
6140,
1006,
6140,
15994,
6434,
1010,
20014,
1059,
1010,
20014,
1040,
1007,
1063,
26066,
14192,
4017,
4289,
1027,
2047,
26066,
14192,
4017,
1006,
1007,
1025,
4289,
1012,
2275,
3207,
6895,
9067,
14192,
11149,
24335,
14956,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/document/sentence/Sentence.java | Sentence.findFirstWordIteratorByLabel | public ListIterator<IWord> findFirstWordIteratorByLabel(String label)
{
ListIterator<IWord> listIterator = this.wordList.listIterator();
while (listIterator.hasNext())
{
IWord word = listIterator.next();
if (label.equals(word.getLabel()))
{
return listIterator;
}
}
return null;
} | java | public ListIterator<IWord> findFirstWordIteratorByLabel(String label)
{
ListIterator<IWord> listIterator = this.wordList.listIterator();
while (listIterator.hasNext())
{
IWord word = listIterator.next();
if (label.equals(word.getLabel()))
{
return listIterator;
}
}
return null;
} | [
"public",
"ListIterator",
"<",
"IWord",
">",
"findFirstWordIteratorByLabel",
"(",
"String",
"label",
")",
"{",
"ListIterator",
"<",
"IWord",
">",
"listIterator",
"=",
"this",
".",
"wordList",
".",
"listIterator",
"(",
")",
";",
"while",
"(",
"listIterator",
".... | 找出第一个词性为label的单词的指针(不检查复合词内部的简单词)<br>
若要查看该单词,请调用 previous<br>
若要删除该单词,请调用 remove<br>
@param label
@return | [
"找出第一个词性为label的单词的指针(不检查复合词内部的简单词)<br",
">",
"若要查看该单词,请调用",
"previous<br",
">",
"若要删除该单词,请调用",
"remove<br",
">"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/document/sentence/Sentence.java#L365-L377 | train | Gets the first word iterator by label. | [
30522,
2270,
2862,
21646,
8844,
1026,
1045,
18351,
1028,
2424,
8873,
12096,
18351,
21646,
8844,
3762,
20470,
2884,
1006,
5164,
3830,
1007,
1063,
2862,
21646,
8844,
1026,
1045,
18351,
1028,
2862,
21646,
8844,
1027,
2023,
1012,
2773,
9863,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/concurrent/PromiseAggregator.java | PromiseAggregator.add | @SafeVarargs
public final PromiseAggregator<V, F> add(Promise<V>... promises) {
if (promises == null) {
throw new NullPointerException("promises");
}
if (promises.length == 0) {
return this;
}
synchronized (this) {
if (pendingPromises == null) {
int size;
if (promises.length > 1) {
size = promises.length;
} else {
size = 2;
}
pendingPromises = new LinkedHashSet<Promise<V>>(size);
}
for (Promise<V> p : promises) {
if (p == null) {
continue;
}
pendingPromises.add(p);
p.addListener(this);
}
}
return this;
} | java | @SafeVarargs
public final PromiseAggregator<V, F> add(Promise<V>... promises) {
if (promises == null) {
throw new NullPointerException("promises");
}
if (promises.length == 0) {
return this;
}
synchronized (this) {
if (pendingPromises == null) {
int size;
if (promises.length > 1) {
size = promises.length;
} else {
size = 2;
}
pendingPromises = new LinkedHashSet<Promise<V>>(size);
}
for (Promise<V> p : promises) {
if (p == null) {
continue;
}
pendingPromises.add(p);
p.addListener(this);
}
}
return this;
} | [
"@",
"SafeVarargs",
"public",
"final",
"PromiseAggregator",
"<",
"V",
",",
"F",
">",
"add",
"(",
"Promise",
"<",
"V",
">",
"...",
"promises",
")",
"{",
"if",
"(",
"promises",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"promise... | Add the given {@link Promise}s to the aggregator. | [
"Add",
"the",
"given",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/PromiseAggregator.java#L64-L91 | train | Add a list of Promises to the aggregator. | [
30522,
1030,
3647,
24516,
10623,
2015,
2270,
2345,
4872,
8490,
30524,
1028,
1012,
1012,
1012,
10659,
1007,
1063,
2065,
1006,
10659,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
10659,
1000,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java | Decimal.divideToIntegralValue | public static Decimal divideToIntegralValue(Decimal value, Decimal divisor, int precision, int scale) {
BigDecimal bd = value.toBigDecimal().divideToIntegralValue(divisor.toBigDecimal());
return fromBigDecimal(bd, precision, scale);
} | java | public static Decimal divideToIntegralValue(Decimal value, Decimal divisor, int precision, int scale) {
BigDecimal bd = value.toBigDecimal().divideToIntegralValue(divisor.toBigDecimal());
return fromBigDecimal(bd, precision, scale);
} | [
"public",
"static",
"Decimal",
"divideToIntegralValue",
"(",
"Decimal",
"value",
",",
"Decimal",
"divisor",
",",
"int",
"precision",
",",
"int",
"scale",
")",
"{",
"BigDecimal",
"bd",
"=",
"value",
".",
"toBigDecimal",
"(",
")",
".",
"divideToIntegralValue",
"... | Returns a {@code Decimal} whose value is the integer part
of the quotient {@code (this / divisor)} rounded down.
@param value value by which this {@code Decimal} is to be divided.
@param divisor value by which this {@code Decimal} is to be divided.
@return The integer part of {@code this / divisor}.
@throws ArithmeticException if {@code divisor==0} | [
"Returns",
"a",
"{",
"@code",
"Decimal",
"}",
"whose",
"value",
"is",
"the",
"integer",
"part",
"of",
"the",
"quotient",
"{",
"@code",
"(",
"this",
"/",
"divisor",
")",
"}",
"rounded",
"down",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java#L328-L331 | train | Divide to integral value. | [
30522,
2270,
10763,
26066,
11443,
3406,
18447,
13910,
7941,
10175,
5657,
1006,
26066,
3643,
1010,
26066,
4487,
11365,
2953,
1010,
20014,
11718,
1010,
20014,
4094,
1007,
1063,
2502,
3207,
6895,
9067,
1038,
2094,
1027,
3643,
1012,
2000,
5638,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
redisson/redisson | redisson/src/main/java/org/redisson/api/LocalCachedMapOptions.java | LocalCachedMapOptions.timeToLive | public LocalCachedMapOptions<K, V> timeToLive(long timeToLive, TimeUnit timeUnit) {
return timeToLive(timeUnit.toMillis(timeToLive));
} | java | public LocalCachedMapOptions<K, V> timeToLive(long timeToLive, TimeUnit timeUnit) {
return timeToLive(timeUnit.toMillis(timeToLive));
} | [
"public",
"LocalCachedMapOptions",
"<",
"K",
",",
"V",
">",
"timeToLive",
"(",
"long",
"timeToLive",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"return",
"timeToLive",
"(",
"timeUnit",
".",
"toMillis",
"(",
"timeToLive",
")",
")",
";",
"}"
] | Sets time to live for each map entry in local cache.
If value equals to <code>0</code> then timeout is not applied
@param timeToLive - time to live
@param timeUnit - time unit
@return LocalCachedMapOptions instance | [
"Sets",
"time",
"to",
"live",
"for",
"each",
"map",
"entry",
"in",
"local",
"cache",
".",
"If",
"value",
"equals",
"to",
"<code",
">",
"0<",
"/",
"code",
">",
"then",
"timeout",
"is",
"not",
"applied"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/LocalCachedMapOptions.java#L244-L246 | train | Returns a new instance of this class with the specified time to live. | [
30522,
2270,
2334,
3540,
7690,
2863,
16340,
9285,
1026,
1047,
1010,
1058,
1028,
2051,
3406,
3669,
3726,
1006,
2146,
2051,
3406,
3669,
3726,
1010,
2051,
19496,
2102,
2051,
19496,
2102,
1007,
1063,
2709,
2051,
3406,
3669,
3726,
1006,
2051,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Native.java | Native.splice | public static int splice(int fd, long offIn, int fdOut, long offOut, long len) throws IOException {
int res = splice0(fd, offIn, fdOut, offOut, len);
if (res >= 0) {
return res;
}
return ioResult("splice", res, SPLICE_CONNECTION_RESET_EXCEPTION, SPLICE_CLOSED_CHANNEL_EXCEPTION);
} | java | public static int splice(int fd, long offIn, int fdOut, long offOut, long len) throws IOException {
int res = splice0(fd, offIn, fdOut, offOut, len);
if (res >= 0) {
return res;
}
return ioResult("splice", res, SPLICE_CONNECTION_RESET_EXCEPTION, SPLICE_CLOSED_CHANNEL_EXCEPTION);
} | [
"public",
"static",
"int",
"splice",
"(",
"int",
"fd",
",",
"long",
"offIn",
",",
"int",
"fdOut",
",",
"long",
"offOut",
",",
"long",
"len",
")",
"throws",
"IOException",
"{",
"int",
"res",
"=",
"splice0",
"(",
"fd",
",",
"offIn",
",",
"fdOut",
",",
... | File-descriptor operations | [
"File",
"-",
"descriptor",
"operations"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/Native.java#L163-L169 | train | splice from a file descriptor to a file descriptor. | [
30522,
2270,
10763,
20014,
11867,
13231,
1006,
20014,
1042,
2094,
1010,
2146,
2125,
2378,
1010,
20014,
1042,
26797,
2102,
1010,
2146,
2125,
5833,
1010,
2146,
18798,
1007,
11618,
22834,
10288,
24422,
1063,
20014,
24501,
1027,
11867,
13231,
269... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CamelCaseMap.java | CamelCaseMap.customKey | @Override
protected Object customKey(Object key) {
if (null != key && key instanceof CharSequence) {
key = StrUtil.toCamelCase(key.toString());
}
return key;
} | java | @Override
protected Object customKey(Object key) {
if (null != key && key instanceof CharSequence) {
key = StrUtil.toCamelCase(key.toString());
}
return key;
} | [
"@",
"Override",
"protected",
"Object",
"customKey",
"(",
"Object",
"key",
")",
"{",
"if",
"(",
"null",
"!=",
"key",
"&&",
"key",
"instanceof",
"CharSequence",
")",
"{",
"key",
"=",
"StrUtil",
".",
"toCamelCase",
"(",
"key",
".",
"toString",
"(",
")",
... | 将Key转为驼峰风格,如果key为字符串的话
@param key KEY
@return 驼峰Key | [
"将Key转为驼峰风格,如果key为字符串的话"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/CamelCaseMap.java#L75-L81 | train | Override to add a custom key to the map. | [
30522,
1030,
2058,
15637,
5123,
4874,
7661,
14839,
1006,
4874,
3145,
1007,
1063,
2065,
1006,
19701,
999,
1027,
3145,
1004,
1004,
3145,
6013,
11253,
25869,
3366,
4226,
5897,
1007,
1063,
3145,
1027,
2358,
22134,
4014,
1012,
2000,
28727,
2884,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/origin/PropertySourceOrigin.java | PropertySourceOrigin.get | public static Origin get(PropertySource<?> propertySource, String name) {
Origin origin = OriginLookup.getOrigin(propertySource, name);
return (origin != null) ? origin : new PropertySourceOrigin(propertySource, name);
} | java | public static Origin get(PropertySource<?> propertySource, String name) {
Origin origin = OriginLookup.getOrigin(propertySource, name);
return (origin != null) ? origin : new PropertySourceOrigin(propertySource, name);
} | [
"public",
"static",
"Origin",
"get",
"(",
"PropertySource",
"<",
"?",
">",
"propertySource",
",",
"String",
"name",
")",
"{",
"Origin",
"origin",
"=",
"OriginLookup",
".",
"getOrigin",
"(",
"propertySource",
",",
"name",
")",
";",
"return",
"(",
"origin",
... | Get an {@link Origin} for the given {@link PropertySource} and
{@code propertyName}. Will either return an {@link OriginLookup} result or a
{@link PropertySourceOrigin}.
@param propertySource the origin property source
@param name the property name
@return the property origin | [
"Get",
"an",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/origin/PropertySourceOrigin.java#L77-L80 | train | Get the origin for the given property source and name. | [
30522,
2270,
10763,
4761,
2131,
1006,
3200,
6499,
3126,
3401,
1026,
1029,
1028,
3200,
6499,
3126,
3401,
1010,
5164,
2171,
1007,
1063,
4761,
4761,
1027,
4761,
4135,
21940,
2361,
1012,
2131,
10050,
11528,
1006,
3200,
6499,
3126,
3401,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/LongParameter.java | LongParameter.setMaximumValue | public LongParameter setMaximumValue(long maximumValue) {
if (hasMinimumValue) {
Util.checkParameter(maximumValue >= minimumValue,
"Maximum value (" + maximumValue + ") must be greater than or equal to minimum (" + minimumValue + ")");
}
this.hasMaximumValue = true;
this.maximumValue = maximumValue;
return this;
} | java | public LongParameter setMaximumValue(long maximumValue) {
if (hasMinimumValue) {
Util.checkParameter(maximumValue >= minimumValue,
"Maximum value (" + maximumValue + ") must be greater than or equal to minimum (" + minimumValue + ")");
}
this.hasMaximumValue = true;
this.maximumValue = maximumValue;
return this;
} | [
"public",
"LongParameter",
"setMaximumValue",
"(",
"long",
"maximumValue",
")",
"{",
"if",
"(",
"hasMinimumValue",
")",
"{",
"Util",
".",
"checkParameter",
"(",
"maximumValue",
">=",
"minimumValue",
",",
"\"Maximum value (\"",
"+",
"maximumValue",
"+",
"\") must be ... | Set the maximum value.
<p>If a minimum value has been set then the maximum value must not be
less than the minimum value.
@param maximumValue the maximum value
@return this | [
"Set",
"the",
"maximum",
"value",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/LongParameter.java#L94-L104 | train | Sets the maximum value. | [
30522,
2270,
2146,
28689,
22828,
2275,
17848,
28591,
10175,
5657,
1006,
2146,
4555,
10175,
5657,
1007,
1063,
2065,
1006,
2038,
25300,
27147,
10175,
5657,
1007,
1063,
21183,
4014,
1012,
4638,
28689,
22828,
1006,
4555,
10175,
5657,
1028,
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... |
networknt/light-4j | utility/src/main/java/com/networknt/utility/NioUtils.java | NioUtils.create | public static void create(String zipFilename, String... filenames)
throws IOException {
try (FileSystem zipFileSystem = createZipFileSystem(zipFilename, true)) {
final Path root = zipFileSystem.getPath("/");
//iterate over the files we need to add
for (String filename : filenames) {
final Path src = Paths.get(filename);
//add a file to the zip file system
if(!Files.isDirectory(src)){
final Path dest = zipFileSystem.getPath(root.toString(),
src.toString());
final Path parent = dest.getParent();
if(Files.notExists(parent)){
if(logger.isDebugEnabled()) logger.debug("Creating directory %s", parent);
Files.createDirectories(parent);
}
Files.copy(src, dest, StandardCopyOption.REPLACE_EXISTING);
}
else{
//for directories, walk the file tree
Files.walkFileTree(src, new SimpleFileVisitor<Path>(){
@Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs) throws IOException {
final Path dest = zipFileSystem.getPath(root.toString(),
file.toString());
Files.copy(file, dest, StandardCopyOption.REPLACE_EXISTING);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult preVisitDirectory(Path dir,
BasicFileAttributes attrs) throws IOException {
final Path dirToCreate = zipFileSystem.getPath(root.toString(),
dir.toString());
if(Files.notExists(dirToCreate)){
if(logger.isDebugEnabled()) logger.debug("Creating directory %s\n", dirToCreate);
Files.createDirectories(dirToCreate);
}
return FileVisitResult.CONTINUE;
}
});
}
}
}
} | java | public static void create(String zipFilename, String... filenames)
throws IOException {
try (FileSystem zipFileSystem = createZipFileSystem(zipFilename, true)) {
final Path root = zipFileSystem.getPath("/");
//iterate over the files we need to add
for (String filename : filenames) {
final Path src = Paths.get(filename);
//add a file to the zip file system
if(!Files.isDirectory(src)){
final Path dest = zipFileSystem.getPath(root.toString(),
src.toString());
final Path parent = dest.getParent();
if(Files.notExists(parent)){
if(logger.isDebugEnabled()) logger.debug("Creating directory %s", parent);
Files.createDirectories(parent);
}
Files.copy(src, dest, StandardCopyOption.REPLACE_EXISTING);
}
else{
//for directories, walk the file tree
Files.walkFileTree(src, new SimpleFileVisitor<Path>(){
@Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs) throws IOException {
final Path dest = zipFileSystem.getPath(root.toString(),
file.toString());
Files.copy(file, dest, StandardCopyOption.REPLACE_EXISTING);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult preVisitDirectory(Path dir,
BasicFileAttributes attrs) throws IOException {
final Path dirToCreate = zipFileSystem.getPath(root.toString(),
dir.toString());
if(Files.notExists(dirToCreate)){
if(logger.isDebugEnabled()) logger.debug("Creating directory %s\n", dirToCreate);
Files.createDirectories(dirToCreate);
}
return FileVisitResult.CONTINUE;
}
});
}
}
}
} | [
"public",
"static",
"void",
"create",
"(",
"String",
"zipFilename",
",",
"String",
"...",
"filenames",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileSystem",
"zipFileSystem",
"=",
"createZipFileSystem",
"(",
"zipFilename",
",",
"true",
")",
")",
"{",
"fi... | Creates/updates a zip file.
@param zipFilename the name of the zip to create
@param filenames list of filename to add to the zip
@throws IOException IOException | [
"Creates",
"/",
"updates",
"a",
"zip",
"file",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/NioUtils.java#L124-L172 | train | Create a zip file system with the specified filenames. | [
30522,
2270,
10763,
11675,
3443,
1006,
5164,
14101,
8873,
20844,
4168,
1010,
5164,
1012,
1012,
1012,
5371,
18442,
2015,
1007,
11618,
22834,
10288,
24422,
1063,
3046,
1006,
6764,
27268,
6633,
14101,
8873,
4244,
27268,
6633,
1027,
3443,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/util/collection/TimSort.java | TimSort.binarySort | @SuppressWarnings("fallthrough")
private void binarySort(Buffer a, int lo, int hi, int start, Comparator<? super K> c) {
assert lo <= start && start <= hi;
if (start == lo)
start++;
K key0 = s.newKey();
K key1 = s.newKey();
Buffer pivotStore = s.allocate(1);
for ( ; start < hi; start++) {
s.copyElement(a, start, pivotStore, 0);
K pivot = s.getKey(pivotStore, 0, key0);
// Set left (and right) to the index where a[start] (pivot) belongs
int left = lo;
int right = start;
assert left <= right;
/*
* Invariants:
* pivot >= all in [lo, left).
* pivot < all in [right, start).
*/
while (left < right) {
int mid = (left + right) >>> 1;
if (c.compare(pivot, s.getKey(a, mid, key1)) < 0)
right = mid;
else
left = mid + 1;
}
assert left == right;
/*
* The invariants still hold: pivot >= all in [lo, left) and
* pivot < all in [left, start), so pivot belongs at left. Note
* that if there are elements equal to pivot, left points to the
* first slot after them -- that's why this sort is stable.
* Slide elements over to make room for pivot.
*/
int n = start - left; // The number of elements to move
// Switch is just an optimization for arraycopy in default case
switch (n) {
case 2: s.copyElement(a, left + 1, a, left + 2);
case 1: s.copyElement(a, left, a, left + 1);
break;
default: s.copyRange(a, left, a, left + 1, n);
}
s.copyElement(pivotStore, 0, a, left);
}
} | java | @SuppressWarnings("fallthrough")
private void binarySort(Buffer a, int lo, int hi, int start, Comparator<? super K> c) {
assert lo <= start && start <= hi;
if (start == lo)
start++;
K key0 = s.newKey();
K key1 = s.newKey();
Buffer pivotStore = s.allocate(1);
for ( ; start < hi; start++) {
s.copyElement(a, start, pivotStore, 0);
K pivot = s.getKey(pivotStore, 0, key0);
// Set left (and right) to the index where a[start] (pivot) belongs
int left = lo;
int right = start;
assert left <= right;
/*
* Invariants:
* pivot >= all in [lo, left).
* pivot < all in [right, start).
*/
while (left < right) {
int mid = (left + right) >>> 1;
if (c.compare(pivot, s.getKey(a, mid, key1)) < 0)
right = mid;
else
left = mid + 1;
}
assert left == right;
/*
* The invariants still hold: pivot >= all in [lo, left) and
* pivot < all in [left, start), so pivot belongs at left. Note
* that if there are elements equal to pivot, left points to the
* first slot after them -- that's why this sort is stable.
* Slide elements over to make room for pivot.
*/
int n = start - left; // The number of elements to move
// Switch is just an optimization for arraycopy in default case
switch (n) {
case 2: s.copyElement(a, left + 1, a, left + 2);
case 1: s.copyElement(a, left, a, left + 1);
break;
default: s.copyRange(a, left, a, left + 1, n);
}
s.copyElement(pivotStore, 0, a, left);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"fallthrough\"",
")",
"private",
"void",
"binarySort",
"(",
"Buffer",
"a",
",",
"int",
"lo",
",",
"int",
"hi",
",",
"int",
"start",
",",
"Comparator",
"<",
"?",
"super",
"K",
">",
"c",
")",
"{",
"assert",
"lo",
"<=",
"... | Sorts the specified portion of the specified array using a binary
insertion sort. This is the best method for sorting small numbers
of elements. It requires O(n log n) compares, but O(n^2) data
movement (worst case).
If the initial part of the specified range is already sorted,
this method can take advantage of it: the method assumes that the
elements from index {@code lo}, inclusive, to {@code start},
exclusive are already sorted.
@param a the array in which a range is to be sorted
@param lo the index of the first element in the range to be sorted
@param hi the index after the last element in the range to be sorted
@param start the index of the first element in the range that is
not already known to be sorted ({@code lo <= start <= hi})
@param c comparator to used for the sort | [
"Sorts",
"the",
"specified",
"portion",
"of",
"the",
"specified",
"array",
"using",
"a",
"binary",
"insertion",
"sort",
".",
"This",
"is",
"the",
"best",
"method",
"for",
"sorting",
"small",
"numbers",
"of",
"elements",
".",
"It",
"requires",
"O",
"(",
"n"... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/TimSort.java#L184-L233 | train | Binary sort. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
2991,
2705,
22494,
5603,
1000,
1007,
2797,
11675,
12441,
21748,
2102,
1006,
17698,
1037,
1010,
20014,
8840,
1010,
20014,
7632,
1010,
20014,
2707,
1010,
4012,
28689,
4263,
1026,
1029,
3565,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnector.java | KafkaCanalConnector.subscribe | @Override
public void subscribe() {
waitClientRunning();
if (!running) {
return;
}
if (partition == null) {
if (kafkaConsumer != null) {
kafkaConsumer.subscribe(Collections.singletonList(topic));
}
if (kafkaConsumer2 != null) {
kafkaConsumer2.subscribe(Collections.singletonList(topic));
}
} else {
TopicPartition topicPartition = new TopicPartition(topic, partition);
if (kafkaConsumer != null) {
kafkaConsumer.assign(Collections.singletonList(topicPartition));
}
if (kafkaConsumer2 != null) {
kafkaConsumer2.assign(Collections.singletonList(topicPartition));
}
}
} | java | @Override
public void subscribe() {
waitClientRunning();
if (!running) {
return;
}
if (partition == null) {
if (kafkaConsumer != null) {
kafkaConsumer.subscribe(Collections.singletonList(topic));
}
if (kafkaConsumer2 != null) {
kafkaConsumer2.subscribe(Collections.singletonList(topic));
}
} else {
TopicPartition topicPartition = new TopicPartition(topic, partition);
if (kafkaConsumer != null) {
kafkaConsumer.assign(Collections.singletonList(topicPartition));
}
if (kafkaConsumer2 != null) {
kafkaConsumer2.assign(Collections.singletonList(topicPartition));
}
}
} | [
"@",
"Override",
"public",
"void",
"subscribe",
"(",
")",
"{",
"waitClientRunning",
"(",
")",
";",
"if",
"(",
"!",
"running",
")",
"{",
"return",
";",
"}",
"if",
"(",
"partition",
"==",
"null",
")",
"{",
"if",
"(",
"kafkaConsumer",
"!=",
"null",
")",... | 订阅topic | [
"订阅topic"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnector.java#L120-L143 | train | Subscribes to the topic. | [
30522,
1030,
2058,
15637,
2270,
11675,
4942,
29234,
1006,
1007,
1063,
3524,
20464,
11638,
15532,
5582,
1006,
1007,
1025,
2065,
1006,
999,
2770,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
13571,
1027,
1027,
19701,
1007,
1063,
2065,
1006,
1055... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/LambdaUtil.java | LambdaUtil.withContextClassLoader | public static <E extends Throwable> void withContextClassLoader(
final ClassLoader cl,
final ThrowingRunnable<E> r) throws E {
try (TemporaryClassLoaderContext tmpCl = new TemporaryClassLoaderContext(cl)) {
r.run();
}
} | java | public static <E extends Throwable> void withContextClassLoader(
final ClassLoader cl,
final ThrowingRunnable<E> r) throws E {
try (TemporaryClassLoaderContext tmpCl = new TemporaryClassLoaderContext(cl)) {
r.run();
}
} | [
"public",
"static",
"<",
"E",
"extends",
"Throwable",
">",
"void",
"withContextClassLoader",
"(",
"final",
"ClassLoader",
"cl",
",",
"final",
"ThrowingRunnable",
"<",
"E",
">",
"r",
")",
"throws",
"E",
"{",
"try",
"(",
"TemporaryClassLoaderContext",
"tmpCl",
"... | Runs the given runnable with the given ClassLoader as the thread's
{@link Thread#setContextClassLoader(ClassLoader) context class loader}.
<p>The method will make sure to set the context class loader of the calling thread
back to what it was before after the runnable completed. | [
"Runs",
"the",
"given",
"runnable",
"with",
"the",
"given",
"ClassLoader",
"as",
"the",
"thread",
"s",
"{",
"@link",
"Thread#setContextClassLoader",
"(",
"ClassLoader",
")",
"context",
"class",
"loader",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/LambdaUtil.java#L76-L83 | train | With a context classloader. | [
30522,
2270,
10763,
1026,
1041,
8908,
5466,
3085,
1028,
11675,
2007,
8663,
18209,
26266,
11066,
2121,
1006,
2345,
2465,
11066,
2121,
18856,
1010,
2345,
6886,
15532,
22966,
1026,
1041,
1028,
1054,
1007,
11618,
1041,
1063,
3046,
1006,
5741,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/job/metrics/AbstractAggregatingMetricsHandler.java | AbstractAggregatingMetricsHandler.getAvailableMetrics | private static Collection<String> getAvailableMetrics(Collection<? extends MetricStore.ComponentMetricStore> stores) {
Set<String> uniqueMetrics = new HashSet<>(32);
for (MetricStore.ComponentMetricStore store : stores) {
uniqueMetrics.addAll(store.metrics.keySet());
}
return uniqueMetrics;
} | java | private static Collection<String> getAvailableMetrics(Collection<? extends MetricStore.ComponentMetricStore> stores) {
Set<String> uniqueMetrics = new HashSet<>(32);
for (MetricStore.ComponentMetricStore store : stores) {
uniqueMetrics.addAll(store.metrics.keySet());
}
return uniqueMetrics;
} | [
"private",
"static",
"Collection",
"<",
"String",
">",
"getAvailableMetrics",
"(",
"Collection",
"<",
"?",
"extends",
"MetricStore",
".",
"ComponentMetricStore",
">",
"stores",
")",
"{",
"Set",
"<",
"String",
">",
"uniqueMetrics",
"=",
"new",
"HashSet",
"<>",
... | Returns a JSON string containing a list of all available metrics in the given stores. Effectively this method maps
the union of all key-sets to JSON.
@param stores metrics
@return JSON string containing a list of all available metrics | [
"Returns",
"a",
"JSON",
"string",
"containing",
"a",
"list",
"of",
"all",
"available",
"metrics",
"in",
"the",
"given",
"stores",
".",
"Effectively",
"this",
"method",
"maps",
"the",
"union",
"of",
"all",
"key",
"-",
"sets",
"to",
"JSON",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/job/metrics/AbstractAggregatingMetricsHandler.java#L163-L169 | train | Get the list of metrics available in the given stores. | [
30522,
2797,
10763,
3074,
1026,
5164,
1028,
2131,
12462,
11733,
3468,
12589,
2015,
1006,
3074,
1026,
1029,
8908,
12046,
23809,
2063,
1012,
30524,
2063,
1012,
6922,
12589,
23809,
2063,
3573,
1024,
5324,
1007,
1063,
4310,
12589,
2015,
1012,
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/collection/trie/DoubleArrayTrie.java | DoubleArrayTrie.parseText | public void parseText(String text, AhoCorasickDoubleArrayTrie.IHit<V> processor)
{
Searcher searcher = getSearcher(text, 0);
while (searcher.next())
{
processor.hit(searcher.begin, searcher.begin + searcher.length, searcher.value);
}
} | java | public void parseText(String text, AhoCorasickDoubleArrayTrie.IHit<V> processor)
{
Searcher searcher = getSearcher(text, 0);
while (searcher.next())
{
processor.hit(searcher.begin, searcher.begin + searcher.length, searcher.value);
}
} | [
"public",
"void",
"parseText",
"(",
"String",
"text",
",",
"AhoCorasickDoubleArrayTrie",
".",
"IHit",
"<",
"V",
">",
"processor",
")",
"{",
"Searcher",
"searcher",
"=",
"getSearcher",
"(",
"text",
",",
"0",
")",
";",
"while",
"(",
"searcher",
".",
"next",
... | 全切分
@param text 文本
@param processor 处理器 | [
"全切分"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L1347-L1354 | train | Parse a sequence of tokens from a text string. | [
30522,
2270,
11675,
11968,
13462,
10288,
2102,
1006,
5164,
3793,
1010,
6289,
24163,
8180,
6799,
26797,
3468,
2906,
9447,
18886,
2063,
1012,
1045,
16584,
1026,
1058,
1028,
13151,
1007,
1063,
3945,
2121,
3945,
2121,
1027,
4152,
14644,
7474,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java | WritableColumnVector.appendStruct | public final int appendStruct(boolean isNull) {
if (isNull) {
appendNull();
for (WritableColumnVector c: childColumns) {
if (c.type instanceof StructType) {
c.appendStruct(true);
} else {
c.appendNull();
}
}
} else {
appendNotNull();
}
return elementsAppended;
} | java | public final int appendStruct(boolean isNull) {
if (isNull) {
appendNull();
for (WritableColumnVector c: childColumns) {
if (c.type instanceof StructType) {
c.appendStruct(true);
} else {
c.appendNull();
}
}
} else {
appendNotNull();
}
return elementsAppended;
} | [
"public",
"final",
"int",
"appendStruct",
"(",
"boolean",
"isNull",
")",
"{",
"if",
"(",
"isNull",
")",
"{",
"appendNull",
"(",
")",
";",
"for",
"(",
"WritableColumnVector",
"c",
":",
"childColumns",
")",
"{",
"if",
"(",
"c",
".",
"type",
"instanceof",
... | Appends a NULL struct. This *has* to be used for structs instead of appendNull() as this
recursively appends a NULL to its children.
We don't have this logic as the general appendNull implementation to optimize the more
common non-struct case. | [
"Appends",
"a",
"NULL",
"struct",
".",
"This",
"*",
"has",
"*",
"to",
"be",
"used",
"for",
"structs",
"instead",
"of",
"appendNull",
"()",
"as",
"this",
"recursively",
"appends",
"a",
"NULL",
"to",
"its",
"children",
".",
"We",
"don",
"t",
"have",
"thi... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java#L605-L619 | train | Append a Struct to the table. | [
30522,
2270,
2345,
20014,
10439,
10497,
3367,
6820,
6593,
1006,
22017,
20898,
3475,
18083,
1007,
1063,
2065,
1006,
3475,
18083,
1007,
1063,
10439,
10497,
11231,
3363,
1006,
1007,
1025,
2005,
1006,
25697,
3085,
25778,
2819,
2078,
3726,
16761,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/parser/BooleanParser.java | BooleanParser.byteArrayEquals | private static boolean byteArrayEquals(byte[] source, int start, int length, byte[] other) {
if (length != other.length) {
return false;
}
for (int i = 0; i < other.length; i++) {
if (Character.toLowerCase(source[i + start]) != other[i]) {
return false;
}
}
return true;
} | java | private static boolean byteArrayEquals(byte[] source, int start, int length, byte[] other) {
if (length != other.length) {
return false;
}
for (int i = 0; i < other.length; i++) {
if (Character.toLowerCase(source[i + start]) != other[i]) {
return false;
}
}
return true;
} | [
"private",
"static",
"boolean",
"byteArrayEquals",
"(",
"byte",
"[",
"]",
"source",
",",
"int",
"start",
",",
"int",
"length",
",",
"byte",
"[",
"]",
"other",
")",
"{",
"if",
"(",
"length",
"!=",
"other",
".",
"length",
")",
"{",
"return",
"false",
"... | Checks if a part of a byte array matches another byte array with chars (case-insensitive).
@param source The source byte array.
@param start The offset into the source byte array.
@param length The length of the match.
@param other The byte array which is fully compared to the part of the source array.
@return true if other can be found in the specified part of source, false otherwise. | [
"Checks",
"if",
"a",
"part",
"of",
"a",
"byte",
"array",
"matches",
"another",
"byte",
"array",
"with",
"chars",
"(",
"case",
"-",
"insensitive",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/parser/BooleanParser.java#L84-L94 | train | Test if two byte arrays are equal. | [
30522,
2797,
10763,
22017,
20898,
24880,
2906,
9447,
2063,
26426,
2015,
1006,
24880,
1031,
1033,
3120,
1010,
20014,
2707,
1010,
20014,
3091,
1010,
24880,
1031,
1033,
2060,
1007,
1063,
2065,
1006,
3091,
999,
1027,
2060,
1012,
3091,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/ComputeFunction.java | ComputeFunction.sendMessageTo | public final void sendMessageTo(K target, Message m) {
outMsg.f0 = target;
outMsg.f1 = m;
out.collect(Either.Right(outMsg));
} | java | public final void sendMessageTo(K target, Message m) {
outMsg.f0 = target;
outMsg.f1 = m;
out.collect(Either.Right(outMsg));
} | [
"public",
"final",
"void",
"sendMessageTo",
"(",
"K",
"target",
",",
"Message",
"m",
")",
"{",
"outMsg",
".",
"f0",
"=",
"target",
";",
"outMsg",
".",
"f1",
"=",
"m",
";",
"out",
".",
"collect",
"(",
"Either",
".",
"Right",
"(",
"outMsg",
")",
")",... | Sends the given message to the vertex identified by the given key. If the target vertex does not exist,
the next superstep will cause an exception due to a non-deliverable message.
@param target The key (id) of the target vertex to message.
@param m The message. | [
"Sends",
"the",
"given",
"message",
"to",
"the",
"vertex",
"identified",
"by",
"the",
"given",
"key",
".",
"If",
"the",
"target",
"vertex",
"does",
"not",
"exist",
"the",
"next",
"superstep",
"will",
"cause",
"an",
"exception",
"due",
"to",
"a",
"non",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/ComputeFunction.java#L115-L121 | train | Send message to target. | [
30522,
2270,
2345,
11675,
4604,
7834,
3736,
18150,
2080,
1006,
1047,
4539,
1010,
4471,
1049,
1007,
1063,
2041,
5244,
2290,
1012,
1042,
2692,
1027,
4539,
1025,
2041,
5244,
2290,
1012,
20069,
1027,
1049,
1025,
2041,
1012,
8145,
1006,
2593,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java | SpringApplicationBuilder.run | public ConfigurableApplicationContext run(String... args) {
if (this.running.get()) {
// If already created we just return the existing context
return this.context;
}
configureAsChildIfNecessary(args);
if (this.running.compareAndSet(false, true)) {
synchronized (this.running) {
// If not already running copy the sources over and then run.
this.context = build().run(args);
}
}
return this.context;
} | java | public ConfigurableApplicationContext run(String... args) {
if (this.running.get()) {
// If already created we just return the existing context
return this.context;
}
configureAsChildIfNecessary(args);
if (this.running.compareAndSet(false, true)) {
synchronized (this.running) {
// If not already running copy the sources over and then run.
this.context = build().run(args);
}
}
return this.context;
} | [
"public",
"ConfigurableApplicationContext",
"run",
"(",
"String",
"...",
"args",
")",
"{",
"if",
"(",
"this",
".",
"running",
".",
"get",
"(",
")",
")",
"{",
"// If already created we just return the existing context",
"return",
"this",
".",
"context",
";",
"}",
... | Create an application context (and its parent if specified) with the command line
args provided. The parent is run first with the same arguments if has not yet been
started.
@param args the command line arguments
@return an application context created from the current state | [
"Create",
"an",
"application",
"context",
"(",
"and",
"its",
"parent",
"if",
"specified",
")",
"with",
"the",
"command",
"line",
"args",
"provided",
".",
"The",
"parent",
"is",
"run",
"first",
"with",
"the",
"same",
"arguments",
"if",
"has",
"not",
"yet",
... | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/builder/SpringApplicationBuilder.java#L130-L143 | train | Run the application. | [
30522,
2270,
9530,
8873,
27390,
3085,
29098,
19341,
3508,
8663,
18209,
2448,
1006,
5164,
1012,
1012,
1012,
12098,
5620,
1007,
1063,
2065,
1006,
2023,
1012,
2770,
1012,
2131,
1006,
1007,
1007,
1063,
1013,
1013,
2065,
2525,
2580,
2057,
2074,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java | BatchTask.constructLogString | public static String constructLogString(String message, String taskName, AbstractInvokable parent) {
return message + ": " + taskName + " (" + (parent.getEnvironment().getTaskInfo().getIndexOfThisSubtask() + 1) +
'/' + parent.getEnvironment().getTaskInfo().getNumberOfParallelSubtasks() + ')';
} | java | public static String constructLogString(String message, String taskName, AbstractInvokable parent) {
return message + ": " + taskName + " (" + (parent.getEnvironment().getTaskInfo().getIndexOfThisSubtask() + 1) +
'/' + parent.getEnvironment().getTaskInfo().getNumberOfParallelSubtasks() + ')';
} | [
"public",
"static",
"String",
"constructLogString",
"(",
"String",
"message",
",",
"String",
"taskName",
",",
"AbstractInvokable",
"parent",
")",
"{",
"return",
"message",
"+",
"\": \"",
"+",
"taskName",
"+",
"\" (\"",
"+",
"(",
"parent",
".",
"getEnvironment",... | Utility function that composes a string for logging purposes. The string includes the given message,
the given name of the task and the index in its subtask group as well as the number of instances
that exist in its subtask group.
@param message The main message for the log.
@param taskName The name of the task.
@param parent The task that contains the code producing the message.
@return The string for logging. | [
"Utility",
"function",
"that",
"composes",
"a",
"string",
"for",
"logging",
"purposes",
".",
"The",
"string",
"includes",
"the",
"given",
"message",
"the",
"given",
"name",
"of",
"the",
"task",
"and",
"the",
"index",
"in",
"its",
"subtask",
"group",
"as",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java#L1172-L1175 | train | Construct log string. | [
30522,
2270,
10763,
5164,
9570,
21197,
3367,
4892,
1006,
5164,
4471,
1010,
5164,
4708,
18442,
1010,
10061,
2378,
6767,
2912,
3468,
6687,
1007,
1063,
2709,
4471,
1009,
30524,
15794,
24158,
6342,
19279,
19895,
1006,
1007,
1009,
1015,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java | CliFrontend.parseParameters | public int parseParameters(String[] args) {
// check for action
if (args.length < 1) {
CliFrontendParser.printHelp(customCommandLines);
System.out.println("Please specify an action.");
return 1;
}
// get action
String action = args[0];
// remove action from parameters
final String[] params = Arrays.copyOfRange(args, 1, args.length);
try {
// do action
switch (action) {
case ACTION_RUN:
run(params);
return 0;
case ACTION_LIST:
list(params);
return 0;
case ACTION_INFO:
info(params);
return 0;
case ACTION_CANCEL:
cancel(params);
return 0;
case ACTION_STOP:
stop(params);
return 0;
case ACTION_SAVEPOINT:
savepoint(params);
return 0;
case "-h":
case "--help":
CliFrontendParser.printHelp(customCommandLines);
return 0;
case "-v":
case "--version":
String version = EnvironmentInformation.getVersion();
String commitID = EnvironmentInformation.getRevisionInformation().commitId;
System.out.print("Version: " + version);
System.out.println(commitID.equals(EnvironmentInformation.UNKNOWN) ? "" : ", Commit ID: " + commitID);
return 0;
default:
System.out.printf("\"%s\" is not a valid action.\n", action);
System.out.println();
System.out.println("Valid actions are \"run\", \"list\", \"info\", \"savepoint\", \"stop\", or \"cancel\".");
System.out.println();
System.out.println("Specify the version option (-v or --version) to print Flink version.");
System.out.println();
System.out.println("Specify the help option (-h or --help) to get help on the command.");
return 1;
}
} catch (CliArgsException ce) {
return handleArgException(ce);
} catch (ProgramParametrizationException ppe) {
return handleParametrizationException(ppe);
} catch (ProgramMissingJobException pmje) {
return handleMissingJobException();
} catch (Exception e) {
return handleError(e);
}
} | java | public int parseParameters(String[] args) {
// check for action
if (args.length < 1) {
CliFrontendParser.printHelp(customCommandLines);
System.out.println("Please specify an action.");
return 1;
}
// get action
String action = args[0];
// remove action from parameters
final String[] params = Arrays.copyOfRange(args, 1, args.length);
try {
// do action
switch (action) {
case ACTION_RUN:
run(params);
return 0;
case ACTION_LIST:
list(params);
return 0;
case ACTION_INFO:
info(params);
return 0;
case ACTION_CANCEL:
cancel(params);
return 0;
case ACTION_STOP:
stop(params);
return 0;
case ACTION_SAVEPOINT:
savepoint(params);
return 0;
case "-h":
case "--help":
CliFrontendParser.printHelp(customCommandLines);
return 0;
case "-v":
case "--version":
String version = EnvironmentInformation.getVersion();
String commitID = EnvironmentInformation.getRevisionInformation().commitId;
System.out.print("Version: " + version);
System.out.println(commitID.equals(EnvironmentInformation.UNKNOWN) ? "" : ", Commit ID: " + commitID);
return 0;
default:
System.out.printf("\"%s\" is not a valid action.\n", action);
System.out.println();
System.out.println("Valid actions are \"run\", \"list\", \"info\", \"savepoint\", \"stop\", or \"cancel\".");
System.out.println();
System.out.println("Specify the version option (-v or --version) to print Flink version.");
System.out.println();
System.out.println("Specify the help option (-h or --help) to get help on the command.");
return 1;
}
} catch (CliArgsException ce) {
return handleArgException(ce);
} catch (ProgramParametrizationException ppe) {
return handleParametrizationException(ppe);
} catch (ProgramMissingJobException pmje) {
return handleMissingJobException();
} catch (Exception e) {
return handleError(e);
}
} | [
"public",
"int",
"parseParameters",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"// check for action",
"if",
"(",
"args",
".",
"length",
"<",
"1",
")",
"{",
"CliFrontendParser",
".",
"printHelp",
"(",
"customCommandLines",
")",
";",
"System",
".",
"out",
".... | Parses the command line arguments and starts the requested action.
@param args command line arguments of the client.
@return The return code of the program | [
"Parses",
"the",
"command",
"line",
"arguments",
"and",
"starts",
"the",
"requested",
"action",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java#L964-L1030 | train | Parses command - line parameters. | [
30522,
2270,
20014,
11968,
3366,
28689,
22828,
2015,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
1013,
1013,
4638,
2005,
2895,
2065,
1006,
12098,
5620,
1012,
3091,
1026,
1015,
1007,
1063,
18856,
10128,
4948,
6528,
18927,
11650,
2121,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java | AbstractFetcher.createPartitionStateHolders | private List<KafkaTopicPartitionState<KPH>> createPartitionStateHolders(
Map<KafkaTopicPartition, Long> partitionsToInitialOffsets,
int timestampWatermarkMode,
SerializedValue<AssignerWithPeriodicWatermarks<T>> watermarksPeriodic,
SerializedValue<AssignerWithPunctuatedWatermarks<T>> watermarksPunctuated,
ClassLoader userCodeClassLoader) throws IOException, ClassNotFoundException {
// CopyOnWrite as adding discovered partitions could happen in parallel
// while different threads iterate the partitions list
List<KafkaTopicPartitionState<KPH>> partitionStates = new CopyOnWriteArrayList<>();
switch (timestampWatermarkMode) {
case NO_TIMESTAMPS_WATERMARKS: {
for (Map.Entry<KafkaTopicPartition, Long> partitionEntry : partitionsToInitialOffsets.entrySet()) {
// create the kafka version specific partition handle
KPH kafkaHandle = createKafkaPartitionHandle(partitionEntry.getKey());
KafkaTopicPartitionState<KPH> partitionState =
new KafkaTopicPartitionState<>(partitionEntry.getKey(), kafkaHandle);
partitionState.setOffset(partitionEntry.getValue());
partitionStates.add(partitionState);
}
return partitionStates;
}
case PERIODIC_WATERMARKS: {
for (Map.Entry<KafkaTopicPartition, Long> partitionEntry : partitionsToInitialOffsets.entrySet()) {
KPH kafkaHandle = createKafkaPartitionHandle(partitionEntry.getKey());
AssignerWithPeriodicWatermarks<T> assignerInstance =
watermarksPeriodic.deserializeValue(userCodeClassLoader);
KafkaTopicPartitionStateWithPeriodicWatermarks<T, KPH> partitionState =
new KafkaTopicPartitionStateWithPeriodicWatermarks<>(
partitionEntry.getKey(),
kafkaHandle,
assignerInstance);
partitionState.setOffset(partitionEntry.getValue());
partitionStates.add(partitionState);
}
return partitionStates;
}
case PUNCTUATED_WATERMARKS: {
for (Map.Entry<KafkaTopicPartition, Long> partitionEntry : partitionsToInitialOffsets.entrySet()) {
KPH kafkaHandle = createKafkaPartitionHandle(partitionEntry.getKey());
AssignerWithPunctuatedWatermarks<T> assignerInstance =
watermarksPunctuated.deserializeValue(userCodeClassLoader);
KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH> partitionState =
new KafkaTopicPartitionStateWithPunctuatedWatermarks<>(
partitionEntry.getKey(),
kafkaHandle,
assignerInstance);
partitionState.setOffset(partitionEntry.getValue());
partitionStates.add(partitionState);
}
return partitionStates;
}
default:
// cannot happen, add this as a guard for the future
throw new RuntimeException();
}
} | java | private List<KafkaTopicPartitionState<KPH>> createPartitionStateHolders(
Map<KafkaTopicPartition, Long> partitionsToInitialOffsets,
int timestampWatermarkMode,
SerializedValue<AssignerWithPeriodicWatermarks<T>> watermarksPeriodic,
SerializedValue<AssignerWithPunctuatedWatermarks<T>> watermarksPunctuated,
ClassLoader userCodeClassLoader) throws IOException, ClassNotFoundException {
// CopyOnWrite as adding discovered partitions could happen in parallel
// while different threads iterate the partitions list
List<KafkaTopicPartitionState<KPH>> partitionStates = new CopyOnWriteArrayList<>();
switch (timestampWatermarkMode) {
case NO_TIMESTAMPS_WATERMARKS: {
for (Map.Entry<KafkaTopicPartition, Long> partitionEntry : partitionsToInitialOffsets.entrySet()) {
// create the kafka version specific partition handle
KPH kafkaHandle = createKafkaPartitionHandle(partitionEntry.getKey());
KafkaTopicPartitionState<KPH> partitionState =
new KafkaTopicPartitionState<>(partitionEntry.getKey(), kafkaHandle);
partitionState.setOffset(partitionEntry.getValue());
partitionStates.add(partitionState);
}
return partitionStates;
}
case PERIODIC_WATERMARKS: {
for (Map.Entry<KafkaTopicPartition, Long> partitionEntry : partitionsToInitialOffsets.entrySet()) {
KPH kafkaHandle = createKafkaPartitionHandle(partitionEntry.getKey());
AssignerWithPeriodicWatermarks<T> assignerInstance =
watermarksPeriodic.deserializeValue(userCodeClassLoader);
KafkaTopicPartitionStateWithPeriodicWatermarks<T, KPH> partitionState =
new KafkaTopicPartitionStateWithPeriodicWatermarks<>(
partitionEntry.getKey(),
kafkaHandle,
assignerInstance);
partitionState.setOffset(partitionEntry.getValue());
partitionStates.add(partitionState);
}
return partitionStates;
}
case PUNCTUATED_WATERMARKS: {
for (Map.Entry<KafkaTopicPartition, Long> partitionEntry : partitionsToInitialOffsets.entrySet()) {
KPH kafkaHandle = createKafkaPartitionHandle(partitionEntry.getKey());
AssignerWithPunctuatedWatermarks<T> assignerInstance =
watermarksPunctuated.deserializeValue(userCodeClassLoader);
KafkaTopicPartitionStateWithPunctuatedWatermarks<T, KPH> partitionState =
new KafkaTopicPartitionStateWithPunctuatedWatermarks<>(
partitionEntry.getKey(),
kafkaHandle,
assignerInstance);
partitionState.setOffset(partitionEntry.getValue());
partitionStates.add(partitionState);
}
return partitionStates;
}
default:
// cannot happen, add this as a guard for the future
throw new RuntimeException();
}
} | [
"private",
"List",
"<",
"KafkaTopicPartitionState",
"<",
"KPH",
">",
">",
"createPartitionStateHolders",
"(",
"Map",
"<",
"KafkaTopicPartition",
",",
"Long",
">",
"partitionsToInitialOffsets",
",",
"int",
"timestampWatermarkMode",
",",
"SerializedValue",
"<",
"AssignerW... | Utility method that takes the topic partitions and creates the topic partition state
holders, depending on the timestamp / watermark mode. | [
"Utility",
"method",
"that",
"takes",
"the",
"topic",
"partitions",
"and",
"creates",
"the",
"topic",
"partition",
"state",
"holders",
"depending",
"on",
"the",
"timestamp",
"/",
"watermark",
"mode",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractFetcher.java#L505-L577 | train | Creates the partition state holders for the partitions to be used in the Kafka topic. | [
30522,
2797,
2862,
1026,
10556,
24316,
10610,
24330,
19362,
3775,
9285,
12259,
1026,
1047,
8458,
1028,
1028,
3443,
19362,
3775,
9285,
12259,
17794,
1006,
4949,
1026,
10556,
24316,
10610,
24330,
19362,
3775,
3508,
1010,
2146,
1028,
13571,
1603... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getTimeDurationHelper | public long getTimeDurationHelper(String name, String vStr, TimeUnit unit) {
vStr = vStr.trim();
vStr = StringUtils.toLowerCase(vStr);
ParsedTimeDuration vUnit = ParsedTimeDuration.unitFor(vStr);
if (null == vUnit) {
logDeprecation("No unit for " + name + "(" + vStr + ") assuming " + unit);
vUnit = ParsedTimeDuration.unitFor(unit);
} else {
vStr = vStr.substring(0, vStr.lastIndexOf(vUnit.suffix()));
}
long raw = Long.parseLong(vStr);
long converted = unit.convert(raw, vUnit.unit());
if (vUnit.unit().convert(converted, unit) < raw) {
logDeprecation("Possible loss of precision converting " + vStr
+ vUnit.suffix() + " to " + unit + " for " + name);
}
return converted;
} | java | public long getTimeDurationHelper(String name, String vStr, TimeUnit unit) {
vStr = vStr.trim();
vStr = StringUtils.toLowerCase(vStr);
ParsedTimeDuration vUnit = ParsedTimeDuration.unitFor(vStr);
if (null == vUnit) {
logDeprecation("No unit for " + name + "(" + vStr + ") assuming " + unit);
vUnit = ParsedTimeDuration.unitFor(unit);
} else {
vStr = vStr.substring(0, vStr.lastIndexOf(vUnit.suffix()));
}
long raw = Long.parseLong(vStr);
long converted = unit.convert(raw, vUnit.unit());
if (vUnit.unit().convert(converted, unit) < raw) {
logDeprecation("Possible loss of precision converting " + vStr
+ vUnit.suffix() + " to " + unit + " for " + name);
}
return converted;
} | [
"public",
"long",
"getTimeDurationHelper",
"(",
"String",
"name",
",",
"String",
"vStr",
",",
"TimeUnit",
"unit",
")",
"{",
"vStr",
"=",
"vStr",
".",
"trim",
"(",
")",
";",
"vStr",
"=",
"StringUtils",
".",
"toLowerCase",
"(",
"vStr",
")",
";",
"ParsedTim... | Return time duration in the given time unit. Valid units are encoded in
properties as suffixes: nanoseconds (ns), microseconds (us), milliseconds
(ms), seconds (s), minutes (m), hours (h), and days (d).
@param name Property name
@param vStr The string value with time unit suffix to be converted.
@param unit Unit to convert the stored property, if it exists. | [
"Return",
"time",
"duration",
"in",
"the",
"given",
"time",
"unit",
".",
"Valid",
"units",
"are",
"encoded",
"in",
"properties",
"as",
"suffixes",
":",
"nanoseconds",
"(",
"ns",
")",
"microseconds",
"(",
"us",
")",
"milliseconds",
"(",
"ms",
")",
"seconds"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1688-L1706 | train | Helper method to convert a string to a long. | [
30522,
2270,
2146,
2131,
7292,
24979,
3370,
16001,
4842,
1006,
5164,
2171,
1010,
5164,
5443,
16344,
1010,
2051,
19496,
2102,
3131,
1007,
1063,
5443,
16344,
1027,
5443,
16344,
1012,
12241,
1006,
1007,
1025,
5443,
16344,
1027,
5164,
21823,
48... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java | Ftp.reconnectIfTimeout | @Override
public Ftp reconnectIfTimeout() {
String pwd = null;
try {
pwd = pwd();
} catch (FtpException fex) {
//ignore
}
if (pwd == null) {
return this.init();
}
return this;
} | java | @Override
public Ftp reconnectIfTimeout() {
String pwd = null;
try {
pwd = pwd();
} catch (FtpException fex) {
//ignore
}
if (pwd == null) {
return this.init();
}
return this;
} | [
"@",
"Override",
"public",
"Ftp",
"reconnectIfTimeout",
"(",
")",
"{",
"String",
"pwd",
"=",
"null",
";",
"try",
"{",
"pwd",
"=",
"pwd",
"(",
")",
";",
"}",
"catch",
"(",
"FtpException",
"fex",
")",
"{",
"//ignore\r",
"}",
"if",
"(",
"pwd",
"==",
"... | 如果连接超时的话,重新进行连接
经测试,当连接超时时,client.isConnected()仍然返回ture,无法判断是否连接超时
因此,通过发送pwd命令的方式,检查连接是否超时
@return this | [
"如果连接超时的话,重新进行连接",
"经测试,当连接超时时,client",
".",
"isConnected",
"()",
"仍然返回ture,无法判断是否连接超时",
"因此,通过发送pwd命令的方式,检查连接是否超时"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java#L186-L199 | train | Reconnects the connection if the timeout expires. | [
30522,
1030,
2058,
15637,
2270,
3027,
2361,
28667,
18256,
6593,
10128,
7292,
5833,
1006,
1007,
1063,
5164,
1052,
21724,
1027,
19701,
1025,
3046,
1063,
1052,
21724,
1027,
1052,
21724,
1006,
1007,
1025,
1065,
4608,
1006,
3027,
5051,
2595,
244... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SnappyFrameDecoder.java | SnappyFrameDecoder.mapChunkType | private static ChunkType mapChunkType(byte type) {
if (type == 0) {
return ChunkType.COMPRESSED_DATA;
} else if (type == 1) {
return ChunkType.UNCOMPRESSED_DATA;
} else if (type == (byte) 0xff) {
return ChunkType.STREAM_IDENTIFIER;
} else if ((type & 0x80) == 0x80) {
return ChunkType.RESERVED_SKIPPABLE;
} else {
return ChunkType.RESERVED_UNSKIPPABLE;
}
} | java | private static ChunkType mapChunkType(byte type) {
if (type == 0) {
return ChunkType.COMPRESSED_DATA;
} else if (type == 1) {
return ChunkType.UNCOMPRESSED_DATA;
} else if (type == (byte) 0xff) {
return ChunkType.STREAM_IDENTIFIER;
} else if ((type & 0x80) == 0x80) {
return ChunkType.RESERVED_SKIPPABLE;
} else {
return ChunkType.RESERVED_UNSKIPPABLE;
}
} | [
"private",
"static",
"ChunkType",
"mapChunkType",
"(",
"byte",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"0",
")",
"{",
"return",
"ChunkType",
".",
"COMPRESSED_DATA",
";",
"}",
"else",
"if",
"(",
"type",
"==",
"1",
")",
"{",
"return",
"ChunkType",
"."... | Decodes the chunk type from the type tag byte.
@param type The tag byte extracted from the stream
@return The appropriate {@link ChunkType}, defaulting to {@link ChunkType#RESERVED_UNSKIPPABLE} | [
"Decodes",
"the",
"chunk",
"type",
"from",
"the",
"type",
"tag",
"byte",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L214-L226 | train | Map the chunk type. | [
30522,
2797,
10763,
20000,
13874,
4949,
20760,
8950,
13874,
1006,
24880,
2828,
1007,
1063,
2065,
1006,
2828,
1027,
1027,
1014,
1007,
1063,
2709,
20000,
13874,
1012,
16620,
1035,
2951,
1025,
1065,
2842,
2065,
1006,
2828,
1027,
1027,
1015,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java | ParameterTool.fromPropertiesFile | public static ParameterTool fromPropertiesFile(String path) throws IOException {
File propertiesFile = new File(path);
return fromPropertiesFile(propertiesFile);
} | java | public static ParameterTool fromPropertiesFile(String path) throws IOException {
File propertiesFile = new File(path);
return fromPropertiesFile(propertiesFile);
} | [
"public",
"static",
"ParameterTool",
"fromPropertiesFile",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"File",
"propertiesFile",
"=",
"new",
"File",
"(",
"path",
")",
";",
"return",
"fromPropertiesFile",
"(",
"propertiesFile",
")",
";",
"}"
] | Returns {@link ParameterTool} for the given {@link Properties} file.
@param path Path to the properties file
@return A {@link ParameterTool}
@throws IOException If the file does not exist
@see Properties | [
"Returns",
"{",
"@link",
"ParameterTool",
"}",
"for",
"the",
"given",
"{",
"@link",
"Properties",
"}",
"file",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L120-L123 | train | Creates a ParameterTool from a properties file. | [
30522,
2270,
10763,
16381,
3406,
4747,
2013,
21572,
4842,
7368,
8873,
2571,
1006,
5164,
4130,
1007,
11618,
22834,
10288,
24422,
1063,
5371,
5144,
8873,
2571,
1027,
2047,
5371,
1006,
4130,
1007,
1025,
2709,
2013,
21572,
4842,
7368,
8873,
257... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-proxy/sharding-proxy-common/src/main/java/org/apache/shardingsphere/shardingproxy/context/ShardingProxyContext.java | ShardingProxyContext.init | public void init(final Authentication authentication, final Properties props) {
this.authentication = authentication;
shardingProperties = new ShardingProperties(props);
} | java | public void init(final Authentication authentication, final Properties props) {
this.authentication = authentication;
shardingProperties = new ShardingProperties(props);
} | [
"public",
"void",
"init",
"(",
"final",
"Authentication",
"authentication",
",",
"final",
"Properties",
"props",
")",
"{",
"this",
".",
"authentication",
"=",
"authentication",
";",
"shardingProperties",
"=",
"new",
"ShardingProperties",
"(",
"props",
")",
";",
... | Initialize proxy context.
@param authentication authentication
@param props properties | [
"Initialize",
"proxy",
"context",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-common/src/main/java/org/apache/shardingsphere/shardingproxy/context/ShardingProxyContext.java#L68-L71 | train | Initialize sharding. | [
30522,
2270,
11675,
1999,
4183,
1006,
2345,
27280,
27280,
1010,
2345,
5144,
24387,
1007,
1063,
2023,
1012,
27280,
1027,
27280,
1025,
21146,
17080,
3070,
21572,
4842,
7368,
1027,
2047,
21146,
17080,
3070,
21572,
4842,
7368,
1006,
24387,
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 | resolver-dns/src/main/java/io/netty/resolver/dns/Cache.java | Cache.clear | final void clear() {
while (!resolveCache.isEmpty()) {
for (Iterator<Entry<String, Entries>> i = resolveCache.entrySet().iterator(); i.hasNext();) {
Map.Entry<String, Entries> e = i.next();
i.remove();
e.getValue().clearAndCancel();
}
}
} | java | final void clear() {
while (!resolveCache.isEmpty()) {
for (Iterator<Entry<String, Entries>> i = resolveCache.entrySet().iterator(); i.hasNext();) {
Map.Entry<String, Entries> e = i.next();
i.remove();
e.getValue().clearAndCancel();
}
}
} | [
"final",
"void",
"clear",
"(",
")",
"{",
"while",
"(",
"!",
"resolveCache",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"Iterator",
"<",
"Entry",
"<",
"String",
",",
"Entries",
">",
">",
"i",
"=",
"resolveCache",
".",
"entrySet",
"(",
")",
".",... | Remove everything from the cache. | [
"Remove",
"everything",
"from",
"the",
"cache",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/Cache.java#L94-L103 | train | Clear the cache. | [
30522,
2345,
11675,
3154,
1006,
1007,
1063,
2096,
1006,
999,
10663,
3540,
5403,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1007,
1063,
2005,
1006,
2009,
6906,
4263,
1026,
4443,
1026,
5164,
1010,
10445,
1028,
1028,
1045,
1027,
10663,
3540,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/internal/NewSessionRequestQueue.java | NewSessionRequestQueue.removeNewSessionRequest | public boolean removeNewSessionRequest(RequestHandler request) {
lock.writeLock().lock();
try {
return newSessionRequests.remove(request);
} finally {
lock.writeLock().unlock();
}
} | java | public boolean removeNewSessionRequest(RequestHandler request) {
lock.writeLock().lock();
try {
return newSessionRequests.remove(request);
} finally {
lock.writeLock().unlock();
}
} | [
"public",
"boolean",
"removeNewSessionRequest",
"(",
"RequestHandler",
"request",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"newSessionRequests",
".",
"remove",
"(",
"request",
")",
";",
"}",
"finally",
... | Remove a specific request
@param request The request to remove
@return A boolean result from doing a newSessionRequest.remove(request). | [
"Remove",
"a",
"specific",
"request"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/NewSessionRequestQueue.java#L114-L121 | train | Removes a new session request from the list of session requests. | [
30522,
2270,
22017,
20898,
6366,
2638,
9333,
7971,
3258,
2890,
15500,
1006,
5227,
11774,
3917,
5227,
1007,
1063,
5843,
1012,
4339,
7878,
1006,
1007,
1012,
5843,
1006,
1007,
1025,
3046,
1063,
2709,
2739,
7971,
3258,
2890,
15500,
2015,
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/seg/WordBasedSegment.java | WordBasedSegment.generateWordNet | protected void generateWordNet(final WordNet wordNetStorage)
{
final char[] charArray = wordNetStorage.charArray;
// 核心词典查询
DoubleArrayTrie<CoreDictionary.Attribute>.Searcher searcher = CoreDictionary.trie.getSearcher(charArray, 0);
while (searcher.next())
{
wordNetStorage.add(searcher.begin + 1, new Vertex(new String(charArray, searcher.begin, searcher.length), searcher.value, searcher.index));
}
// 强制用户词典查询
if (config.forceCustomDictionary)
{
CustomDictionary.parseText(charArray, new AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute>()
{
@Override
public void hit(int begin, int end, CoreDictionary.Attribute value)
{
wordNetStorage.add(begin + 1, new Vertex(new String(charArray, begin, end - begin), value));
}
});
}
// 原子分词,保证图连通
LinkedList<Vertex>[] vertexes = wordNetStorage.getVertexes();
for (int i = 1; i < vertexes.length; )
{
if (vertexes[i].isEmpty())
{
int j = i + 1;
for (; j < vertexes.length - 1; ++j)
{
if (!vertexes[j].isEmpty()) break;
}
wordNetStorage.add(i, quickAtomSegment(charArray, i - 1, j - 1));
i = j;
}
else i += vertexes[i].getLast().realWord.length();
}
} | java | protected void generateWordNet(final WordNet wordNetStorage)
{
final char[] charArray = wordNetStorage.charArray;
// 核心词典查询
DoubleArrayTrie<CoreDictionary.Attribute>.Searcher searcher = CoreDictionary.trie.getSearcher(charArray, 0);
while (searcher.next())
{
wordNetStorage.add(searcher.begin + 1, new Vertex(new String(charArray, searcher.begin, searcher.length), searcher.value, searcher.index));
}
// 强制用户词典查询
if (config.forceCustomDictionary)
{
CustomDictionary.parseText(charArray, new AhoCorasickDoubleArrayTrie.IHit<CoreDictionary.Attribute>()
{
@Override
public void hit(int begin, int end, CoreDictionary.Attribute value)
{
wordNetStorage.add(begin + 1, new Vertex(new String(charArray, begin, end - begin), value));
}
});
}
// 原子分词,保证图连通
LinkedList<Vertex>[] vertexes = wordNetStorage.getVertexes();
for (int i = 1; i < vertexes.length; )
{
if (vertexes[i].isEmpty())
{
int j = i + 1;
for (; j < vertexes.length - 1; ++j)
{
if (!vertexes[j].isEmpty()) break;
}
wordNetStorage.add(i, quickAtomSegment(charArray, i - 1, j - 1));
i = j;
}
else i += vertexes[i].getLast().realWord.length();
}
} | [
"protected",
"void",
"generateWordNet",
"(",
"final",
"WordNet",
"wordNetStorage",
")",
"{",
"final",
"char",
"[",
"]",
"charArray",
"=",
"wordNetStorage",
".",
"charArray",
";",
"// 核心词典查询",
"DoubleArrayTrie",
"<",
"CoreDictionary",
".",
"Attribute",
">",
".",
... | 生成一元词网
@param wordNetStorage | [
"生成一元词网"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/WordBasedSegment.java#L386-L424 | train | Generate word net. | [
30522,
5123,
11675,
9699,
18351,
7159,
1006,
2345,
2773,
7159,
2773,
22781,
4263,
4270,
1007,
1063,
2345,
25869,
1031,
1033,
25869,
2906,
9447,
1027,
2773,
22781,
4263,
4270,
1012,
25869,
2906,
9447,
1025,
1013,
1013,
100,
1849,
100,
100,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java | RequiredParameters.hasNoDefaultValueAndNoValuePassedOnAlternativeName | private boolean hasNoDefaultValueAndNoValuePassedOnAlternativeName(Option o, Map<String, String> data)
throws RequiredParametersException {
if (o.hasAlt() && data.containsKey(o.getAlt())) {
data.put(o.getName(), data.get(o.getAlt()));
} else {
if (o.hasDefaultValue()) {
data.put(o.getName(), o.getDefaultValue());
if (o.hasAlt()) {
data.put(o.getAlt(), o.getDefaultValue());
}
} else {
return true;
}
}
return false;
} | java | private boolean hasNoDefaultValueAndNoValuePassedOnAlternativeName(Option o, Map<String, String> data)
throws RequiredParametersException {
if (o.hasAlt() && data.containsKey(o.getAlt())) {
data.put(o.getName(), data.get(o.getAlt()));
} else {
if (o.hasDefaultValue()) {
data.put(o.getName(), o.getDefaultValue());
if (o.hasAlt()) {
data.put(o.getAlt(), o.getDefaultValue());
}
} else {
return true;
}
}
return false;
} | [
"private",
"boolean",
"hasNoDefaultValueAndNoValuePassedOnAlternativeName",
"(",
"Option",
"o",
",",
"Map",
"<",
"String",
",",
"String",
">",
"data",
")",
"throws",
"RequiredParametersException",
"{",
"if",
"(",
"o",
".",
"hasAlt",
"(",
")",
"&&",
"data",
".",
... | else return true to indicate parameter is 'really' missing | [
"else",
"return",
"true",
"to",
"indicate",
"parameter",
"is",
"really",
"missing"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java#L147-L162 | train | Checks if no default value and no value passed on alternative name. | [
30522,
2797,
22017,
20898,
8440,
10244,
7011,
11314,
10175,
5657,
5685,
13455,
7630,
13699,
27241,
5280,
2389,
16451,
8082,
18442,
1006,
5724,
1051,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
2951,
1007,
11618,
3223,
28689,
22828,
3366,
2595,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.extract | public static List<Object> extract(Iterable<?> collection, Editor<Object> editor, boolean ignoreNull) {
final List<Object> fieldValueList = new ArrayList<>();
Object value;
for (Object bean : collection) {
value = editor.edit(bean);
if (null == value && ignoreNull) {
continue;
}
fieldValueList.add(value);
}
return fieldValueList;
} | java | public static List<Object> extract(Iterable<?> collection, Editor<Object> editor, boolean ignoreNull) {
final List<Object> fieldValueList = new ArrayList<>();
Object value;
for (Object bean : collection) {
value = editor.edit(bean);
if (null == value && ignoreNull) {
continue;
}
fieldValueList.add(value);
}
return fieldValueList;
} | [
"public",
"static",
"List",
"<",
"Object",
">",
"extract",
"(",
"Iterable",
"<",
"?",
">",
"collection",
",",
"Editor",
"<",
"Object",
">",
"editor",
",",
"boolean",
"ignoreNull",
")",
"{",
"final",
"List",
"<",
"Object",
">",
"fieldValueList",
"=",
"new... | 通过Editor抽取集合元素中的某些值返回为新列表<br>
例如提供的是一个Bean列表,通过Editor接口实现获取某个字段值,返回这个字段值组成的新列表
@param collection 原集合
@param editor 编辑器
@param ignoreNull 是否忽略空值
@return 抽取后的新列表
@since 4.5.7 | [
"通过Editor抽取集合元素中的某些值返回为新列表<br",
">",
"例如提供的是一个Bean列表,通过Editor接口实现获取某个字段值,返回这个字段值组成的新列表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1137-L1148 | train | Extract a list of objects from a collection using the specified editor. | [
30522,
2270,
10763,
2862,
1026,
4874,
1028,
14817,
1006,
2009,
6906,
3468,
1026,
1029,
1028,
3074,
1010,
3559,
1026,
4874,
1028,
3559,
1010,
22017,
20898,
8568,
11231,
3363,
1007,
1063,
2345,
2862,
1026,
4874,
1028,
2492,
10175,
16284,
2923... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DataSink.java | DataSink.setParallelism | public DataSink<T> setParallelism(int parallelism) {
Preconditions.checkArgument(parallelism > 0 || parallelism == ExecutionConfig.PARALLELISM_DEFAULT,
"The parallelism of an operator must be at least 1.");
this.parallelism = parallelism;
return this;
} | java | public DataSink<T> setParallelism(int parallelism) {
Preconditions.checkArgument(parallelism > 0 || parallelism == ExecutionConfig.PARALLELISM_DEFAULT,
"The parallelism of an operator must be at least 1.");
this.parallelism = parallelism;
return this;
} | [
"public",
"DataSink",
"<",
"T",
">",
"setParallelism",
"(",
"int",
"parallelism",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"parallelism",
">",
"0",
"||",
"parallelism",
"==",
"ExecutionConfig",
".",
"PARALLELISM_DEFAULT",
",",
"\"The parallelism of an o... | Sets the parallelism for this data sink.
The degree must be 1 or more.
@param parallelism The parallelism for this data sink. A value equal to {@link ExecutionConfig#PARALLELISM_DEFAULT}
will use the system default.
@return This data sink with set parallelism. | [
"Sets",
"the",
"parallelism",
"for",
"this",
"data",
"sink",
".",
"The",
"degree",
"must",
"be",
"1",
"or",
"more",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/DataSink.java#L288-L295 | train | Sets the parallelism of the data sink. | [
30522,
2270,
2951,
11493,
2243,
1026,
1056,
1028,
2275,
28689,
6216,
28235,
1006,
20014,
5903,
2964,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
5903,
2964,
1028,
1014,
1064,
1064,
5903,
2964,
1027,
1027,
7781,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/com/networknt/client/oauth/TokenManager.java | TokenManager.getJwt | public Result<Jwt> getJwt(ClientRequest clientRequest) {
HeaderValues scope = clientRequest.getRequestHeaders().get(OauthHelper.SCOPE);
if(scope != null) {
String scopeStr = scope.getFirst();
Set<String> scopeSet = new HashSet<>();
scopeSet.addAll(Arrays.asList(scopeStr.split(" ")));
return getJwt(new Jwt.Key(scopeSet));
}
HeaderValues serviceId = clientRequest.getRequestHeaders().get(OauthHelper.SERVICE_ID);
if(serviceId != null) {
return getJwt(new Jwt.Key(serviceId.getFirst()));
}
return getJwt(new Jwt.Key());
} | java | public Result<Jwt> getJwt(ClientRequest clientRequest) {
HeaderValues scope = clientRequest.getRequestHeaders().get(OauthHelper.SCOPE);
if(scope != null) {
String scopeStr = scope.getFirst();
Set<String> scopeSet = new HashSet<>();
scopeSet.addAll(Arrays.asList(scopeStr.split(" ")));
return getJwt(new Jwt.Key(scopeSet));
}
HeaderValues serviceId = clientRequest.getRequestHeaders().get(OauthHelper.SERVICE_ID);
if(serviceId != null) {
return getJwt(new Jwt.Key(serviceId.getFirst()));
}
return getJwt(new Jwt.Key());
} | [
"public",
"Result",
"<",
"Jwt",
">",
"getJwt",
"(",
"ClientRequest",
"clientRequest",
")",
"{",
"HeaderValues",
"scope",
"=",
"clientRequest",
".",
"getRequestHeaders",
"(",
")",
".",
"get",
"(",
"OauthHelper",
".",
"SCOPE",
")",
";",
"if",
"(",
"scope",
"... | get a Jwt with a provided clientRequest,
it will get token based on Jwt.Key (either scope or service_id)
if the user declared both scope and service_id in header, it will get jwt based on scope
@param clientRequest
@return | [
"get",
"a",
"Jwt",
"with",
"a",
"provided",
"clientRequest",
"it",
"will",
"get",
"token",
"based",
"on",
"Jwt",
".",
"Key",
"(",
"either",
"scope",
"or",
"service_id",
")",
"if",
"the",
"user",
"declared",
"both",
"scope",
"and",
"service_id",
"in",
"he... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/TokenManager.java#L104-L117 | train | Get a Jwt from the clientRequest | [
30522,
2270,
2765,
1026,
1046,
26677,
1028,
2131,
3501,
26677,
1006,
7396,
2890,
15500,
7396,
2890,
15500,
1007,
1063,
20346,
10175,
15808,
9531,
1027,
7396,
2890,
15500,
1012,
2131,
2890,
15500,
4974,
2545,
1006,
1007,
1012,
2131,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java | ExternalShuffleBlockResolver.getSortBasedShuffleBlockData | private ManagedBuffer getSortBasedShuffleBlockData(
ExecutorShuffleInfo executor, int shuffleId, int mapId, int reduceId) {
File indexFile = getFile(executor.localDirs, executor.subDirsPerLocalDir,
"shuffle_" + shuffleId + "_" + mapId + "_0.index");
try {
ShuffleIndexInformation shuffleIndexInformation = shuffleIndexCache.get(indexFile);
ShuffleIndexRecord shuffleIndexRecord = shuffleIndexInformation.getIndex(reduceId);
return new FileSegmentManagedBuffer(
conf,
getFile(executor.localDirs, executor.subDirsPerLocalDir,
"shuffle_" + shuffleId + "_" + mapId + "_0.data"),
shuffleIndexRecord.getOffset(),
shuffleIndexRecord.getLength());
} catch (ExecutionException e) {
throw new RuntimeException("Failed to open file: " + indexFile, e);
}
} | java | private ManagedBuffer getSortBasedShuffleBlockData(
ExecutorShuffleInfo executor, int shuffleId, int mapId, int reduceId) {
File indexFile = getFile(executor.localDirs, executor.subDirsPerLocalDir,
"shuffle_" + shuffleId + "_" + mapId + "_0.index");
try {
ShuffleIndexInformation shuffleIndexInformation = shuffleIndexCache.get(indexFile);
ShuffleIndexRecord shuffleIndexRecord = shuffleIndexInformation.getIndex(reduceId);
return new FileSegmentManagedBuffer(
conf,
getFile(executor.localDirs, executor.subDirsPerLocalDir,
"shuffle_" + shuffleId + "_" + mapId + "_0.data"),
shuffleIndexRecord.getOffset(),
shuffleIndexRecord.getLength());
} catch (ExecutionException e) {
throw new RuntimeException("Failed to open file: " + indexFile, e);
}
} | [
"private",
"ManagedBuffer",
"getSortBasedShuffleBlockData",
"(",
"ExecutorShuffleInfo",
"executor",
",",
"int",
"shuffleId",
",",
"int",
"mapId",
",",
"int",
"reduceId",
")",
"{",
"File",
"indexFile",
"=",
"getFile",
"(",
"executor",
".",
"localDirs",
",",
"execut... | Sort-based shuffle data uses an index called "shuffle_ShuffleId_MapId_0.index" into a data file
called "shuffle_ShuffleId_MapId_0.data". This logic is from IndexShuffleBlockResolver,
and the block id format is from ShuffleDataBlockId and ShuffleIndexBlockId. | [
"Sort",
"-",
"based",
"shuffle",
"data",
"uses",
"an",
"index",
"called",
"shuffle_ShuffleId_MapId_0",
".",
"index",
"into",
"a",
"data",
"file",
"called",
"shuffle_ShuffleId_MapId_0",
".",
"data",
".",
"This",
"logic",
"is",
"from",
"IndexShuffleBlockResolver",
"... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java#L282-L299 | train | Get the data for a sorted shuffle block. | [
30522,
2797,
3266,
8569,
12494,
4152,
11589,
15058,
5104,
6979,
18142,
23467,
2850,
2696,
1006,
4654,
8586,
16161,
2869,
6979,
18142,
2378,
14876,
4654,
8586,
16161,
2099,
1010,
20014,
23046,
3593,
1010,
20014,
4949,
3593,
1010,
20014,
5547,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java | HpackEncoder.getHeaderField | HpackHeaderField getHeaderField(int index) {
HeaderEntry entry = head;
while (index-- >= 0) {
entry = entry.before;
}
return entry;
} | java | HpackHeaderField getHeaderField(int index) {
HeaderEntry entry = head;
while (index-- >= 0) {
entry = entry.before;
}
return entry;
} | [
"HpackHeaderField",
"getHeaderField",
"(",
"int",
"index",
")",
"{",
"HeaderEntry",
"entry",
"=",
"head",
";",
"while",
"(",
"index",
"--",
">=",
"0",
")",
"{",
"entry",
"=",
"entry",
".",
"before",
";",
"}",
"return",
"entry",
";",
"}"
] | Return the header field at the given index. Exposed for testing. | [
"Return",
"the",
"header",
"field",
"at",
"the",
"given",
"index",
".",
"Exposed",
"for",
"testing",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L338-L344 | train | Gets the header field at the given index. | [
30522,
6522,
8684,
4974,
2121,
3790,
2131,
4974,
2121,
3790,
1006,
20014,
5950,
1007,
1063,
20346,
4765,
2854,
4443,
1027,
2132,
1025,
2096,
1006,
5950,
1011,
1011,
1028,
1027,
1014,
1007,
1063,
4443,
1027,
4443,
1012,
2077,
1025,
1065,
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-http/src/main/java/cn/hutool/http/HtmlUtil.java | HtmlUtil.unescape | public static String unescape(String htmlStr) {
if (StrUtil.isBlank(htmlStr)) {
return htmlStr;
}
return htmlStr.replace(StrUtil.HTML_APOS, "'")//
.replace("'", "'")//
.replace("'", "'")//
.replace(StrUtil.HTML_LT, "<")//
.replace(StrUtil.HTML_GT, ">")//
.replace(StrUtil.HTML_QUOTE, "\"")//
.replace(StrUtil.HTML_AMP, "&")//
.replace(StrUtil.HTML_NBSP, " "//
);
} | java | public static String unescape(String htmlStr) {
if (StrUtil.isBlank(htmlStr)) {
return htmlStr;
}
return htmlStr.replace(StrUtil.HTML_APOS, "'")//
.replace("'", "'")//
.replace("'", "'")//
.replace(StrUtil.HTML_LT, "<")//
.replace(StrUtil.HTML_GT, ">")//
.replace(StrUtil.HTML_QUOTE, "\"")//
.replace(StrUtil.HTML_AMP, "&")//
.replace(StrUtil.HTML_NBSP, " "//
);
} | [
"public",
"static",
"String",
"unescape",
"(",
"String",
"htmlStr",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"htmlStr",
")",
")",
"{",
"return",
"htmlStr",
";",
"}",
"return",
"htmlStr",
".",
"replace",
"(",
"StrUtil",
".",
"HTML_APOS",
",",
... | 还原被转义的HTML特殊字符
@param htmlStr 包含转义符的HTML内容
@return 转换后的字符串 | [
"还原被转义的HTML特殊字符"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HtmlUtil.java#L62-L75 | train | Unescape the HTML entities in the given string. | [
30522,
2270,
10763,
5164,
16655,
15782,
5051,
1006,
5164,
16129,
3367,
2099,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
16129,
3367,
2099,
1007,
1007,
1063,
2709,
16129,
3367,
2099,
1025,
1065,
2709,
16129,
33... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/spring/cache/CacheConfig.java | CacheConfig.fromJSON | public static Map<String, ? extends CacheConfig> fromJSON(Reader reader) throws IOException {
return new CacheConfigSupport().fromJSON(reader);
} | java | public static Map<String, ? extends CacheConfig> fromJSON(Reader reader) throws IOException {
return new CacheConfigSupport().fromJSON(reader);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"?",
"extends",
"CacheConfig",
">",
"fromJSON",
"(",
"Reader",
"reader",
")",
"throws",
"IOException",
"{",
"return",
"new",
"CacheConfigSupport",
"(",
")",
".",
"fromJSON",
"(",
"reader",
")",
";",
"}"
] | Read config objects stored in JSON format from <code>Reader</code>
@param reader of config
@return config
@throws IOException error | [
"Read",
"config",
"objects",
"stored",
"in",
"JSON",
"format",
"from",
"<code",
">",
"Reader<",
"/",
"code",
">"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/spring/cache/CacheConfig.java#L157-L159 | train | Creates a map of cache configs from a JSON document. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
1029,
8908,
17053,
8663,
8873,
2290,
1028,
2013,
22578,
2239,
1006,
8068,
8068,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
2047,
17053,
8663,
8873,
5620,
6279,
6442,
1006,
1007,
1012,
2013,
225... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.