repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/NullableSerializer.java | NullableSerializer.checkIfNullSupported | public static <T> boolean checkIfNullSupported(@Nonnull TypeSerializer<T> serializer) {
int length = serializer.getLength() > 0 ? serializer.getLength() : 1;
DataOutputSerializer dos = new DataOutputSerializer(length);
try {
serializer.serialize(null, dos);
}
catch (IOException | RuntimeException e) {
return false;
}
checkArgument(
serializer.getLength() < 0 || serializer.getLength() == dos.getCopyOfBuffer().length,
"The serialized form of the null value should have the same length " +
"as any other if the length is fixed in the serializer");
DataInputDeserializer dis = new DataInputDeserializer(dos.getSharedBuffer());
try {
checkArgument(serializer.deserialize(dis) == null);
}
catch (IOException e) {
throw new RuntimeException(
String.format("Unexpected failure to deserialize just serialized null value with %s",
serializer.getClass().getName()), e);
}
checkArgument(
serializer.copy(null) == null,
"Serializer %s has to be able properly copy null value if it can serialize it",
serializer.getClass().getName());
return true;
} | java | public static <T> boolean checkIfNullSupported(@Nonnull TypeSerializer<T> serializer) {
int length = serializer.getLength() > 0 ? serializer.getLength() : 1;
DataOutputSerializer dos = new DataOutputSerializer(length);
try {
serializer.serialize(null, dos);
}
catch (IOException | RuntimeException e) {
return false;
}
checkArgument(
serializer.getLength() < 0 || serializer.getLength() == dos.getCopyOfBuffer().length,
"The serialized form of the null value should have the same length " +
"as any other if the length is fixed in the serializer");
DataInputDeserializer dis = new DataInputDeserializer(dos.getSharedBuffer());
try {
checkArgument(serializer.deserialize(dis) == null);
}
catch (IOException e) {
throw new RuntimeException(
String.format("Unexpected failure to deserialize just serialized null value with %s",
serializer.getClass().getName()), e);
}
checkArgument(
serializer.copy(null) == null,
"Serializer %s has to be able properly copy null value if it can serialize it",
serializer.getClass().getName());
return true;
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"checkIfNullSupported",
"(",
"@",
"Nonnull",
"TypeSerializer",
"<",
"T",
">",
"serializer",
")",
"{",
"int",
"length",
"=",
"serializer",
".",
"getLength",
"(",
")",
">",
"0",
"?",
"serializer",
".",
"getLength... | This method checks if {@code serializer} supports {@code null} value.
@param serializer serializer to check | [
"This",
"method",
"checks",
"if",
"{",
"@code",
"serializer",
"}",
"supports",
"{",
"@code",
"null",
"}",
"value",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/NullableSerializer.java#L99-L126 | train | Check if the given serializer supports null values. | [
30522,
2270,
10763,
1026,
1056,
1028,
22017,
20898,
4638,
10128,
11231,
12718,
6279,
6442,
2098,
1006,
1030,
2512,
11231,
3363,
4127,
11610,
28863,
1026,
1056,
1028,
7642,
17629,
1007,
1063,
20014,
3091,
1027,
7642,
17629,
1012,
2131,
7770,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/dialect/mysql/clause/MySQLSelectOptionClauseParser.java | MySQLSelectOptionClauseParser.parse | public void parse() {
lexerEngine.skipAll(MySQLKeyword.HIGH_PRIORITY, MySQLKeyword.STRAIGHT_JOIN,
MySQLKeyword.SQL_SMALL_RESULT, MySQLKeyword.SQL_BIG_RESULT, MySQLKeyword.SQL_BUFFER_RESULT, MySQLKeyword.SQL_CACHE, MySQLKeyword.SQL_NO_CACHE, MySQLKeyword.SQL_CALC_FOUND_ROWS);
} | java | public void parse() {
lexerEngine.skipAll(MySQLKeyword.HIGH_PRIORITY, MySQLKeyword.STRAIGHT_JOIN,
MySQLKeyword.SQL_SMALL_RESULT, MySQLKeyword.SQL_BIG_RESULT, MySQLKeyword.SQL_BUFFER_RESULT, MySQLKeyword.SQL_CACHE, MySQLKeyword.SQL_NO_CACHE, MySQLKeyword.SQL_CALC_FOUND_ROWS);
} | [
"public",
"void",
"parse",
"(",
")",
"{",
"lexerEngine",
".",
"skipAll",
"(",
"MySQLKeyword",
".",
"HIGH_PRIORITY",
",",
"MySQLKeyword",
".",
"STRAIGHT_JOIN",
",",
"MySQLKeyword",
".",
"SQL_SMALL_RESULT",
",",
"MySQLKeyword",
".",
"SQL_BIG_RESULT",
",",
"MySQLKeyw... | 解析Option. | [
"解析Option",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/dialect/mysql/clause/MySQLSelectOptionClauseParser.java#L38-L41 | train | Parse the SQL statement. | [
30522,
2270,
11675,
11968,
3366,
1006,
1007,
1063,
17244,
7869,
3070,
3170,
1012,
13558,
8095,
1006,
2026,
2015,
4160,
28143,
2100,
18351,
1012,
2152,
1035,
9470,
1010,
2026,
2015,
4160,
28143,
2100,
18351,
1012,
3442,
1035,
3693,
1010,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java | SlotPoolImpl.registerTaskManager | @Override
public boolean registerTaskManager(final ResourceID resourceID) {
componentMainThreadExecutor.assertRunningInMainThread();
log.debug("Register new TaskExecutor {}.", resourceID);
return registeredTaskManagers.add(resourceID);
} | java | @Override
public boolean registerTaskManager(final ResourceID resourceID) {
componentMainThreadExecutor.assertRunningInMainThread();
log.debug("Register new TaskExecutor {}.", resourceID);
return registeredTaskManagers.add(resourceID);
} | [
"@",
"Override",
"public",
"boolean",
"registerTaskManager",
"(",
"final",
"ResourceID",
"resourceID",
")",
"{",
"componentMainThreadExecutor",
".",
"assertRunningInMainThread",
"(",
")",
";",
"log",
".",
"debug",
"(",
"\"Register new TaskExecutor {}.\"",
",",
"resource... | Register TaskManager to this pool, only those slots come from registered TaskManager will be considered valid.
Also it provides a way for us to keep "dead" or "abnormal" TaskManagers out of this pool.
@param resourceID The id of the TaskManager | [
"Register",
"TaskManager",
"to",
"this",
"pool",
"only",
"those",
"slots",
"come",
"from",
"registered",
"TaskManager",
"will",
"be",
"considered",
"valid",
".",
"Also",
"it",
"provides",
"a",
"way",
"for",
"us",
"to",
"keep",
"dead",
"or",
"abnormal",
"Task... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java#L689-L696 | train | Register a new TaskManager. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
4236,
10230,
22287,
5162,
4590,
1006,
2345,
7692,
3593,
7692,
3593,
1007,
1063,
6922,
24238,
2705,
16416,
3207,
2595,
8586,
16161,
2099,
1012,
20865,
15532,
5582,
2378,
24238,
2705,
16416,
2094,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.newServerContext | @Deprecated
public static SslContext newServerContext(
File certChainFile, File keyFile, String keyPassword,
Iterable<String> ciphers, Iterable<String> nextProtocols,
long sessionCacheSize, long sessionTimeout) throws SSLException {
return newServerContext(
null, certChainFile, keyFile, keyPassword,
ciphers, nextProtocols, sessionCacheSize, sessionTimeout);
} | java | @Deprecated
public static SslContext newServerContext(
File certChainFile, File keyFile, String keyPassword,
Iterable<String> ciphers, Iterable<String> nextProtocols,
long sessionCacheSize, long sessionTimeout) throws SSLException {
return newServerContext(
null, certChainFile, keyFile, keyPassword,
ciphers, nextProtocols, sessionCacheSize, sessionTimeout);
} | [
"@",
"Deprecated",
"public",
"static",
"SslContext",
"newServerContext",
"(",
"File",
"certChainFile",
",",
"File",
"keyFile",
",",
"String",
"keyPassword",
",",
"Iterable",
"<",
"String",
">",
"ciphers",
",",
"Iterable",
"<",
"String",
">",
"nextProtocols",
","... | Creates a new server-side {@link SslContext}.
@param certChainFile an X.509 certificate chain file in PEM format
@param keyFile a PKCS#8 private key file in PEM format
@param keyPassword the password of the {@code keyFile}.
{@code null} if it's not password-protected.
@param ciphers the cipher suites to enable, in the order of preference.
{@code null} to use the default cipher suites.
@param nextProtocols the application layer protocols to accept, in the order of preference.
{@code null} to disable TLS NPN/ALPN extension.
@param sessionCacheSize the size of the cache used for storing SSL session objects.
{@code 0} to use the default value.
@param sessionTimeout the timeout for the cached SSL session objects, in seconds.
{@code 0} to use the default value.
@return a new server-side {@link SslContext}
@deprecated Replaced by {@link SslContextBuilder} | [
"Creates",
"a",
"new",
"server",
"-",
"side",
"{",
"@link",
"SslContext",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L174-L183 | train | Create a new server context using the specified parameters. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
7020,
22499,
10111,
18413,
2739,
2121,
6299,
8663,
18209,
1006,
5371,
8292,
5339,
24925,
2078,
8873,
2571,
1010,
5371,
3145,
8873,
2571,
1010,
5164,
3145,
15194,
18351,
1010,
2009,
6906,
3468,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java | Matrix.norm1 | public double norm1()
{
double f = 0;
for (int j = 0; j < n; j++)
{
double s = 0;
for (int i = 0; i < m; i++)
{
s += Math.abs(A[i][j]);
}
f = Math.max(f, s);
}
return f;
} | java | public double norm1()
{
double f = 0;
for (int j = 0; j < n; j++)
{
double s = 0;
for (int i = 0; i < m; i++)
{
s += Math.abs(A[i][j]);
}
f = Math.max(f, s);
}
return f;
} | [
"public",
"double",
"norm1",
"(",
")",
"{",
"double",
"f",
"=",
"0",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"n",
";",
"j",
"++",
")",
"{",
"double",
"s",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m"... | One norm
@return maximum column sum. | [
"One",
"norm"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L627-L640 | train | Norm1 function. | [
30522,
2270,
3313,
13373,
2487,
1006,
1007,
1063,
3313,
1042,
1027,
1014,
1025,
2005,
1006,
20014,
1046,
1027,
1014,
1025,
1046,
1026,
1050,
1025,
1046,
1009,
1009,
1007,
1063,
3313,
1055,
1027,
1014,
1025,
2005,
1006,
20014,
1045,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/BCUtil.java | BCUtil.readPemObject | public static PemObject readPemObject(InputStream keyStream) {
PemReader pemReader = null;
try {
pemReader = new PemReader(IoUtil.getReader(keyStream, CharsetUtil.CHARSET_UTF_8));
return pemReader.readPemObject();
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
IoUtil.close(pemReader);
}
} | java | public static PemObject readPemObject(InputStream keyStream) {
PemReader pemReader = null;
try {
pemReader = new PemReader(IoUtil.getReader(keyStream, CharsetUtil.CHARSET_UTF_8));
return pemReader.readPemObject();
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
IoUtil.close(pemReader);
}
} | [
"public",
"static",
"PemObject",
"readPemObject",
"(",
"InputStream",
"keyStream",
")",
"{",
"PemReader",
"pemReader",
"=",
"null",
";",
"try",
"{",
"pemReader",
"=",
"new",
"PemReader",
"(",
"IoUtil",
".",
"getReader",
"(",
"keyStream",
",",
"CharsetUtil",
".... | 读取pem文件中的信息,包括类型、头信息和密钥内容
@param keyStream pem流
@return {@link PemObject}
@since 4.5.2 | [
"读取pem文件中的信息,包括类型、头信息和密钥内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/BCUtil.java#L157-L167 | train | Reads a single PEM object from the specified input stream. | [
30522,
2270,
10763,
21877,
5302,
2497,
20614,
3191,
5051,
5302,
2497,
20614,
1006,
20407,
25379,
6309,
25379,
1007,
1063,
21877,
2213,
16416,
4063,
21877,
2213,
16416,
4063,
1027,
19701,
1025,
3046,
1063,
21877,
2213,
16416,
4063,
1027,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java | URLUtil.toUrlForHttp | public static URL toUrlForHttp(String urlStr, URLStreamHandler handler) {
Assert.notBlank(urlStr, "Url is blank !");
// 去掉url中的空白符,防止空白符导致的异常
urlStr = StrUtil.cleanBlank(urlStr);
return URLUtil.url(urlStr, handler);
} | java | public static URL toUrlForHttp(String urlStr, URLStreamHandler handler) {
Assert.notBlank(urlStr, "Url is blank !");
// 去掉url中的空白符,防止空白符导致的异常
urlStr = StrUtil.cleanBlank(urlStr);
return URLUtil.url(urlStr, handler);
} | [
"public",
"static",
"URL",
"toUrlForHttp",
"(",
"String",
"urlStr",
",",
"URLStreamHandler",
"handler",
")",
"{",
"Assert",
".",
"notBlank",
"(",
"urlStr",
",",
"\"Url is blank !\"",
")",
";",
"// 去掉url中的空白符,防止空白符导致的异常\r",
"urlStr",
"=",
"StrUtil",
".",
"cleanBlan... | 将URL字符串转换为URL对象,并做必要验证
@param urlStr URL字符串
@param handler {@link URLStreamHandler}
@return URL
@since 4.1.9 | [
"将URL字符串转换为URL对象,并做必要验证"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L119-L124 | train | Converts a string to a URL. | [
30522,
2270,
10763,
24471,
2140,
2778,
10270,
2953,
11039,
25856,
1006,
5164,
24471,
4877,
16344,
1010,
24471,
4877,
25379,
11774,
3917,
28213,
1007,
1063,
20865,
1012,
2025,
28522,
8950,
1006,
24471,
4877,
16344,
1010,
1000,
24471,
2140,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
redisson/redisson | redisson/src/main/java/org/redisson/config/RedissonNodeConfig.java | RedissonNodeConfig.fromJSON | public static RedissonNodeConfig fromJSON(File file) throws IOException {
ConfigSupport support = new ConfigSupport();
return support.fromJSON(file, RedissonNodeConfig.class);
} | java | public static RedissonNodeConfig fromJSON(File file) throws IOException {
ConfigSupport support = new ConfigSupport();
return support.fromJSON(file, RedissonNodeConfig.class);
} | [
"public",
"static",
"RedissonNodeConfig",
"fromJSON",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"ConfigSupport",
"support",
"=",
"new",
"ConfigSupport",
"(",
")",
";",
"return",
"support",
".",
"fromJSON",
"(",
"file",
",",
"RedissonNodeConfig",
".... | Read config object stored in JSON format from <code>File</code>
@param file object
@return config
@throws IOException error | [
"Read",
"config",
"object",
"stored",
"in",
"JSON",
"format",
"from",
"<code",
">",
"File<",
"/",
"code",
">"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/config/RedissonNodeConfig.java#L108-L111 | train | Creates a RedissonNodeConfig from a JSON file. | [
30522,
2270,
10763,
2417,
24077,
3630,
3207,
8663,
8873,
2290,
2013,
22578,
2239,
1006,
5371,
5371,
1007,
11618,
22834,
10288,
24422,
1063,
9530,
8873,
5620,
6279,
6442,
2490,
1027,
2047,
9530,
8873,
5620,
6279,
6442,
1006,
1007,
1025,
2709... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SingleOutputStreamOperator.java | SingleOutputStreamOperator.setResources | private SingleOutputStreamOperator<T> setResources(ResourceSpec resources) {
Preconditions.checkNotNull(resources, "The resources must be not null.");
Preconditions.checkArgument(resources.isValid(), "The values in resources must be not less than 0.");
transformation.setResources(resources, resources);
return this;
} | java | private SingleOutputStreamOperator<T> setResources(ResourceSpec resources) {
Preconditions.checkNotNull(resources, "The resources must be not null.");
Preconditions.checkArgument(resources.isValid(), "The values in resources must be not less than 0.");
transformation.setResources(resources, resources);
return this;
} | [
"private",
"SingleOutputStreamOperator",
"<",
"T",
">",
"setResources",
"(",
"ResourceSpec",
"resources",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"resources",
",",
"\"The resources must be not null.\"",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
... | Sets the resources for this operator, the minimum and preferred resources are the same by default.
@param resources The resources for this operator.
@return The operator with set minimum and preferred resources. | [
"Sets",
"the",
"resources",
"for",
"this",
"operator",
"the",
"minimum",
"and",
"preferred",
"resources",
"are",
"the",
"same",
"by",
"default",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SingleOutputStreamOperator.java#L201-L208 | train | Sets the resources. | [
30522,
2797,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1056,
1028,
2275,
6072,
8162,
9623,
1006,
4219,
5051,
2278,
4219,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
4219,
1010,
1000,
1996,
4219,
2442,
2022,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/tuple/Tuple3.java | Tuple3.copy | @Override
@SuppressWarnings("unchecked")
public Tuple3<T0, T1, T2> copy() {
return new Tuple3<>(this.f0,
this.f1,
this.f2);
} | java | @Override
@SuppressWarnings("unchecked")
public Tuple3<T0, T1, T2> copy() {
return new Tuple3<>(this.f0,
this.f1,
this.f2);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Tuple3",
"<",
"T0",
",",
"T1",
",",
"T2",
">",
"copy",
"(",
")",
"{",
"return",
"new",
"Tuple3",
"<>",
"(",
"this",
".",
"f0",
",",
"this",
".",
"f1",
",",
"this",
".",... | Shallow tuple copy.
@return A new Tuple with the same fields as this. | [
"Shallow",
"tuple",
"copy",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/tuple/Tuple3.java#L184-L190 | train | Returns a copy of this tuple. | [
30522,
1030,
2058,
15637,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10722,
10814,
2509,
1026,
1056,
2692,
1010,
1056,
2487,
1010,
1056,
2475,
1028,
6100,
1006,
1007,
1063,
2709,
2047,
10722,
10814,
2509... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.beginOfQuarter | public static Calendar beginOfQuarter(Calendar calendar) {
calendar.set(Calendar.MONTH, calendar.get(DateField.MONTH.getValue()) / 3 * 3);
calendar.set(Calendar.DAY_OF_MONTH, 1);
return beginOfDay(calendar);
} | java | public static Calendar beginOfQuarter(Calendar calendar) {
calendar.set(Calendar.MONTH, calendar.get(DateField.MONTH.getValue()) / 3 * 3);
calendar.set(Calendar.DAY_OF_MONTH, 1);
return beginOfDay(calendar);
} | [
"public",
"static",
"Calendar",
"beginOfQuarter",
"(",
"Calendar",
"calendar",
")",
"{",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"MONTH",
",",
"calendar",
".",
"get",
"(",
"DateField",
".",
"MONTH",
".",
"getValue",
"(",
")",
")",
"/",
"3",
"*",
... | 获取某季度的开始时间
@param calendar 日期 {@link Calendar}
@return {@link Calendar}
@since 4.1.0 | [
"获取某季度的开始时间"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L996-L1000 | train | Returns a copy of the given calendar that is the beginning of the quarter. | [
30522,
2270,
10763,
8094,
4088,
11253,
16211,
19418,
1006,
8094,
8094,
1007,
1063,
8094,
1012,
2275,
1006,
8094,
1012,
3204,
1010,
8094,
1012,
2131,
1006,
3058,
3790,
1012,
3204,
1012,
2131,
10175,
5657,
1006,
1007,
1007,
1013,
1017,
1008,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.writeLines | public static <T> File writeLines(Collection<T> list, String path, String charset, boolean isAppend) throws IORuntimeException {
return writeLines(list, file(path), charset, isAppend);
} | java | public static <T> File writeLines(Collection<T> list, String path, String charset, boolean isAppend) throws IORuntimeException {
return writeLines(list, file(path), charset, isAppend);
} | [
"public",
"static",
"<",
"T",
">",
"File",
"writeLines",
"(",
"Collection",
"<",
"T",
">",
"list",
",",
"String",
"path",
",",
"String",
"charset",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"writeLines",
"(",
"list",
"... | 将列表写入文件
@param <T> 集合元素类型
@param list 列表
@param path 文件路径
@param charset 字符集
@param isAppend 是否追加
@return 目标文件
@throws IORuntimeException IO异常 | [
"将列表写入文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3026-L3028 | train | Write lines to a file. | [
30522,
2270,
10763,
1026,
1056,
1028,
5371,
4339,
12735,
1006,
3074,
1026,
1056,
1028,
2862,
1010,
5164,
4130,
1010,
5164,
25869,
13462,
1010,
22017,
20898,
18061,
21512,
4859,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
4339,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/exceptions/ExceptionUtil.java | ExceptionUtil.stacktraceToString | public static String stacktraceToString(Throwable throwable, int limit, Map<Character, String> replaceCharToStrMap) {
final FastByteArrayOutputStream baos = new FastByteArrayOutputStream();
throwable.printStackTrace(new PrintStream(baos));
String exceptionStr = baos.toString();
int length = exceptionStr.length();
if (limit > 0 && limit < length) {
length = limit;
}
if (CollectionUtil.isNotEmpty(replaceCharToStrMap)) {
final StringBuilder sb = StrUtil.builder();
char c;
String value;
for (int i = 0; i < length; i++) {
c = exceptionStr.charAt(i);
value = replaceCharToStrMap.get(c);
if (null != value) {
sb.append(value);
} else {
sb.append(c);
}
}
return sb.toString();
} else {
return StrUtil.subPre(exceptionStr, limit);
}
} | java | public static String stacktraceToString(Throwable throwable, int limit, Map<Character, String> replaceCharToStrMap) {
final FastByteArrayOutputStream baos = new FastByteArrayOutputStream();
throwable.printStackTrace(new PrintStream(baos));
String exceptionStr = baos.toString();
int length = exceptionStr.length();
if (limit > 0 && limit < length) {
length = limit;
}
if (CollectionUtil.isNotEmpty(replaceCharToStrMap)) {
final StringBuilder sb = StrUtil.builder();
char c;
String value;
for (int i = 0; i < length; i++) {
c = exceptionStr.charAt(i);
value = replaceCharToStrMap.get(c);
if (null != value) {
sb.append(value);
} else {
sb.append(c);
}
}
return sb.toString();
} else {
return StrUtil.subPre(exceptionStr, limit);
}
} | [
"public",
"static",
"String",
"stacktraceToString",
"(",
"Throwable",
"throwable",
",",
"int",
"limit",
",",
"Map",
"<",
"Character",
",",
"String",
">",
"replaceCharToStrMap",
")",
"{",
"final",
"FastByteArrayOutputStream",
"baos",
"=",
"new",
"FastByteArrayOutputS... | 堆栈转为完整字符串
@param throwable 异常对象
@param limit 限制最大长度
@param replaceCharToStrMap 替换字符为指定字符串
@return 堆栈转为的字符串 | [
"堆栈转为完整字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java#L185-L211 | train | Convert a stack trace to a String. | [
30522,
2270,
10763,
5164,
9991,
6494,
3401,
13122,
18886,
3070,
1006,
5466,
3085,
5466,
3085,
1010,
20014,
5787,
1010,
4949,
1026,
2839,
1010,
5164,
1028,
5672,
7507,
5339,
14122,
17830,
2361,
1007,
1063,
2345,
3435,
3762,
27058,
11335,
293... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/service/ESSyncService.java | ESSyncService.joinTableSimpleFieldOperation | private void joinTableSimpleFieldOperation(ESSyncConfig config, Dml dml, Map<String, Object> data,
TableItem tableItem, Map<String, Object> esFieldData) {
ESMapping mapping = config.getEsMapping();
Map<String, Object> paramsTmp = new LinkedHashMap<>();
for (Map.Entry<FieldItem, List<FieldItem>> entry : tableItem.getRelationTableFields().entrySet()) {
for (FieldItem fieldItem : entry.getValue()) {
if (fieldItem.getColumnItems().size() == 1) {
Object value = esTemplate.getValFromData(mapping,
data,
fieldItem.getFieldName(),
entry.getKey().getColumn().getColumnName());
String fieldName = fieldItem.getFieldName();
// 判断是否是主键
if (fieldName.equals(mapping.get_id())) {
fieldName = "_id";
}
paramsTmp.put(fieldName, value);
}
}
}
if (logger.isDebugEnabled()) {
logger.trace("Join table update es index by foreign key, destination:{}, table: {}, index: {}",
config.getDestination(),
dml.getTable(),
mapping.get_index());
}
esTemplate.updateByQuery(config, paramsTmp, esFieldData);
} | java | private void joinTableSimpleFieldOperation(ESSyncConfig config, Dml dml, Map<String, Object> data,
TableItem tableItem, Map<String, Object> esFieldData) {
ESMapping mapping = config.getEsMapping();
Map<String, Object> paramsTmp = new LinkedHashMap<>();
for (Map.Entry<FieldItem, List<FieldItem>> entry : tableItem.getRelationTableFields().entrySet()) {
for (FieldItem fieldItem : entry.getValue()) {
if (fieldItem.getColumnItems().size() == 1) {
Object value = esTemplate.getValFromData(mapping,
data,
fieldItem.getFieldName(),
entry.getKey().getColumn().getColumnName());
String fieldName = fieldItem.getFieldName();
// 判断是否是主键
if (fieldName.equals(mapping.get_id())) {
fieldName = "_id";
}
paramsTmp.put(fieldName, value);
}
}
}
if (logger.isDebugEnabled()) {
logger.trace("Join table update es index by foreign key, destination:{}, table: {}, index: {}",
config.getDestination(),
dml.getTable(),
mapping.get_index());
}
esTemplate.updateByQuery(config, paramsTmp, esFieldData);
} | [
"private",
"void",
"joinTableSimpleFieldOperation",
"(",
"ESSyncConfig",
"config",
",",
"Dml",
"dml",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
",",
"TableItem",
"tableItem",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"esFieldData",
")",
"{"... | 关联表主表简单字段operation
@param config es配置
@param dml dml信息
@param data 单行dml数据
@param tableItem 当前表配置 | [
"关联表主表简单字段operation"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/service/ESSyncService.java#L543-L573 | train | Update the table with a simple field operation | [
30522,
2797,
11675,
4101,
3085,
5332,
23344,
3790,
25918,
3370,
1006,
9686,
6508,
12273,
8663,
8873,
2290,
9530,
8873,
2290,
1010,
1040,
19968,
1040,
19968,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
2951,
1010,
2795,
4221,
2213,
2795,
4221,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/batch/connectors/cassandra/CassandraInputFormat.java | CassandraInputFormat.open | @Override
public void open(InputSplit ignored) throws IOException {
this.session = cluster.connect();
this.resultSet = session.execute(query);
} | java | @Override
public void open(InputSplit ignored) throws IOException {
this.session = cluster.connect();
this.resultSet = session.execute(query);
} | [
"@",
"Override",
"public",
"void",
"open",
"(",
"InputSplit",
"ignored",
")",
"throws",
"IOException",
"{",
"this",
".",
"session",
"=",
"cluster",
".",
"connect",
"(",
")",
";",
"this",
".",
"resultSet",
"=",
"session",
".",
"execute",
"(",
"query",
")"... | Opens a Session and executes the query.
@param ignored because parameter is not parallelizable.
@throws IOException | [
"Opens",
"a",
"Session",
"and",
"executes",
"the",
"query",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/batch/connectors/cassandra/CassandraInputFormat.java#L49-L53 | train | Opens the connection and executes the query. | [
30522,
1030,
2058,
15637,
2270,
11675,
2330,
1006,
20407,
24759,
4183,
6439,
1007,
11618,
22834,
10288,
24422,
1063,
2023,
1012,
5219,
1027,
9324,
1012,
7532,
1006,
1007,
1025,
2023,
1012,
3463,
3388,
1027,
5219,
1012,
15389,
1006,
23032,
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-poi/src/main/java/cn/hutool/poi/word/Word07Writer.java | Word07Writer.addText | public Word07Writer addText(ParagraphAlignment align, Font font, String... texts) {
final XWPFParagraph p = this.doc.createParagraph();
if (null != align) {
p.setAlignment(align);
}
if (ArrayUtil.isNotEmpty(texts)) {
XWPFRun run;
for (String text : texts) {
run = p.createRun();
run.setText(text);
if (null != font) {
run.setFontFamily(font.getFamily());
run.setFontSize(font.getSize());
run.setBold(font.isBold());
run.setItalic(font.isItalic());
}
}
}
return this;
} | java | public Word07Writer addText(ParagraphAlignment align, Font font, String... texts) {
final XWPFParagraph p = this.doc.createParagraph();
if (null != align) {
p.setAlignment(align);
}
if (ArrayUtil.isNotEmpty(texts)) {
XWPFRun run;
for (String text : texts) {
run = p.createRun();
run.setText(text);
if (null != font) {
run.setFontFamily(font.getFamily());
run.setFontSize(font.getSize());
run.setBold(font.isBold());
run.setItalic(font.isItalic());
}
}
}
return this;
} | [
"public",
"Word07Writer",
"addText",
"(",
"ParagraphAlignment",
"align",
",",
"Font",
"font",
",",
"String",
"...",
"texts",
")",
"{",
"final",
"XWPFParagraph",
"p",
"=",
"this",
".",
"doc",
".",
"createParagraph",
"(",
")",
";",
"if",
"(",
"null",
"!=",
... | 增加一个段落
@param align 段落对齐方式{@link ParagraphAlignment}
@param font 字体信息{@link Font}
@param texts 段落中的文本,支持多个文本作为一个段落
@return this | [
"增加一个段落"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/word/Word07Writer.java#L109-L128 | train | Adds a new paragraph to the document. | [
30522,
2270,
2773,
2692,
2581,
15994,
5587,
18209,
1006,
20423,
11475,
16206,
3672,
25705,
1010,
15489,
15489,
1010,
5164,
1012,
1012,
1012,
6981,
1007,
1063,
2345,
1060,
2860,
14376,
28689,
14413,
1052,
1027,
2023,
1012,
9986,
1012,
3443,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ExecutionEnvironment.java | ExecutionEnvironment.createRemoteEnvironment | public static ExecutionEnvironment createRemoteEnvironment(String host, int port, int parallelism, String... jarFiles) {
RemoteEnvironment rec = new RemoteEnvironment(host, port, jarFiles);
rec.setParallelism(parallelism);
return rec;
} | java | public static ExecutionEnvironment createRemoteEnvironment(String host, int port, int parallelism, String... jarFiles) {
RemoteEnvironment rec = new RemoteEnvironment(host, port, jarFiles);
rec.setParallelism(parallelism);
return rec;
} | [
"public",
"static",
"ExecutionEnvironment",
"createRemoteEnvironment",
"(",
"String",
"host",
",",
"int",
"port",
",",
"int",
"parallelism",
",",
"String",
"...",
"jarFiles",
")",
"{",
"RemoteEnvironment",
"rec",
"=",
"new",
"RemoteEnvironment",
"(",
"host",
",",
... | Creates a {@link RemoteEnvironment}. The remote environment sends (parts of) the program
to a cluster for execution. Note that all file paths used in the program must be accessible from the
cluster. The execution will use the specified parallelism.
@param host The host name or address of the master (JobManager), where the program should be executed.
@param port The port of the master (JobManager), where the program should be executed.
@param parallelism The parallelism to use during the execution.
@param jarFiles The JAR files with code that needs to be shipped to the cluster. If the program uses
user-defined functions, user-defined input formats, or any libraries, those must be
provided in the JAR files.
@return A remote environment that executes the program on a cluster. | [
"Creates",
"a",
"{",
"@link",
"RemoteEnvironment",
"}",
".",
"The",
"remote",
"environment",
"sends",
"(",
"parts",
"of",
")",
"the",
"program",
"to",
"a",
"cluster",
"for",
"execution",
".",
"Note",
"that",
"all",
"file",
"paths",
"used",
"in",
"the",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L1210-L1214 | train | Create a remote environment. | [
30522,
2270,
10763,
7781,
2368,
21663,
2239,
3672,
3443,
28578,
12184,
2368,
21663,
2239,
3672,
1006,
5164,
3677,
1010,
20014,
3417,
1010,
20014,
5903,
2964,
1010,
5164,
1012,
1012,
1012,
15723,
8873,
4244,
1007,
1063,
6556,
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... |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/proxy/KinesisProxy.java | KinesisProxy.getRecords | @Override
public GetRecordsResult getRecords(String shardIterator, int maxRecordsToGet) throws InterruptedException {
final GetRecordsRequest getRecordsRequest = new GetRecordsRequest();
getRecordsRequest.setShardIterator(shardIterator);
getRecordsRequest.setLimit(maxRecordsToGet);
GetRecordsResult getRecordsResult = null;
int retryCount = 0;
while (retryCount <= getRecordsMaxRetries && getRecordsResult == null) {
try {
getRecordsResult = kinesisClient.getRecords(getRecordsRequest);
} catch (SdkClientException ex) {
if (isRecoverableSdkClientException(ex)) {
long backoffMillis = fullJitterBackoff(
getRecordsBaseBackoffMillis, getRecordsMaxBackoffMillis, getRecordsExpConstant, retryCount++);
LOG.warn("Got recoverable SdkClientException. Backing off for "
+ backoffMillis + " millis (" + ex.getClass().getName() + ": " + ex.getMessage() + ")");
Thread.sleep(backoffMillis);
} else {
throw ex;
}
}
}
if (getRecordsResult == null) {
throw new RuntimeException("Retries exceeded for getRecords operation - all " + getRecordsMaxRetries +
" retry attempts failed.");
}
return getRecordsResult;
} | java | @Override
public GetRecordsResult getRecords(String shardIterator, int maxRecordsToGet) throws InterruptedException {
final GetRecordsRequest getRecordsRequest = new GetRecordsRequest();
getRecordsRequest.setShardIterator(shardIterator);
getRecordsRequest.setLimit(maxRecordsToGet);
GetRecordsResult getRecordsResult = null;
int retryCount = 0;
while (retryCount <= getRecordsMaxRetries && getRecordsResult == null) {
try {
getRecordsResult = kinesisClient.getRecords(getRecordsRequest);
} catch (SdkClientException ex) {
if (isRecoverableSdkClientException(ex)) {
long backoffMillis = fullJitterBackoff(
getRecordsBaseBackoffMillis, getRecordsMaxBackoffMillis, getRecordsExpConstant, retryCount++);
LOG.warn("Got recoverable SdkClientException. Backing off for "
+ backoffMillis + " millis (" + ex.getClass().getName() + ": " + ex.getMessage() + ")");
Thread.sleep(backoffMillis);
} else {
throw ex;
}
}
}
if (getRecordsResult == null) {
throw new RuntimeException("Retries exceeded for getRecords operation - all " + getRecordsMaxRetries +
" retry attempts failed.");
}
return getRecordsResult;
} | [
"@",
"Override",
"public",
"GetRecordsResult",
"getRecords",
"(",
"String",
"shardIterator",
",",
"int",
"maxRecordsToGet",
")",
"throws",
"InterruptedException",
"{",
"final",
"GetRecordsRequest",
"getRecordsRequest",
"=",
"new",
"GetRecordsRequest",
"(",
")",
";",
"... | {@inheritDoc} | [
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/proxy/KinesisProxy.java#L239-L270 | train | Get records from Kinesis. | [
30522,
1030,
2058,
15637,
2270,
2131,
2890,
27108,
5104,
6072,
11314,
2131,
30524,
2890,
15500,
1006,
1007,
1025,
2131,
2890,
27108,
5104,
2890,
15500,
1012,
4520,
11783,
21646,
8844,
1006,
21146,
17080,
14621,
4263,
1007,
1025,
2131,
2890,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/query/TaskKvStateRegistry.java | TaskKvStateRegistry.unregisterAll | public void unregisterAll() {
for (KvStateInfo kvState : registeredKvStates) {
registry.unregisterKvState(jobId, jobVertexId, kvState.keyGroupRange, kvState.registrationName, kvState.kvStateId);
}
} | java | public void unregisterAll() {
for (KvStateInfo kvState : registeredKvStates) {
registry.unregisterKvState(jobId, jobVertexId, kvState.keyGroupRange, kvState.registrationName, kvState.kvStateId);
}
} | [
"public",
"void",
"unregisterAll",
"(",
")",
"{",
"for",
"(",
"KvStateInfo",
"kvState",
":",
"registeredKvStates",
")",
"{",
"registry",
".",
"unregisterKvState",
"(",
"jobId",
",",
"jobVertexId",
",",
"kvState",
".",
"keyGroupRange",
",",
"kvState",
".",
"reg... | Unregisters all registered KvState instances from the KvStateRegistry. | [
"Unregisters",
"all",
"registered",
"KvState",
"instances",
"from",
"the",
"KvStateRegistry",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/query/TaskKvStateRegistry.java#L71-L75 | train | Unregister all registered KvState objects. | [
30522,
2270,
11675,
4895,
2890,
24063,
21673,
2140,
1006,
1007,
1063,
2005,
1006,
24888,
9153,
9589,
14876,
24888,
9153,
2618,
1024,
5068,
2243,
15088,
12259,
2015,
1007,
1063,
15584,
1012,
4895,
2890,
24063,
2121,
2243,
15088,
12259,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/remote/RemoteWebDriverBuilder.java | RemoteWebDriverBuilder.setCapability | public RemoteWebDriverBuilder setCapability(String capabilityName, String value) {
if (!OK_KEYS.test(capabilityName)) {
throw new IllegalArgumentException("Capability is not valid");
}
if (value == null) {
throw new IllegalArgumentException("Null values are not allowed");
}
additionalCapabilities.put(capabilityName, value);
return this;
} | java | public RemoteWebDriverBuilder setCapability(String capabilityName, String value) {
if (!OK_KEYS.test(capabilityName)) {
throw new IllegalArgumentException("Capability is not valid");
}
if (value == null) {
throw new IllegalArgumentException("Null values are not allowed");
}
additionalCapabilities.put(capabilityName, value);
return this;
} | [
"public",
"RemoteWebDriverBuilder",
"setCapability",
"(",
"String",
"capabilityName",
",",
"String",
"value",
")",
"{",
"if",
"(",
"!",
"OK_KEYS",
".",
"test",
"(",
"capabilityName",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Capability is ... | Sets a capability for every single alternative when the session is created. These capabilities
are only set once the session is created, so this will be set on capabilities added via
{@link #addAlternative(Capabilities)} or {@link #oneOf(Capabilities, Capabilities...)} even
after this method call. | [
"Sets",
"a",
"capability",
"for",
"every",
"single",
"alternative",
"when",
"the",
"session",
"is",
"created",
".",
"These",
"capabilities",
"are",
"only",
"set",
"once",
"the",
"session",
"is",
"created",
"so",
"this",
"will",
"be",
"set",
"on",
"capabiliti... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/RemoteWebDriverBuilder.java#L146-L156 | train | Sets the value of the specified capability. | [
30522,
2270,
6556,
8545,
2497,
23663,
15185,
19231,
4063,
2275,
17695,
8010,
1006,
5164,
10673,
18442,
1010,
5164,
3643,
1007,
1063,
2065,
1006,
999,
7929,
1035,
6309,
1012,
3231,
1006,
10673,
18442,
1007,
1007,
1063,
5466,
2047,
6206,
2906... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java | Restarter.start | protected void start(FailureHandler failureHandler) throws Exception {
do {
Throwable error = doStart();
if (error == null) {
return;
}
if (failureHandler.handle(error) == Outcome.ABORT) {
return;
}
}
while (true);
} | java | protected void start(FailureHandler failureHandler) throws Exception {
do {
Throwable error = doStart();
if (error == null) {
return;
}
if (failureHandler.handle(error) == Outcome.ABORT) {
return;
}
}
while (true);
} | [
"protected",
"void",
"start",
"(",
"FailureHandler",
"failureHandler",
")",
"throws",
"Exception",
"{",
"do",
"{",
"Throwable",
"error",
"=",
"doStart",
"(",
")",
";",
"if",
"(",
"error",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"failureHan... | Start the application.
@param failureHandler a failure handler for application that won't start
@throws Exception in case of errors | [
"Start",
"the",
"application",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java#L263-L274 | train | Start the application. | [
30522,
5123,
11675,
2707,
1006,
4945,
11774,
3917,
4945,
11774,
3917,
1007,
11618,
6453,
1063,
2079,
1063,
5466,
3085,
7561,
1027,
9998,
7559,
2102,
1006,
1007,
1025,
2065,
1006,
7561,
1027,
1027,
19701,
1007,
1063,
2709,
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... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java | SqlExecutor.queryAndClosePs | public static <T> T queryAndClosePs(PreparedStatement ps, RsHandler<T> rsh, Object... params) throws SQLException {
try {
return query(ps, rsh, params);
} finally {
DbUtil.close(ps);
}
} | java | public static <T> T queryAndClosePs(PreparedStatement ps, RsHandler<T> rsh, Object... params) throws SQLException {
try {
return query(ps, rsh, params);
} finally {
DbUtil.close(ps);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"queryAndClosePs",
"(",
"PreparedStatement",
"ps",
",",
"RsHandler",
"<",
"T",
">",
"rsh",
",",
"Object",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"return",
"query",
"(",
"ps",
",",
"rsh",
... | 执行查询语句并关闭PreparedStatement
@param <T> 处理结果类型
@param ps PreparedStatement
@param rsh 结果集处理对象
@param params 参数
@return 结果对象
@throws SQLException SQL执行异常 | [
"执行查询语句并关闭PreparedStatement"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L327-L333 | train | Query and close a prepared statement. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
23032,
5685,
20464,
9232,
4523,
1006,
4810,
9153,
18532,
4765,
8827,
1010,
12667,
11774,
3917,
1026,
1056,
1028,
12667,
2232,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
29296,
10288,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/loader/AtomicLoader.java | AtomicLoader.get | @Override
public T get() {
T result = reference.get();
if (result == null) {
result = init();
if (false == reference.compareAndSet(null, result)) {
// 其它线程已经创建好此对象
result = reference.get();
}
}
return result;
} | java | @Override
public T get() {
T result = reference.get();
if (result == null) {
result = init();
if (false == reference.compareAndSet(null, result)) {
// 其它线程已经创建好此对象
result = reference.get();
}
}
return result;
} | [
"@",
"Override",
"public",
"T",
"get",
"(",
")",
"{",
"T",
"result",
"=",
"reference",
".",
"get",
"(",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"init",
"(",
")",
";",
"if",
"(",
"false",
"==",
"reference",
".",
"co... | 获取一个对象,第一次调用此方法时初始化对象然后返回,之后调用此方法直接返回原对象 | [
"获取一个对象,第一次调用此方法时初始化对象然后返回,之后调用此方法直接返回原对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/loader/AtomicLoader.java#L27-L40 | train | Gets the reference. | [
30522,
1030,
2058,
15637,
2270,
1056,
2131,
1006,
1007,
1063,
1056,
2765,
1027,
4431,
1012,
2131,
1006,
1007,
1025,
2065,
1006,
2765,
1027,
1027,
19701,
1007,
1063,
2765,
1027,
1999,
4183,
1006,
1007,
1025,
2065,
1006,
6270,
1027,
1027,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.getAggregate | protected SqlNode getAggregate(SqlSelect select) {
SqlNode node = select.getGroup();
if (node != null) {
return node;
}
node = select.getHaving();
if (node != null) {
return node;
}
return getAgg(select);
} | java | protected SqlNode getAggregate(SqlSelect select) {
SqlNode node = select.getGroup();
if (node != null) {
return node;
}
node = select.getHaving();
if (node != null) {
return node;
}
return getAgg(select);
} | [
"protected",
"SqlNode",
"getAggregate",
"(",
"SqlSelect",
"select",
")",
"{",
"SqlNode",
"node",
"=",
"select",
".",
"getGroup",
"(",
")",
";",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"return",
"node",
";",
"}",
"node",
"=",
"select",
".",
"getHavin... | Returns the parse tree node (GROUP BY, HAVING, or an aggregate function
call) that causes {@code select} to be an aggregate query, or null if it
is not an aggregate query.
<p>The node is useful context for error messages,
but you cannot assume that the node is the only aggregate function. | [
"Returns",
"the",
"parse",
"tree",
"node",
"(",
"GROUP",
"BY",
"HAVING",
"or",
"an",
"aggregate",
"function",
"call",
")",
"that",
"causes",
"{",
"@code",
"select",
"}",
"to",
"be",
"an",
"aggregate",
"query",
"or",
"null",
"if",
"it",
"is",
"not",
"an... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2775-L2785 | train | Get the aggregate node. | [
30522,
5123,
29296,
3630,
3207,
2131,
8490,
17603,
5867,
1006,
29296,
11246,
22471,
7276,
1007,
1063,
29296,
3630,
3207,
13045,
1027,
7276,
1012,
2131,
17058,
1006,
1007,
1025,
2065,
1006,
13045,
999,
1027,
19701,
1007,
1063,
2709,
13045,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/NullableSerializer.java | NullableSerializer.wrapIfNullIsNotSupported | public static <T> TypeSerializer<T> wrapIfNullIsNotSupported(
@Nonnull TypeSerializer<T> originalSerializer, boolean padNullValueIfFixedLen) {
return checkIfNullSupported(originalSerializer) ?
originalSerializer : wrap(originalSerializer, padNullValueIfFixedLen);
} | java | public static <T> TypeSerializer<T> wrapIfNullIsNotSupported(
@Nonnull TypeSerializer<T> originalSerializer, boolean padNullValueIfFixedLen) {
return checkIfNullSupported(originalSerializer) ?
originalSerializer : wrap(originalSerializer, padNullValueIfFixedLen);
} | [
"public",
"static",
"<",
"T",
">",
"TypeSerializer",
"<",
"T",
">",
"wrapIfNullIsNotSupported",
"(",
"@",
"Nonnull",
"TypeSerializer",
"<",
"T",
">",
"originalSerializer",
",",
"boolean",
"padNullValueIfFixedLen",
")",
"{",
"return",
"checkIfNullSupported",
"(",
"... | This method tries to serialize {@code null} value with the {@code originalSerializer}
and wraps it in case of {@link NullPointerException}, otherwise it returns the {@code originalSerializer}.
@param originalSerializer serializer to wrap and add {@code null} support
@param padNullValueIfFixedLen pad null value to preserve the fixed length of original serializer
@return serializer which supports {@code null} values | [
"This",
"method",
"tries",
"to",
"serialize",
"{",
"@code",
"null",
"}",
"value",
"with",
"the",
"{",
"@code",
"originalSerializer",
"}",
"and",
"wraps",
"it",
"in",
"case",
"of",
"{",
"@link",
"NullPointerException",
"}",
"otherwise",
"it",
"returns",
"the"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/NullableSerializer.java#L88-L92 | train | Wrap if null is supported. | [
30522,
2270,
10763,
1026,
1056,
1028,
4127,
11610,
28863,
1026,
1056,
1028,
10236,
10128,
11231,
21711,
17048,
6342,
9397,
15613,
1006,
1030,
2512,
11231,
3363,
4127,
11610,
28863,
1026,
1056,
1028,
30524,
23728,
11610,
28863,
1010,
11687,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Schema.java | Schema.toProperties | @Override
public Map<String, String> toProperties() {
DescriptorProperties properties = new DescriptorProperties();
List<Map<String, String>> subKeyValues = new ArrayList<>();
for (Map.Entry<String, LinkedHashMap<String, String>> entry : tableSchema.entrySet()) {
String name = entry.getKey();
LinkedHashMap<String, String> props = entry.getValue();
Map<String, String> map = new HashMap<>();
map.put(SCHEMA_NAME, name);
map.putAll(props);
subKeyValues.add(map);
}
properties.putIndexedVariableProperties(
SCHEMA,
subKeyValues);
return properties.asMap();
} | java | @Override
public Map<String, String> toProperties() {
DescriptorProperties properties = new DescriptorProperties();
List<Map<String, String>> subKeyValues = new ArrayList<>();
for (Map.Entry<String, LinkedHashMap<String, String>> entry : tableSchema.entrySet()) {
String name = entry.getKey();
LinkedHashMap<String, String> props = entry.getValue();
Map<String, String> map = new HashMap<>();
map.put(SCHEMA_NAME, name);
map.putAll(props);
subKeyValues.add(map);
}
properties.putIndexedVariableProperties(
SCHEMA,
subKeyValues);
return properties.asMap();
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"String",
">",
"toProperties",
"(",
")",
"{",
"DescriptorProperties",
"properties",
"=",
"new",
"DescriptorProperties",
"(",
")",
";",
"List",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"subKey... | Converts this descriptor into a set of properties. | [
"Converts",
"this",
"descriptor",
"into",
"a",
"set",
"of",
"properties",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Schema.java#L151-L167 | train | Returns a map of the schema to the descriptor properties. | [
30522,
1030,
2058,
15637,
2270,
4949,
1026,
5164,
1010,
5164,
1028,
2327,
18981,
8743,
3111,
1006,
1007,
1063,
4078,
23235,
2953,
21572,
4842,
7368,
5144,
1027,
2047,
4078,
23235,
2953,
21572,
4842,
7368,
1006,
1007,
1025,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/synonym/Synonym.java | Synonym.create | public static List<Synonym> create(String param)
{
if (param == null) return null;
String[] args = param.split(" ");
return create(args);
} | java | public static List<Synonym> create(String param)
{
if (param == null) return null;
String[] args = param.split(" ");
return create(args);
} | [
"public",
"static",
"List",
"<",
"Synonym",
">",
"create",
"(",
"String",
"param",
")",
"{",
"if",
"(",
"param",
"==",
"null",
")",
"return",
"null",
";",
"String",
"[",
"]",
"args",
"=",
"param",
".",
"split",
"(",
"\" \"",
")",
";",
"return",
"cr... | 通过类似 Bh06A32= 番茄 西红柿 的字符串构造一系列同义词
@param param
@return | [
"通过类似",
"Bh06A32",
"=",
"番茄",
"西红柿",
"的字符串构造一系列同义词"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/synonym/Synonym.java#L71-L76 | train | Create a list of synonyms from a string. | [
30522,
2270,
10763,
2862,
1026,
10675,
1028,
3443,
1006,
5164,
11498,
2213,
1007,
1063,
2065,
1006,
11498,
2213,
1027,
1027,
19701,
1007,
2709,
19701,
1025,
5164,
1031,
1033,
12098,
5620,
1027,
11498,
2213,
1012,
3975,
1006,
1000,
1000,
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/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java | HttpAuthUtils.getUserNameFromCookieToken | public static String getUserNameFromCookieToken(String tokenStr) {
Map<String, String> map = splitCookieToken(tokenStr);
if (!map.keySet().equals(COOKIE_ATTRIBUTES)) {
LOG.error("Invalid token with missing attributes " + tokenStr);
return null;
}
return map.get(COOKIE_CLIENT_USER_NAME);
} | java | public static String getUserNameFromCookieToken(String tokenStr) {
Map<String, String> map = splitCookieToken(tokenStr);
if (!map.keySet().equals(COOKIE_ATTRIBUTES)) {
LOG.error("Invalid token with missing attributes " + tokenStr);
return null;
}
return map.get(COOKIE_CLIENT_USER_NAME);
} | [
"public",
"static",
"String",
"getUserNameFromCookieToken",
"(",
"String",
"tokenStr",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"splitCookieToken",
"(",
"tokenStr",
")",
";",
"if",
"(",
"!",
"map",
".",
"keySet",
"(",
")",
".",
"eq... | Parses a cookie token to retrieve client user name.
@param tokenStr Token String.
@return A valid user name if input is of valid format, else returns null. | [
"Parses",
"a",
"cookie",
"token",
"to",
"retrieve",
"client",
"user",
"name",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java#L108-L116 | train | Get the username from the cookie token | [
30522,
2270,
10763,
5164,
2131,
20330,
18442,
19699,
5358,
3597,
23212,
18903,
7520,
1006,
5164,
19204,
3367,
2099,
1007,
1063,
4949,
1026,
5164,
1010,
5164,
1028,
4949,
1027,
3975,
3597,
23212,
18903,
7520,
1006,
19204,
3367,
2099,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.setDeprecatedProperties | public void setDeprecatedProperties() {
DeprecationContext deprecations = deprecationContext.get();
Properties props = getProps();
Properties overlay = getOverlay();
for (Map.Entry<String, DeprecatedKeyInfo> entry :
deprecations.getDeprecatedKeyMap().entrySet()) {
String depKey = entry.getKey();
if (!overlay.contains(depKey)) {
for (String newKey : entry.getValue().newKeys) {
String val = overlay.getProperty(newKey);
if (val != null) {
props.setProperty(depKey, val);
overlay.setProperty(depKey, val);
break;
}
}
}
}
} | java | public void setDeprecatedProperties() {
DeprecationContext deprecations = deprecationContext.get();
Properties props = getProps();
Properties overlay = getOverlay();
for (Map.Entry<String, DeprecatedKeyInfo> entry :
deprecations.getDeprecatedKeyMap().entrySet()) {
String depKey = entry.getKey();
if (!overlay.contains(depKey)) {
for (String newKey : entry.getValue().newKeys) {
String val = overlay.getProperty(newKey);
if (val != null) {
props.setProperty(depKey, val);
overlay.setProperty(depKey, val);
break;
}
}
}
}
} | [
"public",
"void",
"setDeprecatedProperties",
"(",
")",
"{",
"DeprecationContext",
"deprecations",
"=",
"deprecationContext",
".",
"get",
"(",
")",
";",
"Properties",
"props",
"=",
"getProps",
"(",
")",
";",
"Properties",
"overlay",
"=",
"getOverlay",
"(",
")",
... | Sets all deprecated properties that are not currently set but have a
corresponding new property that is set. Useful for iterating the
properties when all deprecated properties for currently set properties
need to be present. | [
"Sets",
"all",
"deprecated",
"properties",
"that",
"are",
"not",
"currently",
"set",
"but",
"have",
"a",
"corresponding",
"new",
"property",
"that",
"is",
"set",
".",
"Useful",
"for",
"iterating",
"the",
"properties",
"when",
"all",
"deprecated",
"properties",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L578-L596 | train | Sets the properties of the deprecated properties. | [
30522,
2270,
11675,
2275,
3207,
28139,
12921,
21572,
4842,
7368,
1006,
1007,
1063,
2139,
28139,
10719,
8663,
18209,
2139,
28139,
10719,
2015,
1027,
2139,
28139,
10719,
8663,
18209,
1012,
2131,
1006,
1007,
1025,
5144,
24387,
1027,
2131,
21572,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/algorithm/MaxHeap.java | MaxHeap.addAll | public MaxHeap<E> addAll(Collection<E> collection)
{
for (E e : collection)
{
add(e);
}
return this;
} | java | public MaxHeap<E> addAll(Collection<E> collection)
{
for (E e : collection)
{
add(e);
}
return this;
} | [
"public",
"MaxHeap",
"<",
"E",
">",
"addAll",
"(",
"Collection",
"<",
"E",
">",
"collection",
")",
"{",
"for",
"(",
"E",
"e",
":",
"collection",
")",
"{",
"add",
"(",
"e",
")",
";",
"}",
"return",
"this",
";",
"}"
] | 添加许多元素
@param collection | [
"添加许多元素"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/MaxHeap.java#L74-L82 | train | Add all the elements in the given collection to this object. | [
30522,
2270,
4098,
20192,
2361,
1026,
1041,
1028,
5587,
8095,
1006,
3074,
1026,
1041,
1028,
3074,
1007,
1063,
2005,
1006,
1041,
1041,
1024,
3074,
1007,
1063,
5587,
1006,
1041,
1007,
1025,
1065,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/JobMetricGroup.java | JobMetricGroup.putVariables | @Override
protected void putVariables(Map<String, String> variables) {
variables.put(ScopeFormat.SCOPE_JOB_ID, jobId.toString());
variables.put(ScopeFormat.SCOPE_JOB_NAME, jobName);
} | java | @Override
protected void putVariables(Map<String, String> variables) {
variables.put(ScopeFormat.SCOPE_JOB_ID, jobId.toString());
variables.put(ScopeFormat.SCOPE_JOB_NAME, jobName);
} | [
"@",
"Override",
"protected",
"void",
"putVariables",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"variables",
")",
"{",
"variables",
".",
"put",
"(",
"ScopeFormat",
".",
"SCOPE_JOB_ID",
",",
"jobId",
".",
"toString",
"(",
")",
")",
";",
"variables",
... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/JobMetricGroup.java#L80-L84 | train | Override this method to add the variables to the map. | [
30522,
1030,
2058,
15637,
5123,
11675,
2404,
10755,
19210,
2015,
1006,
4949,
1026,
5164,
1010,
5164,
1028,
10857,
1007,
1063,
10857,
1012,
2404,
1006,
9531,
14192,
4017,
1012,
9531,
1035,
3105,
1035,
8909,
1010,
3105,
3593,
1012,
2000,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java | OnJavaCondition.isWithin | private boolean isWithin(JavaVersion runningVersion, Range range,
JavaVersion version) {
if (range == Range.EQUAL_OR_NEWER) {
return runningVersion.isEqualOrNewerThan(version);
}
if (range == Range.OLDER_THAN) {
return runningVersion.isOlderThan(version);
}
throw new IllegalStateException("Unknown range " + range);
} | java | private boolean isWithin(JavaVersion runningVersion, Range range,
JavaVersion version) {
if (range == Range.EQUAL_OR_NEWER) {
return runningVersion.isEqualOrNewerThan(version);
}
if (range == Range.OLDER_THAN) {
return runningVersion.isOlderThan(version);
}
throw new IllegalStateException("Unknown range " + range);
} | [
"private",
"boolean",
"isWithin",
"(",
"JavaVersion",
"runningVersion",
",",
"Range",
"range",
",",
"JavaVersion",
"version",
")",
"{",
"if",
"(",
"range",
"==",
"Range",
".",
"EQUAL_OR_NEWER",
")",
"{",
"return",
"runningVersion",
".",
"isEqualOrNewerThan",
"("... | Determines if the {@code runningVersion} is within the specified range of versions.
@param runningVersion the current version.
@param range the range
@param version the bounds of the range
@return if this version is within the specified range | [
"Determines",
"if",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnJavaCondition.java#L71-L80 | train | Checks if the given version is within the given range. | [
30522,
2797,
22017,
20898,
2003,
24415,
2378,
1006,
9262,
27774,
2770,
27774,
1010,
2846,
2846,
1010,
9262,
27774,
2544,
1007,
1063,
2065,
1006,
2846,
1027,
1027,
2846,
1012,
5020,
1035,
2030,
1035,
10947,
1007,
1063,
2709,
2770,
27774,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/internal/utils/configuration/StandaloneConfiguration.java | StandaloneConfiguration.isMergeAble | protected boolean isMergeAble(Class<?> targetType, Object other, Object target) {
// don't merge a null value
if (other == null) {
return false;
} else {
// allow any non-null value to merge over a null target.
if (target == null) {
return true;
}
}
// we know we have two objects with value.. Make sure the types are the same and
// perform additional checks.
if (!targetType.isAssignableFrom(target.getClass()) ||
!targetType.isAssignableFrom(other.getClass())) {
return false;
}
if (target instanceof Collection) {
return !((Collection<?>) other).isEmpty();
}
if (target instanceof Map) {
return !((Map<?, ?>) other).isEmpty();
}
return true;
} | java | protected boolean isMergeAble(Class<?> targetType, Object other, Object target) {
// don't merge a null value
if (other == null) {
return false;
} else {
// allow any non-null value to merge over a null target.
if (target == null) {
return true;
}
}
// we know we have two objects with value.. Make sure the types are the same and
// perform additional checks.
if (!targetType.isAssignableFrom(target.getClass()) ||
!targetType.isAssignableFrom(other.getClass())) {
return false;
}
if (target instanceof Collection) {
return !((Collection<?>) other).isEmpty();
}
if (target instanceof Map) {
return !((Map<?, ?>) other).isEmpty();
}
return true;
} | [
"protected",
"boolean",
"isMergeAble",
"(",
"Class",
"<",
"?",
">",
"targetType",
",",
"Object",
"other",
",",
"Object",
"target",
")",
"{",
"// don't merge a null value",
"if",
"(",
"other",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{"... | Determines if one object can be merged onto another object. Checks for {@code null},
and empty (Collections & Maps) to make decision.
@param targetType The type that both {@code other} and {@code target} must be assignable to.
@param other the object to merge. must be the same type as the 'target'.
@param target the object to merge on to. must be the same type as the 'other'.
@return whether the 'other' can be merged onto the 'target'. | [
"Determines",
"if",
"one",
"object",
"can",
"be",
"merged",
"onto",
"another",
"object",
".",
"Checks",
"for",
"{",
"@code",
"null",
"}",
"and",
"empty",
"(",
"Collections",
"&",
"Maps",
")",
"to",
"make",
"decision",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/utils/configuration/StandaloneConfiguration.java#L207-L234 | train | Checks if the two objects are of the same type and that they are not null. | [
30522,
5123,
22017,
20898,
2003,
5017,
3351,
3085,
1006,
2465,
1026,
1029,
1028,
4539,
13874,
1010,
4874,
2060,
1010,
4874,
4539,
1007,
1063,
1013,
1013,
2123,
1005,
1056,
13590,
1037,
19701,
3643,
2065,
1006,
2060,
1027,
1027,
19701,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | consul/src/main/java/com/networknt/consul/ConsulUtils.java | ConsulUtils.buildService | public static ConsulService buildService(URL url) {
ConsulService service = new ConsulService();
service.setAddress(url.getHost());
service.setId(ConsulUtils.convertConsulSerivceId(url));
service.setName(url.getPath());
service.setPort(url.getPort());
List<String> tags = new ArrayList<String>();
String env = url.getParameter(Constants.TAG_ENVIRONMENT);
if(env != null) tags.add(env);
service.setTags(tags);
return service;
} | java | public static ConsulService buildService(URL url) {
ConsulService service = new ConsulService();
service.setAddress(url.getHost());
service.setId(ConsulUtils.convertConsulSerivceId(url));
service.setName(url.getPath());
service.setPort(url.getPort());
List<String> tags = new ArrayList<String>();
String env = url.getParameter(Constants.TAG_ENVIRONMENT);
if(env != null) tags.add(env);
service.setTags(tags);
return service;
} | [
"public",
"static",
"ConsulService",
"buildService",
"(",
"URL",
"url",
")",
"{",
"ConsulService",
"service",
"=",
"new",
"ConsulService",
"(",
")",
";",
"service",
".",
"setAddress",
"(",
"url",
".",
"getHost",
"(",
")",
")",
";",
"service",
".",
"setId",... | build consul service from url
@param url a URL object
@return ConsulService consul service | [
"build",
"consul",
"service",
"from",
"url"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/consul/src/main/java/com/networknt/consul/ConsulUtils.java#L54-L66 | train | Build a ConsulService from a URL | [
30522,
2270,
10763,
11801,
8043,
7903,
2063,
16473,
2121,
7903,
2063,
1006,
24471,
2140,
24471,
2140,
1007,
1063,
11801,
8043,
7903,
2063,
2326,
1027,
2047,
11801,
8043,
7903,
2063,
1006,
1007,
1025,
2326,
1012,
2275,
4215,
16200,
4757,
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-core/src/main/java/org/apache/flink/util/StringUtils.java | StringUtils.getRandomString | public static String getRandomString(Random rnd, int minLength, int maxLength) {
int len = rnd.nextInt(maxLength - minLength + 1) + minLength;
char[] data = new char[len];
for (int i = 0; i < data.length; i++) {
data[i] = (char) (rnd.nextInt(0x7fff) + 1);
}
return new String(data);
} | java | public static String getRandomString(Random rnd, int minLength, int maxLength) {
int len = rnd.nextInt(maxLength - minLength + 1) + minLength;
char[] data = new char[len];
for (int i = 0; i < data.length; i++) {
data[i] = (char) (rnd.nextInt(0x7fff) + 1);
}
return new String(data);
} | [
"public",
"static",
"String",
"getRandomString",
"(",
"Random",
"rnd",
",",
"int",
"minLength",
",",
"int",
"maxLength",
")",
"{",
"int",
"len",
"=",
"rnd",
".",
"nextInt",
"(",
"maxLength",
"-",
"minLength",
"+",
"1",
")",
"+",
"minLength",
";",
"char",... | Creates a random string with a length within the given interval. The string contains only characters that
can be represented as a single code point.
@param rnd The random used to create the strings.
@param minLength The minimum string length.
@param maxLength The maximum string length (inclusive).
@return A random String. | [
"Creates",
"a",
"random",
"string",
"with",
"a",
"length",
"within",
"the",
"given",
"interval",
".",
"The",
"string",
"contains",
"only",
"characters",
"that",
"can",
"be",
"represented",
"as",
"a",
"single",
"code",
"point",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringUtils.java#L219-L227 | train | Get a random string. | [
30522,
2270,
10763,
5164,
2131,
13033,
22225,
18886,
3070,
1006,
6721,
29300,
2094,
1010,
20014,
8117,
7770,
13512,
2232,
1010,
30524,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
2951,
1012,
3091,
1025,
1045,
1009,
1009,
1007,
1063,
29... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.validateZipCode | public static <T extends CharSequence> T validateZipCode(T value, String errorMsg) throws ValidateException {
if (false == isZipCode(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validateZipCode(T value, String errorMsg) throws ValidateException {
if (false == isZipCode(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateZipCode",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isZipCode",
"(",
"value",
")",
")",
"{",
"throw",
"new",... | 验证是否为邮政编码(中国)
@param <T> 字符串类型
@param value 表单值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证是否为邮政编码(中国)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L625-L630 | train | Validate a zip code. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
9398,
3686,
5831,
15042,
10244,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
1027,
2003,
5831... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-elasticsearch-base/src/main/java/org/apache/flink/streaming/connectors/elasticsearch/util/ElasticsearchUtils.java | ElasticsearchUtils.convertInetSocketAddresses | public static List<TransportAddress> convertInetSocketAddresses(List<InetSocketAddress> inetSocketAddresses) {
if (inetSocketAddresses == null) {
return null;
} else {
List<TransportAddress> converted;
converted = new ArrayList<>(inetSocketAddresses.size());
for (InetSocketAddress address : inetSocketAddresses) {
converted.add(new InetSocketTransportAddress(address));
}
return converted;
}
} | java | public static List<TransportAddress> convertInetSocketAddresses(List<InetSocketAddress> inetSocketAddresses) {
if (inetSocketAddresses == null) {
return null;
} else {
List<TransportAddress> converted;
converted = new ArrayList<>(inetSocketAddresses.size());
for (InetSocketAddress address : inetSocketAddresses) {
converted.add(new InetSocketTransportAddress(address));
}
return converted;
}
} | [
"public",
"static",
"List",
"<",
"TransportAddress",
">",
"convertInetSocketAddresses",
"(",
"List",
"<",
"InetSocketAddress",
">",
"inetSocketAddresses",
")",
"{",
"if",
"(",
"inetSocketAddresses",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{"... | Utility method to convert a {@link List} of {@link InetSocketAddress} to Elasticsearch {@link TransportAddress}.
@param inetSocketAddresses The list of {@link InetSocketAddress} to convert. | [
"Utility",
"method",
"to",
"convert",
"a",
"{",
"@link",
"List",
"}",
"of",
"{",
"@link",
"InetSocketAddress",
"}",
"to",
"Elasticsearch",
"{",
"@link",
"TransportAddress",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/streaming/connectors/elasticsearch/util/ElasticsearchUtils.java#L41-L52 | train | Convert a list of inet socket addresses to a list of transport addresses. | [
30522,
2270,
10763,
2862,
1026,
3665,
4215,
16200,
4757,
1028,
10463,
3170,
3215,
7432,
12928,
14141,
25932,
1006,
2862,
1026,
1999,
8454,
7432,
12928,
14141,
8303,
1028,
1999,
8454,
7432,
12928,
14141,
25932,
1007,
1063,
2065,
1006,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-dfa/src/main/java/cn/hutool/dfa/SensitiveUtil.java | SensitiveUtil.getFindedAllSensitive | public static List<String> getFindedAllSensitive(Object bean){
return sensitiveTree.matchAll(JSONUtil.toJsonStr(bean));
} | java | public static List<String> getFindedAllSensitive(Object bean){
return sensitiveTree.matchAll(JSONUtil.toJsonStr(bean));
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getFindedAllSensitive",
"(",
"Object",
"bean",
")",
"{",
"return",
"sensitiveTree",
".",
"matchAll",
"(",
"JSONUtil",
".",
"toJsonStr",
"(",
"bean",
")",
")",
";",
"}"
] | 查找敏感词,返回找到的所有敏感词
@param bean 对象,会被转为JSON
@return 敏感词 | [
"查找敏感词,返回找到的所有敏感词"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-dfa/src/main/java/cn/hutool/dfa/SensitiveUtil.java#L144-L146 | train | Gets all sensitive fields in the given object. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
2131,
16294,
5732,
8095,
5054,
28032,
3512,
1006,
4874,
14068,
1007,
1063,
2709,
7591,
13334,
1012,
2674,
8095,
1006,
1046,
3385,
21823,
2140,
1012,
2000,
22578,
5644,
16344,
1006,
14068,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointStatsHistory.java | CheckpointStatsHistory.replacePendingCheckpointById | boolean replacePendingCheckpointById(AbstractCheckpointStats completedOrFailed) {
checkArgument(!completedOrFailed.getStatus().isInProgress(), "Not allowed to replace with in progress checkpoints.");
if (readOnly) {
throw new UnsupportedOperationException("Can't create a snapshot of a read-only history.");
}
// Update the latest checkpoint stats
if (completedOrFailed.getStatus().isCompleted()) {
CompletedCheckpointStats completed = (CompletedCheckpointStats) completedOrFailed;
if (completed.getProperties().isSavepoint() &&
(latestSavepoint == null ||
completed.getCheckpointId() > latestSavepoint.getCheckpointId())) {
latestSavepoint = completed;
} else if (latestCompletedCheckpoint == null ||
completed.getCheckpointId() > latestCompletedCheckpoint.getCheckpointId()) {
latestCompletedCheckpoint = completed;
}
} else if (completedOrFailed.getStatus().isFailed()) {
FailedCheckpointStats failed = (FailedCheckpointStats) completedOrFailed;
if (latestFailedCheckpoint == null ||
failed.getCheckpointId() > latestFailedCheckpoint.getCheckpointId()) {
latestFailedCheckpoint = failed;
}
}
if (maxSize == 0) {
return false;
}
long checkpointId = completedOrFailed.getCheckpointId();
// We start searching from the last inserted position. Since the entries
// wrap around the array we search until we are at index 0 and then from
// the end of the array until (start pos + 1).
int startPos = nextPos == checkpointsArray.length ? checkpointsArray.length - 1 : nextPos - 1;
for (int i = startPos; i >= 0; i--) {
if (checkpointsArray[i].getCheckpointId() == checkpointId) {
checkpointsArray[i] = completedOrFailed;
return true;
}
}
for (int i = checkpointsArray.length - 1; i > startPos; i--) {
if (checkpointsArray[i].getCheckpointId() == checkpointId) {
checkpointsArray[i] = completedOrFailed;
return true;
}
}
return false;
} | java | boolean replacePendingCheckpointById(AbstractCheckpointStats completedOrFailed) {
checkArgument(!completedOrFailed.getStatus().isInProgress(), "Not allowed to replace with in progress checkpoints.");
if (readOnly) {
throw new UnsupportedOperationException("Can't create a snapshot of a read-only history.");
}
// Update the latest checkpoint stats
if (completedOrFailed.getStatus().isCompleted()) {
CompletedCheckpointStats completed = (CompletedCheckpointStats) completedOrFailed;
if (completed.getProperties().isSavepoint() &&
(latestSavepoint == null ||
completed.getCheckpointId() > latestSavepoint.getCheckpointId())) {
latestSavepoint = completed;
} else if (latestCompletedCheckpoint == null ||
completed.getCheckpointId() > latestCompletedCheckpoint.getCheckpointId()) {
latestCompletedCheckpoint = completed;
}
} else if (completedOrFailed.getStatus().isFailed()) {
FailedCheckpointStats failed = (FailedCheckpointStats) completedOrFailed;
if (latestFailedCheckpoint == null ||
failed.getCheckpointId() > latestFailedCheckpoint.getCheckpointId()) {
latestFailedCheckpoint = failed;
}
}
if (maxSize == 0) {
return false;
}
long checkpointId = completedOrFailed.getCheckpointId();
// We start searching from the last inserted position. Since the entries
// wrap around the array we search until we are at index 0 and then from
// the end of the array until (start pos + 1).
int startPos = nextPos == checkpointsArray.length ? checkpointsArray.length - 1 : nextPos - 1;
for (int i = startPos; i >= 0; i--) {
if (checkpointsArray[i].getCheckpointId() == checkpointId) {
checkpointsArray[i] = completedOrFailed;
return true;
}
}
for (int i = checkpointsArray.length - 1; i > startPos; i--) {
if (checkpointsArray[i].getCheckpointId() == checkpointId) {
checkpointsArray[i] = completedOrFailed;
return true;
}
}
return false;
} | [
"boolean",
"replacePendingCheckpointById",
"(",
"AbstractCheckpointStats",
"completedOrFailed",
")",
"{",
"checkArgument",
"(",
"!",
"completedOrFailed",
".",
"getStatus",
"(",
")",
".",
"isInProgress",
"(",
")",
",",
"\"Not allowed to replace with in progress checkpoints.\""... | Searches for the in progress checkpoint with the given ID and replaces
it with the given completed or failed checkpoint.
<p>This is bounded by the maximum number of concurrent in progress
checkpointsArray, which means that the runtime of this is constant.
@param completedOrFailed The completed or failed checkpoint to replace the in progress checkpoint with.
@return <code>true</code> if the checkpoint was replaced or <code>false</code> otherwise. | [
"Searches",
"for",
"the",
"in",
"progress",
"checkpoint",
"with",
"the",
"given",
"ID",
"and",
"replaces",
"it",
"with",
"the",
"given",
"completed",
"or",
"failed",
"checkpoint",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointStatsHistory.java#L255-L310 | train | Replace the pending checkpoint with the given checkpoint id. | [
30522,
22017,
20898,
5672,
11837,
4667,
5403,
3600,
8400,
3762,
3593,
1006,
10061,
5403,
3600,
26521,
29336,
2015,
2949,
16347,
17440,
1007,
1063,
4638,
2906,
22850,
4765,
30524,
2015,
1012,
1000,
1007,
1025,
2065,
1006,
3191,
2239,
2135,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.mkParentDirs | public static File mkParentDirs(String path) {
if (path == null) {
return null;
}
return mkParentDirs(file(path));
} | java | public static File mkParentDirs(String path) {
if (path == null) {
return null;
}
return mkParentDirs(file(path));
} | [
"public",
"static",
"File",
"mkParentDirs",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"mkParentDirs",
"(",
"file",
"(",
"path",
")",
")",
";",
"}"
] | 创建父文件夹,如果存在直接返回此文件夹
@param path 文件夹路径,使用POSIX格式,无论哪个平台
@return 创建的目录 | [
"创建父文件夹,如果存在直接返回此文件夹"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L671-L676 | train | Create the parent directories for a file or directory. | [
30522,
2270,
10763,
5371,
12395,
19362,
4765,
4305,
2869,
1006,
5164,
4130,
1007,
1063,
2065,
1006,
4130,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
12395,
19362,
4765,
4305,
2869,
1006,
5371,
1006,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-api-java/src/main/java/org/apache/flink/table/catalog/GenericInMemoryCatalog.java | GenericInMemoryCatalog.createPartition | @Override
public void createPartition(ObjectPath tablePath, CatalogPartitionSpec partitionSpec, CatalogPartition partition, boolean ignoreIfExists)
throws TableNotExistException, TableNotPartitionedException, PartitionSpecInvalidException, PartitionAlreadyExistsException, CatalogException {
validatePartitionSpec(tablePath, partitionSpec);
if (partitionExists(tablePath, partitionSpec)) {
if (!ignoreIfExists) {
throw new PartitionAlreadyExistsException(catalogName, tablePath, partitionSpec);
}
} else {
partitions.get(tablePath).put(partitionSpec, partition.copy());
}
} | java | @Override
public void createPartition(ObjectPath tablePath, CatalogPartitionSpec partitionSpec, CatalogPartition partition, boolean ignoreIfExists)
throws TableNotExistException, TableNotPartitionedException, PartitionSpecInvalidException, PartitionAlreadyExistsException, CatalogException {
validatePartitionSpec(tablePath, partitionSpec);
if (partitionExists(tablePath, partitionSpec)) {
if (!ignoreIfExists) {
throw new PartitionAlreadyExistsException(catalogName, tablePath, partitionSpec);
}
} else {
partitions.get(tablePath).put(partitionSpec, partition.copy());
}
} | [
"@",
"Override",
"public",
"void",
"createPartition",
"(",
"ObjectPath",
"tablePath",
",",
"CatalogPartitionSpec",
"partitionSpec",
",",
"CatalogPartition",
"partition",
",",
"boolean",
"ignoreIfExists",
")",
"throws",
"TableNotExistException",
",",
"TableNotPartitionedExce... | ------ partitions ------ | [
"------",
"partitions",
"------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/GenericInMemoryCatalog.java#L377-L390 | train | Create a partition. | [
30522,
1030,
2058,
15637,
2270,
11675,
3443,
19362,
3775,
3508,
1006,
4874,
15069,
2795,
15069,
1010,
12105,
19362,
3775,
9285,
5051,
2278,
13571,
13102,
8586,
1010,
12105,
19362,
3775,
3508,
13571,
1010,
22017,
20898,
8568,
29323,
9048,
1283... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.isMatchName | public static boolean isMatchName(Object bean, String beanClassName, boolean isSimple) {
return ClassUtil.getClassName(bean, isSimple).equals(isSimple ? StrUtil.upperFirst(beanClassName) : beanClassName);
} | java | public static boolean isMatchName(Object bean, String beanClassName, boolean isSimple) {
return ClassUtil.getClassName(bean, isSimple).equals(isSimple ? StrUtil.upperFirst(beanClassName) : beanClassName);
} | [
"public",
"static",
"boolean",
"isMatchName",
"(",
"Object",
"bean",
",",
"String",
"beanClassName",
",",
"boolean",
"isSimple",
")",
"{",
"return",
"ClassUtil",
".",
"getClassName",
"(",
"bean",
",",
"isSimple",
")",
".",
"equals",
"(",
"isSimple",
"?",
"St... | 给定的Bean的类名是否匹配指定类名字符串<br>
如果isSimple为{@code false},则只匹配类名而忽略包名,例如:cn.hutool.TestEntity只匹配TestEntity<br>
如果isSimple为{@code true},则匹配包括包名的全类名,例如:cn.hutool.TestEntity匹配cn.hutool.TestEntity
@param bean Bean
@param beanClassName Bean的类名
@param isSimple 是否只匹配类名而忽略包名,true表示忽略包名
@return 是否匹配
@since 4.0.6 | [
"给定的Bean的类名是否匹配指定类名字符串<br",
">",
"如果isSimple为",
"{",
"@code",
"false",
"}",
",则只匹配类名而忽略包名,例如:cn",
".",
"hutool",
".",
"TestEntity只匹配TestEntity<br",
">",
"如果isSimple为",
"{",
"@code",
"true",
"}",
",则匹配包括包名的全类名,例如:cn",
".",
"hutool",
".",
"TestEntity匹配cn",
".",
"hutool"... | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L635-L637 | train | Checks if the bean class name is the same as the class name of the bean. | [
30522,
2270,
10763,
22017,
20898,
2003,
18900,
2818,
18442,
1006,
4874,
14068,
1010,
5164,
14068,
26266,
18442,
1010,
22017,
20898,
26354,
5714,
10814,
1007,
1063,
2709,
2465,
21823,
2140,
1012,
2131,
26266,
18442,
1006,
14068,
1010,
26354,
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... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/RC4.java | RC4.swap | private void swap(int i, int j, int[] sbox) {
int temp = sbox[i];
sbox[i] = sbox[j];
sbox[j] = temp;
} | java | private void swap(int i, int j, int[] sbox) {
int temp = sbox[i];
sbox[i] = sbox[j];
sbox[j] = temp;
} | [
"private",
"void",
"swap",
"(",
"int",
"i",
",",
"int",
"j",
",",
"int",
"[",
"]",
"sbox",
")",
"{",
"int",
"temp",
"=",
"sbox",
"[",
"i",
"]",
";",
"sbox",
"[",
"i",
"]",
"=",
"sbox",
"[",
"j",
"]",
";",
"sbox",
"[",
"j",
"]",
"=",
"temp... | 交换指定两个位置的值
@param i 位置1
@param j 位置2
@param sbox 数组 | [
"交换指定两个位置的值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/symmetric/RC4.java#L166-L170 | train | Swaps the elements of the given box. | [
30522,
2797,
11675,
19948,
1006,
20014,
1045,
1010,
20014,
1046,
1010,
20014,
1031,
1033,
24829,
11636,
1007,
1063,
20014,
8915,
8737,
1027,
24829,
11636,
1031,
1045,
1033,
1025,
24829,
11636,
1031,
1045,
1033,
1027,
24829,
11636,
1031,
1046,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.rpad | public UTF8String rpad(int len, UTF8String pad) {
int spaces = len - this.numChars(); // number of char need to pad
if (spaces <= 0 || pad.numBytes() == 0) {
// no padding at all, return the substring of the current string
return substring(0, len);
} else {
int padChars = pad.numChars();
int count = spaces / padChars; // how many padding string needed
// the partial string of the padding
UTF8String remain = pad.substring(0, spaces - padChars * count);
byte[] data = new byte[this.numBytes + pad.numBytes * count + remain.numBytes];
copyMemory(this.base, this.offset, data, BYTE_ARRAY_OFFSET, this.numBytes);
int offset = this.numBytes;
int idx = 0;
while (idx < count) {
copyMemory(pad.base, pad.offset, data, BYTE_ARRAY_OFFSET + offset, pad.numBytes);
++ idx;
offset += pad.numBytes;
}
copyMemory(remain.base, remain.offset, data, BYTE_ARRAY_OFFSET + offset, remain.numBytes);
return UTF8String.fromBytes(data);
}
} | java | public UTF8String rpad(int len, UTF8String pad) {
int spaces = len - this.numChars(); // number of char need to pad
if (spaces <= 0 || pad.numBytes() == 0) {
// no padding at all, return the substring of the current string
return substring(0, len);
} else {
int padChars = pad.numChars();
int count = spaces / padChars; // how many padding string needed
// the partial string of the padding
UTF8String remain = pad.substring(0, spaces - padChars * count);
byte[] data = new byte[this.numBytes + pad.numBytes * count + remain.numBytes];
copyMemory(this.base, this.offset, data, BYTE_ARRAY_OFFSET, this.numBytes);
int offset = this.numBytes;
int idx = 0;
while (idx < count) {
copyMemory(pad.base, pad.offset, data, BYTE_ARRAY_OFFSET + offset, pad.numBytes);
++ idx;
offset += pad.numBytes;
}
copyMemory(remain.base, remain.offset, data, BYTE_ARRAY_OFFSET + offset, remain.numBytes);
return UTF8String.fromBytes(data);
}
} | [
"public",
"UTF8String",
"rpad",
"(",
"int",
"len",
",",
"UTF8String",
"pad",
")",
"{",
"int",
"spaces",
"=",
"len",
"-",
"this",
".",
"numChars",
"(",
")",
";",
"// number of char need to pad",
"if",
"(",
"spaces",
"<=",
"0",
"||",
"pad",
".",
"numBytes"... | Returns str, right-padded with pad to a length of len
For example:
('hi', 5, '??') => 'hi???'
('hi', 1, '??') => 'h' | [
"Returns",
"str",
"right",
"-",
"padded",
"with",
"pad",
"to",
"a",
"length",
"of",
"len",
"For",
"example",
":",
"(",
"hi",
"5",
"??",
")",
"=",
">",
";",
"hi???",
"(",
"hi",
"1",
"??",
")",
"=",
">",
";",
"h"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L821-L845 | train | Returns a new string of length len with the specified padding string. | [
30522,
2270,
21183,
2546,
2620,
3367,
4892,
1054,
15455,
1006,
20014,
18798,
1010,
21183,
2546,
2620,
3367,
4892,
11687,
1007,
1063,
20014,
7258,
1027,
18798,
1011,
2023,
1012,
16371,
12458,
8167,
2015,
1006,
1007,
1025,
1013,
1013,
2193,
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/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalog/v2/expressions/Expressions.java | Expressions.apply | public Transform apply(String name, Expression... args) {
return LogicalExpressions.apply(name,
JavaConverters.asScalaBuffer(Arrays.asList(args)).toSeq());
} | java | public Transform apply(String name, Expression... args) {
return LogicalExpressions.apply(name,
JavaConverters.asScalaBuffer(Arrays.asList(args)).toSeq());
} | [
"public",
"Transform",
"apply",
"(",
"String",
"name",
",",
"Expression",
"...",
"args",
")",
"{",
"return",
"LogicalExpressions",
".",
"apply",
"(",
"name",
",",
"JavaConverters",
".",
"asScalaBuffer",
"(",
"Arrays",
".",
"asList",
"(",
"args",
")",
")",
... | Create a logical transform for applying a named transform.
<p>
This transform can represent applying any named transform.
@param name the transform name
@param args expression arguments to the transform
@return a logical transform | [
"Create",
"a",
"logical",
"transform",
"for",
"applying",
"a",
"named",
"transform",
".",
"<p",
">",
"This",
"transform",
"can",
"represent",
"applying",
"any",
"named",
"transform",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalog/v2/expressions/Expressions.java#L43-L46 | train | Apply a Logical Expression to a CID | [
30522,
2270,
10938,
6611,
1006,
5164,
2171,
1010,
3670,
1012,
1012,
1012,
12098,
5620,
1007,
1063,
2709,
11177,
10288,
20110,
8496,
1012,
6611,
1006,
2171,
1010,
9262,
8663,
16874,
2545,
1012,
4632,
25015,
8569,
12494,
1006,
27448,
1012,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostStandardRequestDecoder.java | HttpPostStandardRequestDecoder.getBodyHttpData | @Override
public InterfaceHttpData getBodyHttpData(String name) {
checkDestroyed();
if (!isLastChunk) {
throw new NotEnoughDataDecoderException();
}
List<InterfaceHttpData> list = bodyMapHttpData.get(name);
if (list != null) {
return list.get(0);
}
return null;
} | java | @Override
public InterfaceHttpData getBodyHttpData(String name) {
checkDestroyed();
if (!isLastChunk) {
throw new NotEnoughDataDecoderException();
}
List<InterfaceHttpData> list = bodyMapHttpData.get(name);
if (list != null) {
return list.get(0);
}
return null;
} | [
"@",
"Override",
"public",
"InterfaceHttpData",
"getBodyHttpData",
"(",
"String",
"name",
")",
"{",
"checkDestroyed",
"(",
")",
";",
"if",
"(",
"!",
"isLastChunk",
")",
"{",
"throw",
"new",
"NotEnoughDataDecoderException",
"(",
")",
";",
"}",
"List",
"<",
"I... | This getMethod returns the first InterfaceHttpData with the given name from
body.<br>
If chunked, all chunks must have been offered using offer() getMethod. If
not, NotEnoughDataDecoderException will be raised.
@return The first Body InterfaceHttpData with the given name (ignore
case)
@throws NotEnoughDataDecoderException
need more chunks | [
"This",
"getMethod",
"returns",
"the",
"first",
"InterfaceHttpData",
"with",
"the",
"given",
"name",
"from",
"body",
".",
"<br",
">"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostStandardRequestDecoder.java#L250-L262 | train | Gets the body http data. | [
30522,
1030,
2058,
15637,
2270,
8278,
11039,
25856,
2850,
2696,
2131,
23684,
11039,
25856,
2850,
2696,
1006,
5164,
2171,
1007,
1063,
4638,
6155,
13181,
20821,
1006,
1007,
1025,
2065,
1006,
999,
25340,
3367,
20760,
8950,
1007,
1063,
5466,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/PageUtil.java | PageUtil.transToStartEnd | public static int[] transToStartEnd(int pageNo, int pageSize) {
final int start = getStart(pageNo, pageSize);
if (pageSize < 1) {
pageSize = 0;
}
final int end = start + pageSize;
return new int[] { start, end };
} | java | public static int[] transToStartEnd(int pageNo, int pageSize) {
final int start = getStart(pageNo, pageSize);
if (pageSize < 1) {
pageSize = 0;
}
final int end = start + pageSize;
return new int[] { start, end };
} | [
"public",
"static",
"int",
"[",
"]",
"transToStartEnd",
"(",
"int",
"pageNo",
",",
"int",
"pageSize",
")",
"{",
"final",
"int",
"start",
"=",
"getStart",
"(",
"pageNo",
",",
"pageSize",
")",
";",
"if",
"(",
"pageSize",
"<",
"1",
")",
"{",
"pageSize",
... | 将页数和每页条目数转换为开始位置和结束位置<br>
此方法用于不包括结束位置的分页方法<br>
例如:
<pre>
页码:1,每页10 =》 [0, 10]
页码:2,每页10 =》 [10, 20]
……
</pre>
@param pageNo 页码(从1计数)
@param pageSize 每页条目数
@return 第一个数为开始位置,第二个数为结束位置 | [
"将页数和每页条目数转换为开始位置和结束位置<br",
">",
"此方法用于不包括结束位置的分页方法<br",
">",
"例如:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/PageUtil.java#L53-L61 | train | Transposed from start to end. | [
30522,
2270,
10763,
20014,
1031,
1033,
9099,
13122,
7559,
6528,
2094,
1006,
20014,
3931,
3630,
1010,
20014,
5530,
4697,
1007,
1063,
2345,
20014,
2707,
1027,
4152,
7559,
2102,
1006,
3931,
3630,
1010,
5530,
4697,
1007,
1025,
2065,
1006,
5530,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java | BatchTask.initOutputs | @SuppressWarnings("unchecked")
public static <T> Collector<T> initOutputs(AbstractInvokable containingTask, ClassLoader cl, TaskConfig config,
List<ChainedDriver<?, ?>> chainedTasksTarget,
List<RecordWriter<?>> eventualOutputs,
ExecutionConfig executionConfig,
Map<String, Accumulator<?,?>> accumulatorMap)
throws Exception
{
final int numOutputs = config.getNumOutputs();
// check whether we got any chained tasks
final int numChained = config.getNumberOfChainedStubs();
if (numChained > 0) {
// got chained stubs. that means that this one may only have a single forward connection
if (numOutputs != 1 || config.getOutputShipStrategy(0) != ShipStrategyType.FORWARD) {
throw new RuntimeException("Plan Generation Bug: Found a chained stub that is not connected via an only forward connection.");
}
// instantiate each task
@SuppressWarnings("rawtypes")
Collector previous = null;
for (int i = numChained - 1; i >= 0; --i)
{
// get the task first
final ChainedDriver<?, ?> ct;
try {
Class<? extends ChainedDriver<?, ?>> ctc = config.getChainedTask(i);
ct = ctc.newInstance();
}
catch (Exception ex) {
throw new RuntimeException("Could not instantiate chained task driver.", ex);
}
// get the configuration for the task
final TaskConfig chainedStubConf = config.getChainedStubConfig(i);
final String taskName = config.getChainedTaskName(i);
if (i == numChained - 1) {
// last in chain, instantiate the output collector for this task
previous = getOutputCollector(containingTask, chainedStubConf, cl, eventualOutputs, 0, chainedStubConf.getNumOutputs());
}
ct.setup(chainedStubConf, taskName, previous, containingTask, cl, executionConfig, accumulatorMap);
chainedTasksTarget.add(0, ct);
if (i == numChained - 1) {
ct.getIOMetrics().reuseOutputMetricsForTask();
}
previous = ct;
}
// the collector of the first in the chain is the collector for the task
return (Collector<T>) previous;
}
// else
// instantiate the output collector the default way from this configuration
return getOutputCollector(containingTask , config, cl, eventualOutputs, 0, numOutputs);
} | java | @SuppressWarnings("unchecked")
public static <T> Collector<T> initOutputs(AbstractInvokable containingTask, ClassLoader cl, TaskConfig config,
List<ChainedDriver<?, ?>> chainedTasksTarget,
List<RecordWriter<?>> eventualOutputs,
ExecutionConfig executionConfig,
Map<String, Accumulator<?,?>> accumulatorMap)
throws Exception
{
final int numOutputs = config.getNumOutputs();
// check whether we got any chained tasks
final int numChained = config.getNumberOfChainedStubs();
if (numChained > 0) {
// got chained stubs. that means that this one may only have a single forward connection
if (numOutputs != 1 || config.getOutputShipStrategy(0) != ShipStrategyType.FORWARD) {
throw new RuntimeException("Plan Generation Bug: Found a chained stub that is not connected via an only forward connection.");
}
// instantiate each task
@SuppressWarnings("rawtypes")
Collector previous = null;
for (int i = numChained - 1; i >= 0; --i)
{
// get the task first
final ChainedDriver<?, ?> ct;
try {
Class<? extends ChainedDriver<?, ?>> ctc = config.getChainedTask(i);
ct = ctc.newInstance();
}
catch (Exception ex) {
throw new RuntimeException("Could not instantiate chained task driver.", ex);
}
// get the configuration for the task
final TaskConfig chainedStubConf = config.getChainedStubConfig(i);
final String taskName = config.getChainedTaskName(i);
if (i == numChained - 1) {
// last in chain, instantiate the output collector for this task
previous = getOutputCollector(containingTask, chainedStubConf, cl, eventualOutputs, 0, chainedStubConf.getNumOutputs());
}
ct.setup(chainedStubConf, taskName, previous, containingTask, cl, executionConfig, accumulatorMap);
chainedTasksTarget.add(0, ct);
if (i == numChained - 1) {
ct.getIOMetrics().reuseOutputMetricsForTask();
}
previous = ct;
}
// the collector of the first in the chain is the collector for the task
return (Collector<T>) previous;
}
// else
// instantiate the output collector the default way from this configuration
return getOutputCollector(containingTask , config, cl, eventualOutputs, 0, numOutputs);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Collector",
"<",
"T",
">",
"initOutputs",
"(",
"AbstractInvokable",
"containingTask",
",",
"ClassLoader",
"cl",
",",
"TaskConfig",
"config",
",",
"List",
"<",
"ChainedDriver"... | Creates a writer for each output. Creates an OutputCollector which forwards its input to all writers.
The output collector applies the configured shipping strategy. | [
"Creates",
"a",
"writer",
"for",
"each",
"output",
".",
"Creates",
"an",
"OutputCollector",
"which",
"forwards",
"its",
"input",
"to",
"all",
"writers",
".",
"The",
"output",
"collector",
"applies",
"the",
"configured",
"shipping",
"strategy",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java#L1273-L1331 | train | Initialize the outputs for the given task. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
10018,
1026,
1056,
1028,
1999,
9956,
4904,
18780,
2015,
1006,
10061,
2378,
6767,
2912,
3468,
4820,
10230,
2243,
1010,
2465,
1106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ExecutionEnvironment.java | ExecutionEnvironment.fromCollection | public <X> DataSource<X> fromCollection(Iterator<X> data, Class<X> type) {
return fromCollection(data, TypeExtractor.getForClass(type));
} | java | public <X> DataSource<X> fromCollection(Iterator<X> data, Class<X> type) {
return fromCollection(data, TypeExtractor.getForClass(type));
} | [
"public",
"<",
"X",
">",
"DataSource",
"<",
"X",
">",
"fromCollection",
"(",
"Iterator",
"<",
"X",
">",
"data",
",",
"Class",
"<",
"X",
">",
"type",
")",
"{",
"return",
"fromCollection",
"(",
"data",
",",
"TypeExtractor",
".",
"getForClass",
"(",
"type... | Creates a DataSet from the given iterator. Because the iterator will remain unmodified until
the actual execution happens, the type of data returned by the iterator must be given
explicitly in the form of the type class (this is due to the fact that the Java compiler
erases the generic type information).
<p>Note that this operation will result in a non-parallel data source, i.e. a data source with
a parallelism of one.
@param data The collection of elements to create the data set from.
@param type The class of the data produced by the iterator. Must not be a generic class.
@return A DataSet representing the elements in the iterator.
@see #fromCollection(Iterator, TypeInformation) | [
"Creates",
"a",
"DataSet",
"from",
"the",
"given",
"iterator",
".",
"Because",
"the",
"iterator",
"will",
"remain",
"unmodified",
"until",
"the",
"actual",
"execution",
"happens",
"the",
"type",
"of",
"data",
"returned",
"by",
"the",
"iterator",
"must",
"be",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L653-L655 | train | Creates a DataSource from an iterator of data. | [
30522,
2270,
1026,
1060,
1028,
2951,
6499,
3126,
3401,
1026,
1060,
1028,
2013,
26895,
18491,
1006,
2009,
6906,
4263,
1026,
1060,
1028,
2951,
1010,
2465,
1026,
1060,
1028,
2828,
1007,
1063,
2709,
2013,
26895,
18491,
1006,
2951,
1010,
2828,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/maxent/UniformPrior.java | UniformPrior.setLabels | public void setLabels(String[] outcomeLabels)
{
this.numOutcomes = outcomeLabels.length;
r = Math.log(1.0 / numOutcomes);
} | java | public void setLabels(String[] outcomeLabels)
{
this.numOutcomes = outcomeLabels.length;
r = Math.log(1.0 / numOutcomes);
} | [
"public",
"void",
"setLabels",
"(",
"String",
"[",
"]",
"outcomeLabels",
")",
"{",
"this",
".",
"numOutcomes",
"=",
"outcomeLabels",
".",
"length",
";",
"r",
"=",
"Math",
".",
"log",
"(",
"1.0",
"/",
"numOutcomes",
")",
";",
"}"
] | 初始化
@param outcomeLabels | [
"初始化"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/maxent/UniformPrior.java#L46-L50 | train | Sets the labels of the class. | [
30522,
2270,
11675,
2275,
20470,
9050,
1006,
5164,
1031,
1033,
9560,
20470,
9050,
1007,
1063,
2023,
1012,
16371,
5302,
4904,
9006,
2229,
1027,
9560,
20470,
9050,
1012,
3091,
1025,
1054,
1027,
8785,
1012,
8833,
1006,
1015,
1012,
1014,
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... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java | KeyUtil.getKeyPair | public static KeyPair getKeyPair(String type, InputStream in, char[] password, String alias) {
final KeyStore keyStore = readKeyStore(type, in, password);
return getKeyPair(keyStore, password, alias);
} | java | public static KeyPair getKeyPair(String type, InputStream in, char[] password, String alias) {
final KeyStore keyStore = readKeyStore(type, in, password);
return getKeyPair(keyStore, password, alias);
} | [
"public",
"static",
"KeyPair",
"getKeyPair",
"(",
"String",
"type",
",",
"InputStream",
"in",
",",
"char",
"[",
"]",
"password",
",",
"String",
"alias",
")",
"{",
"final",
"KeyStore",
"keyStore",
"=",
"readKeyStore",
"(",
"type",
",",
"in",
",",
"password"... | 从KeyStore中获取私钥公钥
@param type 类型
@param in {@link InputStream} 如果想从文件读取.keystore文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取
@param password 密码
@param alias 别名
@return {@link KeyPair}
@since 4.4.1 | [
"从KeyStore中获取私钥公钥"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L592-L595 | train | Gets a KeyPair from an input stream. | [
30522,
2270,
10763,
3145,
4502,
4313,
2131,
14839,
4502,
4313,
1006,
5164,
2828,
1010,
20407,
25379,
1999,
30524,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/Ordering.java | Ordering.appendOrdering | public Ordering appendOrdering(Integer index, Class<? extends Comparable<?>> type, Order order) {
if (index < 0) {
throw new IllegalArgumentException("The key index must not be negative.");
}
if (order == null) {
throw new NullPointerException();
}
if (order == Order.NONE) {
throw new IllegalArgumentException("An ordering must not be created with a NONE order.");
}
if (!this.indexes.contains(index)) {
this.indexes = this.indexes.addField(index);
this.types.add(type);
this.orders.add(order);
}
return this;
} | java | public Ordering appendOrdering(Integer index, Class<? extends Comparable<?>> type, Order order) {
if (index < 0) {
throw new IllegalArgumentException("The key index must not be negative.");
}
if (order == null) {
throw new NullPointerException();
}
if (order == Order.NONE) {
throw new IllegalArgumentException("An ordering must not be created with a NONE order.");
}
if (!this.indexes.contains(index)) {
this.indexes = this.indexes.addField(index);
this.types.add(type);
this.orders.add(order);
}
return this;
} | [
"public",
"Ordering",
"appendOrdering",
"(",
"Integer",
"index",
",",
"Class",
"<",
"?",
"extends",
"Comparable",
"<",
"?",
">",
">",
"type",
",",
"Order",
"order",
")",
"{",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentExcepti... | Extends this ordering by appending an additional order requirement.
If the index has been previously appended then the unmodified Ordering
is returned.
@param index Field index of the appended order requirement.
@param type Type of the appended order requirement.
@param order Order of the appended order requirement.
@return This ordering with an additional appended order requirement. | [
"Extends",
"this",
"ordering",
"by",
"appending",
"an",
"additional",
"order",
"requirement",
".",
"If",
"the",
"index",
"has",
"been",
"previously",
"appended",
"then",
"the",
"unmodified",
"Ordering",
"is",
"returned",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/Ordering.java#L67-L85 | train | Appends an ordering to this ordering. | [
30522,
2270,
13063,
10439,
10497,
8551,
7999,
1006,
16109,
5950,
1010,
2465,
1026,
1029,
8908,
12435,
1026,
1029,
1028,
1028,
2828,
1010,
2344,
2344,
1007,
1063,
2065,
1006,
5950,
1026,
1014,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/JarClassLoader.java | JarClassLoader.loopJar | private static List<File> loopJar(File file) {
return FileUtil.loopFiles(file, new FileFilter() {
@Override
public boolean accept(File file) {
return isJarFile(file);
}
});
} | java | private static List<File> loopJar(File file) {
return FileUtil.loopFiles(file, new FileFilter() {
@Override
public boolean accept(File file) {
return isJarFile(file);
}
});
} | [
"private",
"static",
"List",
"<",
"File",
">",
"loopJar",
"(",
"File",
"file",
")",
"{",
"return",
"FileUtil",
".",
"loopFiles",
"(",
"file",
",",
"new",
"FileFilter",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"File",
"file",
... | 递归获得Jar文件
@param file jar文件或者包含jar文件的目录
@return jar文件列表 | [
"递归获得Jar文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/JarClassLoader.java#L143-L150 | train | loop jar files | [
30522,
2797,
10763,
2862,
1026,
5371,
1028,
7077,
16084,
1006,
5371,
5371,
1007,
1063,
2709,
5371,
21823,
2140,
1012,
7077,
8873,
4244,
1006,
5371,
1010,
2047,
5371,
8873,
21928,
1006,
1007,
1063,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/VariableLengthRowBasedKeyValueBatch.java | VariableLengthRowBasedKeyValueBatch.rowIterator | @Override
public org.apache.spark.unsafe.KVIterator<UnsafeRow, UnsafeRow> rowIterator() {
return new org.apache.spark.unsafe.KVIterator<UnsafeRow, UnsafeRow>() {
private final UnsafeRow key = new UnsafeRow(keySchema.length());
private final UnsafeRow value = new UnsafeRow(valueSchema.length());
private long offsetInPage = 0;
private int recordsInPage = 0;
private int currentklen;
private int currentvlen;
private int totalLength;
private boolean initialized = false;
private void init() {
if (page != null) {
offsetInPage = page.getBaseOffset();
recordsInPage = numRows;
}
initialized = true;
}
@Override
public boolean next() {
if (!initialized) init();
//searching for the next non empty page is records is now zero
if (recordsInPage == 0) {
freeCurrentPage();
return false;
}
totalLength = Platform.getInt(base, offsetInPage) - 4;
currentklen = Platform.getInt(base, offsetInPage + 4);
currentvlen = totalLength - currentklen;
key.pointTo(base, offsetInPage + 8, currentklen);
value.pointTo(base, offsetInPage + 8 + currentklen, currentvlen);
offsetInPage += 8 + totalLength + 8;
recordsInPage -= 1;
return true;
}
@Override
public UnsafeRow getKey() {
return key;
}
@Override
public UnsafeRow getValue() {
return value;
}
@Override
public void close() {
// do nothing
}
private void freeCurrentPage() {
if (page != null) {
freePage(page);
page = null;
}
}
};
} | java | @Override
public org.apache.spark.unsafe.KVIterator<UnsafeRow, UnsafeRow> rowIterator() {
return new org.apache.spark.unsafe.KVIterator<UnsafeRow, UnsafeRow>() {
private final UnsafeRow key = new UnsafeRow(keySchema.length());
private final UnsafeRow value = new UnsafeRow(valueSchema.length());
private long offsetInPage = 0;
private int recordsInPage = 0;
private int currentklen;
private int currentvlen;
private int totalLength;
private boolean initialized = false;
private void init() {
if (page != null) {
offsetInPage = page.getBaseOffset();
recordsInPage = numRows;
}
initialized = true;
}
@Override
public boolean next() {
if (!initialized) init();
//searching for the next non empty page is records is now zero
if (recordsInPage == 0) {
freeCurrentPage();
return false;
}
totalLength = Platform.getInt(base, offsetInPage) - 4;
currentklen = Platform.getInt(base, offsetInPage + 4);
currentvlen = totalLength - currentklen;
key.pointTo(base, offsetInPage + 8, currentklen);
value.pointTo(base, offsetInPage + 8 + currentklen, currentvlen);
offsetInPage += 8 + totalLength + 8;
recordsInPage -= 1;
return true;
}
@Override
public UnsafeRow getKey() {
return key;
}
@Override
public UnsafeRow getValue() {
return value;
}
@Override
public void close() {
// do nothing
}
private void freeCurrentPage() {
if (page != null) {
freePage(page);
page = null;
}
}
};
} | [
"@",
"Override",
"public",
"org",
".",
"apache",
".",
"spark",
".",
"unsafe",
".",
"KVIterator",
"<",
"UnsafeRow",
",",
"UnsafeRow",
">",
"rowIterator",
"(",
")",
"{",
"return",
"new",
"org",
".",
"apache",
".",
"spark",
".",
"unsafe",
".",
"KVIterator",... | Returns an iterator to go through all rows | [
"Returns",
"an",
"iterator",
"to",
"go",
"through",
"all",
"rows"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/VariableLengthRowBasedKeyValueBatch.java#L112-L178 | train | Returns an iterator over the rows of this table. | [
30522,
1030,
2058,
15637,
2270,
8917,
1012,
15895,
1012,
12125,
1012,
25135,
1012,
24888,
21646,
8844,
1026,
25135,
10524,
1010,
25135,
10524,
1028,
5216,
21646,
8844,
1006,
1007,
1063,
2709,
2047,
8917,
1012,
15895,
1012,
12125,
1012,
25135,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/comparator/ComparatorChain.java | ComparatorChain.setComparator | public ComparatorChain<E> setComparator(final int index, final Comparator<E> comparator) throws IndexOutOfBoundsException {
return setComparator(index, comparator, false);
} | java | public ComparatorChain<E> setComparator(final int index, final Comparator<E> comparator) throws IndexOutOfBoundsException {
return setComparator(index, comparator, false);
} | [
"public",
"ComparatorChain",
"<",
"E",
">",
"setComparator",
"(",
"final",
"int",
"index",
",",
"final",
"Comparator",
"<",
"E",
">",
"comparator",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"return",
"setComparator",
"(",
"index",
",",
"comparator",
",",
... | 替换指定位置的比较器,保持原排序方式
@param index 位置
@param comparator {@link Comparator}
@return this
@exception IndexOutOfBoundsException if index < 0 or index >= size() | [
"替换指定位置的比较器,保持原排序方式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/comparator/ComparatorChain.java#L119-L121 | train | Sets the comparator at the given index. | [
30522,
2270,
4012,
28689,
4263,
24925,
2078,
1026,
1041,
1028,
2275,
9006,
28689,
4263,
1006,
2345,
20014,
5950,
1010,
2345,
4012,
28689,
4263,
1026,
1041,
1028,
4012,
28689,
4263,
1007,
11618,
5950,
5833,
11253,
15494,
3366,
2595,
24422,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2ConnectionHandlerBuilder.java | AbstractHttp2ConnectionHandlerBuilder.server | protected B server(boolean isServer) {
enforceConstraint("server", "connection", connection);
enforceConstraint("server", "codec", decoder);
enforceConstraint("server", "codec", encoder);
this.isServer = isServer;
return self();
} | java | protected B server(boolean isServer) {
enforceConstraint("server", "connection", connection);
enforceConstraint("server", "codec", decoder);
enforceConstraint("server", "codec", encoder);
this.isServer = isServer;
return self();
} | [
"protected",
"B",
"server",
"(",
"boolean",
"isServer",
")",
"{",
"enforceConstraint",
"(",
"\"server\"",
",",
"\"connection\"",
",",
"connection",
")",
";",
"enforceConstraint",
"(",
"\"server\"",
",",
"\"codec\"",
",",
"decoder",
")",
";",
"enforceConstraint",
... | Sets if {@link #build()} will to create a {@link Http2Connection} in server mode ({@code true})
or client mode ({@code false}). | [
"Sets",
"if",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2ConnectionHandlerBuilder.java#L178-L185 | train | Sets the isServer attribute of the Crafter App App. | [
30522,
5123,
1038,
8241,
1006,
22017,
20898,
26354,
2121,
6299,
1007,
1063,
16306,
8663,
20528,
18447,
1006,
1000,
8241,
1000,
1010,
1000,
4434,
1000,
1010,
4434,
1007,
1025,
16306,
8663,
20528,
18447,
1006,
1000,
8241,
1000,
1010,
1000,
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... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java | RequiredParameters.checkAndApplyDefaultValue | private void checkAndApplyDefaultValue(Option o, Map<String, String> data) throws RequiredParametersException {
if (hasNoDefaultValueAndNoValuePassedOnAlternativeName(o, data)) {
throw new RequiredParametersException("No default value for undefined parameter " + o.getName());
}
} | java | private void checkAndApplyDefaultValue(Option o, Map<String, String> data) throws RequiredParametersException {
if (hasNoDefaultValueAndNoValuePassedOnAlternativeName(o, data)) {
throw new RequiredParametersException("No default value for undefined parameter " + o.getName());
}
} | [
"private",
"void",
"checkAndApplyDefaultValue",
"(",
"Option",
"o",
",",
"Map",
"<",
"String",
",",
"String",
">",
"data",
")",
"throws",
"RequiredParametersException",
"{",
"if",
"(",
"hasNoDefaultValueAndNoValuePassedOnAlternativeName",
"(",
"o",
",",
"data",
")",... | else throw an exception | [
"else",
"throw",
"an",
"exception"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java#L121-L125 | train | Check if the default value is set and if not then throw an exception. | [
30522,
2797,
11675,
4638,
13832,
9397,
2135,
3207,
7011,
11314,
10175,
5657,
1006,
5724,
1051,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
2951,
1007,
11618,
3223,
28689,
22828,
3366,
2595,
24422,
1063,
2065,
1006,
8440,
10244,
7011,
11314,
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-setting/src/main/java/cn/hutool/setting/Setting.java | Setting.getSetting | public Setting getSetting(String group) {
final Setting setting = new Setting();
setting.putAll(this.getMap(group));
return setting;
} | java | public Setting getSetting(String group) {
final Setting setting = new Setting();
setting.putAll(this.getMap(group));
return setting;
} | [
"public",
"Setting",
"getSetting",
"(",
"String",
"group",
")",
"{",
"final",
"Setting",
"setting",
"=",
"new",
"Setting",
"(",
")",
";",
"setting",
".",
"putAll",
"(",
"this",
".",
"getMap",
"(",
"group",
")",
")",
";",
"return",
"setting",
";",
"}"
] | 获取group分组下所有配置键值对,组成新的{@link Setting}
@param group 分组
@return {@link Setting} | [
"获取group分组下所有配置键值对,组成新的",
"{",
"@link",
"Setting",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L275-L279 | train | Gets a group of settings. | [
30522,
2270,
4292,
4152,
18319,
3070,
1006,
5164,
2177,
1007,
1063,
2345,
4292,
4292,
1027,
2047,
4292,
1006,
1007,
1025,
4292,
1012,
2404,
8095,
1006,
2023,
1012,
2131,
2863,
2361,
1006,
2177,
1007,
1007,
1025,
2709,
4292,
1025,
1065,
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-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/DoubleParameter.java | DoubleParameter.setMaximumValue | public DoubleParameter setMaximumValue(double maximumValue, boolean inclusive) {
if (hasDefaultValue) {
if (inclusive) {
Util.checkParameter(maximumValue >= defaultValue,
"Maximum value (" + maximumValue + ") must be greater than or equal to default (" + defaultValue + ")");
} else {
Util.checkParameter(maximumValue > defaultValue,
"Maximum value (" + maximumValue + ") must be greater than default (" + defaultValue + ")");
}
} else if (hasMinimumValue) {
if (inclusive && minimumValueInclusive) {
Util.checkParameter(maximumValue >= minimumValue,
"Maximum value (" + maximumValue + ") must be greater than or equal to minimum (" + minimumValue + ")");
} else {
Util.checkParameter(maximumValue > minimumValue,
"Maximum value (" + maximumValue + ") must be greater than minimum (" + minimumValue + ")");
}
}
this.hasMaximumValue = true;
this.maximumValue = maximumValue;
this.maximumValueInclusive = inclusive;
return this;
} | java | public DoubleParameter setMaximumValue(double maximumValue, boolean inclusive) {
if (hasDefaultValue) {
if (inclusive) {
Util.checkParameter(maximumValue >= defaultValue,
"Maximum value (" + maximumValue + ") must be greater than or equal to default (" + defaultValue + ")");
} else {
Util.checkParameter(maximumValue > defaultValue,
"Maximum value (" + maximumValue + ") must be greater than default (" + defaultValue + ")");
}
} else if (hasMinimumValue) {
if (inclusive && minimumValueInclusive) {
Util.checkParameter(maximumValue >= minimumValue,
"Maximum value (" + maximumValue + ") must be greater than or equal to minimum (" + minimumValue + ")");
} else {
Util.checkParameter(maximumValue > minimumValue,
"Maximum value (" + maximumValue + ") must be greater than minimum (" + minimumValue + ")");
}
}
this.hasMaximumValue = true;
this.maximumValue = maximumValue;
this.maximumValueInclusive = inclusive;
return this;
} | [
"public",
"DoubleParameter",
"setMaximumValue",
"(",
"double",
"maximumValue",
",",
"boolean",
"inclusive",
")",
"{",
"if",
"(",
"hasDefaultValue",
")",
"{",
"if",
"(",
"inclusive",
")",
"{",
"Util",
".",
"checkParameter",
"(",
"maximumValue",
">=",
"defaultValu... | Set the maximum value. The maximum value is an acceptable value if and
only if inclusive is set to true.
@param maximumValue the maximum value
@param inclusive whether the maximum value is a valid value
@return this | [
"Set",
"the",
"maximum",
"value",
".",
"The",
"maximum",
"value",
"is",
"an",
"acceptable",
"value",
"if",
"and",
"only",
"if",
"inclusive",
"is",
"set",
"to",
"true",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/DoubleParameter.java#L122-L146 | train | Sets the maximum value. | [
30522,
2270,
3313,
28689,
22828,
2275,
17848,
28591,
10175,
5657,
1006,
3313,
4555,
10175,
5657,
1010,
22017,
20898,
18678,
1007,
1063,
2065,
1006,
2038,
3207,
7011,
11314,
10175,
5657,
1007,
1063,
2065,
1006,
18678,
1007,
1063,
21183,
4014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.writeLines | public static <T> File writeLines(Collection<T> list, String path, String charset) throws IORuntimeException {
return writeLines(list, path, charset, false);
} | java | public static <T> File writeLines(Collection<T> list, String path, String charset) throws IORuntimeException {
return writeLines(list, path, charset, false);
} | [
"public",
"static",
"<",
"T",
">",
"File",
"writeLines",
"(",
"Collection",
"<",
"T",
">",
"list",
",",
"String",
"path",
",",
"String",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"writeLines",
"(",
"list",
",",
"path",
",",
"charset",
... | 将列表写入文件,覆盖模式
@param <T> 集合元素类型
@param list 列表
@param path 绝对路径
@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#L2881-L2883 | train | Write lines from collection to file. | [
30522,
2270,
10763,
1026,
1056,
1028,
5371,
4339,
12735,
1006,
3074,
1026,
1056,
1028,
2862,
1010,
5164,
4130,
1010,
5164,
25869,
13462,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
4339,
12735,
1006,
2862,
1010,
4130,
1010,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.list | public static <T> List<T> list(boolean isLinked, Iterator<T> iter) {
final List<T> list = list(isLinked);
if (null != iter) {
while (iter.hasNext()) {
list.add(iter.next());
}
}
return list;
} | java | public static <T> List<T> list(boolean isLinked, Iterator<T> iter) {
final List<T> list = list(isLinked);
if (null != iter) {
while (iter.hasNext()) {
list.add(iter.next());
}
}
return list;
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"list",
"(",
"boolean",
"isLinked",
",",
"Iterator",
"<",
"T",
">",
"iter",
")",
"{",
"final",
"List",
"<",
"T",
">",
"list",
"=",
"list",
"(",
"isLinked",
")",
";",
"if",
"(",
"null",
"... | 新建一个ArrayList<br>
提供的参数为null时返回空{@link ArrayList}
@param <T> 集合元素类型
@param isLinked 是否新建LinkedList
@param iter {@link Iterator}
@return ArrayList对象
@since 4.1.2 | [
"新建一个ArrayList<br",
">",
"提供的参数为null时返回空",
"{",
"@link",
"ArrayList",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L580-L588 | train | Creates a list of objects that are contained in the specified iterator. | [
30522,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
2862,
1006,
22017,
20898,
2003,
13767,
2098,
1010,
2009,
6906,
4263,
1026,
1056,
1028,
2009,
2121,
1007,
1063,
2345,
2862,
1026,
1056,
1028,
2862,
1027,
2862,
1006,
2003,
13767,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslUtils.java | SslUtils.shortBE | private static short shortBE(ByteBuffer buffer, int offset) {
return buffer.order() == ByteOrder.BIG_ENDIAN ?
buffer.getShort(offset) : ByteBufUtil.swapShort(buffer.getShort(offset));
} | java | private static short shortBE(ByteBuffer buffer, int offset) {
return buffer.order() == ByteOrder.BIG_ENDIAN ?
buffer.getShort(offset) : ByteBufUtil.swapShort(buffer.getShort(offset));
} | [
"private",
"static",
"short",
"shortBE",
"(",
"ByteBuffer",
"buffer",
",",
"int",
"offset",
")",
"{",
"return",
"buffer",
".",
"order",
"(",
")",
"==",
"ByteOrder",
".",
"BIG_ENDIAN",
"?",
"buffer",
".",
"getShort",
"(",
"offset",
")",
":",
"ByteBufUtil",
... | Reads a big-endian short integer from the buffer | [
"Reads",
"a",
"big",
"-",
"endian",
"short",
"integer",
"from",
"the",
"buffer"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslUtils.java#L262-L265 | train | Read a short from the buffer in big - endian order. | [
30522,
2797,
10763,
2460,
2460,
4783,
1006,
24880,
8569,
12494,
17698,
1010,
20014,
16396,
1007,
1063,
2709,
17698,
1012,
2344,
1006,
1007,
1027,
1027,
24880,
8551,
2121,
1012,
2502,
1035,
2203,
2937,
1029,
17698,
1012,
4152,
27794,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-bloomFilter/src/main/java/cn/hutool/bloomfilter/BitSetBloomFilter.java | BitSetBloomFilter.init | public void init(String path, String charset) throws IOException {
BufferedReader reader = FileUtil.getReader(path, charset);
try {
String line;
while(true) {
line = reader.readLine();
if(line == null) {
break;
}
this.add(line);
}
}finally {
IoUtil.close(reader);
}
} | java | public void init(String path, String charset) throws IOException {
BufferedReader reader = FileUtil.getReader(path, charset);
try {
String line;
while(true) {
line = reader.readLine();
if(line == null) {
break;
}
this.add(line);
}
}finally {
IoUtil.close(reader);
}
} | [
"public",
"void",
"init",
"(",
"String",
"path",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"reader",
"=",
"FileUtil",
".",
"getReader",
"(",
"path",
",",
"charset",
")",
";",
"try",
"{",
"String",
"line",
";",
"while",
... | 通过文件初始化过滤器.
@param path 文件路径
@param charset 字符集
@throws IOException IO异常 | [
"通过文件初始化过滤器",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-bloomFilter/src/main/java/cn/hutool/bloomfilter/BitSetBloomFilter.java#L44-L58 | train | Initializes the object with data from the specified file. | [
30522,
2270,
11675,
1999,
4183,
1006,
5164,
4130,
1010,
5164,
25869,
13462,
1007,
11618,
22834,
10288,
24422,
1063,
17698,
2098,
16416,
4063,
8068,
1027,
5371,
21823,
2140,
30524,
2240,
1027,
8068,
1012,
3191,
4179,
1006,
1007,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java | UnsafeExternalSorter.acquireNewPageIfNecessary | private void acquireNewPageIfNecessary(int required) {
if (currentPage == null ||
pageCursor + required > currentPage.getBaseOffset() + currentPage.size()) {
// TODO: try to find space on previous pages
currentPage = allocatePage(required);
pageCursor = currentPage.getBaseOffset();
allocatedPages.add(currentPage);
}
} | java | private void acquireNewPageIfNecessary(int required) {
if (currentPage == null ||
pageCursor + required > currentPage.getBaseOffset() + currentPage.size()) {
// TODO: try to find space on previous pages
currentPage = allocatePage(required);
pageCursor = currentPage.getBaseOffset();
allocatedPages.add(currentPage);
}
} | [
"private",
"void",
"acquireNewPageIfNecessary",
"(",
"int",
"required",
")",
"{",
"if",
"(",
"currentPage",
"==",
"null",
"||",
"pageCursor",
"+",
"required",
">",
"currentPage",
".",
"getBaseOffset",
"(",
")",
"+",
"currentPage",
".",
"size",
"(",
")",
")",... | Allocates more memory in order to insert an additional record. This will request additional
memory from the memory manager and spill if the requested memory can not be obtained.
@param required the required space in the data page, in bytes, including space for storing
the record size. This must be less than or equal to the page size (records
that exceed the page size are handled via a different code path which uses
special overflow pages). | [
"Allocates",
"more",
"memory",
"in",
"order",
"to",
"insert",
"an",
"additional",
"record",
".",
"This",
"will",
"request",
"additional",
"memory",
"from",
"the",
"memory",
"manager",
"and",
"spill",
"if",
"the",
"requested",
"memory",
"can",
"not",
"be",
"o... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L377-L385 | train | Acquires a new page if necessary. | [
30522,
2797,
11675,
9878,
2638,
2860,
13704,
10128,
2638,
9623,
10286,
2100,
1006,
20014,
3223,
1007,
1063,
2065,
1006,
2783,
13704,
1027,
1027,
19701,
1064,
1064,
3931,
10841,
25301,
2099,
1009,
3223,
1028,
2783,
30524,
1013,
1013,
28681,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/domain/EntityScanPackages.java | EntityScanPackages.get | public static EntityScanPackages get(BeanFactory beanFactory) {
// Currently we only store a single base package, but we return a list to
// allow this to change in the future if needed
try {
return beanFactory.getBean(BEAN, EntityScanPackages.class);
}
catch (NoSuchBeanDefinitionException ex) {
return NONE;
}
} | java | public static EntityScanPackages get(BeanFactory beanFactory) {
// Currently we only store a single base package, but we return a list to
// allow this to change in the future if needed
try {
return beanFactory.getBean(BEAN, EntityScanPackages.class);
}
catch (NoSuchBeanDefinitionException ex) {
return NONE;
}
} | [
"public",
"static",
"EntityScanPackages",
"get",
"(",
"BeanFactory",
"beanFactory",
")",
"{",
"// Currently we only store a single base package, but we return a list to",
"// allow this to change in the future if needed",
"try",
"{",
"return",
"beanFactory",
".",
"getBean",
"(",
... | Return the {@link EntityScanPackages} for the given bean factory.
@param beanFactory the source bean factory
@return the {@link EntityScanPackages} for the bean factory (never {@code null}) | [
"Return",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/domain/EntityScanPackages.java#L81-L90 | train | Get the list of EntityScanPackages from the given bean factory. | [
30522,
2270,
10763,
9178,
29378,
23947,
13923,
2131,
1006,
14068,
21450,
14068,
21450,
1007,
1063,
1013,
1013,
2747,
2057,
2069,
3573,
1037,
2309,
2918,
7427,
1010,
2021,
2057,
2709,
1037,
2862,
2000,
1013,
1013,
3499,
2023,
2000,
2689,
199... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CharsetConversion.java | CharsetConversion.getCharset | public static String getCharset(final int id) {
Entry entry = getEntry(id);
if (entry != null) {
return entry.mysqlCharset;
} else {
logger.warn("Unexpect mysql charset: " + id);
return null;
}
} | java | public static String getCharset(final int id) {
Entry entry = getEntry(id);
if (entry != null) {
return entry.mysqlCharset;
} else {
logger.warn("Unexpect mysql charset: " + id);
return null;
}
} | [
"public",
"static",
"String",
"getCharset",
"(",
"final",
"int",
"id",
")",
"{",
"Entry",
"entry",
"=",
"getEntry",
"(",
"id",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"return",
"entry",
".",
"mysqlCharset",
";",
"}",
"else",
"{",
"logge... | Return defined charset name for mysql. | [
"Return",
"defined",
"charset",
"name",
"for",
"mysql",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/CharsetConversion.java#L348-L357 | train | Gets the mysql charset for a single class. | [
30522,
2270,
10763,
5164,
2131,
7507,
22573,
2102,
1006,
2345,
20014,
8909,
1007,
1063,
4443,
4443,
1027,
2131,
4765,
2854,
1006,
8909,
1007,
1025,
2065,
1006,
4443,
999,
1027,
19701,
1007,
1063,
2709,
4443,
1012,
2026,
2015,
4160,
29358,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/webservice/SoapClient.java | SoapClient.sendForMessage | public SOAPMessage sendForMessage() {
final HttpResponse res = sendForResponse();
final MimeHeaders headers = new MimeHeaders();
for (Entry<String, List<String>> entry : res.headers().entrySet()) {
if(StrUtil.isNotEmpty(entry.getKey())) {
headers.setHeader(entry.getKey(), CollUtil.get(entry.getValue(), 0));
}
}
try {
return this.factory.createMessage(headers, res.bodyStream());
} catch (IOException | SOAPException e) {
throw new SoapRuntimeException(e);
}
} | java | public SOAPMessage sendForMessage() {
final HttpResponse res = sendForResponse();
final MimeHeaders headers = new MimeHeaders();
for (Entry<String, List<String>> entry : res.headers().entrySet()) {
if(StrUtil.isNotEmpty(entry.getKey())) {
headers.setHeader(entry.getKey(), CollUtil.get(entry.getValue(), 0));
}
}
try {
return this.factory.createMessage(headers, res.bodyStream());
} catch (IOException | SOAPException e) {
throw new SoapRuntimeException(e);
}
} | [
"public",
"SOAPMessage",
"sendForMessage",
"(",
")",
"{",
"final",
"HttpResponse",
"res",
"=",
"sendForResponse",
"(",
")",
";",
"final",
"MimeHeaders",
"headers",
"=",
"new",
"MimeHeaders",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"List",
"... | 执行Webservice请求,既发送SOAP内容
@return 返回结果 | [
"执行Webservice请求,既发送SOAP内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L397-L410 | train | Sends a SOAP message to the server. | [
30522,
2270,
7815,
7834,
3736,
3351,
4604,
14192,
7971,
4270,
1006,
1007,
1063,
2345,
8299,
6072,
26029,
3366,
24501,
1027,
4604,
29278,
6072,
26029,
3366,
1006,
1007,
1025,
2345,
2771,
4168,
4974,
2545,
20346,
2015,
1027,
2047,
2771,
4168,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java | ResourceUtil.getStreamSafe | public static InputStream getStreamSafe(String resurce) {
try {
return getResourceObj(resurce).getStream();
} catch (NoResourceException e) {
// ignore
}
return null;
} | java | public static InputStream getStreamSafe(String resurce) {
try {
return getResourceObj(resurce).getStream();
} catch (NoResourceException e) {
// ignore
}
return null;
} | [
"public",
"static",
"InputStream",
"getStreamSafe",
"(",
"String",
"resurce",
")",
"{",
"try",
"{",
"return",
"getResourceObj",
"(",
"resurce",
")",
".",
"getStream",
"(",
")",
";",
"}",
"catch",
"(",
"NoResourceException",
"e",
")",
"{",
"// ignore\r",
"}",... | 从ClassPath资源中获取{@link InputStream},当资源不存在时返回null
@param resurce ClassPath资源
@return {@link InputStream}
@since 4.0.3 | [
"从ClassPath资源中获取",
"{",
"@link",
"InputStream",
"}",
",当资源不存在时返回null"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java#L70-L77 | train | Returns an InputStream for reading a resource from a file system. | [
30522,
2270,
10763,
20407,
25379,
4152,
25379,
3736,
7959,
1006,
5164,
24501,
3126,
3401,
1007,
1063,
3046,
1063,
2709,
2131,
6072,
8162,
3401,
16429,
3501,
1006,
24501,
3126,
3401,
1007,
1012,
4152,
25379,
1006,
1007,
1025,
1065,
4608,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/DbUtil.java | DbUtil.getJndiDsWithLog | public static DataSource getJndiDsWithLog(String jndiName) {
try {
return getJndiDs(jndiName);
} catch (DbRuntimeException e) {
log.error(e.getCause(), "Find JNDI datasource error!");
}
return null;
} | java | public static DataSource getJndiDsWithLog(String jndiName) {
try {
return getJndiDs(jndiName);
} catch (DbRuntimeException e) {
log.error(e.getCause(), "Find JNDI datasource error!");
}
return null;
} | [
"public",
"static",
"DataSource",
"getJndiDsWithLog",
"(",
"String",
"jndiName",
")",
"{",
"try",
"{",
"return",
"getJndiDs",
"(",
"jndiName",
")",
";",
"}",
"catch",
"(",
"DbRuntimeException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"e",
".",
"getCause",... | 获得JNDI数据源
@param jndiName JNDI名称
@return 数据源 | [
"获得JNDI数据源"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/DbUtil.java#L208-L215 | train | Get a DataSource from the JNDI database. | [
30522,
2270,
10763,
2951,
6499,
3126,
3401,
2131,
22895,
4305,
5104,
24415,
21197,
1006,
5164,
1046,
16089,
18442,
1007,
1063,
3046,
1063,
2709,
2131,
22895,
4305,
5104,
1006,
1046,
16089,
18442,
1007,
1025,
1065,
4608,
1006,
16962,
15532,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ChannelFlushPromiseNotifier.java | ChannelFlushPromiseNotifier.add | public ChannelFlushPromiseNotifier add(ChannelPromise promise, long pendingDataSize) {
if (promise == null) {
throw new NullPointerException("promise");
}
checkPositiveOrZero(pendingDataSize, "pendingDataSize");
long checkpoint = writeCounter + pendingDataSize;
if (promise instanceof FlushCheckpoint) {
FlushCheckpoint cp = (FlushCheckpoint) promise;
cp.flushCheckpoint(checkpoint);
flushCheckpoints.add(cp);
} else {
flushCheckpoints.add(new DefaultFlushCheckpoint(checkpoint, promise));
}
return this;
} | java | public ChannelFlushPromiseNotifier add(ChannelPromise promise, long pendingDataSize) {
if (promise == null) {
throw new NullPointerException("promise");
}
checkPositiveOrZero(pendingDataSize, "pendingDataSize");
long checkpoint = writeCounter + pendingDataSize;
if (promise instanceof FlushCheckpoint) {
FlushCheckpoint cp = (FlushCheckpoint) promise;
cp.flushCheckpoint(checkpoint);
flushCheckpoints.add(cp);
} else {
flushCheckpoints.add(new DefaultFlushCheckpoint(checkpoint, promise));
}
return this;
} | [
"public",
"ChannelFlushPromiseNotifier",
"add",
"(",
"ChannelPromise",
"promise",
",",
"long",
"pendingDataSize",
")",
"{",
"if",
"(",
"promise",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"promise\"",
")",
";",
"}",
"checkPositiveOrZer... | Add a {@link ChannelPromise} to this {@link ChannelFlushPromiseNotifier} which will be notified after the given
{@code pendingDataSize} was reached. | [
"Add",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/ChannelFlushPromiseNotifier.java#L65-L79 | train | Add a new channel promise to the list of flush checkpoints. | [
30522,
2270,
3149,
10258,
20668,
21572,
28732,
17048,
18095,
5587,
1006,
3149,
21572,
28732,
4872,
1010,
2146,
14223,
2850,
10230,
4697,
1007,
1063,
2065,
1006,
4872,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
30524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java | ExcelReader.read | public <T> List<T> read(int headerRowIndex, int startRowIndex, Class<T> beanType) {
return read(headerRowIndex, startRowIndex, Integer.MAX_VALUE, beanType);
} | java | public <T> List<T> read(int headerRowIndex, int startRowIndex, Class<T> beanType) {
return read(headerRowIndex, startRowIndex, Integer.MAX_VALUE, beanType);
} | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"read",
"(",
"int",
"headerRowIndex",
",",
"int",
"startRowIndex",
",",
"Class",
"<",
"T",
">",
"beanType",
")",
"{",
"return",
"read",
"(",
"headerRowIndex",
",",
"startRowIndex",
",",
"Integer",
".",
"M... | 读取Excel为Bean的列表
@param <T> Bean类型
@param headerRowIndex 标题所在行,如果标题行在读取的内容行中间,这行做为数据将忽略,,从0开始计数
@param startRowIndex 起始行(包含,从0开始计数)
@param beanType 每行对应Bean的类型
@return Map的列表
@since 4.0.1 | [
"读取Excel为Bean的列表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java#L334-L336 | train | Reads a list of objects from the specified row index. | [
30522,
2270,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
3191,
1006,
20014,
20346,
10524,
22254,
10288,
1010,
20014,
2707,
10524,
22254,
10288,
1010,
2465,
1026,
1056,
1028,
14068,
13874,
1007,
1063,
2709,
3191,
1006,
20346,
10524,
22254,
10288... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JavaExecutable.java | JavaExecutable.processBuilder | public ProcessBuilder processBuilder(String... arguments) {
ProcessBuilder processBuilder = new ProcessBuilder(toString());
processBuilder.command().addAll(Arrays.asList(arguments));
return processBuilder;
} | java | public ProcessBuilder processBuilder(String... arguments) {
ProcessBuilder processBuilder = new ProcessBuilder(toString());
processBuilder.command().addAll(Arrays.asList(arguments));
return processBuilder;
} | [
"public",
"ProcessBuilder",
"processBuilder",
"(",
"String",
"...",
"arguments",
")",
"{",
"ProcessBuilder",
"processBuilder",
"=",
"new",
"ProcessBuilder",
"(",
"toString",
"(",
")",
")",
";",
"processBuilder",
".",
"command",
"(",
")",
".",
"addAll",
"(",
"A... | Create a new {@link ProcessBuilder} that will run with the Java executable.
@param arguments the command arguments
@return a {@link ProcessBuilder} | [
"Create",
"a",
"new",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JavaExecutable.java#L56-L60 | train | Create a process builder with the specified arguments. | [
30522,
2270,
2832,
8569,
23891,
2099,
2832,
8569,
23891,
2099,
1006,
5164,
1012,
1012,
1012,
9918,
1007,
1063,
2832,
8569,
23891,
2099,
2832,
8569,
23891,
2099,
1027,
2047,
2832,
8569,
23891,
2099,
1006,
2000,
3367,
4892,
1006,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.contentEquals | public static boolean contentEquals(File file1, File file2) throws IORuntimeException {
boolean file1Exists = file1.exists();
if (file1Exists != file2.exists()) {
return false;
}
if (false == file1Exists) {
// 两个文件都不存在,返回true
return true;
}
if (file1.isDirectory() || file2.isDirectory()) {
// 不比较目录
throw new IORuntimeException("Can't compare directories, only files");
}
if (file1.length() != file2.length()) {
// 文件长度不同
return false;
}
if (equals(file1, file2)) {
// 同一个文件
return true;
}
InputStream input1 = null;
InputStream input2 = null;
try {
input1 = getInputStream(file1);
input2 = getInputStream(file2);
return IoUtil.contentEquals(input1, input2);
} finally {
IoUtil.close(input1);
IoUtil.close(input2);
}
} | java | public static boolean contentEquals(File file1, File file2) throws IORuntimeException {
boolean file1Exists = file1.exists();
if (file1Exists != file2.exists()) {
return false;
}
if (false == file1Exists) {
// 两个文件都不存在,返回true
return true;
}
if (file1.isDirectory() || file2.isDirectory()) {
// 不比较目录
throw new IORuntimeException("Can't compare directories, only files");
}
if (file1.length() != file2.length()) {
// 文件长度不同
return false;
}
if (equals(file1, file2)) {
// 同一个文件
return true;
}
InputStream input1 = null;
InputStream input2 = null;
try {
input1 = getInputStream(file1);
input2 = getInputStream(file2);
return IoUtil.contentEquals(input1, input2);
} finally {
IoUtil.close(input1);
IoUtil.close(input2);
}
} | [
"public",
"static",
"boolean",
"contentEquals",
"(",
"File",
"file1",
",",
"File",
"file2",
")",
"throws",
"IORuntimeException",
"{",
"boolean",
"file1Exists",
"=",
"file1",
".",
"exists",
"(",
")",
";",
"if",
"(",
"file1Exists",
"!=",
"file2",
".",
"exists"... | 比较两个文件内容是否相同<br>
首先比较长度,长度一致再比较内容<br>
此方法来自Apache Commons io
@param file1 文件1
@param file2 文件2
@return 两个文件内容一致返回true,否则false
@throws IORuntimeException IO异常
@since 4.0.6 | [
"比较两个文件内容是否相同<br",
">",
"首先比较长度,长度一致再比较内容<br",
">",
"此方法来自Apache",
"Commons",
"io"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1339-L1376 | train | Checks if two files are equal. | [
30522,
2270,
10763,
22017,
20898,
4180,
2063,
26426,
2015,
1006,
5371,
5371,
2487,
1010,
5371,
5371,
2475,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
22017,
20898,
5371,
2487,
10288,
5130,
1027,
5371,
2487,
1012,
6526,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpRequest.java | HttpRequest.setSSLProtocol | public HttpRequest setSSLProtocol(String protocol) {
if (null == this.ssf) {
try {
this.ssf = SSLSocketFactoryBuilder.create().setProtocol(protocol).build();
} catch (Exception e) {
throw new HttpException(e);
}
}
return this;
} | java | public HttpRequest setSSLProtocol(String protocol) {
if (null == this.ssf) {
try {
this.ssf = SSLSocketFactoryBuilder.create().setProtocol(protocol).build();
} catch (Exception e) {
throw new HttpException(e);
}
}
return this;
} | [
"public",
"HttpRequest",
"setSSLProtocol",
"(",
"String",
"protocol",
")",
"{",
"if",
"(",
"null",
"==",
"this",
".",
"ssf",
")",
"{",
"try",
"{",
"this",
".",
"ssf",
"=",
"SSLSocketFactoryBuilder",
".",
"create",
"(",
")",
".",
"setProtocol",
"(",
"prot... | 设置HTTPS安全连接协议,只针对HTTPS请求,可以使用的协议包括:<br>
<pre>
1. TLSv1.2
2. TLSv1.1
3. SSLv3
...
</pre>
@see SSLSocketFactoryBuilder
@param protocol 协议
@return this | [
"设置HTTPS安全连接协议,只针对HTTPS请求,可以使用的协议包括:<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpRequest.java#L816-L825 | train | Sets the SSL protocol for the request. | [
30522,
2270,
8299,
2890,
15500,
4520,
14540,
21572,
3406,
25778,
1006,
5164,
8778,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
2023,
1012,
7020,
2546,
1007,
1063,
3046,
1063,
2023,
1012,
7020,
2546,
1027,
7020,
4877,
7432,
3388,
21450,
8569,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/ts/BaseChineseDictionary.java | BaseChineseDictionary.load | static boolean load(String path, AhoCorasickDoubleArrayTrie<String> trie, boolean reverse)
{
String datPath = path;
if (reverse)
{
datPath += Predefine.REVERSE_EXT;
}
if (loadDat(datPath, trie)) return true;
// 从文本中载入并且尝试生成dat
TreeMap<String, String> map = new TreeMap<String, String>();
if (!load(map, reverse, path)) return false;
logger.info("正在构建AhoCorasickDoubleArrayTrie,来源:" + path);
trie.build(map);
logger.info("正在缓存双数组" + datPath);
saveDat(datPath, trie, map.entrySet());
return true;
} | java | static boolean load(String path, AhoCorasickDoubleArrayTrie<String> trie, boolean reverse)
{
String datPath = path;
if (reverse)
{
datPath += Predefine.REVERSE_EXT;
}
if (loadDat(datPath, trie)) return true;
// 从文本中载入并且尝试生成dat
TreeMap<String, String> map = new TreeMap<String, String>();
if (!load(map, reverse, path)) return false;
logger.info("正在构建AhoCorasickDoubleArrayTrie,来源:" + path);
trie.build(map);
logger.info("正在缓存双数组" + datPath);
saveDat(datPath, trie, map.entrySet());
return true;
} | [
"static",
"boolean",
"load",
"(",
"String",
"path",
",",
"AhoCorasickDoubleArrayTrie",
"<",
"String",
">",
"trie",
",",
"boolean",
"reverse",
")",
"{",
"String",
"datPath",
"=",
"path",
";",
"if",
"(",
"reverse",
")",
"{",
"datPath",
"+=",
"Predefine",
"."... | 读取词典
@param path
@param trie
@param reverse 是否将其翻转
@return | [
"读取词典"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/ts/BaseChineseDictionary.java#L109-L125 | train | Load a single AhoCorasickDoubleArrayTrie. | [
30522,
10763,
22017,
20898,
7170,
1006,
5164,
4130,
1010,
6289,
24163,
8180,
6799,
26797,
3468,
2906,
9447,
18886,
2063,
1026,
5164,
1028,
13012,
2063,
1010,
22017,
20898,
7901,
1007,
1063,
5164,
23755,
15069,
1027,
4130,
1025,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/MemoryLogger.java | MemoryLogger.getMemoryPoolStatsAsString | public static String getMemoryPoolStatsAsString(List<MemoryPoolMXBean> poolBeans) {
StringBuilder bld = new StringBuilder("Off-heap pool stats: ");
int count = 0;
for (MemoryPoolMXBean bean : poolBeans) {
if (bean.getType() == MemoryType.NON_HEAP) {
if (count > 0) {
bld.append(", ");
}
count++;
MemoryUsage usage = bean.getUsage();
long used = usage.getUsed() >> 20;
long committed = usage.getCommitted() >> 20;
long max = usage.getMax() >> 20;
bld.append('[').append(bean.getName()).append(": ");
bld.append(used).append('/').append(committed).append('/').append(max);
bld.append(" MB (used/committed/max)]");
}
}
return bld.toString();
} | java | public static String getMemoryPoolStatsAsString(List<MemoryPoolMXBean> poolBeans) {
StringBuilder bld = new StringBuilder("Off-heap pool stats: ");
int count = 0;
for (MemoryPoolMXBean bean : poolBeans) {
if (bean.getType() == MemoryType.NON_HEAP) {
if (count > 0) {
bld.append(", ");
}
count++;
MemoryUsage usage = bean.getUsage();
long used = usage.getUsed() >> 20;
long committed = usage.getCommitted() >> 20;
long max = usage.getMax() >> 20;
bld.append('[').append(bean.getName()).append(": ");
bld.append(used).append('/').append(committed).append('/').append(max);
bld.append(" MB (used/committed/max)]");
}
}
return bld.toString();
} | [
"public",
"static",
"String",
"getMemoryPoolStatsAsString",
"(",
"List",
"<",
"MemoryPoolMXBean",
">",
"poolBeans",
")",
"{",
"StringBuilder",
"bld",
"=",
"new",
"StringBuilder",
"(",
"\"Off-heap pool stats: \"",
")",
";",
"int",
"count",
"=",
"0",
";",
"for",
"... | Gets the memory pool statistics from the JVM.
@param poolBeans The collection of memory pool beans.
@return A string denoting the names and sizes of the memory pools. | [
"Gets",
"the",
"memory",
"pool",
"statistics",
"from",
"the",
"JVM",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/MemoryLogger.java#L200-L223 | train | Get the memory pool stats as string. | [
30522,
2270,
10763,
5164,
2131,
4168,
5302,
2854,
16869,
9153,
27110,
4757,
18886,
3070,
1006,
2862,
1026,
3638,
16869,
22984,
4783,
2319,
1028,
4770,
4783,
6962,
1007,
1063,
5164,
8569,
23891,
2099,
1038,
6392,
1027,
2047,
5164,
8569,
2389... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/AggregateOperationFactory.java | AggregateOperationFactory.createAggregate | public TableOperation createAggregate(
List<Expression> groupings,
List<Expression> aggregates,
TableOperation child) {
validateGroupings(groupings);
validateAggregates(aggregates);
List<PlannerExpression> convertedGroupings = bridge(groupings);
List<PlannerExpression> convertedAggregates = bridge(aggregates);
TypeInformation[] fieldTypes = Stream.concat(
convertedGroupings.stream(),
convertedAggregates.stream()
).map(PlannerExpression::resultType)
.toArray(TypeInformation[]::new);
String[] fieldNames = Stream.concat(
groupings.stream(),
aggregates.stream()
).map(expr -> extractName(expr).orElseGet(expr::toString))
.toArray(String[]::new);
TableSchema tableSchema = new TableSchema(fieldNames, fieldTypes);
return new AggregateTableOperation(groupings, aggregates, child, tableSchema);
} | java | public TableOperation createAggregate(
List<Expression> groupings,
List<Expression> aggregates,
TableOperation child) {
validateGroupings(groupings);
validateAggregates(aggregates);
List<PlannerExpression> convertedGroupings = bridge(groupings);
List<PlannerExpression> convertedAggregates = bridge(aggregates);
TypeInformation[] fieldTypes = Stream.concat(
convertedGroupings.stream(),
convertedAggregates.stream()
).map(PlannerExpression::resultType)
.toArray(TypeInformation[]::new);
String[] fieldNames = Stream.concat(
groupings.stream(),
aggregates.stream()
).map(expr -> extractName(expr).orElseGet(expr::toString))
.toArray(String[]::new);
TableSchema tableSchema = new TableSchema(fieldNames, fieldTypes);
return new AggregateTableOperation(groupings, aggregates, child, tableSchema);
} | [
"public",
"TableOperation",
"createAggregate",
"(",
"List",
"<",
"Expression",
">",
"groupings",
",",
"List",
"<",
"Expression",
">",
"aggregates",
",",
"TableOperation",
"child",
")",
"{",
"validateGroupings",
"(",
"groupings",
")",
";",
"validateAggregates",
"("... | Creates a valid {@link AggregateTableOperation} operation.
@param groupings expressions describing grouping key of aggregates
@param aggregates expressions describing aggregation functions
@param child relational operation on top of which to apply the aggregation
@return valid aggregate operation | [
"Creates",
"a",
"valid",
"{",
"@link",
"AggregateTableOperation",
"}",
"operation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/AggregateOperationFactory.java#L90-L115 | train | Creates an aggregate table operation. | [
30522,
2270,
2795,
25918,
3370,
3443,
8490,
17603,
5867,
1006,
2862,
1026,
3670,
1028,
19765,
2015,
1010,
2862,
1026,
3670,
1028,
9572,
2015,
1010,
2795,
25918,
3370,
2775,
1007,
1063,
9398,
3686,
17058,
8613,
1006,
19765,
2015,
1007,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/LogFactory.java | LogFactory.getLog | public Log getLog(String name) {
Log log = logCache.get(name);
if (null == log) {
log = createLog(name);
logCache.put(name, log);
}
return log;
} | java | public Log getLog(String name) {
Log log = logCache.get(name);
if (null == log) {
log = createLog(name);
logCache.put(name, log);
}
return log;
} | [
"public",
"Log",
"getLog",
"(",
"String",
"name",
")",
"{",
"Log",
"log",
"=",
"logCache",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"null",
"==",
"log",
")",
"{",
"log",
"=",
"createLog",
"(",
"name",
")",
";",
"logCache",
".",
"put",
"(",
... | 获得日志对象
@param name 日志对象名
@return 日志对象 | [
"获得日志对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/LogFactory.java#L66-L73 | train | Gets the log with the given name. | [
30522,
2270,
8833,
2131,
21197,
1006,
5164,
2171,
1007,
1063,
8833,
8833,
1027,
8833,
3540,
5403,
1012,
2131,
1006,
2171,
1007,
1025,
2065,
1006,
19701,
1027,
1027,
8833,
1007,
1063,
8833,
1027,
3443,
21197,
1006,
2171,
1007,
1025,
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... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java | EmbeddedCLIServiceClient.openSession | @Override
public SessionHandle openSession(String username, String password,
Map<String, String> configuration) throws HiveSQLException {
return cliService.openSession(username, password, configuration);
} | java | @Override
public SessionHandle openSession(String username, String password,
Map<String, String> configuration) throws HiveSQLException {
return cliService.openSession(username, password, configuration);
} | [
"@",
"Override",
"public",
"SessionHandle",
"openSession",
"(",
"String",
"username",
",",
"String",
"password",
",",
"Map",
"<",
"String",
",",
"String",
">",
"configuration",
")",
"throws",
"HiveSQLException",
"{",
"return",
"cliService",
".",
"openSession",
"... | /* (non-Javadoc)
@see org.apache.hive.service.cli.CLIServiceClient#openSession(java.lang.String, java.lang.String, java.util.Map) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/EmbeddedCLIServiceClient.java#L41-L45 | train | Open a session with the specified username password and configuration. | [
30522,
1030,
2058,
15637,
2270,
5219,
11774,
2571,
7480,
7971,
3258,
1006,
5164,
5310,
18442,
1010,
5164,
20786,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
9563,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
2709,
18856,
17288,
79... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/cors/CorsConfig.java | CorsConfig.preflightResponseHeaders | public HttpHeaders preflightResponseHeaders() {
if (preflightHeaders.isEmpty()) {
return EmptyHttpHeaders.INSTANCE;
}
final HttpHeaders preflightHeaders = new DefaultHttpHeaders();
for (Entry<CharSequence, Callable<?>> entry : this.preflightHeaders.entrySet()) {
final Object value = getValue(entry.getValue());
if (value instanceof Iterable) {
preflightHeaders.add(entry.getKey(), (Iterable<?>) value);
} else {
preflightHeaders.add(entry.getKey(), value);
}
}
return preflightHeaders;
} | java | public HttpHeaders preflightResponseHeaders() {
if (preflightHeaders.isEmpty()) {
return EmptyHttpHeaders.INSTANCE;
}
final HttpHeaders preflightHeaders = new DefaultHttpHeaders();
for (Entry<CharSequence, Callable<?>> entry : this.preflightHeaders.entrySet()) {
final Object value = getValue(entry.getValue());
if (value instanceof Iterable) {
preflightHeaders.add(entry.getKey(), (Iterable<?>) value);
} else {
preflightHeaders.add(entry.getKey(), value);
}
}
return preflightHeaders;
} | [
"public",
"HttpHeaders",
"preflightResponseHeaders",
"(",
")",
"{",
"if",
"(",
"preflightHeaders",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"EmptyHttpHeaders",
".",
"INSTANCE",
";",
"}",
"final",
"HttpHeaders",
"preflightHeaders",
"=",
"new",
"DefaultHttpHead... | Returns HTTP response headers that should be added to a CORS preflight response.
@return {@link HttpHeaders} the HTTP response headers to be added. | [
"Returns",
"HTTP",
"response",
"headers",
"that",
"should",
"be",
"added",
"to",
"a",
"CORS",
"preflight",
"response",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/cors/CorsConfig.java#L200-L214 | train | Gets the preflight response headers. | [
30522,
2270,
8299,
4974,
2545,
3653,
28968,
6072,
26029,
3366,
4974,
2545,
1006,
1007,
1063,
2065,
1006,
3653,
28968,
4974,
2545,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1007,
1063,
2709,
4064,
11039,
25856,
4974,
2545,
1012,
6013,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.or | public static ExpectedCondition<Boolean> or(final ExpectedCondition<?>... conditions) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
RuntimeException lastException = null;
for (ExpectedCondition<?> condition : conditions) {
try {
Object result = condition.apply(driver);
if (result != null) {
if (result instanceof Boolean) {
if (Boolean.TRUE.equals(result)) {
return true;
}
} else {
return true;
}
}
} catch (RuntimeException e) {
lastException = e;
}
}
if (lastException != null) {
throw lastException;
}
return false;
}
@Override
public String toString() {
StringBuilder message = new StringBuilder("at least one condition to be valid: ");
Joiner.on(" || ").appendTo(message, conditions);
return message.toString();
}
};
} | java | public static ExpectedCondition<Boolean> or(final ExpectedCondition<?>... conditions) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
RuntimeException lastException = null;
for (ExpectedCondition<?> condition : conditions) {
try {
Object result = condition.apply(driver);
if (result != null) {
if (result instanceof Boolean) {
if (Boolean.TRUE.equals(result)) {
return true;
}
} else {
return true;
}
}
} catch (RuntimeException e) {
lastException = e;
}
}
if (lastException != null) {
throw lastException;
}
return false;
}
@Override
public String toString() {
StringBuilder message = new StringBuilder("at least one condition to be valid: ");
Joiner.on(" || ").appendTo(message, conditions);
return message.toString();
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"Boolean",
">",
"or",
"(",
"final",
"ExpectedCondition",
"<",
"?",
">",
"...",
"conditions",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolean... | An expectation with the logical or condition of the given list of conditions.
Each condition is checked until at least one of them returns true or not null.
@param conditions ExpectedCondition is a list of alternative conditions
@return true once one of conditions is satisfied | [
"An",
"expectation",
"with",
"the",
"logical",
"or",
"condition",
"of",
"the",
"given",
"list",
"of",
"conditions",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L1363-L1397 | train | An expectation for checking that an expected condition is an or condition. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
2030,
1006,
2345,
3517,
8663,
20562,
1026,
1029,
1028,
1012,
1012,
1012,
3785,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
22017,
20898,
1028,
1006,
1007,
1063,
1030,
205... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/slot/TaskSlot.java | TaskSlot.add | public boolean add(Task task) {
// Check that this slot has been assigned to the job sending this task
Preconditions.checkArgument(task.getJobID().equals(jobId), "The task's job id does not match the " +
"job id for which the slot has been allocated.");
Preconditions.checkArgument(task.getAllocationId().equals(allocationId), "The task's allocation " +
"id does not match the allocation id for which the slot has been allocated.");
Preconditions.checkState(TaskSlotState.ACTIVE == state, "The task slot is not in state active.");
Task oldTask = tasks.put(task.getExecutionId(), task);
if (oldTask != null) {
tasks.put(task.getExecutionId(), oldTask);
return false;
} else {
return true;
}
} | java | public boolean add(Task task) {
// Check that this slot has been assigned to the job sending this task
Preconditions.checkArgument(task.getJobID().equals(jobId), "The task's job id does not match the " +
"job id for which the slot has been allocated.");
Preconditions.checkArgument(task.getAllocationId().equals(allocationId), "The task's allocation " +
"id does not match the allocation id for which the slot has been allocated.");
Preconditions.checkState(TaskSlotState.ACTIVE == state, "The task slot is not in state active.");
Task oldTask = tasks.put(task.getExecutionId(), task);
if (oldTask != null) {
tasks.put(task.getExecutionId(), oldTask);
return false;
} else {
return true;
}
} | [
"public",
"boolean",
"add",
"(",
"Task",
"task",
")",
"{",
"// Check that this slot has been assigned to the job sending this task",
"Preconditions",
".",
"checkArgument",
"(",
"task",
".",
"getJobID",
"(",
")",
".",
"equals",
"(",
"jobId",
")",
",",
"\"The task's job... | Add the given task to the task slot. This is only possible if there is not already another
task with the same execution attempt id added to the task slot. In this case, the method
returns true. Otherwise the task slot is left unchanged and false is returned.
<p>In case that the task slot state is not active an {@link IllegalStateException} is thrown.
In case that the task's job id and allocation id don't match with the job id and allocation
id for which the task slot has been allocated, an {@link IllegalArgumentException} is thrown.
@param task to be added to the task slot
@throws IllegalStateException if the task slot is not in state active
@return true if the task was added to the task slot; otherwise false | [
"Add",
"the",
"given",
"task",
"to",
"the",
"task",
"slot",
".",
"This",
"is",
"only",
"possible",
"if",
"there",
"is",
"not",
"already",
"another",
"task",
"with",
"the",
"same",
"execution",
"attempt",
"id",
"added",
"to",
"the",
"task",
"slot",
".",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlot.java#L162-L178 | train | Adds a task to the slot. | [
30522,
2270,
22017,
20898,
5587,
1006,
4708,
4708,
1007,
1063,
1013,
1013,
4638,
2008,
2023,
10453,
2038,
2042,
4137,
2000,
1996,
3105,
6016,
2023,
4708,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
4708,
1012,
2131,
5558,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/deployment/ResultPartitionDeploymentDescriptor.java | ResultPartitionDeploymentDescriptor.from | public static ResultPartitionDeploymentDescriptor from(
IntermediateResultPartition partition, int maxParallelism, boolean lazyScheduling) {
final IntermediateDataSetID resultId = partition.getIntermediateResult().getId();
final IntermediateResultPartitionID partitionId = partition.getPartitionId();
final ResultPartitionType partitionType = partition.getIntermediateResult().getResultType();
// The produced data is partitioned among a number of subpartitions.
//
// If no consumers are known at this point, we use a single subpartition, otherwise we have
// one for each consuming sub task.
int numberOfSubpartitions = 1;
if (!partition.getConsumers().isEmpty() && !partition.getConsumers().get(0).isEmpty()) {
if (partition.getConsumers().size() > 1) {
throw new IllegalStateException("Currently, only a single consumer group per partition is supported.");
}
numberOfSubpartitions = partition.getConsumers().get(0).size();
}
return new ResultPartitionDeploymentDescriptor(
resultId, partitionId, partitionType, numberOfSubpartitions, maxParallelism, lazyScheduling);
} | java | public static ResultPartitionDeploymentDescriptor from(
IntermediateResultPartition partition, int maxParallelism, boolean lazyScheduling) {
final IntermediateDataSetID resultId = partition.getIntermediateResult().getId();
final IntermediateResultPartitionID partitionId = partition.getPartitionId();
final ResultPartitionType partitionType = partition.getIntermediateResult().getResultType();
// The produced data is partitioned among a number of subpartitions.
//
// If no consumers are known at this point, we use a single subpartition, otherwise we have
// one for each consuming sub task.
int numberOfSubpartitions = 1;
if (!partition.getConsumers().isEmpty() && !partition.getConsumers().get(0).isEmpty()) {
if (partition.getConsumers().size() > 1) {
throw new IllegalStateException("Currently, only a single consumer group per partition is supported.");
}
numberOfSubpartitions = partition.getConsumers().get(0).size();
}
return new ResultPartitionDeploymentDescriptor(
resultId, partitionId, partitionType, numberOfSubpartitions, maxParallelism, lazyScheduling);
} | [
"public",
"static",
"ResultPartitionDeploymentDescriptor",
"from",
"(",
"IntermediateResultPartition",
"partition",
",",
"int",
"maxParallelism",
",",
"boolean",
"lazyScheduling",
")",
"{",
"final",
"IntermediateDataSetID",
"resultId",
"=",
"partition",
".",
"getIntermediat... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/deployment/ResultPartitionDeploymentDescriptor.java#L112-L136 | train | Creates an instance of the ResultPartitionDeploymentDescriptor class from an intermediate result partition. | [
30522,
2270,
10763,
2765,
19362,
3775,
3508,
3207,
24759,
6977,
3672,
6155,
23235,
2953,
2013,
1006,
7783,
6072,
11314,
19362,
3775,
3508,
13571,
1010,
20014,
4098,
28689,
6216,
28235,
1010,
22017,
20898,
13971,
22842,
8566,
2989,
1007,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dml/PredicateUtils.java | PredicateUtils.createInCondition | public static Optional<Condition> createInCondition(final PredicateInRightValue inRightValue, final Column column) {
List<SQLExpression> sqlExpressions = new LinkedList<>();
for (ExpressionSegment each : inRightValue.getSqlExpressions()) {
if (!(each instanceof SimpleExpressionSegment)) {
sqlExpressions.clear();
break;
} else {
sqlExpressions.add(((SimpleExpressionSegment) each).getSQLExpression());
}
}
return sqlExpressions.isEmpty() ? Optional.<Condition>absent() : Optional.of(new Condition(column, sqlExpressions));
} | java | public static Optional<Condition> createInCondition(final PredicateInRightValue inRightValue, final Column column) {
List<SQLExpression> sqlExpressions = new LinkedList<>();
for (ExpressionSegment each : inRightValue.getSqlExpressions()) {
if (!(each instanceof SimpleExpressionSegment)) {
sqlExpressions.clear();
break;
} else {
sqlExpressions.add(((SimpleExpressionSegment) each).getSQLExpression());
}
}
return sqlExpressions.isEmpty() ? Optional.<Condition>absent() : Optional.of(new Condition(column, sqlExpressions));
} | [
"public",
"static",
"Optional",
"<",
"Condition",
">",
"createInCondition",
"(",
"final",
"PredicateInRightValue",
"inRightValue",
",",
"final",
"Column",
"column",
")",
"{",
"List",
"<",
"SQLExpression",
">",
"sqlExpressions",
"=",
"new",
"LinkedList",
"<>",
"(",... | Create condition of IN operator.
@param inRightValue right value of IN operator
@param column column
@return condition | [
"Create",
"condition",
"of",
"IN",
"operator",
"."
] | 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/antlr/filler/common/dml/PredicateUtils.java#L112-L123 | train | Create in condition Optional. | [
30522,
2270,
10763,
11887,
1026,
4650,
1028,
3443,
2378,
8663,
20562,
1006,
2345,
3653,
16467,
2378,
15950,
10175,
5657,
1999,
15950,
10175,
5657,
1010,
2345,
5930,
5930,
1007,
1063,
2862,
1026,
29296,
10288,
20110,
3258,
1028,
29296,
10288,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ServerUpgradeCodec.java | Http2ServerUpgradeCodec.decodeSettingsHeader | private Http2Settings decodeSettingsHeader(ChannelHandlerContext ctx, CharSequence settingsHeader)
throws Http2Exception {
ByteBuf header = ByteBufUtil.encodeString(ctx.alloc(), CharBuffer.wrap(settingsHeader), CharsetUtil.UTF_8);
try {
// Decode the SETTINGS payload.
ByteBuf payload = Base64.decode(header, URL_SAFE);
// Create an HTTP/2 frame for the settings.
ByteBuf frame = createSettingsFrame(ctx, payload);
// Decode the SETTINGS frame and return the settings object.
return decodeSettings(ctx, frame);
} finally {
header.release();
}
} | java | private Http2Settings decodeSettingsHeader(ChannelHandlerContext ctx, CharSequence settingsHeader)
throws Http2Exception {
ByteBuf header = ByteBufUtil.encodeString(ctx.alloc(), CharBuffer.wrap(settingsHeader), CharsetUtil.UTF_8);
try {
// Decode the SETTINGS payload.
ByteBuf payload = Base64.decode(header, URL_SAFE);
// Create an HTTP/2 frame for the settings.
ByteBuf frame = createSettingsFrame(ctx, payload);
// Decode the SETTINGS frame and return the settings object.
return decodeSettings(ctx, frame);
} finally {
header.release();
}
} | [
"private",
"Http2Settings",
"decodeSettingsHeader",
"(",
"ChannelHandlerContext",
"ctx",
",",
"CharSequence",
"settingsHeader",
")",
"throws",
"Http2Exception",
"{",
"ByteBuf",
"header",
"=",
"ByteBufUtil",
".",
"encodeString",
"(",
"ctx",
".",
"alloc",
"(",
")",
",... | Decodes the settings header and returns a {@link Http2Settings} object. | [
"Decodes",
"the",
"settings",
"header",
"and",
"returns",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ServerUpgradeCodec.java#L170-L185 | train | Decodes the settings header. | [
30522,
2797,
8299,
2475,
21678,
8613,
21933,
6155,
18319,
3070,
4095,
13775,
2121,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
25869,
3366,
4226,
5897,
10906,
4974,
2121,
1007,
11618,
8299,
2475,
10288,
24422,
1063,
24880,
8569,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronPOSTagger.java | PerceptronPOSTagger.learn | public boolean learn(String... wordTags)
{
String[] words = new String[wordTags.length];
String[] tags = new String[wordTags.length];
for (int i = 0; i < wordTags.length; i++)
{
String[] wordTag = wordTags[i].split("//");
words[i] = wordTag[0];
tags[i] = wordTag[1];
}
return learn(new POSInstance(words, tags, model.featureMap));
} | java | public boolean learn(String... wordTags)
{
String[] words = new String[wordTags.length];
String[] tags = new String[wordTags.length];
for (int i = 0; i < wordTags.length; i++)
{
String[] wordTag = wordTags[i].split("//");
words[i] = wordTag[0];
tags[i] = wordTag[1];
}
return learn(new POSInstance(words, tags, model.featureMap));
} | [
"public",
"boolean",
"learn",
"(",
"String",
"...",
"wordTags",
")",
"{",
"String",
"[",
"]",
"words",
"=",
"new",
"String",
"[",
"wordTags",
".",
"length",
"]",
";",
"String",
"[",
"]",
"tags",
"=",
"new",
"String",
"[",
"wordTags",
".",
"length",
"... | 在线学习
@param wordTags [单词]/[词性]数组
@return 是否学习成功(失败的原因是参数错误) | [
"在线学习"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronPOSTagger.java#L109-L120 | train | Learn a sequence of words and tags from a sequence of words. | [
30522,
2270,
22017,
20898,
4553,
1006,
5164,
1012,
1012,
1012,
2773,
15900,
2015,
1007,
1063,
5164,
1031,
1033,
2616,
1027,
2047,
5164,
1031,
2773,
15900,
2015,
1012,
3091,
1033,
1025,
5164,
1031,
1033,
22073,
1027,
2047,
5164,
1031,
2773,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/StrFormatter.java | StrFormatter.format | public static String format(final String strPattern, final Object... argArray) {
if (StrUtil.isBlank(strPattern) || ArrayUtil.isEmpty(argArray)) {
return strPattern;
}
final int strPatternLength = strPattern.length();
// 初始化定义好的长度以获得更好的性能
StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
int handledPosition = 0;// 记录已经处理到的位置
int delimIndex;// 占位符所在位置
for (int argIndex = 0; argIndex < argArray.length; argIndex++) {
delimIndex = strPattern.indexOf(StrUtil.EMPTY_JSON, handledPosition);
if (delimIndex == -1) {// 剩余部分无占位符
if (handledPosition == 0) { // 不带占位符的模板直接返回
return strPattern;
}
// 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
sbuf.append(strPattern, handledPosition, strPatternLength);
return sbuf.toString();
}
// 转义符
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == StrUtil.C_BACKSLASH) {// 转义符
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == StrUtil.C_BACKSLASH) {// 双转义符
// 转义符之前还有一个转义符,占位符依旧有效
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(StrUtil.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2;
} else {
// 占位符被转义
argIndex--;
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(StrUtil.C_DELIM_START);
handledPosition = delimIndex + 1;
}
} else {// 正常占位符
sbuf.append(strPattern, handledPosition, delimIndex);
sbuf.append(StrUtil.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2;
}
}
// append the characters following the last {} pair.
// 加入最后一个占位符后所有的字符
sbuf.append(strPattern, handledPosition, strPattern.length());
return sbuf.toString();
} | java | public static String format(final String strPattern, final Object... argArray) {
if (StrUtil.isBlank(strPattern) || ArrayUtil.isEmpty(argArray)) {
return strPattern;
}
final int strPatternLength = strPattern.length();
// 初始化定义好的长度以获得更好的性能
StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
int handledPosition = 0;// 记录已经处理到的位置
int delimIndex;// 占位符所在位置
for (int argIndex = 0; argIndex < argArray.length; argIndex++) {
delimIndex = strPattern.indexOf(StrUtil.EMPTY_JSON, handledPosition);
if (delimIndex == -1) {// 剩余部分无占位符
if (handledPosition == 0) { // 不带占位符的模板直接返回
return strPattern;
}
// 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
sbuf.append(strPattern, handledPosition, strPatternLength);
return sbuf.toString();
}
// 转义符
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == StrUtil.C_BACKSLASH) {// 转义符
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == StrUtil.C_BACKSLASH) {// 双转义符
// 转义符之前还有一个转义符,占位符依旧有效
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(StrUtil.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2;
} else {
// 占位符被转义
argIndex--;
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(StrUtil.C_DELIM_START);
handledPosition = delimIndex + 1;
}
} else {// 正常占位符
sbuf.append(strPattern, handledPosition, delimIndex);
sbuf.append(StrUtil.utf8Str(argArray[argIndex]));
handledPosition = delimIndex + 2;
}
}
// append the characters following the last {} pair.
// 加入最后一个占位符后所有的字符
sbuf.append(strPattern, handledPosition, strPattern.length());
return sbuf.toString();
} | [
"public",
"static",
"String",
"format",
"(",
"final",
"String",
"strPattern",
",",
"final",
"Object",
"...",
"argArray",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"strPattern",
")",
"||",
"ArrayUtil",
".",
"isEmpty",
"(",
"argArray",
")",
")",
... | 格式化字符串<br>
此方法只是简单将占位符 {} 按照顺序替换为参数<br>
如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br>
例:<br>
通常使用:format("this is {} for {}", "a", "b") =》 this is a for b<br>
转义{}: format("this is \\{} for {}", "a", "b") =》 this is \{} for a<br>
转义\: format("this is \\\\{} for {}", "a", "b") =》 this is \a for b<br>
@param strPattern 字符串模板
@param argArray 参数列表
@return 结果 | [
"格式化字符串<br",
">",
"此方法只是简单将占位符",
"{}",
"按照顺序替换为参数<br",
">",
"如果想输出",
"{}",
"使用",
"\\\\",
"转义",
"{",
"即可,如果想输出",
"{}",
"之前的",
"\\",
"使用双转义符",
"\\\\\\\\",
"即可<br",
">",
"例:<br",
">",
"通常使用:format",
"(",
"this",
"is",
"{}",
"for",
"{}",
"a",
"b",
")",
"="... | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrFormatter.java#L27-L75 | train | Format a string with the specified arguments. | [
30522,
2270,
10763,
5164,
4289,
1006,
2345,
5164,
2358,
14536,
20097,
2078,
1010,
2345,
4874,
1012,
1012,
1012,
12098,
6843,
9447,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
2358,
14536,
20097,
2078,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.addAll | public static <T> Collection<T> addAll(Collection<T> collection, T[] values) {
if (null != collection && null != values) {
for (T value : values) {
collection.add(value);
}
}
return collection;
} | java | public static <T> Collection<T> addAll(Collection<T> collection, T[] values) {
if (null != collection && null != values) {
for (T value : values) {
collection.add(value);
}
}
return collection;
} | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"addAll",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"T",
"[",
"]",
"values",
")",
"{",
"if",
"(",
"null",
"!=",
"collection",
"&&",
"null",
"!=",
"values",
")",
"{",
"for",
... | 加入全部
@param <T> 集合元素类型
@param collection 被加入的集合 {@link Collection}
@param values 要加入的内容数组
@return 原集合
@since 3.0.8 | [
"加入全部"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1801-L1808 | train | Adds all the values to the given collection. | [
30522,
2270,
10763,
1026,
1056,
1028,
3074,
1026,
1056,
1028,
5587,
8095,
1006,
3074,
1026,
1056,
1028,
3074,
1010,
1056,
1031,
1033,
5300,
1007,
1063,
2065,
1006,
19701,
999,
1027,
3074,
1004,
1004,
19701,
999,
1027,
5300,
1007,
1063,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCAppendTableSinkBuilder.java | JDBCAppendTableSinkBuilder.setParameterTypes | public JDBCAppendTableSinkBuilder setParameterTypes(TypeInformation<?>... types) {
int[] ty = new int[types.length];
for (int i = 0; i < types.length; ++i) {
ty[i] = JDBCTypeUtil.typeInformationToSqlType(types[i]);
}
this.parameterTypes = ty;
return this;
} | java | public JDBCAppendTableSinkBuilder setParameterTypes(TypeInformation<?>... types) {
int[] ty = new int[types.length];
for (int i = 0; i < types.length; ++i) {
ty[i] = JDBCTypeUtil.typeInformationToSqlType(types[i]);
}
this.parameterTypes = ty;
return this;
} | [
"public",
"JDBCAppendTableSinkBuilder",
"setParameterTypes",
"(",
"TypeInformation",
"<",
"?",
">",
"...",
"types",
")",
"{",
"int",
"[",
"]",
"ty",
"=",
"new",
"int",
"[",
"types",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | Specify the type of the rows that the sink will be accepting.
@param types the type of each field | [
"Specify",
"the",
"type",
"of",
"the",
"rows",
"that",
"the",
"sink",
"will",
"be",
"accepting",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCAppendTableSinkBuilder.java#L100-L107 | train | Sets the parameter types. | [
30522,
2270,
26219,
9818,
29098,
10497,
10880,
11493,
2243,
8569,
23891,
2099,
2275,
28689,
22828,
13874,
2015,
1006,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
1012,
1012,
1012,
4127,
1007,
1063,
20014,
1031,
1033,
5939,
1027,
2047,
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... |
netty/netty | common/src/main/java/io/netty/util/DomainMappingBuilder.java | DomainMappingBuilder.add | public DomainMappingBuilder<V> add(String hostname, V output) {
builder.add(hostname, output);
return this;
} | java | public DomainMappingBuilder<V> add(String hostname, V output) {
builder.add(hostname, output);
return this;
} | [
"public",
"DomainMappingBuilder",
"<",
"V",
">",
"add",
"(",
"String",
"hostname",
",",
"V",
"output",
")",
"{",
"builder",
".",
"add",
"(",
"hostname",
",",
"output",
")",
";",
"return",
"this",
";",
"}"
] | Adds a mapping that maps the specified (optionally wildcard) host name to the specified output value.
Null values are forbidden for both hostnames and values.
<p>
<a href="http://en.wikipedia.org/wiki/Wildcard_DNS_record">DNS wildcard</a> is supported as hostname.
For example, you can use {@code *.netty.io} to match {@code netty.io} and {@code downloads.netty.io}.
</p>
@param hostname the host name (optionally wildcard)
@param output the output value that will be returned by {@link DomainNameMapping#map(String)}
when the specified host name matches the specified input host name | [
"Adds",
"a",
"mapping",
"that",
"maps",
"the",
"specified",
"(",
"optionally",
"wildcard",
")",
"host",
"name",
"to",
"the",
"specified",
"output",
"value",
".",
"Null",
"values",
"are",
"forbidden",
"for",
"both",
"hostnames",
"and",
"values",
".",
"<p",
... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/DomainMappingBuilder.java#L63-L66 | train | Add a new domain mapping to the domain mapping. | [
30522,
2270,
5884,
2863,
14853,
8569,
23891,
2099,
1026,
1058,
1028,
5587,
1006,
5164,
3677,
18442,
1010,
1058,
6434,
1007,
1063,
12508,
1012,
5587,
1006,
3677,
18442,
1010,
6434,
1007,
1025,
2709,
2023,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/word2vec/Corpus.java | Corpus.sortVocab | void sortVocab()
{
Arrays.sort(vocab, 0, vocabSize);
// re-build vocabIndexMap
final int size = vocabSize;
trainWords = 0;
table = new int[size];
for (int i = 0; i < size; i++)
{
VocabWord word = vocab[i];
// Words occuring less than min_count times will be discarded from the vocab
if (word.cn < config.getMinCount())
{
table[vocabIndexMap.get(word.word)] = -4;
vocabSize--;
}
else
{
// Hash will be re-computed, as after the sorting it is not actual
table[vocabIndexMap.get(word.word)] = i;
setVocabIndexMap(word, i);
}
}
// lose weight
vocabIndexMap = null;
VocabWord[] nvocab = new VocabWord[vocabSize];
System.arraycopy(vocab, 0, nvocab, 0, vocabSize);
} | java | void sortVocab()
{
Arrays.sort(vocab, 0, vocabSize);
// re-build vocabIndexMap
final int size = vocabSize;
trainWords = 0;
table = new int[size];
for (int i = 0; i < size; i++)
{
VocabWord word = vocab[i];
// Words occuring less than min_count times will be discarded from the vocab
if (word.cn < config.getMinCount())
{
table[vocabIndexMap.get(word.word)] = -4;
vocabSize--;
}
else
{
// Hash will be re-computed, as after the sorting it is not actual
table[vocabIndexMap.get(word.word)] = i;
setVocabIndexMap(word, i);
}
}
// lose weight
vocabIndexMap = null;
VocabWord[] nvocab = new VocabWord[vocabSize];
System.arraycopy(vocab, 0, nvocab, 0, vocabSize);
} | [
"void",
"sortVocab",
"(",
")",
"{",
"Arrays",
".",
"sort",
"(",
"vocab",
",",
"0",
",",
"vocabSize",
")",
";",
"// re-build vocabIndexMap",
"final",
"int",
"size",
"=",
"vocabSize",
";",
"trainWords",
"=",
"0",
";",
"table",
"=",
"new",
"int",
"[",
"si... | Sorts the vocabulary by frequency using word counts | [
"Sorts",
"the",
"vocabulary",
"by",
"frequency",
"using",
"word",
"counts"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/Corpus.java#L147-L177 | train | Sort the vocabulary. | [
30522,
11675,
4066,
6767,
3540,
2497,
1006,
1007,
1063,
27448,
1012,
4066,
1006,
29536,
3540,
2497,
1010,
1014,
1010,
29536,
3540,
5910,
4697,
1007,
1025,
1013,
1013,
2128,
1011,
3857,
29536,
3540,
8428,
3207,
2595,
2863,
2361,
2345,
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... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java | ResourceSpec.isValid | public boolean isValid() {
if (this.cpuCores >= 0 && this.heapMemoryInMB >= 0 && this.directMemoryInMB >= 0 &&
this.nativeMemoryInMB >= 0 && this.stateSizeInMB >= 0) {
for (Resource resource : extendedResources.values()) {
if (resource.getValue() < 0) {
return false;
}
}
return true;
} else {
return false;
}
} | java | public boolean isValid() {
if (this.cpuCores >= 0 && this.heapMemoryInMB >= 0 && this.directMemoryInMB >= 0 &&
this.nativeMemoryInMB >= 0 && this.stateSizeInMB >= 0) {
for (Resource resource : extendedResources.values()) {
if (resource.getValue() < 0) {
return false;
}
}
return true;
} else {
return false;
}
} | [
"public",
"boolean",
"isValid",
"(",
")",
"{",
"if",
"(",
"this",
".",
"cpuCores",
">=",
"0",
"&&",
"this",
".",
"heapMemoryInMB",
">=",
"0",
"&&",
"this",
".",
"directMemoryInMB",
">=",
"0",
"&&",
"this",
".",
"nativeMemoryInMB",
">=",
"0",
"&&",
"thi... | Check whether all the field values are valid.
@return True if all the values are equal or greater than 0, otherwise false. | [
"Check",
"whether",
"all",
"the",
"field",
"values",
"are",
"valid",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java#L163-L175 | train | Returns true if the state of this state is valid. | [
30522,
2270,
22017,
20898,
2003,
10175,
3593,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
17368,
17345,
2015,
1028,
1027,
1014,
1004,
1004,
2023,
1012,
16721,
4168,
5302,
2854,
2378,
14905,
1028,
1027,
1014,
1004,
1004,
2023,
1012,
3622,
4168... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.write | public static boolean write(Image image, String imageType, ImageOutputStream destImageStream, float quality) throws IORuntimeException {
if (StrUtil.isBlank(imageType)) {
imageType = IMAGE_TYPE_JPG;
}
final ImageWriter writer = getWriter(image, imageType);
return write(toBufferedImage(image, imageType), writer, destImageStream, quality);
} | java | public static boolean write(Image image, String imageType, ImageOutputStream destImageStream, float quality) throws IORuntimeException {
if (StrUtil.isBlank(imageType)) {
imageType = IMAGE_TYPE_JPG;
}
final ImageWriter writer = getWriter(image, imageType);
return write(toBufferedImage(image, imageType), writer, destImageStream, quality);
} | [
"public",
"static",
"boolean",
"write",
"(",
"Image",
"image",
",",
"String",
"imageType",
",",
"ImageOutputStream",
"destImageStream",
",",
"float",
"quality",
")",
"throws",
"IORuntimeException",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"imageType",
")"... | 写出图像为指定格式
@param image {@link Image}
@param imageType 图片类型(图片扩展名)
@param destImageStream 写出到的目标流
@param quality 质量,数字为0~1(不包括0和1)表示质量压缩比,除此数字外设置表示不压缩
@return 是否成功写出,如果返回false表示未找到合适的Writer
@throws IORuntimeException IO异常
@since 4.3.2 | [
"写出图像为指定格式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1431-L1438 | train | Write an image to an output stream. | [
30522,
2270,
10763,
22017,
20898,
4339,
1006,
3746,
3746,
1010,
5164,
3746,
13874,
1010,
3746,
5833,
18780,
21422,
4078,
3775,
26860,
21422,
1010,
14257,
3737,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2065,
1006,
2358,
22134,
4014... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonKeyedStream.java | PythonKeyedStream.count_window | public PythonWindowedStream count_window(long size, long slide) {
return new PythonWindowedStream<GlobalWindow>(this.stream.countWindow(size, slide));
} | java | public PythonWindowedStream count_window(long size, long slide) {
return new PythonWindowedStream<GlobalWindow>(this.stream.countWindow(size, slide));
} | [
"public",
"PythonWindowedStream",
"count_window",
"(",
"long",
"size",
",",
"long",
"slide",
")",
"{",
"return",
"new",
"PythonWindowedStream",
"<",
"GlobalWindow",
">",
"(",
"this",
".",
"stream",
".",
"countWindow",
"(",
"size",
",",
"slide",
")",
")",
";"... | A thin wrapper layer over {@link KeyedStream#countWindow(long, long)}.
@param size The size of the windows in number of elements.
@param slide The slide interval in number of elements.
@return The python windowed stream {@link PythonWindowedStream} | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"KeyedStream#countWindow",
"(",
"long",
"long",
")",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonKeyedStream.java#L54-L56 | train | Count the number of windows in the stream. | [
30522,
2270,
18750,
11101,
15096,
21422,
4175,
1035,
3332,
1006,
2146,
2946,
1010,
2146,
7358,
1007,
1063,
2709,
2047,
18750,
11101,
15096,
21422,
1026,
3795,
11101,
5004,
1028,
1006,
2023,
1012,
5460,
1012,
4175,
11101,
5004,
1006,
2946,
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-yarn/src/main/java/org/apache/flink/yarn/YarnTaskExecutorRunner.java | YarnTaskExecutorRunner.run | private static void run(String[] args) {
try {
LOG.debug("All environment variables: {}", ENV);
final String currDir = ENV.get(Environment.PWD.key());
LOG.info("Current working Directory: {}", currDir);
final Configuration configuration = GlobalConfiguration.loadConfiguration(currDir);
//TODO provide path.
FileSystem.initialize(configuration, PluginUtils.createPluginManagerFromRootFolder(Optional.empty()));
setupConfigurationAndInstallSecurityContext(configuration, currDir, ENV);
final String containerId = ENV.get(YarnResourceManager.ENV_FLINK_CONTAINER_ID);
Preconditions.checkArgument(containerId != null,
"ContainerId variable %s not set", YarnResourceManager.ENV_FLINK_CONTAINER_ID);
SecurityUtils.getInstalledContext().runSecured((Callable<Void>) () -> {
TaskManagerRunner.runTaskManager(configuration, new ResourceID(containerId));
return null;
});
}
catch (Throwable t) {
final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
// make sure that everything whatever ends up in the log
LOG.error("YARN TaskManager initialization failed.", strippedThrowable);
System.exit(INIT_ERROR_EXIT_CODE);
}
} | java | private static void run(String[] args) {
try {
LOG.debug("All environment variables: {}", ENV);
final String currDir = ENV.get(Environment.PWD.key());
LOG.info("Current working Directory: {}", currDir);
final Configuration configuration = GlobalConfiguration.loadConfiguration(currDir);
//TODO provide path.
FileSystem.initialize(configuration, PluginUtils.createPluginManagerFromRootFolder(Optional.empty()));
setupConfigurationAndInstallSecurityContext(configuration, currDir, ENV);
final String containerId = ENV.get(YarnResourceManager.ENV_FLINK_CONTAINER_ID);
Preconditions.checkArgument(containerId != null,
"ContainerId variable %s not set", YarnResourceManager.ENV_FLINK_CONTAINER_ID);
SecurityUtils.getInstalledContext().runSecured((Callable<Void>) () -> {
TaskManagerRunner.runTaskManager(configuration, new ResourceID(containerId));
return null;
});
}
catch (Throwable t) {
final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
// make sure that everything whatever ends up in the log
LOG.error("YARN TaskManager initialization failed.", strippedThrowable);
System.exit(INIT_ERROR_EXIT_CODE);
}
} | [
"private",
"static",
"void",
"run",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"LOG",
".",
"debug",
"(",
"\"All environment variables: {}\"",
",",
"ENV",
")",
";",
"final",
"String",
"currDir",
"=",
"ENV",
".",
"get",
"(",
"Environment",
".",... | The instance entry point for the YARN task executor. Obtains user group information and calls
the main work method {@link TaskManagerRunner#runTaskManager(Configuration, ResourceID)} as a
privileged action.
@param args The command line arguments. | [
"The",
"instance",
"entry",
"point",
"for",
"the",
"YARN",
"task",
"executor",
".",
"Obtains",
"user",
"group",
"information",
"and",
"calls",
"the",
"main",
"work",
"method",
"{",
"@link",
"TaskManagerRunner#runTaskManager",
"(",
"Configuration",
"ResourceID",
")... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-yarn/src/main/java/org/apache/flink/yarn/YarnTaskExecutorRunner.java#L89-L118 | train | Run the YARN TaskManager. | [
30522,
2797,
10763,
11675,
2448,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
3046,
1063,
8833,
1012,
2139,
8569,
2290,
1006,
1000,
2035,
4044,
10857,
1024,
1063,
1065,
1000,
1010,
4372,
2615,
1007,
1025,
2345,
5164,
12731,
12171,
4305,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/BufferUtil.java | BufferUtil.copy | public static ByteBuffer copy(ByteBuffer src, ByteBuffer dest, int length) {
return copy(src, src.position(), dest, dest.position(), length);
} | java | public static ByteBuffer copy(ByteBuffer src, ByteBuffer dest, int length) {
return copy(src, src.position(), dest, dest.position(), length);
} | [
"public",
"static",
"ByteBuffer",
"copy",
"(",
"ByteBuffer",
"src",
",",
"ByteBuffer",
"dest",
",",
"int",
"length",
")",
"{",
"return",
"copy",
"(",
"src",
",",
"src",
".",
"position",
"(",
")",
",",
"dest",
",",
"dest",
".",
"position",
"(",
")",
"... | 拷贝ByteBuffer
@param src 源ByteBuffer
@param dest 目标ByteBuffer
@param length 长度
@return 目标ByteBuffer | [
"拷贝ByteBuffer"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java#L51-L53 | train | Copies the given source ByteBuffer to the destination ByteBuffer. | [
30522,
2270,
10763,
24880,
8569,
12494,
6100,
1006,
24880,
8569,
12494,
5034,
2278,
1010,
24880,
8569,
12494,
4078,
2102,
1010,
20014,
3091,
1007,
1063,
2709,
6100,
1006,
5034,
2278,
1010,
5034,
2278,
1012,
2597,
1006,
1007,
1010,
4078,
210... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java | TableFactoryService.normalizeSupportedProperties | private static Tuple2<List<String>, List<String>> normalizeSupportedProperties(TableFactory factory) {
List<String> supportedProperties = factory.supportedProperties();
if (supportedProperties == null) {
throw new TableException(
String.format("Supported properties of factory '%s' must not be null.",
factory.getClass().getName()));
}
List<String> supportedKeys = supportedProperties.stream()
.map(p -> p.toLowerCase())
.collect(Collectors.toList());
// extract wildcard prefixes
List<String> wildcards = extractWildcardPrefixes(supportedKeys);
return Tuple2.of(supportedKeys, wildcards);
} | java | private static Tuple2<List<String>, List<String>> normalizeSupportedProperties(TableFactory factory) {
List<String> supportedProperties = factory.supportedProperties();
if (supportedProperties == null) {
throw new TableException(
String.format("Supported properties of factory '%s' must not be null.",
factory.getClass().getName()));
}
List<String> supportedKeys = supportedProperties.stream()
.map(p -> p.toLowerCase())
.collect(Collectors.toList());
// extract wildcard prefixes
List<String> wildcards = extractWildcardPrefixes(supportedKeys);
return Tuple2.of(supportedKeys, wildcards);
} | [
"private",
"static",
"Tuple2",
"<",
"List",
"<",
"String",
">",
",",
"List",
"<",
"String",
">",
">",
"normalizeSupportedProperties",
"(",
"TableFactory",
"factory",
")",
"{",
"List",
"<",
"String",
">",
"supportedProperties",
"=",
"factory",
".",
"supportedPr... | Prepares the supported properties of a factory to be used for match operations. | [
"Prepares",
"the",
"supported",
"properties",
"of",
"a",
"factory",
"to",
"be",
"used",
"for",
"match",
"operations",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java#L326-L340 | train | Normalizes the supported properties of the given table factory. | [
30522,
2797,
10763,
10722,
10814,
2475,
1026,
2862,
1026,
5164,
1028,
1010,
2862,
1026,
5164,
1028,
1028,
3671,
10057,
6279,
6442,
2098,
21572,
4842,
7368,
1006,
30524,
10288,
24422,
1006,
5164,
1012,
4289,
1006,
1000,
3569,
5144,
1997,
471... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMasterId.java | JobMasterId.fromUuidOrNull | public static JobMasterId fromUuidOrNull(@Nullable UUID uuid) {
return uuid == null ? null : new JobMasterId(uuid);
} | java | public static JobMasterId fromUuidOrNull(@Nullable UUID uuid) {
return uuid == null ? null : new JobMasterId(uuid);
} | [
"public",
"static",
"JobMasterId",
"fromUuidOrNull",
"(",
"@",
"Nullable",
"UUID",
"uuid",
")",
"{",
"return",
"uuid",
"==",
"null",
"?",
"null",
":",
"new",
"JobMasterId",
"(",
"uuid",
")",
";",
"}"
] | If the given uuid is null, this returns null, otherwise a JobMasterId that
corresponds to the UUID, via {@link #JobMasterId(UUID)}. | [
"If",
"the",
"given",
"uuid",
"is",
"null",
"this",
"returns",
"null",
"otherwise",
"a",
"JobMasterId",
"that",
"corresponds",
"to",
"the",
"UUID",
"via",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMasterId.java#L66-L68 | train | Creates a new job master id from a UUID or null. | [
30522,
2270,
10763,
3105,
8706,
3593,
2013,
2226,
21272,
9691,
18083,
1006,
1030,
19701,
3085,
1057,
21272,
1057,
21272,
1007,
1063,
2709,
30524,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.writeUtf8 | public static ByteBuf writeUtf8(ByteBufAllocator alloc, CharSequence seq) {
// UTF-8 uses max. 3 bytes per char, so calculate the worst case.
ByteBuf buf = alloc.buffer(utf8MaxBytes(seq));
writeUtf8(buf, seq);
return buf;
} | java | public static ByteBuf writeUtf8(ByteBufAllocator alloc, CharSequence seq) {
// UTF-8 uses max. 3 bytes per char, so calculate the worst case.
ByteBuf buf = alloc.buffer(utf8MaxBytes(seq));
writeUtf8(buf, seq);
return buf;
} | [
"public",
"static",
"ByteBuf",
"writeUtf8",
"(",
"ByteBufAllocator",
"alloc",
",",
"CharSequence",
"seq",
")",
"{",
"// UTF-8 uses max. 3 bytes per char, so calculate the worst case.",
"ByteBuf",
"buf",
"=",
"alloc",
".",
"buffer",
"(",
"utf8MaxBytes",
"(",
"seq",
")",
... | Encode a {@link CharSequence} in <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> and write
it to a {@link ByteBuf} allocated with {@code alloc}.
@param alloc The allocator used to allocate a new {@link ByteBuf}.
@param seq The characters to write into a buffer.
@return The {@link ByteBuf} which contains the <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> encoded
result. | [
"Encode",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L483-L488 | train | Write a UTF - 8 sequence. | [
30522,
2270,
10763,
24880,
8569,
2546,
4339,
4904,
2546,
2620,
1006,
24880,
8569,
13976,
24755,
4263,
2035,
10085,
1010,
25869,
3366,
4226,
5897,
7367,
4160,
1007,
1063,
1013,
1013,
21183,
2546,
1011,
1022,
3594,
4098,
1012,
1017,
27507,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/Unpooled.java | Unpooled.copyInt | public static ByteBuf copyInt(int... values) {
if (values == null || values.length == 0) {
return EMPTY_BUFFER;
}
ByteBuf buffer = buffer(values.length * 4);
for (int v: values) {
buffer.writeInt(v);
}
return buffer;
} | java | public static ByteBuf copyInt(int... values) {
if (values == null || values.length == 0) {
return EMPTY_BUFFER;
}
ByteBuf buffer = buffer(values.length * 4);
for (int v: values) {
buffer.writeInt(v);
}
return buffer;
} | [
"public",
"static",
"ByteBuf",
"copyInt",
"(",
"int",
"...",
"values",
")",
"{",
"if",
"(",
"values",
"==",
"null",
"||",
"values",
".",
"length",
"==",
"0",
")",
"{",
"return",
"EMPTY_BUFFER",
";",
"}",
"ByteBuf",
"buffer",
"=",
"buffer",
"(",
"values... | Create a big-endian buffer that holds a sequence of the specified 32-bit integers. | [
"Create",
"a",
"big",
"-",
"endian",
"buffer",
"that",
"holds",
"a",
"sequence",
"of",
"the",
"specified",
"32",
"-",
"bit",
"integers",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L685-L694 | train | Create a new big - endian buffer that holds a sequence of the specified 32 - bit integers. | [
30522,
2270,
10763,
24880,
8569,
2546,
6100,
18447,
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,
24880... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.