repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java | ParameterTool.getConfiguration | public Configuration getConfiguration() {
final Configuration conf = new Configuration();
for (Map.Entry<String, String> entry : data.entrySet()) {
conf.setString(entry.getKey(), entry.getValue());
}
return conf;
} | java | public Configuration getConfiguration() {
final Configuration conf = new Configuration();
for (Map.Entry<String, String> entry : data.entrySet()) {
conf.setString(entry.getKey(), entry.getValue());
}
return conf;
} | [
"public",
"Configuration",
"getConfiguration",
"(",
")",
"{",
"final",
"Configuration",
"conf",
"=",
"new",
"Configuration",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"data",
".",
"entrySet",
"(",
")... | Returns a {@link Configuration} object from this {@link ParameterTool}.
@return A {@link Configuration} | [
"Returns",
"a",
"{",
"@link",
"Configuration",
"}",
"object",
"from",
"this",
"{",
"@link",
"ParameterTool",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L484-L490 | train | Gets the configuration. | [
30522,
2270,
9563,
2131,
8663,
8873,
27390,
3370,
1006,
1007,
1063,
2345,
9563,
9530,
2546,
1027,
30524,
1006,
1007,
1007,
1025,
1065,
2709,
9530,
2546,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/UnicodeUtil.java | UnicodeUtil.toUnicode | public static String toUnicode(String str, boolean isSkipAscii) {
if (StrUtil.isEmpty(str)) {
return str;
}
final int len = str.length();
final StrBuilder unicode = StrBuilder.create(str.length() * 6);
char c;
for (int i = 0; i < len; i++) {
c = str.charAt(i);
if(isSkipAscii && CharUtil.isAsciiPrintable(c) ) {
unicode.append(c);
}else {
unicode.append(HexUtil.toUnicodeHex(c));
}
}
return unicode.toString();
} | java | public static String toUnicode(String str, boolean isSkipAscii) {
if (StrUtil.isEmpty(str)) {
return str;
}
final int len = str.length();
final StrBuilder unicode = StrBuilder.create(str.length() * 6);
char c;
for (int i = 0; i < len; i++) {
c = str.charAt(i);
if(isSkipAscii && CharUtil.isAsciiPrintable(c) ) {
unicode.append(c);
}else {
unicode.append(HexUtil.toUnicodeHex(c));
}
}
return unicode.toString();
} | [
"public",
"static",
"String",
"toUnicode",
"(",
"String",
"str",
",",
"boolean",
"isSkipAscii",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isEmpty",
"(",
"str",
")",
")",
"{",
"return",
"str",
";",
"}",
"final",
"int",
"len",
"=",
"str",
".",
"length",
"(... | 字符串编码为Unicode形式
@param str 被编码的字符串
@param isSkipAscii 是否跳过ASCII字符(只跳过可见字符)
@return Unicode字符串 | [
"字符串编码为Unicode形式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/UnicodeUtil.java#L75-L92 | train | Converts a String to Unicode. | [
30522,
2270,
10763,
5164,
2000,
19496,
16044,
1006,
5164,
2358,
2099,
1010,
22017,
20898,
26354,
3211,
19707,
6895,
2072,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
6633,
13876,
2100,
1006,
2358,
2099,
1007,
1007,
1063,
2709,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java | BatchTask.cancelChainedTasks | public static void cancelChainedTasks(List<ChainedDriver<?, ?>> tasks) {
for (int i = 0; i < tasks.size(); i++) {
try {
tasks.get(i).cancelTask();
} catch (Throwable t) {
// do nothing
}
}
} | java | public static void cancelChainedTasks(List<ChainedDriver<?, ?>> tasks) {
for (int i = 0; i < tasks.size(); i++) {
try {
tasks.get(i).cancelTask();
} catch (Throwable t) {
// do nothing
}
}
} | [
"public",
"static",
"void",
"cancelChainedTasks",
"(",
"List",
"<",
"ChainedDriver",
"<",
"?",
",",
"?",
">",
">",
"tasks",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tasks",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"tr... | Cancels all tasks via their {@link ChainedDriver#cancelTask()} method. Any occurring exception
and error is suppressed, such that the canceling method of every task is invoked in all cases.
@param tasks The tasks to be canceled. | [
"Cancels",
"all",
"tasks",
"via",
"their",
"{",
"@link",
"ChainedDriver#cancelTask",
"()",
"}",
"method",
".",
"Any",
"occurring",
"exception",
"and",
"error",
"is",
"suppressed",
"such",
"that",
"the",
"canceling",
"method",
"of",
"every",
"task",
"is",
"invo... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java#L1420-L1428 | train | Cancels all chained tasks. | [
30522,
2270,
10763,
11675,
17542,
24925,
7228,
10230,
5705,
1006,
2862,
1026,
22075,
23663,
2099,
1026,
1029,
1010,
1029,
1028,
1028,
8518,
1007,
1063,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
8518,
1012,
2946,
1006,
1007,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherIteration.java | ScatterGatherIteration.createResultVerticesWithDegrees | @SuppressWarnings("serial")
private DataSet<Vertex<K, VV>> createResultVerticesWithDegrees(Graph<K, VV, EV> graph, EdgeDirection messagingDirection,
TypeInformation<Tuple2<K, Message>> messageTypeInfo, DataSet<LongValue> numberOfVertices) {
DataSet<Tuple2<K, Message>> messages;
this.gatherFunction.setOptDegrees(this.configuration.isOptDegrees());
DataSet<Tuple2<K, LongValue>> inDegrees = graph.inDegrees();
DataSet<Tuple2<K, LongValue>> outDegrees = graph.outDegrees();
DataSet<Tuple3<K, LongValue, LongValue>> degrees = inDegrees.join(outDegrees).where(0).equalTo(0)
.with(new FlatJoinFunction<Tuple2<K, LongValue>, Tuple2<K, LongValue>, Tuple3<K, LongValue, LongValue>>() {
@Override
public void join(Tuple2<K, LongValue> first, Tuple2<K, LongValue> second, Collector<Tuple3<K, LongValue, LongValue>> out) {
out.collect(new Tuple3<>(first.f0, first.f1, second.f1));
}
}).withForwardedFieldsFirst("f0;f1").withForwardedFieldsSecond("f1");
DataSet<Vertex<K, Tuple3<VV, LongValue, LongValue>>> verticesWithDegrees = initialVertices
.join(degrees).where(0).equalTo(0)
.with(new FlatJoinFunction<Vertex<K, VV>, Tuple3<K, LongValue, LongValue>, Vertex<K, Tuple3<VV, LongValue, LongValue>>>() {
@Override
public void join(Vertex<K, VV> vertex, Tuple3<K, LongValue, LongValue> degrees,
Collector<Vertex<K, Tuple3<VV, LongValue, LongValue>>> out) throws Exception {
out.collect(new Vertex<>(vertex.getId(),
new Tuple3<>(vertex.getValue(), degrees.f1, degrees.f2)));
}
}).withForwardedFieldsFirst("f0");
// add type info
TypeInformation<Vertex<K, Tuple3<VV, LongValue, LongValue>>> vertexTypes = verticesWithDegrees.getType();
final DeltaIteration<Vertex<K, Tuple3<VV, LongValue, LongValue>>, Vertex<K, Tuple3<VV, LongValue, LongValue>>> iteration =
verticesWithDegrees.iterateDelta(verticesWithDegrees, this.maximumNumberOfIterations, 0);
setUpIteration(iteration);
switch (messagingDirection) {
case IN:
messages = buildScatterFunctionVerticesWithDegrees(iteration, messageTypeInfo, 1, 0, numberOfVertices);
break;
case OUT:
messages = buildScatterFunctionVerticesWithDegrees(iteration, messageTypeInfo, 0, 0, numberOfVertices);
break;
case ALL:
messages = buildScatterFunctionVerticesWithDegrees(iteration, messageTypeInfo, 1, 0, numberOfVertices)
.union(buildScatterFunctionVerticesWithDegrees(iteration, messageTypeInfo, 0, 0, numberOfVertices));
break;
default:
throw new IllegalArgumentException("Illegal edge direction");
}
@SuppressWarnings({ "unchecked", "rawtypes" })
GatherUdf<K, Tuple3<VV, LongValue, LongValue>, Message> updateUdf =
new GatherUdfVVWithDegrees(gatherFunction, vertexTypes);
// build the update function (co group)
CoGroupOperator<?, ?, Vertex<K, Tuple3<VV, LongValue, LongValue>>> updates =
messages.coGroup(iteration.getSolutionSet()).where(0).equalTo(0).with(updateUdf);
if (this.configuration != null && this.configuration.isOptNumVertices()) {
updates = updates.withBroadcastSet(numberOfVertices, "number of vertices");
}
configureUpdateFunction(updates);
return iteration.closeWith(updates, updates).map(
new MapFunction<Vertex<K, Tuple3<VV, LongValue, LongValue>>, Vertex<K, VV>>() {
public Vertex<K, VV> map(Vertex<K, Tuple3<VV, LongValue, LongValue>> vertex) {
return new Vertex<>(vertex.getId(), vertex.getValue().f0);
}
});
} | java | @SuppressWarnings("serial")
private DataSet<Vertex<K, VV>> createResultVerticesWithDegrees(Graph<K, VV, EV> graph, EdgeDirection messagingDirection,
TypeInformation<Tuple2<K, Message>> messageTypeInfo, DataSet<LongValue> numberOfVertices) {
DataSet<Tuple2<K, Message>> messages;
this.gatherFunction.setOptDegrees(this.configuration.isOptDegrees());
DataSet<Tuple2<K, LongValue>> inDegrees = graph.inDegrees();
DataSet<Tuple2<K, LongValue>> outDegrees = graph.outDegrees();
DataSet<Tuple3<K, LongValue, LongValue>> degrees = inDegrees.join(outDegrees).where(0).equalTo(0)
.with(new FlatJoinFunction<Tuple2<K, LongValue>, Tuple2<K, LongValue>, Tuple3<K, LongValue, LongValue>>() {
@Override
public void join(Tuple2<K, LongValue> first, Tuple2<K, LongValue> second, Collector<Tuple3<K, LongValue, LongValue>> out) {
out.collect(new Tuple3<>(first.f0, first.f1, second.f1));
}
}).withForwardedFieldsFirst("f0;f1").withForwardedFieldsSecond("f1");
DataSet<Vertex<K, Tuple3<VV, LongValue, LongValue>>> verticesWithDegrees = initialVertices
.join(degrees).where(0).equalTo(0)
.with(new FlatJoinFunction<Vertex<K, VV>, Tuple3<K, LongValue, LongValue>, Vertex<K, Tuple3<VV, LongValue, LongValue>>>() {
@Override
public void join(Vertex<K, VV> vertex, Tuple3<K, LongValue, LongValue> degrees,
Collector<Vertex<K, Tuple3<VV, LongValue, LongValue>>> out) throws Exception {
out.collect(new Vertex<>(vertex.getId(),
new Tuple3<>(vertex.getValue(), degrees.f1, degrees.f2)));
}
}).withForwardedFieldsFirst("f0");
// add type info
TypeInformation<Vertex<K, Tuple3<VV, LongValue, LongValue>>> vertexTypes = verticesWithDegrees.getType();
final DeltaIteration<Vertex<K, Tuple3<VV, LongValue, LongValue>>, Vertex<K, Tuple3<VV, LongValue, LongValue>>> iteration =
verticesWithDegrees.iterateDelta(verticesWithDegrees, this.maximumNumberOfIterations, 0);
setUpIteration(iteration);
switch (messagingDirection) {
case IN:
messages = buildScatterFunctionVerticesWithDegrees(iteration, messageTypeInfo, 1, 0, numberOfVertices);
break;
case OUT:
messages = buildScatterFunctionVerticesWithDegrees(iteration, messageTypeInfo, 0, 0, numberOfVertices);
break;
case ALL:
messages = buildScatterFunctionVerticesWithDegrees(iteration, messageTypeInfo, 1, 0, numberOfVertices)
.union(buildScatterFunctionVerticesWithDegrees(iteration, messageTypeInfo, 0, 0, numberOfVertices));
break;
default:
throw new IllegalArgumentException("Illegal edge direction");
}
@SuppressWarnings({ "unchecked", "rawtypes" })
GatherUdf<K, Tuple3<VV, LongValue, LongValue>, Message> updateUdf =
new GatherUdfVVWithDegrees(gatherFunction, vertexTypes);
// build the update function (co group)
CoGroupOperator<?, ?, Vertex<K, Tuple3<VV, LongValue, LongValue>>> updates =
messages.coGroup(iteration.getSolutionSet()).where(0).equalTo(0).with(updateUdf);
if (this.configuration != null && this.configuration.isOptNumVertices()) {
updates = updates.withBroadcastSet(numberOfVertices, "number of vertices");
}
configureUpdateFunction(updates);
return iteration.closeWith(updates, updates).map(
new MapFunction<Vertex<K, Tuple3<VV, LongValue, LongValue>>, Vertex<K, VV>>() {
public Vertex<K, VV> map(Vertex<K, Tuple3<VV, LongValue, LongValue>> vertex) {
return new Vertex<>(vertex.getId(), vertex.getValue().f0);
}
});
} | [
"@",
"SuppressWarnings",
"(",
"\"serial\"",
")",
"private",
"DataSet",
"<",
"Vertex",
"<",
"K",
",",
"VV",
">",
">",
"createResultVerticesWithDegrees",
"(",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"graph",
",",
"EdgeDirection",
"messagingDirection",
",... | Creates the operator that represents this scatter-gather graph computation for a vertex with in
and out degrees added to the vertex value.
@param graph
@param messagingDirection
@param messageTypeInfo
@param numberOfVertices
@return the operator | [
"Creates",
"the",
"operator",
"that",
"represents",
"this",
"scatter",
"-",
"gather",
"graph",
"computation",
"for",
"a",
"vertex",
"with",
"in",
"and",
"out",
"degrees",
"added",
"to",
"the",
"vertex",
"value",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherIteration.java#L610-L684 | train | Create result vertices with degrees. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
7642,
1000,
1007,
2797,
2951,
13462,
1026,
19449,
1026,
1047,
1010,
1058,
2615,
1028,
1028,
3443,
6072,
11314,
16874,
23522,
24415,
3207,
28637,
2015,
1006,
10629,
1026,
1047,
1010,
1058,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlTemplate.java | BeetlTemplate.wrap | public static BeetlTemplate wrap(org.beetl.core.Template beetlTemplate) {
return (null == beetlTemplate) ? null : new BeetlTemplate(beetlTemplate);
} | java | public static BeetlTemplate wrap(org.beetl.core.Template beetlTemplate) {
return (null == beetlTemplate) ? null : new BeetlTemplate(beetlTemplate);
} | [
"public",
"static",
"BeetlTemplate",
"wrap",
"(",
"org",
".",
"beetl",
".",
"core",
".",
"Template",
"beetlTemplate",
")",
"{",
"return",
"(",
"null",
"==",
"beetlTemplate",
")",
"?",
"null",
":",
"new",
"BeetlTemplate",
"(",
"beetlTemplate",
")",
";",
"}"... | 包装Beetl模板
@param beetlTemplate Beetl的模板对象 {@link org.beetl.core.Template}
@return {@link BeetlTemplate} | [
"包装Beetl模板"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlTemplate.java#L26-L28 | train | Creates a new BeetlTemplate object. | [
30522,
2270,
10763,
10506,
19646,
18532,
15725,
10236,
1006,
8917,
1012,
10506,
19646,
1012,
4563,
1012,
23561,
10506,
19646,
18532,
15725,
1007,
1063,
2709,
1006,
19701,
1027,
1027,
10506,
19646,
18532,
15725,
1007,
1029,
19701,
1024,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.getHost | @Deprecated
public static String getHost(HttpMessage message) {
return message.headers().get(HttpHeaderNames.HOST);
} | java | @Deprecated
public static String getHost(HttpMessage message) {
return message.headers().get(HttpHeaderNames.HOST);
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"getHost",
"(",
"HttpMessage",
"message",
")",
"{",
"return",
"message",
".",
"headers",
"(",
")",
".",
"get",
"(",
"HttpHeaderNames",
".",
"HOST",
")",
";",
"}"
] | @deprecated Use {@link #get(CharSequence)} instead.
Returns the value of the {@code "Host"} header. | [
"@deprecated",
"Use",
"{",
"@link",
"#get",
"(",
"CharSequence",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1003-L1006 | train | Gets the host header from the message. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
5164,
2131,
15006,
2102,
1006,
8299,
7834,
3736,
3351,
4471,
1007,
1063,
2709,
4471,
1012,
20346,
2015,
1006,
1007,
1012,
2131,
1006,
8299,
4974,
11795,
14074,
2015,
1012,
3677,
1007,
1025,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/MimeMappings.java | MimeMappings.add | public String add(String extension, String mimeType) {
Mapping previous = this.map.put(extension, new Mapping(extension, mimeType));
return (previous != null) ? previous.getMimeType() : null;
} | java | public String add(String extension, String mimeType) {
Mapping previous = this.map.put(extension, new Mapping(extension, mimeType));
return (previous != null) ? previous.getMimeType() : null;
} | [
"public",
"String",
"add",
"(",
"String",
"extension",
",",
"String",
"mimeType",
")",
"{",
"Mapping",
"previous",
"=",
"this",
".",
"map",
".",
"put",
"(",
"extension",
",",
"new",
"Mapping",
"(",
"extension",
",",
"mimeType",
")",
")",
";",
"return",
... | Add a new mime mapping.
@param extension the file extension (excluding '.')
@param mimeType the mime type to map
@return any previous mapping or {@code null} | [
"Add",
"a",
"new",
"mime",
"mapping",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/MimeMappings.java#L280-L283 | train | Add a new mapping to the map. | [
30522,
2270,
5164,
5587,
1006,
5164,
5331,
1010,
5164,
2771,
11368,
18863,
1007,
1063,
12375,
3025,
1027,
2023,
1012,
4949,
1012,
2404,
1006,
5331,
1010,
2047,
12375,
1006,
5331,
1010,
2771,
11368,
18863,
1007,
1007,
1025,
2709,
1006,
3025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java | AbstractEpollStreamChannel.writeDefaultFileRegion | private int writeDefaultFileRegion(ChannelOutboundBuffer in, DefaultFileRegion region) throws Exception {
final long offset = region.transferred();
final long regionCount = region.count();
if (offset >= regionCount) {
in.remove();
return 0;
}
final long flushedAmount = socket.sendFile(region, region.position(), offset, regionCount - offset);
if (flushedAmount > 0) {
in.progress(flushedAmount);
if (region.transferred() >= regionCount) {
in.remove();
}
return 1;
} else if (flushedAmount == 0) {
validateFileRegion(region, offset);
}
return WRITE_STATUS_SNDBUF_FULL;
} | java | private int writeDefaultFileRegion(ChannelOutboundBuffer in, DefaultFileRegion region) throws Exception {
final long offset = region.transferred();
final long regionCount = region.count();
if (offset >= regionCount) {
in.remove();
return 0;
}
final long flushedAmount = socket.sendFile(region, region.position(), offset, regionCount - offset);
if (flushedAmount > 0) {
in.progress(flushedAmount);
if (region.transferred() >= regionCount) {
in.remove();
}
return 1;
} else if (flushedAmount == 0) {
validateFileRegion(region, offset);
}
return WRITE_STATUS_SNDBUF_FULL;
} | [
"private",
"int",
"writeDefaultFileRegion",
"(",
"ChannelOutboundBuffer",
"in",
",",
"DefaultFileRegion",
"region",
")",
"throws",
"Exception",
"{",
"final",
"long",
"offset",
"=",
"region",
".",
"transferred",
"(",
")",
";",
"final",
"long",
"regionCount",
"=",
... | Write a {@link DefaultFileRegion}
@param in the collection which contains objects to write.
@param region the {@link DefaultFileRegion} from which the bytes should be written
@return The value that should be decremented from the write quantum which starts at
{@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows:
<ul>
<li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content)
is encountered</li>
<li>1 - if a single call to write data was made to the OS</li>
<li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but
no data was accepted</li>
</ul> | [
"Write",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java#L369-L388 | train | Write a DefaultFileRegion to the socket. | [
30522,
2797,
20014,
4339,
3207,
7011,
11314,
8873,
3917,
13910,
3258,
1006,
3149,
5833,
15494,
8569,
12494,
1999,
1010,
12398,
8873,
3917,
13910,
3258,
2555,
1007,
11618,
6453,
1063,
2345,
2146,
16396,
1027,
2555,
1012,
4015,
1006,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/summary/TextRankKeyword.java | TextRankKeyword.getTermAndRank | public Map<String, Float> getTermAndRank(String content)
{
assert content != null;
List<Term> termList = defaultSegment.seg(content);
return getTermAndRank(termList);
} | java | public Map<String, Float> getTermAndRank(String content)
{
assert content != null;
List<Term> termList = defaultSegment.seg(content);
return getTermAndRank(termList);
} | [
"public",
"Map",
"<",
"String",
",",
"Float",
">",
"getTermAndRank",
"(",
"String",
"content",
")",
"{",
"assert",
"content",
"!=",
"null",
";",
"List",
"<",
"Term",
">",
"termList",
"=",
"defaultSegment",
".",
"seg",
"(",
"content",
")",
";",
"return",
... | 返回全部分词结果和对应的rank
@param content
@return | [
"返回全部分词结果和对应的rank"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/summary/TextRankKeyword.java#L68-L73 | train | Get the term and rank for a given content. | [
30522,
2270,
4949,
1026,
5164,
1010,
14257,
1028,
2131,
3334,
2386,
24914,
2243,
1006,
5164,
4180,
1007,
1063,
20865,
4180,
999,
1027,
19701,
1025,
2862,
1026,
2744,
1028,
2744,
9863,
1027,
12398,
3366,
21693,
4765,
1012,
7367,
2290,
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-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/ml/util/LinearRegressionDataGenerator.java | LinearRegressionDataGenerator.main | public static void main(String[] args) throws IOException {
// check parameter count
if (args.length < 1) {
System.out.println("LinearRegressionDataGenerator <numberOfDataPoints> [<seed>]");
System.exit(1);
}
// parse parameters
final int numDataPoints = Integer.parseInt(args[0]);
final long firstSeed = args.length > 1 ? Long.parseLong(args[4]) : DEFAULT_SEED;
final Random random = new Random(firstSeed);
final String tmpDir = System.getProperty("java.io.tmpdir");
// write the points out
BufferedWriter pointsOut = null;
try {
pointsOut = new BufferedWriter(new FileWriter(new File(tmpDir + "/" + POINTS_FILE)));
StringBuilder buffer = new StringBuilder();
// DIMENSIONALITY + 1 means that the number of x(dimensionality) and target y
double[] point = new double[DIMENSIONALITY + 1];
for (int i = 1; i <= numDataPoints; i++) {
point[0] = random.nextGaussian();
point[1] = 2 * point[0] + 0.01 * random.nextGaussian();
writePoint(point, buffer, pointsOut);
}
}
finally {
if (pointsOut != null) {
pointsOut.close();
}
}
System.out.println("Wrote " + numDataPoints + " data points to " + tmpDir + "/" + POINTS_FILE);
} | java | public static void main(String[] args) throws IOException {
// check parameter count
if (args.length < 1) {
System.out.println("LinearRegressionDataGenerator <numberOfDataPoints> [<seed>]");
System.exit(1);
}
// parse parameters
final int numDataPoints = Integer.parseInt(args[0]);
final long firstSeed = args.length > 1 ? Long.parseLong(args[4]) : DEFAULT_SEED;
final Random random = new Random(firstSeed);
final String tmpDir = System.getProperty("java.io.tmpdir");
// write the points out
BufferedWriter pointsOut = null;
try {
pointsOut = new BufferedWriter(new FileWriter(new File(tmpDir + "/" + POINTS_FILE)));
StringBuilder buffer = new StringBuilder();
// DIMENSIONALITY + 1 means that the number of x(dimensionality) and target y
double[] point = new double[DIMENSIONALITY + 1];
for (int i = 1; i <= numDataPoints; i++) {
point[0] = random.nextGaussian();
point[1] = 2 * point[0] + 0.01 * random.nextGaussian();
writePoint(point, buffer, pointsOut);
}
}
finally {
if (pointsOut != null) {
pointsOut.close();
}
}
System.out.println("Wrote " + numDataPoints + " data points to " + tmpDir + "/" + POINTS_FILE);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"// check parameter count",
"if",
"(",
"args",
".",
"length",
"<",
"1",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"LinearRegressionDataGenera... | Main method to generate data for the {@link org.apache.flink.examples.java.ml.LinearRegression} example program.
<p>The generator creates to files:
<ul>
<li><code>{tmp.dir}/data</code> for the data points
</ul>
@param args
<ol>
<li>Int: Number of data points
<li><b>Optional</b> Long: Random seed
</ol> | [
"Main",
"method",
"to",
"generate",
"data",
"for",
"the",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"examples",
".",
"java",
".",
"ml",
".",
"LinearRegression",
"}",
"example",
"program",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/ml/util/LinearRegressionDataGenerator.java#L58-L95 | train | Main method for the LinearRegressionDataGenerator. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
4638,
16381,
4175,
2065,
1006,
12098,
5620,
1012,
3091,
1026,
1015,
1007,
1063,
2291,
1012,
2041,
1012,
6140,
19666,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java | CompactingHashTable.insertBucketEntryFromSearch | private void insertBucketEntryFromSearch(MemorySegment originalBucket, MemorySegment currentBucket,
int originalBucketOffset, int currentBucketOffset,
int countInCurrentBucket, long originalForwardPointer,
int hashCode, long pointer, int partitionNumber) throws IOException {
boolean checkForResize = false;
if (countInCurrentBucket < NUM_ENTRIES_PER_BUCKET) {
// we are good in our current bucket, put the values
currentBucket.putInt(currentBucketOffset + BUCKET_HEADER_LENGTH + (countInCurrentBucket * HASH_CODE_LEN), hashCode); // hash code
currentBucket.putLong(currentBucketOffset + BUCKET_POINTER_START_OFFSET + (countInCurrentBucket * POINTER_LEN), pointer); // pointer
currentBucket.putInt(currentBucketOffset + HEADER_COUNT_OFFSET, countInCurrentBucket + 1); // update count
}
else {
// we go to a new overflow bucket
final InMemoryPartition<T> partition = this.partitions.get(partitionNumber);
MemorySegment overflowSeg;
final int overflowSegmentNum;
final int overflowBucketOffset;
// first, see if there is space for an overflow bucket remaining in the last overflow segment
if (partition.nextOverflowBucket == 0) {
// no space left in last bucket, or no bucket yet, so create an overflow segment
overflowSeg = getNextBuffer();
overflowBucketOffset = 0;
overflowSegmentNum = partition.numOverflowSegments;
// add the new overflow segment
if (partition.overflowSegments.length <= partition.numOverflowSegments) {
MemorySegment[] newSegsArray = new MemorySegment[partition.overflowSegments.length * 2];
System.arraycopy(partition.overflowSegments, 0, newSegsArray, 0, partition.overflowSegments.length);
partition.overflowSegments = newSegsArray;
}
partition.overflowSegments[partition.numOverflowSegments] = overflowSeg;
partition.numOverflowSegments++;
checkForResize = true;
}
else {
// there is space in the last overflow segment
overflowSegmentNum = partition.numOverflowSegments - 1;
overflowSeg = partition.overflowSegments[overflowSegmentNum];
overflowBucketOffset = partition.nextOverflowBucket << NUM_INTRA_BUCKET_BITS;
}
// next overflow bucket is one ahead. if the segment is full, the next will be at the beginning
// of a new segment
partition.nextOverflowBucket = (partition.nextOverflowBucket == this.bucketsPerSegmentMask ? 0 : partition.nextOverflowBucket + 1);
// insert the new overflow bucket in the chain of buckets
// 1) set the old forward pointer
// 2) let the bucket in the main table point to this one
overflowSeg.putLong(overflowBucketOffset + HEADER_FORWARD_OFFSET, originalForwardPointer);
final long pointerToNewBucket = (((long) overflowSegmentNum) << 32) | ((long) overflowBucketOffset);
originalBucket.putLong(originalBucketOffset + HEADER_FORWARD_OFFSET, pointerToNewBucket);
// finally, insert the values into the overflow buckets
overflowSeg.putInt(overflowBucketOffset + BUCKET_HEADER_LENGTH, hashCode); // hash code
overflowSeg.putLong(overflowBucketOffset + BUCKET_POINTER_START_OFFSET, pointer); // pointer
// set the count to one
overflowSeg.putInt(overflowBucketOffset + HEADER_COUNT_OFFSET, 1);
if(checkForResize && !this.isResizing) {
// check if we should resize buckets
if(this.buckets.length <= getOverflowSegmentCount()) {
resizeHashTable();
}
}
}
} | java | private void insertBucketEntryFromSearch(MemorySegment originalBucket, MemorySegment currentBucket,
int originalBucketOffset, int currentBucketOffset,
int countInCurrentBucket, long originalForwardPointer,
int hashCode, long pointer, int partitionNumber) throws IOException {
boolean checkForResize = false;
if (countInCurrentBucket < NUM_ENTRIES_PER_BUCKET) {
// we are good in our current bucket, put the values
currentBucket.putInt(currentBucketOffset + BUCKET_HEADER_LENGTH + (countInCurrentBucket * HASH_CODE_LEN), hashCode); // hash code
currentBucket.putLong(currentBucketOffset + BUCKET_POINTER_START_OFFSET + (countInCurrentBucket * POINTER_LEN), pointer); // pointer
currentBucket.putInt(currentBucketOffset + HEADER_COUNT_OFFSET, countInCurrentBucket + 1); // update count
}
else {
// we go to a new overflow bucket
final InMemoryPartition<T> partition = this.partitions.get(partitionNumber);
MemorySegment overflowSeg;
final int overflowSegmentNum;
final int overflowBucketOffset;
// first, see if there is space for an overflow bucket remaining in the last overflow segment
if (partition.nextOverflowBucket == 0) {
// no space left in last bucket, or no bucket yet, so create an overflow segment
overflowSeg = getNextBuffer();
overflowBucketOffset = 0;
overflowSegmentNum = partition.numOverflowSegments;
// add the new overflow segment
if (partition.overflowSegments.length <= partition.numOverflowSegments) {
MemorySegment[] newSegsArray = new MemorySegment[partition.overflowSegments.length * 2];
System.arraycopy(partition.overflowSegments, 0, newSegsArray, 0, partition.overflowSegments.length);
partition.overflowSegments = newSegsArray;
}
partition.overflowSegments[partition.numOverflowSegments] = overflowSeg;
partition.numOverflowSegments++;
checkForResize = true;
}
else {
// there is space in the last overflow segment
overflowSegmentNum = partition.numOverflowSegments - 1;
overflowSeg = partition.overflowSegments[overflowSegmentNum];
overflowBucketOffset = partition.nextOverflowBucket << NUM_INTRA_BUCKET_BITS;
}
// next overflow bucket is one ahead. if the segment is full, the next will be at the beginning
// of a new segment
partition.nextOverflowBucket = (partition.nextOverflowBucket == this.bucketsPerSegmentMask ? 0 : partition.nextOverflowBucket + 1);
// insert the new overflow bucket in the chain of buckets
// 1) set the old forward pointer
// 2) let the bucket in the main table point to this one
overflowSeg.putLong(overflowBucketOffset + HEADER_FORWARD_OFFSET, originalForwardPointer);
final long pointerToNewBucket = (((long) overflowSegmentNum) << 32) | ((long) overflowBucketOffset);
originalBucket.putLong(originalBucketOffset + HEADER_FORWARD_OFFSET, pointerToNewBucket);
// finally, insert the values into the overflow buckets
overflowSeg.putInt(overflowBucketOffset + BUCKET_HEADER_LENGTH, hashCode); // hash code
overflowSeg.putLong(overflowBucketOffset + BUCKET_POINTER_START_OFFSET, pointer); // pointer
// set the count to one
overflowSeg.putInt(overflowBucketOffset + HEADER_COUNT_OFFSET, 1);
if(checkForResize && !this.isResizing) {
// check if we should resize buckets
if(this.buckets.length <= getOverflowSegmentCount()) {
resizeHashTable();
}
}
}
} | [
"private",
"void",
"insertBucketEntryFromSearch",
"(",
"MemorySegment",
"originalBucket",
",",
"MemorySegment",
"currentBucket",
",",
"int",
"originalBucketOffset",
",",
"int",
"currentBucketOffset",
",",
"int",
"countInCurrentBucket",
",",
"long",
"originalForwardPointer",
... | IMPORTANT!!! We pass only the partition number, because we must make sure we get a fresh
partition reference. The partition reference used during search for the key may have become
invalid during the compaction. | [
"IMPORTANT!!!",
"We",
"pass",
"only",
"the",
"partition",
"number",
"because",
"we",
"must",
"make",
"sure",
"we",
"get",
"a",
"fresh",
"partition",
"reference",
".",
"The",
"partition",
"reference",
"used",
"during",
"search",
"for",
"the",
"key",
"may",
"h... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java#L585-L652 | train | Insert a new bucket entry from the search. | [
30522,
2797,
11675,
19274,
24204,
12870,
3372,
2854,
19699,
22225,
14644,
2818,
1006,
3638,
3366,
21693,
4765,
2434,
24204,
3388,
1010,
3638,
3366,
21693,
4765,
2783,
24204,
3388,
1010,
20014,
2434,
24204,
18903,
21807,
3388,
1010,
20014,
278... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/SQLBuilder.java | SQLBuilder.toSQL | public SQLUnit toSQL(final TableUnit tableUnit, final Map<String, String> logicAndActualTableMap, final ShardingRule shardingRule, final ShardingDataSourceMetaData shardingDataSourceMetaData) {
StringBuilder result = new StringBuilder();
List<Object> insertParameters = new LinkedList<>();
for (Object each : segments) {
if (!(each instanceof ShardingPlaceholder)) {
result.append(each);
continue;
}
String logicTableName = ((ShardingPlaceholder) each).getLogicTableName();
String actualTableName = logicAndActualTableMap.get(logicTableName);
if (each instanceof TablePlaceholder) {
appendTablePlaceholder((TablePlaceholder) each, actualTableName, result);
} else if (each instanceof SchemaPlaceholder) {
appendSchemaPlaceholder(shardingRule, shardingDataSourceMetaData, actualTableName, result);
} else if (each instanceof IndexPlaceholder) {
appendIndexPlaceholder((IndexPlaceholder) each, actualTableName, result);
} else if (each instanceof InsertValuesPlaceholder) {
appendInsertValuesPlaceholder(tableUnit, (InsertValuesPlaceholder) each, insertParameters, result);
} else {
result.append(each);
}
}
return insertParameters.isEmpty() ? new SQLUnit(result.toString(), new ArrayList<>(parameters)) : new SQLUnit(result.toString(), insertParameters);
} | java | public SQLUnit toSQL(final TableUnit tableUnit, final Map<String, String> logicAndActualTableMap, final ShardingRule shardingRule, final ShardingDataSourceMetaData shardingDataSourceMetaData) {
StringBuilder result = new StringBuilder();
List<Object> insertParameters = new LinkedList<>();
for (Object each : segments) {
if (!(each instanceof ShardingPlaceholder)) {
result.append(each);
continue;
}
String logicTableName = ((ShardingPlaceholder) each).getLogicTableName();
String actualTableName = logicAndActualTableMap.get(logicTableName);
if (each instanceof TablePlaceholder) {
appendTablePlaceholder((TablePlaceholder) each, actualTableName, result);
} else if (each instanceof SchemaPlaceholder) {
appendSchemaPlaceholder(shardingRule, shardingDataSourceMetaData, actualTableName, result);
} else if (each instanceof IndexPlaceholder) {
appendIndexPlaceholder((IndexPlaceholder) each, actualTableName, result);
} else if (each instanceof InsertValuesPlaceholder) {
appendInsertValuesPlaceholder(tableUnit, (InsertValuesPlaceholder) each, insertParameters, result);
} else {
result.append(each);
}
}
return insertParameters.isEmpty() ? new SQLUnit(result.toString(), new ArrayList<>(parameters)) : new SQLUnit(result.toString(), insertParameters);
} | [
"public",
"SQLUnit",
"toSQL",
"(",
"final",
"TableUnit",
"tableUnit",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"logicAndActualTableMap",
",",
"final",
"ShardingRule",
"shardingRule",
",",
"final",
"ShardingDataSourceMetaData",
"shardingDataSourceMetaData"... | Convert to SQL unit.
@param tableUnit table unit
@param logicAndActualTableMap logic and actual map
@param shardingRule sharding rule
@param shardingDataSourceMetaData sharding data source meta data
@return SQL unit | [
"Convert",
"to",
"SQL",
"unit",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/SQLBuilder.java#L99-L122 | train | To SQL. | [
30522,
2270,
29296,
19496,
2102,
2000,
2015,
4160,
2140,
1006,
2345,
2795,
19496,
2102,
2795,
19496,
2102,
1010,
2345,
4949,
1026,
5164,
1010,
5164,
1028,
7961,
13832,
6593,
8787,
10880,
2863,
2361,
1010,
2345,
21146,
17080,
3070,
6820,
257... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java | RestClusterClient.getJobDetails | public CompletableFuture<JobDetailsInfo> getJobDetails(JobID jobId) {
final JobDetailsHeaders detailsHeaders = JobDetailsHeaders.getInstance();
final JobMessageParameters params = new JobMessageParameters();
params.jobPathParameter.resolve(jobId);
return sendRequest(
detailsHeaders,
params);
} | java | public CompletableFuture<JobDetailsInfo> getJobDetails(JobID jobId) {
final JobDetailsHeaders detailsHeaders = JobDetailsHeaders.getInstance();
final JobMessageParameters params = new JobMessageParameters();
params.jobPathParameter.resolve(jobId);
return sendRequest(
detailsHeaders,
params);
} | [
"public",
"CompletableFuture",
"<",
"JobDetailsInfo",
">",
"getJobDetails",
"(",
"JobID",
"jobId",
")",
"{",
"final",
"JobDetailsHeaders",
"detailsHeaders",
"=",
"JobDetailsHeaders",
".",
"getInstance",
"(",
")",
";",
"final",
"JobMessageParameters",
"params",
"=",
... | Requests the job details.
@param jobId The job id
@return Job details | [
"Requests",
"the",
"job",
"details",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java#L275-L283 | train | Get the job details information for the given job id. | [
30522,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
3105,
3207,
22081,
2378,
14876,
1028,
2131,
5558,
2497,
3207,
22081,
1006,
3105,
3593,
3105,
3593,
1007,
1063,
2345,
3105,
3207,
22081,
4974,
2545,
4751,
4974,
2545,
1027,
3105,
3207,
220... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/env/OriginTrackedPropertiesLoader.java | OriginTrackedPropertiesLoader.load | public Map<String, OriginTrackedValue> load(boolean expandLists) throws IOException {
try (CharacterReader reader = new CharacterReader(this.resource)) {
Map<String, OriginTrackedValue> result = new LinkedHashMap<>();
StringBuilder buffer = new StringBuilder();
while (reader.read()) {
String key = loadKey(buffer, reader).trim();
if (expandLists && key.endsWith("[]")) {
key = key.substring(0, key.length() - 2);
int index = 0;
do {
OriginTrackedValue value = loadValue(buffer, reader, true);
put(result, key + "[" + (index++) + "]", value);
if (!reader.isEndOfLine()) {
reader.read();
}
}
while (!reader.isEndOfLine());
}
else {
OriginTrackedValue value = loadValue(buffer, reader, false);
put(result, key, value);
}
}
return result;
}
} | java | public Map<String, OriginTrackedValue> load(boolean expandLists) throws IOException {
try (CharacterReader reader = new CharacterReader(this.resource)) {
Map<String, OriginTrackedValue> result = new LinkedHashMap<>();
StringBuilder buffer = new StringBuilder();
while (reader.read()) {
String key = loadKey(buffer, reader).trim();
if (expandLists && key.endsWith("[]")) {
key = key.substring(0, key.length() - 2);
int index = 0;
do {
OriginTrackedValue value = loadValue(buffer, reader, true);
put(result, key + "[" + (index++) + "]", value);
if (!reader.isEndOfLine()) {
reader.read();
}
}
while (!reader.isEndOfLine());
}
else {
OriginTrackedValue value = loadValue(buffer, reader, false);
put(result, key, value);
}
}
return result;
}
} | [
"public",
"Map",
"<",
"String",
",",
"OriginTrackedValue",
">",
"load",
"(",
"boolean",
"expandLists",
")",
"throws",
"IOException",
"{",
"try",
"(",
"CharacterReader",
"reader",
"=",
"new",
"CharacterReader",
"(",
"this",
".",
"resource",
")",
")",
"{",
"Ma... | Load {@code .properties} data and return a map of {@code String} ->
{@link OriginTrackedValue}.
@param expandLists if list {@code name[]=a,b,c} shortcuts should be expanded
@return the loaded properties
@throws IOException on read error | [
"Load",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java#L73-L98 | train | Load the OriginTrackedValue object from the file. | [
30522,
2270,
4949,
1026,
5164,
1010,
4761,
6494,
18141,
10175,
5657,
1028,
7170,
1006,
22017,
20898,
7818,
27103,
1007,
11618,
22834,
10288,
24422,
1063,
3046,
1006,
2839,
16416,
4063,
8068,
1027,
2047,
2839,
16416,
4063,
1006,
2023,
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-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/Handover.java | Handover.produce | public void produce(final ConsumerRecords<byte[], byte[]> element)
throws InterruptedException, WakeupException, ClosedException {
checkNotNull(element);
synchronized (lock) {
while (next != null && !wakeupProducer) {
lock.wait();
}
wakeupProducer = false;
// if there is still an element, we must have been woken up
if (next != null) {
throw new WakeupException();
}
// if there is no error, then this is open and can accept this element
else if (error == null) {
next = element;
lock.notifyAll();
}
// an error marks this as closed for the producer
else {
throw new ClosedException();
}
}
} | java | public void produce(final ConsumerRecords<byte[], byte[]> element)
throws InterruptedException, WakeupException, ClosedException {
checkNotNull(element);
synchronized (lock) {
while (next != null && !wakeupProducer) {
lock.wait();
}
wakeupProducer = false;
// if there is still an element, we must have been woken up
if (next != null) {
throw new WakeupException();
}
// if there is no error, then this is open and can accept this element
else if (error == null) {
next = element;
lock.notifyAll();
}
// an error marks this as closed for the producer
else {
throw new ClosedException();
}
}
} | [
"public",
"void",
"produce",
"(",
"final",
"ConsumerRecords",
"<",
"byte",
"[",
"]",
",",
"byte",
"[",
"]",
">",
"element",
")",
"throws",
"InterruptedException",
",",
"WakeupException",
",",
"ClosedException",
"{",
"checkNotNull",
"(",
"element",
")",
";",
... | Hands over an element from the producer. If the Handover already has an element that was
not yet picked up by the consumer thread, this call blocks until the consumer picks up that
previous element.
<p>This behavior is similar to a "size one" blocking queue.
@param element The next element to hand over.
@throws InterruptedException
Thrown, if the thread is interrupted while blocking for the Handover to be empty.
@throws WakeupException
Thrown, if the {@link #wakeupProducer()} method is called while blocking for
the Handover to be empty.
@throws ClosedException
Thrown if the Handover was closed or concurrently being closed. | [
"Hands",
"over",
"an",
"element",
"from",
"the",
"producer",
".",
"If",
"the",
"Handover",
"already",
"has",
"an",
"element",
"that",
"was",
"not",
"yet",
"picked",
"up",
"by",
"the",
"consumer",
"thread",
"this",
"call",
"blocks",
"until",
"the",
"consume... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/Handover.java#L110-L136 | train | produce an element | [
30522,
2270,
11675,
3965,
1006,
2345,
7325,
2890,
27108,
5104,
1026,
24880,
1031,
1033,
1010,
24880,
1031,
1033,
1028,
5783,
1007,
11618,
7153,
10288,
24422,
1010,
5256,
6279,
10288,
24422,
1010,
2701,
10288,
24422,
1063,
4638,
17048,
11231,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/utility/Utility.java | Utility.shuffleArray | public static void shuffleArray(int[] ar)
{
Random rnd = new Random();
for (int i = ar.length - 1; i > 0; i--)
{
int index = rnd.nextInt(i + 1);
// Simple swap
int a = ar[index];
ar[index] = ar[i];
ar[i] = a;
}
} | java | public static void shuffleArray(int[] ar)
{
Random rnd = new Random();
for (int i = ar.length - 1; i > 0; i--)
{
int index = rnd.nextInt(i + 1);
// Simple swap
int a = ar[index];
ar[index] = ar[i];
ar[i] = a;
}
} | [
"public",
"static",
"void",
"shuffleArray",
"(",
"int",
"[",
"]",
"ar",
")",
"{",
"Random",
"rnd",
"=",
"new",
"Random",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"ar",
".",
"length",
"-",
"1",
";",
"i",
">",
"0",
";",
"i",
"--",
")",
"{",
... | Fisher–Yates shuffle
@param ar | [
"Fisher–Yates",
"shuffle"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/utility/Utility.java#L59-L70 | train | Randomly shuffle array of int. | [
30522,
2270,
10763,
11675,
23046,
2906,
9447,
1006,
20014,
1031,
1033,
12098,
1007,
1063,
6721,
29300,
2094,
1027,
2047,
6721,
1006,
1007,
1025,
2005,
1006,
20014,
1045,
1027,
12098,
1012,
3091,
1011,
1015,
1025,
1045,
1028,
1014,
1025,
104... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.newClientContext | @Deprecated
public static SslContext newClientContext(
File certChainFile, TrustManagerFactory trustManagerFactory,
Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
long sessionCacheSize, long sessionTimeout) throws SSLException {
return newClientContext(
null, certChainFile, trustManagerFactory,
ciphers, cipherFilter, apn, sessionCacheSize, sessionTimeout);
} | java | @Deprecated
public static SslContext newClientContext(
File certChainFile, TrustManagerFactory trustManagerFactory,
Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
long sessionCacheSize, long sessionTimeout) throws SSLException {
return newClientContext(
null, certChainFile, trustManagerFactory,
ciphers, cipherFilter, apn, sessionCacheSize, sessionTimeout);
} | [
"@",
"Deprecated",
"public",
"static",
"SslContext",
"newClientContext",
"(",
"File",
"certChainFile",
",",
"TrustManagerFactory",
"trustManagerFactory",
",",
"Iterable",
"<",
"String",
">",
"ciphers",
",",
"CipherSuiteFilter",
"cipherFilter",
",",
"ApplicationProtocolCon... | Creates a new client-side {@link SslContext}.
@param certChainFile an X.509 certificate chain file in PEM format.
{@code null} to use the system default
@param trustManagerFactory the {@link TrustManagerFactory} that provides the {@link TrustManager}s
that verifies the certificates sent from servers.
{@code null} to use the default.
@param ciphers the cipher suites to enable, in the order of preference.
{@code null} to use the default cipher suites.
@param cipherFilter a filter to apply over the supplied list of ciphers
@param apn Provides a means to configure parameters related to application protocol negotiation.
@param sessionCacheSize the size of the cache used for storing SSL session objects.
{@code 0} to use the default value.
@param sessionTimeout the timeout for the cached SSL session objects, in seconds.
{@code 0} to use the default value.
@return a new client-side {@link SslContext}
@deprecated Replaced by {@link SslContextBuilder} | [
"Creates",
"a",
"new",
"client",
"-",
"side",
"{",
"@link",
"SslContext",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L551-L559 | train | Create a new SslContext with the specified parameters. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
7020,
22499,
10111,
18413,
2047,
20464,
11638,
8663,
18209,
1006,
5371,
8292,
5339,
24925,
2078,
8873,
2571,
1010,
3404,
24805,
4590,
21450,
3404,
24805,
4590,
21450,
1010,
2009,
6906,
3468,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/spring/cache/CacheConfig.java | CacheConfig.toYAML | public static String toYAML(Map<String, ? extends CacheConfig> config) throws IOException {
return new CacheConfigSupport().toYAML(config);
} | java | public static String toYAML(Map<String, ? extends CacheConfig> config) throws IOException {
return new CacheConfigSupport().toYAML(config);
} | [
"public",
"static",
"String",
"toYAML",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"CacheConfig",
">",
"config",
")",
"throws",
"IOException",
"{",
"return",
"new",
"CacheConfigSupport",
"(",
")",
".",
"toYAML",
"(",
"config",
")",
";",
"}"
] | Convert current configuration to YAML format
@param config map
@return yaml string
@throws IOException error | [
"Convert",
"current",
"configuration",
"to",
"YAML",
"format"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/spring/cache/CacheConfig.java#L234-L236 | train | Convert a map of cache config to a YAML string. | [
30522,
2270,
10763,
5164,
9121,
3286,
2140,
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,
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/gen/java/org/apache/hive/service/cli/thrift/TOpenSessionResp.java | TOpenSessionResp.isSet | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case STATUS:
return isSetStatus();
case SERVER_PROTOCOL_VERSION:
return isSetServerProtocolVersion();
case SESSION_HANDLE:
return isSetSessionHandle();
case CONFIGURATION:
return isSetConfiguration();
}
throw new IllegalStateException();
} | java | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case STATUS:
return isSetStatus();
case SERVER_PROTOCOL_VERSION:
return isSetServerProtocolVersion();
case SESSION_HANDLE:
return isSetSessionHandle();
case CONFIGURATION:
return isSetConfiguration();
}
throw new IllegalStateException();
} | [
"public",
"boolean",
"isSet",
"(",
"_Fields",
"field",
")",
"{",
"if",
"(",
"field",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"switch",
"(",
"field",
")",
"{",
"case",
"STATUS",
":",
"return",
"isSetStatus",... | Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise | [
"Returns",
"true",
"if",
"field",
"corresponding",
"to",
"fieldID",
"is",
"set",
"(",
"has",
"been",
"assigned",
"a",
"value",
")",
"and",
"false",
"otherwise"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TOpenSessionResp.java#L367-L383 | train | Checks if field is set to a value of a CRAsCTYPE object. | [
30522,
2270,
22017,
20898,
26354,
3388,
1006,
1035,
4249,
2492,
1007,
1063,
2065,
1006,
2492,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1007,
1025,
1065,
6942,
1006,
2492,
1007,
1063,
2553,
3570... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Snappy.java | Snappy.decodeCopyWith1ByteOffset | private static int decodeCopyWith1ByteOffset(byte tag, ByteBuf in, ByteBuf out, int writtenSoFar) {
if (!in.isReadable()) {
return NOT_ENOUGH_INPUT;
}
int initialIndex = out.writerIndex();
int length = 4 + ((tag & 0x01c) >> 2);
int offset = (tag & 0x0e0) << 8 >> 5 | in.readUnsignedByte();
validateOffset(offset, writtenSoFar);
out.markReaderIndex();
if (offset < length) {
int copies = length / offset;
for (; copies > 0; copies--) {
out.readerIndex(initialIndex - offset);
out.readBytes(out, offset);
}
if (length % offset != 0) {
out.readerIndex(initialIndex - offset);
out.readBytes(out, length % offset);
}
} else {
out.readerIndex(initialIndex - offset);
out.readBytes(out, length);
}
out.resetReaderIndex();
return length;
} | java | private static int decodeCopyWith1ByteOffset(byte tag, ByteBuf in, ByteBuf out, int writtenSoFar) {
if (!in.isReadable()) {
return NOT_ENOUGH_INPUT;
}
int initialIndex = out.writerIndex();
int length = 4 + ((tag & 0x01c) >> 2);
int offset = (tag & 0x0e0) << 8 >> 5 | in.readUnsignedByte();
validateOffset(offset, writtenSoFar);
out.markReaderIndex();
if (offset < length) {
int copies = length / offset;
for (; copies > 0; copies--) {
out.readerIndex(initialIndex - offset);
out.readBytes(out, offset);
}
if (length % offset != 0) {
out.readerIndex(initialIndex - offset);
out.readBytes(out, length % offset);
}
} else {
out.readerIndex(initialIndex - offset);
out.readBytes(out, length);
}
out.resetReaderIndex();
return length;
} | [
"private",
"static",
"int",
"decodeCopyWith1ByteOffset",
"(",
"byte",
"tag",
",",
"ByteBuf",
"in",
",",
"ByteBuf",
"out",
",",
"int",
"writtenSoFar",
")",
"{",
"if",
"(",
"!",
"in",
".",
"isReadable",
"(",
")",
")",
"{",
"return",
"NOT_ENOUGH_INPUT",
";",
... | Reads a compressed reference offset and length from the supplied input
buffer, seeks back to the appropriate place in the input buffer and
writes the found data to the supplied output stream.
@param tag The tag used to identify this as a copy is also used to encode
the length and part of the offset
@param in The input buffer to read from
@param out The output buffer to write to
@return The number of bytes appended to the output buffer, or -1 to indicate
"try again later"
@throws DecompressionException If the read offset is invalid | [
"Reads",
"a",
"compressed",
"reference",
"offset",
"and",
"length",
"from",
"the",
"supplied",
"input",
"buffer",
"seeks",
"back",
"to",
"the",
"appropriate",
"place",
"in",
"the",
"input",
"buffer",
"and",
"writes",
"the",
"found",
"data",
"to",
"the",
"sup... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java#L447-L476 | train | Decodes a copy with 1 byte offset. | [
30522,
2797,
10763,
20014,
21933,
3207,
3597,
7685,
24415,
2487,
3762,
2618,
27475,
3388,
1006,
24880,
6415,
1010,
24880,
8569,
2546,
1999,
1010,
24880,
8569,
2546,
2041,
1010,
20014,
2517,
6499,
14971,
1007,
1063,
2065,
1006,
999,
1999,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java | CommandBuilderUtils.javaMajorVersion | static int javaMajorVersion(String javaVersion) {
String[] version = javaVersion.split("[+.\\-]+");
int major = Integer.parseInt(version[0]);
// if major > 1, we're using the JEP-223 version string, e.g., 9-ea, 9+120
// otherwise the second number is the major version
if (major > 1) {
return major;
} else {
return Integer.parseInt(version[1]);
}
} | java | static int javaMajorVersion(String javaVersion) {
String[] version = javaVersion.split("[+.\\-]+");
int major = Integer.parseInt(version[0]);
// if major > 1, we're using the JEP-223 version string, e.g., 9-ea, 9+120
// otherwise the second number is the major version
if (major > 1) {
return major;
} else {
return Integer.parseInt(version[1]);
}
} | [
"static",
"int",
"javaMajorVersion",
"(",
"String",
"javaVersion",
")",
"{",
"String",
"[",
"]",
"version",
"=",
"javaVersion",
".",
"split",
"(",
"\"[+.\\\\-]+\"",
")",
";",
"int",
"major",
"=",
"Integer",
".",
"parseInt",
"(",
"version",
"[",
"0",
"]",
... | Get the major version of the java version string supplied. This method
accepts any JEP-223-compliant strings (9-ea, 9+100), as well as legacy
version strings such as 1.7.0_79 | [
"Get",
"the",
"major",
"version",
"of",
"the",
"java",
"version",
"string",
"supplied",
".",
"This",
"method",
"accepts",
"any",
"JEP",
"-",
"223",
"-",
"compliant",
"strings",
"(",
"9",
"-",
"ea",
"9",
"+",
"100",
")",
"as",
"well",
"as",
"legacy",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L300-L310 | train | Get the major version number from the java version string | [
30522,
10763,
20014,
9262,
2863,
5558,
2099,
27774,
1006,
5164,
9262,
27774,
1007,
1063,
5164,
1031,
1033,
2544,
1027,
9262,
27774,
1012,
3975,
1006,
1000,
1031,
1009,
1012,
1032,
1032,
1011,
1033,
1009,
1000,
1007,
1025,
20014,
2350,
1027,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/algorithm/Viterbi.java | Viterbi.compute | public static int[] compute(int[] obs, int[] states, double[] start_p, double[][] trans_p, double[][] emit_p)
{
int _max_states_value = 0;
for (int s : states)
{
_max_states_value = Math.max(_max_states_value, s);
}
++_max_states_value;
double[][] V = new double[obs.length][_max_states_value];
int[][] path = new int[_max_states_value][obs.length];
for (int y : states)
{
V[0][y] = start_p[y] + emit_p[y][obs[0]];
path[y][0] = y;
}
for (int t = 1; t < obs.length; ++t)
{
int[][] newpath = new int[_max_states_value][obs.length];
for (int y : states)
{
double prob = Double.MAX_VALUE;
int state;
for (int y0 : states)
{
double nprob = V[t - 1][y0] + trans_p[y0][y] + emit_p[y][obs[t]];
if (nprob < prob)
{
prob = nprob;
state = y0;
// 记录最大概率
V[t][y] = prob;
// 记录路径
System.arraycopy(path[state], 0, newpath[y], 0, t);
newpath[y][t] = y;
}
}
}
path = newpath;
}
double prob = Double.MAX_VALUE;
int state = 0;
for (int y : states)
{
if (V[obs.length - 1][y] < prob)
{
prob = V[obs.length - 1][y];
state = y;
}
}
return path[state];
} | java | public static int[] compute(int[] obs, int[] states, double[] start_p, double[][] trans_p, double[][] emit_p)
{
int _max_states_value = 0;
for (int s : states)
{
_max_states_value = Math.max(_max_states_value, s);
}
++_max_states_value;
double[][] V = new double[obs.length][_max_states_value];
int[][] path = new int[_max_states_value][obs.length];
for (int y : states)
{
V[0][y] = start_p[y] + emit_p[y][obs[0]];
path[y][0] = y;
}
for (int t = 1; t < obs.length; ++t)
{
int[][] newpath = new int[_max_states_value][obs.length];
for (int y : states)
{
double prob = Double.MAX_VALUE;
int state;
for (int y0 : states)
{
double nprob = V[t - 1][y0] + trans_p[y0][y] + emit_p[y][obs[t]];
if (nprob < prob)
{
prob = nprob;
state = y0;
// 记录最大概率
V[t][y] = prob;
// 记录路径
System.arraycopy(path[state], 0, newpath[y], 0, t);
newpath[y][t] = y;
}
}
}
path = newpath;
}
double prob = Double.MAX_VALUE;
int state = 0;
for (int y : states)
{
if (V[obs.length - 1][y] < prob)
{
prob = V[obs.length - 1][y];
state = y;
}
}
return path[state];
} | [
"public",
"static",
"int",
"[",
"]",
"compute",
"(",
"int",
"[",
"]",
"obs",
",",
"int",
"[",
"]",
"states",
",",
"double",
"[",
"]",
"start_p",
",",
"double",
"[",
"]",
"[",
"]",
"trans_p",
",",
"double",
"[",
"]",
"[",
"]",
"emit_p",
")",
"{"... | 求解HMM模型,所有概率请提前取对数
@param obs 观测序列
@param states 隐状态
@param start_p 初始概率(隐状态)
@param trans_p 转移概率(隐状态)
@param emit_p 发射概率 (隐状态表现为显状态的概率)
@return 最可能的序列 | [
"求解HMM模型,所有概率请提前取对数"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/Viterbi.java#L39-L95 | train | Compute the 2 - D HMM matrix. | [
30522,
2270,
10763,
20014,
1031,
1033,
24134,
1006,
20014,
1031,
1033,
27885,
2015,
1010,
20014,
1031,
1033,
2163,
1010,
3313,
1031,
1033,
2707,
1035,
1052,
1010,
3313,
1031,
1033,
1031,
1033,
9099,
1035,
1052,
1010,
3313,
1031,
1033,
1031,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/OpenSslSessionStats.java | OpenSslSessionStats.ticketKeyNew | public long ticketKeyNew() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionTicketKeyNew(context.ctx);
} finally {
readerLock.unlock();
}
} | java | public long ticketKeyNew() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionTicketKeyNew(context.ctx);
} finally {
readerLock.unlock();
}
} | [
"public",
"long",
"ticketKeyNew",
"(",
")",
"{",
"Lock",
"readerLock",
"=",
"context",
".",
"ctxLock",
".",
"readLock",
"(",
")",
";",
"readerLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"SSLContext",
".",
"sessionTicketKeyNew",
"(",
"context",... | Returns the number of times a client did not present a ticket and we issued a new one | [
"Returns",
"the",
"number",
"of",
"times",
"a",
"client",
"did",
"not",
"present",
"a",
"ticket",
"and",
"we",
"issued",
"a",
"new",
"one"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java#L217-L225 | train | Get ticketKeyNew. | [
30522,
2270,
2146,
7281,
14839,
2638,
2860,
1006,
1007,
1063,
5843,
8068,
7878,
1027,
6123,
1012,
14931,
2595,
7878,
1012,
3191,
7878,
1006,
1007,
1025,
8068,
7878,
1012,
5843,
1006,
1007,
1025,
3046,
1063,
2709,
7020,
22499,
10111,
18413,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ServiceOperations.java | ServiceOperations.start | public static void start(Service service) {
Service.STATE state = service.getServiceState();
ensureCurrentState(state, Service.STATE.INITED);
service.start();
} | java | public static void start(Service service) {
Service.STATE state = service.getServiceState();
ensureCurrentState(state, Service.STATE.INITED);
service.start();
} | [
"public",
"static",
"void",
"start",
"(",
"Service",
"service",
")",
"{",
"Service",
".",
"STATE",
"state",
"=",
"service",
".",
"getServiceState",
"(",
")",
";",
"ensureCurrentState",
"(",
"state",
",",
"Service",
".",
"STATE",
".",
"INITED",
")",
";",
... | Start a service.
The service state is checked <i>before</i> the operation begins.
This process is <i>not</i> thread safe.
@param service a service that must be in the state
{@link Service.STATE#INITED}
@throws RuntimeException on a state change failure
@throws IllegalStateException if the service is in the wrong state | [
"Start",
"a",
"service",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java#L81-L85 | train | Start the service. | [
30522,
2270,
10763,
11675,
2707,
1006,
2326,
2326,
1007,
1063,
2326,
1012,
2110,
2110,
1027,
2326,
1012,
4152,
2121,
7903,
4355,
3686,
1006,
1007,
1025,
5676,
10841,
14343,
7666,
12259,
1006,
2110,
1010,
2326,
1012,
2110,
1012,
1999,
17572,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getHeader | @Deprecated
public static String getHeader(HttpMessage message, CharSequence name, String defaultValue) {
return message.headers().get(name, defaultValue);
} | java | @Deprecated
public static String getHeader(HttpMessage message, CharSequence name, String defaultValue) {
return message.headers().get(name, defaultValue);
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"getHeader",
"(",
"HttpMessage",
"message",
",",
"CharSequence",
"name",
",",
"String",
"defaultValue",
")",
"{",
"return",
"message",
".",
"headers",
"(",
")",
".",
"get",
"(",
"name",
",",
"defaultValue",
")... | @deprecated Use {@link #get(CharSequence, String)} instead.
Returns the header value with the specified header name. If there are
more than one header value for the specified header name, the first
value is returned.
@return the header value or the {@code defaultValue} if there is no such
header | [
"@deprecated",
"Use",
"{",
"@link",
"#get",
"(",
"CharSequence",
"String",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L589-L592 | train | Get a header value from a message. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
5164,
2131,
4974,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
25869,
3366,
4226,
5897,
2171,
1010,
5164,
12398,
10175,
5657,
1007,
1063,
2709,
4471,
1012,
20346,
2015,
1006,
1007,
1012,
2131... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | utility/src/main/java/com/networknt/utility/NioUtils.java | NioUtils.toByteBuffer | public static ByteBuffer toByteBuffer(String s) {
ByteBuffer buffer = ByteBuffer.allocateDirect(s.length());
buffer.put(s.getBytes(UTF_8));
buffer.flip();
return buffer;
} | java | public static ByteBuffer toByteBuffer(String s) {
ByteBuffer buffer = ByteBuffer.allocateDirect(s.length());
buffer.put(s.getBytes(UTF_8));
buffer.flip();
return buffer;
} | [
"public",
"static",
"ByteBuffer",
"toByteBuffer",
"(",
"String",
"s",
")",
"{",
"ByteBuffer",
"buffer",
"=",
"ByteBuffer",
".",
"allocateDirect",
"(",
"s",
".",
"length",
"(",
")",
")",
";",
"buffer",
".",
"put",
"(",
"s",
".",
"getBytes",
"(",
"UTF_8",
... | convert String to ByteBuffer
@param s string to be converted
@return ByteBuffer the result ByteBuffer | [
"convert",
"String",
"to",
"ByteBuffer"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/NioUtils.java#L251-L256 | train | Converts a string to a ByteBuffer. | [
30522,
2270,
10763,
24880,
8569,
12494,
11291,
2618,
8569,
12494,
1006,
5164,
1055,
1007,
1063,
24880,
8569,
12494,
17698,
1027,
24880,
8569,
12494,
1012,
11095,
7442,
6593,
1006,
1055,
1012,
3091,
1006,
1007,
1007,
1025,
17698,
1012,
2404,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.mapToBeanIgnoreCase | public static <T> T mapToBeanIgnoreCase(Map<?, ?> map, Class<T> beanClass, boolean isIgnoreError) {
return fillBeanWithMapIgnoreCase(map, ReflectUtil.newInstance(beanClass), isIgnoreError);
} | java | public static <T> T mapToBeanIgnoreCase(Map<?, ?> map, Class<T> beanClass, boolean isIgnoreError) {
return fillBeanWithMapIgnoreCase(map, ReflectUtil.newInstance(beanClass), isIgnoreError);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"mapToBeanIgnoreCase",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"Class",
"<",
"T",
">",
"beanClass",
",",
"boolean",
"isIgnoreError",
")",
"{",
"return",
"fillBeanWithMapIgnoreCase",
"(",
"map",
",",
"Refle... | Map转换为Bean对象<br>
忽略大小写
@param <T> Bean类型
@param map Map
@param beanClass Bean Class
@param isIgnoreError 是否忽略注入错误
@return Bean | [
"Map转换为Bean对象<br",
">",
"忽略大小写"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L341-L343 | train | Fill a map with bean instance of beanClass ignoring case. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
4949,
3406,
4783,
7088,
26745,
2890,
18382,
1006,
4949,
1026,
1029,
1010,
1029,
1028,
4949,
1010,
2465,
1026,
1056,
1028,
14068,
26266,
1010,
22017,
20898,
2003,
23773,
5686,
2121,
29165,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegmentFactory.java | MemorySegmentFactory.allocateUnpooledOffHeapMemory | public static MemorySegment allocateUnpooledOffHeapMemory(int size, Object owner) {
ByteBuffer memory = ByteBuffer.allocateDirect(size);
return wrapPooledOffHeapMemory(memory, owner);
} | java | public static MemorySegment allocateUnpooledOffHeapMemory(int size, Object owner) {
ByteBuffer memory = ByteBuffer.allocateDirect(size);
return wrapPooledOffHeapMemory(memory, owner);
} | [
"public",
"static",
"MemorySegment",
"allocateUnpooledOffHeapMemory",
"(",
"int",
"size",
",",
"Object",
"owner",
")",
"{",
"ByteBuffer",
"memory",
"=",
"ByteBuffer",
".",
"allocateDirect",
"(",
"size",
")",
";",
"return",
"wrapPooledOffHeapMemory",
"(",
"memory",
... | Allocates some unpooled off-heap memory and creates a new memory segment that
represents that memory.
@param size The size of the off-heap memory segment to allocate.
@param owner The owner to associate with the off-heap memory segment.
@return A new memory segment, backed by unpooled off-heap memory. | [
"Allocates",
"some",
"unpooled",
"off",
"-",
"heap",
"memory",
"and",
"creates",
"a",
"new",
"memory",
"segment",
"that",
"represents",
"that",
"memory",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegmentFactory.java#L85-L88 | train | Allocate an unpooled off - heap memory. | [
30522,
2270,
10763,
3638,
3366,
21693,
4765,
2035,
24755,
2618,
4609,
16869,
26010,
4246,
20192,
9737,
6633,
10253,
1006,
20014,
2946,
1010,
4874,
3954,
1007,
1063,
24880,
8569,
12494,
3638,
1027,
24880,
8569,
12494,
1012,
11095,
7442,
6593,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/UndertowReactiveWebServerFactory.java | UndertowReactiveWebServerFactory.setBuilderCustomizers | public void setBuilderCustomizers(
Collection<? extends UndertowBuilderCustomizer> customizers) {
Assert.notNull(customizers, "Customizers must not be null");
this.builderCustomizers = new ArrayList<>(customizers);
} | java | public void setBuilderCustomizers(
Collection<? extends UndertowBuilderCustomizer> customizers) {
Assert.notNull(customizers, "Customizers must not be null");
this.builderCustomizers = new ArrayList<>(customizers);
} | [
"public",
"void",
"setBuilderCustomizers",
"(",
"Collection",
"<",
"?",
"extends",
"UndertowBuilderCustomizer",
">",
"customizers",
")",
"{",
"Assert",
".",
"notNull",
"(",
"customizers",
",",
"\"Customizers must not be null\"",
")",
";",
"this",
".",
"builderCustomiz... | Set {@link UndertowBuilderCustomizer}s that should be applied to the Undertow
{@link io.undertow.Undertow.Builder Builder}. Calling this method will replace any
existing customizers.
@param customizers the customizers to set | [
"Set",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowReactiveWebServerFactory.java#L302-L306 | train | Sets the customizers to be used for building the underlying builder. | [
30522,
2270,
11675,
2275,
8569,
23891,
29006,
20389,
17629,
2015,
1006,
3074,
1026,
1029,
8908,
2104,
18790,
8569,
23891,
29006,
20389,
17629,
1028,
7661,
17629,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
7661,
17629,
2015,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java | BinTrie.parseText | public void parseText(String text, AhoCorasickDoubleArrayTrie.IHit<V> processor)
{
int length = text.length();
int begin = 0;
BaseNode<V> state = this;
for (int i = begin; i < length; ++i)
{
state = state.transition(text.charAt(i));
if (state != null)
{
V value = state.getValue();
if (value != null)
{
processor.hit(begin, i + 1, value);
}
}
else
{
i = begin;
++begin;
state = this;
}
}
} | java | public void parseText(String text, AhoCorasickDoubleArrayTrie.IHit<V> processor)
{
int length = text.length();
int begin = 0;
BaseNode<V> state = this;
for (int i = begin; i < length; ++i)
{
state = state.transition(text.charAt(i));
if (state != null)
{
V value = state.getValue();
if (value != null)
{
processor.hit(begin, i + 1, value);
}
}
else
{
i = begin;
++begin;
state = this;
}
}
} | [
"public",
"void",
"parseText",
"(",
"String",
"text",
",",
"AhoCorasickDoubleArrayTrie",
".",
"IHit",
"<",
"V",
">",
"processor",
")",
"{",
"int",
"length",
"=",
"text",
".",
"length",
"(",
")",
";",
"int",
"begin",
"=",
"0",
";",
"BaseNode",
"<",
"V",... | 匹配文本
@param text 文本
@param processor 处理器 | [
"匹配文本"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java#L595-L619 | train | Parse text. | [
30522,
2270,
11675,
11968,
13462,
10288,
2102,
1006,
5164,
3793,
1010,
6289,
24163,
8180,
6799,
26797,
3468,
2906,
9447,
18886,
2063,
1012,
1045,
16584,
1026,
1058,
1028,
13151,
1007,
1063,
20014,
3091,
1027,
3793,
1012,
3091,
1006,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartition.java | ResultPartition.pin | void pin() {
while (true) {
int refCnt = pendingReferences.get();
if (refCnt >= 0) {
if (pendingReferences.compareAndSet(refCnt, refCnt + subpartitions.length)) {
break;
}
}
else {
throw new IllegalStateException("Released.");
}
}
} | java | void pin() {
while (true) {
int refCnt = pendingReferences.get();
if (refCnt >= 0) {
if (pendingReferences.compareAndSet(refCnt, refCnt + subpartitions.length)) {
break;
}
}
else {
throw new IllegalStateException("Released.");
}
}
} | [
"void",
"pin",
"(",
")",
"{",
"while",
"(",
"true",
")",
"{",
"int",
"refCnt",
"=",
"pendingReferences",
".",
"get",
"(",
")",
";",
"if",
"(",
"refCnt",
">=",
"0",
")",
"{",
"if",
"(",
"pendingReferences",
".",
"compareAndSet",
"(",
"refCnt",
",",
... | Pins the result partition.
<p>The partition can only be released after each subpartition has been consumed once per pin
operation. | [
"Pins",
"the",
"result",
"partition",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartition.java#L412-L425 | train | Pins the partition. | [
30522,
11675,
9231,
1006,
1007,
1063,
2096,
1006,
2995,
1007,
1063,
20014,
25416,
2278,
3372,
1027,
14223,
2890,
25523,
2015,
1012,
2131,
1006,
1007,
1025,
2065,
1006,
25416,
2278,
3372,
1028,
1027,
1014,
1007,
1063,
2065,
1006,
14223,
2890... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getUint24 | public final int getUint24(final int pos) {
final int position = origin + pos;
if (pos + 2 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 2)));
byte[] buf = buffer;
return (0xff & buf[position]) | ((0xff & buf[position + 1]) << 8) | ((0xff & buf[position + 2]) << 16);
} | java | public final int getUint24(final int pos) {
final int position = origin + pos;
if (pos + 2 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 2)));
byte[] buf = buffer;
return (0xff & buf[position]) | ((0xff & buf[position + 1]) << 8) | ((0xff & buf[position + 2]) << 16);
} | [
"public",
"final",
"int",
"getUint24",
"(",
"final",
"int",
"pos",
")",
"{",
"final",
"int",
"position",
"=",
"origin",
"+",
"pos",
";",
"if",
"(",
"pos",
"+",
"2",
">=",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
... | Return 24-bit unsigned int from buffer. (little-endian)
@see mysql-5.1.60/include/my_global.h - uint3korr | [
"Return",
"24",
"-",
"bit",
"unsigned",
"int",
"from",
"buffer",
".",
"(",
"little",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L413-L421 | train | Gets an unsigned 24 - bit value from the buffer. | [
30522,
2270,
2345,
20014,
2131,
20023,
2102,
18827,
1006,
2345,
20014,
13433,
2015,
1007,
1063,
2345,
20014,
2597,
1027,
4761,
1009,
13433,
2015,
1025,
2065,
1006,
13433,
2015,
1009,
1016,
1028,
1027,
5787,
1064,
1064,
13433,
2015,
1026,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/dialect/tinylog/TinyLog.java | TinyLog.getLastArgumentIfThrowable | private static Throwable getLastArgumentIfThrowable(Object... arguments) {
if (ArrayUtil.isNotEmpty(arguments) && arguments[arguments.length - 1] instanceof Throwable) {
return (Throwable) arguments[arguments.length - 1];
} else {
return null;
}
} | java | private static Throwable getLastArgumentIfThrowable(Object... arguments) {
if (ArrayUtil.isNotEmpty(arguments) && arguments[arguments.length - 1] instanceof Throwable) {
return (Throwable) arguments[arguments.length - 1];
} else {
return null;
}
} | [
"private",
"static",
"Throwable",
"getLastArgumentIfThrowable",
"(",
"Object",
"...",
"arguments",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isNotEmpty",
"(",
"arguments",
")",
"&&",
"arguments",
"[",
"arguments",
".",
"length",
"-",
"1",
"]",
"instanceof",
"Thr... | 如果最后一个参数为异常参数,则获取之,否则返回null
@param arguments 参数
@return 最后一个异常参数
@since 4.0.3 | [
"如果最后一个参数为异常参数,则获取之,否则返回null"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/dialect/tinylog/TinyLog.java#L174-L180 | train | Gets the last argument if Throwable. | [
30522,
2797,
10763,
5466,
3085,
2131,
8523,
7559,
22850,
4765,
10128,
2705,
10524,
3085,
1006,
4874,
1012,
1012,
1012,
9918,
1007,
1063,
2065,
1006,
9140,
21823,
2140,
1012,
3475,
12184,
27718,
2100,
1006,
9918,
1007,
1004,
1004,
9918,
1031... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java | VectorizedColumnReader.readBatch | void readBatch(int total, WritableColumnVector column) throws IOException {
int rowId = 0;
WritableColumnVector dictionaryIds = null;
if (dictionary != null) {
// SPARK-16334: We only maintain a single dictionary per row batch, so that it can be used to
// decode all previous dictionary encoded pages if we ever encounter a non-dictionary encoded
// page.
dictionaryIds = column.reserveDictionaryIds(total);
}
while (total > 0) {
// Compute the number of values we want to read in this page.
int leftInPage = (int) (endOfPageValueCount - valuesRead);
if (leftInPage == 0) {
readPage();
leftInPage = (int) (endOfPageValueCount - valuesRead);
}
int num = Math.min(total, leftInPage);
PrimitiveType.PrimitiveTypeName typeName =
descriptor.getPrimitiveType().getPrimitiveTypeName();
if (isCurrentPageDictionaryEncoded) {
// Read and decode dictionary ids.
defColumn.readIntegers(
num, dictionaryIds, column, rowId, maxDefLevel, (VectorizedValuesReader) dataColumn);
// TIMESTAMP_MILLIS encoded as INT64 can't be lazily decoded as we need to post process
// the values to add microseconds precision.
if (column.hasDictionary() || (rowId == 0 &&
(typeName == PrimitiveType.PrimitiveTypeName.INT32 ||
(typeName == PrimitiveType.PrimitiveTypeName.INT64 &&
originalType != OriginalType.TIMESTAMP_MILLIS) ||
typeName == PrimitiveType.PrimitiveTypeName.FLOAT ||
typeName == PrimitiveType.PrimitiveTypeName.DOUBLE ||
typeName == PrimitiveType.PrimitiveTypeName.BINARY))) {
// Column vector supports lazy decoding of dictionary values so just set the dictionary.
// We can't do this if rowId != 0 AND the column doesn't have a dictionary (i.e. some
// non-dictionary encoded values have already been added).
column.setDictionary(new ParquetDictionary(dictionary));
} else {
decodeDictionaryIds(rowId, num, column, dictionaryIds);
}
} else {
if (column.hasDictionary() && rowId != 0) {
// This batch already has dictionary encoded values but this new page is not. The batch
// does not support a mix of dictionary and not so we will decode the dictionary.
decodeDictionaryIds(0, rowId, column, column.getDictionaryIds());
}
column.setDictionary(null);
switch (typeName) {
case BOOLEAN:
readBooleanBatch(rowId, num, column);
break;
case INT32:
readIntBatch(rowId, num, column);
break;
case INT64:
readLongBatch(rowId, num, column);
break;
case INT96:
readBinaryBatch(rowId, num, column);
break;
case FLOAT:
readFloatBatch(rowId, num, column);
break;
case DOUBLE:
readDoubleBatch(rowId, num, column);
break;
case BINARY:
readBinaryBatch(rowId, num, column);
break;
case FIXED_LEN_BYTE_ARRAY:
readFixedLenByteArrayBatch(
rowId, num, column, descriptor.getPrimitiveType().getTypeLength());
break;
default:
throw new IOException("Unsupported type: " + typeName);
}
}
valuesRead += num;
rowId += num;
total -= num;
}
} | java | void readBatch(int total, WritableColumnVector column) throws IOException {
int rowId = 0;
WritableColumnVector dictionaryIds = null;
if (dictionary != null) {
// SPARK-16334: We only maintain a single dictionary per row batch, so that it can be used to
// decode all previous dictionary encoded pages if we ever encounter a non-dictionary encoded
// page.
dictionaryIds = column.reserveDictionaryIds(total);
}
while (total > 0) {
// Compute the number of values we want to read in this page.
int leftInPage = (int) (endOfPageValueCount - valuesRead);
if (leftInPage == 0) {
readPage();
leftInPage = (int) (endOfPageValueCount - valuesRead);
}
int num = Math.min(total, leftInPage);
PrimitiveType.PrimitiveTypeName typeName =
descriptor.getPrimitiveType().getPrimitiveTypeName();
if (isCurrentPageDictionaryEncoded) {
// Read and decode dictionary ids.
defColumn.readIntegers(
num, dictionaryIds, column, rowId, maxDefLevel, (VectorizedValuesReader) dataColumn);
// TIMESTAMP_MILLIS encoded as INT64 can't be lazily decoded as we need to post process
// the values to add microseconds precision.
if (column.hasDictionary() || (rowId == 0 &&
(typeName == PrimitiveType.PrimitiveTypeName.INT32 ||
(typeName == PrimitiveType.PrimitiveTypeName.INT64 &&
originalType != OriginalType.TIMESTAMP_MILLIS) ||
typeName == PrimitiveType.PrimitiveTypeName.FLOAT ||
typeName == PrimitiveType.PrimitiveTypeName.DOUBLE ||
typeName == PrimitiveType.PrimitiveTypeName.BINARY))) {
// Column vector supports lazy decoding of dictionary values so just set the dictionary.
// We can't do this if rowId != 0 AND the column doesn't have a dictionary (i.e. some
// non-dictionary encoded values have already been added).
column.setDictionary(new ParquetDictionary(dictionary));
} else {
decodeDictionaryIds(rowId, num, column, dictionaryIds);
}
} else {
if (column.hasDictionary() && rowId != 0) {
// This batch already has dictionary encoded values but this new page is not. The batch
// does not support a mix of dictionary and not so we will decode the dictionary.
decodeDictionaryIds(0, rowId, column, column.getDictionaryIds());
}
column.setDictionary(null);
switch (typeName) {
case BOOLEAN:
readBooleanBatch(rowId, num, column);
break;
case INT32:
readIntBatch(rowId, num, column);
break;
case INT64:
readLongBatch(rowId, num, column);
break;
case INT96:
readBinaryBatch(rowId, num, column);
break;
case FLOAT:
readFloatBatch(rowId, num, column);
break;
case DOUBLE:
readDoubleBatch(rowId, num, column);
break;
case BINARY:
readBinaryBatch(rowId, num, column);
break;
case FIXED_LEN_BYTE_ARRAY:
readFixedLenByteArrayBatch(
rowId, num, column, descriptor.getPrimitiveType().getTypeLength());
break;
default:
throw new IOException("Unsupported type: " + typeName);
}
}
valuesRead += num;
rowId += num;
total -= num;
}
} | [
"void",
"readBatch",
"(",
"int",
"total",
",",
"WritableColumnVector",
"column",
")",
"throws",
"IOException",
"{",
"int",
"rowId",
"=",
"0",
";",
"WritableColumnVector",
"dictionaryIds",
"=",
"null",
";",
"if",
"(",
"dictionary",
"!=",
"null",
")",
"{",
"//... | Reads `total` values from this columnReader into column. | [
"Reads",
"total",
"values",
"from",
"this",
"columnReader",
"into",
"column",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedColumnReader.java#L153-L235 | train | Read a batch of values from the data stream. | [
30522,
11675,
3191,
14479,
2818,
1006,
20014,
2561,
1010,
25697,
3085,
25778,
2819,
2078,
3726,
16761,
5930,
1007,
11618,
22834,
10288,
24422,
1063,
20014,
5216,
3593,
1027,
1014,
1025,
25697,
3085,
25778,
2819,
2078,
3726,
16761,
9206,
9821,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java | RequiredParameters.add | public Option add(String name) throws RequiredParametersException {
if (!this.data.containsKey(name)) {
Option option = new Option(name);
this.data.put(name, option);
return option;
} else {
throw new RequiredParametersException("Option with key " + name + " already exists.");
}
} | java | public Option add(String name) throws RequiredParametersException {
if (!this.data.containsKey(name)) {
Option option = new Option(name);
this.data.put(name, option);
return option;
} else {
throw new RequiredParametersException("Option with key " + name + " already exists.");
}
} | [
"public",
"Option",
"add",
"(",
"String",
"name",
")",
"throws",
"RequiredParametersException",
"{",
"if",
"(",
"!",
"this",
".",
"data",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"Option",
"option",
"=",
"new",
"Option",
"(",
"name",
")",
";",
"... | Add a parameter based on its name.
@param name - the name of the parameter
@return - an {@link Option} object representing the parameter
@throws RequiredParametersException if an option with the same name is already defined | [
"Add",
"a",
"parameter",
"based",
"on",
"its",
"name",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java#L52-L60 | train | Add an option to the options. | [
30522,
2270,
5724,
5587,
1006,
5164,
2171,
1007,
11618,
3223,
28689,
22828,
3366,
2595,
24422,
1063,
2065,
1006,
999,
2023,
1012,
2951,
1012,
3397,
14839,
1006,
2171,
1007,
1007,
1063,
5724,
5724,
1027,
2047,
5724,
1006,
2171,
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/lang/PatternPool.java | PatternPool.get | public static Pattern get(String regex, int flags) {
final RegexWithFlag regexWithFlag = new RegexWithFlag(regex, flags);
Pattern pattern = POOL.get(regexWithFlag);
if (null == pattern) {
pattern = Pattern.compile(regex, flags);
POOL.put(regexWithFlag, pattern);
}
return pattern;
} | java | public static Pattern get(String regex, int flags) {
final RegexWithFlag regexWithFlag = new RegexWithFlag(regex, flags);
Pattern pattern = POOL.get(regexWithFlag);
if (null == pattern) {
pattern = Pattern.compile(regex, flags);
POOL.put(regexWithFlag, pattern);
}
return pattern;
} | [
"public",
"static",
"Pattern",
"get",
"(",
"String",
"regex",
",",
"int",
"flags",
")",
"{",
"final",
"RegexWithFlag",
"regexWithFlag",
"=",
"new",
"RegexWithFlag",
"(",
"regex",
",",
"flags",
")",
";",
"Pattern",
"pattern",
"=",
"POOL",
".",
"get",
"(",
... | 先从Pattern池中查找正则对应的{@link Pattern},找不到则编译正则表达式并入池。
@param regex 正则表达式
@param flags 正则标识位集合 {@link Pattern}
@return {@link Pattern} | [
"先从Pattern池中查找正则对应的",
"{",
"@link",
"Pattern",
"}",
",找不到则编译正则表达式并入池。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/PatternPool.java#L82-L91 | train | Gets a pattern from the pool. | [
30522,
2270,
10763,
5418,
2131,
1006,
5164,
19723,
10288,
1010,
20014,
9245,
1007,
1063,
2345,
19723,
10288,
24415,
10258,
8490,
19723,
10288,
24415,
10258,
8490,
1027,
2047,
19723,
10288,
24415,
10258,
8490,
1006,
19723,
10288,
1010,
9245,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/ResourceLeakDetectorFactory.java | ResourceLeakDetectorFactory.newResourceLeakDetector | @SuppressWarnings("deprecation")
public <T> ResourceLeakDetector<T> newResourceLeakDetector(Class<T> resource, int samplingInterval) {
return newResourceLeakDetector(resource, ResourceLeakDetector.SAMPLING_INTERVAL, Long.MAX_VALUE);
} | java | @SuppressWarnings("deprecation")
public <T> ResourceLeakDetector<T> newResourceLeakDetector(Class<T> resource, int samplingInterval) {
return newResourceLeakDetector(resource, ResourceLeakDetector.SAMPLING_INTERVAL, Long.MAX_VALUE);
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"<",
"T",
">",
"ResourceLeakDetector",
"<",
"T",
">",
"newResourceLeakDetector",
"(",
"Class",
"<",
"T",
">",
"resource",
",",
"int",
"samplingInterval",
")",
"{",
"return",
"newResourceLeakDetector",... | Returns a new instance of a {@link ResourceLeakDetector} with the given resource class.
@param resource the resource class used to initialize the {@link ResourceLeakDetector}
@param samplingInterval the interval on which sampling takes place
@param <T> the type of the resource class
@return a new instance of {@link ResourceLeakDetector} | [
"Returns",
"a",
"new",
"instance",
"of",
"a",
"{",
"@link",
"ResourceLeakDetector",
"}",
"with",
"the",
"given",
"resource",
"class",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ResourceLeakDetectorFactory.java#L91-L94 | train | Create a new instance of the ResourceLeakDetector class. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
2139,
28139,
10719,
1000,
1007,
2270,
1026,
1056,
1028,
7692,
19738,
2243,
3207,
26557,
4263,
1026,
1056,
1028,
2047,
6072,
8162,
29109,
25508,
3207,
26557,
4263,
1006,
2465,
1026,
1056,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/compiler/NFAStateNameHandler.java | NFAStateNameHandler.checkNameUniqueness | public void checkNameUniqueness(String name) {
if (usedNames.contains(name)) {
throw new MalformedPatternException("Duplicate pattern name: " + name + ". Names must be unique.");
}
usedNames.add(name);
} | java | public void checkNameUniqueness(String name) {
if (usedNames.contains(name)) {
throw new MalformedPatternException("Duplicate pattern name: " + name + ". Names must be unique.");
}
usedNames.add(name);
} | [
"public",
"void",
"checkNameUniqueness",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"usedNames",
".",
"contains",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"MalformedPatternException",
"(",
"\"Duplicate pattern name: \"",
"+",
"name",
"+",
"\". Names must be un... | Checks if the given name is already used or not. If yes, it
throws a {@link MalformedPatternException}.
@param name The name to be checked. | [
"Checks",
"if",
"the",
"given",
"name",
"is",
"already",
"used",
"or",
"not",
".",
"If",
"yes",
"it",
"throws",
"a",
"{",
"@link",
"MalformedPatternException",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/compiler/NFAStateNameHandler.java#L54-L59 | train | Checks that the name is unique. | [
30522,
2270,
11675,
4638,
18442,
19496,
4226,
2791,
1006,
5164,
2171,
1007,
1063,
2065,
1006,
2109,
18442,
2015,
1012,
3397,
1006,
2171,
1007,
1007,
1063,
5466,
2047,
15451,
29021,
4502,
12079,
2638,
2595,
24422,
1006,
1000,
24473,
5418,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/BaseAsymmetric.java | BaseAsymmetric.getKeyByType | protected Key getKeyByType(KeyType type) {
switch (type) {
case PrivateKey:
if (null == this.privateKey) {
throw new NullPointerException("Private key must not null when use it !");
}
return this.privateKey;
case PublicKey:
if (null == this.publicKey) {
throw new NullPointerException("Public key must not null when use it !");
}
return this.publicKey;
}
throw new CryptoException("Uknown key type: " + type);
} | java | protected Key getKeyByType(KeyType type) {
switch (type) {
case PrivateKey:
if (null == this.privateKey) {
throw new NullPointerException("Private key must not null when use it !");
}
return this.privateKey;
case PublicKey:
if (null == this.publicKey) {
throw new NullPointerException("Public key must not null when use it !");
}
return this.publicKey;
}
throw new CryptoException("Uknown key type: " + type);
} | [
"protected",
"Key",
"getKeyByType",
"(",
"KeyType",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"PrivateKey",
":",
"if",
"(",
"null",
"==",
"this",
".",
"privateKey",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Private key must n... | 根据密钥类型获得相应密钥
@param type 类型 {@link KeyType}
@return {@link Key} | [
"根据密钥类型获得相应密钥"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/BaseAsymmetric.java#L156-L170 | train | Returns the key of the specified type. | [
30522,
5123,
3145,
2131,
14839,
3762,
13874,
1006,
3145,
13874,
2828,
1007,
1063,
6942,
1006,
2828,
1007,
1063,
2553,
2797,
14839,
1024,
2065,
1006,
19701,
1027,
1027,
2023,
1012,
2797,
14839,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java | SM2Engine.xor | private void xor(byte[] data, byte[] kdfOut, int dOff, int dRemaining) {
for (int i = 0; i != dRemaining; i++) {
data[dOff + i] ^= kdfOut[i];
}
} | java | private void xor(byte[] data, byte[] kdfOut, int dOff, int dRemaining) {
for (int i = 0; i != dRemaining; i++) {
data[dOff + i] ^= kdfOut[i];
}
} | [
"private",
"void",
"xor",
"(",
"byte",
"[",
"]",
"data",
",",
"byte",
"[",
"]",
"kdfOut",
",",
"int",
"dOff",
",",
"int",
"dRemaining",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"dRemaining",
";",
"i",
"++",
")",
"{",
"data",
... | 异或
@param data 数据
@param kdfOut kdf输出值
@param dOff d偏移
@param dRemaining d剩余 | [
"异或"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java#L326-L330 | train | XOR data with the KDF output | [
30522,
2797,
11675,
1060,
2953,
1006,
24880,
1031,
1033,
2951,
1010,
24880,
1031,
1033,
1047,
20952,
5833,
1010,
20014,
2079,
4246,
1010,
20014,
2852,
14545,
24002,
1007,
1063,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
999,
1027,
285... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/executor/TasksRunnerService.java | TasksRunnerService.finish | private void finish(String requestId, boolean removeTask) {
String script = "";
if (removeTask) {
script += "local scheduled = redis.call('zscore', KEYS[5], ARGV[3]);"
+ "if scheduled == false then "
+ "redis.call('hdel', KEYS[4], ARGV[3]); "
+ "end;";
}
script += "redis.call('zrem', KEYS[5], 'ff' .. ARGV[3]);" +
"if redis.call('decr', KEYS[1]) == 0 then "
+ "redis.call('del', KEYS[1]);"
+ "if redis.call('get', KEYS[2]) == ARGV[1] then "
+ "redis.call('del', KEYS[6]);"
+ "redis.call('set', KEYS[2], ARGV[2]);"
+ "redis.call('publish', KEYS[3], ARGV[2]);"
+ "end;"
+ "end;";
commandExecutor.evalWrite(name, StringCodec.INSTANCE, RedisCommands.EVAL_VOID,
script,
Arrays.<Object>asList(tasksCounterName, statusName, terminationTopicName, tasksName, schedulerQueueName, tasksRetryIntervalName),
RedissonExecutorService.SHUTDOWN_STATE, RedissonExecutorService.TERMINATED_STATE, requestId);
} | java | private void finish(String requestId, boolean removeTask) {
String script = "";
if (removeTask) {
script += "local scheduled = redis.call('zscore', KEYS[5], ARGV[3]);"
+ "if scheduled == false then "
+ "redis.call('hdel', KEYS[4], ARGV[3]); "
+ "end;";
}
script += "redis.call('zrem', KEYS[5], 'ff' .. ARGV[3]);" +
"if redis.call('decr', KEYS[1]) == 0 then "
+ "redis.call('del', KEYS[1]);"
+ "if redis.call('get', KEYS[2]) == ARGV[1] then "
+ "redis.call('del', KEYS[6]);"
+ "redis.call('set', KEYS[2], ARGV[2]);"
+ "redis.call('publish', KEYS[3], ARGV[2]);"
+ "end;"
+ "end;";
commandExecutor.evalWrite(name, StringCodec.INSTANCE, RedisCommands.EVAL_VOID,
script,
Arrays.<Object>asList(tasksCounterName, statusName, terminationTopicName, tasksName, schedulerQueueName, tasksRetryIntervalName),
RedissonExecutorService.SHUTDOWN_STATE, RedissonExecutorService.TERMINATED_STATE, requestId);
} | [
"private",
"void",
"finish",
"(",
"String",
"requestId",
",",
"boolean",
"removeTask",
")",
"{",
"String",
"script",
"=",
"\"\"",
";",
"if",
"(",
"removeTask",
")",
"{",
"script",
"+=",
"\"local scheduled = redis.call('zscore', KEYS[5], ARGV[3]);\"",
"+",
"\"if sche... | Check shutdown state. If tasksCounter equals <code>0</code>
and executor in <code>shutdown</code> state, then set <code>terminated</code> state
and notify terminationTopicName
<p>
If <code>scheduledRequestId</code> is not null then
delete scheduled task
@param requestId | [
"Check",
"shutdown",
"state",
".",
"If",
"tasksCounter",
"equals",
"<code",
">",
"0<",
"/",
"code",
">",
"and",
"executor",
"in",
"<code",
">",
"shutdown<",
"/",
"code",
">",
"state",
"then",
"set",
"<code",
">",
"terminated<",
"/",
"code",
">",
"state",... | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/executor/TasksRunnerService.java#L329-L351 | train | Finishes the processing of a task. | [
30522,
2797,
11675,
3926,
1006,
5164,
5227,
3593,
1010,
22017,
20898,
6366,
10230,
2243,
1007,
1063,
5164,
5896,
1027,
1000,
1000,
1025,
2065,
1006,
6366,
10230,
2243,
1007,
1063,
5896,
1009,
1027,
1000,
2334,
5115,
1027,
2417,
2483,
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-connectors/flink-orc/src/main/java/org/apache/flink/orc/OrcTableSource.java | OrcTableSource.toOrcPredicate | private Predicate toOrcPredicate(Expression pred) {
if (pred instanceof Or) {
Predicate c1 = toOrcPredicate(((Or) pred).left());
Predicate c2 = toOrcPredicate(((Or) pred).right());
if (c1 == null || c2 == null) {
return null;
} else {
return new OrcRowInputFormat.Or(c1, c2);
}
} else if (pred instanceof Not) {
Predicate c = toOrcPredicate(((Not) pred).child());
if (c == null) {
return null;
} else {
return new OrcRowInputFormat.Not(c);
}
} else if (pred instanceof BinaryComparison) {
BinaryComparison binComp = (BinaryComparison) pred;
if (!isValid(binComp)) {
// not a valid predicate
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
PredicateLeaf.Type litType = getLiteralType(binComp);
if (litType == null) {
// unsupported literal type
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
boolean literalOnRight = literalOnRight(binComp);
String colName = getColumnName(binComp);
// fetch literal and ensure it is serializable
Object literalObj = getLiteral(binComp);
Serializable literal;
// validate that literal is serializable
if (literalObj instanceof Serializable) {
literal = (Serializable) literalObj;
} else {
LOG.warn("Encountered a non-serializable literal of type {}. " +
"Cannot push predicate [{}] into OrcTableSource. " +
"This is a bug and should be reported.",
literalObj.getClass().getCanonicalName(), pred);
return null;
}
if (pred instanceof EqualTo) {
return new OrcRowInputFormat.Equals(colName, litType, literal);
} else if (pred instanceof NotEqualTo) {
return new OrcRowInputFormat.Not(
new OrcRowInputFormat.Equals(colName, litType, literal));
} else if (pred instanceof GreaterThan) {
if (literalOnRight) {
return new OrcRowInputFormat.Not(
new OrcRowInputFormat.LessThanEquals(colName, litType, literal));
} else {
return new OrcRowInputFormat.LessThan(colName, litType, literal);
}
} else if (pred instanceof GreaterThanOrEqual) {
if (literalOnRight) {
return new OrcRowInputFormat.Not(
new OrcRowInputFormat.LessThan(colName, litType, literal));
} else {
return new OrcRowInputFormat.LessThanEquals(colName, litType, literal);
}
} else if (pred instanceof LessThan) {
if (literalOnRight) {
return new OrcRowInputFormat.LessThan(colName, litType, literal);
} else {
return new OrcRowInputFormat.Not(
new OrcRowInputFormat.LessThanEquals(colName, litType, literal));
}
} else if (pred instanceof LessThanOrEqual) {
if (literalOnRight) {
return new OrcRowInputFormat.LessThanEquals(colName, litType, literal);
} else {
return new OrcRowInputFormat.Not(
new OrcRowInputFormat.LessThan(colName, litType, literal));
}
} else {
// unsupported predicate
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
} else if (pred instanceof UnaryExpression) {
UnaryExpression unary = (UnaryExpression) pred;
if (!isValid(unary)) {
// not a valid predicate
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
PredicateLeaf.Type colType = toOrcType(((UnaryExpression) pred).child().resultType());
if (colType == null) {
// unsupported type
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
String colName = getColumnName(unary);
if (pred instanceof IsNull) {
return new OrcRowInputFormat.IsNull(colName, colType);
} else if (pred instanceof IsNotNull) {
return new OrcRowInputFormat.Not(
new OrcRowInputFormat.IsNull(colName, colType));
} else {
// unsupported predicate
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
} else {
// unsupported predicate
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
} | java | private Predicate toOrcPredicate(Expression pred) {
if (pred instanceof Or) {
Predicate c1 = toOrcPredicate(((Or) pred).left());
Predicate c2 = toOrcPredicate(((Or) pred).right());
if (c1 == null || c2 == null) {
return null;
} else {
return new OrcRowInputFormat.Or(c1, c2);
}
} else if (pred instanceof Not) {
Predicate c = toOrcPredicate(((Not) pred).child());
if (c == null) {
return null;
} else {
return new OrcRowInputFormat.Not(c);
}
} else if (pred instanceof BinaryComparison) {
BinaryComparison binComp = (BinaryComparison) pred;
if (!isValid(binComp)) {
// not a valid predicate
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
PredicateLeaf.Type litType = getLiteralType(binComp);
if (litType == null) {
// unsupported literal type
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
boolean literalOnRight = literalOnRight(binComp);
String colName = getColumnName(binComp);
// fetch literal and ensure it is serializable
Object literalObj = getLiteral(binComp);
Serializable literal;
// validate that literal is serializable
if (literalObj instanceof Serializable) {
literal = (Serializable) literalObj;
} else {
LOG.warn("Encountered a non-serializable literal of type {}. " +
"Cannot push predicate [{}] into OrcTableSource. " +
"This is a bug and should be reported.",
literalObj.getClass().getCanonicalName(), pred);
return null;
}
if (pred instanceof EqualTo) {
return new OrcRowInputFormat.Equals(colName, litType, literal);
} else if (pred instanceof NotEqualTo) {
return new OrcRowInputFormat.Not(
new OrcRowInputFormat.Equals(colName, litType, literal));
} else if (pred instanceof GreaterThan) {
if (literalOnRight) {
return new OrcRowInputFormat.Not(
new OrcRowInputFormat.LessThanEquals(colName, litType, literal));
} else {
return new OrcRowInputFormat.LessThan(colName, litType, literal);
}
} else if (pred instanceof GreaterThanOrEqual) {
if (literalOnRight) {
return new OrcRowInputFormat.Not(
new OrcRowInputFormat.LessThan(colName, litType, literal));
} else {
return new OrcRowInputFormat.LessThanEquals(colName, litType, literal);
}
} else if (pred instanceof LessThan) {
if (literalOnRight) {
return new OrcRowInputFormat.LessThan(colName, litType, literal);
} else {
return new OrcRowInputFormat.Not(
new OrcRowInputFormat.LessThanEquals(colName, litType, literal));
}
} else if (pred instanceof LessThanOrEqual) {
if (literalOnRight) {
return new OrcRowInputFormat.LessThanEquals(colName, litType, literal);
} else {
return new OrcRowInputFormat.Not(
new OrcRowInputFormat.LessThan(colName, litType, literal));
}
} else {
// unsupported predicate
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
} else if (pred instanceof UnaryExpression) {
UnaryExpression unary = (UnaryExpression) pred;
if (!isValid(unary)) {
// not a valid predicate
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
PredicateLeaf.Type colType = toOrcType(((UnaryExpression) pred).child().resultType());
if (colType == null) {
// unsupported type
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
String colName = getColumnName(unary);
if (pred instanceof IsNull) {
return new OrcRowInputFormat.IsNull(colName, colType);
} else if (pred instanceof IsNotNull) {
return new OrcRowInputFormat.Not(
new OrcRowInputFormat.IsNull(colName, colType));
} else {
// unsupported predicate
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
} else {
// unsupported predicate
LOG.debug("Unsupported predicate [{}] cannot be pushed into OrcTableSource.", pred);
return null;
}
} | [
"private",
"Predicate",
"toOrcPredicate",
"(",
"Expression",
"pred",
")",
"{",
"if",
"(",
"pred",
"instanceof",
"Or",
")",
"{",
"Predicate",
"c1",
"=",
"toOrcPredicate",
"(",
"(",
"(",
"Or",
")",
"pred",
")",
".",
"left",
"(",
")",
")",
";",
"Predicate... | Predicate conversion for filter push-down. | [
"Predicate",
"conversion",
"for",
"filter",
"push",
"-",
"down",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-orc/src/main/java/org/apache/flink/orc/OrcTableSource.java#L229-L348 | train | Converts an OR predicate into an OR predicate. | [
30522,
30524,
1007,
1007,
1025,
3653,
16467,
29248,
1027,
2205,
11890,
28139,
16467,
1006,
1006,
1006,
2030,
1007,
3653,
2094,
1007,
1012,
2157,
1006,
1007,
1007,
1025,
2065,
1006,
27723,
1027,
1027,
19701,
1064,
1064,
29248,
1027,
1027,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.closeAllOperators | private void closeAllOperators() throws Exception {
// We need to close them first to last, since upstream operators in the chain might emit
// elements in their close methods.
StreamOperator<?>[] allOperators = operatorChain.getAllOperators();
for (int i = allOperators.length - 1; i >= 0; i--) {
StreamOperator<?> operator = allOperators[i];
if (operator != null) {
operator.close();
}
}
} | java | private void closeAllOperators() throws Exception {
// We need to close them first to last, since upstream operators in the chain might emit
// elements in their close methods.
StreamOperator<?>[] allOperators = operatorChain.getAllOperators();
for (int i = allOperators.length - 1; i >= 0; i--) {
StreamOperator<?> operator = allOperators[i];
if (operator != null) {
operator.close();
}
}
} | [
"private",
"void",
"closeAllOperators",
"(",
")",
"throws",
"Exception",
"{",
"// We need to close them first to last, since upstream operators in the chain might emit",
"// elements in their close methods.",
"StreamOperator",
"<",
"?",
">",
"[",
"]",
"allOperators",
"=",
"operat... | Execute {@link StreamOperator#close()} of each operator in the chain of this
{@link StreamTask}. Closing happens from <b>head to tail</b> operator in the chain,
contrary to {@link StreamOperator#open()} which happens <b>tail to head</b>
(see {@link #openAllOperators()}. | [
"Execute",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java#L471-L481 | train | Close all operators in the operator chain. | [
30522,
2797,
11675,
2485,
8095,
25918,
18926,
1006,
1007,
11618,
6453,
1063,
1013,
1013,
2057,
2342,
2000,
2485,
2068,
2034,
2000,
2197,
1010,
2144,
13909,
9224,
1999,
1996,
4677,
2453,
12495,
2102,
1013,
1013,
3787,
1999,
2037,
2485,
4725,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/fs/EntropyInjector.java | EntropyInjector.removeEntropyMarkerIfPresent | public static Path removeEntropyMarkerIfPresent(FileSystem fs, Path path) {
final EntropyInjectingFileSystem efs = getEntropyFs(fs);
if (efs == null) {
return path;
}
else {
try {
return resolveEntropy(path, efs, false);
}
catch (IOException e) {
// this should never happen, because the path was valid before and we only remove characters.
// rethrow to silence the compiler
throw new FlinkRuntimeException(e.getMessage(), e);
}
}
} | java | public static Path removeEntropyMarkerIfPresent(FileSystem fs, Path path) {
final EntropyInjectingFileSystem efs = getEntropyFs(fs);
if (efs == null) {
return path;
}
else {
try {
return resolveEntropy(path, efs, false);
}
catch (IOException e) {
// this should never happen, because the path was valid before and we only remove characters.
// rethrow to silence the compiler
throw new FlinkRuntimeException(e.getMessage(), e);
}
}
} | [
"public",
"static",
"Path",
"removeEntropyMarkerIfPresent",
"(",
"FileSystem",
"fs",
",",
"Path",
"path",
")",
"{",
"final",
"EntropyInjectingFileSystem",
"efs",
"=",
"getEntropyFs",
"(",
"fs",
")",
";",
"if",
"(",
"efs",
"==",
"null",
")",
"{",
"return",
"p... | Removes the entropy marker string from the path, if the given file system is an
entropy-injecting file system (implements {@link EntropyInjectingFileSystem}) and
the entropy marker key is present. Otherwise, this returns the path as is.
@param path The path to filter.
@return The path without the marker string. | [
"Removes",
"the",
"entropy",
"marker",
"string",
"from",
"the",
"path",
"if",
"the",
"given",
"file",
"system",
"is",
"an",
"entropy",
"-",
"injecting",
"file",
"system",
"(",
"implements",
"{",
"@link",
"EntropyInjectingFileSystem",
"}",
")",
"and",
"the",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/EntropyInjector.java#L73-L88 | train | Remove the entropy marker if present. | [
30522,
2270,
10763,
4130,
6366,
4765,
18981,
24335,
17007,
11124,
22540,
6072,
4765,
1006,
6764,
27268,
6633,
1042,
2015,
1010,
4130,
4130,
1007,
1063,
2345,
23077,
2378,
20614,
2075,
8873,
4244,
27268,
6633,
1041,
10343,
1027,
2131,
4765,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/dartsclone/details/AutoBytePool.java | AutoBytePool.resizeBuf | private void resizeBuf(int size)
{
int capacity;
if (size >= _capacity * 2)
{
capacity = size;
}
else
{
capacity = 1;
while (capacity < size)
{
capacity <<= 1;
}
}
byte[] buf = new byte[capacity];
if (_size > 0)
{
System.arraycopy(_buf, 0, buf, 0, _size);
}
_buf = buf;
_capacity = capacity;
} | java | private void resizeBuf(int size)
{
int capacity;
if (size >= _capacity * 2)
{
capacity = size;
}
else
{
capacity = 1;
while (capacity < size)
{
capacity <<= 1;
}
}
byte[] buf = new byte[capacity];
if (_size > 0)
{
System.arraycopy(_buf, 0, buf, 0, _size);
}
_buf = buf;
_capacity = capacity;
} | [
"private",
"void",
"resizeBuf",
"(",
"int",
"size",
")",
"{",
"int",
"capacity",
";",
"if",
"(",
"size",
">=",
"_capacity",
"*",
"2",
")",
"{",
"capacity",
"=",
"size",
";",
"}",
"else",
"{",
"capacity",
"=",
"1",
";",
"while",
"(",
"capacity",
"<"... | 设置缓冲区大小
@param size 大小 | [
"设置缓冲区大小"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/dartsclone/details/AutoBytePool.java#L140-L162 | train | Resize the buffer to a given size. | [
30522,
2797,
11675,
24501,
4697,
8569,
2546,
1006,
20014,
2946,
1007,
1063,
20014,
3977,
1025,
2065,
1006,
2946,
1028,
1027,
1035,
3977,
1008,
1016,
1007,
1063,
3977,
1027,
2946,
1025,
1065,
2842,
1063,
3977,
1027,
1015,
1025,
2096,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/spring/cache/CacheConfig.java | CacheConfig.fromJSON | public static Map<String, ? extends CacheConfig> fromJSON(InputStream inputStream) throws IOException {
return new CacheConfigSupport().fromJSON(inputStream);
} | java | public static Map<String, ? extends CacheConfig> fromJSON(InputStream inputStream) throws IOException {
return new CacheConfigSupport().fromJSON(inputStream);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"?",
"extends",
"CacheConfig",
">",
"fromJSON",
"(",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"return",
"new",
"CacheConfigSupport",
"(",
")",
".",
"fromJSON",
"(",
"inputStream",
")",
";",... | Read config objects stored in JSON format from <code>InputStream</code>
@param inputStream of config
@return config
@throws IOException error | [
"Read",
"config",
"objects",
"stored",
"in",
"JSON",
"format",
"from",
"<code",
">",
"InputStream<",
"/",
"code",
">"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/spring/cache/CacheConfig.java#L124-L126 | train | Creates a map of cache configs from a JSON input stream. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
1029,
8908,
17053,
8663,
8873,
2290,
1028,
2013,
22578,
2239,
1006,
20407,
25379,
20407,
25379,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
2047,
17053,
8663,
8873,
5620,
6279,
6442,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.fillBeanWithMap | public static <T> T fillBeanWithMap(Map<?, ?> map, T bean, CopyOptions copyOptions) {
return fillBeanWithMap(map, bean, false, copyOptions);
} | java | public static <T> T fillBeanWithMap(Map<?, ?> map, T bean, CopyOptions copyOptions) {
return fillBeanWithMap(map, bean, false, copyOptions);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"fillBeanWithMap",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"T",
"bean",
",",
"CopyOptions",
"copyOptions",
")",
"{",
"return",
"fillBeanWithMap",
"(",
"map",
",",
"bean",
",",
"false",
",",
"copyOptions"... | 使用Map填充Bean对象
@param <T> Bean类型
@param map Map
@param bean Bean
@param copyOptions 属性复制选项 {@link CopyOptions}
@return Bean | [
"使用Map填充Bean对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L408-L410 | train | Fill bean with map. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
6039,
4783,
2319,
24415,
2863,
2361,
1006,
4949,
1026,
1029,
1010,
1029,
1028,
4949,
1010,
1056,
14068,
1010,
6100,
7361,
9285,
6100,
7361,
9285,
1007,
1063,
2709,
6039,
4783,
2319,
24415,
2863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/iterative/io/HashPartitionIterator.java | HashPartitionIterator.advanceAndRead | private BT advanceAndRead(BT reuse) throws IOException {
if (!partitions.hasNext()) {
return null;
}
currentPartition = partitions.next();
currentPartition.setReadPosition(0);
try {
reuse = serializer.deserialize(reuse, currentPartition);
} catch (EOFException e) {
reuse = advanceAndRead(reuse);
}
return reuse;
} | java | private BT advanceAndRead(BT reuse) throws IOException {
if (!partitions.hasNext()) {
return null;
}
currentPartition = partitions.next();
currentPartition.setReadPosition(0);
try {
reuse = serializer.deserialize(reuse, currentPartition);
} catch (EOFException e) {
reuse = advanceAndRead(reuse);
}
return reuse;
} | [
"private",
"BT",
"advanceAndRead",
"(",
"BT",
"reuse",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"partitions",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"currentPartition",
"=",
"partitions",
".",
"next",
"(",
")",
";",
"... | /* jump to the next partition and continue reading from that | [
"/",
"*",
"jump",
"to",
"the",
"next",
"partition",
"and",
"continue",
"reading",
"from",
"that"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/iterative/io/HashPartitionIterator.java#L86-L99 | train | Reads the next BT from the input stream. | [
30522,
2797,
18411,
5083,
5685,
16416,
2094,
1006,
18411,
2128,
8557,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
999,
13571,
2015,
1012,
8440,
10288,
2102,
1006,
1007,
1007,
1063,
2709,
19701,
1025,
1065,
2783,
19362,
3775,
3508,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java | FastDateFormat.getDateInstance | public static FastDateFormat getDateInstance(final int style, final Locale locale) {
return cache.getDateInstance(style, null, locale);
} | java | public static FastDateFormat getDateInstance(final int style, final Locale locale) {
return cache.getDateInstance(style, null, locale);
} | [
"public",
"static",
"FastDateFormat",
"getDateInstance",
"(",
"final",
"int",
"style",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"cache",
".",
"getDateInstance",
"(",
"style",
",",
"null",
",",
"locale",
")",
";",
"}"
] | 获得 {@link FastDateFormat} 实例<br>
支持缓存
@param style date style: FULL, LONG, MEDIUM, or SHORT
@param locale {@link Locale} 日期地理位置
@return 本地化 {@link FastDateFormat} | [
"获得",
"{",
"@link",
"FastDateFormat",
"}",
"实例<br",
">",
"支持缓存"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L133-L135 | train | Gets the date instance. | [
30522,
2270,
10763,
3435,
13701,
14192,
4017,
2131,
13701,
7076,
26897,
1006,
2345,
20014,
2806,
1010,
2345,
2334,
2063,
2334,
2063,
1007,
1063,
2709,
17053,
1012,
2131,
13701,
7076,
26897,
1006,
2806,
1010,
19701,
1010,
2334,
2063,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.toObjectArray | public static Object[][] toObjectArray(Map<?, ?> map) {
if(map == null) {
return null;
}
final Object[][] result = new Object[map.size()][2];
if(map.isEmpty()) {
return result;
}
int index = 0;
for(Entry<?, ?> entry : map.entrySet()) {
result[index][0] = entry.getKey();
result[index][1] = entry.getValue();
index++;
}
return result;
} | java | public static Object[][] toObjectArray(Map<?, ?> map) {
if(map == null) {
return null;
}
final Object[][] result = new Object[map.size()][2];
if(map.isEmpty()) {
return result;
}
int index = 0;
for(Entry<?, ?> entry : map.entrySet()) {
result[index][0] = entry.getKey();
result[index][1] = entry.getValue();
index++;
}
return result;
} | [
"public",
"static",
"Object",
"[",
"]",
"[",
"]",
"toObjectArray",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Object",
"[",
"]",
"[",
"]",
"result",
"=",... | 将键值对转换为二维数组,第一维是key,第二纬是value
@param map Map<?, ?> map
@return 数组
@since 4.1.9 | [
"将键值对转换为二维数组,第一维是key,第二纬是value"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L398-L413 | train | Converts a map of objects to an array of objects. | [
30522,
2270,
10763,
4874,
1031,
1033,
1031,
1033,
2205,
2497,
20614,
2906,
9447,
1006,
4949,
1026,
1029,
1010,
1029,
1028,
4949,
1007,
1063,
2065,
1006,
4949,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2345,
4874,
1031,
1033,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/PemX509Certificate.java | PemX509Certificate.toPEM | static PemEncoded toPEM(ByteBufAllocator allocator, boolean useDirect,
X509Certificate... chain) throws CertificateEncodingException {
if (chain == null || chain.length == 0) {
throw new IllegalArgumentException("X.509 certificate chain can't be null or empty");
}
// We can take a shortcut if there is only one certificate and
// it already happens to be a PemEncoded instance. This is the
// ideal case and reason why all this exists. It allows the user
// to pass pre-encoded bytes straight into OpenSSL without having
// to do any of the extra work.
if (chain.length == 1) {
X509Certificate first = chain[0];
if (first instanceof PemEncoded) {
return ((PemEncoded) first).retain();
}
}
boolean success = false;
ByteBuf pem = null;
try {
for (X509Certificate cert : chain) {
if (cert == null) {
throw new IllegalArgumentException("Null element in chain: " + Arrays.toString(chain));
}
if (cert instanceof PemEncoded) {
pem = append(allocator, useDirect, (PemEncoded) cert, chain.length, pem);
} else {
pem = append(allocator, useDirect, cert, chain.length, pem);
}
}
PemValue value = new PemValue(pem, false);
success = true;
return value;
} finally {
// Make sure we never leak the PEM's ByteBuf in the event of an Exception
if (!success && pem != null) {
pem.release();
}
}
} | java | static PemEncoded toPEM(ByteBufAllocator allocator, boolean useDirect,
X509Certificate... chain) throws CertificateEncodingException {
if (chain == null || chain.length == 0) {
throw new IllegalArgumentException("X.509 certificate chain can't be null or empty");
}
// We can take a shortcut if there is only one certificate and
// it already happens to be a PemEncoded instance. This is the
// ideal case and reason why all this exists. It allows the user
// to pass pre-encoded bytes straight into OpenSSL without having
// to do any of the extra work.
if (chain.length == 1) {
X509Certificate first = chain[0];
if (first instanceof PemEncoded) {
return ((PemEncoded) first).retain();
}
}
boolean success = false;
ByteBuf pem = null;
try {
for (X509Certificate cert : chain) {
if (cert == null) {
throw new IllegalArgumentException("Null element in chain: " + Arrays.toString(chain));
}
if (cert instanceof PemEncoded) {
pem = append(allocator, useDirect, (PemEncoded) cert, chain.length, pem);
} else {
pem = append(allocator, useDirect, cert, chain.length, pem);
}
}
PemValue value = new PemValue(pem, false);
success = true;
return value;
} finally {
// Make sure we never leak the PEM's ByteBuf in the event of an Exception
if (!success && pem != null) {
pem.release();
}
}
} | [
"static",
"PemEncoded",
"toPEM",
"(",
"ByteBufAllocator",
"allocator",
",",
"boolean",
"useDirect",
",",
"X509Certificate",
"...",
"chain",
")",
"throws",
"CertificateEncodingException",
"{",
"if",
"(",
"chain",
"==",
"null",
"||",
"chain",
".",
"length",
"==",
... | Creates a {@link PemEncoded} value from the {@link X509Certificate}s. | [
"Creates",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/PemX509Certificate.java#L55-L99 | train | This method is used to convert a chain of X. 509 certificate to PEM. | [
30522,
10763,
21877,
3549,
16044,
2094,
2327,
6633,
1006,
24880,
8569,
13976,
24755,
4263,
2035,
24755,
4263,
1010,
22017,
20898,
2109,
7442,
6593,
1010,
1060,
12376,
2683,
17119,
3775,
8873,
16280,
1012,
1012,
1012,
4677,
1007,
11618,
8196,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.setString | @PublicEvolving
public void setString(ConfigOption<String> key, String value) {
setValueInternal(key.key(), value);
} | java | @PublicEvolving
public void setString(ConfigOption<String> key, String value) {
setValueInternal(key.key(), value);
} | [
"@",
"PublicEvolving",
"public",
"void",
"setString",
"(",
"ConfigOption",
"<",
"String",
">",
"key",
",",
"String",
"value",
")",
"{",
"setValueInternal",
"(",
"key",
".",
"key",
"(",
")",
",",
"value",
")",
";",
"}"
] | Adds the given value to the configuration object.
The main key of the config option will be used to map the value.
@param key
the option specifying the key to be added
@param value
the value of the key/value pair to be added | [
"Adds",
"the",
"given",
"value",
"to",
"the",
"configuration",
"object",
".",
"The",
"main",
"key",
"of",
"the",
"config",
"option",
"will",
"be",
"used",
"to",
"map",
"the",
"value",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L190-L193 | train | Sets the value of the specified configuration option to the specified string value. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
11675,
4520,
18886,
3070,
1006,
9530,
8873,
3995,
16790,
1026,
5164,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/gen/java/org/apache/hive/service/cli/thrift/TUnionTypeEntry.java | TUnionTypeEntry.isSet | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case NAME_TO_TYPE_PTR:
return isSetNameToTypePtr();
}
throw new IllegalStateException();
} | java | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case NAME_TO_TYPE_PTR:
return isSetNameToTypePtr();
}
throw new IllegalStateException();
} | [
"public",
"boolean",
"isSet",
"(",
"_Fields",
"field",
")",
"{",
"if",
"(",
"field",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"switch",
"(",
"field",
")",
"{",
"case",
"NAME_TO_TYPE_PTR",
":",
"return",
"isS... | Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise | [
"Returns",
"true",
"if",
"field",
"corresponding",
"to",
"fieldID",
"is",
"set",
"(",
"has",
"been",
"assigned",
"a",
"value",
")",
"and",
"false",
"otherwise"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TUnionTypeEntry.java#L214-L224 | train | Checks if the specified field is set to a value of a CRAsCTYPE object. | [
30522,
2270,
22017,
20898,
26354,
3388,
1006,
1035,
4249,
2492,
1007,
1063,
2065,
1006,
2492,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1007,
1025,
1065,
6942,
1006,
2492,
1007,
1063,
2553,
2171... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java | CanalServerWithEmbedded.rollback | @Override
public void rollback(ClientIdentity clientIdentity, Long batchId) throws CanalServerException {
checkStart(clientIdentity.getDestination());
CanalInstance canalInstance = canalInstances.get(clientIdentity.getDestination());
// 因为存在第一次链接时自动rollback的情况,所以需要忽略未订阅
boolean hasSubscribe = canalInstance.getMetaManager().hasSubscribe(clientIdentity);
if (!hasSubscribe) {
return;
}
synchronized (canalInstance) {
// 清除batch信息
PositionRange<LogPosition> positionRanges = canalInstance.getMetaManager().removeBatch(clientIdentity,
batchId);
if (positionRanges == null) { // 说明是重复的ack/rollback
throw new CanalServerException(String.format("rollback error, clientId:%s batchId:%d is not exist , please check",
clientIdentity.getClientId(),
batchId));
}
// lastRollbackPostions.put(clientIdentity,
// positionRanges.getEnd());// 记录一下最后rollback的位置
// TODO 后续rollback到指定的batchId位置
canalInstance.getEventStore().rollback();// rollback
// eventStore中的状态信息
logger.info("rollback successfully, clientId:{} batchId:{} position:{}",
clientIdentity.getClientId(),
batchId,
positionRanges);
}
} | java | @Override
public void rollback(ClientIdentity clientIdentity, Long batchId) throws CanalServerException {
checkStart(clientIdentity.getDestination());
CanalInstance canalInstance = canalInstances.get(clientIdentity.getDestination());
// 因为存在第一次链接时自动rollback的情况,所以需要忽略未订阅
boolean hasSubscribe = canalInstance.getMetaManager().hasSubscribe(clientIdentity);
if (!hasSubscribe) {
return;
}
synchronized (canalInstance) {
// 清除batch信息
PositionRange<LogPosition> positionRanges = canalInstance.getMetaManager().removeBatch(clientIdentity,
batchId);
if (positionRanges == null) { // 说明是重复的ack/rollback
throw new CanalServerException(String.format("rollback error, clientId:%s batchId:%d is not exist , please check",
clientIdentity.getClientId(),
batchId));
}
// lastRollbackPostions.put(clientIdentity,
// positionRanges.getEnd());// 记录一下最后rollback的位置
// TODO 后续rollback到指定的batchId位置
canalInstance.getEventStore().rollback();// rollback
// eventStore中的状态信息
logger.info("rollback successfully, clientId:{} batchId:{} position:{}",
clientIdentity.getClientId(),
batchId,
positionRanges);
}
} | [
"@",
"Override",
"public",
"void",
"rollback",
"(",
"ClientIdentity",
"clientIdentity",
",",
"Long",
"batchId",
")",
"throws",
"CanalServerException",
"{",
"checkStart",
"(",
"clientIdentity",
".",
"getDestination",
"(",
")",
")",
";",
"CanalInstance",
"canalInstanc... | 回滚到未进行 {@link #ack} 的地方,下次fetch的时候,可以从最后一个没有 {@link #ack} 的地方开始拿 | [
"回滚到未进行",
"{"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java#L464-L494 | train | rollback the specified batchId | [
30522,
1030,
2058,
15637,
2270,
11675,
4897,
5963,
1006,
7396,
5178,
16778,
3723,
7396,
5178,
16778,
3723,
1010,
2146,
14108,
3593,
1007,
11618,
17263,
2121,
28943,
2595,
24422,
1063,
14148,
7559,
2102,
1006,
7396,
5178,
16778,
3723,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java | AbstractAsymmetricCrypto.encrypt | public byte[] encrypt(String data, KeyType keyType) {
return encrypt(StrUtil.bytes(data, CharsetUtil.CHARSET_UTF_8), keyType);
} | java | public byte[] encrypt(String data, KeyType keyType) {
return encrypt(StrUtil.bytes(data, CharsetUtil.CHARSET_UTF_8), keyType);
} | [
"public",
"byte",
"[",
"]",
"encrypt",
"(",
"String",
"data",
",",
"KeyType",
"keyType",
")",
"{",
"return",
"encrypt",
"(",
"StrUtil",
".",
"bytes",
"(",
"data",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
")",
",",
"keyType",
")",
";",
"}"
] | 加密,使用UTF-8编码
@param data 被加密的字符串
@param keyType 私钥或公钥 {@link KeyType}
@return 加密后的bytes | [
"加密,使用UTF",
"-",
"8编码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L100-L102 | train | Encrypts the given string using the specified key type. | [
30522,
2270,
24880,
1031,
1033,
4372,
26775,
22571,
2102,
1006,
5164,
2951,
1010,
3145,
13874,
3145,
13874,
1007,
1063,
2709,
4372,
26775,
22571,
2102,
1006,
2358,
22134,
4014,
1012,
27507,
1006,
2951,
1010,
25869,
13462,
21823,
2140,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/types/Either.java | Either.Right | public static <L, R> Either<L, R> Right(R value) {
return new Right<L, R>(value);
} | java | public static <L, R> Either<L, R> Right(R value) {
return new Right<L, R>(value);
} | [
"public",
"static",
"<",
"L",
",",
"R",
">",
"Either",
"<",
"L",
",",
"R",
">",
"Right",
"(",
"R",
"value",
")",
"{",
"return",
"new",
"Right",
"<",
"L",
",",
"R",
">",
"(",
"value",
")",
";",
"}"
] | Create a Right value of Either | [
"Create",
"a",
"Right",
"value",
"of",
"Either"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/Either.java#L51-L53 | train | Create a Right value. | [
30522,
2270,
10763,
1026,
1048,
1010,
1054,
1028,
2593,
1026,
1048,
1010,
1054,
1028,
2157,
1006,
1054,
3643,
1007,
1063,
2709,
2047,
2157,
1026,
1048,
1010,
1054,
1028,
1006,
3643,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tokenizer/NotionalTokenizer.java | NotionalTokenizer.seg2sentence | public static List<List<Term>> seg2sentence(String text)
{
List<List<Term>> sentenceList = SEGMENT.seg2sentence(text);
for (List<Term> sentence : sentenceList)
{
ListIterator<Term> listIterator = sentence.listIterator();
while (listIterator.hasNext())
{
if (!CoreStopWordDictionary.shouldInclude(listIterator.next()))
{
listIterator.remove();
}
}
}
return sentenceList;
} | java | public static List<List<Term>> seg2sentence(String text)
{
List<List<Term>> sentenceList = SEGMENT.seg2sentence(text);
for (List<Term> sentence : sentenceList)
{
ListIterator<Term> listIterator = sentence.listIterator();
while (listIterator.hasNext())
{
if (!CoreStopWordDictionary.shouldInclude(listIterator.next()))
{
listIterator.remove();
}
}
}
return sentenceList;
} | [
"public",
"static",
"List",
"<",
"List",
"<",
"Term",
">",
">",
"seg2sentence",
"(",
"String",
"text",
")",
"{",
"List",
"<",
"List",
"<",
"Term",
">>",
"sentenceList",
"=",
"SEGMENT",
".",
"seg2sentence",
"(",
"text",
")",
";",
"for",
"(",
"List",
"... | 切分为句子形式
@param text
@return | [
"切分为句子形式"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/tokenizer/NotionalTokenizer.java#L67-L83 | train | seg2sentence This method is used to convert a text to a list of lists of lists of lists of lists of terms. | [
30522,
2270,
10763,
2862,
1026,
2862,
1026,
2744,
1028,
1028,
7367,
2290,
2475,
5054,
6528,
3401,
1006,
5164,
3793,
1007,
1063,
2862,
1026,
2862,
1026,
2744,
1028,
1028,
6251,
9863,
1027,
6903,
1012,
7367,
2290,
2475,
5054,
6528,
3401,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.sortPageAll | @SafeVarargs
public static <T> List<T> sortPageAll(int pageNo, int pageSize, Comparator<T> comparator, Collection<T>... colls) {
final List<T> list = new ArrayList<>(pageNo * pageSize);
for (Collection<T> coll : colls) {
list.addAll(coll);
}
if (null != comparator) {
Collections.sort(list, comparator);
}
return page(pageNo, pageSize, list);
} | java | @SafeVarargs
public static <T> List<T> sortPageAll(int pageNo, int pageSize, Comparator<T> comparator, Collection<T>... colls) {
final List<T> list = new ArrayList<>(pageNo * pageSize);
for (Collection<T> coll : colls) {
list.addAll(coll);
}
if (null != comparator) {
Collections.sort(list, comparator);
}
return page(pageNo, pageSize, list);
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"sortPageAll",
"(",
"int",
"pageNo",
",",
"int",
"pageSize",
",",
"Comparator",
"<",
"T",
">",
"comparator",
",",
"Collection",
"<",
"T",
">",
"...",
"colls",
")",
"{",
"fi... | 将多个集合排序并显示不同的段落(分页)<br>
采用{@link BoundedPriorityQueue}实现分页取局部
@param <T> 集合元素类型
@param pageNo 页码,从1开始计数,0和1效果相同
@param pageSize 每页的条目数
@param comparator 比较器
@param colls 集合数组
@return 分页后的段落内容 | [
"将多个集合排序并显示不同的段落(分页)<br",
">",
"采用",
"{",
"@link",
"BoundedPriorityQueue",
"}",
"实现分页取局部"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2030-L2041 | train | Creates a list of objects that are sorted by the specified collection of type T. | [
30522,
1030,
3647,
24516,
10623,
2015,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
4066,
13704,
8095,
1006,
20014,
3931,
3630,
1010,
20014,
5530,
4697,
1010,
4012,
28689,
4263,
1026,
1056,
1028,
4012,
28689,
4263,
1010,
3074,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/ClassScaner.java | ClassScaner.addIfAccept | private void addIfAccept(String className) {
if(StrUtil.isBlank(className)) {
return;
}
int classLen = className.length();
int packageLen = this.packageName.length();
if(classLen == packageLen) {
//类名和包名长度一致,用户可能传入的包名是类名
if(className.equals(this.packageName)) {
addIfAccept(loadClass(className));
}
} else if(classLen > packageLen){
//检查类名是否以指定包名为前缀,包名后加.(避免类似于cn.hutool.A和cn.hutool.ATest这类类名引起的歧义)
if(className.startsWith(this.packageNameWithDot)) {
addIfAccept(loadClass(className));
}
}
} | java | private void addIfAccept(String className) {
if(StrUtil.isBlank(className)) {
return;
}
int classLen = className.length();
int packageLen = this.packageName.length();
if(classLen == packageLen) {
//类名和包名长度一致,用户可能传入的包名是类名
if(className.equals(this.packageName)) {
addIfAccept(loadClass(className));
}
} else if(classLen > packageLen){
//检查类名是否以指定包名为前缀,包名后加.(避免类似于cn.hutool.A和cn.hutool.ATest这类类名引起的歧义)
if(className.startsWith(this.packageNameWithDot)) {
addIfAccept(loadClass(className));
}
}
} | [
"private",
"void",
"addIfAccept",
"(",
"String",
"className",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"className",
")",
")",
"{",
"return",
";",
"}",
"int",
"classLen",
"=",
"className",
".",
"length",
"(",
")",
";",
"int",
"packageLen",
"... | 通过过滤器,是否满足接受此类的条件
@param clazz 类
@return 是否接受 | [
"通过过滤器,是否满足接受此类的条件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/ClassScaner.java#L284-L301 | train | Add a class if it is accepted by this class. | [
30522,
2797,
11675,
5587,
10128,
6305,
3401,
13876,
1006,
5164,
2465,
18442,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
2465,
18442,
1007,
1007,
1063,
2709,
1025,
1065,
20014,
2465,
7770,
1027,
2465,
18442,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationHead.java | StreamIterationHead.run | @Override
protected void run() throws Exception {
final String iterationId = getConfiguration().getIterationId();
if (iterationId == null || iterationId.length() == 0) {
throw new Exception("Missing iteration ID in the task configuration");
}
final String brokerID = createBrokerIdString(getEnvironment().getJobID(), iterationId ,
getEnvironment().getTaskInfo().getIndexOfThisSubtask());
final long iterationWaitTime = getConfiguration().getIterationWaitTime();
final boolean shouldWait = iterationWaitTime > 0;
final BlockingQueue<StreamRecord<OUT>> dataChannel = new ArrayBlockingQueue<StreamRecord<OUT>>(1);
// offer the queue for the tail
BlockingQueueBroker.INSTANCE.handIn(brokerID, dataChannel);
LOG.info("Iteration head {} added feedback queue under {}", getName(), brokerID);
// do the work
try {
@SuppressWarnings("unchecked")
RecordWriterOutput<OUT>[] outputs = (RecordWriterOutput<OUT>[]) getStreamOutputs();
// If timestamps are enabled we make sure to remove cyclic watermark dependencies
if (isSerializingTimestamps()) {
synchronized (getCheckpointLock()) {
for (RecordWriterOutput<OUT> output : outputs) {
output.emitWatermark(new Watermark(Long.MAX_VALUE));
}
}
}
while (running) {
StreamRecord<OUT> nextRecord = shouldWait ?
dataChannel.poll(iterationWaitTime, TimeUnit.MILLISECONDS) :
dataChannel.take();
if (nextRecord != null) {
synchronized (getCheckpointLock()) {
for (RecordWriterOutput<OUT> output : outputs) {
output.collect(nextRecord);
}
}
}
else {
// done
break;
}
}
}
finally {
// make sure that we remove the queue from the broker, to prevent a resource leak
BlockingQueueBroker.INSTANCE.remove(brokerID);
LOG.info("Iteration head {} removed feedback queue under {}", getName(), brokerID);
}
} | java | @Override
protected void run() throws Exception {
final String iterationId = getConfiguration().getIterationId();
if (iterationId == null || iterationId.length() == 0) {
throw new Exception("Missing iteration ID in the task configuration");
}
final String brokerID = createBrokerIdString(getEnvironment().getJobID(), iterationId ,
getEnvironment().getTaskInfo().getIndexOfThisSubtask());
final long iterationWaitTime = getConfiguration().getIterationWaitTime();
final boolean shouldWait = iterationWaitTime > 0;
final BlockingQueue<StreamRecord<OUT>> dataChannel = new ArrayBlockingQueue<StreamRecord<OUT>>(1);
// offer the queue for the tail
BlockingQueueBroker.INSTANCE.handIn(brokerID, dataChannel);
LOG.info("Iteration head {} added feedback queue under {}", getName(), brokerID);
// do the work
try {
@SuppressWarnings("unchecked")
RecordWriterOutput<OUT>[] outputs = (RecordWriterOutput<OUT>[]) getStreamOutputs();
// If timestamps are enabled we make sure to remove cyclic watermark dependencies
if (isSerializingTimestamps()) {
synchronized (getCheckpointLock()) {
for (RecordWriterOutput<OUT> output : outputs) {
output.emitWatermark(new Watermark(Long.MAX_VALUE));
}
}
}
while (running) {
StreamRecord<OUT> nextRecord = shouldWait ?
dataChannel.poll(iterationWaitTime, TimeUnit.MILLISECONDS) :
dataChannel.take();
if (nextRecord != null) {
synchronized (getCheckpointLock()) {
for (RecordWriterOutput<OUT> output : outputs) {
output.collect(nextRecord);
}
}
}
else {
// done
break;
}
}
}
finally {
// make sure that we remove the queue from the broker, to prevent a resource leak
BlockingQueueBroker.INSTANCE.remove(brokerID);
LOG.info("Iteration head {} removed feedback queue under {}", getName(), brokerID);
}
} | [
"@",
"Override",
"protected",
"void",
"run",
"(",
")",
"throws",
"Exception",
"{",
"final",
"String",
"iterationId",
"=",
"getConfiguration",
"(",
")",
".",
"getIterationId",
"(",
")",
";",
"if",
"(",
"iterationId",
"==",
"null",
"||",
"iterationId",
".",
... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamIterationHead.java#L52-L109 | train | This method is called by the TaskRunner to run the task. | [
30522,
1030,
2058,
15637,
5123,
11675,
2448,
1006,
1007,
11618,
6453,
1063,
2345,
5164,
27758,
3593,
1027,
2131,
8663,
8873,
27390,
3370,
1006,
1007,
1012,
2131,
21646,
3370,
3593,
1006,
1007,
1025,
2065,
1006,
27758,
3593,
1027,
1027,
1970... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java | AbstractMetricGroup.getQueryServiceMetricInfo | public QueryScopeInfo getQueryServiceMetricInfo(CharacterFilter filter) {
if (queryServiceScopeInfo == null) {
queryServiceScopeInfo = createQueryServiceMetricInfo(filter);
}
return queryServiceScopeInfo;
} | java | public QueryScopeInfo getQueryServiceMetricInfo(CharacterFilter filter) {
if (queryServiceScopeInfo == null) {
queryServiceScopeInfo = createQueryServiceMetricInfo(filter);
}
return queryServiceScopeInfo;
} | [
"public",
"QueryScopeInfo",
"getQueryServiceMetricInfo",
"(",
"CharacterFilter",
"filter",
")",
"{",
"if",
"(",
"queryServiceScopeInfo",
"==",
"null",
")",
"{",
"queryServiceScopeInfo",
"=",
"createQueryServiceMetricInfo",
"(",
"filter",
")",
";",
"}",
"return",
"quer... | Returns the metric query service scope for this group.
@param filter character filter
@return query service scope | [
"Returns",
"the",
"metric",
"query",
"service",
"scope",
"for",
"this",
"group",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java#L206-L211 | train | Gets the QueryServiceMetricInfo object. | [
30522,
2270,
23032,
26127,
2378,
14876,
2131,
4226,
24769,
2121,
7903,
21382,
12412,
2378,
14876,
1006,
2839,
8873,
21928,
11307,
1007,
1063,
2065,
1006,
23032,
8043,
7903,
2229,
16186,
2378,
14876,
1027,
1027,
19701,
1007,
1063,
23032,
8043,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/PoolChunk.java | PoolChunk.allocateSubpage | private long allocateSubpage(int normCapacity) {
// Obtain the head of the PoolSubPage pool that is owned by the PoolArena and synchronize on it.
// This is need as we may add it back and so alter the linked-list structure.
PoolSubpage<T> head = arena.findSubpagePoolHead(normCapacity);
int d = maxOrder; // subpages are only be allocated from pages i.e., leaves
synchronized (head) {
int id = allocateNode(d);
if (id < 0) {
return id;
}
final PoolSubpage<T>[] subpages = this.subpages;
final int pageSize = this.pageSize;
freeBytes -= pageSize;
int subpageIdx = subpageIdx(id);
PoolSubpage<T> subpage = subpages[subpageIdx];
if (subpage == null) {
subpage = new PoolSubpage<T>(head, this, id, runOffset(id), pageSize, normCapacity);
subpages[subpageIdx] = subpage;
} else {
subpage.init(head, normCapacity);
}
return subpage.allocate();
}
} | java | private long allocateSubpage(int normCapacity) {
// Obtain the head of the PoolSubPage pool that is owned by the PoolArena and synchronize on it.
// This is need as we may add it back and so alter the linked-list structure.
PoolSubpage<T> head = arena.findSubpagePoolHead(normCapacity);
int d = maxOrder; // subpages are only be allocated from pages i.e., leaves
synchronized (head) {
int id = allocateNode(d);
if (id < 0) {
return id;
}
final PoolSubpage<T>[] subpages = this.subpages;
final int pageSize = this.pageSize;
freeBytes -= pageSize;
int subpageIdx = subpageIdx(id);
PoolSubpage<T> subpage = subpages[subpageIdx];
if (subpage == null) {
subpage = new PoolSubpage<T>(head, this, id, runOffset(id), pageSize, normCapacity);
subpages[subpageIdx] = subpage;
} else {
subpage.init(head, normCapacity);
}
return subpage.allocate();
}
} | [
"private",
"long",
"allocateSubpage",
"(",
"int",
"normCapacity",
")",
"{",
"// Obtain the head of the PoolSubPage pool that is owned by the PoolArena and synchronize on it.",
"// This is need as we may add it back and so alter the linked-list structure.",
"PoolSubpage",
"<",
"T",
">",
"... | Create / initialize a new PoolSubpage of normCapacity
Any PoolSubpage created / initialized here is added to subpage pool in the PoolArena that owns this PoolChunk
@param normCapacity normalized capacity
@return index in memoryMap | [
"Create",
"/",
"initialize",
"a",
"new",
"PoolSubpage",
"of",
"normCapacity",
"Any",
"PoolSubpage",
"created",
"/",
"initialized",
"here",
"is",
"added",
"to",
"subpage",
"pool",
"in",
"the",
"PoolArena",
"that",
"owns",
"this",
"PoolChunk"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/PoolChunk.java#L339-L365 | train | Allocate a subpage from the pool. | [
30522,
2797,
2146,
2035,
24755,
4570,
12083,
13704,
1006,
20014,
13373,
17695,
6305,
3012,
1007,
1063,
1013,
1013,
6855,
1996,
2132,
1997,
1996,
12679,
12083,
13704,
4770,
2008,
2003,
3079,
2011,
1996,
4770,
12069,
2532,
1998,
26351,
8093,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.aggregate | @PublicEvolving
public <ACC, R> SingleOutputStreamOperator<R> aggregate(AggregateFunction<T, ACC, R> function) {
checkNotNull(function, "function");
if (function instanceof RichFunction) {
throw new UnsupportedOperationException("This aggregation function cannot be a RichFunction.");
}
TypeInformation<ACC> accumulatorType = TypeExtractor.getAggregateFunctionAccumulatorType(
function, input.getType(), null, false);
TypeInformation<R> resultType = TypeExtractor.getAggregateFunctionReturnType(
function, input.getType(), null, false);
return aggregate(function, accumulatorType, resultType);
} | java | @PublicEvolving
public <ACC, R> SingleOutputStreamOperator<R> aggregate(AggregateFunction<T, ACC, R> function) {
checkNotNull(function, "function");
if (function instanceof RichFunction) {
throw new UnsupportedOperationException("This aggregation function cannot be a RichFunction.");
}
TypeInformation<ACC> accumulatorType = TypeExtractor.getAggregateFunctionAccumulatorType(
function, input.getType(), null, false);
TypeInformation<R> resultType = TypeExtractor.getAggregateFunctionReturnType(
function, input.getType(), null, false);
return aggregate(function, accumulatorType, resultType);
} | [
"@",
"PublicEvolving",
"public",
"<",
"ACC",
",",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"aggregate",
"(",
"AggregateFunction",
"<",
"T",
",",
"ACC",
",",
"R",
">",
"function",
")",
"{",
"checkNotNull",
"(",
"function",
",",
"\"function\"",
... | Applies the given {@code AggregateFunction} to each window. The AggregateFunction
aggregates all elements of a window into a single result element. The stream of these
result elements (one per window) is interpreted as a regular non-windowed stream.
@param function The aggregation function.
@return The data stream that is the result of applying the fold function to the window.
@param <ACC> The type of the AggregateFunction's accumulator
@param <R> The type of the elements in the resulting stream, equal to the
AggregateFunction's result type | [
"Applies",
"the",
"given",
"{",
"@code",
"AggregateFunction",
"}",
"to",
"each",
"window",
".",
"The",
"AggregateFunction",
"aggregates",
"all",
"elements",
"of",
"a",
"window",
"into",
"a",
"single",
"result",
"element",
".",
"The",
"stream",
"of",
"these",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java#L432-L447 | train | Returns a new SingleOutputStreamOperator that performs an aggregate operation on the specified DataSet. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
1026,
16222,
1010,
1054,
1028,
2309,
30524,
1025,
2065,
1006,
3853,
6013,
11253,
4138,
11263,
27989,
1007,
1063,
5466,
2047,
4895,
6342,
9397,
15613,
25918,
3370,
10288,
24422,
1006,
1000,
2023,
28... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Lz4FrameEncoder.java | Lz4FrameEncoder.compressionLevel | private static int compressionLevel(int blockSize) {
if (blockSize < MIN_BLOCK_SIZE || blockSize > MAX_BLOCK_SIZE) {
throw new IllegalArgumentException(String.format(
"blockSize: %d (expected: %d-%d)", blockSize, MIN_BLOCK_SIZE, MAX_BLOCK_SIZE));
}
int compressionLevel = 32 - Integer.numberOfLeadingZeros(blockSize - 1); // ceil of log2
compressionLevel = Math.max(0, compressionLevel - COMPRESSION_LEVEL_BASE);
return compressionLevel;
} | java | private static int compressionLevel(int blockSize) {
if (blockSize < MIN_BLOCK_SIZE || blockSize > MAX_BLOCK_SIZE) {
throw new IllegalArgumentException(String.format(
"blockSize: %d (expected: %d-%d)", blockSize, MIN_BLOCK_SIZE, MAX_BLOCK_SIZE));
}
int compressionLevel = 32 - Integer.numberOfLeadingZeros(blockSize - 1); // ceil of log2
compressionLevel = Math.max(0, compressionLevel - COMPRESSION_LEVEL_BASE);
return compressionLevel;
} | [
"private",
"static",
"int",
"compressionLevel",
"(",
"int",
"blockSize",
")",
"{",
"if",
"(",
"blockSize",
"<",
"MIN_BLOCK_SIZE",
"||",
"blockSize",
">",
"MAX_BLOCK_SIZE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
... | Calculates compression level on the basis of block size. | [
"Calculates",
"compression",
"level",
"on",
"the",
"basis",
"of",
"block",
"size",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Lz4FrameEncoder.java#L186-L194 | train | Get the compression level of a block size. | [
30522,
2797,
10763,
20014,
13379,
20414,
2884,
1006,
20014,
5991,
4697,
1007,
1063,
2065,
1006,
5991,
4697,
1026,
8117,
1035,
3796,
1035,
2946,
1064,
1064,
5991,
4697,
1028,
4098,
1035,
3796,
1035,
2946,
1007,
1063,
5466,
2047,
6206,
2906,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/useragent/UserAgentParser.java | UserAgentParser.parseBrowser | private static Browser parseBrowser(String userAgentString) {
for (Browser brower : Browser.browers) {
if (brower.isMatch(userAgentString)) {
return brower;
}
}
return Browser.Unknown;
} | java | private static Browser parseBrowser(String userAgentString) {
for (Browser brower : Browser.browers) {
if (brower.isMatch(userAgentString)) {
return brower;
}
}
return Browser.Unknown;
} | [
"private",
"static",
"Browser",
"parseBrowser",
"(",
"String",
"userAgentString",
")",
"{",
"for",
"(",
"Browser",
"brower",
":",
"Browser",
".",
"browers",
")",
"{",
"if",
"(",
"brower",
".",
"isMatch",
"(",
"userAgentString",
")",
")",
"{",
"return",
"br... | 解析浏览器类型
@param userAgentString User-Agent字符串
@return 浏览器类型 | [
"解析浏览器类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/useragent/UserAgentParser.java#L48-L55 | train | Parse a browser string. | [
30522,
2797,
10763,
16602,
11968,
3366,
12618,
9333,
2121,
1006,
5164,
5310,
4270,
7666,
18886,
3070,
1007,
1063,
2005,
1006,
16602,
8306,
2121,
1024,
16602,
1012,
8306,
2545,
1007,
1063,
2065,
1006,
8306,
2121,
1012,
2003,
18900,
2818,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.createRemoteEnvironment | public static StreamExecutionEnvironment createRemoteEnvironment(
String host, int port, int parallelism, String... jarFiles) {
RemoteStreamEnvironment env = new RemoteStreamEnvironment(host, port, jarFiles);
env.setParallelism(parallelism);
return env;
} | java | public static StreamExecutionEnvironment createRemoteEnvironment(
String host, int port, int parallelism, String... jarFiles) {
RemoteStreamEnvironment env = new RemoteStreamEnvironment(host, port, jarFiles);
env.setParallelism(parallelism);
return env;
} | [
"public",
"static",
"StreamExecutionEnvironment",
"createRemoteEnvironment",
"(",
"String",
"host",
",",
"int",
"port",
",",
"int",
"parallelism",
",",
"String",
"...",
"jarFiles",
")",
"{",
"RemoteStreamEnvironment",
"env",
"=",
"new",
"RemoteStreamEnvironment",
"(",... | Creates a {@link RemoteStreamEnvironment}. The remote environment sends
(parts of) the program to a cluster for execution. Note that all file
paths used in the program must be accessible from the cluster. The
execution will use the specified parallelism.
@param host
The host name or address of the master (JobManager), where the
program should be executed.
@param port
The port of the master (JobManager), where the program should
be executed.
@param parallelism
The parallelism to use during the execution.
@param jarFiles
The JAR files with code that needs to be shipped to the
cluster. If the program uses user-defined functions,
user-defined input formats, or any libraries, those must be
provided in the JAR files.
@return A remote environment that executes the program on a cluster. | [
"Creates",
"a",
"{",
"@link",
"RemoteStreamEnvironment",
"}",
".",
"The",
"remote",
"environment",
"sends",
"(",
"parts",
"of",
")",
"the",
"program",
"to",
"a",
"cluster",
"for",
"execution",
".",
"Note",
"that",
"all",
"file",
"paths",
"used",
"in",
"the... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1708-L1713 | train | Creates a remote stream environment. | [
30522,
2270,
10763,
5460,
10288,
8586,
13700,
2368,
21663,
2239,
3672,
3443,
28578,
12184,
2368,
21663,
2239,
3672,
1006,
5164,
3677,
1010,
20014,
3417,
1010,
20014,
5903,
2964,
1010,
5164,
1012,
1012,
1012,
15723,
8873,
4244,
1007,
1063,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java | CharArrayBuffer.append | public void append(final char ch) {
final int newlen = this.len + 1;
if (newlen > this.array.length) {
expand(newlen);
}
this.array[this.len] = ch;
this.len = newlen;
} | java | public void append(final char ch) {
final int newlen = this.len + 1;
if (newlen > this.array.length) {
expand(newlen);
}
this.array[this.len] = ch;
this.len = newlen;
} | [
"public",
"void",
"append",
"(",
"final",
"char",
"ch",
")",
"{",
"final",
"int",
"newlen",
"=",
"this",
".",
"len",
"+",
"1",
";",
"if",
"(",
"newlen",
">",
"this",
".",
"array",
".",
"length",
")",
"{",
"expand",
"(",
"newlen",
")",
";",
"}",
... | Appends {@code ch} char to this buffer. The capacity of the buffer
is increased, if necessary, to accommodate the additional char.
@param ch the char to be appended. | [
"Appends",
"{",
"@code",
"ch",
"}",
"char",
"to",
"this",
"buffer",
".",
"The",
"capacity",
"of",
"the",
"buffer",
"is",
"increased",
"if",
"necessary",
"to",
"accommodate",
"the",
"additional",
"char",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java#L153-L160 | train | Append a single character to the end of the array. | [
30522,
2270,
11675,
10439,
10497,
1006,
2345,
25869,
10381,
1007,
1063,
2345,
20014,
2047,
7770,
1027,
2023,
1012,
18798,
1009,
1015,
1025,
2065,
1006,
2047,
7770,
1028,
2023,
1012,
9140,
1012,
3091,
1007,
1063,
7818,
1006,
2047,
7770,
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-runtime/src/main/java/org/apache/flink/runtime/io/network/api/writer/RecordWriter.java | RecordWriter.broadcastEmit | public void broadcastEmit(T record) throws IOException, InterruptedException {
checkErroneous();
serializer.serializeRecord(record);
boolean pruneAfterCopying = false;
for (int channel : broadcastChannels) {
if (copyFromSerializerToTargetChannel(channel)) {
pruneAfterCopying = true;
}
}
// Make sure we don't hold onto the large intermediate serialization buffer for too long
if (pruneAfterCopying) {
serializer.prune();
}
} | java | public void broadcastEmit(T record) throws IOException, InterruptedException {
checkErroneous();
serializer.serializeRecord(record);
boolean pruneAfterCopying = false;
for (int channel : broadcastChannels) {
if (copyFromSerializerToTargetChannel(channel)) {
pruneAfterCopying = true;
}
}
// Make sure we don't hold onto the large intermediate serialization buffer for too long
if (pruneAfterCopying) {
serializer.prune();
}
} | [
"public",
"void",
"broadcastEmit",
"(",
"T",
"record",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"checkErroneous",
"(",
")",
";",
"serializer",
".",
"serializeRecord",
"(",
"record",
")",
";",
"boolean",
"pruneAfterCopying",
"=",
"false",
"... | This is used to broadcast Streaming Watermarks in-band with records. This ignores
the {@link ChannelSelector}. | [
"This",
"is",
"used",
"to",
"broadcast",
"Streaming",
"Watermarks",
"in",
"-",
"band",
"with",
"records",
".",
"This",
"ignores",
"the",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/writer/RecordWriter.java#L127-L142 | train | Broadcast a record to all channels. | [
30522,
2270,
11675,
3743,
23238,
2102,
1006,
1056,
2501,
1007,
11618,
22834,
10288,
24422,
1010,
7153,
10288,
24422,
1063,
4638,
2121,
20793,
3560,
1006,
1007,
1025,
7642,
17629,
1012,
7642,
17629,
8586,
8551,
1006,
2501,
1007,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.sub | public static <T> List<T> sub(List<T> list, int start, int end, int step) {
if (list == null || list.isEmpty()) {
return null;
}
final int size = list.size();
if (start < 0) {
start += size;
}
if (end < 0) {
end += size;
}
if (start == size) {
return new ArrayList<>(0);
}
if (start > end) {
int tmp = start;
start = end;
end = tmp;
}
if (end > size) {
if (start >= size) {
return new ArrayList<>(0);
}
end = size;
}
if (step <= 1) {
return list.subList(start, end);
}
final List<T> result = new ArrayList<>();
for (int i = start; i < end; i += step) {
result.add(list.get(i));
}
return result;
} | java | public static <T> List<T> sub(List<T> list, int start, int end, int step) {
if (list == null || list.isEmpty()) {
return null;
}
final int size = list.size();
if (start < 0) {
start += size;
}
if (end < 0) {
end += size;
}
if (start == size) {
return new ArrayList<>(0);
}
if (start > end) {
int tmp = start;
start = end;
end = tmp;
}
if (end > size) {
if (start >= size) {
return new ArrayList<>(0);
}
end = size;
}
if (step <= 1) {
return list.subList(start, end);
}
final List<T> result = new ArrayList<>();
for (int i = start; i < end; i += step) {
result.add(list.get(i));
}
return result;
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"sub",
"(",
"List",
"<",
"T",
">",
"list",
",",
"int",
"start",
",",
"int",
"end",
",",
"int",
"step",
")",
"{",
"if",
"(",
"list",
"==",
"null",
"||",
"list",
".",
"isEmpty",
"(",
")"... | 截取集合的部分
@param <T> 集合元素类型
@param list 被截取的数组
@param start 开始位置(包含)
@param end 结束位置(不包含)
@param step 步进
@return 截取后的数组,当开始位置超过最大时,返回空的List
@since 4.0.6 | [
"截取集合的部分"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L829-L865 | train | Returns a sub - list of the specified list. | [
30522,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
4942,
1006,
2862,
1026,
1056,
1028,
2862,
1010,
20014,
2707,
1010,
20014,
2203,
1010,
20014,
3357,
1007,
1063,
2065,
1006,
2862,
1027,
1027,
19701,
1064,
1064,
2862,
1012,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.setDateHeader | @Deprecated
public static void setDateHeader(HttpMessage message, CharSequence name, Date value) {
if (value != null) {
message.headers().set(name, DateFormatter.format(value));
} else {
message.headers().set(name, null);
}
} | java | @Deprecated
public static void setDateHeader(HttpMessage message, CharSequence name, Date value) {
if (value != null) {
message.headers().set(name, DateFormatter.format(value));
} else {
message.headers().set(name, null);
}
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"setDateHeader",
"(",
"HttpMessage",
"message",
",",
"CharSequence",
"name",
",",
"Date",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"set",
"(",
... | @deprecated Use {@link #set(CharSequence, Object)} instead.
Sets a new date header with the specified name and value. If there
is an existing header with the same name, the existing header is removed.
The specified value is formatted as defined in
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1">RFC2616</a> | [
"@deprecated",
"Use",
"{",
"@link",
"#set",
"(",
"CharSequence",
"Object",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L900-L907 | train | Sets a date header. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
11675,
2275,
13701,
4974,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
25869,
3366,
4226,
5897,
2171,
1010,
3058,
3643,
1007,
1063,
2065,
1006,
3643,
999,
1027,
19701,
1007,
1063,
4471,
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-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java | Sftp.put | public Sftp put(String srcFilePath, String destPath, Mode mode) {
try {
channel.put(srcFilePath, destPath, mode.ordinal());
} catch (SftpException e) {
throw new JschRuntimeException(e);
}
return this;
} | java | public Sftp put(String srcFilePath, String destPath, Mode mode) {
try {
channel.put(srcFilePath, destPath, mode.ordinal());
} catch (SftpException e) {
throw new JschRuntimeException(e);
}
return this;
} | [
"public",
"Sftp",
"put",
"(",
"String",
"srcFilePath",
",",
"String",
"destPath",
",",
"Mode",
"mode",
")",
"{",
"try",
"{",
"channel",
".",
"put",
"(",
"srcFilePath",
",",
"destPath",
",",
"mode",
".",
"ordinal",
"(",
")",
")",
";",
"}",
"catch",
"(... | 将本地文件上传到目标服务器,目标文件名为destPath,若destPath为目录,则目标文件名将与srcFilePath文件名相同。
@param srcFilePath 本地文件路径
@param destPath 目标路径,
@param mode {@link Mode} 模式
@return this | [
"将本地文件上传到目标服务器,目标文件名为destPath,若destPath为目录,则目标文件名将与srcFilePath文件名相同。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java#L375-L382 | train | Uploads a file to the remote host. | [
30522,
2270,
16420,
25856,
2404,
1006,
5164,
5034,
2278,
8873,
2571,
15069,
1010,
5164,
4078,
25856,
8988,
1010,
5549,
5549,
1007,
1063,
3046,
1063,
3149,
1012,
2404,
1006,
5034,
2278,
8873,
2571,
15069,
1010,
4078,
25856,
8988,
1010,
5549,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/IOUtils.java | IOUtils.copyBytes | public static void copyBytes(final InputStream in, final OutputStream out) throws IOException {
copyBytes(in, out, BLOCKSIZE, true);
} | java | public static void copyBytes(final InputStream in, final OutputStream out) throws IOException {
copyBytes(in, out, BLOCKSIZE, true);
} | [
"public",
"static",
"void",
"copyBytes",
"(",
"final",
"InputStream",
"in",
",",
"final",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"copyBytes",
"(",
"in",
",",
"out",
",",
"BLOCKSIZE",
",",
"true",
")",
";",
"}"
] | Copies from one stream to another. <strong>closes the input and output
streams at the end</strong>.
@param in
InputStream to read from
@param out
OutputStream to write to
@throws IOException
thrown if an I/O error occurs while copying | [
"Copies",
"from",
"one",
"stream",
"to",
"another",
".",
"<strong",
">",
"closes",
"the",
"input",
"and",
"output",
"streams",
"at",
"the",
"end<",
"/",
"strong",
">",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/IOUtils.java#L90-L92 | train | Copy bytes from the input stream to the output stream. | [
30522,
2270,
10763,
11675,
6100,
3762,
4570,
1006,
2345,
20407,
25379,
1999,
1010,
2345,
27852,
25379,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
6100,
3762,
4570,
1006,
1999,
1010,
2041,
1010,
5991,
4697,
1010,
2995,
1007,
1025,
1065,
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... |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/selenium/proxy/DefaultRemoteProxy.java | DefaultRemoteProxy.getNewSession | @Override
public TestSession getNewSession(Map<String, Object> requestedCapability) {
if (down) {
return null;
}
return super.getNewSession(requestedCapability);
} | java | @Override
public TestSession getNewSession(Map<String, Object> requestedCapability) {
if (down) {
return null;
}
return super.getNewSession(requestedCapability);
} | [
"@",
"Override",
"public",
"TestSession",
"getNewSession",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"requestedCapability",
")",
"{",
"if",
"(",
"down",
")",
"{",
"return",
"null",
";",
"}",
"return",
"super",
".",
"getNewSession",
"(",
"requestedCapabi... | overwrites the session allocation to discard the proxy that are down. | [
"overwrites",
"the",
"session",
"allocation",
"to",
"discard",
"the",
"proxy",
"that",
"are",
"down",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/selenium/proxy/DefaultRemoteProxy.java#L211-L217 | train | Override to return a new session. | [
30522,
1030,
2058,
15637,
2270,
5852,
7971,
3258,
2131,
2638,
9333,
7971,
3258,
1006,
4949,
1026,
5164,
1010,
4874,
1028,
7303,
17695,
8010,
1007,
1063,
2065,
1006,
2091,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
3565,
1012,
2131,
2638,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateTime.java | DateTime.of | public static DateTime of(Date date) {
if (date instanceof DateTime) {
return (DateTime) date;
}
return new DateTime(date);
} | java | public static DateTime of(Date date) {
if (date instanceof DateTime) {
return (DateTime) date;
}
return new DateTime(date);
} | [
"public",
"static",
"DateTime",
"of",
"(",
"Date",
"date",
")",
"{",
"if",
"(",
"date",
"instanceof",
"DateTime",
")",
"{",
"return",
"(",
"DateTime",
")",
"date",
";",
"}",
"return",
"new",
"DateTime",
"(",
"date",
")",
";",
"}"
] | 转换JDK date为 DateTime
@param date JDK Date
@return DateTime | [
"转换JDK",
"date为",
"DateTime"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateTime.java#L40-L45 | train | Creates a new instance of the class from the given date. | [
30522,
2270,
10763,
3058,
7292,
1997,
1006,
3058,
3058,
1007,
1063,
2065,
1006,
3058,
6013,
11253,
3058,
7292,
1007,
1063,
2709,
1006,
3058,
7292,
1007,
3058,
1025,
1065,
2709,
2047,
3058,
7292,
1006,
3058,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getDefaultValue | public static Object getDefaultValue(Class<?> clazz) {
if (clazz.isPrimitive()) {
if (long.class == clazz) {
return 0L;
} else if (int.class == clazz) {
return 0;
} else if (short.class == clazz) {
return (short) 0;
} else if (char.class == clazz) {
return (char) 0;
} else if (byte.class == clazz) {
return (byte) 0;
} else if (double.class == clazz) {
return 0D;
} else if (float.class == clazz) {
return 0f;
} else if (boolean.class == clazz) {
return false;
}
}
return null;
} | java | public static Object getDefaultValue(Class<?> clazz) {
if (clazz.isPrimitive()) {
if (long.class == clazz) {
return 0L;
} else if (int.class == clazz) {
return 0;
} else if (short.class == clazz) {
return (short) 0;
} else if (char.class == clazz) {
return (char) 0;
} else if (byte.class == clazz) {
return (byte) 0;
} else if (double.class == clazz) {
return 0D;
} else if (float.class == clazz) {
return 0f;
} else if (boolean.class == clazz) {
return false;
}
}
return null;
} | [
"public",
"static",
"Object",
"getDefaultValue",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"if",
"(",
"clazz",
".",
"isPrimitive",
"(",
")",
")",
"{",
"if",
"(",
"long",
".",
"class",
"==",
"clazz",
")",
"{",
"return",
"0L",
";",
"}",
"else",... | 获取指定类型分的默认值<br>
默认值规则为:
<pre>
1、如果为原始类型,返回0
2、非原始类型返回{@code null}
</pre>
@param clazz 类
@return 默认值
@since 3.0.8 | [
"获取指定类型分的默认值<br",
">",
"默认值规则为:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L983-L1005 | train | Returns the default value for the given class. | [
30522,
2270,
10763,
4874,
2131,
3207,
7011,
11314,
10175,
5657,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1007,
1063,
2065,
1006,
18856,
10936,
2480,
1012,
2003,
18098,
27605,
6024,
1006,
1007,
1007,
1063,
2065,
1006,
2146,
1012,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java | RemoteInputChannel.assignExclusiveSegments | void assignExclusiveSegments(List<MemorySegment> segments) {
checkState(this.initialCredit == 0, "Bug in input channel setup logic: exclusive buffers have " +
"already been set for this input channel.");
checkNotNull(segments);
checkArgument(segments.size() > 0, "The number of exclusive buffers per channel should be larger than 0.");
this.initialCredit = segments.size();
this.numRequiredBuffers = segments.size();
synchronized (bufferQueue) {
for (MemorySegment segment : segments) {
bufferQueue.addExclusiveBuffer(new NetworkBuffer(segment, this), numRequiredBuffers);
}
}
} | java | void assignExclusiveSegments(List<MemorySegment> segments) {
checkState(this.initialCredit == 0, "Bug in input channel setup logic: exclusive buffers have " +
"already been set for this input channel.");
checkNotNull(segments);
checkArgument(segments.size() > 0, "The number of exclusive buffers per channel should be larger than 0.");
this.initialCredit = segments.size();
this.numRequiredBuffers = segments.size();
synchronized (bufferQueue) {
for (MemorySegment segment : segments) {
bufferQueue.addExclusiveBuffer(new NetworkBuffer(segment, this), numRequiredBuffers);
}
}
} | [
"void",
"assignExclusiveSegments",
"(",
"List",
"<",
"MemorySegment",
">",
"segments",
")",
"{",
"checkState",
"(",
"this",
".",
"initialCredit",
"==",
"0",
",",
"\"Bug in input channel setup logic: exclusive buffers have \"",
"+",
"\"already been set for this input channel.\... | Assigns exclusive buffers to this input channel, and this method should be called only once
after this input channel is created. | [
"Assigns",
"exclusive",
"buffers",
"to",
"this",
"input",
"channel",
"and",
"this",
"method",
"should",
"be",
"called",
"only",
"once",
"after",
"this",
"input",
"channel",
"is",
"created",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java#L135-L150 | train | Assigns the given list of memory segments to this input channel. | [
30522,
11675,
23911,
10288,
23633,
3366,
21693,
11187,
1006,
2862,
1026,
3638,
3366,
21693,
4765,
1028,
9214,
1007,
1063,
14148,
12259,
1006,
2023,
1012,
3988,
16748,
23194,
1027,
1027,
1014,
1010,
1000,
11829,
1999,
7953,
3149,
16437,
7961,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HeadersUtils.java | HeadersUtils.getAsString | public static <K, V> String getAsString(Headers<K, V, ?> headers, K name) {
V orig = headers.get(name);
return orig != null ? orig.toString() : null;
} | java | public static <K, V> String getAsString(Headers<K, V, ?> headers, K name) {
V orig = headers.get(name);
return orig != null ? orig.toString() : null;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"String",
"getAsString",
"(",
"Headers",
"<",
"K",
",",
"V",
",",
"?",
">",
"headers",
",",
"K",
"name",
")",
"{",
"V",
"orig",
"=",
"headers",
".",
"get",
"(",
"name",
")",
";",
"return",
"orig",
"!... | {@link Headers#get(Object)} and convert the result to a {@link String}.
@param headers the headers to get the {@code name} from
@param name the name of the header to retrieve
@return the first header value if the header is found. {@code null} if there's no such entry. | [
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/HeadersUtils.java#L63-L66 | train | Get the value of the header as a string. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
5164,
2131,
12054,
18886,
3070,
1006,
20346,
2015,
1026,
1047,
1010,
1058,
1010,
1029,
1028,
20346,
2015,
1010,
1047,
2171,
1007,
1063,
1058,
2030,
8004,
1027,
20346,
2015,
1012,
2131,
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-setting/src/main/java/cn/hutool/setting/SettingLoader.java | SettingLoader.store | public void store(String absolutePath) {
PrintWriter writer = null;
try {
writer = FileUtil.getPrintWriter(absolutePath, charset, false);
store(writer);
} catch (IOException e) {
throw new IORuntimeException(e, "Store Setting to [{}] error!", absolutePath);
} finally {
IoUtil.close(writer);
}
} | java | public void store(String absolutePath) {
PrintWriter writer = null;
try {
writer = FileUtil.getPrintWriter(absolutePath, charset, false);
store(writer);
} catch (IOException e) {
throw new IORuntimeException(e, "Store Setting to [{}] error!", absolutePath);
} finally {
IoUtil.close(writer);
}
} | [
"public",
"void",
"store",
"(",
"String",
"absolutePath",
")",
"{",
"PrintWriter",
"writer",
"=",
"null",
";",
"try",
"{",
"writer",
"=",
"FileUtil",
".",
"getPrintWriter",
"(",
"absolutePath",
",",
"charset",
",",
"false",
")",
";",
"store",
"(",
"writer"... | 持久化当前设置,会覆盖掉之前的设置<br>
持久化会不会保留之前的分组
@param absolutePath 设置文件的绝对路径 | [
"持久化当前设置,会覆盖掉之前的设置<br",
">",
"持久化会不会保留之前的分组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/SettingLoader.java#L162-L172 | train | Stores the contents of the specified absolute path in the file system. | [
30522,
2270,
11675,
3573,
1006,
5164,
7619,
15069,
1007,
1063,
6140,
15994,
3213,
1027,
19701,
1025,
3046,
1063,
3213,
1027,
5371,
21823,
2140,
1012,
2131,
16550,
15994,
1006,
7619,
15069,
1010,
25869,
13462,
1010,
6270,
1007,
1025,
3573,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java | SingleThreadEventExecutor.takeTask | protected Runnable takeTask() {
assert inEventLoop();
if (!(taskQueue instanceof BlockingQueue)) {
throw new UnsupportedOperationException();
}
BlockingQueue<Runnable> taskQueue = (BlockingQueue<Runnable>) this.taskQueue;
for (;;) {
ScheduledFutureTask<?> scheduledTask = peekScheduledTask();
if (scheduledTask == null) {
Runnable task = null;
try {
task = taskQueue.take();
if (task == WAKEUP_TASK) {
task = null;
}
} catch (InterruptedException e) {
// Ignore
}
return task;
} else {
long delayNanos = scheduledTask.delayNanos();
Runnable task = null;
if (delayNanos > 0) {
try {
task = taskQueue.poll(delayNanos, TimeUnit.NANOSECONDS);
} catch (InterruptedException e) {
// Waken up.
return null;
}
}
if (task == null) {
// We need to fetch the scheduled tasks now as otherwise there may be a chance that
// scheduled tasks are never executed if there is always one task in the taskQueue.
// This is for example true for the read task of OIO Transport
// See https://github.com/netty/netty/issues/1614
fetchFromScheduledTaskQueue();
task = taskQueue.poll();
}
if (task != null) {
return task;
}
}
}
} | java | protected Runnable takeTask() {
assert inEventLoop();
if (!(taskQueue instanceof BlockingQueue)) {
throw new UnsupportedOperationException();
}
BlockingQueue<Runnable> taskQueue = (BlockingQueue<Runnable>) this.taskQueue;
for (;;) {
ScheduledFutureTask<?> scheduledTask = peekScheduledTask();
if (scheduledTask == null) {
Runnable task = null;
try {
task = taskQueue.take();
if (task == WAKEUP_TASK) {
task = null;
}
} catch (InterruptedException e) {
// Ignore
}
return task;
} else {
long delayNanos = scheduledTask.delayNanos();
Runnable task = null;
if (delayNanos > 0) {
try {
task = taskQueue.poll(delayNanos, TimeUnit.NANOSECONDS);
} catch (InterruptedException e) {
// Waken up.
return null;
}
}
if (task == null) {
// We need to fetch the scheduled tasks now as otherwise there may be a chance that
// scheduled tasks are never executed if there is always one task in the taskQueue.
// This is for example true for the read task of OIO Transport
// See https://github.com/netty/netty/issues/1614
fetchFromScheduledTaskQueue();
task = taskQueue.poll();
}
if (task != null) {
return task;
}
}
}
} | [
"protected",
"Runnable",
"takeTask",
"(",
")",
"{",
"assert",
"inEventLoop",
"(",
")",
";",
"if",
"(",
"!",
"(",
"taskQueue",
"instanceof",
"BlockingQueue",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
")",
";",
"}",
"BlockingQueue",
... | Take the next {@link Runnable} from the task queue and so will block if no task is currently present.
<p>
Be aware that this method will throw an {@link UnsupportedOperationException} if the task queue, which was
created via {@link #newTaskQueue()}, does not implement {@link BlockingQueue}.
</p>
@return {@code null} if the executor thread has been interrupted or waken up. | [
"Take",
"the",
"next",
"{",
"@link",
"Runnable",
"}",
"from",
"the",
"task",
"queue",
"and",
"so",
"will",
"block",
"if",
"no",
"task",
"is",
"currently",
"present",
".",
"<p",
">",
"Be",
"aware",
"that",
"this",
"method",
"will",
"throw",
"an",
"{",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java#L227-L272 | train | This method is called by the event loop to get a Runnable from the scheduled tasks. | [
30522,
5123,
2448,
22966,
2202,
10230,
2243,
1006,
1007,
1063,
20865,
1999,
18697,
3372,
4135,
7361,
1006,
1007,
1025,
2065,
1006,
999,
1006,
4708,
4226,
5657,
6013,
11253,
10851,
4226,
5657,
1007,
1007,
1063,
5466,
2047,
4895,
6342,
9397,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.escape | private static String escape(char c) {
switch (c) {
case '\b':
return "\\b";
case '\t':
return "\\t";
case '\n':
return "\\n";
case '\f':
return "\\f";
case '\r':
return "\\r";
default:
if (c < StrUtil.C_SPACE || //
(c >= '\u0080' && c <= '\u00a0') || //
(c >= '\u2000' && c <= '\u2010') || //
(c >= '\u2028' && c <= '\u202F') || //
(c >= '\u2066' && c <= '\u206F')//
) {
return HexUtil.toUnicodeHex(c);
} else {
return Character.toString(c);
}
}
} | java | private static String escape(char c) {
switch (c) {
case '\b':
return "\\b";
case '\t':
return "\\t";
case '\n':
return "\\n";
case '\f':
return "\\f";
case '\r':
return "\\r";
default:
if (c < StrUtil.C_SPACE || //
(c >= '\u0080' && c <= '\u00a0') || //
(c >= '\u2000' && c <= '\u2010') || //
(c >= '\u2028' && c <= '\u202F') || //
(c >= '\u2066' && c <= '\u206F')//
) {
return HexUtil.toUnicodeHex(c);
} else {
return Character.toString(c);
}
}
} | [
"private",
"static",
"String",
"escape",
"(",
"char",
"c",
")",
"{",
"switch",
"(",
"c",
")",
"{",
"case",
"'",
"'",
":",
"return",
"\"\\\\b\"",
";",
"case",
"'",
"'",
":",
"return",
"\"\\\\t\"",
";",
"case",
"'",
"'",
":",
"return",
"\"\\\\n\"",
"... | 转义不可见字符<br>
见:https://en.wikibooks.org/wiki/Unicode/Character_reference/0000-0FFF
@param c 字符
@return 转义后的字符串 | [
"转义不可见字符<br",
">",
"见:https",
":",
"//",
"en",
".",
"wikibooks",
".",
"org",
"/",
"wiki",
"/",
"Unicode",
"/",
"Character_reference",
"/",
"0000",
"-",
"0FFF"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L711-L735 | train | Escape a single character. | [
30522,
2797,
10763,
5164,
4019,
1006,
25869,
1039,
1007,
1063,
6942,
1006,
1039,
1007,
1063,
2553,
1005,
1032,
1038,
1005,
1024,
2709,
1000,
1032,
1032,
1038,
1000,
1025,
2553,
1005,
1032,
1056,
1005,
1024,
2709,
1000,
1032,
1032,
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-http/src/main/java/cn/hutool/http/HttpResponse.java | HttpResponse.readBody | private void readBody(InputStream in) throws IORuntimeException {
if (ignoreBody) {
return;
}
int contentLength = Convert.toInt(header(Header.CONTENT_LENGTH), 0);
final FastByteArrayOutputStream out = contentLength > 0 ? new FastByteArrayOutputStream(contentLength) : new FastByteArrayOutputStream();
try {
IoUtil.copy(in, out);
} catch (IORuntimeException e) {
if (e.getCause() instanceof EOFException || StrUtil.containsIgnoreCase(e.getMessage(), "Premature EOF")) {
// 忽略读取HTTP流中的EOF错误
} else {
throw e;
}
}
this.bodyBytes = out.toByteArray();
} | java | private void readBody(InputStream in) throws IORuntimeException {
if (ignoreBody) {
return;
}
int contentLength = Convert.toInt(header(Header.CONTENT_LENGTH), 0);
final FastByteArrayOutputStream out = contentLength > 0 ? new FastByteArrayOutputStream(contentLength) : new FastByteArrayOutputStream();
try {
IoUtil.copy(in, out);
} catch (IORuntimeException e) {
if (e.getCause() instanceof EOFException || StrUtil.containsIgnoreCase(e.getMessage(), "Premature EOF")) {
// 忽略读取HTTP流中的EOF错误
} else {
throw e;
}
}
this.bodyBytes = out.toByteArray();
} | [
"private",
"void",
"readBody",
"(",
"InputStream",
"in",
")",
"throws",
"IORuntimeException",
"{",
"if",
"(",
"ignoreBody",
")",
"{",
"return",
";",
"}",
"int",
"contentLength",
"=",
"Convert",
".",
"toInt",
"(",
"header",
"(",
"Header",
".",
"CONTENT_LENGTH... | 读取主体,忽略EOFException异常
@param in 输入流
@return 自身
@throws IORuntimeException IO异常 | [
"读取主体,忽略EOFException异常"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpResponse.java#L393-L410 | train | Reads the body of the request. | [
30522,
2797,
11675,
3191,
23684,
1006,
20407,
25379,
1999,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2065,
1006,
8568,
23684,
1007,
1063,
2709,
1025,
1065,
20014,
4180,
7770,
13512,
2232,
1027,
10463,
1012,
2000,
18447,
1006,
20346... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSet.java | MergingWindowSet.persist | public void persist() throws Exception {
if (!mapping.equals(initialMapping)) {
state.clear();
for (Map.Entry<W, W> window : mapping.entrySet()) {
state.add(new Tuple2<>(window.getKey(), window.getValue()));
}
}
} | java | public void persist() throws Exception {
if (!mapping.equals(initialMapping)) {
state.clear();
for (Map.Entry<W, W> window : mapping.entrySet()) {
state.add(new Tuple2<>(window.getKey(), window.getValue()));
}
}
} | [
"public",
"void",
"persist",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"mapping",
".",
"equals",
"(",
"initialMapping",
")",
")",
"{",
"state",
".",
"clear",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"W",
",",
"W",
">",
"wi... | Persist the updated mapping to the given state if the mapping changed since
initialization. | [
"Persist",
"the",
"updated",
"mapping",
"to",
"the",
"given",
"state",
"if",
"the",
"mapping",
"changed",
"since",
"initialization",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/MergingWindowSet.java#L102-L109 | train | Persist the mapping to the database. | [
30522,
2270,
11675,
29486,
1006,
1007,
11618,
6453,
1063,
2065,
1006,
999,
12375,
1012,
19635,
1006,
3988,
2863,
14853,
1007,
1007,
1063,
2110,
1012,
3154,
1006,
1007,
1025,
2005,
1006,
4949,
1012,
4443,
1026,
1059,
1010,
1059,
1028,
3332,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/utility/SentencesUtil.java | SentencesUtil.toSentenceList | public static List<String> toSentenceList(String content, boolean shortest)
{
return toSentenceList(content.toCharArray(), shortest);
} | java | public static List<String> toSentenceList(String content, boolean shortest)
{
return toSentenceList(content.toCharArray(), shortest);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"toSentenceList",
"(",
"String",
"content",
",",
"boolean",
"shortest",
")",
"{",
"return",
"toSentenceList",
"(",
"content",
".",
"toCharArray",
"(",
")",
",",
"shortest",
")",
";",
"}"
] | 文本分句
@param content 文本
@param shortest 是否切割为最细的单位(将逗号也视作分隔符)
@return | [
"文本分句"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/SentencesUtil.java#L32-L35 | train | Converts a String to a List of Strings. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
2000,
5054,
6528,
29109,
2923,
1006,
5164,
4180,
1010,
22017,
20898,
20047,
1007,
1063,
2709,
2000,
5054,
6528,
29109,
2923,
1006,
4180,
1012,
2000,
7507,
19848,
9447,
1006,
1007,
1010,
20047,
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/incubator-shardingsphere | sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/sql/prepare/SQLExecutePrepareTemplate.java | SQLExecutePrepareTemplate.getExecuteUnitGroups | public Collection<ShardingExecuteGroup<StatementExecuteUnit>> getExecuteUnitGroups(final Collection<RouteUnit> routeUnits, final SQLExecutePrepareCallback callback) throws SQLException {
return getSynchronizedExecuteUnitGroups(routeUnits, callback);
} | java | public Collection<ShardingExecuteGroup<StatementExecuteUnit>> getExecuteUnitGroups(final Collection<RouteUnit> routeUnits, final SQLExecutePrepareCallback callback) throws SQLException {
return getSynchronizedExecuteUnitGroups(routeUnits, callback);
} | [
"public",
"Collection",
"<",
"ShardingExecuteGroup",
"<",
"StatementExecuteUnit",
">",
">",
"getExecuteUnitGroups",
"(",
"final",
"Collection",
"<",
"RouteUnit",
">",
"routeUnits",
",",
"final",
"SQLExecutePrepareCallback",
"callback",
")",
"throws",
"SQLException",
"{"... | Get execute unit groups.
@param routeUnits route units
@param callback SQL execute prepare callback
@return statement execute unit groups
@throws SQLException SQL exception | [
"Get",
"execute",
"unit",
"groups",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/sql/prepare/SQLExecutePrepareTemplate.java#L58-L60 | train | Get execute unit groups. | [
30522,
2270,
3074,
1026,
21146,
17080,
15465,
2595,
8586,
10421,
17058,
1026,
4861,
10288,
8586,
10421,
19496,
2102,
1028,
1028,
2131,
10288,
8586,
10421,
19496,
2102,
17058,
2015,
1006,
2345,
3074,
1026,
2799,
19496,
2102,
1028,
2799,
19496,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/dialect/sqlserver/clause/SQLServerOffsetClauseParser.java | SQLServerOffsetClauseParser.parse | public void parse(final SelectStatement selectStatement) {
if (!lexerEngine.skipIfEqual(SQLServerKeyword.OFFSET)) {
return;
}
int offsetValue = -1;
int offsetIndex = -1;
if (lexerEngine.equalAny(Literals.INT)) {
offsetValue = Integer.parseInt(lexerEngine.getCurrentToken().getLiterals());
} else if (lexerEngine.equalAny(Symbol.QUESTION)) {
offsetIndex = selectStatement.getParametersIndex();
selectStatement.setParametersIndex(selectStatement.getParametersIndex() + 1);
} else {
throw new SQLParsingException(lexerEngine);
}
lexerEngine.nextToken();
Limit limit = new Limit();
if (lexerEngine.skipIfEqual(DefaultKeyword.FETCH)) {
lexerEngine.nextToken();
int rowCountValue = -1;
int rowCountIndex = -1;
lexerEngine.nextToken();
if (lexerEngine.equalAny(Literals.INT)) {
rowCountValue = Integer.parseInt(lexerEngine.getCurrentToken().getLiterals());
} else if (lexerEngine.equalAny(Symbol.QUESTION)) {
rowCountIndex = selectStatement.getParametersIndex();
selectStatement.setParametersIndex(selectStatement.getParametersIndex() + 1);
} else {
throw new SQLParsingException(lexerEngine);
}
lexerEngine.nextToken();
lexerEngine.nextToken();
limit.setRowCount(new LimitValue(rowCountValue, rowCountIndex, false));
limit.setOffset(new LimitValue(offsetValue, offsetIndex, true));
} else {
limit.setOffset(new LimitValue(offsetValue, offsetIndex, true));
}
selectStatement.setLimit(limit);
} | java | public void parse(final SelectStatement selectStatement) {
if (!lexerEngine.skipIfEqual(SQLServerKeyword.OFFSET)) {
return;
}
int offsetValue = -1;
int offsetIndex = -1;
if (lexerEngine.equalAny(Literals.INT)) {
offsetValue = Integer.parseInt(lexerEngine.getCurrentToken().getLiterals());
} else if (lexerEngine.equalAny(Symbol.QUESTION)) {
offsetIndex = selectStatement.getParametersIndex();
selectStatement.setParametersIndex(selectStatement.getParametersIndex() + 1);
} else {
throw new SQLParsingException(lexerEngine);
}
lexerEngine.nextToken();
Limit limit = new Limit();
if (lexerEngine.skipIfEqual(DefaultKeyword.FETCH)) {
lexerEngine.nextToken();
int rowCountValue = -1;
int rowCountIndex = -1;
lexerEngine.nextToken();
if (lexerEngine.equalAny(Literals.INT)) {
rowCountValue = Integer.parseInt(lexerEngine.getCurrentToken().getLiterals());
} else if (lexerEngine.equalAny(Symbol.QUESTION)) {
rowCountIndex = selectStatement.getParametersIndex();
selectStatement.setParametersIndex(selectStatement.getParametersIndex() + 1);
} else {
throw new SQLParsingException(lexerEngine);
}
lexerEngine.nextToken();
lexerEngine.nextToken();
limit.setRowCount(new LimitValue(rowCountValue, rowCountIndex, false));
limit.setOffset(new LimitValue(offsetValue, offsetIndex, true));
} else {
limit.setOffset(new LimitValue(offsetValue, offsetIndex, true));
}
selectStatement.setLimit(limit);
} | [
"public",
"void",
"parse",
"(",
"final",
"SelectStatement",
"selectStatement",
")",
"{",
"if",
"(",
"!",
"lexerEngine",
".",
"skipIfEqual",
"(",
"SQLServerKeyword",
".",
"OFFSET",
")",
")",
"{",
"return",
";",
"}",
"int",
"offsetValue",
"=",
"-",
"1",
";",... | Parse offset.
@param selectStatement select statement | [
"Parse",
"offset",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/dialect/sqlserver/clause/SQLServerOffsetClauseParser.java#L47-L84 | train | Parse the SELECT statement. | [
30522,
2270,
11675,
11968,
3366,
1006,
2345,
27034,
12259,
3672,
27034,
12259,
3672,
1007,
1063,
2065,
1006,
999,
17244,
7869,
3070,
3170,
1012,
13558,
29323,
26426,
1006,
29296,
8043,
6299,
14839,
18351,
1012,
16396,
1007,
1007,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/registration/RegisteredRpcConnection.java | RegisteredRpcConnection.createNewRegistration | private RetryingRegistration<F, G, S> createNewRegistration() {
RetryingRegistration<F, G, S> newRegistration = checkNotNull(generateRegistration());
CompletableFuture<Tuple2<G, S>> future = newRegistration.getFuture();
future.whenCompleteAsync(
(Tuple2<G, S> result, Throwable failure) -> {
if (failure != null) {
if (failure instanceof CancellationException) {
// we ignore cancellation exceptions because they originate from cancelling
// the RetryingRegistration
log.debug("Retrying registration towards {} was cancelled.", targetAddress);
} else {
// this future should only ever fail if there is a bug, not if the registration is declined
onRegistrationFailure(failure);
}
} else {
targetGateway = result.f0;
onRegistrationSuccess(result.f1);
}
}, executor);
return newRegistration;
} | java | private RetryingRegistration<F, G, S> createNewRegistration() {
RetryingRegistration<F, G, S> newRegistration = checkNotNull(generateRegistration());
CompletableFuture<Tuple2<G, S>> future = newRegistration.getFuture();
future.whenCompleteAsync(
(Tuple2<G, S> result, Throwable failure) -> {
if (failure != null) {
if (failure instanceof CancellationException) {
// we ignore cancellation exceptions because they originate from cancelling
// the RetryingRegistration
log.debug("Retrying registration towards {} was cancelled.", targetAddress);
} else {
// this future should only ever fail if there is a bug, not if the registration is declined
onRegistrationFailure(failure);
}
} else {
targetGateway = result.f0;
onRegistrationSuccess(result.f1);
}
}, executor);
return newRegistration;
} | [
"private",
"RetryingRegistration",
"<",
"F",
",",
"G",
",",
"S",
">",
"createNewRegistration",
"(",
")",
"{",
"RetryingRegistration",
"<",
"F",
",",
"G",
",",
"S",
">",
"newRegistration",
"=",
"checkNotNull",
"(",
"generateRegistration",
"(",
")",
")",
";",
... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/registration/RegisteredRpcConnection.java#L217-L240 | train | Creates a new retrying registration. | [
30522,
2797,
2128,
11129,
2075,
2890,
24063,
8156,
1026,
1042,
1010,
1043,
1010,
1055,
1028,
3443,
2638,
13088,
13910,
2923,
8156,
1006,
1007,
1063,
2128,
11129,
2075,
2890,
24063,
8156,
1026,
1042,
1010,
1043,
1010,
1055,
1028,
2047,
2890,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/nosql/redis/RedisDS.java | RedisDS.del | public Long del(String... keys) {
try (Jedis jedis = getJedis()) {
return jedis.del(keys);
}
} | java | public Long del(String... keys) {
try (Jedis jedis = getJedis()) {
return jedis.del(keys);
}
} | [
"public",
"Long",
"del",
"(",
"String",
"...",
"keys",
")",
"{",
"try",
"(",
"Jedis",
"jedis",
"=",
"getJedis",
"(",
")",
")",
"{",
"return",
"jedis",
".",
"del",
"(",
"keys",
")",
";",
"}",
"}"
] | 从Redis中删除多个值
@param keys 需要删除值对应的键列表
@return 删除个数,0表示无key可删除 | [
"从Redis中删除多个值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/nosql/redis/RedisDS.java#L170-L174 | train | Delete multiple keys from the cache. | [
30522,
2270,
2146,
3972,
1006,
5164,
1012,
1012,
1012,
6309,
1007,
1063,
3046,
1006,
27273,
2015,
27273,
2015,
1027,
2131,
6460,
10521,
1006,
1007,
1007,
1063,
2709,
27273,
2015,
1012,
3972,
1006,
6309,
1007,
1025,
1065,
1065,
102,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapKeyedStateBackend.java | HeapKeyedStateBackend.numKeyValueStateEntries | @VisibleForTesting
public int numKeyValueStateEntries(Object namespace) {
int sum = 0;
for (StateTable<?, ?, ?> state : registeredKVStates.values()) {
sum += state.sizeOfNamespace(namespace);
}
return sum;
} | java | @VisibleForTesting
public int numKeyValueStateEntries(Object namespace) {
int sum = 0;
for (StateTable<?, ?, ?> state : registeredKVStates.values()) {
sum += state.sizeOfNamespace(namespace);
}
return sum;
} | [
"@",
"VisibleForTesting",
"public",
"int",
"numKeyValueStateEntries",
"(",
"Object",
"namespace",
")",
"{",
"int",
"sum",
"=",
"0",
";",
"for",
"(",
"StateTable",
"<",
"?",
",",
"?",
",",
"?",
">",
"state",
":",
"registeredKVStates",
".",
"values",
"(",
... | Returns the total number of state entries across all keys for the given namespace. | [
"Returns",
"the",
"total",
"number",
"of",
"state",
"entries",
"across",
"all",
"keys",
"for",
"the",
"given",
"namespace",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapKeyedStateBackend.java#L361-L368 | train | Returns the number of KeyValueStateEntries for the given namespace. | [
30522,
1030,
5710,
13028,
4355,
2075,
2270,
20014,
16371,
2213,
14839,
10175,
15808,
12259,
4765,
5134,
1006,
4874,
3415,
15327,
1007,
1063,
20014,
7680,
1027,
1014,
1025,
2005,
1006,
2110,
10880,
1026,
1029,
1010,
1029,
1010,
1029,
1028,
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-core/src/main/java/org/apache/flink/api/common/Plan.java | Plan.addDataSink | public void addDataSink(GenericDataSinkBase<?> sink) {
checkNotNull(sink, "The data sink must not be null.");
if (!this.sinks.contains(sink)) {
this.sinks.add(sink);
}
} | java | public void addDataSink(GenericDataSinkBase<?> sink) {
checkNotNull(sink, "The data sink must not be null.");
if (!this.sinks.contains(sink)) {
this.sinks.add(sink);
}
} | [
"public",
"void",
"addDataSink",
"(",
"GenericDataSinkBase",
"<",
"?",
">",
"sink",
")",
"{",
"checkNotNull",
"(",
"sink",
",",
"\"The data sink must not be null.\"",
")",
";",
"if",
"(",
"!",
"this",
".",
"sinks",
".",
"contains",
"(",
"sink",
")",
")",
"... | Adds a data sink to the set of sinks in this program.
@param sink The data sink to add. | [
"Adds",
"a",
"data",
"sink",
"to",
"the",
"set",
"of",
"sinks",
"in",
"this",
"program",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/Plan.java#L199-L205 | train | Add a data sink to the data source. | [
30522,
2270,
11675,
5587,
2850,
10230,
19839,
1006,
12391,
2850,
10230,
19839,
15058,
1026,
1029,
1028,
7752,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
7752,
1010,
1000,
1996,
2951,
7752,
2442,
2025,
2022,
19701,
1012,
1000,
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/util/ReUtil.java | ReUtil.delAll | public static String delAll(Pattern pattern, CharSequence content) {
if (null == pattern || StrUtil.isBlank(content)) {
return StrUtil.str(content);
}
return pattern.matcher(content).replaceAll(StrUtil.EMPTY);
} | java | public static String delAll(Pattern pattern, CharSequence content) {
if (null == pattern || StrUtil.isBlank(content)) {
return StrUtil.str(content);
}
return pattern.matcher(content).replaceAll(StrUtil.EMPTY);
} | [
"public",
"static",
"String",
"delAll",
"(",
"Pattern",
"pattern",
",",
"CharSequence",
"content",
")",
"{",
"if",
"(",
"null",
"==",
"pattern",
"||",
"StrUtil",
".",
"isBlank",
"(",
"content",
")",
")",
"{",
"return",
"StrUtil",
".",
"str",
"(",
"conten... | 删除匹配的全部内容
@param pattern 正则
@param content 被匹配的内容
@return 删除后剩余的内容 | [
"删除匹配的全部内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L326-L332 | train | Removes all occurrences of the specified pattern from the specified content. | [
30522,
2270,
10763,
5164,
3972,
8095,
1006,
5418,
5418,
1010,
25869,
3366,
4226,
5897,
4180,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
5418,
1064,
1064,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
4180,
1007,
1007,
1063,
2709,
2358,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/filesystem/FsStateBackend.java | FsStateBackend.configure | @Override
public FsStateBackend configure(Configuration config, ClassLoader classLoader) {
return new FsStateBackend(this, config, classLoader);
} | java | @Override
public FsStateBackend configure(Configuration config, ClassLoader classLoader) {
return new FsStateBackend(this, config, classLoader);
} | [
"@",
"Override",
"public",
"FsStateBackend",
"configure",
"(",
"Configuration",
"config",
",",
"ClassLoader",
"classLoader",
")",
"{",
"return",
"new",
"FsStateBackend",
"(",
"this",
",",
"config",
",",
"classLoader",
")",
";",
"}"
] | Creates a copy of this state backend that uses the values defined in the configuration
for fields where that were not specified in this state backend.
@param config the configuration
@return The re-configured variant of the state backend | [
"Creates",
"a",
"copy",
"of",
"this",
"state",
"backend",
"that",
"uses",
"the",
"values",
"defined",
"in",
"the",
"configuration",
"for",
"fields",
"where",
"that",
"were",
"not",
"specified",
"in",
"this",
"state",
"backend",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsStateBackend.java#L438-L441 | train | Override this method to configure the state backend. | [
30522,
1030,
2058,
15637,
2270,
1042,
4757,
12259,
5963,
10497,
9530,
8873,
27390,
2063,
1006,
9563,
9530,
8873,
2290,
1010,
2465,
11066,
2121,
2465,
11066,
2121,
1007,
1063,
2709,
2047,
1042,
4757,
12259,
5963,
10497,
1006,
2023,
1010,
953... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java | FutureUtils.thenApplyAsyncIfNotDone | public static <IN, OUT> CompletableFuture<OUT> thenApplyAsyncIfNotDone(
CompletableFuture<IN> completableFuture,
Executor executor,
Function<? super IN, ? extends OUT> applyFun) {
return completableFuture.isDone() ?
completableFuture.thenApply(applyFun) :
completableFuture.thenApplyAsync(applyFun, executor);
} | java | public static <IN, OUT> CompletableFuture<OUT> thenApplyAsyncIfNotDone(
CompletableFuture<IN> completableFuture,
Executor executor,
Function<? super IN, ? extends OUT> applyFun) {
return completableFuture.isDone() ?
completableFuture.thenApply(applyFun) :
completableFuture.thenApplyAsync(applyFun, executor);
} | [
"public",
"static",
"<",
"IN",
",",
"OUT",
">",
"CompletableFuture",
"<",
"OUT",
">",
"thenApplyAsyncIfNotDone",
"(",
"CompletableFuture",
"<",
"IN",
">",
"completableFuture",
",",
"Executor",
"executor",
",",
"Function",
"<",
"?",
"super",
"IN",
",",
"?",
"... | This function takes a {@link CompletableFuture} and a function to apply to this future. If the input future
is already done, this function returns {@link CompletableFuture#thenApply(Function)}. Otherwise, the return
value is {@link CompletableFuture#thenApplyAsync(Function, Executor)} with the given executor.
@param completableFuture the completable future for which we want to apply.
@param executor the executor to run the apply function if the future is not yet done.
@param applyFun the function to apply.
@param <IN> type of the input future.
@param <OUT> type of the output future.
@return a completable future that is applying the given function to the input future. | [
"This",
"function",
"takes",
"a",
"{",
"@link",
"CompletableFuture",
"}",
"and",
"a",
"function",
"to",
"apply",
"to",
"this",
"future",
".",
"If",
"the",
"input",
"future",
"is",
"already",
"done",
"this",
"function",
"returns",
"{",
"@link",
"CompletableFu... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java#L837-L844 | train | Apply a function to a CompletableFuture if the CompletableFuture is done otherwise apply the function to the CompletableFuture. | [
30522,
2270,
10763,
1026,
1999,
1010,
2041,
1028,
4012,
10814,
10880,
11263,
11244,
1026,
2041,
1028,
2059,
29098,
2135,
3022,
6038,
6895,
2546,
17048,
5280,
2063,
1006,
4012,
10814,
10880,
11263,
11244,
1026,
1999,
1028,
4012,
10814,
10880,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/concurrent/FastThreadLocal.java | FastThreadLocal.remove | @SuppressWarnings("unchecked")
public final void remove(InternalThreadLocalMap threadLocalMap) {
if (threadLocalMap == null) {
return;
}
Object v = threadLocalMap.removeIndexedVariable(index);
removeFromVariablesToRemove(threadLocalMap, this);
if (v != InternalThreadLocalMap.UNSET) {
try {
onRemoval((V) v);
} catch (Exception e) {
PlatformDependent.throwException(e);
}
}
} | java | @SuppressWarnings("unchecked")
public final void remove(InternalThreadLocalMap threadLocalMap) {
if (threadLocalMap == null) {
return;
}
Object v = threadLocalMap.removeIndexedVariable(index);
removeFromVariablesToRemove(threadLocalMap, this);
if (v != InternalThreadLocalMap.UNSET) {
try {
onRemoval((V) v);
} catch (Exception e) {
PlatformDependent.throwException(e);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"void",
"remove",
"(",
"InternalThreadLocalMap",
"threadLocalMap",
")",
"{",
"if",
"(",
"threadLocalMap",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Object",
"v",
"=",
"threadLocalMap",
"... | Sets the value to uninitialized for the specified thread local map;
a proceeding call to get() will trigger a call to initialValue().
The specified thread local map must be for the current thread. | [
"Sets",
"the",
"value",
"to",
"uninitialized",
"for",
"the",
"specified",
"thread",
"local",
"map",
";",
"a",
"proceeding",
"call",
"to",
"get",
"()",
"will",
"trigger",
"a",
"call",
"to",
"initialValue",
"()",
".",
"The",
"specified",
"thread",
"local",
"... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/FastThreadLocal.java#L245-L261 | train | Removes the entry from the given thread local map. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
2345,
11675,
6366,
1006,
4722,
2705,
16416,
19422,
24755,
19145,
2361,
11689,
4135,
9289,
2863,
2361,
1007,
1063,
2065,
1006,
11689,
4135,
9289,
2863,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java | ReflectUtil.invokeWithCheck | public static <T> T invokeWithCheck(Object obj, Method method, Object... args) throws UtilException {
final Class<?>[] types = method.getParameterTypes();
if (null != types && null != args) {
Assert.isTrue(args.length == types.length, "Params length [{}] is not fit for param length [{}] of method !", args.length, types.length);
Class<?> type;
for (int i = 0; i < args.length; i++) {
type = types[i];
if (type.isPrimitive() && null == args[i]) {
// 参数是原始类型,而传入参数为null时赋予默认值
args[i] = ClassUtil.getDefaultValue(type);
}
}
}
return invoke(obj, method, args);
} | java | public static <T> T invokeWithCheck(Object obj, Method method, Object... args) throws UtilException {
final Class<?>[] types = method.getParameterTypes();
if (null != types && null != args) {
Assert.isTrue(args.length == types.length, "Params length [{}] is not fit for param length [{}] of method !", args.length, types.length);
Class<?> type;
for (int i = 0; i < args.length; i++) {
type = types[i];
if (type.isPrimitive() && null == args[i]) {
// 参数是原始类型,而传入参数为null时赋予默认值
args[i] = ClassUtil.getDefaultValue(type);
}
}
}
return invoke(obj, method, args);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"invokeWithCheck",
"(",
"Object",
"obj",
",",
"Method",
"method",
",",
"Object",
"...",
"args",
")",
"throws",
"UtilException",
"{",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"types",
"=",
"method",
".",
"getPar... | 执行方法<br>
执行前要检查给定参数:
<pre>
1. 参数个数是否与方法参数个数一致
2. 如果某个参数为null但是方法这个位置的参数为原始类型,则赋予原始类型默认值
</pre>
@param <T> 返回对象类型
@param obj 对象,如果执行静态方法,此值为<code>null</code>
@param method 方法(对象方法或static方法都可)
@param args 参数对象
@return 结果
@throws UtilException 一些列异常的包装 | [
"执行方法<br",
">",
"执行前要检查给定参数:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L755-L770 | train | Invoke method with check. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
1999,
6767,
3489,
24415,
5403,
3600,
1006,
4874,
27885,
3501,
1010,
4118,
4118,
1010,
4874,
1012,
1012,
1012,
12098,
5620,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
2345,
2465,
1026,
1029,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | resolver/src/main/java/io/netty/resolver/AddressResolverGroup.java | AddressResolverGroup.close | @Override
@SuppressWarnings({ "unchecked", "SuspiciousToArrayCall" })
public void close() {
final AddressResolver<T>[] rArray;
synchronized (resolvers) {
rArray = (AddressResolver<T>[]) resolvers.values().toArray(new AddressResolver[0]);
resolvers.clear();
}
for (AddressResolver<T> r: rArray) {
try {
r.close();
} catch (Throwable t) {
logger.warn("Failed to close a resolver:", t);
}
}
} | java | @Override
@SuppressWarnings({ "unchecked", "SuspiciousToArrayCall" })
public void close() {
final AddressResolver<T>[] rArray;
synchronized (resolvers) {
rArray = (AddressResolver<T>[]) resolvers.values().toArray(new AddressResolver[0]);
resolvers.clear();
}
for (AddressResolver<T> r: rArray) {
try {
r.close();
} catch (Throwable t) {
logger.warn("Failed to close a resolver:", t);
}
}
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"SuspiciousToArrayCall\"",
"}",
")",
"public",
"void",
"close",
"(",
")",
"{",
"final",
"AddressResolver",
"<",
"T",
">",
"[",
"]",
"rArray",
";",
"synchronized",
"(",
"resolvers",
"... | Closes all {@link NameResolver}s created by this group. | [
"Closes",
"all",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver/src/main/java/io/netty/resolver/AddressResolverGroup.java#L100-L116 | train | Close all the address resolvers. | [
30522,
1030,
2058,
15637,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
4895,
5403,
18141,
1000,
1010,
1000,
10027,
3406,
2906,
9447,
9289,
2140,
1000,
1065,
1007,
2270,
11675,
2485,
1006,
1007,
1063,
2345,
4769,
6072,
4747,
6299,
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/codec/BCD.java | BCD.strToBcd | public static byte[] strToBcd(String asc) {
int len = asc.length();
int mod = len % 2;
if (mod != 0) {
asc = "0" + asc;
len = asc.length();
}
byte abt[] = new byte[len];
if (len >= 2) {
len >>= 1;
}
byte bbt[] = new byte[len];
abt = asc.getBytes();
int j;
int k;
for (int p = 0; p < asc.length() / 2; p++) {
if ((abt[2 * p] >= '0') && (abt[2 * p] <= '9')) {
j = abt[2 * p] - '0';
} else if ((abt[2 * p] >= 'a') && (abt[2 * p] <= 'z')) {
j = abt[2 * p] - 'a' + 0x0a;
} else {
j = abt[2 * p] - 'A' + 0x0a;
}
if ((abt[2 * p + 1] >= '0') && (abt[2 * p + 1] <= '9')) {
k = abt[2 * p + 1] - '0';
} else if ((abt[2 * p + 1] >= 'a') && (abt[2 * p + 1] <= 'z')) {
k = abt[2 * p + 1] - 'a' + 0x0a;
} else {
k = abt[2 * p + 1] - 'A' + 0x0a;
}
int a = (j << 4) + k;
byte b = (byte) a;
bbt[p] = b;
}
return bbt;
} | java | public static byte[] strToBcd(String asc) {
int len = asc.length();
int mod = len % 2;
if (mod != 0) {
asc = "0" + asc;
len = asc.length();
}
byte abt[] = new byte[len];
if (len >= 2) {
len >>= 1;
}
byte bbt[] = new byte[len];
abt = asc.getBytes();
int j;
int k;
for (int p = 0; p < asc.length() / 2; p++) {
if ((abt[2 * p] >= '0') && (abt[2 * p] <= '9')) {
j = abt[2 * p] - '0';
} else if ((abt[2 * p] >= 'a') && (abt[2 * p] <= 'z')) {
j = abt[2 * p] - 'a' + 0x0a;
} else {
j = abt[2 * p] - 'A' + 0x0a;
}
if ((abt[2 * p + 1] >= '0') && (abt[2 * p + 1] <= '9')) {
k = abt[2 * p + 1] - '0';
} else if ((abt[2 * p + 1] >= 'a') && (abt[2 * p + 1] <= 'z')) {
k = abt[2 * p + 1] - 'a' + 0x0a;
} else {
k = abt[2 * p + 1] - 'A' + 0x0a;
}
int a = (j << 4) + k;
byte b = (byte) a;
bbt[p] = b;
}
return bbt;
} | [
"public",
"static",
"byte",
"[",
"]",
"strToBcd",
"(",
"String",
"asc",
")",
"{",
"int",
"len",
"=",
"asc",
".",
"length",
"(",
")",
";",
"int",
"mod",
"=",
"len",
"%",
"2",
";",
"if",
"(",
"mod",
"!=",
"0",
")",
"{",
"asc",
"=",
"\"0\"",
"+"... | 字符串转BCD码
@param asc ASCII字符串
@return BCD | [
"字符串转BCD码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/BCD.java#L17-L52 | train | Returns the bytes that are in BCD format from a String. | [
30522,
2270,
10763,
24880,
1031,
1033,
2358,
5339,
16429,
19797,
1006,
5164,
2004,
2278,
1007,
1063,
20014,
18798,
1027,
2004,
2278,
1012,
3091,
1006,
1007,
1025,
20014,
16913,
1027,
18798,
1003,
1016,
1025,
2065,
1006,
16913,
999,
1027,
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/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/util/SQLUtil.java | SQLUtil.getOriginalValue | public static String getOriginalValue(final String value, final DatabaseType databaseType) {
if (DatabaseType.MySQL != databaseType) {
return value;
}
try {
DefaultKeyword.valueOf(value.toUpperCase());
return String.format("`%s`", value);
} catch (final IllegalArgumentException ex) {
return getOriginalValueForMySQLKeyword(value);
}
} | java | public static String getOriginalValue(final String value, final DatabaseType databaseType) {
if (DatabaseType.MySQL != databaseType) {
return value;
}
try {
DefaultKeyword.valueOf(value.toUpperCase());
return String.format("`%s`", value);
} catch (final IllegalArgumentException ex) {
return getOriginalValueForMySQLKeyword(value);
}
} | [
"public",
"static",
"String",
"getOriginalValue",
"(",
"final",
"String",
"value",
",",
"final",
"DatabaseType",
"databaseType",
")",
"{",
"if",
"(",
"DatabaseType",
".",
"MySQL",
"!=",
"databaseType",
")",
"{",
"return",
"value",
";",
"}",
"try",
"{",
"Defa... | Get original value for SQL expression.
@param value SQL expression
@param databaseType database type
@return original SQL expression | [
"Get",
"original",
"value",
"for",
"SQL",
"expression",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/util/SQLUtil.java#L67-L77 | train | Gets original value. | [
30522,
2270,
10763,
5164,
2131,
10050,
24965,
10175,
5657,
1006,
2345,
5164,
3643,
1010,
2345,
7809,
13874,
30524,
1025,
1065,
3046,
1063,
12398,
14839,
18351,
1012,
3643,
11253,
1006,
3643,
1012,
2000,
29547,
18992,
3366,
1006,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/utility/TextUtility.java | TextUtility.isAllDelimiter | public static boolean isAllDelimiter(byte[] sString)
{
int nLen = sString.length;
int i = 0;
while (i < nLen - 1 && (getUnsigned(sString[i]) == 161 || getUnsigned(sString[i]) == 163))
{
i += 2;
}
if (i < nLen)
return false;
return true;
} | java | public static boolean isAllDelimiter(byte[] sString)
{
int nLen = sString.length;
int i = 0;
while (i < nLen - 1 && (getUnsigned(sString[i]) == 161 || getUnsigned(sString[i]) == 163))
{
i += 2;
}
if (i < nLen)
return false;
return true;
} | [
"public",
"static",
"boolean",
"isAllDelimiter",
"(",
"byte",
"[",
"]",
"sString",
")",
"{",
"int",
"nLen",
"=",
"sString",
".",
"length",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"nLen",
"-",
"1",
"&&",
"(",
"getUnsigned",
"(",
"sSt... | 是否全是分隔符
@param sString
@return | [
"是否全是分隔符"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/TextUtility.java#L281-L293 | train | is all delimiter | [
30522,
2270,
10763,
22017,
20898,
18061,
3363,
9247,
27605,
3334,
1006,
24880,
1031,
1033,
7020,
18886,
3070,
1007,
1063,
20014,
17953,
2368,
1027,
7020,
18886,
3070,
1012,
3091,
1025,
20014,
1045,
1027,
1014,
1025,
2096,
1006,
1045,
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-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java | SqlDateTimeUtils.dateSub | public static String dateSub(long ts, int days, TimeZone tz) {
ZoneId zoneId = tz.toZoneId();
Instant instant = Instant.ofEpochMilli(ts);
ZonedDateTime zdt = ZonedDateTime.ofInstant(instant, zoneId);
long resultTs = zdt.minusDays(days).toInstant().toEpochMilli();
return dateFormat(resultTs, DATE_FORMAT_STRING, tz);
} | java | public static String dateSub(long ts, int days, TimeZone tz) {
ZoneId zoneId = tz.toZoneId();
Instant instant = Instant.ofEpochMilli(ts);
ZonedDateTime zdt = ZonedDateTime.ofInstant(instant, zoneId);
long resultTs = zdt.minusDays(days).toInstant().toEpochMilli();
return dateFormat(resultTs, DATE_FORMAT_STRING, tz);
} | [
"public",
"static",
"String",
"dateSub",
"(",
"long",
"ts",
",",
"int",
"days",
",",
"TimeZone",
"tz",
")",
"{",
"ZoneId",
"zoneId",
"=",
"tz",
".",
"toZoneId",
"(",
")",
";",
"Instant",
"instant",
"=",
"Instant",
".",
"ofEpochMilli",
"(",
"ts",
")",
... | Do subtraction on date string.
@param ts the timestamp.
@param days days count you want to subtract.
@param tz time zone of the date time string
@return datetime string. | [
"Do",
"subtraction",
"on",
"date",
"string",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L771-L777 | train | Get the date sub - string. | [
30522,
2270,
10763,
5164,
5246,
12083,
1006,
2146,
24529,
1010,
20014,
2420,
1010,
2051,
15975,
1056,
2480,
1007,
1063,
4224,
3593,
4224,
3593,
1027,
1056,
2480,
1012,
2000,
15975,
3593,
1006,
1007,
1025,
7107,
7107,
1027,
7107,
1012,
1997,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/JobLeaderIdService.java | JobLeaderIdService.clear | public void clear() throws Exception {
Exception exception = null;
for (JobLeaderIdListener listener: jobLeaderIdListeners.values()) {
try {
listener.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
}
if (exception != null) {
ExceptionUtils.rethrowException(exception, "Could not properly stop the " +
JobLeaderIdService.class.getSimpleName() + '.');
}
jobLeaderIdListeners.clear();
} | java | public void clear() throws Exception {
Exception exception = null;
for (JobLeaderIdListener listener: jobLeaderIdListeners.values()) {
try {
listener.stop();
} catch (Exception e) {
exception = ExceptionUtils.firstOrSuppressed(e, exception);
}
}
if (exception != null) {
ExceptionUtils.rethrowException(exception, "Could not properly stop the " +
JobLeaderIdService.class.getSimpleName() + '.');
}
jobLeaderIdListeners.clear();
} | [
"public",
"void",
"clear",
"(",
")",
"throws",
"Exception",
"{",
"Exception",
"exception",
"=",
"null",
";",
"for",
"(",
"JobLeaderIdListener",
"listener",
":",
"jobLeaderIdListeners",
".",
"values",
"(",
")",
")",
"{",
"try",
"{",
"listener",
".",
"stop",
... | Stop and clear the currently registered job leader id listeners.
@throws Exception which is thrown in case a retrieval service cannot be stopped properly | [
"Stop",
"and",
"clear",
"the",
"currently",
"registered",
"job",
"leader",
"id",
"listeners",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/JobLeaderIdService.java#L120-L137 | train | Clear all job leader ids. | [
30522,
2270,
11675,
3154,
1006,
1007,
11618,
6453,
1063,
6453,
6453,
1027,
19701,
1025,
2005,
1006,
3105,
19000,
3593,
9863,
24454,
19373,
1024,
3105,
19000,
3593,
9863,
24454,
2015,
1012,
5300,
1006,
1007,
1007,
1063,
3046,
1063,
19373,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.