repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java | ThriftHttpServlet.getAuthHeader | private String getAuthHeader(HttpServletRequest request, String authType)
throws HttpAuthenticationException {
String authHeader = request.getHeader(HttpAuthUtils.AUTHORIZATION);
// Each http request must have an Authorization header
if (authHeader == null || authHeader.isEmpty()) {
throw new HttpAuthenticationException("Authorization header received " +
"from the client is empty.");
}
String authHeaderBase64String;
int beginIndex;
if (isKerberosAuthMode(authType)) {
beginIndex = (HttpAuthUtils.NEGOTIATE + " ").length();
}
else {
beginIndex = (HttpAuthUtils.BASIC + " ").length();
}
authHeaderBase64String = authHeader.substring(beginIndex);
// Authorization header must have a payload
if (authHeaderBase64String == null || authHeaderBase64String.isEmpty()) {
throw new HttpAuthenticationException("Authorization header received " +
"from the client does not contain any data.");
}
return authHeaderBase64String;
} | java | private String getAuthHeader(HttpServletRequest request, String authType)
throws HttpAuthenticationException {
String authHeader = request.getHeader(HttpAuthUtils.AUTHORIZATION);
// Each http request must have an Authorization header
if (authHeader == null || authHeader.isEmpty()) {
throw new HttpAuthenticationException("Authorization header received " +
"from the client is empty.");
}
String authHeaderBase64String;
int beginIndex;
if (isKerberosAuthMode(authType)) {
beginIndex = (HttpAuthUtils.NEGOTIATE + " ").length();
}
else {
beginIndex = (HttpAuthUtils.BASIC + " ").length();
}
authHeaderBase64String = authHeader.substring(beginIndex);
// Authorization header must have a payload
if (authHeaderBase64String == null || authHeaderBase64String.isEmpty()) {
throw new HttpAuthenticationException("Authorization header received " +
"from the client does not contain any data.");
}
return authHeaderBase64String;
} | [
"private",
"String",
"getAuthHeader",
"(",
"HttpServletRequest",
"request",
",",
"String",
"authType",
")",
"throws",
"HttpAuthenticationException",
"{",
"String",
"authHeader",
"=",
"request",
".",
"getHeader",
"(",
"HttpAuthUtils",
".",
"AUTHORIZATION",
")",
";",
... | Returns the base64 encoded auth header payload
@param request
@param authType
@return
@throws HttpAuthenticationException | [
"Returns",
"the",
"base64",
"encoded",
"auth",
"header",
"payload"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java#L496-L520 | train | Get the Authorization header from the request | [
30522,
2797,
5164,
2131,
4887,
2705,
4974,
2121,
1006,
16770,
2121,
2615,
7485,
2890,
15500,
5227,
1010,
5164,
8740,
2705,
13874,
1007,
11618,
8299,
4887,
10760,
16778,
10719,
10288,
24422,
1063,
5164,
8740,
2705,
4974,
2121,
1027,
5227,
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... |
networknt/light-4j | client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java | CharArrayBuffer.substringTrimmed | public String substringTrimmed(final int beginIndex, final int endIndex) {
if (beginIndex < 0) {
throw new IndexOutOfBoundsException("Negative beginIndex: " + beginIndex);
}
if (endIndex > this.len) {
throw new IndexOutOfBoundsException("endIndex: " + endIndex + " > length: " + this.len);
}
if (beginIndex > endIndex) {
throw new IndexOutOfBoundsException("beginIndex: " + beginIndex + " > endIndex: " + endIndex);
}
int beginIndex0 = beginIndex;
int endIndex0 = endIndex;
while (beginIndex0 < endIndex && isWhitespace(this.array[beginIndex0])) {
beginIndex0++;
}
while (endIndex0 > beginIndex0 && isWhitespace(this.array[endIndex0 - 1])) {
endIndex0--;
}
return new String(this.array, beginIndex0, endIndex0 - beginIndex0);
} | java | public String substringTrimmed(final int beginIndex, final int endIndex) {
if (beginIndex < 0) {
throw new IndexOutOfBoundsException("Negative beginIndex: " + beginIndex);
}
if (endIndex > this.len) {
throw new IndexOutOfBoundsException("endIndex: " + endIndex + " > length: " + this.len);
}
if (beginIndex > endIndex) {
throw new IndexOutOfBoundsException("beginIndex: " + beginIndex + " > endIndex: " + endIndex);
}
int beginIndex0 = beginIndex;
int endIndex0 = endIndex;
while (beginIndex0 < endIndex && isWhitespace(this.array[beginIndex0])) {
beginIndex0++;
}
while (endIndex0 > beginIndex0 && isWhitespace(this.array[endIndex0 - 1])) {
endIndex0--;
}
return new String(this.array, beginIndex0, endIndex0 - beginIndex0);
} | [
"public",
"String",
"substringTrimmed",
"(",
"final",
"int",
"beginIndex",
",",
"final",
"int",
"endIndex",
")",
"{",
"if",
"(",
"beginIndex",
"<",
"0",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Negative beginIndex: \"",
"+",
"beginIndex",
"... | Returns a substring of this buffer with leading and trailing whitespace
omitted. The substring begins with the first non-whitespace character
from {@code beginIndex} and extends to the last
non-whitespace character with the index lesser than
{@code endIndex}.
@param beginIndex the beginning index, inclusive.
@param endIndex the ending index, exclusive.
@return the specified substring.
@throws IndexOutOfBoundsException if the
{@code beginIndex} is negative, or
{@code endIndex} is larger than the length of this
buffer, or {@code beginIndex} is larger than
{@code endIndex}. | [
"Returns",
"a",
"substring",
"of",
"this",
"buffer",
"with",
"leading",
"and",
"trailing",
"whitespace",
"omitted",
".",
"The",
"substring",
"begins",
"with",
"the",
"first",
"non",
"-",
"whitespace",
"character",
"from",
"{",
"@code",
"beginIndex",
"}",
"and"... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/org/apache/hc/core5/util/copied/CharArrayBuffer.java#L452-L471 | train | Gets a substring trimmed from the specified begin and endIndex. | [
30522,
2270,
5164,
4942,
3367,
4892,
18886,
20058,
2094,
1006,
2345,
20014,
4088,
22254,
10288,
1010,
2345,
20014,
2203,
22254,
10288,
1007,
1063,
2065,
1006,
4088,
22254,
10288,
1026,
1014,
1007,
1063,
5466,
2047,
5950,
5833,
11253,
15494,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.stringifyException | public static String stringifyException(final Throwable e) {
if (e == null) {
return STRINGIFIED_NULL_EXCEPTION;
}
try {
StringWriter stm = new StringWriter();
PrintWriter wrt = new PrintWriter(stm);
e.printStackTrace(wrt);
wrt.close();
return stm.toString();
}
catch (Throwable t) {
return e.getClass().getName() + " (error while printing stack trace)";
}
} | java | public static String stringifyException(final Throwable e) {
if (e == null) {
return STRINGIFIED_NULL_EXCEPTION;
}
try {
StringWriter stm = new StringWriter();
PrintWriter wrt = new PrintWriter(stm);
e.printStackTrace(wrt);
wrt.close();
return stm.toString();
}
catch (Throwable t) {
return e.getClass().getName() + " (error while printing stack trace)";
}
} | [
"public",
"static",
"String",
"stringifyException",
"(",
"final",
"Throwable",
"e",
")",
"{",
"if",
"(",
"e",
"==",
"null",
")",
"{",
"return",
"STRINGIFIED_NULL_EXCEPTION",
";",
"}",
"try",
"{",
"StringWriter",
"stm",
"=",
"new",
"StringWriter",
"(",
")",
... | Makes a string representation of the exception's stack trace, or "(null)", if the
exception is null.
<p>This method makes a best effort and never fails.
@param e The exception to stringify.
@return A string with exception name and call stack. | [
"Makes",
"a",
"string",
"representation",
"of",
"the",
"exception",
"s",
"stack",
"trace",
"or",
"(",
"null",
")",
"if",
"the",
"exception",
"is",
"null",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java#L60-L75 | train | Returns a String representation of the given exception. | [
30522,
2270,
10763,
5164,
5164,
8757,
10288,
24422,
1006,
2345,
5466,
3085,
1041,
1007,
1063,
2065,
1006,
1041,
1027,
1027,
19701,
1007,
1063,
2709,
5164,
7810,
1035,
19701,
1035,
6453,
1025,
1065,
3046,
1063,
5164,
15994,
2358,
2213,
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-optimizer/src/main/java/org/apache/flink/optimizer/plantranslate/JobGraphGenerator.java | JobGraphGenerator.connectJobVertices | private DistributionPattern connectJobVertices(Channel channel, int inputNumber,
final JobVertex sourceVertex, final TaskConfig sourceConfig,
final JobVertex targetVertex, final TaskConfig targetConfig, boolean isBroadcast)
throws CompilerException
{
// ------------ connect the vertices to the job graph --------------
final DistributionPattern distributionPattern;
switch (channel.getShipStrategy()) {
case FORWARD:
distributionPattern = DistributionPattern.POINTWISE;
break;
case PARTITION_RANDOM:
case BROADCAST:
case PARTITION_HASH:
case PARTITION_CUSTOM:
case PARTITION_RANGE:
case PARTITION_FORCED_REBALANCE:
distributionPattern = DistributionPattern.ALL_TO_ALL;
break;
default:
throw new RuntimeException("Unknown runtime ship strategy: " + channel.getShipStrategy());
}
final ResultPartitionType resultType;
switch (channel.getDataExchangeMode()) {
case PIPELINED:
resultType = ResultPartitionType.PIPELINED;
break;
case BATCH:
// BLOCKING results are currently not supported in closed loop iterations
//
// See https://issues.apache.org/jira/browse/FLINK-1713 for details
resultType = channel.getSource().isOnDynamicPath()
? ResultPartitionType.PIPELINED
: ResultPartitionType.BLOCKING;
break;
case PIPELINE_WITH_BATCH_FALLBACK:
throw new UnsupportedOperationException("Data exchange mode " +
channel.getDataExchangeMode() + " currently not supported.");
default:
throw new UnsupportedOperationException("Unknown data exchange mode.");
}
JobEdge edge = targetVertex.connectNewDataSetAsInput(sourceVertex, distributionPattern, resultType);
// -------------- configure the source task's ship strategy strategies in task config --------------
final int outputIndex = sourceConfig.getNumOutputs();
sourceConfig.addOutputShipStrategy(channel.getShipStrategy());
if (outputIndex == 0) {
sourceConfig.setOutputSerializer(channel.getSerializer());
}
if (channel.getShipStrategyComparator() != null) {
sourceConfig.setOutputComparator(channel.getShipStrategyComparator(), outputIndex);
}
if (channel.getShipStrategy() == ShipStrategyType.PARTITION_RANGE) {
final DataDistribution dataDistribution = channel.getDataDistribution();
if (dataDistribution != null) {
sourceConfig.setOutputDataDistribution(dataDistribution, outputIndex);
} else {
throw new RuntimeException("Range partitioning requires data distribution.");
}
}
if (channel.getShipStrategy() == ShipStrategyType.PARTITION_CUSTOM) {
if (channel.getPartitioner() != null) {
sourceConfig.setOutputPartitioner(channel.getPartitioner(), outputIndex);
} else {
throw new CompilerException("The ship strategy was set to custom partitioning, but no partitioner was set.");
}
}
// ---------------- configure the receiver -------------------
if (isBroadcast) {
targetConfig.addBroadcastInputToGroup(inputNumber);
} else {
targetConfig.addInputToGroup(inputNumber);
}
// ---------------- attach the additional infos to the job edge -------------------
String shipStrategy = JsonMapper.getShipStrategyString(channel.getShipStrategy());
if (channel.getShipStrategyKeys() != null && channel.getShipStrategyKeys().size() > 0) {
shipStrategy += " on " + (channel.getShipStrategySortOrder() == null ?
channel.getShipStrategyKeys().toString() :
Utils.createOrdering(channel.getShipStrategyKeys(), channel.getShipStrategySortOrder()).toString());
}
String localStrategy;
if (channel.getLocalStrategy() == null || channel.getLocalStrategy() == LocalStrategy.NONE) {
localStrategy = null;
}
else {
localStrategy = JsonMapper.getLocalStrategyString(channel.getLocalStrategy());
if (localStrategy != null && channel.getLocalStrategyKeys() != null && channel.getLocalStrategyKeys().size() > 0) {
localStrategy += " on " + (channel.getLocalStrategySortOrder() == null ?
channel.getLocalStrategyKeys().toString() :
Utils.createOrdering(channel.getLocalStrategyKeys(), channel.getLocalStrategySortOrder()).toString());
}
}
String caching = channel.getTempMode() == TempMode.NONE ? null : channel.getTempMode().toString();
edge.setShipStrategyName(shipStrategy);
edge.setPreProcessingOperationName(localStrategy);
edge.setOperatorLevelCachingDescription(caching);
return distributionPattern;
} | java | private DistributionPattern connectJobVertices(Channel channel, int inputNumber,
final JobVertex sourceVertex, final TaskConfig sourceConfig,
final JobVertex targetVertex, final TaskConfig targetConfig, boolean isBroadcast)
throws CompilerException
{
// ------------ connect the vertices to the job graph --------------
final DistributionPattern distributionPattern;
switch (channel.getShipStrategy()) {
case FORWARD:
distributionPattern = DistributionPattern.POINTWISE;
break;
case PARTITION_RANDOM:
case BROADCAST:
case PARTITION_HASH:
case PARTITION_CUSTOM:
case PARTITION_RANGE:
case PARTITION_FORCED_REBALANCE:
distributionPattern = DistributionPattern.ALL_TO_ALL;
break;
default:
throw new RuntimeException("Unknown runtime ship strategy: " + channel.getShipStrategy());
}
final ResultPartitionType resultType;
switch (channel.getDataExchangeMode()) {
case PIPELINED:
resultType = ResultPartitionType.PIPELINED;
break;
case BATCH:
// BLOCKING results are currently not supported in closed loop iterations
//
// See https://issues.apache.org/jira/browse/FLINK-1713 for details
resultType = channel.getSource().isOnDynamicPath()
? ResultPartitionType.PIPELINED
: ResultPartitionType.BLOCKING;
break;
case PIPELINE_WITH_BATCH_FALLBACK:
throw new UnsupportedOperationException("Data exchange mode " +
channel.getDataExchangeMode() + " currently not supported.");
default:
throw new UnsupportedOperationException("Unknown data exchange mode.");
}
JobEdge edge = targetVertex.connectNewDataSetAsInput(sourceVertex, distributionPattern, resultType);
// -------------- configure the source task's ship strategy strategies in task config --------------
final int outputIndex = sourceConfig.getNumOutputs();
sourceConfig.addOutputShipStrategy(channel.getShipStrategy());
if (outputIndex == 0) {
sourceConfig.setOutputSerializer(channel.getSerializer());
}
if (channel.getShipStrategyComparator() != null) {
sourceConfig.setOutputComparator(channel.getShipStrategyComparator(), outputIndex);
}
if (channel.getShipStrategy() == ShipStrategyType.PARTITION_RANGE) {
final DataDistribution dataDistribution = channel.getDataDistribution();
if (dataDistribution != null) {
sourceConfig.setOutputDataDistribution(dataDistribution, outputIndex);
} else {
throw new RuntimeException("Range partitioning requires data distribution.");
}
}
if (channel.getShipStrategy() == ShipStrategyType.PARTITION_CUSTOM) {
if (channel.getPartitioner() != null) {
sourceConfig.setOutputPartitioner(channel.getPartitioner(), outputIndex);
} else {
throw new CompilerException("The ship strategy was set to custom partitioning, but no partitioner was set.");
}
}
// ---------------- configure the receiver -------------------
if (isBroadcast) {
targetConfig.addBroadcastInputToGroup(inputNumber);
} else {
targetConfig.addInputToGroup(inputNumber);
}
// ---------------- attach the additional infos to the job edge -------------------
String shipStrategy = JsonMapper.getShipStrategyString(channel.getShipStrategy());
if (channel.getShipStrategyKeys() != null && channel.getShipStrategyKeys().size() > 0) {
shipStrategy += " on " + (channel.getShipStrategySortOrder() == null ?
channel.getShipStrategyKeys().toString() :
Utils.createOrdering(channel.getShipStrategyKeys(), channel.getShipStrategySortOrder()).toString());
}
String localStrategy;
if (channel.getLocalStrategy() == null || channel.getLocalStrategy() == LocalStrategy.NONE) {
localStrategy = null;
}
else {
localStrategy = JsonMapper.getLocalStrategyString(channel.getLocalStrategy());
if (localStrategy != null && channel.getLocalStrategyKeys() != null && channel.getLocalStrategyKeys().size() > 0) {
localStrategy += " on " + (channel.getLocalStrategySortOrder() == null ?
channel.getLocalStrategyKeys().toString() :
Utils.createOrdering(channel.getLocalStrategyKeys(), channel.getLocalStrategySortOrder()).toString());
}
}
String caching = channel.getTempMode() == TempMode.NONE ? null : channel.getTempMode().toString();
edge.setShipStrategyName(shipStrategy);
edge.setPreProcessingOperationName(localStrategy);
edge.setOperatorLevelCachingDescription(caching);
return distributionPattern;
} | [
"private",
"DistributionPattern",
"connectJobVertices",
"(",
"Channel",
"channel",
",",
"int",
"inputNumber",
",",
"final",
"JobVertex",
"sourceVertex",
",",
"final",
"TaskConfig",
"sourceConfig",
",",
"final",
"JobVertex",
"targetVertex",
",",
"final",
"TaskConfig",
... | NOTE: The channel for global and local strategies are different if we connect a union. The global strategy
channel is then the channel into the union node, the local strategy channel the one from the union to the
actual target operator.
@throws CompilerException | [
"NOTE",
":",
"The",
"channel",
"for",
"global",
"and",
"local",
"strategies",
"are",
"different",
"if",
"we",
"connect",
"a",
"union",
".",
"The",
"global",
"strategy",
"channel",
"is",
"then",
"the",
"channel",
"into",
"the",
"union",
"node",
"the",
"loca... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/plantranslate/JobGraphGenerator.java#L1141-L1257 | train | Connect the vertices to the job graph. | [
30522,
2797,
4353,
4502,
12079,
2078,
7532,
5558,
2497,
16874,
23522,
1006,
3149,
3149,
1010,
20014,
7953,
19172,
5677,
1010,
2345,
3105,
16874,
10288,
3120,
16874,
10288,
1010,
2345,
4708,
8663,
8873,
2290,
3120,
8663,
8873,
2290,
1010,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/StreamProjection.java | StreamProjection.projectTuple4 | public <T0, T1, T2, T3> SingleOutputStreamOperator<Tuple4<T0, T1, T2, T3>> projectTuple4() {
TypeInformation<?>[] fTypes = extractFieldTypes(fieldIndexes, dataStream.getType());
TupleTypeInfo<Tuple4<T0, T1, T2, T3>> tType = new TupleTypeInfo<Tuple4<T0, T1, T2, T3>>(fTypes);
return dataStream.transform("Projection", tType, new StreamProject<IN, Tuple4<T0, T1, T2, T3>>(fieldIndexes, tType.createSerializer(dataStream.getExecutionConfig())));
} | java | public <T0, T1, T2, T3> SingleOutputStreamOperator<Tuple4<T0, T1, T2, T3>> projectTuple4() {
TypeInformation<?>[] fTypes = extractFieldTypes(fieldIndexes, dataStream.getType());
TupleTypeInfo<Tuple4<T0, T1, T2, T3>> tType = new TupleTypeInfo<Tuple4<T0, T1, T2, T3>>(fTypes);
return dataStream.transform("Projection", tType, new StreamProject<IN, Tuple4<T0, T1, T2, T3>>(fieldIndexes, tType.createSerializer(dataStream.getExecutionConfig())));
} | [
"public",
"<",
"T0",
",",
"T1",
",",
"T2",
",",
"T3",
">",
"SingleOutputStreamOperator",
"<",
"Tuple4",
"<",
"T0",
",",
"T1",
",",
"T2",
",",
"T3",
">",
">",
"projectTuple4",
"(",
")",
"{",
"TypeInformation",
"<",
"?",
">",
"[",
"]",
"fTypes",
"=",... | Projects a {@link Tuple} {@link DataStream} to the previously selected fields.
@return The projected DataStream.
@see Tuple
@see DataStream | [
"Projects",
"a",
"{",
"@link",
"Tuple",
"}",
"{",
"@link",
"DataStream",
"}",
"to",
"the",
"previously",
"selected",
"fields",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/StreamProjection.java#L176-L181 | train | Project a tuple of data stream into a single output stream. | [
30522,
2270,
1026,
1056,
2692,
1010,
1056,
2487,
1010,
1056,
2475,
1010,
1056,
2509,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
10722,
10814,
2549,
1026,
1056,
2692,
1010,
1056,
2487,
1010,
1056,
2475,
1010,
1056,
2509,
1028,
1028,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.findAll | public List<Entity> findAll(String tableName) throws SQLException {
return findAll(Entity.create(tableName));
} | java | public List<Entity> findAll(String tableName) throws SQLException {
return findAll(Entity.create(tableName));
} | [
"public",
"List",
"<",
"Entity",
">",
"findAll",
"(",
"String",
"tableName",
")",
"throws",
"SQLException",
"{",
"return",
"findAll",
"(",
"Entity",
".",
"create",
"(",
"tableName",
")",
")",
";",
"}"
] | 查询数据列表,返回所有字段
@param tableName 表名
@return 数据对象列表
@throws SQLException SQL执行异常 | [
"查询数据列表,返回所有字段"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L542-L544 | train | Returns all entities in the table with the given name. | [
30522,
2270,
2862,
1026,
9178,
1028,
2424,
8095,
1006,
5164,
2795,
18442,
1007,
11618,
29296,
10288,
24422,
1063,
2709,
2424,
8095,
1006,
9178,
1012,
3443,
1006,
2795,
18442,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.timeWindow | public WindowedStream<T, KEY, TimeWindow> timeWindow(Time size, Time slide) {
if (environment.getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime) {
return window(SlidingProcessingTimeWindows.of(size, slide));
} else {
return window(SlidingEventTimeWindows.of(size, slide));
}
} | java | public WindowedStream<T, KEY, TimeWindow> timeWindow(Time size, Time slide) {
if (environment.getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime) {
return window(SlidingProcessingTimeWindows.of(size, slide));
} else {
return window(SlidingEventTimeWindows.of(size, slide));
}
} | [
"public",
"WindowedStream",
"<",
"T",
",",
"KEY",
",",
"TimeWindow",
">",
"timeWindow",
"(",
"Time",
"size",
",",
"Time",
"slide",
")",
"{",
"if",
"(",
"environment",
".",
"getStreamTimeCharacteristic",
"(",
")",
"==",
"TimeCharacteristic",
".",
"ProcessingTim... | Windows this {@code KeyedStream} into sliding time windows.
<p>This is a shortcut for either {@code .window(SlidingEventTimeWindows.of(size, slide))} or
{@code .window(SlidingProcessingTimeWindows.of(size, slide))} depending on the time
characteristic set using
{@link org.apache.flink.streaming.api.environment.StreamExecutionEnvironment#setStreamTimeCharacteristic(org.apache.flink.streaming.api.TimeCharacteristic)}
@param size The size of the window. | [
"Windows",
"this",
"{",
"@code",
"KeyedStream",
"}",
"into",
"sliding",
"time",
"windows",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java#L629-L635 | train | Creates a sliding time window. | [
30522,
2270,
3332,
2098,
21422,
1026,
1056,
1010,
3145,
1010,
2051,
11101,
5004,
1028,
2051,
11101,
5004,
1006,
2051,
2946,
1010,
2051,
7358,
1007,
1063,
2065,
1006,
4044,
1012,
4152,
25379,
7292,
7507,
22648,
3334,
6553,
1006,
1007,
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-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/CepOperator.java | CepOperator.advanceTime | private void advanceTime(NFAState nfaState, long timestamp) throws Exception {
try (SharedBufferAccessor<IN> sharedBufferAccessor = partialMatches.getAccessor()) {
Collection<Tuple2<Map<String, List<IN>>, Long>> timedOut =
nfa.advanceTime(sharedBufferAccessor, nfaState, timestamp);
if (!timedOut.isEmpty()) {
processTimedOutSequences(timedOut);
}
}
} | java | private void advanceTime(NFAState nfaState, long timestamp) throws Exception {
try (SharedBufferAccessor<IN> sharedBufferAccessor = partialMatches.getAccessor()) {
Collection<Tuple2<Map<String, List<IN>>, Long>> timedOut =
nfa.advanceTime(sharedBufferAccessor, nfaState, timestamp);
if (!timedOut.isEmpty()) {
processTimedOutSequences(timedOut);
}
}
} | [
"private",
"void",
"advanceTime",
"(",
"NFAState",
"nfaState",
",",
"long",
"timestamp",
")",
"throws",
"Exception",
"{",
"try",
"(",
"SharedBufferAccessor",
"<",
"IN",
">",
"sharedBufferAccessor",
"=",
"partialMatches",
".",
"getAccessor",
"(",
")",
")",
"{",
... | Advances the time for the given NFA to the given timestamp. This means that no more events with timestamp
<b>lower</b> than the given timestamp should be passed to the nfa, This can lead to pruning and timeouts. | [
"Advances",
"the",
"time",
"for",
"the",
"given",
"NFA",
"to",
"the",
"given",
"timestamp",
".",
"This",
"means",
"that",
"no",
"more",
"events",
"with",
"timestamp",
"<b",
">",
"lower<",
"/",
"b",
">",
"than",
"the",
"given",
"timestamp",
"should",
"be"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/CepOperator.java#L434-L442 | train | Advance the time of the partial matches. | [
30522,
2797,
11675,
5083,
7292,
1006,
1050,
24333,
3686,
1050,
24333,
3686,
1010,
2146,
2335,
15464,
2361,
1007,
11618,
6453,
1063,
3046,
1006,
4207,
8569,
12494,
6305,
9623,
21748,
1026,
1999,
1028,
4207,
8569,
12494,
6305,
9623,
21748,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeutils/base/BigDecComparator.java | BigDecComparator.putNormalizedKey | @Override
public void putNormalizedKey(BigDecimal record, MemorySegment target, int offset, int len) {
final long signum = record.signum();
// order of magnitude
// smallest:
// scale = Integer.MAX, precision = 1 => SMALLEST_MAGNITUDE
// largest:
// scale = Integer.MIN, precision = Integer.MAX => LARGEST_MAGNITUDE
final long mag = ((long) record.scale()) - ((long) record.precision()) + 1;
// normalize value range: from 0 to (SMALLEST_MAGNITUDE + -1*LARGEST_MAGNITUDE)
final long normMag = -1L * LARGEST_MAGNITUDE + mag;
// normalize value range dependent on sign:
// 0 to (SMALLEST_MAGNITUDE + -1*LARGEST_MAGNITUDE)
// OR (SMALLEST_MAGNITUDE + -1*LARGEST_MAGNITUDE) to 0
// --> uses at most 33 bit (5 least-significant bytes)
long signNormMag = signum < 0 ? normMag : (SMALLEST_MAGNITUDE + -1L * LARGEST_MAGNITUDE - normMag);
// zero has no magnitude
// set 34th bit to flag zero
if (signum == 0) {
signNormMag = 0L;
signNormMag |= (1L << 34);
}
// set 35th bit to flag positive sign
else if (signum > 0) {
signNormMag |= (1L << 35);
}
// add 5 least-significant bytes that contain value to target
for (int i = 0; i < 5 && len > 0; i++, len--) {
final byte b = (byte) (signNormMag >>> (8 * (4 - i)));
target.put(offset++, b);
}
} | java | @Override
public void putNormalizedKey(BigDecimal record, MemorySegment target, int offset, int len) {
final long signum = record.signum();
// order of magnitude
// smallest:
// scale = Integer.MAX, precision = 1 => SMALLEST_MAGNITUDE
// largest:
// scale = Integer.MIN, precision = Integer.MAX => LARGEST_MAGNITUDE
final long mag = ((long) record.scale()) - ((long) record.precision()) + 1;
// normalize value range: from 0 to (SMALLEST_MAGNITUDE + -1*LARGEST_MAGNITUDE)
final long normMag = -1L * LARGEST_MAGNITUDE + mag;
// normalize value range dependent on sign:
// 0 to (SMALLEST_MAGNITUDE + -1*LARGEST_MAGNITUDE)
// OR (SMALLEST_MAGNITUDE + -1*LARGEST_MAGNITUDE) to 0
// --> uses at most 33 bit (5 least-significant bytes)
long signNormMag = signum < 0 ? normMag : (SMALLEST_MAGNITUDE + -1L * LARGEST_MAGNITUDE - normMag);
// zero has no magnitude
// set 34th bit to flag zero
if (signum == 0) {
signNormMag = 0L;
signNormMag |= (1L << 34);
}
// set 35th bit to flag positive sign
else if (signum > 0) {
signNormMag |= (1L << 35);
}
// add 5 least-significant bytes that contain value to target
for (int i = 0; i < 5 && len > 0; i++, len--) {
final byte b = (byte) (signNormMag >>> (8 * (4 - i)));
target.put(offset++, b);
}
} | [
"@",
"Override",
"public",
"void",
"putNormalizedKey",
"(",
"BigDecimal",
"record",
",",
"MemorySegment",
"target",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"final",
"long",
"signum",
"=",
"record",
".",
"signum",
"(",
")",
";",
"// order of magnit... | Adds a normalized key containing a normalized order of magnitude of the given record.
2 bits determine the sign (negative, zero, positive), 33 bits determine the magnitude.
This method adds at most 5 bytes that contain information. | [
"Adds",
"a",
"normalized",
"key",
"containing",
"a",
"normalized",
"order",
"of",
"magnitude",
"of",
"the",
"given",
"record",
".",
"2",
"bits",
"determine",
"the",
"sign",
"(",
"negative",
"zero",
"positive",
")",
"33",
"bits",
"determine",
"the",
"magnitud... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/base/BigDecComparator.java#L76-L112 | train | Put a normalized key into the given MemorySegment. | [
30522,
1030,
2058,
15637,
2270,
11675,
2404,
12131,
9067,
3550,
14839,
1006,
2502,
3207,
6895,
9067,
2501,
1010,
3638,
3366,
21693,
4765,
4539,
1010,
20014,
16396,
1010,
20014,
18798,
1007,
1063,
2345,
2146,
3696,
2819,
1027,
2501,
1012,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/symmetric/RC4.java | RC4.initSBox | private int[] initSBox(byte[] key) {
int[] sbox = new int[SBOX_LENGTH];
int j = 0;
for (int i = 0; i < SBOX_LENGTH; i++) {
sbox[i] = i;
}
for (int i = 0; i < SBOX_LENGTH; i++) {
j = (j + sbox[i] + (key[i % key.length]) & 0xFF) % SBOX_LENGTH;
swap(i, j, sbox);
}
return sbox;
} | java | private int[] initSBox(byte[] key) {
int[] sbox = new int[SBOX_LENGTH];
int j = 0;
for (int i = 0; i < SBOX_LENGTH; i++) {
sbox[i] = i;
}
for (int i = 0; i < SBOX_LENGTH; i++) {
j = (j + sbox[i] + (key[i % key.length]) & 0xFF) % SBOX_LENGTH;
swap(i, j, sbox);
}
return sbox;
} | [
"private",
"int",
"[",
"]",
"initSBox",
"(",
"byte",
"[",
"]",
"key",
")",
"{",
"int",
"[",
"]",
"sbox",
"=",
"new",
"int",
"[",
"SBOX_LENGTH",
"]",
";",
"int",
"j",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"SBOX_LENGTH... | 初始化Sbox
@param key 密钥
@return sbox | [
"初始化Sbox"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/RC4.java#L144-L157 | train | Initializes the SBOX array from the given byte array. | [
30522,
2797,
20014,
1031,
1033,
1999,
12762,
8758,
1006,
24880,
1031,
1033,
3145,
1007,
1063,
20014,
1031,
1033,
24829,
11636,
1027,
2047,
20014,
1031,
24829,
11636,
1035,
3091,
1033,
1025,
20014,
1046,
1027,
1014,
1025,
2005,
1006,
20014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/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... |
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/UnknownInputChannel.java | UnknownInputChannel.toRemoteInputChannel | public RemoteInputChannel toRemoteInputChannel(ConnectionID producerAddress) {
return new RemoteInputChannel(inputGate, channelIndex, partitionId, checkNotNull(producerAddress), connectionManager, initialBackoff, maxBackoff, metrics);
} | java | public RemoteInputChannel toRemoteInputChannel(ConnectionID producerAddress) {
return new RemoteInputChannel(inputGate, channelIndex, partitionId, checkNotNull(producerAddress), connectionManager, initialBackoff, maxBackoff, metrics);
} | [
"public",
"RemoteInputChannel",
"toRemoteInputChannel",
"(",
"ConnectionID",
"producerAddress",
")",
"{",
"return",
"new",
"RemoteInputChannel",
"(",
"inputGate",
",",
"channelIndex",
",",
"partitionId",
",",
"checkNotNull",
"(",
"producerAddress",
")",
",",
"connection... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/UnknownInputChannel.java#L119-L121 | train | Converts this input gate to a remote input channel. | [
30522,
2270,
6556,
2378,
18780,
26058,
9538,
18938,
12377,
18780,
26058,
1006,
4434,
3593,
3135,
4215,
16200,
4757,
1007,
1063,
2709,
2047,
6556,
2378,
18780,
26058,
1006,
7953,
5867,
1010,
3149,
22254,
10288,
1010,
13571,
3593,
1010,
4638,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/service/RdbSyncService.java | RdbSyncService.appendCondition | private void appendCondition(MappingConfig.DbMapping dbMapping, StringBuilder sql, Map<String, Integer> ctype,
List<Map<String, ?>> values, Map<String, Object> d) {
appendCondition(dbMapping, sql, ctype, values, d, null);
} | java | private void appendCondition(MappingConfig.DbMapping dbMapping, StringBuilder sql, Map<String, Integer> ctype,
List<Map<String, ?>> values, Map<String, Object> d) {
appendCondition(dbMapping, sql, ctype, values, d, null);
} | [
"private",
"void",
"appendCondition",
"(",
"MappingConfig",
".",
"DbMapping",
"dbMapping",
",",
"StringBuilder",
"sql",
",",
"Map",
"<",
"String",
",",
"Integer",
">",
"ctype",
",",
"List",
"<",
"Map",
"<",
"String",
",",
"?",
">",
">",
"values",
",",
"M... | 拼接主键 where条件 | [
"拼接主键",
"where条件"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/service/RdbSyncService.java#L431-L434 | train | Append condition. | [
30522,
2797,
11675,
10439,
10497,
8663,
20562,
1006,
12375,
8663,
8873,
2290,
1012,
16962,
2863,
14853,
16962,
2863,
14853,
1010,
5164,
8569,
23891,
2099,
29296,
1010,
4949,
1026,
5164,
1010,
16109,
1028,
14931,
18863,
1010,
2862,
1026,
4949,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySources.java | ConfigurationPropertySources.from | public static Iterable<ConfigurationPropertySource> from(PropertySource<?> source) {
return Collections.singleton(SpringConfigurationPropertySource.from(source));
} | java | public static Iterable<ConfigurationPropertySource> from(PropertySource<?> source) {
return Collections.singleton(SpringConfigurationPropertySource.from(source));
} | [
"public",
"static",
"Iterable",
"<",
"ConfigurationPropertySource",
">",
"from",
"(",
"PropertySource",
"<",
"?",
">",
"source",
")",
"{",
"return",
"Collections",
".",
"singleton",
"(",
"SpringConfigurationPropertySource",
".",
"from",
"(",
"source",
")",
")",
... | Return {@link Iterable} containing a single new {@link ConfigurationPropertySource}
adapted from the given Spring {@link PropertySource}.
@param source the Spring property source to adapt
@return an {@link Iterable} containing a single newly adapted
{@link SpringConfigurationPropertySource} | [
"Return",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySources.java#L116-L118 | train | Creates an iterable of configuration property sources from the given property source. | [
30522,
2270,
10763,
2009,
6906,
3468,
1026,
9563,
21572,
4842,
3723,
6499,
3126,
3401,
1028,
2013,
1006,
3200,
6499,
3126,
3401,
1026,
1029,
1028,
3120,
1007,
1063,
2709,
6407,
1012,
28159,
1006,
3500,
8663,
8873,
27390,
3370,
21572,
4842,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/HpackHuffmanDecoder.java | HpackHuffmanDecoder.decode | public AsciiString decode(ByteBuf buf, int length) throws Http2Exception {
processor.reset();
buf.forEachByte(buf.readerIndex(), length, processor);
buf.skipBytes(length);
return processor.end();
} | java | public AsciiString decode(ByteBuf buf, int length) throws Http2Exception {
processor.reset();
buf.forEachByte(buf.readerIndex(), length, processor);
buf.skipBytes(length);
return processor.end();
} | [
"public",
"AsciiString",
"decode",
"(",
"ByteBuf",
"buf",
",",
"int",
"length",
")",
"throws",
"Http2Exception",
"{",
"processor",
".",
"reset",
"(",
")",
";",
"buf",
".",
"forEachByte",
"(",
"buf",
".",
"readerIndex",
"(",
")",
",",
"length",
",",
"proc... | Decompresses the given Huffman coded string literal.
@param buf the string literal to be decoded
@return the output stream for the compressed data
@throws Http2Exception EOS Decoded | [
"Decompresses",
"the",
"given",
"Huffman",
"coded",
"string",
"literal",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackHuffmanDecoder.java#L65-L70 | train | Decodes a UTF - 8 encoded string from the specified buffer. | [
30522,
2270,
2004,
6895,
2923,
4892,
21933,
3207,
1006,
24880,
8569,
2546,
20934,
2546,
1010,
20014,
3091,
1007,
11618,
8299,
2475,
10288,
24422,
1063,
13151,
1012,
25141,
1006,
1007,
1025,
20934,
2546,
1012,
18921,
6776,
3762,
2618,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java | FutureUtils.whenCompleteAsyncIfNotDone | public static <IN> CompletableFuture<IN> whenCompleteAsyncIfNotDone(
CompletableFuture<IN> completableFuture,
Executor executor,
BiConsumer<? super IN, ? super Throwable> whenCompleteFun) {
return completableFuture.isDone() ?
completableFuture.whenComplete(whenCompleteFun) :
completableFuture.whenCompleteAsync(whenCompleteFun, executor);
} | java | public static <IN> CompletableFuture<IN> whenCompleteAsyncIfNotDone(
CompletableFuture<IN> completableFuture,
Executor executor,
BiConsumer<? super IN, ? super Throwable> whenCompleteFun) {
return completableFuture.isDone() ?
completableFuture.whenComplete(whenCompleteFun) :
completableFuture.whenCompleteAsync(whenCompleteFun, executor);
} | [
"public",
"static",
"<",
"IN",
">",
"CompletableFuture",
"<",
"IN",
">",
"whenCompleteAsyncIfNotDone",
"(",
"CompletableFuture",
"<",
"IN",
">",
"completableFuture",
",",
"Executor",
"executor",
",",
"BiConsumer",
"<",
"?",
"super",
"IN",
",",
"?",
"super",
"T... | This function takes a {@link CompletableFuture} and a bi-consumer to call on completion of this future. If the
input future is already done, this function returns {@link CompletableFuture#whenComplete(BiConsumer)}.
Otherwise, the return value is {@link CompletableFuture#whenCompleteAsync(BiConsumer, Executor)} with the given
executor.
@param completableFuture the completable future for which we want to call #whenComplete.
@param executor the executor to run the whenComplete function if the future is not yet done.
@param whenCompleteFun the bi-consumer function to call when the future is completed.
@param <IN> type of the input future.
@return the new completion stage. | [
"This",
"function",
"takes",
"a",
"{",
"@link",
"CompletableFuture",
"}",
"and",
"a",
"bi",
"-",
"consumer",
"to",
"call",
"on",
"completion",
"of",
"this",
"future",
".",
"If",
"the",
"input",
"future",
"is",
"already",
"done",
"this",
"function",
"return... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java#L879-L886 | train | When the given CompletableFuture is completed asynchronously or if it is not done it will be completed with the given executor. | [
30522,
2270,
10763,
30524,
12273,
10128,
17048,
5280,
2063,
1006,
4012,
10814,
10880,
11263,
11244,
1026,
1999,
1028,
4012,
10814,
10880,
11263,
11244,
1010,
4654,
8586,
16161,
2099,
4654,
8586,
16161,
2099,
1010,
12170,
8663,
23545,
2099,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java | AuthEngine.challenge | ClientChallenge challenge() throws GeneralSecurityException {
this.authNonce = randomBytes(conf.encryptionKeyLength() / Byte.SIZE);
SecretKeySpec authKey = generateKey(conf.keyFactoryAlgorithm(), conf.keyFactoryIterations(),
authNonce, conf.encryptionKeyLength());
initializeForAuth(conf.cipherTransformation(), authNonce, authKey);
this.challenge = randomBytes(conf.encryptionKeyLength() / Byte.SIZE);
return new ClientChallenge(new String(appId, UTF_8),
conf.keyFactoryAlgorithm(),
conf.keyFactoryIterations(),
conf.cipherTransformation(),
conf.encryptionKeyLength(),
authNonce,
challenge(appId, authNonce, challenge));
} | java | ClientChallenge challenge() throws GeneralSecurityException {
this.authNonce = randomBytes(conf.encryptionKeyLength() / Byte.SIZE);
SecretKeySpec authKey = generateKey(conf.keyFactoryAlgorithm(), conf.keyFactoryIterations(),
authNonce, conf.encryptionKeyLength());
initializeForAuth(conf.cipherTransformation(), authNonce, authKey);
this.challenge = randomBytes(conf.encryptionKeyLength() / Byte.SIZE);
return new ClientChallenge(new String(appId, UTF_8),
conf.keyFactoryAlgorithm(),
conf.keyFactoryIterations(),
conf.cipherTransformation(),
conf.encryptionKeyLength(),
authNonce,
challenge(appId, authNonce, challenge));
} | [
"ClientChallenge",
"challenge",
"(",
")",
"throws",
"GeneralSecurityException",
"{",
"this",
".",
"authNonce",
"=",
"randomBytes",
"(",
"conf",
".",
"encryptionKeyLength",
"(",
")",
"/",
"Byte",
".",
"SIZE",
")",
";",
"SecretKeySpec",
"authKey",
"=",
"generateKe... | Create the client challenge.
@return A challenge to be sent the remote side. | [
"Create",
"the",
"client",
"challenge",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java#L84-L98 | train | Generates a challenge for the client. | [
30522,
7396,
18598,
7770,
3351,
4119,
1006,
1007,
11618,
11593,
8586,
25137,
10288,
24422,
1063,
2023,
1012,
8740,
2705,
8540,
3401,
1027,
6721,
3762,
4570,
1006,
9530,
2546,
1012,
21999,
14839,
7770,
13512,
2232,
1006,
1007,
1013,
24880,
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/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/BatchPreparedStatementExecutor.java | BatchPreparedStatementExecutor.addBatchForRouteUnits | public void addBatchForRouteUnits(final SQLRouteResult routeResult) {
handleOldRouteUnits(createBatchRouteUnits(routeResult.getRouteUnits()));
handleNewRouteUnits(createBatchRouteUnits(routeResult.getRouteUnits()));
batchCount++;
} | java | public void addBatchForRouteUnits(final SQLRouteResult routeResult) {
handleOldRouteUnits(createBatchRouteUnits(routeResult.getRouteUnits()));
handleNewRouteUnits(createBatchRouteUnits(routeResult.getRouteUnits()));
batchCount++;
} | [
"public",
"void",
"addBatchForRouteUnits",
"(",
"final",
"SQLRouteResult",
"routeResult",
")",
"{",
"handleOldRouteUnits",
"(",
"createBatchRouteUnits",
"(",
"routeResult",
".",
"getRouteUnits",
"(",
")",
")",
")",
";",
"handleNewRouteUnits",
"(",
"createBatchRouteUnits... | Add batch for route units.
@param routeResult route result | [
"Add",
"batch",
"for",
"route",
"units",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/BatchPreparedStatementExecutor.java#L114-L118 | train | Add batch for route units. | [
30522,
2270,
11675,
5587,
14479,
2818,
29278,
22494,
2618,
19496,
3215,
1006,
2345,
29296,
22494,
3334,
2229,
11314,
2799,
6072,
11314,
1007,
1063,
5047,
11614,
22494,
2618,
19496,
3215,
1006,
3443,
14479,
2818,
22494,
2618,
19496,
3215,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/Other/CommonAhoCorasickSegmentUtil.java | CommonAhoCorasickSegmentUtil.segment | public static <V> LinkedList<ResultTerm<V>> segment(final char[] charArray, AhoCorasickDoubleArrayTrie<V> trie)
{
LinkedList<ResultTerm<V>> termList = new LinkedList<ResultTerm<V>>();
final ResultTerm<V>[] wordNet = new ResultTerm[charArray.length];
trie.parseText(charArray, new AhoCorasickDoubleArrayTrie.IHit<V>()
{
@Override
public void hit(int begin, int end, V value)
{
if (wordNet[begin] == null || wordNet[begin].word.length() < end - begin)
{
wordNet[begin] = new ResultTerm<V>(new String(charArray, begin, end - begin), value, begin);
}
}
});
for (int i = 0; i < charArray.length;)
{
if (wordNet[i] == null)
{
StringBuilder sbTerm = new StringBuilder();
int offset = i;
while (i < charArray.length && wordNet[i] == null)
{
sbTerm.append(charArray[i]);
++i;
}
termList.add(new ResultTerm<V>(sbTerm.toString(), null, offset));
}
else
{
termList.add(wordNet[i]);
i += wordNet[i].word.length();
}
}
return termList;
} | java | public static <V> LinkedList<ResultTerm<V>> segment(final char[] charArray, AhoCorasickDoubleArrayTrie<V> trie)
{
LinkedList<ResultTerm<V>> termList = new LinkedList<ResultTerm<V>>();
final ResultTerm<V>[] wordNet = new ResultTerm[charArray.length];
trie.parseText(charArray, new AhoCorasickDoubleArrayTrie.IHit<V>()
{
@Override
public void hit(int begin, int end, V value)
{
if (wordNet[begin] == null || wordNet[begin].word.length() < end - begin)
{
wordNet[begin] = new ResultTerm<V>(new String(charArray, begin, end - begin), value, begin);
}
}
});
for (int i = 0; i < charArray.length;)
{
if (wordNet[i] == null)
{
StringBuilder sbTerm = new StringBuilder();
int offset = i;
while (i < charArray.length && wordNet[i] == null)
{
sbTerm.append(charArray[i]);
++i;
}
termList.add(new ResultTerm<V>(sbTerm.toString(), null, offset));
}
else
{
termList.add(wordNet[i]);
i += wordNet[i].word.length();
}
}
return termList;
} | [
"public",
"static",
"<",
"V",
">",
"LinkedList",
"<",
"ResultTerm",
"<",
"V",
">",
">",
"segment",
"(",
"final",
"char",
"[",
"]",
"charArray",
",",
"AhoCorasickDoubleArrayTrie",
"<",
"V",
">",
"trie",
")",
"{",
"LinkedList",
"<",
"ResultTerm",
"<",
"V",... | 最长分词,合并未知语素
@param charArray 文本
@param trie 自动机
@param <V> 类型
@return 结果链表 | [
"最长分词,合并未知语素"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Other/CommonAhoCorasickSegmentUtil.java#L46-L81 | train | segment method. | [
30522,
2270,
10763,
1026,
1058,
1028,
5799,
9863,
1026,
2765,
3334,
2213,
1026,
1058,
1028,
1028,
6903,
1006,
2345,
25869,
1031,
1033,
25869,
2906,
9447,
1010,
6289,
24163,
8180,
6799,
26797,
3468,
2906,
9447,
18886,
2063,
1026,
1058,
1028,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/expressions/javalang/typed.java | typed.avg | public static <T> TypedColumn<T, Double> avg(MapFunction<T, Double> f) {
return new TypedAverage<T>(f).toColumnJava();
} | java | public static <T> TypedColumn<T, Double> avg(MapFunction<T, Double> f) {
return new TypedAverage<T>(f).toColumnJava();
} | [
"public",
"static",
"<",
"T",
">",
"TypedColumn",
"<",
"T",
",",
"Double",
">",
"avg",
"(",
"MapFunction",
"<",
"T",
",",
"Double",
">",
"f",
")",
"{",
"return",
"new",
"TypedAverage",
"<",
"T",
">",
"(",
"f",
")",
".",
"toColumnJava",
"(",
")",
... | Average aggregate function.
@since 2.0.0 | [
"Average",
"aggregate",
"function",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/expressions/javalang/typed.java#L45-L47 | train | Returns a typed average column. | [
30522,
2270,
10763,
1026,
1056,
1028,
21189,
25778,
2819,
2078,
1026,
1056,
1010,
3313,
1028,
20704,
2290,
1006,
4949,
11263,
27989,
1026,
1056,
1010,
3313,
1028,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java | MysqlEventParser.findByStartTimeStamp | private EntryPosition findByStartTimeStamp(MysqlConnection mysqlConnection, Long startTimestamp) {
EntryPosition endPosition = findEndPosition(mysqlConnection);
EntryPosition startPosition = findStartPosition(mysqlConnection);
String maxBinlogFileName = endPosition.getJournalName();
String minBinlogFileName = startPosition.getJournalName();
logger.info("show master status to set search end condition:{} ", endPosition);
String startSearchBinlogFile = endPosition.getJournalName();
boolean shouldBreak = false;
while (running && !shouldBreak) {
try {
EntryPosition entryPosition = findAsPerTimestampInSpecificLogFile(mysqlConnection,
startTimestamp,
endPosition,
startSearchBinlogFile,
false);
if (entryPosition == null) {
if (StringUtils.equalsIgnoreCase(minBinlogFileName, startSearchBinlogFile)) {
// 已经找到最早的一个binlog,没必要往前找了
shouldBreak = true;
logger.warn("Didn't find the corresponding binlog files from {} to {}",
minBinlogFileName,
maxBinlogFileName);
} else {
// 继续往前找
int binlogSeqNum = Integer.parseInt(startSearchBinlogFile.substring(startSearchBinlogFile.indexOf(".") + 1));
if (binlogSeqNum <= 1) {
logger.warn("Didn't find the corresponding binlog files");
shouldBreak = true;
} else {
int nextBinlogSeqNum = binlogSeqNum - 1;
String binlogFileNamePrefix = startSearchBinlogFile.substring(0,
startSearchBinlogFile.indexOf(".") + 1);
String binlogFileNameSuffix = String.format("%06d", nextBinlogSeqNum);
startSearchBinlogFile = binlogFileNamePrefix + binlogFileNameSuffix;
}
}
} else {
logger.info("found and return:{} in findByStartTimeStamp operation.", entryPosition);
return entryPosition;
}
} catch (Exception e) {
logger.warn(String.format("the binlogfile:%s doesn't exist, to continue to search the next binlogfile , caused by",
startSearchBinlogFile),
e);
int binlogSeqNum = Integer.parseInt(startSearchBinlogFile.substring(startSearchBinlogFile.indexOf(".") + 1));
if (binlogSeqNum <= 1) {
logger.warn("Didn't find the corresponding binlog files");
shouldBreak = true;
} else {
int nextBinlogSeqNum = binlogSeqNum - 1;
String binlogFileNamePrefix = startSearchBinlogFile.substring(0,
startSearchBinlogFile.indexOf(".") + 1);
String binlogFileNameSuffix = String.format("%06d", nextBinlogSeqNum);
startSearchBinlogFile = binlogFileNamePrefix + binlogFileNameSuffix;
}
}
}
// 找不到
return null;
} | java | private EntryPosition findByStartTimeStamp(MysqlConnection mysqlConnection, Long startTimestamp) {
EntryPosition endPosition = findEndPosition(mysqlConnection);
EntryPosition startPosition = findStartPosition(mysqlConnection);
String maxBinlogFileName = endPosition.getJournalName();
String minBinlogFileName = startPosition.getJournalName();
logger.info("show master status to set search end condition:{} ", endPosition);
String startSearchBinlogFile = endPosition.getJournalName();
boolean shouldBreak = false;
while (running && !shouldBreak) {
try {
EntryPosition entryPosition = findAsPerTimestampInSpecificLogFile(mysqlConnection,
startTimestamp,
endPosition,
startSearchBinlogFile,
false);
if (entryPosition == null) {
if (StringUtils.equalsIgnoreCase(minBinlogFileName, startSearchBinlogFile)) {
// 已经找到最早的一个binlog,没必要往前找了
shouldBreak = true;
logger.warn("Didn't find the corresponding binlog files from {} to {}",
minBinlogFileName,
maxBinlogFileName);
} else {
// 继续往前找
int binlogSeqNum = Integer.parseInt(startSearchBinlogFile.substring(startSearchBinlogFile.indexOf(".") + 1));
if (binlogSeqNum <= 1) {
logger.warn("Didn't find the corresponding binlog files");
shouldBreak = true;
} else {
int nextBinlogSeqNum = binlogSeqNum - 1;
String binlogFileNamePrefix = startSearchBinlogFile.substring(0,
startSearchBinlogFile.indexOf(".") + 1);
String binlogFileNameSuffix = String.format("%06d", nextBinlogSeqNum);
startSearchBinlogFile = binlogFileNamePrefix + binlogFileNameSuffix;
}
}
} else {
logger.info("found and return:{} in findByStartTimeStamp operation.", entryPosition);
return entryPosition;
}
} catch (Exception e) {
logger.warn(String.format("the binlogfile:%s doesn't exist, to continue to search the next binlogfile , caused by",
startSearchBinlogFile),
e);
int binlogSeqNum = Integer.parseInt(startSearchBinlogFile.substring(startSearchBinlogFile.indexOf(".") + 1));
if (binlogSeqNum <= 1) {
logger.warn("Didn't find the corresponding binlog files");
shouldBreak = true;
} else {
int nextBinlogSeqNum = binlogSeqNum - 1;
String binlogFileNamePrefix = startSearchBinlogFile.substring(0,
startSearchBinlogFile.indexOf(".") + 1);
String binlogFileNameSuffix = String.format("%06d", nextBinlogSeqNum);
startSearchBinlogFile = binlogFileNamePrefix + binlogFileNameSuffix;
}
}
}
// 找不到
return null;
} | [
"private",
"EntryPosition",
"findByStartTimeStamp",
"(",
"MysqlConnection",
"mysqlConnection",
",",
"Long",
"startTimestamp",
")",
"{",
"EntryPosition",
"endPosition",
"=",
"findEndPosition",
"(",
"mysqlConnection",
")",
";",
"EntryPosition",
"startPosition",
"=",
"findSt... | 根据时间查找binlog位置 | [
"根据时间查找binlog位置"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java#L571-L630 | train | Find by start timestamp. | [
30522,
2797,
4443,
26994,
2424,
3762,
14117,
6916,
7834,
15464,
2361,
1006,
2026,
2015,
4160,
22499,
10087,
7542,
2026,
2015,
4160,
22499,
10087,
7542,
1010,
2146,
2707,
7292,
9153,
8737,
1007,
1063,
4443,
26994,
2203,
26994,
1027,
2424,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java | HexUtil.decodeHexStr | public static String decodeHexStr(char[] hexData, Charset charset) {
return StrUtil.str(decodeHex(hexData), charset);
} | java | public static String decodeHexStr(char[] hexData, Charset charset) {
return StrUtil.str(decodeHex(hexData), charset);
} | [
"public",
"static",
"String",
"decodeHexStr",
"(",
"char",
"[",
"]",
"hexData",
",",
"Charset",
"charset",
")",
"{",
"return",
"StrUtil",
".",
"str",
"(",
"decodeHex",
"(",
"hexData",
")",
",",
"charset",
")",
";",
"}"
] | 将十六进制字符数组转换为字符串
@param hexData 十六进制char[]
@param charset 编码
@return 字符串 | [
"将十六进制字符数组转换为字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java#L156-L158 | train | Decodes a hex string. | [
30522,
2270,
10763,
5164,
21933,
25383,
10288,
3367,
2099,
1006,
25869,
1031,
1033,
2002,
2595,
2850,
2696,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2709,
2358,
22134,
4014,
1012,
2358,
2099,
1006,
21933,
25383,
10288,
1006,
2002,
2595,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateTrue | public static boolean validateTrue(boolean value, String errorMsgTemplate, Object... params) throws ValidateException {
if (isFalse(value)) {
throw new ValidateException(errorMsgTemplate, params);
}
return value;
} | java | public static boolean validateTrue(boolean value, String errorMsgTemplate, Object... params) throws ValidateException {
if (isFalse(value)) {
throw new ValidateException(errorMsgTemplate, params);
}
return value;
} | [
"public",
"static",
"boolean",
"validateTrue",
"(",
"boolean",
"value",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"isFalse",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"ValidateExce... | 检查指定值是否为<code>ture</code>
@param value 值
@param errorMsgTemplate 错误消息内容模板(变量使用{}表示)
@param params 模板中变量替换后的值
@return 检查过后的值
@throws ValidateException 检查不满足条件抛出的异常
@since 4.4.5 | [
"检查指定值是否为<code",
">",
"ture<",
"/",
"code",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L92-L97 | train | Validate true. | [
30522,
2270,
10763,
22017,
20898,
9398,
3686,
16344,
5657,
1006,
22017,
20898,
3643,
1010,
5164,
7561,
5244,
13512,
6633,
15725,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
2003,
7011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.readX509Certificate | public static Certificate readX509Certificate(InputStream in, char[] password, String alias) {
return KeyUtil.readX509Certificate(in, password, alias);
} | java | public static Certificate readX509Certificate(InputStream in, char[] password, String alias) {
return KeyUtil.readX509Certificate(in, password, alias);
} | [
"public",
"static",
"Certificate",
"readX509Certificate",
"(",
"InputStream",
"in",
",",
"char",
"[",
"]",
"password",
",",
"String",
"alias",
")",
"{",
"return",
"KeyUtil",
".",
"readX509Certificate",
"(",
"in",
",",
"password",
",",
"alias",
")",
";",
"}"
... | 读取X.509 Certification文件<br>
Certification为证书文件<br>
see: http://snowolf.iteye.com/blog/391931
@param in {@link InputStream} 如果想从文件读取.cer文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取
@param password 密码
@param alias 别名
@return {@link KeyStore}
@since 4.4.1 | [
"读取X",
".",
"509",
"Certification文件<br",
">",
"Certification为证书文件<br",
">",
"see",
":",
"http",
":",
"//",
"snowolf",
".",
"iteye",
".",
"com",
"/",
"blog",
"/",
"391931"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L335-L337 | train | Read a X509 certificate from an input stream. | [
30522,
2270,
10763,
8196,
3191,
2595,
12376,
2683,
17119,
3775,
8873,
16280,
1006,
20407,
25379,
1999,
1010,
25869,
1031,
1033,
20786,
1010,
5164,
14593,
1007,
1063,
2709,
3145,
21823,
2140,
1012,
3191,
2595,
12376,
2683,
17119,
3775,
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... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpBase.java | HttpBase.charset | public T charset(String charset) {
if(StrUtil.isNotBlank(charset)){
this.charset = Charset.forName(charset);
}
return (T) this;
} | java | public T charset(String charset) {
if(StrUtil.isNotBlank(charset)){
this.charset = Charset.forName(charset);
}
return (T) this;
} | [
"public",
"T",
"charset",
"(",
"String",
"charset",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isNotBlank",
"(",
"charset",
")",
")",
"{",
"this",
".",
"charset",
"=",
"Charset",
".",
"forName",
"(",
"charset",
")",
";",
"}",
"return",
"(",
"T",
")",
"t... | 设置字符集
@param charset 字符集
@return T 自己
@see CharsetUtil | [
"设置字符集"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpBase.java#L253-L258 | train | Sets the charset of the object. | [
30522,
2270,
1056,
25869,
13462,
1006,
5164,
25869,
13462,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
3475,
4140,
28522,
8950,
1006,
25869,
13462,
1007,
1007,
1063,
2023,
1012,
25869,
13462,
1027,
25869,
13462,
1012,
2005,
18442,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/rank/TopNBuffer.java | TopNBuffer.put | public int put(BaseRow sortKey, BaseRow value) {
currentTopNum += 1;
// update treeMap
Collection<BaseRow> collection = treeMap.get(sortKey);
if (collection == null) {
collection = valueSupplier.get();
treeMap.put(sortKey, collection);
}
collection.add(value);
return collection.size();
} | java | public int put(BaseRow sortKey, BaseRow value) {
currentTopNum += 1;
// update treeMap
Collection<BaseRow> collection = treeMap.get(sortKey);
if (collection == null) {
collection = valueSupplier.get();
treeMap.put(sortKey, collection);
}
collection.add(value);
return collection.size();
} | [
"public",
"int",
"put",
"(",
"BaseRow",
"sortKey",
",",
"BaseRow",
"value",
")",
"{",
"currentTopNum",
"+=",
"1",
";",
"// update treeMap",
"Collection",
"<",
"BaseRow",
">",
"collection",
"=",
"treeMap",
".",
"get",
"(",
"sortKey",
")",
";",
"if",
"(",
... | Appends a record into the buffer.
@param sortKey sort key with which the specified value is to be associated
@param value record which is to be appended
@return the size of the collection under the sortKey. | [
"Appends",
"a",
"record",
"into",
"the",
"buffer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/rank/TopNBuffer.java#L58-L68 | train | Add a new value to the tree. | [
30522,
2270,
20014,
2404,
1006,
2918,
10524,
4066,
14839,
1010,
2918,
10524,
3643,
1007,
1063,
2783,
14399,
19172,
1009,
1027,
1015,
1025,
1013,
1013,
10651,
3392,
2863,
2361,
3074,
1026,
2918,
10524,
30524,
1006,
1007,
1025,
3392,
2863,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/Unpooled.java | Unpooled.copyMedium | public static ByteBuf copyMedium(int... values) {
if (values == null || values.length == 0) {
return EMPTY_BUFFER;
}
ByteBuf buffer = buffer(values.length * 3);
for (int v: values) {
buffer.writeMedium(v);
}
return buffer;
} | java | public static ByteBuf copyMedium(int... values) {
if (values == null || values.length == 0) {
return EMPTY_BUFFER;
}
ByteBuf buffer = buffer(values.length * 3);
for (int v: values) {
buffer.writeMedium(v);
}
return buffer;
} | [
"public",
"static",
"ByteBuf",
"copyMedium",
"(",
"int",
"...",
"values",
")",
"{",
"if",
"(",
"values",
"==",
"null",
"||",
"values",
".",
"length",
"==",
"0",
")",
"{",
"return",
"EMPTY_BUFFER",
";",
"}",
"ByteBuf",
"buffer",
"=",
"buffer",
"(",
"val... | Create a new big-endian buffer that holds a sequence of the specified 24-bit integers. | [
"Create",
"a",
"new",
"big",
"-",
"endian",
"buffer",
"that",
"holds",
"a",
"sequence",
"of",
"the",
"specified",
"24",
"-",
"bit",
"integers",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L745-L754 | train | Create a new big - endian buffer that holds a sequence of the specified medium values. | [
30522,
2270,
10763,
24880,
8569,
2546,
6100,
7583,
5007,
1006,
20014,
1012,
1012,
1012,
5300,
1007,
1063,
2065,
1006,
5300,
1027,
1027,
19701,
1064,
1064,
5300,
1012,
3091,
1027,
1027,
1014,
1007,
1063,
2709,
4064,
1035,
17698,
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-extra/src/main/java/cn/hutool/extra/mail/InternalMailUtil.java | InternalMailUtil.parseAddress | public static InternetAddress[] parseAddress(String address, Charset charset) {
InternetAddress[] addresses;
try {
addresses = InternetAddress.parse(address);
} catch (AddressException e) {
throw new MailException(e);
}
//编码用户名
if (ArrayUtil.isNotEmpty(addresses)) {
for (InternetAddress internetAddress : addresses) {
try {
internetAddress.setPersonal(internetAddress.getPersonal(), charset.name());
} catch (UnsupportedEncodingException e) {
throw new MailException(e);
}
}
}
return addresses;
} | java | public static InternetAddress[] parseAddress(String address, Charset charset) {
InternetAddress[] addresses;
try {
addresses = InternetAddress.parse(address);
} catch (AddressException e) {
throw new MailException(e);
}
//编码用户名
if (ArrayUtil.isNotEmpty(addresses)) {
for (InternetAddress internetAddress : addresses) {
try {
internetAddress.setPersonal(internetAddress.getPersonal(), charset.name());
} catch (UnsupportedEncodingException e) {
throw new MailException(e);
}
}
}
return addresses;
} | [
"public",
"static",
"InternetAddress",
"[",
"]",
"parseAddress",
"(",
"String",
"address",
",",
"Charset",
"charset",
")",
"{",
"InternetAddress",
"[",
"]",
"addresses",
";",
"try",
"{",
"addresses",
"=",
"InternetAddress",
".",
"parse",
"(",
"address",
")",
... | 将一个地址字符串解析为多个地址<br>
地址间使用" "、","、";"分隔
@param address 地址字符串
@param charset 编码
@return 地址列表 | [
"将一个地址字符串解析为多个地址<br",
">",
"地址间使用",
"、",
"、",
";",
"分隔"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/InternalMailUtil.java#L71-L90 | train | Parses the given string and returns an array of InternetAddress objects containing all the addresses in the array. | [
30522,
2270,
10763,
4274,
4215,
16200,
4757,
1031,
1033,
11968,
17310,
14141,
8303,
1006,
5164,
4769,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
4274,
4215,
16200,
4757,
1031,
1033,
11596,
1025,
3046,
1063,
11596,
1027,
4274,
4215,
16200,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/nr/JapanesePersonDictionary.java | JapanesePersonDictionary.saveDat | static boolean saveDat(TreeMap<String, Character> map)
{
try
{
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(IOUtil.newOutputStream(path + Predefine.VALUE_EXT)));
out.writeInt(map.size());
for (Character character : map.values())
{
out.writeChar(character);
}
out.close();
}
catch (Exception e)
{
logger.warning("保存值" + path + Predefine.VALUE_EXT + "失败" + e);
return false;
}
return trie.save(path + Predefine.TRIE_EXT);
} | java | static boolean saveDat(TreeMap<String, Character> map)
{
try
{
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(IOUtil.newOutputStream(path + Predefine.VALUE_EXT)));
out.writeInt(map.size());
for (Character character : map.values())
{
out.writeChar(character);
}
out.close();
}
catch (Exception e)
{
logger.warning("保存值" + path + Predefine.VALUE_EXT + "失败" + e);
return false;
}
return trie.save(path + Predefine.TRIE_EXT);
} | [
"static",
"boolean",
"saveDat",
"(",
"TreeMap",
"<",
"String",
",",
"Character",
">",
"map",
")",
"{",
"try",
"{",
"DataOutputStream",
"out",
"=",
"new",
"DataOutputStream",
"(",
"new",
"BufferedOutputStream",
"(",
"IOUtil",
".",
"newOutputStream",
"(",
"path"... | 保存dat到磁盘
@param map
@return | [
"保存dat到磁盘"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/nr/JapanesePersonDictionary.java#L93-L111 | train | Save a map of strings to a file. | [
30522,
10763,
22017,
20898,
5552,
4017,
1006,
3392,
2863,
2361,
1026,
5164,
1010,
2839,
1028,
4949,
1007,
1063,
3046,
1063,
2951,
5833,
18780,
21422,
2041,
1027,
2047,
2951,
5833,
18780,
21422,
1006,
2047,
17698,
26010,
4904,
18780,
21422,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.copyFile | public static File copyFile(File src, File dest, StandardCopyOption... options) throws IORuntimeException {
// check
Assert.notNull(src, "Source File is null !");
if (false == src.exists()) {
throw new IORuntimeException("File not exist: " + src);
}
Assert.notNull(dest, "Destination File or directiory is null !");
if (equals(src, dest)) {
throw new IORuntimeException("Files '{}' and '{}' are equal", src, dest);
}
return copyFile(src.toPath(), dest.toPath(), options).toFile();
} | java | public static File copyFile(File src, File dest, StandardCopyOption... options) throws IORuntimeException {
// check
Assert.notNull(src, "Source File is null !");
if (false == src.exists()) {
throw new IORuntimeException("File not exist: " + src);
}
Assert.notNull(dest, "Destination File or directiory is null !");
if (equals(src, dest)) {
throw new IORuntimeException("Files '{}' and '{}' are equal", src, dest);
}
return copyFile(src.toPath(), dest.toPath(), options).toFile();
} | [
"public",
"static",
"File",
"copyFile",
"(",
"File",
"src",
",",
"File",
"dest",
",",
"StandardCopyOption",
"...",
"options",
")",
"throws",
"IORuntimeException",
"{",
"// check\r",
"Assert",
".",
"notNull",
"(",
"src",
",",
"\"Source File is null !\"",
")",
";"... | 通过JDK7+的 {@link Files#copy(Path, Path, CopyOption...)} 方法拷贝文件
@param src 源文件
@param dest 目标文件或目录,如果为目录使用与源文件相同的文件名
@param options {@link StandardCopyOption}
@return 目标文件
@throws IORuntimeException IO异常 | [
"通过JDK7",
"+",
"的",
"{",
"@link",
"Files#copy",
"(",
"Path",
"Path",
"CopyOption",
"...",
")",
"}",
"方法拷贝文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L939-L950 | train | Copies the source file to the destination file. | [
30522,
2270,
10763,
5371,
6100,
8873,
2571,
1006,
5371,
5034,
2278,
1010,
5371,
4078,
2102,
1010,
3115,
3597,
7685,
7361,
3508,
1012,
1012,
1012,
7047,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
1013,
1013,
4638,
20865,
1012,
2025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getClassPath | public static String getClassPath(boolean isEncoded) {
final URL classPathURL = getClassPathURL();
String url = isEncoded ? classPathURL.getPath() : URLUtil.getDecodedPath(classPathURL);
return FileUtil.normalize(url);
} | java | public static String getClassPath(boolean isEncoded) {
final URL classPathURL = getClassPathURL();
String url = isEncoded ? classPathURL.getPath() : URLUtil.getDecodedPath(classPathURL);
return FileUtil.normalize(url);
} | [
"public",
"static",
"String",
"getClassPath",
"(",
"boolean",
"isEncoded",
")",
"{",
"final",
"URL",
"classPathURL",
"=",
"getClassPathURL",
"(",
")",
";",
"String",
"url",
"=",
"isEncoded",
"?",
"classPathURL",
".",
"getPath",
"(",
")",
":",
"URLUtil",
".",... | 获得ClassPath,这个ClassPath路径会文件路径被标准化处理
@param isEncoded 是否编码路径中的中文
@return ClassPath
@since 3.2.1 | [
"获得ClassPath,这个ClassPath路径会文件路径被标准化处理"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L453-L457 | train | Get the path of the class file. | [
30522,
2270,
10763,
5164,
2131,
26266,
15069,
1006,
22017,
20898,
2003,
2368,
16044,
2094,
1007,
1063,
2345,
24471,
2140,
2465,
15069,
3126,
2140,
1027,
2131,
26266,
15069,
3126,
2140,
1006,
1007,
1025,
5164,
24471,
2140,
1027,
2003,
2368,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/server/EOFPacket.java | EOFPacket.fromBytes | public void fromBytes(byte[] data) {
int index = 0;
// 1. read field count
fieldCount = data[index];
index++;
// 2. read warning count
this.warningCount = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
// 3. read status flag
this.statusFlag = ByteHelper.readUnsignedShortLittleEndian(data, index);
// end read
} | java | public void fromBytes(byte[] data) {
int index = 0;
// 1. read field count
fieldCount = data[index];
index++;
// 2. read warning count
this.warningCount = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
// 3. read status flag
this.statusFlag = ByteHelper.readUnsignedShortLittleEndian(data, index);
// end read
} | [
"public",
"void",
"fromBytes",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"int",
"index",
"=",
"0",
";",
"// 1. read field count",
"fieldCount",
"=",
"data",
"[",
"index",
"]",
";",
"index",
"++",
";",
"// 2. read warning count",
"this",
".",
"warningCount",
... | <pre>
VERSION 4.1
Bytes Name
----- ----
1 field_count, always = 0xfe
2 warning_count
2 Status Flags
</pre> | [
"<pre",
">",
"VERSION",
"4",
".",
"1",
"Bytes",
"Name",
"-----",
"----",
"1",
"field_count",
"always",
"=",
"0xfe",
"2",
"warning_count",
"2",
"Status",
"Flags",
"<",
"/",
"pre",
">"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/server/EOFPacket.java#L25-L36 | train | Reads the CRA from the byte array. | [
30522,
2270,
11675,
2013,
3762,
4570,
1006,
24880,
1031,
1033,
2951,
1007,
1063,
20014,
5950,
1027,
1014,
1025,
1013,
1013,
1015,
1012,
3191,
2492,
4175,
2492,
3597,
16671,
1027,
2951,
1031,
5950,
1033,
1025,
5950,
1009,
1009,
1025,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/LocalProperties.java | LocalProperties.filterBySemanticProperties | public LocalProperties filterBySemanticProperties(SemanticProperties props, int input) {
if (props == null) {
throw new NullPointerException("SemanticProperties may not be null.");
}
LocalProperties returnProps = new LocalProperties();
// check if sorting is preserved
if (this.ordering != null) {
Ordering newOrdering = new Ordering();
for (int i = 0; i < this.ordering.getInvolvedIndexes().size(); i++) {
int sourceField = this.ordering.getInvolvedIndexes().get(i);
FieldSet targetField = props.getForwardingTargetFields(input, sourceField);
if (targetField == null || targetField.size() == 0) {
if (i == 0) {
// order fully destroyed
newOrdering = null;
break;
} else {
// order partially preserved
break;
}
} else {
// use any field of target fields for now. We should use something like field equivalence sets in the future.
if(targetField.size() > 1) {
LOG.warn("Found that a field is forwarded to more than one target field in " +
"semantic forwarded field information. Will only use the field with the lowest index.");
}
newOrdering.appendOrdering(targetField.toArray()[0], this.ordering.getType(i), this.ordering.getOrder(i));
}
}
returnProps.ordering = newOrdering;
if (newOrdering != null) {
returnProps.groupedFields = newOrdering.getInvolvedIndexes();
} else {
returnProps.groupedFields = null;
}
}
// check if grouping is preserved
else if (this.groupedFields != null) {
FieldList newGroupedFields = new FieldList();
for (Integer sourceField : this.groupedFields) {
FieldSet targetField = props.getForwardingTargetFields(input, sourceField);
if (targetField == null || targetField.size() == 0) {
newGroupedFields = null;
break;
} else {
// use any field of target fields for now. We should use something like field equivalence sets in the future.
if(targetField.size() > 1) {
LOG.warn("Found that a field is forwarded to more than one target field in " +
"semantic forwarded field information. Will only use the field with the lowest index.");
}
newGroupedFields = newGroupedFields.addField(targetField.toArray()[0]);
}
}
returnProps.groupedFields = newGroupedFields;
}
if (this.uniqueFields != null) {
Set<FieldSet> newUniqueFields = new HashSet<FieldSet>();
for (FieldSet fields : this.uniqueFields) {
FieldSet newFields = new FieldSet();
for (Integer sourceField : fields) {
FieldSet targetField = props.getForwardingTargetFields(input, sourceField);
if (targetField == null || targetField.size() == 0) {
newFields = null;
break;
} else {
// use any field of target fields for now. We should use something like field equivalence sets in the future.
if(targetField.size() > 1) {
LOG.warn("Found that a field is forwarded to more than one target field in " +
"semantic forwarded field information. Will only use the field with the lowest index.");
}
newFields = newFields.addField(targetField.toArray()[0]);
}
}
if (newFields != null) {
newUniqueFields.add(newFields);
}
}
if (!newUniqueFields.isEmpty()) {
returnProps.uniqueFields = newUniqueFields;
} else {
returnProps.uniqueFields = null;
}
}
return returnProps;
} | java | public LocalProperties filterBySemanticProperties(SemanticProperties props, int input) {
if (props == null) {
throw new NullPointerException("SemanticProperties may not be null.");
}
LocalProperties returnProps = new LocalProperties();
// check if sorting is preserved
if (this.ordering != null) {
Ordering newOrdering = new Ordering();
for (int i = 0; i < this.ordering.getInvolvedIndexes().size(); i++) {
int sourceField = this.ordering.getInvolvedIndexes().get(i);
FieldSet targetField = props.getForwardingTargetFields(input, sourceField);
if (targetField == null || targetField.size() == 0) {
if (i == 0) {
// order fully destroyed
newOrdering = null;
break;
} else {
// order partially preserved
break;
}
} else {
// use any field of target fields for now. We should use something like field equivalence sets in the future.
if(targetField.size() > 1) {
LOG.warn("Found that a field is forwarded to more than one target field in " +
"semantic forwarded field information. Will only use the field with the lowest index.");
}
newOrdering.appendOrdering(targetField.toArray()[0], this.ordering.getType(i), this.ordering.getOrder(i));
}
}
returnProps.ordering = newOrdering;
if (newOrdering != null) {
returnProps.groupedFields = newOrdering.getInvolvedIndexes();
} else {
returnProps.groupedFields = null;
}
}
// check if grouping is preserved
else if (this.groupedFields != null) {
FieldList newGroupedFields = new FieldList();
for (Integer sourceField : this.groupedFields) {
FieldSet targetField = props.getForwardingTargetFields(input, sourceField);
if (targetField == null || targetField.size() == 0) {
newGroupedFields = null;
break;
} else {
// use any field of target fields for now. We should use something like field equivalence sets in the future.
if(targetField.size() > 1) {
LOG.warn("Found that a field is forwarded to more than one target field in " +
"semantic forwarded field information. Will only use the field with the lowest index.");
}
newGroupedFields = newGroupedFields.addField(targetField.toArray()[0]);
}
}
returnProps.groupedFields = newGroupedFields;
}
if (this.uniqueFields != null) {
Set<FieldSet> newUniqueFields = new HashSet<FieldSet>();
for (FieldSet fields : this.uniqueFields) {
FieldSet newFields = new FieldSet();
for (Integer sourceField : fields) {
FieldSet targetField = props.getForwardingTargetFields(input, sourceField);
if (targetField == null || targetField.size() == 0) {
newFields = null;
break;
} else {
// use any field of target fields for now. We should use something like field equivalence sets in the future.
if(targetField.size() > 1) {
LOG.warn("Found that a field is forwarded to more than one target field in " +
"semantic forwarded field information. Will only use the field with the lowest index.");
}
newFields = newFields.addField(targetField.toArray()[0]);
}
}
if (newFields != null) {
newUniqueFields.add(newFields);
}
}
if (!newUniqueFields.isEmpty()) {
returnProps.uniqueFields = newUniqueFields;
} else {
returnProps.uniqueFields = null;
}
}
return returnProps;
} | [
"public",
"LocalProperties",
"filterBySemanticProperties",
"(",
"SemanticProperties",
"props",
",",
"int",
"input",
")",
"{",
"if",
"(",
"props",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"SemanticProperties may not be null.\"",
")",
";",
... | Filters these LocalProperties by the fields that are forwarded to the output
as described by the SemanticProperties.
@param props The semantic properties holding information about forwarded fields.
@param input The index of the input.
@return The filtered LocalProperties | [
"Filters",
"these",
"LocalProperties",
"by",
"the",
"fields",
"that",
"are",
"forwarded",
"to",
"the",
"output",
"as",
"described",
"by",
"the",
"SemanticProperties",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dataproperties/LocalProperties.java#L139-L233 | train | Filter by semantic properties. | [
30522,
2270,
2334,
21572,
4842,
7368,
11307,
3762,
3366,
2386,
4588,
21572,
4842,
7368,
1006,
21641,
21572,
4842,
7368,
24387,
1010,
20014,
7953,
1007,
1063,
2065,
1006,
24387,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONConverter.java | JSONConverter.jsonConvert | @SuppressWarnings("unchecked")
protected static <T> T jsonConvert(Type targetType, Object value, boolean ignoreError) throws ConvertException {
if (JSONUtil.isNull(value)) {
return null;
}
Object targetValue = null;
try {
targetValue = Convert.convert(targetType, value);
} catch (ConvertException e) {
if (ignoreError) {
return null;
}
throw e;
}
if (null == targetValue && false == ignoreError) {
if (StrUtil.isBlankIfStr(value)) {
// 对于传入空字符串的情况,如果转换的目标对象是非字符串或非原始类型,转换器会返回false。
// 此处特殊处理,认为返回null属于正常情况
return null;
}
throw new ConvertException("Can not convert {} to type {}", value, ObjectUtil.defaultIfNull(TypeUtil.getClass(targetType), targetType));
}
return (T) targetValue;
} | java | @SuppressWarnings("unchecked")
protected static <T> T jsonConvert(Type targetType, Object value, boolean ignoreError) throws ConvertException {
if (JSONUtil.isNull(value)) {
return null;
}
Object targetValue = null;
try {
targetValue = Convert.convert(targetType, value);
} catch (ConvertException e) {
if (ignoreError) {
return null;
}
throw e;
}
if (null == targetValue && false == ignoreError) {
if (StrUtil.isBlankIfStr(value)) {
// 对于传入空字符串的情况,如果转换的目标对象是非字符串或非原始类型,转换器会返回false。
// 此处特殊处理,认为返回null属于正常情况
return null;
}
throw new ConvertException("Can not convert {} to type {}", value, ObjectUtil.defaultIfNull(TypeUtil.getClass(targetType), targetType));
}
return (T) targetValue;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"static",
"<",
"T",
">",
"T",
"jsonConvert",
"(",
"Type",
"targetType",
",",
"Object",
"value",
",",
"boolean",
"ignoreError",
")",
"throws",
"ConvertException",
"{",
"if",
"(",
"JSONUtil",
".",
... | JSON递归转换<br>
首先尝试JDK类型转换,如果失败尝试JSON转Bean
@param <T>
@param targetType 目标类型
@param value 值
@param ignoreError 是否忽略转换错误
@return 目标类型的值
@throws ConvertException 转换失败 | [
"JSON递归转换<br",
">",
"首先尝试JDK类型转换,如果失败尝试JSON转Bean",
"@param",
"<T",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONConverter.java#L65-L92 | train | Convert a JSON value to a target type. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
5123,
10763,
1026,
1056,
1028,
1056,
1046,
3385,
8663,
16874,
1006,
2828,
4539,
13874,
1010,
4874,
3643,
1010,
22017,
20898,
8568,
2121,
29165,
1007,
11618,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/concurrent/DefaultPromise.java | DefaultPromise.cancel | @Override
public boolean cancel(boolean mayInterruptIfRunning) {
if (RESULT_UPDATER.compareAndSet(this, null, CANCELLATION_CAUSE_HOLDER)) {
if (checkNotifyWaiters()) {
notifyListeners();
}
return true;
}
return false;
} | java | @Override
public boolean cancel(boolean mayInterruptIfRunning) {
if (RESULT_UPDATER.compareAndSet(this, null, CANCELLATION_CAUSE_HOLDER)) {
if (checkNotifyWaiters()) {
notifyListeners();
}
return true;
}
return false;
} | [
"@",
"Override",
"public",
"boolean",
"cancel",
"(",
"boolean",
"mayInterruptIfRunning",
")",
"{",
"if",
"(",
"RESULT_UPDATER",
".",
"compareAndSet",
"(",
"this",
",",
"null",
",",
"CANCELLATION_CAUSE_HOLDER",
")",
")",
"{",
"if",
"(",
"checkNotifyWaiters",
"(",... | {@inheritDoc}
@param mayInterruptIfRunning this value has no effect in this implementation. | [
"{",
"@inheritDoc",
"}"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java#L305-L314 | train | Cancel the current thread. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
17542,
1006,
22017,
20898,
2089,
18447,
2121,
21531,
3775,
19699,
4609,
5582,
1007,
1063,
2065,
1006,
2765,
1035,
10651,
2099,
1012,
12826,
29560,
3388,
1006,
2023,
1010,
19701,
1010,
16990,
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... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java | TypeExtractor.getMapReturnTypes | @PublicEvolving
public static <IN, OUT> TypeInformation<OUT> getMapReturnTypes(MapFunction<IN, OUT> mapInterface, TypeInformation<IN> inType) {
return getMapReturnTypes(mapInterface, inType, null, false);
} | java | @PublicEvolving
public static <IN, OUT> TypeInformation<OUT> getMapReturnTypes(MapFunction<IN, OUT> mapInterface, TypeInformation<IN> inType) {
return getMapReturnTypes(mapInterface, inType, null, false);
} | [
"@",
"PublicEvolving",
"public",
"static",
"<",
"IN",
",",
"OUT",
">",
"TypeInformation",
"<",
"OUT",
">",
"getMapReturnTypes",
"(",
"MapFunction",
"<",
"IN",
",",
"OUT",
">",
"mapInterface",
",",
"TypeInformation",
"<",
"IN",
">",
"inType",
")",
"{",
"ret... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L166-L169 | train | Get the return type information for a map function. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
10763,
1026,
1999,
1010,
2041,
1028,
2828,
2378,
14192,
3370,
1026,
2041,
1028,
2131,
2863,
28139,
22299,
13874,
2015,
1006,
4949,
11263,
27989,
1026,
1999,
1010,
2041,
1028,
4949,
18447,
2121,
121... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/TransformMatrix.java | TransformMatrix.extend | public void extend(int ordinaryMax)
{
this.ordinaryMax = ordinaryMax;
double[][] n_transititon_probability = new double[ordinaryMax][ordinaryMax];
for (int i = 0; i < transititon_probability.length; i++)
{
System.arraycopy(transititon_probability[i], 0, n_transititon_probability[i], 0, transititon_probability.length);
}
transititon_probability = n_transititon_probability;
int[] n_total = new int[ordinaryMax];
System.arraycopy(total, 0, n_total, 0, total.length);
total = n_total;
double[] n_start_probability = new double[ordinaryMax];
System.arraycopy(start_probability, 0, n_start_probability, 0, start_probability.length);
start_probability = n_start_probability;
int[][] n_matrix = new int[ordinaryMax][ordinaryMax];
for (int i = 0; i < matrix.length; i++)
{
System.arraycopy(matrix[i], 0, n_matrix[i], 0, matrix.length);
}
matrix = n_matrix;
} | java | public void extend(int ordinaryMax)
{
this.ordinaryMax = ordinaryMax;
double[][] n_transititon_probability = new double[ordinaryMax][ordinaryMax];
for (int i = 0; i < transititon_probability.length; i++)
{
System.arraycopy(transititon_probability[i], 0, n_transititon_probability[i], 0, transititon_probability.length);
}
transititon_probability = n_transititon_probability;
int[] n_total = new int[ordinaryMax];
System.arraycopy(total, 0, n_total, 0, total.length);
total = n_total;
double[] n_start_probability = new double[ordinaryMax];
System.arraycopy(start_probability, 0, n_start_probability, 0, start_probability.length);
start_probability = n_start_probability;
int[][] n_matrix = new int[ordinaryMax][ordinaryMax];
for (int i = 0; i < matrix.length; i++)
{
System.arraycopy(matrix[i], 0, n_matrix[i], 0, matrix.length);
}
matrix = n_matrix;
} | [
"public",
"void",
"extend",
"(",
"int",
"ordinaryMax",
")",
"{",
"this",
".",
"ordinaryMax",
"=",
"ordinaryMax",
";",
"double",
"[",
"]",
"[",
"]",
"n_transititon_probability",
"=",
"new",
"double",
"[",
"ordinaryMax",
"]",
"[",
"ordinaryMax",
"]",
";",
"f... | 拓展内部矩阵,仅用于通过反射新增了枚举实例之后的兼容措施 | [
"拓展内部矩阵",
"仅用于通过反射新增了枚举实例之后的兼容措施"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/TransformMatrix.java#L149-L173 | train | Extend the class with the ordinaryMax value. | [
30522,
2270,
11675,
7949,
1006,
20014,
6623,
17848,
1007,
1063,
2023,
1012,
6623,
17848,
1027,
6623,
17848,
1025,
3313,
1031,
1033,
1031,
1033,
1050,
1035,
6671,
9956,
2078,
1035,
9723,
1027,
2047,
3313,
1031,
6623,
17848,
1033,
1031,
6623,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.setFieldValue | @SuppressWarnings({ "unchecked", "rawtypes" })
public static void setFieldValue(Object bean, String fieldNameOrIndex, Object value) {
if (bean instanceof Map) {
((Map) bean).put(fieldNameOrIndex, value);
} else if (bean instanceof List) {
CollUtil.setOrAppend((List) bean, Convert.toInt(fieldNameOrIndex), value);
} else if (ArrayUtil.isArray(bean)) {
ArrayUtil.setOrAppend(bean, Convert.toInt(fieldNameOrIndex), value);
} else {
// 普通Bean对象
ReflectUtil.setFieldValue(bean, fieldNameOrIndex, value);
}
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public static void setFieldValue(Object bean, String fieldNameOrIndex, Object value) {
if (bean instanceof Map) {
((Map) bean).put(fieldNameOrIndex, value);
} else if (bean instanceof List) {
CollUtil.setOrAppend((List) bean, Convert.toInt(fieldNameOrIndex), value);
} else if (ArrayUtil.isArray(bean)) {
ArrayUtil.setOrAppend(bean, Convert.toInt(fieldNameOrIndex), value);
} else {
// 普通Bean对象
ReflectUtil.setFieldValue(bean, fieldNameOrIndex, value);
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"static",
"void",
"setFieldValue",
"(",
"Object",
"bean",
",",
"String",
"fieldNameOrIndex",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"bean",
"instanceof",
"Map",
... | 设置字段值,,通过反射设置字段值,并不调用setXXX方法<br>
对象同样支持Map类型,fieldNameOrIndex即为key
@param bean Bean
@param fieldNameOrIndex 字段名或序号,序号支持负数
@param value 值 | [
"设置字段值,,通过反射设置字段值,并不调用setXXX方法<br",
">",
"对象同样支持Map类型,fieldNameOrIndex即为key"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L278-L290 | train | Sets the value of the specified field in the specified bean. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
4895,
5403,
18141,
1000,
1010,
1000,
6315,
13874,
2015,
1000,
1065,
1007,
2270,
10763,
11675,
2275,
3790,
10175,
5657,
1006,
4874,
14068,
1010,
5164,
2492,
18442,
28741,
3207,
2595,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java | EpollSocketChannelConfig.setTcpFastOpenConnect | public EpollSocketChannelConfig setTcpFastOpenConnect(boolean fastOpenConnect) {
try {
((EpollSocketChannel) channel).socket.setTcpFastOpenConnect(fastOpenConnect);
return this;
} catch (IOException e) {
throw new ChannelException(e);
}
} | java | public EpollSocketChannelConfig setTcpFastOpenConnect(boolean fastOpenConnect) {
try {
((EpollSocketChannel) channel).socket.setTcpFastOpenConnect(fastOpenConnect);
return this;
} catch (IOException e) {
throw new ChannelException(e);
}
} | [
"public",
"EpollSocketChannelConfig",
"setTcpFastOpenConnect",
"(",
"boolean",
"fastOpenConnect",
")",
"{",
"try",
"{",
"(",
"(",
"EpollSocketChannel",
")",
"channel",
")",
".",
"socket",
".",
"setTcpFastOpenConnect",
"(",
"fastOpenConnect",
")",
";",
"return",
"thi... | Set the {@code TCP_FASTOPEN_CONNECT} option on the socket. Requires Linux kernel 4.11 or later.
See
<a href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=19f6d3f3">this commit</a>
for more details. | [
"Set",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java#L558-L565 | train | Sets the TCP fast open connect flag. | [
30522,
2270,
4958,
14511,
6499,
19869,
10649,
20147,
22499,
2078,
8873,
2290,
2275,
13535,
14376,
14083,
26915,
8663,
2638,
6593,
1006,
22017,
20898,
3435,
26915,
8663,
2638,
6593,
1007,
1063,
3046,
1063,
1006,
1006,
4958,
14511,
6499,
19869,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/copier/BeanCopier.java | BeanCopier.mappingKey | private static String mappingKey(Map<String, String> mapping, String fieldName) {
if (MapUtil.isEmpty(mapping)) {
return fieldName;
}
return ObjectUtil.defaultIfNull(mapping.get(fieldName), fieldName);
} | java | private static String mappingKey(Map<String, String> mapping, String fieldName) {
if (MapUtil.isEmpty(mapping)) {
return fieldName;
}
return ObjectUtil.defaultIfNull(mapping.get(fieldName), fieldName);
} | [
"private",
"static",
"String",
"mappingKey",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"mapping",
",",
"String",
"fieldName",
")",
"{",
"if",
"(",
"MapUtil",
".",
"isEmpty",
"(",
"mapping",
")",
")",
"{",
"return",
"fieldName",
";",
"}",
"return",
... | 获取指定字段名对应的映射值
@param mapping 反向映射Map
@param fieldName 字段名
@return 映射值,无对应值返回字段名
@since 4.1.10 | [
"获取指定字段名对应的映射值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/copier/BeanCopier.java#L294-L299 | train | Returns the key of the field in the mapping. | [
30522,
2797,
10763,
5164,
12375,
14839,
1006,
4949,
1026,
5164,
1010,
5164,
1028,
12375,
1010,
5164,
2492,
18442,
1007,
1063,
2065,
1006,
4949,
21823,
2140,
1012,
2003,
6633,
13876,
2100,
1006,
12375,
1007,
1007,
1063,
2709,
2492,
18442,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java | Bzip2BlockCompressor.close | void close(ByteBuf out) {
// If an RLE run is in progress, write it out
if (rleLength > 0) {
writeRun(rleCurrentValue & 0xff, rleLength);
}
// Apply a one byte block wrap required by the BWT implementation
block[blockLength] = block[0];
// Perform the Burrows Wheeler Transform
Bzip2DivSufSort divSufSort = new Bzip2DivSufSort(block, bwtBlock, blockLength);
int bwtStartPointer = divSufSort.bwt();
Bzip2BitWriter writer = this.writer;
// Write out the block header
writer.writeBits(out, 24, BLOCK_HEADER_MAGIC_1);
writer.writeBits(out, 24, BLOCK_HEADER_MAGIC_2);
writer.writeInt(out, crc.getCRC());
writer.writeBoolean(out, false); // Randomised block flag. We never create randomised blocks
writer.writeBits(out, 24, bwtStartPointer);
// Write out the symbol map
writeSymbolMap(out);
// Perform the Move To Front Transform and Run-Length Encoding[2] stages
Bzip2MTFAndRLE2StageEncoder mtfEncoder = new Bzip2MTFAndRLE2StageEncoder(bwtBlock, blockLength,
blockValuesPresent);
mtfEncoder.encode();
// Perform the Huffman Encoding stage and write out the encoded data
Bzip2HuffmanStageEncoder huffmanEncoder = new Bzip2HuffmanStageEncoder(writer,
mtfEncoder.mtfBlock(),
mtfEncoder.mtfLength(),
mtfEncoder.mtfAlphabetSize(),
mtfEncoder.mtfSymbolFrequencies());
huffmanEncoder.encode(out);
} | java | void close(ByteBuf out) {
// If an RLE run is in progress, write it out
if (rleLength > 0) {
writeRun(rleCurrentValue & 0xff, rleLength);
}
// Apply a one byte block wrap required by the BWT implementation
block[blockLength] = block[0];
// Perform the Burrows Wheeler Transform
Bzip2DivSufSort divSufSort = new Bzip2DivSufSort(block, bwtBlock, blockLength);
int bwtStartPointer = divSufSort.bwt();
Bzip2BitWriter writer = this.writer;
// Write out the block header
writer.writeBits(out, 24, BLOCK_HEADER_MAGIC_1);
writer.writeBits(out, 24, BLOCK_HEADER_MAGIC_2);
writer.writeInt(out, crc.getCRC());
writer.writeBoolean(out, false); // Randomised block flag. We never create randomised blocks
writer.writeBits(out, 24, bwtStartPointer);
// Write out the symbol map
writeSymbolMap(out);
// Perform the Move To Front Transform and Run-Length Encoding[2] stages
Bzip2MTFAndRLE2StageEncoder mtfEncoder = new Bzip2MTFAndRLE2StageEncoder(bwtBlock, blockLength,
blockValuesPresent);
mtfEncoder.encode();
// Perform the Huffman Encoding stage and write out the encoded data
Bzip2HuffmanStageEncoder huffmanEncoder = new Bzip2HuffmanStageEncoder(writer,
mtfEncoder.mtfBlock(),
mtfEncoder.mtfLength(),
mtfEncoder.mtfAlphabetSize(),
mtfEncoder.mtfSymbolFrequencies());
huffmanEncoder.encode(out);
} | [
"void",
"close",
"(",
"ByteBuf",
"out",
")",
"{",
"// If an RLE run is in progress, write it out",
"if",
"(",
"rleLength",
">",
"0",
")",
"{",
"writeRun",
"(",
"rleCurrentValue",
"&",
"0xff",
",",
"rleLength",
")",
";",
"}",
"// Apply a one byte block wrap required ... | Compresses and writes out the block. | [
"Compresses",
"and",
"writes",
"out",
"the",
"block",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java#L222-L259 | train | Write out the Burrows Wheeler Transform and Huffman Encoding stages | [
30522,
11675,
2485,
1006,
24880,
8569,
2546,
2041,
1007,
1063,
1013,
1013,
2065,
2019,
1054,
2571,
2448,
2003,
1999,
5082,
1010,
4339,
2009,
2041,
2065,
1006,
1054,
2571,
7770,
13512,
2232,
1028,
1014,
1007,
1063,
3213,
4609,
1006,
1054,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SpringApplication.java | SpringApplication.logStartupProfileInfo | protected void logStartupProfileInfo(ConfigurableApplicationContext context) {
Log log = getApplicationLog();
if (log.isInfoEnabled()) {
String[] activeProfiles = context.getEnvironment().getActiveProfiles();
if (ObjectUtils.isEmpty(activeProfiles)) {
String[] defaultProfiles = context.getEnvironment().getDefaultProfiles();
log.info("No active profile set, falling back to default profiles: "
+ StringUtils.arrayToCommaDelimitedString(defaultProfiles));
}
else {
log.info("The following profiles are active: "
+ StringUtils.arrayToCommaDelimitedString(activeProfiles));
}
}
} | java | protected void logStartupProfileInfo(ConfigurableApplicationContext context) {
Log log = getApplicationLog();
if (log.isInfoEnabled()) {
String[] activeProfiles = context.getEnvironment().getActiveProfiles();
if (ObjectUtils.isEmpty(activeProfiles)) {
String[] defaultProfiles = context.getEnvironment().getDefaultProfiles();
log.info("No active profile set, falling back to default profiles: "
+ StringUtils.arrayToCommaDelimitedString(defaultProfiles));
}
else {
log.info("The following profiles are active: "
+ StringUtils.arrayToCommaDelimitedString(activeProfiles));
}
}
} | [
"protected",
"void",
"logStartupProfileInfo",
"(",
"ConfigurableApplicationContext",
"context",
")",
"{",
"Log",
"log",
"=",
"getApplicationLog",
"(",
")",
";",
"if",
"(",
"log",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"String",
"[",
"]",
"activeProfiles",
"... | Called to log active profile information.
@param context the application context | [
"Called",
"to",
"log",
"active",
"profile",
"information",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L676-L690 | train | Log the startup profile info. | [
30522,
5123,
11675,
15664,
7559,
8525,
9397,
3217,
8873,
19856,
14876,
1006,
9530,
8873,
27390,
3085,
29098,
19341,
3508,
8663,
18209,
6123,
1007,
1063,
8833,
8833,
1027,
2131,
29098,
19341,
3508,
21197,
1006,
1007,
1025,
2065,
1006,
8833,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-system/src/main/java/cn/hutool/system/JavaInfo.java | JavaInfo.getJavaVersionAsFloat | private final float getJavaVersionAsFloat() {
if (JAVA_VERSION == null) {
return 0f;
}
String str = JAVA_VERSION.substring(0, 3);
if (JAVA_VERSION.length() >= 5) {
str = str + JAVA_VERSION.substring(4, 5);
}
return Float.parseFloat(str);
} | java | private final float getJavaVersionAsFloat() {
if (JAVA_VERSION == null) {
return 0f;
}
String str = JAVA_VERSION.substring(0, 3);
if (JAVA_VERSION.length() >= 5) {
str = str + JAVA_VERSION.substring(4, 5);
}
return Float.parseFloat(str);
} | [
"private",
"final",
"float",
"getJavaVersionAsFloat",
"(",
")",
"{",
"if",
"(",
"JAVA_VERSION",
"==",
"null",
")",
"{",
"return",
"0f",
";",
"}",
"String",
"str",
"=",
"JAVA_VERSION",
".",
"substring",
"(",
"0",
",",
"3",
")",
";",
"if",
"(",
"JAVA_VER... | 取得当前Java impl.的版本的<code>float</code>值。
@return Java版本的<code>float</code>值或<code>0</code> | [
"取得当前Java",
"impl",
".",
"的版本的<code",
">",
"float<",
"/",
"code",
">",
"值。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-system/src/main/java/cn/hutool/system/JavaInfo.java#L81-L93 | train | Returns the Java version as a float. | [
30522,
2797,
2345,
14257,
2131,
3900,
3567,
27774,
3022,
10258,
16503,
1006,
1007,
1063,
2065,
1006,
9262,
1035,
2544,
1027,
1027,
19701,
1007,
1063,
2709,
1014,
2546,
1025,
1065,
5164,
2358,
2099,
1027,
9262,
1035,
2544,
1012,
4942,
3367,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/evictors/TimeEvictor.java | TimeEvictor.of | public static <W extends Window> TimeEvictor<W> of(Time windowSize) {
return new TimeEvictor<>(windowSize.toMilliseconds());
} | java | public static <W extends Window> TimeEvictor<W> of(Time windowSize) {
return new TimeEvictor<>(windowSize.toMilliseconds());
} | [
"public",
"static",
"<",
"W",
"extends",
"Window",
">",
"TimeEvictor",
"<",
"W",
">",
"of",
"(",
"Time",
"windowSize",
")",
"{",
"return",
"new",
"TimeEvictor",
"<>",
"(",
"windowSize",
".",
"toMilliseconds",
"(",
")",
")",
";",
"}"
] | Creates a {@code TimeEvictor} that keeps the given number of elements.
Eviction is done before the window function.
@param windowSize The amount of time for which to keep elements. | [
"Creates",
"a",
"{",
"@code",
"TimeEvictor",
"}",
"that",
"keeps",
"the",
"given",
"number",
"of",
"elements",
".",
"Eviction",
"is",
"done",
"before",
"the",
"window",
"function",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/windowing/evictors/TimeEvictor.java#L123-L125 | train | Creates a new time evictor. | [
30522,
2270,
10763,
1026,
1059,
8908,
3332,
1028,
2051,
17726,
4263,
1026,
1059,
1028,
1997,
1006,
2051,
3645,
4697,
1007,
1063,
2709,
2047,
2051,
17726,
4263,
1026,
1028,
1006,
3645,
4697,
1012,
3419,
8591,
5562,
8663,
5104,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherConfiguration.java | ScatterGatherConfiguration.addBroadcastSetForGatherFunction | public void addBroadcastSetForGatherFunction(String name, DataSet<?> data) {
this.bcVarsGather.add(new Tuple2<>(name, data));
} | java | public void addBroadcastSetForGatherFunction(String name, DataSet<?> data) {
this.bcVarsGather.add(new Tuple2<>(name, data));
} | [
"public",
"void",
"addBroadcastSetForGatherFunction",
"(",
"String",
"name",
",",
"DataSet",
"<",
"?",
">",
"data",
")",
"{",
"this",
".",
"bcVarsGather",
".",
"add",
"(",
"new",
"Tuple2",
"<>",
"(",
"name",
",",
"data",
")",
")",
";",
"}"
] | Adds a data set as a broadcast set to the gather function.
@param name The name under which the broadcast data is available in the gather function.
@param data The data set to be broadcast. | [
"Adds",
"a",
"data",
"set",
"as",
"a",
"broadcast",
"set",
"to",
"the",
"gather",
"function",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherConfiguration.java#L71-L73 | train | Adds a data set to the gather function. | [
30522,
2270,
11675,
5587,
12618,
4215,
10526,
13462,
29278,
20697,
5886,
11263,
27989,
1006,
5164,
2171,
1010,
2951,
13462,
1026,
1029,
1028,
2951,
1007,
1063,
2023,
1012,
4647,
10755,
28745,
8988,
2121,
1012,
5587,
1006,
2047,
10722,
10814,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/py/PinyinDictionary.java | PinyinDictionary.segLongest | protected static List<Pinyin> segLongest(char[] charArray, AhoCorasickDoubleArrayTrie<Pinyin[]> trie)
{
return segLongest(charArray, trie, true);
} | java | protected static List<Pinyin> segLongest(char[] charArray, AhoCorasickDoubleArrayTrie<Pinyin[]> trie)
{
return segLongest(charArray, trie, true);
} | [
"protected",
"static",
"List",
"<",
"Pinyin",
">",
"segLongest",
"(",
"char",
"[",
"]",
"charArray",
",",
"AhoCorasickDoubleArrayTrie",
"<",
"Pinyin",
"[",
"]",
">",
"trie",
")",
"{",
"return",
"segLongest",
"(",
"charArray",
",",
"trie",
",",
"true",
")",... | 用最长分词算法匹配拼音
@param charArray
@param trie
@return | [
"用最长分词算法匹配拼音"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/py/PinyinDictionary.java#L175-L178 | train | segLongest method. | [
30522,
5123,
10763,
2862,
1026,
9973,
1028,
7367,
23296,
30524,
13012,
2063,
1007,
1063,
2709,
7367,
23296,
5063,
4355,
1006,
25869,
2906,
9447,
1010,
13012,
2063,
1010,
2995,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/KeyedStateCheckpointOutputStream.java | KeyedStateCheckpointOutputStream.startNewKeyGroup | public void startNewKeyGroup(int keyGroupId) throws IOException {
if (isKeyGroupAlreadyStarted(keyGroupId)) {
throw new IOException("Key group " + keyGroupId + " already registered!");
}
keyGroupRangeOffsets.setKeyGroupOffset(keyGroupId, delegate.getPos());
currentKeyGroup = keyGroupId;
} | java | public void startNewKeyGroup(int keyGroupId) throws IOException {
if (isKeyGroupAlreadyStarted(keyGroupId)) {
throw new IOException("Key group " + keyGroupId + " already registered!");
}
keyGroupRangeOffsets.setKeyGroupOffset(keyGroupId, delegate.getPos());
currentKeyGroup = keyGroupId;
} | [
"public",
"void",
"startNewKeyGroup",
"(",
"int",
"keyGroupId",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isKeyGroupAlreadyStarted",
"(",
"keyGroupId",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Key group \"",
"+",
"keyGroupId",
"+",
"\" already re... | User code can call this method to signal that it begins to write a new key group with the given key group id.
This id must be within the {@link KeyGroupsList} provided by the stream. Each key-group can only be started once
and is considered final/immutable as soon as this method is called again. | [
"User",
"code",
"can",
"call",
"this",
"method",
"to",
"signal",
"that",
"it",
"begins",
"to",
"write",
"a",
"new",
"key",
"group",
"with",
"the",
"given",
"key",
"group",
"id",
".",
"This",
"id",
"must",
"be",
"within",
"the",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyedStateCheckpointOutputStream.java#L71-L77 | train | Start a new key group. | [
30522,
2270,
11675,
2707,
2638,
26291,
3240,
17058,
1006,
20014,
3145,
17058,
3593,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
2003,
14839,
17058,
2389,
16416,
5149,
14117,
3064,
1006,
3145,
17058,
3593,
1007,
1007,
1063,
5466,
2047,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java | ConditionMessage.of | public static ConditionMessage of(Collection<? extends ConditionMessage> messages) {
ConditionMessage result = new ConditionMessage();
if (messages != null) {
for (ConditionMessage message : messages) {
result = new ConditionMessage(result, message.toString());
}
}
return result;
} | java | public static ConditionMessage of(Collection<? extends ConditionMessage> messages) {
ConditionMessage result = new ConditionMessage();
if (messages != null) {
for (ConditionMessage message : messages) {
result = new ConditionMessage(result, message.toString());
}
}
return result;
} | [
"public",
"static",
"ConditionMessage",
"of",
"(",
"Collection",
"<",
"?",
"extends",
"ConditionMessage",
">",
"messages",
")",
"{",
"ConditionMessage",
"result",
"=",
"new",
"ConditionMessage",
"(",
")",
";",
"if",
"(",
"messages",
"!=",
"null",
")",
"{",
"... | Factory method to create a new {@link ConditionMessage} comprised of the specified
messages.
@param messages the source messages (may be {@code null})
@return a new {@link ConditionMessage} instance | [
"Factory",
"method",
"to",
"create",
"a",
"new",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java#L161-L169 | train | Creates a new condition message from a collection of condition messages. | [
30522,
2270,
10763,
4650,
7834,
3736,
3351,
1997,
1006,
3074,
1026,
1029,
8908,
4650,
7834,
3736,
3351,
1028,
7696,
1007,
1063,
4650,
7834,
3736,
3351,
2765,
1027,
2047,
4650,
7834,
3736,
3351,
1006,
1007,
1025,
2065,
1006,
7696,
999,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnarArray.java | ColumnarArray.array | @Override
public Object[] array() {
DataType dt = data.dataType();
Object[] list = new Object[length];
try {
for (int i = 0; i < length; i++) {
if (!data.isNullAt(offset + i)) {
list[i] = get(i, dt);
}
}
return list;
} catch(Exception e) {
throw new RuntimeException("Could not get the array", e);
}
} | java | @Override
public Object[] array() {
DataType dt = data.dataType();
Object[] list = new Object[length];
try {
for (int i = 0; i < length; i++) {
if (!data.isNullAt(offset + i)) {
list[i] = get(i, dt);
}
}
return list;
} catch(Exception e) {
throw new RuntimeException("Could not get the array", e);
}
} | [
"@",
"Override",
"public",
"Object",
"[",
"]",
"array",
"(",
")",
"{",
"DataType",
"dt",
"=",
"data",
".",
"dataType",
"(",
")",
";",
"Object",
"[",
"]",
"list",
"=",
"new",
"Object",
"[",
"length",
"]",
";",
"try",
"{",
"for",
"(",
"int",
"i",
... | TODO: this is extremely expensive. | [
"TODO",
":",
"this",
"is",
"extremely",
"expensive",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnarArray.java#L95-L109 | train | Override the array method to return an array of the array. | [
30522,
1030,
2058,
15637,
2270,
4874,
1031,
1033,
9140,
1006,
1007,
1063,
2951,
13874,
26718,
1027,
2951,
1012,
2951,
13874,
1006,
1007,
1025,
4874,
1031,
1033,
2862,
1027,
2047,
4874,
1031,
3091,
1033,
1025,
3046,
1063,
2005,
1006,
20014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/utility/ByteUtil.java | ByteUtil.bytesToInt | public static int bytesToInt(byte[] b)
{
int i = (b[0] << 24) & 0xFF000000;
i |= (b[1] << 16) & 0xFF0000;
i |= (b[2] << 8) & 0xFF00;
i |= b[3] & 0xFF;
return i;
} | java | public static int bytesToInt(byte[] b)
{
int i = (b[0] << 24) & 0xFF000000;
i |= (b[1] << 16) & 0xFF0000;
i |= (b[2] << 8) & 0xFF00;
i |= b[3] & 0xFF;
return i;
} | [
"public",
"static",
"int",
"bytesToInt",
"(",
"byte",
"[",
"]",
"b",
")",
"{",
"int",
"i",
"=",
"(",
"b",
"[",
"0",
"]",
"<<",
"24",
")",
"&",
"0xFF000000",
";",
"i",
"|=",
"(",
"b",
"[",
"1",
"]",
"<<",
"16",
")",
"&",
"0xFF0000",
";",
"i"... | 将一个4位字节数组转换为4整数。<br>
注意,函数中不会对字节数组长度进行判断,请自行保证传入参数的正确性。
@param b 字节数组
@return 整数 | [
"将一个4位字节数组转换为4整数。<br",
">",
"注意,函数中不会对字节数组长度进行判断,请自行保证传入参数的正确性。"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/ByteUtil.java#L100-L107 | train | Convert a byte array to an int. | [
30522,
2270,
10763,
20014,
27507,
3406,
18447,
1006,
24880,
1031,
1033,
1038,
1007,
1063,
20014,
1045,
1027,
1006,
1038,
1031,
1014,
1033,
1026,
1026,
2484,
1007,
1004,
1014,
2595,
4246,
8889,
8889,
8889,
1025,
1045,
1064,
1027,
1006,
1038,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/remote/BaseAugmenter.java | BaseAugmenter.augment | public WebElement augment(RemoteWebElement element) {
// TODO(simon): We should really add a "SelfDescribing" interface for this
RemoteWebDriver parent = (RemoteWebDriver) element.getWrappedDriver();
if (parent == null) {
return element;
}
return create(parent, elementAugmentors, element);
} | java | public WebElement augment(RemoteWebElement element) {
// TODO(simon): We should really add a "SelfDescribing" interface for this
RemoteWebDriver parent = (RemoteWebDriver) element.getWrappedDriver();
if (parent == null) {
return element;
}
return create(parent, elementAugmentors, element);
} | [
"public",
"WebElement",
"augment",
"(",
"RemoteWebElement",
"element",
")",
"{",
"// TODO(simon): We should really add a \"SelfDescribing\" interface for this",
"RemoteWebDriver",
"parent",
"=",
"(",
"RemoteWebDriver",
")",
"element",
".",
"getWrappedDriver",
"(",
")",
";",
... | Enhance the interfaces implemented by this instance of WebElement iff that instance is a
{@link org.openqa.selenium.remote.RemoteWebElement}.
The WebElement that is returned may well be a dynamic proxy. You cannot rely on the concrete
implementing class to remain constant.
@param element The driver to enhance.
@return A class implementing the described interfaces. | [
"Enhance",
"the",
"interfaces",
"implemented",
"by",
"this",
"instance",
"of",
"WebElement",
"iff",
"that",
"instance",
"is",
"a",
"{",
"@link",
"org",
".",
"openqa",
".",
"selenium",
".",
"remote",
".",
"RemoteWebElement",
"}",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/BaseAugmenter.java#L110-L118 | train | Augment the specified WebElement with the specified WebElement. | [
30522,
2270,
4773,
12260,
3672,
15476,
3672,
1006,
6556,
8545,
8671,
13665,
5783,
1007,
1063,
1013,
1013,
28681,
2080,
1006,
4079,
1007,
1024,
2057,
2323,
2428,
5587,
1037,
1000,
2969,
6155,
26775,
12322,
2075,
1000,
8278,
2005,
2023,
6556,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/KafkaConsumerThread.java | KafkaConsumerThread.shutdown | public void shutdown() {
running = false;
// wake up all blocking calls on the queue
unassignedPartitionsQueue.close();
// We cannot call close() on the KafkaConsumer, because it will actually throw
// an exception if a concurrent call is in progress
// this wakes up the consumer if it is blocked handing over records
handover.wakeupProducer();
// this wakes up the consumer if it is blocked in a kafka poll
synchronized (consumerReassignmentLock) {
if (consumer != null) {
consumer.wakeup();
} else {
// the consumer is currently isolated for partition reassignment;
// set this flag so that the wakeup state is restored once the reassignment is complete
hasBufferedWakeup = true;
}
}
} | java | public void shutdown() {
running = false;
// wake up all blocking calls on the queue
unassignedPartitionsQueue.close();
// We cannot call close() on the KafkaConsumer, because it will actually throw
// an exception if a concurrent call is in progress
// this wakes up the consumer if it is blocked handing over records
handover.wakeupProducer();
// this wakes up the consumer if it is blocked in a kafka poll
synchronized (consumerReassignmentLock) {
if (consumer != null) {
consumer.wakeup();
} else {
// the consumer is currently isolated for partition reassignment;
// set this flag so that the wakeup state is restored once the reassignment is complete
hasBufferedWakeup = true;
}
}
} | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"running",
"=",
"false",
";",
"// wake up all blocking calls on the queue",
"unassignedPartitionsQueue",
".",
"close",
"(",
")",
";",
"// We cannot call close() on the KafkaConsumer, because it will actually throw",
"// an exception if... | Shuts this thread down, waking up the thread gracefully if blocked (without Thread.interrupt() calls). | [
"Shuts",
"this",
"thread",
"down",
"waking",
"up",
"the",
"thread",
"gracefully",
"if",
"blocked",
"(",
"without",
"Thread",
".",
"interrupt",
"()",
"calls",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/KafkaConsumerThread.java#L293-L315 | train | Shuts down the consumer. | [
30522,
30524,
1063,
2770,
1027,
6270,
1025,
1013,
1013,
5256,
2039,
2035,
10851,
4455,
2006,
1996,
24240,
14477,
18719,
19225,
19362,
3775,
9285,
4226,
5657,
1012,
2485,
1006,
1007,
1025,
1013,
1013,
2057,
3685,
2655,
2485,
1006,
1007,
2006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.write | public static void write(OutputStream out, boolean isCloseOut, byte[] content) throws IORuntimeException {
try {
out.write(content);
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
if (isCloseOut) {
close(out);
}
}
} | java | public static void write(OutputStream out, boolean isCloseOut, byte[] content) throws IORuntimeException {
try {
out.write(content);
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
if (isCloseOut) {
close(out);
}
}
} | [
"public",
"static",
"void",
"write",
"(",
"OutputStream",
"out",
",",
"boolean",
"isCloseOut",
",",
"byte",
"[",
"]",
"content",
")",
"throws",
"IORuntimeException",
"{",
"try",
"{",
"out",
".",
"write",
"(",
"content",
")",
";",
"}",
"catch",
"(",
"IOEx... | 将byte[]写到流中
@param out 输出流
@param isCloseOut 写入完毕是否关闭输出流
@param content 写入的内容
@throws IORuntimeException IO异常 | [
"将byte",
"[]",
"写到流中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L857-L867 | train | Writes the specified content to the specified output stream. | [
30522,
2270,
10763,
11675,
4339,
1006,
27852,
25379,
2041,
1010,
22017,
20898,
2003,
20464,
9232,
5833,
1010,
24880,
1031,
1033,
4180,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
3046,
1063,
2041,
1012,
4339,
1006,
4180,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dictionary/TFDictionary.java | TFDictionary.getFrequency | public int getFrequency(String key)
{
TermFrequency termFrequency = get(key);
if (termFrequency == null) return 0;
return termFrequency.getFrequency();
} | java | public int getFrequency(String key)
{
TermFrequency termFrequency = get(key);
if (termFrequency == null) return 0;
return termFrequency.getFrequency();
} | [
"public",
"int",
"getFrequency",
"(",
"String",
"key",
")",
"{",
"TermFrequency",
"termFrequency",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"termFrequency",
"==",
"null",
")",
"return",
"0",
";",
"return",
"termFrequency",
".",
"getFrequency",
"(",
")"... | 获取频次
@param key
@return | [
"获取频次"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/TFDictionary.java#L118-L123 | train | Gets the frequency value for the specified key. | [
30522,
2270,
20014,
2131,
19699,
2063,
4226,
9407,
1006,
5164,
3145,
1007,
1063,
2744,
19699,
2063,
4226,
9407,
2744,
19699,
2063,
4226,
9407,
1027,
2131,
1006,
3145,
1007,
1025,
2065,
1006,
2744,
19699,
2063,
4226,
9407,
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... |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.indexOf | public static int indexOf(final CharSequence cs, final char searchChar, int start) {
if (cs instanceof String) {
return ((String) cs).indexOf(searchChar, start);
} else if (cs instanceof AsciiString) {
return ((AsciiString) cs).indexOf(searchChar, start);
}
if (cs == null) {
return INDEX_NOT_FOUND;
}
final int sz = cs.length();
for (int i = start < 0 ? 0 : start; i < sz; i++) {
if (cs.charAt(i) == searchChar) {
return i;
}
}
return INDEX_NOT_FOUND;
} | java | public static int indexOf(final CharSequence cs, final char searchChar, int start) {
if (cs instanceof String) {
return ((String) cs).indexOf(searchChar, start);
} else if (cs instanceof AsciiString) {
return ((AsciiString) cs).indexOf(searchChar, start);
}
if (cs == null) {
return INDEX_NOT_FOUND;
}
final int sz = cs.length();
for (int i = start < 0 ? 0 : start; i < sz; i++) {
if (cs.charAt(i) == searchChar) {
return i;
}
}
return INDEX_NOT_FOUND;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"final",
"CharSequence",
"cs",
",",
"final",
"char",
"searchChar",
",",
"int",
"start",
")",
"{",
"if",
"(",
"cs",
"instanceof",
"String",
")",
"{",
"return",
"(",
"(",
"String",
")",
"cs",
")",
".",
"indexOf"... | ----------------------------------------------------------------------- | [
"-----------------------------------------------------------------------"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L1800-L1816 | train | Gets the index of the first occurrence of the specified character in the CharSequence. | [
30522,
2270,
10763,
20014,
5950,
11253,
1006,
2345,
25869,
3366,
4226,
5897,
20116,
1010,
2345,
25869,
3945,
7507,
2099,
1010,
20014,
2707,
1007,
1063,
2065,
1006,
20116,
6013,
11253,
5164,
1007,
1063,
2709,
1006,
1006,
5164,
1007,
20116,
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/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/util/SQLUtil.java | SQLUtil.getExactlyExpression | public static String getExactlyExpression(final String value) {
return null == value ? null : CharMatcher.anyOf(" ").removeFrom(value);
} | java | public static String getExactlyExpression(final String value) {
return null == value ? null : CharMatcher.anyOf(" ").removeFrom(value);
} | [
"public",
"static",
"String",
"getExactlyExpression",
"(",
"final",
"String",
"value",
")",
"{",
"return",
"null",
"==",
"value",
"?",
"null",
":",
"CharMatcher",
".",
"anyOf",
"(",
"\" \"",
")",
".",
"removeFrom",
"(",
"value",
")",
";",
"}"
] | Get exactly SQL expression.
<p>remove space for SQL expression</p>
@param value SQL expression
@return exactly SQL expression | [
"Get",
"exactly",
"SQL",
"expression",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/util/SQLUtil.java#L56-L58 | train | Gets the exact expression. | [
30522,
2270,
10763,
5164,
2131,
10288,
18908,
2135,
10288,
20110,
3258,
1006,
2345,
5164,
3643,
1007,
1063,
2709,
19701,
1027,
1027,
3643,
1029,
19701,
1024,
11084,
4017,
7474,
1012,
2151,
11253,
1006,
1000,
1000,
1007,
1012,
6366,
19699,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java | ThriftCLIServiceClient.cancelOperation | @Override
public void cancelOperation(OperationHandle opHandle) throws HiveSQLException {
try {
TCancelOperationReq req = new TCancelOperationReq(opHandle.toTOperationHandle());
TCancelOperationResp resp = cliService.CancelOperation(req);
checkStatus(resp.getStatus());
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | java | @Override
public void cancelOperation(OperationHandle opHandle) throws HiveSQLException {
try {
TCancelOperationReq req = new TCancelOperationReq(opHandle.toTOperationHandle());
TCancelOperationResp resp = cliService.CancelOperation(req);
checkStatus(resp.getStatus());
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | [
"@",
"Override",
"public",
"void",
"cancelOperation",
"(",
"OperationHandle",
"opHandle",
")",
"throws",
"HiveSQLException",
"{",
"try",
"{",
"TCancelOperationReq",
"req",
"=",
"new",
"TCancelOperationReq",
"(",
"opHandle",
".",
"toTOperationHandle",
"(",
")",
")",
... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#cancelOperation(org.apache.hive.service.cli.OperationHandle) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java#L321-L332 | train | Cancel an operation. | [
30522,
1030,
2058,
15637,
2270,
11675,
17542,
25918,
3370,
1006,
3169,
11774,
2571,
6728,
11774,
2571,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
3046,
1063,
22975,
6651,
4135,
29487,
2890,
4160,
2128,
4160,
1027,
2047,
22975,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ThreadDeathWatcher.java | ThreadDeathWatcher.unwatch | public static void unwatch(Thread thread, Runnable task) {
if (thread == null) {
throw new NullPointerException("thread");
}
if (task == null) {
throw new NullPointerException("task");
}
schedule(thread, task, false);
} | java | public static void unwatch(Thread thread, Runnable task) {
if (thread == null) {
throw new NullPointerException("thread");
}
if (task == null) {
throw new NullPointerException("task");
}
schedule(thread, task, false);
} | [
"public",
"static",
"void",
"unwatch",
"(",
"Thread",
"thread",
",",
"Runnable",
"task",
")",
"{",
"if",
"(",
"thread",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"thread\"",
")",
";",
"}",
"if",
"(",
"task",
"==",
"null",
"... | Cancels the task scheduled via {@link #watch(Thread, Runnable)}. | [
"Cancels",
"the",
"task",
"scheduled",
"via",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ThreadDeathWatcher.java#L96-L105 | train | Unwatch a Runnable. | [
30522,
2270,
10763,
11675,
4895,
18866,
1006,
11689,
11689,
1010,
2448,
22966,
4708,
1007,
1063,
2065,
1006,
11689,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
11689,
1000,
1007,
1025,
1065,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java | ReferenceCountedOpenSslEngine.setOcspResponse | @UnstableApi
public void setOcspResponse(byte[] response) {
if (!enableOcsp) {
throw new IllegalStateException("OCSP stapling is not enabled");
}
if (clientMode) {
throw new IllegalStateException("Not a server SSLEngine");
}
synchronized (this) {
SSL.setOcspResponse(ssl, response);
}
} | java | @UnstableApi
public void setOcspResponse(byte[] response) {
if (!enableOcsp) {
throw new IllegalStateException("OCSP stapling is not enabled");
}
if (clientMode) {
throw new IllegalStateException("Not a server SSLEngine");
}
synchronized (this) {
SSL.setOcspResponse(ssl, response);
}
} | [
"@",
"UnstableApi",
"public",
"void",
"setOcspResponse",
"(",
"byte",
"[",
"]",
"response",
")",
"{",
"if",
"(",
"!",
"enableOcsp",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"OCSP stapling is not enabled\"",
")",
";",
"}",
"if",
"(",
"clientMod... | Sets the OCSP response. | [
"Sets",
"the",
"OCSP",
"response",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java#L388-L401 | train | Set the OCSP response. | [
30522,
1030,
14480,
9331,
2072,
2270,
11675,
2275,
10085,
13102,
6072,
26029,
3366,
1006,
24880,
1031,
1033,
3433,
1007,
1063,
2065,
1006,
999,
9585,
10085,
13102,
1007,
1063,
5466,
2047,
6206,
9153,
17389,
2595,
24422,
1006,
1000,
1051,
61... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.filter | public static <T> T[] filter(T[] array, Filter<T> filter) {
if(null == filter) {
return array;
}
final ArrayList<T> list = new ArrayList<T>(array.length);
for (T t : array) {
if (filter.accept(t)) {
list.add(t);
}
}
final T[] result = newArray(array.getClass().getComponentType(), list.size());
return list.toArray(result);
} | java | public static <T> T[] filter(T[] array, Filter<T> filter) {
if(null == filter) {
return array;
}
final ArrayList<T> list = new ArrayList<T>(array.length);
for (T t : array) {
if (filter.accept(t)) {
list.add(t);
}
}
final T[] result = newArray(array.getClass().getComponentType(), list.size());
return list.toArray(result);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"filter",
"(",
"T",
"[",
"]",
"array",
",",
"Filter",
"<",
"T",
">",
"filter",
")",
"{",
"if",
"(",
"null",
"==",
"filter",
")",
"{",
"return",
"array",
";",
"}",
"final",
"ArrayList",
"<",
"T",... | 过滤<br>
过滤过程通过传入的Filter实现来过滤返回需要的元素内容,这个Filter实现可以实现以下功能:
<pre>
1、过滤出需要的对象,{@link Filter#accept(Object)}方法返回true的对象将被加入结果集合中
</pre>
@param <T> 数组元素类型
@param array 数组
@param filter 过滤器接口,用于定义过滤规则,null表示不过滤,返回原数组
@return 过滤后的数组
@since 3.2.1 | [
"过滤<br",
">",
"过滤过程通过传入的Filter实现来过滤返回需要的元素内容,这个Filter实现可以实现以下功能:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L759-L772 | train | Returns an array that accepts all the elements of the given array that match the given filter. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
1031,
1033,
11307,
1006,
1056,
1031,
1033,
9140,
1010,
11307,
1026,
1056,
1028,
11307,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
11307,
1007,
1063,
2709,
9140,
1025,
1065,
2345,
9140,
9863,
1026,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/security/DynamicConfiguration.java | DynamicConfiguration.getAppConfigurationEntry | @Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
AppConfigurationEntry[] entry = null;
if (delegate != null) {
entry = delegate.getAppConfigurationEntry(name);
}
final AppConfigurationEntry[] existing = dynamicEntries.get(name);
if (existing != null) {
if (entry != null) {
entry = merge(entry, existing);
}
else {
entry = Arrays.copyOf(existing, existing.length);
}
}
return entry;
} | java | @Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
AppConfigurationEntry[] entry = null;
if (delegate != null) {
entry = delegate.getAppConfigurationEntry(name);
}
final AppConfigurationEntry[] existing = dynamicEntries.get(name);
if (existing != null) {
if (entry != null) {
entry = merge(entry, existing);
}
else {
entry = Arrays.copyOf(existing, existing.length);
}
}
return entry;
} | [
"@",
"Override",
"public",
"AppConfigurationEntry",
"[",
"]",
"getAppConfigurationEntry",
"(",
"String",
"name",
")",
"{",
"AppConfigurationEntry",
"[",
"]",
"entry",
"=",
"null",
";",
"if",
"(",
"delegate",
"!=",
"null",
")",
"{",
"entry",
"=",
"delegate",
... | Retrieve the AppConfigurationEntries for the specified <i>name</i>
from this Configuration.
@param name the name used to index the Configuration.
@return an array of AppConfigurationEntries for the specified <i>name</i>
from this Configuration, or null if there are no entries
for the specified <i>name</i> | [
"Retrieve",
"the",
"AppConfigurationEntries",
"for",
"the",
"specified",
"<i",
">",
"name<",
"/",
"i",
">",
"from",
"this",
"Configuration",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/security/DynamicConfiguration.java#L81-L97 | train | Returns an array of AppConfigurationEntry objects for the given name. | [
30522,
1030,
2058,
15637,
2270,
10439,
8663,
8873,
27390,
3370,
4765,
2854,
1031,
1033,
2131,
29098,
8663,
8873,
27390,
3370,
4765,
2854,
1006,
5164,
2171,
1007,
1063,
10439,
8663,
8873,
27390,
3370,
4765,
2854,
1031,
1033,
4443,
1027,
1970... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.add | public HttpHeaders add(CharSequence name, Iterable<?> values) {
return add(name.toString(), values);
} | java | public HttpHeaders add(CharSequence name, Iterable<?> values) {
return add(name.toString(), values);
} | [
"public",
"HttpHeaders",
"add",
"(",
"CharSequence",
"name",
",",
"Iterable",
"<",
"?",
">",
"values",
")",
"{",
"return",
"add",
"(",
"name",
".",
"toString",
"(",
")",
",",
"values",
")",
";",
"}"
] | Adds a new header with the specified name and values.
This getMethod can be represented approximately as the following code:
<pre>
for (Object v: values) {
if (v == null) {
break;
}
headers.add(name, v);
}
</pre>
@param name The name of the headers being set
@param values The values of the headers being set
@return {@code this} | [
"Adds",
"a",
"new",
"header",
"with",
"the",
"specified",
"name",
"and",
"values",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1405-L1407 | train | Add a header with the specified name and values. | [
30522,
2270,
8299,
4974,
2545,
5587,
1006,
25869,
3366,
4226,
5897,
2171,
1010,
2009,
6906,
3468,
1026,
1029,
1028,
5300,
1007,
1063,
2709,
5587,
1006,
2171,
1012,
2000,
3367,
4892,
1006,
1007,
1010,
5300,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java | BeetlUtil.renderFromStr | public static String renderFromStr(String templateContent, Map<String, Object> bindingMap) {
return render(getStrTemplate(templateContent), bindingMap);
} | java | public static String renderFromStr(String templateContent, Map<String, Object> bindingMap) {
return render(getStrTemplate(templateContent), bindingMap);
} | [
"public",
"static",
"String",
"renderFromStr",
"(",
"String",
"templateContent",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"bindingMap",
")",
"{",
"return",
"render",
"(",
"getStrTemplate",
"(",
"templateContent",
")",
",",
"bindingMap",
")",
";",
"}"
] | 渲染模板
@param templateContent 模板内容
@param bindingMap 绑定参数
@return 渲染后的内容
@since 3.2.0 | [
"渲染模板"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java#L211-L213 | train | Renders a string from a template. | [
30522,
2270,
10763,
5164,
17552,
19699,
22225,
16344,
1006,
5164,
23561,
8663,
6528,
2102,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
8031,
2863,
2361,
1007,
1063,
2709,
17552,
1006,
4152,
16344,
18532,
15725,
1006,
23561,
8663,
6528,
2102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/connection/BackendConnection.java | BackendConnection.close | public synchronized void close(final boolean forceClose) throws SQLException {
Collection<SQLException> exceptions = new LinkedList<>();
MasterVisitedManager.clear();
exceptions.addAll(closeResultSets());
exceptions.addAll(closeStatements());
if (!stateHandler.isInTransaction() || forceClose) {
exceptions.addAll(releaseConnections(forceClose));
}
stateHandler.doNotifyIfNecessary();
throwSQLExceptionIfNecessary(exceptions);
} | java | public synchronized void close(final boolean forceClose) throws SQLException {
Collection<SQLException> exceptions = new LinkedList<>();
MasterVisitedManager.clear();
exceptions.addAll(closeResultSets());
exceptions.addAll(closeStatements());
if (!stateHandler.isInTransaction() || forceClose) {
exceptions.addAll(releaseConnections(forceClose));
}
stateHandler.doNotifyIfNecessary();
throwSQLExceptionIfNecessary(exceptions);
} | [
"public",
"synchronized",
"void",
"close",
"(",
"final",
"boolean",
"forceClose",
")",
"throws",
"SQLException",
"{",
"Collection",
"<",
"SQLException",
">",
"exceptions",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"MasterVisitedManager",
".",
"clear",
"(",
... | Close cached connection.
@param forceClose force close flag
@throws SQLException SQL exception | [
"Close",
"cached",
"connection",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/connection/BackendConnection.java#L239-L249 | train | Close all resources. | [
30522,
2270,
25549,
11675,
2485,
1006,
2345,
22017,
20898,
2486,
20464,
9232,
1007,
11618,
29296,
10288,
24422,
1063,
3074,
1026,
29296,
10288,
24422,
1028,
11790,
1027,
2047,
5799,
9863,
1026,
1028,
1006,
1007,
1025,
3040,
11365,
17572,
2480... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-web/src/main/java/org/apache/flink/runtime/webmonitor/HttpRequestHandler.java | HttpRequestHandler.checkAndCreateUploadDir | public static synchronized void checkAndCreateUploadDir(File uploadDir) throws IOException {
if (uploadDir.exists() && uploadDir.canWrite()) {
LOG.info("Using directory {} for web frontend JAR file uploads.", uploadDir);
} else if (uploadDir.mkdirs() && uploadDir.canWrite()) {
LOG.info("Created directory {} for web frontend JAR file uploads.", uploadDir);
} else {
LOG.warn("Jar upload directory {} cannot be created or is not writable.", uploadDir.getAbsolutePath());
throw new IOException(
String.format("Jar upload directory %s cannot be created or is not writable.",
uploadDir.getAbsolutePath()));
}
} | java | public static synchronized void checkAndCreateUploadDir(File uploadDir) throws IOException {
if (uploadDir.exists() && uploadDir.canWrite()) {
LOG.info("Using directory {} for web frontend JAR file uploads.", uploadDir);
} else if (uploadDir.mkdirs() && uploadDir.canWrite()) {
LOG.info("Created directory {} for web frontend JAR file uploads.", uploadDir);
} else {
LOG.warn("Jar upload directory {} cannot be created or is not writable.", uploadDir.getAbsolutePath());
throw new IOException(
String.format("Jar upload directory %s cannot be created or is not writable.",
uploadDir.getAbsolutePath()));
}
} | [
"public",
"static",
"synchronized",
"void",
"checkAndCreateUploadDir",
"(",
"File",
"uploadDir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"uploadDir",
".",
"exists",
"(",
")",
"&&",
"uploadDir",
".",
"canWrite",
"(",
")",
")",
"{",
"LOG",
".",
"info",
... | Checks whether the given directory exists and is writable. If it doesn't exist this method will attempt to create
it.
@param uploadDir directory to check
@throws IOException if the directory does not exist and cannot be created, or if the directory isn't writable | [
"Checks",
"whether",
"the",
"given",
"directory",
"exists",
"and",
"is",
"writable",
".",
"If",
"it",
"doesn",
"t",
"exist",
"this",
"method",
"will",
"attempt",
"to",
"create",
"it",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/HttpRequestHandler.java#L206-L217 | train | Check if the upload directory exists and if not create it. | [
30522,
2270,
10763,
25549,
11675,
4638,
5685,
16748,
3686,
6279,
11066,
4305,
2099,
1006,
5371,
2039,
11066,
4305,
2099,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
2039,
11066,
4305,
2099,
1012,
6526,
1006,
1007,
1004,
1004,
2039,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/health/OrderedHealthAggregator.java | OrderedHealthAggregator.setStatusOrder | public void setStatusOrder(Status... statusOrder) {
String[] order = new String[statusOrder.length];
for (int i = 0; i < statusOrder.length; i++) {
order[i] = statusOrder[i].getCode();
}
setStatusOrder(Arrays.asList(order));
} | java | public void setStatusOrder(Status... statusOrder) {
String[] order = new String[statusOrder.length];
for (int i = 0; i < statusOrder.length; i++) {
order[i] = statusOrder[i].getCode();
}
setStatusOrder(Arrays.asList(order));
} | [
"public",
"void",
"setStatusOrder",
"(",
"Status",
"...",
"statusOrder",
")",
"{",
"String",
"[",
"]",
"order",
"=",
"new",
"String",
"[",
"statusOrder",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"statusOrder",
".",
"l... | Set the ordering of the status.
@param statusOrder an ordered list of the status | [
"Set",
"the",
"ordering",
"of",
"the",
"status",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/OrderedHealthAggregator.java#L51-L57 | train | Sets the status order. | [
30522,
2270,
11675,
4520,
29336,
26658,
26764,
1006,
3570,
1012,
1012,
1012,
3570,
8551,
2121,
1007,
1063,
5164,
1031,
1033,
2344,
1027,
2047,
5164,
1031,
3570,
8551,
2121,
1012,
3091,
1033,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
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-setting/src/main/java/cn/hutool/setting/Setting.java | Setting.toProperties | public Properties toProperties() {
final Properties properties = new Properties();
String group;
for (Entry<String, LinkedHashMap<String, String>> groupEntry : this.groupedMap.entrySet()) {
group = groupEntry.getKey();
for (Entry<String, String> entry : groupEntry.getValue().entrySet()) {
properties.setProperty(StrUtil.isEmpty(group) ? entry.getKey() : group + CharUtil.DOT + entry.getKey(), entry.getValue());
}
}
return properties;
} | java | public Properties toProperties() {
final Properties properties = new Properties();
String group;
for (Entry<String, LinkedHashMap<String, String>> groupEntry : this.groupedMap.entrySet()) {
group = groupEntry.getKey();
for (Entry<String, String> entry : groupEntry.getValue().entrySet()) {
properties.setProperty(StrUtil.isEmpty(group) ? entry.getKey() : group + CharUtil.DOT + entry.getKey(), entry.getValue());
}
}
return properties;
} | [
"public",
"Properties",
"toProperties",
"(",
")",
"{",
"final",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"String",
"group",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
">",
... | 转换为Properties对象,原分组变为前缀
@return Properties对象 | [
"转换为Properties对象,原分组变为前缀"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L325-L335 | train | Converts this object to a Properties object. | [
30522,
2270,
5144,
2327,
18981,
8743,
3111,
1006,
1007,
1063,
2345,
5144,
5144,
1027,
2047,
5144,
1006,
1007,
1025,
5164,
2177,
1025,
2005,
1006,
4443,
1026,
5164,
1010,
5799,
14949,
22444,
2361,
1026,
5164,
1010,
5164,
1028,
1028,
2177,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/DynaBean.java | DynaBean.set | @SuppressWarnings({ "unchecked", "rawtypes" })
public void set(String fieldName, Object value) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
((Map)bean).put(fieldName, value);
return;
}else{
try {
final Method setter = BeanUtil.getBeanDesc(beanClass).getSetter(fieldName);
if(null == setter){
throw new BeanException("No set method for {}", fieldName);
}
setter.invoke(this.bean, value);
} catch (Exception e) {
throw new BeanException(e);
}
}
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public void set(String fieldName, Object value) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
((Map)bean).put(fieldName, value);
return;
}else{
try {
final Method setter = BeanUtil.getBeanDesc(beanClass).getSetter(fieldName);
if(null == setter){
throw new BeanException("No set method for {}", fieldName);
}
setter.invoke(this.bean, value);
} catch (Exception e) {
throw new BeanException(e);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"void",
"set",
"(",
"String",
"fieldName",
",",
"Object",
"value",
")",
"throws",
"BeanException",
"{",
"if",
"(",
"Map",
".",
"class",
".",
"isAssignableFrom",
"(",... | 设置字段值
@param fieldName 字段名
@param value 字段值
@throws BeanException 反射获取属性值或字段值导致的异常 | [
"设置字段值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/DynaBean.java#L113-L129 | train | Sets the value of the specified field in the bean. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
4895,
5403,
18141,
1000,
1010,
1000,
6315,
13874,
2015,
1000,
1065,
1007,
2270,
11675,
2275,
1006,
5164,
2492,
18442,
1010,
4874,
3643,
1007,
11618,
14068,
10288,
24422,
1063,
2065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ChannelDuplexHandler.java | Http2ChannelDuplexHandler.newStream | public final Http2FrameStream newStream() {
Http2FrameCodec codec = frameCodec;
if (codec == null) {
throw new IllegalStateException(StringUtil.simpleClassName(Http2FrameCodec.class) + " not found." +
" Has the handler been added to a pipeline?");
}
return codec.newStream();
} | java | public final Http2FrameStream newStream() {
Http2FrameCodec codec = frameCodec;
if (codec == null) {
throw new IllegalStateException(StringUtil.simpleClassName(Http2FrameCodec.class) + " not found." +
" Has the handler been added to a pipeline?");
}
return codec.newStream();
} | [
"public",
"final",
"Http2FrameStream",
"newStream",
"(",
")",
"{",
"Http2FrameCodec",
"codec",
"=",
"frameCodec",
";",
"if",
"(",
"codec",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"StringUtil",
".",
"simpleClassName",
"(",
"Http2Fram... | Creates a new {@link Http2FrameStream} object.
<p>This method is <em>thread-safe</em>. | [
"Creates",
"a",
"new",
"{",
"@link",
"Http2FrameStream",
"}",
"object",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ChannelDuplexHandler.java#L68-L75 | train | Returns a new stream for this handler. | [
30522,
2270,
2345,
8299,
2475,
15643,
21422,
2739,
25379,
1006,
1007,
1063,
8299,
2475,
15643,
16044,
2278,
3642,
2278,
1027,
4853,
16044,
2278,
1025,
2065,
1006,
3642,
2278,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
9153,
17389,
259... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.trimRight | public UTF8String trimRight(UTF8String trimString) {
if (trimString == null) return null;
int charIdx = 0;
// number of characters from the source string
int numChars = 0;
// array of character length for the source string
int[] stringCharLen = new int[numBytes];
// array of the first byte position for each character in the source string
int[] stringCharPos = new int[numBytes];
// build the position and length array
while (charIdx < numBytes) {
stringCharPos[numChars] = charIdx;
stringCharLen[numChars] = numBytesForFirstByte(getByte(charIdx));
charIdx += stringCharLen[numChars];
numChars ++;
}
// index trimEnd points to the first no matching byte position from the right side of
// the source string.
int trimEnd = numBytes - 1;
while (numChars > 0) {
UTF8String searchChar = copyUTF8String(
stringCharPos[numChars - 1],
stringCharPos[numChars - 1] + stringCharLen[numChars - 1] - 1);
if (trimString.find(searchChar, 0) >= 0) {
trimEnd -= stringCharLen[numChars - 1];
} else {
break;
}
numChars --;
}
if (trimEnd < 0) {
// empty string
return EMPTY_UTF8;
} else {
return copyUTF8String(0, trimEnd);
}
} | java | public UTF8String trimRight(UTF8String trimString) {
if (trimString == null) return null;
int charIdx = 0;
// number of characters from the source string
int numChars = 0;
// array of character length for the source string
int[] stringCharLen = new int[numBytes];
// array of the first byte position for each character in the source string
int[] stringCharPos = new int[numBytes];
// build the position and length array
while (charIdx < numBytes) {
stringCharPos[numChars] = charIdx;
stringCharLen[numChars] = numBytesForFirstByte(getByte(charIdx));
charIdx += stringCharLen[numChars];
numChars ++;
}
// index trimEnd points to the first no matching byte position from the right side of
// the source string.
int trimEnd = numBytes - 1;
while (numChars > 0) {
UTF8String searchChar = copyUTF8String(
stringCharPos[numChars - 1],
stringCharPos[numChars - 1] + stringCharLen[numChars - 1] - 1);
if (trimString.find(searchChar, 0) >= 0) {
trimEnd -= stringCharLen[numChars - 1];
} else {
break;
}
numChars --;
}
if (trimEnd < 0) {
// empty string
return EMPTY_UTF8;
} else {
return copyUTF8String(0, trimEnd);
}
} | [
"public",
"UTF8String",
"trimRight",
"(",
"UTF8String",
"trimString",
")",
"{",
"if",
"(",
"trimString",
"==",
"null",
")",
"return",
"null",
";",
"int",
"charIdx",
"=",
"0",
";",
"// number of characters from the source string",
"int",
"numChars",
"=",
"0",
";"... | Based on the given trim string, trim this string starting from right end
This method searches each character in the source string starting from the right end,
removes the character if it is in the trim string, stops at the first character which is not
in the trim string, returns the new string.
@param trimString the trim character string | [
"Based",
"on",
"the",
"given",
"trim",
"string",
"trim",
"this",
"string",
"starting",
"from",
"right",
"end",
"This",
"method",
"searches",
"each",
"character",
"in",
"the",
"source",
"string",
"starting",
"from",
"the",
"right",
"end",
"removes",
"the",
"c... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L629-L667 | train | Trims the given string from the right side of the source string. | [
30522,
2270,
21183,
2546,
2620,
3367,
4892,
12241,
15950,
1006,
21183,
2546,
2620,
3367,
4892,
12241,
3367,
4892,
1007,
1063,
2065,
1006,
12241,
3367,
4892,
1027,
1027,
19701,
1007,
2709,
19701,
1025,
20014,
25869,
3593,
2595,
1027,
1014,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/BatchRouteUnit.java | BatchRouteUnit.getParameterSets | public List<List<Object>> getParameterSets() {
List<List<Object>> result = new LinkedList<>();
if (routeUnit.getSqlUnit().getParameters().isEmpty() || 0 == actualCallAddBatchTimes) {
result.add(Collections.emptyList());
} else {
result.addAll(Lists.partition(routeUnit.getSqlUnit().getParameters(), routeUnit.getSqlUnit().getParameters().size() / actualCallAddBatchTimes));
}
return result;
} | java | public List<List<Object>> getParameterSets() {
List<List<Object>> result = new LinkedList<>();
if (routeUnit.getSqlUnit().getParameters().isEmpty() || 0 == actualCallAddBatchTimes) {
result.add(Collections.emptyList());
} else {
result.addAll(Lists.partition(routeUnit.getSqlUnit().getParameters(), routeUnit.getSqlUnit().getParameters().size() / actualCallAddBatchTimes));
}
return result;
} | [
"public",
"List",
"<",
"List",
"<",
"Object",
">",
">",
"getParameterSets",
"(",
")",
"{",
"List",
"<",
"List",
"<",
"Object",
">>",
"result",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"if",
"(",
"routeUnit",
".",
"getSqlUnit",
"(",
")",
".",
... | Get parameter sets.
@return parameter sets | [
"Get",
"parameter",
"sets",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/BatchRouteUnit.java#L67-L75 | train | Get parameter sets. | [
30522,
2270,
2862,
1026,
2862,
1026,
4874,
1028,
1028,
2131,
28689,
22828,
13462,
2015,
1006,
1007,
1063,
2862,
1026,
2862,
1026,
4874,
1028,
1028,
2765,
1027,
2047,
5799,
9863,
1026,
1028,
1006,
1007,
1025,
2065,
1006,
2799,
19496,
2102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | utility/src/main/java/com/networknt/utility/NioUtils.java | NioUtils.toByteArray | public static byte[] toByteArray(InputStream is) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
try {
byte[] b = new byte[BUFFER_SIZE];
int n = 0;
while ((n = is.read(b)) != -1) {
output.write(b, 0, n);
}
return output.toByteArray();
} finally {
output.close();
}
} | java | public static byte[] toByteArray(InputStream is) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
try {
byte[] b = new byte[BUFFER_SIZE];
int n = 0;
while ((n = is.read(b)) != -1) {
output.write(b, 0, n);
}
return output.toByteArray();
} finally {
output.close();
}
} | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"output",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"try",
"{",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
... | Reads and returns the rest of the given input stream as a byte array.
Caller is responsible for closing the given input stream.
@param is input stream
@return byte[] byte array
@throws IOException IOException | [
"Reads",
"and",
"returns",
"the",
"rest",
"of",
"the",
"given",
"input",
"stream",
"as",
"a",
"byte",
"array",
".",
"Caller",
"is",
"responsible",
"for",
"closing",
"the",
"given",
"input",
"stream",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/NioUtils.java#L299-L311 | train | Get a byte array from an input stream. | [
30522,
2270,
10763,
24880,
1031,
1033,
11291,
27058,
11335,
2100,
1006,
20407,
25379,
2003,
1007,
11618,
22834,
10288,
24422,
1063,
24880,
2906,
9447,
5833,
18780,
21422,
6434,
1027,
2047,
24880,
2906,
9447,
5833,
18780,
21422,
1006,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.beanToMap | public static Map<String, Object> beanToMap(Object bean, Map<String, Object> targetMap, boolean ignoreNullValue, Editor<String> keyEditor) {
if (bean == null) {
return null;
}
final Collection<PropDesc> props = BeanUtil.getBeanDesc(bean.getClass()).getProps();
String key;
Method getter;
Object value;
for (PropDesc prop : props) {
key = prop.getFieldName();
// 过滤class属性
// 得到property对应的getter方法
getter = prop.getGetter();
if (null != getter) {
// 只读取有getter方法的属性
try {
value = getter.invoke(bean);
} catch (Exception ignore) {
continue;
}
if (false == ignoreNullValue || (null != value && false == value.equals(bean))) {
key = keyEditor.edit(key);
if (null != key) {
targetMap.put(key, value);
}
}
}
}
return targetMap;
} | java | public static Map<String, Object> beanToMap(Object bean, Map<String, Object> targetMap, boolean ignoreNullValue, Editor<String> keyEditor) {
if (bean == null) {
return null;
}
final Collection<PropDesc> props = BeanUtil.getBeanDesc(bean.getClass()).getProps();
String key;
Method getter;
Object value;
for (PropDesc prop : props) {
key = prop.getFieldName();
// 过滤class属性
// 得到property对应的getter方法
getter = prop.getGetter();
if (null != getter) {
// 只读取有getter方法的属性
try {
value = getter.invoke(bean);
} catch (Exception ignore) {
continue;
}
if (false == ignoreNullValue || (null != value && false == value.equals(bean))) {
key = keyEditor.edit(key);
if (null != key) {
targetMap.put(key, value);
}
}
}
}
return targetMap;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"beanToMap",
"(",
"Object",
"bean",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"targetMap",
",",
"boolean",
"ignoreNullValue",
",",
"Editor",
"<",
"String",
">",
"keyEditor",
")",
"{",
"if... | 对象转Map<br>
通过实现{@link Editor} 可以自定义字段值,如果这个Editor返回null则忽略这个字段,以便实现:
<pre>
1. 字段筛选,可以去除不需要的字段
2. 字段变换,例如实现驼峰转下划线
3. 自定义字段前缀或后缀等等
</pre>
@param bean bean对象
@param targetMap 目标的Map
@param ignoreNullValue 是否忽略值为空的字段
@param keyEditor 属性字段(Map的key)编辑器,用于筛选、编辑key
@return Map
@since 4.0.5 | [
"对象转Map<br",
">",
"通过实现",
"{",
"@link",
"Editor",
"}",
"可以自定义字段值,如果这个Editor返回null则忽略这个字段,以便实现:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L542-L573 | train | Returns a map of all the properties of the specified bean from the specified target map. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
4874,
1028,
14068,
20389,
9331,
1006,
4874,
14068,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
4539,
2863,
2361,
1010,
22017,
20898,
8568,
11231,
3363,
10175,
5657,
1010,
3559,
1026,
5164,
1028,
314... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.isInRange | public static boolean isInRange(String ip, String cidr) {
String[] ips = StrUtil.splitToArray(ip, '.');
int ipAddr = (Integer.parseInt(ips[0]) << 24) | (Integer.parseInt(ips[1]) << 16) | (Integer.parseInt(ips[2]) << 8) | Integer.parseInt(ips[3]);
int type = Integer.parseInt(cidr.replaceAll(".*/", ""));
int mask = 0xFFFFFFFF << (32 - type);
String cidrIp = cidr.replaceAll("/.*", "");
String[] cidrIps = cidrIp.split("\\.");
int cidrIpAddr = (Integer.parseInt(cidrIps[0]) << 24) | (Integer.parseInt(cidrIps[1]) << 16) | (Integer.parseInt(cidrIps[2]) << 8) | Integer.parseInt(cidrIps[3]);
return (ipAddr & mask) == (cidrIpAddr & mask);
} | java | public static boolean isInRange(String ip, String cidr) {
String[] ips = StrUtil.splitToArray(ip, '.');
int ipAddr = (Integer.parseInt(ips[0]) << 24) | (Integer.parseInt(ips[1]) << 16) | (Integer.parseInt(ips[2]) << 8) | Integer.parseInt(ips[3]);
int type = Integer.parseInt(cidr.replaceAll(".*/", ""));
int mask = 0xFFFFFFFF << (32 - type);
String cidrIp = cidr.replaceAll("/.*", "");
String[] cidrIps = cidrIp.split("\\.");
int cidrIpAddr = (Integer.parseInt(cidrIps[0]) << 24) | (Integer.parseInt(cidrIps[1]) << 16) | (Integer.parseInt(cidrIps[2]) << 8) | Integer.parseInt(cidrIps[3]);
return (ipAddr & mask) == (cidrIpAddr & mask);
} | [
"public",
"static",
"boolean",
"isInRange",
"(",
"String",
"ip",
",",
"String",
"cidr",
")",
"{",
"String",
"[",
"]",
"ips",
"=",
"StrUtil",
".",
"splitToArray",
"(",
"ip",
",",
"'",
"'",
")",
";",
"int",
"ipAddr",
"=",
"(",
"Integer",
".",
"parseInt... | 是否在CIDR规则配置范围内<br>
方法来自:【成都】小邓
@param ip 需要验证的IP
@param cidr CIDR规则
@return 是否在范围内
@since 4.0.6 | [
"是否在CIDR规则配置范围内<br",
">",
"方法来自:【成都】小邓"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L526-L535 | train | Checks if the given IP address is in the range of the specified CIDR. | [
30522,
2270,
10763,
22017,
20898,
2003,
2378,
24388,
2063,
1006,
5164,
12997,
1010,
5164,
28744,
2099,
1007,
1063,
5164,
1031,
1033,
12997,
2015,
1027,
2358,
22134,
4014,
1012,
3975,
3406,
2906,
9447,
1006,
12997,
1010,
1005,
1012,
1005,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/perceptron/structures/IndexMaps.java | IndexMaps.clusterId | public int[] clusterId(String word)
{
int[] ids = new int[3];
ids[0] = -100;
ids[1] = -100;
ids[2] = -100;
if (brownFullClusters.containsKey(word))
ids[0] = brownFullClusters.get(word);
if (ids[0] > 0)
{
ids[1] = brown4Clusters.get(ids[0]);
ids[2] = brown6Clusters.get(ids[0]);
}
return ids;
} | java | public int[] clusterId(String word)
{
int[] ids = new int[3];
ids[0] = -100;
ids[1] = -100;
ids[2] = -100;
if (brownFullClusters.containsKey(word))
ids[0] = brownFullClusters.get(word);
if (ids[0] > 0)
{
ids[1] = brown4Clusters.get(ids[0]);
ids[2] = brown6Clusters.get(ids[0]);
}
return ids;
} | [
"public",
"int",
"[",
"]",
"clusterId",
"(",
"String",
"word",
")",
"{",
"int",
"[",
"]",
"ids",
"=",
"new",
"int",
"[",
"3",
"]",
";",
"ids",
"[",
"0",
"]",
"=",
"-",
"100",
";",
"ids",
"[",
"1",
"]",
"=",
"-",
"100",
";",
"ids",
"[",
"2... | 获取聚类id
@param word
@return | [
"获取聚类id"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/perceptron/structures/IndexMaps.java#L143-L158 | train | Get the clusterId of a single word. | [
30522,
2270,
20014,
1031,
1033,
9324,
3593,
1006,
5164,
2773,
1007,
1063,
20014,
1031,
1033,
8909,
2015,
1027,
2047,
20014,
1031,
1017,
1033,
1025,
8909,
2015,
1031,
1014,
1033,
1027,
1011,
2531,
1025,
8909,
2015,
1031,
30524,
1033,
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-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java | StateDescriptor.setQueryable | public void setQueryable(String queryableStateName) {
Preconditions.checkArgument(
ttlConfig.getUpdateType() == StateTtlConfig.UpdateType.Disabled,
"Queryable state is currently not supported with TTL");
if (this.queryableStateName == null) {
this.queryableStateName = Preconditions.checkNotNull(queryableStateName, "Registration name");
} else {
throw new IllegalStateException("Queryable state name already set");
}
} | java | public void setQueryable(String queryableStateName) {
Preconditions.checkArgument(
ttlConfig.getUpdateType() == StateTtlConfig.UpdateType.Disabled,
"Queryable state is currently not supported with TTL");
if (this.queryableStateName == null) {
this.queryableStateName = Preconditions.checkNotNull(queryableStateName, "Registration name");
} else {
throw new IllegalStateException("Queryable state name already set");
}
} | [
"public",
"void",
"setQueryable",
"(",
"String",
"queryableStateName",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"ttlConfig",
".",
"getUpdateType",
"(",
")",
"==",
"StateTtlConfig",
".",
"UpdateType",
".",
"Disabled",
",",
"\"Queryable state is currently n... | Sets the name for queries of state created from this descriptor.
<p>If a name is set, the created state will be published for queries
during runtime. The name needs to be unique per job. If there is another
state instance published under the same name, the job will fail during runtime.
@param queryableStateName State name for queries (unique name per job)
@throws IllegalStateException If queryable state name already set | [
"Sets",
"the",
"name",
"for",
"queries",
"of",
"state",
"created",
"from",
"this",
"descriptor",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/state/StateDescriptor.java#L211-L220 | train | Sets the queryable state name. | [
30522,
2270,
11675,
2275,
4226,
20444,
3468,
1006,
5164,
23032,
3085,
9153,
6528,
14074,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
23746,
22499,
2078,
8873,
2290,
1012,
2131,
6279,
13701,
13874,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/document/sentence/Sentence.java | Sentence.create | public static Sentence create(String param)
{
if (param == null)
{
return null;
}
param = param.trim();
if (param.isEmpty())
{
return null;
}
Pattern pattern = Pattern.compile("(\\[(([^\\s]+/[0-9a-zA-Z]+)\\s+)+?([^\\s]+/[0-9a-zA-Z]+)]/?[0-9a-zA-Z]+)|([^\\s]+/[0-9a-zA-Z]+)");
Matcher matcher = pattern.matcher(param);
List<IWord> wordList = new LinkedList<IWord>();
while (matcher.find())
{
String single = matcher.group();
IWord word = WordFactory.create(single);
if (word == null)
{
logger.warning("在用 " + single + " 构造单词时失败,句子构造参数为 " + param);
return null;
}
wordList.add(word);
}
if (wordList.isEmpty()) // 按照无词性来解析
{
for (String w : param.split("\\s+"))
{
wordList.add(new Word(w, null));
}
}
return new Sentence(wordList);
} | java | public static Sentence create(String param)
{
if (param == null)
{
return null;
}
param = param.trim();
if (param.isEmpty())
{
return null;
}
Pattern pattern = Pattern.compile("(\\[(([^\\s]+/[0-9a-zA-Z]+)\\s+)+?([^\\s]+/[0-9a-zA-Z]+)]/?[0-9a-zA-Z]+)|([^\\s]+/[0-9a-zA-Z]+)");
Matcher matcher = pattern.matcher(param);
List<IWord> wordList = new LinkedList<IWord>();
while (matcher.find())
{
String single = matcher.group();
IWord word = WordFactory.create(single);
if (word == null)
{
logger.warning("在用 " + single + " 构造单词时失败,句子构造参数为 " + param);
return null;
}
wordList.add(word);
}
if (wordList.isEmpty()) // 按照无词性来解析
{
for (String w : param.split("\\s+"))
{
wordList.add(new Word(w, null));
}
}
return new Sentence(wordList);
} | [
"public",
"static",
"Sentence",
"create",
"(",
"String",
"param",
")",
"{",
"if",
"(",
"param",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"param",
"=",
"param",
".",
"trim",
"(",
")",
";",
"if",
"(",
"param",
".",
"isEmpty",
"(",
")",
"... | 以人民日报2014语料格式的字符串创建一个结构化句子
@param param
@return | [
"以人民日报2014语料格式的字符串创建一个结构化句子"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/document/sentence/Sentence.java#L213-L247 | train | Create a Sentence object from a String | [
30522,
2270,
10763,
6251,
3443,
1006,
5164,
11498,
2213,
1007,
1063,
2065,
1006,
11498,
2213,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
11498,
2213,
1027,
11498,
2213,
1012,
12241,
1006,
1007,
1025,
2065,
1006,
11498,
2213,
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/net/SSLUtils.java | SSLUtils.createRestServerSSLEngineFactory | public static SSLHandlerFactory createRestServerSSLEngineFactory(final Configuration config) throws Exception {
SSLContext sslContext = createRestServerSSLContext(config);
if (sslContext == null) {
throw new IllegalConfigurationException("SSL is not enabled for REST endpoints.");
}
return new SSLHandlerFactory(
sslContext,
getEnabledProtocols(config),
getEnabledCipherSuites(config),
false,
isRestSSLAuthenticationEnabled(config),
-1,
-1);
} | java | public static SSLHandlerFactory createRestServerSSLEngineFactory(final Configuration config) throws Exception {
SSLContext sslContext = createRestServerSSLContext(config);
if (sslContext == null) {
throw new IllegalConfigurationException("SSL is not enabled for REST endpoints.");
}
return new SSLHandlerFactory(
sslContext,
getEnabledProtocols(config),
getEnabledCipherSuites(config),
false,
isRestSSLAuthenticationEnabled(config),
-1,
-1);
} | [
"public",
"static",
"SSLHandlerFactory",
"createRestServerSSLEngineFactory",
"(",
"final",
"Configuration",
"config",
")",
"throws",
"Exception",
"{",
"SSLContext",
"sslContext",
"=",
"createRestServerSSLContext",
"(",
"config",
")",
";",
"if",
"(",
"sslContext",
"==",
... | Creates a {@link SSLHandlerFactory} to be used by the REST Servers.
@param config The application configuration. | [
"Creates",
"a",
"{",
"@link",
"SSLHandlerFactory",
"}",
"to",
"be",
"used",
"by",
"the",
"REST",
"Servers",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java#L153-L167 | train | Create a SSLHandlerFactory for REST endpoints. | [
30522,
2270,
10763,
7020,
2140,
11774,
3917,
21450,
3443,
28533,
8043,
14028,
25016,
3070,
3170,
21450,
1006,
2345,
9563,
9530,
8873,
2290,
1007,
11618,
6453,
1063,
7020,
22499,
10111,
18413,
7020,
22499,
10111,
18413,
1027,
3443,
28533,
8043... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/SQLOperation.java | SQLOperation.getConfigForOperation | private HiveConf getConfigForOperation() throws HiveSQLException {
HiveConf sqlOperationConf = getParentSession().getHiveConf();
if (!getConfOverlay().isEmpty() || shouldRunAsync()) {
// clone the parent session config for this query
sqlOperationConf = new HiveConf(sqlOperationConf);
// apply overlay query specific settings, if any
for (Map.Entry<String, String> confEntry : getConfOverlay().entrySet()) {
try {
sqlOperationConf.verifyAndSet(confEntry.getKey(), confEntry.getValue());
} catch (IllegalArgumentException e) {
throw new HiveSQLException("Error applying statement specific settings", e);
}
}
}
return sqlOperationConf;
} | java | private HiveConf getConfigForOperation() throws HiveSQLException {
HiveConf sqlOperationConf = getParentSession().getHiveConf();
if (!getConfOverlay().isEmpty() || shouldRunAsync()) {
// clone the parent session config for this query
sqlOperationConf = new HiveConf(sqlOperationConf);
// apply overlay query specific settings, if any
for (Map.Entry<String, String> confEntry : getConfOverlay().entrySet()) {
try {
sqlOperationConf.verifyAndSet(confEntry.getKey(), confEntry.getValue());
} catch (IllegalArgumentException e) {
throw new HiveSQLException("Error applying statement specific settings", e);
}
}
}
return sqlOperationConf;
} | [
"private",
"HiveConf",
"getConfigForOperation",
"(",
")",
"throws",
"HiveSQLException",
"{",
"HiveConf",
"sqlOperationConf",
"=",
"getParentSession",
"(",
")",
".",
"getHiveConf",
"(",
")",
";",
"if",
"(",
"!",
"getConfOverlay",
"(",
")",
".",
"isEmpty",
"(",
... | If there are query specific settings to overlay, then create a copy of config
There are two cases we need to clone the session config that's being passed to hive driver
1. Async query -
If the client changes a config setting, that shouldn't reflect in the execution already underway
2. confOverlay -
The query specific settings should only be applied to the query config and not session
@return new configuration
@throws HiveSQLException | [
"If",
"there",
"are",
"query",
"specific",
"settings",
"to",
"overlay",
"then",
"create",
"a",
"copy",
"of",
"config",
"There",
"are",
"two",
"cases",
"we",
"need",
"to",
"clone",
"the",
"session",
"config",
"that",
"s",
"being",
"passed",
"to",
"hive",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/SQLOperation.java#L443-L459 | train | Get the config for this operation. | [
30522,
2797,
26736,
8663,
2546,
2131,
8663,
8873,
25708,
14604,
29487,
1006,
1007,
30524,
2065,
1006,
999,
2131,
8663,
14876,
6299,
8485,
1006,
1007,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1064,
1064,
2323,
26605,
6508,
12273,
1006,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/SortedGrouping.java | SortedGrouping.combineGroup | public <R> GroupCombineOperator<T, R> combineGroup(GroupCombineFunction<T, R> combiner) {
if (combiner == null) {
throw new NullPointerException("GroupCombine function must not be null.");
}
TypeInformation<R> resultType = TypeExtractor.getGroupCombineReturnTypes(combiner,
this.getInputDataSet().getType(), Utils.getCallLocationName(), true);
return new GroupCombineOperator<>(this, resultType, inputDataSet.clean(combiner), Utils.getCallLocationName());
} | java | public <R> GroupCombineOperator<T, R> combineGroup(GroupCombineFunction<T, R> combiner) {
if (combiner == null) {
throw new NullPointerException("GroupCombine function must not be null.");
}
TypeInformation<R> resultType = TypeExtractor.getGroupCombineReturnTypes(combiner,
this.getInputDataSet().getType(), Utils.getCallLocationName(), true);
return new GroupCombineOperator<>(this, resultType, inputDataSet.clean(combiner), Utils.getCallLocationName());
} | [
"public",
"<",
"R",
">",
"GroupCombineOperator",
"<",
"T",
",",
"R",
">",
"combineGroup",
"(",
"GroupCombineFunction",
"<",
"T",
",",
"R",
">",
"combiner",
")",
"{",
"if",
"(",
"combiner",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"... | Applies a GroupCombineFunction on a grouped {@link DataSet}.
A CombineFunction is similar to a GroupReduceFunction but does not perform a full data exchange. Instead, the
CombineFunction calls the combine method once per partition for combining a group of results. This
operator is suitable for combining values into an intermediate format before doing a proper groupReduce where
the data is shuffled across the node for further reduction. The GroupReduce operator can also be supplied with
a combiner by implementing the RichGroupReduce function. The combine method of the RichGroupReduce function
demands input and output type to be the same. The CombineFunction, on the other side, can have an arbitrary
output type.
@param combiner The GroupCombineFunction that is applied on the DataSet.
@return A GroupCombineOperator which represents the combined DataSet. | [
"Applies",
"a",
"GroupCombineFunction",
"on",
"a",
"grouped",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/SortedGrouping.java#L190-L198 | train | Combine the input data set with the given combiner function. | [
30522,
2270,
1026,
1054,
1028,
2177,
18274,
3170,
25918,
8844,
1026,
1056,
1010,
1054,
1028,
11506,
17058,
1006,
2177,
18274,
3170,
11263,
27989,
1026,
1056,
1010,
1054,
1028,
11506,
2099,
1007,
1063,
2065,
1006,
11506,
2099,
1027,
1027,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/nio/AbstractNioByteChannel.java | AbstractNioByteChannel.doWrite0 | protected final int doWrite0(ChannelOutboundBuffer in) throws Exception {
Object msg = in.current();
if (msg == null) {
// Directly return here so incompleteWrite(...) is not called.
return 0;
}
return doWriteInternal(in, in.current());
} | java | protected final int doWrite0(ChannelOutboundBuffer in) throws Exception {
Object msg = in.current();
if (msg == null) {
// Directly return here so incompleteWrite(...) is not called.
return 0;
}
return doWriteInternal(in, in.current());
} | [
"protected",
"final",
"int",
"doWrite0",
"(",
"ChannelOutboundBuffer",
"in",
")",
"throws",
"Exception",
"{",
"Object",
"msg",
"=",
"in",
".",
"current",
"(",
")",
";",
"if",
"(",
"msg",
"==",
"null",
")",
"{",
"// Directly return here so incompleteWrite(...) is... | Write objects to the OS.
@param in the collection which contains objects to write.
@return The value that should be decremented from the write quantum which starts at
{@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows:
<ul>
<li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content)
is encountered</li>
<li>1 - if a single call to write data was made to the OS</li>
<li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but no
data was accepted</li>
</ul>
@throws Exception if an I/O exception occurs during write. | [
"Write",
"objects",
"to",
"the",
"OS",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/nio/AbstractNioByteChannel.java#L203-L210 | train | Write a single record to the channel. | [
30522,
5123,
2345,
20014,
23268,
17625,
2692,
1006,
3149,
5833,
15494,
8569,
12494,
1999,
1007,
11618,
6453,
1063,
4874,
5796,
2290,
1027,
1999,
1012,
2783,
1006,
1007,
1025,
2065,
1006,
5796,
2290,
1027,
1027,
19701,
1007,
1063,
1013,
1013... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/typeutils/base/BigDecSerializer.java | BigDecSerializer.readBigDecimal | public static BigDecimal readBigDecimal(DataInputView source) throws IOException {
final BigInteger unscaledValue = BigIntSerializer.readBigInteger(source);
if (unscaledValue == null) {
return null;
}
final int scale = source.readInt();
// fast-path for 0, 1, 10
if (scale == 0) {
if (unscaledValue == BigInteger.ZERO) {
return BigDecimal.ZERO;
}
else if (unscaledValue == BigInteger.ONE) {
return BigDecimal.ONE;
}
else if (unscaledValue == BigInteger.TEN) {
return BigDecimal.TEN;
}
}
// default
return new BigDecimal(unscaledValue, scale);
} | java | public static BigDecimal readBigDecimal(DataInputView source) throws IOException {
final BigInteger unscaledValue = BigIntSerializer.readBigInteger(source);
if (unscaledValue == null) {
return null;
}
final int scale = source.readInt();
// fast-path for 0, 1, 10
if (scale == 0) {
if (unscaledValue == BigInteger.ZERO) {
return BigDecimal.ZERO;
}
else if (unscaledValue == BigInteger.ONE) {
return BigDecimal.ONE;
}
else if (unscaledValue == BigInteger.TEN) {
return BigDecimal.TEN;
}
}
// default
return new BigDecimal(unscaledValue, scale);
} | [
"public",
"static",
"BigDecimal",
"readBigDecimal",
"(",
"DataInputView",
"source",
")",
"throws",
"IOException",
"{",
"final",
"BigInteger",
"unscaledValue",
"=",
"BigIntSerializer",
".",
"readBigInteger",
"(",
"source",
")",
";",
"if",
"(",
"unscaledValue",
"==",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/base/BigDecSerializer.java#L117-L137 | train | Reads a BigDecimal from the given DataInputView. | [
30522,
2270,
10763,
2502,
3207,
6895,
9067,
3191,
5638,
2290,
3207,
6895,
9067,
1006,
2951,
2378,
18780,
8584,
3120,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
2502,
18447,
26320,
4895,
15782,
3709,
10175,
5657,
1027,
2502,
18447,
8043,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/relational/WebLogAnalysis.java | WebLogAnalysis.main | public static void main(String[] args) throws Exception {
final ParameterTool params = ParameterTool.fromArgs(args);
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
env.getConfig().setGlobalJobParameters(params);
// get input data
DataSet<Tuple2<String, String>> documents = getDocumentsDataSet(env, params);
DataSet<Tuple3<Integer, String, Integer>> ranks = getRanksDataSet(env, params);
DataSet<Tuple2<String, String>> visits = getVisitsDataSet(env, params);
// Retain documents with keywords
DataSet<Tuple1<String>> filterDocs = documents
.filter(new FilterDocByKeyWords())
.project(0);
// Filter ranks by minimum rank
DataSet<Tuple3<Integer, String, Integer>> filterRanks = ranks
.filter(new FilterByRank());
// Filter visits by visit date
DataSet<Tuple1<String>> filterVisits = visits
.filter(new FilterVisitsByDate())
.project(0);
// Join the filtered documents and ranks, i.e., get all URLs with min rank and keywords
DataSet<Tuple3<Integer, String, Integer>> joinDocsRanks =
filterDocs.join(filterRanks)
.where(0).equalTo(1)
.projectSecond(0, 1, 2);
// Anti-join urls with visits, i.e., retain all URLs which have NOT been visited in a certain time
DataSet<Tuple3<Integer, String, Integer>> result =
joinDocsRanks.coGroup(filterVisits)
.where(1).equalTo(0)
.with(new AntiJoinVisits());
// emit result
if (params.has("output")) {
result.writeAsCsv(params.get("output"), "\n", "|");
// execute program
env.execute("WebLogAnalysis Example");
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
result.print();
}
} | java | public static void main(String[] args) throws Exception {
final ParameterTool params = ParameterTool.fromArgs(args);
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
env.getConfig().setGlobalJobParameters(params);
// get input data
DataSet<Tuple2<String, String>> documents = getDocumentsDataSet(env, params);
DataSet<Tuple3<Integer, String, Integer>> ranks = getRanksDataSet(env, params);
DataSet<Tuple2<String, String>> visits = getVisitsDataSet(env, params);
// Retain documents with keywords
DataSet<Tuple1<String>> filterDocs = documents
.filter(new FilterDocByKeyWords())
.project(0);
// Filter ranks by minimum rank
DataSet<Tuple3<Integer, String, Integer>> filterRanks = ranks
.filter(new FilterByRank());
// Filter visits by visit date
DataSet<Tuple1<String>> filterVisits = visits
.filter(new FilterVisitsByDate())
.project(0);
// Join the filtered documents and ranks, i.e., get all URLs with min rank and keywords
DataSet<Tuple3<Integer, String, Integer>> joinDocsRanks =
filterDocs.join(filterRanks)
.where(0).equalTo(1)
.projectSecond(0, 1, 2);
// Anti-join urls with visits, i.e., retain all URLs which have NOT been visited in a certain time
DataSet<Tuple3<Integer, String, Integer>> result =
joinDocsRanks.coGroup(filterVisits)
.where(1).equalTo(0)
.with(new AntiJoinVisits());
// emit result
if (params.has("output")) {
result.writeAsCsv(params.get("output"), "\n", "|");
// execute program
env.execute("WebLogAnalysis Example");
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
result.print();
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"final",
"ParameterTool",
"params",
"=",
"ParameterTool",
".",
"fromArgs",
"(",
"args",
")",
";",
"final",
"ExecutionEnvironment",
"env",
"=",
"ExecutionEnvir... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/relational/WebLogAnalysis.java#L96-L144 | train | Main method to run the WebLogAnalysis example. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
2345,
16381,
3406,
4747,
11498,
5244,
1027,
16381,
3406,
4747,
1012,
2013,
2906,
5620,
1006,
12098,
5620,
1007,
1025,
2345,
7781,
2368,
21663,
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/dictionary/CommonSuffixExtractor.java | CommonSuffixExtractor.extractSuffixByWords | public List<String> extractSuffixByWords(int length, int size, boolean extend)
{
TFDictionary suffixTreeSet = new TFDictionary();
for (String key : tfDictionary.keySet())
{
List<Term> termList = StandardTokenizer.segment(key);
if (termList.size() > length)
{
suffixTreeSet.add(combine(termList.subList(termList.size() - length, termList.size())));
if (extend)
{
for (int l = 1; l < length; ++l)
{
suffixTreeSet.add(combine(termList.subList(termList.size() - l, termList.size())));
}
}
}
}
return extract(suffixTreeSet, size);
} | java | public List<String> extractSuffixByWords(int length, int size, boolean extend)
{
TFDictionary suffixTreeSet = new TFDictionary();
for (String key : tfDictionary.keySet())
{
List<Term> termList = StandardTokenizer.segment(key);
if (termList.size() > length)
{
suffixTreeSet.add(combine(termList.subList(termList.size() - length, termList.size())));
if (extend)
{
for (int l = 1; l < length; ++l)
{
suffixTreeSet.add(combine(termList.subList(termList.size() - l, termList.size())));
}
}
}
}
return extract(suffixTreeSet, size);
} | [
"public",
"List",
"<",
"String",
">",
"extractSuffixByWords",
"(",
"int",
"length",
",",
"int",
"size",
",",
"boolean",
"extend",
")",
"{",
"TFDictionary",
"suffixTreeSet",
"=",
"new",
"TFDictionary",
"(",
")",
";",
"for",
"(",
"String",
"key",
":",
"tfDic... | 此方法认为后缀一定是整个的词语,所以length是以词语为单位的
@param length
@param size
@param extend
@return | [
"此方法认为后缀一定是整个的词语,所以length是以词语为单位的"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/CommonSuffixExtractor.java#L99-L119 | train | Extract suffix by words. | [
30522,
2270,
2862,
1026,
5164,
1028,
27059,
16093,
8873,
2595,
3762,
22104,
1006,
20014,
3091,
1010,
20014,
2946,
1010,
22017,
20898,
7949,
1007,
1063,
30524,
1028,
2744,
9863,
1027,
3115,
18715,
18595,
6290,
1012,
6903,
1006,
3145,
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... |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoop.java | EpollEventLoop.handleLoopException | void handleLoopException(Throwable t) {
logger.warn("Unexpected exception in the selector loop.", t);
// Prevent possible consecutive immediate failures that lead to
// excessive CPU consumption.
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore.
}
} | java | void handleLoopException(Throwable t) {
logger.warn("Unexpected exception in the selector loop.", t);
// Prevent possible consecutive immediate failures that lead to
// excessive CPU consumption.
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Ignore.
}
} | [
"void",
"handleLoopException",
"(",
"Throwable",
"t",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Unexpected exception in the selector loop.\"",
",",
"t",
")",
";",
"// Prevent possible consecutive immediate failures that lead to",
"// excessive CPU consumption.",
"try",
"{",
"T... | Visible only for testing! | [
"Visible",
"only",
"for",
"testing!"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoop.java#L365-L375 | train | Handle an exception in the selector loop. | [
30522,
11675,
5047,
4135,
17635,
2595,
24422,
1006,
5466,
3085,
1056,
1007,
1063,
8833,
4590,
1012,
11582,
1006,
1000,
9223,
6453,
1999,
1996,
27000,
7077,
1012,
1000,
1010,
1056,
1007,
1025,
1013,
1013,
4652,
2825,
5486,
6234,
15428,
2008,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SharedBuffer.java | SharedBuffer.upsertEntry | void upsertEntry(NodeId nodeId, Lockable<SharedBufferNode> entry) {
this.entryCache.put(nodeId, entry);
} | java | void upsertEntry(NodeId nodeId, Lockable<SharedBufferNode> entry) {
this.entryCache.put(nodeId, entry);
} | [
"void",
"upsertEntry",
"(",
"NodeId",
"nodeId",
",",
"Lockable",
"<",
"SharedBufferNode",
">",
"entry",
")",
"{",
"this",
".",
"entryCache",
".",
"put",
"(",
"nodeId",
",",
"entry",
")",
";",
"}"
] | Inserts or updates a shareBufferNode in cache.
@param nodeId id of the event
@param entry SharedBufferNode | [
"Inserts",
"or",
"updates",
"a",
"shareBufferNode",
"in",
"cache",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBuffer.java#L172-L174 | train | Upsert a shared buffer entry in the cache. | [
30522,
11675,
11139,
8743,
4765,
2854,
1006,
13045,
3593,
13045,
3593,
1010,
5843,
3085,
1026,
4207,
8569,
12494,
3630,
3207,
1028,
4443,
1007,
1063,
2023,
1012,
4443,
3540,
5403,
1012,
2404,
1006,
13045,
3593,
1010,
4443,
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-core/src/main/java/cn/hutool/core/text/csv/CsvWriter.java | CsvWriter.write | public CsvWriter write(String[]... lines) throws IORuntimeException {
if (ArrayUtil.isNotEmpty(lines)) {
for (final String[] values : lines) {
appendLine(values);
}
flush();
}
return this;
} | java | public CsvWriter write(String[]... lines) throws IORuntimeException {
if (ArrayUtil.isNotEmpty(lines)) {
for (final String[] values : lines) {
appendLine(values);
}
flush();
}
return this;
} | [
"public",
"CsvWriter",
"write",
"(",
"String",
"[",
"]",
"...",
"lines",
")",
"throws",
"IORuntimeException",
"{",
"if",
"(",
"ArrayUtil",
".",
"isNotEmpty",
"(",
"lines",
")",
")",
"{",
"for",
"(",
"final",
"String",
"[",
"]",
"values",
":",
"lines",
... | 将多行写出到Writer
@param lines 多行数据
@return this
@throws IORuntimeException IO异常 | [
"将多行写出到Writer"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvWriter.java#L171-L179 | train | Write a sequence of lines to the writer. | [
30522,
2270,
20116,
2615,
15994,
4339,
1006,
5164,
1031,
1033,
1012,
1012,
1012,
3210,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2065,
1006,
9140,
21823,
2140,
1012,
3475,
12184,
27718,
2100,
1006,
3210,
1007,
1007,
1063,
2005,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogDecoder.java | LogDecoder.decode | public LogEvent decode(LogBuffer buffer, LogContext context) throws IOException {
final int limit = buffer.limit();
if (limit >= FormatDescriptionLogEvent.LOG_EVENT_HEADER_LEN) {
LogHeader header = new LogHeader(buffer, context.getFormatDescription());
final int len = header.getEventLen();
if (limit >= len) {
LogEvent event;
/* Checking binary-log's header */
if (handleSet.get(header.getType())) {
buffer.limit(len);
try {
/* Decoding binary-log to event */
event = decode(buffer, header, context);
} catch (IOException e) {
if (logger.isWarnEnabled()) {
logger.warn("Decoding " + LogEvent.getTypeName(header.getType()) + " failed from: "
+ context.getLogPosition(), e);
}
throw e;
} finally {
buffer.limit(limit); /* Restore limit */
}
} else {
/* Ignore unsupported binary-log. */
event = new UnknownLogEvent(header);
}
if (event != null) {
// set logFileName
event.getHeader().setLogFileName(context.getLogPosition().getFileName());
event.setSemival(buffer.semival);
}
/* consume this binary-log. */
buffer.consume(len);
return event;
}
}
/* Rewind buffer's position to 0. */
buffer.rewind();
return null;
} | java | public LogEvent decode(LogBuffer buffer, LogContext context) throws IOException {
final int limit = buffer.limit();
if (limit >= FormatDescriptionLogEvent.LOG_EVENT_HEADER_LEN) {
LogHeader header = new LogHeader(buffer, context.getFormatDescription());
final int len = header.getEventLen();
if (limit >= len) {
LogEvent event;
/* Checking binary-log's header */
if (handleSet.get(header.getType())) {
buffer.limit(len);
try {
/* Decoding binary-log to event */
event = decode(buffer, header, context);
} catch (IOException e) {
if (logger.isWarnEnabled()) {
logger.warn("Decoding " + LogEvent.getTypeName(header.getType()) + " failed from: "
+ context.getLogPosition(), e);
}
throw e;
} finally {
buffer.limit(limit); /* Restore limit */
}
} else {
/* Ignore unsupported binary-log. */
event = new UnknownLogEvent(header);
}
if (event != null) {
// set logFileName
event.getHeader().setLogFileName(context.getLogPosition().getFileName());
event.setSemival(buffer.semival);
}
/* consume this binary-log. */
buffer.consume(len);
return event;
}
}
/* Rewind buffer's position to 0. */
buffer.rewind();
return null;
} | [
"public",
"LogEvent",
"decode",
"(",
"LogBuffer",
"buffer",
",",
"LogContext",
"context",
")",
"throws",
"IOException",
"{",
"final",
"int",
"limit",
"=",
"buffer",
".",
"limit",
"(",
")",
";",
"if",
"(",
"limit",
">=",
"FormatDescriptionLogEvent",
".",
"LOG... | Decoding an event from binary-log buffer.
@return <code>UknownLogEvent</code> if event type is unknown or skipped,
<code>null</code> if buffer is not including a full event. | [
"Decoding",
"an",
"event",
"from",
"binary",
"-",
"log",
"buffer",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogDecoder.java#L96-L141 | train | Decodes a binary - log. | [
30522,
2270,
8833,
18697,
3372,
21933,
3207,
1006,
8833,
8569,
12494,
17698,
1010,
8833,
8663,
18209,
6123,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
20014,
5787,
1027,
17698,
1012,
5787,
1006,
1007,
1025,
2065,
1006,
5787,
1028,
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/taskexecutor/TaskExecutor.java | TaskExecutor.triggerCheckpoint | @Override
public CompletableFuture<Acknowledge> triggerCheckpoint(
ExecutionAttemptID executionAttemptID,
long checkpointId,
long checkpointTimestamp,
CheckpointOptions checkpointOptions,
boolean advanceToEndOfEventTime) {
log.debug("Trigger checkpoint {}@{} for {}.", checkpointId, checkpointTimestamp, executionAttemptID);
final CheckpointType checkpointType = checkpointOptions.getCheckpointType();
if (advanceToEndOfEventTime && !(checkpointType.isSynchronous() && checkpointType.isSavepoint())) {
throw new IllegalArgumentException("Only synchronous savepoints are allowed to advance the watermark to MAX.");
}
final Task task = taskSlotTable.getTask(executionAttemptID);
if (task != null) {
task.triggerCheckpointBarrier(checkpointId, checkpointTimestamp, checkpointOptions, advanceToEndOfEventTime);
return CompletableFuture.completedFuture(Acknowledge.get());
} else {
final String message = "TaskManager received a checkpoint request for unknown task " + executionAttemptID + '.';
log.debug(message);
return FutureUtils.completedExceptionally(new CheckpointException(message));
}
} | java | @Override
public CompletableFuture<Acknowledge> triggerCheckpoint(
ExecutionAttemptID executionAttemptID,
long checkpointId,
long checkpointTimestamp,
CheckpointOptions checkpointOptions,
boolean advanceToEndOfEventTime) {
log.debug("Trigger checkpoint {}@{} for {}.", checkpointId, checkpointTimestamp, executionAttemptID);
final CheckpointType checkpointType = checkpointOptions.getCheckpointType();
if (advanceToEndOfEventTime && !(checkpointType.isSynchronous() && checkpointType.isSavepoint())) {
throw new IllegalArgumentException("Only synchronous savepoints are allowed to advance the watermark to MAX.");
}
final Task task = taskSlotTable.getTask(executionAttemptID);
if (task != null) {
task.triggerCheckpointBarrier(checkpointId, checkpointTimestamp, checkpointOptions, advanceToEndOfEventTime);
return CompletableFuture.completedFuture(Acknowledge.get());
} else {
final String message = "TaskManager received a checkpoint request for unknown task " + executionAttemptID + '.';
log.debug(message);
return FutureUtils.completedExceptionally(new CheckpointException(message));
}
} | [
"@",
"Override",
"public",
"CompletableFuture",
"<",
"Acknowledge",
">",
"triggerCheckpoint",
"(",
"ExecutionAttemptID",
"executionAttemptID",
",",
"long",
"checkpointId",
",",
"long",
"checkpointTimestamp",
",",
"CheckpointOptions",
"checkpointOptions",
",",
"boolean",
"... | ---------------------------------------------------------------------- | [
"----------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java#L682-L708 | train | Trigger a checkpoint. | [
30522,
1030,
2058,
15637,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
13399,
1028,
9495,
5403,
3600,
8400,
1006,
7781,
19321,
6633,
13876,
3593,
7781,
19321,
6633,
13876,
3593,
1010,
2146,
26520,
3593,
1010,
2146,
26520,
7292,
9153,
8737,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.add_document | void add_document(Document doc)
{
doc.feature().normalize();
documents_.add(doc);
composite_.add_vector(doc.feature());
} | java | void add_document(Document doc)
{
doc.feature().normalize();
documents_.add(doc);
composite_.add_vector(doc.feature());
} | [
"void",
"add_document",
"(",
"Document",
"doc",
")",
"{",
"doc",
".",
"feature",
"(",
")",
".",
"normalize",
"(",
")",
";",
"documents_",
".",
"add",
"(",
"doc",
")",
";",
"composite_",
".",
"add_vector",
"(",
"doc",
".",
"feature",
"(",
")",
")",
... | Add a document.
@param doc the pointer of a document object | [
"Add",
"a",
"document",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/Cluster.java#L115-L120 | train | Adds a document to the document set. | [
30522,
11675,
5587,
1035,
6254,
1006,
6254,
9986,
1007,
1063,
9986,
1012,
3444,
1006,
1007,
1012,
3671,
4697,
1006,
1007,
1025,
5491,
1035,
1012,
5587,
1006,
9986,
1007,
1025,
12490,
1035,
1012,
5587,
1035,
9207,
1006,
9986,
1012,
3444,
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/util/ZipUtil.java | ZipUtil.zlib | public static byte[] zlib(String content, String charset, int level) {
return zlib(StrUtil.bytes(content, charset), level);
} | java | public static byte[] zlib(String content, String charset, int level) {
return zlib(StrUtil.bytes(content, charset), level);
} | [
"public",
"static",
"byte",
"[",
"]",
"zlib",
"(",
"String",
"content",
",",
"String",
"charset",
",",
"int",
"level",
")",
"{",
"return",
"zlib",
"(",
"StrUtil",
".",
"bytes",
"(",
"content",
",",
"charset",
")",
",",
"level",
")",
";",
"}"
] | Zlib压缩处理
@param content 被压缩的字符串
@param charset 编码
@param level 压缩级别,1~9
@return 压缩后的字节流
@since 4.1.4 | [
"Zlib压缩处理"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L629-L631 | train | Zlib - compress a string. | [
30522,
2270,
10763,
24880,
1031,
1033,
1062,
29521,
1006,
5164,
4180,
1010,
5164,
25869,
13462,
1010,
20014,
2504,
1007,
1063,
2709,
1062,
29521,
1006,
2358,
22134,
4014,
1012,
27507,
1006,
4180,
1010,
25869,
13462,
1007,
1010,
2504,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readString | public static String readString(File file, Charset charset) throws IORuntimeException {
return FileReader.create(file, charset).readString();
} | java | public static String readString(File file, Charset charset) throws IORuntimeException {
return FileReader.create(file, charset).readString();
} | [
"public",
"static",
"String",
"readString",
"(",
"File",
"file",
",",
"Charset",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileReader",
".",
"create",
"(",
"file",
",",
"charset",
")",
".",
"readString",
"(",
")",
";",
"}"
] | 读取文件内容
@param file 文件
@param charset 字符集
@return 内容
@throws IORuntimeException IO异常 | [
"读取文件内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2102-L2104 | train | Reads a string from a file. | [
30522,
2270,
10763,
5164,
9631,
18886,
3070,
1006,
5371,
5371,
1010,
25869,
13462,
25869,
13462,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
5371,
16416,
4063,
1012,
3443,
1006,
5371,
1010,
25869,
13462,
1007,
1012,
9631,
18886... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.sortByProperty | public static <T> List<T> sortByProperty(Collection<T> collection, String property) {
return sort(collection, new PropertyComparator<>(property));
} | java | public static <T> List<T> sortByProperty(Collection<T> collection, String property) {
return sort(collection, new PropertyComparator<>(property));
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"sortByProperty",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"String",
"property",
")",
"{",
"return",
"sort",
"(",
"collection",
",",
"new",
"PropertyComparator",
"<>",
"(",
"property",
... | 根据Bean的属性排序
@param <T> 元素类型
@param collection 集合,会被转换为List
@param property 属性名
@return 排序后的List
@since 4.0.6 | [
"根据Bean的属性排序"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2112-L2114 | train | Sort a collection of objects by a property. | [
30522,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
4066,
3762,
21572,
4842,
3723,
1006,
3074,
1026,
1056,
1028,
3074,
1010,
5164,
3200,
1007,
1063,
2709,
4066,
1006,
3074,
1010,
2047,
3200,
9006,
28689,
4263,
1026,
1028,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateGeneralWithChinese | public static <T extends CharSequence> T validateGeneralWithChinese(T value, String errorMsg) throws ValidateException {
if (false == isGeneralWithChinese(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validateGeneralWithChinese(T value, String errorMsg) throws ValidateException {
if (false == isGeneralWithChinese(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateGeneralWithChinese",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isGeneralWithChinese",
"(",
"value",
")",
")",
"{... | 验证是否为中文字、英文字母、数字和下划线
@param <T> 字符串类型
@param value 值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证是否为中文字、英文字母、数字和下划线"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L974-L979 | train | Validate a string with Chinese format. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
9398,
3686,
6914,
21673,
24415,
17231,
6810,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/web/servlet/console/DefaultProxyHtmlRenderer.java | DefaultProxyHtmlRenderer.tabBrowsers | private String tabBrowsers() {
StringBuilder builder = new StringBuilder();
builder.append("<div type='browsers' class='content_detail'>");
SlotsLines rcLines = new SlotsLines();
SlotsLines wdLines = new SlotsLines();
for (TestSlot slot : proxy.getTestSlots()) {
if (slot.getProtocol() == SeleniumProtocol.Selenium) {
rcLines.add(slot);
} else {
wdLines.add(slot);
}
}
if (rcLines.getLinesType().size() != 0) {
builder.append("<p class='protocol' >Remote Control (legacy)</p>");
builder.append(getLines(rcLines));
}
if (wdLines.getLinesType().size() != 0) {
builder.append("<p class='protocol' >WebDriver</p>");
builder.append(getLines(wdLines));
}
builder.append("</div>");
return builder.toString();
} | java | private String tabBrowsers() {
StringBuilder builder = new StringBuilder();
builder.append("<div type='browsers' class='content_detail'>");
SlotsLines rcLines = new SlotsLines();
SlotsLines wdLines = new SlotsLines();
for (TestSlot slot : proxy.getTestSlots()) {
if (slot.getProtocol() == SeleniumProtocol.Selenium) {
rcLines.add(slot);
} else {
wdLines.add(slot);
}
}
if (rcLines.getLinesType().size() != 0) {
builder.append("<p class='protocol' >Remote Control (legacy)</p>");
builder.append(getLines(rcLines));
}
if (wdLines.getLinesType().size() != 0) {
builder.append("<p class='protocol' >WebDriver</p>");
builder.append(getLines(wdLines));
}
builder.append("</div>");
return builder.toString();
} | [
"private",
"String",
"tabBrowsers",
"(",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"\"<div type='browsers' class='content_detail'>\"",
")",
";",
"SlotsLines",
"rcLines",
"=",
"new",
"SlotsLines",... | content of the browsers tab | [
"content",
"of",
"the",
"browsers",
"tab"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/web/servlet/console/DefaultProxyHtmlRenderer.java#L98-L123 | train | tabBrowsers - returns the browsers tab | [
30522,
2797,
5164,
21628,
12618,
9333,
2545,
1006,
1007,
1063,
5164,
8569,
23891,
2099,
12508,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
1007,
1025,
12508,
1012,
10439,
10497,
1006,
1000,
1026,
4487,
2615,
2828,
1027,
1005,
16602,
2015,
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-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java | SqlDateTimeUtils.unixTimestamp | public static long unixTimestamp(String dateStr, String format, TimeZone tz) {
long ts = parseToTimeMillis(dateStr, format, tz);
if (ts == Long.MIN_VALUE) {
return Long.MIN_VALUE;
} else {
// return the seconds
return ts / 1000;
}
} | java | public static long unixTimestamp(String dateStr, String format, TimeZone tz) {
long ts = parseToTimeMillis(dateStr, format, tz);
if (ts == Long.MIN_VALUE) {
return Long.MIN_VALUE;
} else {
// return the seconds
return ts / 1000;
}
} | [
"public",
"static",
"long",
"unixTimestamp",
"(",
"String",
"dateStr",
",",
"String",
"format",
",",
"TimeZone",
"tz",
")",
"{",
"long",
"ts",
"=",
"parseToTimeMillis",
"(",
"dateStr",
",",
"format",
",",
"tz",
")",
";",
"if",
"(",
"ts",
"==",
"Long",
... | Returns the value of the argument as an unsigned integer in seconds since
'1970-01-01 00:00:00' UTC. | [
"Returns",
"the",
"value",
"of",
"the",
"argument",
"as",
"an",
"unsigned",
"integer",
"in",
"seconds",
"since",
"1970",
"-",
"01",
"-",
"01",
"00",
":",
"00",
":",
"00",
"UTC",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L889-L897 | train | Returns the unix timestamp value of the given date string. | [
30522,
2270,
10763,
2146,
19998,
7292,
9153,
8737,
1006,
5164,
5246,
16344,
1010,
5164,
4289,
1010,
2051,
15975,
1056,
2480,
1007,
1063,
2146,
24529,
1027,
11968,
13462,
4140,
14428,
19912,
2483,
1006,
5246,
16344,
1010,
4289,
1010,
1056,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostStandardRequestDecoder.java | HttpPostStandardRequestDecoder.parseBodyAttributesStandard | private void parseBodyAttributesStandard() {
int firstpos = undecodedChunk.readerIndex();
int currentpos = firstpos;
int equalpos;
int ampersandpos;
if (currentStatus == MultiPartStatus.NOTSTARTED) {
currentStatus = MultiPartStatus.DISPOSITION;
}
boolean contRead = true;
try {
while (undecodedChunk.isReadable() && contRead) {
char read = (char) undecodedChunk.readUnsignedByte();
currentpos++;
switch (currentStatus) {
case DISPOSITION:// search '='
if (read == '=') {
currentStatus = MultiPartStatus.FIELD;
equalpos = currentpos - 1;
String key = decodeAttribute(undecodedChunk.toString(firstpos, equalpos - firstpos, charset),
charset);
currentAttribute = factory.createAttribute(request, key);
firstpos = currentpos;
} else if (read == '&') { // special empty FIELD
currentStatus = MultiPartStatus.DISPOSITION;
ampersandpos = currentpos - 1;
String key = decodeAttribute(
undecodedChunk.toString(firstpos, ampersandpos - firstpos, charset), charset);
currentAttribute = factory.createAttribute(request, key);
currentAttribute.setValue(""); // empty
addHttpData(currentAttribute);
currentAttribute = null;
firstpos = currentpos;
contRead = true;
}
break;
case FIELD:// search '&' or end of line
if (read == '&') {
currentStatus = MultiPartStatus.DISPOSITION;
ampersandpos = currentpos - 1;
setFinalBuffer(undecodedChunk.copy(firstpos, ampersandpos - firstpos));
firstpos = currentpos;
contRead = true;
} else if (read == HttpConstants.CR) {
if (undecodedChunk.isReadable()) {
read = (char) undecodedChunk.readUnsignedByte();
currentpos++;
if (read == HttpConstants.LF) {
currentStatus = MultiPartStatus.PREEPILOGUE;
ampersandpos = currentpos - 2;
setFinalBuffer(undecodedChunk.copy(firstpos, ampersandpos - firstpos));
firstpos = currentpos;
contRead = false;
} else {
// Error
throw new ErrorDataDecoderException("Bad end of line");
}
} else {
currentpos--;
}
} else if (read == HttpConstants.LF) {
currentStatus = MultiPartStatus.PREEPILOGUE;
ampersandpos = currentpos - 1;
setFinalBuffer(undecodedChunk.copy(firstpos, ampersandpos - firstpos));
firstpos = currentpos;
contRead = false;
}
break;
default:
// just stop
contRead = false;
}
}
if (isLastChunk && currentAttribute != null) {
// special case
ampersandpos = currentpos;
if (ampersandpos > firstpos) {
setFinalBuffer(undecodedChunk.copy(firstpos, ampersandpos - firstpos));
} else if (!currentAttribute.isCompleted()) {
setFinalBuffer(EMPTY_BUFFER);
}
firstpos = currentpos;
currentStatus = MultiPartStatus.EPILOGUE;
} else if (contRead && currentAttribute != null && currentStatus == MultiPartStatus.FIELD) {
// reset index except if to continue in case of FIELD getStatus
currentAttribute.addContent(undecodedChunk.copy(firstpos, currentpos - firstpos),
false);
firstpos = currentpos;
}
undecodedChunk.readerIndex(firstpos);
} catch (ErrorDataDecoderException e) {
// error while decoding
undecodedChunk.readerIndex(firstpos);
throw e;
} catch (IOException e) {
// error while decoding
undecodedChunk.readerIndex(firstpos);
throw new ErrorDataDecoderException(e);
}
} | java | private void parseBodyAttributesStandard() {
int firstpos = undecodedChunk.readerIndex();
int currentpos = firstpos;
int equalpos;
int ampersandpos;
if (currentStatus == MultiPartStatus.NOTSTARTED) {
currentStatus = MultiPartStatus.DISPOSITION;
}
boolean contRead = true;
try {
while (undecodedChunk.isReadable() && contRead) {
char read = (char) undecodedChunk.readUnsignedByte();
currentpos++;
switch (currentStatus) {
case DISPOSITION:// search '='
if (read == '=') {
currentStatus = MultiPartStatus.FIELD;
equalpos = currentpos - 1;
String key = decodeAttribute(undecodedChunk.toString(firstpos, equalpos - firstpos, charset),
charset);
currentAttribute = factory.createAttribute(request, key);
firstpos = currentpos;
} else if (read == '&') { // special empty FIELD
currentStatus = MultiPartStatus.DISPOSITION;
ampersandpos = currentpos - 1;
String key = decodeAttribute(
undecodedChunk.toString(firstpos, ampersandpos - firstpos, charset), charset);
currentAttribute = factory.createAttribute(request, key);
currentAttribute.setValue(""); // empty
addHttpData(currentAttribute);
currentAttribute = null;
firstpos = currentpos;
contRead = true;
}
break;
case FIELD:// search '&' or end of line
if (read == '&') {
currentStatus = MultiPartStatus.DISPOSITION;
ampersandpos = currentpos - 1;
setFinalBuffer(undecodedChunk.copy(firstpos, ampersandpos - firstpos));
firstpos = currentpos;
contRead = true;
} else if (read == HttpConstants.CR) {
if (undecodedChunk.isReadable()) {
read = (char) undecodedChunk.readUnsignedByte();
currentpos++;
if (read == HttpConstants.LF) {
currentStatus = MultiPartStatus.PREEPILOGUE;
ampersandpos = currentpos - 2;
setFinalBuffer(undecodedChunk.copy(firstpos, ampersandpos - firstpos));
firstpos = currentpos;
contRead = false;
} else {
// Error
throw new ErrorDataDecoderException("Bad end of line");
}
} else {
currentpos--;
}
} else if (read == HttpConstants.LF) {
currentStatus = MultiPartStatus.PREEPILOGUE;
ampersandpos = currentpos - 1;
setFinalBuffer(undecodedChunk.copy(firstpos, ampersandpos - firstpos));
firstpos = currentpos;
contRead = false;
}
break;
default:
// just stop
contRead = false;
}
}
if (isLastChunk && currentAttribute != null) {
// special case
ampersandpos = currentpos;
if (ampersandpos > firstpos) {
setFinalBuffer(undecodedChunk.copy(firstpos, ampersandpos - firstpos));
} else if (!currentAttribute.isCompleted()) {
setFinalBuffer(EMPTY_BUFFER);
}
firstpos = currentpos;
currentStatus = MultiPartStatus.EPILOGUE;
} else if (contRead && currentAttribute != null && currentStatus == MultiPartStatus.FIELD) {
// reset index except if to continue in case of FIELD getStatus
currentAttribute.addContent(undecodedChunk.copy(firstpos, currentpos - firstpos),
false);
firstpos = currentpos;
}
undecodedChunk.readerIndex(firstpos);
} catch (ErrorDataDecoderException e) {
// error while decoding
undecodedChunk.readerIndex(firstpos);
throw e;
} catch (IOException e) {
// error while decoding
undecodedChunk.readerIndex(firstpos);
throw new ErrorDataDecoderException(e);
}
} | [
"private",
"void",
"parseBodyAttributesStandard",
"(",
")",
"{",
"int",
"firstpos",
"=",
"undecodedChunk",
".",
"readerIndex",
"(",
")",
";",
"int",
"currentpos",
"=",
"firstpos",
";",
"int",
"equalpos",
";",
"int",
"ampersandpos",
";",
"if",
"(",
"currentStat... | This getMethod fill the map and list with as much Attribute as possible from
Body in not Multipart mode.
@throws ErrorDataDecoderException
if there is a problem with the charset decoding or other
errors | [
"This",
"getMethod",
"fill",
"the",
"map",
"and",
"list",
"with",
"as",
"much",
"Attribute",
"as",
"possible",
"from",
"Body",
"in",
"not",
"Multipart",
"mode",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostStandardRequestDecoder.java#L387-L485 | train | Parse the body attributes standard. | [
30522,
2797,
11675,
11968,
3366,
23684,
19321,
3089,
8569,
4570,
21515,
4232,
1006,
1007,
1063,
20014,
2034,
6873,
2015,
1027,
6151,
8586,
10244,
16409,
17157,
2243,
1012,
8068,
22254,
10288,
1006,
1007,
1025,
20014,
2783,
6873,
2015,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshotData.java | PojoSerializerSnapshotData.writeSnapshotData | void writeSnapshotData(DataOutputView out) throws IOException {
out.writeUTF(pojoClass.getName());
writeOptionalMap(out, fieldSerializerSnapshots, PojoFieldUtils::writeField, TypeSerializerSnapshot::writeVersionedSnapshot);
writeOptionalMap(out, registeredSubclassSerializerSnapshots, NoOpWriter.noopWriter(), TypeSerializerSnapshot::writeVersionedSnapshot);
writeOptionalMap(out, nonRegisteredSubclassSerializerSnapshots, NoOpWriter.noopWriter(), TypeSerializerSnapshot::writeVersionedSnapshot);
} | java | void writeSnapshotData(DataOutputView out) throws IOException {
out.writeUTF(pojoClass.getName());
writeOptionalMap(out, fieldSerializerSnapshots, PojoFieldUtils::writeField, TypeSerializerSnapshot::writeVersionedSnapshot);
writeOptionalMap(out, registeredSubclassSerializerSnapshots, NoOpWriter.noopWriter(), TypeSerializerSnapshot::writeVersionedSnapshot);
writeOptionalMap(out, nonRegisteredSubclassSerializerSnapshots, NoOpWriter.noopWriter(), TypeSerializerSnapshot::writeVersionedSnapshot);
} | [
"void",
"writeSnapshotData",
"(",
"DataOutputView",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"writeUTF",
"(",
"pojoClass",
".",
"getName",
"(",
")",
")",
";",
"writeOptionalMap",
"(",
"out",
",",
"fieldSerializerSnapshots",
",",
"PojoFieldUtils",
":... | --------------------------------------------------------------------------------------------- | [
"---------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshotData.java#L170-L175 | train | Writes the snapshot data. | [
30522,
11675,
7009,
2532,
4523,
12326,
2850,
2696,
1006,
2951,
5833,
18780,
8584,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
2041,
1012,
4339,
4904,
2546,
1006,
13433,
5558,
26266,
1012,
2131,
18442,
1006,
1007,
1007,
1025,
4339,
7361,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.