repo stringclasses 11 values | path stringlengths 41 234 | func_name stringlengths 5 78 | original_string stringlengths 71 14.1k | language stringclasses 1 value | code stringlengths 71 14.1k | code_tokens listlengths 22 2.65k | docstring stringlengths 2 5.35k | docstring_tokens listlengths 1 369 | sha stringclasses 11 values | url stringlengths 129 339 | partition stringclasses 1 value | summary stringlengths 7 175 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/DistinctOperator.java | DistinctOperator.translateSelectorFunctionDistinct | private static <IN, K> org.apache.flink.api.common.operators.SingleInputOperator<?, IN, ?> translateSelectorFunctionDistinct(
SelectorFunctionKeys<IN, ?> rawKeys,
ReduceFunction<IN> function,
TypeInformation<IN> outputType,
String name,
Operator<IN> input,
int parallelism,
CombineHint hint) {
@SuppressWarnings("unchecked")
final SelectorFunctionKeys<IN, K> keys = (SelectorFunctionKeys<IN, K>) rawKeys;
TypeInformation<Tuple2<K, IN>> typeInfoWithKey = KeyFunctions.createTypeWithKey(keys);
Operator<Tuple2<K, IN>> keyedInput = KeyFunctions.appendKeyExtractor(input, keys);
PlanUnwrappingReduceOperator<IN, K> reducer =
new PlanUnwrappingReduceOperator<>(function, keys, name, outputType, typeInfoWithKey);
reducer.setInput(keyedInput);
reducer.setCombineHint(hint);
reducer.setParallelism(parallelism);
return KeyFunctions.appendKeyRemover(reducer, keys);
} | java | private static <IN, K> org.apache.flink.api.common.operators.SingleInputOperator<?, IN, ?> translateSelectorFunctionDistinct(
SelectorFunctionKeys<IN, ?> rawKeys,
ReduceFunction<IN> function,
TypeInformation<IN> outputType,
String name,
Operator<IN> input,
int parallelism,
CombineHint hint) {
@SuppressWarnings("unchecked")
final SelectorFunctionKeys<IN, K> keys = (SelectorFunctionKeys<IN, K>) rawKeys;
TypeInformation<Tuple2<K, IN>> typeInfoWithKey = KeyFunctions.createTypeWithKey(keys);
Operator<Tuple2<K, IN>> keyedInput = KeyFunctions.appendKeyExtractor(input, keys);
PlanUnwrappingReduceOperator<IN, K> reducer =
new PlanUnwrappingReduceOperator<>(function, keys, name, outputType, typeInfoWithKey);
reducer.setInput(keyedInput);
reducer.setCombineHint(hint);
reducer.setParallelism(parallelism);
return KeyFunctions.appendKeyRemover(reducer, keys);
} | [
"private",
"static",
"<",
"IN",
",",
"K",
">",
"org",
".",
"apache",
".",
"flink",
".",
"api",
".",
"common",
".",
"operators",
".",
"SingleInputOperator",
"<",
"?",
",",
"IN",
",",
"?",
">",
"translateSelectorFunctionDistinct",
"(",
"SelectorFunctionKeys",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/DistinctOperator.java#L128-L149 | train | Translate a single input selector function distinct. | [
30522,
2797,
10763,
1026,
1999,
1010,
1047,
1028,
8917,
1012,
15895,
1012,
13109,
19839,
1012,
17928,
1012,
2691,
1012,
9224,
1012,
2309,
2378,
18780,
25918,
8844,
1026,
1029,
1010,
1999,
1010,
1029,
1028,
16315,
12260,
16761,
11263,
27989,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.on | public SqlBuilder on(String on) {
if (StrUtil.isNotBlank(on)) {
this.sql.append(" ON ").append(on);
}
return this;
} | java | public SqlBuilder on(String on) {
if (StrUtil.isNotBlank(on)) {
this.sql.append(" ON ").append(on);
}
return this;
} | [
"public",
"SqlBuilder",
"on",
"(",
"String",
"on",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isNotBlank",
"(",
"on",
")",
")",
"{",
"this",
".",
"sql",
".",
"append",
"(",
"\" ON \"",
")",
".",
"append",
"(",
"on",
")",
";",
"}",
"return",
"this",
";... | 配合JOIN的 ON语句,多表关联的条件语句<br>
只支持单一的逻辑运算符(例如多个条件之间)
@param on 条件
@return 自己 | [
"配合JOIN的",
"ON语句,多表关联的条件语句<br",
">",
"只支持单一的逻辑运算符(例如多个条件之间)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java#L482-L487 | train | Add a ON clause. | [
30522,
2270,
29296,
8569,
23891,
2099,
2006,
1006,
5164,
2006,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
3475,
4140,
28522,
8950,
1006,
2006,
1007,
1007,
1063,
2023,
1012,
29296,
1012,
10439,
10497,
1006,
1000,
2006,
1000,
1007,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.mapPartition | public <R> MapPartitionOperator<T, R> mapPartition(MapPartitionFunction<T, R> mapPartition) {
if (mapPartition == null) {
throw new NullPointerException("MapPartition function must not be null.");
}
String callLocation = Utils.getCallLocationName();
TypeInformation<R> resultType = TypeExtractor.getMapPartitionReturnTypes(mapPartition, getType(), callLocation, true);
return new MapPartitionOperator<>(this, resultType, clean(mapPartition), callLocation);
} | java | public <R> MapPartitionOperator<T, R> mapPartition(MapPartitionFunction<T, R> mapPartition) {
if (mapPartition == null) {
throw new NullPointerException("MapPartition function must not be null.");
}
String callLocation = Utils.getCallLocationName();
TypeInformation<R> resultType = TypeExtractor.getMapPartitionReturnTypes(mapPartition, getType(), callLocation, true);
return new MapPartitionOperator<>(this, resultType, clean(mapPartition), callLocation);
} | [
"public",
"<",
"R",
">",
"MapPartitionOperator",
"<",
"T",
",",
"R",
">",
"mapPartition",
"(",
"MapPartitionFunction",
"<",
"T",
",",
"R",
">",
"mapPartition",
")",
"{",
"if",
"(",
"mapPartition",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerExcepti... | Applies a Map-style operation to the entire partition of the data.
The function is called once per parallel partition of the data,
and the entire partition is available through the given Iterator.
The number of elements that each instance of the MapPartition function
sees is non deterministic and depends on the parallelism of the operation.
<p>This function is intended for operations that cannot transform individual elements,
requires no grouping of elements. To transform individual elements,
the use of {@code map()} and {@code flatMap()} is preferable.
@param mapPartition The MapPartitionFunction that is called for the full DataSet.
@return A MapPartitionOperator that represents the transformed DataSet.
@see MapPartitionFunction
@see MapPartitionOperator | [
"Applies",
"a",
"Map",
"-",
"style",
"operation",
"to",
"the",
"entire",
"partition",
"of",
"the",
"data",
".",
"The",
"function",
"is",
"called",
"once",
"per",
"parallel",
"partition",
"of",
"the",
"data",
"and",
"the",
"entire",
"partition",
"is",
"avai... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L237-L245 | train | Create a new MapPartitionOperator from this operator and a MapPartitionFunction. | [
30522,
2270,
1026,
1054,
1028,
4949,
19362,
3775,
3508,
25918,
8844,
1026,
1056,
1010,
1054,
1028,
4949,
19362,
3775,
3508,
1006,
4949,
19362,
3775,
3508,
11263,
27989,
1026,
1056,
1010,
1054,
1028,
4949,
19362,
3775,
3508,
1007,
1063,
2065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java | SlotPoolImpl.suspend | @Override
public void suspend() {
componentMainThreadExecutor.assertRunningInMainThread();
log.info("Suspending SlotPool.");
// cancel all pending allocations --> we can request these slots
// again after we regained the leadership
Set<AllocationID> allocationIds = pendingRequests.keySetB();
for (AllocationID allocationId : allocationIds) {
resourceManagerGateway.cancelSlotRequest(allocationId);
}
// do not accept any requests
jobMasterId = null;
resourceManagerGateway = null;
// Clear (but not release!) the available slots. The TaskManagers should re-register them
// at the new leader JobManager/SlotPool
clear();
} | java | @Override
public void suspend() {
componentMainThreadExecutor.assertRunningInMainThread();
log.info("Suspending SlotPool.");
// cancel all pending allocations --> we can request these slots
// again after we regained the leadership
Set<AllocationID> allocationIds = pendingRequests.keySetB();
for (AllocationID allocationId : allocationIds) {
resourceManagerGateway.cancelSlotRequest(allocationId);
}
// do not accept any requests
jobMasterId = null;
resourceManagerGateway = null;
// Clear (but not release!) the available slots. The TaskManagers should re-register them
// at the new leader JobManager/SlotPool
clear();
} | [
"@",
"Override",
"public",
"void",
"suspend",
"(",
")",
"{",
"componentMainThreadExecutor",
".",
"assertRunningInMainThread",
"(",
")",
";",
"log",
".",
"info",
"(",
"\"Suspending SlotPool.\"",
")",
";",
"// cancel all pending allocations --> we can request these slots",
... | Suspends this pool, meaning it has lost its authority to accept and distribute slots. | [
"Suspends",
"this",
"pool",
"meaning",
"it",
"has",
"lost",
"its",
"authority",
"to",
"accept",
"and",
"distribute",
"slots",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java#L192-L214 | train | Suspend the slot pool. | [
30522,
1030,
2058,
15637,
2270,
11675,
28324,
1006,
1007,
1063,
6922,
24238,
2705,
16416,
3207,
2595,
8586,
16161,
2099,
1012,
20865,
15532,
5582,
2378,
24238,
2705,
16416,
2094,
1006,
1007,
1025,
8833,
1012,
18558,
1006,
1000,
28324,
2075,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/LargeRecordHandler.java | LargeRecordHandler.createSerializer | private TypeSerializer<Object> createSerializer(Object key, int pos) {
if (key == null) {
throw new NullKeyFieldException(pos);
}
try {
TypeInformation<Object> info = TypeExtractor.getForObject(key);
return info.createSerializer(executionConfig);
}
catch (Throwable t) {
throw new RuntimeException("Could not create key serializer for type " + key);
}
} | java | private TypeSerializer<Object> createSerializer(Object key, int pos) {
if (key == null) {
throw new NullKeyFieldException(pos);
}
try {
TypeInformation<Object> info = TypeExtractor.getForObject(key);
return info.createSerializer(executionConfig);
}
catch (Throwable t) {
throw new RuntimeException("Could not create key serializer for type " + key);
}
} | [
"private",
"TypeSerializer",
"<",
"Object",
">",
"createSerializer",
"(",
"Object",
"key",
",",
"int",
"pos",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"NullKeyFieldException",
"(",
"pos",
")",
";",
"}",
"try",
"{",
"TypeInforma... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/LargeRecordHandler.java#L383-L394 | train | Create a serializer for the given key. | [
30522,
2797,
4127,
11610,
28863,
1026,
4874,
1028,
9005,
11610,
28863,
1006,
4874,
3145,
1010,
20014,
13433,
2015,
1007,
1063,
2065,
1006,
3145,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
14839,
3790,
10288,
24422,
1006,
13433,
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/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/JoinNode.java | JoinNode.computeOperatorSpecificDefaultEstimates | @Override
protected void computeOperatorSpecificDefaultEstimates(DataStatistics statistics) {
long card1 = getFirstPredecessorNode().getEstimatedNumRecords();
long card2 = getSecondPredecessorNode().getEstimatedNumRecords();
this.estimatedNumRecords = (card1 < 0 || card2 < 0) ? -1 : Math.max(card1, card2);
if (this.estimatedNumRecords >= 0) {
float width1 = getFirstPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
float width2 = getSecondPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
float width = (width1 <= 0 || width2 <= 0) ? -1 : width1 + width2;
if (width > 0) {
this.estimatedOutputSize = (long) (width * this.estimatedNumRecords);
}
}
} | java | @Override
protected void computeOperatorSpecificDefaultEstimates(DataStatistics statistics) {
long card1 = getFirstPredecessorNode().getEstimatedNumRecords();
long card2 = getSecondPredecessorNode().getEstimatedNumRecords();
this.estimatedNumRecords = (card1 < 0 || card2 < 0) ? -1 : Math.max(card1, card2);
if (this.estimatedNumRecords >= 0) {
float width1 = getFirstPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
float width2 = getSecondPredecessorNode().getEstimatedAvgWidthPerOutputRecord();
float width = (width1 <= 0 || width2 <= 0) ? -1 : width1 + width2;
if (width > 0) {
this.estimatedOutputSize = (long) (width * this.estimatedNumRecords);
}
}
} | [
"@",
"Override",
"protected",
"void",
"computeOperatorSpecificDefaultEstimates",
"(",
"DataStatistics",
"statistics",
")",
"{",
"long",
"card1",
"=",
"getFirstPredecessorNode",
"(",
")",
".",
"getEstimatedNumRecords",
"(",
")",
";",
"long",
"card2",
"=",
"getSecondPre... | The default estimates build on the principle of inclusion: The smaller input key domain is included in the larger
input key domain. We also assume that every key from the larger input has one join partner in the smaller input.
The result cardinality is hence the larger one. | [
"The",
"default",
"estimates",
"build",
"on",
"the",
"principle",
"of",
"inclusion",
":",
"The",
"smaller",
"input",
"key",
"domain",
"is",
"included",
"in",
"the",
"larger",
"input",
"key",
"domain",
".",
"We",
"also",
"assume",
"that",
"every",
"key",
"f... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/JoinNode.java#L97-L112 | train | Compute the default estimates for the operator. | [
30522,
1030,
2058,
15637,
5123,
11675,
24134,
25918,
18926,
5051,
6895,
8873,
19797,
12879,
23505,
4355,
21499,
2015,
1006,
2951,
9153,
16774,
6558,
6747,
1007,
1063,
2146,
4003,
2487,
1027,
2131,
8873,
12096,
28139,
3207,
9623,
21748,
3630,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | dump/src/main/java/com/networknt/dump/DumpHelper.java | DumpHelper.logResult | static void logResult(Map<String, Object> result, DumpConfig config) {
Consumer<String> loggerFunc = getLoggerFuncBasedOnLevel(config.getLogLevel());
if(config.isUseJson()) {
logResultUsingJson(result, loggerFunc);
} else {
int startLevel = -1;
StringBuilder sb = new StringBuilder("Http request/response information:");
_logResult(result, startLevel, config.getIndentSize(), sb);
loggerFunc.accept(sb.toString());
}
} | java | static void logResult(Map<String, Object> result, DumpConfig config) {
Consumer<String> loggerFunc = getLoggerFuncBasedOnLevel(config.getLogLevel());
if(config.isUseJson()) {
logResultUsingJson(result, loggerFunc);
} else {
int startLevel = -1;
StringBuilder sb = new StringBuilder("Http request/response information:");
_logResult(result, startLevel, config.getIndentSize(), sb);
loggerFunc.accept(sb.toString());
}
} | [
"static",
"void",
"logResult",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
",",
"DumpConfig",
"config",
")",
"{",
"Consumer",
"<",
"String",
">",
"loggerFunc",
"=",
"getLoggerFuncBasedOnLevel",
"(",
"config",
".",
"getLogLevel",
"(",
")",
")",
... | A help method to log result pojo
@param result the map contains info that needs to be logged | [
"A",
"help",
"method",
"to",
"log",
"result",
"pojo"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/DumpHelper.java#L39-L49 | train | Logs the result of a request. | [
30522,
10763,
11675,
8833,
6072,
11314,
1006,
4949,
1026,
5164,
1010,
4874,
1028,
2765,
1010,
15653,
8663,
8873,
2290,
9530,
8873,
2290,
1007,
1063,
7325,
1026,
5164,
1028,
8833,
4590,
11263,
12273,
1027,
2131,
21197,
4590,
11263,
12273,
15... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.hexDump | public static String hexDump(ByteBuf buffer, int fromIndex, int length) {
return HexUtil.hexDump(buffer, fromIndex, length);
} | java | public static String hexDump(ByteBuf buffer, int fromIndex, int length) {
return HexUtil.hexDump(buffer, fromIndex, length);
} | [
"public",
"static",
"String",
"hexDump",
"(",
"ByteBuf",
"buffer",
",",
"int",
"fromIndex",
",",
"int",
"length",
")",
"{",
"return",
"HexUtil",
".",
"hexDump",
"(",
"buffer",
",",
"fromIndex",
",",
"length",
")",
";",
"}"
] | Returns a <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a>
of the specified buffer's sub-region. | [
"Returns",
"a",
"<a",
"href",
"=",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Hex_dump",
">",
"hex",
"dump<",
"/",
"a",
">",
"of",
"the",
"specified",
"buffer",
"s",
"sub",
"-",
"region",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L121-L123 | train | Hex dump of a byte buffer. | [
30522,
2270,
10763,
5164,
2002,
2595,
8566,
8737,
1006,
24880,
8569,
2546,
17698,
1010,
20014,
2013,
22254,
10288,
1010,
20014,
3091,
1007,
1063,
2709,
2002,
2595,
21823,
2140,
1012,
2002,
2595,
8566,
8737,
1006,
17698,
1010,
2013,
22254,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.generateSequence | public DataStreamSource<Long> generateSequence(long from, long to) {
if (from > to) {
throw new IllegalArgumentException("Start of sequence must not be greater than the end");
}
return addSource(new StatefulSequenceSource(from, to), "Sequence Source");
} | java | public DataStreamSource<Long> generateSequence(long from, long to) {
if (from > to) {
throw new IllegalArgumentException("Start of sequence must not be greater than the end");
}
return addSource(new StatefulSequenceSource(from, to), "Sequence Source");
} | [
"public",
"DataStreamSource",
"<",
"Long",
">",
"generateSequence",
"(",
"long",
"from",
",",
"long",
"to",
")",
"{",
"if",
"(",
"from",
">",
"to",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Start of sequence must not be greater than the end\"",
... | Creates a new data stream that contains a sequence of numbers. This is a parallel source,
if you manually set the parallelism to {@code 1}
(using {@link org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator#setParallelism(int)})
the generated sequence of elements is in order.
@param from
The number to start at (inclusive)
@param to
The number to stop at (inclusive)
@return A data stream, containing all number in the [from, to] interval | [
"Creates",
"a",
"new",
"data",
"stream",
"that",
"contains",
"a",
"sequence",
"of",
"numbers",
".",
"This",
"is",
"a",
"parallel",
"source",
"if",
"you",
"manually",
"set",
"the",
"parallelism",
"to",
"{",
"@code",
"1",
"}",
"(",
"using",
"{",
"@link",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L675-L680 | train | Generates a sequence from the given start and end. | [
30522,
2270,
2951,
21422,
6499,
3126,
3401,
1026,
2146,
1028,
19421,
2063,
4226,
5897,
1006,
2146,
2013,
1010,
2146,
2000,
1007,
1063,
30524,
3401,
1006,
2047,
2110,
3993,
3366,
4226,
5897,
6499,
3126,
3401,
1006,
2013,
1010,
2000,
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-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/NFA.java | NFA.process | public Collection<Map<String, List<T>>> process(
final SharedBufferAccessor<T> sharedBufferAccessor,
final NFAState nfaState,
final T event,
final long timestamp,
final AfterMatchSkipStrategy afterMatchSkipStrategy,
final TimerService timerService) throws Exception {
try (EventWrapper eventWrapper = new EventWrapper(event, timestamp, sharedBufferAccessor)) {
return doProcess(sharedBufferAccessor, nfaState, eventWrapper, afterMatchSkipStrategy, timerService);
}
} | java | public Collection<Map<String, List<T>>> process(
final SharedBufferAccessor<T> sharedBufferAccessor,
final NFAState nfaState,
final T event,
final long timestamp,
final AfterMatchSkipStrategy afterMatchSkipStrategy,
final TimerService timerService) throws Exception {
try (EventWrapper eventWrapper = new EventWrapper(event, timestamp, sharedBufferAccessor)) {
return doProcess(sharedBufferAccessor, nfaState, eventWrapper, afterMatchSkipStrategy, timerService);
}
} | [
"public",
"Collection",
"<",
"Map",
"<",
"String",
",",
"List",
"<",
"T",
">",
">",
">",
"process",
"(",
"final",
"SharedBufferAccessor",
"<",
"T",
">",
"sharedBufferAccessor",
",",
"final",
"NFAState",
"nfaState",
",",
"final",
"T",
"event",
",",
"final",... | Processes the next input event. If some of the computations reach a final state then the
resulting event sequences are returned. If computations time out and timeout handling is
activated, then the timed out event patterns are returned.
<p>If computations reach a stop state, the path forward is discarded and currently constructed path is returned
with the element that resulted in the stop state.
@param sharedBufferAccessor the accessor to SharedBuffer object that we need to work upon while processing
@param nfaState The NFAState object that we need to affect while processing
@param event The current event to be processed or null if only pruning shall be done
@param timestamp The timestamp of the current event
@param afterMatchSkipStrategy The skip strategy to use after per match
@param timerService gives access to processing time and time characteristic, needed for condition evaluation
@return Tuple of the collection of matched patterns (e.g. the result of computations which have
reached a final state) and the collection of timed out patterns (if timeout handling is
activated)
@throws Exception Thrown if the system cannot access the state. | [
"Processes",
"the",
"next",
"input",
"event",
".",
"If",
"some",
"of",
"the",
"computations",
"reach",
"a",
"final",
"state",
"then",
"the",
"resulting",
"event",
"sequences",
"are",
"returned",
".",
"If",
"computations",
"time",
"out",
"and",
"timeout",
"ha... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/NFA.java#L220-L230 | train | Process an event. | [
30522,
2270,
3074,
1026,
4949,
1026,
5164,
1010,
2862,
1026,
1056,
1028,
1028,
1028,
2832,
1006,
2345,
4207,
8569,
12494,
6305,
9623,
21748,
1026,
1056,
1028,
4207,
8569,
12494,
6305,
9623,
21748,
1010,
2345,
1050,
24333,
3686,
1050,
24333,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/common/Vertex.java | Vertex.newNumberInstance | public static Vertex newNumberInstance(String realWord)
{
return new Vertex(Predefine.TAG_NUMBER, realWord, new CoreDictionary.Attribute(Nature.m, 1000));
} | java | public static Vertex newNumberInstance(String realWord)
{
return new Vertex(Predefine.TAG_NUMBER, realWord, new CoreDictionary.Attribute(Nature.m, 1000));
} | [
"public",
"static",
"Vertex",
"newNumberInstance",
"(",
"String",
"realWord",
")",
"{",
"return",
"new",
"Vertex",
"(",
"Predefine",
".",
"TAG_NUMBER",
",",
"realWord",
",",
"new",
"CoreDictionary",
".",
"Attribute",
"(",
"Nature",
".",
"m",
",",
"1000",
")"... | 创建一个数词实例
@param realWord 数字对应的真实字串
@return 数词顶点 | [
"创建一个数词实例"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/Vertex.java#L342-L345 | train | Create a number Vertex. | [
30522,
2270,
10763,
19449,
2047,
19172,
5677,
7076,
26897,
1006,
5164,
2613,
18351,
1007,
1063,
2709,
2047,
19449,
1006,
3653,
3207,
23460,
1012,
6415,
1035,
2193,
1010,
2613,
18351,
1010,
2047,
4563,
29201,
3258,
5649,
1012,
17961,
1006,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ftp/AbstractFtp.java | AbstractFtp.containsIgnoreCase | private static boolean containsIgnoreCase(List<String> names, String nameToFind) {
if (CollUtil.isEmpty(names)) {
return false;
}
if (StrUtil.isEmpty(nameToFind)) {
return false;
}
for (String name : names) {
if (nameToFind.equalsIgnoreCase(name)) {
return true;
}
}
return false;
} | java | private static boolean containsIgnoreCase(List<String> names, String nameToFind) {
if (CollUtil.isEmpty(names)) {
return false;
}
if (StrUtil.isEmpty(nameToFind)) {
return false;
}
for (String name : names) {
if (nameToFind.equalsIgnoreCase(name)) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"containsIgnoreCase",
"(",
"List",
"<",
"String",
">",
"names",
",",
"String",
"nameToFind",
")",
"{",
"if",
"(",
"CollUtil",
".",
"isEmpty",
"(",
"names",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"StrUtil",
... | 是否包含指定字符串,忽略大小写
@param names 文件或目录名列表
@param nameToFind 要查找的文件或目录名
@return 是否包含 | [
"是否包含指定字符串,忽略大小写"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/AbstractFtp.java#L160-L173 | train | Checks if the list of strings contains the given name ignoring case. | [
30522,
2797,
10763,
22017,
20898,
3397,
23773,
5686,
18382,
1006,
2862,
1026,
5164,
1028,
3415,
1010,
5164,
2171,
3406,
30524,
1012,
2003,
6633,
13876,
2100,
1006,
3415,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
2065,
1006,
2358,
22134,
401... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSink.java | CassandraSink.slotSharingGroup | public CassandraSink<IN> slotSharingGroup(String slotSharingGroup) {
if (useDataStreamSink) {
getSinkTransformation().setSlotSharingGroup(slotSharingGroup);
} else {
getStreamTransformation().setSlotSharingGroup(slotSharingGroup);
}
return this;
} | java | public CassandraSink<IN> slotSharingGroup(String slotSharingGroup) {
if (useDataStreamSink) {
getSinkTransformation().setSlotSharingGroup(slotSharingGroup);
} else {
getStreamTransformation().setSlotSharingGroup(slotSharingGroup);
}
return this;
} | [
"public",
"CassandraSink",
"<",
"IN",
">",
"slotSharingGroup",
"(",
"String",
"slotSharingGroup",
")",
"{",
"if",
"(",
"useDataStreamSink",
")",
"{",
"getSinkTransformation",
"(",
")",
".",
"setSlotSharingGroup",
"(",
"slotSharingGroup",
")",
";",
"}",
"else",
"... | Sets the slot sharing group of this operation. Parallel instances of
operations that are in the same slot sharing group will be co-located in the same
TaskManager slot, if possible.
<p>Operations inherit the slot sharing group of input operations if all input operations
are in the same slot sharing group and no slot sharing group was explicitly specified.
<p>Initially an operation is in the default slot sharing group. An operation can be put into
the default group explicitly by setting the slot sharing group to {@code "default"}.
@param slotSharingGroup The slot sharing group name. | [
"Sets",
"the",
"slot",
"sharing",
"group",
"of",
"this",
"operation",
".",
"Parallel",
"instances",
"of",
"operations",
"that",
"are",
"in",
"the",
"same",
"slot",
"sharing",
"group",
"will",
"be",
"co",
"-",
"located",
"in",
"the",
"same",
"TaskManager",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSink.java#L185-L192 | train | Sets the slot sharing group for this sink. | [
30522,
2270,
15609,
11493,
2243,
1026,
1999,
1028,
19832,
18428,
3070,
17058,
1006,
5164,
19832,
18428,
3070,
17058,
1007,
1063,
2065,
1006,
2109,
6790,
21422,
11493,
2243,
1007,
1063,
4152,
19839,
6494,
3619,
14192,
3370,
1006,
1007,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/DelegatingDecompressorFrameListener.java | DelegatingDecompressorFrameListener.newContentDecompressor | protected EmbeddedChannel newContentDecompressor(final ChannelHandlerContext ctx, CharSequence contentEncoding)
throws Http2Exception {
if (GZIP.contentEqualsIgnoreCase(contentEncoding) || X_GZIP.contentEqualsIgnoreCase(contentEncoding)) {
return new EmbeddedChannel(ctx.channel().id(), ctx.channel().metadata().hasDisconnect(),
ctx.channel().config(), ZlibCodecFactory.newZlibDecoder(ZlibWrapper.GZIP));
}
if (DEFLATE.contentEqualsIgnoreCase(contentEncoding) || X_DEFLATE.contentEqualsIgnoreCase(contentEncoding)) {
final ZlibWrapper wrapper = strict ? ZlibWrapper.ZLIB : ZlibWrapper.ZLIB_OR_NONE;
// To be strict, 'deflate' means ZLIB, but some servers were not implemented correctly.
return new EmbeddedChannel(ctx.channel().id(), ctx.channel().metadata().hasDisconnect(),
ctx.channel().config(), ZlibCodecFactory.newZlibDecoder(wrapper));
}
// 'identity' or unsupported
return null;
} | java | protected EmbeddedChannel newContentDecompressor(final ChannelHandlerContext ctx, CharSequence contentEncoding)
throws Http2Exception {
if (GZIP.contentEqualsIgnoreCase(contentEncoding) || X_GZIP.contentEqualsIgnoreCase(contentEncoding)) {
return new EmbeddedChannel(ctx.channel().id(), ctx.channel().metadata().hasDisconnect(),
ctx.channel().config(), ZlibCodecFactory.newZlibDecoder(ZlibWrapper.GZIP));
}
if (DEFLATE.contentEqualsIgnoreCase(contentEncoding) || X_DEFLATE.contentEqualsIgnoreCase(contentEncoding)) {
final ZlibWrapper wrapper = strict ? ZlibWrapper.ZLIB : ZlibWrapper.ZLIB_OR_NONE;
// To be strict, 'deflate' means ZLIB, but some servers were not implemented correctly.
return new EmbeddedChannel(ctx.channel().id(), ctx.channel().metadata().hasDisconnect(),
ctx.channel().config(), ZlibCodecFactory.newZlibDecoder(wrapper));
}
// 'identity' or unsupported
return null;
} | [
"protected",
"EmbeddedChannel",
"newContentDecompressor",
"(",
"final",
"ChannelHandlerContext",
"ctx",
",",
"CharSequence",
"contentEncoding",
")",
"throws",
"Http2Exception",
"{",
"if",
"(",
"GZIP",
".",
"contentEqualsIgnoreCase",
"(",
"contentEncoding",
")",
"||",
"X... | Returns a new {@link EmbeddedChannel} that decodes the HTTP2 message content encoded in the specified
{@code contentEncoding}.
@param contentEncoding the value of the {@code content-encoding} header
@return a new {@link ByteToMessageDecoder} if the specified encoding is supported. {@code null} otherwise
(alternatively, you can throw a {@link Http2Exception} to block unknown encoding).
@throws Http2Exception If the specified encoding is not not supported and warrants an exception | [
"Returns",
"a",
"new",
"{",
"@link",
"EmbeddedChannel",
"}",
"that",
"decodes",
"the",
"HTTP2",
"message",
"content",
"encoded",
"in",
"the",
"specified",
"{",
"@code",
"contentEncoding",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/DelegatingDecompressorFrameListener.java#L166-L180 | train | Create an EmbeddedChannel based on the content encoding. | [
30522,
5123,
11157,
26058,
2047,
8663,
6528,
2102,
3207,
9006,
20110,
2953,
1006,
2345,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
25869,
3366,
4226,
5897,
4180,
2368,
3597,
4667,
1007,
11618,
8299,
2475,
10288,
24422,
1063,
2065,
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/SqlConnRunner.java | SqlConnRunner.findBy | public List<Entity> findBy(Connection conn, String tableName, String field, Object value) throws SQLException{
return findAll(conn, Entity.create(tableName).set(field, value));
} | java | public List<Entity> findBy(Connection conn, String tableName, String field, Object value) throws SQLException{
return findAll(conn, Entity.create(tableName).set(field, value));
} | [
"public",
"List",
"<",
"Entity",
">",
"findBy",
"(",
"Connection",
"conn",
",",
"String",
"tableName",
",",
"String",
"field",
",",
"Object",
"value",
")",
"throws",
"SQLException",
"{",
"return",
"findAll",
"(",
"conn",
",",
"Entity",
".",
"create",
"(",
... | 根据某个字段名条件查询数据列表,返回所有字段
@param conn 数据库连接对象
@param tableName 表名
@param field 字段名
@param value 字段值
@return 数据对象列表
@throws SQLException SQL执行异常 | [
"根据某个字段名条件查询数据列表,返回所有字段"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L399-L401 | train | Find by tableName field and value | [
30522,
2270,
2862,
1026,
9178,
1028,
2424,
3762,
1006,
4434,
9530,
2078,
1010,
5164,
2795,
18442,
1010,
5164,
2492,
1010,
4874,
3643,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
2424,
8095,
1006,
9530,
2078,
1010,
9178,
1012,
3443,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/instance/Instance.java | Instance.allocateSimpleSlot | public SimpleSlot allocateSimpleSlot() throws InstanceDiedException {
synchronized (instanceLock) {
if (isDead) {
throw new InstanceDiedException(this);
}
Integer nextSlot = availableSlots.poll();
if (nextSlot == null) {
return null;
}
else {
SimpleSlot slot = new SimpleSlot(this, location, nextSlot, taskManagerGateway);
allocatedSlots.add(slot);
return slot;
}
}
} | java | public SimpleSlot allocateSimpleSlot() throws InstanceDiedException {
synchronized (instanceLock) {
if (isDead) {
throw new InstanceDiedException(this);
}
Integer nextSlot = availableSlots.poll();
if (nextSlot == null) {
return null;
}
else {
SimpleSlot slot = new SimpleSlot(this, location, nextSlot, taskManagerGateway);
allocatedSlots.add(slot);
return slot;
}
}
} | [
"public",
"SimpleSlot",
"allocateSimpleSlot",
"(",
")",
"throws",
"InstanceDiedException",
"{",
"synchronized",
"(",
"instanceLock",
")",
"{",
"if",
"(",
"isDead",
")",
"{",
"throw",
"new",
"InstanceDiedException",
"(",
"this",
")",
";",
"}",
"Integer",
"nextSlo... | Allocates a simple slot on this TaskManager instance. This method returns {@code null}, if no slot
is available at the moment.
@return A simple slot that represents a task slot on this TaskManager instance, or null, if the
TaskManager instance has no more slots available.
@throws InstanceDiedException Thrown if the instance is no longer alive by the time the
slot is allocated. | [
"Allocates",
"a",
"simple",
"slot",
"on",
"this",
"TaskManager",
"instance",
".",
"This",
"method",
"returns",
"{",
"@code",
"null",
"}",
"if",
"no",
"slot",
"is",
"available",
"at",
"the",
"moment",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/Instance.java#L220-L236 | train | Allocate a SimpleSlot. | [
30522,
2270,
3722,
14540,
4140,
2035,
24755,
4570,
5714,
21112,
10994,
1006,
1007,
11618,
6013,
10265,
3207,
2595,
24422,
1063,
25549,
1006,
6013,
7878,
1007,
1063,
2065,
1006,
2003,
3207,
4215,
1007,
1063,
5466,
2047,
6013,
10265,
3207,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java | ExecutionGraph.updateState | public boolean updateState(TaskExecutionState state) {
assertRunningInJobMasterMainThread();
final Execution attempt = currentExecutions.get(state.getID());
if (attempt != null) {
try {
Map<String, Accumulator<?, ?>> accumulators;
switch (state.getExecutionState()) {
case RUNNING:
return attempt.switchToRunning();
case FINISHED:
// this deserialization is exception-free
accumulators = deserializeAccumulators(state);
attempt.markFinished(accumulators, state.getIOMetrics());
return true;
case CANCELED:
// this deserialization is exception-free
accumulators = deserializeAccumulators(state);
attempt.completeCancelling(accumulators, state.getIOMetrics());
return true;
case FAILED:
// this deserialization is exception-free
accumulators = deserializeAccumulators(state);
attempt.markFailed(state.getError(userClassLoader), accumulators, state.getIOMetrics());
return true;
default:
// we mark as failed and return false, which triggers the TaskManager
// to remove the task
attempt.fail(new Exception("TaskManager sent illegal state update: " + state.getExecutionState()));
return false;
}
}
catch (Throwable t) {
ExceptionUtils.rethrowIfFatalErrorOrOOM(t);
// failures during updates leave the ExecutionGraph inconsistent
failGlobal(t);
return false;
}
}
else {
return false;
}
} | java | public boolean updateState(TaskExecutionState state) {
assertRunningInJobMasterMainThread();
final Execution attempt = currentExecutions.get(state.getID());
if (attempt != null) {
try {
Map<String, Accumulator<?, ?>> accumulators;
switch (state.getExecutionState()) {
case RUNNING:
return attempt.switchToRunning();
case FINISHED:
// this deserialization is exception-free
accumulators = deserializeAccumulators(state);
attempt.markFinished(accumulators, state.getIOMetrics());
return true;
case CANCELED:
// this deserialization is exception-free
accumulators = deserializeAccumulators(state);
attempt.completeCancelling(accumulators, state.getIOMetrics());
return true;
case FAILED:
// this deserialization is exception-free
accumulators = deserializeAccumulators(state);
attempt.markFailed(state.getError(userClassLoader), accumulators, state.getIOMetrics());
return true;
default:
// we mark as failed and return false, which triggers the TaskManager
// to remove the task
attempt.fail(new Exception("TaskManager sent illegal state update: " + state.getExecutionState()));
return false;
}
}
catch (Throwable t) {
ExceptionUtils.rethrowIfFatalErrorOrOOM(t);
// failures during updates leave the ExecutionGraph inconsistent
failGlobal(t);
return false;
}
}
else {
return false;
}
} | [
"public",
"boolean",
"updateState",
"(",
"TaskExecutionState",
"state",
")",
"{",
"assertRunningInJobMasterMainThread",
"(",
")",
";",
"final",
"Execution",
"attempt",
"=",
"currentExecutions",
".",
"get",
"(",
"state",
".",
"getID",
"(",
")",
")",
";",
"if",
... | Updates the state of one of the ExecutionVertex's Execution attempts.
If the new status if "FINISHED", this also updates the accumulators.
@param state The state update.
@return True, if the task update was properly applied, false, if the execution attempt was not found. | [
"Updates",
"the",
"state",
"of",
"one",
"of",
"the",
"ExecutionVertex",
"s",
"Execution",
"attempts",
".",
"If",
"the",
"new",
"status",
"if",
"FINISHED",
"this",
"also",
"updates",
"the",
"accumulators",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java#L1542-L1590 | train | Update the state of the task. | [
30522,
2270,
22017,
20898,
14409,
12259,
1006,
4708,
10288,
8586,
13700,
9153,
2618,
2110,
1007,
1063,
20865,
15532,
5582,
2378,
5558,
25526,
24268,
24238,
2705,
16416,
2094,
1006,
1007,
1025,
2345,
7781,
3535,
1027,
2783,
10288,
8586,
13700,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/AbstractMergeIterator.java | AbstractMergeIterator.crossSecond1withNValues | private void crossSecond1withNValues(T2 val1, T1 firstValN,
Iterator<T1> valsN, FlatJoinFunction<T1, T2, O> joinFunction, Collector<O> collector) throws Exception {
T2 copy2 = createCopy(serializer2, val1, this.copy2);
joinFunction.join(firstValN, copy2, collector);
// set copy and join first element
boolean more = true;
do {
final T1 nRec = valsN.next();
if (valsN.hasNext()) {
copy2 = createCopy(serializer2, val1, this.copy2);
joinFunction.join(nRec, copy2, collector);
} else {
joinFunction.join(nRec, val1, collector);
more = false;
}
}
while (more);
} | java | private void crossSecond1withNValues(T2 val1, T1 firstValN,
Iterator<T1> valsN, FlatJoinFunction<T1, T2, O> joinFunction, Collector<O> collector) throws Exception {
T2 copy2 = createCopy(serializer2, val1, this.copy2);
joinFunction.join(firstValN, copy2, collector);
// set copy and join first element
boolean more = true;
do {
final T1 nRec = valsN.next();
if (valsN.hasNext()) {
copy2 = createCopy(serializer2, val1, this.copy2);
joinFunction.join(nRec, copy2, collector);
} else {
joinFunction.join(nRec, val1, collector);
more = false;
}
}
while (more);
} | [
"private",
"void",
"crossSecond1withNValues",
"(",
"T2",
"val1",
",",
"T1",
"firstValN",
",",
"Iterator",
"<",
"T1",
">",
"valsN",
",",
"FlatJoinFunction",
"<",
"T1",
",",
"T2",
",",
"O",
">",
"joinFunction",
",",
"Collector",
"<",
"O",
">",
"collector",
... | Crosses a single value from the second side with N values, all sharing a common key.
Effectively realizes a <i>N:1</i> join.
@param val1 The value form the <i>1</i> side.
@param firstValN The first of the values from the <i>N</i> side.
@param valsN Iterator over remaining <i>N</i> side values.
@throws Exception Forwards all exceptions thrown by the stub. | [
"Crosses",
"a",
"single",
"value",
"from",
"the",
"second",
"side",
"with",
"N",
"values",
"all",
"sharing",
"a",
"common",
"key",
".",
"Effectively",
"realizes",
"a",
"<i",
">",
"N",
":",
"1<",
"/",
"i",
">",
"join",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/AbstractMergeIterator.java#L200-L219 | train | Cross second with N values. | [
30522,
2797,
11675,
2892,
3366,
8663,
2094,
2487,
24415,
30524,
1026,
1051,
1028,
10018,
1007,
11618,
6453,
1063,
1056,
2475,
6100,
2475,
1027,
3443,
3597,
7685,
1006,
7642,
17629,
2475,
1010,
11748,
2487,
1010,
2023,
1012,
6100,
2475,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodec.java | Http2FrameCodec.userEventTriggered | @Override
public final void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
if (evt == Http2ConnectionPrefaceAndSettingsFrameWrittenEvent.INSTANCE) {
// The user event implies that we are on the client.
tryExpandConnectionFlowControlWindow(connection());
} else if (evt instanceof UpgradeEvent) {
UpgradeEvent upgrade = (UpgradeEvent) evt;
try {
onUpgradeEvent(ctx, upgrade.retain());
Http2Stream stream = connection().stream(HTTP_UPGRADE_STREAM_ID);
if (stream.getProperty(streamKey) == null) {
// TODO: improve handler/stream lifecycle so that stream isn't active before handler added.
// The stream was already made active, but ctx may have been null so it wasn't initialized.
// https://github.com/netty/netty/issues/4942
onStreamActive0(stream);
}
upgrade.upgradeRequest().headers().setInt(
HttpConversionUtil.ExtensionHeaderNames.STREAM_ID.text(), HTTP_UPGRADE_STREAM_ID);
stream.setProperty(upgradeKey, true);
InboundHttpToHttp2Adapter.handle(
ctx, connection(), decoder().frameListener(), upgrade.upgradeRequest().retain());
} finally {
upgrade.release();
}
return;
}
super.userEventTriggered(ctx, evt);
} | java | @Override
public final void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
if (evt == Http2ConnectionPrefaceAndSettingsFrameWrittenEvent.INSTANCE) {
// The user event implies that we are on the client.
tryExpandConnectionFlowControlWindow(connection());
} else if (evt instanceof UpgradeEvent) {
UpgradeEvent upgrade = (UpgradeEvent) evt;
try {
onUpgradeEvent(ctx, upgrade.retain());
Http2Stream stream = connection().stream(HTTP_UPGRADE_STREAM_ID);
if (stream.getProperty(streamKey) == null) {
// TODO: improve handler/stream lifecycle so that stream isn't active before handler added.
// The stream was already made active, but ctx may have been null so it wasn't initialized.
// https://github.com/netty/netty/issues/4942
onStreamActive0(stream);
}
upgrade.upgradeRequest().headers().setInt(
HttpConversionUtil.ExtensionHeaderNames.STREAM_ID.text(), HTTP_UPGRADE_STREAM_ID);
stream.setProperty(upgradeKey, true);
InboundHttpToHttp2Adapter.handle(
ctx, connection(), decoder().frameListener(), upgrade.upgradeRequest().retain());
} finally {
upgrade.release();
}
return;
}
super.userEventTriggered(ctx, evt);
} | [
"@",
"Override",
"public",
"final",
"void",
"userEventTriggered",
"(",
"ChannelHandlerContext",
"ctx",
",",
"Object",
"evt",
")",
"throws",
"Exception",
"{",
"if",
"(",
"evt",
"==",
"Http2ConnectionPrefaceAndSettingsFrameWrittenEvent",
".",
"INSTANCE",
")",
"{",
"//... | Handles the cleartext HTTP upgrade event. If an upgrade occurred, sends a simple response via
HTTP/2 on stream 1 (the stream specifically reserved for cleartext HTTP upgrade). | [
"Handles",
"the",
"cleartext",
"HTTP",
"upgrade",
"event",
".",
"If",
"an",
"upgrade",
"occurred",
"sends",
"a",
"simple",
"response",
"via",
"HTTP",
"/",
"2",
"on",
"stream",
"1",
"(",
"the",
"stream",
"specifically",
"reserved",
"for",
"cleartext",
"HTTP",... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodec.java#L239-L266 | train | Override to handle upgrade events. | [
30522,
1030,
2058,
15637,
2270,
2345,
11675,
5310,
18697,
3372,
18886,
13327,
2098,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
4874,
23408,
2102,
1007,
11618,
6453,
1063,
2065,
1006,
23408,
2102,
1027,
30524,
2008,
2057,
2024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/trainer/ArcEagerBeamTrainer.java | ArcEagerBeamTrainer.beamSortOneThread | private void beamSortOneThread(ArrayList<Configuration> beam, TreeSet<BeamElement> beamPreserver)
{
for (int b = 0; b < beam.size(); b++)
{
Configuration configuration = beam.get(b);
State currentState = configuration.state;
float prevScore = configuration.score;
boolean canShift = ArcEager.canDo(Action.Shift, currentState);
boolean canReduce = ArcEager.canDo(Action.Reduce, currentState);
boolean canRightArc = ArcEager.canDo(Action.RightArc, currentState);
boolean canLeftArc = ArcEager.canDo(Action.LeftArc, currentState);
Object[] features = FeatureExtractor.extractAllParseFeatures(configuration, featureLength);
if (canShift)
{
float score = classifier.shiftScore(features, false);
float addedScore = score + prevScore;
addToBeam(beamPreserver, b, addedScore, 0, -1, options.beamWidth);
}
if (canReduce)
{
float score = classifier.reduceScore(features, false);
float addedScore = score + prevScore;
addToBeam(beamPreserver, b, addedScore, 1, -1, options.beamWidth);
}
if (canRightArc)
{
float[] rightArcScores = classifier.rightArcScores(features, false);
for (int dependency : dependencyRelations)
{
float score = rightArcScores[dependency];
float addedScore = score + prevScore;
addToBeam(beamPreserver, b, addedScore, 2, dependency, options.beamWidth);
}
}
if (canLeftArc)
{
float[] leftArcScores = classifier.leftArcScores(features, false);
for (int dependency : dependencyRelations)
{
float score = leftArcScores[dependency];
float addedScore = score + prevScore;
addToBeam(beamPreserver, b, addedScore, 3, dependency, options.beamWidth);
}
}
}
} | java | private void beamSortOneThread(ArrayList<Configuration> beam, TreeSet<BeamElement> beamPreserver)
{
for (int b = 0; b < beam.size(); b++)
{
Configuration configuration = beam.get(b);
State currentState = configuration.state;
float prevScore = configuration.score;
boolean canShift = ArcEager.canDo(Action.Shift, currentState);
boolean canReduce = ArcEager.canDo(Action.Reduce, currentState);
boolean canRightArc = ArcEager.canDo(Action.RightArc, currentState);
boolean canLeftArc = ArcEager.canDo(Action.LeftArc, currentState);
Object[] features = FeatureExtractor.extractAllParseFeatures(configuration, featureLength);
if (canShift)
{
float score = classifier.shiftScore(features, false);
float addedScore = score + prevScore;
addToBeam(beamPreserver, b, addedScore, 0, -1, options.beamWidth);
}
if (canReduce)
{
float score = classifier.reduceScore(features, false);
float addedScore = score + prevScore;
addToBeam(beamPreserver, b, addedScore, 1, -1, options.beamWidth);
}
if (canRightArc)
{
float[] rightArcScores = classifier.rightArcScores(features, false);
for (int dependency : dependencyRelations)
{
float score = rightArcScores[dependency];
float addedScore = score + prevScore;
addToBeam(beamPreserver, b, addedScore, 2, dependency, options.beamWidth);
}
}
if (canLeftArc)
{
float[] leftArcScores = classifier.leftArcScores(features, false);
for (int dependency : dependencyRelations)
{
float score = leftArcScores[dependency];
float addedScore = score + prevScore;
addToBeam(beamPreserver, b, addedScore, 3, dependency, options.beamWidth);
}
}
}
} | [
"private",
"void",
"beamSortOneThread",
"(",
"ArrayList",
"<",
"Configuration",
">",
"beam",
",",
"TreeSet",
"<",
"BeamElement",
">",
"beamPreserver",
")",
"{",
"for",
"(",
"int",
"b",
"=",
"0",
";",
"b",
"<",
"beam",
".",
"size",
"(",
")",
";",
"b",
... | 每个beam元素执行所有可能的动作一次
@param beam
@param beamPreserver
@throws Exception | [
"每个beam元素执行所有可能的动作一次"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/perceptron/transition/trainer/ArcEagerBeamTrainer.java#L526-L573 | train | Sort one thread of beam. | [
30522,
2797,
11675,
13110,
11589,
5643,
2705,
16416,
2094,
1006,
9140,
9863,
1026,
9563,
1028,
7504,
1010,
3628,
3388,
1026,
7504,
12260,
3672,
1028,
7504,
28994,
2121,
6299,
1007,
1063,
2005,
1006,
20014,
1038,
1027,
1014,
1025,
1038,
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... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/function/FunctionUtils.java | FunctionUtils.nullFn | @SuppressWarnings("unchecked")
public static <T> Function<T, Void> nullFn() {
return (Function<T, Void>) NULL_FN;
} | java | @SuppressWarnings("unchecked")
public static <T> Function<T, Void> nullFn() {
return (Function<T, Void>) NULL_FN;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Function",
"<",
"T",
",",
"Void",
">",
"nullFn",
"(",
")",
"{",
"return",
"(",
"Function",
"<",
"T",
",",
"Void",
">",
")",
"NULL_FN",
";",
"}"
] | Function which returns {@code null} (type: Void).
@param <T> input type
@return Function which returns {@code null}. | [
"Function",
"which",
"returns",
"{",
"@code",
"null",
"}",
"(",
"type",
":",
"Void",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/function/FunctionUtils.java#L46-L49 | train | Returns a function that returns null when the function is null. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
3853,
1026,
1056,
1010,
11675,
1028,
19701,
2546,
2078,
1006,
1007,
1063,
2709,
1006,
3853,
1026,
1056,
1010,
11675,
1028,
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... |
networknt/light-4j | dump/src/main/java/com/networknt/dump/CookiesDumper.java | CookiesDumper.dumpCookies | private void dumpCookies(Map<String, Cookie> cookiesMap, String maskKey) {
cookiesMap.forEach((key, cookie) -> {
if(!config.getRequestFilteredCookies().contains(cookie.getName())) {
List<Map<String, String>> cookieInfoList = new ArrayList<>();
//mask cookieValue
String cookieValue = config.isMaskEnabled() ? Mask.maskRegex(cookie.getValue(), maskKey, cookie.getName()) : cookie.getValue();
cookieInfoList.add(new HashMap<String, String>(){{put(DumpConstants.COOKIE_VALUE, cookieValue);}});
cookieInfoList.add(new HashMap<String, String>(){{put(DumpConstants.COOKIE_DOMAIN, cookie.getDomain());}});
cookieInfoList.add(new HashMap<String, String>(){{put(DumpConstants.COOKIE_PATH, cookie.getPath());}});
cookieInfoList.add(new HashMap<String, String>(){{put(DumpConstants.COOKIE_EXPIRES, cookie.getExpires() == null ? "" : cookie.getExpires().toString());}});
this.cookieMap.put(key, cookieInfoList);
}
});
} | java | private void dumpCookies(Map<String, Cookie> cookiesMap, String maskKey) {
cookiesMap.forEach((key, cookie) -> {
if(!config.getRequestFilteredCookies().contains(cookie.getName())) {
List<Map<String, String>> cookieInfoList = new ArrayList<>();
//mask cookieValue
String cookieValue = config.isMaskEnabled() ? Mask.maskRegex(cookie.getValue(), maskKey, cookie.getName()) : cookie.getValue();
cookieInfoList.add(new HashMap<String, String>(){{put(DumpConstants.COOKIE_VALUE, cookieValue);}});
cookieInfoList.add(new HashMap<String, String>(){{put(DumpConstants.COOKIE_DOMAIN, cookie.getDomain());}});
cookieInfoList.add(new HashMap<String, String>(){{put(DumpConstants.COOKIE_PATH, cookie.getPath());}});
cookieInfoList.add(new HashMap<String, String>(){{put(DumpConstants.COOKIE_EXPIRES, cookie.getExpires() == null ? "" : cookie.getExpires().toString());}});
this.cookieMap.put(key, cookieInfoList);
}
});
} | [
"private",
"void",
"dumpCookies",
"(",
"Map",
"<",
"String",
",",
"Cookie",
">",
"cookiesMap",
",",
"String",
"maskKey",
")",
"{",
"cookiesMap",
".",
"forEach",
"(",
"(",
"key",
",",
"cookie",
")",
"->",
"{",
"if",
"(",
"!",
"config",
".",
"getRequestF... | put cookies info to cookieMap
@param cookiesMap Map of cookies | [
"put",
"cookies",
"info",
"to",
"cookieMap"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/CookiesDumper.java#L61-L74 | train | Dump cookies. | [
30522,
2797,
11675,
15653,
3597,
23212,
2229,
1006,
4949,
1026,
5164,
1010,
17387,
1028,
16324,
2863,
2361,
1010,
5164,
7308,
14839,
1007,
1063,
16324,
2863,
2361,
1012,
18921,
6776,
1006,
1006,
3145,
1010,
17387,
1007,
1011,
1028,
1063,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java | PerceptronClassifier.evaluate | public BinaryClassificationFMeasure evaluate(Instance[] instanceList)
{
int TP = 0, FP = 0, FN = 0;
for (Instance instance : instanceList)
{
int y = model.decode(instance.x);
if (y == 1)
{
if (instance.y == 1)
++TP;
else
++FP;
}
else if (instance.y == 1)
++FN;
}
float p = TP / (float) (TP + FP) * 100;
float r = TP / (float) (TP + FN) * 100;
return new BinaryClassificationFMeasure(p, r, 2 * p * r / (p + r));
} | java | public BinaryClassificationFMeasure evaluate(Instance[] instanceList)
{
int TP = 0, FP = 0, FN = 0;
for (Instance instance : instanceList)
{
int y = model.decode(instance.x);
if (y == 1)
{
if (instance.y == 1)
++TP;
else
++FP;
}
else if (instance.y == 1)
++FN;
}
float p = TP / (float) (TP + FP) * 100;
float r = TP / (float) (TP + FN) * 100;
return new BinaryClassificationFMeasure(p, r, 2 * p * r / (p + r));
} | [
"public",
"BinaryClassificationFMeasure",
"evaluate",
"(",
"Instance",
"[",
"]",
"instanceList",
")",
"{",
"int",
"TP",
"=",
"0",
",",
"FP",
"=",
"0",
",",
"FN",
"=",
"0",
";",
"for",
"(",
"Instance",
"instance",
":",
"instanceList",
")",
"{",
"int",
"... | 评估
@param instanceList
@return | [
"评估"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java#L165-L184 | train | Evaluate the binary classification of the given instance list. | [
30522,
2270,
12441,
26266,
9031,
16715,
5243,
28632,
16157,
1006,
6013,
1031,
1033,
6013,
9863,
1007,
1063,
20014,
1056,
2361,
1027,
1014,
1010,
1042,
2361,
1027,
1014,
1010,
1042,
2078,
1027,
1014,
1025,
2005,
1006,
6013,
6013,
1024,
6013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.pathEquals | public static boolean pathEquals(File file1, File file2) {
if (isWindows()) {
// Windows环境
try {
if (StrUtil.equalsIgnoreCase(file1.getCanonicalPath(), file2.getCanonicalPath())) {
return true;
}
} catch (Exception e) {
if (StrUtil.equalsIgnoreCase(file1.getAbsolutePath(), file2.getAbsolutePath())) {
return true;
}
}
} else {
// 类Unix环境
try {
if (StrUtil.equals(file1.getCanonicalPath(), file2.getCanonicalPath())) {
return true;
}
} catch (Exception e) {
if (StrUtil.equals(file1.getAbsolutePath(), file2.getAbsolutePath())) {
return true;
}
}
}
return false;
} | java | public static boolean pathEquals(File file1, File file2) {
if (isWindows()) {
// Windows环境
try {
if (StrUtil.equalsIgnoreCase(file1.getCanonicalPath(), file2.getCanonicalPath())) {
return true;
}
} catch (Exception e) {
if (StrUtil.equalsIgnoreCase(file1.getAbsolutePath(), file2.getAbsolutePath())) {
return true;
}
}
} else {
// 类Unix环境
try {
if (StrUtil.equals(file1.getCanonicalPath(), file2.getCanonicalPath())) {
return true;
}
} catch (Exception e) {
if (StrUtil.equals(file1.getAbsolutePath(), file2.getAbsolutePath())) {
return true;
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"pathEquals",
"(",
"File",
"file1",
",",
"File",
"file2",
")",
"{",
"if",
"(",
"isWindows",
"(",
")",
")",
"{",
"// Windows环境\r",
"try",
"{",
"if",
"(",
"StrUtil",
".",
"equalsIgnoreCase",
"(",
"file1",
".",
"getCanonicalPath... | 文件路径是否相同<br>
取两个文件的绝对路径比较,在Windows下忽略大小写,在Linux下不忽略。
@param file1 文件1
@param file2 文件2
@return 文件路径是否相同
@since 3.0.9 | [
"文件路径是否相同<br",
">",
"取两个文件的绝对路径比较,在Windows下忽略大小写,在Linux下不忽略。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1432-L1457 | train | Checks if two files are equal. | [
30522,
2270,
10763,
22017,
20898,
4130,
2063,
26426,
2015,
1006,
5371,
5371,
2487,
1010,
5371,
5371,
2475,
1007,
1063,
2065,
1006,
2003,
11101,
15568,
1006,
1007,
1007,
1063,
1013,
1013,
3645,
100,
100,
3046,
1063,
2065,
1006,
2358,
22134,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Snowflake.java | Snowflake.nextId | public synchronized long nextId() {
long timestamp = genTime();
if (timestamp < lastTimestamp) {
// 如果服务器时间有问题(时钟后退) 报错。
throw new IllegalStateException(StrUtil.format("Clock moved backwards. Refusing to generate id for {}ms", lastTimestamp - timestamp));
}
if (lastTimestamp == timestamp) {
sequence = (sequence + 1) & sequenceMask;
if (sequence == 0) {
timestamp = tilNextMillis(lastTimestamp);
}
} else {
sequence = 0L;
}
lastTimestamp = timestamp;
return ((timestamp - twepoch) << timestampLeftShift) | (datacenterId << datacenterIdShift) | (workerId << workerIdShift) | sequence;
} | java | public synchronized long nextId() {
long timestamp = genTime();
if (timestamp < lastTimestamp) {
// 如果服务器时间有问题(时钟后退) 报错。
throw new IllegalStateException(StrUtil.format("Clock moved backwards. Refusing to generate id for {}ms", lastTimestamp - timestamp));
}
if (lastTimestamp == timestamp) {
sequence = (sequence + 1) & sequenceMask;
if (sequence == 0) {
timestamp = tilNextMillis(lastTimestamp);
}
} else {
sequence = 0L;
}
lastTimestamp = timestamp;
return ((timestamp - twepoch) << timestampLeftShift) | (datacenterId << datacenterIdShift) | (workerId << workerIdShift) | sequence;
} | [
"public",
"synchronized",
"long",
"nextId",
"(",
")",
"{",
"long",
"timestamp",
"=",
"genTime",
"(",
")",
";",
"if",
"(",
"timestamp",
"<",
"lastTimestamp",
")",
"{",
"// 如果服务器时间有问题(时钟后退) 报错。\r",
"throw",
"new",
"IllegalStateException",
"(",
"StrUtil",
".",
"f... | 下一个ID
@return ID | [
"下一个ID"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Snowflake.java#L120-L138 | train | Returns the next unique id. | [
30522,
2270,
25549,
2146,
2279,
3593,
1006,
1007,
1063,
2146,
2335,
15464,
2361,
1027,
8991,
7292,
30524,
1013,
1013,
100,
100,
100,
100,
100,
100,
100,
1873,
100,
100,
1006,
100,
100,
100,
100,
1007,
100,
100,
1636,
5466,
2047,
6206,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/math/Combination.java | Combination.selectAll | public List<String[]> selectAll(){
final List<String[]> result = new ArrayList<>((int)countAll(this.datas.length));
for(int i = 1; i <= this.datas.length; i++) {
result.addAll(select(i));
}
return result;
} | java | public List<String[]> selectAll(){
final List<String[]> result = new ArrayList<>((int)countAll(this.datas.length));
for(int i = 1; i <= this.datas.length; i++) {
result.addAll(select(i));
}
return result;
} | [
"public",
"List",
"<",
"String",
"[",
"]",
">",
"selectAll",
"(",
")",
"{",
"final",
"List",
"<",
"String",
"[",
"]",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
"(",
"int",
")",
"countAll",
"(",
"this",
".",
"datas",
".",
"length",
")",
"... | 全组合
@return 全排列结果 | [
"全组合"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/math/Combination.java#L78-L84 | train | Select all the data in the table. | [
30522,
2270,
2862,
1026,
5164,
1031,
1033,
1028,
7276,
8095,
1006,
1007,
1063,
2345,
2862,
1026,
5164,
1031,
1033,
1028,
2765,
1027,
2047,
9140,
9863,
1026,
1028,
1006,
1006,
20014,
1007,
4175,
8095,
1006,
2023,
1012,
2951,
2015,
1012,
30... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Lz4FrameEncoder.java | Lz4FrameEncoder.close | public ChannelFuture close(final ChannelPromise promise) {
ChannelHandlerContext ctx = ctx();
EventExecutor executor = ctx.executor();
if (executor.inEventLoop()) {
return finishEncode(ctx, promise);
} else {
executor.execute(new Runnable() {
@Override
public void run() {
ChannelFuture f = finishEncode(ctx(), promise);
f.addListener(new ChannelPromiseNotifier(promise));
}
});
return promise;
}
} | java | public ChannelFuture close(final ChannelPromise promise) {
ChannelHandlerContext ctx = ctx();
EventExecutor executor = ctx.executor();
if (executor.inEventLoop()) {
return finishEncode(ctx, promise);
} else {
executor.execute(new Runnable() {
@Override
public void run() {
ChannelFuture f = finishEncode(ctx(), promise);
f.addListener(new ChannelPromiseNotifier(promise));
}
});
return promise;
}
} | [
"public",
"ChannelFuture",
"close",
"(",
"final",
"ChannelPromise",
"promise",
")",
"{",
"ChannelHandlerContext",
"ctx",
"=",
"ctx",
"(",
")",
";",
"EventExecutor",
"executor",
"=",
"ctx",
".",
"executor",
"(",
")",
";",
"if",
"(",
"executor",
".",
"inEventL... | Close this {@link Lz4FrameEncoder} and so finish the encoding.
The given {@link ChannelFuture} will be notified once the operation
completes and will also be returned. | [
"Close",
"this",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Lz4FrameEncoder.java#L361-L376 | train | Close the session. | [
30522,
2270,
3149,
11263,
11244,
2485,
1006,
2345,
3149,
21572,
28732,
4872,
1007,
1063,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1027,
14931,
2595,
1006,
1007,
1025,
2724,
10288,
8586,
16161,
2099,
4654,
8586,
16161,
2099,
1027,
14931,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SqlConnRunner.java | SqlConnRunner.insert | public int[] insert(Connection conn, Collection<Entity> records) throws SQLException {
return insert(conn, records.toArray(new Entity[records.size()]));
} | java | public int[] insert(Connection conn, Collection<Entity> records) throws SQLException {
return insert(conn, records.toArray(new Entity[records.size()]));
} | [
"public",
"int",
"[",
"]",
"insert",
"(",
"Connection",
"conn",
",",
"Collection",
"<",
"Entity",
">",
"records",
")",
"throws",
"SQLException",
"{",
"return",
"insert",
"(",
"conn",
",",
"records",
".",
"toArray",
"(",
"new",
"Entity",
"[",
"records",
"... | 批量插入数据<br>
需要注意的是,批量插入每一条数据结构必须一致。批量插入数据时会获取第一条数据的字段结构,之后的数据会按照这个格式插入。<br>
也就是说假如第一条数据只有2个字段,后边数据多于这两个字段的部分将被抛弃。
此方法不会关闭Connection
@param conn 数据库连接
@param records 记录列表,记录KV必须严格一致
@return 插入行数
@throws SQLException SQL执行异常 | [
"批量插入数据<br",
">",
"需要注意的是,批量插入每一条数据结构必须一致。批量插入数据时会获取第一条数据的字段结构,之后的数据会按照这个格式插入。<br",
">",
"也就是说假如第一条数据只有2个字段,后边数据多于这两个字段的部分将被抛弃。",
"此方法不会关闭Connection"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L141-L143 | train | Insert a collection of entities into the database. | [
30522,
2270,
20014,
1031,
1033,
19274,
1006,
4434,
9530,
2078,
1010,
3074,
1026,
9178,
1028,
2636,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
19274,
1006,
9530,
2078,
1010,
2636,
1012,
2000,
2906,
9447,
1006,
2047,
9178,
1031,
2636,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.handleScalarSubQuery | private void handleScalarSubQuery(
SqlSelect parentSelect,
SqlSelect selectItem,
List<SqlNode> expandedSelectItems,
Set<String> aliasList,
List<Map.Entry<String, RelDataType>> fieldList) {
// A scalar sub-query only has one output column.
if (1 != selectItem.getSelectList().size()) {
throw newValidationError(selectItem,
RESOURCE.onlyScalarSubQueryAllowed());
}
// No expansion in this routine just append to list.
expandedSelectItems.add(selectItem);
// Get or generate alias and add to list.
final String alias =
deriveAlias(
selectItem,
aliasList.size());
aliasList.add(alias);
final SelectScope scope = (SelectScope) getWhereScope(parentSelect);
final RelDataType type = deriveType(scope, selectItem);
setValidatedNodeType(selectItem, type);
// we do not want to pass on the RelRecordType returned
// by the sub query. Just the type of the single expression
// in the sub-query select list.
assert type instanceof RelRecordType;
RelRecordType rec = (RelRecordType) type;
RelDataType nodeType = rec.getFieldList().get(0).getType();
nodeType = typeFactory.createTypeWithNullability(nodeType, true);
fieldList.add(Pair.of(alias, nodeType));
} | java | private void handleScalarSubQuery(
SqlSelect parentSelect,
SqlSelect selectItem,
List<SqlNode> expandedSelectItems,
Set<String> aliasList,
List<Map.Entry<String, RelDataType>> fieldList) {
// A scalar sub-query only has one output column.
if (1 != selectItem.getSelectList().size()) {
throw newValidationError(selectItem,
RESOURCE.onlyScalarSubQueryAllowed());
}
// No expansion in this routine just append to list.
expandedSelectItems.add(selectItem);
// Get or generate alias and add to list.
final String alias =
deriveAlias(
selectItem,
aliasList.size());
aliasList.add(alias);
final SelectScope scope = (SelectScope) getWhereScope(parentSelect);
final RelDataType type = deriveType(scope, selectItem);
setValidatedNodeType(selectItem, type);
// we do not want to pass on the RelRecordType returned
// by the sub query. Just the type of the single expression
// in the sub-query select list.
assert type instanceof RelRecordType;
RelRecordType rec = (RelRecordType) type;
RelDataType nodeType = rec.getFieldList().get(0).getType();
nodeType = typeFactory.createTypeWithNullability(nodeType, true);
fieldList.add(Pair.of(alias, nodeType));
} | [
"private",
"void",
"handleScalarSubQuery",
"(",
"SqlSelect",
"parentSelect",
",",
"SqlSelect",
"selectItem",
",",
"List",
"<",
"SqlNode",
">",
"expandedSelectItems",
",",
"Set",
"<",
"String",
">",
"aliasList",
",",
"List",
"<",
"Map",
".",
"Entry",
"<",
"Stri... | Processes SubQuery found in Select list. Checks that is actually Scalar
sub-query and makes proper entries in each of the 3 lists used to create
the final rowType entry.
@param parentSelect base SqlSelect item
@param selectItem child SqlSelect from select list
@param expandedSelectItems Select items after processing
@param aliasList built from user or system values
@param fieldList Built up entries for each select list entry | [
"Processes",
"SubQuery",
"found",
"in",
"Select",
"list",
".",
"Checks",
"that",
"is",
"actually",
"Scalar",
"sub",
"-",
"query",
"and",
"makes",
"proper",
"entries",
"in",
"each",
"of",
"the",
"3",
"lists",
"used",
"to",
"create",
"the",
"final",
"rowType... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L4129-L4164 | train | Handle a scalar sub - query. | [
30522,
2797,
11675,
16024,
25015,
2869,
12083,
4226,
2854,
1006,
29296,
11246,
22471,
3008,
12260,
6593,
1010,
29296,
11246,
22471,
7276,
4221,
2213,
1010,
2862,
1026,
29296,
3630,
3207,
1028,
4423,
11246,
22471,
4221,
5244,
1010,
2275,
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/bean/BeanUtil.java | BeanUtil.getPropertyDescriptorMap | public static Map<String, PropertyDescriptor> getPropertyDescriptorMap(Class<?> clazz, boolean ignoreCase) throws BeanException {
Map<String, PropertyDescriptor> map = BeanInfoCache.INSTANCE.getPropertyDescriptorMap(clazz, ignoreCase);
if (null == map) {
map = internalGetPropertyDescriptorMap(clazz, ignoreCase);
BeanInfoCache.INSTANCE.putPropertyDescriptorMap(clazz, map, ignoreCase);
}
return map;
} | java | public static Map<String, PropertyDescriptor> getPropertyDescriptorMap(Class<?> clazz, boolean ignoreCase) throws BeanException {
Map<String, PropertyDescriptor> map = BeanInfoCache.INSTANCE.getPropertyDescriptorMap(clazz, ignoreCase);
if (null == map) {
map = internalGetPropertyDescriptorMap(clazz, ignoreCase);
BeanInfoCache.INSTANCE.putPropertyDescriptorMap(clazz, map, ignoreCase);
}
return map;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"PropertyDescriptor",
">",
"getPropertyDescriptorMap",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"boolean",
"ignoreCase",
")",
"throws",
"BeanException",
"{",
"Map",
"<",
"String",
",",
"PropertyDescriptor",
">",
... | 获得字段名和字段描述Map,获得的结果会缓存在 {@link BeanInfoCache}中
@param clazz Bean类
@param ignoreCase 是否忽略大小写
@return 字段名和字段描述Map
@throws BeanException 获取属性异常 | [
"获得字段名和字段描述Map,获得的结果会缓存在",
"{",
"@link",
"BeanInfoCache",
"}",
"中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L192-L199 | train | Returns a map of property descriptors for the given class ignoring case. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
3200,
6155,
23235,
2953,
1028,
2131,
21572,
4842,
3723,
6155,
23235,
2953,
2863,
2361,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1010,
22017,
20898,
8568,
18382,
1007,
11618,
14068,
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... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java | StyleUtil.setBorder | public static CellStyle setBorder(CellStyle cellStyle, BorderStyle borderSize, IndexedColors colorIndex) {
cellStyle.setBorderBottom(borderSize);
cellStyle.setBottomBorderColor(colorIndex.index);
cellStyle.setBorderLeft(borderSize);
cellStyle.setLeftBorderColor(colorIndex.index);
cellStyle.setBorderRight(borderSize);
cellStyle.setRightBorderColor(colorIndex.index);
cellStyle.setBorderTop(borderSize);
cellStyle.setTopBorderColor(colorIndex.index);
return cellStyle;
} | java | public static CellStyle setBorder(CellStyle cellStyle, BorderStyle borderSize, IndexedColors colorIndex) {
cellStyle.setBorderBottom(borderSize);
cellStyle.setBottomBorderColor(colorIndex.index);
cellStyle.setBorderLeft(borderSize);
cellStyle.setLeftBorderColor(colorIndex.index);
cellStyle.setBorderRight(borderSize);
cellStyle.setRightBorderColor(colorIndex.index);
cellStyle.setBorderTop(borderSize);
cellStyle.setTopBorderColor(colorIndex.index);
return cellStyle;
} | [
"public",
"static",
"CellStyle",
"setBorder",
"(",
"CellStyle",
"cellStyle",
",",
"BorderStyle",
"borderSize",
",",
"IndexedColors",
"colorIndex",
")",
"{",
"cellStyle",
".",
"setBorderBottom",
"(",
"borderSize",
")",
";",
"cellStyle",
".",
"setBottomBorderColor",
"... | 设置cell的四个边框粗细和颜色
@param cellStyle {@link CellStyle}
@param borderSize 边框粗细{@link BorderStyle}枚举
@param colorIndex 颜色的short值
@return {@link CellStyle} | [
"设置cell的四个边框粗细和颜色"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java#L69-L83 | train | Sets the border of the cellStyle. | [
30522,
2270,
10763,
4442,
27983,
2275,
12821,
4063,
1006,
4442,
27983,
4442,
27983,
1010,
6645,
27983,
6645,
4697,
1010,
25331,
18717,
2015,
3609,
22254,
10288,
1007,
1063,
4442,
27983,
1012,
2275,
12821,
4063,
18384,
20389,
1006,
6645,
4697,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/InputGateMetrics.java | InputGateMetrics.refreshAndGetTotal | long refreshAndGetTotal() {
long total = 0;
for (InputChannel channel : inputGate.getInputChannels().values()) {
if (channel instanceof RemoteInputChannel) {
RemoteInputChannel rc = (RemoteInputChannel) channel;
total += rc.unsynchronizedGetNumberOfQueuedBuffers();
}
}
return total;
} | java | long refreshAndGetTotal() {
long total = 0;
for (InputChannel channel : inputGate.getInputChannels().values()) {
if (channel instanceof RemoteInputChannel) {
RemoteInputChannel rc = (RemoteInputChannel) channel;
total += rc.unsynchronizedGetNumberOfQueuedBuffers();
}
}
return total;
} | [
"long",
"refreshAndGetTotal",
"(",
")",
"{",
"long",
"total",
"=",
"0",
";",
"for",
"(",
"InputChannel",
"channel",
":",
"inputGate",
".",
"getInputChannels",
"(",
")",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"channel",
"instanceof",
"RemoteInputChan... | Iterates over all input channels and collects the total number of queued buffers in a
best-effort way.
@return total number of queued buffers | [
"Iterates",
"over",
"all",
"input",
"channels",
"and",
"collects",
"the",
"total",
"number",
"of",
"queued",
"buffers",
"in",
"a",
"best",
"-",
"effort",
"way",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/InputGateMetrics.java#L51-L63 | train | This method is used to refresh the internal state of the input gate and return the total number of queued buffers in the input gate. | [
30522,
2146,
25416,
21898,
5685,
18150,
3406,
9080,
1006,
1007,
1063,
2146,
2561,
1027,
1014,
1025,
2005,
1006,
7953,
26058,
3149,
1024,
7953,
5867,
1012,
2131,
2378,
18780,
26058,
2015,
1006,
1007,
1012,
5300,
1006,
1007,
1007,
1063,
2065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.isBirthday | public static boolean isBirthday(int year, int month, int day) {
// 验证年
int thisYear = DateUtil.thisYear();
if (year < 1900 || year > thisYear) {
return false;
}
// 验证月
if (month < 1 || month > 12) {
return false;
}
// 验证日
if (day < 1 || day > 31) {
return false;
}
if ((month == 4 || month == 6 || month == 9 || month == 11) && day == 31) {
return false;
}
if (month == 2) {
if (day > 29 || (day == 29 && false == DateUtil.isLeapYear(year))) {
return false;
}
}
return true;
} | java | public static boolean isBirthday(int year, int month, int day) {
// 验证年
int thisYear = DateUtil.thisYear();
if (year < 1900 || year > thisYear) {
return false;
}
// 验证月
if (month < 1 || month > 12) {
return false;
}
// 验证日
if (day < 1 || day > 31) {
return false;
}
if ((month == 4 || month == 6 || month == 9 || month == 11) && day == 31) {
return false;
}
if (month == 2) {
if (day > 29 || (day == 29 && false == DateUtil.isLeapYear(year))) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isBirthday",
"(",
"int",
"year",
",",
"int",
"month",
",",
"int",
"day",
")",
"{",
"// 验证年\r",
"int",
"thisYear",
"=",
"DateUtil",
".",
"thisYear",
"(",
")",
";",
"if",
"(",
"year",
"<",
"1900",
"||",
"year",
">",
"thi... | 验证是否为生日
@param year 年,从1900年开始计算
@param month 月,从1开始计数
@param day 日,从1开始计数
@return 是否为生日 | [
"验证是否为生日"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L720-L745 | train | Returns true if the given date is a birthday of the specified year month and day. | [
30522,
2270,
10763,
22017,
20898,
2003,
17706,
2705,
10259,
1006,
20014,
2095,
1010,
20014,
3204,
1010,
20014,
2154,
1007,
1063,
1013,
1013,
100,
100,
1840,
20014,
2023,
29100,
1027,
3058,
21823,
2140,
1012,
2023,
29100,
1006,
1007,
1025,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/cluster/Cluster.java | Cluster.remove_document | void remove_document(Document doc)
{
for (Document<K> document : documents_)
{
if (document.equals(doc))
{
remove_document(doc);
return;
}
}
} | java | void remove_document(Document doc)
{
for (Document<K> document : documents_)
{
if (document.equals(doc))
{
remove_document(doc);
return;
}
}
} | [
"void",
"remove_document",
"(",
"Document",
"doc",
")",
"{",
"for",
"(",
"Document",
"<",
"K",
">",
"document",
":",
"documents_",
")",
"{",
"if",
"(",
"document",
".",
"equals",
"(",
"doc",
")",
")",
"{",
"remove_document",
"(",
"doc",
")",
";",
"re... | Remove a document from this cluster.
@param doc the pointer of a document object | [
"Remove",
"a",
"document",
"from",
"this",
"cluster",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/Cluster.java#L140-L150 | train | Remove a document from the list of documents_. | [
30522,
11675,
6366,
1035,
6254,
1006,
6254,
9986,
1007,
1063,
2005,
1006,
6254,
1026,
1047,
1028,
6254,
1024,
5491,
1035,
1007,
1063,
2065,
1006,
6254,
1012,
19635,
1006,
9986,
1007,
1007,
1063,
6366,
1035,
6254,
1006,
9986,
1007,
1025,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/PatternPool.java | PatternPool.remove | public static Pattern remove(String regex, int flags) {
return POOL.remove(new RegexWithFlag(regex, flags));
} | java | public static Pattern remove(String regex, int flags) {
return POOL.remove(new RegexWithFlag(regex, flags));
} | [
"public",
"static",
"Pattern",
"remove",
"(",
"String",
"regex",
",",
"int",
"flags",
")",
"{",
"return",
"POOL",
".",
"remove",
"(",
"new",
"RegexWithFlag",
"(",
"regex",
",",
"flags",
")",
")",
";",
"}"
] | 移除缓存
@param regex 正则
@param flags 标识
@return 移除的{@link Pattern},可能为{@code null} | [
"移除缓存"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/PatternPool.java#L100-L102 | train | Returns a new Pattern that matches the given regular expression with the given flags. | [
30522,
2270,
10763,
5418,
6366,
1006,
5164,
19723,
10288,
1010,
20014,
9245,
1007,
1063,
2709,
4770,
1012,
6366,
1006,
2047,
19723,
10288,
24415,
10258,
8490,
1006,
19723,
10288,
1010,
9245,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.write | public static void write(Node node, OutputStream out, String charset, int indent) {
transform(new DOMSource(node), new StreamResult(out), charset, indent);
} | java | public static void write(Node node, OutputStream out, String charset, int indent) {
transform(new DOMSource(node), new StreamResult(out), charset, indent);
} | [
"public",
"static",
"void",
"write",
"(",
"Node",
"node",
",",
"OutputStream",
"out",
",",
"String",
"charset",
",",
"int",
"indent",
")",
"{",
"transform",
"(",
"new",
"DOMSource",
"(",
"node",
")",
",",
"new",
"StreamResult",
"(",
"out",
")",
",",
"c... | 将XML文档写出
@param node {@link Node} XML文档节点或文档本身
@param out 写出的Writer,Writer决定了输出XML的编码
@param charset 编码
@param indent 格式化输出中缩进量,小于1表示不格式化输出
@since 4.0.8 | [
"将XML文档写出"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L337-L339 | train | Write a DOM node to an output stream. | [
30522,
2270,
10763,
11675,
4339,
1006,
13045,
13045,
1010,
27852,
25379,
2041,
1010,
5164,
25869,
13462,
1010,
20014,
27427,
4765,
1007,
1063,
10938,
1006,
2047,
14383,
6499,
3126,
3401,
1006,
13045,
1007,
1010,
2047,
5460,
6072,
11314,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.writeBytes | public static File writeBytes(byte[] data, File dest, int off, int len, boolean isAppend) throws IORuntimeException {
return FileWriter.create(dest).write(data, off, len, isAppend);
} | java | public static File writeBytes(byte[] data, File dest, int off, int len, boolean isAppend) throws IORuntimeException {
return FileWriter.create(dest).write(data, off, len, isAppend);
} | [
"public",
"static",
"File",
"writeBytes",
"(",
"byte",
"[",
"]",
"data",
",",
"File",
"dest",
",",
"int",
"off",
",",
"int",
"len",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
"(",
"dest",
... | 写入数据到文件
@param data 数据
@param dest 目标文件
@param off 数据开始位置
@param len 数据长度
@param isAppend 是否追加模式
@return 目标文件
@throws IORuntimeException IO异常 | [
"写入数据到文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3141-L3143 | train | Write a byte array to a file. | [
30522,
2270,
10763,
5371,
4339,
3762,
4570,
1006,
24880,
1031,
1033,
2951,
1010,
5371,
4078,
2102,
1010,
20014,
2125,
1010,
20014,
18798,
1010,
22017,
20898,
18061,
21512,
4859,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
5371,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java | DataStream.broadcast | @PublicEvolving
public BroadcastStream<T> broadcast(final MapStateDescriptor<?, ?>... broadcastStateDescriptors) {
Preconditions.checkNotNull(broadcastStateDescriptors);
final DataStream<T> broadcastStream = setConnectionType(new BroadcastPartitioner<>());
return new BroadcastStream<>(environment, broadcastStream, broadcastStateDescriptors);
} | java | @PublicEvolving
public BroadcastStream<T> broadcast(final MapStateDescriptor<?, ?>... broadcastStateDescriptors) {
Preconditions.checkNotNull(broadcastStateDescriptors);
final DataStream<T> broadcastStream = setConnectionType(new BroadcastPartitioner<>());
return new BroadcastStream<>(environment, broadcastStream, broadcastStateDescriptors);
} | [
"@",
"PublicEvolving",
"public",
"BroadcastStream",
"<",
"T",
">",
"broadcast",
"(",
"final",
"MapStateDescriptor",
"<",
"?",
",",
"?",
">",
"...",
"broadcastStateDescriptors",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"broadcastStateDescriptors",
")",
... | Sets the partitioning of the {@link DataStream} so that the output elements
are broadcasted to every parallel instance of the next operation. In addition,
it implicitly as many {@link org.apache.flink.api.common.state.BroadcastState broadcast states}
as the specified descriptors which can be used to store the element of the stream.
@param broadcastStateDescriptors the descriptors of the broadcast states to create.
@return A {@link BroadcastStream} which can be used in the {@link #connect(BroadcastStream)} to
create a {@link BroadcastConnectedStream} for further processing of the elements. | [
"Sets",
"the",
"partitioning",
"of",
"the",
"{",
"@link",
"DataStream",
"}",
"so",
"that",
"the",
"output",
"elements",
"are",
"broadcasted",
"to",
"every",
"parallel",
"instance",
"of",
"the",
"next",
"operation",
".",
"In",
"addition",
"it",
"implicitly",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L426-L431 | train | Creates a new stream that contains the given broadcast state descriptors. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
8960,
25379,
1026,
1056,
1028,
3743,
1006,
2345,
7341,
16238,
2229,
23235,
2953,
1026,
1029,
1010,
1029,
1028,
1012,
1012,
1012,
8960,
16238,
2229,
23235,
5668,
1007,
1063,
3653,
8663,
20562,
2015,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java | Bzip2BitWriter.flush | void flush(ByteBuf out) {
final int bitCount = this.bitCount;
if (bitCount > 0) {
final long bitBuffer = this.bitBuffer;
final int shiftToRight = 64 - bitCount;
if (bitCount <= 8) {
out.writeByte((int) (bitBuffer >>> shiftToRight << 8 - bitCount));
} else if (bitCount <= 16) {
out.writeShort((int) (bitBuffer >>> shiftToRight << 16 - bitCount));
} else if (bitCount <= 24) {
out.writeMedium((int) (bitBuffer >>> shiftToRight << 24 - bitCount));
} else {
out.writeInt((int) (bitBuffer >>> shiftToRight << 32 - bitCount));
}
}
} | java | void flush(ByteBuf out) {
final int bitCount = this.bitCount;
if (bitCount > 0) {
final long bitBuffer = this.bitBuffer;
final int shiftToRight = 64 - bitCount;
if (bitCount <= 8) {
out.writeByte((int) (bitBuffer >>> shiftToRight << 8 - bitCount));
} else if (bitCount <= 16) {
out.writeShort((int) (bitBuffer >>> shiftToRight << 16 - bitCount));
} else if (bitCount <= 24) {
out.writeMedium((int) (bitBuffer >>> shiftToRight << 24 - bitCount));
} else {
out.writeInt((int) (bitBuffer >>> shiftToRight << 32 - bitCount));
}
}
} | [
"void",
"flush",
"(",
"ByteBuf",
"out",
")",
"{",
"final",
"int",
"bitCount",
"=",
"this",
".",
"bitCount",
";",
"if",
"(",
"bitCount",
">",
"0",
")",
"{",
"final",
"long",
"bitBuffer",
"=",
"this",
".",
"bitBuffer",
";",
"final",
"int",
"shiftToRight"... | Writes any remaining bits to the output {@link ByteBuf},
zero padding to a whole byte as required. | [
"Writes",
"any",
"remaining",
"bits",
"to",
"the",
"output",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java#L102-L119 | train | Flushes the buffer to the output. | [
30522,
11675,
13862,
1006,
24880,
8569,
2546,
2041,
1007,
1063,
2345,
20014,
2978,
3597,
16671,
1027,
2023,
1012,
2978,
3597,
16671,
1025,
2065,
1006,
2978,
3597,
16671,
1028,
1014,
1007,
1063,
2345,
2146,
2978,
8569,
12494,
1027,
2023,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/AbstractCloseableRegistry.java | AbstractCloseableRegistry.registerCloseable | public final void registerCloseable(C closeable) throws IOException {
if (null == closeable) {
return;
}
synchronized (getSynchronizationLock()) {
if (!closed) {
doRegister(closeable, closeableToRef);
return;
}
}
IOUtils.closeQuietly(closeable);
throw new IOException("Cannot register Closeable, registry is already closed. Closing argument.");
} | java | public final void registerCloseable(C closeable) throws IOException {
if (null == closeable) {
return;
}
synchronized (getSynchronizationLock()) {
if (!closed) {
doRegister(closeable, closeableToRef);
return;
}
}
IOUtils.closeQuietly(closeable);
throw new IOException("Cannot register Closeable, registry is already closed. Closing argument.");
} | [
"public",
"final",
"void",
"registerCloseable",
"(",
"C",
"closeable",
")",
"throws",
"IOException",
"{",
"if",
"(",
"null",
"==",
"closeable",
")",
"{",
"return",
";",
"}",
"synchronized",
"(",
"getSynchronizationLock",
"(",
")",
")",
"{",
"if",
"(",
"!",... | Registers a {@link Closeable} with the registry. In case the registry is already closed, this method throws an
{@link IllegalStateException} and closes the passed {@link Closeable}.
@param closeable Closeable tor register
@throws IOException exception when the registry was closed before | [
"Registers",
"a",
"{",
"@link",
"Closeable",
"}",
"with",
"the",
"registry",
".",
"In",
"case",
"the",
"registry",
"is",
"already",
"closed",
"this",
"method",
"throws",
"an",
"{",
"@link",
"IllegalStateException",
"}",
"and",
"closes",
"the",
"passed",
"{",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/AbstractCloseableRegistry.java#L71-L86 | train | Registers a Closeable with the registry. | [
30522,
2270,
2345,
11675,
4236,
20464,
9232,
3085,
1006,
1039,
2485,
3085,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
19701,
1027,
1027,
2485,
3085,
1007,
1063,
2709,
1025,
1065,
25549,
1006,
4152,
6038,
2818,
4948,
3989,
7878,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/hooks/MasterHooks.java | MasterHooks.reset | public static void reset(
final Collection<MasterTriggerRestoreHook<?>> hooks,
final Logger log) throws FlinkException {
for (MasterTriggerRestoreHook<?> hook : hooks) {
final String id = hook.getIdentifier();
try {
hook.reset();
}
catch (Throwable t) {
ExceptionUtils.rethrowIfFatalErrorOrOOM(t);
throw new FlinkException("Error while resetting checkpoint master hook '" + id + '\'', t);
}
}
} | java | public static void reset(
final Collection<MasterTriggerRestoreHook<?>> hooks,
final Logger log) throws FlinkException {
for (MasterTriggerRestoreHook<?> hook : hooks) {
final String id = hook.getIdentifier();
try {
hook.reset();
}
catch (Throwable t) {
ExceptionUtils.rethrowIfFatalErrorOrOOM(t);
throw new FlinkException("Error while resetting checkpoint master hook '" + id + '\'', t);
}
}
} | [
"public",
"static",
"void",
"reset",
"(",
"final",
"Collection",
"<",
"MasterTriggerRestoreHook",
"<",
"?",
">",
">",
"hooks",
",",
"final",
"Logger",
"log",
")",
"throws",
"FlinkException",
"{",
"for",
"(",
"MasterTriggerRestoreHook",
"<",
"?",
">",
"hook",
... | Resets the master hooks.
@param hooks The hooks to reset
@throws FlinkException Thrown, if the hooks throw an exception. | [
"Resets",
"the",
"master",
"hooks",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/hooks/MasterHooks.java#L61-L75 | train | Resets all the checkpoint master hooks. | [
30522,
2270,
10763,
11675,
25141,
1006,
2345,
3074,
1026,
3040,
18886,
13327,
28533,
5686,
6806,
6559,
1026,
1029,
1028,
1028,
18008,
1010,
2345,
8833,
4590,
8833,
1007,
11618,
13109,
19839,
10288,
24422,
1063,
2005,
1006,
3040,
18886,
13327,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/minicluster/MiniCluster.java | MiniCluster.createRpcService | protected RpcService createRpcService(
AkkaRpcServiceConfiguration akkaRpcServiceConfig,
boolean remoteEnabled,
String bindAddress) {
final Config akkaConfig;
if (remoteEnabled) {
akkaConfig = AkkaUtils.getAkkaConfig(akkaRpcServiceConfig.getConfiguration(), bindAddress, 0);
} else {
akkaConfig = AkkaUtils.getAkkaConfig(akkaRpcServiceConfig.getConfiguration());
}
final Config effectiveAkkaConfig = AkkaUtils.testDispatcherConfig().withFallback(akkaConfig);
final ActorSystem actorSystem = AkkaUtils.createActorSystem(effectiveAkkaConfig);
return new AkkaRpcService(actorSystem, akkaRpcServiceConfig);
} | java | protected RpcService createRpcService(
AkkaRpcServiceConfiguration akkaRpcServiceConfig,
boolean remoteEnabled,
String bindAddress) {
final Config akkaConfig;
if (remoteEnabled) {
akkaConfig = AkkaUtils.getAkkaConfig(akkaRpcServiceConfig.getConfiguration(), bindAddress, 0);
} else {
akkaConfig = AkkaUtils.getAkkaConfig(akkaRpcServiceConfig.getConfiguration());
}
final Config effectiveAkkaConfig = AkkaUtils.testDispatcherConfig().withFallback(akkaConfig);
final ActorSystem actorSystem = AkkaUtils.createActorSystem(effectiveAkkaConfig);
return new AkkaRpcService(actorSystem, akkaRpcServiceConfig);
} | [
"protected",
"RpcService",
"createRpcService",
"(",
"AkkaRpcServiceConfiguration",
"akkaRpcServiceConfig",
",",
"boolean",
"remoteEnabled",
",",
"String",
"bindAddress",
")",
"{",
"final",
"Config",
"akkaConfig",
";",
"if",
"(",
"remoteEnabled",
")",
"{",
"akkaConfig",
... | Factory method to instantiate the RPC service.
@param akkaRpcServiceConfig
The default RPC timeout for asynchronous "ask" requests.
@param remoteEnabled
True, if the RPC service should be reachable from other (remote) RPC services.
@param bindAddress
The address to bind the RPC service to. Only relevant when "remoteEnabled" is true.
@return The instantiated RPC service | [
"Factory",
"method",
"to",
"instantiate",
"the",
"RPC",
"service",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java#L715-L733 | train | Create a RpcService. | [
30522,
5123,
1054,
15042,
8043,
7903,
2063,
3443,
14536,
6169,
2121,
7903,
2063,
1006,
17712,
6673,
15042,
8043,
7903,
8586,
2239,
8873,
27390,
3370,
17712,
6673,
15042,
8043,
7903,
8586,
2239,
8873,
2290,
1010,
22017,
20898,
6556,
8189,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java | CompositeByteBuf.addComponents | public CompositeByteBuf addComponents(int cIndex, Iterable<ByteBuf> buffers) {
return addComponents(false, cIndex, buffers);
} | java | public CompositeByteBuf addComponents(int cIndex, Iterable<ByteBuf> buffers) {
return addComponents(false, cIndex, buffers);
} | [
"public",
"CompositeByteBuf",
"addComponents",
"(",
"int",
"cIndex",
",",
"Iterable",
"<",
"ByteBuf",
">",
"buffers",
")",
"{",
"return",
"addComponents",
"(",
"false",
",",
"cIndex",
",",
"buffers",
")",
";",
"}"
] | Add the given {@link ByteBuf}s on the specific index
Be aware that this method does not increase the {@code writerIndex} of the {@link CompositeByteBuf}.
If you need to have it increased you need to handle it by your own.
<p>
{@link ByteBuf#release()} ownership of all {@link ByteBuf} objects in {@code buffers} is transferred to this
{@link CompositeByteBuf}.
@param cIndex the index on which the {@link ByteBuf} will be added.
@param buffers the {@link ByteBuf}s to add. {@link ByteBuf#release()} ownership of all
{@link ByteBuf#release()} ownership of all {@link ByteBuf} objects is transferred to this
{@link CompositeByteBuf}. | [
"Add",
"the",
"given",
"{",
"@link",
"ByteBuf",
"}",
"s",
"on",
"the",
"specific",
"index"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L413-L415 | train | Add a sequence of components to this CompositeByteBuf. | [
30522,
2270,
12490,
3762,
2618,
8569,
2546,
5587,
9006,
29513,
7666,
1006,
20014,
25022,
13629,
2595,
1010,
2009,
6906,
3468,
1026,
24880,
8569,
2546,
1028,
17698,
2015,
1007,
1063,
2709,
5587,
9006,
29513,
7666,
1006,
6270,
1010,
25022,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleServiceMetrics.java | YarnShuffleServiceMetrics.getMetrics | @Override
public void getMetrics(MetricsCollector collector, boolean all) {
MetricsRecordBuilder metricsRecordBuilder = collector.addRecord("sparkShuffleService");
for (Map.Entry<String, Metric> entry : metricSet.getMetrics().entrySet()) {
collectMetric(metricsRecordBuilder, entry.getKey(), entry.getValue());
}
} | java | @Override
public void getMetrics(MetricsCollector collector, boolean all) {
MetricsRecordBuilder metricsRecordBuilder = collector.addRecord("sparkShuffleService");
for (Map.Entry<String, Metric> entry : metricSet.getMetrics().entrySet()) {
collectMetric(metricsRecordBuilder, entry.getKey(), entry.getValue());
}
} | [
"@",
"Override",
"public",
"void",
"getMetrics",
"(",
"MetricsCollector",
"collector",
",",
"boolean",
"all",
")",
"{",
"MetricsRecordBuilder",
"metricsRecordBuilder",
"=",
"collector",
".",
"addRecord",
"(",
"\"sparkShuffleService\"",
")",
";",
"for",
"(",
"Map",
... | Get metrics from the source
@param collector to contain the resulting metrics snapshot
@param all if true, return all metrics even if unchanged. | [
"Get",
"metrics",
"from",
"the",
"source"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleServiceMetrics.java#L47-L54 | train | Get the metrics from the metric set. | [
30522,
1030,
2058,
15637,
2270,
11675,
2131,
12589,
2015,
1006,
12046,
9363,
6216,
16761,
10018,
1010,
22017,
20898,
2035,
1007,
1063,
12046,
21338,
8586,
8551,
8569,
23891,
2099,
12046,
21338,
8586,
8551,
8569,
23891,
2099,
1027,
10018,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/description/Formatter.java | Formatter.format | public String format(Description description) {
for (BlockElement blockElement : description.getBlocks()) {
blockElement.format(this);
}
return finalizeFormatting();
} | java | public String format(Description description) {
for (BlockElement blockElement : description.getBlocks()) {
blockElement.format(this);
}
return finalizeFormatting();
} | [
"public",
"String",
"format",
"(",
"Description",
"description",
")",
"{",
"for",
"(",
"BlockElement",
"blockElement",
":",
"description",
".",
"getBlocks",
"(",
")",
")",
"{",
"blockElement",
".",
"format",
"(",
"this",
")",
";",
"}",
"return",
"finalizeFor... | Formats the description into a String using format specific tags.
@param description description to be formatted
@return string representation of the description | [
"Formats",
"the",
"description",
"into",
"a",
"String",
"using",
"format",
"specific",
"tags",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/description/Formatter.java#L36-L41 | train | Format the given description. | [
30522,
2270,
5164,
4289,
1006,
6412,
6412,
1007,
1063,
2005,
1006,
3796,
12260,
3672,
3796,
12260,
3672,
1024,
6412,
1012,
2131,
23467,
2015,
1006,
1007,
1007,
1063,
3796,
12260,
3672,
1012,
4289,
1006,
2023,
1007,
1025,
1065,
2709,
2345,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/PinyinUtil.java | PinyinUtil.getFirstLetter | public static char getFirstLetter(char ch) {
if (ch >= 'a' && ch <= 'z') {
return ch;
}
if (ch >= 'A' && ch <= 'Z') {
return Character.toLowerCase(ch);
}
final byte[] bys = String.valueOf(ch).getBytes(CharsetUtil.CHARSET_GBK);
if (bys.length == 1) {
return ch;
}
int count = (bys[0] + 256) * 256 + bys[1] + 256;
if (count < 45217) {
return ch;
} else if (count < 45253) {
return 'a';
} else if (count < 45761) {
return 'b';
} else if (count < 46318) {
return 'c';
} else if (count < 46826) {
return 'd';
} else if (count < 47010) {
return 'e';
} else if (count < 47297) {
return 'f';
} else if (count < 47614) {
return 'g';
} else if (count < 48119) {
return 'h';
} else if (count < 49062) {
return 'j';
} else if (count < 49324) {
return 'k';
} else if (count < 49896) {
return 'l';
} else if (count < 50371) {
return 'm';
} else if (count < 50614) {
return 'n';
} else if (count < 50622) {
return 'o';
} else if (count < 50906) {
return 'p';
} else if (count < 51387) {
return 'q';
} else if (count < 51446) {
return 'r';
} else if (count < 52218) {
return 's';
} else if (count < 52698) {
return 't';
} else if (count < 52980) {
return 'w';
} else if (count < 53689) {
return 'x';
} else if (count < 54481) {
return 'y';
} else if (count < 55290) {
return 'z';
}
return ch;
} | java | public static char getFirstLetter(char ch) {
if (ch >= 'a' && ch <= 'z') {
return ch;
}
if (ch >= 'A' && ch <= 'Z') {
return Character.toLowerCase(ch);
}
final byte[] bys = String.valueOf(ch).getBytes(CharsetUtil.CHARSET_GBK);
if (bys.length == 1) {
return ch;
}
int count = (bys[0] + 256) * 256 + bys[1] + 256;
if (count < 45217) {
return ch;
} else if (count < 45253) {
return 'a';
} else if (count < 45761) {
return 'b';
} else if (count < 46318) {
return 'c';
} else if (count < 46826) {
return 'd';
} else if (count < 47010) {
return 'e';
} else if (count < 47297) {
return 'f';
} else if (count < 47614) {
return 'g';
} else if (count < 48119) {
return 'h';
} else if (count < 49062) {
return 'j';
} else if (count < 49324) {
return 'k';
} else if (count < 49896) {
return 'l';
} else if (count < 50371) {
return 'm';
} else if (count < 50614) {
return 'n';
} else if (count < 50622) {
return 'o';
} else if (count < 50906) {
return 'p';
} else if (count < 51387) {
return 'q';
} else if (count < 51446) {
return 'r';
} else if (count < 52218) {
return 's';
} else if (count < 52698) {
return 't';
} else if (count < 52980) {
return 'w';
} else if (count < 53689) {
return 'x';
} else if (count < 54481) {
return 'y';
} else if (count < 55290) {
return 'z';
}
return ch;
} | [
"public",
"static",
"char",
"getFirstLetter",
"(",
"char",
"ch",
")",
"{",
"if",
"(",
"ch",
">=",
"'",
"'",
"&&",
"ch",
"<=",
"'",
"'",
")",
"{",
"return",
"ch",
";",
"}",
"if",
"(",
"ch",
">=",
"'",
"'",
"&&",
"ch",
"<=",
"'",
"'",
")",
"{... | 获取拼音首字母<br>
传入汉字,返回拼音首字母<br>
如果传入为字母,返回其小写形式<br>
感谢【帝都】宁静 提供方法
@param ch 汉字
@return 首字母,小写 | [
"获取拼音首字母<br",
">",
"传入汉字,返回拼音首字母<br",
">",
"如果传入为字母,返回其小写形式<br",
">",
"感谢【帝都】宁静",
"提供方法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/PinyinUtil.java#L83-L145 | train | Returns the first letter of the specified character in the ISO 4217 language. | [
30522,
2270,
10763,
25869,
2131,
8873,
12096,
27901,
2099,
1006,
25869,
10381,
1007,
1063,
2065,
1006,
10381,
1028,
1027,
1005,
1037,
1005,
1004,
1004,
10381,
1026,
1027,
1005,
1062,
1005,
1007,
1063,
2709,
10381,
1025,
1065,
2065,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/io/SimpleVersionedSerialization.java | SimpleVersionedSerialization.writeVersionAndSerialize | public static <T> byte[] writeVersionAndSerialize(SimpleVersionedSerializer<T> serializer, T datum) throws IOException {
checkNotNull(serializer, "serializer");
checkNotNull(datum, "datum");
final byte[] data = serializer.serialize(datum);
final byte[] versionAndData = new byte[data.length + 8];
final int version = serializer.getVersion();
versionAndData[0] = (byte) (version >> 24);
versionAndData[1] = (byte) (version >> 16);
versionAndData[2] = (byte) (version >> 8);
versionAndData[3] = (byte) version;
final int length = data.length;
versionAndData[4] = (byte) (length >> 24);
versionAndData[5] = (byte) (length >> 16);
versionAndData[6] = (byte) (length >> 8);
versionAndData[7] = (byte) length;
// move the data to the array
System.arraycopy(data, 0, versionAndData, 8, data.length);
return versionAndData;
} | java | public static <T> byte[] writeVersionAndSerialize(SimpleVersionedSerializer<T> serializer, T datum) throws IOException {
checkNotNull(serializer, "serializer");
checkNotNull(datum, "datum");
final byte[] data = serializer.serialize(datum);
final byte[] versionAndData = new byte[data.length + 8];
final int version = serializer.getVersion();
versionAndData[0] = (byte) (version >> 24);
versionAndData[1] = (byte) (version >> 16);
versionAndData[2] = (byte) (version >> 8);
versionAndData[3] = (byte) version;
final int length = data.length;
versionAndData[4] = (byte) (length >> 24);
versionAndData[5] = (byte) (length >> 16);
versionAndData[6] = (byte) (length >> 8);
versionAndData[7] = (byte) length;
// move the data to the array
System.arraycopy(data, 0, versionAndData, 8, data.length);
return versionAndData;
} | [
"public",
"static",
"<",
"T",
">",
"byte",
"[",
"]",
"writeVersionAndSerialize",
"(",
"SimpleVersionedSerializer",
"<",
"T",
">",
"serializer",
",",
"T",
"datum",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"serializer",
",",
"\"serializer\"",
")",
... | Serializes the version and datum into a byte array. The first four bytes will be occupied by
the version (as returned by {@link SimpleVersionedSerializer#getVersion()}),
written in <i>big-endian</i> encoding. The remaining bytes will be the serialized
datum, as produced by {@link SimpleVersionedSerializer#serialize(Object)}. The resulting array
will hence be four bytes larger than the serialized datum.
<p>Data serialized via this method can be deserialized via
{@link #readVersionAndDeSerialize(SimpleVersionedSerializer, byte[])}.
@param serializer The serializer to serialize the datum with.
@param datum The datum to serialize.
@return A byte array containing the serialized version and serialized datum.
@throws IOException Exceptions from the {@link SimpleVersionedSerializer#serialize(Object)}
method are forwarded. | [
"Serializes",
"the",
"version",
"and",
"datum",
"into",
"a",
"byte",
"array",
".",
"The",
"first",
"four",
"bytes",
"will",
"be",
"occupied",
"by",
"the",
"version",
"(",
"as",
"returned",
"by",
"{",
"@link",
"SimpleVersionedSerializer#getVersion",
"()",
"}",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/io/SimpleVersionedSerialization.java#L108-L131 | train | Write the version and serialize of the given object using the given serializer. | [
30522,
2270,
10763,
1026,
1056,
1028,
24880,
1031,
1033,
4339,
27774,
29560,
11610,
3669,
4371,
1006,
3722,
27774,
2098,
8043,
4818,
17629,
1026,
1056,
1028,
7642,
17629,
1010,
1056,
23755,
2819,
1007,
11618,
22834,
10288,
24422,
1063,
4638,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AllWindowedStream.java | AllWindowedStream.evictor | @PublicEvolving
public AllWindowedStream<T, W> evictor(Evictor<? super T, ? super W> evictor) {
if (windowAssigner instanceof BaseAlignedWindowAssigner) {
throw new UnsupportedOperationException("Cannot use a " + windowAssigner.getClass().getSimpleName() + " with an Evictor.");
}
this.evictor = evictor;
return this;
} | java | @PublicEvolving
public AllWindowedStream<T, W> evictor(Evictor<? super T, ? super W> evictor) {
if (windowAssigner instanceof BaseAlignedWindowAssigner) {
throw new UnsupportedOperationException("Cannot use a " + windowAssigner.getClass().getSimpleName() + " with an Evictor.");
}
this.evictor = evictor;
return this;
} | [
"@",
"PublicEvolving",
"public",
"AllWindowedStream",
"<",
"T",
",",
"W",
">",
"evictor",
"(",
"Evictor",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"W",
">",
"evictor",
")",
"{",
"if",
"(",
"windowAssigner",
"instanceof",
"BaseAlignedWindowAssigner",
")",
... | Sets the {@code Evictor} that should be used to evict elements from a window before emission.
<p>Note: When using an evictor window performance will degrade significantly, since
incremental aggregation of window results cannot be used. | [
"Sets",
"the",
"{",
"@code",
"Evictor",
"}",
"that",
"should",
"be",
"used",
"to",
"evict",
"elements",
"from",
"a",
"window",
"before",
"emission",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java#L175-L183 | train | Sets the Evictor to use for evicting the stream. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
2035,
11101,
15096,
21422,
1026,
1056,
1010,
1059,
1028,
23408,
2594,
4263,
1006,
23408,
2594,
4263,
1026,
1029,
3565,
1056,
1010,
1029,
3565,
1059,
1028,
23408,
2594,
4263,
1007,
1063,
2065,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java | Handler.addToRootFileCache | static void addToRootFileCache(File sourceFile, JarFile jarFile) {
Map<File, JarFile> cache = rootFileCache.get();
if (cache == null) {
cache = new ConcurrentHashMap<>();
rootFileCache = new SoftReference<>(cache);
}
cache.put(sourceFile, jarFile);
} | java | static void addToRootFileCache(File sourceFile, JarFile jarFile) {
Map<File, JarFile> cache = rootFileCache.get();
if (cache == null) {
cache = new ConcurrentHashMap<>();
rootFileCache = new SoftReference<>(cache);
}
cache.put(sourceFile, jarFile);
} | [
"static",
"void",
"addToRootFileCache",
"(",
"File",
"sourceFile",
",",
"JarFile",
"jarFile",
")",
"{",
"Map",
"<",
"File",
",",
"JarFile",
">",
"cache",
"=",
"rootFileCache",
".",
"get",
"(",
")",
";",
"if",
"(",
"cache",
"==",
"null",
")",
"{",
"cach... | Add the given {@link JarFile} to the root file cache.
@param sourceFile the source file to add
@param jarFile the jar file. | [
"Add",
"the",
"given",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java#L333-L340 | train | Add a file to the cache of root files. | [
30522,
10763,
11675,
5587,
4263,
17206,
8873,
2571,
3540,
5403,
1006,
5371,
3120,
8873,
2571,
1010,
15723,
8873,
2571,
15723,
8873,
2571,
1007,
1063,
4949,
1026,
5371,
1010,
15723,
8873,
2571,
1028,
17053,
1027,
7117,
8873,
2571,
3540,
5403... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java | FileSystemWatcher.addSourceFolders | public void addSourceFolders(Iterable<File> folders) {
Assert.notNull(folders, "Folders must not be null");
synchronized (this.monitor) {
for (File folder : folders) {
addSourceFolder(folder);
}
}
} | java | public void addSourceFolders(Iterable<File> folders) {
Assert.notNull(folders, "Folders must not be null");
synchronized (this.monitor) {
for (File folder : folders) {
addSourceFolder(folder);
}
}
} | [
"public",
"void",
"addSourceFolders",
"(",
"Iterable",
"<",
"File",
">",
"folders",
")",
"{",
"Assert",
".",
"notNull",
"(",
"folders",
",",
"\"Folders must not be null\"",
")",
";",
"synchronized",
"(",
"this",
".",
"monitor",
")",
"{",
"for",
"(",
"File",
... | Add source folders to monitor. Cannot be called after the watcher has been
{@link #start() started}.
@param folders the folders to monitor | [
"Add",
"source",
"folders",
"to",
"monitor",
".",
"Cannot",
"be",
"called",
"after",
"the",
"watcher",
"has",
"been",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java#L112-L119 | train | Adds the source folders to the report. | [
30522,
2270,
11675,
9909,
30524,
3363,
1006,
19622,
2015,
1010,
1000,
19622,
2015,
2442,
2025,
2022,
19701,
1000,
1007,
1025,
25549,
1006,
2023,
1012,
8080,
1007,
1063,
2005,
1006,
5371,
19622,
1024,
19622,
2015,
1007,
1063,
9909,
8162,
340... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/description/TextElement.java | TextElement.code | public static TextElement code(String text) {
TextElement element = text(text);
element.textStyles.add(TextStyle.CODE);
return element;
} | java | public static TextElement code(String text) {
TextElement element = text(text);
element.textStyles.add(TextStyle.CODE);
return element;
} | [
"public",
"static",
"TextElement",
"code",
"(",
"String",
"text",
")",
"{",
"TextElement",
"element",
"=",
"text",
"(",
"text",
")",
";",
"element",
".",
"textStyles",
".",
"add",
"(",
"TextStyle",
".",
"CODE",
")",
";",
"return",
"element",
";",
"}"
] | Creates a block of text formatted as code.
@param text a block of text that will be formatted as code
@return block of text formatted as code | [
"Creates",
"a",
"block",
"of",
"text",
"formatted",
"as",
"code",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/description/TextElement.java#L64-L68 | train | Create a text element with a code style. | [
30522,
2270,
10763,
3793,
12260,
3672,
3642,
1006,
5164,
3793,
1007,
1063,
3793,
12260,
3672,
5783,
1027,
3793,
1006,
3793,
1007,
1025,
5783,
1012,
6981,
27983,
2015,
1012,
5587,
1006,
6981,
27983,
1012,
3642,
1007,
1025,
2709,
5783,
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-system/src/main/java/cn/hutool/system/SystemUtil.java | SystemUtil.dumpSystemInfo | public static void dumpSystemInfo(PrintWriter out) {
out.println("--------------");
out.println(getJvmSpecInfo());
out.println("--------------");
out.println(getJvmInfo());
out.println("--------------");
out.println(getJavaSpecInfo());
out.println("--------------");
out.println(getJavaInfo());
out.println("--------------");
out.println(getJavaRuntimeInfo());
out.println("--------------");
out.println(getOsInfo());
out.println("--------------");
out.println(getUserInfo());
out.println("--------------");
out.println(getHostInfo());
out.println("--------------");
out.println(getRuntimeInfo());
out.println("--------------");
out.flush();
} | java | public static void dumpSystemInfo(PrintWriter out) {
out.println("--------------");
out.println(getJvmSpecInfo());
out.println("--------------");
out.println(getJvmInfo());
out.println("--------------");
out.println(getJavaSpecInfo());
out.println("--------------");
out.println(getJavaInfo());
out.println("--------------");
out.println(getJavaRuntimeInfo());
out.println("--------------");
out.println(getOsInfo());
out.println("--------------");
out.println(getUserInfo());
out.println("--------------");
out.println(getHostInfo());
out.println("--------------");
out.println(getRuntimeInfo());
out.println("--------------");
out.flush();
} | [
"public",
"static",
"void",
"dumpSystemInfo",
"(",
"PrintWriter",
"out",
")",
"{",
"out",
".",
"println",
"(",
"\"--------------\"",
")",
";",
"out",
".",
"println",
"(",
"getJvmSpecInfo",
"(",
")",
")",
";",
"out",
".",
"println",
"(",
"\"--------------\"",... | 将系统信息输出到指定<code>PrintWriter</code>中。
@param out <code>PrintWriter</code>输出流 | [
"将系统信息输出到指定<code",
">",
"PrintWriter<",
"/",
"code",
">",
"中。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-system/src/main/java/cn/hutool/system/SystemUtil.java#L439-L460 | train | Dumps the system info. | [
30522,
2270,
10763,
11675,
15653,
6508,
13473,
10020,
14876,
1006,
6140,
15994,
2041,
1007,
1063,
2041,
1012,
6140,
19666,
1006,
1000,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1000,
1007,
1025,
204... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
redisson/redisson | redisson/src/main/java/org/redisson/spring/cache/CacheConfig.java | CacheConfig.toJSON | public static String toJSON(Map<String, ? extends CacheConfig> config) throws IOException {
return new CacheConfigSupport().toJSON(config);
} | java | public static String toJSON(Map<String, ? extends CacheConfig> config) throws IOException {
return new CacheConfigSupport().toJSON(config);
} | [
"public",
"static",
"String",
"toJSON",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"CacheConfig",
">",
"config",
")",
"throws",
"IOException",
"{",
"return",
"new",
"CacheConfigSupport",
"(",
")",
".",
"toJSON",
"(",
"config",
")",
";",
"}"
] | Convert current configuration to JSON format
@param config object
@return json string
@throws IOException error | [
"Convert",
"current",
"configuration",
"to",
"JSON",
"format"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/spring/cache/CacheConfig.java#L168-L170 | train | Convert a map of cache config to JSON string. | [
30522,
2270,
10763,
5164,
2000,
22578,
2239,
1006,
4949,
1026,
5164,
1010,
1029,
8908,
17053,
8663,
8873,
2290,
1028,
9530,
8873,
2290,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
2047,
17053,
8663,
8873,
5620,
6279,
6442,
1006,
1007,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.mul | public static BigDecimal mul(Number v1, Number v2) {
return mul(new Number[] { v1, v2 });
} | java | public static BigDecimal mul(Number v1, Number v2) {
return mul(new Number[] { v1, v2 });
} | [
"public",
"static",
"BigDecimal",
"mul",
"(",
"Number",
"v1",
",",
"Number",
"v2",
")",
"{",
"return",
"mul",
"(",
"new",
"Number",
"[",
"]",
"{",
"v1",
",",
"v2",
"}",
")",
";",
"}"
] | 提供精确的乘法运算<br>
如果传入多个值为null或者空,则返回0
@param v1 被乘数
@param v2 乘数
@return 积 | [
"提供精确的乘法运算<br",
">",
"如果传入多个值为null或者空,则返回0"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L388-L390 | train | Multiply two numbers. | [
30522,
2270,
10763,
2502,
3207,
6895,
9067,
14163,
2140,
1006,
2193,
1058,
2487,
1010,
2193,
1058,
2475,
1007,
1063,
2709,
14163,
2140,
1006,
2047,
2193,
1031,
1033,
1063,
1058,
2487,
1010,
1058,
2475,
1065,
1007,
1025,
1065,
102,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/logging/LoggingHandler.java | LoggingHandler.formatByteBufHolder | private static String formatByteBufHolder(ChannelHandlerContext ctx, String eventName, ByteBufHolder msg) {
String chStr = ctx.channel().toString();
String msgStr = msg.toString();
ByteBuf content = msg.content();
int length = content.readableBytes();
if (length == 0) {
StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + msgStr.length() + 4);
buf.append(chStr).append(' ').append(eventName).append(", ").append(msgStr).append(", 0B");
return buf.toString();
} else {
int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4;
StringBuilder buf = new StringBuilder(
chStr.length() + 1 + eventName.length() + 2 + msgStr.length() + 2 + 10 + 1 + 2 + rows * 80);
buf.append(chStr).append(' ').append(eventName).append(": ")
.append(msgStr).append(", ").append(length).append('B').append(NEWLINE);
appendPrettyHexDump(buf, content);
return buf.toString();
}
} | java | private static String formatByteBufHolder(ChannelHandlerContext ctx, String eventName, ByteBufHolder msg) {
String chStr = ctx.channel().toString();
String msgStr = msg.toString();
ByteBuf content = msg.content();
int length = content.readableBytes();
if (length == 0) {
StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + msgStr.length() + 4);
buf.append(chStr).append(' ').append(eventName).append(", ").append(msgStr).append(", 0B");
return buf.toString();
} else {
int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4;
StringBuilder buf = new StringBuilder(
chStr.length() + 1 + eventName.length() + 2 + msgStr.length() + 2 + 10 + 1 + 2 + rows * 80);
buf.append(chStr).append(' ').append(eventName).append(": ")
.append(msgStr).append(", ").append(length).append('B').append(NEWLINE);
appendPrettyHexDump(buf, content);
return buf.toString();
}
} | [
"private",
"static",
"String",
"formatByteBufHolder",
"(",
"ChannelHandlerContext",
"ctx",
",",
"String",
"eventName",
",",
"ByteBufHolder",
"msg",
")",
"{",
"String",
"chStr",
"=",
"ctx",
".",
"channel",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"... | Generates the default log message of the specified event whose argument is a {@link ByteBufHolder}. | [
"Generates",
"the",
"default",
"log",
"message",
"of",
"the",
"specified",
"event",
"whose",
"argument",
"is",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/logging/LoggingHandler.java#L344-L364 | train | Format ByteBuf Holder. | [
30522,
2797,
10763,
5164,
4289,
3762,
2618,
8569,
2546,
14528,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
5164,
2724,
18442,
1010,
24880,
8569,
2546,
14528,
5796,
2290,
1007,
1063,
5164,
10381,
3367,
2099,
1027,
14931,
2595,
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/model/perceptron/model/LinearModel.java | LinearModel.load | public void load(String modelFile) throws IOException
{
if (HanLP.Config.DEBUG)
logger.start("加载 %s ... ", modelFile);
ByteArrayStream byteArray = ByteArrayStream.createByteArrayStream(modelFile);
if (!load(byteArray))
{
throw new IOException(String.format("%s 加载失败", modelFile));
}
if (HanLP.Config.DEBUG)
logger.finish(" 加载完毕\n");
} | java | public void load(String modelFile) throws IOException
{
if (HanLP.Config.DEBUG)
logger.start("加载 %s ... ", modelFile);
ByteArrayStream byteArray = ByteArrayStream.createByteArrayStream(modelFile);
if (!load(byteArray))
{
throw new IOException(String.format("%s 加载失败", modelFile));
}
if (HanLP.Config.DEBUG)
logger.finish(" 加载完毕\n");
} | [
"public",
"void",
"load",
"(",
"String",
"modelFile",
")",
"throws",
"IOException",
"{",
"if",
"(",
"HanLP",
".",
"Config",
".",
"DEBUG",
")",
"logger",
".",
"start",
"(",
"\"加载 %s ... \", mo",
"d",
"lFile);",
"",
"",
"ByteArrayStream",
"byteArray",
"=",
"... | 加载模型
@param modelFile
@throws IOException | [
"加载模型"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/model/LinearModel.java#L383-L394 | train | Load a single SECTYPE file. | [
30522,
2270,
11675,
7170,
1006,
5164,
2944,
8873,
2571,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
7658,
14277,
1012,
9530,
8873,
2290,
1012,
2139,
8569,
2290,
1007,
8833,
4590,
1012,
2707,
1006,
1000,
1779,
100,
1003,
1055,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java | SslContextBuilder.keyManager | public SslContextBuilder keyManager(KeyManagerFactory keyManagerFactory) {
if (forServer) {
checkNotNull(keyManagerFactory, "keyManagerFactory required for servers");
}
keyCertChain = null;
key = null;
keyPassword = null;
this.keyManagerFactory = keyManagerFactory;
return this;
} | java | public SslContextBuilder keyManager(KeyManagerFactory keyManagerFactory) {
if (forServer) {
checkNotNull(keyManagerFactory, "keyManagerFactory required for servers");
}
keyCertChain = null;
key = null;
keyPassword = null;
this.keyManagerFactory = keyManagerFactory;
return this;
} | [
"public",
"SslContextBuilder",
"keyManager",
"(",
"KeyManagerFactory",
"keyManagerFactory",
")",
"{",
"if",
"(",
"forServer",
")",
"{",
"checkNotNull",
"(",
"keyManagerFactory",
",",
"\"keyManagerFactory required for servers\"",
")",
";",
"}",
"keyCertChain",
"=",
"null... | Identifying manager for this host. {@code keyManagerFactory} may be {@code null} for
client contexts, which disables mutual authentication. Using a {@link KeyManagerFactory}
is only supported for {@link SslProvider#JDK} or {@link SslProvider#OPENSSL} / {@link SslProvider#OPENSSL_REFCNT}
if the used openssl version is 1.0.1+. You can check if your openssl version supports using a
{@link KeyManagerFactory} by calling {@link OpenSsl#supportsKeyManagerFactory()}. If this is not the case
you must use {@link #keyManager(File, File)} or {@link #keyManager(File, File, String)}.
If you use {@link SslProvider#OPENSSL} or {@link SslProvider#OPENSSL_REFCNT} consider using
{@link OpenSslX509KeyManagerFactory} or {@link OpenSslCachingX509KeyManagerFactory}. | [
"Identifying",
"manager",
"for",
"this",
"host",
".",
"{",
"@code",
"keyManagerFactory",
"}",
"may",
"be",
"{",
"@code",
"null",
"}",
"for",
"client",
"contexts",
"which",
"disables",
"mutual",
"authentication",
".",
"Using",
"a",
"{",
"@link",
"KeyManagerFact... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L345-L354 | train | Sets the key manager to use for this context. | [
30522,
2270,
7020,
22499,
10111,
18413,
8569,
23891,
2099,
3145,
24805,
4590,
1006,
3145,
24805,
4590,
21450,
3145,
24805,
4590,
21450,
1007,
1063,
2065,
1006,
2005,
8043,
6299,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
3145,
24805,
4590,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.addHeader | @Deprecated
public static void addHeader(HttpMessage message, String name, Object value) {
message.headers().add(name, value);
} | java | @Deprecated
public static void addHeader(HttpMessage message, String name, Object value) {
message.headers().add(name, value);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"addHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"add",
"(",
"name",
",",
"value",
")",
";",
"}"
] | @deprecated Use {@link #add(CharSequence, Object)} instead.
@see #addHeader(HttpMessage, CharSequence, Object) | [
"@deprecated",
"Use",
"{",
"@link",
"#add",
"(",
"CharSequence",
"Object",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L655-L658 | train | Add a header to the message. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
11675,
5587,
4974,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
5164,
2171,
1010,
4874,
3643,
1007,
1063,
4471,
1012,
20346,
2015,
1006,
1007,
1012,
5587,
1006,
2171,
1010,
3643,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.trimLeft | public UTF8String trimLeft(UTF8String trimString) {
if (trimString == null) return null;
// the searching byte position in the source string
int srchIdx = 0;
// the first beginning byte position of a non-matching character
int trimIdx = 0;
while (srchIdx < numBytes) {
UTF8String searchChar = copyUTF8String(
srchIdx, srchIdx + numBytesForFirstByte(this.getByte(srchIdx)) - 1);
int searchCharBytes = searchChar.numBytes;
// try to find the matching for the searchChar in the trimString set
if (trimString.find(searchChar, 0) >= 0) {
trimIdx += searchCharBytes;
} else {
// no matching, exit the search
break;
}
srchIdx += searchCharBytes;
}
if (trimIdx >= numBytes) {
// empty string
return EMPTY_UTF8;
} else {
return copyUTF8String(trimIdx, numBytes - 1);
}
} | java | public UTF8String trimLeft(UTF8String trimString) {
if (trimString == null) return null;
// the searching byte position in the source string
int srchIdx = 0;
// the first beginning byte position of a non-matching character
int trimIdx = 0;
while (srchIdx < numBytes) {
UTF8String searchChar = copyUTF8String(
srchIdx, srchIdx + numBytesForFirstByte(this.getByte(srchIdx)) - 1);
int searchCharBytes = searchChar.numBytes;
// try to find the matching for the searchChar in the trimString set
if (trimString.find(searchChar, 0) >= 0) {
trimIdx += searchCharBytes;
} else {
// no matching, exit the search
break;
}
srchIdx += searchCharBytes;
}
if (trimIdx >= numBytes) {
// empty string
return EMPTY_UTF8;
} else {
return copyUTF8String(trimIdx, numBytes - 1);
}
} | [
"public",
"UTF8String",
"trimLeft",
"(",
"UTF8String",
"trimString",
")",
"{",
"if",
"(",
"trimString",
"==",
"null",
")",
"return",
"null",
";",
"// the searching byte position in the source string",
"int",
"srchIdx",
"=",
"0",
";",
"// the first beginning byte positio... | Based on the given trim string, trim this string starting from left end
This method searches each character in the source string starting from the left end, removes
the character if it is in the trim string, stops at the first character which is not in the
trim string, returns the new string.
@param trimString the trim character string | [
"Based",
"on",
"the",
"given",
"trim",
"string",
"trim",
"this",
"string",
"starting",
"from",
"left",
"end",
"This",
"method",
"searches",
"each",
"character",
"in",
"the",
"source",
"string",
"starting",
"from",
"the",
"left",
"end",
"removes",
"the",
"cha... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L580-L607 | train | Trims the left part of the source string. | [
30522,
2270,
21183,
2546,
2620,
3367,
4892,
12241,
2571,
6199,
1006,
21183,
2546,
2620,
3367,
4892,
12241,
3367,
4892,
1007,
1063,
2065,
1006,
12241,
3367,
4892,
1027,
1027,
19701,
1007,
2709,
19701,
1025,
1013,
1013,
1996,
6575,
24880,
259... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java | SqlBuilder.buildCondition | private String buildCondition(LogicalOperator logicalOperator, Condition... conditions) {
if (ArrayUtil.isEmpty(conditions)) {
return StrUtil.EMPTY;
}
if (null == logicalOperator) {
logicalOperator = LogicalOperator.AND;
}
final StringBuilder conditionStrBuilder = new StringBuilder();
boolean isFirst = true;
for (Condition condition : conditions) {
// 添加逻辑运算符
if (isFirst) {
isFirst = false;
} else {
// " AND " 或者 " OR "
conditionStrBuilder.append(StrUtil.SPACE).append(logicalOperator).append(StrUtil.SPACE);
}
// 构建条件部分:"name = ?"、"name IN (?,?,?)"、"name BETWEEN ?AND ?"、"name LIKE ?"
conditionStrBuilder.append(condition.toString(this.paramValues));
}
return conditionStrBuilder.toString();
} | java | private String buildCondition(LogicalOperator logicalOperator, Condition... conditions) {
if (ArrayUtil.isEmpty(conditions)) {
return StrUtil.EMPTY;
}
if (null == logicalOperator) {
logicalOperator = LogicalOperator.AND;
}
final StringBuilder conditionStrBuilder = new StringBuilder();
boolean isFirst = true;
for (Condition condition : conditions) {
// 添加逻辑运算符
if (isFirst) {
isFirst = false;
} else {
// " AND " 或者 " OR "
conditionStrBuilder.append(StrUtil.SPACE).append(logicalOperator).append(StrUtil.SPACE);
}
// 构建条件部分:"name = ?"、"name IN (?,?,?)"、"name BETWEEN ?AND ?"、"name LIKE ?"
conditionStrBuilder.append(condition.toString(this.paramValues));
}
return conditionStrBuilder.toString();
} | [
"private",
"String",
"buildCondition",
"(",
"LogicalOperator",
"logicalOperator",
",",
"Condition",
"...",
"conditions",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"conditions",
")",
")",
"{",
"return",
"StrUtil",
".",
"EMPTY",
";",
"}",
"if",
"(... | 构建组合条件<br>
例如:name = ? AND type IN (?, ?) AND other LIKE ?
@param logicalOperator 逻辑运算符
@param conditions 条件对象
@return 构建后的SQL语句条件部分 | [
"构建组合条件<br",
">",
"例如:name",
"=",
"?",
"AND",
"type",
"IN",
"(",
"?",
"?",
")",
"AND",
"other",
"LIKE",
"?"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java#L587-L611 | train | Build the condition string. | [
30522,
2797,
5164,
3857,
8663,
20562,
1006,
11177,
25918,
8844,
11177,
25918,
8844,
1010,
4650,
1012,
1012,
1012,
3785,
1007,
1063,
2065,
1006,
9140,
21823,
2140,
1012,
2003,
6633,
13876,
2100,
1006,
3785,
1007,
1007,
1063,
2709,
2358,
2213... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.asQueryableState | @PublicEvolving
public QueryableStateStream<KEY, T> asQueryableState(
String queryableStateName,
ValueStateDescriptor<T> stateDescriptor) {
transform("Queryable state: " + queryableStateName,
getType(),
new QueryableValueStateOperator<>(queryableStateName, stateDescriptor));
stateDescriptor.initializeSerializerUnlessSet(getExecutionConfig());
return new QueryableStateStream<>(
queryableStateName,
stateDescriptor,
getKeyType().createSerializer(getExecutionConfig()));
} | java | @PublicEvolving
public QueryableStateStream<KEY, T> asQueryableState(
String queryableStateName,
ValueStateDescriptor<T> stateDescriptor) {
transform("Queryable state: " + queryableStateName,
getType(),
new QueryableValueStateOperator<>(queryableStateName, stateDescriptor));
stateDescriptor.initializeSerializerUnlessSet(getExecutionConfig());
return new QueryableStateStream<>(
queryableStateName,
stateDescriptor,
getKeyType().createSerializer(getExecutionConfig()));
} | [
"@",
"PublicEvolving",
"public",
"QueryableStateStream",
"<",
"KEY",
",",
"T",
">",
"asQueryableState",
"(",
"String",
"queryableStateName",
",",
"ValueStateDescriptor",
"<",
"T",
">",
"stateDescriptor",
")",
"{",
"transform",
"(",
"\"Queryable state: \"",
"+",
"que... | Publishes the keyed stream as a queryable ValueState instance.
@param queryableStateName Name under which to the publish the queryable state instance
@param stateDescriptor State descriptor to create state instance from
@return Queryable state instance | [
"Publishes",
"the",
"keyed",
"stream",
"as",
"a",
"queryable",
"ValueState",
"instance",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java#L1019-L1034 | train | Returns a new QueryableValueStateStream with the given name and value state descriptor. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
23032,
3085,
9153,
22199,
16416,
2213,
1026,
3145,
1010,
1056,
1028,
2004,
4226,
20444,
13510,
12259,
1006,
5164,
23032,
3085,
9153,
6528,
14074,
1010,
5300,
16238,
2229,
23235,
2953,
1026,
1056,
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-system/src/main/java/cn/hutool/system/JavaInfo.java | JavaInfo.getJavaVersionAsInt | private final int getJavaVersionAsInt() {
if (JAVA_VERSION == null) {
return 0;
}
String str = JAVA_VERSION.substring(0, 1);
str = str + JAVA_VERSION.substring(2, 3);
if (JAVA_VERSION.length() >= 5) {
str = str + JAVA_VERSION.substring(4, 5);
} else {
str = str + "0";
}
return Integer.parseInt(str);
} | java | private final int getJavaVersionAsInt() {
if (JAVA_VERSION == null) {
return 0;
}
String str = JAVA_VERSION.substring(0, 1);
str = str + JAVA_VERSION.substring(2, 3);
if (JAVA_VERSION.length() >= 5) {
str = str + JAVA_VERSION.substring(4, 5);
} else {
str = str + "0";
}
return Integer.parseInt(str);
} | [
"private",
"final",
"int",
"getJavaVersionAsInt",
"(",
")",
"{",
"if",
"(",
"JAVA_VERSION",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"String",
"str",
"=",
"JAVA_VERSION",
".",
"substring",
"(",
"0",
",",
"1",
")",
";",
"str",
"=",
"str",
"+",... | 取得当前Java impl.的版本的<code>int</code>值。
@return Java版本的<code>int</code>值或<code>0</code> | [
"取得当前Java",
"impl",
".",
"的版本的<code",
">",
"int<",
"/",
"code",
">",
"值。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-system/src/main/java/cn/hutool/system/JavaInfo.java#L100-L116 | train | Returns the integer value of the Java version field. | [
30522,
2797,
2345,
20014,
2131,
3900,
3567,
27774,
21369,
3372,
1006,
1007,
1063,
2065,
1006,
9262,
1035,
2544,
1027,
1027,
19701,
1007,
1063,
2709,
1014,
1025,
1065,
5164,
2358,
2099,
1027,
9262,
1035,
2544,
1012,
4942,
3367,
4892,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java | PojoSerializer.getSubclassSerializer | TypeSerializer<?> getSubclassSerializer(Class<?> subclass) {
TypeSerializer<?> result = subclassSerializerCache.get(subclass);
if (result == null) {
result = createSubclassSerializer(subclass);
subclassSerializerCache.put(subclass, result);
}
return result;
} | java | TypeSerializer<?> getSubclassSerializer(Class<?> subclass) {
TypeSerializer<?> result = subclassSerializerCache.get(subclass);
if (result == null) {
result = createSubclassSerializer(subclass);
subclassSerializerCache.put(subclass, result);
}
return result;
} | [
"TypeSerializer",
"<",
"?",
">",
"getSubclassSerializer",
"(",
"Class",
"<",
"?",
">",
"subclass",
")",
"{",
"TypeSerializer",
"<",
"?",
">",
"result",
"=",
"subclassSerializerCache",
".",
"get",
"(",
"subclass",
")",
";",
"if",
"(",
"result",
"==",
"null"... | Fetches cached serializer for a non-registered subclass;
also creates the serializer if it doesn't exist yet.
This method is also exposed to package-private access
for testing purposes. | [
"Fetches",
"cached",
"serializer",
"for",
"a",
"non",
"-",
"registered",
"subclass",
";",
"also",
"creates",
"the",
"serializer",
"if",
"it",
"doesn",
"t",
"exist",
"yet",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java#L1061-L1068 | train | Get the subclass serializer for the given class. | [
30522,
4127,
11610,
28863,
1026,
1029,
1028,
4152,
12083,
26266,
8043,
4818,
17629,
1006,
2465,
1026,
1029,
1028,
4942,
26266,
1007,
1063,
4127,
11610,
28863,
1026,
1029,
1028,
2765,
1027,
4942,
26266,
8043,
4818,
17629,
3540,
5403,
1012,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONUtil.java | JSONUtil.readJSON | public static JSON readJSON(File file, Charset charset) throws IORuntimeException {
return parse(FileReader.create(file, charset).readString());
} | java | public static JSON readJSON(File file, Charset charset) throws IORuntimeException {
return parse(FileReader.create(file, charset).readString());
} | [
"public",
"static",
"JSON",
"readJSON",
"(",
"File",
"file",
",",
"Charset",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"parse",
"(",
"FileReader",
".",
"create",
"(",
"file",
",",
"charset",
")",
".",
"readString",
"(",
")",
")",
";",
... | 读取JSON
@param file JSON文件
@param charset 编码
@return JSON(包括JSONObject和JSONArray)
@throws IORuntimeException IO异常 | [
"读取JSON"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L212-L214 | train | Read a JSON file. | [
30522,
2270,
10763,
1046,
3385,
3191,
22578,
2239,
1006,
5371,
5371,
1010,
25869,
13462,
25869,
13462,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
11968,
3366,
1006,
5371,
16416,
4063,
1012,
3443,
1006,
5371,
1010,
25869,
13462... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java | MailUtil.splitAddress | private static List<String> splitAddress(String addresses){
if(StrUtil.isBlank(addresses)) {
return null;
}
List<String> result;
if(StrUtil.contains(addresses, ',')) {
result = StrUtil.splitTrim(addresses, ',');
}else if(StrUtil.contains(addresses, ';')) {
result = StrUtil.splitTrim(addresses, ';');
}else {
result = CollUtil.newArrayList(addresses);
}
return result;
} | java | private static List<String> splitAddress(String addresses){
if(StrUtil.isBlank(addresses)) {
return null;
}
List<String> result;
if(StrUtil.contains(addresses, ',')) {
result = StrUtil.splitTrim(addresses, ',');
}else if(StrUtil.contains(addresses, ';')) {
result = StrUtil.splitTrim(addresses, ';');
}else {
result = CollUtil.newArrayList(addresses);
}
return result;
} | [
"private",
"static",
"List",
"<",
"String",
">",
"splitAddress",
"(",
"String",
"addresses",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"addresses",
")",
")",
"{",
"return",
"null",
";",
"}",
"List",
"<",
"String",
">",
"result",
";",
"if",
... | 将多个联系人转为列表,分隔符为逗号或者分号
@param addresses 多个联系人,如果为空返回null
@return 联系人列表 | [
"将多个联系人转为列表,分隔符为逗号或者分号"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java#L208-L222 | train | Splits the given address string into a list of addresses. | [
30522,
2797,
10763,
2862,
1026,
5164,
1028,
3975,
4215,
16200,
4757,
1006,
5164,
11596,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
11596,
1007,
1007,
1063,
2709,
19701,
1025,
1065,
2862,
1026,
5164,
1028,
2765... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HexUtil.java | HexUtil.appendHex | public static void appendHex(StringBuilder builder, byte b, boolean toLowerCase) {
final char[] toDigits = toLowerCase ? DIGITS_LOWER : DIGITS_UPPER;
int high = (b & 0xf0) >>> 4;//高位
int low = b & 0x0f;//低位
builder.append(toDigits[high]);
builder.append(toDigits[low]);
} | java | public static void appendHex(StringBuilder builder, byte b, boolean toLowerCase) {
final char[] toDigits = toLowerCase ? DIGITS_LOWER : DIGITS_UPPER;
int high = (b & 0xf0) >>> 4;//高位
int low = b & 0x0f;//低位
builder.append(toDigits[high]);
builder.append(toDigits[low]);
} | [
"public",
"static",
"void",
"appendHex",
"(",
"StringBuilder",
"builder",
",",
"byte",
"b",
",",
"boolean",
"toLowerCase",
")",
"{",
"final",
"char",
"[",
"]",
"toDigits",
"=",
"toLowerCase",
"?",
"DIGITS_LOWER",
":",
"DIGITS_UPPER",
";",
"int",
"high",
"=",... | 将byte值转为16进制并添加到{@link StringBuilder}中
@param builder {@link StringBuilder}
@param b byte
@param toLowerCase 是否使用小写
@since 4.4.1 | [
"将byte值转为16进制并添加到",
"{"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java#L330-L337 | train | Appends a hex value to a StringBuilder. | [
30522,
2270,
10763,
11675,
10439,
10497,
5369,
2595,
1006,
5164,
8569,
23891,
2099,
12508,
1010,
24880,
1038,
1010,
22017,
20898,
2000,
27663,
18992,
3366,
1007,
1063,
2345,
25869,
1031,
1033,
28681,
8004,
12762,
1027,
2000,
27663,
18992,
336... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/JarClassLoader.java | JarClassLoader.loadJarToSystemClassLoader | public static URLClassLoader loadJarToSystemClassLoader(File jarFile) {
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
loadJar(urlClassLoader, jarFile);
return urlClassLoader;
} | java | public static URLClassLoader loadJarToSystemClassLoader(File jarFile) {
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
loadJar(urlClassLoader, jarFile);
return urlClassLoader;
} | [
"public",
"static",
"URLClassLoader",
"loadJarToSystemClassLoader",
"(",
"File",
"jarFile",
")",
"{",
"URLClassLoader",
"urlClassLoader",
"=",
"(",
"URLClassLoader",
")",
"ClassLoader",
".",
"getSystemClassLoader",
"(",
")",
";",
"loadJar",
"(",
"urlClassLoader",
",",... | 加载Jar文件到System ClassLoader中
@param jarFile 被加载的jar
@return System ClassLoader | [
"加载Jar文件到System",
"ClassLoader中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/JarClassLoader.java#L78-L82 | train | Load a jar file to the system class loader. | [
30522,
2270,
10763,
24471,
15472,
27102,
11066,
2121,
7170,
16084,
13122,
27268,
6633,
26266,
11066,
2121,
1006,
5371,
15723,
8873,
2571,
1007,
1063,
24471,
30524,
1006,
24471,
15472,
27102,
11066,
2121,
1010,
15723,
8873,
2571,
1007,
1025,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java | Statistics.columnAvgLength | public Statistics columnAvgLength(String columnName, Double avgLen) {
this.columnStats
.computeIfAbsent(columnName, column -> new HashMap<>())
.put(AVG_LENGTH, String.valueOf(avgLen));
return this;
} | java | public Statistics columnAvgLength(String columnName, Double avgLen) {
this.columnStats
.computeIfAbsent(columnName, column -> new HashMap<>())
.put(AVG_LENGTH, String.valueOf(avgLen));
return this;
} | [
"public",
"Statistics",
"columnAvgLength",
"(",
"String",
"columnName",
",",
"Double",
"avgLen",
")",
"{",
"this",
".",
"columnStats",
".",
"computeIfAbsent",
"(",
"columnName",
",",
"column",
"->",
"new",
"HashMap",
"<>",
"(",
")",
")",
".",
"put",
"(",
"... | Sets the average length statistic for the given column. | [
"Sets",
"the",
"average",
"length",
"statistic",
"for",
"the",
"given",
"column",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java#L111-L116 | train | Sets the avg length statistics for the specified column. | [
30522,
2270,
6747,
5930,
11431,
9354,
3070,
2705,
1006,
5164,
5930,
18442,
1010,
3313,
20704,
9354,
2078,
1007,
1063,
2023,
1012,
7753,
29336,
2015,
1012,
24134,
10128,
7875,
5054,
2102,
1006,
5930,
18442,
1010,
5930,
1011,
1028,
2047,
2332... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HpackDecoder.java | HpackDecoder.setMaxHeaderTableSize | public void setMaxHeaderTableSize(long maxHeaderTableSize) throws Http2Exception {
if (maxHeaderTableSize < MIN_HEADER_TABLE_SIZE || maxHeaderTableSize > MAX_HEADER_TABLE_SIZE) {
throw connectionError(PROTOCOL_ERROR, "Header Table Size must be >= %d and <= %d but was %d",
MIN_HEADER_TABLE_SIZE, MAX_HEADER_TABLE_SIZE, maxHeaderTableSize);
}
maxDynamicTableSize = maxHeaderTableSize;
if (maxDynamicTableSize < encoderMaxDynamicTableSize) {
// decoder requires less space than encoder
// encoder MUST signal this change
maxDynamicTableSizeChangeRequired = true;
hpackDynamicTable.setCapacity(maxDynamicTableSize);
}
} | java | public void setMaxHeaderTableSize(long maxHeaderTableSize) throws Http2Exception {
if (maxHeaderTableSize < MIN_HEADER_TABLE_SIZE || maxHeaderTableSize > MAX_HEADER_TABLE_SIZE) {
throw connectionError(PROTOCOL_ERROR, "Header Table Size must be >= %d and <= %d but was %d",
MIN_HEADER_TABLE_SIZE, MAX_HEADER_TABLE_SIZE, maxHeaderTableSize);
}
maxDynamicTableSize = maxHeaderTableSize;
if (maxDynamicTableSize < encoderMaxDynamicTableSize) {
// decoder requires less space than encoder
// encoder MUST signal this change
maxDynamicTableSizeChangeRequired = true;
hpackDynamicTable.setCapacity(maxDynamicTableSize);
}
} | [
"public",
"void",
"setMaxHeaderTableSize",
"(",
"long",
"maxHeaderTableSize",
")",
"throws",
"Http2Exception",
"{",
"if",
"(",
"maxHeaderTableSize",
"<",
"MIN_HEADER_TABLE_SIZE",
"||",
"maxHeaderTableSize",
">",
"MAX_HEADER_TABLE_SIZE",
")",
"{",
"throw",
"connectionError... | Set the maximum table size. If this is below the maximum size of the dynamic table used by
the encoder, the beginning of the next header block MUST signal this change. | [
"Set",
"the",
"maximum",
"table",
"size",
".",
"If",
"this",
"is",
"below",
"the",
"maximum",
"size",
"of",
"the",
"dynamic",
"table",
"used",
"by",
"the",
"encoder",
"the",
"beginning",
"of",
"the",
"next",
"header",
"block",
"MUST",
"signal",
"this",
"... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDecoder.java#L305-L317 | train | Sets the max header table size. | [
30522,
2270,
11675,
2275,
17848,
4974,
8743,
3085,
5332,
4371,
1006,
2146,
4098,
4974,
8743,
3085,
5332,
4371,
1007,
11618,
8299,
2475,
10288,
24422,
1063,
2065,
1006,
4098,
4974,
8743,
3085,
5332,
4371,
1026,
8117,
1035,
20346,
1035,
2795,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Db.java | Db.quietRollback | private void quietRollback(Connection conn) {
if (null != conn) {
try {
conn.rollback();
} catch (Exception e) {
StaticLog.error(e);
}
}
} | java | private void quietRollback(Connection conn) {
if (null != conn) {
try {
conn.rollback();
} catch (Exception e) {
StaticLog.error(e);
}
}
} | [
"private",
"void",
"quietRollback",
"(",
"Connection",
"conn",
")",
"{",
"if",
"(",
"null",
"!=",
"conn",
")",
"{",
"try",
"{",
"conn",
".",
"rollback",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"StaticLog",
".",
"error",
"(",
"... | 静默回滚事务
@param conn Connection | [
"静默回滚事务"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Db.java#L212-L220 | train | Rollbacks the transaction. | [
30522,
2797,
11675,
4251,
28402,
5963,
1006,
4434,
9530,
2078,
1007,
1063,
2065,
1006,
19701,
999,
1027,
9530,
2078,
1007,
1063,
3046,
1063,
9530,
2078,
1012,
4897,
5963,
1006,
1007,
1025,
1065,
4608,
1006,
6453,
1041,
1007,
1063,
10763,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DuplicatingCheckpointOutputStream.java | DuplicatingCheckpointOutputStream.closeAndGetSecondaryHandle | public StreamStateHandle closeAndGetSecondaryHandle() throws IOException {
if (secondaryStreamException == null) {
flushInternalBuffer();
return secondaryOutputStream.closeAndGetHandle();
} else {
throw new IOException("Secondary stream previously failed exceptionally", secondaryStreamException);
}
} | java | public StreamStateHandle closeAndGetSecondaryHandle() throws IOException {
if (secondaryStreamException == null) {
flushInternalBuffer();
return secondaryOutputStream.closeAndGetHandle();
} else {
throw new IOException("Secondary stream previously failed exceptionally", secondaryStreamException);
}
} | [
"public",
"StreamStateHandle",
"closeAndGetSecondaryHandle",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"secondaryStreamException",
"==",
"null",
")",
"{",
"flushInternalBuffer",
"(",
")",
";",
"return",
"secondaryOutputStream",
".",
"closeAndGetHandle",
"(",
... | Returns the state handle from the {@link #secondaryOutputStream}. Also reports suppressed exceptions from earlier
interactions with that stream. | [
"Returns",
"the",
"state",
"handle",
"from",
"the",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/DuplicatingCheckpointOutputStream.java#L261-L268 | train | Closes the underlying stream and returns the handle of the secondary stream. | [
30522,
2270,
9199,
12259,
11774,
2571,
2485,
5685,
18150,
3366,
8663,
7662,
2100,
11774,
2571,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
3905,
21422,
10288,
24422,
1027,
1027,
19701,
1007,
1063,
13862,
18447,
11795,
2389,
8569... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/rank/TopNBuffer.java | TopNBuffer.removeLast | BaseRow removeLast() {
Map.Entry<BaseRow, Collection<BaseRow>> last = treeMap.lastEntry();
BaseRow lastElement = null;
if (last != null) {
Collection<BaseRow> list = last.getValue();
lastElement = getLastElement(list);
if (lastElement != null) {
if (list.remove(lastElement)) {
currentTopNum -= 1;
}
if (list.size() == 0) {
treeMap.remove(last.getKey());
}
}
}
return lastElement;
} | java | BaseRow removeLast() {
Map.Entry<BaseRow, Collection<BaseRow>> last = treeMap.lastEntry();
BaseRow lastElement = null;
if (last != null) {
Collection<BaseRow> list = last.getValue();
lastElement = getLastElement(list);
if (lastElement != null) {
if (list.remove(lastElement)) {
currentTopNum -= 1;
}
if (list.size() == 0) {
treeMap.remove(last.getKey());
}
}
}
return lastElement;
} | [
"BaseRow",
"removeLast",
"(",
")",
"{",
"Map",
".",
"Entry",
"<",
"BaseRow",
",",
"Collection",
"<",
"BaseRow",
">",
">",
"last",
"=",
"treeMap",
".",
"lastEntry",
"(",
")",
";",
"BaseRow",
"lastElement",
"=",
"null",
";",
"if",
"(",
"last",
"!=",
"n... | Removes the last record of the last Entry in the buffer.
@return removed record | [
"Removes",
"the",
"last",
"record",
"of",
"the",
"last",
"Entry",
"in",
"the",
"buffer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/rank/TopNBuffer.java#L122-L138 | train | Removes the last element in the tree. | [
30522,
2918,
10524,
6366,
8523,
2102,
1006,
1007,
1063,
4949,
1012,
4443,
1026,
2918,
10524,
1010,
3074,
1026,
2918,
10524,
1028,
1028,
2197,
1027,
3392,
2863,
2361,
1012,
2197,
4765,
2854,
1006,
1007,
1025,
2918,
10524,
2197,
12260,
3672,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Http2FrameCodec.java | Http2FrameCodec.forEachActiveStream | final void forEachActiveStream(final Http2FrameStreamVisitor streamVisitor) throws Http2Exception {
assert ctx.executor().inEventLoop();
connection().forEachActiveStream(new Http2StreamVisitor() {
@Override
public boolean visit(Http2Stream stream) {
try {
return streamVisitor.visit((Http2FrameStream) stream.getProperty(streamKey));
} catch (Throwable cause) {
onError(ctx, false, cause);
return false;
}
}
});
} | java | final void forEachActiveStream(final Http2FrameStreamVisitor streamVisitor) throws Http2Exception {
assert ctx.executor().inEventLoop();
connection().forEachActiveStream(new Http2StreamVisitor() {
@Override
public boolean visit(Http2Stream stream) {
try {
return streamVisitor.visit((Http2FrameStream) stream.getProperty(streamKey));
} catch (Throwable cause) {
onError(ctx, false, cause);
return false;
}
}
});
} | [
"final",
"void",
"forEachActiveStream",
"(",
"final",
"Http2FrameStreamVisitor",
"streamVisitor",
")",
"throws",
"Http2Exception",
"{",
"assert",
"ctx",
".",
"executor",
"(",
")",
".",
"inEventLoop",
"(",
")",
";",
"connection",
"(",
")",
".",
"forEachActiveStream... | Iterates over all active HTTP/2 streams.
<p>This method must not be called outside of the event loop. | [
"Iterates",
"over",
"all",
"active",
"HTTP",
"/",
"2",
"streams",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodec.java#L186-L200 | train | For each active stream visit the given streamVisitor. | [
30522,
2345,
11675,
18921,
6776,
19620,
21422,
1006,
2345,
8299,
2475,
15643,
21422,
11365,
15660,
5460,
11365,
15660,
1007,
11618,
8299,
2475,
10288,
24422,
1063,
20865,
14931,
2595,
1012,
4654,
8586,
16161,
2099,
1006,
1007,
1012,
1999,
186... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/HadoopOutputFormatBase.java | HadoopOutputFormatBase.open | @Override
public void open(int taskNumber, int numTasks) throws IOException {
// enforce sequential open() calls
synchronized (OPEN_MUTEX) {
if (Integer.toString(taskNumber + 1).length() > 6) {
throw new IOException("Task id too large.");
}
TaskAttemptID taskAttemptID = TaskAttemptID.forName("attempt__0000_r_"
+ String.format("%" + (6 - Integer.toString(taskNumber + 1).length()) + "s", " ").replace(" ", "0")
+ Integer.toString(taskNumber + 1)
+ "_0");
this.jobConf.set("mapred.task.id", taskAttemptID.toString());
this.jobConf.setInt("mapred.task.partition", taskNumber + 1);
// for hadoop 2.2
this.jobConf.set("mapreduce.task.attempt.id", taskAttemptID.toString());
this.jobConf.setInt("mapreduce.task.partition", taskNumber + 1);
this.context = new TaskAttemptContextImpl(this.jobConf, taskAttemptID);
this.outputCommitter = this.jobConf.getOutputCommitter();
JobContext jobContext = new JobContextImpl(this.jobConf, new JobID());
this.outputCommitter.setupJob(jobContext);
this.recordWriter = this.mapredOutputFormat.getRecordWriter(null, this.jobConf, Integer.toString(taskNumber + 1), new HadoopDummyProgressable());
}
} | java | @Override
public void open(int taskNumber, int numTasks) throws IOException {
// enforce sequential open() calls
synchronized (OPEN_MUTEX) {
if (Integer.toString(taskNumber + 1).length() > 6) {
throw new IOException("Task id too large.");
}
TaskAttemptID taskAttemptID = TaskAttemptID.forName("attempt__0000_r_"
+ String.format("%" + (6 - Integer.toString(taskNumber + 1).length()) + "s", " ").replace(" ", "0")
+ Integer.toString(taskNumber + 1)
+ "_0");
this.jobConf.set("mapred.task.id", taskAttemptID.toString());
this.jobConf.setInt("mapred.task.partition", taskNumber + 1);
// for hadoop 2.2
this.jobConf.set("mapreduce.task.attempt.id", taskAttemptID.toString());
this.jobConf.setInt("mapreduce.task.partition", taskNumber + 1);
this.context = new TaskAttemptContextImpl(this.jobConf, taskAttemptID);
this.outputCommitter = this.jobConf.getOutputCommitter();
JobContext jobContext = new JobContextImpl(this.jobConf, new JobID());
this.outputCommitter.setupJob(jobContext);
this.recordWriter = this.mapredOutputFormat.getRecordWriter(null, this.jobConf, Integer.toString(taskNumber + 1), new HadoopDummyProgressable());
}
} | [
"@",
"Override",
"public",
"void",
"open",
"(",
"int",
"taskNumber",
",",
"int",
"numTasks",
")",
"throws",
"IOException",
"{",
"// enforce sequential open() calls",
"synchronized",
"(",
"OPEN_MUTEX",
")",
"{",
"if",
"(",
"Integer",
".",
"toString",
"(",
"taskNu... | create the temporary output file for hadoop RecordWriter.
@param taskNumber The number of the parallel instance.
@param numTasks The number of parallel tasks.
@throws java.io.IOException | [
"create",
"the",
"temporary",
"output",
"file",
"for",
"hadoop",
"RecordWriter",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/HadoopOutputFormatBase.java#L111-L141 | train | This method is called by the TaskManager to open the job. | [
30522,
1030,
2058,
15637,
2270,
11675,
2330,
1006,
20014,
4708,
19172,
5677,
1010,
20014,
16371,
20492,
19895,
2015,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
16306,
25582,
2330,
1006,
1007,
4455,
25549,
1006,
2330,
1035,
20101,
259... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/GenericHiveMetastoreCatalogUtil.java | GenericHiveMetastoreCatalogUtil.createHiveDatabase | public static Database createHiveDatabase(String dbName, CatalogDatabase db) {
Map<String, String> props = db.getProperties();
return new Database(
dbName,
db.getDescription().isPresent() ? db.getDescription().get() : null,
null,
props);
} | java | public static Database createHiveDatabase(String dbName, CatalogDatabase db) {
Map<String, String> props = db.getProperties();
return new Database(
dbName,
db.getDescription().isPresent() ? db.getDescription().get() : null,
null,
props);
} | [
"public",
"static",
"Database",
"createHiveDatabase",
"(",
"String",
"dbName",
",",
"CatalogDatabase",
"db",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"props",
"=",
"db",
".",
"getProperties",
"(",
")",
";",
"return",
"new",
"Database",
"(",
"dbN... | Creates a Hive database from CatalogDatabase. | [
"Creates",
"a",
"Hive",
"database",
"from",
"CatalogDatabase",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/GenericHiveMetastoreCatalogUtil.java#L41-L48 | train | Create a Hive Database from a catalog database. | [
30522,
2270,
10763,
7809,
3443,
4048,
28614,
2696,
15058,
1006,
5164,
16962,
18442,
1010,
12105,
2850,
2696,
15058,
16962,
1007,
1063,
4949,
1026,
5164,
1010,
5164,
1028,
24387,
1027,
16962,
1012,
2131,
21572,
4842,
7368,
1006,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.newArrayList | public static <T> ArrayList<T> newArrayList(Iterable<T> iterable) {
return (ArrayList<T>) list(false, iterable);
} | java | public static <T> ArrayList<T> newArrayList(Iterable<T> iterable) {
return (ArrayList<T>) list(false, iterable);
} | [
"public",
"static",
"<",
"T",
">",
"ArrayList",
"<",
"T",
">",
"newArrayList",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
")",
"{",
"return",
"(",
"ArrayList",
"<",
"T",
">",
")",
"list",
"(",
"false",
",",
"iterable",
")",
";",
"}"
] | 新建一个ArrayList<br>
提供的参数为null时返回空{@link ArrayList}
@param <T> 集合元素类型
@param iterable {@link Iterable}
@return ArrayList对象
@since 3.1.0 | [
"新建一个ArrayList<br",
">",
"提供的参数为null时返回空",
"{",
"@link",
"ArrayList",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L655-L657 | train | Creates an ArrayList from the given iterable. | [
30522,
2270,
10763,
1026,
1056,
1028,
9140,
9863,
1026,
1056,
1028,
2047,
2906,
9447,
9863,
1006,
2009,
6906,
3468,
1026,
1056,
1028,
2009,
6906,
3468,
1007,
1063,
2709,
1006,
9140,
9863,
1026,
1056,
1028,
1007,
2862,
1006,
6270,
1010,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.getEndValue | public static int getEndValue(Calendar calendar, int dateField) {
if(Calendar.DAY_OF_WEEK == dateField) {
return (calendar.getFirstDayOfWeek() + 6) % 7;
}
return calendar.getActualMaximum(dateField);
} | java | public static int getEndValue(Calendar calendar, int dateField) {
if(Calendar.DAY_OF_WEEK == dateField) {
return (calendar.getFirstDayOfWeek() + 6) % 7;
}
return calendar.getActualMaximum(dateField);
} | [
"public",
"static",
"int",
"getEndValue",
"(",
"Calendar",
"calendar",
",",
"int",
"dateField",
")",
"{",
"if",
"(",
"Calendar",
".",
"DAY_OF_WEEK",
"==",
"dateField",
")",
"{",
"return",
"(",
"calendar",
".",
"getFirstDayOfWeek",
"(",
")",
"+",
"6",
")",
... | 获取指定日期字段的最大值,例如分钟的最小值是59
@param calendar {@link Calendar}
@param dateField {@link DateField}
@return 字段最大值
@since 4.5.7
@see Calendar#getActualMaximum(int) | [
"获取指定日期字段的最大值,例如分钟的最小值是59"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1696-L1701 | train | Returns the value of the specified field in the given calendar. | [
30522,
2270,
10763,
20014,
2131,
10497,
10175,
5657,
1006,
8094,
8094,
1010,
20014,
3058,
3790,
1007,
1063,
2065,
1006,
8094,
1012,
2154,
1035,
1997,
1035,
2733,
1027,
1027,
3058,
3790,
1007,
1063,
2709,
1006,
8094,
1012,
2131,
8873,
12096,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | utility/src/main/java/com/networknt/utility/StringUtils.java | StringUtils.inputStreamToString | public static String inputStreamToString(InputStream inputStream, Charset charset) throws IOException {
if (inputStream != null && inputStream.available() != -1) {
ByteArrayOutputStream result = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) != -1) {
result.write(buffer, 0, length);
}
if (charset != null) {
return result.toString(charset.name());
}
return result.toString(StandardCharsets.UTF_8.name());
}
return null;
} | java | public static String inputStreamToString(InputStream inputStream, Charset charset) throws IOException {
if (inputStream != null && inputStream.available() != -1) {
ByteArrayOutputStream result = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inputStream.read(buffer)) != -1) {
result.write(buffer, 0, length);
}
if (charset != null) {
return result.toString(charset.name());
}
return result.toString(StandardCharsets.UTF_8.name());
}
return null;
} | [
"public",
"static",
"String",
"inputStreamToString",
"(",
"InputStream",
"inputStream",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inputStream",
"!=",
"null",
"&&",
"inputStream",
".",
"available",
"(",
")",
"!=",
"-",
"1",
")",
... | Convert an InputStream into a String.
Highest performing conversion per: https://stackoverflow.com/a/35446009
@param inputStream The input stream to be converted.
@param charset The decoding charset to use.
@return The string value of the input stream, null otherwise.
@throws IOException If there are any issues in reading from the stream. | [
"Convert",
"an",
"InputStream",
"into",
"a",
"String",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/StringUtils.java#L1265-L1279 | train | This method is used to convert an input stream to a string. | [
30522,
2270,
10763,
5164,
20407,
25379,
13122,
18886,
3070,
1006,
20407,
25379,
20407,
25379,
1010,
25869,
13462,
25869,
13462,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
20407,
25379,
999,
1027,
19701,
1004,
1004,
20407,
25379,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | examples/src/main/java/org/apache/spark/examples/sql/hive/JavaSparkHiveExample.java | JavaSparkHiveExample.main | public static void main(String[] args) {
// $example on:spark_hive$
// warehouseLocation points to the default location for managed databases and tables
String warehouseLocation = new File("spark-warehouse").getAbsolutePath();
SparkSession spark = SparkSession
.builder()
.appName("Java Spark Hive Example")
.config("spark.sql.warehouse.dir", warehouseLocation)
.enableHiveSupport()
.getOrCreate();
spark.sql("CREATE TABLE IF NOT EXISTS src (key INT, value STRING) USING hive");
spark.sql("LOAD DATA LOCAL INPATH 'examples/src/main/resources/kv1.txt' INTO TABLE src");
// Queries are expressed in HiveQL
spark.sql("SELECT * FROM src").show();
// +---+-------+
// |key| value|
// +---+-------+
// |238|val_238|
// | 86| val_86|
// |311|val_311|
// ...
// Aggregation queries are also supported.
spark.sql("SELECT COUNT(*) FROM src").show();
// +--------+
// |count(1)|
// +--------+
// | 500 |
// +--------+
// The results of SQL queries are themselves DataFrames and support all normal functions.
Dataset<Row> sqlDF = spark.sql("SELECT key, value FROM src WHERE key < 10 ORDER BY key");
// The items in DataFrames are of type Row, which lets you to access each column by ordinal.
Dataset<String> stringsDS = sqlDF.map(
(MapFunction<Row, String>) row -> "Key: " + row.get(0) + ", Value: " + row.get(1),
Encoders.STRING());
stringsDS.show();
// +--------------------+
// | value|
// +--------------------+
// |Key: 0, Value: val_0|
// |Key: 0, Value: val_0|
// |Key: 0, Value: val_0|
// ...
// You can also use DataFrames to create temporary views within a SparkSession.
List<Record> records = new ArrayList<>();
for (int key = 1; key < 100; key++) {
Record record = new Record();
record.setKey(key);
record.setValue("val_" + key);
records.add(record);
}
Dataset<Row> recordsDF = spark.createDataFrame(records, Record.class);
recordsDF.createOrReplaceTempView("records");
// Queries can then join DataFrames data with data stored in Hive.
spark.sql("SELECT * FROM records r JOIN src s ON r.key = s.key").show();
// +---+------+---+------+
// |key| value|key| value|
// +---+------+---+------+
// | 2| val_2| 2| val_2|
// | 2| val_2| 2| val_2|
// | 4| val_4| 4| val_4|
// ...
// $example off:spark_hive$
spark.stop();
} | java | public static void main(String[] args) {
// $example on:spark_hive$
// warehouseLocation points to the default location for managed databases and tables
String warehouseLocation = new File("spark-warehouse").getAbsolutePath();
SparkSession spark = SparkSession
.builder()
.appName("Java Spark Hive Example")
.config("spark.sql.warehouse.dir", warehouseLocation)
.enableHiveSupport()
.getOrCreate();
spark.sql("CREATE TABLE IF NOT EXISTS src (key INT, value STRING) USING hive");
spark.sql("LOAD DATA LOCAL INPATH 'examples/src/main/resources/kv1.txt' INTO TABLE src");
// Queries are expressed in HiveQL
spark.sql("SELECT * FROM src").show();
// +---+-------+
// |key| value|
// +---+-------+
// |238|val_238|
// | 86| val_86|
// |311|val_311|
// ...
// Aggregation queries are also supported.
spark.sql("SELECT COUNT(*) FROM src").show();
// +--------+
// |count(1)|
// +--------+
// | 500 |
// +--------+
// The results of SQL queries are themselves DataFrames and support all normal functions.
Dataset<Row> sqlDF = spark.sql("SELECT key, value FROM src WHERE key < 10 ORDER BY key");
// The items in DataFrames are of type Row, which lets you to access each column by ordinal.
Dataset<String> stringsDS = sqlDF.map(
(MapFunction<Row, String>) row -> "Key: " + row.get(0) + ", Value: " + row.get(1),
Encoders.STRING());
stringsDS.show();
// +--------------------+
// | value|
// +--------------------+
// |Key: 0, Value: val_0|
// |Key: 0, Value: val_0|
// |Key: 0, Value: val_0|
// ...
// You can also use DataFrames to create temporary views within a SparkSession.
List<Record> records = new ArrayList<>();
for (int key = 1; key < 100; key++) {
Record record = new Record();
record.setKey(key);
record.setValue("val_" + key);
records.add(record);
}
Dataset<Row> recordsDF = spark.createDataFrame(records, Record.class);
recordsDF.createOrReplaceTempView("records");
// Queries can then join DataFrames data with data stored in Hive.
spark.sql("SELECT * FROM records r JOIN src s ON r.key = s.key").show();
// +---+------+---+------+
// |key| value|key| value|
// +---+------+---+------+
// | 2| val_2| 2| val_2|
// | 2| val_2| 2| val_2|
// | 4| val_4| 4| val_4|
// ...
// $example off:spark_hive$
spark.stop();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"// $example on:spark_hive$",
"// warehouseLocation points to the default location for managed databases and tables",
"String",
"warehouseLocation",
"=",
"new",
"File",
"(",
"\"spark-warehouse\"",
... | $example off:spark_hive$ | [
"$example",
"off",
":",
"spark_hive$"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/examples/src/main/java/org/apache/spark/examples/sql/hive/JavaSparkHiveExample.java#L57-L128 | train | Example of creating a table and reading data from a file. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
1013,
1013,
1002,
2742,
2006,
1024,
12125,
1035,
26736,
1002,
1013,
1013,
9746,
4135,
10719,
2685,
2000,
1996,
12398,
3295,
2005,
3266,
17881,
1998,
7251,
516... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/SparkLauncher.java | SparkLauncher.launch | public Process launch() throws IOException {
ProcessBuilder pb = createBuilder();
boolean outputToLog = outputStream == null;
boolean errorToLog = !redirectErrorStream && errorStream == null;
String loggerName = getLoggerName();
if (loggerName != null && outputToLog && errorToLog) {
pb.redirectErrorStream(true);
}
Process childProc = pb.start();
if (loggerName != null) {
InputStream logStream = outputToLog ? childProc.getInputStream() : childProc.getErrorStream();
new OutputRedirector(logStream, loggerName, REDIRECTOR_FACTORY);
}
return childProc;
} | java | public Process launch() throws IOException {
ProcessBuilder pb = createBuilder();
boolean outputToLog = outputStream == null;
boolean errorToLog = !redirectErrorStream && errorStream == null;
String loggerName = getLoggerName();
if (loggerName != null && outputToLog && errorToLog) {
pb.redirectErrorStream(true);
}
Process childProc = pb.start();
if (loggerName != null) {
InputStream logStream = outputToLog ? childProc.getInputStream() : childProc.getErrorStream();
new OutputRedirector(logStream, loggerName, REDIRECTOR_FACTORY);
}
return childProc;
} | [
"public",
"Process",
"launch",
"(",
")",
"throws",
"IOException",
"{",
"ProcessBuilder",
"pb",
"=",
"createBuilder",
"(",
")",
";",
"boolean",
"outputToLog",
"=",
"outputStream",
"==",
"null",
";",
"boolean",
"errorToLog",
"=",
"!",
"redirectErrorStream",
"&&",
... | Launches a sub-process that will start the configured Spark application.
<p>
The {@link #startApplication(SparkAppHandle.Listener...)} method is preferred when launching
Spark, since it provides better control of the child application.
@return A process handle for the Spark app. | [
"Launches",
"a",
"sub",
"-",
"process",
"that",
"will",
"start",
"the",
"configured",
"Spark",
"application",
".",
"<p",
">",
"The",
"{",
"@link",
"#startApplication",
"(",
"SparkAppHandle",
".",
"Listener",
"...",
")",
"}",
"method",
"is",
"preferred",
"whe... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/SparkLauncher.java#L312-L330 | train | Launch the process. | [
30522,
2270,
2832,
4888,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
2832,
8569,
23891,
2099,
1052,
2497,
1027,
3443,
8569,
23891,
2099,
1006,
1007,
1025,
22017,
20898,
6434,
3406,
21197,
1027,
27852,
25379,
1027,
1027,
19701,
1025,
22017,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/sampling/PoissonSampler.java | PoissonSampler.sample | @Override
public Iterator<T> sample(final Iterator<T> input) {
if (fraction == 0) {
return emptyIterable;
}
return new SampledIterator<T>() {
T currentElement;
int currentCount = 0;
@Override
public boolean hasNext() {
if (currentCount > 0) {
return true;
} else {
samplingProcess();
if (currentCount > 0) {
return true;
} else {
return false;
}
}
}
@Override
public T next() {
if (currentCount <= 0) {
samplingProcess();
}
currentCount--;
return currentElement;
}
public int poisson_ge1(double p) {
// sample 'k' from Poisson(p), conditioned to k >= 1.
double q = Math.pow(Math.E, -p);
// simulate a poisson trial such that k >= 1.
double t = q + (1 - q) * random.nextDouble();
int k = 1;
// continue standard poisson generation trials.
t = t * random.nextDouble();
while (t > q) {
k++;
t = t * random.nextDouble();
}
return k;
}
private void skipGapElements(int num) {
// skip the elements that occurrence number is zero.
int elementCount = 0;
while (input.hasNext() && elementCount < num) {
currentElement = input.next();
elementCount++;
}
}
private void samplingProcess() {
if (fraction <= THRESHOLD) {
double u = Math.max(random.nextDouble(), EPSILON);
int gap = (int) (Math.log(u) / -fraction);
skipGapElements(gap);
if (input.hasNext()) {
currentElement = input.next();
currentCount = poisson_ge1(fraction);
}
} else {
while (input.hasNext()) {
currentElement = input.next();
currentCount = poissonDistribution.sample();
if (currentCount > 0) {
break;
}
}
}
}
};
} | java | @Override
public Iterator<T> sample(final Iterator<T> input) {
if (fraction == 0) {
return emptyIterable;
}
return new SampledIterator<T>() {
T currentElement;
int currentCount = 0;
@Override
public boolean hasNext() {
if (currentCount > 0) {
return true;
} else {
samplingProcess();
if (currentCount > 0) {
return true;
} else {
return false;
}
}
}
@Override
public T next() {
if (currentCount <= 0) {
samplingProcess();
}
currentCount--;
return currentElement;
}
public int poisson_ge1(double p) {
// sample 'k' from Poisson(p), conditioned to k >= 1.
double q = Math.pow(Math.E, -p);
// simulate a poisson trial such that k >= 1.
double t = q + (1 - q) * random.nextDouble();
int k = 1;
// continue standard poisson generation trials.
t = t * random.nextDouble();
while (t > q) {
k++;
t = t * random.nextDouble();
}
return k;
}
private void skipGapElements(int num) {
// skip the elements that occurrence number is zero.
int elementCount = 0;
while (input.hasNext() && elementCount < num) {
currentElement = input.next();
elementCount++;
}
}
private void samplingProcess() {
if (fraction <= THRESHOLD) {
double u = Math.max(random.nextDouble(), EPSILON);
int gap = (int) (Math.log(u) / -fraction);
skipGapElements(gap);
if (input.hasNext()) {
currentElement = input.next();
currentCount = poisson_ge1(fraction);
}
} else {
while (input.hasNext()) {
currentElement = input.next();
currentCount = poissonDistribution.sample();
if (currentCount > 0) {
break;
}
}
}
}
};
} | [
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"sample",
"(",
"final",
"Iterator",
"<",
"T",
">",
"input",
")",
"{",
"if",
"(",
"fraction",
"==",
"0",
")",
"{",
"return",
"emptyIterable",
";",
"}",
"return",
"new",
"SampledIterator",
"<",
"T",
... | Sample the input elements, for each input element, generate its count following a poisson
distribution.
@param input Elements to be sampled.
@return The sampled result which is lazy computed upon input elements. | [
"Sample",
"the",
"input",
"elements",
"for",
"each",
"input",
"element",
"generate",
"its",
"count",
"following",
"a",
"poisson",
"distribution",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/sampling/PoissonSampler.java#L85-L162 | train | Samples an iterator of elements from the input. | [
30522,
1030,
2058,
15637,
2270,
2009,
6906,
4263,
1026,
1056,
1028,
7099,
1006,
2345,
2009,
6906,
4263,
1026,
1056,
1028,
7953,
1007,
1063,
2065,
1006,
12884,
1027,
1027,
1014,
1007,
1063,
2709,
4064,
21646,
3085,
1025,
1065,
2709,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/Proxy.java | Proxy.setSslProxy | public Proxy setSslProxy(String sslProxy) {
verifyProxyTypeCompatibility(ProxyType.MANUAL);
this.proxyType = ProxyType.MANUAL;
this.sslProxy = sslProxy;
return this;
} | java | public Proxy setSslProxy(String sslProxy) {
verifyProxyTypeCompatibility(ProxyType.MANUAL);
this.proxyType = ProxyType.MANUAL;
this.sslProxy = sslProxy;
return this;
} | [
"public",
"Proxy",
"setSslProxy",
"(",
"String",
"sslProxy",
")",
"{",
"verifyProxyTypeCompatibility",
"(",
"ProxyType",
".",
"MANUAL",
")",
";",
"this",
".",
"proxyType",
"=",
"ProxyType",
".",
"MANUAL",
";",
"this",
".",
"sslProxy",
"=",
"sslProxy",
";",
"... | Specify which proxy to use for SSL connections.
@param sslProxy the proxy host, expected format is <code>hostname.com:1234</code>
@return reference to self | [
"Specify",
"which",
"proxy",
"to",
"use",
"for",
"SSL",
"connections",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/Proxy.java#L283-L288 | train | Sets the SSL proxy. | [
30522,
2270,
24540,
4520,
14540,
21572,
18037,
1006,
5164,
7020,
14277,
3217,
18037,
1007,
1063,
20410,
21572,
18037,
13874,
9006,
24952,
8553,
1006,
24540,
13874,
1012,
6410,
1007,
1025,
2023,
1012,
24540,
13874,
1027,
24540,
13874,
1012,
64... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Select.java | Select.selectByVisibleText | @Override
public void selectByVisibleText(String text) {
// try to find the option via XPATH ...
List<WebElement> options =
element.findElements(By.xpath(".//option[normalize-space(.) = " + Quotes.escape(text) + "]"));
for (WebElement option : options) {
setSelected(option, true);
if (!isMultiple()) {
return;
}
}
boolean matched = !options.isEmpty();
if (!matched && text.contains(" ")) {
String subStringWithoutSpace = getLongestSubstringWithoutSpace(text);
List<WebElement> candidates;
if ("".equals(subStringWithoutSpace)) {
// hmm, text is either empty or contains only spaces - get all options ...
candidates = element.findElements(By.tagName("option"));
} else {
// get candidates via XPATH ...
candidates =
element.findElements(By.xpath(".//option[contains(., " +
Quotes.escape(subStringWithoutSpace) + ")]"));
}
for (WebElement option : candidates) {
if (text.equals(option.getText())) {
setSelected(option, true);
if (!isMultiple()) {
return;
}
matched = true;
}
}
}
if (!matched) {
throw new NoSuchElementException("Cannot locate option with text: " + text);
}
} | java | @Override
public void selectByVisibleText(String text) {
// try to find the option via XPATH ...
List<WebElement> options =
element.findElements(By.xpath(".//option[normalize-space(.) = " + Quotes.escape(text) + "]"));
for (WebElement option : options) {
setSelected(option, true);
if (!isMultiple()) {
return;
}
}
boolean matched = !options.isEmpty();
if (!matched && text.contains(" ")) {
String subStringWithoutSpace = getLongestSubstringWithoutSpace(text);
List<WebElement> candidates;
if ("".equals(subStringWithoutSpace)) {
// hmm, text is either empty or contains only spaces - get all options ...
candidates = element.findElements(By.tagName("option"));
} else {
// get candidates via XPATH ...
candidates =
element.findElements(By.xpath(".//option[contains(., " +
Quotes.escape(subStringWithoutSpace) + ")]"));
}
for (WebElement option : candidates) {
if (text.equals(option.getText())) {
setSelected(option, true);
if (!isMultiple()) {
return;
}
matched = true;
}
}
}
if (!matched) {
throw new NoSuchElementException("Cannot locate option with text: " + text);
}
} | [
"@",
"Override",
"public",
"void",
"selectByVisibleText",
"(",
"String",
"text",
")",
"{",
"// try to find the option via XPATH ...",
"List",
"<",
"WebElement",
">",
"options",
"=",
"element",
".",
"findElements",
"(",
"By",
".",
"xpath",
"(",
"\".//option[normalize... | Select all options that display text matching the argument. That is, when given "Bar" this
would select an option like:
<option value="foo">Bar</option>
@param text The visible text to match against
@throws NoSuchElementException If no matching option elements are found | [
"Select",
"all",
"options",
"that",
"display",
"text",
"matching",
"the",
"argument",
".",
"That",
"is",
"when",
"given",
"Bar",
"this",
"would",
"select",
"an",
"option",
"like",
":"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/Select.java#L110-L150 | train | Override the method to select the option with the specified text. | [
30522,
1030,
2058,
15637,
2270,
11675,
7276,
3762,
11365,
7028,
18209,
1006,
5164,
3793,
1007,
1063,
1013,
1013,
3046,
2000,
2424,
1996,
5724,
3081,
26726,
8988,
1012,
1012,
1012,
2862,
1026,
4773,
12260,
3672,
1028,
7047,
1027,
5783,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java | ThriftHttpServlet.getHttpOnlyCookieHeader | private static String getHttpOnlyCookieHeader(Cookie cookie) {
NewCookie newCookie = new NewCookie(cookie.getName(), cookie.getValue(),
cookie.getPath(), cookie.getDomain(), cookie.getVersion(),
cookie.getComment(), cookie.getMaxAge(), cookie.getSecure());
return newCookie + "; HttpOnly";
} | java | private static String getHttpOnlyCookieHeader(Cookie cookie) {
NewCookie newCookie = new NewCookie(cookie.getName(), cookie.getValue(),
cookie.getPath(), cookie.getDomain(), cookie.getVersion(),
cookie.getComment(), cookie.getMaxAge(), cookie.getSecure());
return newCookie + "; HttpOnly";
} | [
"private",
"static",
"String",
"getHttpOnlyCookieHeader",
"(",
"Cookie",
"cookie",
")",
"{",
"NewCookie",
"newCookie",
"=",
"new",
"NewCookie",
"(",
"cookie",
".",
"getName",
"(",
")",
",",
"cookie",
".",
"getValue",
"(",
")",
",",
"cookie",
".",
"getPath",
... | Generate httponly cookie from HS2 cookie
@param cookie HS2 generated cookie
@return The httponly cookie | [
"Generate",
"httponly",
"cookie",
"from",
"HS2",
"cookie"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java#L303-L308 | train | Get the HttpOnly cookie header | [
30522,
2797,
10763,
5164,
2131,
11039,
25856,
2239,
2135,
3597,
23212,
11106,
13775,
2121,
1006,
17387,
17387,
1007,
1063,
2047,
3597,
23212,
2063,
2047,
3597,
23212,
2063,
1027,
2047,
2047,
3597,
23212,
2063,
1006,
17387,
1012,
2131,
18442,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONConverter.java | JSONConverter.toList | protected static <T> List<T> toList(JSONArray jsonArray, Class<T> elementType) {
return Convert.toList(elementType, jsonArray);
} | java | protected static <T> List<T> toList(JSONArray jsonArray, Class<T> elementType) {
return Convert.toList(elementType, jsonArray);
} | [
"protected",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"toList",
"(",
"JSONArray",
"jsonArray",
",",
"Class",
"<",
"T",
">",
"elementType",
")",
"{",
"return",
"Convert",
".",
"toList",
"(",
"elementType",
",",
"jsonArray",
")",
";",
"}"
] | 将JSONArray转换为指定类型的对量列表
@param <T> 元素类型
@param jsonArray JSONArray
@param elementType 对象元素类型
@return 对象列表 | [
"将JSONArray转换为指定类型的对量列表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONConverter.java#L50-L52 | train | Converts a JSONArray to a List of the given type. | [
30522,
5123,
10763,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
2000,
9863,
1006,
1046,
3385,
2906,
9447,
1046,
3385,
2906,
9447,
1010,
2465,
1026,
1056,
1028,
5783,
13874,
1007,
1063,
2709,
10463,
1012,
2000,
9863,
1006,
5783,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperUtilityFactory.java | ZooKeeperUtilityFactory.createZooKeeperStateHandleStore | public <T extends Serializable> ZooKeeperStateHandleStore<T> createZooKeeperStateHandleStore(
String zkStateHandleStorePath,
RetrievableStateStorageHelper<T> stateStorageHelper) throws Exception {
return ZooKeeperUtils.createZooKeeperStateHandleStore(
facade,
zkStateHandleStorePath,
stateStorageHelper);
} | java | public <T extends Serializable> ZooKeeperStateHandleStore<T> createZooKeeperStateHandleStore(
String zkStateHandleStorePath,
RetrievableStateStorageHelper<T> stateStorageHelper) throws Exception {
return ZooKeeperUtils.createZooKeeperStateHandleStore(
facade,
zkStateHandleStorePath,
stateStorageHelper);
} | [
"public",
"<",
"T",
"extends",
"Serializable",
">",
"ZooKeeperStateHandleStore",
"<",
"T",
">",
"createZooKeeperStateHandleStore",
"(",
"String",
"zkStateHandleStorePath",
",",
"RetrievableStateStorageHelper",
"<",
"T",
">",
"stateStorageHelper",
")",
"throws",
"Exception... | Creates a {@link ZooKeeperStateHandleStore} instance with the provided arguments.
@param zkStateHandleStorePath specifying the path in ZooKeeper to store the state handles to
@param stateStorageHelper storing the actual state data
@param <T> Type of the state to be stored
@return a ZooKeeperStateHandleStore instance
@throws Exception if ZooKeeper could not create the provided state handle store path in
ZooKeeper | [
"Creates",
"a",
"{",
"@link",
"ZooKeeperStateHandleStore",
"}",
"instance",
"with",
"the",
"provided",
"arguments",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/zookeeper/ZooKeeperUtilityFactory.java#L79-L87 | train | Create a ZooKeeperStateHandleStore. | [
30522,
2270,
1026,
1056,
8908,
7642,
21335,
3468,
1028,
9201,
24764,
12259,
11774,
4244,
19277,
1026,
1056,
1028,
3443,
23221,
24764,
12259,
11774,
4244,
19277,
1006,
5164,
1062,
5705,
12259,
11774,
4244,
19277,
15069,
1010,
2128,
18886,
1333... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.mul | public static BigDecimal mul(String v1, String v2) {
return mul(new BigDecimal(v1), new BigDecimal(v2));
} | java | public static BigDecimal mul(String v1, String v2) {
return mul(new BigDecimal(v1), new BigDecimal(v2));
} | [
"public",
"static",
"BigDecimal",
"mul",
"(",
"String",
"v1",
",",
"String",
"v2",
")",
"{",
"return",
"mul",
"(",
"new",
"BigDecimal",
"(",
"v1",
")",
",",
"new",
"BigDecimal",
"(",
"v2",
")",
")",
";",
"}"
] | 提供精确的乘法运算
@param v1 被乘数
@param v2 乘数
@return 积
@since 3.0.8 | [
"提供精确的乘法运算"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L424-L426 | train | Multiply two numbers. | [
30522,
2270,
10763,
2502,
3207,
6895,
9067,
14163,
2140,
1006,
5164,
1058,
2487,
1010,
5164,
1058,
2475,
1007,
1063,
2709,
14163,
2140,
1006,
2047,
2502,
3207,
6895,
9067,
1006,
1058,
2487,
1007,
1010,
2047,
2502,
3207,
6895,
9067,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java | StreamTask.createStateBackend | private StateBackend createStateBackend() throws Exception {
final StateBackend fromApplication = configuration.getStateBackend(getUserCodeClassLoader());
return StateBackendLoader.fromApplicationOrConfigOrDefault(
fromApplication,
getEnvironment().getTaskManagerInfo().getConfiguration(),
getUserCodeClassLoader(),
LOG);
} | java | private StateBackend createStateBackend() throws Exception {
final StateBackend fromApplication = configuration.getStateBackend(getUserCodeClassLoader());
return StateBackendLoader.fromApplicationOrConfigOrDefault(
fromApplication,
getEnvironment().getTaskManagerInfo().getConfiguration(),
getUserCodeClassLoader(),
LOG);
} | [
"private",
"StateBackend",
"createStateBackend",
"(",
")",
"throws",
"Exception",
"{",
"final",
"StateBackend",
"fromApplication",
"=",
"configuration",
".",
"getStateBackend",
"(",
"getUserCodeClassLoader",
"(",
")",
")",
";",
"return",
"StateBackendLoader",
".",
"fr... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java#L813-L821 | train | Create the state backend. | [
30522,
2797,
2110,
5963,
10497,
9005,
12259,
5963,
10497,
1006,
1007,
11618,
6453,
1063,
2345,
2110,
5963,
10497,
2013,
29098,
19341,
3508,
1027,
9563,
1012,
4152,
12259,
5963,
30524,
10230,
22287,
5162,
4590,
2378,
14876,
1006,
1007,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/ConsistentHash.java | ConsistentHash.remove | public void remove(T node) {
for (int i = 0; i < numberOfReplicas; i++) {
circle.remove(hashFunc.hash(node.toString() + i));
}
} | java | public void remove(T node) {
for (int i = 0; i < numberOfReplicas; i++) {
circle.remove(hashFunc.hash(node.toString() + i));
}
} | [
"public",
"void",
"remove",
"(",
"T",
"node",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numberOfReplicas",
";",
"i",
"++",
")",
"{",
"circle",
".",
"remove",
"(",
"hashFunc",
".",
"hash",
"(",
"node",
".",
"toString",
"(",
")",
... | 移除节点的同时移除相应的虚拟节点
@param node 节点对象 | [
"移除节点的同时移除相应的虚拟节点"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/ConsistentHash.java#L78-L82 | train | Remove a node from the cluster. | [
30522,
2270,
11675,
6366,
1006,
1056,
13045,
1007,
1063,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
2193,
11253,
2890,
24759,
5555,
2015,
1025,
1045,
1009,
1009,
1007,
1063,
4418,
1012,
6366,
1006,
23325,
11263,
12273,
1012,
233... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/statemachine/event/Event.java | Event.formatAddress | public static String formatAddress(int address) {
int b1 = (address >>> 24) & 0xff;
int b2 = (address >>> 16) & 0xff;
int b3 = (address >>> 8) & 0xff;
int b4 = address & 0xff;
return "" + b1 + '.' + b2 + '.' + b3 + '.' + b4;
} | java | public static String formatAddress(int address) {
int b1 = (address >>> 24) & 0xff;
int b2 = (address >>> 16) & 0xff;
int b3 = (address >>> 8) & 0xff;
int b4 = address & 0xff;
return "" + b1 + '.' + b2 + '.' + b3 + '.' + b4;
} | [
"public",
"static",
"String",
"formatAddress",
"(",
"int",
"address",
")",
"{",
"int",
"b1",
"=",
"(",
"address",
">>>",
"24",
")",
"&",
"0xff",
";",
"int",
"b2",
"=",
"(",
"address",
">>>",
"16",
")",
"&",
"0xff",
";",
"int",
"b3",
"=",
"(",
"ad... | Util method to create a string representation of a 32 bit integer representing
an IPv4 address.
@param address The address, MSB first.
@return The IP address string. | [
"Util",
"method",
"to",
"create",
"a",
"string",
"representation",
"of",
"a",
"32",
"bit",
"integer",
"representing",
"an",
"IPv4",
"address",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/statemachine/event/Event.java#L96-L103 | train | Format an address into a string | [
30522,
2270,
10763,
5164,
4289,
4215,
16200,
4757,
1006,
20014,
4769,
1007,
1063,
20014,
29491,
1027,
1006,
4769,
1028,
1028,
1028,
2484,
1007,
1004,
1014,
2595,
4246,
1025,
20014,
1038,
2475,
1027,
1006,
4769,
1028,
1028,
1028,
2385,
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-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java | VelocityUtil.toFile | public static void toFile(Template template, VelocityContext context, String destPath) {
PrintWriter writer = null;
try {
writer = FileUtil.getPrintWriter(destPath, Velocity.getProperty(Velocity.INPUT_ENCODING).toString(), false);
merge(template, context, writer);
} catch (IORuntimeException e) {
throw new UtilException(e, "Write Velocity content to [{}] error!", destPath);
} finally {
IoUtil.close(writer);
}
} | java | public static void toFile(Template template, VelocityContext context, String destPath) {
PrintWriter writer = null;
try {
writer = FileUtil.getPrintWriter(destPath, Velocity.getProperty(Velocity.INPUT_ENCODING).toString(), false);
merge(template, context, writer);
} catch (IORuntimeException e) {
throw new UtilException(e, "Write Velocity content to [{}] error!", destPath);
} finally {
IoUtil.close(writer);
}
} | [
"public",
"static",
"void",
"toFile",
"(",
"Template",
"template",
",",
"VelocityContext",
"context",
",",
"String",
"destPath",
")",
"{",
"PrintWriter",
"writer",
"=",
"null",
";",
"try",
"{",
"writer",
"=",
"FileUtil",
".",
"getPrintWriter",
"(",
"destPath",... | 生成文件
@param template 模板
@param context 模板上下文
@param destPath 目标路径(绝对) | [
"生成文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L165-L175 | train | Write the contents of the given Velocity template to the given destination path. | [
30522,
2270,
10763,
11675,
2000,
8873,
2571,
1006,
23561,
23561,
1010,
10146,
8663,
18209,
6123,
1010,
5164,
4078,
25856,
8988,
1007,
1063,
6140,
15994,
3213,
1027,
19701,
1025,
3046,
1063,
3213,
1027,
5371,
21823,
2140,
1012,
2131,
16550,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowCompressionConfigurer.java | UndertowCompressionConfigurer.configureCompression | public static HttpHandler configureCompression(Compression compression,
HttpHandler httpHandler) {
if (compression == null || !compression.getEnabled()) {
return httpHandler;
}
ContentEncodingRepository repository = new ContentEncodingRepository();
repository.addEncodingHandler("gzip", new GzipEncodingProvider(), 50,
Predicates.and(getCompressionPredicates(compression)));
return new EncodingHandler(repository).setNext(httpHandler);
} | java | public static HttpHandler configureCompression(Compression compression,
HttpHandler httpHandler) {
if (compression == null || !compression.getEnabled()) {
return httpHandler;
}
ContentEncodingRepository repository = new ContentEncodingRepository();
repository.addEncodingHandler("gzip", new GzipEncodingProvider(), 50,
Predicates.and(getCompressionPredicates(compression)));
return new EncodingHandler(repository).setNext(httpHandler);
} | [
"public",
"static",
"HttpHandler",
"configureCompression",
"(",
"Compression",
"compression",
",",
"HttpHandler",
"httpHandler",
")",
"{",
"if",
"(",
"compression",
"==",
"null",
"||",
"!",
"compression",
".",
"getEnabled",
"(",
")",
")",
"{",
"return",
"httpHan... | Optionally wrap the given {@link HttpHandler} for HTTP compression support.
@param compression the HTTP compression configuration
@param httpHandler the HTTP handler to wrap
@return the wrapped HTTP handler if compression is enabled, or the handler itself | [
"Optionally",
"wrap",
"the",
"given",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowCompressionConfigurer.java#L55-L64 | train | Configure the compression. | [
30522,
2270,
10763,
8299,
11774,
3917,
9530,
8873,
27390,
8586,
25377,
8303,
3258,
1006,
13379,
13379,
1010,
8299,
11774,
3917,
8299,
11774,
3917,
1007,
1063,
2065,
1006,
13379,
1027,
1027,
19701,
1064,
1064,
999,
13379,
1012,
2131,
8189,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java | IOUtil.readBytesFromOtherInputStream | public static int readBytesFromOtherInputStream(InputStream is, byte[] targetArray) throws IOException
{
assert targetArray != null;
if (targetArray.length == 0) return 0;
int len;
int off = 0;
while (off < targetArray.length && (len = is.read(targetArray, off, targetArray.length - off)) != -1)
{
off += len;
}
return off;
} | java | public static int readBytesFromOtherInputStream(InputStream is, byte[] targetArray) throws IOException
{
assert targetArray != null;
if (targetArray.length == 0) return 0;
int len;
int off = 0;
while (off < targetArray.length && (len = is.read(targetArray, off, targetArray.length - off)) != -1)
{
off += len;
}
return off;
} | [
"public",
"static",
"int",
"readBytesFromOtherInputStream",
"(",
"InputStream",
"is",
",",
"byte",
"[",
"]",
"targetArray",
")",
"throws",
"IOException",
"{",
"assert",
"targetArray",
"!=",
"null",
";",
"if",
"(",
"targetArray",
".",
"length",
"==",
"0",
")",
... | 从InputStream读取指定长度的字节出来
@param is 流
@param targetArray output
@return 实际读取了多少字节,返回0表示遇到了文件尾部
@throws IOException | [
"从InputStream读取指定长度的字节出来"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java#L292-L303 | train | Read bytes from other input stream. | [
30522,
2270,
10763,
20014,
3191,
3762,
4570,
19699,
19506,
12399,
2378,
18780,
21422,
1006,
20407,
25379,
2003,
1010,
24880,
1031,
1033,
4539,
2906,
9447,
1007,
11618,
22834,
10288,
24422,
1063,
20865,
4539,
2906,
9447,
999,
1027,
19701,
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/util/ReUtil.java | ReUtil.findAll | public static List<String> findAll(String regex, CharSequence content, int group) {
return findAll(regex, content, group, new ArrayList<String>());
} | java | public static List<String> findAll(String regex, CharSequence content, int group) {
return findAll(regex, content, group, new ArrayList<String>());
} | [
"public",
"static",
"List",
"<",
"String",
">",
"findAll",
"(",
"String",
"regex",
",",
"CharSequence",
"content",
",",
"int",
"group",
")",
"{",
"return",
"findAll",
"(",
"regex",
",",
"content",
",",
"group",
",",
"new",
"ArrayList",
"<",
"String",
">"... | 取得内容中匹配的所有结果
@param regex 正则
@param content 被查找的内容
@param group 正则的分组
@return 结果列表
@since 3.0.6 | [
"取得内容中匹配的所有结果"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L388-L390 | train | Finds all matches of the given regex in the given content and group. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
2424,
8095,
1006,
5164,
19723,
10288,
1010,
25869,
3366,
4226,
5897,
4180,
1010,
20014,
2177,
1007,
1063,
2709,
2424,
8095,
1006,
19723,
10288,
1010,
4180,
1010,
2177,
1010,
2047,
9140,
9863,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java | CheckpointCoordinator.receiveDeclineMessage | public void receiveDeclineMessage(DeclineCheckpoint message) {
if (shutdown || message == null) {
return;
}
if (!job.equals(message.getJob())) {
throw new IllegalArgumentException("Received DeclineCheckpoint message for job " +
message.getJob() + " while this coordinator handles job " + job);
}
final long checkpointId = message.getCheckpointId();
final String reason = (message.getReason() != null ? message.getReason().getMessage() : "");
PendingCheckpoint checkpoint;
synchronized (lock) {
// we need to check inside the lock for being shutdown as well, otherwise we
// get races and invalid error log messages
if (shutdown) {
return;
}
checkpoint = pendingCheckpoints.remove(checkpointId);
if (checkpoint != null && !checkpoint.isDiscarded()) {
LOG.info("Decline checkpoint {} by task {} of job {}.", checkpointId, message.getTaskExecutionId(), job);
discardCheckpoint(checkpoint, message.getReason());
}
else if (checkpoint != null) {
// this should not happen
throw new IllegalStateException(
"Received message for discarded but non-removed checkpoint " + checkpointId);
}
else if (LOG.isDebugEnabled()) {
if (recentPendingCheckpoints.contains(checkpointId)) {
// message is for an unknown checkpoint, or comes too late (checkpoint disposed)
LOG.debug("Received another decline message for now expired checkpoint attempt {} of job {} : {}",
checkpointId, job, reason);
} else {
// message is for an unknown checkpoint. might be so old that we don't even remember it any more
LOG.debug("Received decline message for unknown (too old?) checkpoint attempt {} of job {} : {}",
checkpointId, job, reason);
}
}
}
} | java | public void receiveDeclineMessage(DeclineCheckpoint message) {
if (shutdown || message == null) {
return;
}
if (!job.equals(message.getJob())) {
throw new IllegalArgumentException("Received DeclineCheckpoint message for job " +
message.getJob() + " while this coordinator handles job " + job);
}
final long checkpointId = message.getCheckpointId();
final String reason = (message.getReason() != null ? message.getReason().getMessage() : "");
PendingCheckpoint checkpoint;
synchronized (lock) {
// we need to check inside the lock for being shutdown as well, otherwise we
// get races and invalid error log messages
if (shutdown) {
return;
}
checkpoint = pendingCheckpoints.remove(checkpointId);
if (checkpoint != null && !checkpoint.isDiscarded()) {
LOG.info("Decline checkpoint {} by task {} of job {}.", checkpointId, message.getTaskExecutionId(), job);
discardCheckpoint(checkpoint, message.getReason());
}
else if (checkpoint != null) {
// this should not happen
throw new IllegalStateException(
"Received message for discarded but non-removed checkpoint " + checkpointId);
}
else if (LOG.isDebugEnabled()) {
if (recentPendingCheckpoints.contains(checkpointId)) {
// message is for an unknown checkpoint, or comes too late (checkpoint disposed)
LOG.debug("Received another decline message for now expired checkpoint attempt {} of job {} : {}",
checkpointId, job, reason);
} else {
// message is for an unknown checkpoint. might be so old that we don't even remember it any more
LOG.debug("Received decline message for unknown (too old?) checkpoint attempt {} of job {} : {}",
checkpointId, job, reason);
}
}
}
} | [
"public",
"void",
"receiveDeclineMessage",
"(",
"DeclineCheckpoint",
"message",
")",
"{",
"if",
"(",
"shutdown",
"||",
"message",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"job",
".",
"equals",
"(",
"message",
".",
"getJob",
"(",
")",
... | Receives a {@link DeclineCheckpoint} message for a pending checkpoint.
@param message Checkpoint decline from the task manager | [
"Receives",
"a",
"{",
"@link",
"DeclineCheckpoint",
"}",
"message",
"for",
"a",
"pending",
"checkpoint",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java#L723-L767 | train | This method is called when a DeclineCheckpoint message is received from the coordinator. | [
30522,
2270,
11675,
2363,
8586,
4179,
7834,
3736,
3351,
1006,
6689,
5403,
3600,
8400,
4471,
1007,
1063,
2065,
1006,
3844,
7698,
1064,
1064,
4471,
1027,
1027,
19701,
1007,
1063,
2709,
1025,
1065,
2065,
1006,
999,
3105,
1012,
19635,
1006,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.notContain | public static String notContain(String textToSearch, String substring) throws IllegalArgumentException {
return notContain(textToSearch, substring, "[Assertion failed] - this String argument must not contain the substring [{}]", substring);
} | java | public static String notContain(String textToSearch, String substring) throws IllegalArgumentException {
return notContain(textToSearch, substring, "[Assertion failed] - this String argument must not contain the substring [{}]", substring);
} | [
"public",
"static",
"String",
"notContain",
"(",
"String",
"textToSearch",
",",
"String",
"substring",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"notContain",
"(",
"textToSearch",
",",
"substring",
",",
"\"[Assertion failed] - this String argument must not c... | 断言给定字符串是否不被另一个字符串包含(既是否为子串)
<pre class="code">
Assert.doesNotContain(name, "rod", "Name must not contain 'rod'");
</pre>
@param textToSearch 被搜索的字符串
@param substring 被检查的子串
@return 被检查的子串
@throws IllegalArgumentException 非子串抛出异常 | [
"断言给定字符串是否不被另一个字符串包含(既是否为子串)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L261-L263 | train | Assert that the textToSearch does not contain the substring | [
30522,
2270,
10763,
5164,
2025,
8663,
18249,
1006,
5164,
3793,
22282,
2906,
2818,
1010,
5164,
4942,
3367,
4892,
1007,
11618,
6206,
2906,
22850,
15781,
2595,
24422,
1063,
2709,
2025,
8663,
18249,
1006,
3793,
22282,
2906,
2818,
1010,
4942,
33... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java | ResourceSpec.lessThanOrEqual | public boolean lessThanOrEqual(@Nonnull ResourceSpec other) {
int cmp1 = Double.compare(this.cpuCores, other.cpuCores);
int cmp2 = Integer.compare(this.heapMemoryInMB, other.heapMemoryInMB);
int cmp3 = Integer.compare(this.directMemoryInMB, other.directMemoryInMB);
int cmp4 = Integer.compare(this.nativeMemoryInMB, other.nativeMemoryInMB);
int cmp5 = Integer.compare(this.stateSizeInMB, other.stateSizeInMB);
if (cmp1 <= 0 && cmp2 <= 0 && cmp3 <= 0 && cmp4 <= 0 && cmp5 <= 0) {
for (Resource resource : extendedResources.values()) {
if (!other.extendedResources.containsKey(resource.getName()) ||
other.extendedResources.get(resource.getName()).getResourceAggregateType() != resource.getResourceAggregateType() ||
other.extendedResources.get(resource.getName()).getValue() < resource.getValue()) {
return false;
}
}
return true;
}
return false;
} | java | public boolean lessThanOrEqual(@Nonnull ResourceSpec other) {
int cmp1 = Double.compare(this.cpuCores, other.cpuCores);
int cmp2 = Integer.compare(this.heapMemoryInMB, other.heapMemoryInMB);
int cmp3 = Integer.compare(this.directMemoryInMB, other.directMemoryInMB);
int cmp4 = Integer.compare(this.nativeMemoryInMB, other.nativeMemoryInMB);
int cmp5 = Integer.compare(this.stateSizeInMB, other.stateSizeInMB);
if (cmp1 <= 0 && cmp2 <= 0 && cmp3 <= 0 && cmp4 <= 0 && cmp5 <= 0) {
for (Resource resource : extendedResources.values()) {
if (!other.extendedResources.containsKey(resource.getName()) ||
other.extendedResources.get(resource.getName()).getResourceAggregateType() != resource.getResourceAggregateType() ||
other.extendedResources.get(resource.getName()).getValue() < resource.getValue()) {
return false;
}
}
return true;
}
return false;
} | [
"public",
"boolean",
"lessThanOrEqual",
"(",
"@",
"Nonnull",
"ResourceSpec",
"other",
")",
"{",
"int",
"cmp1",
"=",
"Double",
".",
"compare",
"(",
"this",
".",
"cpuCores",
",",
"other",
".",
"cpuCores",
")",
";",
"int",
"cmp2",
"=",
"Integer",
".",
"comp... | Checks the current resource less than or equal with the other resource by comparing
all the fields in the resource.
@param other The resource to compare
@return True if current resource is less than or equal with the other resource, otherwise return false. | [
"Checks",
"the",
"current",
"resource",
"less",
"than",
"or",
"equal",
"with",
"the",
"other",
"resource",
"by",
"comparing",
"all",
"the",
"fields",
"in",
"the",
"resource",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java#L184-L201 | train | Checks if this resource spec is less than or equal to the other resource spec. | [
30522,
2270,
22017,
20898,
2625,
21604,
5686,
26426,
1006,
1030,
2512,
11231,
3363,
4219,
5051,
2278,
2060,
1007,
1063,
20014,
4642,
2361,
2487,
1027,
3313,
1012,
12826,
1006,
2023,
1012,
17368,
17345,
2015,
1010,
2060,
1012,
17368,
17345,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.removeNull | public static <T> T[] removeNull(T[] array) {
return filter(array, new Editor<T>() {
@Override
public T edit(T t) {
// 返回null便不加入集合
return t;
}
});
} | java | public static <T> T[] removeNull(T[] array) {
return filter(array, new Editor<T>() {
@Override
public T edit(T t) {
// 返回null便不加入集合
return t;
}
});
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"removeNull",
"(",
"T",
"[",
"]",
"array",
")",
"{",
"return",
"filter",
"(",
"array",
",",
"new",
"Editor",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"T",
"edit",
"(",
"T",
"t",
... | 去除{@code null} 元素
@param array 数组
@return 处理后的数组
@since 3.2.2 | [
"去除",
"{",
"@code",
"null",
"}",
"元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L781-L789 | train | Removes null elements from an array. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
1031,
1033,
6366,
11231,
3363,
1006,
1056,
1031,
1033,
9140,
1007,
1063,
2709,
11307,
1006,
9140,
1010,
2047,
3559,
1026,
1056,
1028,
1006,
1007,
1063,
1030,
2058,
15637,
2270,
1056,
10086,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java | TypeExtractor.getBinaryOperatorReturnType | @SuppressWarnings("unchecked")
@PublicEvolving
public static <IN1, IN2, OUT> TypeInformation<OUT> getBinaryOperatorReturnType(
Function function,
Class<?> baseClass,
int input1TypeArgumentIndex,
int input2TypeArgumentIndex,
int outputTypeArgumentIndex,
int[] lambdaOutputTypeArgumentIndices,
TypeInformation<IN1> in1Type,
TypeInformation<IN2> in2Type,
String functionName,
boolean allowMissing) {
Preconditions.checkArgument(in1Type == null || input1TypeArgumentIndex >= 0, "Input 1 type argument index was not provided");
Preconditions.checkArgument(in2Type == null || input2TypeArgumentIndex >= 0, "Input 2 type argument index was not provided");
Preconditions.checkArgument(outputTypeArgumentIndex >= 0, "Output type argument index was not provided");
Preconditions.checkArgument(
lambdaOutputTypeArgumentIndices != null,
"Indices for output type arguments within lambda not provided");
// explicit result type has highest precedence
if (function instanceof ResultTypeQueryable) {
return ((ResultTypeQueryable<OUT>) function).getProducedType();
}
// perform extraction
try {
final LambdaExecutable exec;
try {
exec = checkAndExtractLambda(function);
} catch (TypeExtractionException e) {
throw new InvalidTypesException("Internal error occurred.", e);
}
if (exec != null) {
final Method sam = TypeExtractionUtils.getSingleAbstractMethod(baseClass);
final int baseParametersLen = sam.getParameterTypes().length;
// parameters must be accessed from behind, since JVM can add additional parameters e.g. when using local variables inside lambda function
final int paramLen = exec.getParameterTypes().length;
final Type output;
if (lambdaOutputTypeArgumentIndices.length > 0) {
output = TypeExtractionUtils.extractTypeFromLambda(
baseClass,
exec,
lambdaOutputTypeArgumentIndices,
paramLen,
baseParametersLen);
} else {
output = exec.getReturnType();
TypeExtractionUtils.validateLambdaType(baseClass, output);
}
return new TypeExtractor().privateCreateTypeInfo(
output,
in1Type,
in2Type);
}
else {
if (in1Type != null) {
validateInputType(baseClass, function.getClass(), input1TypeArgumentIndex, in1Type);
}
if (in2Type != null) {
validateInputType(baseClass, function.getClass(), input2TypeArgumentIndex, in2Type);
}
return new TypeExtractor().privateCreateTypeInfo(baseClass, function.getClass(), outputTypeArgumentIndex, in1Type, in2Type);
}
}
catch (InvalidTypesException e) {
if (allowMissing) {
return (TypeInformation<OUT>) new MissingTypeInfo(functionName != null ? functionName : function.toString(), e);
} else {
throw e;
}
}
} | java | @SuppressWarnings("unchecked")
@PublicEvolving
public static <IN1, IN2, OUT> TypeInformation<OUT> getBinaryOperatorReturnType(
Function function,
Class<?> baseClass,
int input1TypeArgumentIndex,
int input2TypeArgumentIndex,
int outputTypeArgumentIndex,
int[] lambdaOutputTypeArgumentIndices,
TypeInformation<IN1> in1Type,
TypeInformation<IN2> in2Type,
String functionName,
boolean allowMissing) {
Preconditions.checkArgument(in1Type == null || input1TypeArgumentIndex >= 0, "Input 1 type argument index was not provided");
Preconditions.checkArgument(in2Type == null || input2TypeArgumentIndex >= 0, "Input 2 type argument index was not provided");
Preconditions.checkArgument(outputTypeArgumentIndex >= 0, "Output type argument index was not provided");
Preconditions.checkArgument(
lambdaOutputTypeArgumentIndices != null,
"Indices for output type arguments within lambda not provided");
// explicit result type has highest precedence
if (function instanceof ResultTypeQueryable) {
return ((ResultTypeQueryable<OUT>) function).getProducedType();
}
// perform extraction
try {
final LambdaExecutable exec;
try {
exec = checkAndExtractLambda(function);
} catch (TypeExtractionException e) {
throw new InvalidTypesException("Internal error occurred.", e);
}
if (exec != null) {
final Method sam = TypeExtractionUtils.getSingleAbstractMethod(baseClass);
final int baseParametersLen = sam.getParameterTypes().length;
// parameters must be accessed from behind, since JVM can add additional parameters e.g. when using local variables inside lambda function
final int paramLen = exec.getParameterTypes().length;
final Type output;
if (lambdaOutputTypeArgumentIndices.length > 0) {
output = TypeExtractionUtils.extractTypeFromLambda(
baseClass,
exec,
lambdaOutputTypeArgumentIndices,
paramLen,
baseParametersLen);
} else {
output = exec.getReturnType();
TypeExtractionUtils.validateLambdaType(baseClass, output);
}
return new TypeExtractor().privateCreateTypeInfo(
output,
in1Type,
in2Type);
}
else {
if (in1Type != null) {
validateInputType(baseClass, function.getClass(), input1TypeArgumentIndex, in1Type);
}
if (in2Type != null) {
validateInputType(baseClass, function.getClass(), input2TypeArgumentIndex, in2Type);
}
return new TypeExtractor().privateCreateTypeInfo(baseClass, function.getClass(), outputTypeArgumentIndex, in1Type, in2Type);
}
}
catch (InvalidTypesException e) {
if (allowMissing) {
return (TypeInformation<OUT>) new MissingTypeInfo(functionName != null ? functionName : function.toString(), e);
} else {
throw e;
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"PublicEvolving",
"public",
"static",
"<",
"IN1",
",",
"IN2",
",",
"OUT",
">",
"TypeInformation",
"<",
"OUT",
">",
"getBinaryOperatorReturnType",
"(",
"Function",
"function",
",",
"Class",
"<",
"?",
">",... | Returns the binary operator's return type.
<p>This method can extract a type in 4 different ways:
<p>1. By using the generics of the base class like MyFunction<X, Y, Z, IN, OUT>.
This is what outputTypeArgumentIndex (in this example "4") is good for.
<p>2. By using input type inference SubMyFunction<T, String, String, String, T>.
This is what inputTypeArgumentIndex (in this example "0") and inType is good for.
<p>3. By using the static method that a compiler generates for Java lambdas.
This is what lambdaOutputTypeArgumentIndices is good for. Given that MyFunction has
the following single abstract method:
<pre>
<code>
void apply(IN value, Collector<OUT> value)
</code>
</pre>
<p> Lambda type indices allow the extraction of a type from lambdas. To extract the
output type <b>OUT</b> from the function one should pass {@code new int[] {1, 0}}.
"1" for selecting the parameter and 0 for the first generic in this type.
Use {@code TypeExtractor.NO_INDEX} for selecting the return type of the lambda for
extraction or if the class cannot be a lambda because it is not a single abstract
method interface.
<p>4. By using interfaces such as {@link TypeInfoFactory} or {@link ResultTypeQueryable}.
<p>See also comments in the header of this class.
@param function Function to extract the return type from
@param baseClass Base class of the function
@param input1TypeArgumentIndex Index of first input generic type in the class specification (ignored if in1Type is null)
@param input2TypeArgumentIndex Index of second input generic type in the class specification (ignored if in2Type is null)
@param outputTypeArgumentIndex Index of output generic type in the class specification
@param lambdaOutputTypeArgumentIndices Table of indices of the type argument specifying the output type. See example.
@param in1Type Type of the left side input elements (In case of an iterable, it is the element type)
@param in2Type Type of the right side input elements (In case of an iterable, it is the element type)
@param functionName Function name
@param allowMissing Can the type information be missing (this generates a MissingTypeInfo for postponing an exception)
@param <IN1> Left side input type
@param <IN2> Right side input type
@param <OUT> Output type
@return TypeInformation of the return type of the function | [
"Returns",
"the",
"binary",
"operator",
"s",
"return",
"type",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L646-L723 | train | Gets the binary operator return type. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
1030,
2270,
6777,
4747,
6455,
2270,
10763,
1026,
1999,
2487,
1010,
1999,
2475,
1010,
2041,
1028,
2828,
2378,
14192,
3370,
1026,
2041,
1028,
2131,
21114,
2854,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/dartsclone/DartMap.java | DartMap.commonPrefixSearch | public ArrayList<Pair<String, V>> commonPrefixSearch(String key, int offset, int maxResults)
{
byte[] keyBytes = key.getBytes(utf8);
List<Pair<Integer, Integer>> pairList = commonPrefixSearch(keyBytes, offset, maxResults);
ArrayList<Pair<String, V>> resultList = new ArrayList<Pair<String, V>>(pairList.size());
for (Pair<Integer, Integer> pair : pairList)
{
resultList.add(new Pair<String, V>(new String(keyBytes, 0, pair.first), valueArray[pair.second]));
}
return resultList;
} | java | public ArrayList<Pair<String, V>> commonPrefixSearch(String key, int offset, int maxResults)
{
byte[] keyBytes = key.getBytes(utf8);
List<Pair<Integer, Integer>> pairList = commonPrefixSearch(keyBytes, offset, maxResults);
ArrayList<Pair<String, V>> resultList = new ArrayList<Pair<String, V>>(pairList.size());
for (Pair<Integer, Integer> pair : pairList)
{
resultList.add(new Pair<String, V>(new String(keyBytes, 0, pair.first), valueArray[pair.second]));
}
return resultList;
} | [
"public",
"ArrayList",
"<",
"Pair",
"<",
"String",
",",
"V",
">",
">",
"commonPrefixSearch",
"(",
"String",
"key",
",",
"int",
"offset",
",",
"int",
"maxResults",
")",
"{",
"byte",
"[",
"]",
"keyBytes",
"=",
"key",
".",
"getBytes",
"(",
"utf8",
")",
... | 前缀查询
@param key
@param offset
@param maxResults
@return | [
"前缀查询"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/dartsclone/DartMap.java#L140-L150 | train | Common prefix search. | [
30522,
2270,
9140,
9863,
1026,
3940,
1026,
5164,
1010,
1058,
1028,
1028,
2691,
28139,
8873,
2595,
17310,
11140,
1006,
5164,
3145,
1010,
20014,
16396,
1010,
20014,
4098,
6072,
11314,
2015,
1007,
1063,
24880,
1031,
1033,
3145,
3762,
4570,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.