repo stringclasses 11 values | path stringlengths 41 234 | func_name stringlengths 5 78 | original_string stringlengths 71 14.1k | language stringclasses 1 value | code stringlengths 71 14.1k | code_tokens listlengths 22 2.65k | docstring stringlengths 2 5.35k | docstring_tokens listlengths 1 369 | sha stringclasses 11 values | url stringlengths 129 339 | partition stringclasses 1 value | summary stringlengths 7 175 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.getPathEle | public static Path getPathEle(Path path, int index) {
return subPath(path, index, index == -1 ? path.getNameCount() : index + 1);
} | java | public static Path getPathEle(Path path, int index) {
return subPath(path, index, index == -1 ? path.getNameCount() : index + 1);
} | [
"public",
"static",
"Path",
"getPathEle",
"(",
"Path",
"path",
",",
"int",
"index",
")",
"{",
"return",
"subPath",
"(",
"path",
",",
"index",
",",
"index",
"==",
"-",
"1",
"?",
"path",
".",
"getNameCount",
"(",
")",
":",
"index",
"+",
"1",
")",
";"... | 获取指定位置的子路径部分,支持负数,例如index为-1表示从后数第一个节点位置
@param path 路径
@param index 路径节点位置,支持负数(负数从后向前计数)
@return 获取的子路径
@since 3.1.2 | [
"获取指定位置的子路径部分,支持负数,例如index为",
"-",
"1表示从后数第一个节点位置"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1642-L1644 | train | Returns the element at the given index in the path. | [
30522,
2270,
10763,
4130,
2131,
15069,
12260,
1006,
4130,
4130,
1010,
20014,
5950,
1007,
1063,
2709,
4942,
15069,
1006,
4130,
1010,
5950,
1010,
5950,
1027,
1027,
1011,
1015,
1029,
4130,
1012,
2131,
18442,
3597,
16671,
1006,
1007,
1024,
5950... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/ByteValueArray.java | ByteValueArray.compareTo | @Override
public int compareTo(ValueArray<ByteValue> o) {
ByteValueArray other = (ByteValueArray) o;
int min = Math.min(position, other.position);
for (int i = 0; i < min; i++) {
int cmp = Byte.compare(data[i], other.data[i]);
if (cmp != 0) {
return cmp;
}
}
return Integer.compare(position, other.position);
} | java | @Override
public int compareTo(ValueArray<ByteValue> o) {
ByteValueArray other = (ByteValueArray) o;
int min = Math.min(position, other.position);
for (int i = 0; i < min; i++) {
int cmp = Byte.compare(data[i], other.data[i]);
if (cmp != 0) {
return cmp;
}
}
return Integer.compare(position, other.position);
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"ValueArray",
"<",
"ByteValue",
">",
"o",
")",
"{",
"ByteValueArray",
"other",
"=",
"(",
"ByteValueArray",
")",
"o",
";",
"int",
"min",
"=",
"Math",
".",
"min",
"(",
"position",
",",
"other",
".",
"po... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/ByteValueArray.java#L226-L240 | train | Compares two ByteValueArrays. | [
30522,
1030,
2058,
15637,
2270,
20014,
12826,
3406,
1006,
3643,
2906,
9447,
1026,
24880,
10175,
5657,
1028,
1051,
1007,
1063,
24880,
10175,
5657,
2906,
9447,
2060,
1027,
1006,
24880,
10175,
5657,
2906,
9447,
1007,
1051,
1025,
20014,
8117,
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/selenium/grid/log/TerseFormatter.java | TerseFormatter.format | @Override
public synchronized String format(final LogRecord record) {
buffer.setLength(PREFIX.length());
buffer.append(timestampFormatter.format(new Date(record.getMillis())));
buffer.append(' ');
buffer.append(levelNumberToCommonsLevelName(record.getLevel()));
String[] parts = record.getSourceClassName().split("\\.");
buffer.append(" [" + parts[parts.length-1] + "." + record.getSourceMethodName() + "]");
buffer.append(SUFFIX);
buffer.append(formatMessage(record)).append(lineSeparator);
if (record.getThrown() != null) {
final StringWriter trace = new StringWriter();
record.getThrown().printStackTrace(new PrintWriter(trace));
buffer.append(trace);
}
return buffer.toString();
} | java | @Override
public synchronized String format(final LogRecord record) {
buffer.setLength(PREFIX.length());
buffer.append(timestampFormatter.format(new Date(record.getMillis())));
buffer.append(' ');
buffer.append(levelNumberToCommonsLevelName(record.getLevel()));
String[] parts = record.getSourceClassName().split("\\.");
buffer.append(" [" + parts[parts.length-1] + "." + record.getSourceMethodName() + "]");
buffer.append(SUFFIX);
buffer.append(formatMessage(record)).append(lineSeparator);
if (record.getThrown() != null) {
final StringWriter trace = new StringWriter();
record.getThrown().printStackTrace(new PrintWriter(trace));
buffer.append(trace);
}
return buffer.toString();
} | [
"@",
"Override",
"public",
"synchronized",
"String",
"format",
"(",
"final",
"LogRecord",
"record",
")",
"{",
"buffer",
".",
"setLength",
"(",
"PREFIX",
".",
"length",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"timestampFormatter",
".",
"format",
"... | Format the given log record and return the formatted string.
@param record the log record to be formatted.
@return a formatted log record | [
"Format",
"the",
"given",
"log",
"record",
"and",
"return",
"the",
"formatted",
"string",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/selenium/grid/log/TerseFormatter.java#L75-L92 | train | Format a LogRecord to a String. | [
30522,
30524,
14376,
2953,
18900,
3334,
1012,
4289,
1006,
2047,
3058,
1006,
2501,
1012,
2131,
19912,
2483,
1006,
1007,
1007,
1007,
1007,
1025,
17698,
1012,
10439,
10497,
1006,
1005,
1005,
1007,
1025,
17698,
1012,
10439,
10497,
1006,
2504,
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-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/AggregateOperationFactory.java | AggregateOperationFactory.createResolvedWindow | public ResolvedGroupWindow createResolvedWindow(GroupWindow window, ExpressionResolver resolver) {
Expression alias = window.getAlias();
if (!(alias instanceof UnresolvedReferenceExpression)) {
throw new ValidationException("Only unresolved reference supported for alias of a group window.");
}
final String windowName = ((UnresolvedReferenceExpression) alias).getName();
FieldReferenceExpression timeField = getValidatedTimeAttribute(window, resolver);
if (window instanceof TumbleWithSizeOnTimeWithAlias) {
return validateAndCreateTumbleWindow(
(TumbleWithSizeOnTimeWithAlias) window,
windowName,
timeField);
} else if (window instanceof SlideWithSizeAndSlideOnTimeWithAlias) {
return validateAndCreateSlideWindow(
(SlideWithSizeAndSlideOnTimeWithAlias) window,
windowName,
timeField);
} else if (window instanceof SessionWithGapOnTimeWithAlias) {
return validateAndCreateSessionWindow(
(SessionWithGapOnTimeWithAlias) window,
windowName,
timeField);
} else {
throw new TableException("Unknown window type: " + window);
}
} | java | public ResolvedGroupWindow createResolvedWindow(GroupWindow window, ExpressionResolver resolver) {
Expression alias = window.getAlias();
if (!(alias instanceof UnresolvedReferenceExpression)) {
throw new ValidationException("Only unresolved reference supported for alias of a group window.");
}
final String windowName = ((UnresolvedReferenceExpression) alias).getName();
FieldReferenceExpression timeField = getValidatedTimeAttribute(window, resolver);
if (window instanceof TumbleWithSizeOnTimeWithAlias) {
return validateAndCreateTumbleWindow(
(TumbleWithSizeOnTimeWithAlias) window,
windowName,
timeField);
} else if (window instanceof SlideWithSizeAndSlideOnTimeWithAlias) {
return validateAndCreateSlideWindow(
(SlideWithSizeAndSlideOnTimeWithAlias) window,
windowName,
timeField);
} else if (window instanceof SessionWithGapOnTimeWithAlias) {
return validateAndCreateSessionWindow(
(SessionWithGapOnTimeWithAlias) window,
windowName,
timeField);
} else {
throw new TableException("Unknown window type: " + window);
}
} | [
"public",
"ResolvedGroupWindow",
"createResolvedWindow",
"(",
"GroupWindow",
"window",
",",
"ExpressionResolver",
"resolver",
")",
"{",
"Expression",
"alias",
"=",
"window",
".",
"getAlias",
"(",
")",
";",
"if",
"(",
"!",
"(",
"alias",
"instanceof",
"UnresolvedRef... | Converts an API class to a resolved window for planning with expressions already resolved.
It performs following validations:
<ul>
<li>The alias is represented with an unresolved reference</li>
<li>The time attribute is a single field reference of a {@link TimeIndicatorTypeInfo}(stream),
{@link SqlTimeTypeInfo}(batch), or {@link BasicTypeInfo#LONG_TYPE_INFO}(batch) type</li>
<li>The size & slide are value literals of either {@link RowIntervalTypeInfo#INTERVAL_ROWS},
or {@link TimeIntervalTypeInfo} type</li>
<li>The size & slide are of the same type</li>
<li>The gap is a value literal of a {@link TimeIntervalTypeInfo} type</li>
</ul>
@param window window to resolve
@param resolver resolver to resolve potential unresolved field references
@return window with expressions resolved | [
"Converts",
"an",
"API",
"class",
"to",
"a",
"resolved",
"window",
"for",
"planning",
"with",
"expressions",
"already",
"resolved",
".",
"It",
"performs",
"following",
"validations",
":",
"<ul",
">",
"<li",
">",
"The",
"alias",
"is",
"represented",
"with",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/AggregateOperationFactory.java#L183-L211 | train | Create a resolved window. | [
30522,
2270,
10395,
17058,
11101,
5004,
3443,
6072,
16116,
11101,
5004,
1006,
2177,
11101,
5004,
3332,
1010,
3670,
6072,
4747,
6299,
10663,
2099,
1007,
1063,
3670,
14593,
1027,
3332,
1012,
2131,
22786,
2015,
1006,
1007,
1025,
2065,
1006,
99... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/IterativeStream.java | IterativeStream.closeWith | @SuppressWarnings({ "unchecked", "rawtypes" })
public DataStream<T> closeWith(DataStream<T> feedbackStream) {
Collection<StreamTransformation<?>> predecessors = feedbackStream.getTransformation().getTransitivePredecessors();
if (!predecessors.contains(this.transformation)) {
throw new UnsupportedOperationException(
"Cannot close an iteration with a feedback DataStream that does not originate from said iteration.");
}
((FeedbackTransformation) getTransformation()).addFeedbackEdge(feedbackStream.getTransformation());
return feedbackStream;
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public DataStream<T> closeWith(DataStream<T> feedbackStream) {
Collection<StreamTransformation<?>> predecessors = feedbackStream.getTransformation().getTransitivePredecessors();
if (!predecessors.contains(this.transformation)) {
throw new UnsupportedOperationException(
"Cannot close an iteration with a feedback DataStream that does not originate from said iteration.");
}
((FeedbackTransformation) getTransformation()).addFeedbackEdge(feedbackStream.getTransformation());
return feedbackStream;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"DataStream",
"<",
"T",
">",
"closeWith",
"(",
"DataStream",
"<",
"T",
">",
"feedbackStream",
")",
"{",
"Collection",
"<",
"StreamTransformation",
"<",
"?",
">",
">"... | Closes the iteration. This method defines the end of the iterative
program part that will be fed back to the start of the iteration.
<p>A common usage pattern for streaming iterations is to use output
splitting to send a part of the closing data stream to the head. Refer to
{@link DataStream#split(org.apache.flink.streaming.api.collector.selector.OutputSelector)}
for more information.
@param feedbackStream
{@link DataStream} that will be used as input to the iteration
head.
@return The feedback stream. | [
"Closes",
"the",
"iteration",
".",
"This",
"method",
"defines",
"the",
"end",
"of",
"the",
"iterative",
"program",
"part",
"that",
"will",
"be",
"fed",
"back",
"to",
"the",
"start",
"of",
"the",
"iteration",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/IterativeStream.java#L67-L80 | train | Closes the iteration with the given feedback DataStream. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
4895,
5403,
18141,
1000,
1010,
1000,
6315,
13874,
2015,
1000,
1065,
1007,
2270,
2951,
21422,
1026,
1056,
1028,
2485,
24415,
1006,
2951,
21422,
1026,
1056,
1028,
12247,
21422,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java | SqlBuilder.groupBy | public SqlBuilder groupBy(String... fields) {
if (ArrayUtil.isNotEmpty(fields)) {
if (null != wrapper) {
// 包装字段名
fields = wrapper.wrap(fields);
}
sql.append(" GROUP BY ").append(ArrayUtil.join(fields, StrUtil.COMMA));
}
return this;
} | java | public SqlBuilder groupBy(String... fields) {
if (ArrayUtil.isNotEmpty(fields)) {
if (null != wrapper) {
// 包装字段名
fields = wrapper.wrap(fields);
}
sql.append(" GROUP BY ").append(ArrayUtil.join(fields, StrUtil.COMMA));
}
return this;
} | [
"public",
"SqlBuilder",
"groupBy",
"(",
"String",
"...",
"fields",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isNotEmpty",
"(",
"fields",
")",
")",
"{",
"if",
"(",
"null",
"!=",
"wrapper",
")",
"{",
"// 包装字段名\r",
"fields",
"=",
"wrapper",
".",
"wrap",
"("... | 分组
@param fields 字段
@return 自己 | [
"分组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java#L349-L360 | train | GROUP BY 参数 | [
30522,
2270,
29296,
8569,
23891,
2099,
2177,
3762,
1006,
5164,
1012,
30524,
4249,
1027,
10236,
4842,
1012,
10236,
1006,
4249,
1007,
1025,
1065,
29296,
1012,
10439,
10497,
1006,
1000,
2177,
2011,
1000,
1007,
1012,
10439,
10497,
1006,
9140,
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-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/BipartiteGraph.java | BipartiteGraph.fromDataSet | public static <KT, KB, VVT, VVB, EV> BipartiteGraph<KT, KB, VVT, VVB, EV> fromDataSet(
DataSet<Vertex<KT, VVT>> topVertices,
DataSet<Vertex<KB, VVB>> bottomVertices,
DataSet<BipartiteEdge<KT, KB, EV>> edges,
ExecutionEnvironment context) {
return new BipartiteGraph<>(topVertices, bottomVertices, edges, context);
} | java | public static <KT, KB, VVT, VVB, EV> BipartiteGraph<KT, KB, VVT, VVB, EV> fromDataSet(
DataSet<Vertex<KT, VVT>> topVertices,
DataSet<Vertex<KB, VVB>> bottomVertices,
DataSet<BipartiteEdge<KT, KB, EV>> edges,
ExecutionEnvironment context) {
return new BipartiteGraph<>(topVertices, bottomVertices, edges, context);
} | [
"public",
"static",
"<",
"KT",
",",
"KB",
",",
"VVT",
",",
"VVB",
",",
"EV",
">",
"BipartiteGraph",
"<",
"KT",
",",
"KB",
",",
"VVT",
",",
"VVB",
",",
"EV",
">",
"fromDataSet",
"(",
"DataSet",
"<",
"Vertex",
"<",
"KT",
",",
"VVT",
">",
">",
"to... | Create bipartite graph from datasets.
@param topVertices dataset of top vertices in the graph
@param bottomVertices dataset of bottom vertices in the graph
@param edges dataset of edges between vertices
@param context Flink execution context
@return new bipartite graph created from provided datasets | [
"Create",
"bipartite",
"graph",
"from",
"datasets",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/BipartiteGraph.java#L81-L87 | train | Creates a BipartiteGraph from a DataSet of Vertex objects. | [
30522,
2270,
10763,
1026,
1047,
2102,
1010,
21677,
1010,
1058,
2615,
2102,
1010,
1058,
26493,
1010,
23408,
1028,
12170,
19362,
23096,
14413,
1026,
1047,
2102,
1010,
21677,
1010,
1058,
2615,
2102,
1010,
1058,
26493,
1010,
23408,
1028,
2013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java | Types.POJO | public static <T> TypeInformation<T> POJO(Class<T> pojoClass, Map<String, TypeInformation<?>> fields) {
final List<PojoField> pojoFields = new ArrayList<>(fields.size());
for (Map.Entry<String, TypeInformation<?>> field : fields.entrySet()) {
final Field f = TypeExtractor.getDeclaredField(pojoClass, field.getKey());
if (f == null) {
throw new InvalidTypesException("Field '" + field.getKey() + "'could not be accessed.");
}
pojoFields.add(new PojoField(f, field.getValue()));
}
return new PojoTypeInfo<>(pojoClass, pojoFields);
} | java | public static <T> TypeInformation<T> POJO(Class<T> pojoClass, Map<String, TypeInformation<?>> fields) {
final List<PojoField> pojoFields = new ArrayList<>(fields.size());
for (Map.Entry<String, TypeInformation<?>> field : fields.entrySet()) {
final Field f = TypeExtractor.getDeclaredField(pojoClass, field.getKey());
if (f == null) {
throw new InvalidTypesException("Field '" + field.getKey() + "'could not be accessed.");
}
pojoFields.add(new PojoField(f, field.getValue()));
}
return new PojoTypeInfo<>(pojoClass, pojoFields);
} | [
"public",
"static",
"<",
"T",
">",
"TypeInformation",
"<",
"T",
">",
"POJO",
"(",
"Class",
"<",
"T",
">",
"pojoClass",
",",
"Map",
"<",
"String",
",",
"TypeInformation",
"<",
"?",
">",
">",
"fields",
")",
"{",
"final",
"List",
"<",
"PojoField",
">",
... | Returns type information for a POJO (Plain Old Java Object) and allows to specify all fields manually.
<p>A POJO class is public and standalone (no non-static inner class). It has a public no-argument
constructor. All non-static, non-transient fields in the class (and all superclasses) are either public
(and non-final) or have a public getter and a setter method that follows the Java beans naming
conventions for getters and setters.
<p>A POJO is a fixed-length, null-aware composite type with non-deterministic field order. Every field
can be null independent of the field's type.
<p>The generic types for all fields of the POJO can be defined in a hierarchy of subclasses.
<p>If Flink's type analyzer is unable to extract a POJO field, an
{@link org.apache.flink.api.common.functions.InvalidTypesException} is thrown.
<p><strong>Note:</strong> In most cases the type information of fields can be determined automatically,
we recommend to use {@link Types#POJO(Class)}.
@param pojoClass POJO class
@param fields map of fields that map a name to type information. The map key is the name of
the field and the value is its type. | [
"Returns",
"type",
"information",
"for",
"a",
"POJO",
"(",
"Plain",
"Old",
"Java",
"Object",
")",
"and",
"allows",
"to",
"specify",
"all",
"fields",
"manually",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java#L312-L323 | train | Creates a POJO type from a map of fields. | [
30522,
2270,
10763,
1026,
1056,
1028,
2828,
2378,
14192,
3370,
1026,
1056,
1028,
13433,
5558,
1006,
2465,
1026,
1056,
1028,
13433,
5558,
26266,
1010,
4949,
1026,
5164,
1010,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
1028,
4249,
1007,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java | ExceptionUtils.findThrowableWithMessage | public static Optional<Throwable> findThrowableWithMessage(Throwable throwable, String searchMessage) {
if (throwable == null || searchMessage == null) {
return Optional.empty();
}
Throwable t = throwable;
while (t != null) {
if (t.getMessage() != null && t.getMessage().contains(searchMessage)) {
return Optional.of(t);
} else {
t = t.getCause();
}
}
return Optional.empty();
} | java | public static Optional<Throwable> findThrowableWithMessage(Throwable throwable, String searchMessage) {
if (throwable == null || searchMessage == null) {
return Optional.empty();
}
Throwable t = throwable;
while (t != null) {
if (t.getMessage() != null && t.getMessage().contains(searchMessage)) {
return Optional.of(t);
} else {
t = t.getCause();
}
}
return Optional.empty();
} | [
"public",
"static",
"Optional",
"<",
"Throwable",
">",
"findThrowableWithMessage",
"(",
"Throwable",
"throwable",
",",
"String",
"searchMessage",
")",
"{",
"if",
"(",
"throwable",
"==",
"null",
"||",
"searchMessage",
"==",
"null",
")",
"{",
"return",
"Optional",... | Checks whether a throwable chain contains a specific error message and returns the corresponding throwable.
@param throwable the throwable chain to check.
@param searchMessage the error message to search for in the chain.
@return Optional throwable containing the search message if available, otherwise empty | [
"Checks",
"whether",
"a",
"throwable",
"chain",
"contains",
"a",
"specific",
"error",
"message",
"and",
"returns",
"the",
"corresponding",
"throwable",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java#L372-L387 | train | Find a Throwable with a message. | [
30522,
2270,
10763,
11887,
1026,
5466,
3085,
1028,
2424,
2705,
10524,
3085,
24415,
7834,
3736,
3351,
1006,
5466,
3085,
5466,
3085,
1010,
5164,
3945,
7834,
3736,
3351,
1007,
1063,
2065,
1006,
5466,
3085,
1027,
1027,
19701,
1064,
1064,
3945,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-bloomFilter/src/main/java/cn/hutool/bloomfilter/BitSetBloomFilter.java | BitSetBloomFilter.createHashes | public static int[] createHashes(String str, int hashNumber) {
int[] result = new int[hashNumber];
for(int i = 0; i < hashNumber; i++) {
result[i] = hash(str, i);
}
return result;
} | java | public static int[] createHashes(String str, int hashNumber) {
int[] result = new int[hashNumber];
for(int i = 0; i < hashNumber; i++) {
result[i] = hash(str, i);
}
return result;
} | [
"public",
"static",
"int",
"[",
"]",
"createHashes",
"(",
"String",
"str",
",",
"int",
"hashNumber",
")",
"{",
"int",
"[",
"]",
"result",
"=",
"new",
"int",
"[",
"hashNumber",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"hashNumber",... | 将字符串的字节表示进行多哈希编码.
@param str 待添加进过滤器的字符串字节表示.
@param hashNumber 要经过的哈希个数.
@return 各个哈希的结果数组. | [
"将字符串的字节表示进行多哈希编码",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-bloomFilter/src/main/java/cn/hutool/bloomfilter/BitSetBloomFilter.java#L106-L113 | train | Creates a hash array of the given number of bytes from the given string. | [
30522,
2270,
10763,
20014,
1031,
1033,
3443,
14949,
15689,
1006,
5164,
2358,
2099,
1010,
20014,
23325,
19172,
5677,
1007,
1063,
20014,
1031,
1033,
2765,
1027,
2047,
20014,
1031,
23325,
19172,
5677,
1033,
1025,
2005,
1006,
20014,
1045,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTags.java | RestTemplateExchangeTags.outcome | public static Tag outcome(ClientHttpResponse response) {
try {
if (response != null) {
HttpStatus statusCode = response.getStatusCode();
if (statusCode.is1xxInformational()) {
return OUTCOME_INFORMATIONAL;
}
if (statusCode.is2xxSuccessful()) {
return OUTCOME_SUCCESS;
}
if (statusCode.is3xxRedirection()) {
return OUTCOME_REDIRECTION;
}
if (statusCode.is4xxClientError()) {
return OUTCOME_CLIENT_ERROR;
}
if (statusCode.is5xxServerError()) {
return OUTCOME_SERVER_ERROR;
}
}
return OUTCOME_UNKNOWN;
}
catch (IOException | IllegalArgumentException ex) {
return OUTCOME_UNKNOWN;
}
} | java | public static Tag outcome(ClientHttpResponse response) {
try {
if (response != null) {
HttpStatus statusCode = response.getStatusCode();
if (statusCode.is1xxInformational()) {
return OUTCOME_INFORMATIONAL;
}
if (statusCode.is2xxSuccessful()) {
return OUTCOME_SUCCESS;
}
if (statusCode.is3xxRedirection()) {
return OUTCOME_REDIRECTION;
}
if (statusCode.is4xxClientError()) {
return OUTCOME_CLIENT_ERROR;
}
if (statusCode.is5xxServerError()) {
return OUTCOME_SERVER_ERROR;
}
}
return OUTCOME_UNKNOWN;
}
catch (IOException | IllegalArgumentException ex) {
return OUTCOME_UNKNOWN;
}
} | [
"public",
"static",
"Tag",
"outcome",
"(",
"ClientHttpResponse",
"response",
")",
"{",
"try",
"{",
"if",
"(",
"response",
"!=",
"null",
")",
"{",
"HttpStatus",
"statusCode",
"=",
"response",
".",
"getStatusCode",
"(",
")",
";",
"if",
"(",
"statusCode",
"."... | Creates an {@code outcome} {@code Tag} derived from the
{@link ClientHttpResponse#getStatusCode() status} of the given {@code response}.
@param response the response
@return the outcome tag
@since 2.2.0 | [
"Creates",
"an",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTags.java#L140-L165 | train | Returns the outcome of the HTTP response. | [
30522,
2270,
10763,
6415,
9560,
1006,
7396,
11039,
25856,
6072,
26029,
3366,
3433,
1007,
1063,
3046,
1063,
2065,
1006,
3433,
999,
1027,
19701,
1007,
1063,
16770,
29336,
2271,
3570,
16044,
1027,
3433,
1012,
4152,
29336,
2271,
16044,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/PathPattern.java | PathPattern.match | public boolean match(String[] requestPathTokens, Map<String, String> params) {
if (tokens.length == requestPathTokens.length) {
for (int i = 0; i < tokens.length; i++) {
String key = tokens[i];
String value = requestPathTokens[i];
if (key.length() > 0 && key.charAt(0) == ':') {
// This is a placeholder
params.put(key.substring(1), value);
} else if (!key.equals(value)) {
// This is a constant
return false;
}
}
return true;
}
if (tokens.length > 0 &&
tokens[tokens.length - 1].equals(":*") &&
tokens.length <= requestPathTokens.length) {
// The first part
for (int i = 0; i < tokens.length - 2; i++) {
String key = tokens[i];
String value = requestPathTokens[i];
if (key.length() > 0 && key.charAt(0) == ':') {
// This is a placeholder
params.put(key.substring(1), value);
} else if (!key.equals(value)) {
// This is a constant
return false;
}
}
// The last :* part
StringBuilder b = new StringBuilder(requestPathTokens[tokens.length - 1]);
for (int i = tokens.length; i < requestPathTokens.length; i++) {
b.append('/');
b.append(requestPathTokens[i]);
}
params.put("*", b.toString());
return true;
}
return false;
} | java | public boolean match(String[] requestPathTokens, Map<String, String> params) {
if (tokens.length == requestPathTokens.length) {
for (int i = 0; i < tokens.length; i++) {
String key = tokens[i];
String value = requestPathTokens[i];
if (key.length() > 0 && key.charAt(0) == ':') {
// This is a placeholder
params.put(key.substring(1), value);
} else if (!key.equals(value)) {
// This is a constant
return false;
}
}
return true;
}
if (tokens.length > 0 &&
tokens[tokens.length - 1].equals(":*") &&
tokens.length <= requestPathTokens.length) {
// The first part
for (int i = 0; i < tokens.length - 2; i++) {
String key = tokens[i];
String value = requestPathTokens[i];
if (key.length() > 0 && key.charAt(0) == ':') {
// This is a placeholder
params.put(key.substring(1), value);
} else if (!key.equals(value)) {
// This is a constant
return false;
}
}
// The last :* part
StringBuilder b = new StringBuilder(requestPathTokens[tokens.length - 1]);
for (int i = tokens.length; i < requestPathTokens.length; i++) {
b.append('/');
b.append(requestPathTokens[i]);
}
params.put("*", b.toString());
return true;
}
return false;
} | [
"public",
"boolean",
"match",
"(",
"String",
"[",
"]",
"requestPathTokens",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"if",
"(",
"tokens",
".",
"length",
"==",
"requestPathTokens",
".",
"length",
")",
"{",
"for",
"(",
"int",
"i... | {@code params} will be updated with params embedded in the request path.
<p>This method signature is designed so that {@code requestPathTokens} and {@code params}
can be created only once then reused, to optimize for performance when a
large number of path patterns need to be matched.
@return {@code false} if not matched; in this case params should be reset | [
"{",
"@code",
"params",
"}",
"will",
"be",
"updated",
"with",
"params",
"embedded",
"in",
"the",
"request",
"path",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/PathPattern.java#L133-L180 | train | Match the request path with the tokens in requestPathTokens and put the parameters in params | [
30522,
2270,
22017,
20898,
2674,
1006,
5164,
1031,
1033,
5227,
15069,
18715,
6132,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
11498,
5244,
1007,
1063,
2065,
1006,
19204,
2015,
1012,
3091,
1027,
1027,
5227,
15069,
18715,
6132,
1012,
3091,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java | IterUtil.countMap | public static <T> Map<T, Integer> countMap(Iterable<T> iter) {
return countMap(null == iter ? null : iter.iterator());
} | java | public static <T> Map<T, Integer> countMap(Iterable<T> iter) {
return countMap(null == iter ? null : iter.iterator());
} | [
"public",
"static",
"<",
"T",
">",
"Map",
"<",
"T",
",",
"Integer",
">",
"countMap",
"(",
"Iterable",
"<",
"T",
">",
"iter",
")",
"{",
"return",
"countMap",
"(",
"null",
"==",
"iter",
"?",
"null",
":",
"iter",
".",
"iterator",
"(",
")",
")",
";",... | 根据集合返回一个元素计数的 {@link Map}<br>
所谓元素计数就是假如这个集合中某个元素出现了n次,那将这个元素做为key,n做为value<br>
例如:[a,b,c,c,c] 得到:<br>
a: 1<br>
b: 1<br>
c: 3<br>
@param <T> 集合元素类型
@param iter {@link Iterable},如果为null返回一个空的Map
@return {@link Map} | [
"根据集合返回一个元素计数的",
"{",
"@link",
"Map",
"}",
"<br",
">",
"所谓元素计数就是假如这个集合中某个元素出现了n次,那将这个元素做为key,n做为value<br",
">",
"例如:",
"[",
"a",
"b",
"c",
"c",
"c",
"]",
"得到:<br",
">",
"a",
":",
"1<br",
">",
"b",
":",
"1<br",
">",
"c",
":",
"3<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L136-L138 | train | Returns a map of the items in the given iterable. | [
30522,
2270,
10763,
1026,
1056,
1028,
4949,
1026,
1056,
1010,
16109,
1028,
4175,
2863,
2361,
1006,
2009,
6906,
3468,
1026,
1056,
1028,
2009,
2121,
1007,
1063,
2709,
4175,
2863,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java | ReUtil.extractMulti | public static String extractMulti(String regex, CharSequence content, String template) {
if (null == content || null == regex || null == template) {
return null;
}
// Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
final Pattern pattern = PatternPool.get(regex, Pattern.DOTALL);
return extractMulti(pattern, content, template);
} | java | public static String extractMulti(String regex, CharSequence content, String template) {
if (null == content || null == regex || null == template) {
return null;
}
// Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
final Pattern pattern = PatternPool.get(regex, Pattern.DOTALL);
return extractMulti(pattern, content, template);
} | [
"public",
"static",
"String",
"extractMulti",
"(",
"String",
"regex",
",",
"CharSequence",
"content",
",",
"String",
"template",
")",
"{",
"if",
"(",
"null",
"==",
"content",
"||",
"null",
"==",
"regex",
"||",
"null",
"==",
"template",
")",
"{",
"return",
... | 从content中匹配出多个值并根据template生成新的字符串<br>
匹配结束后会删除匹配内容之前的内容(包括匹配内容)<br>
例如:<br>
content 2013年5月 pattern (.*?)年(.*?)月 template: $1-$2 return 2013-5
@param regex 匹配正则字符串
@param content 被匹配的内容
@param template 生成内容模板,变量 $1 表示group1的内容,以此类推
@return 按照template拼接后的字符串 | [
"从content中匹配出多个值并根据template生成新的字符串<br",
">",
"匹配结束后会删除匹配内容之前的内容(包括匹配内容)<br",
">",
"例如:<br",
">",
"content",
"2013年5月",
"pattern",
"(",
".",
"*",
"?",
")",
"年",
"(",
".",
"*",
"?",
")",
"月",
"template:",
"$1",
"-",
"$2",
"return",
"2013",
"-",
"5"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L209-L217 | train | Extract a multi - line string from a CharSequence using a regular expression and a template. | [
30522,
2270,
10763,
5164,
14817,
12274,
7096,
2072,
1006,
5164,
19723,
10288,
1010,
25869,
3366,
4226,
5897,
4180,
1010,
5164,
23561,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
4180,
1064,
1064,
19701,
1027,
1027,
19723,
10288,
1064,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpEncoder.java | SpdyHttpEncoder.isLast | private static boolean isLast(HttpMessage httpMessage) {
if (httpMessage instanceof FullHttpMessage) {
FullHttpMessage fullMessage = (FullHttpMessage) httpMessage;
if (fullMessage.trailingHeaders().isEmpty() && !fullMessage.content().isReadable()) {
return true;
}
}
return false;
} | java | private static boolean isLast(HttpMessage httpMessage) {
if (httpMessage instanceof FullHttpMessage) {
FullHttpMessage fullMessage = (FullHttpMessage) httpMessage;
if (fullMessage.trailingHeaders().isEmpty() && !fullMessage.content().isReadable()) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"isLast",
"(",
"HttpMessage",
"httpMessage",
")",
"{",
"if",
"(",
"httpMessage",
"instanceof",
"FullHttpMessage",
")",
"{",
"FullHttpMessage",
"fullMessage",
"=",
"(",
"FullHttpMessage",
")",
"httpMessage",
";",
"if",
"(",
"fullMess... | Checks if the given HTTP message should be considered as a last SPDY frame.
@param httpMessage check this HTTP message
@return whether the given HTTP message should generate a <em>last</em> SPDY frame. | [
"Checks",
"if",
"the",
"given",
"HTTP",
"message",
"should",
"be",
"considered",
"as",
"a",
"last",
"SPDY",
"frame",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpEncoder.java#L322-L331 | train | Is the message a last message? | [
30522,
2797,
10763,
22017,
20898,
25340,
3367,
1006,
8299,
7834,
3736,
3351,
8299,
7834,
3736,
3351,
1007,
1063,
2065,
1006,
8299,
7834,
3736,
3351,
6013,
11253,
2440,
11039,
25856,
7834,
3736,
3351,
1007,
1063,
2440,
11039,
25856,
7834,
37... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/util/HandlerUtils.java | HandlerUtils.sendResponse | public static CompletableFuture<Void> sendResponse(
@Nonnull ChannelHandlerContext channelHandlerContext,
@Nonnull HttpRequest httpRequest,
@Nonnull String message,
@Nonnull HttpResponseStatus statusCode,
@Nonnull Map<String, String> headers) {
return sendResponse(
channelHandlerContext,
HttpHeaders.isKeepAlive(httpRequest),
message,
statusCode,
headers);
} | java | public static CompletableFuture<Void> sendResponse(
@Nonnull ChannelHandlerContext channelHandlerContext,
@Nonnull HttpRequest httpRequest,
@Nonnull String message,
@Nonnull HttpResponseStatus statusCode,
@Nonnull Map<String, String> headers) {
return sendResponse(
channelHandlerContext,
HttpHeaders.isKeepAlive(httpRequest),
message,
statusCode,
headers);
} | [
"public",
"static",
"CompletableFuture",
"<",
"Void",
">",
"sendResponse",
"(",
"@",
"Nonnull",
"ChannelHandlerContext",
"channelHandlerContext",
",",
"@",
"Nonnull",
"HttpRequest",
"httpRequest",
",",
"@",
"Nonnull",
"String",
"message",
",",
"@",
"Nonnull",
"HttpR... | Sends the given response and status code to the given channel.
@param channelHandlerContext identifying the open channel
@param httpRequest originating http request
@param message which should be sent
@param statusCode of the message to send
@param headers additional header values | [
"Sends",
"the",
"given",
"response",
"and",
"status",
"code",
"to",
"the",
"given",
"channel",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/util/HandlerUtils.java#L169-L182 | train | Sends a response to the server. | [
30522,
2270,
10763,
4012,
10814,
10880,
11263,
11244,
1026,
11675,
1028,
4604,
6072,
26029,
3366,
1006,
1030,
2512,
11231,
30524,
16044,
1010,
1030,
2512,
11231,
3363,
4949,
1026,
5164,
1010,
5164,
1028,
20346,
2015,
1007,
1063,
2709,
4604,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/io/BufferSpiller.java | BufferSpiller.add | @Override
public void add(BufferOrEvent boe) throws IOException {
try {
ByteBuffer contents;
if (boe.isBuffer()) {
Buffer buf = boe.getBuffer();
contents = buf.getNioBufferReadable();
}
else {
contents = EventSerializer.toSerializedEvent(boe.getEvent());
}
headBuffer.clear();
headBuffer.putInt(boe.getChannelIndex());
headBuffer.putInt(contents.remaining());
headBuffer.put((byte) (boe.isBuffer() ? 0 : 1));
headBuffer.flip();
bytesWritten += (headBuffer.remaining() + contents.remaining());
FileUtils.writeCompletely(currentChannel, headBuffer);
FileUtils.writeCompletely(currentChannel, contents);
}
finally {
if (boe.isBuffer()) {
boe.getBuffer().recycleBuffer();
}
}
} | java | @Override
public void add(BufferOrEvent boe) throws IOException {
try {
ByteBuffer contents;
if (boe.isBuffer()) {
Buffer buf = boe.getBuffer();
contents = buf.getNioBufferReadable();
}
else {
contents = EventSerializer.toSerializedEvent(boe.getEvent());
}
headBuffer.clear();
headBuffer.putInt(boe.getChannelIndex());
headBuffer.putInt(contents.remaining());
headBuffer.put((byte) (boe.isBuffer() ? 0 : 1));
headBuffer.flip();
bytesWritten += (headBuffer.remaining() + contents.remaining());
FileUtils.writeCompletely(currentChannel, headBuffer);
FileUtils.writeCompletely(currentChannel, contents);
}
finally {
if (boe.isBuffer()) {
boe.getBuffer().recycleBuffer();
}
}
} | [
"@",
"Override",
"public",
"void",
"add",
"(",
"BufferOrEvent",
"boe",
")",
"throws",
"IOException",
"{",
"try",
"{",
"ByteBuffer",
"contents",
";",
"if",
"(",
"boe",
".",
"isBuffer",
"(",
")",
")",
"{",
"Buffer",
"buf",
"=",
"boe",
".",
"getBuffer",
"... | Adds a buffer or event to the sequence of spilled buffers and events.
@param boe The buffer or event to add and spill.
@throws IOException Thrown, if the buffer of event could not be spilled. | [
"Adds",
"a",
"buffer",
"or",
"event",
"to",
"the",
"sequence",
"of",
"spilled",
"buffers",
"and",
"events",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BufferSpiller.java#L127-L155 | train | Add an event to the event store. | [
30522,
1030,
2058,
15637,
2270,
11675,
5587,
1006,
17698,
5686,
15338,
8945,
2063,
1007,
11618,
22834,
10288,
24422,
1063,
3046,
1063,
24880,
8569,
12494,
8417,
1025,
2065,
1006,
8945,
2063,
1012,
2003,
8569,
12494,
1006,
1007,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/DualInputOperator.java | DualInputOperator.accept | @Override
public void accept(Visitor<Operator<?>> visitor) {
boolean descend = visitor.preVisit(this);
if (descend) {
this.input1.accept(visitor);
this.input2.accept(visitor);
for (Operator<?> c : this.broadcastInputs.values()) {
c.accept(visitor);
}
visitor.postVisit(this);
}
} | java | @Override
public void accept(Visitor<Operator<?>> visitor) {
boolean descend = visitor.preVisit(this);
if (descend) {
this.input1.accept(visitor);
this.input2.accept(visitor);
for (Operator<?> c : this.broadcastInputs.values()) {
c.accept(visitor);
}
visitor.postVisit(this);
}
} | [
"@",
"Override",
"public",
"void",
"accept",
"(",
"Visitor",
"<",
"Operator",
"<",
"?",
">",
">",
"visitor",
")",
"{",
"boolean",
"descend",
"=",
"visitor",
".",
"preVisit",
"(",
"this",
")",
";",
"if",
"(",
"descend",
")",
"{",
"this",
".",
"input1"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/DualInputOperator.java#L277-L288 | train | Visit this operator. | [
30522,
1030,
2058,
15637,
2270,
11675,
5138,
1006,
10367,
1026,
6872,
1026,
1029,
1028,
1028,
10367,
1007,
1063,
22017,
20898,
18855,
1027,
10367,
1012,
3653,
11365,
4183,
1006,
2023,
1007,
1025,
2065,
1006,
18855,
1007,
1063,
2023,
1012,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/windowing/assigners/SlidingProcessingTimeWindows.java | SlidingProcessingTimeWindows.of | public static SlidingProcessingTimeWindows of(Time size, Time slide) {
return new SlidingProcessingTimeWindows(size.toMilliseconds(), slide.toMilliseconds(), 0);
} | java | public static SlidingProcessingTimeWindows of(Time size, Time slide) {
return new SlidingProcessingTimeWindows(size.toMilliseconds(), slide.toMilliseconds(), 0);
} | [
"public",
"static",
"SlidingProcessingTimeWindows",
"of",
"(",
"Time",
"size",
",",
"Time",
"slide",
")",
"{",
"return",
"new",
"SlidingProcessingTimeWindows",
"(",
"size",
".",
"toMilliseconds",
"(",
")",
",",
"slide",
".",
"toMilliseconds",
"(",
")",
",",
"0... | Creates a new {@code SlidingProcessingTimeWindows} {@link WindowAssigner} that assigns
elements to sliding time windows based on the element timestamp.
@param size The size of the generated windows.
@param slide The slide interval of the generated windows.
@return The time policy. | [
"Creates",
"a",
"new",
"{",
"@code",
"SlidingProcessingTimeWindows",
"}",
"{",
"@link",
"WindowAssigner",
"}",
"that",
"assigns",
"elements",
"to",
"sliding",
"time",
"windows",
"based",
"on",
"the",
"element",
"timestamp",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/assigners/SlidingProcessingTimeWindows.java#L104-L106 | train | Create a sliding processing time windows of the specified size and slide. | [
30522,
2270,
10763,
8058,
21572,
9623,
7741,
7292,
11101,
15568,
1997,
1006,
2051,
2946,
1010,
2051,
7358,
1007,
1063,
2709,
2047,
8058,
21572,
9623,
7741,
7292,
11101,
15568,
1006,
2946,
1012,
3419,
8591,
5562,
8663,
5104,
1006,
1007,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java | BeetlUtil.getClassPathTemplate | public static Template getClassPathTemplate(String path, String templateFileName) {
return getTemplate(createClassPathGroupTemplate(path), templateFileName);
} | java | public static Template getClassPathTemplate(String path, String templateFileName) {
return getTemplate(createClassPathGroupTemplate(path), templateFileName);
} | [
"public",
"static",
"Template",
"getClassPathTemplate",
"(",
"String",
"path",
",",
"String",
"templateFileName",
")",
"{",
"return",
"getTemplate",
"(",
"createClassPathGroupTemplate",
"(",
"path",
")",
",",
"templateFileName",
")",
";",
"}"
] | 获得ClassPath模板
@param path ClassPath路径
@param templateFileName 模板内容
@return 模板
@since 3.2.0 | [
"获得ClassPath模板"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java#L157-L159 | train | Get a Class path Template from a file name. | [
30522,
2270,
10763,
23561,
2131,
26266,
15069,
18532,
15725,
1006,
5164,
4130,
1010,
5164,
23561,
8873,
20844,
4168,
1007,
1063,
2709,
2131,
18532,
15725,
1006,
3443,
26266,
15069,
17058,
18532,
15725,
1006,
4130,
1007,
1010,
23561,
8873,
208... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/Runner.java | Runner.getAlgorithmsListing | private static String getAlgorithmsListing() {
StrBuilder strBuilder = new StrBuilder();
strBuilder
.appendNewLine()
.appendln("Select an algorithm to view usage: flink run examples/flink-gelly-examples_<version>.jar --algorithm <algorithm>")
.appendNewLine()
.appendln("Available algorithms:");
for (Driver algorithm : driverFactory) {
strBuilder.append(" ")
.appendFixedWidthPadRight(algorithm.getName(), 30, ' ')
.append(algorithm.getShortDescription()).appendNewLine();
}
return strBuilder.toString();
} | java | private static String getAlgorithmsListing() {
StrBuilder strBuilder = new StrBuilder();
strBuilder
.appendNewLine()
.appendln("Select an algorithm to view usage: flink run examples/flink-gelly-examples_<version>.jar --algorithm <algorithm>")
.appendNewLine()
.appendln("Available algorithms:");
for (Driver algorithm : driverFactory) {
strBuilder.append(" ")
.appendFixedWidthPadRight(algorithm.getName(), 30, ' ')
.append(algorithm.getShortDescription()).appendNewLine();
}
return strBuilder.toString();
} | [
"private",
"static",
"String",
"getAlgorithmsListing",
"(",
")",
"{",
"StrBuilder",
"strBuilder",
"=",
"new",
"StrBuilder",
"(",
")",
";",
"strBuilder",
".",
"appendNewLine",
"(",
")",
".",
"appendln",
"(",
"\"Select an algorithm to view usage: flink run examples/flink-... | List available algorithms. This is displayed to the user when no valid
algorithm is given in the program parameterization.
@return usage string listing available algorithms | [
"List",
"available",
"algorithms",
".",
"This",
"is",
"displayed",
"to",
"the",
"user",
"when",
"no",
"valid",
"algorithm",
"is",
"given",
"in",
"the",
"program",
"parameterization",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/Runner.java#L191-L207 | train | Get a string listing of available algorithms. | [
30522,
2797,
10763,
5164,
2131,
2389,
20255,
8939,
5244,
9863,
2075,
1006,
1007,
1063,
2358,
15185,
19231,
4063,
2358,
15185,
19231,
4063,
1027,
2047,
2358,
15185,
19231,
4063,
1006,
1007,
1025,
2358,
15185,
19231,
4063,
1012,
10439,
10497,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.decryptStrFromBcd | public String decryptStrFromBcd(String data, KeyType keyType) {
return decryptStrFromBcd(data, keyType, CharsetUtil.CHARSET_UTF_8);
} | java | public String decryptStrFromBcd(String data, KeyType keyType) {
return decryptStrFromBcd(data, keyType, CharsetUtil.CHARSET_UTF_8);
} | [
"public",
"String",
"decryptStrFromBcd",
"(",
"String",
"data",
",",
"KeyType",
"keyType",
")",
"{",
"return",
"decryptStrFromBcd",
"(",
"data",
",",
"keyType",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
")",
";",
"}"
] | 解密为字符串,密文需为BCD格式,编码为UTF-8格式
@param data 数据,BCD格式
@param keyType 密钥类型
@return 解密后的密文
@since 4.5.2 | [
"解密为字符串,密文需为BCD格式,编码为UTF",
"-",
"8格式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L322-L324 | train | This method is used to decrypt a string using BCD. | [
30522,
2270,
5164,
11703,
2854,
22798,
16344,
19699,
5358,
9818,
2094,
1006,
5164,
2951,
1010,
3145,
13874,
3145,
13874,
1007,
1063,
2709,
11703,
2854,
22798,
16344,
19699,
5358,
9818,
2094,
1006,
2951,
1010,
3145,
13874,
1010,
25869,
13462,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.toBuffered | public static BufferedOutputStream toBuffered(OutputStream out) {
return (out instanceof BufferedOutputStream) ? (BufferedOutputStream) out : new BufferedOutputStream(out);
} | java | public static BufferedOutputStream toBuffered(OutputStream out) {
return (out instanceof BufferedOutputStream) ? (BufferedOutputStream) out : new BufferedOutputStream(out);
} | [
"public",
"static",
"BufferedOutputStream",
"toBuffered",
"(",
"OutputStream",
"out",
")",
"{",
"return",
"(",
"out",
"instanceof",
"BufferedOutputStream",
")",
"?",
"(",
"BufferedOutputStream",
")",
"out",
":",
"new",
"BufferedOutputStream",
"(",
"out",
")",
";",... | 转换为{@link BufferedOutputStream}
@param out {@link OutputStream}
@return {@link BufferedOutputStream}
@since 4.0.10 | [
"转换为",
"{",
"@link",
"BufferedOutputStream",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L814-L816 | train | Converts an OutputStream to a buffered OutputStream. | [
30522,
2270,
10763,
17698,
26010,
4904,
18780,
21422,
2000,
8569,
12494,
2098,
1006,
27852,
25379,
2041,
1007,
1063,
2709,
1006,
2041,
6013,
11253,
17698,
26010,
4904,
18780,
21422,
1007,
1029,
1006,
17698,
26010,
4904,
18780,
21422,
1007,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java | Ftp.cd | @Override
public boolean cd(String directory) {
boolean flag = true;
try {
flag = client.changeWorkingDirectory(directory);
} catch (IOException e) {
throw new FtpException(e);
}
return flag;
} | java | @Override
public boolean cd(String directory) {
boolean flag = true;
try {
flag = client.changeWorkingDirectory(directory);
} catch (IOException e) {
throw new FtpException(e);
}
return flag;
} | [
"@",
"Override",
"public",
"boolean",
"cd",
"(",
"String",
"directory",
")",
"{",
"boolean",
"flag",
"=",
"true",
";",
"try",
"{",
"flag",
"=",
"client",
".",
"changeWorkingDirectory",
"(",
"directory",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")... | 改变目录
@param directory 目录
@return 是否成功 | [
"改变目录"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java#L207-L216 | train | Override the default implementation to change the working directory of a file. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
3729,
1006,
5164,
14176,
1007,
1063,
22017,
20898,
5210,
1027,
2995,
1025,
3046,
1063,
5210,
1027,
7396,
1012,
2689,
21398,
4305,
2890,
16761,
2100,
1006,
14176,
1007,
1025,
1065,
4608,
1006,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java | IOUtil.newInputStream | public static InputStream newInputStream(String path) throws IOException
{
if (IOAdapter == null) return new FileInputStream(path);
return IOAdapter.open(path);
} | java | public static InputStream newInputStream(String path) throws IOException
{
if (IOAdapter == null) return new FileInputStream(path);
return IOAdapter.open(path);
} | [
"public",
"static",
"InputStream",
"newInputStream",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"IOAdapter",
"==",
"null",
")",
"return",
"new",
"FileInputStream",
"(",
"path",
")",
";",
"return",
"IOAdapter",
".",
"open",
"(",
"pat... | 创建输入流(经过IO适配器创建)
@param path
@return
@throws IOException | [
"创建输入流(经过IO适配器创建)"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java#L623-L627 | train | Returns an InputStream for the given path. | [
30522,
2270,
10763,
20407,
25379,
2047,
2378,
18780,
21422,
1006,
5164,
4130,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
22834,
8447,
13876,
2121,
1027,
1027,
19701,
1007,
2709,
2047,
5371,
2378,
18780,
21422,
1006,
4130,
1007,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.create | @SuppressWarnings({ "unchecked", "rawtypes" })
public static <T> Collection<T> create(Class<?> collectionType) {
Collection<T> list = null;
if (collectionType.isAssignableFrom(AbstractCollection.class)) {
// 抽象集合默认使用ArrayList
list = new ArrayList<>();
}
// Set
else if (collectionType.isAssignableFrom(HashSet.class)) {
list = new HashSet<>();
} else if (collectionType.isAssignableFrom(LinkedHashSet.class)) {
list = new LinkedHashSet<>();
} else if (collectionType.isAssignableFrom(TreeSet.class)) {
list = new TreeSet<>();
} else if (collectionType.isAssignableFrom(EnumSet.class)) {
list = (Collection<T>) EnumSet.noneOf((Class<Enum>) ClassUtil.getTypeArgument(collectionType));
}
// List
else if (collectionType.isAssignableFrom(ArrayList.class)) {
list = new ArrayList<>();
} else if (collectionType.isAssignableFrom(LinkedList.class)) {
list = new LinkedList<>();
}
// Others,直接实例化
else {
try {
list = (Collection<T>) ReflectUtil.newInstance(collectionType);
} catch (Exception e) {
throw new UtilException(e);
}
}
return list;
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public static <T> Collection<T> create(Class<?> collectionType) {
Collection<T> list = null;
if (collectionType.isAssignableFrom(AbstractCollection.class)) {
// 抽象集合默认使用ArrayList
list = new ArrayList<>();
}
// Set
else if (collectionType.isAssignableFrom(HashSet.class)) {
list = new HashSet<>();
} else if (collectionType.isAssignableFrom(LinkedHashSet.class)) {
list = new LinkedHashSet<>();
} else if (collectionType.isAssignableFrom(TreeSet.class)) {
list = new TreeSet<>();
} else if (collectionType.isAssignableFrom(EnumSet.class)) {
list = (Collection<T>) EnumSet.noneOf((Class<Enum>) ClassUtil.getTypeArgument(collectionType));
}
// List
else if (collectionType.isAssignableFrom(ArrayList.class)) {
list = new ArrayList<>();
} else if (collectionType.isAssignableFrom(LinkedList.class)) {
list = new LinkedList<>();
}
// Others,直接实例化
else {
try {
list = (Collection<T>) ReflectUtil.newInstance(collectionType);
} catch (Exception e) {
throw new UtilException(e);
}
}
return list;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"create",
"(",
"Class",
"<",
"?",
">",
"collectionType",
")",
"{",
"Collection",
"<",
"T",
">",
"list",
"... | 创建新的集合对象
@param <T> 集合类型
@param collectionType 集合类型
@return 集合类型对应的实例
@since 3.0.8 | [
"创建新的集合对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L737-L772 | train | Creates a new instance of the specified type from the specified type. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
4895,
5403,
18141,
1000,
1010,
1000,
6315,
13874,
2015,
1000,
1065,
1007,
2270,
10763,
1026,
1056,
1028,
3074,
1026,
1056,
1028,
3443,
1006,
2465,
1026,
1029,
1028,
3074,
13874,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java | TomcatServletWebServerFactory.addContextValves | public void addContextValves(Valve... contextValves) {
Assert.notNull(contextValves, "Valves must not be null");
this.contextValves.addAll(Arrays.asList(contextValves));
} | java | public void addContextValves(Valve... contextValves) {
Assert.notNull(contextValves, "Valves must not be null");
this.contextValves.addAll(Arrays.asList(contextValves));
} | [
"public",
"void",
"addContextValves",
"(",
"Valve",
"...",
"contextValves",
")",
"{",
"Assert",
".",
"notNull",
"(",
"contextValves",
",",
"\"Valves must not be null\"",
")",
";",
"this",
".",
"contextValves",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
... | Add {@link Valve}s that should be applied to the Tomcat {@link Context}.
@param contextValves the valves to add | [
"Add",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java#L540-L543 | train | Add a list of context valves to the context. | [
30522,
2270,
11675,
5587,
8663,
18209,
10175,
6961,
1006,
10764,
1012,
1012,
1012,
6123,
10175,
6961,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
6123,
10175,
6961,
1010,
1000,
17355,
2442,
2025,
2022,
19701,
1000,
1007,
1025,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java | Matrix.getColumnPackedCopy | public double[] getColumnPackedCopy()
{
double[] vals = new double[m * n];
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
vals[i + j * m] = A[i][j];
}
}
return vals;
} | java | public double[] getColumnPackedCopy()
{
double[] vals = new double[m * n];
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
vals[i + j * m] = A[i][j];
}
}
return vals;
} | [
"public",
"double",
"[",
"]",
"getColumnPackedCopy",
"(",
")",
"{",
"double",
"[",
"]",
"vals",
"=",
"new",
"double",
"[",
"m",
"*",
"n",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m",
";",
"i",
"++",
")",
"{",
"for",
"(",
... | Make a one-dimensional column packed copy of the internal array.
@return Matrix elements packed in a one-dimensional array by columns. | [
"Make",
"a",
"one",
"-",
"dimensional",
"column",
"packed",
"copy",
"of",
"the",
"internal",
"array",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L283-L294 | train | Get column packed copy of the A matrix. | [
30522,
2270,
3313,
1031,
1033,
2131,
25778,
2819,
16275,
8684,
2098,
3597,
7685,
1006,
1007,
1063,
3313,
1031,
1033,
11748,
2015,
1027,
2047,
3313,
1031,
1049,
1008,
1050,
1033,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/NShort/Path/NShortPath.java | NShortPath.getNPaths | public List<int[]> getNPaths(int n)
{
List<int[]> result = new ArrayList<int[]>();
n = Math.min(Predefine.MAX_SEGMENT_NUM, n);
for (int i = 0; i < N && result.size() < n; ++i)
{
List<int[]> pathList = getPaths(i);
for (int[] path : pathList)
{
if (result.size() == n) break;
result.add(path);
}
}
return result;
} | java | public List<int[]> getNPaths(int n)
{
List<int[]> result = new ArrayList<int[]>();
n = Math.min(Predefine.MAX_SEGMENT_NUM, n);
for (int i = 0; i < N && result.size() < n; ++i)
{
List<int[]> pathList = getPaths(i);
for (int[] path : pathList)
{
if (result.size() == n) break;
result.add(path);
}
}
return result;
} | [
"public",
"List",
"<",
"int",
"[",
"]",
">",
"getNPaths",
"(",
"int",
"n",
")",
"{",
"List",
"<",
"int",
"[",
"]",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"int",
"[",
"]",
">",
"(",
")",
";",
"n",
"=",
"Math",
".",
"min",
"(",
"Predefine... | 从短到长获取至多 n 条路径
@param n
@return | [
"从短到长获取至多",
"n",
"条路径"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/NShort/Path/NShortPath.java#L262-L278 | train | Get n paths in a list of int array. | [
30522,
2270,
2862,
1026,
20014,
1031,
1033,
1028,
2131,
16275,
8988,
2015,
1006,
20014,
1050,
1007,
1063,
2862,
1026,
20014,
1031,
1033,
1028,
2765,
1027,
2047,
9140,
9863,
1026,
20014,
1031,
1033,
1028,
1006,
1007,
1025,
1050,
1027,
8785,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HeapPriorityQueueSet.java | HeapPriorityQueueSet.remove | @Override
public boolean remove(@Nonnull T toRemove) {
T storedElement = getDedupMapForElement(toRemove).remove(toRemove);
return storedElement != null && super.remove(storedElement);
} | java | @Override
public boolean remove(@Nonnull T toRemove) {
T storedElement = getDedupMapForElement(toRemove).remove(toRemove);
return storedElement != null && super.remove(storedElement);
} | [
"@",
"Override",
"public",
"boolean",
"remove",
"(",
"@",
"Nonnull",
"T",
"toRemove",
")",
"{",
"T",
"storedElement",
"=",
"getDedupMapForElement",
"(",
"toRemove",
")",
".",
"remove",
"(",
"toRemove",
")",
";",
"return",
"storedElement",
"!=",
"null",
"&&",... | In contrast to the superclass and to maintain set semantics, removal here is based on comparing the given element
via {@link #equals(Object)}.
@return <code>true</code> if the operation changed the head element or if is it unclear if the head element changed.
Only returns <code>false</code> iff the head element was not changed by this operation. | [
"In",
"contrast",
"to",
"the",
"superclass",
"and",
"to",
"maintain",
"set",
"semantics",
"removal",
"here",
"is",
"based",
"on",
"comparing",
"the",
"given",
"element",
"via",
"{",
"@link",
"#equals",
"(",
"Object",
")",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapPriorityQueueSet.java#L131-L135 | train | Removes the given element from the map. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
6366,
1006,
1030,
2512,
11231,
3363,
1056,
9538,
5302,
3726,
1007,
1063,
1056,
8250,
12260,
3672,
1027,
2131,
5732,
6279,
2863,
14376,
5686,
16930,
4765,
1006,
9538,
5302,
3726,
1007,
1012,
6366... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBStateBackend.java | RocksDBStateBackend.setDbStoragePaths | public void setDbStoragePaths(String... paths) {
if (paths == null) {
localRocksDbDirectories = null;
}
else if (paths.length == 0) {
throw new IllegalArgumentException("empty paths");
}
else {
File[] pp = new File[paths.length];
for (int i = 0; i < paths.length; i++) {
final String rawPath = paths[i];
final String path;
if (rawPath == null) {
throw new IllegalArgumentException("null path");
}
else {
// we need this for backwards compatibility, to allow URIs like 'file:///'...
URI uri = null;
try {
uri = new Path(rawPath).toUri();
}
catch (Exception e) {
// cannot parse as a path
}
if (uri != null && uri.getScheme() != null) {
if ("file".equalsIgnoreCase(uri.getScheme())) {
path = uri.getPath();
}
else {
throw new IllegalArgumentException("Path " + rawPath + " has a non-local scheme");
}
}
else {
path = rawPath;
}
}
pp[i] = new File(path);
if (!pp[i].isAbsolute()) {
throw new IllegalArgumentException("Relative paths are not supported");
}
}
localRocksDbDirectories = pp;
}
} | java | public void setDbStoragePaths(String... paths) {
if (paths == null) {
localRocksDbDirectories = null;
}
else if (paths.length == 0) {
throw new IllegalArgumentException("empty paths");
}
else {
File[] pp = new File[paths.length];
for (int i = 0; i < paths.length; i++) {
final String rawPath = paths[i];
final String path;
if (rawPath == null) {
throw new IllegalArgumentException("null path");
}
else {
// we need this for backwards compatibility, to allow URIs like 'file:///'...
URI uri = null;
try {
uri = new Path(rawPath).toUri();
}
catch (Exception e) {
// cannot parse as a path
}
if (uri != null && uri.getScheme() != null) {
if ("file".equalsIgnoreCase(uri.getScheme())) {
path = uri.getPath();
}
else {
throw new IllegalArgumentException("Path " + rawPath + " has a non-local scheme");
}
}
else {
path = rawPath;
}
}
pp[i] = new File(path);
if (!pp[i].isAbsolute()) {
throw new IllegalArgumentException("Relative paths are not supported");
}
}
localRocksDbDirectories = pp;
}
} | [
"public",
"void",
"setDbStoragePaths",
"(",
"String",
"...",
"paths",
")",
"{",
"if",
"(",
"paths",
"==",
"null",
")",
"{",
"localRocksDbDirectories",
"=",
"null",
";",
"}",
"else",
"if",
"(",
"paths",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new"... | Sets the directories in which the local RocksDB database puts its files (like SST and
metadata files). These directories do not need to be persistent, they can be ephemeral,
meaning that they are lost on a machine failure, because state in RocksDB is persisted
in checkpoints.
<p>If nothing is configured, these directories default to the TaskManager's local
temporary file directories.
<p>Each distinct state will be stored in one path, but when the state backend creates
multiple states, they will store their files on different paths.
<p>Passing {@code null} to this function restores the default behavior, where the configured
temp directories will be used.
@param paths The paths across which the local RocksDB database files will be spread. | [
"Sets",
"the",
"directories",
"in",
"which",
"the",
"local",
"RocksDB",
"database",
"puts",
"its",
"files",
"(",
"like",
"SST",
"and",
"metadata",
"files",
")",
".",
"These",
"directories",
"do",
"not",
"need",
"to",
"be",
"persistent",
"they",
"can",
"be"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBStateBackend.java#L622-L670 | train | Sets the paths to the local db storage directories. | [
30522,
2270,
11675,
2275,
18939,
23809,
4270,
15069,
2015,
1006,
5164,
1012,
1012,
1012,
10425,
1007,
1063,
2065,
1006,
10425,
1027,
1027,
19701,
1007,
1063,
2334,
16901,
16150,
2497,
4305,
2890,
16761,
3111,
1027,
19701,
1025,
1065,
2842,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/trigram/CharacterBasedGenerativeModel.java | CharacterBasedGenerativeModel.log_prob | double log_prob(char s1, int i1, char s2, int i2, char s3, int i3)
{
if (transMatrix[i1][i2][i3] == 0)
return inf;
char t1 = id2tag[i1];
char t2 = id2tag[i2];
char t3 = id2tag[i3];
double uni = l1 * tf.freq(s3,t3);
double bi = div(l2 * tf.get(s2,t2, s3,t3), tf.get(s2,t2));
double tri = div(l3 * tf.get(s1,t1, s2,t2, s3,t3), tf.get(s1,t1, s2,t2));
if (uni + bi + tri == 0)
return inf;
return Math.log(uni + bi + tri);
} | java | double log_prob(char s1, int i1, char s2, int i2, char s3, int i3)
{
if (transMatrix[i1][i2][i3] == 0)
return inf;
char t1 = id2tag[i1];
char t2 = id2tag[i2];
char t3 = id2tag[i3];
double uni = l1 * tf.freq(s3,t3);
double bi = div(l2 * tf.get(s2,t2, s3,t3), tf.get(s2,t2));
double tri = div(l3 * tf.get(s1,t1, s2,t2, s3,t3), tf.get(s1,t1, s2,t2));
if (uni + bi + tri == 0)
return inf;
return Math.log(uni + bi + tri);
} | [
"double",
"log_prob",
"(",
"char",
"s1",
",",
"int",
"i1",
",",
"char",
"s2",
",",
"int",
"i2",
",",
"char",
"s3",
",",
"int",
"i3",
")",
"{",
"if",
"(",
"transMatrix",
"[",
"i1",
"]",
"[",
"i2",
"]",
"[",
"i3",
"]",
"==",
"0",
")",
"return",... | 求概率
@param s1 前2个字
@param s1 前2个状态的下标
@param s2 前1个字
@param s2 前1个状态的下标
@param s3 当前字
@param s3 当前状态的下标
@return 序列的概率 | [
"求概率"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/trigram/CharacterBasedGenerativeModel.java#L157-L170 | train | log_prob for a sequence of characters | [
30522,
3313,
8833,
1035,
4013,
2497,
1006,
25869,
1055,
2487,
1010,
20014,
1045,
2487,
1010,
25869,
1055,
2475,
1010,
20014,
1045,
2475,
1010,
25869,
1055,
2509,
1010,
20014,
1045,
2509,
1007,
1063,
2065,
1006,
9099,
18900,
17682,
1031,
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... |
apache/flink | flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/HadoopInputFormatBase.java | HadoopInputFormatBase.configure | @Override
public void configure(Configuration parameters) {
// enforce sequential configuration() calls
synchronized (CONFIGURE_MUTEX) {
// configure MR InputFormat if necessary
if (this.mapredInputFormat instanceof Configurable) {
((Configurable) this.mapredInputFormat).setConf(this.jobConf);
} else if (this.mapredInputFormat instanceof JobConfigurable) {
((JobConfigurable) this.mapredInputFormat).configure(this.jobConf);
}
}
} | java | @Override
public void configure(Configuration parameters) {
// enforce sequential configuration() calls
synchronized (CONFIGURE_MUTEX) {
// configure MR InputFormat if necessary
if (this.mapredInputFormat instanceof Configurable) {
((Configurable) this.mapredInputFormat).setConf(this.jobConf);
} else if (this.mapredInputFormat instanceof JobConfigurable) {
((JobConfigurable) this.mapredInputFormat).configure(this.jobConf);
}
}
} | [
"@",
"Override",
"public",
"void",
"configure",
"(",
"Configuration",
"parameters",
")",
"{",
"// enforce sequential configuration() calls",
"synchronized",
"(",
"CONFIGURE_MUTEX",
")",
"{",
"// configure MR InputFormat if necessary",
"if",
"(",
"this",
".",
"mapredInputFor... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/HadoopInputFormatBase.java#L103-L115 | train | Override this method to configure the MR InputFormat. | [
30522,
1030,
2058,
15637,
2270,
11675,
9530,
8873,
27390,
2063,
1006,
9563,
11709,
1007,
1063,
1013,
1013,
16306,
25582,
9563,
1006,
1007,
4455,
25549,
1006,
9530,
8873,
27390,
2063,
1035,
20101,
2595,
1007,
1063,
1013,
1013,
9530,
8873,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.extName | public static String extName(File file) {
if (null == file) {
return null;
}
if (file.isDirectory()) {
return null;
}
return extName(file.getName());
} | java | public static String extName(File file) {
if (null == file) {
return null;
}
if (file.isDirectory()) {
return null;
}
return extName(file.getName());
} | [
"public",
"static",
"String",
"extName",
"(",
"File",
"file",
")",
"{",
"if",
"(",
"null",
"==",
"file",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"extName... | 获取文件扩展名,扩展名不带“.”
@param file 文件
@return 扩展名 | [
"获取文件扩展名,扩展名不带“",
".",
"”"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1806-L1814 | train | Returns the name of the file extension. | [
30522,
2270,
10763,
5164,
4654,
2102,
18442,
1006,
5371,
5371,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
5371,
1007,
1063,
2709,
19701,
1025,
1065,
2065,
1006,
5371,
1012,
2003,
4305,
2890,
16761,
2100,
1006,
1007,
1007,
1063,
2709,
19701,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslHandler.java | SslHandler.isEncrypted | public static boolean isEncrypted(ByteBuf buffer) {
if (buffer.readableBytes() < SslUtils.SSL_RECORD_HEADER_LENGTH) {
throw new IllegalArgumentException(
"buffer must have at least " + SslUtils.SSL_RECORD_HEADER_LENGTH + " readable bytes");
}
return getEncryptedPacketLength(buffer, buffer.readerIndex()) != SslUtils.NOT_ENCRYPTED;
} | java | public static boolean isEncrypted(ByteBuf buffer) {
if (buffer.readableBytes() < SslUtils.SSL_RECORD_HEADER_LENGTH) {
throw new IllegalArgumentException(
"buffer must have at least " + SslUtils.SSL_RECORD_HEADER_LENGTH + " readable bytes");
}
return getEncryptedPacketLength(buffer, buffer.readerIndex()) != SslUtils.NOT_ENCRYPTED;
} | [
"public",
"static",
"boolean",
"isEncrypted",
"(",
"ByteBuf",
"buffer",
")",
"{",
"if",
"(",
"buffer",
".",
"readableBytes",
"(",
")",
"<",
"SslUtils",
".",
"SSL_RECORD_HEADER_LENGTH",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"buffer must have ... | Returns {@code true} if the given {@link ByteBuf} is encrypted. Be aware that this method
will not increase the readerIndex of the given {@link ByteBuf}.
@param buffer
The {@link ByteBuf} to read from. Be aware that it must have at least 5 bytes to read,
otherwise it will throw an {@link IllegalArgumentException}.
@return encrypted
{@code true} if the {@link ByteBuf} is encrypted, {@code false} otherwise.
@throws IllegalArgumentException
Is thrown if the given {@link ByteBuf} has not at least 5 bytes to read. | [
"Returns",
"{",
"@code",
"true",
"}",
"if",
"the",
"given",
"{",
"@link",
"ByteBuf",
"}",
"is",
"encrypted",
".",
"Be",
"aware",
"that",
"this",
"method",
"will",
"not",
"increase",
"the",
"readerIndex",
"of",
"the",
"given",
"{",
"@link",
"ByteBuf",
"}"... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslHandler.java#L1181-L1187 | train | Checks if the buffer contains encrypted data. | [
30522,
2270,
10763,
22017,
20898,
2003,
2368,
26775,
22571,
3064,
1006,
24880,
8569,
2546,
17698,
1007,
1063,
2065,
1006,
17698,
1012,
3191,
3085,
3762,
4570,
1006,
1007,
30524,
1000,
3191,
3085,
27507,
1000,
1007,
1025,
1065,
2709,
2131,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/Segment.java | Segment.mergeNumberQuantifier | protected void mergeNumberQuantifier(List<Vertex> termList, WordNet wordNetAll, Config config)
{
if (termList.size() < 4) return;
StringBuilder sbQuantifier = new StringBuilder();
ListIterator<Vertex> iterator = termList.listIterator();
iterator.next();
int line = 1;
while (iterator.hasNext())
{
Vertex pre = iterator.next();
if (pre.hasNature(Nature.m))
{
sbQuantifier.append(pre.realWord);
Vertex cur = null;
while (iterator.hasNext() && (cur = iterator.next()).hasNature(Nature.m))
{
sbQuantifier.append(cur.realWord);
iterator.remove();
removeFromWordNet(cur, wordNetAll, line, sbQuantifier.length());
}
if (cur != null)
{
if ((cur.hasNature(Nature.q) || cur.hasNature(Nature.qv) || cur.hasNature(Nature.qt)))
{
if (config.indexMode > 0)
{
wordNetAll.add(line, new Vertex(sbQuantifier.toString(), new CoreDictionary.Attribute(Nature.m)));
}
sbQuantifier.append(cur.realWord);
iterator.remove();
removeFromWordNet(cur, wordNetAll, line, sbQuantifier.length());
}
else
{
line += cur.realWord.length(); // (cur = iterator.next()).hasNature(Nature.m) 最后一个next可能不含q词性
}
}
if (sbQuantifier.length() != pre.realWord.length())
{
for (Vertex vertex : wordNetAll.get(line + pre.realWord.length()))
{
vertex.from = null;
}
pre.realWord = sbQuantifier.toString();
pre.word = Predefine.TAG_NUMBER;
pre.attribute = new CoreDictionary.Attribute(Nature.mq);
pre.wordID = CoreDictionary.M_WORD_ID;
sbQuantifier.setLength(0);
}
}
sbQuantifier.setLength(0);
line += pre.realWord.length();
}
// System.out.println(wordNetAll);
} | java | protected void mergeNumberQuantifier(List<Vertex> termList, WordNet wordNetAll, Config config)
{
if (termList.size() < 4) return;
StringBuilder sbQuantifier = new StringBuilder();
ListIterator<Vertex> iterator = termList.listIterator();
iterator.next();
int line = 1;
while (iterator.hasNext())
{
Vertex pre = iterator.next();
if (pre.hasNature(Nature.m))
{
sbQuantifier.append(pre.realWord);
Vertex cur = null;
while (iterator.hasNext() && (cur = iterator.next()).hasNature(Nature.m))
{
sbQuantifier.append(cur.realWord);
iterator.remove();
removeFromWordNet(cur, wordNetAll, line, sbQuantifier.length());
}
if (cur != null)
{
if ((cur.hasNature(Nature.q) || cur.hasNature(Nature.qv) || cur.hasNature(Nature.qt)))
{
if (config.indexMode > 0)
{
wordNetAll.add(line, new Vertex(sbQuantifier.toString(), new CoreDictionary.Attribute(Nature.m)));
}
sbQuantifier.append(cur.realWord);
iterator.remove();
removeFromWordNet(cur, wordNetAll, line, sbQuantifier.length());
}
else
{
line += cur.realWord.length(); // (cur = iterator.next()).hasNature(Nature.m) 最后一个next可能不含q词性
}
}
if (sbQuantifier.length() != pre.realWord.length())
{
for (Vertex vertex : wordNetAll.get(line + pre.realWord.length()))
{
vertex.from = null;
}
pre.realWord = sbQuantifier.toString();
pre.word = Predefine.TAG_NUMBER;
pre.attribute = new CoreDictionary.Attribute(Nature.mq);
pre.wordID = CoreDictionary.M_WORD_ID;
sbQuantifier.setLength(0);
}
}
sbQuantifier.setLength(0);
line += pre.realWord.length();
}
// System.out.println(wordNetAll);
} | [
"protected",
"void",
"mergeNumberQuantifier",
"(",
"List",
"<",
"Vertex",
">",
"termList",
",",
"WordNet",
"wordNetAll",
",",
"Config",
"config",
")",
"{",
"if",
"(",
"termList",
".",
"size",
"(",
")",
"<",
"4",
")",
"return",
";",
"StringBuilder",
"sbQuan... | 合并数字
@param termList | [
"合并数字"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Segment.java#L405-L459 | train | Merge number quantifier. | [
30522,
5123,
11675,
13590,
19172,
5677,
16211,
16778,
8873,
2121,
1006,
2862,
1026,
19449,
1028,
2744,
9863,
1010,
2773,
7159,
2773,
7159,
8095,
1010,
9530,
8873,
2290,
9530,
8873,
2290,
1007,
1063,
2065,
1006,
2744,
9863,
1012,
2946,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java | TaskExecutorBuilder.customizers | public TaskExecutorBuilder customizers(TaskExecutorCustomizer... customizers) {
Assert.notNull(customizers, "Customizers must not be null");
return customizers(Arrays.asList(customizers));
} | java | public TaskExecutorBuilder customizers(TaskExecutorCustomizer... customizers) {
Assert.notNull(customizers, "Customizers must not be null");
return customizers(Arrays.asList(customizers));
} | [
"public",
"TaskExecutorBuilder",
"customizers",
"(",
"TaskExecutorCustomizer",
"...",
"customizers",
")",
"{",
"Assert",
".",
"notNull",
"(",
"customizers",
",",
"\"Customizers must not be null\"",
")",
";",
"return",
"customizers",
"(",
"Arrays",
".",
"asList",
"(",
... | Set the {@link TaskExecutorCustomizer TaskExecutorCustomizers} that should be
applied to the {@link ThreadPoolTaskExecutor}. Customizers are applied in the order
that they were added after builder configuration has been applied. Setting this
value will replace any previously configured customizers.
@param customizers the customizers to set
@return a new builder instance
@see #additionalCustomizers(TaskExecutorCustomizer...) | [
"Set",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java#L232-L235 | train | Add custom Task Executor Customizers to the builder. | [
30522,
2270,
4708,
10288,
8586,
16161,
15185,
19231,
4063,
7661,
17629,
2015,
1006,
4708,
30524,
2004,
9863,
1006,
7661,
17629,
2015,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCAppendTableSinkBuilder.java | JDBCAppendTableSinkBuilder.build | public JDBCAppendTableSink build() {
Preconditions.checkNotNull(parameterTypes,
"Types of the query parameters are not specified." +
" Please specify types using the setParameterTypes() method.");
JDBCOutputFormat format = JDBCOutputFormat.buildJDBCOutputFormat()
.setUsername(username)
.setPassword(password)
.setDBUrl(dbURL)
.setQuery(query)
.setDrivername(driverName)
.setBatchInterval(batchSize)
.setSqlTypes(parameterTypes)
.finish();
return new JDBCAppendTableSink(format);
} | java | public JDBCAppendTableSink build() {
Preconditions.checkNotNull(parameterTypes,
"Types of the query parameters are not specified." +
" Please specify types using the setParameterTypes() method.");
JDBCOutputFormat format = JDBCOutputFormat.buildJDBCOutputFormat()
.setUsername(username)
.setPassword(password)
.setDBUrl(dbURL)
.setQuery(query)
.setDrivername(driverName)
.setBatchInterval(batchSize)
.setSqlTypes(parameterTypes)
.finish();
return new JDBCAppendTableSink(format);
} | [
"public",
"JDBCAppendTableSink",
"build",
"(",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"parameterTypes",
",",
"\"Types of the query parameters are not specified.\"",
"+",
"\" Please specify types using the setParameterTypes() method.\"",
")",
";",
"JDBCOutputFormat",
... | Finalizes the configuration and checks validity.
@return Configured JDBCOutputFormat | [
"Finalizes",
"the",
"configuration",
"and",
"checks",
"validity",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCAppendTableSinkBuilder.java#L123-L139 | train | Build the table sink. | [
30522,
2270,
26219,
9818,
29098,
10497,
10880,
11493,
2243,
3857,
1006,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
16381,
13874,
2015,
1010,
1000,
4127,
1997,
1996,
23032,
11709,
2024,
2025,
9675,
1012,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/KryoUtils.java | KryoUtils.applyRegistrations | public static void applyRegistrations(Kryo kryo, Collection<KryoRegistration> resolvedRegistrations) {
Serializer<?> serializer;
for (KryoRegistration registration : resolvedRegistrations) {
serializer = registration.getSerializer(kryo);
if (serializer != null) {
kryo.register(registration.getRegisteredClass(), serializer, kryo.getNextRegistrationId());
} else {
kryo.register(registration.getRegisteredClass(), kryo.getNextRegistrationId());
}
}
} | java | public static void applyRegistrations(Kryo kryo, Collection<KryoRegistration> resolvedRegistrations) {
Serializer<?> serializer;
for (KryoRegistration registration : resolvedRegistrations) {
serializer = registration.getSerializer(kryo);
if (serializer != null) {
kryo.register(registration.getRegisteredClass(), serializer, kryo.getNextRegistrationId());
} else {
kryo.register(registration.getRegisteredClass(), kryo.getNextRegistrationId());
}
}
} | [
"public",
"static",
"void",
"applyRegistrations",
"(",
"Kryo",
"kryo",
",",
"Collection",
"<",
"KryoRegistration",
">",
"resolvedRegistrations",
")",
"{",
"Serializer",
"<",
"?",
">",
"serializer",
";",
"for",
"(",
"KryoRegistration",
"registration",
":",
"resolve... | Apply a list of {@link KryoRegistration} to a Kryo instance. The list of registrations is
assumed to already be a final resolution of all possible registration overwrites.
<p>The registrations are applied in the given order and always specify the registration id as
the next available id in the Kryo instance (providing the id just extra ensures nothing is
overwritten, and isn't strictly required);
@param kryo the Kryo instance to apply the registrations
@param resolvedRegistrations the registrations, which should already be resolved of all possible registration overwrites | [
"Apply",
"a",
"list",
"of",
"{",
"@link",
"KryoRegistration",
"}",
"to",
"a",
"Kryo",
"instance",
".",
"The",
"list",
"of",
"registrations",
"is",
"assumed",
"to",
"already",
"be",
"a",
"final",
"resolution",
"of",
"all",
"possible",
"registration",
"overwri... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/KryoUtils.java#L103-L115 | train | Apply the given collection of registered KryoRegistrations to the Kryo instance. | [
30522,
2270,
10763,
11675,
6611,
2890,
24063,
28893,
1006,
1047,
2854,
2080,
1047,
2854,
2080,
1010,
3074,
1026,
1047,
2854,
5686,
24063,
8156,
1028,
10395,
2890,
24063,
28893,
1007,
1063,
7642,
17629,
1026,
1029,
1028,
7642,
17629,
1025,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/cluster/Cluster.java | Cluster.centroid_vector | SparseVector centroid_vector()
{
if (documents_.size() > 0 && composite_.size() == 0)
set_composite_vector();
centroid_ = (SparseVector) composite_vector().clone();
centroid_.normalize();
return centroid_;
} | java | SparseVector centroid_vector()
{
if (documents_.size() > 0 && composite_.size() == 0)
set_composite_vector();
centroid_ = (SparseVector) composite_vector().clone();
centroid_.normalize();
return centroid_;
} | [
"SparseVector",
"centroid_vector",
"(",
")",
"{",
"if",
"(",
"documents_",
".",
"size",
"(",
")",
">",
"0",
"&&",
"composite_",
".",
"size",
"(",
")",
"==",
"0",
")",
"set_composite_vector",
"(",
")",
";",
"centroid_",
"=",
"(",
"SparseVector",
")",
"c... | Get the pointer of a centroid vector.
@return the pointer of a centroid vector | [
"Get",
"the",
"pointer",
"of",
"a",
"centroid",
"vector",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/Cluster.java#L81-L88 | train | Returns the centroid vector. | [
30522,
20288,
3726,
16761,
18120,
3593,
1035,
9207,
1006,
1007,
1063,
2065,
1006,
5491,
1035,
1012,
2946,
1006,
1007,
1028,
1014,
1004,
1004,
12490,
1035,
1012,
2946,
1006,
1007,
1027,
1027,
1014,
1007,
2275,
1035,
12490,
1035,
9207,
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/AbsSetting.java | AbsSetting.getChar | public Character getChar(String key, String group) {
final String value = getByGroup(key, group);
if (StrUtil.isBlank(value)) {
return null;
}
return value.charAt(0);
} | java | public Character getChar(String key, String group) {
final String value = getByGroup(key, group);
if (StrUtil.isBlank(value)) {
return null;
}
return value.charAt(0);
} | [
"public",
"Character",
"getChar",
"(",
"String",
"key",
",",
"String",
"group",
")",
"{",
"final",
"String",
"value",
"=",
"getByGroup",
"(",
"key",
",",
"group",
")",
";",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"value",
")",
")",
"{",
"return",
... | 获取char类型属性值
@param key 属性名
@param group 分组名
@return 属性值 | [
"获取char类型属性值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java#L224-L230 | train | Gets a character value from the group. | [
30522,
2270,
2839,
2131,
7507,
2099,
1006,
5164,
3145,
1010,
5164,
2177,
1007,
1063,
2345,
5164,
3643,
1027,
2131,
3762,
17058,
1006,
3145,
1010,
2177,
1007,
1025,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
3643,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImpl.java | HiveSessionImpl.setConf | private static void setConf(String varname, String key, String varvalue, boolean register)
throws IllegalArgumentException {
HiveConf conf = SessionState.get().getConf();
String value = new VariableSubstitution().substitute(conf, varvalue);
if (conf.getBoolVar(HiveConf.ConfVars.HIVECONFVALIDATION)) {
HiveConf.ConfVars confVars = HiveConf.getConfVars(key);
if (confVars != null) {
if (!confVars.isType(value)) {
StringBuilder message = new StringBuilder();
message.append("'SET ").append(varname).append('=').append(varvalue);
message.append("' FAILED because ").append(key).append(" expects ");
message.append(confVars.typeString()).append(" type value.");
throw new IllegalArgumentException(message.toString());
}
String fail = confVars.validate(value);
if (fail != null) {
StringBuilder message = new StringBuilder();
message.append("'SET ").append(varname).append('=').append(varvalue);
message.append("' FAILED in validation : ").append(fail).append('.');
throw new IllegalArgumentException(message.toString());
}
} else if (key.startsWith("hive.")) {
throw new IllegalArgumentException("hive configuration " + key + " does not exists.");
}
}
conf.verifyAndSet(key, value);
if (register) {
SessionState.get().getOverriddenConfigurations().put(key, value);
}
} | java | private static void setConf(String varname, String key, String varvalue, boolean register)
throws IllegalArgumentException {
HiveConf conf = SessionState.get().getConf();
String value = new VariableSubstitution().substitute(conf, varvalue);
if (conf.getBoolVar(HiveConf.ConfVars.HIVECONFVALIDATION)) {
HiveConf.ConfVars confVars = HiveConf.getConfVars(key);
if (confVars != null) {
if (!confVars.isType(value)) {
StringBuilder message = new StringBuilder();
message.append("'SET ").append(varname).append('=').append(varvalue);
message.append("' FAILED because ").append(key).append(" expects ");
message.append(confVars.typeString()).append(" type value.");
throw new IllegalArgumentException(message.toString());
}
String fail = confVars.validate(value);
if (fail != null) {
StringBuilder message = new StringBuilder();
message.append("'SET ").append(varname).append('=').append(varvalue);
message.append("' FAILED in validation : ").append(fail).append('.');
throw new IllegalArgumentException(message.toString());
}
} else if (key.startsWith("hive.")) {
throw new IllegalArgumentException("hive configuration " + key + " does not exists.");
}
}
conf.verifyAndSet(key, value);
if (register) {
SessionState.get().getOverriddenConfigurations().put(key, value);
}
} | [
"private",
"static",
"void",
"setConf",
"(",
"String",
"varname",
",",
"String",
"key",
",",
"String",
"varvalue",
",",
"boolean",
"register",
")",
"throws",
"IllegalArgumentException",
"{",
"HiveConf",
"conf",
"=",
"SessionState",
".",
"get",
"(",
")",
".",
... | returns non-null string for validation fail | [
"returns",
"non",
"-",
"null",
"string",
"for",
"validation",
"fail"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImpl.java#L263-L292 | train | Set a configuration variable. | [
30522,
2797,
10763,
11675,
2275,
8663,
2546,
1006,
5164,
13075,
18442,
1010,
5164,
3145,
1010,
5164,
13075,
10175,
5657,
1010,
22017,
20898,
4236,
1007,
11618,
6206,
2906,
22850,
15781,
2595,
24422,
1063,
26736,
8663,
2546,
9530,
2546,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java | CheckpointCoordinator.createActivatorDeactivator | public JobStatusListener createActivatorDeactivator() {
synchronized (lock) {
if (shutdown) {
throw new IllegalArgumentException("Checkpoint coordinator is shut down");
}
if (jobStatusListener == null) {
jobStatusListener = new CheckpointCoordinatorDeActivator(this);
}
return jobStatusListener;
}
} | java | public JobStatusListener createActivatorDeactivator() {
synchronized (lock) {
if (shutdown) {
throw new IllegalArgumentException("Checkpoint coordinator is shut down");
}
if (jobStatusListener == null) {
jobStatusListener = new CheckpointCoordinatorDeActivator(this);
}
return jobStatusListener;
}
} | [
"public",
"JobStatusListener",
"createActivatorDeactivator",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"shutdown",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Checkpoint coordinator is shut down\"",
")",
";",
"}",
"if",
"(",
... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java#L1278-L1290 | train | Create a new deactivator for the checkpoint coordinator. | [
30522,
2270,
5841,
29336,
2271,
9863,
24454,
3443,
18908,
11444,
4263,
3207,
18908,
11444,
4263,
1006,
1007,
1063,
25549,
1006,
5843,
1007,
1063,
2065,
1006,
3844,
7698,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodec.java | Http2FrameCodec.onStreamError | @Override
protected final void onStreamError(ChannelHandlerContext ctx, boolean outbound, Throwable cause,
Http2Exception.StreamException streamException) {
int streamId = streamException.streamId();
Http2Stream connectionStream = connection().stream(streamId);
if (connectionStream == null) {
onHttp2UnknownStreamError(ctx, cause, streamException);
// Write a RST_STREAM
super.onStreamError(ctx, outbound, cause, streamException);
return;
}
Http2FrameStream stream = connectionStream.getProperty(streamKey);
if (stream == null) {
LOG.warn("Stream exception thrown without stream object attached.", cause);
// Write a RST_STREAM
super.onStreamError(ctx, outbound, cause, streamException);
return;
}
if (!outbound) {
// We only forward non outbound errors as outbound errors will already be reflected by failing the promise.
onHttp2FrameStreamException(ctx, new Http2FrameStreamException(stream, streamException.error(), cause));
}
} | java | @Override
protected final void onStreamError(ChannelHandlerContext ctx, boolean outbound, Throwable cause,
Http2Exception.StreamException streamException) {
int streamId = streamException.streamId();
Http2Stream connectionStream = connection().stream(streamId);
if (connectionStream == null) {
onHttp2UnknownStreamError(ctx, cause, streamException);
// Write a RST_STREAM
super.onStreamError(ctx, outbound, cause, streamException);
return;
}
Http2FrameStream stream = connectionStream.getProperty(streamKey);
if (stream == null) {
LOG.warn("Stream exception thrown without stream object attached.", cause);
// Write a RST_STREAM
super.onStreamError(ctx, outbound, cause, streamException);
return;
}
if (!outbound) {
// We only forward non outbound errors as outbound errors will already be reflected by failing the promise.
onHttp2FrameStreamException(ctx, new Http2FrameStreamException(stream, streamException.error(), cause));
}
} | [
"@",
"Override",
"protected",
"final",
"void",
"onStreamError",
"(",
"ChannelHandlerContext",
"ctx",
",",
"boolean",
"outbound",
",",
"Throwable",
"cause",
",",
"Http2Exception",
".",
"StreamException",
"streamException",
")",
"{",
"int",
"streamId",
"=",
"streamExc... | Exceptions for unknown streams, that is streams that have no {@link Http2FrameStream} object attached
are simply logged and replied to by sending a RST_STREAM frame. | [
"Exceptions",
"for",
"unknown",
"streams",
"that",
"is",
"streams",
"that",
"have",
"no",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodec.java#L477-L501 | train | Override to handle stream error. | [
30522,
1030,
2058,
15637,
5123,
2345,
11675,
2006,
21422,
2121,
29165,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
22017,
20898,
2041,
15494,
1010,
5466,
3085,
3426,
1010,
8299,
2475,
10288,
24422,
1012,
5460,
10288,
24422,
5460,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.setDeprecatedProperties | public void setDeprecatedProperties() {
DeprecationContext deprecations = deprecationContext.get();
Properties props = getProps();
Properties overlay = getOverlay();
for (Map.Entry<String, DeprecatedKeyInfo> entry :
deprecations.getDeprecatedKeyMap().entrySet()) {
String depKey = entry.getKey();
if (!overlay.contains(depKey)) {
for (String newKey : entry.getValue().newKeys) {
String val = overlay.getProperty(newKey);
if (val != null) {
props.setProperty(depKey, val);
overlay.setProperty(depKey, val);
break;
}
}
}
}
} | java | public void setDeprecatedProperties() {
DeprecationContext deprecations = deprecationContext.get();
Properties props = getProps();
Properties overlay = getOverlay();
for (Map.Entry<String, DeprecatedKeyInfo> entry :
deprecations.getDeprecatedKeyMap().entrySet()) {
String depKey = entry.getKey();
if (!overlay.contains(depKey)) {
for (String newKey : entry.getValue().newKeys) {
String val = overlay.getProperty(newKey);
if (val != null) {
props.setProperty(depKey, val);
overlay.setProperty(depKey, val);
break;
}
}
}
}
} | [
"public",
"void",
"setDeprecatedProperties",
"(",
")",
"{",
"DeprecationContext",
"deprecations",
"=",
"deprecationContext",
".",
"get",
"(",
")",
";",
"Properties",
"props",
"=",
"getProps",
"(",
")",
";",
"Properties",
"overlay",
"=",
"getOverlay",
"(",
")",
... | Sets all deprecated properties that are not currently set but have a
corresponding new property that is set. Useful for iterating the
properties when all deprecated properties for currently set properties
need to be present. | [
"Sets",
"all",
"deprecated",
"properties",
"that",
"are",
"not",
"currently",
"set",
"but",
"have",
"a",
"corresponding",
"new",
"property",
"that",
"is",
"set",
".",
"Useful",
"for",
"iterating",
"the",
"properties",
"when",
"all",
"deprecated",
"properties",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L578-L596 | train | Sets the properties of the deprecated properties. | [
30522,
2270,
11675,
2275,
3207,
28139,
12921,
21572,
4842,
7368,
1006,
1007,
1063,
2139,
28139,
10719,
8663,
18209,
2139,
28139,
10719,
2015,
1027,
2139,
28139,
10719,
8663,
18209,
1012,
2131,
1006,
1007,
1025,
5144,
24387,
1027,
2131,
21572,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/generator/CirculantGraph.java | CirculantGraph.addRange | public CirculantGraph addRange(long offset, long length) {
Preconditions.checkArgument(offset >= MINIMUM_OFFSET,
"Range offset must be at least " + MINIMUM_OFFSET);
Preconditions.checkArgument(length <= vertexCount - offset,
"Range length must not be greater than the vertex count minus the range offset.");
offsetRanges.add(new OffsetRange(offset, length));
return this;
} | java | public CirculantGraph addRange(long offset, long length) {
Preconditions.checkArgument(offset >= MINIMUM_OFFSET,
"Range offset must be at least " + MINIMUM_OFFSET);
Preconditions.checkArgument(length <= vertexCount - offset,
"Range length must not be greater than the vertex count minus the range offset.");
offsetRanges.add(new OffsetRange(offset, length));
return this;
} | [
"public",
"CirculantGraph",
"addRange",
"(",
"long",
"offset",
",",
"long",
"length",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"offset",
">=",
"MINIMUM_OFFSET",
",",
"\"Range offset must be at least \"",
"+",
"MINIMUM_OFFSET",
")",
";",
"Preconditions",
... | Required configuration for each range of offsets in the graph.
@param offset first offset appointing the vertices' position
@param length number of contiguous offsets in range
@return this | [
"Required",
"configuration",
"for",
"each",
"range",
"of",
"offsets",
"in",
"the",
"graph",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CirculantGraph.java#L81-L90 | train | Adds a range to the CirculantGraph. | [
30522,
2270,
25022,
11890,
7068,
3372,
14413,
5587,
24388,
2063,
1006,
2146,
16396,
1010,
2146,
3091,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
16396,
1028,
1027,
6263,
1035,
16396,
1010,
1000,
2846,
16396,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java | ExcelWriter.write | @SuppressWarnings({ "rawtypes", "unchecked" })
public ExcelWriter write(Iterable<?> data, Comparator<String> comparator) {
Assert.isFalse(this.isClosed, "ExcelWriter has been closed!");
boolean isFirstRow = true;
Map<?, ?> map;
for (Object obj : data) {
if (obj instanceof Map) {
map = new TreeMap<>(comparator);
map.putAll((Map) obj);
} else {
map = BeanUtil.beanToMap(obj, new TreeMap<String, Object>(comparator), false, false);
}
writeRow(map, isFirstRow);
if (isFirstRow) {
isFirstRow = false;
}
}
return this;
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
public ExcelWriter write(Iterable<?> data, Comparator<String> comparator) {
Assert.isFalse(this.isClosed, "ExcelWriter has been closed!");
boolean isFirstRow = true;
Map<?, ?> map;
for (Object obj : data) {
if (obj instanceof Map) {
map = new TreeMap<>(comparator);
map.putAll((Map) obj);
} else {
map = BeanUtil.beanToMap(obj, new TreeMap<String, Object>(comparator), false, false);
}
writeRow(map, isFirstRow);
if (isFirstRow) {
isFirstRow = false;
}
}
return this;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"ExcelWriter",
"write",
"(",
"Iterable",
"<",
"?",
">",
"data",
",",
"Comparator",
"<",
"String",
">",
"comparator",
")",
"{",
"Assert",
".",
"isFalse",
"(",
"this... | 写出数据,本方法只是将数据写入Workbook中的Sheet,并不写出到文件<br>
写出的起始行为当前行号,可使用{@link #getCurrentRow()}方法调用,根据写出的的行数,当前行号自动增加<br>
样式为默认样式,可使用{@link #getCellStyle()}方法调用后自定义默认样式<br>
data中元素支持的类型有:
<p>
1. Map,既元素为一个Map,第一个Map的keys作为首行,剩下的行为Map的values,data表示多行 <br>
2. Bean,既元素为一个Bean,第一个Bean的字段名列表会作为首行,剩下的行为Bean的字段值列表,data表示多行 <br>
</p>
@param data 数据
@param comparator 比较器,用于字段名的排序
@return this
@since 3.2.3 | [
"写出数据,本方法只是将数据写入Workbook中的Sheet,并不写出到文件<br",
">",
"写出的起始行为当前行号,可使用",
"{",
"@link",
"#getCurrentRow",
"()",
"}",
"方法调用,根据写出的的行数,当前行号自动增加<br",
">",
"样式为默认样式,可使用",
"{",
"@link",
"#getCellStyle",
"()",
"}",
"方法调用后自定义默认样式<br",
">",
"data中元素支持的类型有:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L626-L644 | train | Write a sequence of objects to an Excel file using the specified comparator. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
6315,
13874,
2015,
1000,
1010,
1000,
4895,
5403,
18141,
1000,
1065,
1007,
2270,
24970,
15994,
4339,
1006,
2009,
6906,
3468,
1026,
1029,
1028,
2951,
1010,
4012,
28689,
4263,
1026,
5164,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.countMap | public static <T> Map<T, Integer> countMap(Iterable<T> collection) {
return IterUtil.countMap(collection);
} | java | public static <T> Map<T, Integer> countMap(Iterable<T> collection) {
return IterUtil.countMap(collection);
} | [
"public",
"static",
"<",
"T",
">",
"Map",
"<",
"T",
",",
"Integer",
">",
"countMap",
"(",
"Iterable",
"<",
"T",
">",
"collection",
")",
"{",
"return",
"IterUtil",
".",
"countMap",
"(",
"collection",
")",
";",
"}"
] | 根据集合返回一个元素计数的 {@link Map}<br>
所谓元素计数就是假如这个集合中某个元素出现了n次,那将这个元素做为key,n做为value<br>
例如:[a,b,c,c,c] 得到:<br>
a: 1<br>
b: 1<br>
c: 3<br>
@param <T> 集合元素类型
@param collection 集合
@return {@link Map}
@see IterUtil#countMap(Iterable) | [
"根据集合返回一个元素计数的",
"{",
"@link",
"Map",
"}",
"<br",
">",
"所谓元素计数就是假如这个集合中某个元素出现了n次,那将这个元素做为key,n做为value<br",
">",
"例如:",
"[",
"a",
"b",
"c",
"c",
"c",
"]",
"得到:<br",
">",
"a",
":",
"1<br",
">",
"b",
":",
"1<br",
">",
"c",
":",
"3<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L262-L264 | train | Creates a map from an iterable. | [
30522,
2270,
10763,
1026,
1056,
1028,
4949,
1026,
1056,
1010,
16109,
1028,
4175,
2863,
2361,
1006,
2009,
6906,
3468,
1026,
1056,
1028,
3074,
1007,
1063,
2709,
2009,
2121,
21823,
2140,
1012,
4175,
2863,
2361,
1006,
3074,
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... |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java | Scheduler.updatePattern | public Scheduler updatePattern(String id, CronPattern pattern) {
this.taskTable.updatePattern(id, pattern);
return this;
} | java | public Scheduler updatePattern(String id, CronPattern pattern) {
this.taskTable.updatePattern(id, pattern);
return this;
} | [
"public",
"Scheduler",
"updatePattern",
"(",
"String",
"id",
",",
"CronPattern",
"pattern",
")",
"{",
"this",
".",
"taskTable",
".",
"updatePattern",
"(",
"id",
",",
"pattern",
")",
";",
"return",
"this",
";",
"}"
] | 更新Task执行的时间规则
@param id Task的ID
@param pattern {@link CronPattern}
@return this
@since 4.0.10 | [
"更新Task执行的时间规则"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java#L279-L282 | train | Updates an existing CronPattern. | [
30522,
2270,
6134,
2099,
10651,
4502,
12079,
2078,
1006,
5164,
8909,
1010,
13675,
2239,
4502,
12079,
2078,
5418,
1007,
1063,
2023,
1012,
4708,
10880,
1012,
10651,
4502,
12079,
2078,
1006,
8909,
1010,
5418,
1007,
1025,
2709,
2023,
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... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java | KeyedStream.asQueryableState | @PublicEvolving
public QueryableStateStream<KEY, T> asQueryableState(
String queryableStateName,
ReducingStateDescriptor<T> stateDescriptor) {
transform("Queryable state: " + queryableStateName,
getType(),
new QueryableAppendingStateOperator<>(queryableStateName, stateDescriptor));
stateDescriptor.initializeSerializerUnlessSet(getExecutionConfig());
return new QueryableStateStream<>(
queryableStateName,
stateDescriptor,
getKeyType().createSerializer(getExecutionConfig()));
} | java | @PublicEvolving
public QueryableStateStream<KEY, T> asQueryableState(
String queryableStateName,
ReducingStateDescriptor<T> stateDescriptor) {
transform("Queryable state: " + queryableStateName,
getType(),
new QueryableAppendingStateOperator<>(queryableStateName, stateDescriptor));
stateDescriptor.initializeSerializerUnlessSet(getExecutionConfig());
return new QueryableStateStream<>(
queryableStateName,
stateDescriptor,
getKeyType().createSerializer(getExecutionConfig()));
} | [
"@",
"PublicEvolving",
"public",
"QueryableStateStream",
"<",
"KEY",
",",
"T",
">",
"asQueryableState",
"(",
"String",
"queryableStateName",
",",
"ReducingStateDescriptor",
"<",
"T",
">",
"stateDescriptor",
")",
"{",
"transform",
"(",
"\"Queryable state: \"",
"+",
"... | Publishes the keyed stream as a queryable ReducingState instance.
@param queryableStateName Name under which to the publish the queryable state instance
@param stateDescriptor State descriptor to create state instance from
@return Queryable state instance | [
"Publishes",
"the",
"keyed",
"stream",
"as",
"a",
"queryable",
"ReducingState",
"instance",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java#L1070-L1085 | train | Returns a new QueryableStateStream with the given name and state descriptor. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
23032,
3085,
9153,
22199,
16416,
2213,
1026,
3145,
1010,
1056,
1028,
2004,
4226,
20444,
13510,
12259,
1006,
5164,
23032,
3085,
9153,
30524,
2229,
23235,
2953,
1026,
1056,
1028,
3090,
2229,
23235,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/ExecutionContext.java | ExecutionContext.wrapClassLoader | public <R> R wrapClassLoader(Supplier<R> supplier) {
try (TemporaryClassLoaderContext tmpCl = new TemporaryClassLoaderContext(classLoader)){
return supplier.get();
}
} | java | public <R> R wrapClassLoader(Supplier<R> supplier) {
try (TemporaryClassLoaderContext tmpCl = new TemporaryClassLoaderContext(classLoader)){
return supplier.get();
}
} | [
"public",
"<",
"R",
">",
"R",
"wrapClassLoader",
"(",
"Supplier",
"<",
"R",
">",
"supplier",
")",
"{",
"try",
"(",
"TemporaryClassLoaderContext",
"tmpCl",
"=",
"new",
"TemporaryClassLoaderContext",
"(",
"classLoader",
")",
")",
"{",
"return",
"supplier",
".",
... | Executes the given supplier using the execution context's classloader as thread classloader. | [
"Executes",
"the",
"given",
"supplier",
"using",
"the",
"execution",
"context",
"s",
"classloader",
"as",
"thread",
"classloader",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/ExecutionContext.java#L188-L192 | train | Wrap the given supplier in a TemporaryClassLoaderContext. | [
30522,
2270,
1026,
1054,
1028,
1054,
10236,
26266,
11066,
2121,
1006,
17024,
1026,
1054,
1028,
17024,
1007,
1063,
3046,
1006,
5741,
26266,
11066,
2121,
8663,
18209,
1056,
8737,
20464,
1027,
30524,
1012,
2131,
1006,
1007,
1025,
1065,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.getParent | public static File getParent(File file, int level) {
if (level < 1 || null == file) {
return file;
}
File parentFile;
try {
parentFile = file.getCanonicalFile().getParentFile();
} catch (IOException e) {
throw new IORuntimeException(e);
}
if (1 == level) {
return parentFile;
}
return getParent(parentFile, level - 1);
} | java | public static File getParent(File file, int level) {
if (level < 1 || null == file) {
return file;
}
File parentFile;
try {
parentFile = file.getCanonicalFile().getParentFile();
} catch (IOException e) {
throw new IORuntimeException(e);
}
if (1 == level) {
return parentFile;
}
return getParent(parentFile, level - 1);
} | [
"public",
"static",
"File",
"getParent",
"(",
"File",
"file",
",",
"int",
"level",
")",
"{",
"if",
"(",
"level",
"<",
"1",
"||",
"null",
"==",
"file",
")",
"{",
"return",
"file",
";",
"}",
"File",
"parentFile",
";",
"try",
"{",
"parentFile",
"=",
"... | 获取指定层级的父路径
<pre>
getParent(file("d:/aaa/bbb/cc/ddd", 0)) -> "d:/aaa/bbb/cc/ddd"
getParent(file("d:/aaa/bbb/cc/ddd", 2)) -> "d:/aaa/bbb"
getParent(file("d:/aaa/bbb/cc/ddd", 4)) -> "d:/"
getParent(file("d:/aaa/bbb/cc/ddd", 5)) -> null
</pre>
@param file 目录或文件
@param level 层级
@return 路径File,如果不存在返回null
@since 4.1.2 | [
"获取指定层级的父路径"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3357-L3372 | train | Gets the parent file of the given file. | [
30522,
2270,
10763,
5371,
2131,
19362,
4765,
1006,
5371,
5371,
1010,
20014,
2504,
1007,
1063,
2065,
1006,
2504,
1026,
1015,
1064,
1064,
19701,
1027,
1027,
5371,
1007,
1063,
2709,
5371,
1025,
1065,
5371,
6687,
8873,
2571,
1025,
3046,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getUint32 | public final long getUint32() {
if (position + 3 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 3));
byte[] buf = buffer;
return ((long) (0xff & buf[position++])) | ((long) (0xff & buf[position++]) << 8)
| ((long) (0xff & buf[position++]) << 16) | ((long) (0xff & buf[position++]) << 24);
} | java | public final long getUint32() {
if (position + 3 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 3));
byte[] buf = buffer;
return ((long) (0xff & buf[position++])) | ((long) (0xff & buf[position++]) << 8)
| ((long) (0xff & buf[position++]) << 16) | ((long) (0xff & buf[position++]) << 24);
} | [
"public",
"final",
"long",
"getUint32",
"(",
")",
"{",
"if",
"(",
"position",
"+",
"3",
">=",
"origin",
"+",
"limit",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"(",
"position",
"-",
"origin",
"+",
"3",
")",
")",
";... | Return next 32-bit unsigned int from buffer. (little-endian)
@see mysql-5.1.60/include/my_global.h - uint4korr | [
"Return",
"next",
"32",
"-",
"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#L561-L568 | train | Gets a 32 - bit unsigned integer from the buffer. | [
30522,
2270,
2345,
2146,
2131,
20023,
2102,
16703,
1006,
1007,
1063,
2065,
1006,
2597,
1009,
1017,
1028,
1027,
4761,
1009,
5787,
1007,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
5787,
4654,
9468,
13089,
1024,
1000,
1009,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java | BinaryString.toBooleanSQL | public Boolean toBooleanSQL() {
if (TRUE_STRINGS.contains(toLowerCase())) {
return true;
} else if (FALSE_STRINGS.contains(toLowerCase())) {
return false;
} else {
return null;
}
} | java | public Boolean toBooleanSQL() {
if (TRUE_STRINGS.contains(toLowerCase())) {
return true;
} else if (FALSE_STRINGS.contains(toLowerCase())) {
return false;
} else {
return null;
}
} | [
"public",
"Boolean",
"toBooleanSQL",
"(",
")",
"{",
"if",
"(",
"TRUE_STRINGS",
".",
"contains",
"(",
"toLowerCase",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"FALSE_STRINGS",
".",
"contains",
"(",
"toLowerCase",
"(",
")",
... | Decide boolean representation of a string. | [
"Decide",
"boolean",
"representation",
"of",
"a",
"string",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L1830-L1838 | train | Returns the Boolean value for this SQL statement. | [
30522,
2270,
22017,
20898,
2000,
5092,
9890,
6962,
4160,
2140,
1006,
1007,
1063,
2065,
1006,
2995,
1035,
7817,
1012,
3397,
1006,
2000,
27663,
18992,
3366,
1006,
1007,
1007,
1007,
1063,
2709,
2995,
1025,
1065,
2842,
2065,
1006,
6270,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/StringUtil.java | StringUtil.endsWith | public static boolean endsWith(CharSequence s, char c) {
int len = s.length();
return len > 0 && s.charAt(len - 1) == c;
} | java | public static boolean endsWith(CharSequence s, char c) {
int len = s.length();
return len > 0 && s.charAt(len - 1) == c;
} | [
"public",
"static",
"boolean",
"endsWith",
"(",
"CharSequence",
"s",
",",
"char",
"c",
")",
"{",
"int",
"len",
"=",
"s",
".",
"length",
"(",
")",
";",
"return",
"len",
">",
"0",
"&&",
"s",
".",
"charAt",
"(",
"len",
"-",
"1",
")",
"==",
"c",
";... | Determine if the string {@code s} ends with the char {@code c}.
@param s the string to test
@param c the tested char
@return true if {@code s} ends with the char {@code c} | [
"Determine",
"if",
"the",
"string",
"{",
"@code",
"s",
"}",
"ends",
"with",
"the",
"char",
"{",
"@code",
"c",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L578-L581 | train | Check if a char sequence ends with a char. | [
30522,
2270,
10763,
22017,
20898,
4515,
24415,
1006,
25869,
3366,
4226,
5897,
1055,
1010,
25869,
1039,
1007,
1063,
20014,
18798,
1027,
1055,
1012,
3091,
1006,
1007,
1025,
2709,
18798,
1028,
1014,
1004,
1004,
1055,
1012,
25869,
4017,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/ds/pooled/PooledDataSource.java | PooledDataSource.getConnectionDirect | private PooledConnection getConnectionDirect() throws SQLException {
if (null == freePool) {
throw new SQLException("PooledDataSource is closed!");
}
final int maxActive = config.getMaxActive();
if (maxActive <= 0 || maxActive < this.activeCount) {
// 超过最大使用限制
throw new SQLException("In used Connection is more than Max Active.");
}
PooledConnection conn = freePool.poll();
if (null == conn || conn.open().isClosed()) {
conn = this.newConnection();
}
activeCount++;
return conn;
} | java | private PooledConnection getConnectionDirect() throws SQLException {
if (null == freePool) {
throw new SQLException("PooledDataSource is closed!");
}
final int maxActive = config.getMaxActive();
if (maxActive <= 0 || maxActive < this.activeCount) {
// 超过最大使用限制
throw new SQLException("In used Connection is more than Max Active.");
}
PooledConnection conn = freePool.poll();
if (null == conn || conn.open().isClosed()) {
conn = this.newConnection();
}
activeCount++;
return conn;
} | [
"private",
"PooledConnection",
"getConnectionDirect",
"(",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"null",
"==",
"freePool",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"\"PooledDataSource is closed!\"",
")",
";",
"}",
"final",
"int",
"maxActive",
"=",
... | 直接从连接池中获取连接,如果池中无连接直接抛出异常
@return PooledConnection
@throws SQLException SQL异常 | [
"直接从连接池中获取连接,如果池中无连接直接抛出异常"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/ds/pooled/PooledDataSource.java#L170-L187 | train | Gets a connection from the pool. | [
30522,
2797,
19107,
16409,
18256,
7542,
2131,
8663,
2638,
7542,
4305,
2890,
6593,
1006,
1007,
11618,
29296,
10288,
24422,
1063,
2065,
1006,
19701,
1027,
1027,
2489,
16869,
1007,
1063,
5466,
2047,
29296,
10288,
24422,
1006,
1000,
19107,
25062,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-rabbitmq/src/main/java/org/apache/flink/streaming/connectors/rabbitmq/RMQSink.java | RMQSink.invoke | @Override
public void invoke(IN value) {
try {
byte[] msg = schema.serialize(value);
if (publishOptions == null) {
channel.basicPublish("", queueName, null, msg);
} else {
boolean mandatory = publishOptions.computeMandatory(value);
boolean immediate = publishOptions.computeImmediate(value);
Preconditions.checkState(!(returnListener == null && (mandatory || immediate)),
"Setting mandatory and/or immediate flags to true requires a ReturnListener.");
String rk = publishOptions.computeRoutingKey(value);
String exchange = publishOptions.computeExchange(value);
channel.basicPublish(exchange, rk, mandatory, immediate,
publishOptions.computeProperties(value), msg);
}
} catch (IOException e) {
if (logFailuresOnly) {
LOG.error("Cannot send RMQ message {} at {}", queueName, rmqConnectionConfig.getHost(), e);
} else {
throw new RuntimeException("Cannot send RMQ message " + queueName + " at " + rmqConnectionConfig.getHost(), e);
}
}
} | java | @Override
public void invoke(IN value) {
try {
byte[] msg = schema.serialize(value);
if (publishOptions == null) {
channel.basicPublish("", queueName, null, msg);
} else {
boolean mandatory = publishOptions.computeMandatory(value);
boolean immediate = publishOptions.computeImmediate(value);
Preconditions.checkState(!(returnListener == null && (mandatory || immediate)),
"Setting mandatory and/or immediate flags to true requires a ReturnListener.");
String rk = publishOptions.computeRoutingKey(value);
String exchange = publishOptions.computeExchange(value);
channel.basicPublish(exchange, rk, mandatory, immediate,
publishOptions.computeProperties(value), msg);
}
} catch (IOException e) {
if (logFailuresOnly) {
LOG.error("Cannot send RMQ message {} at {}", queueName, rmqConnectionConfig.getHost(), e);
} else {
throw new RuntimeException("Cannot send RMQ message " + queueName + " at " + rmqConnectionConfig.getHost(), e);
}
}
} | [
"@",
"Override",
"public",
"void",
"invoke",
"(",
"IN",
"value",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"msg",
"=",
"schema",
".",
"serialize",
"(",
"value",
")",
";",
"if",
"(",
"publishOptions",
"==",
"null",
")",
"{",
"channel",
".",
"basicPublis... | Called when new data arrives to the sink, and forwards it to RMQ.
@param value
The incoming data | [
"Called",
"when",
"new",
"data",
"arrives",
"to",
"the",
"sink",
"and",
"forwards",
"it",
"to",
"RMQ",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-rabbitmq/src/main/java/org/apache/flink/streaming/connectors/rabbitmq/RMQSink.java#L164-L192 | train | Sends a message to the RMQ queue. | [
30522,
1030,
2058,
15637,
2270,
11675,
1999,
6767,
3489,
1006,
1999,
3643,
1007,
1063,
3046,
1063,
24880,
1031,
1033,
5796,
2290,
1027,
8040,
28433,
1012,
7642,
4697,
1006,
3643,
1007,
1025,
2065,
1006,
10172,
7361,
9285,
1027,
1027,
19701,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/GroupReduceDriver.java | GroupReduceDriver.prepare | @Override
public void prepare() throws Exception {
TaskConfig config = this.taskContext.getTaskConfig();
if (config.getDriverStrategy() != DriverStrategy.SORTED_GROUP_REDUCE) {
throw new Exception("Unrecognized driver strategy for GroupReduce driver: " + config.getDriverStrategy().name());
}
final Counter numRecordsIn = this.taskContext.getMetricGroup().getIOMetricGroup().getNumRecordsInCounter();
this.serializer = this.taskContext.<IT>getInputSerializer(0).getSerializer();
this.comparator = this.taskContext.getDriverComparator(0);
this.input = new CountingMutableObjectIterator<>(this.taskContext.<IT>getInput(0), numRecordsIn);
ExecutionConfig executionConfig = taskContext.getExecutionConfig();
this.objectReuseEnabled = executionConfig.isObjectReuseEnabled();
if (LOG.isDebugEnabled()) {
LOG.debug("GroupReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + ".");
}
} | java | @Override
public void prepare() throws Exception {
TaskConfig config = this.taskContext.getTaskConfig();
if (config.getDriverStrategy() != DriverStrategy.SORTED_GROUP_REDUCE) {
throw new Exception("Unrecognized driver strategy for GroupReduce driver: " + config.getDriverStrategy().name());
}
final Counter numRecordsIn = this.taskContext.getMetricGroup().getIOMetricGroup().getNumRecordsInCounter();
this.serializer = this.taskContext.<IT>getInputSerializer(0).getSerializer();
this.comparator = this.taskContext.getDriverComparator(0);
this.input = new CountingMutableObjectIterator<>(this.taskContext.<IT>getInput(0), numRecordsIn);
ExecutionConfig executionConfig = taskContext.getExecutionConfig();
this.objectReuseEnabled = executionConfig.isObjectReuseEnabled();
if (LOG.isDebugEnabled()) {
LOG.debug("GroupReduceDriver object reuse: " + (this.objectReuseEnabled ? "ENABLED" : "DISABLED") + ".");
}
} | [
"@",
"Override",
"public",
"void",
"prepare",
"(",
")",
"throws",
"Exception",
"{",
"TaskConfig",
"config",
"=",
"this",
".",
"taskContext",
".",
"getTaskConfig",
"(",
")",
";",
"if",
"(",
"config",
".",
"getDriverStrategy",
"(",
")",
"!=",
"DriverStrategy",... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/GroupReduceDriver.java#L89-L107 | train | Prepare the task context. | [
30522,
1030,
2058,
15637,
2270,
11675,
7374,
1006,
1007,
11618,
6453,
1063,
4708,
8663,
8873,
2290,
9530,
8873,
2290,
1027,
2023,
1012,
4708,
8663,
18209,
1012,
2131,
10230,
2243,
8663,
8873,
2290,
1006,
1007,
1025,
2065,
1006,
9530,
8873,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/misc/HighwayHash.java | HighwayHash.finalize64 | public long finalize64() {
permuteAndUpdate();
permuteAndUpdate();
permuteAndUpdate();
permuteAndUpdate();
done = true;
return v0[0] + v1[0] + mul0[0] + mul1[0];
} | java | public long finalize64() {
permuteAndUpdate();
permuteAndUpdate();
permuteAndUpdate();
permuteAndUpdate();
done = true;
return v0[0] + v1[0] + mul0[0] + mul1[0];
} | [
"public",
"long",
"finalize64",
"(",
")",
"{",
"permuteAndUpdate",
"(",
")",
";",
"permuteAndUpdate",
"(",
")",
";",
"permuteAndUpdate",
"(",
")",
";",
"permuteAndUpdate",
"(",
")",
";",
"done",
"=",
"true",
";",
"return",
"v0",
"[",
"0",
"]",
"+",
"v1... | Computes the hash value after all bytes were processed. Invalidates the
state.
NOTE: The 64-bit HighwayHash algorithm is declared stable and no longer subject to change.
@return 64-bit hash | [
"Computes",
"the",
"hash",
"value",
"after",
"all",
"bytes",
"were",
"processed",
".",
"Invalidates",
"the",
"state",
"."
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/misc/HighwayHash.java#L154-L161 | train | Finalize the sequence. | [
30522,
2270,
2146,
2345,
4697,
21084,
1006,
1007,
1063,
2566,
26746,
5685,
6279,
13701,
1006,
1007,
1025,
2566,
26746,
5685,
6279,
13701,
1006,
1007,
1025,
2566,
26746,
5685,
6279,
13701,
30524,
2589,
1027,
2995,
1025,
2709,
1058,
2692,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBufferAccessor.java | SharedBufferAccessor.extractPatterns | public List<Map<String, List<EventId>>> extractPatterns(
final NodeId nodeId,
final DeweyNumber version) {
List<Map<String, List<EventId>>> result = new ArrayList<>();
// stack to remember the current extraction states
Stack<SharedBufferAccessor.ExtractionState> extractionStates = new Stack<>();
// get the starting shared buffer entry for the previous relation
Lockable<SharedBufferNode> entryLock = sharedBuffer.getEntry(nodeId);
if (entryLock != null) {
SharedBufferNode entry = entryLock.getElement();
extractionStates.add(new SharedBufferAccessor.ExtractionState(Tuple2.of(nodeId, entry), version, new Stack<>()));
// use a depth first search to reconstruct the previous relations
while (!extractionStates.isEmpty()) {
final SharedBufferAccessor.ExtractionState extractionState = extractionStates.pop();
// current path of the depth first search
final Stack<Tuple2<NodeId, SharedBufferNode>> currentPath = extractionState.getPath();
final Tuple2<NodeId, SharedBufferNode> currentEntry = extractionState.getEntry();
// termination criterion
if (currentEntry == null) {
final Map<String, List<EventId>> completePath = new LinkedHashMap<>();
while (!currentPath.isEmpty()) {
final NodeId currentPathEntry = currentPath.pop().f0;
String page = currentPathEntry.getPageName();
List<EventId> values = completePath
.computeIfAbsent(page, k -> new ArrayList<>());
values.add(currentPathEntry.getEventId());
}
result.add(completePath);
} else {
// append state to the path
currentPath.push(currentEntry);
boolean firstMatch = true;
for (SharedBufferEdge edge : currentEntry.f1.getEdges()) {
// we can only proceed if the current version is compatible to the version
// of this previous relation
final DeweyNumber currentVersion = extractionState.getVersion();
if (currentVersion.isCompatibleWith(edge.getDeweyNumber())) {
final NodeId target = edge.getTarget();
Stack<Tuple2<NodeId, SharedBufferNode>> newPath;
if (firstMatch) {
// for the first match we don't have to copy the current path
newPath = currentPath;
firstMatch = false;
} else {
newPath = new Stack<>();
newPath.addAll(currentPath);
}
extractionStates.push(new SharedBufferAccessor.ExtractionState(
target != null ? Tuple2.of(target, sharedBuffer.getEntry(target).getElement()) : null,
edge.getDeweyNumber(),
newPath));
}
}
}
}
}
return result;
} | java | public List<Map<String, List<EventId>>> extractPatterns(
final NodeId nodeId,
final DeweyNumber version) {
List<Map<String, List<EventId>>> result = new ArrayList<>();
// stack to remember the current extraction states
Stack<SharedBufferAccessor.ExtractionState> extractionStates = new Stack<>();
// get the starting shared buffer entry for the previous relation
Lockable<SharedBufferNode> entryLock = sharedBuffer.getEntry(nodeId);
if (entryLock != null) {
SharedBufferNode entry = entryLock.getElement();
extractionStates.add(new SharedBufferAccessor.ExtractionState(Tuple2.of(nodeId, entry), version, new Stack<>()));
// use a depth first search to reconstruct the previous relations
while (!extractionStates.isEmpty()) {
final SharedBufferAccessor.ExtractionState extractionState = extractionStates.pop();
// current path of the depth first search
final Stack<Tuple2<NodeId, SharedBufferNode>> currentPath = extractionState.getPath();
final Tuple2<NodeId, SharedBufferNode> currentEntry = extractionState.getEntry();
// termination criterion
if (currentEntry == null) {
final Map<String, List<EventId>> completePath = new LinkedHashMap<>();
while (!currentPath.isEmpty()) {
final NodeId currentPathEntry = currentPath.pop().f0;
String page = currentPathEntry.getPageName();
List<EventId> values = completePath
.computeIfAbsent(page, k -> new ArrayList<>());
values.add(currentPathEntry.getEventId());
}
result.add(completePath);
} else {
// append state to the path
currentPath.push(currentEntry);
boolean firstMatch = true;
for (SharedBufferEdge edge : currentEntry.f1.getEdges()) {
// we can only proceed if the current version is compatible to the version
// of this previous relation
final DeweyNumber currentVersion = extractionState.getVersion();
if (currentVersion.isCompatibleWith(edge.getDeweyNumber())) {
final NodeId target = edge.getTarget();
Stack<Tuple2<NodeId, SharedBufferNode>> newPath;
if (firstMatch) {
// for the first match we don't have to copy the current path
newPath = currentPath;
firstMatch = false;
} else {
newPath = new Stack<>();
newPath.addAll(currentPath);
}
extractionStates.push(new SharedBufferAccessor.ExtractionState(
target != null ? Tuple2.of(target, sharedBuffer.getEntry(target).getElement()) : null,
edge.getDeweyNumber(),
newPath));
}
}
}
}
}
return result;
} | [
"public",
"List",
"<",
"Map",
"<",
"String",
",",
"List",
"<",
"EventId",
">",
">",
">",
"extractPatterns",
"(",
"final",
"NodeId",
"nodeId",
",",
"final",
"DeweyNumber",
"version",
")",
"{",
"List",
"<",
"Map",
"<",
"String",
",",
"List",
"<",
"EventI... | Returns all elements from the previous relation starting at the given entry.
@param nodeId id of the starting entry
@param version Version of the previous relation which shall be extracted
@return Collection of previous relations starting with the given value | [
"Returns",
"all",
"elements",
"from",
"the",
"previous",
"relation",
"starting",
"at",
"the",
"given",
"entry",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBufferAccessor.java#L119-L189 | train | Extract patterns from the given node id and version. | [
30522,
2270,
2862,
1026,
4949,
1026,
5164,
1010,
2862,
1026,
2724,
3593,
1028,
1028,
1028,
14817,
4502,
12079,
3619,
1006,
2345,
13045,
3593,
13045,
3593,
1010,
2345,
20309,
19172,
5677,
2544,
1007,
1063,
2862,
1026,
4949,
1026,
5164,
1010,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.addFile | private static void addFile(File file, String path, ZipOutputStream out) throws UtilException {
BufferedInputStream in = null;
try {
in = FileUtil.getInputStream(file);
addFile(in, path, out);
} finally {
IoUtil.close(in);
}
} | java | private static void addFile(File file, String path, ZipOutputStream out) throws UtilException {
BufferedInputStream in = null;
try {
in = FileUtil.getInputStream(file);
addFile(in, path, out);
} finally {
IoUtil.close(in);
}
} | [
"private",
"static",
"void",
"addFile",
"(",
"File",
"file",
",",
"String",
"path",
",",
"ZipOutputStream",
"out",
")",
"throws",
"UtilException",
"{",
"BufferedInputStream",
"in",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"FileUtil",
".",
"getInputStream",
"... | 添加文件到压缩包
@param file 需要压缩的文件
@param path 在压缩文件中的路径
@param out 压缩文件存储对象
@throws UtilException IO异常
@since 4.0.5 | [
"添加文件到压缩包"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L802-L810 | train | Adds a file to a zip output stream. | [
30522,
2797,
10763,
11675,
5587,
8873,
2571,
1006,
5371,
5371,
1010,
5164,
4130,
1010,
14101,
5833,
18780,
21422,
2041,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
17698,
2098,
2378,
18780,
21422,
1999,
1027,
19701,
1025,
3046,
1063,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/PageFactory.java | PageFactory.initElements | public static <T> T initElements(WebDriver driver, Class<T> pageClassToProxy) {
T page = instantiatePage(driver, pageClassToProxy);
initElements(driver, page);
return page;
} | java | public static <T> T initElements(WebDriver driver, Class<T> pageClassToProxy) {
T page = instantiatePage(driver, pageClassToProxy);
initElements(driver, page);
return page;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"initElements",
"(",
"WebDriver",
"driver",
",",
"Class",
"<",
"T",
">",
"pageClassToProxy",
")",
"{",
"T",
"page",
"=",
"instantiatePage",
"(",
"driver",
",",
"pageClassToProxy",
")",
";",
"initElements",
"(",
"driv... | Instantiate an instance of the given class, and set a lazy proxy for each of the WebElement and
List<WebElement> fields that have been declared, assuming that the field
name is also the HTML element's "id" or "name". This means that for the class:
<code> public class Page { private WebElement submit; } </code>
there will be an element that can be located using the xpath expression "//*[@id='submit']" or
"//*[@name='submit']"
By default, the element or the list is looked up each and every time a method is called upon
it. To change this behaviour, simply annotate the field with the {@link CacheLookup}. To change
how the element is located, use the {@link FindBy} annotation.
This method will attempt to instantiate the class given to it, preferably using a constructor
which takes a WebDriver instance as its only argument or falling back on a no-arg constructor.
An exception will be thrown if the class cannot be instantiated.
@param driver The driver that will be used to look up the elements
@param pageClassToProxy A class which will be initialised.
@param <T> Class of the PageObject
@return An instantiated instance of the class with WebElement and List<WebElement>
fields proxied
@see FindBy
@see CacheLookup | [
"Instantiate",
"an",
"instance",
"of",
"the",
"given",
"class",
"and",
"set",
"a",
"lazy",
"proxy",
"for",
"each",
"of",
"the",
"WebElement",
"and",
"List<",
";",
"WebElement>",
";",
"fields",
"that",
"have",
"been",
"declared",
"assuming",
"that",
"the"... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/PageFactory.java#L62-L66 | train | Initializes the elements of the page. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
1999,
4221,
16930,
11187,
1006,
4773,
23663,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/Segment.java | Segment.combineByCustomDictionary | protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList, final WordNet wordNetAll)
{
return combineByCustomDictionary(vertexList, CustomDictionary.dat, wordNetAll);
} | java | protected static List<Vertex> combineByCustomDictionary(List<Vertex> vertexList, final WordNet wordNetAll)
{
return combineByCustomDictionary(vertexList, CustomDictionary.dat, wordNetAll);
} | [
"protected",
"static",
"List",
"<",
"Vertex",
">",
"combineByCustomDictionary",
"(",
"List",
"<",
"Vertex",
">",
"vertexList",
",",
"final",
"WordNet",
"wordNetAll",
")",
"{",
"return",
"combineByCustomDictionary",
"(",
"vertexList",
",",
"CustomDictionary",
".",
... | 使用用户词典合并粗分结果,并将用户词语收集到全词图中
@param vertexList 粗分结果
@param wordNetAll 收集用户词语到全词图中
@return 合并后的结果 | [
"使用用户词典合并粗分结果,并将用户词语收集到全词图中"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Segment.java#L287-L290 | train | Combine by custom dictionary. | [
30522,
5123,
10763,
2862,
1026,
19449,
1028,
11506,
3762,
7874,
20389,
29201,
3258,
5649,
1006,
2862,
1026,
19449,
1028,
19449,
9863,
1010,
2345,
2773,
7159,
2773,
7159,
8095,
1007,
1063,
2709,
11506,
3762,
7874,
20389,
29201,
3258,
5649,
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 | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java | HttpPostMultipartRequestDecoder.parseBodyMultipart | private void parseBodyMultipart() {
if (undecodedChunk == null || undecodedChunk.readableBytes() == 0) {
// nothing to decode
return;
}
InterfaceHttpData data = decodeMultipart(currentStatus);
while (data != null) {
addHttpData(data);
if (currentStatus == MultiPartStatus.PREEPILOGUE || currentStatus == MultiPartStatus.EPILOGUE) {
break;
}
data = decodeMultipart(currentStatus);
}
} | java | private void parseBodyMultipart() {
if (undecodedChunk == null || undecodedChunk.readableBytes() == 0) {
// nothing to decode
return;
}
InterfaceHttpData data = decodeMultipart(currentStatus);
while (data != null) {
addHttpData(data);
if (currentStatus == MultiPartStatus.PREEPILOGUE || currentStatus == MultiPartStatus.EPILOGUE) {
break;
}
data = decodeMultipart(currentStatus);
}
} | [
"private",
"void",
"parseBodyMultipart",
"(",
")",
"{",
"if",
"(",
"undecodedChunk",
"==",
"null",
"||",
"undecodedChunk",
".",
"readableBytes",
"(",
")",
"==",
"0",
")",
"{",
"// nothing to decode",
"return",
";",
"}",
"InterfaceHttpData",
"data",
"=",
"decod... | Parse the Body for multipart
@throws ErrorDataDecoderException
if there is a problem with the charset decoding or other
errors | [
"Parse",
"the",
"Body",
"for",
"multipart"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L437-L450 | train | Parse the body multipart. | [
30522,
2797,
11675,
11968,
3366,
23684,
12274,
7096,
11514,
8445,
1006,
1007,
1063,
2065,
1006,
6151,
8586,
10244,
16409,
17157,
2243,
1027,
1027,
19701,
1064,
1064,
6151,
8586,
10244,
16409,
17157,
2243,
1012,
3191,
3085,
3762,
4570,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/os/ExecutableFinder.java | ExecutableFinder.find | public String find(String named) {
File file = new File(named);
if (canExecute(file)) {
return named;
}
if (Platform.getCurrent().is(Platform.WINDOWS)) {
file = new File(named + ".exe");
if (canExecute(file)) {
return named + ".exe";
}
}
addPathFromEnvironment();
if (Platform.getCurrent().is(Platform.MAC)) {
addMacSpecificPath();
}
for (String pathSegment : pathSegmentBuilder.build()) {
for (String ending : ENDINGS) {
file = new File(pathSegment, named + ending);
if (canExecute(file)) {
return file.getAbsolutePath();
}
}
}
return null;
} | java | public String find(String named) {
File file = new File(named);
if (canExecute(file)) {
return named;
}
if (Platform.getCurrent().is(Platform.WINDOWS)) {
file = new File(named + ".exe");
if (canExecute(file)) {
return named + ".exe";
}
}
addPathFromEnvironment();
if (Platform.getCurrent().is(Platform.MAC)) {
addMacSpecificPath();
}
for (String pathSegment : pathSegmentBuilder.build()) {
for (String ending : ENDINGS) {
file = new File(pathSegment, named + ending);
if (canExecute(file)) {
return file.getAbsolutePath();
}
}
}
return null;
} | [
"public",
"String",
"find",
"(",
"String",
"named",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"named",
")",
";",
"if",
"(",
"canExecute",
"(",
"file",
")",
")",
"{",
"return",
"named",
";",
"}",
"if",
"(",
"Platform",
".",
"getCurrent",
"(... | Find the executable by scanning the file system and the PATH. In the case of Windows this
method allows common executable endings (".com", ".bat" and ".exe") to be omitted.
@param named The name of the executable to find
@return The absolute path to the executable, or null if no match is made. | [
"Find",
"the",
"executable",
"by",
"scanning",
"the",
"file",
"system",
"and",
"the",
"PATH",
".",
"In",
"the",
"case",
"of",
"Windows",
"this",
"method",
"allows",
"common",
"executable",
"endings",
"(",
".",
"com",
".",
"bat",
"and",
".",
"exe",
")",
... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/os/ExecutableFinder.java#L45-L72 | train | Find a file in the system. | [
30522,
2270,
5164,
2424,
1006,
5164,
2315,
1007,
1063,
5371,
5371,
1027,
2047,
5371,
1006,
2315,
1007,
1025,
2065,
1006,
11942,
2595,
8586,
10421,
1006,
5371,
1007,
1007,
1063,
2709,
2315,
1025,
1065,
2065,
1006,
4132,
1012,
2131,
10841,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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
@SuppressWarnings("unchecked")
@Override
public int numKeyValueStateEntries() {
int sum = 0;
for (StateSnapshotRestore state : registeredKVStates.values()) {
sum += ((StateTable<?, ?, ?>) state).size();
}
return sum;
} | java | @VisibleForTesting
@SuppressWarnings("unchecked")
@Override
public int numKeyValueStateEntries() {
int sum = 0;
for (StateSnapshotRestore state : registeredKVStates.values()) {
sum += ((StateTable<?, ?, ?>) state).size();
}
return sum;
} | [
"@",
"VisibleForTesting",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"int",
"numKeyValueStateEntries",
"(",
")",
"{",
"int",
"sum",
"=",
"0",
";",
"for",
"(",
"StateSnapshotRestore",
"state",
":",
"registeredKVStates",
".",
"v... | Returns the total number of state entries across all keys/namespaces. | [
"Returns",
"the",
"total",
"number",
"of",
"state",
"entries",
"across",
"all",
"keys",
"/",
"namespaces",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapKeyedStateBackend.java#L347-L356 | train | Returns the number of entries in the state table. | [
30522,
1030,
5710,
13028,
4355,
2075,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
1030,
2058,
15637,
2270,
20014,
16371,
2213,
14839,
10175,
15808,
12259,
4765,
5134,
1006,
1007,
1063,
20014,
7680,
1027,
1014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.asIterator | public static <E> Iterator<E> asIterator(Enumeration<E> e) {
return IterUtil.asIterator(e);
} | java | public static <E> Iterator<E> asIterator(Enumeration<E> e) {
return IterUtil.asIterator(e);
} | [
"public",
"static",
"<",
"E",
">",
"Iterator",
"<",
"E",
">",
"asIterator",
"(",
"Enumeration",
"<",
"E",
">",
"e",
")",
"{",
"return",
"IterUtil",
".",
"asIterator",
"(",
"e",
")",
";",
"}"
] | Enumeration转换为Iterator
<p>
Adapt the specified <code>Enumeration</code> to the <code>Iterator</code> interface
@param <E> 集合元素类型
@param e {@link Enumeration}
@return {@link Iterator}
@see IterUtil#asIterator(Enumeration) | [
"Enumeration转换为Iterator",
"<p",
">",
"Adapt",
"the",
"specified",
"<code",
">",
"Enumeration<",
"/",
"code",
">",
"to",
"the",
"<code",
">",
"Iterator<",
"/",
"code",
">",
"interface"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1583-L1585 | train | Returns an iterator that iterates over the elements in the given enumeration. | [
30522,
2270,
10763,
1026,
1041,
1028,
2009,
6906,
4263,
1026,
1041,
1028,
2004,
21646,
8844,
1006,
4372,
17897,
8156,
1026,
1041,
1028,
1041,
1007,
1063,
2709,
2009,
2121,
21823,
2140,
1012,
2004,
21646,
8844,
1006,
1041,
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... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/KafkaTableSourceBase.java | KafkaTableSourceBase.validateProctimeAttribute | private Optional<String> validateProctimeAttribute(Optional<String> proctimeAttribute) {
return proctimeAttribute.map((attribute) -> {
// validate that field exists and is of correct type
Optional<TypeInformation<?>> tpe = schema.getFieldType(attribute);
if (!tpe.isPresent()) {
throw new ValidationException("Processing time attribute '" + attribute + "' is not present in TableSchema.");
} else if (tpe.get() != Types.SQL_TIMESTAMP()) {
throw new ValidationException("Processing time attribute '" + attribute + "' is not of type SQL_TIMESTAMP.");
}
return attribute;
} | java | private Optional<String> validateProctimeAttribute(Optional<String> proctimeAttribute) {
return proctimeAttribute.map((attribute) -> {
// validate that field exists and is of correct type
Optional<TypeInformation<?>> tpe = schema.getFieldType(attribute);
if (!tpe.isPresent()) {
throw new ValidationException("Processing time attribute '" + attribute + "' is not present in TableSchema.");
} else if (tpe.get() != Types.SQL_TIMESTAMP()) {
throw new ValidationException("Processing time attribute '" + attribute + "' is not of type SQL_TIMESTAMP.");
}
return attribute;
} | [
"private",
"Optional",
"<",
"String",
">",
"validateProctimeAttribute",
"(",
"Optional",
"<",
"String",
">",
"proctimeAttribute",
")",
"{",
"return",
"proctimeAttribute",
".",
"map",
"(",
"(",
"attribute",
")",
"-",
">",
"{",
"// validate that field exists and is of... | Validates a field of the schema to be the processing time attribute.
@param proctimeAttribute The name of the field that becomes the processing time field. | [
"Validates",
"a",
"field",
"of",
"the",
"schema",
"to",
"be",
"the",
"processing",
"time",
"attribute",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/KafkaTableSourceBase.java#L286-L296 | train | Validate the given attribute. | [
30522,
2797,
11887,
1026,
5164,
1028,
9398,
3686,
21572,
6593,
14428,
19321,
3089,
8569,
2618,
1006,
11887,
1026,
5164,
1028,
4013,
6593,
14428,
19321,
3089,
8569,
2618,
1007,
1063,
2709,
4013,
6593,
14428,
19321,
3089,
8569,
2618,
1012,
49... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.isRolledUpColumn | private boolean isRolledUpColumn(SqlIdentifier identifier, SqlValidatorScope scope) {
Pair<String, String> pair = findTableColumnPair(identifier, scope);
if (pair == null) {
return false;
}
String tableAlias = pair.left;
String columnName = pair.right;
Table table = findTable(tableAlias);
if (table != null) {
return table.isRolledUp(columnName);
}
return false;
} | java | private boolean isRolledUpColumn(SqlIdentifier identifier, SqlValidatorScope scope) {
Pair<String, String> pair = findTableColumnPair(identifier, scope);
if (pair == null) {
return false;
}
String tableAlias = pair.left;
String columnName = pair.right;
Table table = findTable(tableAlias);
if (table != null) {
return table.isRolledUp(columnName);
}
return false;
} | [
"private",
"boolean",
"isRolledUpColumn",
"(",
"SqlIdentifier",
"identifier",
",",
"SqlValidatorScope",
"scope",
")",
"{",
"Pair",
"<",
"String",
",",
"String",
">",
"pair",
"=",
"findTableColumnPair",
"(",
"identifier",
",",
"scope",
")",
";",
"if",
"(",
"pai... | Returns true iff the given column is actually rolled up. | [
"Returns",
"true",
"iff",
"the",
"given",
"column",
"is",
"actually",
"rolled",
"up",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3477-L3492 | train | Checks if the column is rolled up. | [
30522,
2797,
22017,
20898,
2003,
28402,
2098,
6279,
25778,
2819,
2078,
1006,
29296,
5178,
16778,
8873,
2121,
8909,
4765,
18095,
1010,
29296,
10175,
8524,
6591,
16186,
9531,
1007,
1063,
3940,
1026,
5164,
1010,
5164,
1028,
3940,
1027,
2424,
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... |
networknt/light-4j | http-url/src/main/java/com/networknt/url/URLNormalizer.java | URLNormalizer.decodeUnreservedCharacters | public URLNormalizer decodeUnreservedCharacters() {
if (url.contains("%")) {
StringBuffer sb = new StringBuffer();
Matcher m = PATTERN_PERCENT_ENCODED_CHAR.matcher(url);
try {
while (m.find()) {
String enc = m.group(1).toUpperCase();
if (isEncodedUnreservedCharacter(enc)) {
m.appendReplacement(sb, URLDecoder.decode(
enc, StandardCharsets.UTF_8.toString()));
}
}
} catch (UnsupportedEncodingException e) {
logger.debug("UTF-8 is not supported by your system. "
+ "URL will remain unchanged:" + url, e);
}
url = m.appendTail(sb).toString();
}
return this;
} | java | public URLNormalizer decodeUnreservedCharacters() {
if (url.contains("%")) {
StringBuffer sb = new StringBuffer();
Matcher m = PATTERN_PERCENT_ENCODED_CHAR.matcher(url);
try {
while (m.find()) {
String enc = m.group(1).toUpperCase();
if (isEncodedUnreservedCharacter(enc)) {
m.appendReplacement(sb, URLDecoder.decode(
enc, StandardCharsets.UTF_8.toString()));
}
}
} catch (UnsupportedEncodingException e) {
logger.debug("UTF-8 is not supported by your system. "
+ "URL will remain unchanged:" + url, e);
}
url = m.appendTail(sb).toString();
}
return this;
} | [
"public",
"URLNormalizer",
"decodeUnreservedCharacters",
"(",
")",
"{",
"if",
"(",
"url",
".",
"contains",
"(",
"\"%\"",
")",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Matcher",
"m",
"=",
"PATTERN_PERCENT_ENCODED_CHAR",
".",
... | Decodes percent-encoded unreserved characters.<p>
<code>http://www.example.com/%7Eusername/ →
http://www.example.com/~username/</code>
@return this instance | [
"Decodes",
"percent",
"-",
"encoded",
"unreserved",
"characters",
".",
"<p",
">",
"<code",
">",
"http",
":",
"//",
"www",
".",
"example",
".",
"com",
"/",
"%7Eusername",
"/",
"&rarr",
";",
"http",
":",
"//",
"www",
".",
"example",
".",
"com",
"/",
"~... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/URLNormalizer.java#L221-L240 | train | This method is used to decode the URL without the reserved characters. | [
30522,
2270,
24471,
19666,
2953,
9067,
17629,
21933,
3207,
4609,
6072,
25944,
7507,
22648,
7747,
1006,
1007,
1063,
2065,
1006,
24471,
2140,
1012,
3397,
1006,
1000,
1003,
1000,
1007,
1007,
1063,
5164,
8569,
12494,
24829,
1027,
2047,
5164,
85... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpoint.java | ConfigurationPropertiesReportEndpoint.applySerializationModifier | private void applySerializationModifier(ObjectMapper mapper) {
SerializerFactory factory = BeanSerializerFactory.instance
.withSerializerModifier(new GenericSerializerModifier());
mapper.setSerializerFactory(factory);
} | java | private void applySerializationModifier(ObjectMapper mapper) {
SerializerFactory factory = BeanSerializerFactory.instance
.withSerializerModifier(new GenericSerializerModifier());
mapper.setSerializerFactory(factory);
} | [
"private",
"void",
"applySerializationModifier",
"(",
"ObjectMapper",
"mapper",
")",
"{",
"SerializerFactory",
"factory",
"=",
"BeanSerializerFactory",
".",
"instance",
".",
"withSerializerModifier",
"(",
"new",
"GenericSerializerModifier",
"(",
")",
")",
";",
"mapper",... | Ensure only bindable and non-cyclic bean properties are reported.
@param mapper the object mapper | [
"Ensure",
"only",
"bindable",
"and",
"non",
"-",
"cyclic",
"bean",
"properties",
"are",
"reported",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpoint.java#L193-L197 | train | Apply the serialization modifier to the given object mapper. | [
30522,
2797,
11675,
6611,
8043,
4818,
3989,
5302,
4305,
8873,
2121,
1006,
4874,
2863,
18620,
4949,
4842,
1007,
1063,
7642,
17629,
21450,
4713,
1027,
13435,
11610,
28863,
21450,
1012,
6013,
1012,
2007,
8043,
4818,
17629,
5302,
4305,
8873,
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-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.age | public static int age(Date birthDay, Date dateToCompare) {
Calendar cal = Calendar.getInstance();
cal.setTime(dateToCompare);
if (cal.before(birthDay)) {
throw new IllegalArgumentException(StrUtil.format("Birthday is after date {}!", formatDate(dateToCompare)));
}
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
cal.setTime(birthDay);
int age = year - cal.get(Calendar.YEAR);
int monthBirth = cal.get(Calendar.MONTH);
if (month == monthBirth) {
int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
if (dayOfMonth < dayOfMonthBirth) {
// 如果生日在当月,但是未达到生日当天的日期,年龄减一
age--;
}
} else if (month < monthBirth) {
// 如果当前月份未达到生日的月份,年龄计算减一
age--;
}
return age;
} | java | public static int age(Date birthDay, Date dateToCompare) {
Calendar cal = Calendar.getInstance();
cal.setTime(dateToCompare);
if (cal.before(birthDay)) {
throw new IllegalArgumentException(StrUtil.format("Birthday is after date {}!", formatDate(dateToCompare)));
}
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
cal.setTime(birthDay);
int age = year - cal.get(Calendar.YEAR);
int monthBirth = cal.get(Calendar.MONTH);
if (month == monthBirth) {
int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH);
if (dayOfMonth < dayOfMonthBirth) {
// 如果生日在当月,但是未达到生日当天的日期,年龄减一
age--;
}
} else if (month < monthBirth) {
// 如果当前月份未达到生日的月份,年龄计算减一
age--;
}
return age;
} | [
"public",
"static",
"int",
"age",
"(",
"Date",
"birthDay",
",",
"Date",
"dateToCompare",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"dateToCompare",
")",
";",
"if",
"(",
"cal",
".",
"bef... | 计算相对于dateToCompare的年龄,长用于计算指定生日在某年的年龄
@param birthDay 生日
@param dateToCompare 需要对比的日期
@return 年龄 | [
"计算相对于dateToCompare的年龄,长用于计算指定生日在某年的年龄"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1511-L1539 | train | Returns the age of the user who has access to the specified date. | [
30522,
2270,
10763,
20014,
2287,
1006,
3058,
5798,
1010,
3058,
3058,
3406,
9006,
19362,
2063,
1007,
1063,
8094,
10250,
1027,
8094,
1012,
2131,
7076,
26897,
1006,
1007,
1025,
10250,
1012,
2275,
7292,
1006,
3058,
3406,
9006,
19362,
2063,
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/spark | launcher/src/main/java/org/apache/spark/launcher/Main.java | Main.prepareBashCommand | private static List<String> prepareBashCommand(List<String> cmd, Map<String, String> childEnv) {
if (childEnv.isEmpty()) {
return cmd;
}
List<String> newCmd = new ArrayList<>();
newCmd.add("env");
for (Map.Entry<String, String> e : childEnv.entrySet()) {
newCmd.add(String.format("%s=%s", e.getKey(), e.getValue()));
}
newCmd.addAll(cmd);
return newCmd;
} | java | private static List<String> prepareBashCommand(List<String> cmd, Map<String, String> childEnv) {
if (childEnv.isEmpty()) {
return cmd;
}
List<String> newCmd = new ArrayList<>();
newCmd.add("env");
for (Map.Entry<String, String> e : childEnv.entrySet()) {
newCmd.add(String.format("%s=%s", e.getKey(), e.getValue()));
}
newCmd.addAll(cmd);
return newCmd;
} | [
"private",
"static",
"List",
"<",
"String",
">",
"prepareBashCommand",
"(",
"List",
"<",
"String",
">",
"cmd",
",",
"Map",
"<",
"String",
",",
"String",
">",
"childEnv",
")",
"{",
"if",
"(",
"childEnv",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"... | Prepare the command for execution from a bash script. The final command will have commands to
set up any needed environment variables needed by the child process. | [
"Prepare",
"the",
"command",
"for",
"execution",
"from",
"a",
"bash",
"script",
".",
"The",
"final",
"command",
"will",
"have",
"commands",
"to",
"set",
"up",
"any",
"needed",
"environment",
"variables",
"needed",
"by",
"the",
"child",
"process",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/Main.java#L142-L155 | train | Prepare a command for a Bash command. | [
30522,
2797,
10763,
2862,
1026,
5164,
1028,
7374,
22083,
16257,
5358,
2386,
2094,
1006,
2862,
1026,
5164,
1028,
4642,
2094,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
2775,
2368,
2615,
1007,
1063,
2065,
1006,
2775,
2368,
2615,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java | NetUtil.createAddress | public static InetSocketAddress createAddress(String host, int port) {
if (StrUtil.isBlank(host)) {
return new InetSocketAddress(port);
}
return new InetSocketAddress(host, port);
} | java | public static InetSocketAddress createAddress(String host, int port) {
if (StrUtil.isBlank(host)) {
return new InetSocketAddress(port);
}
return new InetSocketAddress(host, port);
} | [
"public",
"static",
"InetSocketAddress",
"createAddress",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"host",
")",
")",
"{",
"return",
"new",
"InetSocketAddress",
"(",
"port",
")",
";",
"}",
"return",
"... | 创建 {@link InetSocketAddress}
@param host 域名或IP地址,空表示任意地址
@param port 端口,0表示系统分配临时端口
@return {@link InetSocketAddress}
@since 3.3.0 | [
"创建",
"{",
"@link",
"InetSocketAddress",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L467-L472 | train | Creates an InetSocketAddress from a host and port. | [
30522,
2270,
10763,
1999,
8454,
7432,
12928,
14141,
8303,
3443,
4215,
16200,
4757,
1006,
5164,
3677,
1010,
20014,
3417,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
3677,
1007,
1007,
1063,
2709,
2047,
1999,
8454... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DaoTemplate.java | DaoTemplate.page | public PageResult<Entity> page(Entity where, Page page, String... selectFields) throws SQLException{
return db.page(Arrays.asList(selectFields), fixEntity(where), page);
} | java | public PageResult<Entity> page(Entity where, Page page, String... selectFields) throws SQLException{
return db.page(Arrays.asList(selectFields), fixEntity(where), page);
} | [
"public",
"PageResult",
"<",
"Entity",
">",
"page",
"(",
"Entity",
"where",
",",
"Page",
"page",
",",
"String",
"...",
"selectFields",
")",
"throws",
"SQLException",
"{",
"return",
"db",
".",
"page",
"(",
"Arrays",
".",
"asList",
"(",
"selectFields",
")",
... | 分页
@param where 条件
@param page 分页对象
@param selectFields 查询的字段列表
@return 分页结果集
@throws SQLException SQL执行异常 | [
"分页"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java#L309-L311 | train | Retrieves a page of entities matching the where clause. | [
30522,
2270,
3931,
6072,
11314,
1026,
9178,
1028,
3931,
1006,
9178,
2073,
1010,
3931,
3931,
1010,
5164,
1012,
1012,
1012,
7276,
15155,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
16962,
1012,
3931,
1006,
27448,
1012,
2004,
9863,
1006,
727... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/net/SSLUtils.java | SSLUtils.isRestSSLEnabled | public static boolean isRestSSLEnabled(Configuration sslConfig) {
@SuppressWarnings("deprecation")
final boolean fallbackFlag = sslConfig.getBoolean(SecurityOptions.SSL_ENABLED);
return sslConfig.getBoolean(SecurityOptions.SSL_REST_ENABLED, fallbackFlag);
} | java | public static boolean isRestSSLEnabled(Configuration sslConfig) {
@SuppressWarnings("deprecation")
final boolean fallbackFlag = sslConfig.getBoolean(SecurityOptions.SSL_ENABLED);
return sslConfig.getBoolean(SecurityOptions.SSL_REST_ENABLED, fallbackFlag);
} | [
"public",
"static",
"boolean",
"isRestSSLEnabled",
"(",
"Configuration",
"sslConfig",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"final",
"boolean",
"fallbackFlag",
"=",
"sslConfig",
".",
"getBoolean",
"(",
"SecurityOptions",
".",
"SSL_ENABLED",
... | Checks whether SSL for the external REST endpoint is enabled. | [
"Checks",
"whether",
"SSL",
"for",
"the",
"external",
"REST",
"endpoint",
"is",
"enabled",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java#L65-L69 | train | Checks if SSL is enabled. | [
30522,
2270,
10763,
22017,
20898,
2003,
28533,
4757,
20844,
23242,
1006,
9563,
7020,
22499,
2078,
8873,
2290,
1007,
1063,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
2139,
28139,
10719,
1000,
1007,
2345,
22017,
20898,
2991,
5963,
10258,
8490,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/Convert.java | Convert.toBigDecimal | public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) {
return convert(BigDecimal.class, value, defaultValue);
} | java | public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) {
return convert(BigDecimal.class, value, defaultValue);
} | [
"public",
"static",
"BigDecimal",
"toBigDecimal",
"(",
"Object",
"value",
",",
"BigDecimal",
"defaultValue",
")",
"{",
"return",
"convert",
"(",
"BigDecimal",
".",
"class",
",",
"value",
",",
"defaultValue",
")",
";",
"}"
] | 转换为BigDecimal<br>
如果给定的值为空,或者转换失败,返回默认值<br>
转换失败不会报错
@param value 被转换的值
@param defaultValue 转换错误时的默认值
@return 结果 | [
"转换为BigDecimal<br",
">",
"如果给定的值为空,或者转换失败,返回默认值<br",
">",
"转换失败不会报错"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L421-L423 | train | Converts value of type BigInteger to BigDecimal. | [
30522,
2270,
10763,
2502,
3207,
6895,
9067,
2000,
5638,
2290,
3207,
6895,
9067,
1006,
4874,
3643,
1010,
2502,
3207,
6895,
9067,
12398,
10175,
5657,
1007,
1063,
2709,
10463,
1006,
2502,
3207,
6895,
9067,
1012,
2465,
1010,
3643,
1010,
12398,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/config/MappingConfigLoader.java | MappingConfigLoader.load | public static Map<String, MappingConfig> load(Properties envProperties) {
logger.info("## Start loading hbase mapping config ... ");
Map<String, MappingConfig> result = new LinkedHashMap<>();
Map<String, String> configContentMap = MappingConfigsLoader.loadConfigs("hbase");
configContentMap.forEach((fileName, content) -> {
MappingConfig config = YmlConfigBinder
.bindYmlToObj(null, content, MappingConfig.class, null, envProperties);
if (config == null) {
return;
}
try {
config.validate();
} catch (Exception e) {
throw new RuntimeException("ERROR load Config: " + fileName + " " + e.getMessage(), e);
}
result.put(fileName, config);
});
logger.info("## Hbase mapping config loaded");
return result;
} | java | public static Map<String, MappingConfig> load(Properties envProperties) {
logger.info("## Start loading hbase mapping config ... ");
Map<String, MappingConfig> result = new LinkedHashMap<>();
Map<String, String> configContentMap = MappingConfigsLoader.loadConfigs("hbase");
configContentMap.forEach((fileName, content) -> {
MappingConfig config = YmlConfigBinder
.bindYmlToObj(null, content, MappingConfig.class, null, envProperties);
if (config == null) {
return;
}
try {
config.validate();
} catch (Exception e) {
throw new RuntimeException("ERROR load Config: " + fileName + " " + e.getMessage(), e);
}
result.put(fileName, config);
});
logger.info("## Hbase mapping config loaded");
return result;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"MappingConfig",
">",
"load",
"(",
"Properties",
"envProperties",
")",
"{",
"logger",
".",
"info",
"(",
"\"## Start loading hbase mapping config ... \"",
")",
";",
"Map",
"<",
"String",
",",
"MappingConfig",
">",
"r... | 加载HBase表映射配置
@return 配置名/配置文件名--对象 | [
"加载HBase表映射配置"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/hbase/src/main/java/com/alibaba/otter/canal/client/adapter/hbase/config/MappingConfigLoader.java#L28-L50 | train | Load HBase mapping config. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
12375,
8663,
8873,
2290,
1028,
7170,
1006,
5144,
4372,
2615,
21572,
4842,
7368,
1007,
1063,
8833,
4590,
1012,
18558,
1006,
1000,
1001,
1001,
2707,
10578,
1044,
15058,
12375,
9530,
8873,
2290,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Rowtime.java | Rowtime.toProperties | @Override
public Map<String, String> toProperties() {
final DescriptorProperties properties = new DescriptorProperties();
properties.putProperties(internalProperties);
return properties.asMap();
} | java | @Override
public Map<String, String> toProperties() {
final DescriptorProperties properties = new DescriptorProperties();
properties.putProperties(internalProperties);
return properties.asMap();
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"String",
">",
"toProperties",
"(",
")",
"{",
"final",
"DescriptorProperties",
"properties",
"=",
"new",
"DescriptorProperties",
"(",
")",
";",
"properties",
".",
"putProperties",
"(",
"internalProperties",
"... | Converts this descriptor into a set of properties. | [
"Converts",
"this",
"descriptor",
"into",
"a",
"set",
"of",
"properties",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Rowtime.java#L136-L141 | train | Returns the descriptor properties as a map. | [
30522,
1030,
2058,
15637,
2270,
4949,
1026,
5164,
1010,
5164,
1028,
2327,
18981,
8743,
3111,
1006,
1007,
1063,
2345,
4078,
23235,
2953,
21572,
4842,
7368,
5144,
1027,
2047,
4078,
23235,
2953,
21572,
4842,
7368,
1006,
1007,
1025,
5144,
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-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.pageForEntityList | public List<Entity> pageForEntityList(Entity where, Page page) throws SQLException {
return page(where, page, EntityListHandler.create());
} | java | public List<Entity> pageForEntityList(Entity where, Page page) throws SQLException {
return page(where, page, EntityListHandler.create());
} | [
"public",
"List",
"<",
"Entity",
">",
"pageForEntityList",
"(",
"Entity",
"where",
",",
"Page",
"page",
")",
"throws",
"SQLException",
"{",
"return",
"page",
"(",
"where",
",",
"page",
",",
"EntityListHandler",
".",
"create",
"(",
")",
")",
";",
"}"
] | 分页查询,结果为Entity列表,不计算总数<br>
查询条件为多个key value对表示,默认key = value,如果使用其它条件可以使用:where.put("key", " > 1"),value也可以传Condition对象,key被忽略
@param where 条件实体类(包含表名)
@param page 分页对象
@return 结果对象
@throws SQLException SQL执行异常
@since 3.2.2 | [
"分页查询,结果为Entity列表,不计算总数<br",
">",
"查询条件为多个key",
"value对表示,默认key",
"=",
"value,如果使用其它条件可以使用:where",
".",
"put",
"(",
"key",
">",
";",
"1",
")",
",value也可以传Condition对象,key被忽略"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L673-L675 | train | Creates a page of entities for the specified entity. | [
30522,
2270,
2862,
1026,
9178,
1028,
3931,
29278,
4765,
3012,
9863,
1006,
9178,
2073,
1010,
3931,
3931,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
3931,
1006,
2073,
1010,
3931,
1010,
9178,
9863,
11774,
3917,
1012,
3443,
1006,
1007,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.downloadString | public static String downloadString(String url, Charset customCharset, StreamProgress streamPress) {
if (StrUtil.isBlank(url)) {
throw new NullPointerException("[url] is null!");
}
FastByteArrayOutputStream out = new FastByteArrayOutputStream();
download(url, out, true, streamPress);
return null == customCharset ? out.toString() : out.toString(customCharset);
} | java | public static String downloadString(String url, Charset customCharset, StreamProgress streamPress) {
if (StrUtil.isBlank(url)) {
throw new NullPointerException("[url] is null!");
}
FastByteArrayOutputStream out = new FastByteArrayOutputStream();
download(url, out, true, streamPress);
return null == customCharset ? out.toString() : out.toString(customCharset);
} | [
"public",
"static",
"String",
"downloadString",
"(",
"String",
"url",
",",
"Charset",
"customCharset",
",",
"StreamProgress",
"streamPress",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"url",
")",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",... | 下载远程文本
@param url 请求的url
@param customCharset 自定义的字符集,可以使用{@link CharsetUtil#charset} 方法转换
@param streamPress 进度条 {@link StreamProgress}
@return 文本 | [
"下载远程文本"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L237-L245 | train | Download a string from the specified URL using the specified custom charset. | [
30522,
2270,
10763,
5164,
22956,
18886,
3070,
1006,
5164,
24471,
2140,
1010,
25869,
13462,
7661,
7507,
22573,
2102,
1010,
5460,
21572,
17603,
4757,
5460,
20110,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
24471,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessage.java | HAProxyMessage.ipBytesToString | private static String ipBytesToString(ByteBuf header, int addressLen) {
StringBuilder sb = new StringBuilder();
if (addressLen == 4) {
sb.append(header.readByte() & 0xff);
sb.append('.');
sb.append(header.readByte() & 0xff);
sb.append('.');
sb.append(header.readByte() & 0xff);
sb.append('.');
sb.append(header.readByte() & 0xff);
} else {
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
}
return sb.toString();
} | java | private static String ipBytesToString(ByteBuf header, int addressLen) {
StringBuilder sb = new StringBuilder();
if (addressLen == 4) {
sb.append(header.readByte() & 0xff);
sb.append('.');
sb.append(header.readByte() & 0xff);
sb.append('.');
sb.append(header.readByte() & 0xff);
sb.append('.');
sb.append(header.readByte() & 0xff);
} else {
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
sb.append(':');
sb.append(Integer.toHexString(header.readUnsignedShort()));
}
return sb.toString();
} | [
"private",
"static",
"String",
"ipBytesToString",
"(",
"ByteBuf",
"header",
",",
"int",
"addressLen",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"addressLen",
"==",
"4",
")",
"{",
"sb",
".",
"append",
"(",
"he... | Convert ip address bytes to string representation
@param header buffer containing ip address bytes
@param addressLen number of bytes to read (4 bytes for IPv4, 16 bytes for IPv6)
@return string representation of the ip address | [
"Convert",
"ip",
"address",
"bytes",
"to",
"string",
"representation"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessage.java#L359-L387 | train | Method to get the string representation of an ip bytes. | [
30522,
2797,
10763,
5164,
12997,
3762,
22199,
14122,
4892,
1006,
24880,
8569,
2546,
20346,
1010,
20014,
4769,
7770,
1007,
1063,
5164,
8569,
23891,
2099,
24829,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
1007,
1025,
2065,
1006,
4769,
7770,
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 | codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java | CompressorHttp2ConnectionEncoder.bindCompressorToStream | private void bindCompressorToStream(EmbeddedChannel compressor, int streamId) {
if (compressor != null) {
Http2Stream stream = connection().stream(streamId);
if (stream != null) {
stream.setProperty(propertyKey, compressor);
}
}
} | java | private void bindCompressorToStream(EmbeddedChannel compressor, int streamId) {
if (compressor != null) {
Http2Stream stream = connection().stream(streamId);
if (stream != null) {
stream.setProperty(propertyKey, compressor);
}
}
} | [
"private",
"void",
"bindCompressorToStream",
"(",
"EmbeddedChannel",
"compressor",
",",
"int",
"streamId",
")",
"{",
"if",
"(",
"compressor",
"!=",
"null",
")",
"{",
"Http2Stream",
"stream",
"=",
"connection",
"(",
")",
".",
"stream",
"(",
"streamId",
")",
"... | Called after the super class has written the headers and created any associated stream objects.
@param compressor The compressor associated with the stream identified by {@code streamId}.
@param streamId The stream id for which the headers were written. | [
"Called",
"after",
"the",
"super",
"class",
"has",
"written",
"the",
"headers",
"and",
"created",
"any",
"associated",
"stream",
"objects",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java#L271-L278 | train | Binds the given compressor to the given stream. | [
30522,
2797,
11675,
14187,
9006,
20110,
11589,
14122,
16416,
2213,
1006,
11157,
26058,
29329,
1010,
20014,
5460,
3593,
1007,
1063,
2065,
1006,
29329,
999,
1027,
19701,
1007,
1063,
8299,
2475,
21422,
5460,
1027,
4434,
1006,
1007,
1012,
5460,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/NonReusingBuildFirstHashJoinIterator.java | NonReusingBuildFirstHashJoinIterator.open | @Override
public void open() throws IOException, MemoryAllocationException, InterruptedException {
this.hashJoin.open(this.firstInput, this.secondInput, this.buildSideOuterJoin);
} | java | @Override
public void open() throws IOException, MemoryAllocationException, InterruptedException {
this.hashJoin.open(this.firstInput, this.secondInput, this.buildSideOuterJoin);
} | [
"@",
"Override",
"public",
"void",
"open",
"(",
")",
"throws",
"IOException",
",",
"MemoryAllocationException",
",",
"InterruptedException",
"{",
"this",
".",
"hashJoin",
".",
"open",
"(",
"this",
".",
"firstInput",
",",
"this",
".",
"secondInput",
",",
"this"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/NonReusingBuildFirstHashJoinIterator.java#L96-L99 | train | Open the hash join. | [
30522,
1030,
2058,
15637,
2270,
11675,
2330,
1006,
1007,
11618,
22834,
10288,
24422,
1010,
3638,
8095,
23909,
10288,
24422,
1010,
7153,
10288,
24422,
1063,
2023,
1012,
23325,
5558,
2378,
1012,
2330,
1006,
2023,
1012,
2034,
2378,
18780,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java | SqlConnRunner.count | public int count(Connection conn, Entity where) throws SQLException {
checkConn(conn);
final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName());
PreparedStatement ps = null;
try {
ps = dialect.psForCount(conn, query);
return SqlExecutor.query(ps, new NumberHandler()).intValue();
} catch (SQLException e) {
throw e;
} finally {
DbUtil.close(ps);
}
} | java | public int count(Connection conn, Entity where) throws SQLException {
checkConn(conn);
final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName());
PreparedStatement ps = null;
try {
ps = dialect.psForCount(conn, query);
return SqlExecutor.query(ps, new NumberHandler()).intValue();
} catch (SQLException e) {
throw e;
} finally {
DbUtil.close(ps);
}
} | [
"public",
"int",
"count",
"(",
"Connection",
"conn",
",",
"Entity",
"where",
")",
"throws",
"SQLException",
"{",
"checkConn",
"(",
"conn",
")",
";",
"final",
"Query",
"query",
"=",
"new",
"Query",
"(",
"SqlUtil",
".",
"buildConditions",
"(",
"where",
")",
... | 结果的条目数
@param conn 数据库连接对象
@param where 查询条件
@return 复合条件的结果数
@throws SQLException SQL执行异常 | [
"结果的条目数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L439-L452 | train | Returns the number of rows matching the given condition. | [
30522,
2270,
20014,
4175,
1006,
4434,
9530,
2078,
1010,
9178,
2073,
1007,
11618,
29296,
10288,
24422,
1063,
4638,
8663,
2078,
1006,
9530,
2078,
1007,
1025,
2345,
23032,
23032,
1027,
2047,
23032,
1006,
29296,
21823,
2140,
1012,
3857,
8663,
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-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java | VelocityUtil.merge | public static void merge(Template template, VelocityContext context, Writer writer) {
if (template == null) {
throw new UtilException("Template is null");
}
if (context == null) {
context = new VelocityContext(globalContext);
} else {
// 加入全局上下文
for (Entry<String, Object> entry : globalContext.entrySet()) {
context.put(entry.getKey(), entry.getValue());
}
}
template.merge(context, writer);
} | java | public static void merge(Template template, VelocityContext context, Writer writer) {
if (template == null) {
throw new UtilException("Template is null");
}
if (context == null) {
context = new VelocityContext(globalContext);
} else {
// 加入全局上下文
for (Entry<String, Object> entry : globalContext.entrySet()) {
context.put(entry.getKey(), entry.getValue());
}
}
template.merge(context, writer);
} | [
"public",
"static",
"void",
"merge",
"(",
"Template",
"template",
",",
"VelocityContext",
"context",
",",
"Writer",
"writer",
")",
"{",
"if",
"(",
"template",
"==",
"null",
")",
"{",
"throw",
"new",
"UtilException",
"(",
"\"Template is null\"",
")",
";",
"}"... | 融合模板和内容并写入到Writer
@param template 模板
@param context 内容
@param writer Writer | [
"融合模板和内容并写入到Writer"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L254-L268 | train | Merge the given VelocityContext with the given Template. | [
30522,
2270,
10763,
11675,
13590,
1006,
23561,
23561,
1010,
10146,
8663,
18209,
6123,
1010,
3213,
3213,
1007,
1063,
2065,
1006,
23561,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
21183,
9463,
2595,
24422,
1006,
1000,
23561,
2003,
19701,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/dataproperties/RequestedGlobalProperties.java | RequestedGlobalProperties.parameterizeChannel | public void parameterizeChannel(Channel channel, boolean globalDopChange,
ExecutionMode exchangeMode, boolean breakPipeline) {
// safety check. Fully replicated input must be preserved.
if (channel.getSource().getGlobalProperties().isFullyReplicated() &&
!(this.partitioning == PartitioningProperty.FULL_REPLICATION ||
this.partitioning == PartitioningProperty.ANY_DISTRIBUTION))
{
throw new CompilerException("Fully replicated input must be preserved " +
"and may not be converted into another global property.");
}
// if we request nothing, then we need no special strategy. forward, if the number of instances remains
// the same, randomly repartition otherwise
if (isTrivial() || this.partitioning == PartitioningProperty.ANY_DISTRIBUTION) {
ShipStrategyType shipStrategy = globalDopChange ? ShipStrategyType.PARTITION_RANDOM :
ShipStrategyType.FORWARD;
DataExchangeMode em = DataExchangeMode.select(exchangeMode, shipStrategy, breakPipeline);
channel.setShipStrategy(shipStrategy, em);
return;
}
final GlobalProperties inGlobals = channel.getSource().getGlobalProperties();
// if we have no global parallelism change, check if we have already compatible global properties
if (!globalDopChange && isMetBy(inGlobals)) {
DataExchangeMode em = DataExchangeMode.select(exchangeMode, ShipStrategyType.FORWARD, breakPipeline);
channel.setShipStrategy(ShipStrategyType.FORWARD, em);
return;
}
// if we fall through the conditions until here, we need to re-establish
ShipStrategyType shipType;
FieldList partitionKeys;
boolean[] sortDirection;
Partitioner<?> partitioner;
switch (this.partitioning) {
case FULL_REPLICATION:
shipType = ShipStrategyType.BROADCAST;
partitionKeys = null;
sortDirection = null;
partitioner = null;
break;
case ANY_PARTITIONING:
case HASH_PARTITIONED:
shipType = ShipStrategyType.PARTITION_HASH;
partitionKeys = Utils.createOrderedFromSet(this.partitioningFields);
sortDirection = null;
partitioner = null;
break;
case RANGE_PARTITIONED:
shipType = ShipStrategyType.PARTITION_RANGE;
partitionKeys = this.ordering.getInvolvedIndexes();
sortDirection = this.ordering.getFieldSortDirections();
partitioner = null;
if (this.dataDistribution != null) {
channel.setDataDistribution(this.dataDistribution);
}
break;
case FORCED_REBALANCED:
shipType = ShipStrategyType.PARTITION_FORCED_REBALANCE;
partitionKeys = null;
sortDirection = null;
partitioner = null;
break;
case CUSTOM_PARTITIONING:
shipType = ShipStrategyType.PARTITION_CUSTOM;
partitionKeys = Utils.createOrderedFromSet(this.partitioningFields);
sortDirection = null;
partitioner = this.customPartitioner;
break;
default:
throw new CompilerException("Invalid partitioning to create through a data exchange: "
+ this.partitioning.name());
}
DataExchangeMode exMode = DataExchangeMode.select(exchangeMode, shipType, breakPipeline);
channel.setShipStrategy(shipType, partitionKeys, sortDirection, partitioner, exMode);
} | java | public void parameterizeChannel(Channel channel, boolean globalDopChange,
ExecutionMode exchangeMode, boolean breakPipeline) {
// safety check. Fully replicated input must be preserved.
if (channel.getSource().getGlobalProperties().isFullyReplicated() &&
!(this.partitioning == PartitioningProperty.FULL_REPLICATION ||
this.partitioning == PartitioningProperty.ANY_DISTRIBUTION))
{
throw new CompilerException("Fully replicated input must be preserved " +
"and may not be converted into another global property.");
}
// if we request nothing, then we need no special strategy. forward, if the number of instances remains
// the same, randomly repartition otherwise
if (isTrivial() || this.partitioning == PartitioningProperty.ANY_DISTRIBUTION) {
ShipStrategyType shipStrategy = globalDopChange ? ShipStrategyType.PARTITION_RANDOM :
ShipStrategyType.FORWARD;
DataExchangeMode em = DataExchangeMode.select(exchangeMode, shipStrategy, breakPipeline);
channel.setShipStrategy(shipStrategy, em);
return;
}
final GlobalProperties inGlobals = channel.getSource().getGlobalProperties();
// if we have no global parallelism change, check if we have already compatible global properties
if (!globalDopChange && isMetBy(inGlobals)) {
DataExchangeMode em = DataExchangeMode.select(exchangeMode, ShipStrategyType.FORWARD, breakPipeline);
channel.setShipStrategy(ShipStrategyType.FORWARD, em);
return;
}
// if we fall through the conditions until here, we need to re-establish
ShipStrategyType shipType;
FieldList partitionKeys;
boolean[] sortDirection;
Partitioner<?> partitioner;
switch (this.partitioning) {
case FULL_REPLICATION:
shipType = ShipStrategyType.BROADCAST;
partitionKeys = null;
sortDirection = null;
partitioner = null;
break;
case ANY_PARTITIONING:
case HASH_PARTITIONED:
shipType = ShipStrategyType.PARTITION_HASH;
partitionKeys = Utils.createOrderedFromSet(this.partitioningFields);
sortDirection = null;
partitioner = null;
break;
case RANGE_PARTITIONED:
shipType = ShipStrategyType.PARTITION_RANGE;
partitionKeys = this.ordering.getInvolvedIndexes();
sortDirection = this.ordering.getFieldSortDirections();
partitioner = null;
if (this.dataDistribution != null) {
channel.setDataDistribution(this.dataDistribution);
}
break;
case FORCED_REBALANCED:
shipType = ShipStrategyType.PARTITION_FORCED_REBALANCE;
partitionKeys = null;
sortDirection = null;
partitioner = null;
break;
case CUSTOM_PARTITIONING:
shipType = ShipStrategyType.PARTITION_CUSTOM;
partitionKeys = Utils.createOrderedFromSet(this.partitioningFields);
sortDirection = null;
partitioner = this.customPartitioner;
break;
default:
throw new CompilerException("Invalid partitioning to create through a data exchange: "
+ this.partitioning.name());
}
DataExchangeMode exMode = DataExchangeMode.select(exchangeMode, shipType, breakPipeline);
channel.setShipStrategy(shipType, partitionKeys, sortDirection, partitioner, exMode);
} | [
"public",
"void",
"parameterizeChannel",
"(",
"Channel",
"channel",
",",
"boolean",
"globalDopChange",
",",
"ExecutionMode",
"exchangeMode",
",",
"boolean",
"breakPipeline",
")",
"{",
"// safety check. Fully replicated input must be preserved.",
"if",
"(",
"channel",
".",
... | Parametrizes the ship strategy fields of a channel such that the channel produces
the desired global properties.
@param channel The channel to parametrize.
@param globalDopChange Flag indicating whether the parallelism changes
between sender and receiver.
@param exchangeMode The mode of data exchange (pipelined, always batch,
batch only on shuffle, ...)
@param breakPipeline Indicates whether this data exchange should break
pipelines (unless pipelines are forced). | [
"Parametrizes",
"the",
"ship",
"strategy",
"fields",
"of",
"a",
"channel",
"such",
"that",
"the",
"channel",
"produces",
"the",
"desired",
"global",
"properties",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dataproperties/RequestedGlobalProperties.java#L350-L435 | train | Parameterizes the channel. | [
30522,
2270,
11675,
16381,
4697,
26058,
1006,
3149,
3149,
1010,
22017,
20898,
3795,
3527,
15042,
18003,
2063,
1010,
7781,
5302,
3207,
3863,
5302,
3207,
1010,
22017,
20898,
3338,
24548,
4179,
1007,
1063,
1013,
1013,
3808,
4638,
1012,
3929,
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/io/FileUtil.java | FileUtil.containsInvalid | public static boolean containsInvalid(String fileName) {
return StrUtil.isBlank(fileName) ? false : ReUtil.contains(FILE_NAME_INVALID_PATTERN_WIN, fileName);
} | java | public static boolean containsInvalid(String fileName) {
return StrUtil.isBlank(fileName) ? false : ReUtil.contains(FILE_NAME_INVALID_PATTERN_WIN, fileName);
} | [
"public",
"static",
"boolean",
"containsInvalid",
"(",
"String",
"fileName",
")",
"{",
"return",
"StrUtil",
".",
"isBlank",
"(",
"fileName",
")",
"?",
"false",
":",
"ReUtil",
".",
"contains",
"(",
"FILE_NAME_INVALID_PATTERN_WIN",
",",
"fileName",
")",
";",
"}"... | 文件名中是否包含在Windows下不支持的非法字符,包括: \ / : * ? " < > |
@param fileName 文件名(必须不包括路径,否则路径符将被替换)
@return 是否包含非法字符
@since 3.3.1 | [
"文件名中是否包含在Windows下不支持的非法字符,包括:",
"\\",
"/",
":",
"*",
"?",
"<",
";",
">",
";",
"|"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3266-L3268 | train | Checks if the given file name contains invalid characters. | [
30522,
2270,
10763,
22017,
20898,
3397,
2378,
10175,
3593,
1006,
5164,
5371,
18442,
1007,
1063,
2709,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
5371,
18442,
1007,
1029,
6270,
1024,
2128,
21823,
2140,
1012,
3397,
1006,
5371,
1035,
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... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/IterativeStream.java | IterativeStream.withFeedbackType | public <F> ConnectedIterativeStreams<T, F> withFeedbackType(Class<F> feedbackTypeClass) {
return withFeedbackType(TypeInformation.of(feedbackTypeClass));
} | java | public <F> ConnectedIterativeStreams<T, F> withFeedbackType(Class<F> feedbackTypeClass) {
return withFeedbackType(TypeInformation.of(feedbackTypeClass));
} | [
"public",
"<",
"F",
">",
"ConnectedIterativeStreams",
"<",
"T",
",",
"F",
">",
"withFeedbackType",
"(",
"Class",
"<",
"F",
">",
"feedbackTypeClass",
")",
"{",
"return",
"withFeedbackType",
"(",
"TypeInformation",
".",
"of",
"(",
"feedbackTypeClass",
")",
")",
... | Changes the feedback type of the iteration and allows the user to apply
co-transformations on the input and feedback stream, as in a
{@link ConnectedStreams}.
<p>For type safety the user needs to define the feedback type
@param feedbackTypeClass
Class of the elements in the feedback stream.
@return A {@link ConnectedIterativeStreams}. | [
"Changes",
"the",
"feedback",
"type",
"of",
"the",
"iteration",
"and",
"allows",
"the",
"user",
"to",
"apply",
"co",
"-",
"transformations",
"on",
"the",
"input",
"and",
"feedback",
"stream",
"as",
"in",
"a",
"{",
"@link",
"ConnectedStreams",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/IterativeStream.java#L93-L95 | train | Sets the feedback type of the connected iterators. | [
30522,
2270,
1026,
1042,
1028,
4198,
21646,
8082,
21422,
2015,
1026,
1056,
1010,
1042,
1028,
2007,
7959,
2098,
5963,
13874,
1006,
2465,
1026,
1042,
1028,
12247,
13874,
26266,
1007,
1063,
2709,
2007,
7959,
2098,
5963,
13874,
1006,
2828,
2378... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java | QrCodeUtil.generatePng | public static byte[] generatePng(String content, int width, int height) {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
generate(content, width, height, ImgUtil.IMAGE_TYPE_PNG, out);
return out.toByteArray();
} | java | public static byte[] generatePng(String content, int width, int height) {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
generate(content, width, height, ImgUtil.IMAGE_TYPE_PNG, out);
return out.toByteArray();
} | [
"public",
"static",
"byte",
"[",
"]",
"generatePng",
"(",
"String",
"content",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"final",
"ByteArrayOutputStream",
"out",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"generate",
"(",
"content",
",",
... | 生成PNG格式的二维码图片,以byte[]形式表示
@param content 内容
@param width 宽度
@param height 高度
@return 图片的byte[]
@since 4.0.10 | [
"生成PNG格式的二维码图片,以byte",
"[]",
"形式表示"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L47-L51 | train | Generates a PNG image of the specified size. | [
30522,
2270,
10763,
24880,
1031,
1033,
9699,
2361,
3070,
1006,
5164,
4180,
1010,
20014,
9381,
1010,
20014,
4578,
1007,
1063,
2345,
24880,
2906,
9447,
5833,
18780,
21422,
2041,
1027,
2047,
24880,
2906,
9447,
5833,
18780,
21422,
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-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopOutputFormatBase.java | HadoopOutputFormatBase.close | @Override
public void close() throws IOException {
// enforce sequential close() calls
synchronized (CLOSE_MUTEX) {
try {
this.recordWriter.close(this.context);
} catch (InterruptedException e) {
throw new IOException("Could not close RecordReader.", e);
}
if (this.outputCommitter.needsTaskCommit(this.context)) {
this.outputCommitter.commitTask(this.context);
}
Path outputPath = new Path(this.configuration.get("mapred.output.dir"));
// rename tmp-file to final name
FileSystem fs = FileSystem.get(outputPath.toUri(), this.configuration);
String taskNumberStr = Integer.toString(this.taskNumber);
String tmpFileTemplate = "tmp-r-00000";
String tmpFile = tmpFileTemplate.substring(0, 11 - taskNumberStr.length()) + taskNumberStr;
if (fs.exists(new Path(outputPath.toString() + "/" + tmpFile))) {
fs.rename(new Path(outputPath.toString() + "/" + tmpFile), new Path(outputPath.toString() + "/" + taskNumberStr));
}
}
} | java | @Override
public void close() throws IOException {
// enforce sequential close() calls
synchronized (CLOSE_MUTEX) {
try {
this.recordWriter.close(this.context);
} catch (InterruptedException e) {
throw new IOException("Could not close RecordReader.", e);
}
if (this.outputCommitter.needsTaskCommit(this.context)) {
this.outputCommitter.commitTask(this.context);
}
Path outputPath = new Path(this.configuration.get("mapred.output.dir"));
// rename tmp-file to final name
FileSystem fs = FileSystem.get(outputPath.toUri(), this.configuration);
String taskNumberStr = Integer.toString(this.taskNumber);
String tmpFileTemplate = "tmp-r-00000";
String tmpFile = tmpFileTemplate.substring(0, 11 - taskNumberStr.length()) + taskNumberStr;
if (fs.exists(new Path(outputPath.toString() + "/" + tmpFile))) {
fs.rename(new Path(outputPath.toString() + "/" + tmpFile), new Path(outputPath.toString() + "/" + taskNumberStr));
}
}
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"// enforce sequential close() calls",
"synchronized",
"(",
"CLOSE_MUTEX",
")",
"{",
"try",
"{",
"this",
".",
"recordWriter",
".",
"close",
"(",
"this",
".",
"context",
")",
";... | commit the task by moving the output file out from the temporary directory.
@throws java.io.IOException | [
"commit",
"the",
"task",
"by",
"moving",
"the",
"output",
"file",
"out",
"from",
"the",
"temporary",
"directory",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapreduce/HadoopOutputFormatBase.java#L160-L188 | train | Close the underlying RecordReader. | [
30522,
1030,
2058,
15637,
2270,
11675,
2485,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
16306,
25582,
2485,
1006,
1007,
4455,
25549,
1006,
2485,
1035,
20101,
2595,
1007,
1063,
3046,
1063,
2023,
1012,
2501,
15994,
1012,
2485,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java | FileWriter.writeMap | public File writeMap(Map<?, ?> map, String kvSeparator, boolean isAppend) throws IORuntimeException {
return writeMap(map, null, kvSeparator, isAppend);
} | java | public File writeMap(Map<?, ?> map, String kvSeparator, boolean isAppend) throws IORuntimeException {
return writeMap(map, null, kvSeparator, isAppend);
} | [
"public",
"File",
"writeMap",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"String",
"kvSeparator",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"writeMap",
"(",
"map",
",",
"null",
",",
"kvSeparator",
",",
"isAppend"... | 将Map写入文件,每个键值对为一行,一行中键与值之间使用kvSeparator分隔
@param map Map
@param kvSeparator 键和值之间的分隔符,如果传入null使用默认分隔符" = "
@param isAppend 是否追加
@return 目标文件
@throws IORuntimeException IO异常
@since 4.0.5 | [
"将Map写入文件,每个键值对为一行,一行中键与值之间使用kvSeparator分隔"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java#L220-L222 | train | Write a map to the file. | [
30522,
2270,
5371,
4339,
2863,
2361,
1006,
4949,
1026,
1029,
1010,
1029,
1028,
4949,
1010,
5164,
24888,
3366,
28689,
4263,
1010,
22017,
20898,
18061,
21512,
4859,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
4339,
2863,
2361,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java | TouchActions.move | public TouchActions move(int x, int y) {
if (touchScreen != null) {
action.addAction(new MoveAction(touchScreen, x, y));
}
return this;
} | java | public TouchActions move(int x, int y) {
if (touchScreen != null) {
action.addAction(new MoveAction(touchScreen, x, y));
}
return this;
} | [
"public",
"TouchActions",
"move",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"if",
"(",
"touchScreen",
"!=",
"null",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"MoveAction",
"(",
"touchScreen",
",",
"x",
",",
"y",
")",
")",
";",
"}",
"retur... | Allows the execution of the gesture 'move' on the screen.
@param x The x coordinate relative to the viewport
@param y The y coordinate relative to the viewport
@return self | [
"Allows",
"the",
"execution",
"of",
"the",
"gesture",
"move",
"on",
"the",
"screen",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java#L100-L105 | train | Move the touch screen to the specified coordinates. | [
30522,
2270,
3543,
18908,
8496,
2693,
1006,
20014,
1060,
1010,
20014,
1061,
1007,
1063,
2065,
1006,
3543,
18182,
999,
1027,
19701,
1007,
1063,
2895,
1012,
5587,
18908,
3258,
1006,
2047,
2693,
18908,
3258,
1006,
3543,
18182,
1010,
1060,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.flip | public static void flip(Image image, OutputStream out) throws IORuntimeException {
flip(image, getImageOutputStream(out));
} | java | public static void flip(Image image, OutputStream out) throws IORuntimeException {
flip(image, getImageOutputStream(out));
} | [
"public",
"static",
"void",
"flip",
"(",
"Image",
"image",
",",
"OutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"flip",
"(",
"image",
",",
"getImageOutputStream",
"(",
"out",
")",
")",
";",
"}"
] | 水平翻转图像
@param image 图像
@param out 输出
@throws IORuntimeException IO异常
@since 3.2.2 | [
"水平翻转图像"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1094-L1096 | train | Flips the image using the specified output stream. | [
30522,
2270,
10763,
11675,
11238,
1006,
3746,
3746,
1010,
27852,
25379,
2041,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
11238,
1006,
3746,
1010,
2131,
9581,
3351,
5833,
18780,
21422,
1006,
2041,
1007,
1007,
1025,
1065,
102,
30524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java | AllWindowedStream.reduce | @SuppressWarnings("unchecked")
public SingleOutputStreamOperator<T> reduce(ReduceFunction<T> function) {
if (function instanceof RichFunction) {
throw new UnsupportedOperationException("ReduceFunction of reduce can not be a RichFunction. " +
"Please use reduce(ReduceFunction, WindowFunction) instead.");
}
//clean the closure
function = input.getExecutionEnvironment().clean(function);
String callLocation = Utils.getCallLocationName();
String udfName = "AllWindowedStream." + callLocation;
return reduce(function, new PassThroughAllWindowFunction<W, T>());
} | java | @SuppressWarnings("unchecked")
public SingleOutputStreamOperator<T> reduce(ReduceFunction<T> function) {
if (function instanceof RichFunction) {
throw new UnsupportedOperationException("ReduceFunction of reduce can not be a RichFunction. " +
"Please use reduce(ReduceFunction, WindowFunction) instead.");
}
//clean the closure
function = input.getExecutionEnvironment().clean(function);
String callLocation = Utils.getCallLocationName();
String udfName = "AllWindowedStream." + callLocation;
return reduce(function, new PassThroughAllWindowFunction<W, T>());
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"SingleOutputStreamOperator",
"<",
"T",
">",
"reduce",
"(",
"ReduceFunction",
"<",
"T",
">",
"function",
")",
"{",
"if",
"(",
"function",
"instanceof",
"RichFunction",
")",
"{",
"throw",
"new",
"Uns... | Applies a reduce function to the window. The window function is called for each evaluation
of the window for each key individually. The output of the reduce function is interpreted
as a regular non-windowed stream.
<p>This window will try and incrementally aggregate data as much as the window policies permit.
For example, tumbling time windows can aggregate the data, meaning that only one element per
key is stored. Sliding time windows will aggregate on the granularity of the slide interval,
so a few elements are stored per key (one per slide interval).
Custom windows may not be able to incrementally aggregate, or may need to store extra values
in an aggregation tree.
@param function The reduce function.
@return The data stream that is the result of applying the reduce function to the window. | [
"Applies",
"a",
"reduce",
"function",
"to",
"the",
"window",
".",
"The",
"window",
"function",
"is",
"called",
"for",
"each",
"evaluation",
"of",
"the",
"window",
"for",
"each",
"key",
"individually",
".",
"The",
"output",
"of",
"the",
"reduce",
"function",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java#L205-L219 | train | Returns a new stream that combines the results of applying the given function to the windowed stream. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1056,
1028,
5547,
1006,
5547,
11263,
27989,
1026,
1056,
1028,
3853,
1007,
1063,
2065,
1006,
3853,
6013,
1125... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java | EmbeddedCLIServiceClient.executeStatement | @Override
public OperationHandle executeStatement(SessionHandle sessionHandle, String statement,
Map<String, String> confOverlay) throws HiveSQLException {
return cliService.executeStatement(sessionHandle, statement, confOverlay);
} | java | @Override
public OperationHandle executeStatement(SessionHandle sessionHandle, String statement,
Map<String, String> confOverlay) throws HiveSQLException {
return cliService.executeStatement(sessionHandle, statement, confOverlay);
} | [
"@",
"Override",
"public",
"OperationHandle",
"executeStatement",
"(",
"SessionHandle",
"sessionHandle",
",",
"String",
"statement",
",",
"Map",
"<",
"String",
",",
"String",
">",
"confOverlay",
")",
"throws",
"HiveSQLException",
"{",
"return",
"cliService",
".",
... | /* (non-Javadoc)
@see org.apache.hive.service.cli.CLIServiceClient#executeStatement(org.apache.hive.service.cli.SessionHandle,
java.lang.String, java.util.Map) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java#L74-L78 | train | Execute a statement in the session. | [
30522,
1030,
2058,
15637,
2270,
3169,
11774,
2571,
15389,
9153,
18532,
4765,
1006,
5219,
11774,
2571,
5219,
11774,
2571,
1010,
5164,
4861,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
9530,
14876,
6299,
8485,
1007,
11618,
26736,
2015,
4160,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/util/collections/FloatHashSet.java | FloatHashSet.add | public boolean add(final float k) {
int intKey = Float.floatToIntBits(k);
if (intKey == 0) {
if (this.containsZero) {
return false;
}
this.containsZero = true;
} else {
float[] key = this.key;
int pos;
int curr;
if ((curr = Float.floatToIntBits(key[pos = MurmurHashUtil.fmix(intKey) & this.mask])) != 0) {
if (curr == intKey) {
return false;
}
while ((curr = Float.floatToIntBits(key[pos = pos + 1 & this.mask])) != 0) {
if (curr == intKey) {
return false;
}
}
}
key[pos] = k;
}
if (this.size++ >= this.maxFill) {
this.rehash(OptimizableHashSet.arraySize(this.size + 1, this.f));
}
return true;
} | java | public boolean add(final float k) {
int intKey = Float.floatToIntBits(k);
if (intKey == 0) {
if (this.containsZero) {
return false;
}
this.containsZero = true;
} else {
float[] key = this.key;
int pos;
int curr;
if ((curr = Float.floatToIntBits(key[pos = MurmurHashUtil.fmix(intKey) & this.mask])) != 0) {
if (curr == intKey) {
return false;
}
while ((curr = Float.floatToIntBits(key[pos = pos + 1 & this.mask])) != 0) {
if (curr == intKey) {
return false;
}
}
}
key[pos] = k;
}
if (this.size++ >= this.maxFill) {
this.rehash(OptimizableHashSet.arraySize(this.size + 1, this.f));
}
return true;
} | [
"public",
"boolean",
"add",
"(",
"final",
"float",
"k",
")",
"{",
"int",
"intKey",
"=",
"Float",
".",
"floatToIntBits",
"(",
"k",
")",
";",
"if",
"(",
"intKey",
"==",
"0",
")",
"{",
"if",
"(",
"this",
".",
"containsZero",
")",
"{",
"return",
"false... | See {@link Float#equals(Object)}. | [
"See",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/util/collections/FloatHashSet.java#L45-L77 | train | Add a value to the set. | [
30522,
2270,
22017,
20898,
5587,
1006,
2345,
14257,
1047,
1007,
1063,
20014,
20014,
14839,
1027,
14257,
1012,
14257,
3406,
18447,
16313,
2015,
1006,
1047,
1007,
1025,
2065,
1006,
20014,
14839,
1027,
1027,
1014,
1007,
1063,
2065,
1006,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.page | public <T> T page(Entity where, int page, int numPerPage, RsHandler<T> rsh) throws SQLException {
return page(where, new Page(page, numPerPage), rsh);
} | java | public <T> T page(Entity where, int page, int numPerPage, RsHandler<T> rsh) throws SQLException {
return page(where, new Page(page, numPerPage), rsh);
} | [
"public",
"<",
"T",
">",
"T",
"page",
"(",
"Entity",
"where",
",",
"int",
"page",
",",
"int",
"numPerPage",
",",
"RsHandler",
"<",
"T",
">",
"rsh",
")",
"throws",
"SQLException",
"{",
"return",
"page",
"(",
"where",
",",
"new",
"Page",
"(",
"page",
... | 分页查询<br>
查询条件为多个key value对表示,默认key = value,如果使用其它条件可以使用:where.put("key", " > 1"),value也可以传Condition对象,key被忽略
@param <T> 结果对象类型
@param where 条件实体类(包含表名)
@param page 页码
@param numPerPage 每页条目数
@param rsh 结果集处理对象
@return 结果对象
@throws SQLException SQL执行异常
@since 3.2.2 | [
"分页查询<br",
">",
"查询条件为多个key",
"value对表示,默认key",
"=",
"value,如果使用其它条件可以使用:where",
".",
"put",
"(",
"key",
">",
";",
"1",
")",
",value也可以传Condition对象,key被忽略"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L644-L646 | train | Creates a new page of entities. | [
30522,
2270,
1026,
1056,
1028,
1056,
3931,
1006,
9178,
2073,
1010,
20014,
3931,
1010,
20014,
16371,
8737,
2121,
13704,
1010,
12667,
11774,
3917,
1026,
1056,
1028,
12667,
2232,
1007,
11618,
29296,
10288,
24422,
1063,
30524,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readString | public static String readString(File file, String charsetName) throws IORuntimeException {
return readString(file, CharsetUtil.charset(charsetName));
} | java | public static String readString(File file, String charsetName) throws IORuntimeException {
return readString(file, CharsetUtil.charset(charsetName));
} | [
"public",
"static",
"String",
"readString",
"(",
"File",
"file",
",",
"String",
"charsetName",
")",
"throws",
"IORuntimeException",
"{",
"return",
"readString",
"(",
"file",
",",
"CharsetUtil",
".",
"charset",
"(",
"charsetName",
")",
")",
";",
"}"
] | 读取文件内容
@param file 文件
@param charsetName 字符集
@return 内容
@throws IORuntimeException IO异常 | [
"读取文件内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2090-L2092 | train | Reads a string from a file with the specified charset. | [
30522,
2270,
10763,
5164,
9631,
18886,
3070,
1006,
5371,
5371,
1010,
5164,
25869,
13462,
18442,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
9631,
18886,
3070,
1006,
5371,
1010,
25869,
13462,
21823,
2140,
1012,
25869,
13462,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java | KeyUtil.generateKey | public static SecretKey generateKey(String algorithm, KeySpec keySpec) {
final SecretKeyFactory keyFactory = getSecretKeyFactory(algorithm);
try {
return keyFactory.generateSecret(keySpec);
} catch (InvalidKeySpecException e) {
throw new CryptoException(e);
}
} | java | public static SecretKey generateKey(String algorithm, KeySpec keySpec) {
final SecretKeyFactory keyFactory = getSecretKeyFactory(algorithm);
try {
return keyFactory.generateSecret(keySpec);
} catch (InvalidKeySpecException e) {
throw new CryptoException(e);
}
} | [
"public",
"static",
"SecretKey",
"generateKey",
"(",
"String",
"algorithm",
",",
"KeySpec",
"keySpec",
")",
"{",
"final",
"SecretKeyFactory",
"keyFactory",
"=",
"getSecretKeyFactory",
"(",
"algorithm",
")",
";",
"try",
"{",
"return",
"keyFactory",
".",
"generateSe... | 生成 {@link SecretKey},仅用于对称加密和摘要算法
@param algorithm 算法
@param keySpec {@link KeySpec}
@return {@link SecretKey} | [
"生成",
"{",
"@link",
"SecretKey",
"}",
",仅用于对称加密和摘要算法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L188-L195 | train | Generates a secret key using the specified algorithm and key spec. | [
30522,
2270,
10763,
3595,
14839,
9699,
14839,
1006,
5164,
9896,
1010,
6309,
5051,
2278,
6309,
5051,
2278,
1007,
1063,
2345,
3595,
14839,
21450,
3145,
21450,
1027,
4152,
8586,
13465,
14839,
21450,
1006,
9896,
1007,
1025,
3046,
1063,
2709,
31... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.