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/operators/hash/MutableHashTable.java | MutableHashTable.spillPartition | protected int spillPartition() throws IOException {
// find the largest partition
ArrayList<HashPartition<BT, PT>> partitions = this.partitionsBeingBuilt;
int largestNumBlocks = 0;
int largestPartNum = -1;
for (int i = 0; i < partitions.size(); i++) {
HashPartition<BT, PT> p = partitions.get(i);
if (p.isInMemory() && p.getNumOccupiedMemorySegments() > largestNumBlocks) {
largestNumBlocks = p.getNumOccupiedMemorySegments();
largestPartNum = i;
}
}
final HashPartition<BT, PT> p = partitions.get(largestPartNum);
if (useBloomFilters) {
buildBloomFilterForBucketsInPartition(largestPartNum, p);
}
// spill the partition
int numBuffersFreed = p.spillPartition(this.availableMemory, this.ioManager,
this.currentEnumerator.next(), this.writeBehindBuffers);
this.writeBehindBuffersAvailable += numBuffersFreed;
// grab as many buffers as are available directly
MemorySegment currBuff;
while (this.writeBehindBuffersAvailable > 0 && (currBuff = this.writeBehindBuffers.poll()) != null) {
this.availableMemory.add(currBuff);
this.writeBehindBuffersAvailable--;
}
return largestPartNum;
} | java | protected int spillPartition() throws IOException {
// find the largest partition
ArrayList<HashPartition<BT, PT>> partitions = this.partitionsBeingBuilt;
int largestNumBlocks = 0;
int largestPartNum = -1;
for (int i = 0; i < partitions.size(); i++) {
HashPartition<BT, PT> p = partitions.get(i);
if (p.isInMemory() && p.getNumOccupiedMemorySegments() > largestNumBlocks) {
largestNumBlocks = p.getNumOccupiedMemorySegments();
largestPartNum = i;
}
}
final HashPartition<BT, PT> p = partitions.get(largestPartNum);
if (useBloomFilters) {
buildBloomFilterForBucketsInPartition(largestPartNum, p);
}
// spill the partition
int numBuffersFreed = p.spillPartition(this.availableMemory, this.ioManager,
this.currentEnumerator.next(), this.writeBehindBuffers);
this.writeBehindBuffersAvailable += numBuffersFreed;
// grab as many buffers as are available directly
MemorySegment currBuff;
while (this.writeBehindBuffersAvailable > 0 && (currBuff = this.writeBehindBuffers.poll()) != null) {
this.availableMemory.add(currBuff);
this.writeBehindBuffersAvailable--;
}
return largestPartNum;
} | [
"protected",
"int",
"spillPartition",
"(",
")",
"throws",
"IOException",
"{",
"// find the largest partition",
"ArrayList",
"<",
"HashPartition",
"<",
"BT",
",",
"PT",
">",
">",
"partitions",
"=",
"this",
".",
"partitionsBeingBuilt",
";",
"int",
"largestNumBlocks",
... | Selects a partition and spills it. The number of the spilled partition is returned.
@return The number of the spilled partition. | [
"Selects",
"a",
"partition",
"and",
"spills",
"it",
".",
"The",
"number",
"of",
"the",
"spilled",
"partition",
"is",
"returned",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/MutableHashTable.java#L1211-L1241 | train | Spills the next partition in the available memory. | [
30522,
5123,
20014,
14437,
19362,
3775,
3508,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
2424,
1996,
2922,
13571,
9140,
9863,
1026,
23325,
19362,
3775,
3508,
1026,
18411,
1010,
13866,
1028,
1028,
13571,
2015,
1027,
2023,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java | DataSourceProperties.determinePassword | public String determinePassword() {
if (StringUtils.hasText(this.password)) {
return this.password;
}
if (EmbeddedDatabaseConnection.isEmbedded(determineDriverClassName())) {
return "";
}
return null;
} | java | public String determinePassword() {
if (StringUtils.hasText(this.password)) {
return this.password;
}
if (EmbeddedDatabaseConnection.isEmbedded(determineDriverClassName())) {
return "";
}
return null;
} | [
"public",
"String",
"determinePassword",
"(",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"this",
".",
"password",
")",
")",
"{",
"return",
"this",
".",
"password",
";",
"}",
"if",
"(",
"EmbeddedDatabaseConnection",
".",
"isEmbedded",
"(",
"de... | Determine the password to use based on this configuration and the environment.
@return the password to use
@since 1.4.0 | [
"Determine",
"the",
"password",
"to",
"use",
"based",
"on",
"this",
"configuration",
"and",
"the",
"environment",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java#L357-L365 | train | Determine the password to use for this connection. | [
30522,
2270,
5164,
5646,
15194,
18351,
1006,
1007,
1063,
2065,
1006,
5164,
21823,
4877,
1012,
24748,
18413,
1006,
2023,
1012,
20786,
1007,
1007,
1063,
2709,
2023,
1012,
20786,
1025,
1065,
2065,
1006,
11157,
2850,
2696,
15058,
8663,
2638,
75... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/memory/TaskMemoryManager.java | TaskMemoryManager.allocatePage | public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
assert(consumer != null);
assert(consumer.getMode() == tungstenMemoryMode);
if (size > MAXIMUM_PAGE_SIZE_BYTES) {
throw new TooLargePageException(size);
}
long acquired = acquireExecutionMemory(size, consumer);
if (acquired <= 0) {
return null;
}
final int pageNumber;
synchronized (this) {
pageNumber = allocatedPages.nextClearBit(0);
if (pageNumber >= PAGE_TABLE_SIZE) {
releaseExecutionMemory(acquired, consumer);
throw new IllegalStateException(
"Have already allocated a maximum of " + PAGE_TABLE_SIZE + " pages");
}
allocatedPages.set(pageNumber);
}
MemoryBlock page = null;
try {
page = memoryManager.tungstenMemoryAllocator().allocate(acquired);
} catch (OutOfMemoryError e) {
logger.warn("Failed to allocate a page ({} bytes), try again.", acquired);
// there is no enough memory actually, it means the actual free memory is smaller than
// MemoryManager thought, we should keep the acquired memory.
synchronized (this) {
acquiredButNotUsed += acquired;
allocatedPages.clear(pageNumber);
}
// this could trigger spilling to free some pages.
return allocatePage(size, consumer);
}
page.pageNumber = pageNumber;
pageTable[pageNumber] = page;
if (logger.isTraceEnabled()) {
logger.trace("Allocate page number {} ({} bytes)", pageNumber, acquired);
}
return page;
} | java | public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
assert(consumer != null);
assert(consumer.getMode() == tungstenMemoryMode);
if (size > MAXIMUM_PAGE_SIZE_BYTES) {
throw new TooLargePageException(size);
}
long acquired = acquireExecutionMemory(size, consumer);
if (acquired <= 0) {
return null;
}
final int pageNumber;
synchronized (this) {
pageNumber = allocatedPages.nextClearBit(0);
if (pageNumber >= PAGE_TABLE_SIZE) {
releaseExecutionMemory(acquired, consumer);
throw new IllegalStateException(
"Have already allocated a maximum of " + PAGE_TABLE_SIZE + " pages");
}
allocatedPages.set(pageNumber);
}
MemoryBlock page = null;
try {
page = memoryManager.tungstenMemoryAllocator().allocate(acquired);
} catch (OutOfMemoryError e) {
logger.warn("Failed to allocate a page ({} bytes), try again.", acquired);
// there is no enough memory actually, it means the actual free memory is smaller than
// MemoryManager thought, we should keep the acquired memory.
synchronized (this) {
acquiredButNotUsed += acquired;
allocatedPages.clear(pageNumber);
}
// this could trigger spilling to free some pages.
return allocatePage(size, consumer);
}
page.pageNumber = pageNumber;
pageTable[pageNumber] = page;
if (logger.isTraceEnabled()) {
logger.trace("Allocate page number {} ({} bytes)", pageNumber, acquired);
}
return page;
} | [
"public",
"MemoryBlock",
"allocatePage",
"(",
"long",
"size",
",",
"MemoryConsumer",
"consumer",
")",
"{",
"assert",
"(",
"consumer",
"!=",
"null",
")",
";",
"assert",
"(",
"consumer",
".",
"getMode",
"(",
")",
"==",
"tungstenMemoryMode",
")",
";",
"if",
"... | Allocate a block of memory that will be tracked in the MemoryManager's page table; this is
intended for allocating large blocks of Tungsten memory that will be shared between operators.
Returns `null` if there was not enough memory to allocate the page. May return a page that
contains fewer bytes than requested, so callers should verify the size of returned pages.
@throws TooLargePageException | [
"Allocate",
"a",
"block",
"of",
"memory",
"that",
"will",
"be",
"tracked",
"in",
"the",
"MemoryManager",
"s",
"page",
"table",
";",
"this",
"is",
"intended",
"for",
"allocating",
"large",
"blocks",
"of",
"Tungsten",
"memory",
"that",
"will",
"be",
"shared",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java#L282-L324 | train | Allocate a page of the given size. | [
30522,
2270,
3638,
23467,
2035,
24755,
2618,
13704,
1006,
2146,
2946,
1010,
3638,
8663,
23545,
2099,
7325,
1007,
1063,
20865,
1006,
7325,
999,
1027,
19701,
1007,
1025,
20865,
1006,
7325,
1012,
2131,
5302,
3207,
1006,
1007,
1027,
1027,
27079... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.validateFrom | protected void validateFrom(
SqlNode node,
RelDataType targetRowType,
SqlValidatorScope scope) {
Objects.requireNonNull(targetRowType);
switch (node.getKind()) {
case AS:
validateFrom(
((SqlCall) node).operand(0),
targetRowType,
scope);
break;
case VALUES:
validateValues((SqlCall) node, targetRowType, scope);
break;
case JOIN:
validateJoin((SqlJoin) node, scope);
break;
case OVER:
validateOver((SqlCall) node, scope);
break;
case UNNEST:
validateUnnest((SqlCall) node, scope, targetRowType);
break;
default:
validateQuery(node, scope, targetRowType);
break;
}
// Validate the namespace representation of the node, just in case the
// validation did not occur implicitly.
getNamespace(node, scope).validate(targetRowType);
} | java | protected void validateFrom(
SqlNode node,
RelDataType targetRowType,
SqlValidatorScope scope) {
Objects.requireNonNull(targetRowType);
switch (node.getKind()) {
case AS:
validateFrom(
((SqlCall) node).operand(0),
targetRowType,
scope);
break;
case VALUES:
validateValues((SqlCall) node, targetRowType, scope);
break;
case JOIN:
validateJoin((SqlJoin) node, scope);
break;
case OVER:
validateOver((SqlCall) node, scope);
break;
case UNNEST:
validateUnnest((SqlCall) node, scope, targetRowType);
break;
default:
validateQuery(node, scope, targetRowType);
break;
}
// Validate the namespace representation of the node, just in case the
// validation did not occur implicitly.
getNamespace(node, scope).validate(targetRowType);
} | [
"protected",
"void",
"validateFrom",
"(",
"SqlNode",
"node",
",",
"RelDataType",
"targetRowType",
",",
"SqlValidatorScope",
"scope",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"targetRowType",
")",
";",
"switch",
"(",
"node",
".",
"getKind",
"(",
")",
")... | Validates the FROM clause of a query, or (recursively) a child node of
the FROM clause: AS, OVER, JOIN, VALUES, or sub-query.
@param node Node in FROM clause, typically a table or derived
table
@param targetRowType Desired row type of this expression, or
{@link #unknownType} if not fussy. Must not be null.
@param scope Scope | [
"Validates",
"the",
"FROM",
"clause",
"of",
"a",
"query",
"or",
"(",
"recursively",
")",
"a",
"child",
"node",
"of",
"the",
"FROM",
"clause",
":",
"AS",
"OVER",
"JOIN",
"VALUES",
"or",
"sub",
"-",
"query",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3030-L3062 | train | Validate the given node using the given target row type and scope. | [
30522,
5123,
11675,
9398,
3686,
19699,
5358,
1006,
29296,
3630,
3207,
13045,
1010,
2128,
15150,
29336,
18863,
4539,
10524,
13874,
1010,
29296,
10175,
8524,
6591,
16186,
9531,
1007,
1063,
5200,
1012,
5478,
8540,
11231,
3363,
1006,
4539,
10524,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HttpObjectEncoder.java | HttpObjectEncoder.encodeHeaders | protected void encodeHeaders(HttpHeaders headers, ByteBuf buf) {
Iterator<Entry<CharSequence, CharSequence>> iter = headers.iteratorCharSequence();
while (iter.hasNext()) {
Entry<CharSequence, CharSequence> header = iter.next();
HttpHeadersEncoder.encoderHeader(header.getKey(), header.getValue(), buf);
}
} | java | protected void encodeHeaders(HttpHeaders headers, ByteBuf buf) {
Iterator<Entry<CharSequence, CharSequence>> iter = headers.iteratorCharSequence();
while (iter.hasNext()) {
Entry<CharSequence, CharSequence> header = iter.next();
HttpHeadersEncoder.encoderHeader(header.getKey(), header.getValue(), buf);
}
} | [
"protected",
"void",
"encodeHeaders",
"(",
"HttpHeaders",
"headers",
",",
"ByteBuf",
"buf",
")",
"{",
"Iterator",
"<",
"Entry",
"<",
"CharSequence",
",",
"CharSequence",
">",
">",
"iter",
"=",
"headers",
".",
"iteratorCharSequence",
"(",
")",
";",
"while",
"... | Encode the {@link HttpHeaders} into a {@link ByteBuf}. | [
"Encode",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectEncoder.java#L187-L193 | train | Encode headers. | [
30522,
5123,
11675,
4372,
16044,
4974,
2545,
1006,
8299,
4974,
2545,
20346,
2015,
1010,
24880,
8569,
2546,
20934,
2546,
1007,
1063,
2009,
6906,
4263,
1026,
4443,
1026,
25869,
3366,
4226,
5897,
1010,
25869,
3366,
4226,
5897,
1028,
1028,
2009... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.format | public static String format(Date date, DatePrinter format) {
if (null == format || null == date) {
return null;
}
return format.format(date);
} | java | public static String format(Date date, DatePrinter format) {
if (null == format || null == date) {
return null;
}
return format.format(date);
} | [
"public",
"static",
"String",
"format",
"(",
"Date",
"date",
",",
"DatePrinter",
"format",
")",
"{",
"if",
"(",
"null",
"==",
"format",
"||",
"null",
"==",
"date",
")",
"{",
"return",
"null",
";",
"}",
"return",
"format",
".",
"format",
"(",
"date",
... | 根据特定格式格式化日期
@param date 被格式化的日期
@param format {@link DatePrinter} 或 {@link FastDateFormat}
@return 格式化后的字符串 | [
"根据特定格式格式化日期"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L479-L484 | train | Format a date with a date printer. | [
30522,
2270,
10763,
5164,
4289,
1006,
3058,
3058,
1010,
3058,
16550,
2121,
4289,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
4289,
1064,
1064,
19701,
1027,
1027,
3058,
1007,
1063,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.notContain | public static String notContain(String textToSearch, String substring, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (StrUtil.isNotEmpty(textToSearch) && StrUtil.isNotEmpty(substring) && textToSearch.contains(substring)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return substring;
} | java | public static String notContain(String textToSearch, String substring, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (StrUtil.isNotEmpty(textToSearch) && StrUtil.isNotEmpty(substring) && textToSearch.contains(substring)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return substring;
} | [
"public",
"static",
"String",
"notContain",
"(",
"String",
"textToSearch",
",",
"String",
"substring",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"StrUtil",
".",
"isNotEmpty",
"(",
... | 断言给定字符串是否不被另一个字符串包含(既是否为子串)
<pre class="code">
Assert.doesNotContain(name, "rod", "Name must not contain 'rod'");
</pre>
@param textToSearch 被搜索的字符串
@param substring 被检查的子串
@param errorMsgTemplate 异常时的消息模板
@param params 参数列表
@return 被检查的子串
@throws IllegalArgumentException 非子串抛出异常 | [
"断言给定字符串是否不被另一个字符串包含(既是否为子串)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L242-L247 | train | Returns the substring that is not contained in the textToSearch. | [
30522,
2270,
10763,
5164,
2025,
8663,
18249,
1006,
5164,
3793,
22282,
2906,
2818,
1010,
5164,
4942,
3367,
4892,
1010,
5164,
7561,
5244,
13512,
6633,
15725,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
6206,
2906,
22850,
15781,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.buildKeyStore | static KeyStore buildKeyStore(X509Certificate[] certChain, PrivateKey key, char[] keyPasswordChars)
throws KeyStoreException, NoSuchAlgorithmException,
CertificateException, IOException {
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(null, null);
ks.setKeyEntry(ALIAS, key, keyPasswordChars, certChain);
return ks;
} | java | static KeyStore buildKeyStore(X509Certificate[] certChain, PrivateKey key, char[] keyPasswordChars)
throws KeyStoreException, NoSuchAlgorithmException,
CertificateException, IOException {
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(null, null);
ks.setKeyEntry(ALIAS, key, keyPasswordChars, certChain);
return ks;
} | [
"static",
"KeyStore",
"buildKeyStore",
"(",
"X509Certificate",
"[",
"]",
"certChain",
",",
"PrivateKey",
"key",
",",
"char",
"[",
"]",
"keyPasswordChars",
")",
"throws",
"KeyStoreException",
",",
"NoSuchAlgorithmException",
",",
"CertificateException",
",",
"IOExcepti... | Generates a new {@link KeyStore}.
@param certChain a X.509 certificate chain
@param key a PKCS#8 private key
@param keyPasswordChars the password of the {@code keyFile}.
{@code null} if it's not password-protected.
@return generated {@link KeyStore}. | [
"Generates",
"a",
"new",
"{",
"@link",
"KeyStore",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L1035-L1042 | train | Build a KeyStore from a X509Certificate and PrivateKey. | [
30522,
10763,
6309,
19277,
3857,
14839,
23809,
2063,
1006,
1060,
12376,
2683,
17119,
3775,
8873,
16280,
1031,
1033,
8292,
5339,
24925,
2078,
1010,
2797,
14839,
3145,
1010,
25869,
1031,
1033,
3145,
15194,
18351,
7507,
2869,
1007,
11618,
6309,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.valuesOfKeys | public static <K, V> ArrayList<V> valuesOfKeys(Map<K, V> map, Iterable<K> keys) {
return valuesOfKeys(map, keys.iterator());
} | java | public static <K, V> ArrayList<V> valuesOfKeys(Map<K, V> map, Iterable<K> keys) {
return valuesOfKeys(map, keys.iterator());
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"ArrayList",
"<",
"V",
">",
"valuesOfKeys",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"Iterable",
"<",
"K",
">",
"keys",
")",
"{",
"return",
"valuesOfKeys",
"(",
"map",
",",
"keys",
".",
"iterat... | 从Map中获取指定键列表对应的值列表<br>
如果key在map中不存在或key对应值为null,则返回值列表对应位置的值也为null
@param <K> 键类型
@param <V> 值类型
@param map {@link Map}
@param keys 键列表
@return 值列表
@since 3.0.9 | [
"从Map中获取指定键列表对应的值列表<br",
">",
"如果key在map中不存在或key对应值为null,则返回值列表对应位置的值也为null"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1995-L1997 | train | Returns an ArrayList of the values of the given keys in the given map. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
9140,
9863,
1026,
1058,
1028,
5300,
11253,
14839,
2015,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
4949,
1010,
2009,
6906,
3468,
1026,
1047,
1028,
6309,
1007,
1063,
2709,
5300,
11253,
14839,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | http-url/src/main/java/com/networknt/url/HttpURL.java | HttpURL.encodeQueryString | public static String encodeQueryString(String queryString) {
if (StringUtils.isBlank(queryString)) {
return queryString;
}
return new QueryString(queryString).toString();
} | java | public static String encodeQueryString(String queryString) {
if (StringUtils.isBlank(queryString)) {
return queryString;
}
return new QueryString(queryString).toString();
} | [
"public",
"static",
"String",
"encodeQueryString",
"(",
"String",
"queryString",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"queryString",
")",
")",
"{",
"return",
"queryString",
";",
"}",
"return",
"new",
"QueryString",
"(",
"queryString",
")",
... | <p>URL-Encodes the query string portion of a URL. The entire
string supplied is assumed to be a query string.
@param queryString URL query string
@return encoded path
@since 1.8.0 | [
"<p",
">",
"URL",
"-",
"Encodes",
"the",
"query",
"string",
"portion",
"of",
"a",
"URL",
".",
"The",
"entire",
"string",
"supplied",
"is",
"assumed",
"to",
"be",
"a",
"query",
"string",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/HttpURL.java#L413-L418 | train | Encode a query string to be used in a URL. | [
30522,
2270,
10763,
5164,
4372,
16044,
4226,
24769,
18886,
3070,
1006,
5164,
23032,
3367,
4892,
1007,
1063,
2065,
1006,
5164,
21823,
4877,
1012,
2003,
28522,
8950,
1006,
23032,
3367,
4892,
1007,
1007,
1063,
2709,
23032,
3367,
4892,
1025,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/ObjectId.java | ObjectId.next | public static String next(boolean withHyphen) {
byte[] array = nextBytes();
final StringBuilder buf = new StringBuilder(withHyphen ? 26 : 24);
int t;
for (int i = 0; i < array.length; i++) {
if (withHyphen && i % 4 == 0 && i != 0) {
buf.append("-");
}
t = array[i] & 0xff;
if (t < 16) {
buf.append('0');
}
buf.append(Integer.toHexString(t));
}
return buf.toString();
} | java | public static String next(boolean withHyphen) {
byte[] array = nextBytes();
final StringBuilder buf = new StringBuilder(withHyphen ? 26 : 24);
int t;
for (int i = 0; i < array.length; i++) {
if (withHyphen && i % 4 == 0 && i != 0) {
buf.append("-");
}
t = array[i] & 0xff;
if (t < 16) {
buf.append('0');
}
buf.append(Integer.toHexString(t));
}
return buf.toString();
} | [
"public",
"static",
"String",
"next",
"(",
"boolean",
"withHyphen",
")",
"{",
"byte",
"[",
"]",
"array",
"=",
"nextBytes",
"(",
")",
";",
"final",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
"withHyphen",
"?",
"26",
":",
"24",
")",
";",
"... | 获取一个objectId
@param withHyphen 是否包含分隔符
@return objectId | [
"获取一个objectId"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/ObjectId.java#L101-L117 | train | Returns the next 16 - bit string. | [
30522,
2270,
10763,
5164,
2279,
1006,
22017,
20898,
2007,
10536,
8458,
2368,
1007,
1063,
24880,
1031,
1033,
9140,
1027,
2279,
3762,
4570,
1006,
1007,
1025,
2345,
5164,
8569,
23891,
2099,
20934,
2546,
1027,
2047,
5164,
8569,
23891,
2099,
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-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.generateKeyPair | public static KeyPair generateKeyPair(String algorithm, int keySize, byte[] seed) {
return KeyUtil.generateKeyPair(algorithm, keySize, seed);
} | java | public static KeyPair generateKeyPair(String algorithm, int keySize, byte[] seed) {
return KeyUtil.generateKeyPair(algorithm, keySize, seed);
} | [
"public",
"static",
"KeyPair",
"generateKeyPair",
"(",
"String",
"algorithm",
",",
"int",
"keySize",
",",
"byte",
"[",
"]",
"seed",
")",
"{",
"return",
"KeyUtil",
".",
"generateKeyPair",
"(",
"algorithm",
",",
"keySize",
",",
"seed",
")",
";",
"}"
] | 生成用于非对称加密的公钥和私钥<br>
密钥对生成算法见:https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#KeyPairGenerator
@param algorithm 非对称加密算法
@param keySize 密钥模(modulus )长度
@param seed 种子
@return {@link KeyPair} | [
"生成用于非对称加密的公钥和私钥<br",
">",
"密钥对生成算法见:https",
":",
"//",
"docs",
".",
"oracle",
".",
"com",
"/",
"javase",
"/",
"7",
"/",
"docs",
"/",
"technotes",
"/",
"guides",
"/",
"security",
"/",
"StandardNames",
".",
"html#KeyPairGenerator"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L227-L229 | train | Generates a new RSA key pair. | [
30522,
2270,
10763,
3145,
4502,
4313,
9699,
14839,
4502,
4313,
1006,
5164,
9896,
1010,
20014,
6309,
4697,
1010,
24880,
1031,
1033,
6534,
1007,
1063,
2709,
3145,
21823,
2140,
1012,
9699,
14839,
4502,
4313,
1006,
9896,
1010,
6309,
4697,
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-connectors/flink-hbase/src/main/java/org/apache/flink/addons/hbase/HBaseTableSchema.java | HBaseTableSchema.getFamilyKeys | byte[][] getFamilyKeys() {
Charset c = Charset.forName(charset);
byte[][] familyKeys = new byte[this.familyMap.size()][];
int i = 0;
for (String name : this.familyMap.keySet()) {
familyKeys[i++] = name.getBytes(c);
}
return familyKeys;
} | java | byte[][] getFamilyKeys() {
Charset c = Charset.forName(charset);
byte[][] familyKeys = new byte[this.familyMap.size()][];
int i = 0;
for (String name : this.familyMap.keySet()) {
familyKeys[i++] = name.getBytes(c);
}
return familyKeys;
} | [
"byte",
"[",
"]",
"[",
"]",
"getFamilyKeys",
"(",
")",
"{",
"Charset",
"c",
"=",
"Charset",
".",
"forName",
"(",
"charset",
")",
";",
"byte",
"[",
"]",
"[",
"]",
"familyKeys",
"=",
"new",
"byte",
"[",
"this",
".",
"familyMap",
".",
"size",
"(",
"... | Returns the HBase identifiers of all registered column families.
@return The HBase identifiers of all registered column families. | [
"Returns",
"the",
"HBase",
"identifiers",
"of",
"all",
"registered",
"column",
"families",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hbase/src/main/java/org/apache/flink/addons/hbase/HBaseTableSchema.java#L90-L99 | train | Returns the byte array of the family keys. | [
30522,
24880,
1031,
1033,
1031,
1033,
2131,
7011,
4328,
2135,
14839,
2015,
1006,
1007,
1063,
25869,
13462,
1039,
1027,
25869,
13462,
1012,
2005,
18442,
1006,
25869,
13462,
1007,
1025,
24880,
1031,
1033,
1031,
1033,
2155,
14839,
2015,
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/clusterframework/BootstrapTools.java | BootstrapTools.substituteDeprecatedConfigPrefix | public static void substituteDeprecatedConfigPrefix(
Configuration config,
String deprecatedPrefix,
String designatedPrefix) {
// set the designated key only if it is not set already
final int prefixLen = deprecatedPrefix.length();
Configuration replacement = new Configuration();
for (String key : config.keySet()) {
if (key.startsWith(deprecatedPrefix)) {
String newKey = designatedPrefix + key.substring(prefixLen);
if (!config.containsKey(newKey)) {
replacement.setString(newKey, config.getString(key, null));
}
}
}
config.addAll(replacement);
} | java | public static void substituteDeprecatedConfigPrefix(
Configuration config,
String deprecatedPrefix,
String designatedPrefix) {
// set the designated key only if it is not set already
final int prefixLen = deprecatedPrefix.length();
Configuration replacement = new Configuration();
for (String key : config.keySet()) {
if (key.startsWith(deprecatedPrefix)) {
String newKey = designatedPrefix + key.substring(prefixLen);
if (!config.containsKey(newKey)) {
replacement.setString(newKey, config.getString(key, null));
}
}
}
config.addAll(replacement);
} | [
"public",
"static",
"void",
"substituteDeprecatedConfigPrefix",
"(",
"Configuration",
"config",
",",
"String",
"deprecatedPrefix",
",",
"String",
"designatedPrefix",
")",
"{",
"// set the designated key only if it is not set already",
"final",
"int",
"prefixLen",
"=",
"deprec... | Sets the value of a new config key to the value of a deprecated config key. Taking into
account the changed prefix.
@param config Config to write
@param deprecatedPrefix Old prefix of key
@param designatedPrefix New prefix of key | [
"Sets",
"the",
"value",
"of",
"a",
"new",
"config",
"key",
"to",
"the",
"value",
"of",
"a",
"deprecated",
"config",
"key",
".",
"Taking",
"into",
"account",
"the",
"changed",
"prefix",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java#L346-L366 | train | Substitute the deprecated config prefix with the designated prefix. | [
30522,
2270,
10763,
11675,
17316,
13699,
2890,
12921,
8663,
8873,
21600,
2890,
8873,
2595,
1006,
9563,
9530,
8873,
2290,
1010,
5164,
2139,
28139,
12921,
28139,
8873,
2595,
1010,
5164,
4351,
28139,
8873,
2595,
1007,
1063,
1013,
1013,
2275,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/word2vec/AbstractVectorModel.java | AbstractVectorModel.dimension | public int dimension()
{
if (storage == null || storage.isEmpty())
{
return 0;
}
return storage.values().iterator().next().size();
} | java | public int dimension()
{
if (storage == null || storage.isEmpty())
{
return 0;
}
return storage.values().iterator().next().size();
} | [
"public",
"int",
"dimension",
"(",
")",
"{",
"if",
"(",
"storage",
"==",
"null",
"||",
"storage",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"return",
"storage",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"... | 模型中的词向量维度
@return | [
"模型中的词向量维度"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/AbstractVectorModel.java#L211-L218 | train | Get the dimension of the domain. | [
30522,
2270,
20014,
9812,
1006,
1007,
1063,
2065,
1006,
5527,
1027,
1027,
19701,
1064,
1064,
5527,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1007,
1063,
2709,
1014,
1025,
1065,
2709,
5527,
1012,
5300,
1006,
1007,
1012,
2009,
6906,
4263,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-log/src/main/java/cn/hutool/log/dialect/jdk/JdkLog.java | JdkLog.logIfEnabled | private void logIfEnabled(Level level, Throwable throwable, String format, Object[] arguments){
this.logIfEnabled(FQCN_SELF, level, throwable, format, arguments);
} | java | private void logIfEnabled(Level level, Throwable throwable, String format, Object[] arguments){
this.logIfEnabled(FQCN_SELF, level, throwable, format, arguments);
} | [
"private",
"void",
"logIfEnabled",
"(",
"Level",
"level",
",",
"Throwable",
"throwable",
",",
"String",
"format",
",",
"Object",
"[",
"]",
"arguments",
")",
"{",
"this",
".",
"logIfEnabled",
"(",
"FQCN_SELF",
",",
"level",
",",
"throwable",
",",
"format",
... | 打印对应等级的日志
@param level 等级
@param throwable 异常对象
@param format 消息模板
@param arguments 参数 | [
"打印对应等级的日志"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/dialect/jdk/JdkLog.java#L167-L169 | train | Logs a throwable if the specified log level is enabled. | [
30522,
2797,
11675,
8833,
29323,
22966,
2094,
1006,
2504,
2504,
1010,
5466,
3085,
5466,
3085,
1010,
5164,
4289,
1010,
4874,
1031,
1033,
9918,
1007,
1063,
2023,
1012,
8833,
29323,
22966,
2094,
1006,
1042,
4160,
2278,
2078,
1035,
2969,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.write | public static void write(Image image, File targetFile) throws IORuntimeException {
ImageOutputStream out = null;
try {
out = getImageOutputStream(targetFile);
write(image, FileUtil.extName(targetFile), out);
} finally {
IoUtil.close(out);
}
} | java | public static void write(Image image, File targetFile) throws IORuntimeException {
ImageOutputStream out = null;
try {
out = getImageOutputStream(targetFile);
write(image, FileUtil.extName(targetFile), out);
} finally {
IoUtil.close(out);
}
} | [
"public",
"static",
"void",
"write",
"(",
"Image",
"image",
",",
"File",
"targetFile",
")",
"throws",
"IORuntimeException",
"{",
"ImageOutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"getImageOutputStream",
"(",
"targetFile",
")",
";",
"write",... | 写出图像为目标文件扩展名对应的格式
@param image {@link Image}
@param targetFile 目标文件
@throws IORuntimeException IO异常
@since 3.1.0 | [
"写出图像为目标文件扩展名对应的格式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1448-L1456 | train | Write an image to a file. | [
30522,
2270,
10763,
11675,
4339,
1006,
3746,
3746,
1010,
5371,
4539,
8873,
2571,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
3746,
5833,
18780,
21422,
2041,
1027,
19701,
1025,
3046,
1063,
2041,
1027,
2131,
9581,
3351,
5833,
18780,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/RestartPipelinedRegionStrategy.java | RestartPipelinedRegionStrategy.generateAllFailoverRegion | private void generateAllFailoverRegion(List<ExecutionJobVertex> newJobVerticesTopological) {
final IdentityHashMap<ExecutionVertex, ArrayList<ExecutionVertex>> vertexToRegion = new IdentityHashMap<>();
// we use the map (list -> null) to imitate an IdentityHashSet (which does not exist)
final IdentityHashMap<ArrayList<ExecutionVertex>, Object> distinctRegions = new IdentityHashMap<>();
// this loop will worst case iterate over every edge in the graph (complexity is O(#edges))
for (ExecutionJobVertex ejv : newJobVerticesTopological) {
// currently, jobs with a co-location constraint fail as one
// we want to improve that in the future (or get rid of co-location constraints)
if (ejv.getCoLocationGroup() != null) {
makeAllOneRegion(newJobVerticesTopological);
return;
}
// see if this JobVertex one has pipelined inputs at all
final List<IntermediateResult> inputs = ejv.getInputs();
final int numInputs = inputs.size();
boolean hasPipelinedInputs = false;
for (IntermediateResult input : inputs) {
if (input.getResultType().isPipelined()) {
hasPipelinedInputs = true;
break;
}
}
if (hasPipelinedInputs) {
// build upon the predecessors
for (ExecutionVertex ev : ejv.getTaskVertices()) {
// remember the region in which we are
ArrayList<ExecutionVertex> thisRegion = null;
for (int inputNum = 0; inputNum < numInputs; inputNum++) {
if (inputs.get(inputNum).getResultType().isPipelined()) {
for (ExecutionEdge edge : ev.getInputEdges(inputNum)) {
final ExecutionVertex predecessor = edge.getSource().getProducer();
final ArrayList<ExecutionVertex> predecessorRegion = vertexToRegion.get(predecessor);
if (thisRegion != null) {
// we already have a region. see if it is the same as the predecessor's region
if (predecessorRegion != thisRegion) {
// we need to merge our region and the predecessor's region
predecessorRegion.addAll(thisRegion);
distinctRegions.remove(thisRegion);
thisRegion = predecessorRegion;
// remap the vertices from that merged region
for (ExecutionVertex inPredRegion: predecessorRegion) {
vertexToRegion.put(inPredRegion, thisRegion);
}
}
}
else if (predecessor != null) {
// first case, make this our region
thisRegion = predecessorRegion;
thisRegion.add(ev);
vertexToRegion.put(ev, thisRegion);
}
else {
// throw an uncaught exception here
// this is a bug and not a recoverable situation
throw new FlinkRuntimeException(
"bug in the logic to construct the pipelined failover regions");
}
}
}
}
}
}
else {
// no pipelined inputs, start a new region
for (ExecutionVertex ev : ejv.getTaskVertices()) {
ArrayList<ExecutionVertex> region = new ArrayList<>(1);
region.add(ev);
vertexToRegion.put(ev, region);
distinctRegions.put(region, null);
}
}
}
// now that we have all regions, create the failover region objects
LOG.info("Creating {} individual failover regions for job {} ({})",
distinctRegions.size(), executionGraph.getJobName(), executionGraph.getJobID());
for (List<ExecutionVertex> region : distinctRegions.keySet()) {
final FailoverRegion failoverRegion = createFailoverRegion(executionGraph, region);
for (ExecutionVertex ev : region) {
this.vertexToRegion.put(ev, failoverRegion);
}
}
} | java | private void generateAllFailoverRegion(List<ExecutionJobVertex> newJobVerticesTopological) {
final IdentityHashMap<ExecutionVertex, ArrayList<ExecutionVertex>> vertexToRegion = new IdentityHashMap<>();
// we use the map (list -> null) to imitate an IdentityHashSet (which does not exist)
final IdentityHashMap<ArrayList<ExecutionVertex>, Object> distinctRegions = new IdentityHashMap<>();
// this loop will worst case iterate over every edge in the graph (complexity is O(#edges))
for (ExecutionJobVertex ejv : newJobVerticesTopological) {
// currently, jobs with a co-location constraint fail as one
// we want to improve that in the future (or get rid of co-location constraints)
if (ejv.getCoLocationGroup() != null) {
makeAllOneRegion(newJobVerticesTopological);
return;
}
// see if this JobVertex one has pipelined inputs at all
final List<IntermediateResult> inputs = ejv.getInputs();
final int numInputs = inputs.size();
boolean hasPipelinedInputs = false;
for (IntermediateResult input : inputs) {
if (input.getResultType().isPipelined()) {
hasPipelinedInputs = true;
break;
}
}
if (hasPipelinedInputs) {
// build upon the predecessors
for (ExecutionVertex ev : ejv.getTaskVertices()) {
// remember the region in which we are
ArrayList<ExecutionVertex> thisRegion = null;
for (int inputNum = 0; inputNum < numInputs; inputNum++) {
if (inputs.get(inputNum).getResultType().isPipelined()) {
for (ExecutionEdge edge : ev.getInputEdges(inputNum)) {
final ExecutionVertex predecessor = edge.getSource().getProducer();
final ArrayList<ExecutionVertex> predecessorRegion = vertexToRegion.get(predecessor);
if (thisRegion != null) {
// we already have a region. see if it is the same as the predecessor's region
if (predecessorRegion != thisRegion) {
// we need to merge our region and the predecessor's region
predecessorRegion.addAll(thisRegion);
distinctRegions.remove(thisRegion);
thisRegion = predecessorRegion;
// remap the vertices from that merged region
for (ExecutionVertex inPredRegion: predecessorRegion) {
vertexToRegion.put(inPredRegion, thisRegion);
}
}
}
else if (predecessor != null) {
// first case, make this our region
thisRegion = predecessorRegion;
thisRegion.add(ev);
vertexToRegion.put(ev, thisRegion);
}
else {
// throw an uncaught exception here
// this is a bug and not a recoverable situation
throw new FlinkRuntimeException(
"bug in the logic to construct the pipelined failover regions");
}
}
}
}
}
}
else {
// no pipelined inputs, start a new region
for (ExecutionVertex ev : ejv.getTaskVertices()) {
ArrayList<ExecutionVertex> region = new ArrayList<>(1);
region.add(ev);
vertexToRegion.put(ev, region);
distinctRegions.put(region, null);
}
}
}
// now that we have all regions, create the failover region objects
LOG.info("Creating {} individual failover regions for job {} ({})",
distinctRegions.size(), executionGraph.getJobName(), executionGraph.getJobID());
for (List<ExecutionVertex> region : distinctRegions.keySet()) {
final FailoverRegion failoverRegion = createFailoverRegion(executionGraph, region);
for (ExecutionVertex ev : region) {
this.vertexToRegion.put(ev, failoverRegion);
}
}
} | [
"private",
"void",
"generateAllFailoverRegion",
"(",
"List",
"<",
"ExecutionJobVertex",
">",
"newJobVerticesTopological",
")",
"{",
"final",
"IdentityHashMap",
"<",
"ExecutionVertex",
",",
"ArrayList",
"<",
"ExecutionVertex",
">",
">",
"vertexToRegion",
"=",
"new",
"I... | Generate all the FailoverRegion from the new added job vertexes | [
"Generate",
"all",
"the",
"FailoverRegion",
"from",
"the",
"new",
"added",
"job",
"vertexes"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/RestartPipelinedRegionStrategy.java#L107-L203 | train | generate all failover regions | [
30522,
2797,
11675,
9699,
8095,
7011,
22360,
6299,
23784,
1006,
2862,
1026,
7781,
5558,
2497,
16874,
10288,
1028,
2047,
5558,
2497,
16874,
23522,
14399,
10091,
1007,
1063,
2345,
4767,
14949,
22444,
2361,
1026,
7781,
16874,
10288,
1010,
9140,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java | CommandBuilderUtils.join | static String join(String sep, String... elements) {
StringBuilder sb = new StringBuilder();
for (String e : elements) {
if (e != null) {
if (sb.length() > 0) {
sb.append(sep);
}
sb.append(e);
}
}
return sb.toString();
} | java | static String join(String sep, String... elements) {
StringBuilder sb = new StringBuilder();
for (String e : elements) {
if (e != null) {
if (sb.length() > 0) {
sb.append(sep);
}
sb.append(e);
}
}
return sb.toString();
} | [
"static",
"String",
"join",
"(",
"String",
"sep",
",",
"String",
"...",
"elements",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"String",
"e",
":",
"elements",
")",
"{",
"if",
"(",
"e",
"!=",
"null",
")",
... | Joins a list of strings using the given separator. | [
"Joins",
"a",
"list",
"of",
"strings",
"using",
"the",
"given",
"separator",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L40-L51 | train | Join a sequence of strings with a separator. | [
30522,
10763,
5164,
3693,
1006,
5164,
19802,
1010,
5164,
1012,
1012,
1012,
3787,
1007,
1063,
5164,
8569,
23891,
2099,
24829,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
1007,
1025,
2005,
1006,
5164,
1041,
1024,
3787,
1007,
1063,
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... |
netty/netty | codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java | MqttEncoder.doEncode | static ByteBuf doEncode(ByteBufAllocator byteBufAllocator, MqttMessage message) {
switch (message.fixedHeader().messageType()) {
case CONNECT:
return encodeConnectMessage(byteBufAllocator, (MqttConnectMessage) message);
case CONNACK:
return encodeConnAckMessage(byteBufAllocator, (MqttConnAckMessage) message);
case PUBLISH:
return encodePublishMessage(byteBufAllocator, (MqttPublishMessage) message);
case SUBSCRIBE:
return encodeSubscribeMessage(byteBufAllocator, (MqttSubscribeMessage) message);
case UNSUBSCRIBE:
return encodeUnsubscribeMessage(byteBufAllocator, (MqttUnsubscribeMessage) message);
case SUBACK:
return encodeSubAckMessage(byteBufAllocator, (MqttSubAckMessage) message);
case UNSUBACK:
case PUBACK:
case PUBREC:
case PUBREL:
case PUBCOMP:
return encodeMessageWithOnlySingleByteFixedHeaderAndMessageId(byteBufAllocator, message);
case PINGREQ:
case PINGRESP:
case DISCONNECT:
return encodeMessageWithOnlySingleByteFixedHeader(byteBufAllocator, message);
default:
throw new IllegalArgumentException(
"Unknown message type: " + message.fixedHeader().messageType().value());
}
} | java | static ByteBuf doEncode(ByteBufAllocator byteBufAllocator, MqttMessage message) {
switch (message.fixedHeader().messageType()) {
case CONNECT:
return encodeConnectMessage(byteBufAllocator, (MqttConnectMessage) message);
case CONNACK:
return encodeConnAckMessage(byteBufAllocator, (MqttConnAckMessage) message);
case PUBLISH:
return encodePublishMessage(byteBufAllocator, (MqttPublishMessage) message);
case SUBSCRIBE:
return encodeSubscribeMessage(byteBufAllocator, (MqttSubscribeMessage) message);
case UNSUBSCRIBE:
return encodeUnsubscribeMessage(byteBufAllocator, (MqttUnsubscribeMessage) message);
case SUBACK:
return encodeSubAckMessage(byteBufAllocator, (MqttSubAckMessage) message);
case UNSUBACK:
case PUBACK:
case PUBREC:
case PUBREL:
case PUBCOMP:
return encodeMessageWithOnlySingleByteFixedHeaderAndMessageId(byteBufAllocator, message);
case PINGREQ:
case PINGRESP:
case DISCONNECT:
return encodeMessageWithOnlySingleByteFixedHeader(byteBufAllocator, message);
default:
throw new IllegalArgumentException(
"Unknown message type: " + message.fixedHeader().messageType().value());
}
} | [
"static",
"ByteBuf",
"doEncode",
"(",
"ByteBufAllocator",
"byteBufAllocator",
",",
"MqttMessage",
"message",
")",
"{",
"switch",
"(",
"message",
".",
"fixedHeader",
"(",
")",
".",
"messageType",
"(",
")",
")",
"{",
"case",
"CONNECT",
":",
"return",
"encodeConn... | This is the main encoding method.
It's only visible for testing.
@param byteBufAllocator Allocates ByteBuf
@param message MQTT message to encode
@return ByteBuf with encoded bytes | [
"This",
"is",
"the",
"main",
"encoding",
"method",
".",
"It",
"s",
"only",
"visible",
"for",
"testing",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java#L56-L93 | train | Encode a single message. | [
30522,
10763,
24880,
8569,
2546,
18629,
15305,
3207,
1006,
24880,
8569,
13976,
24755,
4263,
24880,
8569,
13976,
24755,
4263,
1010,
1049,
4160,
4779,
7834,
3736,
3351,
4471,
1007,
1063,
6942,
1006,
4471,
1012,
4964,
4974,
2121,
1006,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/TaskManagerJobMetricGroup.java | TaskManagerJobMetricGroup.addTask | public TaskMetricGroup addTask(
final JobVertexID jobVertexId,
final ExecutionAttemptID executionAttemptID,
final String taskName,
final int subtaskIndex,
final int attemptNumber) {
checkNotNull(jobVertexId);
checkNotNull(executionAttemptID);
checkNotNull(taskName);
synchronized (this) {
if (!isClosed()) {
TaskMetricGroup prior = tasks.get(executionAttemptID);
if (prior != null) {
return prior;
} else {
TaskMetricGroup task = new TaskMetricGroup(
registry,
this,
jobVertexId,
executionAttemptID,
taskName,
subtaskIndex,
attemptNumber);
tasks.put(executionAttemptID, task);
return task;
}
} else {
return null;
}
}
} | java | public TaskMetricGroup addTask(
final JobVertexID jobVertexId,
final ExecutionAttemptID executionAttemptID,
final String taskName,
final int subtaskIndex,
final int attemptNumber) {
checkNotNull(jobVertexId);
checkNotNull(executionAttemptID);
checkNotNull(taskName);
synchronized (this) {
if (!isClosed()) {
TaskMetricGroup prior = tasks.get(executionAttemptID);
if (prior != null) {
return prior;
} else {
TaskMetricGroup task = new TaskMetricGroup(
registry,
this,
jobVertexId,
executionAttemptID,
taskName,
subtaskIndex,
attemptNumber);
tasks.put(executionAttemptID, task);
return task;
}
} else {
return null;
}
}
} | [
"public",
"TaskMetricGroup",
"addTask",
"(",
"final",
"JobVertexID",
"jobVertexId",
",",
"final",
"ExecutionAttemptID",
"executionAttemptID",
",",
"final",
"String",
"taskName",
",",
"final",
"int",
"subtaskIndex",
",",
"final",
"int",
"attemptNumber",
")",
"{",
"ch... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/TaskManagerJobMetricGroup.java#L65-L96 | train | Add a task to the metric group. | [
30522,
2270,
4708,
12589,
17058,
5587,
10230,
2243,
1006,
2345,
3105,
16874,
10288,
3593,
3105,
16874,
10288,
3593,
1010,
2345,
7781,
19321,
6633,
13876,
3593,
7781,
19321,
6633,
13876,
3593,
1010,
2345,
5164,
4708,
18442,
1010,
2345,
20014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.calendar | public static Calendar calendar(Date date) {
if(date instanceof DateTime) {
return ((DateTime)date).toCalendar();
}else {
return calendar(date.getTime());
}
} | java | public static Calendar calendar(Date date) {
if(date instanceof DateTime) {
return ((DateTime)date).toCalendar();
}else {
return calendar(date.getTime());
}
} | [
"public",
"static",
"Calendar",
"calendar",
"(",
"Date",
"date",
")",
"{",
"if",
"(",
"date",
"instanceof",
"DateTime",
")",
"{",
"return",
"(",
"(",
"DateTime",
")",
"date",
")",
".",
"toCalendar",
"(",
")",
";",
"}",
"else",
"{",
"return",
"calendar"... | 转换为Calendar对象
@param date 日期对象
@return Calendar对象 | [
"转换为Calendar对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L90-L96 | train | Returns a calendar object from a java. util. Date object. | [
30522,
2270,
10763,
8094,
8094,
1006,
3058,
3058,
1007,
1063,
2065,
1006,
3058,
6013,
11253,
3058,
7292,
1007,
1063,
2709,
1006,
1006,
3058,
7292,
1007,
3058,
1007,
1012,
2000,
9289,
10497,
2906,
1006,
1007,
1025,
1065,
2842,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java | GlobalConfiguration.loadConfigurationWithDynamicProperties | public static Configuration loadConfigurationWithDynamicProperties(Configuration dynamicProperties) {
final String configDir = System.getenv(ConfigConstants.ENV_FLINK_CONF_DIR);
if (configDir == null) {
return new Configuration(dynamicProperties);
}
return loadConfiguration(configDir, dynamicProperties);
} | java | public static Configuration loadConfigurationWithDynamicProperties(Configuration dynamicProperties) {
final String configDir = System.getenv(ConfigConstants.ENV_FLINK_CONF_DIR);
if (configDir == null) {
return new Configuration(dynamicProperties);
}
return loadConfiguration(configDir, dynamicProperties);
} | [
"public",
"static",
"Configuration",
"loadConfigurationWithDynamicProperties",
"(",
"Configuration",
"dynamicProperties",
")",
"{",
"final",
"String",
"configDir",
"=",
"System",
".",
"getenv",
"(",
"ConfigConstants",
".",
"ENV_FLINK_CONF_DIR",
")",
";",
"if",
"(",
"c... | Loads the global configuration and adds the given dynamic properties
configuration.
@param dynamicProperties The given dynamic properties
@return Returns the loaded global configuration with dynamic properties | [
"Loads",
"the",
"global",
"configuration",
"and",
"adds",
"the",
"given",
"dynamic",
"properties",
"configuration",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java#L131-L138 | train | Load configuration with dynamic properties. | [
30522,
2270,
10763,
9563,
7170,
8663,
8873,
27390,
3370,
24415,
5149,
28987,
21906,
18981,
8743,
3111,
1006,
9563,
8790,
21572,
4842,
7368,
1007,
1063,
2345,
5164,
9530,
8873,
2290,
4305,
2099,
1027,
2291,
1012,
2131,
2368,
2615,
1006,
9530... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.writePng | public static void writePng(Image image, OutputStream out) throws IORuntimeException {
write(image, IMAGE_TYPE_PNG, out);
} | java | public static void writePng(Image image, OutputStream out) throws IORuntimeException {
write(image, IMAGE_TYPE_PNG, out);
} | [
"public",
"static",
"void",
"writePng",
"(",
"Image",
"image",
",",
"OutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"write",
"(",
"image",
",",
"IMAGE_TYPE_PNG",
",",
"out",
")",
";",
"}"
] | 写出图像为PNG格式
@param image {@link Image}
@param out 写出到的目标流
@throws IORuntimeException IO异常
@since 4.0.10 | [
"写出图像为PNG格式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1389-L1391 | train | Write a PNG image to an OutputStream. | [
30522,
2270,
10763,
11675,
4339,
2361,
3070,
1006,
3746,
3746,
1010,
27852,
25379,
2041,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
4339,
1006,
3746,
1010,
3746,
1035,
2828,
1035,
1052,
3070,
1010,
2041,
1007,
1025,
1065,
102,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.sub | public static double sub(Double v1, Double v2) {
return sub((Number) v1, (Number) v2).doubleValue();
} | java | public static double sub(Double v1, Double v2) {
return sub((Number) v1, (Number) v2).doubleValue();
} | [
"public",
"static",
"double",
"sub",
"(",
"Double",
"v1",
",",
"Double",
"v2",
")",
"{",
"return",
"sub",
"(",
"(",
"Number",
")",
"v1",
",",
"(",
"Number",
")",
"v2",
")",
".",
"doubleValue",
"(",
")",
";",
"}"
] | 提供精确的减法运算
@param v1 被减数
@param v2 减数
@return 差 | [
"提供精确的减法运算"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L236-L238 | train | Returns the subtraction of two numbers. | [
30522,
2270,
10763,
3313,
4942,
1006,
3313,
1058,
2487,
1010,
3313,
1058,
2475,
1007,
1063,
2709,
4942,
1006,
1006,
2193,
1007,
1058,
2487,
1010,
1006,
2193,
1007,
1058,
2475,
1007,
1012,
3313,
10175,
5657,
1006,
1007,
1025,
1065,
102,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java | ExcelUtil.read07BySax | public static Excel07SaxReader read07BySax(String path, int sheetIndex, RowHandler rowHandler) {
try {
return new Excel07SaxReader(rowHandler).read(path, sheetIndex);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | java | public static Excel07SaxReader read07BySax(String path, int sheetIndex, RowHandler rowHandler) {
try {
return new Excel07SaxReader(rowHandler).read(path, sheetIndex);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | [
"public",
"static",
"Excel07SaxReader",
"read07BySax",
"(",
"String",
"path",
",",
"int",
"sheetIndex",
",",
"RowHandler",
"rowHandler",
")",
"{",
"try",
"{",
"return",
"new",
"Excel07SaxReader",
"(",
"rowHandler",
")",
".",
"read",
"(",
"path",
",",
"sheetInd... | Sax方式读取Excel07
@param path 路径
@param sheetIndex Sheet索引,-1表示全部Sheet, 0表示第一个Sheet
@param rowHandler 行处理器
@return {@link Excel07SaxReader}
@since 3.2.0 | [
"Sax方式读取Excel07"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L123-L129 | train | Reads an Excel file from a file in Excel07 format by SAX. | [
30522,
2270,
30524,
1006,
5216,
11774,
3917,
1007,
1012,
3191,
1006,
4130,
1010,
7123,
22254,
10288,
1007,
1025,
1065,
4608,
1006,
2053,
26266,
3207,
4246,
28819,
2121,
29165,
1041,
1007,
1063,
5466,
2047,
24394,
10288,
24422,
1006,
4874,
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/spark | launcher/src/main/java/org/apache/spark/launcher/ChildProcAppHandle.java | ChildProcAppHandle.monitorChild | void monitorChild() {
Process proc = childProc;
if (proc == null) {
// Process may have already been disposed of, e.g. by calling kill().
return;
}
while (proc.isAlive()) {
try {
proc.waitFor();
} catch (Exception e) {
LOG.log(Level.WARNING, "Exception waiting for child process to exit.", e);
}
}
synchronized (this) {
if (isDisposed()) {
return;
}
int ec;
try {
ec = proc.exitValue();
} catch (Exception e) {
LOG.log(Level.WARNING, "Exception getting child process exit code, assuming failure.", e);
ec = 1;
}
if (ec != 0) {
State currState = getState();
// Override state with failure if the current state is not final, or is success.
if (!currState.isFinal() || currState == State.FINISHED) {
setState(State.FAILED, true);
}
}
dispose();
}
} | java | void monitorChild() {
Process proc = childProc;
if (proc == null) {
// Process may have already been disposed of, e.g. by calling kill().
return;
}
while (proc.isAlive()) {
try {
proc.waitFor();
} catch (Exception e) {
LOG.log(Level.WARNING, "Exception waiting for child process to exit.", e);
}
}
synchronized (this) {
if (isDisposed()) {
return;
}
int ec;
try {
ec = proc.exitValue();
} catch (Exception e) {
LOG.log(Level.WARNING, "Exception getting child process exit code, assuming failure.", e);
ec = 1;
}
if (ec != 0) {
State currState = getState();
// Override state with failure if the current state is not final, or is success.
if (!currState.isFinal() || currState == State.FINISHED) {
setState(State.FAILED, true);
}
}
dispose();
}
} | [
"void",
"monitorChild",
"(",
")",
"{",
"Process",
"proc",
"=",
"childProc",
";",
"if",
"(",
"proc",
"==",
"null",
")",
"{",
"// Process may have already been disposed of, e.g. by calling kill().",
"return",
";",
"}",
"while",
"(",
"proc",
".",
"isAlive",
"(",
")... | Wait for the child process to exit and update the handle's state if necessary, according to
the exit code. | [
"Wait",
"for",
"the",
"child",
"process",
"to",
"exit",
"and",
"update",
"the",
"handle",
"s",
"state",
"if",
"necessary",
"according",
"to",
"the",
"exit",
"code",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/ChildProcAppHandle.java#L97-L135 | train | Monitor the child process. | [
30522,
11675,
8080,
19339,
1006,
1007,
1063,
2832,
4013,
2278,
1027,
2775,
21572,
2278,
1025,
2065,
1006,
4013,
2278,
1027,
1027,
19701,
1007,
1063,
1013,
1013,
2832,
2089,
2031,
2525,
2042,
21866,
1997,
1010,
1041,
1012,
1043,
1012,
2011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSnapshotSerializationUtil.java | TypeSerializerSnapshotSerializationUtil.readSerializerSnapshot | public static <T> TypeSerializerSnapshot<T> readSerializerSnapshot(
DataInputView in,
ClassLoader userCodeClassLoader,
@Nullable TypeSerializer<T> existingPriorSerializer) throws IOException {
final TypeSerializerSnapshotSerializationProxy<T> proxy =
new TypeSerializerSnapshotSerializationProxy<>(userCodeClassLoader, existingPriorSerializer);
proxy.read(in);
return proxy.getSerializerSnapshot();
} | java | public static <T> TypeSerializerSnapshot<T> readSerializerSnapshot(
DataInputView in,
ClassLoader userCodeClassLoader,
@Nullable TypeSerializer<T> existingPriorSerializer) throws IOException {
final TypeSerializerSnapshotSerializationProxy<T> proxy =
new TypeSerializerSnapshotSerializationProxy<>(userCodeClassLoader, existingPriorSerializer);
proxy.read(in);
return proxy.getSerializerSnapshot();
} | [
"public",
"static",
"<",
"T",
">",
"TypeSerializerSnapshot",
"<",
"T",
">",
"readSerializerSnapshot",
"(",
"DataInputView",
"in",
",",
"ClassLoader",
"userCodeClassLoader",
",",
"@",
"Nullable",
"TypeSerializer",
"<",
"T",
">",
"existingPriorSerializer",
")",
"throw... | Reads from a data input view a {@link TypeSerializerSnapshot} that was previously
written using {@link TypeSerializerSnapshotSerializationUtil#writeSerializerSnapshot(DataOutputView, TypeSerializerSnapshot, TypeSerializer)}.
@param in the data input view
@param userCodeClassLoader the user code class loader to use
@param existingPriorSerializer the prior serializer. This would only be non-null if we are
restoring from a snapshot taken with Flink version <= 1.6.
@return the read serializer configuration snapshot | [
"Reads",
"from",
"a",
"data",
"input",
"view",
"a",
"{",
"@link",
"TypeSerializerSnapshot",
"}",
"that",
"was",
"previously",
"written",
"using",
"{",
"@link",
"TypeSerializerSnapshotSerializationUtil#writeSerializerSnapshot",
"(",
"DataOutputView",
"TypeSerializerSnapshot"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSnapshotSerializationUtil.java#L69-L79 | train | Read a serializer snapshot. | [
30522,
2270,
10763,
1026,
1056,
1028,
4127,
11610,
28863,
2015,
2532,
4523,
12326,
1026,
1056,
1028,
9631,
11610,
28863,
2015,
2532,
4523,
12326,
1006,
2951,
2378,
18780,
8584,
1999,
1010,
2465,
11066,
2121,
5310,
16044,
26266,
11066,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/io/TextInputFormat.java | TextInputFormat.readRecord | @Override
public String readRecord(String reusable, byte[] bytes, int offset, int numBytes) throws IOException {
//Check if \n is used as delimiter and the end of this line is a \r, then remove \r from the line
if (this.getDelimiter() != null && this.getDelimiter().length == 1
&& this.getDelimiter()[0] == NEW_LINE && offset + numBytes >= 1
&& bytes[offset + numBytes - 1] == CARRIAGE_RETURN){
numBytes -= 1;
}
return new String(bytes, offset, numBytes, this.charsetName);
} | java | @Override
public String readRecord(String reusable, byte[] bytes, int offset, int numBytes) throws IOException {
//Check if \n is used as delimiter and the end of this line is a \r, then remove \r from the line
if (this.getDelimiter() != null && this.getDelimiter().length == 1
&& this.getDelimiter()[0] == NEW_LINE && offset + numBytes >= 1
&& bytes[offset + numBytes - 1] == CARRIAGE_RETURN){
numBytes -= 1;
}
return new String(bytes, offset, numBytes, this.charsetName);
} | [
"@",
"Override",
"public",
"String",
"readRecord",
"(",
"String",
"reusable",
",",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"int",
"numBytes",
")",
"throws",
"IOException",
"{",
"//Check if \\n is used as delimiter and the end of this line is a \\r, then re... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/io/TextInputFormat.java#L86-L96 | train | Read a record from the input stream. | [
30522,
1030,
2058,
15637,
2270,
5164,
3191,
2890,
27108,
2094,
1006,
5164,
2128,
10383,
3468,
1010,
24880,
1031,
1033,
27507,
1010,
20014,
16396,
1010,
20014,
15903,
17250,
2015,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
4638,
2065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/LevelDBProvider.java | LevelDBProvider.checkVersion | public static void checkVersion(DB db, StoreVersion newversion, ObjectMapper mapper) throws
IOException {
byte[] bytes = db.get(StoreVersion.KEY);
if (bytes == null) {
storeVersion(db, newversion, mapper);
} else {
StoreVersion version = mapper.readValue(bytes, StoreVersion.class);
if (version.major != newversion.major) {
throw new IOException("cannot read state DB with version " + version + ", incompatible " +
"with current version " + newversion);
}
storeVersion(db, newversion, mapper);
}
} | java | public static void checkVersion(DB db, StoreVersion newversion, ObjectMapper mapper) throws
IOException {
byte[] bytes = db.get(StoreVersion.KEY);
if (bytes == null) {
storeVersion(db, newversion, mapper);
} else {
StoreVersion version = mapper.readValue(bytes, StoreVersion.class);
if (version.major != newversion.major) {
throw new IOException("cannot read state DB with version " + version + ", incompatible " +
"with current version " + newversion);
}
storeVersion(db, newversion, mapper);
}
} | [
"public",
"static",
"void",
"checkVersion",
"(",
"DB",
"db",
",",
"StoreVersion",
"newversion",
",",
"ObjectMapper",
"mapper",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"db",
".",
"get",
"(",
"StoreVersion",
".",
"KEY",
")",
";",
... | Simple major.minor versioning scheme. Any incompatible changes should be across major
versions. Minor version differences are allowed -- meaning we should be able to read
dbs that are either earlier *or* later on the minor version. | [
"Simple",
"major",
".",
"minor",
"versioning",
"scheme",
".",
"Any",
"incompatible",
"changes",
"should",
"be",
"across",
"major",
"versions",
".",
"Minor",
"version",
"differences",
"are",
"allowed",
"--",
"meaning",
"we",
"should",
"be",
"able",
"to",
"read"... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/LevelDBProvider.java#L102-L115 | train | Check version of the state database. | [
30522,
2270,
10763,
11675,
4638,
27774,
1006,
16962,
16962,
1010,
3573,
27774,
2047,
27774,
1010,
4874,
2863,
18620,
4949,
4842,
1007,
11618,
22834,
10288,
24422,
1063,
24880,
1031,
1033,
27507,
1027,
16962,
1012,
2131,
1006,
3573,
27774,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.zip | public static File zip(String srcPath, String zipPath, boolean withSrcDir) throws UtilException {
return zip(srcPath, zipPath, DEFAULT_CHARSET, withSrcDir);
} | java | public static File zip(String srcPath, String zipPath, boolean withSrcDir) throws UtilException {
return zip(srcPath, zipPath, DEFAULT_CHARSET, withSrcDir);
} | [
"public",
"static",
"File",
"zip",
"(",
"String",
"srcPath",
",",
"String",
"zipPath",
",",
"boolean",
"withSrcDir",
")",
"throws",
"UtilException",
"{",
"return",
"zip",
"(",
"srcPath",
",",
"zipPath",
",",
"DEFAULT_CHARSET",
",",
"withSrcDir",
")",
";",
"}... | 对文件或文件目录进行压缩<br>
@param srcPath 要压缩的源文件路径。如果压缩一个文件,则为该文件的全路径;如果压缩一个目录,则为该目录的顶层目录路径
@param zipPath 压缩文件保存的路径,包括文件名。注意:zipPath不能是srcPath路径下的子文件夹
@param withSrcDir 是否包含被打包目录
@return 压缩文件
@throws UtilException IO异常 | [
"对文件或文件目录进行压缩<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L111-L113 | train | Creates a zip file from the given source and destination. | [
30522,
2270,
10763,
5371,
14101,
1006,
5164,
5034,
21906,
8988,
1010,
5164,
14101,
15069,
1010,
22017,
20898,
2007,
21338,
19797,
4313,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
2709,
14101,
1006,
5034,
21906,
8988,
1010,
14101,
15069,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.appendUtf8String | public static File appendUtf8String(String content, String path) throws IORuntimeException {
return appendString(content, path, CharsetUtil.CHARSET_UTF_8);
} | java | public static File appendUtf8String(String content, String path) throws IORuntimeException {
return appendString(content, path, CharsetUtil.CHARSET_UTF_8);
} | [
"public",
"static",
"File",
"appendUtf8String",
"(",
"String",
"content",
",",
"String",
"path",
")",
"throws",
"IORuntimeException",
"{",
"return",
"appendString",
"(",
"content",
",",
"path",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
")",
";",
"}"
] | 将String写入文件,UTF-8编码追加模式
@param content 写入的内容
@param path 文件路径
@return 写入的文件
@throws IORuntimeException IO异常
@since 3.1.2 | [
"将String写入文件,UTF",
"-",
"8编码追加模式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2774-L2776 | train | Append a UTF - 8 string to a file. | [
30522,
2270,
10763,
5371,
10439,
10497,
4904,
2546,
2620,
3367,
4892,
1006,
5164,
4180,
1010,
5164,
4130,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
10439,
10497,
3367,
4892,
1006,
4180,
1010,
4130,
1010,
25869,
13462,
21823,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityService.java | CloudFoundrySecurityService.fetchTokenKeys | public Map<String, String> fetchTokenKeys() {
try {
return extractTokenKeys(this.restTemplate
.getForObject(getUaaUrl() + "/token_keys", Map.class));
}
catch (HttpStatusCodeException ex) {
throw new CloudFoundryAuthorizationException(Reason.SERVICE_UNAVAILABLE,
"UAA not reachable");
}
} | java | public Map<String, String> fetchTokenKeys() {
try {
return extractTokenKeys(this.restTemplate
.getForObject(getUaaUrl() + "/token_keys", Map.class));
}
catch (HttpStatusCodeException ex) {
throw new CloudFoundryAuthorizationException(Reason.SERVICE_UNAVAILABLE,
"UAA not reachable");
}
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"fetchTokenKeys",
"(",
")",
"{",
"try",
"{",
"return",
"extractTokenKeys",
"(",
"this",
".",
"restTemplate",
".",
"getForObject",
"(",
"getUaaUrl",
"(",
")",
"+",
"\"/token_keys\"",
",",
"Map",
".",
"clas... | Return all token keys known by the UAA.
@return a list of token keys | [
"Return",
"all",
"token",
"keys",
"known",
"by",
"the",
"UAA",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundrySecurityService.java#L109-L118 | train | Fetch token keys from the UAA. | [
30522,
2270,
4949,
1026,
5164,
1010,
5164,
1028,
18584,
18715,
2368,
14839,
2015,
1006,
1007,
1063,
3046,
1063,
2709,
14817,
18715,
2368,
14839,
2015,
1006,
2023,
1012,
2717,
18532,
15725,
1012,
2131,
29278,
16429,
20614,
1006,
2131,
6692,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.removeEmpty | public static <T extends CharSequence> T[] removeEmpty(T[] array) {
return filter(array, new Filter<T>() {
@Override
public boolean accept(T t) {
return false == StrUtil.isEmpty(t);
}
});
} | java | public static <T extends CharSequence> T[] removeEmpty(T[] array) {
return filter(array, new Filter<T>() {
@Override
public boolean accept(T t) {
return false == StrUtil.isEmpty(t);
}
});
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"[",
"]",
"removeEmpty",
"(",
"T",
"[",
"]",
"array",
")",
"{",
"return",
"filter",
"(",
"array",
",",
"new",
"Filter",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boo... | 去除{@code null}或者"" 元素
@param array 数组
@return 处理后的数组
@since 3.2.2 | [
"去除",
"{",
"@code",
"null",
"}",
"或者",
"元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L798-L805 | train | Removes all empty elements from the array. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
1031,
1033,
6366,
6633,
13876,
2100,
1006,
1056,
1031,
1033,
9140,
1007,
1063,
2709,
11307,
1006,
9140,
1010,
2047,
11307,
1026,
1056,
1028,
1006,
1007,
1063,
1030,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/protobuf/ProtobufVarint32LengthFieldPrepender.java | ProtobufVarint32LengthFieldPrepender.writeRawVarint32 | static void writeRawVarint32(ByteBuf out, int value) {
while (true) {
if ((value & ~0x7F) == 0) {
out.writeByte(value);
return;
} else {
out.writeByte((value & 0x7F) | 0x80);
value >>>= 7;
}
}
} | java | static void writeRawVarint32(ByteBuf out, int value) {
while (true) {
if ((value & ~0x7F) == 0) {
out.writeByte(value);
return;
} else {
out.writeByte((value & 0x7F) | 0x80);
value >>>= 7;
}
}
} | [
"static",
"void",
"writeRawVarint32",
"(",
"ByteBuf",
"out",
",",
"int",
"value",
")",
"{",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"(",
"value",
"&",
"~",
"0x7F",
")",
"==",
"0",
")",
"{",
"out",
".",
"writeByte",
"(",
"value",
")",
";",
"ret... | Writes protobuf varint32 to (@link ByteBuf).
@param out to be written to
@param value to be written | [
"Writes",
"protobuf",
"varint32",
"to",
"("
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java#L58-L68 | train | Write raw varint 32. | [
30522,
10763,
11675,
3213,
10376,
10755,
18447,
16703,
1006,
24880,
8569,
2546,
2041,
1010,
20014,
3643,
1007,
1063,
2096,
1006,
2995,
1007,
1063,
2065,
1006,
1006,
3643,
1004,
1066,
1014,
2595,
2581,
2546,
1007,
1027,
1027,
1014,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/common/CommonDictionary.java | CommonDictionary.loadDat | protected boolean loadDat(ByteArray byteArray)
{
V[] valueArray = loadValueArray(byteArray);
if (valueArray == null)
{
return false;
}
return trie.load(byteArray.getBytes(), byteArray.getOffset(), valueArray);
} | java | protected boolean loadDat(ByteArray byteArray)
{
V[] valueArray = loadValueArray(byteArray);
if (valueArray == null)
{
return false;
}
return trie.load(byteArray.getBytes(), byteArray.getOffset(), valueArray);
} | [
"protected",
"boolean",
"loadDat",
"(",
"ByteArray",
"byteArray",
")",
"{",
"V",
"[",
"]",
"valueArray",
"=",
"loadValueArray",
"(",
"byteArray",
")",
";",
"if",
"(",
"valueArray",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"trie",
".... | 从dat路径加载
@param byteArray
@return | [
"从dat路径加载"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/common/CommonDictionary.java#L99-L107 | train | Load a single SECTYPE from the byte array. | [
30522,
5123,
22017,
20898,
7170,
2850,
2102,
1006,
24880,
2906,
9447,
24880,
2906,
9447,
1007,
1063,
1058,
1031,
1033,
3643,
2906,
9447,
1027,
7170,
10175,
5657,
2906,
9447,
1006,
24880,
2906,
9447,
1007,
1025,
2065,
1006,
3643,
2906,
9447,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/state/MapStateDescriptor.java | MapStateDescriptor.getKeySerializer | public TypeSerializer<UK> getKeySerializer() {
final TypeSerializer<Map<UK, UV>> rawSerializer = getSerializer();
if (!(rawSerializer instanceof MapSerializer)) {
throw new IllegalStateException("Unexpected serializer type.");
}
return ((MapSerializer<UK, UV>) rawSerializer).getKeySerializer();
} | java | public TypeSerializer<UK> getKeySerializer() {
final TypeSerializer<Map<UK, UV>> rawSerializer = getSerializer();
if (!(rawSerializer instanceof MapSerializer)) {
throw new IllegalStateException("Unexpected serializer type.");
}
return ((MapSerializer<UK, UV>) rawSerializer).getKeySerializer();
} | [
"public",
"TypeSerializer",
"<",
"UK",
">",
"getKeySerializer",
"(",
")",
"{",
"final",
"TypeSerializer",
"<",
"Map",
"<",
"UK",
",",
"UV",
">",
">",
"rawSerializer",
"=",
"getSerializer",
"(",
")",
";",
"if",
"(",
"!",
"(",
"rawSerializer",
"instanceof",
... | Gets the serializer for the keys in the state.
@return The serializer for the keys in the state. | [
"Gets",
"the",
"serializer",
"for",
"the",
"keys",
"in",
"the",
"state",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/state/MapStateDescriptor.java#L99-L106 | train | Get the key serializer. | [
30522,
2270,
4127,
11610,
28863,
1026,
2866,
1028,
2131,
14839,
8043,
4818,
17629,
1006,
1007,
1063,
2345,
4127,
11610,
28863,
1026,
4949,
1026,
2866,
1010,
23068,
1028,
1028,
6315,
8043,
4818,
17629,
1027,
4152,
11610,
28863,
1006,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/heartbeat/HeartbeatManagerImpl.java | HeartbeatManagerImpl.monitorTarget | @Override
public void monitorTarget(ResourceID resourceID, HeartbeatTarget<O> heartbeatTarget) {
if (!stopped) {
if (heartbeatTargets.containsKey(resourceID)) {
log.debug("The target with resource ID {} is already been monitored.", resourceID);
} else {
HeartbeatManagerImpl.HeartbeatMonitor<O> heartbeatMonitor = new HeartbeatManagerImpl.HeartbeatMonitor<>(
resourceID,
heartbeatTarget,
scheduledExecutor,
heartbeatListener,
heartbeatTimeoutIntervalMs);
heartbeatTargets.put(
resourceID,
heartbeatMonitor);
// check if we have stopped in the meantime (concurrent stop operation)
if (stopped) {
heartbeatMonitor.cancel();
heartbeatTargets.remove(resourceID);
}
}
}
} | java | @Override
public void monitorTarget(ResourceID resourceID, HeartbeatTarget<O> heartbeatTarget) {
if (!stopped) {
if (heartbeatTargets.containsKey(resourceID)) {
log.debug("The target with resource ID {} is already been monitored.", resourceID);
} else {
HeartbeatManagerImpl.HeartbeatMonitor<O> heartbeatMonitor = new HeartbeatManagerImpl.HeartbeatMonitor<>(
resourceID,
heartbeatTarget,
scheduledExecutor,
heartbeatListener,
heartbeatTimeoutIntervalMs);
heartbeatTargets.put(
resourceID,
heartbeatMonitor);
// check if we have stopped in the meantime (concurrent stop operation)
if (stopped) {
heartbeatMonitor.cancel();
heartbeatTargets.remove(resourceID);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"monitorTarget",
"(",
"ResourceID",
"resourceID",
",",
"HeartbeatTarget",
"<",
"O",
">",
"heartbeatTarget",
")",
"{",
"if",
"(",
"!",
"stopped",
")",
"{",
"if",
"(",
"heartbeatTargets",
".",
"containsKey",
"(",
"resourceID",
... | ---------------------------------------------------------------------------------------------- | [
"----------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/heartbeat/HeartbeatManagerImpl.java#L117-L142 | train | Monitor the target with the given resource ID. | [
30522,
1030,
2058,
15637,
2270,
11675,
8080,
7559,
18150,
1006,
7692,
3593,
7692,
3593,
1010,
12251,
7559,
18150,
1026,
1051,
1028,
12251,
7559,
18150,
1007,
1063,
2065,
1006,
999,
3030,
1007,
1063,
2065,
1006,
12251,
7559,
18150,
2015,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/plan/RelOptCluster.java | RelOptCluster.create | public static RelOptCluster create(RelOptPlanner planner,
RexBuilder rexBuilder) {
return new RelOptCluster(planner, rexBuilder.getTypeFactory(),
rexBuilder, new AtomicInteger(0), new HashMap<String, RelNode>());
} | java | public static RelOptCluster create(RelOptPlanner planner,
RexBuilder rexBuilder) {
return new RelOptCluster(planner, rexBuilder.getTypeFactory(),
rexBuilder, new AtomicInteger(0), new HashMap<String, RelNode>());
} | [
"public",
"static",
"RelOptCluster",
"create",
"(",
"RelOptPlanner",
"planner",
",",
"RexBuilder",
"rexBuilder",
")",
"{",
"return",
"new",
"RelOptCluster",
"(",
"planner",
",",
"rexBuilder",
".",
"getTypeFactory",
"(",
")",
",",
"rexBuilder",
",",
"new",
"Atomi... | Creates a cluster. | [
"Creates",
"a",
"cluster",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/plan/RelOptCluster.java#L99-L103 | train | Create a new cluster with the given planner and rex builder. | [
30522,
2270,
10763,
2128,
4135,
13876,
20464,
19966,
2121,
3443,
1006,
2128,
4135,
13876,
24759,
20147,
2099,
24555,
1010,
10151,
8569,
23891,
2099,
10151,
8569,
23891,
2099,
1007,
1063,
2709,
2047,
2128,
4135,
13876,
20464,
19966,
2121,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java | ExcelWriter.writeCellValue | public ExcelWriter writeCellValue(int x, int y, Object value) {
final Cell cell = getOrCreateCell(x, y);
CellUtil.setCellValue(cell, value, this.styleSet, false);
return this;
} | java | public ExcelWriter writeCellValue(int x, int y, Object value) {
final Cell cell = getOrCreateCell(x, y);
CellUtil.setCellValue(cell, value, this.styleSet, false);
return this;
} | [
"public",
"ExcelWriter",
"writeCellValue",
"(",
"int",
"x",
",",
"int",
"y",
",",
"Object",
"value",
")",
"{",
"final",
"Cell",
"cell",
"=",
"getOrCreateCell",
"(",
"x",
",",
"y",
")",
";",
"CellUtil",
".",
"setCellValue",
"(",
"cell",
",",
"value",
",... | 给指定单元格赋值,使用默认单元格样式
@param x X坐标,从0计数,既列号
@param y Y坐标,从0计数,既行号
@param value 值
@return this
@since 4.0.2 | [
"给指定单元格赋值,使用默认单元格样式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L751-L755 | train | Write a cell value. | [
30522,
2270,
24970,
15994,
4339,
29109,
22144,
7630,
2063,
1006,
20014,
1060,
1010,
20014,
1061,
1010,
4874,
3643,
1007,
1063,
2345,
3526,
3526,
1027,
2131,
2953,
16748,
3686,
29109,
2140,
1006,
1060,
1010,
1061,
1007,
1025,
3526,
21823,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlUtil.java | SqlUtil.toSqlTimestamp | public static java.sql.Timestamp toSqlTimestamp(java.util.Date date) {
return new java.sql.Timestamp(date.getTime());
} | java | public static java.sql.Timestamp toSqlTimestamp(java.util.Date date) {
return new java.sql.Timestamp(date.getTime());
} | [
"public",
"static",
"java",
".",
"sql",
".",
"Timestamp",
"toSqlTimestamp",
"(",
"java",
".",
"util",
".",
"Date",
"date",
")",
"{",
"return",
"new",
"java",
".",
"sql",
".",
"Timestamp",
"(",
"date",
".",
"getTime",
"(",
")",
")",
";",
"}"
] | 转换为{@link java.sql.Timestamp}
@param date {@link java.util.Date}
@return {@link java.sql.Timestamp}
@since 3.1.2 | [
"转换为",
"{",
"@link",
"java",
".",
"sql",
".",
"Timestamp",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlUtil.java#L203-L205 | train | Converts a java. util. Date to a java. sql. Timestamp. | [
30522,
2270,
10763,
9262,
1012,
29296,
1012,
2335,
15464,
2361,
2000,
2015,
4160,
7096,
14428,
9153,
8737,
1006,
9262,
1012,
21183,
4014,
1012,
3058,
3058,
1007,
1063,
2709,
2047,
9262,
1012,
29296,
1012,
2335,
15464,
2361,
1006,
3058,
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/executiongraph/ExecutionGraph.java | ExecutionGraph.allVerticesInTerminalState | private void allVerticesInTerminalState(long expectedGlobalVersionForRestart) {
assertRunningInJobMasterMainThread();
// we are done, transition to the final state
JobStatus current;
while (true) {
current = this.state;
if (current == JobStatus.RUNNING) {
failGlobal(new Exception("ExecutionGraph went into allVerticesInTerminalState() from RUNNING"));
}
else if (current == JobStatus.CANCELLING) {
if (transitionState(current, JobStatus.CANCELED)) {
onTerminalState(JobStatus.CANCELED);
break;
}
}
else if (current == JobStatus.FAILING) {
if (tryRestartOrFail(expectedGlobalVersionForRestart)) {
break;
}
// concurrent job status change, let's check again
}
else if (current.isGloballyTerminalState()) {
LOG.warn("Job has entered globally terminal state without waiting for all " +
"job vertices to reach final state.");
break;
}
else {
failGlobal(new Exception("ExecutionGraph went into final state from state " + current));
break;
}
}
// done transitioning the state
} | java | private void allVerticesInTerminalState(long expectedGlobalVersionForRestart) {
assertRunningInJobMasterMainThread();
// we are done, transition to the final state
JobStatus current;
while (true) {
current = this.state;
if (current == JobStatus.RUNNING) {
failGlobal(new Exception("ExecutionGraph went into allVerticesInTerminalState() from RUNNING"));
}
else if (current == JobStatus.CANCELLING) {
if (transitionState(current, JobStatus.CANCELED)) {
onTerminalState(JobStatus.CANCELED);
break;
}
}
else if (current == JobStatus.FAILING) {
if (tryRestartOrFail(expectedGlobalVersionForRestart)) {
break;
}
// concurrent job status change, let's check again
}
else if (current.isGloballyTerminalState()) {
LOG.warn("Job has entered globally terminal state without waiting for all " +
"job vertices to reach final state.");
break;
}
else {
failGlobal(new Exception("ExecutionGraph went into final state from state " + current));
break;
}
}
// done transitioning the state
} | [
"private",
"void",
"allVerticesInTerminalState",
"(",
"long",
"expectedGlobalVersionForRestart",
")",
"{",
"assertRunningInJobMasterMainThread",
"(",
")",
";",
"// we are done, transition to the final state",
"JobStatus",
"current",
";",
"while",
"(",
"true",
")",
"{",
"cur... | This method is a callback during cancellation/failover and called when all tasks
have reached a terminal state (cancelled/failed/finished). | [
"This",
"method",
"is",
"a",
"callback",
"during",
"cancellation",
"/",
"failover",
"and",
"called",
"when",
"all",
"tasks",
"have",
"reached",
"a",
"terminal",
"state",
"(",
"cancelled",
"/",
"failed",
"/",
"finished",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java#L1424-L1459 | train | This method is called by the job master thread to check if all vertices in the terminal state are in the final state. | [
30522,
2797,
11675,
2035,
16874,
23522,
18447,
2121,
22311,
4877,
12259,
1006,
2146,
3517,
23296,
16429,
2389,
27774,
29278,
28533,
8445,
1007,
1063,
20865,
15532,
5582,
2378,
5558,
25526,
24268,
24238,
2705,
16416,
2094,
1006,
1007,
1025,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.appendString | public static File appendString(String content, File file, String charset) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.charset(charset)).append(content);
} | java | public static File appendString(String content, File file, String charset) throws IORuntimeException {
return FileWriter.create(file, CharsetUtil.charset(charset)).append(content);
} | [
"public",
"static",
"File",
"appendString",
"(",
"String",
"content",
",",
"File",
"file",
",",
"String",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
"(",
"file",
",",
"CharsetUtil",
".",
"charset",
"(",
"charset... | 将String写入文件,追加模式
@param content 写入的内容
@param file 文件
@param charset 字符集
@return 写入的文件
@throws IORuntimeException IO异常 | [
"将String写入文件,追加模式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2826-L2828 | train | Append a string to a file. | [
30522,
2270,
10763,
5371,
10439,
10497,
30524,
1063,
2709,
5371,
15994,
1012,
3443,
1006,
5371,
1010,
25869,
13462,
21823,
2140,
1012,
25869,
13462,
1006,
25869,
13462,
1007,
1007,
1012,
10439,
10497,
1006,
4180,
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/incubator-shardingsphere | sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java | JDBCDriverURLRecognizerEngine.getDriverClassName | public static String getDriverClassName(final String url) {
for (Entry<String, String> entry : URL_PREFIX_AND_DRIVER_CLASS_NAME_MAPPER.entrySet()) {
if (url.startsWith(entry.getKey())) {
return entry.getValue();
}
}
throw new ShardingException("Cannot resolve JDBC url `%s`. Please implements `%s` and add to SPI.", url, JDBCDriverURLRecognizer.class.getName());
} | java | public static String getDriverClassName(final String url) {
for (Entry<String, String> entry : URL_PREFIX_AND_DRIVER_CLASS_NAME_MAPPER.entrySet()) {
if (url.startsWith(entry.getKey())) {
return entry.getValue();
}
}
throw new ShardingException("Cannot resolve JDBC url `%s`. Please implements `%s` and add to SPI.", url, JDBCDriverURLRecognizer.class.getName());
} | [
"public",
"static",
"String",
"getDriverClassName",
"(",
"final",
"String",
"url",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"URL_PREFIX_AND_DRIVER_CLASS_NAME_MAPPER",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"url... | Get JDBC driver class name.
@param url JDBC URL
@return driver class name | [
"Get",
"JDBC",
"driver",
"class",
"name",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java#L59-L66 | train | Get the driver class name for the JDBC url. | [
30522,
2270,
10763,
5164,
2131,
23663,
11890,
27102,
18442,
1006,
2345,
5164,
24471,
2140,
1007,
1063,
2005,
1006,
4443,
1026,
5164,
1010,
5164,
1028,
4443,
1024,
24471,
2140,
1035,
17576,
1035,
1998,
1035,
4062,
1035,
2465,
1035,
2171,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java | BinTrie.load | public boolean load(String path, V[] value)
{
byte[] bytes = IOUtil.readBytes(path);
if (bytes == null) return false;
_ValueArray valueArray = new _ValueArray(value);
ByteArray byteArray = new ByteArray(bytes);
for (int i = 0; i < child.length; ++i)
{
int flag = byteArray.nextInt();
if (flag == 1)
{
child[i] = new Node<V>();
child[i].walkToLoad(byteArray, valueArray);
}
}
size = value.length;
return true;
} | java | public boolean load(String path, V[] value)
{
byte[] bytes = IOUtil.readBytes(path);
if (bytes == null) return false;
_ValueArray valueArray = new _ValueArray(value);
ByteArray byteArray = new ByteArray(bytes);
for (int i = 0; i < child.length; ++i)
{
int flag = byteArray.nextInt();
if (flag == 1)
{
child[i] = new Node<V>();
child[i].walkToLoad(byteArray, valueArray);
}
}
size = value.length;
return true;
} | [
"public",
"boolean",
"load",
"(",
"String",
"path",
",",
"V",
"[",
"]",
"value",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"IOUtil",
".",
"readBytes",
"(",
"path",
")",
";",
"if",
"(",
"bytes",
"==",
"null",
")",
"return",
"false",
";",
"_ValueArra... | 从磁盘加载二分数组树
@param path 路径
@param value 额外提供的值数组,按照值的字典序。(之所以要求提供它,是因为泛型的保存不归树管理)
@return 是否成功 | [
"从磁盘加载二分数组树"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java#L412-L430 | train | Load a single SECTYPE from a file. | [
30522,
2270,
22017,
20898,
7170,
1006,
5164,
4130,
1010,
1058,
1031,
1033,
3643,
1007,
1063,
24880,
1031,
1033,
27507,
1027,
22834,
21823,
2140,
1012,
3191,
3762,
4570,
1006,
4130,
1007,
1025,
2065,
1006,
27507,
1027,
1027,
19701,
1007,
270... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java | ThriftCLIServiceClient.getOperationStatus | @Override
public OperationStatus getOperationStatus(OperationHandle opHandle) throws HiveSQLException {
try {
TGetOperationStatusReq req = new TGetOperationStatusReq(opHandle.toTOperationHandle());
TGetOperationStatusResp resp = cliService.GetOperationStatus(req);
// Checks the status of the RPC call, throws an exception in case of error
checkStatus(resp.getStatus());
OperationState opState = OperationState.getOperationState(resp.getOperationState());
HiveSQLException opException = null;
if (opState == OperationState.ERROR) {
opException = new HiveSQLException(resp.getErrorMessage(), resp.getSqlState(), resp.getErrorCode());
}
return new OperationStatus(opState, opException);
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | java | @Override
public OperationStatus getOperationStatus(OperationHandle opHandle) throws HiveSQLException {
try {
TGetOperationStatusReq req = new TGetOperationStatusReq(opHandle.toTOperationHandle());
TGetOperationStatusResp resp = cliService.GetOperationStatus(req);
// Checks the status of the RPC call, throws an exception in case of error
checkStatus(resp.getStatus());
OperationState opState = OperationState.getOperationState(resp.getOperationState());
HiveSQLException opException = null;
if (opState == OperationState.ERROR) {
opException = new HiveSQLException(resp.getErrorMessage(), resp.getSqlState(), resp.getErrorCode());
}
return new OperationStatus(opState, opException);
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | [
"@",
"Override",
"public",
"OperationStatus",
"getOperationStatus",
"(",
"OperationHandle",
"opHandle",
")",
"throws",
"HiveSQLException",
"{",
"try",
"{",
"TGetOperationStatusReq",
"req",
"=",
"new",
"TGetOperationStatusReq",
"(",
"opHandle",
".",
"toTOperationHandle",
... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#getOperationStatus(org.apache.hive.service.cli.OperationHandle) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java#L298-L316 | train | Get the OperationStatus for the given operation handle. | [
30522,
1030,
2058,
30524,
18150,
25918,
10708,
29336,
2271,
2890,
4160,
1006,
6728,
11774,
2571,
1012,
2000,
14399,
16754,
11774,
2571,
1006,
1007,
1007,
1025,
1056,
18150,
25918,
10708,
29336,
2271,
6072,
2361,
24501,
2361,
1027,
18856,
1728... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/bootstrap/ServerBootstrap.java | ServerBootstrap.group | public ServerBootstrap group(EventLoopGroup parentGroup, EventLoopGroup childGroup) {
super.group(parentGroup);
if (childGroup == null) {
throw new NullPointerException("childGroup");
}
if (this.childGroup != null) {
throw new IllegalStateException("childGroup set already");
}
this.childGroup = childGroup;
return this;
} | java | public ServerBootstrap group(EventLoopGroup parentGroup, EventLoopGroup childGroup) {
super.group(parentGroup);
if (childGroup == null) {
throw new NullPointerException("childGroup");
}
if (this.childGroup != null) {
throw new IllegalStateException("childGroup set already");
}
this.childGroup = childGroup;
return this;
} | [
"public",
"ServerBootstrap",
"group",
"(",
"EventLoopGroup",
"parentGroup",
",",
"EventLoopGroup",
"childGroup",
")",
"{",
"super",
".",
"group",
"(",
"parentGroup",
")",
";",
"if",
"(",
"childGroup",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException... | Set the {@link EventLoopGroup} for the parent (acceptor) and the child (client). These
{@link EventLoopGroup}'s are used to handle all the events and IO for {@link ServerChannel} and
{@link Channel}'s. | [
"Set",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/bootstrap/ServerBootstrap.java#L80-L90 | train | Sets the child group. | [
30522,
2270,
8241,
27927,
20528,
2361,
2177,
1006,
2724,
4135,
7361,
17058,
6687,
17058,
1010,
2724,
4135,
7361,
17058,
2775,
17058,
1007,
1063,
3565,
1012,
2177,
1006,
6687,
17058,
1007,
1025,
2065,
1006,
2775,
17058,
1027,
1027,
19701,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/common/Vertex.java | Vertex.newPersonInstance | public static Vertex newPersonInstance(String realWord, int frequency)
{
return new Vertex(Predefine.TAG_PEOPLE, realWord, new CoreDictionary.Attribute(Nature.nr, frequency));
} | java | public static Vertex newPersonInstance(String realWord, int frequency)
{
return new Vertex(Predefine.TAG_PEOPLE, realWord, new CoreDictionary.Attribute(Nature.nr, frequency));
} | [
"public",
"static",
"Vertex",
"newPersonInstance",
"(",
"String",
"realWord",
",",
"int",
"frequency",
")",
"{",
"return",
"new",
"Vertex",
"(",
"Predefine",
".",
"TAG_PEOPLE",
",",
"realWord",
",",
"new",
"CoreDictionary",
".",
"Attribute",
"(",
"Nature",
"."... | 创建一个人名实例
@param realWord
@param frequency
@return | [
"创建一个人名实例"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/Vertex.java#L409-L412 | train | Create a Person Vertex. | [
30522,
2270,
10763,
19449,
2047,
27576,
7076,
26897,
1006,
5164,
2613,
18351,
1010,
20014,
6075,
1007,
1063,
2709,
2047,
19449,
1006,
3653,
3207,
23460,
1012,
6415,
1035,
2111,
1010,
2613,
18351,
1010,
2047,
4563,
29201,
3258,
5649,
1012,
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-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonKeyedStream.java | PythonKeyedStream.time_window | public PythonWindowedStream time_window(Time size, Time slide) {
return new PythonWindowedStream<TimeWindow>(this.stream.timeWindow(size, slide));
} | java | public PythonWindowedStream time_window(Time size, Time slide) {
return new PythonWindowedStream<TimeWindow>(this.stream.timeWindow(size, slide));
} | [
"public",
"PythonWindowedStream",
"time_window",
"(",
"Time",
"size",
",",
"Time",
"slide",
")",
"{",
"return",
"new",
"PythonWindowedStream",
"<",
"TimeWindow",
">",
"(",
"this",
".",
"stream",
".",
"timeWindow",
"(",
"size",
",",
"slide",
")",
")",
";",
... | A thin wrapper layer over {@link KeyedStream#timeWindow(Time, Time)}.
@param size The size of the window.
@return The python wrapper {@link PythonWindowedStream} | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"KeyedStream#timeWindow",
"(",
"Time",
"Time",
")",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonKeyedStream.java#L74-L76 | train | Create a new time window stream. | [
30522,
2270,
18750,
11101,
15096,
21422,
2051,
1035,
3332,
1006,
2051,
2946,
1010,
2051,
7358,
1007,
1063,
2709,
2047,
18750,
11101,
15096,
21422,
1026,
2051,
11101,
5004,
1028,
1006,
2023,
1012,
5460,
1012,
2051,
11101,
5004,
1006,
2946,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java | CompositeByteBuf.addComponents | public CompositeByteBuf addComponents(boolean increaseWriterIndex, Iterable<ByteBuf> buffers) {
return addComponents(increaseWriterIndex, componentCount, buffers);
} | java | public CompositeByteBuf addComponents(boolean increaseWriterIndex, Iterable<ByteBuf> buffers) {
return addComponents(increaseWriterIndex, componentCount, buffers);
} | [
"public",
"CompositeByteBuf",
"addComponents",
"(",
"boolean",
"increaseWriterIndex",
",",
"Iterable",
"<",
"ByteBuf",
">",
"buffers",
")",
"{",
"return",
"addComponents",
"(",
"increaseWriterIndex",
",",
"componentCount",
",",
"buffers",
")",
";",
"}"
] | Add the given {@link ByteBuf}s and increase the {@code writerIndex} if {@code increaseWriterIndex} is
{@code true}.
{@link ByteBuf#release()} ownership of all {@link ByteBuf} objects in {@code buffers} is transferred to this
{@link CompositeByteBuf}.
@param buffers the {@link ByteBuf}s to add. {@link ByteBuf#release()} ownership of all {@link ByteBuf#release()}
ownership of all {@link ByteBuf} objects is transferred to this {@link CompositeByteBuf}. | [
"Add",
"the",
"given",
"{",
"@link",
"ByteBuf",
"}",
"s",
"and",
"increase",
"the",
"{",
"@code",
"writerIndex",
"}",
"if",
"{",
"@code",
"increaseWriterIndex",
"}",
"is",
"{",
"@code",
"true",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L250-L252 | train | Add a sequence of components to this composite buffer. | [
30522,
2270,
12490,
3762,
2618,
8569,
2546,
5587,
9006,
29513,
7666,
1006,
30524,
6906,
3468,
1026,
24880,
8569,
2546,
1028,
17698,
2015,
1007,
1063,
2709,
5587,
9006,
29513,
7666,
1006,
3623,
15994,
22254,
10288,
1010,
6922,
3597,
16671,
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-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/state/serialization/KvStateSerializer.java | KvStateSerializer.serializeMap | public static <UK, UV> byte[] serializeMap(Iterable<Map.Entry<UK, UV>> entries, TypeSerializer<UK> keySerializer, TypeSerializer<UV> valueSerializer) throws IOException {
if (entries != null) {
// Serialize
DataOutputSerializer dos = new DataOutputSerializer(32);
for (Map.Entry<UK, UV> entry : entries) {
keySerializer.serialize(entry.getKey(), dos);
if (entry.getValue() == null) {
dos.writeBoolean(true);
} else {
dos.writeBoolean(false);
valueSerializer.serialize(entry.getValue(), dos);
}
}
return dos.getCopyOfBuffer();
} else {
return null;
}
} | java | public static <UK, UV> byte[] serializeMap(Iterable<Map.Entry<UK, UV>> entries, TypeSerializer<UK> keySerializer, TypeSerializer<UV> valueSerializer) throws IOException {
if (entries != null) {
// Serialize
DataOutputSerializer dos = new DataOutputSerializer(32);
for (Map.Entry<UK, UV> entry : entries) {
keySerializer.serialize(entry.getKey(), dos);
if (entry.getValue() == null) {
dos.writeBoolean(true);
} else {
dos.writeBoolean(false);
valueSerializer.serialize(entry.getValue(), dos);
}
}
return dos.getCopyOfBuffer();
} else {
return null;
}
} | [
"public",
"static",
"<",
"UK",
",",
"UV",
">",
"byte",
"[",
"]",
"serializeMap",
"(",
"Iterable",
"<",
"Map",
".",
"Entry",
"<",
"UK",
",",
"UV",
">",
">",
"entries",
",",
"TypeSerializer",
"<",
"UK",
">",
"keySerializer",
",",
"TypeSerializer",
"<",
... | Serializes all values of the Iterable with the given serializer.
@param entries Key-value pairs to serialize
@param keySerializer Serializer for UK
@param valueSerializer Serializer for UV
@param <UK> Type of the keys
@param <UV> Type of the values
@return Serialized values or <code>null</code> if values <code>null</code> or empty
@throws IOException On failure during serialization | [
"Serializes",
"all",
"values",
"of",
"the",
"Iterable",
"with",
"the",
"given",
"serializer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/state/serialization/KvStateSerializer.java#L216-L236 | train | Serialize a collection of entries to a byte array. | [
30522,
2270,
10763,
1026,
2866,
1010,
23068,
1028,
24880,
1031,
1033,
7642,
4697,
2863,
2361,
1006,
2009,
6906,
3468,
1026,
4949,
1012,
4443,
1026,
2866,
1010,
23068,
1028,
1028,
10445,
1010,
4127,
11610,
28863,
1026,
2866,
1028,
6309,
1161... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java | RawConfigurationMetadata.resolveName | private void resolveName(ConfigurationMetadataItem item) {
item.setName(item.getId()); // fallback
ConfigurationMetadataSource source = getSource(item);
if (source != null) {
String groupId = source.getGroupId();
String dottedPrefix = groupId + ".";
String id = item.getId();
if (hasLength(groupId) && id.startsWith(dottedPrefix)) {
String name = id.substring(dottedPrefix.length());
item.setName(name);
}
}
} | java | private void resolveName(ConfigurationMetadataItem item) {
item.setName(item.getId()); // fallback
ConfigurationMetadataSource source = getSource(item);
if (source != null) {
String groupId = source.getGroupId();
String dottedPrefix = groupId + ".";
String id = item.getId();
if (hasLength(groupId) && id.startsWith(dottedPrefix)) {
String name = id.substring(dottedPrefix.length());
item.setName(name);
}
}
} | [
"private",
"void",
"resolveName",
"(",
"ConfigurationMetadataItem",
"item",
")",
"{",
"item",
".",
"setName",
"(",
"item",
".",
"getId",
"(",
")",
")",
";",
"// fallback",
"ConfigurationMetadataSource",
"source",
"=",
"getSource",
"(",
"item",
")",
";",
"if",
... | Resolve the name of an item against this instance.
@param item the item to resolve
@see ConfigurationMetadataProperty#setName(String) | [
"Resolve",
"the",
"name",
"of",
"an",
"item",
"against",
"this",
"instance",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata/src/main/java/org/springframework/boot/configurationmetadata/RawConfigurationMetadata.java#L77-L89 | train | Resolve the name of the item. | [
30522,
2797,
11675,
10663,
18442,
1006,
9563,
11368,
8447,
15444,
18532,
8875,
1007,
1063,
8875,
1012,
2275,
18442,
1006,
8875,
1012,
2131,
3593,
1006,
1007,
1007,
1025,
1013,
1013,
2991,
5963,
9563,
11368,
8447,
10230,
8162,
3401,
3120,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ModifierUtil.java | ModifierUtil.hasModifier | public static boolean hasModifier(Class<?> clazz, ModifierType... modifierTypes) {
if (null == clazz || ArrayUtil.isEmpty(modifierTypes)) {
return false;
}
return 0 != (clazz.getModifiers() & modifiersToInt(modifierTypes));
} | java | public static boolean hasModifier(Class<?> clazz, ModifierType... modifierTypes) {
if (null == clazz || ArrayUtil.isEmpty(modifierTypes)) {
return false;
}
return 0 != (clazz.getModifiers() & modifiersToInt(modifierTypes));
} | [
"public",
"static",
"boolean",
"hasModifier",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"ModifierType",
"...",
"modifierTypes",
")",
"{",
"if",
"(",
"null",
"==",
"clazz",
"||",
"ArrayUtil",
".",
"isEmpty",
"(",
"modifierTypes",
")",
")",
"{",
"return",
... | 是否同时存在一个或多个修饰符(可能有多个修饰符,如果有指定的修饰符则返回true)
@param clazz 类
@param modifierTypes 修饰符枚举
@return 是否有指定修饰符,如果有返回true,否则false,如果提供参数为null返回false | [
"是否同时存在一个或多个修饰符(可能有多个修饰符,如果有指定的修饰符则返回true)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ModifierUtil.java#L74-L79 | train | Checks if the given class has one of the given modifiers. | [
30522,
2270,
10763,
22017,
20898,
2038,
5302,
4305,
8873,
2121,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
16913,
18095,
13874,
1012,
1012,
1012,
16913,
18095,
13874,
2015,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
18856,
10936,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-memcache/src/main/java/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheEncoder.java | AbstractBinaryMemcacheEncoder.encodeExtras | private static void encodeExtras(ByteBuf buf, ByteBuf extras) {
if (extras == null || !extras.isReadable()) {
return;
}
buf.writeBytes(extras);
} | java | private static void encodeExtras(ByteBuf buf, ByteBuf extras) {
if (extras == null || !extras.isReadable()) {
return;
}
buf.writeBytes(extras);
} | [
"private",
"static",
"void",
"encodeExtras",
"(",
"ByteBuf",
"buf",
",",
"ByteBuf",
"extras",
")",
"{",
"if",
"(",
"extras",
"==",
"null",
"||",
"!",
"extras",
".",
"isReadable",
"(",
")",
")",
"{",
"return",
";",
"}",
"buf",
".",
"writeBytes",
"(",
... | Encode the extras.
@param buf the {@link ByteBuf} to write into.
@param extras the extras to encode. | [
"Encode",
"the",
"extras",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-memcache/src/main/java/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheEncoder.java#L54-L60 | train | Encode the extra data in the CRA - A tag. | [
30522,
2797,
10763,
11675,
4372,
16044,
10288,
6494,
2015,
1006,
24880,
8569,
2546,
20934,
2546,
1010,
24880,
8569,
2546,
26279,
1007,
1063,
2065,
1006,
26279,
1027,
1027,
19701,
1064,
1064,
999,
26279,
1012,
2003,
16416,
20782,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractInboundHttp2ToHttpAdapterBuilder.java | AbstractInboundHttp2ToHttpAdapterBuilder.build | protected T build() {
final T instance;
try {
instance = build(connection(), maxContentLength(),
isValidateHttpHeaders(), isPropagateSettings());
} catch (Throwable t) {
throw new IllegalStateException("failed to create a new InboundHttp2ToHttpAdapter", t);
}
connection.addListener(instance);
return instance;
} | java | protected T build() {
final T instance;
try {
instance = build(connection(), maxContentLength(),
isValidateHttpHeaders(), isPropagateSettings());
} catch (Throwable t) {
throw new IllegalStateException("failed to create a new InboundHttp2ToHttpAdapter", t);
}
connection.addListener(instance);
return instance;
} | [
"protected",
"T",
"build",
"(",
")",
"{",
"final",
"T",
"instance",
";",
"try",
"{",
"instance",
"=",
"build",
"(",
"connection",
"(",
")",
",",
"maxContentLength",
"(",
")",
",",
"isValidateHttpHeaders",
"(",
")",
",",
"isPropagateSettings",
"(",
")",
"... | Builds/creates a new {@link InboundHttp2ToHttpAdapter} instance using this builder's current settings. | [
"Builds",
"/",
"creates",
"a",
"new",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractInboundHttp2ToHttpAdapterBuilder.java#L119-L129 | train | Build the HTTP2ToHttpAdapter. | [
30522,
5123,
1056,
3857,
1006,
1007,
1063,
2345,
1056,
6013,
1025,
3046,
1063,
6013,
1027,
3857,
1006,
4434,
1006,
1007,
1010,
4098,
8663,
6528,
9286,
3070,
2705,
1006,
1007,
1010,
2003,
10175,
8524,
2618,
11039,
25856,
4974,
2545,
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-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java | EnvironmentInformation.getMaxJvmHeapMemory | public static long getMaxJvmHeapMemory() {
final long maxMemory = Runtime.getRuntime().maxMemory();
if (maxMemory != Long.MAX_VALUE) {
// we have the proper max memory
return maxMemory;
} else {
// max JVM heap size is not set - use the heuristic to use 1/4th of the physical memory
final long physicalMemory = Hardware.getSizeOfPhysicalMemory();
if (physicalMemory != -1) {
// got proper value for physical memory
return physicalMemory / 4;
} else {
throw new RuntimeException("Could not determine the amount of free memory.\n" +
"Please set the maximum memory for the JVM, e.g. -Xmx512M for 512 megabytes.");
}
}
} | java | public static long getMaxJvmHeapMemory() {
final long maxMemory = Runtime.getRuntime().maxMemory();
if (maxMemory != Long.MAX_VALUE) {
// we have the proper max memory
return maxMemory;
} else {
// max JVM heap size is not set - use the heuristic to use 1/4th of the physical memory
final long physicalMemory = Hardware.getSizeOfPhysicalMemory();
if (physicalMemory != -1) {
// got proper value for physical memory
return physicalMemory / 4;
} else {
throw new RuntimeException("Could not determine the amount of free memory.\n" +
"Please set the maximum memory for the JVM, e.g. -Xmx512M for 512 megabytes.");
}
}
} | [
"public",
"static",
"long",
"getMaxJvmHeapMemory",
"(",
")",
"{",
"final",
"long",
"maxMemory",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"maxMemory",
"(",
")",
";",
"if",
"(",
"maxMemory",
"!=",
"Long",
".",
"MAX_VALUE",
")",
"{",
"// we have the ... | The maximum JVM heap size, in bytes.
<p>This method uses the <i>-Xmx</i> value of the JVM, if set. If not set, it returns (as
a heuristic) 1/4th of the physical memory size.
@return The maximum JVM heap size, in bytes. | [
"The",
"maximum",
"JVM",
"heap",
"size",
"in",
"bytes",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java#L123-L139 | train | Get the maximum JVM heap size. | [
30522,
2270,
10763,
2146,
2131,
17848,
3501,
2615,
2213,
20192,
9737,
6633,
10253,
1006,
1007,
1063,
2345,
2146,
4098,
4168,
5302,
2854,
1027,
2448,
7292,
1012,
2131,
15532,
7292,
1006,
1007,
1012,
4098,
4168,
5302,
2854,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java | AbstractLauncher.setAppName | public T setAppName(String appName) {
checkNotNull(appName, "appName");
builder.appName = appName;
return self();
} | java | public T setAppName(String appName) {
checkNotNull(appName, "appName");
builder.appName = appName;
return self();
} | [
"public",
"T",
"setAppName",
"(",
"String",
"appName",
")",
"{",
"checkNotNull",
"(",
"appName",
",",
"\"appName\"",
")",
";",
"builder",
".",
"appName",
"=",
"appName",
";",
"return",
"self",
"(",
")",
";",
"}"
] | Set the application name.
@param appName Application name.
@return This launcher. | [
"Set",
"the",
"application",
"name",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java#L72-L76 | train | Sets the name of the application. | [
30522,
2270,
1056,
2275,
29098,
18442,
1006,
5164,
10439,
18442,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
10439,
18442,
1010,
1000,
10439,
18442,
1000,
1007,
1025,
12508,
1012,
10439,
18442,
1027,
10439,
18442,
1025,
2709,
2969,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayload.java | HttpTunnelPayload.getPayloadData | public static ByteBuffer getPayloadData(ReadableByteChannel channel)
throws IOException {
ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE);
try {
int amountRead = channel.read(buffer);
Assert.state(amountRead != -1, "Target server connection closed");
buffer.flip();
return buffer;
}
catch (InterruptedIOException ex) {
return null;
}
} | java | public static ByteBuffer getPayloadData(ReadableByteChannel channel)
throws IOException {
ByteBuffer buffer = ByteBuffer.allocate(BUFFER_SIZE);
try {
int amountRead = channel.read(buffer);
Assert.state(amountRead != -1, "Target server connection closed");
buffer.flip();
return buffer;
}
catch (InterruptedIOException ex) {
return null;
}
} | [
"public",
"static",
"ByteBuffer",
"getPayloadData",
"(",
"ReadableByteChannel",
"channel",
")",
"throws",
"IOException",
"{",
"ByteBuffer",
"buffer",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"BUFFER_SIZE",
")",
";",
"try",
"{",
"int",
"amountRead",
"=",
"channel",... | Return the payload data for the given source {@link ReadableByteChannel} or null if
the channel timed out whilst reading.
@param channel the source channel
@return payload data or {@code null}
@throws IOException in case of I/O errors | [
"Return",
"the",
"payload",
"data",
"for",
"the",
"given",
"source",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayload.java#L137-L149 | train | Reads the payload data from the given channel. | [
30522,
2270,
10763,
24880,
8569,
12494,
2131,
4502,
8516,
10441,
25062,
2696,
1006,
3191,
3085,
3762,
15007,
20147,
2140,
3149,
1007,
11618,
22834,
10288,
24422,
1063,
24880,
8569,
12494,
17698,
1027,
24880,
8569,
12494,
1012,
2035,
24755,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.getDouble | @PublicEvolving
public double getDouble(ConfigOption<Double> configOption) {
Object o = getValueOrDefaultFromOption(configOption);
return convertToDouble(o, configOption.defaultValue());
} | java | @PublicEvolving
public double getDouble(ConfigOption<Double> configOption) {
Object o = getValueOrDefaultFromOption(configOption);
return convertToDouble(o, configOption.defaultValue());
} | [
"@",
"PublicEvolving",
"public",
"double",
"getDouble",
"(",
"ConfigOption",
"<",
"Double",
">",
"configOption",
")",
"{",
"Object",
"o",
"=",
"getValueOrDefaultFromOption",
"(",
"configOption",
")",
";",
"return",
"convertToDouble",
"(",
"o",
",",
"configOption",... | Returns the value associated with the given config option as a {@code double}.
@param configOption The configuration option
@return the (default) value associated with the given config option | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"config",
"option",
"as",
"a",
"{",
"@code",
"double",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L515-L519 | train | Returns the value mapped by the given config option as a double. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
3313,
2131,
26797,
3468,
1006,
9530,
8873,
3995,
16790,
1026,
3313,
1028,
9530,
8873,
3995,
16790,
1007,
1063,
4874,
1051,
1027,
2131,
10175,
5657,
8551,
12879,
23505,
19699,
19506,
16790,
1006,
95... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.fromYAML | public static Map<String, ? extends CacheConfig> fromYAML(Reader reader) throws IOException {
return new CacheConfigSupport().fromYAML(reader);
} | java | public static Map<String, ? extends CacheConfig> fromYAML(Reader reader) throws IOException {
return new CacheConfigSupport().fromYAML(reader);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"?",
"extends",
"CacheConfig",
">",
"fromYAML",
"(",
"Reader",
"reader",
")",
"throws",
"IOException",
"{",
"return",
"new",
"CacheConfigSupport",
"(",
")",
".",
"fromYAML",
"(",
"reader",
")",
";",
"}"
] | Read config objects stored in YAML format from <code>Reader</code>
@param reader of config
@return config
@throws IOException error | [
"Read",
"config",
"objects",
"stored",
"in",
"YAML",
"format",
"from",
"<code",
">",
"Reader<",
"/",
"code",
">"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/spring/cache/CacheConfig.java#L223-L225 | train | Creates a map from a YAML file. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
1029,
8908,
17053,
8663,
8873,
2290,
1028,
2013,
14852,
2140,
1006,
8068,
8068,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
2047,
17053,
8663,
8873,
5620,
6279,
6442,
1006,
1007,
1012,
2013,
148... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | metrics/src/main/java/io/dropwizard/metrics/MetricRegistry.java | MetricRegistry.name | public static MetricName name(String name, String... names) {
final int length;
if (names == null) {
length = 0;
} else {
length = names.length;
}
final String[] parts = new String[length + 1];
parts[0] = name;
System.arraycopy(names, 0, parts, 1, length);
return MetricName.build(parts);
} | java | public static MetricName name(String name, String... names) {
final int length;
if (names == null) {
length = 0;
} else {
length = names.length;
}
final String[] parts = new String[length + 1];
parts[0] = name;
System.arraycopy(names, 0, parts, 1, length);
return MetricName.build(parts);
} | [
"public",
"static",
"MetricName",
"name",
"(",
"String",
"name",
",",
"String",
"...",
"names",
")",
"{",
"final",
"int",
"length",
";",
"if",
"(",
"names",
"==",
"null",
")",
"{",
"length",
"=",
"0",
";",
"}",
"else",
"{",
"length",
"=",
"names",
... | Shorthand method for backwards compatibility in creating metric names.
Uses {@link MetricName#build(String...)} for its
heavy lifting.
@see MetricName#build(String...)
@param name The first element of the name
@param names The remaining elements of the name
@return A metric name matching the specified components. | [
"Shorthand",
"method",
"for",
"backwards",
"compatibility",
"in",
"creating",
"metric",
"names",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/MetricRegistry.java#L62-L77 | train | Create a metric name from a name and a list of names. | [
30522,
2270,
10763,
12046,
18442,
2171,
1006,
5164,
2171,
1010,
5164,
1012,
1012,
1012,
3415,
1007,
1063,
2345,
20014,
3091,
1025,
2065,
1006,
3415,
1027,
1027,
19701,
1007,
1063,
3091,
1027,
1014,
1025,
1065,
2842,
1063,
3091,
1027,
3415,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/qrcode/QrCodeUtil.java | QrCodeUtil.encode | public static BitMatrix encode(String content, BarcodeFormat format, QrConfig config) {
final MultiFormatWriter multiFormatWriter = new MultiFormatWriter();
if (null == config) {
// 默认配置
config = new QrConfig();
}
BitMatrix bitMatrix;
try {
bitMatrix = multiFormatWriter.encode(content, format, config.width, config.height, config.toHints());
} catch (WriterException e) {
throw new QrCodeException(e);
}
return bitMatrix;
} | java | public static BitMatrix encode(String content, BarcodeFormat format, QrConfig config) {
final MultiFormatWriter multiFormatWriter = new MultiFormatWriter();
if (null == config) {
// 默认配置
config = new QrConfig();
}
BitMatrix bitMatrix;
try {
bitMatrix = multiFormatWriter.encode(content, format, config.width, config.height, config.toHints());
} catch (WriterException e) {
throw new QrCodeException(e);
}
return bitMatrix;
} | [
"public",
"static",
"BitMatrix",
"encode",
"(",
"String",
"content",
",",
"BarcodeFormat",
"format",
",",
"QrConfig",
"config",
")",
"{",
"final",
"MultiFormatWriter",
"multiFormatWriter",
"=",
"new",
"MultiFormatWriter",
"(",
")",
";",
"if",
"(",
"null",
"==",
... | 将文本内容编码为条形码或二维码
@param content 文本内容
@param format 格式枚举
@param config 二维码配置,包括长、宽、边距、颜色等
@return {@link BitMatrix}
@since 4.1.2 | [
"将文本内容编码为条形码或二维码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L247-L261 | train | Encode a string with the specified format and QrConfig. | [
30522,
2270,
10763,
2978,
18900,
17682,
4372,
16044,
1006,
5164,
4180,
1010,
3347,
16044,
14192,
4017,
4289,
1010,
1053,
29566,
2078,
8873,
2290,
9530,
8873,
2290,
1007,
1063,
2345,
4800,
14192,
4017,
15994,
4800,
14192,
4017,
15994,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/CoalescingBufferQueue.java | CoalescingBufferQueue.remove | public ByteBuf remove(int bytes, ChannelPromise aggregatePromise) {
return remove(channel.alloc(), bytes, aggregatePromise);
} | java | public ByteBuf remove(int bytes, ChannelPromise aggregatePromise) {
return remove(channel.alloc(), bytes, aggregatePromise);
} | [
"public",
"ByteBuf",
"remove",
"(",
"int",
"bytes",
",",
"ChannelPromise",
"aggregatePromise",
")",
"{",
"return",
"remove",
"(",
"channel",
".",
"alloc",
"(",
")",
",",
"bytes",
",",
"aggregatePromise",
")",
";",
"}"
] | Remove a {@link ByteBuf} from the queue with the specified number of bytes. Any added buffer who's bytes are
fully consumed during removal will have it's promise completed when the passed aggregate {@link ChannelPromise}
completes.
@param bytes the maximum number of readable bytes in the returned {@link ByteBuf}, if {@code bytes} is greater
than {@link #readableBytes} then a buffer of length {@link #readableBytes} is returned.
@param aggregatePromise used to aggregate the promises and listeners for the constituent buffers.
@return a {@link ByteBuf} composed of the enqueued buffers. | [
"Remove",
"a",
"{",
"@link",
"ByteBuf",
"}",
"from",
"the",
"queue",
"with",
"the",
"specified",
"number",
"of",
"bytes",
".",
"Any",
"added",
"buffer",
"who",
"s",
"bytes",
"are",
"fully",
"consumed",
"during",
"removal",
"will",
"have",
"it",
"s",
"pro... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/CoalescingBufferQueue.java#L62-L64 | train | Remove a chunk of bytes from the cache. | [
30522,
2270,
24880,
8569,
2546,
6366,
1006,
20014,
27507,
1010,
3149,
21572,
28732,
9572,
21572,
28732,
1007,
1063,
2709,
6366,
1006,
3149,
1012,
2035,
10085,
1006,
1007,
1010,
27507,
1010,
9572,
21572,
28732,
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-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.getFloat | @PublicEvolving
public float getFloat(ConfigOption<Float> configOption) {
Object o = getValueOrDefaultFromOption(configOption);
return convertToFloat(o, configOption.defaultValue());
} | java | @PublicEvolving
public float getFloat(ConfigOption<Float> configOption) {
Object o = getValueOrDefaultFromOption(configOption);
return convertToFloat(o, configOption.defaultValue());
} | [
"@",
"PublicEvolving",
"public",
"float",
"getFloat",
"(",
"ConfigOption",
"<",
"Float",
">",
"configOption",
")",
"{",
"Object",
"o",
"=",
"getValueOrDefaultFromOption",
"(",
"configOption",
")",
";",
"return",
"convertToFloat",
"(",
"o",
",",
"configOption",
"... | Returns the value associated with the given config option as a float.
@param configOption The configuration option
@return the (default) value associated with the given config option | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"config",
"option",
"as",
"a",
"float",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L441-L445 | train | Returns the value mapped by the given config option as a float. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
14257,
2131,
10258,
16503,
1006,
9530,
8873,
3995,
16790,
1026,
14257,
1028,
9530,
8873,
3995,
16790,
1007,
1063,
4874,
1051,
1027,
2131,
10175,
5657,
8551,
12879,
23505,
19699,
19506,
16790,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java | CustomDictionary.contains | public static boolean contains(String key)
{
if (dat.exactMatchSearch(key) >= 0) return true;
return trie != null && trie.containsKey(key);
} | java | public static boolean contains(String key)
{
if (dat.exactMatchSearch(key) >= 0) return true;
return trie != null && trie.containsKey(key);
} | [
"public",
"static",
"boolean",
"contains",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"dat",
".",
"exactMatchSearch",
"(",
"key",
")",
">=",
"0",
")",
"return",
"true",
";",
"return",
"trie",
"!=",
"null",
"&&",
"trie",
".",
"containsKey",
"(",
"key",
... | 词典中是否含有词语
@param key 词语
@return 是否包含 | [
"词典中是否含有词语"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L481-L485 | train | Check if a key is in the cache. | [
30522,
2270,
10763,
22017,
20898,
3397,
1006,
5164,
3145,
1007,
1063,
2065,
1006,
23755,
1012,
6635,
18900,
18069,
14644,
2818,
1006,
3145,
1007,
1028,
1027,
1014,
1007,
2709,
2995,
1025,
2709,
13012,
2063,
999,
1027,
19701,
1004,
1004,
130... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.lookupNameCompletionHints | public final void lookupNameCompletionHints(
SqlValidatorScope scope,
List<String> names,
SqlParserPos pos,
Collection<SqlMoniker> hintList) {
// Remove the last part of name - it is a dummy
List<String> subNames = Util.skipLast(names);
if (subNames.size() > 0) {
// If there's a prefix, resolve it to a namespace.
SqlValidatorNamespace ns = null;
for (String name : subNames) {
if (ns == null) {
final SqlValidatorScope.ResolvedImpl resolved =
new SqlValidatorScope.ResolvedImpl();
final SqlNameMatcher nameMatcher = catalogReader.nameMatcher();
scope.resolve(ImmutableList.of(name), nameMatcher, false, resolved);
if (resolved.count() == 1) {
ns = resolved.only().namespace;
}
} else {
ns = ns.lookupChild(name);
}
if (ns == null) {
break;
}
}
if (ns != null) {
RelDataType rowType = ns.getRowType();
if (rowType.isStruct()) {
for (RelDataTypeField field : rowType.getFieldList()) {
hintList.add(
new SqlMonikerImpl(
field.getName(),
SqlMonikerType.COLUMN));
}
}
}
// builtin function names are valid completion hints when the
// identifier has only 1 name part
findAllValidFunctionNames(names, this, hintList, pos);
} else {
// No prefix; use the children of the current scope (that is,
// the aliases in the FROM clause)
scope.findAliases(hintList);
// If there's only one alias, add all child columns
SelectScope selectScope =
SqlValidatorUtil.getEnclosingSelectScope(scope);
if ((selectScope != null)
&& (selectScope.getChildren().size() == 1)) {
RelDataType rowType =
selectScope.getChildren().get(0).getRowType();
for (RelDataTypeField field : rowType.getFieldList()) {
hintList.add(
new SqlMonikerImpl(
field.getName(),
SqlMonikerType.COLUMN));
}
}
}
findAllValidUdfNames(names, this, hintList);
} | java | public final void lookupNameCompletionHints(
SqlValidatorScope scope,
List<String> names,
SqlParserPos pos,
Collection<SqlMoniker> hintList) {
// Remove the last part of name - it is a dummy
List<String> subNames = Util.skipLast(names);
if (subNames.size() > 0) {
// If there's a prefix, resolve it to a namespace.
SqlValidatorNamespace ns = null;
for (String name : subNames) {
if (ns == null) {
final SqlValidatorScope.ResolvedImpl resolved =
new SqlValidatorScope.ResolvedImpl();
final SqlNameMatcher nameMatcher = catalogReader.nameMatcher();
scope.resolve(ImmutableList.of(name), nameMatcher, false, resolved);
if (resolved.count() == 1) {
ns = resolved.only().namespace;
}
} else {
ns = ns.lookupChild(name);
}
if (ns == null) {
break;
}
}
if (ns != null) {
RelDataType rowType = ns.getRowType();
if (rowType.isStruct()) {
for (RelDataTypeField field : rowType.getFieldList()) {
hintList.add(
new SqlMonikerImpl(
field.getName(),
SqlMonikerType.COLUMN));
}
}
}
// builtin function names are valid completion hints when the
// identifier has only 1 name part
findAllValidFunctionNames(names, this, hintList, pos);
} else {
// No prefix; use the children of the current scope (that is,
// the aliases in the FROM clause)
scope.findAliases(hintList);
// If there's only one alias, add all child columns
SelectScope selectScope =
SqlValidatorUtil.getEnclosingSelectScope(scope);
if ((selectScope != null)
&& (selectScope.getChildren().size() == 1)) {
RelDataType rowType =
selectScope.getChildren().get(0).getRowType();
for (RelDataTypeField field : rowType.getFieldList()) {
hintList.add(
new SqlMonikerImpl(
field.getName(),
SqlMonikerType.COLUMN));
}
}
}
findAllValidUdfNames(names, this, hintList);
} | [
"public",
"final",
"void",
"lookupNameCompletionHints",
"(",
"SqlValidatorScope",
"scope",
",",
"List",
"<",
"String",
">",
"names",
",",
"SqlParserPos",
"pos",
",",
"Collection",
"<",
"SqlMoniker",
">",
"hintList",
")",
"{",
"// Remove the last part of name - it is a... | Populates a list of all the valid alternatives for an identifier.
@param scope Validation scope
@param names Components of the identifier
@param pos position
@param hintList a list of valid options | [
"Populates",
"a",
"list",
"of",
"all",
"the",
"valid",
"alternatives",
"for",
"an",
"identifier",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L789-L853 | train | Lookup name completion hints. | [
30522,
2270,
2345,
11675,
2298,
6279,
18442,
9006,
10814,
3508,
10606,
3215,
1006,
29296,
10175,
8524,
6591,
16186,
9531,
1010,
2862,
1026,
5164,
1028,
3415,
1010,
29296,
19362,
8043,
6873,
2015,
13433,
2015,
1010,
3074,
1026,
29296,
8202,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ConstantPool.java | ConstantPool.createOrThrow | private T createOrThrow(String name) {
T constant = constants.get(name);
if (constant == null) {
final T tempConstant = newConstant(nextId(), name);
constant = constants.putIfAbsent(name, tempConstant);
if (constant == null) {
return tempConstant;
}
}
throw new IllegalArgumentException(String.format("'%s' is already in use", name));
} | java | private T createOrThrow(String name) {
T constant = constants.get(name);
if (constant == null) {
final T tempConstant = newConstant(nextId(), name);
constant = constants.putIfAbsent(name, tempConstant);
if (constant == null) {
return tempConstant;
}
}
throw new IllegalArgumentException(String.format("'%s' is already in use", name));
} | [
"private",
"T",
"createOrThrow",
"(",
"String",
"name",
")",
"{",
"T",
"constant",
"=",
"constants",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"constant",
"==",
"null",
")",
"{",
"final",
"T",
"tempConstant",
"=",
"newConstant",
"(",
"nextId",
"(",... | Creates constant by name or throws exception. Threadsafe
@param name the name of the {@link Constant} | [
"Creates",
"constant",
"by",
"name",
"or",
"throws",
"exception",
".",
"Threadsafe"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ConstantPool.java#L103-L114 | train | Creates or returns a new instance of the class with the given name. | [
30522,
2797,
1056,
3443,
28610,
10524,
1006,
5164,
2171,
1007,
1063,
1056,
5377,
1027,
5377,
2015,
1012,
2131,
1006,
2171,
1007,
1025,
2065,
1006,
5377,
1027,
1027,
19701,
1007,
1063,
2345,
1056,
8915,
8737,
8663,
12693,
2102,
1027,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.readTextFile | public DataStreamSource<String> readTextFile(String filePath, String charsetName) {
Preconditions.checkArgument(!StringUtils.isNullOrWhitespaceOnly(filePath), "The file path must not be null or blank.");
TextInputFormat format = new TextInputFormat(new Path(filePath));
format.setFilesFilter(FilePathFilter.createDefaultFilter());
TypeInformation<String> typeInfo = BasicTypeInfo.STRING_TYPE_INFO;
format.setCharsetName(charsetName);
return readFile(format, filePath, FileProcessingMode.PROCESS_ONCE, -1, typeInfo);
} | java | public DataStreamSource<String> readTextFile(String filePath, String charsetName) {
Preconditions.checkArgument(!StringUtils.isNullOrWhitespaceOnly(filePath), "The file path must not be null or blank.");
TextInputFormat format = new TextInputFormat(new Path(filePath));
format.setFilesFilter(FilePathFilter.createDefaultFilter());
TypeInformation<String> typeInfo = BasicTypeInfo.STRING_TYPE_INFO;
format.setCharsetName(charsetName);
return readFile(format, filePath, FileProcessingMode.PROCESS_ONCE, -1, typeInfo);
} | [
"public",
"DataStreamSource",
"<",
"String",
">",
"readTextFile",
"(",
"String",
"filePath",
",",
"String",
"charsetName",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"!",
"StringUtils",
".",
"isNullOrWhitespaceOnly",
"(",
"filePath",
")",
",",
"\"The fi... | Reads the given file line-by-line and creates a data stream that contains a string with the
contents of each such line. The {@link java.nio.charset.Charset} with the given name will be
used to read the files.
<p><b>NOTES ON CHECKPOINTING: </b> The source monitors the path, creates the
{@link org.apache.flink.core.fs.FileInputSplit FileInputSplits} to be processed,
forwards them to the downstream {@link ContinuousFileReaderOperator readers} to read the actual data,
and exits, without waiting for the readers to finish reading. This implies that no more checkpoint
barriers are going to be forwarded after the source exits, thus having no checkpoints after that point.
@param filePath
The path of the file, as a URI (e.g., "file:///some/local/file" or "hdfs://host:port/file/path")
@param charsetName
The name of the character set used to read the file
@return The data stream that represents the data read from the given file as text lines | [
"Reads",
"the",
"given",
"file",
"line",
"-",
"by",
"-",
"line",
"and",
"creates",
"a",
"data",
"stream",
"that",
"contains",
"a",
"string",
"with",
"the",
"contents",
"of",
"each",
"such",
"line",
".",
"The",
"{",
"@link",
"java",
".",
"nio",
".",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L959-L968 | train | Reads a text file from the given file path. | [
30522,
2270,
2951,
21422,
6499,
3126,
3401,
1026,
5164,
1028,
3191,
18209,
8873,
2571,
1006,
5164,
5371,
15069,
1010,
5164,
25869,
13462,
18442,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
999,
5164,
21823,
487... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.ack | @Override
public void ack(ClientIdentity clientIdentity, long batchId) throws CanalServerException {
checkStart(clientIdentity.getDestination());
checkSubscribe(clientIdentity);
CanalInstance canalInstance = canalInstances.get(clientIdentity.getDestination());
PositionRange<LogPosition> positionRanges = null;
positionRanges = canalInstance.getMetaManager().removeBatch(clientIdentity, batchId); // 更新位置
if (positionRanges == null) { // 说明是重复的ack/rollback
throw new CanalServerException(String.format("ack error , clientId:%s batchId:%d is not exist , please check",
clientIdentity.getClientId(),
batchId));
}
// 更新cursor最好严格判断下位置是否有跳跃更新
// Position position = lastRollbackPostions.get(clientIdentity);
// if (position != null) {
// // Position position =
// canalInstance.getMetaManager().getCursor(clientIdentity);
// LogPosition minPosition =
// CanalEventUtils.min(positionRanges.getStart(), (LogPosition)
// position);
// if (minPosition == position) {// ack的position要晚于该最后ack的位置,可能有丢数据
// throw new CanalServerException(
// String.format(
// "ack error , clientId:%s batchId:%d %s is jump ack , last ack:%s",
// clientIdentity.getClientId(), batchId, positionRanges,
// position));
// }
// }
// 更新cursor
if (positionRanges.getAck() != null) {
canalInstance.getMetaManager().updateCursor(clientIdentity, positionRanges.getAck());
if (logger.isInfoEnabled()) {
logger.info("ack successfully, clientId:{} batchId:{} position:{}",
clientIdentity.getClientId(),
batchId,
positionRanges);
}
}
// 可定时清理数据
canalInstance.getEventStore().ack(positionRanges.getEnd());
} | java | @Override
public void ack(ClientIdentity clientIdentity, long batchId) throws CanalServerException {
checkStart(clientIdentity.getDestination());
checkSubscribe(clientIdentity);
CanalInstance canalInstance = canalInstances.get(clientIdentity.getDestination());
PositionRange<LogPosition> positionRanges = null;
positionRanges = canalInstance.getMetaManager().removeBatch(clientIdentity, batchId); // 更新位置
if (positionRanges == null) { // 说明是重复的ack/rollback
throw new CanalServerException(String.format("ack error , clientId:%s batchId:%d is not exist , please check",
clientIdentity.getClientId(),
batchId));
}
// 更新cursor最好严格判断下位置是否有跳跃更新
// Position position = lastRollbackPostions.get(clientIdentity);
// if (position != null) {
// // Position position =
// canalInstance.getMetaManager().getCursor(clientIdentity);
// LogPosition minPosition =
// CanalEventUtils.min(positionRanges.getStart(), (LogPosition)
// position);
// if (minPosition == position) {// ack的position要晚于该最后ack的位置,可能有丢数据
// throw new CanalServerException(
// String.format(
// "ack error , clientId:%s batchId:%d %s is jump ack , last ack:%s",
// clientIdentity.getClientId(), batchId, positionRanges,
// position));
// }
// }
// 更新cursor
if (positionRanges.getAck() != null) {
canalInstance.getMetaManager().updateCursor(clientIdentity, positionRanges.getAck());
if (logger.isInfoEnabled()) {
logger.info("ack successfully, clientId:{} batchId:{} position:{}",
clientIdentity.getClientId(),
batchId,
positionRanges);
}
}
// 可定时清理数据
canalInstance.getEventStore().ack(positionRanges.getEnd());
} | [
"@",
"Override",
"public",
"void",
"ack",
"(",
"ClientIdentity",
"clientIdentity",
",",
"long",
"batchId",
")",
"throws",
"CanalServerException",
"{",
"checkStart",
"(",
"clientIdentity",
".",
"getDestination",
"(",
")",
")",
";",
"checkSubscribe",
"(",
"clientIde... | 进行 batch id 的确认。确认之后,小于等于此 batchId 的 Message 都会被确认。
<pre>
注意:进行反馈时必须按照batchId的顺序进行ack(需有客户端保证)
</pre> | [
"进行",
"batch",
"id",
"的确认。确认之后,小于等于此",
"batchId",
"的",
"Message",
"都会被确认。"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java#L392-L437 | train | Ack the specified batch. | [
30522,
1030,
2058,
15637,
2270,
11675,
9353,
2243,
1006,
7396,
5178,
16778,
3723,
7396,
5178,
16778,
3723,
1010,
2146,
14108,
3593,
1007,
11618,
17263,
2121,
28943,
2595,
24422,
1063,
14148,
7559,
2102,
1006,
7396,
5178,
16778,
3723,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateTime.java | DateTime.parse | private static Date parse(String dateStr, DateParser parser) {
Assert.notNull(parser, "Parser or DateFromat must be not null !");
Assert.notBlank(dateStr, "Date String must be not blank !");
try {
return parser.parse(dateStr);
} catch (Exception e) {
throw new DateException("Parse [{}] with format [{}] error!", dateStr, parser.getPattern(), e);
}
} | java | private static Date parse(String dateStr, DateParser parser) {
Assert.notNull(parser, "Parser or DateFromat must be not null !");
Assert.notBlank(dateStr, "Date String must be not blank !");
try {
return parser.parse(dateStr);
} catch (Exception e) {
throw new DateException("Parse [{}] with format [{}] error!", dateStr, parser.getPattern(), e);
}
} | [
"private",
"static",
"Date",
"parse",
"(",
"String",
"dateStr",
",",
"DateParser",
"parser",
")",
"{",
"Assert",
".",
"notNull",
"(",
"parser",
",",
"\"Parser or DateFromat must be not null !\"",
")",
";",
"Assert",
".",
"notBlank",
"(",
"dateStr",
",",
"\"Date ... | 转换字符串为Date
@param dateStr 日期字符串
@param parser {@link FastDateFormat}
@return {@link Date} | [
"转换字符串为Date"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateTime.java#L896-L904 | train | Parse a string of date with a given parser. | [
30522,
2797,
10763,
3058,
11968,
3366,
1006,
5164,
5246,
16344,
1010,
3058,
19362,
8043,
11968,
8043,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
11968,
8043,
1010,
1000,
11968,
8043,
2030,
3058,
19699,
9626,
2102,
2442,
2022,
2025,
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/collection/CollUtil.java | CollUtil.filter | public static <T> Collection<T> filter(Collection<T> collection, Editor<T> editor) {
if (null == collection || null == editor) {
return collection;
}
Collection<T> collection2 = ObjectUtil.clone(collection);
try {
collection2.clear();
} catch (UnsupportedOperationException e) {
// 克隆后的对象不支持清空,说明为不可变集合对象,使用默认的ArrayList保存结果
collection2 = new ArrayList<>();
}
T modified;
for (T t : collection) {
modified = editor.edit(t);
if (null != modified) {
collection2.add(modified);
}
}
return collection2;
} | java | public static <T> Collection<T> filter(Collection<T> collection, Editor<T> editor) {
if (null == collection || null == editor) {
return collection;
}
Collection<T> collection2 = ObjectUtil.clone(collection);
try {
collection2.clear();
} catch (UnsupportedOperationException e) {
// 克隆后的对象不支持清空,说明为不可变集合对象,使用默认的ArrayList保存结果
collection2 = new ArrayList<>();
}
T modified;
for (T t : collection) {
modified = editor.edit(t);
if (null != modified) {
collection2.add(modified);
}
}
return collection2;
} | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"filter",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"Editor",
"<",
"T",
">",
"editor",
")",
"{",
"if",
"(",
"null",
"==",
"collection",
"||",
"null",
"==",
"editor",
")",
"{... | 过滤<br>
过滤过程通过传入的Editor实现来返回需要的元素内容,这个Editor实现可以实现以下功能:
<pre>
1、过滤出需要的对象,如果返回null表示这个元素对象抛弃
2、修改元素对象,返回集合中为修改后的对象
</pre>
@param <T> 集合元素类型
@param collection 集合
@param editor 编辑器接口
@return 过滤后的集合 | [
"过滤<br",
">",
"过滤过程通过传入的Editor实现来返回需要的元素内容,这个Editor实现可以实现以下功能:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L936-L957 | train | Returns a new collection with all the items in the specified collection that match the specified filter criteria. | [
30522,
2270,
10763,
1026,
1056,
1028,
3074,
1026,
1056,
1028,
11307,
1006,
3074,
1026,
1056,
1028,
3074,
1010,
3559,
1026,
1056,
1028,
3559,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
3074,
1064,
1064,
19701,
1027,
1027,
3559,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/Quotes.java | Quotes.escape | @SuppressWarnings("JavaDoc")
public static String escape(String toEscape) {
if (toEscape.contains("\"") && toEscape.contains("'")) {
boolean quoteIsLast = false;
if (toEscape.lastIndexOf("\"") == toEscape.length() - 1) {
quoteIsLast = true;
}
String[] substringsWithoutQuotes = toEscape.split("\"");
StringBuilder quoted = new StringBuilder("concat(");
for (int i = 0; i < substringsWithoutQuotes.length; i++) {
quoted.append("\"").append(substringsWithoutQuotes[i]).append("\"");
quoted
.append(((i == substringsWithoutQuotes.length - 1) ? (quoteIsLast ? ", '\"')" : ")")
: ", '\"', "));
}
return quoted.toString();
}
// Escape string with just a quote into being single quoted: f"oo -> 'f"oo'
if (toEscape.contains("\"")) {
return String.format("'%s'", toEscape);
}
// Otherwise return the quoted string
return String.format("\"%s\"", toEscape);
} | java | @SuppressWarnings("JavaDoc")
public static String escape(String toEscape) {
if (toEscape.contains("\"") && toEscape.contains("'")) {
boolean quoteIsLast = false;
if (toEscape.lastIndexOf("\"") == toEscape.length() - 1) {
quoteIsLast = true;
}
String[] substringsWithoutQuotes = toEscape.split("\"");
StringBuilder quoted = new StringBuilder("concat(");
for (int i = 0; i < substringsWithoutQuotes.length; i++) {
quoted.append("\"").append(substringsWithoutQuotes[i]).append("\"");
quoted
.append(((i == substringsWithoutQuotes.length - 1) ? (quoteIsLast ? ", '\"')" : ")")
: ", '\"', "));
}
return quoted.toString();
}
// Escape string with just a quote into being single quoted: f"oo -> 'f"oo'
if (toEscape.contains("\"")) {
return String.format("'%s'", toEscape);
}
// Otherwise return the quoted string
return String.format("\"%s\"", toEscape);
} | [
"@",
"SuppressWarnings",
"(",
"\"JavaDoc\"",
")",
"public",
"static",
"String",
"escape",
"(",
"String",
"toEscape",
")",
"{",
"if",
"(",
"toEscape",
".",
"contains",
"(",
"\"\\\"\"",
")",
"&&",
"toEscape",
".",
"contains",
"(",
"\"'\"",
")",
")",
"{",
"... | Convert strings with both quotes and ticks into a valid xpath component
For example,
<p>
{@code foo} will be converted to {@code "foo"},
</p>
<p>
{@code f"oo} will be converted to {@code 'f"oo'},
</p>
<p>
{@code foo'"bar} will be converted to {@code concat("foo'", '"', "bar")}
</p>
@param toEscape a text to escape quotes in, e.g. {@code "f'oo"}
@return the same text with escaped quoted, e.g. {@code "\"f'oo\""} | [
"Convert",
"strings",
"with",
"both",
"quotes",
"and",
"ticks",
"into",
"a",
"valid",
"xpath",
"component"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/Quotes.java#L40-L66 | train | Escape a string into a single quoted string. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
9262,
3527,
2278,
1000,
1007,
2270,
10763,
5164,
4019,
1006,
5164,
10393,
19464,
1007,
1063,
2065,
1006,
10393,
19464,
1012,
3397,
1006,
1000,
1032,
1000,
1000,
1007,
1004,
1004,
10393,
1946... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SystemPropertyUtil.java | SystemPropertyUtil.getBoolean | public static boolean getBoolean(String key, boolean def) {
String value = get(key);
if (value == null) {
return def;
}
value = value.trim().toLowerCase();
if (value.isEmpty()) {
return def;
}
if ("true".equals(value) || "yes".equals(value) || "1".equals(value)) {
return true;
}
if ("false".equals(value) || "no".equals(value) || "0".equals(value)) {
return false;
}
logger.warn(
"Unable to parse the boolean system property '{}':{} - using the default value: {}",
key, value, def
);
return def;
} | java | public static boolean getBoolean(String key, boolean def) {
String value = get(key);
if (value == null) {
return def;
}
value = value.trim().toLowerCase();
if (value.isEmpty()) {
return def;
}
if ("true".equals(value) || "yes".equals(value) || "1".equals(value)) {
return true;
}
if ("false".equals(value) || "no".equals(value) || "0".equals(value)) {
return false;
}
logger.warn(
"Unable to parse the boolean system property '{}':{} - using the default value: {}",
key, value, def
);
return def;
} | [
"public",
"static",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"def",
")",
"{",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"def",
";",
"}",
"value",
"=",
"value",
"... | Returns the value of the Java system property with the specified
{@code key}, while falling back to the specified default value if
the property access fails.
@return the property value.
{@code def} if there's no such property or if an access to the
specified property is not allowed. | [
"Returns",
"the",
"value",
"of",
"the",
"Java",
"system",
"property",
"with",
"the",
"specified",
"{",
"@code",
"key",
"}",
"while",
"falling",
"back",
"to",
"the",
"specified",
"default",
"value",
"if",
"the",
"property",
"access",
"fails",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java#L98-L123 | train | Gets the boolean value for the specified key. | [
30522,
2270,
10763,
22017,
20898,
2131,
5092,
9890,
2319,
1006,
5164,
3145,
1010,
22017,
20898,
13366,
1007,
1063,
5164,
3643,
1027,
2131,
1006,
3145,
1007,
1025,
2065,
1006,
3643,
1027,
1027,
19701,
1007,
1063,
2709,
13366,
1025,
1065,
364... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | http-url/src/main/java/com/networknt/url/URLNormalizer.java | URLNormalizer.addDirectoryTrailingSlash | public URLNormalizer addDirectoryTrailingSlash() {
String urlRoot = HttpURL.getRoot(url);
String path = toURL().getPath();
String urlRootAndPath = urlRoot + path;
String name = StringUtils.substringAfterLast(path, "/");
if (StringUtils.isNotBlank(name) && !name.contains(".")) {
String newPath = path + "/";
String newUrlRootAndPath = urlRoot + newPath;
url = StringUtils.replaceOnce(
url, urlRootAndPath, newUrlRootAndPath);
}
return this;
} | java | public URLNormalizer addDirectoryTrailingSlash() {
String urlRoot = HttpURL.getRoot(url);
String path = toURL().getPath();
String urlRootAndPath = urlRoot + path;
String name = StringUtils.substringAfterLast(path, "/");
if (StringUtils.isNotBlank(name) && !name.contains(".")) {
String newPath = path + "/";
String newUrlRootAndPath = urlRoot + newPath;
url = StringUtils.replaceOnce(
url, urlRootAndPath, newUrlRootAndPath);
}
return this;
} | [
"public",
"URLNormalizer",
"addDirectoryTrailingSlash",
"(",
")",
"{",
"String",
"urlRoot",
"=",
"HttpURL",
".",
"getRoot",
"(",
"url",
")",
";",
"String",
"path",
"=",
"toURL",
"(",
")",
".",
"getPath",
"(",
")",
";",
"String",
"urlRootAndPath",
"=",
"url... | <p>Adds a trailing slash (/) to a URL ending with a directory. A URL is
considered to end with a directory if the last path segment,
before fragment (#) or query string (?), does not contain a dot,
typically representing an extension.</p>
<p><b>Please Note:</b> URLs do not always denote a directory structure
and many URLs can qualify to this method without truly representing a
directory. Adding a trailing slash to these URLs could potentially break
its semantic equivalence.</p>
<code>http://www.example.com/alice →
http://www.example.com/alice/</code>
@return this instance
@since 1.11.0 (renamed from "addTrailingSlash") | [
"<p",
">",
"Adds",
"a",
"trailing",
"slash",
"(",
"/",
")",
"to",
"a",
"URL",
"ending",
"with",
"a",
"directory",
".",
"A",
"URL",
"is",
"considered",
"to",
"end",
"with",
"a",
"directory",
"if",
"the",
"last",
"path",
"segment",
"before",
"fragment",
... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/URLNormalizer.java#L322-L335 | train | Add directory trailing slash to the URL. | [
30522,
2270,
24471,
19666,
2953,
9067,
17629,
5587,
4305,
2890,
16761,
22123,
15118,
8613,
27067,
1006,
1007,
1063,
5164,
24471,
20974,
17206,
1027,
8299,
3126,
2140,
1012,
2131,
3217,
4140,
1006,
24471,
2140,
1007,
1025,
5164,
4130,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.zip | public static File zip(File zipFile, String[] paths, InputStream[] ins, Charset charset) throws UtilException {
if (ArrayUtil.isEmpty(paths) || ArrayUtil.isEmpty(ins)) {
throw new IllegalArgumentException("Paths or ins is empty !");
}
if (paths.length != ins.length) {
throw new IllegalArgumentException("Paths length is not equals to ins length !");
}
ZipOutputStream out = null;
try {
out = getZipOutputStream(zipFile, charset);
for (int i = 0; i < paths.length; i++) {
addFile(ins[i], paths[i], out);
}
} finally {
IoUtil.close(out);
}
return zipFile;
} | java | public static File zip(File zipFile, String[] paths, InputStream[] ins, Charset charset) throws UtilException {
if (ArrayUtil.isEmpty(paths) || ArrayUtil.isEmpty(ins)) {
throw new IllegalArgumentException("Paths or ins is empty !");
}
if (paths.length != ins.length) {
throw new IllegalArgumentException("Paths length is not equals to ins length !");
}
ZipOutputStream out = null;
try {
out = getZipOutputStream(zipFile, charset);
for (int i = 0; i < paths.length; i++) {
addFile(ins[i], paths[i], out);
}
} finally {
IoUtil.close(out);
}
return zipFile;
} | [
"public",
"static",
"File",
"zip",
"(",
"File",
"zipFile",
",",
"String",
"[",
"]",
"paths",
",",
"InputStream",
"[",
"]",
"ins",
",",
"Charset",
"charset",
")",
"throws",
"UtilException",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"paths",
")",
... | 对流中的数据加入到压缩文件<br>
路径列表和流列表长度必须一致
@param zipFile 生成的Zip文件,包括文件名。注意:zipPath不能是srcPath路径下的子文件夹
@param paths 流数据在压缩文件中的路径或文件名
@param ins 要压缩的源
@param charset 编码
@return 压缩文件
@throws UtilException IO异常
@since 3.0.9 | [
"对流中的数据加入到压缩文件<br",
">",
"路径列表和流列表长度必须一致"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L267-L285 | train | Creates a zip file from the specified input stream and writes the result to the specified zip file. | [
30522,
2270,
10763,
5371,
14101,
1006,
5371,
14101,
8873,
2571,
1010,
5164,
1031,
1033,
10425,
1010,
20407,
25379,
1031,
1033,
16021,
1010,
25869,
13462,
25869,
13462,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
2065,
1006,
9140,
21823,
2140... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/StringUtils.java | StringUtils.startsWith | private static boolean startsWith(final CharSequence str, final CharSequence prefix, final boolean ignoreCase) {
if (str == null || prefix == null) {
return str == prefix;
}
if (prefix.length() > str.length()) {
return false;
}
return CharSequenceUtils.regionMatches(str, ignoreCase, 0, prefix, 0, prefix.length());
} | java | private static boolean startsWith(final CharSequence str, final CharSequence prefix, final boolean ignoreCase) {
if (str == null || prefix == null) {
return str == prefix;
}
if (prefix.length() > str.length()) {
return false;
}
return CharSequenceUtils.regionMatches(str, ignoreCase, 0, prefix, 0, prefix.length());
} | [
"private",
"static",
"boolean",
"startsWith",
"(",
"final",
"CharSequence",
"str",
",",
"final",
"CharSequence",
"prefix",
",",
"final",
"boolean",
"ignoreCase",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"prefix",
"==",
"null",
")",
"{",
"return",
"s... | <p>Check if a CharSequence starts with a specified prefix (optionally case insensitive).</p>
@see java.lang.String#startsWith(String)
@param str the CharSequence to check, may be null
@param prefix the prefix to find, may be null
@param ignoreCase indicates whether the compare should ignore case
(case insensitive) or not.
@return {@code true} if the CharSequence starts with the prefix or
both {@code null} | [
"<p",
">",
"Check",
"if",
"a",
"CharSequence",
"starts",
"with",
"a",
"specified",
"prefix",
"(",
"optionally",
"case",
"insensitive",
")",
".",
"<",
"/",
"p",
">"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/StringUtils.java#L826-L834 | train | Check if a CharSequence starts with a prefix. | [
30522,
2797,
10763,
22017,
20898,
4627,
24415,
1006,
2345,
25869,
3366,
4226,
5897,
2358,
2099,
1010,
2345,
25869,
3366,
4226,
5897,
17576,
1010,
2345,
22017,
20898,
8568,
18382,
1007,
1063,
2065,
1006,
2358,
2099,
1027,
1027,
19701,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HttpHeaders.java | HttpHeaders.containsValue | public boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase) {
Iterator<? extends CharSequence> itr = valueCharSequenceIterator(name);
while (itr.hasNext()) {
if (containsCommaSeparatedTrimmed(itr.next(), value, ignoreCase)) {
return true;
}
}
return false;
} | java | public boolean containsValue(CharSequence name, CharSequence value, boolean ignoreCase) {
Iterator<? extends CharSequence> itr = valueCharSequenceIterator(name);
while (itr.hasNext()) {
if (containsCommaSeparatedTrimmed(itr.next(), value, ignoreCase)) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"containsValue",
"(",
"CharSequence",
"name",
",",
"CharSequence",
"value",
",",
"boolean",
"ignoreCase",
")",
"{",
"Iterator",
"<",
"?",
"extends",
"CharSequence",
">",
"itr",
"=",
"valueCharSequenceIterator",
"(",
"name",
")",
";",
"while"... | Returns {@code true} if a header with the {@code name} and {@code value} exists, {@code false} otherwise.
This also handles multiple values that are separated with a {@code ,}.
<p>
If {@code ignoreCase} is {@code true} then a case insensitive compare is done on the value.
@param name the name of the header to find
@param value the value of the header to find
@param ignoreCase {@code true} then a case insensitive compare is run to compare values.
otherwise a case sensitive compare is run to compare values. | [
"Returns",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1598-L1606 | train | Check if a value is contained in a set of attributes. | [
30522,
2270,
22017,
20898,
3397,
10175,
5657,
1006,
25869,
3366,
4226,
5897,
2171,
1010,
25869,
3366,
4226,
5897,
3643,
1010,
22017,
20898,
8568,
18382,
1007,
1063,
2009,
6906,
4263,
1026,
1029,
8908,
25869,
3366,
4226,
5897,
1028,
2009,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getPublicMethods | public static List<Method> getPublicMethods(Class<?> clazz, Method... excludeMethods) {
return ReflectUtil.getPublicMethods(clazz, excludeMethods);
} | java | public static List<Method> getPublicMethods(Class<?> clazz, Method... excludeMethods) {
return ReflectUtil.getPublicMethods(clazz, excludeMethods);
} | [
"public",
"static",
"List",
"<",
"Method",
">",
"getPublicMethods",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Method",
"...",
"excludeMethods",
")",
"{",
"return",
"ReflectUtil",
".",
"getPublicMethods",
"(",
"clazz",
",",
"excludeMethods",
")",
";",
"}"
] | 获得指定类过滤后的Public方法列表
@param clazz 查找方法的类
@param excludeMethods 不包括的方法
@return 过滤后的方法列表 | [
"获得指定类过滤后的Public方法列表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L270-L272 | train | Get a list of public methods of a class including those that are not excluded from the result. | [
30522,
2270,
10763,
2862,
1026,
4118,
1028,
2131,
14289,
16558,
2594,
11368,
6806,
5104,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
4118,
1012,
1012,
1012,
23329,
11368,
6806,
5104,
1007,
1063,
2709,
8339,
21823,
2140,
1012,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelClient.java | TunnelClient.start | public int start() throws IOException {
synchronized (this.monitor) {
Assert.state(this.serverThread == null, "Server already started");
ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
serverSocketChannel.socket().bind(new InetSocketAddress(this.listenPort));
int port = serverSocketChannel.socket().getLocalPort();
logger.trace("Listening for TCP traffic to tunnel on port " + port);
this.serverThread = new ServerThread(serverSocketChannel);
this.serverThread.start();
return port;
}
} | java | public int start() throws IOException {
synchronized (this.monitor) {
Assert.state(this.serverThread == null, "Server already started");
ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();
serverSocketChannel.socket().bind(new InetSocketAddress(this.listenPort));
int port = serverSocketChannel.socket().getLocalPort();
logger.trace("Listening for TCP traffic to tunnel on port " + port);
this.serverThread = new ServerThread(serverSocketChannel);
this.serverThread.start();
return port;
}
} | [
"public",
"int",
"start",
"(",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"this",
".",
"monitor",
")",
"{",
"Assert",
".",
"state",
"(",
"this",
".",
"serverThread",
"==",
"null",
",",
"\"Server already started\"",
")",
";",
"ServerSocketChannel",... | Start the client and accept incoming connections.
@return the port on which the client is listening
@throws IOException in case of I/O errors | [
"Start",
"the",
"client",
"and",
"accept",
"incoming",
"connections",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelClient.java#L85-L96 | train | Starts the server. | [
30522,
2270,
20014,
2707,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
25549,
1006,
2023,
1012,
8080,
1007,
1063,
20865,
1012,
2110,
1006,
2023,
1012,
8241,
2705,
16416,
2094,
1027,
1027,
19701,
1010,
1000,
8241,
2525,
2318,
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... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Snappy.java | Snappy.findMatchingLength | private static int findMatchingLength(ByteBuf in, int minIndex, int inIndex, int maxIndex) {
int matched = 0;
while (inIndex <= maxIndex - 4 &&
in.getInt(inIndex) == in.getInt(minIndex + matched)) {
inIndex += 4;
matched += 4;
}
while (inIndex < maxIndex && in.getByte(minIndex + matched) == in.getByte(inIndex)) {
++inIndex;
++matched;
}
return matched;
} | java | private static int findMatchingLength(ByteBuf in, int minIndex, int inIndex, int maxIndex) {
int matched = 0;
while (inIndex <= maxIndex - 4 &&
in.getInt(inIndex) == in.getInt(minIndex + matched)) {
inIndex += 4;
matched += 4;
}
while (inIndex < maxIndex && in.getByte(minIndex + matched) == in.getByte(inIndex)) {
++inIndex;
++matched;
}
return matched;
} | [
"private",
"static",
"int",
"findMatchingLength",
"(",
"ByteBuf",
"in",
",",
"int",
"minIndex",
",",
"int",
"inIndex",
",",
"int",
"maxIndex",
")",
"{",
"int",
"matched",
"=",
"0",
";",
"while",
"(",
"inIndex",
"<=",
"maxIndex",
"-",
"4",
"&&",
"in",
"... | Iterates over the supplied input buffer between the supplied minIndex and
maxIndex to find how long our matched copy overlaps with an already-written
literal value.
@param in The input buffer to scan over
@param minIndex The index in the input buffer to start scanning from
@param inIndex The index of the start of our copy
@param maxIndex The length of our input buffer
@return The number of bytes for which our candidate copy is a repeat of | [
"Iterates",
"over",
"the",
"supplied",
"input",
"buffer",
"between",
"the",
"supplied",
"minIndex",
"and",
"maxIndex",
"to",
"find",
"how",
"long",
"our",
"matched",
"copy",
"overlaps",
"with",
"an",
"already",
"-",
"written",
"literal",
"value",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java#L179-L194 | train | Find matching length of a sequence of bytes in a buffer. | [
30522,
2797,
10763,
20014,
2424,
18900,
8450,
7770,
13512,
2232,
1006,
24880,
8569,
2546,
1999,
1010,
20014,
7163,
13629,
2595,
1010,
20014,
1999,
22254,
10288,
1010,
20014,
21510,
13629,
2595,
1007,
1063,
20014,
10349,
1027,
1014,
1025,
2096... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java | DoubleArrayTrie.build | public int build(TreeMap<String, V> keyValueMap)
{
assert keyValueMap != null;
Set<Map.Entry<String, V>> entrySet = keyValueMap.entrySet();
return build(entrySet);
} | java | public int build(TreeMap<String, V> keyValueMap)
{
assert keyValueMap != null;
Set<Map.Entry<String, V>> entrySet = keyValueMap.entrySet();
return build(entrySet);
} | [
"public",
"int",
"build",
"(",
"TreeMap",
"<",
"String",
",",
"V",
">",
"keyValueMap",
")",
"{",
"assert",
"keyValueMap",
"!=",
"null",
";",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"V",
">",
">",
"entrySet",
"=",
"keyValueMap",
".",
"ent... | 方便地构造一个双数组trie树
@param keyValueMap 升序键值对map
@return 构造结果 | [
"方便地构造一个双数组trie树"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L371-L376 | train | Build a CRT from a map of key - value pairs. | [
30522,
2270,
20014,
3857,
1006,
3392,
2863,
2361,
1026,
5164,
1010,
1058,
1028,
3145,
10175,
5657,
2863,
2361,
1007,
1063,
20865,
3145,
10175,
5657,
2863,
2361,
999,
1027,
19701,
1025,
2275,
1026,
4949,
1012,
4443,
1026,
5164,
1010,
1058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/UUID.java | UUID.compareTo | public int compareTo(UUID val) {
// The ordering is intentionally set up so that the UUIDs
// can simply be numerically compared as two numbers
return (this.mostSigBits < val.mostSigBits ? -1 : //
(this.mostSigBits > val.mostSigBits ? 1 : //
(this.leastSigBits < val.leastSigBits ? -1 : //
(this.leastSigBits > val.leastSigBits ? 1 : //
0))));
} | java | public int compareTo(UUID val) {
// The ordering is intentionally set up so that the UUIDs
// can simply be numerically compared as two numbers
return (this.mostSigBits < val.mostSigBits ? -1 : //
(this.mostSigBits > val.mostSigBits ? 1 : //
(this.leastSigBits < val.leastSigBits ? -1 : //
(this.leastSigBits > val.leastSigBits ? 1 : //
0))));
} | [
"public",
"int",
"compareTo",
"(",
"UUID",
"val",
")",
"{",
"// The ordering is intentionally set up so that the UUIDs\r",
"// can simply be numerically compared as two numbers\r",
"return",
"(",
"this",
".",
"mostSigBits",
"<",
"val",
".",
"mostSigBits",
"?",
"-",
"1",
"... | 将此 UUID 与指定的 UUID 比较。
<p>
如果两个 UUID 不同,且第一个 UUID 的最高有效字段大于第二个 UUID 的对应字段,则第一个 UUID 大于第二个 UUID。
@param val 与此 UUID 比较的 UUID
@return 在此 UUID 小于、等于或大于 val 时,分别返回 -1、0 或 1。 | [
"将此",
"UUID",
"与指定的",
"UUID",
"比较。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/UUID.java#L417-L425 | train | Compares two UUIDs. | [
30522,
2270,
20014,
12826,
3406,
1006,
1057,
21272,
11748,
1007,
1063,
1013,
1013,
1996,
13063,
2003,
15734,
2275,
2039,
2061,
2008,
1996,
1057,
21272,
2015,
1013,
1013,
2064,
3432,
2022,
15973,
2135,
4102,
2004,
2048,
3616,
2709,
1006,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.mapToXml | private static void mapToXml(Document doc, Element element, Map<?, ?> data) {
Element filedEle;
Object key;
for (Entry<?, ?> entry : data.entrySet()) {
key = entry.getKey();
if (null != key) {
// key作为标签名
filedEle = doc.createElement(key.toString());
element.appendChild(filedEle);
final Object value = entry.getValue();
// value作为标签内的值。
if (null != value) {
if (value instanceof Map) {
// 如果值依旧为map,递归继续
mapToXml(doc, filedEle, (Map<?, ?>) value);
element.appendChild(filedEle);
} else {
filedEle.appendChild(doc.createTextNode(value.toString()));
}
}
}
}
} | java | private static void mapToXml(Document doc, Element element, Map<?, ?> data) {
Element filedEle;
Object key;
for (Entry<?, ?> entry : data.entrySet()) {
key = entry.getKey();
if (null != key) {
// key作为标签名
filedEle = doc.createElement(key.toString());
element.appendChild(filedEle);
final Object value = entry.getValue();
// value作为标签内的值。
if (null != value) {
if (value instanceof Map) {
// 如果值依旧为map,递归继续
mapToXml(doc, filedEle, (Map<?, ?>) value);
element.appendChild(filedEle);
} else {
filedEle.appendChild(doc.createTextNode(value.toString()));
}
}
}
}
} | [
"private",
"static",
"void",
"mapToXml",
"(",
"Document",
"doc",
",",
"Element",
"element",
",",
"Map",
"<",
"?",
",",
"?",
">",
"data",
")",
"{",
"Element",
"filedEle",
";",
"Object",
"key",
";",
"for",
"(",
"Entry",
"<",
"?",
",",
"?",
">",
"entr... | 将Map转换为XML格式的字符串
@param doc {@link Document}
@param element 节点
@param data Map类型数据
@since 4.0.8 | [
"将Map转换为XML格式的字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L793-L815 | train | Converts a map of data to an XML element. | [
30522,
2797,
10763,
11675,
4949,
3406,
2595,
19968,
1006,
6254,
9986,
1010,
5783,
5783,
1010,
4949,
1026,
1029,
1010,
1029,
1028,
2951,
1007,
1063,
5783,
6406,
12260,
1025,
4874,
3145,
1025,
2005,
1006,
4443,
1026,
1029,
1010,
1029,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/IterativeDataSet.java | IterativeDataSet.registerAggregationConvergenceCriterion | @PublicEvolving
public <X extends Value> IterativeDataSet<T> registerAggregationConvergenceCriterion(
String name, Aggregator<X> aggregator, ConvergenceCriterion<X> convergenceCheck) {
this.aggregators.registerAggregationConvergenceCriterion(name, aggregator, convergenceCheck);
return this;
} | java | @PublicEvolving
public <X extends Value> IterativeDataSet<T> registerAggregationConvergenceCriterion(
String name, Aggregator<X> aggregator, ConvergenceCriterion<X> convergenceCheck) {
this.aggregators.registerAggregationConvergenceCriterion(name, aggregator, convergenceCheck);
return this;
} | [
"@",
"PublicEvolving",
"public",
"<",
"X",
"extends",
"Value",
">",
"IterativeDataSet",
"<",
"T",
">",
"registerAggregationConvergenceCriterion",
"(",
"String",
"name",
",",
"Aggregator",
"<",
"X",
">",
"aggregator",
",",
"ConvergenceCriterion",
"<",
"X",
">",
"... | Registers an {@link Aggregator} for the iteration together with a {@link ConvergenceCriterion}. For a general description
of aggregators, see {@link #registerAggregator(String, Aggregator)} and {@link Aggregator}.
At the end of each iteration, the convergence criterion takes the aggregator's global aggregate value and decided whether
the iteration should terminate. A typical use case is to have an aggregator that sums up the total error of change
in an iteration step and have to have a convergence criterion that signals termination as soon as the aggregate value
is below a certain threshold.
@param name The name under which the aggregator is registered.
@param aggregator The aggregator class.
@param convergenceCheck The convergence criterion.
@return The IterativeDataSet itself, to allow chaining function calls. | [
"Registers",
"an",
"{",
"@link",
"Aggregator",
"}",
"for",
"the",
"iteration",
"together",
"with",
"a",
"{",
"@link",
"ConvergenceCriterion",
"}",
".",
"For",
"a",
"general",
"description",
"of",
"aggregators",
"see",
"{",
"@link",
"#registerAggregator",
"(",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/IterativeDataSet.java#L129-L134 | train | Registers an aggregation convergence criterion. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
1026,
1060,
8908,
3643,
1028,
2009,
25284,
2850,
18260,
2102,
1026,
1056,
1028,
4236,
8490,
17603,
12540,
8663,
6299,
17905,
26775,
21646,
3258,
1006,
5164,
2171,
1010,
24089,
1026,
1060,
1028,
240... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.map | public <R> MapOperator<T, R> map(MapFunction<T, R> mapper) {
if (mapper == null) {
throw new NullPointerException("Map function must not be null.");
}
String callLocation = Utils.getCallLocationName();
TypeInformation<R> resultType = TypeExtractor.getMapReturnTypes(mapper, getType(), callLocation, true);
return new MapOperator<>(this, resultType, clean(mapper), callLocation);
} | java | public <R> MapOperator<T, R> map(MapFunction<T, R> mapper) {
if (mapper == null) {
throw new NullPointerException("Map function must not be null.");
}
String callLocation = Utils.getCallLocationName();
TypeInformation<R> resultType = TypeExtractor.getMapReturnTypes(mapper, getType(), callLocation, true);
return new MapOperator<>(this, resultType, clean(mapper), callLocation);
} | [
"public",
"<",
"R",
">",
"MapOperator",
"<",
"T",
",",
"R",
">",
"map",
"(",
"MapFunction",
"<",
"T",
",",
"R",
">",
"mapper",
")",
"{",
"if",
"(",
"mapper",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Map function must not ... | Applies a Map transformation on this DataSet.
<p>The transformation calls a {@link org.apache.flink.api.common.functions.MapFunction} for each element of the DataSet.
Each MapFunction call returns exactly one element.
@param mapper The MapFunction that is called for each element of the DataSet.
@return A MapOperator that represents the transformed DataSet.
@see org.apache.flink.api.common.functions.MapFunction
@see org.apache.flink.api.common.functions.RichMapFunction
@see MapOperator | [
"Applies",
"a",
"Map",
"transformation",
"on",
"this",
"DataSet",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L210-L218 | train | Returns a new MapOperator instance that maps the elements of this DataSet to the results of applying the given MapFunction to each element of the DataSet. | [
30522,
2270,
1026,
1054,
1028,
4949,
25918,
8844,
1026,
1056,
1010,
1054,
1028,
4949,
1006,
4949,
11263,
27989,
1026,
1056,
1010,
1054,
1028,
4949,
4842,
1007,
1063,
2065,
1006,
4949,
4842,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
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... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java | FileSystem.loadHadoopFsFactory | private static FileSystemFactory loadHadoopFsFactory() {
final ClassLoader cl = FileSystem.class.getClassLoader();
// first, see if the Flink runtime classes are available
final Class<? extends FileSystemFactory> factoryClass;
try {
factoryClass = Class
.forName("org.apache.flink.runtime.fs.hdfs.HadoopFsFactory", false, cl)
.asSubclass(FileSystemFactory.class);
}
catch (ClassNotFoundException e) {
LOG.info("No Flink runtime dependency present. " +
"The extended set of supported File Systems via Hadoop is not available.");
return new UnsupportedSchemeFactory("Flink runtime classes missing in classpath/dependencies.");
}
catch (Exception | LinkageError e) {
LOG.warn("Flink's Hadoop file system factory could not be loaded", e);
return new UnsupportedSchemeFactory("Flink's Hadoop file system factory could not be loaded", e);
}
// check (for eager and better exception messages) if the Hadoop classes are available here
try {
Class.forName("org.apache.hadoop.conf.Configuration", false, cl);
Class.forName("org.apache.hadoop.fs.FileSystem", false, cl);
}
catch (ClassNotFoundException e) {
LOG.info("Hadoop is not in the classpath/dependencies. " +
"The extended set of supported File Systems via Hadoop is not available.");
return new UnsupportedSchemeFactory("Hadoop is not in the classpath/dependencies.");
}
// Create the factory.
try {
return factoryClass.newInstance();
}
catch (Exception | LinkageError e) {
LOG.warn("Flink's Hadoop file system factory could not be created", e);
return new UnsupportedSchemeFactory("Flink's Hadoop file system factory could not be created", e);
}
} | java | private static FileSystemFactory loadHadoopFsFactory() {
final ClassLoader cl = FileSystem.class.getClassLoader();
// first, see if the Flink runtime classes are available
final Class<? extends FileSystemFactory> factoryClass;
try {
factoryClass = Class
.forName("org.apache.flink.runtime.fs.hdfs.HadoopFsFactory", false, cl)
.asSubclass(FileSystemFactory.class);
}
catch (ClassNotFoundException e) {
LOG.info("No Flink runtime dependency present. " +
"The extended set of supported File Systems via Hadoop is not available.");
return new UnsupportedSchemeFactory("Flink runtime classes missing in classpath/dependencies.");
}
catch (Exception | LinkageError e) {
LOG.warn("Flink's Hadoop file system factory could not be loaded", e);
return new UnsupportedSchemeFactory("Flink's Hadoop file system factory could not be loaded", e);
}
// check (for eager and better exception messages) if the Hadoop classes are available here
try {
Class.forName("org.apache.hadoop.conf.Configuration", false, cl);
Class.forName("org.apache.hadoop.fs.FileSystem", false, cl);
}
catch (ClassNotFoundException e) {
LOG.info("Hadoop is not in the classpath/dependencies. " +
"The extended set of supported File Systems via Hadoop is not available.");
return new UnsupportedSchemeFactory("Hadoop is not in the classpath/dependencies.");
}
// Create the factory.
try {
return factoryClass.newInstance();
}
catch (Exception | LinkageError e) {
LOG.warn("Flink's Hadoop file system factory could not be created", e);
return new UnsupportedSchemeFactory("Flink's Hadoop file system factory could not be created", e);
}
} | [
"private",
"static",
"FileSystemFactory",
"loadHadoopFsFactory",
"(",
")",
"{",
"final",
"ClassLoader",
"cl",
"=",
"FileSystem",
".",
"class",
".",
"getClassLoader",
"(",
")",
";",
"// first, see if the Flink runtime classes are available",
"final",
"Class",
"<",
"?",
... | Utility loader for the Hadoop file system factory.
We treat the Hadoop FS factory in a special way, because we use it as a catch
all for file systems schemes not supported directly in Flink.
<p>This method does a set of eager checks for availability of certain classes, to
be able to give better error messages. | [
"Utility",
"loader",
"for",
"the",
"Hadoop",
"file",
"system",
"factory",
".",
"We",
"treat",
"the",
"Hadoop",
"FS",
"factory",
"in",
"a",
"special",
"way",
"because",
"we",
"use",
"it",
"as",
"a",
"catch",
"all",
"for",
"file",
"systems",
"schemes",
"no... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java#L1038-L1077 | train | Load the Hadoop file system factory. | [
30522,
2797,
10763,
6764,
27268,
6633,
21450,
7170,
16102,
18589,
10343,
21450,
1006,
1007,
1063,
2345,
2465,
11066,
2121,
18856,
1027,
6764,
27268,
6633,
1012,
2465,
1012,
2131,
26266,
11066,
2121,
1006,
1007,
1025,
1013,
1013,
2034,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java | CompositeByteBuf.addComponents | public CompositeByteBuf addComponents(boolean increaseWriterIndex, ByteBuf... buffers) {
checkNotNull(buffers, "buffers");
addComponents0(increaseWriterIndex, componentCount, buffers, 0);
consolidateIfNeeded();
return this;
} | java | public CompositeByteBuf addComponents(boolean increaseWriterIndex, ByteBuf... buffers) {
checkNotNull(buffers, "buffers");
addComponents0(increaseWriterIndex, componentCount, buffers, 0);
consolidateIfNeeded();
return this;
} | [
"public",
"CompositeByteBuf",
"addComponents",
"(",
"boolean",
"increaseWriterIndex",
",",
"ByteBuf",
"...",
"buffers",
")",
"{",
"checkNotNull",
"(",
"buffers",
",",
"\"buffers\"",
")",
";",
"addComponents0",
"(",
"increaseWriterIndex",
",",
"componentCount",
",",
... | Add the given {@link ByteBuf}s and increase the {@code writerIndex} if {@code increaseWriterIndex} is
{@code true}.
{@link ByteBuf#release()} ownership of all {@link ByteBuf} objects in {@code buffers} is transferred to this
{@link CompositeByteBuf}.
@param buffers the {@link ByteBuf}s to add. {@link ByteBuf#release()} ownership of all {@link ByteBuf#release()}
ownership of all {@link ByteBuf} objects is transferred to this {@link CompositeByteBuf}. | [
"Add",
"the",
"given",
"{",
"@link",
"ByteBuf",
"}",
"s",
"and",
"increase",
"the",
"{",
"@code",
"writerIndex",
"}",
"if",
"{",
"@code",
"increaseWriterIndex",
"}",
"is",
"{",
"@code",
"true",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L234-L239 | train | Add multiple components to this composite buffer. | [
30522,
2270,
12490,
3762,
2618,
8569,
2546,
5587,
9006,
29513,
7666,
1006,
22017,
20898,
3623,
15994,
22254,
10288,
1010,
24880,
8569,
2546,
1012,
1012,
1012,
17698,
2015,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
17698,
2015,
1010,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/algorithm/EditDistance.java | EditDistance.compute | public static int compute(char[] wrongWord, char[] rightWord)
{
final int m = wrongWord.length;
final int n = rightWord.length;
int[][] d = new int[m + 1][n + 1];
for (int j = 0; j <= n; ++j)
{
d[0][j] = j;
}
for (int i = 0; i <= m; ++i)
{
d[i][0] = i;
}
for (int i = 1; i <= m; ++i)
{
char ci = wrongWord[i - 1];
for (int j = 1; j <= n; ++j)
{
char cj = rightWord[j - 1];
if (ci == cj)
{
d[i][j] = d[i - 1][j - 1];
}
else if (i > 1 && j > 1 && ci == rightWord[j - 2] && cj == wrongWord[i - 2])
{
// 交错相等
d[i][j] = 1 + Math.min(d[i - 2][j - 2], Math.min(d[i][j - 1], d[i - 1][j]));
}
else
{
// 等号右边的分别代表 将ci改成cj 错串加cj 错串删ci
d[i][j] = Math.min(d[i - 1][j - 1] + 1, Math.min(d[i][j - 1] + 1, d[i - 1][j] + 1));
}
}
}
return d[m][n];
} | java | public static int compute(char[] wrongWord, char[] rightWord)
{
final int m = wrongWord.length;
final int n = rightWord.length;
int[][] d = new int[m + 1][n + 1];
for (int j = 0; j <= n; ++j)
{
d[0][j] = j;
}
for (int i = 0; i <= m; ++i)
{
d[i][0] = i;
}
for (int i = 1; i <= m; ++i)
{
char ci = wrongWord[i - 1];
for (int j = 1; j <= n; ++j)
{
char cj = rightWord[j - 1];
if (ci == cj)
{
d[i][j] = d[i - 1][j - 1];
}
else if (i > 1 && j > 1 && ci == rightWord[j - 2] && cj == wrongWord[i - 2])
{
// 交错相等
d[i][j] = 1 + Math.min(d[i - 2][j - 2], Math.min(d[i][j - 1], d[i - 1][j]));
}
else
{
// 等号右边的分别代表 将ci改成cj 错串加cj 错串删ci
d[i][j] = Math.min(d[i - 1][j - 1] + 1, Math.min(d[i][j - 1] + 1, d[i - 1][j] + 1));
}
}
}
return d[m][n];
} | [
"public",
"static",
"int",
"compute",
"(",
"char",
"[",
"]",
"wrongWord",
",",
"char",
"[",
"]",
"rightWord",
")",
"{",
"final",
"int",
"m",
"=",
"wrongWord",
".",
"length",
";",
"final",
"int",
"n",
"=",
"rightWord",
".",
"length",
";",
"int",
"[",
... | 编辑距离
@param wrongWord 串A,其实它们两个调换位置还是一样的
@param rightWord 串B
@return 它们之间的距离 | [
"编辑距离"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/EditDistance.java#L192-L231 | train | Compute the 2 - D array of int. | [
30522,
2270,
10763,
20014,
24134,
1006,
25869,
1031,
1033,
3308,
18351,
1010,
25869,
1031,
1033,
2157,
18351,
1007,
1063,
2345,
20014,
1049,
1027,
3308,
18351,
1012,
3091,
1025,
2345,
20014,
30524,
1031,
1033,
1031,
1033,
1040,
1027,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.addDeprecation | @Deprecated
public static void addDeprecation(String key, String[] newKeys,
String customMessage) {
addDeprecations(new DeprecationDelta[] {
new DeprecationDelta(key, newKeys, customMessage)
});
} | java | @Deprecated
public static void addDeprecation(String key, String[] newKeys,
String customMessage) {
addDeprecations(new DeprecationDelta[] {
new DeprecationDelta(key, newKeys, customMessage)
});
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"addDeprecation",
"(",
"String",
"key",
",",
"String",
"[",
"]",
"newKeys",
",",
"String",
"customMessage",
")",
"{",
"addDeprecations",
"(",
"new",
"DeprecationDelta",
"[",
"]",
"{",
"new",
"DeprecationDelta",
"(... | Adds the deprecated key to the global deprecation map.
It does not override any existing entries in the deprecation map.
This is to be used only by the developers in order to add deprecation of
keys, and attempts to call this method after loading resources once,
would lead to <tt>UnsupportedOperationException</tt>
If a key is deprecated in favor of multiple keys, they are all treated as
aliases of each other, and setting any one of them resets all the others
to the new value.
If you have multiple deprecation entries to add, it is more efficient to
use #addDeprecations(DeprecationDelta[] deltas) instead.
@param key
@param newKeys
@param customMessage
@deprecated use {@link #addDeprecation(String key, String newKey,
String customMessage)} instead | [
"Adds",
"the",
"deprecated",
"key",
"to",
"the",
"global",
"deprecation",
"map",
".",
"It",
"does",
"not",
"override",
"any",
"existing",
"entries",
"in",
"the",
"deprecation",
"map",
".",
"This",
"is",
"to",
"be",
"used",
"only",
"by",
"the",
"developers"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L484-L490 | train | Add a deprecation delta to the list of deprecation keys. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
11675,
5587,
3207,
28139,
10719,
1006,
5164,
3145,
1010,
5164,
1031,
1033,
2047,
14839,
2015,
1010,
5164,
7661,
7834,
3736,
3351,
1007,
1063,
5587,
3207,
28139,
10719,
2015,
1006,
2047,
2139,
28... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HttpHeaders.java | HttpHeaders.setHeader | @Deprecated
public static void setHeader(HttpMessage message, String name, Iterable<?> values) {
message.headers().set(name, values);
} | java | @Deprecated
public static void setHeader(HttpMessage message, String name, Iterable<?> values) {
message.headers().set(name, values);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"setHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
",",
"Iterable",
"<",
"?",
">",
"values",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"set",
"(",
"name",
",",
"values",
")",
";",... | @deprecated Use {@link #set(CharSequence, Iterable)} instead.
@see #setHeader(HttpMessage, CharSequence, Iterable) | [
"@deprecated",
"Use",
"{",
"@link",
"#set",
"(",
"CharSequence",
"Iterable",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L624-L627 | train | Sets the header of the given message. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
11675,
6662,
13775,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
5164,
2171,
1010,
2009,
6906,
3468,
1026,
1029,
1028,
5300,
1007,
1063,
4471,
1012,
20346,
2015,
1006,
1007,
1012,
2275,
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/text/csv/CsvWriter.java | CsvWriter.appendField | private void appendField(final String value) throws IOException {
boolean alwaysDelimitText = config.alwaysDelimitText;
char textDelimiter = config.textDelimiter;
char fieldSeparator = config.fieldSeparator;
if (false == newline) {
writer.write(fieldSeparator);
} else {
newline = false;
}
if (null == value) {
if (alwaysDelimitText) {
writer.write(new char[] { textDelimiter, textDelimiter });
}
return;
}
final char[] valueChars = value.toCharArray();
boolean needsTextDelimiter = alwaysDelimitText;
boolean containsTextDelimiter = false;
for (final char c : valueChars) {
if (c == textDelimiter) {
// 字段值中存在包装符
containsTextDelimiter = needsTextDelimiter = true;
break;
} else if (c == fieldSeparator || c == CharUtil.LF || c == CharUtil.CR) {
// 包含分隔符或换行符需要包装符包装
needsTextDelimiter = true;
}
}
// 包装符开始
if (needsTextDelimiter) {
writer.write(textDelimiter);
}
// 正文
if (containsTextDelimiter) {
for (final char c : valueChars) {
// 转义文本包装符
if (c == textDelimiter) {
writer.write(textDelimiter);
}
writer.write(c);
}
} else {
writer.write(valueChars);
}
// 包装符结尾
if (needsTextDelimiter) {
writer.write(textDelimiter);
}
} | java | private void appendField(final String value) throws IOException {
boolean alwaysDelimitText = config.alwaysDelimitText;
char textDelimiter = config.textDelimiter;
char fieldSeparator = config.fieldSeparator;
if (false == newline) {
writer.write(fieldSeparator);
} else {
newline = false;
}
if (null == value) {
if (alwaysDelimitText) {
writer.write(new char[] { textDelimiter, textDelimiter });
}
return;
}
final char[] valueChars = value.toCharArray();
boolean needsTextDelimiter = alwaysDelimitText;
boolean containsTextDelimiter = false;
for (final char c : valueChars) {
if (c == textDelimiter) {
// 字段值中存在包装符
containsTextDelimiter = needsTextDelimiter = true;
break;
} else if (c == fieldSeparator || c == CharUtil.LF || c == CharUtil.CR) {
// 包含分隔符或换行符需要包装符包装
needsTextDelimiter = true;
}
}
// 包装符开始
if (needsTextDelimiter) {
writer.write(textDelimiter);
}
// 正文
if (containsTextDelimiter) {
for (final char c : valueChars) {
// 转义文本包装符
if (c == textDelimiter) {
writer.write(textDelimiter);
}
writer.write(c);
}
} else {
writer.write(valueChars);
}
// 包装符结尾
if (needsTextDelimiter) {
writer.write(textDelimiter);
}
} | [
"private",
"void",
"appendField",
"(",
"final",
"String",
"value",
")",
"throws",
"IOException",
"{",
"boolean",
"alwaysDelimitText",
"=",
"config",
".",
"alwaysDelimitText",
";",
"char",
"textDelimiter",
"=",
"config",
".",
"textDelimiter",
";",
"char",
"fieldSep... | 在当前行追加字段值,自动添加字段分隔符,如果有必要,自动包装字段
@param value 字段值,{@code null} 会被做为空串写出
@throws IOException IO异常 | [
"在当前行追加字段值,自动添加字段分隔符,如果有必要,自动包装字段"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvWriter.java#L263-L318 | train | Append a field to the output stream. | [
30522,
2797,
11675,
10439,
10497,
3790,
1006,
2345,
5164,
3643,
1007,
11618,
22834,
10288,
24422,
1063,
22017,
20898,
2467,
9247,
27605,
4674,
18413,
1027,
9530,
8873,
2290,
1012,
2467,
9247,
27605,
4674,
18413,
1025,
25869,
3793,
9247,
27605... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/TableConnectorUtils.java | TableConnectorUtils.generateRuntimeName | public static String generateRuntimeName(Class<?> clazz, String[] fields) {
String className = clazz.getSimpleName();
if (null == fields) {
return className + "(*)";
} else {
return className + "(" + String.join(", ", fields) + ")";
}
} | java | public static String generateRuntimeName(Class<?> clazz, String[] fields) {
String className = clazz.getSimpleName();
if (null == fields) {
return className + "(*)";
} else {
return className + "(" + String.join(", ", fields) + ")";
}
} | [
"public",
"static",
"String",
"generateRuntimeName",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"[",
"]",
"fields",
")",
"{",
"String",
"className",
"=",
"clazz",
".",
"getSimpleName",
"(",
")",
";",
"if",
"(",
"null",
"==",
"fields",
")",
"{... | Returns the table connector name used for logging and web UI. | [
"Returns",
"the",
"table",
"connector",
"name",
"used",
"for",
"logging",
"and",
"web",
"UI",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/TableConnectorUtils.java#L36-L43 | train | Generates a runtime name for a class. | [
30522,
2270,
10763,
5164,
9699,
15532,
7292,
18442,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
5164,
1031,
1033,
4249,
1007,
1063,
5164,
2465,
18442,
1027,
18856,
10936,
2480,
1012,
4152,
5714,
10814,
18442,
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... |
looly/hutool | hutool-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java | CaptchaUtil.createLineCaptcha | public static LineCaptcha createLineCaptcha(int width, int height, int codeCount, int lineCount) {
return new LineCaptcha(width, height, codeCount, lineCount);
} | java | public static LineCaptcha createLineCaptcha(int width, int height, int codeCount, int lineCount) {
return new LineCaptcha(width, height, codeCount, lineCount);
} | [
"public",
"static",
"LineCaptcha",
"createLineCaptcha",
"(",
"int",
"width",
",",
"int",
"height",
",",
"int",
"codeCount",
",",
"int",
"lineCount",
")",
"{",
"return",
"new",
"LineCaptcha",
"(",
"width",
",",
"height",
",",
"codeCount",
",",
"lineCount",
")... | 创建线干扰的验证码
@param width 图片宽
@param height 图片高
@param codeCount 字符个数
@param lineCount 干扰线条数
@return {@link LineCaptcha} | [
"创建线干扰的验证码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java#L31-L33 | train | Create a LineCaptcha object. | [
30522,
2270,
10763,
2240,
17695,
10649,
2050,
3443,
4179,
17695,
10649,
2050,
1006,
20014,
9381,
1010,
20014,
4578,
1010,
20014,
3642,
3597,
16671,
1010,
20014,
2240,
3597,
16671,
1007,
1063,
2709,
2047,
2240,
17695,
10649,
2050,
1006,
9381,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/tsdb/dao/MetaSnapshotDAO.java | MetaSnapshotDAO.deleteByTimestamp | public Integer deleteByTimestamp(String destination, int interval) {
HashMap params = Maps.newHashMapWithExpectedSize(2);
long timestamp = System.currentTimeMillis() - interval * 1000;
params.put("timestamp", timestamp);
params.put("destination", destination);
return getSqlMapClientTemplate().delete("meta_snapshot.deleteByTimestamp", params);
} | java | public Integer deleteByTimestamp(String destination, int interval) {
HashMap params = Maps.newHashMapWithExpectedSize(2);
long timestamp = System.currentTimeMillis() - interval * 1000;
params.put("timestamp", timestamp);
params.put("destination", destination);
return getSqlMapClientTemplate().delete("meta_snapshot.deleteByTimestamp", params);
} | [
"public",
"Integer",
"deleteByTimestamp",
"(",
"String",
"destination",
",",
"int",
"interval",
")",
"{",
"HashMap",
"params",
"=",
"Maps",
".",
"newHashMapWithExpectedSize",
"(",
"2",
")",
";",
"long",
"timestamp",
"=",
"System",
".",
"currentTimeMillis",
"(",
... | 删除interval秒之前的数据 | [
"删除interval秒之前的数据"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/tsdb/dao/MetaSnapshotDAO.java#L41-L47 | train | Delete by timestamp | [
30522,
2270,
16109,
3972,
12870,
3762,
7292,
9153,
8737,
1006,
5164,
7688,
1010,
20014,
13483,
1007,
1063,
23325,
2863,
2361,
11498,
5244,
1027,
7341,
1012,
2047,
14949,
22444,
28400,
8939,
10288,
5051,
10985,
5332,
4371,
1006,
1016,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.generateRandomNumber | public static int[] generateRandomNumber(int begin, int end, int size) {
if (begin > end) {
int temp = begin;
begin = end;
end = temp;
}
// 加入逻辑判断,确保begin<end并且size不能大于该表示范围
if ((end - begin) < size) {
throw new UtilException("Size is larger than range between begin and end!");
}
// 种子你可以随意生成,但不能重复
int[] seed = new int[end - begin];
for (int i = begin; i < end; i++) {
seed[i - begin] = i;
}
int[] ranArr = new int[size];
Random ran = new Random();
// 数量你可以自己定义。
for (int i = 0; i < size; i++) {
// 得到一个位置
int j = ran.nextInt(seed.length - i);
// 得到那个位置的数值
ranArr[i] = seed[j];
// 将最后一个未用的数字放到这里
seed[j] = seed[seed.length - 1 - i];
}
return ranArr;
} | java | public static int[] generateRandomNumber(int begin, int end, int size) {
if (begin > end) {
int temp = begin;
begin = end;
end = temp;
}
// 加入逻辑判断,确保begin<end并且size不能大于该表示范围
if ((end - begin) < size) {
throw new UtilException("Size is larger than range between begin and end!");
}
// 种子你可以随意生成,但不能重复
int[] seed = new int[end - begin];
for (int i = begin; i < end; i++) {
seed[i - begin] = i;
}
int[] ranArr = new int[size];
Random ran = new Random();
// 数量你可以自己定义。
for (int i = 0; i < size; i++) {
// 得到一个位置
int j = ran.nextInt(seed.length - i);
// 得到那个位置的数值
ranArr[i] = seed[j];
// 将最后一个未用的数字放到这里
seed[j] = seed[seed.length - 1 - i];
}
return ranArr;
} | [
"public",
"static",
"int",
"[",
"]",
"generateRandomNumber",
"(",
"int",
"begin",
",",
"int",
"end",
",",
"int",
"size",
")",
"{",
"if",
"(",
"begin",
">",
"end",
")",
"{",
"int",
"temp",
"=",
"begin",
";",
"begin",
"=",
"end",
";",
"end",
"=",
"... | 生成不重复随机数 根据给定的最小数字和最大数字,以及随机数的个数,产生指定的不重复的数组
@param begin 最小数字(包含该数)
@param end 最大数字(不包含该数)
@param size 指定产生随机数的个数
@return 随机int数组 | [
"生成不重复随机数",
"根据给定的最小数字和最大数字,以及随机数的个数,产生指定的不重复的数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L1226-L1254 | train | Generates a random number from the specified range of numbers. | [
30522,
2270,
10763,
20014,
1031,
1033,
9699,
13033,
5358,
19172,
5677,
1006,
20014,
4088,
1010,
20014,
2203,
1010,
20014,
2946,
1007,
1063,
2065,
1006,
4088,
1028,
2203,
1007,
1063,
20014,
8915,
8737,
1027,
4088,
1025,
4088,
1027,
2203,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java | Matrix.getRowPackedCopy | public double[] getRowPackedCopy()
{
double[] vals = new double[m * n];
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
vals[i * n + j] = A[i][j];
}
}
return vals;
} | java | public double[] getRowPackedCopy()
{
double[] vals = new double[m * n];
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
vals[i * n + j] = A[i][j];
}
}
return vals;
} | [
"public",
"double",
"[",
"]",
"getRowPackedCopy",
"(",
")",
"{",
"double",
"[",
"]",
"vals",
"=",
"new",
"double",
"[",
"m",
"*",
"n",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m",
";",
"i",
"++",
")",
"{",
"for",
"(",
"in... | Make a one-dimensional row packed copy of the internal array.
@return Matrix elements packed in a one-dimensional array by rows. | [
"Make",
"a",
"one",
"-",
"dimensional",
"row",
"packed",
"copy",
"of",
"the",
"internal",
"array",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L302-L313 | train | Get a row packed copy of the A matrix. | [
30522,
2270,
3313,
1031,
1033,
2131,
10524,
23947,
2098,
3597,
7685,
1006,
1007,
1063,
3313,
1031,
1033,
11748,
2015,
1027,
2047,
3313,
1031,
1049,
1008,
1050,
1033,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
1049,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java | ZooKeeperStateHandleStore.getAllPaths | public Collection<String> getAllPaths() throws Exception {
final String path = "/";
while (true) {
Stat stat = client.checkExists().forPath(path);
if (stat == null) {
return Collections.emptyList();
} else {
try {
return client.getChildren().forPath(path);
} catch (KeeperException.NoNodeException ignored) {
// Concurrent deletion, retry
}
}
}
} | java | public Collection<String> getAllPaths() throws Exception {
final String path = "/";
while (true) {
Stat stat = client.checkExists().forPath(path);
if (stat == null) {
return Collections.emptyList();
} else {
try {
return client.getChildren().forPath(path);
} catch (KeeperException.NoNodeException ignored) {
// Concurrent deletion, retry
}
}
}
} | [
"public",
"Collection",
"<",
"String",
">",
"getAllPaths",
"(",
")",
"throws",
"Exception",
"{",
"final",
"String",
"path",
"=",
"\"/\"",
";",
"while",
"(",
"true",
")",
"{",
"Stat",
"stat",
"=",
"client",
".",
"checkExists",
"(",
")",
".",
"forPath",
... | Return a list of all valid paths for state handles.
@return List of valid state handle paths in ZooKeeper
@throws Exception if a ZooKeeper operation fails | [
"Return",
"a",
"list",
"of",
"all",
"valid",
"paths",
"for",
"state",
"handles",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperStateHandleStore.java#L253-L269 | train | Gets all paths. | [
30522,
2270,
3074,
1026,
5164,
1028,
2131,
8095,
15069,
2015,
1006,
1007,
11618,
6453,
1063,
2345,
5164,
4130,
1027,
1000,
1013,
1000,
1025,
2096,
1006,
2995,
1007,
1063,
28093,
28093,
1027,
7396,
1012,
4638,
10288,
5130,
1006,
1007,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBStateDownloader.java | RocksDBStateDownloader.downloadDataForStateHandle | private void downloadDataForStateHandle(
Path restoreFilePath,
StreamStateHandle remoteFileHandle,
CloseableRegistry closeableRegistry) throws IOException {
FSDataInputStream inputStream = null;
FSDataOutputStream outputStream = null;
try {
FileSystem restoreFileSystem = restoreFilePath.getFileSystem();
inputStream = remoteFileHandle.openInputStream();
closeableRegistry.registerCloseable(inputStream);
outputStream = restoreFileSystem.create(restoreFilePath, FileSystem.WriteMode.OVERWRITE);
closeableRegistry.registerCloseable(outputStream);
byte[] buffer = new byte[8 * 1024];
while (true) {
int numBytes = inputStream.read(buffer);
if (numBytes == -1) {
break;
}
outputStream.write(buffer, 0, numBytes);
}
} finally {
if (closeableRegistry.unregisterCloseable(inputStream)) {
inputStream.close();
}
if (closeableRegistry.unregisterCloseable(outputStream)) {
outputStream.close();
}
}
} | java | private void downloadDataForStateHandle(
Path restoreFilePath,
StreamStateHandle remoteFileHandle,
CloseableRegistry closeableRegistry) throws IOException {
FSDataInputStream inputStream = null;
FSDataOutputStream outputStream = null;
try {
FileSystem restoreFileSystem = restoreFilePath.getFileSystem();
inputStream = remoteFileHandle.openInputStream();
closeableRegistry.registerCloseable(inputStream);
outputStream = restoreFileSystem.create(restoreFilePath, FileSystem.WriteMode.OVERWRITE);
closeableRegistry.registerCloseable(outputStream);
byte[] buffer = new byte[8 * 1024];
while (true) {
int numBytes = inputStream.read(buffer);
if (numBytes == -1) {
break;
}
outputStream.write(buffer, 0, numBytes);
}
} finally {
if (closeableRegistry.unregisterCloseable(inputStream)) {
inputStream.close();
}
if (closeableRegistry.unregisterCloseable(outputStream)) {
outputStream.close();
}
}
} | [
"private",
"void",
"downloadDataForStateHandle",
"(",
"Path",
"restoreFilePath",
",",
"StreamStateHandle",
"remoteFileHandle",
",",
"CloseableRegistry",
"closeableRegistry",
")",
"throws",
"IOException",
"{",
"FSDataInputStream",
"inputStream",
"=",
"null",
";",
"FSDataOutp... | Copies the file from a single state handle to the given path. | [
"Copies",
"the",
"file",
"from",
"a",
"single",
"state",
"handle",
"to",
"the",
"given",
"path",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBStateDownloader.java#L117-L151 | train | Download data for the given state handle. | [
30522,
2797,
11675,
8816,
2850,
2696,
29278,
9153,
2618,
11774,
2571,
1006,
4130,
9239,
8873,
2571,
15069,
1010,
9199,
12259,
11774,
2571,
6556,
8873,
2571,
11774,
2571,
1010,
2485,
3085,
2890,
24063,
2854,
2485,
3085,
2890,
24063,
2854,
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/rest/handler/legacy/backpressure/StackTraceSampleCoordinator.java | StackTraceSampleCoordinator.shutDown | public void shutDown() {
synchronized (lock) {
if (!isShutDown) {
LOG.info("Shutting down stack trace sample coordinator.");
for (PendingStackTraceSample pending : pendingSamples.values()) {
pending.discard(new RuntimeException("Shut down"));
}
pendingSamples.clear();
isShutDown = true;
}
}
} | java | public void shutDown() {
synchronized (lock) {
if (!isShutDown) {
LOG.info("Shutting down stack trace sample coordinator.");
for (PendingStackTraceSample pending : pendingSamples.values()) {
pending.discard(new RuntimeException("Shut down"));
}
pendingSamples.clear();
isShutDown = true;
}
}
} | [
"public",
"void",
"shutDown",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"!",
"isShutDown",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Shutting down stack trace sample coordinator.\"",
")",
";",
"for",
"(",
"PendingStackTraceSample",
"pending",
... | Shuts down the coordinator.
<p>After shut down, no further operations are executed. | [
"Shuts",
"down",
"the",
"coordinator",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/backpressure/StackTraceSampleCoordinator.java#L217-L231 | train | Shut down the coordinator. | [
30522,
2270,
11675,
3844,
7698,
1006,
1007,
1063,
25549,
1006,
5843,
1007,
1063,
2065,
1006,
999,
26354,
6979,
2102,
7698,
1007,
1063,
8833,
1012,
18558,
1006,
1000,
17521,
2091,
9991,
7637,
7099,
10669,
1012,
1000,
1007,
1025,
2005,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/types/Either.java | Either.obtainLeft | @Internal
public static <L, R> Left<L, R> obtainLeft(Either<L, R> input, TypeSerializer<L> leftSerializer) {
if (input.isLeft()) {
return (Left<L, R>) input;
} else {
Right<L, R> right = (Right<L, R>) input;
if (right.left == null) {
right.left = Left.of(leftSerializer.createInstance());
right.left.right = right;
}
return right.left;
}
} | java | @Internal
public static <L, R> Left<L, R> obtainLeft(Either<L, R> input, TypeSerializer<L> leftSerializer) {
if (input.isLeft()) {
return (Left<L, R>) input;
} else {
Right<L, R> right = (Right<L, R>) input;
if (right.left == null) {
right.left = Left.of(leftSerializer.createInstance());
right.left.right = right;
}
return right.left;
}
} | [
"@",
"Internal",
"public",
"static",
"<",
"L",
",",
"R",
">",
"Left",
"<",
"L",
",",
"R",
">",
"obtainLeft",
"(",
"Either",
"<",
"L",
",",
"R",
">",
"input",
",",
"TypeSerializer",
"<",
"L",
">",
"leftSerializer",
")",
"{",
"if",
"(",
"input",
".... | Utility function for {@link EitherSerializer} to support object reuse.
To support object reuse both subclasses of Either contain a reference to
an instance of the other type. This method provides access to and
initializes the cross-reference.
@param input container for Left or Right value
@param leftSerializer for creating an instance of the left type
@param <L>
the type of Left
@param <R>
the type of Right
@return input if Left type else input's Left reference | [
"Utility",
"function",
"for",
"{",
"@link",
"EitherSerializer",
"}",
"to",
"support",
"object",
"reuse",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/Either.java#L232-L244 | train | Obtains the left. | [
30522,
1030,
4722,
2270,
10763,
1026,
1048,
1010,
1054,
1028,
2187,
1026,
1048,
1010,
1054,
1028,
6855,
2571,
6199,
1006,
2593,
1026,
1048,
1010,
1054,
1028,
7953,
1010,
4127,
11610,
28863,
1026,
1048,
1028,
2187,
8043,
4818,
17629,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.