repo stringclasses 11 values | path stringlengths 41 234 | func_name stringlengths 5 78 | original_string stringlengths 71 14.1k | language stringclasses 1 value | code stringlengths 71 14.1k | code_tokens listlengths 22 2.65k | docstring stringlengths 2 5.35k | docstring_tokens listlengths 1 369 | sha stringclasses 11 values | url stringlengths 129 339 | partition stringclasses 1 value | summary stringlengths 7 175 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronLexicalAnalyzer.java | PerceptronLexicalAnalyzer.segment | public void segment(String text, List<String> output)
{
String normalized = CharTable.convert(text);
segment(text, normalized, output);
} | java | public void segment(String text, List<String> output)
{
String normalized = CharTable.convert(text);
segment(text, normalized, output);
} | [
"public",
"void",
"segment",
"(",
"String",
"text",
",",
"List",
"<",
"String",
">",
"output",
")",
"{",
"String",
"normalized",
"=",
"CharTable",
".",
"convert",
"(",
"text",
")",
";",
"segment",
"(",
"text",
",",
"normalized",
",",
"output",
")",
";"... | 中文分词
@param text
@param output | [
"中文分词"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronLexicalAnalyzer.java#L104-L108 | train | segment a text into a list of tokens. | [
30522,
2270,
11675,
6903,
1006,
5164,
3793,
1010,
2862,
1026,
5164,
1028,
6434,
1007,
1063,
5164,
3671,
3550,
1027,
3673,
3085,
1012,
10463,
1006,
3793,
1007,
1025,
6903,
1006,
3793,
1010,
3671,
3550,
1010,
6434,
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... |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java | KinesisDataFetcher.emitRecordAndUpdateState | protected void emitRecordAndUpdateState(T record, long recordTimestamp, int shardStateIndex, SequenceNumber lastSequenceNumber) {
// track per shard watermarks and emit timestamps extracted from the record,
// when a watermark assigner was configured.
if (periodicWatermarkAssigner != null) {
ShardWatermarkState sws = shardWatermarks.get(shardStateIndex);
Preconditions.checkNotNull(
sws, "shard watermark state initialized in registerNewSubscribedShardState");
recordTimestamp =
sws.periodicWatermarkAssigner.extractTimestamp(record, sws.lastRecordTimestamp);
sws.lastRecordTimestamp = recordTimestamp;
sws.lastUpdated = getCurrentTimeMillis();
}
synchronized (checkpointLock) {
if (record != null) {
sourceContext.collectWithTimestamp(record, recordTimestamp);
} else {
LOG.warn("Skipping non-deserializable record at sequence number {} of shard {}.",
lastSequenceNumber,
subscribedShardsState.get(shardStateIndex).getStreamShardHandle());
}
updateState(shardStateIndex, lastSequenceNumber);
}
} | java | protected void emitRecordAndUpdateState(T record, long recordTimestamp, int shardStateIndex, SequenceNumber lastSequenceNumber) {
// track per shard watermarks and emit timestamps extracted from the record,
// when a watermark assigner was configured.
if (periodicWatermarkAssigner != null) {
ShardWatermarkState sws = shardWatermarks.get(shardStateIndex);
Preconditions.checkNotNull(
sws, "shard watermark state initialized in registerNewSubscribedShardState");
recordTimestamp =
sws.periodicWatermarkAssigner.extractTimestamp(record, sws.lastRecordTimestamp);
sws.lastRecordTimestamp = recordTimestamp;
sws.lastUpdated = getCurrentTimeMillis();
}
synchronized (checkpointLock) {
if (record != null) {
sourceContext.collectWithTimestamp(record, recordTimestamp);
} else {
LOG.warn("Skipping non-deserializable record at sequence number {} of shard {}.",
lastSequenceNumber,
subscribedShardsState.get(shardStateIndex).getStreamShardHandle());
}
updateState(shardStateIndex, lastSequenceNumber);
}
} | [
"protected",
"void",
"emitRecordAndUpdateState",
"(",
"T",
"record",
",",
"long",
"recordTimestamp",
",",
"int",
"shardStateIndex",
",",
"SequenceNumber",
"lastSequenceNumber",
")",
"{",
"// track per shard watermarks and emit timestamps extracted from the record,",
"// when a wa... | Atomic operation to collect a record and update state to the sequence number of the record.
This method is called by {@link ShardConsumer}s.
@param record the record to collect
@param recordTimestamp timestamp to attach to the collected record
@param shardStateIndex index of the shard to update in subscribedShardsState;
this index should be the returned value from
{@link KinesisDataFetcher#registerNewSubscribedShardState(KinesisStreamShardState)}, called
when the shard state was registered.
@param lastSequenceNumber the last sequence number value to update | [
"Atomic",
"operation",
"to",
"collect",
"a",
"record",
"and",
"update",
"state",
"to",
"the",
"sequence",
"number",
"of",
"the",
"record",
".",
"This",
"method",
"is",
"called",
"by",
"{",
"@link",
"ShardConsumer",
"}",
"s",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java#L605-L629 | train | Emit a record and update the state of the stream. | [
30522,
5123,
11675,
12495,
7913,
27108,
7847,
8566,
17299,
8520,
12259,
1006,
1056,
2501,
1010,
2146,
2501,
7292,
9153,
8737,
1010,
20014,
23327,
12259,
22254,
10288,
1010,
5537,
19172,
5677,
16180,
2063,
4226,
5897,
19172,
5677,
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... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/table/descriptors/Kafka.java | Kafka.startFromSpecificOffset | public Kafka startFromSpecificOffset(int partition, long specificOffset) {
this.startupMode = StartupMode.SPECIFIC_OFFSETS;
if (this.specificOffsets == null) {
this.specificOffsets = new HashMap<>();
}
this.specificOffsets.put(partition, specificOffset);
return this;
} | java | public Kafka startFromSpecificOffset(int partition, long specificOffset) {
this.startupMode = StartupMode.SPECIFIC_OFFSETS;
if (this.specificOffsets == null) {
this.specificOffsets = new HashMap<>();
}
this.specificOffsets.put(partition, specificOffset);
return this;
} | [
"public",
"Kafka",
"startFromSpecificOffset",
"(",
"int",
"partition",
",",
"long",
"specificOffset",
")",
"{",
"this",
".",
"startupMode",
"=",
"StartupMode",
".",
"SPECIFIC_OFFSETS",
";",
"if",
"(",
"this",
".",
"specificOffsets",
"==",
"null",
")",
"{",
"th... | Configures to start reading partitions from specific offsets and specifies the given offset for
the given partition.
@param partition partition index
@param specificOffset partition offset to start reading from
@see FlinkKafkaConsumerBase#setStartFromSpecificOffsets(Map) | [
"Configures",
"to",
"start",
"reading",
"partitions",
"from",
"specific",
"offsets",
"and",
"specifies",
"the",
"given",
"offset",
"for",
"the",
"given",
"partition",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/table/descriptors/Kafka.java#L177-L184 | train | Start Kafka from specific offsets. | [
30522,
2270,
10556,
24316,
2050,
2707,
19699,
22225,
5051,
6895,
8873,
3597,
21807,
3388,
1006,
20014,
13571,
1010,
2146,
3563,
27475,
3388,
1007,
1063,
2023,
1012,
22752,
5302,
3207,
1027,
22752,
5302,
3207,
1012,
3563,
1035,
16396,
2015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java | ColumnVector.getInts | public int[] getInts(int rowId, int count) {
int[] res = new int[count];
for (int i = 0; i < count; i++) {
res[i] = getInt(rowId + i);
}
return res;
} | java | public int[] getInts(int rowId, int count) {
int[] res = new int[count];
for (int i = 0; i < count; i++) {
res[i] = getInt(rowId + i);
}
return res;
} | [
"public",
"int",
"[",
"]",
"getInts",
"(",
"int",
"rowId",
",",
"int",
"count",
")",
"{",
"int",
"[",
"]",
"res",
"=",
"new",
"int",
"[",
"count",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",... | Gets int type values from [rowId, rowId + count). The return values for the null slots
are undefined and can be anything. | [
"Gets",
"int",
"type",
"values",
"from",
"[",
"rowId",
"rowId",
"+",
"count",
")",
".",
"The",
"return",
"values",
"for",
"the",
"null",
"slots",
"are",
"undefined",
"and",
"can",
"be",
"anything",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnVector.java#L146-L152 | train | Gets the ints from the specified row. | [
30522,
2270,
20014,
1031,
1033,
2131,
18447,
2015,
1006,
20014,
5216,
3593,
1010,
20014,
4175,
1007,
1063,
20014,
1031,
1033,
24501,
1027,
2047,
20014,
1031,
4175,
1033,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
4175,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java | CLIService.executeStatement | @Override
public OperationHandle executeStatement(SessionHandle sessionHandle, String statement,
Map<String, String> confOverlay)
throws HiveSQLException {
OperationHandle opHandle = sessionManager.getSession(sessionHandle)
.executeStatement(statement, confOverlay);
LOG.debug(sessionHandle + ": executeStatement()");
return opHandle;
} | java | @Override
public OperationHandle executeStatement(SessionHandle sessionHandle, String statement,
Map<String, String> confOverlay)
throws HiveSQLException {
OperationHandle opHandle = sessionManager.getSession(sessionHandle)
.executeStatement(statement, confOverlay);
LOG.debug(sessionHandle + ": executeStatement()");
return opHandle;
} | [
"@",
"Override",
"public",
"OperationHandle",
"executeStatement",
"(",
"SessionHandle",
"sessionHandle",
",",
"String",
"statement",
",",
"Map",
"<",
"String",
",",
"String",
">",
"confOverlay",
")",
"throws",
"HiveSQLException",
"{",
"OperationHandle",
"opHandle",
... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#executeStatement(org.apache.hive.service.cli.SessionHandle,
java.lang.String, java.util.Map) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java#L257-L265 | train | Execute a SQL statement. | [
30522,
1030,
2058,
15637,
2270,
3169,
11774,
2571,
15389,
9153,
18532,
4765,
1006,
5219,
11774,
2571,
5219,
11774,
2571,
1010,
5164,
4861,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
9530,
14876,
6299,
8485,
1007,
11618,
26736,
2015,
4160,
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 | codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java | HttpUtil.set100ContinueExpected | public static void set100ContinueExpected(HttpMessage message, boolean expected) {
if (expected) {
message.headers().set(HttpHeaderNames.EXPECT, HttpHeaderValues.CONTINUE);
} else {
message.headers().remove(HttpHeaderNames.EXPECT);
}
} | java | public static void set100ContinueExpected(HttpMessage message, boolean expected) {
if (expected) {
message.headers().set(HttpHeaderNames.EXPECT, HttpHeaderValues.CONTINUE);
} else {
message.headers().remove(HttpHeaderNames.EXPECT);
}
} | [
"public",
"static",
"void",
"set100ContinueExpected",
"(",
"HttpMessage",
"message",
",",
"boolean",
"expected",
")",
"{",
"if",
"(",
"expected",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"set",
"(",
"HttpHeaderNames",
".",
"EXPECT",
",",
"HttpHead... | Sets or removes the {@code "Expect: 100-continue"} header to / from the
specified message. If {@code expected} is {@code true},
the {@code "Expect: 100-continue"} header is set and all other previous
{@code "Expect"} headers are removed. Otherwise, all {@code "Expect"}
headers are removed completely. | [
"Sets",
"or",
"removes",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java#L286-L292 | train | Sets the 100 Continue expected header. | [
30522,
2270,
10763,
11675,
2275,
18613,
8663,
7629,
5657,
10288,
5051,
10985,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
22017,
20898,
3517,
1007,
1063,
2065,
1006,
3517,
1007,
1063,
4471,
1012,
20346,
2015,
1006,
1007,
1012,
2275,
1006,
829... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | public static void addDeprecation(String key, String newKey) {
addDeprecation(key, new String[] {newKey}, null);
} | java | public static void addDeprecation(String key, String newKey) {
addDeprecation(key, new String[] {newKey}, null);
} | [
"public",
"static",
"void",
"addDeprecation",
"(",
"String",
"key",
",",
"String",
"newKey",
")",
"{",
"addDeprecation",
"(",
"key",
",",
"new",
"String",
"[",
"]",
"{",
"newKey",
"}",
",",
"null",
")",
";",
"}"
] | Adds the deprecated key to the global deprecation map when no custom
message is provided.
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 you have multiple deprecation entries to add, it is more efficient to
use #addDeprecations(DeprecationDelta[] deltas) instead.
@param key Key that is to be deprecated
@param newKey key that takes up the value of deprecated key | [
"Adds",
"the",
"deprecated",
"key",
"to",
"the",
"global",
"deprecation",
"map",
"when",
"no",
"custom",
"message",
"is",
"provided",
".",
"It",
"does",
"not",
"override",
"any",
"existing",
"entries",
"in",
"the",
"deprecation",
"map",
".",
"This",
"is",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L549-L551 | train | Add a deprecation for the given key. | [
30522,
2270,
10763,
11675,
5587,
3207,
28139,
10719,
1006,
5164,
3145,
1010,
5164,
2047,
14839,
1007,
1063,
5587,
3207,
28139,
10719,
1006,
3145,
1010,
2047,
5164,
1031,
1033,
1063,
2047,
14839,
1065,
1010,
19701,
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-cron/src/main/java/cn/hutool/cron/CronUtil.java | CronUtil.start | synchronized public static void start(boolean isDeamon) {
if (null == crontabSetting) {
// 尝试查找config/cron.setting
setCronSetting(CRONTAB_CONFIG_PATH);
}
// 尝试查找cron.setting
if (null == crontabSetting) {
setCronSetting(CRONTAB_CONFIG_PATH2);
}
if (scheduler.isStarted()) {
throw new UtilException("Scheduler has been started, please stop it first!");
}
schedule(crontabSetting);
scheduler.start(isDeamon);
} | java | synchronized public static void start(boolean isDeamon) {
if (null == crontabSetting) {
// 尝试查找config/cron.setting
setCronSetting(CRONTAB_CONFIG_PATH);
}
// 尝试查找cron.setting
if (null == crontabSetting) {
setCronSetting(CRONTAB_CONFIG_PATH2);
}
if (scheduler.isStarted()) {
throw new UtilException("Scheduler has been started, please stop it first!");
}
schedule(crontabSetting);
scheduler.start(isDeamon);
} | [
"synchronized",
"public",
"static",
"void",
"start",
"(",
"boolean",
"isDeamon",
")",
"{",
"if",
"(",
"null",
"==",
"crontabSetting",
")",
"{",
"// 尝试查找config/cron.setting",
"setCronSetting",
"(",
"CRONTAB_CONFIG_PATH",
")",
";",
"}",
"// 尝试查找cron.setting",
"if",
... | 开始
@param isDeamon 是否以守护线程方式启动,如果为true,则在调用{@link #stop()}方法后执行的定时任务立即结束,否则等待执行完毕才结束。 | [
"开始"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/CronUtil.java#L149-L164 | train | Start the scheduler. | [
30522,
25549,
2270,
10763,
11675,
2707,
1006,
22017,
20898,
2003,
3207,
22591,
2078,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
13675,
12162,
7875,
21678,
2075,
1007,
1063,
1013,
1013,
100,
100,
100,
100,
9530,
8873,
2290,
1013,
13675,
2239... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java | MainClassFinder.findSingleMainClass | public static String findSingleMainClass(File rootFolder, String annotationName)
throws IOException {
SingleMainClassCallback callback = new SingleMainClassCallback(annotationName);
MainClassFinder.doWithMainClasses(rootFolder, callback);
return callback.getMainClassName();
} | java | public static String findSingleMainClass(File rootFolder, String annotationName)
throws IOException {
SingleMainClassCallback callback = new SingleMainClassCallback(annotationName);
MainClassFinder.doWithMainClasses(rootFolder, callback);
return callback.getMainClassName();
} | [
"public",
"static",
"String",
"findSingleMainClass",
"(",
"File",
"rootFolder",
",",
"String",
"annotationName",
")",
"throws",
"IOException",
"{",
"SingleMainClassCallback",
"callback",
"=",
"new",
"SingleMainClassCallback",
"(",
"annotationName",
")",
";",
"MainClassF... | Find a single main class from the given {@code rootFolder}. A main class annotated
with an annotation with the given {@code annotationName} will be preferred over a
main class with no such annotation.
@param rootFolder the root folder to search
@param annotationName the name of the annotation that may be present on the main
class
@return the main class or {@code null}
@throws IOException if the folder cannot be read | [
"Find",
"a",
"single",
"main",
"class",
"from",
"the",
"given",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java#L107-L112 | train | Find the main class name of the annotation. | [
30522,
2270,
10763,
5164,
4858,
2075,
16930,
8113,
26266,
1006,
5371,
7117,
10371,
2121,
1010,
5164,
5754,
17287,
3508,
18442,
1007,
11618,
22834,
10288,
24422,
1063,
2309,
24238,
26266,
9289,
20850,
8684,
2655,
5963,
1027,
2047,
2309,
24238,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/aftermatch/AfterMatchSkipStrategy.java | AfterMatchSkipStrategy.prune | public void prune(
Collection<ComputationState> matchesToPrune,
Collection<Map<String, List<EventId>>> matchedResult,
SharedBufferAccessor<?> sharedBufferAccessor) throws Exception {
EventId pruningId = getPruningId(matchedResult);
if (pruningId != null) {
List<ComputationState> discardStates = new ArrayList<>();
for (ComputationState computationState : matchesToPrune) {
if (computationState.getStartEventID() != null &&
shouldPrune(computationState.getStartEventID(), pruningId)) {
sharedBufferAccessor.releaseNode(computationState.getPreviousBufferEntry());
discardStates.add(computationState);
}
}
matchesToPrune.removeAll(discardStates);
}
} | java | public void prune(
Collection<ComputationState> matchesToPrune,
Collection<Map<String, List<EventId>>> matchedResult,
SharedBufferAccessor<?> sharedBufferAccessor) throws Exception {
EventId pruningId = getPruningId(matchedResult);
if (pruningId != null) {
List<ComputationState> discardStates = new ArrayList<>();
for (ComputationState computationState : matchesToPrune) {
if (computationState.getStartEventID() != null &&
shouldPrune(computationState.getStartEventID(), pruningId)) {
sharedBufferAccessor.releaseNode(computationState.getPreviousBufferEntry());
discardStates.add(computationState);
}
}
matchesToPrune.removeAll(discardStates);
}
} | [
"public",
"void",
"prune",
"(",
"Collection",
"<",
"ComputationState",
">",
"matchesToPrune",
",",
"Collection",
"<",
"Map",
"<",
"String",
",",
"List",
"<",
"EventId",
">",
">",
">",
"matchedResult",
",",
"SharedBufferAccessor",
"<",
"?",
">",
"sharedBufferAc... | Prunes matches/partial matches based on the chosen strategy.
@param matchesToPrune current partial matches
@param matchedResult already completed matches
@param sharedBufferAccessor accessor to corresponding shared buffer
@throws Exception thrown if could not access the state | [
"Prunes",
"matches",
"/",
"partial",
"matches",
"based",
"on",
"the",
"chosen",
"strategy",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/aftermatch/AfterMatchSkipStrategy.java#L102-L119 | train | Prune a collection of matches to be considered to be discarded. | [
30522,
2270,
11675,
10975,
9816,
1006,
3074,
1026,
22334,
9153,
2618,
1028,
3503,
14399,
15532,
2063,
1010,
3074,
1026,
4949,
1026,
5164,
1010,
2862,
1026,
2724,
3593,
1028,
1028,
1028,
10349,
6072,
11314,
1010,
4207,
8569,
12494,
6305,
962... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.round | public static DateTime round(Date date, DateField dateField) {
return new DateTime(round(calendar(date), dateField));
} | java | public static DateTime round(Date date, DateField dateField) {
return new DateTime(round(calendar(date), dateField));
} | [
"public",
"static",
"DateTime",
"round",
"(",
"Date",
"date",
",",
"DateField",
"dateField",
")",
"{",
"return",
"new",
"DateTime",
"(",
"round",
"(",
"calendar",
"(",
"date",
")",
",",
"dateField",
")",
")",
";",
"}"
] | 修改日期为某个时间字段四舍五入时间
@param date {@link Date}
@param dateField 时间字段
@return {@link DateTime}
@since 4.5.7 | [
"修改日期为某个时间字段四舍五入时间"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L779-L781 | train | Round to the nearest integer value. | [
30522,
2270,
10763,
3058,
7292,
2461,
1006,
3058,
3058,
1010,
3058,
3790,
3058,
3790,
1007,
1063,
2709,
2047,
3058,
7292,
1006,
2461,
1006,
8094,
1006,
3058,
1007,
1010,
3058,
3790,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/WindowOperator.java | WindowOperator.registerCleanupTimer | private void registerCleanupTimer(W window) {
long cleanupTime = cleanupTime(window);
if (cleanupTime == Long.MAX_VALUE) {
// don't set a GC timer for "end of time"
return;
}
if (windowAssigner.isEventTime()) {
triggerContext.registerEventTimeTimer(cleanupTime);
} else {
triggerContext.registerProcessingTimeTimer(cleanupTime);
}
} | java | private void registerCleanupTimer(W window) {
long cleanupTime = cleanupTime(window);
if (cleanupTime == Long.MAX_VALUE) {
// don't set a GC timer for "end of time"
return;
}
if (windowAssigner.isEventTime()) {
triggerContext.registerEventTimeTimer(cleanupTime);
} else {
triggerContext.registerProcessingTimeTimer(cleanupTime);
}
} | [
"private",
"void",
"registerCleanupTimer",
"(",
"W",
"window",
")",
"{",
"long",
"cleanupTime",
"=",
"cleanupTime",
"(",
"window",
")",
";",
"if",
"(",
"cleanupTime",
"==",
"Long",
".",
"MAX_VALUE",
")",
"{",
"// don't set a GC timer for \"end of time\"",
"return"... | Registers a timer to cleanup the content of the window.
@param window the window whose state to discard | [
"Registers",
"a",
"timer",
"to",
"cleanup",
"the",
"content",
"of",
"the",
"window",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/WindowOperator.java#L472-L484 | train | Registers a cleanup timer for the given window. | [
30522,
2797,
11675,
4236,
14321,
24076,
13876,
14428,
2099,
1006,
1059,
3332,
1007,
1063,
2146,
27686,
7292,
1027,
27686,
7292,
1006,
3332,
1007,
30524,
1012,
2003,
18697,
3372,
7292,
1006,
1007,
1007,
1063,
9495,
8663,
18209,
1012,
4236,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/io/FileOutputFormat.java | FileOutputFormat.initializeGlobal | @Override
public void initializeGlobal(int parallelism) throws IOException {
final Path path = getOutputFilePath();
final FileSystem fs = path.getFileSystem();
// only distributed file systems can be initialized at start-up time.
if (fs.isDistributedFS()) {
final WriteMode writeMode = getWriteMode();
final OutputDirectoryMode outDirMode = getOutputDirectoryMode();
if (parallelism == 1 && outDirMode == OutputDirectoryMode.PARONLY) {
// output is not written in parallel and should be written to a single file.
// prepare distributed output path
if(!fs.initOutPathDistFS(path, writeMode, false)) {
// output preparation failed! Cancel task.
throw new IOException("Output path could not be initialized.");
}
} else {
// output should be written to a directory
// only distributed file systems can be initialized at start-up time.
if(!fs.initOutPathDistFS(path, writeMode, true)) {
throw new IOException("Output directory could not be created.");
}
}
}
} | java | @Override
public void initializeGlobal(int parallelism) throws IOException {
final Path path = getOutputFilePath();
final FileSystem fs = path.getFileSystem();
// only distributed file systems can be initialized at start-up time.
if (fs.isDistributedFS()) {
final WriteMode writeMode = getWriteMode();
final OutputDirectoryMode outDirMode = getOutputDirectoryMode();
if (parallelism == 1 && outDirMode == OutputDirectoryMode.PARONLY) {
// output is not written in parallel and should be written to a single file.
// prepare distributed output path
if(!fs.initOutPathDistFS(path, writeMode, false)) {
// output preparation failed! Cancel task.
throw new IOException("Output path could not be initialized.");
}
} else {
// output should be written to a directory
// only distributed file systems can be initialized at start-up time.
if(!fs.initOutPathDistFS(path, writeMode, true)) {
throw new IOException("Output directory could not be created.");
}
}
}
} | [
"@",
"Override",
"public",
"void",
"initializeGlobal",
"(",
"int",
"parallelism",
")",
"throws",
"IOException",
"{",
"final",
"Path",
"path",
"=",
"getOutputFilePath",
"(",
")",
";",
"final",
"FileSystem",
"fs",
"=",
"path",
".",
"getFileSystem",
"(",
")",
"... | Initialization of the distributed file system if it is used.
@param parallelism The task parallelism. | [
"Initialization",
"of",
"the",
"distributed",
"file",
"system",
"if",
"it",
"is",
"used",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/FileOutputFormat.java#L272-L300 | train | Initialize the global output file system. | [
30522,
1030,
2058,
15637,
2270,
11675,
3988,
4697,
23296,
16429,
2389,
1006,
20014,
5903,
2964,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
4130,
4130,
1027,
2131,
5833,
18780,
8873,
2571,
15069,
1006,
1007,
1025,
2345,
6764,
27268,
6633,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java | FastDateParser.init | private void init(final Calendar definingCalendar) {
patterns = new ArrayList<>();
final StrategyParser fm = new StrategyParser(definingCalendar);
for (;;) {
final StrategyAndWidth field = fm.getNextStrategy();
if (field == null) {
break;
}
patterns.add(field);
}
} | java | private void init(final Calendar definingCalendar) {
patterns = new ArrayList<>();
final StrategyParser fm = new StrategyParser(definingCalendar);
for (;;) {
final StrategyAndWidth field = fm.getNextStrategy();
if (field == null) {
break;
}
patterns.add(field);
}
} | [
"private",
"void",
"init",
"(",
"final",
"Calendar",
"definingCalendar",
")",
"{",
"patterns",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"StrategyParser",
"fm",
"=",
"new",
"StrategyParser",
"(",
"definingCalendar",
")",
";",
"for",
"(",
";",
... | Initialize derived fields from defining fields. This is called from constructor and from readObject (de-serialization)
@param definingCalendar the {@link java.util.Calendar} instance used to initialize this FastDateParser | [
"Initialize",
"derived",
"fields",
"from",
"defining",
"fields",
".",
"This",
"is",
"called",
"from",
"constructor",
"and",
"from",
"readObject",
"(",
"de",
"-",
"serialization",
")"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java#L105-L116 | train | Initializes the list of rules. | [
30522,
2797,
11675,
1999,
4183,
1006,
2345,
8094,
12854,
9289,
10497,
2906,
1007,
1063,
7060,
1027,
2047,
9140,
9863,
1026,
1028,
1006,
1007,
1025,
2345,
5656,
19362,
8043,
4718,
1027,
2047,
5656,
19362,
8043,
1006,
12854,
9289,
10497,
2906... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java | Pattern.begin | public static <T, F extends T> GroupPattern<T, F> begin(final Pattern<T, F> group, final AfterMatchSkipStrategy afterMatchSkipStrategy) {
return new GroupPattern<>(null, group, ConsumingStrategy.STRICT, afterMatchSkipStrategy);
} | java | public static <T, F extends T> GroupPattern<T, F> begin(final Pattern<T, F> group, final AfterMatchSkipStrategy afterMatchSkipStrategy) {
return new GroupPattern<>(null, group, ConsumingStrategy.STRICT, afterMatchSkipStrategy);
} | [
"public",
"static",
"<",
"T",
",",
"F",
"extends",
"T",
">",
"GroupPattern",
"<",
"T",
",",
"F",
">",
"begin",
"(",
"final",
"Pattern",
"<",
"T",
",",
"F",
">",
"group",
",",
"final",
"AfterMatchSkipStrategy",
"afterMatchSkipStrategy",
")",
"{",
"return"... | Starts a new pattern sequence. The provided pattern is the initial pattern
of the new sequence.
@param group the pattern to begin with
@param afterMatchSkipStrategy the {@link AfterMatchSkipStrategy.SkipStrategy} to use after each match.
@return The first pattern of a pattern sequence | [
"Starts",
"a",
"new",
"pattern",
"sequence",
".",
"The",
"provided",
"pattern",
"is",
"the",
"initial",
"pattern",
"of",
"the",
"new",
"sequence",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/pattern/Pattern.java#L493-L495 | train | Creates a new group pattern with a strict ConsumingStrategy. | [
30522,
2270,
10763,
1026,
1056,
1010,
1042,
8908,
1056,
1028,
2177,
4502,
12079,
2078,
1026,
1056,
1010,
1042,
1028,
4088,
1006,
2345,
5418,
1026,
1056,
1010,
1042,
1028,
2177,
1010,
2345,
2044,
18900,
18069,
3211,
4523,
6494,
2618,
6292,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/WebServiceTemplateBuilder.java | WebServiceTemplateBuilder.setWebServiceMessageFactory | public WebServiceTemplateBuilder setWebServiceMessageFactory(
WebServiceMessageFactory messageFactory) {
Assert.notNull(messageFactory, "MessageFactory must not be null");
return new WebServiceTemplateBuilder(this.detectHttpMessageSender,
this.interceptors, this.internalCustomizers, this.customizers,
this.messageSenders, this.marshaller, this.unmarshaller,
this.destinationProvider, this.transformerFactoryClass, messageFactory);
} | java | public WebServiceTemplateBuilder setWebServiceMessageFactory(
WebServiceMessageFactory messageFactory) {
Assert.notNull(messageFactory, "MessageFactory must not be null");
return new WebServiceTemplateBuilder(this.detectHttpMessageSender,
this.interceptors, this.internalCustomizers, this.customizers,
this.messageSenders, this.marshaller, this.unmarshaller,
this.destinationProvider, this.transformerFactoryClass, messageFactory);
} | [
"public",
"WebServiceTemplateBuilder",
"setWebServiceMessageFactory",
"(",
"WebServiceMessageFactory",
"messageFactory",
")",
"{",
"Assert",
".",
"notNull",
"(",
"messageFactory",
",",
"\"MessageFactory must not be null\"",
")",
";",
"return",
"new",
"WebServiceTemplateBuilder"... | Sets the {@link WebServiceMessageFactory} to use for creating messages.
@param messageFactory the message factory to use for creating messages
@return a new builder instance.
@see WebServiceTemplate#setMessageFactory(WebServiceMessageFactory) | [
"Sets",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/WebServiceTemplateBuilder.java#L367-L374 | train | Sets the message factory to use for creating the message sender. | [
30522,
2270,
4773,
8043,
7903,
12870,
8737,
13806,
8569,
23891,
2099,
2275,
8545,
5910,
2121,
7903,
21382,
11488,
3351,
21450,
1006,
4773,
8043,
7903,
21382,
11488,
3351,
21450,
4471,
21450,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanDesc.java | BeanDesc.getField | public Field getField(String fieldName) {
final PropDesc desc = this.propMap.get(fieldName);
return null == desc ? null : desc.getField();
} | java | public Field getField(String fieldName) {
final PropDesc desc = this.propMap.get(fieldName);
return null == desc ? null : desc.getField();
} | [
"public",
"Field",
"getField",
"(",
"String",
"fieldName",
")",
"{",
"final",
"PropDesc",
"desc",
"=",
"this",
".",
"propMap",
".",
"get",
"(",
"fieldName",
")",
";",
"return",
"null",
"==",
"desc",
"?",
"null",
":",
"desc",
".",
"getField",
"(",
")",
... | 获得字段名对应的字段对象,如果不存在返回null
@param fieldName 字段名
@return 字段值 | [
"获得字段名对应的字段对象,如果不存在返回null"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanDesc.java#L104-L107 | train | Returns the field with the given name. | [
30522,
2270,
2492,
2131,
3790,
1006,
5164,
2492,
18442,
1007,
1063,
2345,
17678,
6155,
2278,
4078,
2278,
1027,
2023,
1012,
17678,
2863,
2361,
1012,
2131,
1006,
2492,
18442,
1007,
1025,
2709,
19701,
1027,
1027,
4078,
2278,
1029,
19701,
1024,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/lexer/analyzer/Tokenizer.java | Tokenizer.scanSymbol | public Token scanSymbol() {
int length = 0;
while (CharType.isSymbol(charAt(offset + length))) {
length++;
}
String literals = input.substring(offset, offset + length);
Symbol symbol;
while (null == (symbol = Symbol.literalsOf(literals))) {
literals = input.substring(offset, offset + --length);
}
return new Token(symbol, literals, offset + length);
} | java | public Token scanSymbol() {
int length = 0;
while (CharType.isSymbol(charAt(offset + length))) {
length++;
}
String literals = input.substring(offset, offset + length);
Symbol symbol;
while (null == (symbol = Symbol.literalsOf(literals))) {
literals = input.substring(offset, offset + --length);
}
return new Token(symbol, literals, offset + length);
} | [
"public",
"Token",
"scanSymbol",
"(",
")",
"{",
"int",
"length",
"=",
"0",
";",
"while",
"(",
"CharType",
".",
"isSymbol",
"(",
"charAt",
"(",
"offset",
"+",
"length",
")",
")",
")",
"{",
"length",
"++",
";",
"}",
"String",
"literals",
"=",
"input",
... | scan symbol.
@return symbol token | [
"scan",
"symbol",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/lexer/analyzer/Tokenizer.java#L301-L312 | train | Scan a symbol. | [
30522,
2270,
19204,
27404,
24335,
14956,
1006,
1007,
1063,
20014,
3091,
1027,
1014,
1025,
2096,
1006,
3673,
18863,
1012,
26354,
24335,
14956,
1006,
25869,
4017,
1006,
16396,
1009,
3091,
1007,
1007,
1007,
1063,
3091,
1009,
1009,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.visibilityOfNestedElementsLocatedBy | public static ExpectedCondition<List<WebElement>> visibilityOfNestedElementsLocatedBy(
final By parent,
final By childLocator) {
return new ExpectedCondition<List<WebElement>>() {
@Override
public List<WebElement> apply(WebDriver driver) {
WebElement current = driver.findElement(parent);
List<WebElement> allChildren = current.findElements(childLocator);
// The original code only checked the first element. Fair enough.
if (!allChildren.isEmpty() && allChildren.get(0).isDisplayed()) {
return allChildren;
}
return null;
}
@Override
public String toString() {
return String.format("visibility of elements located by %s -> %s", parent, childLocator);
}
};
} | java | public static ExpectedCondition<List<WebElement>> visibilityOfNestedElementsLocatedBy(
final By parent,
final By childLocator) {
return new ExpectedCondition<List<WebElement>>() {
@Override
public List<WebElement> apply(WebDriver driver) {
WebElement current = driver.findElement(parent);
List<WebElement> allChildren = current.findElements(childLocator);
// The original code only checked the first element. Fair enough.
if (!allChildren.isEmpty() && allChildren.get(0).isDisplayed()) {
return allChildren;
}
return null;
}
@Override
public String toString() {
return String.format("visibility of elements located by %s -> %s", parent, childLocator);
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"List",
"<",
"WebElement",
">",
">",
"visibilityOfNestedElementsLocatedBy",
"(",
"final",
"By",
"parent",
",",
"final",
"By",
"childLocator",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"List",
"<",
"WebElemen... | An expectation for checking child WebElement as a part of parent element to be visible
@param parent used to check parent element. For example table with locator
By.id("fish")
@param childLocator used to find the ultimate child element.
@return visible nested element | [
"An",
"expectation",
"for",
"checking",
"child",
"WebElement",
"as",
"a",
"part",
"of",
"parent",
"element",
"to",
"be",
"visible"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L1159-L1182 | train | An expectation for checking that a list of elements is visible in a nested page. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
2862,
1026,
4773,
12260,
3672,
1028,
1028,
16476,
11253,
5267,
3064,
12260,
8163,
4135,
12921,
3762,
1006,
2345,
2011,
6687,
1010,
2345,
2011,
2775,
4135,
11266,
2953,
1007,
1063,
2709,
2047,
351... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashBucketArea.java | BinaryHashBucketArea.insertToBucket | boolean insertToBucket(int hashCode, int pointer, boolean spillingAllowed, boolean sizeAddAndCheckResize) throws IOException {
final int posHashCode = findBucket(hashCode);
// get the bucket for the given hash code
final int bucketArrayPos = posHashCode >> table.bucketsPerSegmentBits;
final int bucketInSegmentPos = (posHashCode & table.bucketsPerSegmentMask) << BUCKET_SIZE_BITS;
final MemorySegment bucket = this.buckets[bucketArrayPos];
return insertToBucket(bucket, bucketInSegmentPos, hashCode, pointer, spillingAllowed, sizeAddAndCheckResize);
} | java | boolean insertToBucket(int hashCode, int pointer, boolean spillingAllowed, boolean sizeAddAndCheckResize) throws IOException {
final int posHashCode = findBucket(hashCode);
// get the bucket for the given hash code
final int bucketArrayPos = posHashCode >> table.bucketsPerSegmentBits;
final int bucketInSegmentPos = (posHashCode & table.bucketsPerSegmentMask) << BUCKET_SIZE_BITS;
final MemorySegment bucket = this.buckets[bucketArrayPos];
return insertToBucket(bucket, bucketInSegmentPos, hashCode, pointer, spillingAllowed, sizeAddAndCheckResize);
} | [
"boolean",
"insertToBucket",
"(",
"int",
"hashCode",
",",
"int",
"pointer",
",",
"boolean",
"spillingAllowed",
",",
"boolean",
"sizeAddAndCheckResize",
")",
"throws",
"IOException",
"{",
"final",
"int",
"posHashCode",
"=",
"findBucket",
"(",
"hashCode",
")",
";",
... | Insert into bucket by hashCode and pointer.
@return return false when spill own partition. | [
"Insert",
"into",
"bucket",
"by",
"hashCode",
"and",
"pointer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashBucketArea.java#L436-L443 | train | Insert the given hash code into the bucket. | [
30522,
22017,
20898,
19274,
3406,
24204,
3388,
1006,
20014,
23325,
16044,
1010,
20014,
20884,
1010,
22017,
20898,
18054,
8095,
15096,
1010,
22017,
20898,
2946,
4215,
7847,
16409,
5369,
3600,
6072,
4697,
1007,
11618,
22834,
10288,
24422,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/Actions.java | Actions.click | public Actions click() {
if (isBuildingActions()) {
action.addAction(new ClickAction(jsonMouse, null));
}
return clickInTicks(LEFT);
} | java | public Actions click() {
if (isBuildingActions()) {
action.addAction(new ClickAction(jsonMouse, null));
}
return clickInTicks(LEFT);
} | [
"public",
"Actions",
"click",
"(",
")",
"{",
"if",
"(",
"isBuildingActions",
"(",
")",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"ClickAction",
"(",
"jsonMouse",
",",
"null",
")",
")",
";",
"}",
"return",
"clickInTicks",
"(",
"LEFT",
")",
";",
... | Clicks at the current mouse location. Useful when combined with
{@link #moveToElement(org.openqa.selenium.WebElement, int, int)} or
{@link #moveByOffset(int, int)}.
@return A self reference. | [
"Clicks",
"at",
"the",
"current",
"mouse",
"location",
".",
"Useful",
"when",
"combined",
"with",
"{"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L305-L311 | train | Clicks the user in the left tick of the document. | [
30522,
2270,
4506,
11562,
1006,
1007,
1063,
2065,
1006,
2003,
25820,
18908,
8496,
1006,
1007,
1007,
1063,
2895,
1012,
5587,
18908,
3258,
1006,
2047,
11562,
18908,
3258,
1006,
1046,
3385,
27711,
2063,
1010,
19701,
1007,
1007,
1025,
1065,
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/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/sql/dml/insert/InsertParserFactory.java | InsertParserFactory.newInstance | public static AbstractInsertParser newInstance(final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine, final ShardingTableMetaData shardingTableMetaData) {
switch (dbType) {
case H2:
case MySQL:
return new MySQLInsertParser(shardingRule, lexerEngine, shardingTableMetaData);
case Oracle:
return new OracleInsertParser(shardingRule, lexerEngine, shardingTableMetaData);
case SQLServer:
return new SQLServerInsertParser(shardingRule, lexerEngine, shardingTableMetaData);
case PostgreSQL:
return new PostgreSQLInsertParser(shardingRule, lexerEngine, shardingTableMetaData);
default:
throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType));
}
} | java | public static AbstractInsertParser newInstance(final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine, final ShardingTableMetaData shardingTableMetaData) {
switch (dbType) {
case H2:
case MySQL:
return new MySQLInsertParser(shardingRule, lexerEngine, shardingTableMetaData);
case Oracle:
return new OracleInsertParser(shardingRule, lexerEngine, shardingTableMetaData);
case SQLServer:
return new SQLServerInsertParser(shardingRule, lexerEngine, shardingTableMetaData);
case PostgreSQL:
return new PostgreSQLInsertParser(shardingRule, lexerEngine, shardingTableMetaData);
default:
throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType));
}
} | [
"public",
"static",
"AbstractInsertParser",
"newInstance",
"(",
"final",
"DatabaseType",
"dbType",
",",
"final",
"ShardingRule",
"shardingRule",
",",
"final",
"LexerEngine",
"lexerEngine",
",",
"final",
"ShardingTableMetaData",
"shardingTableMetaData",
")",
"{",
"switch",... | Create insert parser instance.
@param dbType database type
@param shardingRule databases and tables sharding rule
@param lexerEngine lexical analysis engine
@param shardingTableMetaData sharding meta data
@return insert parser instance | [
"Create",
"insert",
"parser",
"instance",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/sql/dml/insert/InsertParserFactory.java#L49-L63 | train | Create insert parser instance. | [
30522,
2270,
10763,
10061,
7076,
8743,
19362,
8043,
2047,
7076,
26897,
1006,
2345,
7809,
13874,
16962,
13874,
1010,
2345,
21146,
17080,
3070,
6820,
2571,
21146,
17080,
3070,
6820,
2571,
1010,
2345,
17244,
7869,
3070,
3170,
17244,
7869,
3070,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java | ResourceUtil.getResourceObj | public static Resource getResourceObj(String path) {
if(StrUtil.isNotBlank(path)) {
if(path.startsWith(URLUtil.FILE_URL_PREFIX) || FileUtil.isAbsolutePath(path)) {
return new FileResource(path);
}
}
return new ClassPathResource(path);
} | java | public static Resource getResourceObj(String path) {
if(StrUtil.isNotBlank(path)) {
if(path.startsWith(URLUtil.FILE_URL_PREFIX) || FileUtil.isAbsolutePath(path)) {
return new FileResource(path);
}
}
return new ClassPathResource(path);
} | [
"public",
"static",
"Resource",
"getResourceObj",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isNotBlank",
"(",
"path",
")",
")",
"{",
"if",
"(",
"path",
".",
"startsWith",
"(",
"URLUtil",
".",
"FILE_URL_PREFIX",
")",
"||",
"FileUtil",
"... | 获取{@link Resource} 资源对象<br>
如果提供路径为绝对路径或路径以file:开头,返回{@link FileResource},否则返回{@link ClassPathResource}
@param path 路径,可以是绝对路径,也可以是相对路径
@return {@link Resource} 资源对象
@since 3.2.1 | [
"获取",
"{",
"@link",
"Resource",
"}",
"资源对象<br",
">",
"如果提供路径为绝对路径或路径以file",
":",
"开头,返回",
"{",
"@link",
"FileResource",
"}",
",否则返回",
"{",
"@link",
"ClassPathResource",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java#L171-L178 | train | Get a resource object from a path. | [
30522,
2270,
10763,
7692,
2131,
6072,
8162,
3401,
16429,
3501,
1006,
5164,
4130,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
3475,
4140,
28522,
8950,
1006,
4130,
1007,
1007,
1063,
2065,
1006,
4130,
1012,
4627,
24415,
1006,
24471,
7630,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AbstractCoalescingBufferQueue.java | AbstractCoalescingBufferQueue.copyTo | public final void copyTo(AbstractCoalescingBufferQueue dest) {
dest.bufAndListenerPairs.addAll(bufAndListenerPairs);
dest.incrementReadableBytes(readableBytes);
} | java | public final void copyTo(AbstractCoalescingBufferQueue dest) {
dest.bufAndListenerPairs.addAll(bufAndListenerPairs);
dest.incrementReadableBytes(readableBytes);
} | [
"public",
"final",
"void",
"copyTo",
"(",
"AbstractCoalescingBufferQueue",
"dest",
")",
"{",
"dest",
".",
"bufAndListenerPairs",
".",
"addAll",
"(",
"bufAndListenerPairs",
")",
";",
"dest",
".",
"incrementReadableBytes",
"(",
"readableBytes",
")",
";",
"}"
] | Copy all pending entries in this queue into the destination queue.
@param dest to copy pending buffers to. | [
"Copy",
"all",
"pending",
"entries",
"in",
"this",
"queue",
"into",
"the",
"destination",
"queue",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java#L214-L217 | train | Copy the contents of this object to another object. | [
30522,
2270,
2345,
11675,
6100,
3406,
1006,
10061,
3597,
23266,
6129,
8569,
12494,
4226,
5657,
4078,
2102,
1007,
1063,
4078,
2102,
1012,
20934,
15143,
19422,
27870,
3678,
4502,
18894,
1012,
5587,
8095,
1006,
20934,
15143,
19422,
27870,
3678,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.refreshed | public static <T> ExpectedCondition<T> refreshed(final ExpectedCondition<T> condition) {
return new ExpectedCondition<T>() {
@Override
public T apply(WebDriver driver) {
try {
return condition.apply(driver);
} catch (StaleElementReferenceException e) {
return null;
}
}
@Override
public String toString() {
return String.format("condition (%s) to be refreshed", condition);
}
};
} | java | public static <T> ExpectedCondition<T> refreshed(final ExpectedCondition<T> condition) {
return new ExpectedCondition<T>() {
@Override
public T apply(WebDriver driver) {
try {
return condition.apply(driver);
} catch (StaleElementReferenceException e) {
return null;
}
}
@Override
public String toString() {
return String.format("condition (%s) to be refreshed", condition);
}
};
} | [
"public",
"static",
"<",
"T",
">",
"ExpectedCondition",
"<",
"T",
">",
"refreshed",
"(",
"final",
"ExpectedCondition",
"<",
"T",
">",
"condition",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"T... | Wrapper for a condition, which allows for elements to update by redrawing.
This works around the problem of conditions which have two parts: find an element and then
check for some condition on it. For these conditions it is possible that an element is located
and then subsequently it is redrawn on the client. When this happens a {@link
StaleElementReferenceException} is thrown when the second part of the condition is checked.
@param condition ExpectedCondition to wrap
@param <T> return type of the condition provided
@return the result of the provided condition | [
"Wrapper",
"for",
"a",
"condition",
"which",
"allows",
"for",
"elements",
"to",
"update",
"by",
"redrawing",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L726-L742 | train | An expectation that is satisfied when the element is refreshed. | [
30522,
2270,
10763,
1026,
1056,
1028,
3517,
8663,
20562,
1026,
1056,
1028,
25416,
21898,
2098,
1006,
2345,
3517,
8663,
20562,
1026,
1056,
1028,
4650,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
1056,
1028,
1006,
1007,
1063,
1030,
2058,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/Setting.java | Setting.entrySet | public Set<Entry<String, String>> entrySet(String group) {
return this.groupedMap.entrySet(group);
} | java | public Set<Entry<String, String>> entrySet(String group) {
return this.groupedMap.entrySet(group);
} | [
"public",
"Set",
"<",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"entrySet",
"(",
"String",
"group",
")",
"{",
"return",
"this",
".",
"groupedMap",
".",
"entrySet",
"(",
"group",
")",
";",
"}"
] | 指定分组下所有键值对
@param group 分组
@return 键值对 | [
"指定分组下所有键值对"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L485-L487 | train | Returns a set of entries in the specified group. | [
30522,
2270,
2275,
1026,
4443,
1026,
5164,
1010,
5164,
1028,
1028,
4443,
13462,
1006,
5164,
2177,
1007,
1063,
2709,
2023,
1012,
15131,
2863,
2361,
1012,
4443,
13462,
1006,
2177,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/route/ShardingAlgorithmFactory.java | ShardingAlgorithmFactory.newInstance | @SneakyThrows
@SuppressWarnings("unchecked")
public static <T extends ShardingAlgorithm> T newInstance(final String shardingAlgorithmClassName, final Class<T> superShardingAlgorithmClass) {
Class<?> result = Class.forName(shardingAlgorithmClassName);
if (!superShardingAlgorithmClass.isAssignableFrom(result)) {
throw new ShardingException("Class %s should be implement %s", shardingAlgorithmClassName, superShardingAlgorithmClass.getName());
}
return (T) result.newInstance();
} | java | @SneakyThrows
@SuppressWarnings("unchecked")
public static <T extends ShardingAlgorithm> T newInstance(final String shardingAlgorithmClassName, final Class<T> superShardingAlgorithmClass) {
Class<?> result = Class.forName(shardingAlgorithmClassName);
if (!superShardingAlgorithmClass.isAssignableFrom(result)) {
throw new ShardingException("Class %s should be implement %s", shardingAlgorithmClassName, superShardingAlgorithmClass.getName());
}
return (T) result.newInstance();
} | [
"@",
"SneakyThrows",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"ShardingAlgorithm",
">",
"T",
"newInstance",
"(",
"final",
"String",
"shardingAlgorithmClassName",
",",
"final",
"Class",
"<",
"T",
">",
"superShardi... | Create sharding algorithm.
@param shardingAlgorithmClassName sharding algorithm class name
@param superShardingAlgorithmClass sharding algorithm super class
@param <T> class generic type
@return sharding algorithm instance | [
"Create",
"sharding",
"algorithm",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/route/ShardingAlgorithmFactory.java#L42-L50 | train | Create a new instance of the sharding algorithm class. | [
30522,
1030,
13583,
22123,
8093,
15568,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
8908,
21146,
17080,
13807,
2140,
20255,
8939,
2213,
1028,
1056,
2047,
7076,
26897,
1006,
2345,
5164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java | HpackEncoder.encodeLiteral | private void encodeLiteral(ByteBuf out, CharSequence name, CharSequence value, IndexType indexType,
int nameIndex) {
boolean nameIndexValid = nameIndex != -1;
switch (indexType) {
case INCREMENTAL:
encodeInteger(out, 0x40, 6, nameIndexValid ? nameIndex : 0);
break;
case NONE:
encodeInteger(out, 0x00, 4, nameIndexValid ? nameIndex : 0);
break;
case NEVER:
encodeInteger(out, 0x10, 4, nameIndexValid ? nameIndex : 0);
break;
default:
throw new Error("should not reach here");
}
if (!nameIndexValid) {
encodeStringLiteral(out, name);
}
encodeStringLiteral(out, value);
} | java | private void encodeLiteral(ByteBuf out, CharSequence name, CharSequence value, IndexType indexType,
int nameIndex) {
boolean nameIndexValid = nameIndex != -1;
switch (indexType) {
case INCREMENTAL:
encodeInteger(out, 0x40, 6, nameIndexValid ? nameIndex : 0);
break;
case NONE:
encodeInteger(out, 0x00, 4, nameIndexValid ? nameIndex : 0);
break;
case NEVER:
encodeInteger(out, 0x10, 4, nameIndexValid ? nameIndex : 0);
break;
default:
throw new Error("should not reach here");
}
if (!nameIndexValid) {
encodeStringLiteral(out, name);
}
encodeStringLiteral(out, value);
} | [
"private",
"void",
"encodeLiteral",
"(",
"ByteBuf",
"out",
",",
"CharSequence",
"name",
",",
"CharSequence",
"value",
",",
"IndexType",
"indexType",
",",
"int",
"nameIndex",
")",
"{",
"boolean",
"nameIndexValid",
"=",
"nameIndex",
"!=",
"-",
"1",
";",
"switch"... | Encode literal header field according to Section 6.2. | [
"Encode",
"literal",
"header",
"field",
"according",
"to",
"Section",
"6",
".",
"2",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L274-L294 | train | Encode a single literal. | [
30522,
2797,
11675,
4372,
16044,
22779,
7941,
1006,
24880,
8569,
2546,
2041,
1010,
25869,
3366,
4226,
5897,
2171,
1010,
25869,
3366,
4226,
5897,
3643,
1010,
5950,
13874,
5950,
13874,
1010,
20014,
2171,
22254,
10288,
1007,
1063,
22017,
20898,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java | VectorizedParquetRecordReader.initBatch | private void initBatch(
MemoryMode memMode,
StructType partitionColumns,
InternalRow partitionValues) {
StructType batchSchema = new StructType();
for (StructField f: sparkSchema.fields()) {
batchSchema = batchSchema.add(f);
}
if (partitionColumns != null) {
for (StructField f : partitionColumns.fields()) {
batchSchema = batchSchema.add(f);
}
}
if (memMode == MemoryMode.OFF_HEAP) {
columnVectors = OffHeapColumnVector.allocateColumns(capacity, batchSchema);
} else {
columnVectors = OnHeapColumnVector.allocateColumns(capacity, batchSchema);
}
columnarBatch = new ColumnarBatch(columnVectors);
if (partitionColumns != null) {
int partitionIdx = sparkSchema.fields().length;
for (int i = 0; i < partitionColumns.fields().length; i++) {
ColumnVectorUtils.populate(columnVectors[i + partitionIdx], partitionValues, i);
columnVectors[i + partitionIdx].setIsConstant();
}
}
// Initialize missing columns with nulls.
for (int i = 0; i < missingColumns.length; i++) {
if (missingColumns[i]) {
columnVectors[i].putNulls(0, capacity);
columnVectors[i].setIsConstant();
}
}
} | java | private void initBatch(
MemoryMode memMode,
StructType partitionColumns,
InternalRow partitionValues) {
StructType batchSchema = new StructType();
for (StructField f: sparkSchema.fields()) {
batchSchema = batchSchema.add(f);
}
if (partitionColumns != null) {
for (StructField f : partitionColumns.fields()) {
batchSchema = batchSchema.add(f);
}
}
if (memMode == MemoryMode.OFF_HEAP) {
columnVectors = OffHeapColumnVector.allocateColumns(capacity, batchSchema);
} else {
columnVectors = OnHeapColumnVector.allocateColumns(capacity, batchSchema);
}
columnarBatch = new ColumnarBatch(columnVectors);
if (partitionColumns != null) {
int partitionIdx = sparkSchema.fields().length;
for (int i = 0; i < partitionColumns.fields().length; i++) {
ColumnVectorUtils.populate(columnVectors[i + partitionIdx], partitionValues, i);
columnVectors[i + partitionIdx].setIsConstant();
}
}
// Initialize missing columns with nulls.
for (int i = 0; i < missingColumns.length; i++) {
if (missingColumns[i]) {
columnVectors[i].putNulls(0, capacity);
columnVectors[i].setIsConstant();
}
}
} | [
"private",
"void",
"initBatch",
"(",
"MemoryMode",
"memMode",
",",
"StructType",
"partitionColumns",
",",
"InternalRow",
"partitionValues",
")",
"{",
"StructType",
"batchSchema",
"=",
"new",
"StructType",
"(",
")",
";",
"for",
"(",
"StructField",
"f",
":",
"spar... | Column 3: partitionValues[1] | [
"Column",
"3",
":",
"partitionValues",
"[",
"1",
"]"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java#L185-L220 | train | Initialize the batch. | [
30522,
2797,
11675,
1999,
4183,
14479,
2818,
1006,
3638,
5302,
3207,
2033,
7382,
10244,
1010,
2358,
6820,
6593,
13874,
13571,
25778,
2819,
3619,
1010,
4722,
10524,
13571,
10175,
15808,
1007,
1063,
2358,
6820,
6593,
13874,
14108,
22842,
2863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ns/PlaceDictionary.java | PlaceDictionary.isBadCase | static boolean isBadCase(String name)
{
EnumItem<NS> nrEnumItem = dictionary.get(name);
if (nrEnumItem == null) return false;
return nrEnumItem.containsLabel(NS.Z);
} | java | static boolean isBadCase(String name)
{
EnumItem<NS> nrEnumItem = dictionary.get(name);
if (nrEnumItem == null) return false;
return nrEnumItem.containsLabel(NS.Z);
} | [
"static",
"boolean",
"isBadCase",
"(",
"String",
"name",
")",
"{",
"EnumItem",
"<",
"NS",
">",
"nrEnumItem",
"=",
"dictionary",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"nrEnumItem",
"==",
"null",
")",
"return",
"false",
";",
"return",
"nrEnumItem",... | 因为任何算法都无法解决100%的问题,总是有一些bad case,这些bad case会以“盖公章 A 1”的形式加入词典中<BR>
这个方法返回是否是bad case
@param name
@return | [
"因为任何算法都无法解决100%的问题,总是有一些bad",
"case,这些bad",
"case会以“盖公章",
"A",
"1”的形式加入词典中<BR",
">",
"这个方法返回是否是bad",
"case"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/ns/PlaceDictionary.java#L130-L135 | train | Check if a name is a bad case. | [
30522,
10763,
22017,
20898,
2003,
9024,
18382,
1006,
5164,
2171,
1007,
1063,
4372,
30524,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/internal/datasource/OrchestrationShardingDataSource.java | OrchestrationShardingDataSource.renew | @SneakyThrows
@Subscribe
public final synchronized void renew(final PropertiesChangedEvent propertiesChangedEvent) {
dataSource = new ShardingDataSource(dataSource.getDataSourceMap(),
dataSource.getShardingContext().getShardingRule(), propertiesChangedEvent.getProps());
} | java | @SneakyThrows
@Subscribe
public final synchronized void renew(final PropertiesChangedEvent propertiesChangedEvent) {
dataSource = new ShardingDataSource(dataSource.getDataSourceMap(),
dataSource.getShardingContext().getShardingRule(), propertiesChangedEvent.getProps());
} | [
"@",
"SneakyThrows",
"@",
"Subscribe",
"public",
"final",
"synchronized",
"void",
"renew",
"(",
"final",
"PropertiesChangedEvent",
"propertiesChangedEvent",
")",
"{",
"dataSource",
"=",
"new",
"ShardingDataSource",
"(",
"dataSource",
".",
"getDataSourceMap",
"(",
")",... | Renew properties.
@param propertiesChangedEvent properties changed event | [
"Renew",
"properties",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/internal/datasource/OrchestrationShardingDataSource.java#L111-L116 | train | Renews the data source. | [
30522,
1030,
13583,
22123,
8093,
15568,
1030,
4942,
29234,
2270,
2345,
25549,
11675,
20687,
1006,
2345,
5144,
22305,
14728,
15338,
5144,
22305,
14728,
15338,
1007,
1063,
2951,
6499,
3126,
3401,
1027,
2047,
21146,
17080,
3070,
2850,
10230,
816... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/perceptron/transition/features/FeatureExtractor.java | FeatureExtractor.extractBasicFeatures | private static Long[] extractBasicFeatures(Configuration configuration, int length)
{
Long[] featureMap = new Long[length];
State state = configuration.state;
Sentence sentence = configuration.sentence;
int b0Position = 0;
int b1Position = 0;
int b2Position = 0;
int s0Position = 0;
long b0w = 0;
long b0p = 0;
long b1w = 0;
long b1p = 0;
long b2w = 0;
long b2p = 0;
long s0w = 0;
long s0p = 0;
long bl0p = 0;
long sr0p = 0;
long sh0p = 0;
long sl0p = 0;
int[] words = sentence.getWords();
int[] tags = sentence.getTags();
if (0 < state.bufferSize())
{
b0Position = state.bufferHead();
b0w = b0Position == 0 ? 0 : words[b0Position - 1];
b0w += 2;
b0p = b0Position == 0 ? 0 : tags[b0Position - 1];
b0p += 2;
int leftMost = state.leftMostModifier(state.getBufferItem(0));
if (leftMost >= 0)
{
bl0p = leftMost == 0 ? 0 : tags[leftMost - 1];
bl0p += 2;
}
if (1 < state.bufferSize())
{
b1Position = state.getBufferItem(1);
b1w = b1Position == 0 ? 0 : words[b1Position - 1];
b1w += 2;
b1p = b1Position == 0 ? 0 : tags[b1Position - 1];
b1p += 2;
if (2 < state.bufferSize())
{
b2Position = state.getBufferItem(2);
b2w = b2Position == 0 ? 0 : words[b2Position - 1];
b2w += 2;
b2p = b2Position == 0 ? 0 : tags[b2Position - 1];
b2p += 2;
}
}
}
if (0 < state.stackSize())
{
s0Position = state.stackTop();
s0w = s0Position == 0 ? 0 : words[s0Position - 1];
s0w += 2;
s0p = s0Position == 0 ? 0 : tags[s0Position - 1];
s0p += 2;
int leftMost = state.leftMostModifier(s0Position);
if (leftMost >= 0)
{
sl0p = leftMost == 0 ? 0 : tags[leftMost - 1];
sl0p += 2;
}
int rightMost = state.rightMostModifier(s0Position);
if (rightMost >= 0)
{
sr0p = rightMost == 0 ? 0 : tags[rightMost - 1];
sr0p += 2;
}
int headIndex = state.getHead(s0Position);
if (headIndex >= 0)
{
sh0p = headIndex == 0 ? 0 : tags[headIndex - 1];
sh0p += 2;
}
}
int index = 0;
long b0wp = b0p;
b0wp |= (b0w << 8);
long b1wp = b1p;
b1wp |= (b1w << 8);
long s0wp = s0p;
s0wp |= (s0w << 8);
long b2wp = b2p;
b2wp |= (b2w << 8);
/**
* From single words
*/
if (s0w != 1)
{
featureMap[index++] = s0wp;
featureMap[index++] = s0w;
}
else
{
featureMap[index++] = null;
featureMap[index++] = null;
}
featureMap[index++] = s0p;
if (b0w != 1)
{
featureMap[index++] = b0wp;
featureMap[index++] = b0w;
}
else
{
featureMap[index++] = null;
featureMap[index++] = null;
}
featureMap[index++] = b0p;
if (b1w != 1)
{
featureMap[index++] = b1wp;
featureMap[index++] = b1w;
}
else
{
featureMap[index++] = null;
featureMap[index++] = null;
}
featureMap[index++] = b1p;
if (b2w != 1)
{
featureMap[index++] = b2wp;
featureMap[index++] = b2w;
}
else
{
featureMap[index++] = null;
featureMap[index++] = null;
}
featureMap[index++] = b2p;
/**
* from word pairs
*/
if (s0w != 1 && b0w != 1)
{
featureMap[index++] = (s0wp << 28) | b0wp;
featureMap[index++] = (s0wp << 20) | b0w;
featureMap[index++] = (s0w << 28) | b0wp;
}
else
{
featureMap[index++] = null;
featureMap[index++] = null;
featureMap[index++] = null;
}
if (s0w != 1)
{
featureMap[index++] = (s0wp << 8) | b0p;
}
else
{
featureMap[index++] = null;
}
if (b0w != 1)
{
featureMap[index++] = (s0p << 28) | b0wp;
}
else
{
featureMap[index++] = null;
}
if (s0w != 1 && b0w != 1)
{
featureMap[index++] = (s0w << 20) | b0w;
}
else
{
featureMap[index++] = null;
}
featureMap[index++] = (s0p << 8) | b0p;
featureMap[index++] = (b0p << 8) | b1p;
/**
* from three words
*/
featureMap[index++] = (b0p << 16) | (b1p << 8) | b2p;
featureMap[index++] = (s0p << 16) | (b0p << 8) | b1p;
featureMap[index++] = (sh0p << 16) | (s0p << 8) | b0p;
featureMap[index++] = (s0p << 16) | (sl0p << 8) | b0p;
featureMap[index++] = (s0p << 16) | (sr0p << 8) | b0p;
featureMap[index++] = (s0p << 16) | (b0p << 8) | bl0p;
return featureMap;
} | java | private static Long[] extractBasicFeatures(Configuration configuration, int length)
{
Long[] featureMap = new Long[length];
State state = configuration.state;
Sentence sentence = configuration.sentence;
int b0Position = 0;
int b1Position = 0;
int b2Position = 0;
int s0Position = 0;
long b0w = 0;
long b0p = 0;
long b1w = 0;
long b1p = 0;
long b2w = 0;
long b2p = 0;
long s0w = 0;
long s0p = 0;
long bl0p = 0;
long sr0p = 0;
long sh0p = 0;
long sl0p = 0;
int[] words = sentence.getWords();
int[] tags = sentence.getTags();
if (0 < state.bufferSize())
{
b0Position = state.bufferHead();
b0w = b0Position == 0 ? 0 : words[b0Position - 1];
b0w += 2;
b0p = b0Position == 0 ? 0 : tags[b0Position - 1];
b0p += 2;
int leftMost = state.leftMostModifier(state.getBufferItem(0));
if (leftMost >= 0)
{
bl0p = leftMost == 0 ? 0 : tags[leftMost - 1];
bl0p += 2;
}
if (1 < state.bufferSize())
{
b1Position = state.getBufferItem(1);
b1w = b1Position == 0 ? 0 : words[b1Position - 1];
b1w += 2;
b1p = b1Position == 0 ? 0 : tags[b1Position - 1];
b1p += 2;
if (2 < state.bufferSize())
{
b2Position = state.getBufferItem(2);
b2w = b2Position == 0 ? 0 : words[b2Position - 1];
b2w += 2;
b2p = b2Position == 0 ? 0 : tags[b2Position - 1];
b2p += 2;
}
}
}
if (0 < state.stackSize())
{
s0Position = state.stackTop();
s0w = s0Position == 0 ? 0 : words[s0Position - 1];
s0w += 2;
s0p = s0Position == 0 ? 0 : tags[s0Position - 1];
s0p += 2;
int leftMost = state.leftMostModifier(s0Position);
if (leftMost >= 0)
{
sl0p = leftMost == 0 ? 0 : tags[leftMost - 1];
sl0p += 2;
}
int rightMost = state.rightMostModifier(s0Position);
if (rightMost >= 0)
{
sr0p = rightMost == 0 ? 0 : tags[rightMost - 1];
sr0p += 2;
}
int headIndex = state.getHead(s0Position);
if (headIndex >= 0)
{
sh0p = headIndex == 0 ? 0 : tags[headIndex - 1];
sh0p += 2;
}
}
int index = 0;
long b0wp = b0p;
b0wp |= (b0w << 8);
long b1wp = b1p;
b1wp |= (b1w << 8);
long s0wp = s0p;
s0wp |= (s0w << 8);
long b2wp = b2p;
b2wp |= (b2w << 8);
/**
* From single words
*/
if (s0w != 1)
{
featureMap[index++] = s0wp;
featureMap[index++] = s0w;
}
else
{
featureMap[index++] = null;
featureMap[index++] = null;
}
featureMap[index++] = s0p;
if (b0w != 1)
{
featureMap[index++] = b0wp;
featureMap[index++] = b0w;
}
else
{
featureMap[index++] = null;
featureMap[index++] = null;
}
featureMap[index++] = b0p;
if (b1w != 1)
{
featureMap[index++] = b1wp;
featureMap[index++] = b1w;
}
else
{
featureMap[index++] = null;
featureMap[index++] = null;
}
featureMap[index++] = b1p;
if (b2w != 1)
{
featureMap[index++] = b2wp;
featureMap[index++] = b2w;
}
else
{
featureMap[index++] = null;
featureMap[index++] = null;
}
featureMap[index++] = b2p;
/**
* from word pairs
*/
if (s0w != 1 && b0w != 1)
{
featureMap[index++] = (s0wp << 28) | b0wp;
featureMap[index++] = (s0wp << 20) | b0w;
featureMap[index++] = (s0w << 28) | b0wp;
}
else
{
featureMap[index++] = null;
featureMap[index++] = null;
featureMap[index++] = null;
}
if (s0w != 1)
{
featureMap[index++] = (s0wp << 8) | b0p;
}
else
{
featureMap[index++] = null;
}
if (b0w != 1)
{
featureMap[index++] = (s0p << 28) | b0wp;
}
else
{
featureMap[index++] = null;
}
if (s0w != 1 && b0w != 1)
{
featureMap[index++] = (s0w << 20) | b0w;
}
else
{
featureMap[index++] = null;
}
featureMap[index++] = (s0p << 8) | b0p;
featureMap[index++] = (b0p << 8) | b1p;
/**
* from three words
*/
featureMap[index++] = (b0p << 16) | (b1p << 8) | b2p;
featureMap[index++] = (s0p << 16) | (b0p << 8) | b1p;
featureMap[index++] = (sh0p << 16) | (s0p << 8) | b0p;
featureMap[index++] = (s0p << 16) | (sl0p << 8) | b0p;
featureMap[index++] = (s0p << 16) | (sr0p << 8) | b0p;
featureMap[index++] = (s0p << 16) | (b0p << 8) | bl0p;
return featureMap;
} | [
"private",
"static",
"Long",
"[",
"]",
"extractBasicFeatures",
"(",
"Configuration",
"configuration",
",",
"int",
"length",
")",
"{",
"Long",
"[",
"]",
"featureMap",
"=",
"new",
"Long",
"[",
"length",
"]",
";",
"State",
"state",
"=",
"configuration",
".",
... | Given a list of templates, extracts all features for the given state
@param configuration
@return
@throws Exception | [
"Given",
"a",
"list",
"of",
"templates",
"extracts",
"all",
"features",
"for",
"the",
"given",
"state"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/perceptron/transition/features/FeatureExtractor.java#L566-L781 | train | Extract the basic features from the configuration. | [
30522,
2797,
10763,
2146,
1031,
1033,
14817,
22083,
2594,
7959,
4017,
14900,
1006,
9563,
9563,
1010,
20014,
3091,
1007,
1063,
2146,
1031,
1033,
3444,
2863,
2361,
1027,
2047,
2146,
1031,
3091,
1033,
1025,
2110,
2110,
1027,
9563,
1012,
2110,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/By.java | By.findElement | public WebElement findElement(SearchContext context) {
List<WebElement> allElements = findElements(context);
if (allElements == null || allElements.isEmpty()) {
throw new NoSuchElementException("Cannot locate an element using " + toString());
}
return allElements.get(0);
} | java | public WebElement findElement(SearchContext context) {
List<WebElement> allElements = findElements(context);
if (allElements == null || allElements.isEmpty()) {
throw new NoSuchElementException("Cannot locate an element using " + toString());
}
return allElements.get(0);
} | [
"public",
"WebElement",
"findElement",
"(",
"SearchContext",
"context",
")",
"{",
"List",
"<",
"WebElement",
">",
"allElements",
"=",
"findElements",
"(",
"context",
")",
";",
"if",
"(",
"allElements",
"==",
"null",
"||",
"allElements",
".",
"isEmpty",
"(",
... | Find a single element. Override this method if necessary.
@param context A context to use to find the element.
@return The WebElement that matches the selector. | [
"Find",
"a",
"single",
"element",
".",
"Override",
"this",
"method",
"if",
"necessary",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/By.java#L125-L131 | train | Find an element using the specified search context. | [
30522,
2270,
4773,
12260,
3672,
2424,
12260,
3672,
1006,
3945,
8663,
18209,
6123,
1007,
1063,
2862,
1026,
4773,
12260,
3672,
1028,
2035,
12260,
8163,
1027,
2424,
12260,
8163,
1006,
6123,
1007,
1025,
2065,
1006,
2035,
12260,
8163,
1027,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/internal/MergingWindowSet.java | MergingWindowSet.addWindow | public W addWindow(W newWindow, MergeFunction<W> mergeFunction) throws Exception {
MergeResultCollector collector = new MergeResultCollector();
windowAssigner.mergeWindows(newWindow, sortedWindows, collector);
W resultWindow = newWindow;
boolean isNewWindowMerged = false;
// perform the merge
for (Map.Entry<W, Collection<W>> c : collector.mergeResults.entrySet()) {
W mergeResult = c.getKey();
Collection<W> mergedWindows = c.getValue();
// if our new window is in the merged windows make the merge result the
// result window
if (mergedWindows.remove(newWindow)) {
isNewWindowMerged = true;
resultWindow = mergeResult;
}
// if our new window is the same as a pre-exising window, nothing to do
if (mergedWindows.isEmpty()) {
continue;
}
// pick any of the merged windows and choose that window's state window
// as the state window for the merge result
W mergedStateNamespace = this.mapping.get(mergedWindows.iterator().next());
// figure out the state windows that we are merging
List<W> mergedStateWindows = new ArrayList<>();
for (W mergedWindow : mergedWindows) {
W res = this.mapping.get(mergedWindow);
if (res != null) {
this.mapping.remove(mergedWindow);
this.sortedWindows.remove(mergedWindow);
// don't put the target state window into the merged windows
if (!res.equals(mergedStateNamespace)) {
mergedStateWindows.add(res);
}
}
}
this.mapping.put(mergeResult, mergedStateNamespace);
this.sortedWindows.add(mergeResult);
// don't merge the new window itself, it never had any state associated with it
// i.e. if we are only merging one pre-existing window into itself
// without extending the pre-exising window
if (!(mergedWindows.contains(mergeResult) && mergedWindows.size() == 1)) {
mergeFunction.merge(mergeResult,
mergedWindows,
mergedStateNamespace,
mergedStateWindows);
}
}
// the new window created a new, self-contained window without merging
if (collector.mergeResults.isEmpty() || (resultWindow.equals(newWindow) && !isNewWindowMerged)) {
this.mapping.put(resultWindow, resultWindow);
this.sortedWindows.add(resultWindow);
}
return resultWindow;
} | java | public W addWindow(W newWindow, MergeFunction<W> mergeFunction) throws Exception {
MergeResultCollector collector = new MergeResultCollector();
windowAssigner.mergeWindows(newWindow, sortedWindows, collector);
W resultWindow = newWindow;
boolean isNewWindowMerged = false;
// perform the merge
for (Map.Entry<W, Collection<W>> c : collector.mergeResults.entrySet()) {
W mergeResult = c.getKey();
Collection<W> mergedWindows = c.getValue();
// if our new window is in the merged windows make the merge result the
// result window
if (mergedWindows.remove(newWindow)) {
isNewWindowMerged = true;
resultWindow = mergeResult;
}
// if our new window is the same as a pre-exising window, nothing to do
if (mergedWindows.isEmpty()) {
continue;
}
// pick any of the merged windows and choose that window's state window
// as the state window for the merge result
W mergedStateNamespace = this.mapping.get(mergedWindows.iterator().next());
// figure out the state windows that we are merging
List<W> mergedStateWindows = new ArrayList<>();
for (W mergedWindow : mergedWindows) {
W res = this.mapping.get(mergedWindow);
if (res != null) {
this.mapping.remove(mergedWindow);
this.sortedWindows.remove(mergedWindow);
// don't put the target state window into the merged windows
if (!res.equals(mergedStateNamespace)) {
mergedStateWindows.add(res);
}
}
}
this.mapping.put(mergeResult, mergedStateNamespace);
this.sortedWindows.add(mergeResult);
// don't merge the new window itself, it never had any state associated with it
// i.e. if we are only merging one pre-existing window into itself
// without extending the pre-exising window
if (!(mergedWindows.contains(mergeResult) && mergedWindows.size() == 1)) {
mergeFunction.merge(mergeResult,
mergedWindows,
mergedStateNamespace,
mergedStateWindows);
}
}
// the new window created a new, self-contained window without merging
if (collector.mergeResults.isEmpty() || (resultWindow.equals(newWindow) && !isNewWindowMerged)) {
this.mapping.put(resultWindow, resultWindow);
this.sortedWindows.add(resultWindow);
}
return resultWindow;
} | [
"public",
"W",
"addWindow",
"(",
"W",
"newWindow",
",",
"MergeFunction",
"<",
"W",
">",
"mergeFunction",
")",
"throws",
"Exception",
"{",
"MergeResultCollector",
"collector",
"=",
"new",
"MergeResultCollector",
"(",
")",
";",
"windowAssigner",
".",
"mergeWindows",... | Adds a new {@code Window} to the set of in-flight windows. It might happen that this
triggers merging of previously in-flight windows. In that case, the provided
{@link MergeFunction} is called.
<p>This returns the window that is the representative of the added window after adding.
This can either be the new window itself, if no merge occurred, or the newly merged
window. Adding an element to a window or calling trigger functions should only
happen on the returned representative. This way, we never have to deal with a new window
that is immediately swallowed up by another window.
<p>If the new window is merged, the {@code MergeFunction} callback arguments also don't
contain the new window as part of the list of merged windows.
@param newWindow The new {@code Window} to add.
@param mergeFunction The callback to be invoked in case a merge occurs.
@return The {@code Window} that new new {@code Window} ended up in. This can also be the
the new {@code Window} itself in case no merge occurred.
@throws Exception | [
"Adds",
"a",
"new",
"{",
"@code",
"Window",
"}",
"to",
"the",
"set",
"of",
"in",
"-",
"flight",
"windows",
".",
"It",
"might",
"happen",
"that",
"this",
"triggers",
"merging",
"of",
"previously",
"in",
"-",
"flight",
"windows",
".",
"In",
"that",
"case... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/internal/MergingWindowSet.java#L155-L218 | train | Add a new window to the cluster. | [
30522,
2270,
1059,
5587,
11101,
5004,
1006,
1059,
2047,
11101,
5004,
1010,
13590,
11263,
27989,
1026,
1059,
1028,
13590,
11263,
27989,
1007,
11618,
6453,
1063,
7660,
2229,
11314,
26895,
22471,
2953,
10018,
1027,
2047,
7660,
2229,
11314,
26895... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/NFAStateSerializer.java | NFAStateSerializer.serializeComputationStates | private void serializeComputationStates(Queue<ComputationState> states, DataOutputView target) throws IOException {
target.writeInt(states.size());
for (ComputationState computationState : states) {
serializeSingleComputationState(computationState, target);
}
} | java | private void serializeComputationStates(Queue<ComputationState> states, DataOutputView target) throws IOException {
target.writeInt(states.size());
for (ComputationState computationState : states) {
serializeSingleComputationState(computationState, target);
}
} | [
"private",
"void",
"serializeComputationStates",
"(",
"Queue",
"<",
"ComputationState",
">",
"states",
",",
"DataOutputView",
"target",
")",
"throws",
"IOException",
"{",
"target",
".",
"writeInt",
"(",
"states",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
... | /*
De/serialization methods | [
"/",
"*",
"De",
"/",
"serialization",
"methods"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/NFAStateSerializer.java#L168-L173 | train | Serialize a queue of computation states to the given output view. | [
30522,
2797,
11675,
7642,
4697,
9006,
18780,
10708,
12259,
2015,
1006,
24240,
1026,
22334,
9153,
2618,
1028,
2163,
1010,
2951,
5833,
18780,
8584,
4539,
1007,
11618,
22834,
10288,
24422,
1063,
4539,
1012,
4339,
18447,
1006,
2163,
1012,
2946,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/word/TfIdf.java | TfIdf.tf | public static <TERM> Map<TERM, Double> tf(Collection<TERM> document, TfType type)
{
Map<TERM, Double> tf = new HashMap<TERM, Double>();
for (TERM term : document)
{
Double f = tf.get(term);
if (f == null) f = 0.0;
tf.put(term, f + 1);
}
if (type != TfType.NATURAL)
{
for (TERM term : tf.keySet())
{
switch (type)
{
case LOGARITHM:
tf.put(term, 1 + Math.log(tf.get(term)));
break;
case BOOLEAN:
tf.put(term, tf.get(term) == 0.0 ? 0.0 : 1.0);
break;
}
}
}
return tf;
} | java | public static <TERM> Map<TERM, Double> tf(Collection<TERM> document, TfType type)
{
Map<TERM, Double> tf = new HashMap<TERM, Double>();
for (TERM term : document)
{
Double f = tf.get(term);
if (f == null) f = 0.0;
tf.put(term, f + 1);
}
if (type != TfType.NATURAL)
{
for (TERM term : tf.keySet())
{
switch (type)
{
case LOGARITHM:
tf.put(term, 1 + Math.log(tf.get(term)));
break;
case BOOLEAN:
tf.put(term, tf.get(term) == 0.0 ? 0.0 : 1.0);
break;
}
}
}
return tf;
} | [
"public",
"static",
"<",
"TERM",
">",
"Map",
"<",
"TERM",
",",
"Double",
">",
"tf",
"(",
"Collection",
"<",
"TERM",
">",
"document",
",",
"TfType",
"type",
")",
"{",
"Map",
"<",
"TERM",
",",
"Double",
">",
"tf",
"=",
"new",
"HashMap",
"<",
"TERM",
... | 单文档词频
@param document 词袋
@param type 词频计算方式
@param <TERM> 词语类型
@return 一个包含词频的Map | [
"单文档词频"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word/TfIdf.java#L54-L79 | train | Get a map of terms to counts for a given type of document. | [
30522,
2270,
10763,
1026,
2744,
1028,
4949,
1026,
2744,
1010,
3313,
1028,
1056,
2546,
1006,
3074,
1026,
2744,
1028,
6254,
1010,
1056,
6199,
18863,
2828,
1007,
1063,
4949,
1026,
2744,
1010,
3313,
1028,
1056,
2546,
1027,
2047,
23325,
2863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java | SqlBuilder.where | public SqlBuilder where(String where) {
if (StrUtil.isNotBlank(where)) {
sql.append(" WHERE ").append(where);
}
return this;
} | java | public SqlBuilder where(String where) {
if (StrUtil.isNotBlank(where)) {
sql.append(" WHERE ").append(where);
}
return this;
} | [
"public",
"SqlBuilder",
"where",
"(",
"String",
"where",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isNotBlank",
"(",
"where",
")",
")",
"{",
"sql",
".",
"append",
"(",
"\" WHERE \"",
")",
".",
"append",
"(",
"where",
")",
";",
"}",
"return",
"this",
";",... | 添加Where语句<br>
@param where WHERE语句之后跟的条件语句字符串
@return 自己 | [
"添加Where语句<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java#L322-L327 | train | Add a WHERE clause to the query. | [
30522,
2270,
29296,
8569,
23891,
2099,
2073,
1006,
5164,
2073,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
3475,
4140,
28522,
8950,
1006,
2073,
1007,
1007,
1063,
29296,
1012,
10439,
10497,
1006,
1000,
2073,
1000,
1007,
1012,
10439,
104... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Bzip2BlockCompressor.java | Bzip2BlockCompressor.writeSymbolMap | private void writeSymbolMap(ByteBuf out) {
Bzip2BitWriter writer = this.writer;
final boolean[] blockValuesPresent = this.blockValuesPresent;
final boolean[] condensedInUse = new boolean[16];
for (int i = 0; i < condensedInUse.length; i++) {
for (int j = 0, k = i << 4; j < HUFFMAN_SYMBOL_RANGE_SIZE; j++, k++) {
if (blockValuesPresent[k]) {
condensedInUse[i] = true;
}
}
}
for (boolean isCondensedInUse : condensedInUse) {
writer.writeBoolean(out, isCondensedInUse);
}
for (int i = 0; i < condensedInUse.length; i++) {
if (condensedInUse[i]) {
for (int j = 0, k = i << 4; j < HUFFMAN_SYMBOL_RANGE_SIZE; j++, k++) {
writer.writeBoolean(out, blockValuesPresent[k]);
}
}
}
} | java | private void writeSymbolMap(ByteBuf out) {
Bzip2BitWriter writer = this.writer;
final boolean[] blockValuesPresent = this.blockValuesPresent;
final boolean[] condensedInUse = new boolean[16];
for (int i = 0; i < condensedInUse.length; i++) {
for (int j = 0, k = i << 4; j < HUFFMAN_SYMBOL_RANGE_SIZE; j++, k++) {
if (blockValuesPresent[k]) {
condensedInUse[i] = true;
}
}
}
for (boolean isCondensedInUse : condensedInUse) {
writer.writeBoolean(out, isCondensedInUse);
}
for (int i = 0; i < condensedInUse.length; i++) {
if (condensedInUse[i]) {
for (int j = 0, k = i << 4; j < HUFFMAN_SYMBOL_RANGE_SIZE; j++, k++) {
writer.writeBoolean(out, blockValuesPresent[k]);
}
}
}
} | [
"private",
"void",
"writeSymbolMap",
"(",
"ByteBuf",
"out",
")",
"{",
"Bzip2BitWriter",
"writer",
"=",
"this",
".",
"writer",
";",
"final",
"boolean",
"[",
"]",
"blockValuesPresent",
"=",
"this",
".",
"blockValuesPresent",
";",
"final",
"boolean",
"[",
"]",
... | Write the Huffman symbol to output byte map. | [
"Write",
"the",
"Huffman",
"symbol",
"to",
"output",
"byte",
"map",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java#L106-L131 | train | Write symbol map. | [
30522,
2797,
11675,
7009,
24335,
14956,
2863,
2361,
1006,
24880,
8569,
2546,
2041,
1007,
1063,
1038,
5831,
2361,
2475,
16313,
15994,
3213,
1027,
2023,
1012,
3213,
1025,
2345,
22017,
20898,
1031,
1033,
3796,
10175,
15808,
28994,
4765,
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/rest/handler/HandlerRequest.java | HandlerRequest.getQueryParameter | public <X, QP extends MessageQueryParameter<X>> List<X> getQueryParameter(Class<QP> parameterClass) {
@SuppressWarnings("unchecked")
QP queryParameter = (QP) queryParameters.get(parameterClass);
if (queryParameter == null) {
return Collections.emptyList();
} else {
return queryParameter.getValue();
}
} | java | public <X, QP extends MessageQueryParameter<X>> List<X> getQueryParameter(Class<QP> parameterClass) {
@SuppressWarnings("unchecked")
QP queryParameter = (QP) queryParameters.get(parameterClass);
if (queryParameter == null) {
return Collections.emptyList();
} else {
return queryParameter.getValue();
}
} | [
"public",
"<",
"X",
",",
"QP",
"extends",
"MessageQueryParameter",
"<",
"X",
">",
">",
"List",
"<",
"X",
">",
"getQueryParameter",
"(",
"Class",
"<",
"QP",
">",
"parameterClass",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"QP",
"queryPar... | Returns the value of the {@link MessageQueryParameter} for the given class.
@param parameterClass class of the parameter
@param <X> the value type that the parameter contains
@param <QP> type of the query parameter
@return query parameter value for the given class, or an empty list if no parameter value exists for the given class | [
"Returns",
"the",
"value",
"of",
"the",
"{",
"@link",
"MessageQueryParameter",
"}",
"for",
"the",
"given",
"class",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/HandlerRequest.java#L133-L141 | train | Gets the query parameter. | [
30522,
2270,
1026,
1060,
1010,
1053,
2361,
8908,
4471,
4226,
2854,
28689,
22828,
1026,
1060,
1028,
1028,
2862,
1026,
1060,
1028,
2131,
4226,
2854,
28689,
22828,
1006,
2465,
1026,
1053,
2361,
1028,
16381,
26266,
1007,
1063,
1030,
16081,
9028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/UnionOperator.java | UnionOperator.translateToDataFlow | @Override
protected Union<T> translateToDataFlow(Operator<T> input1, Operator<T> input2) {
return new Union<T>(input1, input2, unionLocationName);
} | java | @Override
protected Union<T> translateToDataFlow(Operator<T> input1, Operator<T> input2) {
return new Union<T>(input1, input2, unionLocationName);
} | [
"@",
"Override",
"protected",
"Union",
"<",
"T",
">",
"translateToDataFlow",
"(",
"Operator",
"<",
"T",
">",
"input1",
",",
"Operator",
"<",
"T",
">",
"input2",
")",
"{",
"return",
"new",
"Union",
"<",
"T",
">",
"(",
"input1",
",",
"input2",
",",
"un... | Returns the BinaryNodeTranslation of the Union.
@param input1 The first input of the union, as a common API operator.
@param input2 The second input of the union, as a common API operator.
@return The common API union operator. | [
"Returns",
"the",
"BinaryNodeTranslation",
"of",
"the",
"Union",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/UnionOperator.java#L61-L64 | train | Override to translate to dataflow. | [
30522,
1030,
2058,
15637,
5123,
2586,
1026,
1056,
1028,
17637,
3406,
2850,
2696,
12314,
1006,
6872,
1026,
1056,
1028,
7953,
2487,
1010,
6872,
1026,
1056,
1028,
7953,
2475,
1007,
1063,
2709,
2047,
2586,
1026,
1056,
1028,
1006,
7953,
2487,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/base64/Base64.java | Base64.encodedBufferSize | static int encodedBufferSize(int len, boolean breakLines) {
// Cast len to long to prevent overflow
long len43 = ((long) len << 2) / 3;
// Account for padding
long ret = (len43 + 3) & ~3;
if (breakLines) {
ret += len43 / MAX_LINE_LENGTH;
}
return ret < Integer.MAX_VALUE ? (int) ret : Integer.MAX_VALUE;
} | java | static int encodedBufferSize(int len, boolean breakLines) {
// Cast len to long to prevent overflow
long len43 = ((long) len << 2) / 3;
// Account for padding
long ret = (len43 + 3) & ~3;
if (breakLines) {
ret += len43 / MAX_LINE_LENGTH;
}
return ret < Integer.MAX_VALUE ? (int) ret : Integer.MAX_VALUE;
} | [
"static",
"int",
"encodedBufferSize",
"(",
"int",
"len",
",",
"boolean",
"breakLines",
")",
"{",
"// Cast len to long to prevent overflow",
"long",
"len43",
"=",
"(",
"(",
"long",
")",
"len",
"<<",
"2",
")",
"/",
"3",
";",
"// Account for padding",
"long",
"re... | package-private for testing | [
"package",
"-",
"private",
"for",
"testing"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/base64/Base64.java#L199-L211 | train | Encode a size of a record set to be used in a log file. | [
30522,
10763,
20014,
12359,
8569,
12494,
5332,
4371,
1006,
20014,
18798,
1010,
22017,
20898,
3338,
12735,
1007,
1063,
1013,
1013,
3459,
18798,
2000,
2146,
2000,
4652,
2058,
12314,
2146,
18798,
23777,
1027,
1006,
1006,
2146,
1007,
18798,
1026,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/math/Arrangement.java | Arrangement.select | private void select(String[] resultList, int resultIndex, List<String[]> result) {
int resultLen = resultList.length;
if (resultIndex >= resultLen) { // 全部选择完时,输出排列结果
result.add(Arrays.copyOf(resultList, resultList.length));
return;
}
// 递归选择下一个
for (int i = 0; i < datas.length; i++) {
// 判断待选项是否存在于排列结果中
boolean exists = false;
for (int j = 0; j < resultIndex; j++) {
if (datas[i].equals(resultList[j])) {
exists = true;
break;
}
}
if (false == exists) { // 排列结果不存在该项,才可选择
resultList[resultIndex] = datas[i];
select(resultList, resultIndex + 1, result);
}
}
} | java | private void select(String[] resultList, int resultIndex, List<String[]> result) {
int resultLen = resultList.length;
if (resultIndex >= resultLen) { // 全部选择完时,输出排列结果
result.add(Arrays.copyOf(resultList, resultList.length));
return;
}
// 递归选择下一个
for (int i = 0; i < datas.length; i++) {
// 判断待选项是否存在于排列结果中
boolean exists = false;
for (int j = 0; j < resultIndex; j++) {
if (datas[i].equals(resultList[j])) {
exists = true;
break;
}
}
if (false == exists) { // 排列结果不存在该项,才可选择
resultList[resultIndex] = datas[i];
select(resultList, resultIndex + 1, result);
}
}
} | [
"private",
"void",
"select",
"(",
"String",
"[",
"]",
"resultList",
",",
"int",
"resultIndex",
",",
"List",
"<",
"String",
"[",
"]",
">",
"result",
")",
"{",
"int",
"resultLen",
"=",
"resultList",
".",
"length",
";",
"if",
"(",
"resultIndex",
">=",
"re... | 排列选择
@param dataList 待选列表
@param resultList 前面(resultIndex-1)个的排列结果
@param resultIndex 选择索引,从0开始
@param result 最终结果 | [
"排列选择"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/math/Arrangement.java#L108-L130 | train | Select a list of strings from the list of strings. | [
30522,
2797,
11675,
7276,
1006,
5164,
1031,
1033,
2765,
9863,
1010,
20014,
2765,
22254,
10288,
1010,
2862,
1026,
5164,
1031,
1033,
1028,
2765,
1007,
1063,
20014,
2765,
7770,
1027,
2765,
9863,
1012,
3091,
1025,
2065,
1006,
2765,
22254,
10288... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java | StreamGraphGenerator.transformSink | private <T> Collection<Integer> transformSink(SinkTransformation<T> sink) {
Collection<Integer> inputIds = transform(sink.getInput());
String slotSharingGroup = determineSlotSharingGroup(sink.getSlotSharingGroup(), inputIds);
streamGraph.addSink(sink.getId(),
slotSharingGroup,
sink.getCoLocationGroupKey(),
sink.getOperator(),
sink.getInput().getOutputType(),
null,
"Sink: " + sink.getName());
streamGraph.setParallelism(sink.getId(), sink.getParallelism());
streamGraph.setMaxParallelism(sink.getId(), sink.getMaxParallelism());
for (Integer inputId: inputIds) {
streamGraph.addEdge(inputId,
sink.getId(),
0
);
}
if (sink.getStateKeySelector() != null) {
TypeSerializer<?> keySerializer = sink.getStateKeyType().createSerializer(env.getConfig());
streamGraph.setOneInputStateKey(sink.getId(), sink.getStateKeySelector(), keySerializer);
}
return Collections.emptyList();
} | java | private <T> Collection<Integer> transformSink(SinkTransformation<T> sink) {
Collection<Integer> inputIds = transform(sink.getInput());
String slotSharingGroup = determineSlotSharingGroup(sink.getSlotSharingGroup(), inputIds);
streamGraph.addSink(sink.getId(),
slotSharingGroup,
sink.getCoLocationGroupKey(),
sink.getOperator(),
sink.getInput().getOutputType(),
null,
"Sink: " + sink.getName());
streamGraph.setParallelism(sink.getId(), sink.getParallelism());
streamGraph.setMaxParallelism(sink.getId(), sink.getMaxParallelism());
for (Integer inputId: inputIds) {
streamGraph.addEdge(inputId,
sink.getId(),
0
);
}
if (sink.getStateKeySelector() != null) {
TypeSerializer<?> keySerializer = sink.getStateKeyType().createSerializer(env.getConfig());
streamGraph.setOneInputStateKey(sink.getId(), sink.getStateKeySelector(), keySerializer);
}
return Collections.emptyList();
} | [
"private",
"<",
"T",
">",
"Collection",
"<",
"Integer",
">",
"transformSink",
"(",
"SinkTransformation",
"<",
"T",
">",
"sink",
")",
"{",
"Collection",
"<",
"Integer",
">",
"inputIds",
"=",
"transform",
"(",
"sink",
".",
"getInput",
"(",
")",
")",
";",
... | Transforms a {@code SourceTransformation}. | [
"Transforms",
"a",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamGraphGenerator.java#L499-L529 | train | Transform a sink transformation. | [
30522,
2797,
1026,
1056,
1028,
3074,
1026,
16109,
1028,
21743,
19839,
1006,
7752,
6494,
3619,
14192,
3370,
1026,
1056,
1028,
7752,
1007,
1063,
3074,
1026,
16109,
1028,
7953,
9821,
1027,
10938,
1006,
7752,
1012,
2131,
2378,
18780,
1006,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.page | public PageResult<Entity> page(Entity where, int page, int numPerPage) throws SQLException {
return this.page(where, new Page(page, numPerPage));
} | java | public PageResult<Entity> page(Entity where, int page, int numPerPage) throws SQLException {
return this.page(where, new Page(page, numPerPage));
} | [
"public",
"PageResult",
"<",
"Entity",
">",
"page",
"(",
"Entity",
"where",
",",
"int",
"page",
",",
"int",
"numPerPage",
")",
"throws",
"SQLException",
"{",
"return",
"this",
".",
"page",
"(",
"where",
",",
"new",
"Page",
"(",
"page",
",",
"numPerPage",... | 分页查询<br>
查询条件为多个key value对表示,默认key = value,如果使用其它条件可以使用:where.put("key", " > 1"),value也可以传Condition对象,key被忽略
@param where 条件实体类(包含表名)
@param page 页码
@param numPerPage 每页条目数
@return 分页结果集
@throws SQLException SQL执行异常
@since 3.2.2 | [
"分页查询<br",
">",
"查询条件为多个key",
"value对表示,默认key",
"=",
"value,如果使用其它条件可以使用:where",
".",
"put",
"(",
"key",
">",
";",
"1",
")",
",value也可以传Condition对象,key被忽略"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L773-L775 | train | Retrieves a page of entities matching the specified criteria. | [
30522,
2270,
3931,
6072,
11314,
1026,
9178,
1028,
3931,
1006,
9178,
2073,
1010,
20014,
3931,
1010,
20014,
16371,
8737,
2121,
13704,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
2023,
1012,
3931,
1006,
2073,
1010,
2047,
3931,
1006,
3931,
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-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBIncrementalRestoreOperation.java | RocksDBIncrementalRestoreOperation.readMetaData | private KeyedBackendSerializationProxy<K> readMetaData(StreamStateHandle metaStateHandle) throws Exception {
FSDataInputStream inputStream = null;
try {
inputStream = metaStateHandle.openInputStream();
cancelStreamRegistry.registerCloseable(inputStream);
DataInputView in = new DataInputViewStreamWrapper(inputStream);
return readMetaData(in);
} finally {
if (cancelStreamRegistry.unregisterCloseable(inputStream)) {
inputStream.close();
}
}
} | java | private KeyedBackendSerializationProxy<K> readMetaData(StreamStateHandle metaStateHandle) throws Exception {
FSDataInputStream inputStream = null;
try {
inputStream = metaStateHandle.openInputStream();
cancelStreamRegistry.registerCloseable(inputStream);
DataInputView in = new DataInputViewStreamWrapper(inputStream);
return readMetaData(in);
} finally {
if (cancelStreamRegistry.unregisterCloseable(inputStream)) {
inputStream.close();
}
}
} | [
"private",
"KeyedBackendSerializationProxy",
"<",
"K",
">",
"readMetaData",
"(",
"StreamStateHandle",
"metaStateHandle",
")",
"throws",
"Exception",
"{",
"FSDataInputStream",
"inputStream",
"=",
"null",
";",
"try",
"{",
"inputStream",
"=",
"metaStateHandle",
".",
"ope... | Reads Flink's state meta data file from the state handle. | [
"Reads",
"Flink",
"s",
"state",
"meta",
"data",
"file",
"from",
"the",
"state",
"handle",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/restore/RocksDBIncrementalRestoreOperation.java#L484-L498 | train | Reads the metadata from the given state handle. | [
30522,
2797,
3145,
2098,
5963,
10497,
8043,
4818,
3989,
21572,
18037,
1026,
1047,
1028,
3191,
11368,
8447,
2696,
1006,
9199,
12259,
11774,
2571,
18804,
9153,
2618,
11774,
2571,
1007,
11618,
6453,
1063,
1042,
16150,
6790,
2378,
18780,
21422,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.urlToBe | public static ExpectedCondition<Boolean> urlToBe(final String url) {
return new ExpectedCondition<Boolean>() {
private String currentUrl = "";
@Override
public Boolean apply(WebDriver driver) {
currentUrl = driver.getCurrentUrl();
return currentUrl != null && currentUrl.equals(url);
}
@Override
public String toString() {
return String.format("url to be \"%s\". Current url: \"%s\"", url, currentUrl);
}
};
} | java | public static ExpectedCondition<Boolean> urlToBe(final String url) {
return new ExpectedCondition<Boolean>() {
private String currentUrl = "";
@Override
public Boolean apply(WebDriver driver) {
currentUrl = driver.getCurrentUrl();
return currentUrl != null && currentUrl.equals(url);
}
@Override
public String toString() {
return String.format("url to be \"%s\". Current url: \"%s\"", url, currentUrl);
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"Boolean",
">",
"urlToBe",
"(",
"final",
"String",
"url",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"Boolean",
">",
"(",
")",
"{",
"private",
"String",
"currentUrl",
"=",
"\"\"",
";",
"@",
"Override",
... | An expectation for the URL of the current page to be a specific url.
@param url the url that the page should be on
@return <code>true</code> when the URL is what it should be | [
"An",
"expectation",
"for",
"the",
"URL",
"of",
"the",
"current",
"page",
"to",
"be",
"a",
"specific",
"url",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L103-L118 | train | An expectation for checking that the current url of the application is the same as the given url. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
24471,
23223,
4783,
1006,
2345,
5164,
24471,
2140,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
1006,
1007,
1063,
2797,
5164,
2783,
3126,
2140,
1027,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java | MDAG.getStringsEndingWith | public HashSet<String> getStringsEndingWith(String suffixStr)
{
HashSet<String> strHashSet = new HashSet<String>();
if (sourceNode != null) //if the MDAG hasn't been simplified
getStrings(strHashSet, SearchCondition.SUFFIX_SEARCH_CONDITION, suffixStr, "", sourceNode.getOutgoingTransitions());
else
getStrings(strHashSet, SearchCondition.SUFFIX_SEARCH_CONDITION, suffixStr, "", simplifiedSourceNode);
return strHashSet;
} | java | public HashSet<String> getStringsEndingWith(String suffixStr)
{
HashSet<String> strHashSet = new HashSet<String>();
if (sourceNode != null) //if the MDAG hasn't been simplified
getStrings(strHashSet, SearchCondition.SUFFIX_SEARCH_CONDITION, suffixStr, "", sourceNode.getOutgoingTransitions());
else
getStrings(strHashSet, SearchCondition.SUFFIX_SEARCH_CONDITION, suffixStr, "", simplifiedSourceNode);
return strHashSet;
} | [
"public",
"HashSet",
"<",
"String",
">",
"getStringsEndingWith",
"(",
"String",
"suffixStr",
")",
"{",
"HashSet",
"<",
"String",
">",
"strHashSet",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"sourceNode",
"!=",
"null",
")",
"//i... | 后缀查询<br>
Retrieves all the Strings in the MDAG that begin with a given String.
@param suffixStr a String that is the suffix for all the desired Strings
@return a HashSet containing all the Strings present in the MDAG that end with {@code suffixStr} | [
"后缀查询<br",
">",
"Retrieves",
"all",
"the",
"Strings",
"in",
"the",
"MDAG",
"that",
"begin",
"with",
"a",
"given",
"String",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L996-L1006 | train | Get the strings ending with the suffixStr | [
30522,
2270,
23325,
13462,
1026,
5164,
1028,
4152,
18886,
3070,
5054,
4667,
24415,
1006,
5164,
16809,
3367,
2099,
1007,
1063,
23325,
13462,
1026,
5164,
1028,
2358,
25032,
11823,
13462,
1027,
2047,
23325,
13462,
1026,
5164,
1028,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java | HashUtil.fnvHash | public static int fnvHash(String data) {
final int p = 16777619;
int hash = (int) 2166136261L;
for (int i = 0; i < data.length(); i++) {
hash = (hash ^ data.charAt(i)) * p;
}
hash += hash << 13;
hash ^= hash >> 7;
hash += hash << 3;
hash ^= hash >> 17;
hash += hash << 5;
return hash;
} | java | public static int fnvHash(String data) {
final int p = 16777619;
int hash = (int) 2166136261L;
for (int i = 0; i < data.length(); i++) {
hash = (hash ^ data.charAt(i)) * p;
}
hash += hash << 13;
hash ^= hash >> 7;
hash += hash << 3;
hash ^= hash >> 17;
hash += hash << 5;
return hash;
} | [
"public",
"static",
"int",
"fnvHash",
"(",
"String",
"data",
")",
"{",
"final",
"int",
"p",
"=",
"16777619",
";",
"int",
"hash",
"=",
"(",
"int",
")",
"2166136261L",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
"("... | 改进的32位FNV算法1
@param data 字符串
@return hash结果 | [
"改进的32位FNV算法1"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java#L164-L176 | train | Returns a 32 - bit hash value for a given string. | [
30522,
2270,
10763,
20014,
1042,
2078,
2615,
14949,
2232,
1006,
5164,
2951,
1007,
1063,
2345,
20014,
1052,
1027,
16785,
2581,
2581,
2575,
16147,
1025,
20014,
23325,
1027,
1006,
20014,
1007,
20294,
2575,
17134,
2575,
23833,
2487,
2140,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/Convert.java | Convert.toCollection | public static Collection<?> toCollection(Class<?> collectionType, Class<?> elementType, Object value) {
return new CollectionConverter(collectionType, elementType).convert(value, null);
} | java | public static Collection<?> toCollection(Class<?> collectionType, Class<?> elementType, Object value) {
return new CollectionConverter(collectionType, elementType).convert(value, null);
} | [
"public",
"static",
"Collection",
"<",
"?",
">",
"toCollection",
"(",
"Class",
"<",
"?",
">",
"collectionType",
",",
"Class",
"<",
"?",
">",
"elementType",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"CollectionConverter",
"(",
"collectionType",
",",
... | 转换为集合类
@param collectionType 集合类型
@param elementType 集合中元素类型
@param value 被转换的值
@return {@link Collection}
@since 3.0.8 | [
"转换为集合类"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L500-L502 | train | Converts the given value to a Collection of given type and element type. | [
30522,
2270,
10763,
3074,
1026,
1029,
1028,
2000,
26895,
18491,
1006,
2465,
1026,
1029,
1028,
3074,
13874,
1010,
2465,
1026,
1029,
1028,
5783,
13874,
1010,
4874,
3643,
1007,
1063,
2709,
2047,
3074,
8663,
16874,
2121,
1006,
3074,
13874,
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... |
networknt/light-4j | dump/src/main/java/com/networknt/dump/DumperFactory.java | DumperFactory.createRequestDumpers | public List<IRequestDumpable> createRequestDumpers(DumpConfig config, HttpServerExchange exchange) {
RequestDumperFactory factory = new RequestDumperFactory();
List<IRequestDumpable> dumpers = new ArrayList<>();
for(String dumperNames: requestDumpers) {
IRequestDumpable dumper = factory.create(dumperNames, config, exchange);
dumpers.add(dumper);
}
return dumpers;
} | java | public List<IRequestDumpable> createRequestDumpers(DumpConfig config, HttpServerExchange exchange) {
RequestDumperFactory factory = new RequestDumperFactory();
List<IRequestDumpable> dumpers = new ArrayList<>();
for(String dumperNames: requestDumpers) {
IRequestDumpable dumper = factory.create(dumperNames, config, exchange);
dumpers.add(dumper);
}
return dumpers;
} | [
"public",
"List",
"<",
"IRequestDumpable",
">",
"createRequestDumpers",
"(",
"DumpConfig",
"config",
",",
"HttpServerExchange",
"exchange",
")",
"{",
"RequestDumperFactory",
"factory",
"=",
"new",
"RequestDumperFactory",
"(",
")",
";",
"List",
"<",
"IRequestDumpable",... | use RequestDumperFactory to create dumpers listed in this.requestDumpers
@param config type: DumpConfig
@param exchange type: HttpServerExchange
@return a list of IRequestDumpable, dumpers can dump http request info | [
"use",
"RequestDumperFactory",
"to",
"create",
"dumpers",
"listed",
"in",
"this",
".",
"requestDumpers"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/DumperFactory.java#L45-L54 | train | Create a list of request dumpers. | [
30522,
2270,
2862,
1026,
20868,
2063,
15500,
8566,
8737,
3085,
1028,
3443,
2890,
15500,
8566,
8737,
2545,
1006,
15653,
8663,
8873,
2290,
9530,
8873,
2290,
1010,
16770,
2121,
28943,
2595,
22305,
2063,
3863,
1007,
1063,
5227,
8566,
8737,
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... |
networknt/light-4j | http-url/src/main/java/com/networknt/url/QueryString.java | QueryString.addString | public final void addString(String key, String... values) {
if (values == null || Array.getLength(values) == 0) {
return;
}
List<String> list = parameters.get(key);
if (list == null) {
list = new ArrayList<>();
}
list.addAll(Arrays.asList(values));
parameters.put(key, list);
} | java | public final void addString(String key, String... values) {
if (values == null || Array.getLength(values) == 0) {
return;
}
List<String> list = parameters.get(key);
if (list == null) {
list = new ArrayList<>();
}
list.addAll(Arrays.asList(values));
parameters.put(key, list);
} | [
"public",
"final",
"void",
"addString",
"(",
"String",
"key",
",",
"String",
"...",
"values",
")",
"{",
"if",
"(",
"values",
"==",
"null",
"||",
"Array",
".",
"getLength",
"(",
"values",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"List",
"<",
"S... | Adds one or multiple string values.
Adding a single <code>null</code> value has no effect.
When adding multiple values, <code>null</code> values are converted
to blank strings.
@param key the key of the value to set
@param values the values to set | [
"Adds",
"one",
"or",
"multiple",
"string",
"values",
".",
"Adding",
"a",
"single",
"<code",
">",
"null<",
"/",
"code",
">",
"value",
"has",
"no",
"effect",
".",
"When",
"adding",
"multiple",
"values",
"<code",
">",
"null<",
"/",
"code",
">",
"values",
... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/QueryString.java#L201-L211 | train | Add a string parameter. | [
30522,
2270,
2345,
11675,
9909,
18886,
3070,
1006,
5164,
3145,
1010,
5164,
1012,
1012,
1012,
5300,
1007,
1063,
2065,
1006,
5300,
1027,
1027,
19701,
1064,
1064,
9140,
1012,
2131,
7770,
13512,
2232,
1006,
5300,
1007,
1027,
1027,
1014,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/config/entries/DeploymentEntry.java | DeploymentEntry.enrich | public static DeploymentEntry enrich(DeploymentEntry deployment, Map<String, String> prefixedProperties) {
final Map<String, String> enrichedProperties = new HashMap<>(deployment.asMap());
prefixedProperties.forEach((k, v) -> {
final String normalizedKey = k.toLowerCase();
if (k.startsWith(DEPLOYMENT_ENTRY + '.')) {
enrichedProperties.put(normalizedKey.substring(DEPLOYMENT_ENTRY.length() + 1), v);
}
});
final DescriptorProperties properties = new DescriptorProperties(true);
properties.putProperties(enrichedProperties);
return new DeploymentEntry(properties);
} | java | public static DeploymentEntry enrich(DeploymentEntry deployment, Map<String, String> prefixedProperties) {
final Map<String, String> enrichedProperties = new HashMap<>(deployment.asMap());
prefixedProperties.forEach((k, v) -> {
final String normalizedKey = k.toLowerCase();
if (k.startsWith(DEPLOYMENT_ENTRY + '.')) {
enrichedProperties.put(normalizedKey.substring(DEPLOYMENT_ENTRY.length() + 1), v);
}
});
final DescriptorProperties properties = new DescriptorProperties(true);
properties.putProperties(enrichedProperties);
return new DeploymentEntry(properties);
} | [
"public",
"static",
"DeploymentEntry",
"enrich",
"(",
"DeploymentEntry",
"deployment",
",",
"Map",
"<",
"String",
",",
"String",
">",
"prefixedProperties",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"enrichedProperties",
"=",
"new",
"HashMap",
... | Creates a new deployment entry enriched with additional properties that are prefixed with
{@link Environment#DEPLOYMENT_ENTRY}. | [
"Creates",
"a",
"new",
"deployment",
"entry",
"enriched",
"with",
"additional",
"properties",
"that",
"are",
"prefixed",
"with",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/config/entries/DeploymentEntry.java#L153-L167 | train | Enrich the deployment with the given prefixed properties. | [
30522,
2270,
10763,
10813,
4765,
2854,
4372,
13149,
1006,
10813,
4765,
2854,
10813,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
17576,
2098,
21572,
4842,
7368,
1007,
1063,
2345,
4949,
1026,
5164,
1010,
5164,
1028,
25202,
21572,
4842,
7368,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/RdbAdapter.java | RdbAdapter.count | @Override
public Map<String, Object> count(String task) {
MappingConfig config = rdbMapping.get(task);
MappingConfig.DbMapping dbMapping = config.getDbMapping();
String sql = "SELECT COUNT(1) AS cnt FROM " + SyncUtil.getDbTableName(dbMapping);
Connection conn = null;
Map<String, Object> res = new LinkedHashMap<>();
try {
conn = dataSource.getConnection();
Util.sqlRS(conn, sql, rs -> {
try {
if (rs.next()) {
Long rowCount = rs.getLong("cnt");
res.put("count", rowCount);
}
} catch (SQLException e) {
logger.error(e.getMessage(), e);
}
});
} catch (SQLException e) {
logger.error(e.getMessage(), e);
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
logger.error(e.getMessage(), e);
}
}
}
res.put("targetTable", SyncUtil.getDbTableName(dbMapping));
return res;
} | java | @Override
public Map<String, Object> count(String task) {
MappingConfig config = rdbMapping.get(task);
MappingConfig.DbMapping dbMapping = config.getDbMapping();
String sql = "SELECT COUNT(1) AS cnt FROM " + SyncUtil.getDbTableName(dbMapping);
Connection conn = null;
Map<String, Object> res = new LinkedHashMap<>();
try {
conn = dataSource.getConnection();
Util.sqlRS(conn, sql, rs -> {
try {
if (rs.next()) {
Long rowCount = rs.getLong("cnt");
res.put("count", rowCount);
}
} catch (SQLException e) {
logger.error(e.getMessage(), e);
}
});
} catch (SQLException e) {
logger.error(e.getMessage(), e);
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
logger.error(e.getMessage(), e);
}
}
}
res.put("targetTable", SyncUtil.getDbTableName(dbMapping));
return res;
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"count",
"(",
"String",
"task",
")",
"{",
"MappingConfig",
"config",
"=",
"rdbMapping",
".",
"get",
"(",
"task",
")",
";",
"MappingConfig",
".",
"DbMapping",
"dbMapping",
"=",
"config",
... | 获取总数方法
@param task 任务名, 对应配置名
@return 总数 | [
"获取总数方法"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/RdbAdapter.java#L221-L254 | train | Count the number of records in a single table. | [
30522,
1030,
2058,
15637,
2270,
4949,
1026,
5164,
1010,
4874,
1028,
4175,
1006,
5164,
4708,
1007,
1063,
12375,
8663,
8873,
2290,
9530,
8873,
2290,
1027,
16428,
25526,
29098,
2075,
1012,
2131,
1006,
4708,
1007,
1025,
12375,
8663,
8873,
2290,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java | KeyedStream.process | @Internal
public <R> SingleOutputStreamOperator<R> process(
KeyedProcessFunction<KEY, T, R> keyedProcessFunction,
TypeInformation<R> outputType) {
KeyedProcessOperator<KEY, T, R> operator = new KeyedProcessOperator<>(clean(keyedProcessFunction));
return transform("KeyedProcess", outputType, operator);
} | java | @Internal
public <R> SingleOutputStreamOperator<R> process(
KeyedProcessFunction<KEY, T, R> keyedProcessFunction,
TypeInformation<R> outputType) {
KeyedProcessOperator<KEY, T, R> operator = new KeyedProcessOperator<>(clean(keyedProcessFunction));
return transform("KeyedProcess", outputType, operator);
} | [
"@",
"Internal",
"public",
"<",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"process",
"(",
"KeyedProcessFunction",
"<",
"KEY",
",",
"T",
",",
"R",
">",
"keyedProcessFunction",
",",
"TypeInformation",
"<",
"R",
">",
"outputType",
")",
"{",
"KeyedP... | Applies the given {@link KeyedProcessFunction} on the input stream, thereby creating a transformed output stream.
<p>The function will be called for every element in the input streams and can produce zero
or more output elements. Contrary to the {@link DataStream#flatMap(FlatMapFunction)}
function, this function can also query the time and set timers. When reacting to the firing
of set timers the function can directly emit elements and/or register yet more timers.
@param keyedProcessFunction The {@link KeyedProcessFunction} that is called for each element in the stream.
@param outputType {@link TypeInformation} for the result type of the function.
@param <R> The type of elements emitted by the {@code KeyedProcessFunction}.
@return The transformed {@link DataStream}. | [
"Applies",
"the",
"given",
"{",
"@link",
"KeyedProcessFunction",
"}",
"on",
"the",
"input",
"stream",
"thereby",
"creating",
"a",
"transformed",
"output",
"stream",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java#L392-L399 | train | Process a single output stream. | [
30522,
1030,
4722,
2270,
1026,
1054,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
2832,
1006,
3145,
2098,
21572,
9623,
22747,
4609,
7542,
1026,
3145,
1010,
1056,
1010,
1054,
1028,
3145,
2098,
21572,
9623,
22747,
4609,
7542... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java | HiveAuthFactory.getDelegationToken | public String getDelegationToken(String owner, String renewer) throws HiveSQLException {
if (saslServer == null) {
throw new HiveSQLException(
"Delegation token only supported over kerberos authentication", "08S01");
}
try {
String tokenStr = saslServer.getDelegationTokenWithService(owner, renewer, HS2_CLIENT_TOKEN);
if (tokenStr == null || tokenStr.isEmpty()) {
throw new HiveSQLException(
"Received empty retrieving delegation token for user " + owner, "08S01");
}
return tokenStr;
} catch (IOException e) {
throw new HiveSQLException(
"Error retrieving delegation token for user " + owner, "08S01", e);
} catch (InterruptedException e) {
throw new HiveSQLException("delegation token retrieval interrupted", "08S01", e);
}
} | java | public String getDelegationToken(String owner, String renewer) throws HiveSQLException {
if (saslServer == null) {
throw new HiveSQLException(
"Delegation token only supported over kerberos authentication", "08S01");
}
try {
String tokenStr = saslServer.getDelegationTokenWithService(owner, renewer, HS2_CLIENT_TOKEN);
if (tokenStr == null || tokenStr.isEmpty()) {
throw new HiveSQLException(
"Received empty retrieving delegation token for user " + owner, "08S01");
}
return tokenStr;
} catch (IOException e) {
throw new HiveSQLException(
"Error retrieving delegation token for user " + owner, "08S01", e);
} catch (InterruptedException e) {
throw new HiveSQLException("delegation token retrieval interrupted", "08S01", e);
}
} | [
"public",
"String",
"getDelegationToken",
"(",
"String",
"owner",
",",
"String",
"renewer",
")",
"throws",
"HiveSQLException",
"{",
"if",
"(",
"saslServer",
"==",
"null",
")",
"{",
"throw",
"new",
"HiveSQLException",
"(",
"\"Delegation token only supported over kerber... | retrieve delegation token for the given user | [
"retrieve",
"delegation",
"token",
"for",
"the",
"given",
"user"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java#L315-L334 | train | Get delegation token for a user. | [
30522,
2270,
5164,
2131,
9247,
29107,
3508,
18715,
2368,
1006,
5164,
3954,
1010,
5164,
20687,
2121,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
2065,
1006,
21871,
4877,
2121,
6299,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
267... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.cut | public static void cut(File srcImgFile, File destImgFile, Rectangle rectangle) {
cut(read(srcImgFile), destImgFile, rectangle);
} | java | public static void cut(File srcImgFile, File destImgFile, Rectangle rectangle) {
cut(read(srcImgFile), destImgFile, rectangle);
} | [
"public",
"static",
"void",
"cut",
"(",
"File",
"srcImgFile",
",",
"File",
"destImgFile",
",",
"Rectangle",
"rectangle",
")",
"{",
"cut",
"(",
"read",
"(",
"srcImgFile",
")",
",",
"destImgFile",
",",
"rectangle",
")",
";",
"}"
] | 图像切割(按指定起点坐标和宽高切割)
@param srcImgFile 源图像文件
@param destImgFile 切片后的图像文件
@param rectangle 矩形对象,表示矩形区域的x,y,width,height
@since 3.1.0 | [
"图像切割",
"(",
"按指定起点坐标和宽高切割",
")"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L256-L258 | train | Cut the image from srcImgFile to destImgFile with the specified rectangle. | [
30522,
2270,
10763,
11675,
3013,
1006,
5371,
5034,
6895,
24798,
8873,
2571,
1010,
5371,
4078,
3775,
24798,
8873,
2571,
1010,
28667,
23395,
28667,
23395,
1007,
1063,
3013,
1006,
3191,
1006,
5034,
6895,
24798,
8873,
2571,
1007,
1010,
4078,
37... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.removeAll | public void removeAll() {
for(Iterator<Map.Entry<MetricName, Metric>> it = metrics.entrySet().iterator(); it.hasNext();) {
Map.Entry<MetricName, Metric> entry = it.next();
Metric metric = entry.getValue();
if(metric != null) {
onMetricRemoved(entry.getKey(), metric);
}
it.remove();
}
} | java | public void removeAll() {
for(Iterator<Map.Entry<MetricName, Metric>> it = metrics.entrySet().iterator(); it.hasNext();) {
Map.Entry<MetricName, Metric> entry = it.next();
Metric metric = entry.getValue();
if(metric != null) {
onMetricRemoved(entry.getKey(), metric);
}
it.remove();
}
} | [
"public",
"void",
"removeAll",
"(",
")",
"{",
"for",
"(",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"MetricName",
",",
"Metric",
">",
">",
"it",
"=",
"metrics",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
... | Removes all the metrics in registry. | [
"Removes",
"all",
"the",
"metrics",
"in",
"registry",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/MetricRegistry.java#L245-L254 | train | Removes all the metrics from the cache. | [
30522,
2270,
11675,
6366,
8095,
1006,
1007,
1063,
2005,
1006,
2009,
6906,
4263,
1026,
4949,
1012,
4443,
1026,
12046,
18442,
1010,
12046,
1028,
1028,
2009,
1027,
12046,
2015,
1012,
4443,
13462,
1006,
1007,
1012,
2009,
6906,
4263,
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... |
alibaba/canal | client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/service/RdbMirrorDbSyncService.java | RdbMirrorDbSyncService.sync | public void sync(List<Dml> dmls) {
List<Dml> dmlList = new ArrayList<>();
for (Dml dml : dmls) {
String destination = StringUtils.trimToEmpty(dml.getDestination());
String database = dml.getDatabase();
MirrorDbConfig mirrorDbConfig = mirrorDbConfigCache.get(destination + "." + database);
if (mirrorDbConfig == null) {
continue;
}
if (mirrorDbConfig.getMappingConfig() == null) {
continue;
}
if (dml.getGroupId() != null && StringUtils.isNotEmpty(mirrorDbConfig.getMappingConfig().getGroupId())) {
if (!mirrorDbConfig.getMappingConfig().getGroupId().equals(dml.getGroupId())) {
continue; // 如果groupId不匹配则过滤
}
}
if (dml.getIsDdl() != null && dml.getIsDdl() && StringUtils.isNotEmpty(dml.getSql())) {
// DDL
if (logger.isDebugEnabled()) {
logger.debug("DDL: {}", JSON.toJSONString(dml, SerializerFeature.WriteMapNullValue));
}
executeDdl(mirrorDbConfig, dml);
rdbSyncService.getColumnsTypeCache().remove(destination + "." + database + "." + dml.getTable());
mirrorDbConfig.getTableConfig().remove(dml.getTable()); // 删除对应库表配置
} else {
// DML
initMappingConfig(dml.getTable(), mirrorDbConfig.getMappingConfig(), mirrorDbConfig, dml);
dmlList.add(dml);
}
}
if (!dmlList.isEmpty()) {
rdbSyncService.sync(dmlList, dml -> {
MirrorDbConfig mirrorDbConfig = mirrorDbConfigCache.get(dml.getDestination() + "." + dml.getDatabase());
if (mirrorDbConfig == null) {
return false;
}
String table = dml.getTable();
MappingConfig config = mirrorDbConfig.getTableConfig().get(table);
if (config == null) {
return false;
}
if (config.getConcurrent()) {
List<SingleDml> singleDmls = SingleDml.dml2SingleDmls(dml);
singleDmls.forEach(singleDml -> {
int hash = rdbSyncService.pkHash(config.getDbMapping(), singleDml.getData());
RdbSyncService.SyncItem syncItem = new RdbSyncService.SyncItem(config, singleDml);
rdbSyncService.getDmlsPartition()[hash].add(syncItem);
});
} else {
int hash = 0;
List<SingleDml> singleDmls = SingleDml.dml2SingleDmls(dml);
singleDmls.forEach(singleDml -> {
RdbSyncService.SyncItem syncItem = new RdbSyncService.SyncItem(config, singleDml);
rdbSyncService.getDmlsPartition()[hash].add(syncItem);
});
}
return true;
});
}
} | java | public void sync(List<Dml> dmls) {
List<Dml> dmlList = new ArrayList<>();
for (Dml dml : dmls) {
String destination = StringUtils.trimToEmpty(dml.getDestination());
String database = dml.getDatabase();
MirrorDbConfig mirrorDbConfig = mirrorDbConfigCache.get(destination + "." + database);
if (mirrorDbConfig == null) {
continue;
}
if (mirrorDbConfig.getMappingConfig() == null) {
continue;
}
if (dml.getGroupId() != null && StringUtils.isNotEmpty(mirrorDbConfig.getMappingConfig().getGroupId())) {
if (!mirrorDbConfig.getMappingConfig().getGroupId().equals(dml.getGroupId())) {
continue; // 如果groupId不匹配则过滤
}
}
if (dml.getIsDdl() != null && dml.getIsDdl() && StringUtils.isNotEmpty(dml.getSql())) {
// DDL
if (logger.isDebugEnabled()) {
logger.debug("DDL: {}", JSON.toJSONString(dml, SerializerFeature.WriteMapNullValue));
}
executeDdl(mirrorDbConfig, dml);
rdbSyncService.getColumnsTypeCache().remove(destination + "." + database + "." + dml.getTable());
mirrorDbConfig.getTableConfig().remove(dml.getTable()); // 删除对应库表配置
} else {
// DML
initMappingConfig(dml.getTable(), mirrorDbConfig.getMappingConfig(), mirrorDbConfig, dml);
dmlList.add(dml);
}
}
if (!dmlList.isEmpty()) {
rdbSyncService.sync(dmlList, dml -> {
MirrorDbConfig mirrorDbConfig = mirrorDbConfigCache.get(dml.getDestination() + "." + dml.getDatabase());
if (mirrorDbConfig == null) {
return false;
}
String table = dml.getTable();
MappingConfig config = mirrorDbConfig.getTableConfig().get(table);
if (config == null) {
return false;
}
if (config.getConcurrent()) {
List<SingleDml> singleDmls = SingleDml.dml2SingleDmls(dml);
singleDmls.forEach(singleDml -> {
int hash = rdbSyncService.pkHash(config.getDbMapping(), singleDml.getData());
RdbSyncService.SyncItem syncItem = new RdbSyncService.SyncItem(config, singleDml);
rdbSyncService.getDmlsPartition()[hash].add(syncItem);
});
} else {
int hash = 0;
List<SingleDml> singleDmls = SingleDml.dml2SingleDmls(dml);
singleDmls.forEach(singleDml -> {
RdbSyncService.SyncItem syncItem = new RdbSyncService.SyncItem(config, singleDml);
rdbSyncService.getDmlsPartition()[hash].add(syncItem);
});
}
return true;
});
}
} | [
"public",
"void",
"sync",
"(",
"List",
"<",
"Dml",
">",
"dmls",
")",
"{",
"List",
"<",
"Dml",
">",
"dmlList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Dml",
"dml",
":",
"dmls",
")",
"{",
"String",
"destination",
"=",
"StringUtils"... | 批量同步方法
@param dmls 批量 DML | [
"批量同步方法"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/service/RdbMirrorDbSyncService.java#L50-L113 | train | Synchronize DMLs. | [
30522,
2270,
11675,
26351,
1006,
2862,
1026,
1040,
19968,
1028,
1040,
19968,
2015,
1007,
1063,
2862,
1026,
1040,
19968,
1028,
1040,
19968,
9863,
1027,
2047,
9140,
9863,
1026,
1028,
1006,
1007,
1025,
2005,
1006,
1040,
19968,
1040,
19968,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Schema.java | Schema.rowtime | public Schema rowtime(Rowtime rowtime) {
if (lastField == null) {
throw new ValidationException("No field defined previously. Use field() before.");
}
tableSchema.get(lastField).putAll(rowtime.toProperties());
lastField = null;
return this;
} | java | public Schema rowtime(Rowtime rowtime) {
if (lastField == null) {
throw new ValidationException("No field defined previously. Use field() before.");
}
tableSchema.get(lastField).putAll(rowtime.toProperties());
lastField = null;
return this;
} | [
"public",
"Schema",
"rowtime",
"(",
"Rowtime",
"rowtime",
")",
"{",
"if",
"(",
"lastField",
"==",
"null",
")",
"{",
"throw",
"new",
"ValidationException",
"(",
"\"No field defined previously. Use field() before.\"",
")",
";",
"}",
"tableSchema",
".",
"get",
"(",
... | Specifies the previously defined field as an event-time attribute.
<p>E.g. field("rowtime", Types.SQL_TIMESTAMP).rowtime(...) | [
"Specifies",
"the",
"previously",
"defined",
"field",
"as",
"an",
"event",
"-",
"time",
"attribute",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Schema.java#L139-L146 | train | Adds a rowtime to the schema. | [
30522,
2270,
8040,
28433,
5216,
7292,
1006,
5216,
7292,
5216,
7292,
1007,
1063,
2065,
1006,
2197,
3790,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
27354,
10288,
24422,
1006,
1000,
2053,
2492,
4225,
3130,
1012,
2224,
2492,
1006,
1007,
2077,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/ComputeFunction.java | ComputeFunction.setNewVertexValue | public final void setNewVertexValue(VV newValue) {
if (setNewVertexValueCalled) {
throw new IllegalStateException("setNewVertexValue should only be called at most once per updateVertex");
}
setNewVertexValueCalled = true;
outVertex.f1 = newValue;
out.collect(Either.Left(outVertex));
} | java | public final void setNewVertexValue(VV newValue) {
if (setNewVertexValueCalled) {
throw new IllegalStateException("setNewVertexValue should only be called at most once per updateVertex");
}
setNewVertexValueCalled = true;
outVertex.f1 = newValue;
out.collect(Either.Left(outVertex));
} | [
"public",
"final",
"void",
"setNewVertexValue",
"(",
"VV",
"newValue",
")",
"{",
"if",
"(",
"setNewVertexValueCalled",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"setNewVertexValue should only be called at most once per updateVertex\"",
")",
";",
"}",
"setN... | Sets the new value of this vertex.
<p>This should be called at most once per ComputeFunction.
@param newValue The new vertex value. | [
"Sets",
"the",
"new",
"value",
"of",
"this",
"vertex",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/pregel/ComputeFunction.java#L130-L139 | train | Sets the new value of the vertex. | [
30522,
2270,
2345,
11675,
2275,
2638,
2860,
16874,
10288,
10175,
5657,
1006,
1058,
2615,
2047,
10175,
5657,
1007,
1063,
2065,
1006,
2275,
2638,
2860,
16874,
10288,
10175,
5657,
9289,
3709,
1007,
1063,
5466,
2047,
6206,
9153,
17389,
2595,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | example/src/main/java/io/netty/example/http2/helloworld/multiplex/server/Http2ServerInitializer.java | Http2ServerInitializer.configureClearText | private void configureClearText(SocketChannel ch) {
final ChannelPipeline p = ch.pipeline();
final HttpServerCodec sourceCodec = new HttpServerCodec();
p.addLast(sourceCodec);
p.addLast(new HttpServerUpgradeHandler(sourceCodec, upgradeCodecFactory));
p.addLast(new SimpleChannelInboundHandler<HttpMessage>() {
@Override
protected void channelRead0(ChannelHandlerContext ctx, HttpMessage msg) throws Exception {
// If this handler is hit then no upgrade has been attempted and the client is just talking HTTP.
System.err.println("Directly talking: " + msg.protocolVersion() + " (no upgrade was attempted)");
ChannelPipeline pipeline = ctx.pipeline();
ChannelHandlerContext thisCtx = pipeline.context(this);
pipeline.addAfter(thisCtx.name(), null, new HelloWorldHttp1Handler("Direct. No Upgrade Attempted."));
pipeline.replace(this, null, new HttpObjectAggregator(maxHttpContentLength));
ctx.fireChannelRead(ReferenceCountUtil.retain(msg));
}
});
p.addLast(new UserEventLogger());
} | java | private void configureClearText(SocketChannel ch) {
final ChannelPipeline p = ch.pipeline();
final HttpServerCodec sourceCodec = new HttpServerCodec();
p.addLast(sourceCodec);
p.addLast(new HttpServerUpgradeHandler(sourceCodec, upgradeCodecFactory));
p.addLast(new SimpleChannelInboundHandler<HttpMessage>() {
@Override
protected void channelRead0(ChannelHandlerContext ctx, HttpMessage msg) throws Exception {
// If this handler is hit then no upgrade has been attempted and the client is just talking HTTP.
System.err.println("Directly talking: " + msg.protocolVersion() + " (no upgrade was attempted)");
ChannelPipeline pipeline = ctx.pipeline();
ChannelHandlerContext thisCtx = pipeline.context(this);
pipeline.addAfter(thisCtx.name(), null, new HelloWorldHttp1Handler("Direct. No Upgrade Attempted."));
pipeline.replace(this, null, new HttpObjectAggregator(maxHttpContentLength));
ctx.fireChannelRead(ReferenceCountUtil.retain(msg));
}
});
p.addLast(new UserEventLogger());
} | [
"private",
"void",
"configureClearText",
"(",
"SocketChannel",
"ch",
")",
"{",
"final",
"ChannelPipeline",
"p",
"=",
"ch",
".",
"pipeline",
"(",
")",
";",
"final",
"HttpServerCodec",
"sourceCodec",
"=",
"new",
"HttpServerCodec",
"(",
")",
";",
"p",
".",
"add... | Configure the pipeline for a cleartext upgrade from HTTP to HTTP/2.0 | [
"Configure",
"the",
"pipeline",
"for",
"a",
"cleartext",
"upgrade",
"from",
"HTTP",
"to",
"HTTP",
"/",
"2",
".",
"0"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http2/helloworld/multiplex/server/Http2ServerInitializer.java#L91-L111 | train | Configure clear text. | [
30522,
2797,
11675,
9530,
8873,
27390,
8586,
19738,
19731,
18413,
1006,
22278,
26058,
10381,
1007,
1063,
2345,
3149,
24548,
4179,
1052,
1027,
10381,
1012,
13117,
1006,
1007,
1025,
2345,
16770,
2121,
6299,
16044,
2278,
3120,
16044,
2278,
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/img/Img.java | Img.pressImage | public Img pressImage(Image pressImg, int x, int y, float alpha) {
final int pressImgWidth = pressImg.getWidth(null);
final int pressImgHeight = pressImg.getHeight(null);
return pressImage(pressImg, new Rectangle(x, y, pressImgWidth, pressImgHeight), alpha);
} | java | public Img pressImage(Image pressImg, int x, int y, float alpha) {
final int pressImgWidth = pressImg.getWidth(null);
final int pressImgHeight = pressImg.getHeight(null);
return pressImage(pressImg, new Rectangle(x, y, pressImgWidth, pressImgHeight), alpha);
} | [
"public",
"Img",
"pressImage",
"(",
"Image",
"pressImg",
",",
"int",
"x",
",",
"int",
"y",
",",
"float",
"alpha",
")",
"{",
"final",
"int",
"pressImgWidth",
"=",
"pressImg",
".",
"getWidth",
"(",
"null",
")",
";",
"final",
"int",
"pressImgHeight",
"=",
... | 给图片添加图片水印
@param pressImg 水印图片,可以使用{@link ImageIO#read(File)}方法读取文件
@param x 修正值。 默认在中间,偏移量相对于中间偏移
@param y 修正值。 默认在中间,偏移量相对于中间偏移
@param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
@return this | [
"给图片添加图片水印"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L433-L438 | train | Press an image at the specified coordinates. | [
30522,
2270,
10047,
2290,
2811,
9581,
3351,
1006,
3746,
2811,
5714,
2290,
1010,
20014,
1060,
1010,
20014,
1061,
1010,
14257,
6541,
1007,
1063,
2345,
20014,
2811,
5714,
2290,
9148,
11927,
2232,
1027,
2811,
5714,
2290,
1012,
2131,
9148,
11927... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapKeyedStateBackend.java | HeapKeyedStateBackend.create | @SuppressWarnings("unchecked")
@Nonnull
@Override
public <T extends HeapPriorityQueueElement & PriorityComparable & Keyed> KeyGroupedInternalPriorityQueue<T> create(
@Nonnull String stateName,
@Nonnull TypeSerializer<T> byteOrderedElementSerializer) {
final HeapPriorityQueueSnapshotRestoreWrapper existingState = registeredPQStates.get(stateName);
if (existingState != null) {
// TODO we implement the simple way of supporting the current functionality, mimicking keyed state
// because this should be reworked in FLINK-9376 and then we should have a common algorithm over
// StateMetaInfoSnapshot that avoids this code duplication.
TypeSerializerSchemaCompatibility<T> compatibilityResult =
existingState.getMetaInfo().updateElementSerializer(byteOrderedElementSerializer);
if (compatibilityResult.isIncompatible()) {
throw new FlinkRuntimeException(new StateMigrationException("For heap backends, the new priority queue serializer must not be incompatible."));
} else {
registeredPQStates.put(
stateName,
existingState.forUpdatedSerializer(byteOrderedElementSerializer));
}
return existingState.getPriorityQueue();
} else {
final RegisteredPriorityQueueStateBackendMetaInfo<T> metaInfo =
new RegisteredPriorityQueueStateBackendMetaInfo<>(stateName, byteOrderedElementSerializer);
return createInternal(metaInfo);
}
} | java | @SuppressWarnings("unchecked")
@Nonnull
@Override
public <T extends HeapPriorityQueueElement & PriorityComparable & Keyed> KeyGroupedInternalPriorityQueue<T> create(
@Nonnull String stateName,
@Nonnull TypeSerializer<T> byteOrderedElementSerializer) {
final HeapPriorityQueueSnapshotRestoreWrapper existingState = registeredPQStates.get(stateName);
if (existingState != null) {
// TODO we implement the simple way of supporting the current functionality, mimicking keyed state
// because this should be reworked in FLINK-9376 and then we should have a common algorithm over
// StateMetaInfoSnapshot that avoids this code duplication.
TypeSerializerSchemaCompatibility<T> compatibilityResult =
existingState.getMetaInfo().updateElementSerializer(byteOrderedElementSerializer);
if (compatibilityResult.isIncompatible()) {
throw new FlinkRuntimeException(new StateMigrationException("For heap backends, the new priority queue serializer must not be incompatible."));
} else {
registeredPQStates.put(
stateName,
existingState.forUpdatedSerializer(byteOrderedElementSerializer));
}
return existingState.getPriorityQueue();
} else {
final RegisteredPriorityQueueStateBackendMetaInfo<T> metaInfo =
new RegisteredPriorityQueueStateBackendMetaInfo<>(stateName, byteOrderedElementSerializer);
return createInternal(metaInfo);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Nonnull",
"@",
"Override",
"public",
"<",
"T",
"extends",
"HeapPriorityQueueElement",
"&",
"PriorityComparable",
"&",
"Keyed",
">",
"KeyGroupedInternalPriorityQueue",
"<",
"T",
">",
"create",
"(",
"@",
"Non... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapKeyedStateBackend.java#L149-L180 | train | Create a new priority queue. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
1030,
2512,
11231,
3363,
1030,
2058,
15637,
2270,
1026,
1056,
8908,
16721,
18098,
25346,
3012,
4226,
5657,
12260,
3672,
1004,
9470,
9006,
28689,
3468,
1004,
31... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java | RadixSort.getKeyPrefixArrayCounts | private static long[][] getKeyPrefixArrayCounts(
LongArray array, long startIndex, long numRecords, int startByteIndex, int endByteIndex) {
long[][] counts = new long[8][];
long bitwiseMax = 0;
long bitwiseMin = -1L;
long baseOffset = array.getBaseOffset() + startIndex * 8L;
long limit = baseOffset + numRecords * 16L;
Object baseObject = array.getBaseObject();
for (long offset = baseOffset; offset < limit; offset += 16) {
long value = Platform.getLong(baseObject, offset + 8);
bitwiseMax |= value;
bitwiseMin &= value;
}
long bitsChanged = bitwiseMin ^ bitwiseMax;
for (int i = startByteIndex; i <= endByteIndex; i++) {
if (((bitsChanged >>> (i * 8)) & 0xff) != 0) {
counts[i] = new long[256];
for (long offset = baseOffset; offset < limit; offset += 16) {
counts[i][(int)((Platform.getLong(baseObject, offset + 8) >>> (i * 8)) & 0xff)]++;
}
}
}
return counts;
} | java | private static long[][] getKeyPrefixArrayCounts(
LongArray array, long startIndex, long numRecords, int startByteIndex, int endByteIndex) {
long[][] counts = new long[8][];
long bitwiseMax = 0;
long bitwiseMin = -1L;
long baseOffset = array.getBaseOffset() + startIndex * 8L;
long limit = baseOffset + numRecords * 16L;
Object baseObject = array.getBaseObject();
for (long offset = baseOffset; offset < limit; offset += 16) {
long value = Platform.getLong(baseObject, offset + 8);
bitwiseMax |= value;
bitwiseMin &= value;
}
long bitsChanged = bitwiseMin ^ bitwiseMax;
for (int i = startByteIndex; i <= endByteIndex; i++) {
if (((bitsChanged >>> (i * 8)) & 0xff) != 0) {
counts[i] = new long[256];
for (long offset = baseOffset; offset < limit; offset += 16) {
counts[i][(int)((Platform.getLong(baseObject, offset + 8) >>> (i * 8)) & 0xff)]++;
}
}
}
return counts;
} | [
"private",
"static",
"long",
"[",
"]",
"[",
"]",
"getKeyPrefixArrayCounts",
"(",
"LongArray",
"array",
",",
"long",
"startIndex",
",",
"long",
"numRecords",
",",
"int",
"startByteIndex",
",",
"int",
"endByteIndex",
")",
"{",
"long",
"[",
"]",
"[",
"]",
"co... | Specialization of getCounts() for key-prefix arrays. We could probably combine this with
getCounts with some added parameters but that seems to hurt in benchmarks. | [
"Specialization",
"of",
"getCounts",
"()",
"for",
"key",
"-",
"prefix",
"arrays",
".",
"We",
"could",
"probably",
"combine",
"this",
"with",
"getCounts",
"with",
"some",
"added",
"parameters",
"but",
"that",
"seems",
"to",
"hurt",
"in",
"benchmarks",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java#L214-L237 | train | Get the key prefix array counts. | [
30522,
2797,
10763,
2146,
1031,
1033,
1031,
1033,
2131,
14839,
28139,
8873,
18684,
11335,
2100,
3597,
16671,
2015,
1006,
2146,
2906,
9447,
9140,
1010,
2146,
2707,
22254,
10288,
1010,
2146,
16371,
2213,
2890,
27108,
5104,
1010,
20014,
2707,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java | NeuralNetworkParser.FORM | int FORM(final List<Integer> forms, int id)
{
return ((id != -1) ? (forms.get(id)) : kNilForm);
} | java | int FORM(final List<Integer> forms, int id)
{
return ((id != -1) ? (forms.get(id)) : kNilForm);
} | [
"int",
"FORM",
"(",
"final",
"List",
"<",
"Integer",
">",
"forms",
",",
"int",
"id",
")",
"{",
"return",
"(",
"(",
"id",
"!=",
"-",
"1",
")",
"?",
"(",
"forms",
".",
"get",
"(",
"id",
")",
")",
":",
"kNilForm",
")",
";",
"}"
] | 获取单词
@param forms 单词列表
@param id 单词下标
@return 单词 | [
"获取单词"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java#L628-L631 | train | Get the form from a list of forms. | [
30522,
20014,
2433,
1006,
2345,
2862,
1026,
16109,
1028,
3596,
1010,
20014,
8909,
1007,
1063,
2709,
1006,
1006,
8909,
999,
1027,
1011,
1015,
1007,
1029,
1006,
3596,
1012,
2131,
1006,
8909,
1007,
1007,
1024,
14161,
4014,
14192,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java | Matrix.random | public static Matrix random(int m, int n)
{
Matrix A = new Matrix(m, n);
double[][] X = A.getArray();
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
X[i][j] = Math.random();
}
}
return A;
} | java | public static Matrix random(int m, int n)
{
Matrix A = new Matrix(m, n);
double[][] X = A.getArray();
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
X[i][j] = Math.random();
}
}
return A;
} | [
"public",
"static",
"Matrix",
"random",
"(",
"int",
"m",
",",
"int",
"n",
")",
"{",
"Matrix",
"A",
"=",
"new",
"Matrix",
"(",
"m",
",",
"n",
")",
";",
"double",
"[",
"]",
"[",
"]",
"X",
"=",
"A",
".",
"getArray",
"(",
")",
";",
"for",
"(",
... | Generate matrix with random elements
@param m Number of rows.
@param n Number of colums.
@return An m-by-n matrix with uniformly distributed random elements. | [
"Generate",
"matrix",
"with",
"random",
"elements"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L995-L1007 | train | Random matrix. | [
30522,
2270,
10763,
8185,
6721,
1006,
20014,
1049,
1010,
20014,
1050,
1007,
1063,
8185,
1037,
1027,
2047,
8185,
1006,
1049,
1010,
1050,
1007,
1025,
3313,
1031,
1033,
1031,
1033,
1060,
1027,
1037,
1012,
2131,
2906,
9447,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java | AbstractBootstrap.option | public <T> B option(ChannelOption<T> option, T value) {
if (option == null) {
throw new NullPointerException("option");
}
if (value == null) {
synchronized (options) {
options.remove(option);
}
} else {
synchronized (options) {
options.put(option, value);
}
}
return self();
} | java | public <T> B option(ChannelOption<T> option, T value) {
if (option == null) {
throw new NullPointerException("option");
}
if (value == null) {
synchronized (options) {
options.remove(option);
}
} else {
synchronized (options) {
options.put(option, value);
}
}
return self();
} | [
"public",
"<",
"T",
">",
"B",
"option",
"(",
"ChannelOption",
"<",
"T",
">",
"option",
",",
"T",
"value",
")",
"{",
"if",
"(",
"option",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"option\"",
")",
";",
"}",
"if",
"(",
"v... | Allow to specify a {@link ChannelOption} which is used for the {@link Channel} instances once they got
created. Use a value of {@code null} to remove a previous set {@link ChannelOption}. | [
"Allow",
"to",
"specify",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java#L170-L184 | train | Sets an option on the session. | [
30522,
2270,
1026,
1056,
1028,
1038,
5724,
1006,
3149,
7361,
3508,
1026,
1056,
1028,
5724,
1010,
1056,
3643,
1007,
1063,
2065,
1006,
5724,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
5724,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.offsetSecond | public static DateTime offsetSecond(Date date, int offset) {
return offset(date, DateField.SECOND, offset);
} | java | public static DateTime offsetSecond(Date date, int offset) {
return offset(date, DateField.SECOND, offset);
} | [
"public",
"static",
"DateTime",
"offsetSecond",
"(",
"Date",
"date",
",",
"int",
"offset",
")",
"{",
"return",
"offset",
"(",
"date",
",",
"DateField",
".",
"SECOND",
",",
"offset",
")",
";",
"}"
] | 偏移秒数
@param date 日期
@param offset 偏移秒数,正数向未来偏移,负数向历史偏移
@return 偏移后的日期 | [
"偏移秒数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1131-L1133 | train | Create an offset of the given date with the second field. | [
30522,
2270,
10763,
3058,
7292,
16396,
3366,
8663,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getUlong40 | public final long getUlong40() {
if (position + 4 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 4));
byte[] buf = buffer;
return ((long) (0xff & buf[position++])) | ((long) (0xff & buf[position++]) << 8)
| ((long) (0xff & buf[position++]) << 16) | ((long) (0xff & buf[position++]) << 24)
| ((long) (0xff & buf[position++]) << 32);
} | java | public final long getUlong40() {
if (position + 4 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 4));
byte[] buf = buffer;
return ((long) (0xff & buf[position++])) | ((long) (0xff & buf[position++]) << 8)
| ((long) (0xff & buf[position++]) << 16) | ((long) (0xff & buf[position++]) << 24)
| ((long) (0xff & buf[position++]) << 32);
} | [
"public",
"final",
"long",
"getUlong40",
"(",
")",
"{",
"if",
"(",
"position",
"+",
"4",
">=",
"origin",
"+",
"limit",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"(",
"position",
"-",
"origin",
"+",
"4",
")",
")",
"... | Return next 40-bit unsigned int from buffer. (little-endian) | [
"Return",
"next",
"40",
"-",
"bit",
"unsigned",
"int",
"from",
"buffer",
".",
"(",
"little",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L602-L610 | train | Gets a 40 - bit unsigned long from the buffer. | [
30522,
2270,
2345,
2146,
2131,
18845,
3070,
12740,
1006,
1007,
1063,
2065,
1006,
2597,
1009,
1018,
1028,
1027,
4761,
1009,
5787,
1007,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
5787,
4654,
9468,
13089,
1024,
1000,
1009,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | handler/src/main/java/com/networknt/handler/Handler.java | Handler.initHandlers | static void initHandlers() {
if (config != null && config.getHandlers() != null) {
// initialize handlers
for (Object handler : config.getHandlers()) {
// If the handler is configured as just a string, it's a fully qualified class
// name with a default constructor.
if (handler instanceof String) {
initStringDefinedHandler((String) handler);
} else if (handler instanceof Map) {
initMapDefinedHandler((Map<String, Object>) handler);
}
}
}
} | java | static void initHandlers() {
if (config != null && config.getHandlers() != null) {
// initialize handlers
for (Object handler : config.getHandlers()) {
// If the handler is configured as just a string, it's a fully qualified class
// name with a default constructor.
if (handler instanceof String) {
initStringDefinedHandler((String) handler);
} else if (handler instanceof Map) {
initMapDefinedHandler((Map<String, Object>) handler);
}
}
}
} | [
"static",
"void",
"initHandlers",
"(",
")",
"{",
"if",
"(",
"config",
"!=",
"null",
"&&",
"config",
".",
"getHandlers",
"(",
")",
"!=",
"null",
")",
"{",
"// initialize handlers",
"for",
"(",
"Object",
"handler",
":",
"config",
".",
"getHandlers",
"(",
"... | Construct the named map of handlers. Note: All handlers in use for this
microservice should be listed in this handlers list
@throws Exception | [
"Construct",
"the",
"named",
"map",
"of",
"handlers",
".",
"Note",
":",
"All",
"handlers",
"in",
"use",
"for",
"this",
"microservice",
"should",
"be",
"listed",
"in",
"this",
"handlers",
"list"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/handler/src/main/java/com/networknt/handler/Handler.java#L82-L95 | train | Initialize the handlers. | [
30522,
10763,
11675,
1999,
26054,
4859,
12910,
1006,
1007,
1063,
2065,
1006,
9530,
8873,
2290,
999,
1027,
19701,
1004,
1004,
9530,
8873,
2290,
1012,
2131,
11774,
12910,
1006,
1007,
999,
1027,
19701,
1007,
1063,
1013,
1013,
3988,
4697,
28213... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/word/TfIdfCounter.java | TfIdfCounter.add | public int add(String text)
{
int id = tfMap.size();
add(id, text);
return id;
} | java | public int add(String text)
{
int id = tfMap.size();
add(id, text);
return id;
} | [
"public",
"int",
"add",
"(",
"String",
"text",
")",
"{",
"int",
"id",
"=",
"tfMap",
".",
"size",
"(",
")",
";",
"add",
"(",
"id",
",",
"text",
")",
";",
"return",
"id",
";",
"}"
] | 添加文档,自动分配id
@param text | [
"添加文档,自动分配id"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word/TfIdfCounter.java#L133-L138 | train | Add a new record to the record set. | [
30522,
2270,
20014,
5587,
1006,
5164,
3793,
1007,
1063,
20014,
8909,
1027,
1056,
16715,
9331,
1012,
2946,
1006,
1007,
1025,
5587,
1006,
8909,
1010,
3793,
1007,
1025,
2709,
8909,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/JoinedStreams.java | JoinedStreams.where | public <KEY> Where<KEY> where(KeySelector<T1, KEY> keySelector, TypeInformation<KEY> keyType) {
requireNonNull(keySelector);
requireNonNull(keyType);
return new Where<>(input1.clean(keySelector), keyType);
} | java | public <KEY> Where<KEY> where(KeySelector<T1, KEY> keySelector, TypeInformation<KEY> keyType) {
requireNonNull(keySelector);
requireNonNull(keyType);
return new Where<>(input1.clean(keySelector), keyType);
} | [
"public",
"<",
"KEY",
">",
"Where",
"<",
"KEY",
">",
"where",
"(",
"KeySelector",
"<",
"T1",
",",
"KEY",
">",
"keySelector",
",",
"TypeInformation",
"<",
"KEY",
">",
"keyType",
")",
"{",
"requireNonNull",
"(",
"keySelector",
")",
";",
"requireNonNull",
"... | Specifies a {@link KeySelector} for elements from the first input with explicit type information for the key type.
@param keySelector The KeySelector to be used for extracting the first input's key for partitioning.
@param keyType The type information describing the key type. | [
"Specifies",
"a",
"{",
"@link",
"KeySelector",
"}",
"for",
"elements",
"from",
"the",
"first",
"input",
"with",
"explicit",
"type",
"information",
"for",
"the",
"key",
"type",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/JoinedStreams.java#L99-L103 | train | Creates a new Where expression from the input. | [
30522,
2270,
1026,
3145,
1028,
2073,
1026,
3145,
1028,
2073,
1006,
6309,
12260,
16761,
1026,
1056,
2487,
1010,
3145,
1028,
6309,
12260,
16761,
1010,
2828,
2378,
14192,
3370,
1026,
3145,
1028,
3145,
13874,
1007,
1063,
5478,
8540,
11231,
3363... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java | WordTree.addWords | public void addWords(Collection<String> words){
if(false == (words instanceof Set)){
words = new HashSet<>(words);
}
for (String word : words) {
addWord(word);
}
} | java | public void addWords(Collection<String> words){
if(false == (words instanceof Set)){
words = new HashSet<>(words);
}
for (String word : words) {
addWord(word);
}
} | [
"public",
"void",
"addWords",
"(",
"Collection",
"<",
"String",
">",
"words",
")",
"{",
"if",
"(",
"false",
"==",
"(",
"words",
"instanceof",
"Set",
")",
")",
"{",
"words",
"=",
"new",
"HashSet",
"<>",
"(",
"words",
")",
";",
"}",
"for",
"(",
"Stri... | 增加一组单词
@param words 单词集合 | [
"增加一组单词"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-dfa/src/main/java/cn/hutool/dfa/WordTree.java#L49-L56 | train | Adds a collection of words to the list of words. | [
30522,
2270,
11675,
5587,
22104,
1006,
3074,
1026,
5164,
1028,
2616,
1007,
1063,
2065,
1006,
6270,
1027,
1027,
1006,
2616,
6013,
11253,
2275,
1007,
1007,
1063,
2616,
1027,
2047,
23325,
13462,
1026,
1028,
1006,
2616,
1007,
1025,
1065,
2005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/sax/Excel07SaxReader.java | Excel07SaxReader.startElement | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
// 单元格元素
if (C_ELEMENT.equals(qName)) {
// 获取当前列坐标
String tempCurCoordinate = attributes.getValue(R_ATTR);
// 前一列为null,则将其设置为"@",A为第一列,ascii码为65,前一列即为@,ascii码64
if (preCoordinate == null) {
preCoordinate = String.valueOf(ExcelSaxUtil.CELL_FILL_CHAR);
} else {
// 存在,则前一列要设置为上一列的坐标
preCoordinate = curCoordinate;
}
// 重置当前列
curCoordinate = tempCurCoordinate;
// 设置单元格类型
setCellType(attributes);
}
lastContent = "";
} | java | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
// 单元格元素
if (C_ELEMENT.equals(qName)) {
// 获取当前列坐标
String tempCurCoordinate = attributes.getValue(R_ATTR);
// 前一列为null,则将其设置为"@",A为第一列,ascii码为65,前一列即为@,ascii码64
if (preCoordinate == null) {
preCoordinate = String.valueOf(ExcelSaxUtil.CELL_FILL_CHAR);
} else {
// 存在,则前一列要设置为上一列的坐标
preCoordinate = curCoordinate;
}
// 重置当前列
curCoordinate = tempCurCoordinate;
// 设置单元格类型
setCellType(attributes);
}
lastContent = "";
} | [
"@",
"Override",
"public",
"void",
"startElement",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"Attributes",
"attributes",
")",
"throws",
"SAXException",
"{",
"// 单元格元素\r",
"if",
"(",
"C_ELEMENT",
".",
"equals",
"(",
"qName",... | 读到一个xml开始标签时的回调处理方法 | [
"读到一个xml开始标签时的回调处理方法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel07SaxReader.java#L179-L200 | train | Override startElement to add cell type attributes to the element. | [
30522,
1030,
2058,
15637,
2270,
11675,
2707,
12260,
3672,
1006,
5164,
24471,
2072,
1010,
5164,
2334,
18442,
1010,
5164,
1053,
18442,
1010,
12332,
12332,
1007,
11618,
24937,
2595,
24422,
1063,
1013,
1013,
100,
1769,
100,
1769,
100,
2065,
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-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.newBigInteger | public static BigInteger newBigInteger(String str) {
str = StrUtil.trimToNull(str);
if (null == str) {
return null;
}
int pos = 0; // 数字字符串位置
int radix = 10;
boolean negate = false; // 负数与否
if (str.startsWith("-")) {
negate = true;
pos = 1;
}
if (str.startsWith("0x", pos) || str.startsWith("0X", pos)) {
// hex
radix = 16;
pos += 2;
} else if (str.startsWith("#", pos)) {
// alternative hex (allowed by Long/Integer)
radix = 16;
pos++;
} else if (str.startsWith("0", pos) && str.length() > pos + 1) {
// octal; so long as there are additional digits
radix = 8;
pos++;
} // default is to treat as decimal
if (pos > 0) {
str = str.substring(pos);
}
final BigInteger value = new BigInteger(str, radix);
return negate ? value.negate() : value;
} | java | public static BigInteger newBigInteger(String str) {
str = StrUtil.trimToNull(str);
if (null == str) {
return null;
}
int pos = 0; // 数字字符串位置
int radix = 10;
boolean negate = false; // 负数与否
if (str.startsWith("-")) {
negate = true;
pos = 1;
}
if (str.startsWith("0x", pos) || str.startsWith("0X", pos)) {
// hex
radix = 16;
pos += 2;
} else if (str.startsWith("#", pos)) {
// alternative hex (allowed by Long/Integer)
radix = 16;
pos++;
} else if (str.startsWith("0", pos) && str.length() > pos + 1) {
// octal; so long as there are additional digits
radix = 8;
pos++;
} // default is to treat as decimal
if (pos > 0) {
str = str.substring(pos);
}
final BigInteger value = new BigInteger(str, radix);
return negate ? value.negate() : value;
} | [
"public",
"static",
"BigInteger",
"newBigInteger",
"(",
"String",
"str",
")",
"{",
"str",
"=",
"StrUtil",
".",
"trimToNull",
"(",
"str",
")",
";",
"if",
"(",
"null",
"==",
"str",
")",
"{",
"return",
"null",
";",
"}",
"int",
"pos",
"=",
"0",
";",
"/... | 创建{@link BigInteger},支持16进制、10进制和8进制,如果传入空白串返回null<br>
from Apache Common Lang
@param str 数字字符串
@return {@link BigInteger}
@since 3.2.1 | [
"创建",
"{",
"@link",
"BigInteger",
"}",
",支持16进制、10进制和8进制,如果传入空白串返回null<br",
">",
"from",
"Apache",
"Common",
"Lang"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L1989-L2021 | train | Creates a BigInteger from the specified string. | [
30522,
2270,
10763,
2502,
18447,
26320,
2047,
5638,
11528,
2618,
4590,
1006,
5164,
2358,
2099,
1007,
1063,
2358,
2099,
1027,
2358,
22134,
4014,
1012,
12241,
2669,
18083,
1006,
2358,
2099,
1007,
1025,
2065,
1006,
19701,
1027,
1027,
2358,
209... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/RdbAdapter.java | RdbAdapter.init | @Override
public void init(OuterAdapterConfig configuration, Properties envProperties) {
this.envProperties = envProperties;
Map<String, MappingConfig> rdbMappingTmp = ConfigLoader.load(envProperties);
// 过滤不匹配的key的配置
rdbMappingTmp.forEach((key, mappingConfig) -> {
if ((mappingConfig.getOuterAdapterKey() == null && configuration.getKey() == null)
|| (mappingConfig.getOuterAdapterKey() != null
&& mappingConfig.getOuterAdapterKey().equalsIgnoreCase(configuration.getKey()))) {
rdbMapping.put(key, mappingConfig);
}
});
if (rdbMapping.isEmpty()) {
throw new RuntimeException("No rdb adapter found for config key: " + configuration.getKey());
}
for (Map.Entry<String, MappingConfig> entry : rdbMapping.entrySet()) {
String configName = entry.getKey();
MappingConfig mappingConfig = entry.getValue();
if (!mappingConfig.getDbMapping().getMirrorDb()) {
String key;
if (envProperties != null && !"tcp".equalsIgnoreCase(envProperties.getProperty("canal.conf.mode"))) {
key = StringUtils.trimToEmpty(mappingConfig.getDestination()) + "-"
+ StringUtils.trimToEmpty(mappingConfig.getGroupId()) + "_"
+ mappingConfig.getDbMapping().getDatabase() + "-" + mappingConfig.getDbMapping().getTable();
} else {
key = StringUtils.trimToEmpty(mappingConfig.getDestination()) + "_"
+ mappingConfig.getDbMapping().getDatabase() + "-" + mappingConfig.getDbMapping().getTable();
}
Map<String, MappingConfig> configMap = mappingConfigCache.computeIfAbsent(key,
k1 -> new ConcurrentHashMap<>());
configMap.put(configName, mappingConfig);
} else {
// mirrorDB
String key = StringUtils.trimToEmpty(mappingConfig.getDestination()) + "."
+ mappingConfig.getDbMapping().getDatabase();
mirrorDbConfigCache.put(key, MirrorDbConfig.create(configName, mappingConfig));
}
}
// 初始化连接池
Map<String, String> properties = configuration.getProperties();
dataSource = new DruidDataSource();
dataSource.setDriverClassName(properties.get("jdbc.driverClassName"));
dataSource.setUrl(properties.get("jdbc.url"));
dataSource.setUsername(properties.get("jdbc.username"));
dataSource.setPassword(properties.get("jdbc.password"));
dataSource.setInitialSize(1);
dataSource.setMinIdle(1);
dataSource.setMaxActive(30);
dataSource.setMaxWait(60000);
dataSource.setTimeBetweenEvictionRunsMillis(60000);
dataSource.setMinEvictableIdleTimeMillis(300000);
dataSource.setUseUnfairLock(true);
// List<String> array = new ArrayList<>();
// array.add("set names utf8mb4;");
// dataSource.setConnectionInitSqls(array);
try {
dataSource.init();
} catch (SQLException e) {
logger.error("ERROR ## failed to initial datasource: " + properties.get("jdbc.url"), e);
}
String threads = properties.get("threads");
// String commitSize = properties.get("commitSize");
boolean skipDupException = BooleanUtils
.toBoolean(configuration.getProperties().getOrDefault("skipDupException", "true"));
rdbSyncService = new RdbSyncService(dataSource,
threads != null ? Integer.valueOf(threads) : null,
skipDupException);
rdbMirrorDbSyncService = new RdbMirrorDbSyncService(mirrorDbConfigCache,
dataSource,
threads != null ? Integer.valueOf(threads) : null,
rdbSyncService.getColumnsTypeCache(),
skipDupException);
rdbConfigMonitor = new RdbConfigMonitor();
rdbConfigMonitor.init(configuration.getKey(), this, envProperties);
} | java | @Override
public void init(OuterAdapterConfig configuration, Properties envProperties) {
this.envProperties = envProperties;
Map<String, MappingConfig> rdbMappingTmp = ConfigLoader.load(envProperties);
// 过滤不匹配的key的配置
rdbMappingTmp.forEach((key, mappingConfig) -> {
if ((mappingConfig.getOuterAdapterKey() == null && configuration.getKey() == null)
|| (mappingConfig.getOuterAdapterKey() != null
&& mappingConfig.getOuterAdapterKey().equalsIgnoreCase(configuration.getKey()))) {
rdbMapping.put(key, mappingConfig);
}
});
if (rdbMapping.isEmpty()) {
throw new RuntimeException("No rdb adapter found for config key: " + configuration.getKey());
}
for (Map.Entry<String, MappingConfig> entry : rdbMapping.entrySet()) {
String configName = entry.getKey();
MappingConfig mappingConfig = entry.getValue();
if (!mappingConfig.getDbMapping().getMirrorDb()) {
String key;
if (envProperties != null && !"tcp".equalsIgnoreCase(envProperties.getProperty("canal.conf.mode"))) {
key = StringUtils.trimToEmpty(mappingConfig.getDestination()) + "-"
+ StringUtils.trimToEmpty(mappingConfig.getGroupId()) + "_"
+ mappingConfig.getDbMapping().getDatabase() + "-" + mappingConfig.getDbMapping().getTable();
} else {
key = StringUtils.trimToEmpty(mappingConfig.getDestination()) + "_"
+ mappingConfig.getDbMapping().getDatabase() + "-" + mappingConfig.getDbMapping().getTable();
}
Map<String, MappingConfig> configMap = mappingConfigCache.computeIfAbsent(key,
k1 -> new ConcurrentHashMap<>());
configMap.put(configName, mappingConfig);
} else {
// mirrorDB
String key = StringUtils.trimToEmpty(mappingConfig.getDestination()) + "."
+ mappingConfig.getDbMapping().getDatabase();
mirrorDbConfigCache.put(key, MirrorDbConfig.create(configName, mappingConfig));
}
}
// 初始化连接池
Map<String, String> properties = configuration.getProperties();
dataSource = new DruidDataSource();
dataSource.setDriverClassName(properties.get("jdbc.driverClassName"));
dataSource.setUrl(properties.get("jdbc.url"));
dataSource.setUsername(properties.get("jdbc.username"));
dataSource.setPassword(properties.get("jdbc.password"));
dataSource.setInitialSize(1);
dataSource.setMinIdle(1);
dataSource.setMaxActive(30);
dataSource.setMaxWait(60000);
dataSource.setTimeBetweenEvictionRunsMillis(60000);
dataSource.setMinEvictableIdleTimeMillis(300000);
dataSource.setUseUnfairLock(true);
// List<String> array = new ArrayList<>();
// array.add("set names utf8mb4;");
// dataSource.setConnectionInitSqls(array);
try {
dataSource.init();
} catch (SQLException e) {
logger.error("ERROR ## failed to initial datasource: " + properties.get("jdbc.url"), e);
}
String threads = properties.get("threads");
// String commitSize = properties.get("commitSize");
boolean skipDupException = BooleanUtils
.toBoolean(configuration.getProperties().getOrDefault("skipDupException", "true"));
rdbSyncService = new RdbSyncService(dataSource,
threads != null ? Integer.valueOf(threads) : null,
skipDupException);
rdbMirrorDbSyncService = new RdbMirrorDbSyncService(mirrorDbConfigCache,
dataSource,
threads != null ? Integer.valueOf(threads) : null,
rdbSyncService.getColumnsTypeCache(),
skipDupException);
rdbConfigMonitor = new RdbConfigMonitor();
rdbConfigMonitor.init(configuration.getKey(), this, envProperties);
} | [
"@",
"Override",
"public",
"void",
"init",
"(",
"OuterAdapterConfig",
"configuration",
",",
"Properties",
"envProperties",
")",
"{",
"this",
".",
"envProperties",
"=",
"envProperties",
";",
"Map",
"<",
"String",
",",
"MappingConfig",
">",
"rdbMappingTmp",
"=",
"... | 初始化方法
@param configuration 外部适配器配置信息 | [
"初始化方法"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/RdbAdapter.java#L69-L151 | train | Initialize the base class. | [
30522,
1030,
2058,
15637,
2270,
11675,
1999,
4183,
1006,
6058,
8447,
13876,
2121,
8663,
8873,
2290,
9563,
1010,
5144,
4372,
2615,
21572,
4842,
7368,
1007,
1063,
2023,
1012,
4372,
2615,
21572,
4842,
7368,
1027,
4372,
2615,
21572,
4842,
7368,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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(Field field, ModifierType... modifierTypes) {
if (null == field || ArrayUtil.isEmpty(modifierTypes)) {
return false;
}
return 0 != (field.getModifiers() & modifiersToInt(modifierTypes));
} | java | public static boolean hasModifier(Field field, ModifierType... modifierTypes) {
if (null == field || ArrayUtil.isEmpty(modifierTypes)) {
return false;
}
return 0 != (field.getModifiers() & modifiersToInt(modifierTypes));
} | [
"public",
"static",
"boolean",
"hasModifier",
"(",
"Field",
"field",
",",
"ModifierType",
"...",
"modifierTypes",
")",
"{",
"if",
"(",
"null",
"==",
"field",
"||",
"ArrayUtil",
".",
"isEmpty",
"(",
"modifierTypes",
")",
")",
"{",
"return",
"false",
";",
"}... | 是否同时存在一个或多个修饰符(可能有多个修饰符,如果有指定的修饰符则返回true)
@param field 字段
@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#L116-L121 | train | Checks if the field has one of the given modifiers. | [
30522,
2270,
10763,
22017,
20898,
2038,
5302,
4305,
8873,
2121,
1006,
2492,
2492,
1010,
16913,
18095,
13874,
1012,
1012,
1012,
16913,
18095,
13874,
2015,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
2492,
1064,
1064,
9140,
21823,
2140,
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/text/StrBuilder.java | StrBuilder.getChars | public StrBuilder getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) {
if (srcBegin < 0) {
srcBegin = 0;
}
if (srcEnd < 0) {
srcEnd = 0;
} else if (srcEnd > this.position) {
srcEnd = this.position;
}
if (srcBegin > srcEnd) {
throw new StringIndexOutOfBoundsException("srcBegin > srcEnd");
}
System.arraycopy(value, srcBegin, dst, dstBegin, srcEnd - srcBegin);
return this;
} | java | public StrBuilder getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) {
if (srcBegin < 0) {
srcBegin = 0;
}
if (srcEnd < 0) {
srcEnd = 0;
} else if (srcEnd > this.position) {
srcEnd = this.position;
}
if (srcBegin > srcEnd) {
throw new StringIndexOutOfBoundsException("srcBegin > srcEnd");
}
System.arraycopy(value, srcBegin, dst, dstBegin, srcEnd - srcBegin);
return this;
} | [
"public",
"StrBuilder",
"getChars",
"(",
"int",
"srcBegin",
",",
"int",
"srcEnd",
",",
"char",
"[",
"]",
"dst",
",",
"int",
"dstBegin",
")",
"{",
"if",
"(",
"srcBegin",
"<",
"0",
")",
"{",
"srcBegin",
"=",
"0",
";",
"}",
"if",
"(",
"srcEnd",
"<",
... | 将指定段的字符列表写出到目标字符数组中
@param srcBegin 起始位置(包括)
@param srcEnd 结束位置(不包括)
@param dst 目标数组
@param dstBegin 目标起始位置(包括)
@return this | [
"将指定段的字符列表写出到目标字符数组中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrBuilder.java#L301-L315 | train | Gets chars from the builder. | [
30522,
2270,
2358,
15185,
19231,
4063,
2131,
7507,
2869,
1006,
20014,
5034,
27421,
13910,
2378,
1010,
20014,
5034,
23865,
1010,
25869,
1031,
1033,
16233,
2102,
1010,
20014,
16233,
2102,
4783,
11528,
1007,
1063,
2065,
1006,
5034,
27421,
13910,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dictionary/TFDictionary.java | TFDictionary.combine | public static int combine(String... path)
{
TFDictionary dictionaryMain = new TFDictionary();
dictionaryMain.load(path[0]);
int preSize = dictionaryMain.trie.size();
for (int i = 1; i < path.length; ++i)
{
TFDictionary dictionary = new TFDictionary();
dictionary.load(path[i]);
dictionaryMain.combine(dictionary, 1, true);
}
try
{
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(IOUtil.newOutputStream(path[0]), "UTF-8"));
for (Map.Entry<String, TermFrequency> entry : dictionaryMain.trie.entrySet())
{
bw.write(entry.getKey());
bw.write(' ');
bw.write(String.valueOf(entry.getValue().getValue()));
bw.newLine();
}
bw.close();
}
catch (Exception e)
{
e.printStackTrace();
return -1;
}
return dictionaryMain.trie.size() - preSize;
} | java | public static int combine(String... path)
{
TFDictionary dictionaryMain = new TFDictionary();
dictionaryMain.load(path[0]);
int preSize = dictionaryMain.trie.size();
for (int i = 1; i < path.length; ++i)
{
TFDictionary dictionary = new TFDictionary();
dictionary.load(path[i]);
dictionaryMain.combine(dictionary, 1, true);
}
try
{
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(IOUtil.newOutputStream(path[0]), "UTF-8"));
for (Map.Entry<String, TermFrequency> entry : dictionaryMain.trie.entrySet())
{
bw.write(entry.getKey());
bw.write(' ');
bw.write(String.valueOf(entry.getValue().getValue()));
bw.newLine();
}
bw.close();
}
catch (Exception e)
{
e.printStackTrace();
return -1;
}
return dictionaryMain.trie.size() - preSize;
} | [
"public",
"static",
"int",
"combine",
"(",
"String",
"...",
"path",
")",
"{",
"TFDictionary",
"dictionaryMain",
"=",
"new",
"TFDictionary",
"(",
")",
";",
"dictionaryMain",
".",
"load",
"(",
"path",
"[",
"0",
"]",
")",
";",
"int",
"preSize",
"=",
"dictio... | 合并多个词典
@param path 多个词典的路径,第一个是主词典。主词典与其他词典的区别详见com.hankcs.hanlp.corpus.dictionary.TFDictionary#combine(com.hankcs.hanlp.corpus.dictionary.TFDictionary, int, boolean)
@return 词条的增量 | [
"合并多个词典"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/TFDictionary.java#L81-L111 | train | Combine the terms of a sequence of words into a single sequence of words. | [
30522,
2270,
10763,
20014,
11506,
1006,
5164,
1012,
1012,
1012,
4130,
1007,
1063,
1056,
2546,
29201,
3258,
5649,
9206,
24238,
1027,
2047,
1056,
2546,
29201,
3258,
5649,
1006,
1007,
1025,
9206,
24238,
1012,
7170,
1006,
4130,
1031,
1014,
1033... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java | MainClassFinder.doWithMainClasses | static <T> T doWithMainClasses(File rootFolder, MainClassCallback<T> callback)
throws IOException {
if (!rootFolder.exists()) {
return null; // nothing to do
}
if (!rootFolder.isDirectory()) {
throw new IllegalArgumentException(
"Invalid root folder '" + rootFolder + "'");
}
String prefix = rootFolder.getAbsolutePath() + "/";
Deque<File> stack = new ArrayDeque<>();
stack.push(rootFolder);
while (!stack.isEmpty()) {
File file = stack.pop();
if (file.isFile()) {
try (InputStream inputStream = new FileInputStream(file)) {
ClassDescriptor classDescriptor = createClassDescriptor(inputStream);
if (classDescriptor != null && classDescriptor.isMainMethodFound()) {
String className = convertToClassName(file.getAbsolutePath(),
prefix);
T result = callback.doWith(new MainClass(className,
classDescriptor.getAnnotationNames()));
if (result != null) {
return result;
}
}
}
}
if (file.isDirectory()) {
pushAllSorted(stack, file.listFiles(PACKAGE_FOLDER_FILTER));
pushAllSorted(stack, file.listFiles(CLASS_FILE_FILTER));
}
}
return null;
} | java | static <T> T doWithMainClasses(File rootFolder, MainClassCallback<T> callback)
throws IOException {
if (!rootFolder.exists()) {
return null; // nothing to do
}
if (!rootFolder.isDirectory()) {
throw new IllegalArgumentException(
"Invalid root folder '" + rootFolder + "'");
}
String prefix = rootFolder.getAbsolutePath() + "/";
Deque<File> stack = new ArrayDeque<>();
stack.push(rootFolder);
while (!stack.isEmpty()) {
File file = stack.pop();
if (file.isFile()) {
try (InputStream inputStream = new FileInputStream(file)) {
ClassDescriptor classDescriptor = createClassDescriptor(inputStream);
if (classDescriptor != null && classDescriptor.isMainMethodFound()) {
String className = convertToClassName(file.getAbsolutePath(),
prefix);
T result = callback.doWith(new MainClass(className,
classDescriptor.getAnnotationNames()));
if (result != null) {
return result;
}
}
}
}
if (file.isDirectory()) {
pushAllSorted(stack, file.listFiles(PACKAGE_FOLDER_FILTER));
pushAllSorted(stack, file.listFiles(CLASS_FILE_FILTER));
}
}
return null;
} | [
"static",
"<",
"T",
">",
"T",
"doWithMainClasses",
"(",
"File",
"rootFolder",
",",
"MainClassCallback",
"<",
"T",
">",
"callback",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"rootFolder",
".",
"exists",
"(",
")",
")",
"{",
"return",
"null",
";",
... | Perform the given callback operation on all main classes from the given root
folder.
@param <T> the result type
@param rootFolder the root folder
@param callback the callback
@return the first callback result or {@code null}
@throws IOException in case of I/O errors | [
"Perform",
"the",
"given",
"callback",
"operation",
"on",
"all",
"main",
"classes",
"from",
"the",
"given",
"root",
"folder",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java#L123-L157 | train | Do with main classes in the given folder. | [
30522,
10763,
1026,
1056,
1028,
1056,
23268,
8939,
24238,
26266,
2229,
1006,
5371,
7117,
10371,
2121,
1010,
2364,
26266,
9289,
20850,
8684,
1026,
1056,
1028,
2655,
5963,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
999,
7117,
10371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SslUtils.java | SslUtils.shortBE | @SuppressWarnings("deprecation")
private static short shortBE(ByteBuf buffer, int offset) {
return buffer.order() == ByteOrder.BIG_ENDIAN ?
buffer.getShort(offset) : buffer.getShortLE(offset);
} | java | @SuppressWarnings("deprecation")
private static short shortBE(ByteBuf buffer, int offset) {
return buffer.order() == ByteOrder.BIG_ENDIAN ?
buffer.getShort(offset) : buffer.getShortLE(offset);
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"static",
"short",
"shortBE",
"(",
"ByteBuf",
"buffer",
",",
"int",
"offset",
")",
"{",
"return",
"buffer",
".",
"order",
"(",
")",
"==",
"ByteOrder",
".",
"BIG_ENDIAN",
"?",
"buffer",
".",
"... | Reads a big-endian short integer from the buffer | [
"Reads",
"a",
"big",
"-",
"endian",
"short",
"integer",
"from",
"the",
"buffer"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslUtils.java#L246-L250 | train | Get a short from the buffer in big - endian order. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
2139,
28139,
10719,
1000,
1007,
2797,
10763,
2460,
2460,
4783,
1006,
24880,
8569,
2546,
17698,
30524,
1035,
2203,
2937,
1029,
17698,
1012,
4152,
27794,
1006,
16396,
1007,
1024,
17698,
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/lang/Validator.java | Validator.validateBirthday | public static <T extends CharSequence> T validateBirthday(T value, String errorMsg) throws ValidateException {
if (false == isBirthday(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validateBirthday(T value, String errorMsg) throws ValidateException {
if (false == isBirthday(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateBirthday",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isBirthday",
"(",
"value",
")",
")",
"{",
"throw",
"new... | 验证验证是否为生日
@param <T> 字符串类型
@param value 值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证验证是否为生日"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L783-L788 | train | Validate a Birthday value. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
9398,
3686,
17706,
2705,
10259,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
1027,
2003,
1770... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | server/src/main/java/com/alibaba/otter/canal/common/MQMessageUtils.java | MQMessageUtils.messageConverter | public static List<FlatMessage> messageConverter(Message message) {
try {
if (message == null) {
return null;
}
List<FlatMessage> flatMessages = new ArrayList<>();
List<CanalEntry.Entry> entrys = null;
if (message.isRaw()) {
List<ByteString> rawEntries = message.getRawEntries();
entrys = new ArrayList<CanalEntry.Entry>(rawEntries.size());
for (ByteString byteString : rawEntries) {
CanalEntry.Entry entry = CanalEntry.Entry.parseFrom(byteString);
entrys.add(entry);
}
} else {
entrys = message.getEntries();
}
for (CanalEntry.Entry entry : entrys) {
if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN
|| entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONEND) {
continue;
}
CanalEntry.RowChange rowChange;
try {
rowChange = CanalEntry.RowChange.parseFrom(entry.getStoreValue());
} catch (Exception e) {
throw new RuntimeException("ERROR ## parser of eromanga-event has an error , data:"
+ entry.toString(), e);
}
CanalEntry.EventType eventType = rowChange.getEventType();
FlatMessage flatMessage = new FlatMessage(message.getId());
flatMessages.add(flatMessage);
flatMessage.setDatabase(entry.getHeader().getSchemaName());
flatMessage.setTable(entry.getHeader().getTableName());
flatMessage.setIsDdl(rowChange.getIsDdl());
flatMessage.setType(eventType.toString());
flatMessage.setEs(entry.getHeader().getExecuteTime());
flatMessage.setTs(System.currentTimeMillis());
flatMessage.setSql(rowChange.getSql());
if (!rowChange.getIsDdl()) {
Map<String, Integer> sqlType = new LinkedHashMap<>();
Map<String, String> mysqlType = new LinkedHashMap<>();
List<Map<String, String>> data = new ArrayList<>();
List<Map<String, String>> old = new ArrayList<>();
Set<String> updateSet = new HashSet<>();
boolean hasInitPkNames = false;
for (CanalEntry.RowData rowData : rowChange.getRowDatasList()) {
if (eventType != CanalEntry.EventType.INSERT && eventType != CanalEntry.EventType.UPDATE
&& eventType != CanalEntry.EventType.DELETE) {
continue;
}
Map<String, String> row = new LinkedHashMap<>();
List<CanalEntry.Column> columns;
if (eventType == CanalEntry.EventType.DELETE) {
columns = rowData.getBeforeColumnsList();
} else {
columns = rowData.getAfterColumnsList();
}
for (CanalEntry.Column column : columns) {
if (!hasInitPkNames && column.getIsKey()) {
flatMessage.addPkName(column.getName());
}
sqlType.put(column.getName(), column.getSqlType());
mysqlType.put(column.getName(), column.getMysqlType());
if (column.getIsNull()) {
row.put(column.getName(), null);
} else {
row.put(column.getName(), column.getValue());
}
// 获取update为true的字段
if (column.getUpdated()) {
updateSet.add(column.getName());
}
}
hasInitPkNames = true;
if (!row.isEmpty()) {
data.add(row);
}
if (eventType == CanalEntry.EventType.UPDATE) {
Map<String, String> rowOld = new LinkedHashMap<>();
for (CanalEntry.Column column : rowData.getBeforeColumnsList()) {
if (updateSet.contains(column.getName())) {
if (column.getIsNull()) {
rowOld.put(column.getName(), null);
} else {
rowOld.put(column.getName(), column.getValue());
}
}
}
// update操作将记录修改前的值
if (!rowOld.isEmpty()) {
old.add(rowOld);
}
}
}
if (!sqlType.isEmpty()) {
flatMessage.setSqlType(sqlType);
}
if (!mysqlType.isEmpty()) {
flatMessage.setMysqlType(mysqlType);
}
if (!data.isEmpty()) {
flatMessage.setData(data);
}
if (!old.isEmpty()) {
flatMessage.setOld(old);
}
}
}
return flatMessages;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public static List<FlatMessage> messageConverter(Message message) {
try {
if (message == null) {
return null;
}
List<FlatMessage> flatMessages = new ArrayList<>();
List<CanalEntry.Entry> entrys = null;
if (message.isRaw()) {
List<ByteString> rawEntries = message.getRawEntries();
entrys = new ArrayList<CanalEntry.Entry>(rawEntries.size());
for (ByteString byteString : rawEntries) {
CanalEntry.Entry entry = CanalEntry.Entry.parseFrom(byteString);
entrys.add(entry);
}
} else {
entrys = message.getEntries();
}
for (CanalEntry.Entry entry : entrys) {
if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN
|| entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONEND) {
continue;
}
CanalEntry.RowChange rowChange;
try {
rowChange = CanalEntry.RowChange.parseFrom(entry.getStoreValue());
} catch (Exception e) {
throw new RuntimeException("ERROR ## parser of eromanga-event has an error , data:"
+ entry.toString(), e);
}
CanalEntry.EventType eventType = rowChange.getEventType();
FlatMessage flatMessage = new FlatMessage(message.getId());
flatMessages.add(flatMessage);
flatMessage.setDatabase(entry.getHeader().getSchemaName());
flatMessage.setTable(entry.getHeader().getTableName());
flatMessage.setIsDdl(rowChange.getIsDdl());
flatMessage.setType(eventType.toString());
flatMessage.setEs(entry.getHeader().getExecuteTime());
flatMessage.setTs(System.currentTimeMillis());
flatMessage.setSql(rowChange.getSql());
if (!rowChange.getIsDdl()) {
Map<String, Integer> sqlType = new LinkedHashMap<>();
Map<String, String> mysqlType = new LinkedHashMap<>();
List<Map<String, String>> data = new ArrayList<>();
List<Map<String, String>> old = new ArrayList<>();
Set<String> updateSet = new HashSet<>();
boolean hasInitPkNames = false;
for (CanalEntry.RowData rowData : rowChange.getRowDatasList()) {
if (eventType != CanalEntry.EventType.INSERT && eventType != CanalEntry.EventType.UPDATE
&& eventType != CanalEntry.EventType.DELETE) {
continue;
}
Map<String, String> row = new LinkedHashMap<>();
List<CanalEntry.Column> columns;
if (eventType == CanalEntry.EventType.DELETE) {
columns = rowData.getBeforeColumnsList();
} else {
columns = rowData.getAfterColumnsList();
}
for (CanalEntry.Column column : columns) {
if (!hasInitPkNames && column.getIsKey()) {
flatMessage.addPkName(column.getName());
}
sqlType.put(column.getName(), column.getSqlType());
mysqlType.put(column.getName(), column.getMysqlType());
if (column.getIsNull()) {
row.put(column.getName(), null);
} else {
row.put(column.getName(), column.getValue());
}
// 获取update为true的字段
if (column.getUpdated()) {
updateSet.add(column.getName());
}
}
hasInitPkNames = true;
if (!row.isEmpty()) {
data.add(row);
}
if (eventType == CanalEntry.EventType.UPDATE) {
Map<String, String> rowOld = new LinkedHashMap<>();
for (CanalEntry.Column column : rowData.getBeforeColumnsList()) {
if (updateSet.contains(column.getName())) {
if (column.getIsNull()) {
rowOld.put(column.getName(), null);
} else {
rowOld.put(column.getName(), column.getValue());
}
}
}
// update操作将记录修改前的值
if (!rowOld.isEmpty()) {
old.add(rowOld);
}
}
}
if (!sqlType.isEmpty()) {
flatMessage.setSqlType(sqlType);
}
if (!mysqlType.isEmpty()) {
flatMessage.setMysqlType(mysqlType);
}
if (!data.isEmpty()) {
flatMessage.setData(data);
}
if (!old.isEmpty()) {
flatMessage.setOld(old);
}
}
}
return flatMessages;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"List",
"<",
"FlatMessage",
">",
"messageConverter",
"(",
"Message",
"message",
")",
"{",
"try",
"{",
"if",
"(",
"message",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"List",
"<",
"FlatMessage",
">",
"flatMessages",
"=",
"new... | 将Message转换为FlatMessage
@param message 原生message
@return FlatMessage列表 | [
"将Message转换为FlatMessage"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/server/src/main/java/com/alibaba/otter/canal/common/MQMessageUtils.java#L275-L400 | train | Convert a message to flat message. | [
30522,
2270,
10763,
2862,
1026,
4257,
7834,
3736,
3351,
1028,
4471,
8663,
16874,
2121,
1006,
4471,
4471,
1007,
1063,
3046,
1063,
2065,
1006,
4471,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2862,
1026,
4257,
7834,
3736,
3351,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashPartition.java | BinaryHashPartition.finalizeBuildPhase | int finalizeBuildPhase(IOManager ioAccess, FileIOChannel.Enumerator probeChannelEnumerator) throws IOException {
this.finalBufferLimit = this.buildSideWriteBuffer.getCurrentPositionInSegment();
this.partitionBuffers = this.buildSideWriteBuffer.close();
if (!isInMemory()) {
// close the channel.
this.buildSideChannel.close();
this.probeSideBuffer = FileChannelUtil.createOutputView(
ioAccess,
probeChannelEnumerator.next(),
compressionEnable,
compressionCodecFactory,
compressionBlockSize,
memorySegmentSize);
return 1;
} else {
return 0;
}
} | java | int finalizeBuildPhase(IOManager ioAccess, FileIOChannel.Enumerator probeChannelEnumerator) throws IOException {
this.finalBufferLimit = this.buildSideWriteBuffer.getCurrentPositionInSegment();
this.partitionBuffers = this.buildSideWriteBuffer.close();
if (!isInMemory()) {
// close the channel.
this.buildSideChannel.close();
this.probeSideBuffer = FileChannelUtil.createOutputView(
ioAccess,
probeChannelEnumerator.next(),
compressionEnable,
compressionCodecFactory,
compressionBlockSize,
memorySegmentSize);
return 1;
} else {
return 0;
}
} | [
"int",
"finalizeBuildPhase",
"(",
"IOManager",
"ioAccess",
",",
"FileIOChannel",
".",
"Enumerator",
"probeChannelEnumerator",
")",
"throws",
"IOException",
"{",
"this",
".",
"finalBufferLimit",
"=",
"this",
".",
"buildSideWriteBuffer",
".",
"getCurrentPositionInSegment",
... | After build phase.
@return build spill return buffer, if have spilled, it returns the current write buffer,
because it was used all the time in build phase, so it can only be returned at this time. | [
"After",
"build",
"phase",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashPartition.java#L332-L351 | train | Finalize the build phase. | [
30522,
20014,
2345,
4697,
8569,
4014,
18927,
14949,
2063,
1006,
22834,
24805,
4590,
22834,
6305,
9623,
2015,
1010,
5371,
3695,
26058,
1012,
4372,
17897,
16259,
15113,
26058,
2368,
17897,
16259,
1007,
11618,
22834,
10288,
24422,
1063,
2023,
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/NShort/Path/NShortPath.java | NShortPath.getBestPath | public Integer[] getBestPath()
{
assert (vertexCount > 2);
Stack<Integer> stack = new Stack<Integer>();
int curNode = vertexCount - 1, curIndex = 0;
QueueElement element;
element = fromArray[curNode - 1][curIndex].GetFirst();
stack.push(curNode);
stack.push(element.from);
curNode = element.from;
while (curNode != 0)
{
element = fromArray[element.from - 1][element.index].GetFirst();
stack.push(element.from);
curNode = element.from;
}
return (Integer[]) stack.toArray();
} | java | public Integer[] getBestPath()
{
assert (vertexCount > 2);
Stack<Integer> stack = new Stack<Integer>();
int curNode = vertexCount - 1, curIndex = 0;
QueueElement element;
element = fromArray[curNode - 1][curIndex].GetFirst();
stack.push(curNode);
stack.push(element.from);
curNode = element.from;
while (curNode != 0)
{
element = fromArray[element.from - 1][element.index].GetFirst();
stack.push(element.from);
curNode = element.from;
}
return (Integer[]) stack.toArray();
} | [
"public",
"Integer",
"[",
"]",
"getBestPath",
"(",
")",
"{",
"assert",
"(",
"vertexCount",
">",
"2",
")",
";",
"Stack",
"<",
"Integer",
">",
"stack",
"=",
"new",
"Stack",
"<",
"Integer",
">",
"(",
")",
";",
"int",
"curNode",
"=",
"vertexCount",
"-",
... | 获取唯一一条最短路径,当然最短路径可能不只一条
@return | [
"获取唯一一条最短路径,当然最短路径可能不只一条"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/NShort/Path/NShortPath.java#L232-L254 | train | Gets the best path of the sequence. | [
30522,
2270,
16109,
1031,
1033,
2131,
12681,
25856,
8988,
1006,
1007,
1063,
20865,
1006,
19449,
3597,
16671,
1028,
1016,
1007,
1025,
9991,
1026,
16109,
1028,
9991,
1027,
2047,
9991,
1026,
16109,
1028,
1006,
1007,
1025,
20014,
30524,
1014,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java | Wrapper.wrap | public Entity wrap(Entity entity){
if(null == entity) {
return null;
}
final Entity wrapedEntity = new Entity();
//wrap table name
wrapedEntity.setTableName(wrap(entity.getTableName()));
//wrap fields
for (Entry<String, Object> entry : entity.entrySet()) {
wrapedEntity.set(wrap(entry.getKey()), entry.getValue());
}
return wrapedEntity;
} | java | public Entity wrap(Entity entity){
if(null == entity) {
return null;
}
final Entity wrapedEntity = new Entity();
//wrap table name
wrapedEntity.setTableName(wrap(entity.getTableName()));
//wrap fields
for (Entry<String, Object> entry : entity.entrySet()) {
wrapedEntity.set(wrap(entry.getKey()), entry.getValue());
}
return wrapedEntity;
} | [
"public",
"Entity",
"wrap",
"(",
"Entity",
"entity",
")",
"{",
"if",
"(",
"null",
"==",
"entity",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Entity",
"wrapedEntity",
"=",
"new",
"Entity",
"(",
")",
";",
"//wrap table name\r",
"wrapedEntity",
".",
"s... | 包装字段名<br>
有时字段与SQL的某些关键字冲突,导致SQL出错,因此需要将字段名用单引号或者反引号包装起来,避免冲突
@param entity 被包装的实体
@return 包装后的字段名 | [
"包装字段名<br",
">",
"有时字段与SQL的某些关键字冲突,导致SQL出错,因此需要将字段名用单引号或者反引号包装起来,避免冲突"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java#L152-L168 | train | Wraps the given entity in a new Entity object. | [
30522,
2270,
9178,
10236,
1006,
9178,
9178,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
9178,
1007,
1063,
2709,
19701,
1025,
1065,
2345,
9178,
10236,
14728,
16778,
3723,
1027,
2047,
9178,
1006,
1007,
1025,
1013,
1013,
10236,
2795,
2171,
1023... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/scheduler/Scheduler.java | Scheduler.processNewlyAvailableInstances | private void processNewlyAvailableInstances() {
synchronized (globalLock) {
Instance instance;
while ((instance = newlyAvailableInstances.poll()) != null) {
if (instance.hasResourcesAvailable()) {
instancesWithAvailableResources.put(instance.getTaskManagerID(), instance);
}
}
}
} | java | private void processNewlyAvailableInstances() {
synchronized (globalLock) {
Instance instance;
while ((instance = newlyAvailableInstances.poll()) != null) {
if (instance.hasResourcesAvailable()) {
instancesWithAvailableResources.put(instance.getTaskManagerID(), instance);
}
}
}
} | [
"private",
"void",
"processNewlyAvailableInstances",
"(",
")",
"{",
"synchronized",
"(",
"globalLock",
")",
"{",
"Instance",
"instance",
";",
"while",
"(",
"(",
"instance",
"=",
"newlyAvailableInstances",
".",
"poll",
"(",
")",
")",
"!=",
"null",
")",
"{",
"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/scheduler/Scheduler.java#L811-L821 | train | Process newly available instances. | [
30522,
2797,
11675,
2832,
2638,
13668,
3148,
3567,
11733,
3468,
7076,
26897,
2015,
1006,
1007,
1063,
25549,
1006,
3795,
7878,
1007,
1063,
6013,
6013,
1025,
2096,
1006,
1006,
6013,
1027,
4397,
12462,
11733,
3468,
7076,
26897,
2015,
1012,
855... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/flink/table/descriptors/ConnectTableDescriptor.java | ConnectTableDescriptor.withFormat | @Override
public D withFormat(FormatDescriptor format) {
formatDescriptor = Optional.of(Preconditions.checkNotNull(format));
return (D) this;
} | java | @Override
public D withFormat(FormatDescriptor format) {
formatDescriptor = Optional.of(Preconditions.checkNotNull(format));
return (D) this;
} | [
"@",
"Override",
"public",
"D",
"withFormat",
"(",
"FormatDescriptor",
"format",
")",
"{",
"formatDescriptor",
"=",
"Optional",
".",
"of",
"(",
"Preconditions",
".",
"checkNotNull",
"(",
"format",
")",
")",
";",
"return",
"(",
"D",
")",
"this",
";",
"}"
] | Specifies the format that defines how to read data from a connector. | [
"Specifies",
"the",
"format",
"that",
"defines",
"how",
"to",
"read",
"data",
"from",
"a",
"connector",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/descriptors/ConnectTableDescriptor.java#L92-L96 | train | Sets the format descriptor for the XML document. | [
30522,
1030,
2058,
15637,
2270,
1040,
2007,
14192,
4017,
1006,
4289,
6155,
23235,
2953,
4289,
1007,
1063,
4289,
6155,
23235,
2953,
1027,
11887,
1012,
1997,
1006,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
4289,
1007,
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-setting/src/main/java/cn/hutool/setting/Setting.java | Setting.getProperties | public Properties getProperties(String group) {
final Properties properties = new Properties();
properties.putAll(getMap(group));
return properties;
} | java | public Properties getProperties(String group) {
final Properties properties = new Properties();
properties.putAll(getMap(group));
return properties;
} | [
"public",
"Properties",
"getProperties",
"(",
"String",
"group",
")",
"{",
"final",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"properties",
".",
"putAll",
"(",
"getMap",
"(",
"group",
")",
")",
";",
"return",
"properties",
";",
"... | 获取group分组下所有配置键值对,组成新的{@link Properties}
@param group 分组
@return Properties对象 | [
"获取group分组下所有配置键值对,组成新的",
"{",
"@link",
"Properties",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L287-L291 | train | Gets the properties for the specified group. | [
30522,
2270,
5144,
2131,
21572,
4842,
7368,
1006,
5164,
2177,
1007,
1063,
2345,
5144,
5144,
1027,
2047,
5144,
1006,
1007,
1025,
5144,
1012,
2404,
8095,
1006,
2131,
2863,
2361,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/TimestampedValue.java | TimestampedValue.getStreamRecord | public StreamRecord<T> getStreamRecord() {
StreamRecord<T> streamRecord = new StreamRecord<>(value);
if (hasTimestamp) {
streamRecord.setTimestamp(timestamp);
}
return streamRecord;
} | java | public StreamRecord<T> getStreamRecord() {
StreamRecord<T> streamRecord = new StreamRecord<>(value);
if (hasTimestamp) {
streamRecord.setTimestamp(timestamp);
}
return streamRecord;
} | [
"public",
"StreamRecord",
"<",
"T",
">",
"getStreamRecord",
"(",
")",
"{",
"StreamRecord",
"<",
"T",
">",
"streamRecord",
"=",
"new",
"StreamRecord",
"<>",
"(",
"value",
")",
";",
"if",
"(",
"hasTimestamp",
")",
"{",
"streamRecord",
".",
"setTimestamp",
"(... | Creates a {@link StreamRecord} from this TimestampedValue. | [
"Creates",
"a",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/TimestampedValue.java#L93-L99 | train | Gets the stream record. | [
30522,
2270,
5460,
2890,
27108,
2094,
1026,
1056,
1028,
4152,
25379,
2890,
27108,
2094,
1006,
1007,
1063,
5460,
2890,
27108,
2094,
1026,
1056,
1028,
5460,
2890,
27108,
2094,
1027,
2047,
5460,
2890,
27108,
2094,
1026,
1028,
1006,
3643,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationUtil.java | AnnotationUtil.getAnnotation | public static <A extends Annotation> A getAnnotation(AnnotatedElement annotationEle, Class<A> annotationType) {
return (null == annotationEle) ? null : toCombination(annotationEle).getAnnotation(annotationType);
} | java | public static <A extends Annotation> A getAnnotation(AnnotatedElement annotationEle, Class<A> annotationType) {
return (null == annotationEle) ? null : toCombination(annotationEle).getAnnotation(annotationType);
} | [
"public",
"static",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"getAnnotation",
"(",
"AnnotatedElement",
"annotationEle",
",",
"Class",
"<",
"A",
">",
"annotationType",
")",
"{",
"return",
"(",
"null",
"==",
"annotationEle",
")",
"?",
"null",
":",
"toCombi... | 获取指定注解
@param <A> 注解类型
@param annotationEle {@link AnnotatedElement},可以是Class、Method、Field、Constructor、ReflectPermission
@param annotationType 注解类型
@return 注解对象 | [
"获取指定注解"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationUtil.java#L61-L63 | train | Gets the annotation of the given type from the given annotated element. | [
30522,
2270,
10763,
1026,
1037,
8908,
5754,
17287,
3508,
1028,
1037,
2131,
11639,
17287,
3508,
1006,
5754,
17287,
3064,
12260,
3672,
5754,
17287,
3508,
12260,
1010,
2465,
1026,
1037,
1028,
5754,
17287,
3508,
13874,
1007,
1063,
2709,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/writer/S3RecoverableWriter.java | S3RecoverableWriter.writer | public static S3RecoverableWriter writer(
final FileSystem fs,
final FunctionWithException<File, RefCountedFile, IOException> tempFileCreator,
final S3AccessHelper s3AccessHelper,
final Executor uploadThreadPool,
final long userDefinedMinPartSize,
final int maxConcurrentUploadsPerStream) {
checkArgument(userDefinedMinPartSize >= S3_MULTIPART_MIN_PART_SIZE);
final S3RecoverableMultipartUploadFactory uploadFactory =
new S3RecoverableMultipartUploadFactory(
fs,
s3AccessHelper,
maxConcurrentUploadsPerStream,
uploadThreadPool,
tempFileCreator);
return new S3RecoverableWriter(s3AccessHelper, uploadFactory, tempFileCreator, userDefinedMinPartSize);
} | java | public static S3RecoverableWriter writer(
final FileSystem fs,
final FunctionWithException<File, RefCountedFile, IOException> tempFileCreator,
final S3AccessHelper s3AccessHelper,
final Executor uploadThreadPool,
final long userDefinedMinPartSize,
final int maxConcurrentUploadsPerStream) {
checkArgument(userDefinedMinPartSize >= S3_MULTIPART_MIN_PART_SIZE);
final S3RecoverableMultipartUploadFactory uploadFactory =
new S3RecoverableMultipartUploadFactory(
fs,
s3AccessHelper,
maxConcurrentUploadsPerStream,
uploadThreadPool,
tempFileCreator);
return new S3RecoverableWriter(s3AccessHelper, uploadFactory, tempFileCreator, userDefinedMinPartSize);
} | [
"public",
"static",
"S3RecoverableWriter",
"writer",
"(",
"final",
"FileSystem",
"fs",
",",
"final",
"FunctionWithException",
"<",
"File",
",",
"RefCountedFile",
",",
"IOException",
">",
"tempFileCreator",
",",
"final",
"S3AccessHelper",
"s3AccessHelper",
",",
"final"... | --------------------------- Static Constructor --------------------------- | [
"---------------------------",
"Static",
"Constructor",
"---------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/writer/S3RecoverableWriter.java#L145-L164 | train | Create a new S3RecoverableWriter. | [
30522,
2270,
10763,
1055,
2509,
2890,
3597,
26061,
3468,
15994,
3213,
1006,
2345,
6764,
27268,
6633,
1042,
2015,
1010,
2345,
3853,
24415,
10288,
24422,
1026,
5371,
1010,
25416,
3597,
16671,
2098,
8873,
2571,
1010,
22834,
10288,
24422,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java | Binder.get | public static Binder get(Environment environment) {
return new Binder(ConfigurationPropertySources.get(environment),
new PropertySourcesPlaceholdersResolver(environment));
} | java | public static Binder get(Environment environment) {
return new Binder(ConfigurationPropertySources.get(environment),
new PropertySourcesPlaceholdersResolver(environment));
} | [
"public",
"static",
"Binder",
"get",
"(",
"Environment",
"environment",
")",
"{",
"return",
"new",
"Binder",
"(",
"ConfigurationPropertySources",
".",
"get",
"(",
"environment",
")",
",",
"new",
"PropertySourcesPlaceholdersResolver",
"(",
"environment",
")",
")",
... | Create a new {@link Binder} instance from the specified environment.
@param environment the environment source (must have attached
{@link ConfigurationPropertySources})
@return a {@link Binder} instance | [
"Create",
"a",
"new",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java#L381-L384 | train | Returns a new instance of the binder configured with the given environment. | [
30522,
2270,
10763,
14187,
2121,
2131,
1006,
4044,
4044,
1007,
1063,
2709,
2047,
14187,
2121,
1006,
9563,
21572,
4842,
3723,
6499,
3126,
9623,
1012,
2131,
1006,
4044,
1007,
1010,
2047,
3200,
6499,
3126,
9623,
24759,
10732,
17794,
6072,
4747... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java | ThreadUtil.safeSleep | public static boolean safeSleep(Number millis) {
long millisLong = millis.longValue();
long done = 0;
while (done < millisLong) {
long before = System.currentTimeMillis();
if (false == sleep(millisLong - done)) {
return false;
}
long after = System.currentTimeMillis();
done += (after - before);
}
return true;
} | java | public static boolean safeSleep(Number millis) {
long millisLong = millis.longValue();
long done = 0;
while (done < millisLong) {
long before = System.currentTimeMillis();
if (false == sleep(millisLong - done)) {
return false;
}
long after = System.currentTimeMillis();
done += (after - before);
}
return true;
} | [
"public",
"static",
"boolean",
"safeSleep",
"(",
"Number",
"millis",
")",
"{",
"long",
"millisLong",
"=",
"millis",
".",
"longValue",
"(",
")",
";",
"long",
"done",
"=",
"0",
";",
"while",
"(",
"done",
"<",
"millisLong",
")",
"{",
"long",
"before",
"="... | 考虑{@link Thread#sleep(long)}方法有可能时间不足给定毫秒数,此方法保证sleep时间不小于给定的毫秒数
@see ThreadUtil#sleep(Number)
@param millis 给定的sleep时间
@return 被中断返回false,否则true | [
"考虑",
"{",
"@link",
"Thread#sleep",
"(",
"long",
")",
"}",
"方法有可能时间不足给定毫秒数,此方法保证sleep时间不小于给定的毫秒数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java#L244-L256 | train | Synchronized sleep method. | [
30522,
2270,
10763,
22017,
20898,
3647,
25016,
13699,
1006,
2193,
4971,
2483,
1007,
1063,
2146,
4971,
2483,
10052,
1027,
4971,
2483,
1012,
2146,
10175,
5657,
1006,
1007,
1025,
2146,
2589,
1027,
1014,
1025,
2096,
1006,
2589,
1026,
4971,
2483... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/logging/CommonsLogger.java | CommonsLogger.debug | @Override
public void debug(String format, Object arg) {
if (logger.isDebugEnabled()) {
FormattingTuple ft = MessageFormatter.format(format, arg);
logger.debug(ft.getMessage(), ft.getThrowable());
}
} | java | @Override
public void debug(String format, Object arg) {
if (logger.isDebugEnabled()) {
FormattingTuple ft = MessageFormatter.format(format, arg);
logger.debug(ft.getMessage(), ft.getThrowable());
}
} | [
"@",
"Override",
"public",
"void",
"debug",
"(",
"String",
"format",
",",
"Object",
"arg",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"FormattingTuple",
"ft",
"=",
"MessageFormatter",
".",
"format",
"(",
"format",
",",
"arg... | Delegates to the {@link Log#debug(Object)} method of the underlying
{@link Log} instance.
<p>
However, this form avoids superfluous object creation when the logger is disabled
for level DEBUG.
</p>
@param format
the format string
@param arg
the argument | [
"Delegates",
"to",
"the",
"{",
"@link",
"Log#debug",
"(",
"Object",
")",
"}",
"method",
"of",
"the",
"underlying",
"{",
"@link",
"Log",
"}",
"instance",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/logging/CommonsLogger.java#L202-L208 | train | Debug method. | [
30522,
1030,
2058,
15637,
2270,
11675,
2139,
8569,
2290,
1006,
5164,
4289,
1010,
4874,
12098,
2290,
1007,
1063,
2065,
1006,
8833,
4590,
1012,
2003,
3207,
8569,
6914,
3085,
2094,
1006,
1007,
1007,
1063,
4289,
3436,
8525,
10814,
3027,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/common/WordNet.java | WordNet.mergeContinuousNsIntoOne | public void mergeContinuousNsIntoOne()
{
for (int row = 0; row < vertexes.length - 1; ++row)
{
List<Vertex> vertexListFrom = vertexes[row];
ListIterator<Vertex> listIteratorFrom = vertexListFrom.listIterator();
while (listIteratorFrom.hasNext())
{
Vertex from = listIteratorFrom.next();
if (from.getNature() == Nature.ns)
{
int toIndex = row + from.realWord.length();
ListIterator<Vertex> listIteratorTo = vertexes[toIndex].listIterator();
while (listIteratorTo.hasNext())
{
Vertex to = listIteratorTo.next();
if (to.getNature() == Nature.ns)
{
// 我们不能直接改,因为很多条线路在公用指针
// from.realWord += to.realWord;
logger.info("合并【" + from.realWord + "】和【" + to.realWord + "】");
listIteratorFrom.set(Vertex.newAddressInstance(from.realWord + to.realWord));
// listIteratorTo.remove();
break;
}
}
}
}
}
} | java | public void mergeContinuousNsIntoOne()
{
for (int row = 0; row < vertexes.length - 1; ++row)
{
List<Vertex> vertexListFrom = vertexes[row];
ListIterator<Vertex> listIteratorFrom = vertexListFrom.listIterator();
while (listIteratorFrom.hasNext())
{
Vertex from = listIteratorFrom.next();
if (from.getNature() == Nature.ns)
{
int toIndex = row + from.realWord.length();
ListIterator<Vertex> listIteratorTo = vertexes[toIndex].listIterator();
while (listIteratorTo.hasNext())
{
Vertex to = listIteratorTo.next();
if (to.getNature() == Nature.ns)
{
// 我们不能直接改,因为很多条线路在公用指针
// from.realWord += to.realWord;
logger.info("合并【" + from.realWord + "】和【" + to.realWord + "】");
listIteratorFrom.set(Vertex.newAddressInstance(from.realWord + to.realWord));
// listIteratorTo.remove();
break;
}
}
}
}
}
} | [
"public",
"void",
"mergeContinuousNsIntoOne",
"(",
")",
"{",
"for",
"(",
"int",
"row",
"=",
"0",
";",
"row",
"<",
"vertexes",
".",
"length",
"-",
"1",
";",
"++",
"row",
")",
"{",
"List",
"<",
"Vertex",
">",
"vertexListFrom",
"=",
"vertexes",
"[",
"ro... | 将连续的ns节点合并为一个 | [
"将连续的ns节点合并为一个"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/WordNet.java#L360-L389 | train | Merge continuous NNs into one. | [
30522,
2270,
11675,
13590,
8663,
7629,
8918,
3619,
18447,
7828,
2063,
1006,
1007,
1063,
2005,
1006,
20014,
5216,
1027,
1014,
1025,
5216,
1026,
19449,
2229,
1012,
3091,
1011,
1015,
1025,
1009,
1009,
5216,
1007,
1063,
2862,
1026,
19449,
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-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryImpl.java | MetricRegistryImpl.shutdown | public CompletableFuture<Void> shutdown() {
synchronized (lock) {
if (isShutdown) {
return terminationFuture;
} else {
isShutdown = true;
final Collection<CompletableFuture<Void>> terminationFutures = new ArrayList<>(3);
final Time gracePeriod = Time.seconds(1L);
if (metricQueryServiceRpcService != null) {
final CompletableFuture<Void> metricQueryServiceRpcServiceTerminationFuture = metricQueryServiceRpcService.stopService();
terminationFutures.add(metricQueryServiceRpcServiceTerminationFuture);
}
Throwable throwable = null;
for (MetricReporter reporter : reporters) {
try {
reporter.close();
} catch (Throwable t) {
throwable = ExceptionUtils.firstOrSuppressed(t, throwable);
}
}
reporters.clear();
if (throwable != null) {
terminationFutures.add(
FutureUtils.completedExceptionally(
new FlinkException("Could not shut down the metric reporters properly.", throwable)));
}
final CompletableFuture<Void> executorShutdownFuture = ExecutorUtils.nonBlockingShutdown(
gracePeriod.toMilliseconds(),
TimeUnit.MILLISECONDS,
executor);
terminationFutures.add(executorShutdownFuture);
FutureUtils
.completeAll(terminationFutures)
.whenComplete(
(Void ignored, Throwable error) -> {
if (error != null) {
terminationFuture.completeExceptionally(error);
} else {
terminationFuture.complete(null);
}
});
return terminationFuture;
}
}
} | java | public CompletableFuture<Void> shutdown() {
synchronized (lock) {
if (isShutdown) {
return terminationFuture;
} else {
isShutdown = true;
final Collection<CompletableFuture<Void>> terminationFutures = new ArrayList<>(3);
final Time gracePeriod = Time.seconds(1L);
if (metricQueryServiceRpcService != null) {
final CompletableFuture<Void> metricQueryServiceRpcServiceTerminationFuture = metricQueryServiceRpcService.stopService();
terminationFutures.add(metricQueryServiceRpcServiceTerminationFuture);
}
Throwable throwable = null;
for (MetricReporter reporter : reporters) {
try {
reporter.close();
} catch (Throwable t) {
throwable = ExceptionUtils.firstOrSuppressed(t, throwable);
}
}
reporters.clear();
if (throwable != null) {
terminationFutures.add(
FutureUtils.completedExceptionally(
new FlinkException("Could not shut down the metric reporters properly.", throwable)));
}
final CompletableFuture<Void> executorShutdownFuture = ExecutorUtils.nonBlockingShutdown(
gracePeriod.toMilliseconds(),
TimeUnit.MILLISECONDS,
executor);
terminationFutures.add(executorShutdownFuture);
FutureUtils
.completeAll(terminationFutures)
.whenComplete(
(Void ignored, Throwable error) -> {
if (error != null) {
terminationFuture.completeExceptionally(error);
} else {
terminationFuture.complete(null);
}
});
return terminationFuture;
}
}
} | [
"public",
"CompletableFuture",
"<",
"Void",
">",
"shutdown",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"isShutdown",
")",
"{",
"return",
"terminationFuture",
";",
"}",
"else",
"{",
"isShutdown",
"=",
"true",
";",
"final",
"Collection... | Shuts down this registry and the associated {@link MetricReporter}.
<p>NOTE: This operation is asynchronous and returns a future which is completed
once the shutdown operation has been completed.
@return Future which is completed once the {@link MetricRegistryImpl}
is shut down. | [
"Shuts",
"down",
"this",
"registry",
"and",
"the",
"associated",
"{",
"@link",
"MetricReporter",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryImpl.java#L264-L315 | train | Shutdown the metric reporters. | [
30522,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
11675,
1028,
3844,
7698,
1006,
1007,
1063,
25549,
1006,
5843,
1007,
1063,
2065,
1006,
26354,
6979,
2102,
7698,
1007,
1063,
2709,
18287,
11263,
11244,
1025,
1065,
2842,
1063,
26354,
6979,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/LinkedOptionalMap.java | LinkedOptionalMap.optionalMapOf | public static <K, V> LinkedOptionalMap<K, V> optionalMapOf(Map<K, V> sourceMap, Function<K, String> keyNameGetter) {
LinkedHashMap<String, KeyValue<K, V>> underlyingMap = new LinkedHashMap<>(sourceMap.size());
sourceMap.forEach((k, v) -> {
String keyName = keyNameGetter.apply(k);
underlyingMap.put(keyName, new KeyValue<>(k, v));
});
return new LinkedOptionalMap<>(underlyingMap);
} | java | public static <K, V> LinkedOptionalMap<K, V> optionalMapOf(Map<K, V> sourceMap, Function<K, String> keyNameGetter) {
LinkedHashMap<String, KeyValue<K, V>> underlyingMap = new LinkedHashMap<>(sourceMap.size());
sourceMap.forEach((k, v) -> {
String keyName = keyNameGetter.apply(k);
underlyingMap.put(keyName, new KeyValue<>(k, v));
});
return new LinkedOptionalMap<>(underlyingMap);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"LinkedOptionalMap",
"<",
"K",
",",
"V",
">",
"optionalMapOf",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"sourceMap",
",",
"Function",
"<",
"K",
",",
"String",
">",
"keyNameGetter",
")",
"{",
"LinkedHashMap",
"... | Creates an {@code LinkedOptionalMap} from the provided map.
<p>This method is the equivalent of {@link Optional#of(Object)} but for maps. To support more than one {@code NULL}
key, an optional map requires a unique string name to be associated with each key (provided by keyNameGetter)
@param sourceMap a source map to wrap as an optional map.
@param keyNameGetter function that assigns a unique name to the keys of the source map.
@param <K> key type
@param <V> value type
@return an {@code LinkedOptionalMap} with optional named keys, and optional values. | [
"Creates",
"an",
"{",
"@code",
"LinkedOptionalMap",
"}",
"from",
"the",
"provided",
"map",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/LinkedOptionalMap.java#L62-L72 | train | Creates an optional map from a map. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
5799,
7361,
3508,
2389,
2863,
2361,
1026,
1047,
1010,
1058,
1028,
11887,
2863,
6873,
2546,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
3120,
2863,
2361,
1010,
3853,
1026,
1047,
1010,
5164,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnector.java | KafkaCanalConnector.disconnect | @Override
public void disconnect() {
if (kafkaConsumer != null) {
kafkaConsumer.close();
kafkaConsumer = null;
}
if (kafkaConsumer2 != null) {
kafkaConsumer2.close();
kafkaConsumer2 = null;
}
connected = false;
} | java | @Override
public void disconnect() {
if (kafkaConsumer != null) {
kafkaConsumer.close();
kafkaConsumer = null;
}
if (kafkaConsumer2 != null) {
kafkaConsumer2.close();
kafkaConsumer2 = null;
}
connected = false;
} | [
"@",
"Override",
"public",
"void",
"disconnect",
"(",
")",
"{",
"if",
"(",
"kafkaConsumer",
"!=",
"null",
")",
"{",
"kafkaConsumer",
".",
"close",
"(",
")",
";",
"kafkaConsumer",
"=",
"null",
";",
"}",
"if",
"(",
"kafkaConsumer2",
"!=",
"null",
")",
"{... | 关闭链接 | [
"关闭链接"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client/src/main/java/com/alibaba/otter/canal/client/kafka/KafkaCanalConnector.java#L94-L106 | train | Disconnect from the Kafka consumer and consumer2. | [
30522,
1030,
2058,
15637,
2270,
11675,
12532,
10087,
6593,
1006,
1007,
1063,
2065,
1006,
10556,
24316,
22684,
3619,
17897,
2099,
999,
1027,
19701,
1007,
1063,
10556,
24316,
22684,
3619,
17897,
2099,
1012,
2485,
1006,
1007,
1025,
10556,
24316,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getHadoopUser | public static String getHadoopUser() {
try {
Class<?> ugiClass = Class.forName(
"org.apache.hadoop.security.UserGroupInformation",
false,
EnvironmentInformation.class.getClassLoader());
Method currentUserMethod = ugiClass.getMethod("getCurrentUser");
Method shortUserNameMethod = ugiClass.getMethod("getShortUserName");
Object ugi = currentUserMethod.invoke(null);
return (String) shortUserNameMethod.invoke(ugi);
}
catch (ClassNotFoundException e) {
return "<no hadoop dependency found>";
}
catch (LinkageError e) {
// hadoop classes are not in the classpath
LOG.debug("Cannot determine user/group information using Hadoop utils. " +
"Hadoop classes not loaded or compatible", e);
}
catch (Throwable t) {
// some other error occurred that we should log and make known
LOG.warn("Error while accessing user/group information via Hadoop utils.", t);
}
return UNKNOWN;
} | java | public static String getHadoopUser() {
try {
Class<?> ugiClass = Class.forName(
"org.apache.hadoop.security.UserGroupInformation",
false,
EnvironmentInformation.class.getClassLoader());
Method currentUserMethod = ugiClass.getMethod("getCurrentUser");
Method shortUserNameMethod = ugiClass.getMethod("getShortUserName");
Object ugi = currentUserMethod.invoke(null);
return (String) shortUserNameMethod.invoke(ugi);
}
catch (ClassNotFoundException e) {
return "<no hadoop dependency found>";
}
catch (LinkageError e) {
// hadoop classes are not in the classpath
LOG.debug("Cannot determine user/group information using Hadoop utils. " +
"Hadoop classes not loaded or compatible", e);
}
catch (Throwable t) {
// some other error occurred that we should log and make known
LOG.warn("Error while accessing user/group information via Hadoop utils.", t);
}
return UNKNOWN;
} | [
"public",
"static",
"String",
"getHadoopUser",
"(",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"ugiClass",
"=",
"Class",
".",
"forName",
"(",
"\"org.apache.hadoop.security.UserGroupInformation\"",
",",
"false",
",",
"EnvironmentInformation",
".",
"class",
".",
... | Gets the name of the user that is running the JVM.
@return The name of the user that is running the JVM. | [
"Gets",
"the",
"name",
"of",
"the",
"user",
"that",
"is",
"running",
"the",
"JVM",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java#L87-L113 | train | Returns the user name of the current user. | [
30522,
2270,
10763,
5164,
2131,
16102,
18589,
20330,
1006,
1007,
1063,
3046,
1063,
2465,
1026,
1029,
1028,
1057,
12863,
27102,
1027,
2465,
1012,
2005,
18442,
1006,
1000,
8917,
1012,
15895,
1012,
2018,
18589,
1012,
3036,
1012,
5310,
17058,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.