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/incubator-shardingsphere | sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/PreparedStatementRoutingEngine.java | PreparedStatementRoutingEngine.route | public SQLRouteResult route(final List<Object> parameters) {
if (null == sqlStatement) {
sqlStatement = shardingRouter.parse(logicSQL, true);
}
return masterSlaveRouter.route(shardingRouter.route(logicSQL, parameters, sqlStatement));
} | java | public SQLRouteResult route(final List<Object> parameters) {
if (null == sqlStatement) {
sqlStatement = shardingRouter.parse(logicSQL, true);
}
return masterSlaveRouter.route(shardingRouter.route(logicSQL, parameters, sqlStatement));
} | [
"public",
"SQLRouteResult",
"route",
"(",
"final",
"List",
"<",
"Object",
">",
"parameters",
")",
"{",
"if",
"(",
"null",
"==",
"sqlStatement",
")",
"{",
"sqlStatement",
"=",
"shardingRouter",
".",
"parse",
"(",
"logicSQL",
",",
"true",
")",
";",
"}",
"r... | SQL route.
<p>First routing time will parse SQL, after second time will reuse first parsed result.</p>
@param parameters parameters of SQL placeholder
@return route result | [
"SQL",
"route",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/PreparedStatementRoutingEngine.java#L62-L67 | train | Route SQL. | [
30522,
2270,
29296,
22494,
3334,
2229,
11314,
2799,
1006,
2345,
2862,
1026,
4874,
1028,
11709,
1007,
1063,
2065,
1006,
19701,
1027,
30524,
4765,
1007,
1063,
29296,
9153,
18532,
4765,
1027,
21146,
17080,
3070,
22494,
3334,
1012,
11968,
3366,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2DivSufSort.java | Bzip2DivSufSort.lsUpdateGroup | private void lsUpdateGroup(final int isa, final int first, final int last) {
final int[] SA = this.SA;
int a, b;
int t;
for (a = first; a < last; ++a) {
if (0 <= SA[a]) {
b = a;
do {
SA[isa + SA[a]] = a;
} while (++a < last && 0 <= SA[a]);
SA[b] = b - a;
if (last <= a) {
break;
}
}
b = a;
do {
SA[a] = ~SA[a];
} while (SA[++a] < 0);
t = a;
do {
SA[isa + SA[b]] = t;
} while (++b <= a);
}
} | java | private void lsUpdateGroup(final int isa, final int first, final int last) {
final int[] SA = this.SA;
int a, b;
int t;
for (a = first; a < last; ++a) {
if (0 <= SA[a]) {
b = a;
do {
SA[isa + SA[a]] = a;
} while (++a < last && 0 <= SA[a]);
SA[b] = b - a;
if (last <= a) {
break;
}
}
b = a;
do {
SA[a] = ~SA[a];
} while (SA[++a] < 0);
t = a;
do {
SA[isa + SA[b]] = t;
} while (++b <= a);
}
} | [
"private",
"void",
"lsUpdateGroup",
"(",
"final",
"int",
"isa",
",",
"final",
"int",
"first",
",",
"final",
"int",
"last",
")",
"{",
"final",
"int",
"[",
"]",
"SA",
"=",
"this",
".",
"SA",
";",
"int",
"a",
",",
"b",
";",
"int",
"t",
";",
"for",
... | /*--------------------------------------------------------------------------- | [
"/",
"*",
"---------------------------------------------------------------------------"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2DivSufSort.java#L1117-L1143 | train | Update the group. | [
30522,
2797,
11675,
21849,
17299,
3686,
17058,
1006,
2345,
20014,
18061,
1010,
2345,
20014,
2034,
1010,
2345,
20014,
2197,
1007,
1063,
2345,
20014,
1031,
1033,
7842,
1027,
2023,
1012,
7842,
1025,
20014,
1037,
1010,
1038,
1025,
20014,
1056,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-mesos/src/main/java/org/apache/flink/mesos/util/MesosConfiguration.java | MesosConfiguration.createDriver | public SchedulerDriver createDriver(Scheduler scheduler, boolean implicitAcknowledgements) {
MesosSchedulerDriver schedulerDriver;
if (this.credential().isDefined()) {
schedulerDriver =
new MesosSchedulerDriver(scheduler, frameworkInfo.build(), this.masterUrl(),
implicitAcknowledgements, this.credential().get().build());
}
else {
schedulerDriver =
new MesosSchedulerDriver(scheduler, frameworkInfo.build(), this.masterUrl(),
implicitAcknowledgements);
}
return schedulerDriver;
} | java | public SchedulerDriver createDriver(Scheduler scheduler, boolean implicitAcknowledgements) {
MesosSchedulerDriver schedulerDriver;
if (this.credential().isDefined()) {
schedulerDriver =
new MesosSchedulerDriver(scheduler, frameworkInfo.build(), this.masterUrl(),
implicitAcknowledgements, this.credential().get().build());
}
else {
schedulerDriver =
new MesosSchedulerDriver(scheduler, frameworkInfo.build(), this.masterUrl(),
implicitAcknowledgements);
}
return schedulerDriver;
} | [
"public",
"SchedulerDriver",
"createDriver",
"(",
"Scheduler",
"scheduler",
",",
"boolean",
"implicitAcknowledgements",
")",
"{",
"MesosSchedulerDriver",
"schedulerDriver",
";",
"if",
"(",
"this",
".",
"credential",
"(",
")",
".",
"isDefined",
"(",
")",
")",
"{",
... | Create the Mesos scheduler driver based on this configuration.
@param scheduler the scheduler to use.
@param implicitAcknowledgements whether to configure the driver for implicit acknowledgements.
@return a scheduler driver. | [
"Create",
"the",
"Mesos",
"scheduler",
"driver",
"based",
"on",
"this",
"configuration",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/util/MesosConfiguration.java#L108-L121 | train | Create a new MesosSchedulerDriver instance. | [
30522,
2270,
6134,
4103,
24352,
2580,
24352,
1006,
6134,
2099,
6134,
2099,
1010,
22017,
20898,
24655,
8684,
19779,
3709,
20511,
2015,
1007,
1063,
2033,
17063,
22842,
8566,
3917,
23663,
2099,
6134,
4103,
24352,
1025,
2065,
1006,
2023,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java | SslContextBuilder.keyManager | public SslContextBuilder keyManager(File keyCertChainFile, File keyFile) {
return keyManager(keyCertChainFile, keyFile, null);
} | java | public SslContextBuilder keyManager(File keyCertChainFile, File keyFile) {
return keyManager(keyCertChainFile, keyFile, null);
} | [
"public",
"SslContextBuilder",
"keyManager",
"(",
"File",
"keyCertChainFile",
",",
"File",
"keyFile",
")",
"{",
"return",
"keyManager",
"(",
"keyCertChainFile",
",",
"keyFile",
",",
"null",
")",
";",
"}"
] | Identifying certificate for this host. {@code keyCertChainFile} and {@code keyFile} may
be {@code null} for client contexts, which disables mutual authentication.
@param keyCertChainFile an X.509 certificate chain file in PEM format
@param keyFile a PKCS#8 private key file in PEM format | [
"Identifying",
"certificate",
"for",
"this",
"host",
".",
"{",
"@code",
"keyCertChainFile",
"}",
"and",
"{",
"@code",
"keyFile",
"}",
"may",
"be",
"{",
"@code",
"null",
"}",
"for",
"client",
"contexts",
"which",
"disables",
"mutual",
"authentication",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L224-L226 | train | Set the key manager. | [
30522,
2270,
7020,
22499,
10111,
18413,
8569,
23891,
2099,
3145,
24805,
4590,
1006,
5371,
3145,
17119,
10649,
8113,
8873,
2571,
1010,
5371,
3145,
8873,
2571,
1007,
1063,
2709,
3145,
24805,
4590,
1006,
3145,
17119,
10649,
8113,
8873,
2571,
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-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java | CliFrontend.main | public static void main(final String[] args) {
EnvironmentInformation.logEnvironmentInfo(LOG, "Command Line Client", args);
// 1. find the configuration directory
final String configurationDirectory = getConfigurationDirectoryFromEnv();
// 2. load the global configuration
final Configuration configuration = GlobalConfiguration.loadConfiguration(configurationDirectory);
// 3. load the custom command lines
final List<CustomCommandLine<?>> customCommandLines = loadCustomCommandLines(
configuration,
configurationDirectory);
try {
final CliFrontend cli = new CliFrontend(
configuration,
customCommandLines);
SecurityUtils.install(new SecurityConfiguration(cli.configuration));
int retCode = SecurityUtils.getInstalledContext()
.runSecured(() -> cli.parseParameters(args));
System.exit(retCode);
}
catch (Throwable t) {
final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
LOG.error("Fatal error while running command line interface.", strippedThrowable);
strippedThrowable.printStackTrace();
System.exit(31);
}
} | java | public static void main(final String[] args) {
EnvironmentInformation.logEnvironmentInfo(LOG, "Command Line Client", args);
// 1. find the configuration directory
final String configurationDirectory = getConfigurationDirectoryFromEnv();
// 2. load the global configuration
final Configuration configuration = GlobalConfiguration.loadConfiguration(configurationDirectory);
// 3. load the custom command lines
final List<CustomCommandLine<?>> customCommandLines = loadCustomCommandLines(
configuration,
configurationDirectory);
try {
final CliFrontend cli = new CliFrontend(
configuration,
customCommandLines);
SecurityUtils.install(new SecurityConfiguration(cli.configuration));
int retCode = SecurityUtils.getInstalledContext()
.runSecured(() -> cli.parseParameters(args));
System.exit(retCode);
}
catch (Throwable t) {
final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
LOG.error("Fatal error while running command line interface.", strippedThrowable);
strippedThrowable.printStackTrace();
System.exit(31);
}
} | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"{",
"EnvironmentInformation",
".",
"logEnvironmentInfo",
"(",
"LOG",
",",
"\"Command Line Client\"",
",",
"args",
")",
";",
"// 1. find the configuration directory",
"final",
"String... | Submits the job based on the arguments. | [
"Submits",
"the",
"job",
"based",
"on",
"the",
"arguments",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java#L1035-L1065 | train | Main method for the command line interface. | [
30522,
2270,
10763,
11675,
2364,
1006,
2345,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
4044,
2378,
14192,
3370,
1012,
8833,
2368,
21663,
2239,
3672,
2378,
14876,
1006,
8833,
1010,
1000,
3094,
2240,
7396,
1000,
1010,
12098,
5620,
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-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.readKeyStore | public static KeyStore readKeyStore(String type, InputStream in, char[] password) {
return KeyUtil.readKeyStore(type, in, password);
} | java | public static KeyStore readKeyStore(String type, InputStream in, char[] password) {
return KeyUtil.readKeyStore(type, in, password);
} | [
"public",
"static",
"KeyStore",
"readKeyStore",
"(",
"String",
"type",
",",
"InputStream",
"in",
",",
"char",
"[",
"]",
"password",
")",
"{",
"return",
"KeyUtil",
".",
"readKeyStore",
"(",
"type",
",",
"in",
",",
"password",
")",
";",
"}"
] | 读取KeyStore文件<br>
KeyStore文件用于数字证书的密钥对保存<br>
see: http://snowolf.iteye.com/blog/391931
@param type 类型
@param in {@link InputStream} 如果想从文件读取.keystore文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取
@param password 密码
@return {@link KeyStore} | [
"读取KeyStore文件<br",
">",
"KeyStore文件用于数字证书的密钥对保存<br",
">",
"see",
":",
"http",
":",
"//",
"snowolf",
".",
"iteye",
".",
"com",
"/",
"blog",
"/",
"391931"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L320-L322 | train | Read a key store from an input stream. | [
30522,
2270,
10763,
6309,
19277,
3191,
14839,
23809,
2063,
1006,
5164,
2828,
1010,
20407,
25379,
1999,
1010,
25869,
1031,
1033,
20786,
1007,
1063,
2709,
3145,
21823,
2140,
1012,
3191,
14839,
23809,
2063,
1006,
2828,
1010,
1999,
1010,
20786,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-system/src/main/java/cn/hutool/system/SystemUtil.java | SystemUtil.append | protected static void append(StringBuilder builder, String caption, Object value) {
builder.append(caption).append(StrUtil.nullToDefault(Convert.toStr(value), "[n/a]")).append("\n");
} | java | protected static void append(StringBuilder builder, String caption, Object value) {
builder.append(caption).append(StrUtil.nullToDefault(Convert.toStr(value), "[n/a]")).append("\n");
} | [
"protected",
"static",
"void",
"append",
"(",
"StringBuilder",
"builder",
",",
"String",
"caption",
",",
"Object",
"value",
")",
"{",
"builder",
".",
"append",
"(",
"caption",
")",
".",
"append",
"(",
"StrUtil",
".",
"nullToDefault",
"(",
"Convert",
".",
"... | 输出到<code>StringBuilder</code>。
@param builder <code>StringBuilder</code>对象
@param caption 标题
@param value 值 | [
"输出到<code",
">",
"StringBuilder<",
"/",
"code",
">",
"。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-system/src/main/java/cn/hutool/system/SystemUtil.java#L469-L471 | train | Append a caption and value to a StringBuilder. | [
30522,
5123,
10763,
11675,
10439,
10497,
1006,
5164,
8569,
23891,
2099,
12508,
1010,
5164,
14408,
3258,
1010,
4874,
3643,
1007,
1063,
12508,
1012,
10439,
10497,
1006,
14408,
3258,
1007,
1012,
10439,
10497,
1006,
2358,
22134,
4014,
1012,
19701... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/OpenSslSessionContext.java | OpenSslSessionContext.setTicketKeys | public void setTicketKeys(OpenSslSessionTicketKey... keys) {
ObjectUtil.checkNotNull(keys, "keys");
SessionTicketKey[] ticketKeys = new SessionTicketKey[keys.length];
for (int i = 0; i < ticketKeys.length; i++) {
ticketKeys[i] = keys[i].key;
}
Lock writerLock = context.ctxLock.writeLock();
writerLock.lock();
try {
SSLContext.clearOptions(context.ctx, SSL.SSL_OP_NO_TICKET);
SSLContext.setSessionTicketKeys(context.ctx, ticketKeys);
} finally {
writerLock.unlock();
}
} | java | public void setTicketKeys(OpenSslSessionTicketKey... keys) {
ObjectUtil.checkNotNull(keys, "keys");
SessionTicketKey[] ticketKeys = new SessionTicketKey[keys.length];
for (int i = 0; i < ticketKeys.length; i++) {
ticketKeys[i] = keys[i].key;
}
Lock writerLock = context.ctxLock.writeLock();
writerLock.lock();
try {
SSLContext.clearOptions(context.ctx, SSL.SSL_OP_NO_TICKET);
SSLContext.setSessionTicketKeys(context.ctx, ticketKeys);
} finally {
writerLock.unlock();
}
} | [
"public",
"void",
"setTicketKeys",
"(",
"OpenSslSessionTicketKey",
"...",
"keys",
")",
"{",
"ObjectUtil",
".",
"checkNotNull",
"(",
"keys",
",",
"\"keys\"",
")",
";",
"SessionTicketKey",
"[",
"]",
"ticketKeys",
"=",
"new",
"SessionTicketKey",
"[",
"keys",
".",
... | Sets the SSL session ticket keys of this context. | [
"Sets",
"the",
"SSL",
"session",
"ticket",
"keys",
"of",
"this",
"context",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionContext.java#L100-L114 | train | Set the session ticket keys. | [
30522,
2270,
11675,
2275,
26348,
3388,
14839,
2015,
1006,
7480,
14540,
8583,
10992,
26348,
3388,
14839,
1012,
1012,
1012,
6309,
1007,
1063,
4874,
21823,
2140,
1012,
4638,
17048,
11231,
3363,
1006,
6309,
1010,
1000,
6309,
1000,
1007,
1025,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java | SSLUtils.createRestClientSSLContext | @Nullable
public static SSLContext createRestClientSSLContext(Configuration config) throws Exception {
final RestSSLContextConfigMode configMode;
if (isRestSSLAuthenticationEnabled(config)) {
configMode = RestSSLContextConfigMode.MUTUAL;
} else {
configMode = RestSSLContextConfigMode.CLIENT;
}
return createRestSSLContext(config, configMode);
} | java | @Nullable
public static SSLContext createRestClientSSLContext(Configuration config) throws Exception {
final RestSSLContextConfigMode configMode;
if (isRestSSLAuthenticationEnabled(config)) {
configMode = RestSSLContextConfigMode.MUTUAL;
} else {
configMode = RestSSLContextConfigMode.CLIENT;
}
return createRestSSLContext(config, configMode);
} | [
"@",
"Nullable",
"public",
"static",
"SSLContext",
"createRestClientSSLContext",
"(",
"Configuration",
"config",
")",
"throws",
"Exception",
"{",
"final",
"RestSSLContextConfigMode",
"configMode",
";",
"if",
"(",
"isRestSSLAuthenticationEnabled",
"(",
"config",
")",
")"... | Creates an SSL context for clients against the external REST endpoint. | [
"Creates",
"an",
"SSL",
"context",
"for",
"clients",
"against",
"the",
"external",
"REST",
"endpoint",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java#L343-L353 | train | Creates a Rest SSL context. | [
30522,
1030,
19701,
3085,
2270,
10763,
7020,
22499,
10111,
18413,
3443,
28533,
20464,
11638,
4757,
22499,
10111,
18413,
1006,
9563,
9530,
8873,
2290,
1007,
11618,
6453,
1063,
2345,
16626,
14540,
8663,
18209,
8663,
8873,
21693,
10244,
9530,
88... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoDS.java | MongoDS.createCredentail | private MongoCredential createCredentail(String userName, String database, String password) {
if (StrUtil.hasEmpty(userName, database, database)) {
return null;
}
return MongoCredential.createCredential(userName, database, password.toCharArray());
} | java | private MongoCredential createCredentail(String userName, String database, String password) {
if (StrUtil.hasEmpty(userName, database, database)) {
return null;
}
return MongoCredential.createCredential(userName, database, password.toCharArray());
} | [
"private",
"MongoCredential",
"createCredentail",
"(",
"String",
"userName",
",",
"String",
"database",
",",
"String",
"password",
")",
"{",
"if",
"(",
"StrUtil",
".",
"hasEmpty",
"(",
"userName",
",",
"database",
",",
"database",
")",
")",
"{",
"return",
"n... | 创建{@link MongoCredential},用于服务端验证
@param userName 用户名
@param database 数据库名
@param password 密码
@return {@link MongoCredential}
@since 4.1.20 | [
"创建",
"{",
"@link",
"MongoCredential",
"}",
",用于服务端验证"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoDS.java#L315-L320 | train | Create a credential. | [
30522,
2797,
12256,
3995,
16748,
16454,
4818,
3443,
16748,
16454,
12502,
1006,
5164,
5310,
18442,
1010,
5164,
7809,
1010,
5164,
20786,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2038,
6633,
13876,
2100,
1006,
5310,
18442,
1010,
7809,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshotData.java | PojoSerializerSnapshotData.createFrom | static <T> PojoSerializerSnapshotData<T> createFrom(
Class<T> pojoClass,
Field[] fields,
TypeSerializer<?>[] fieldSerializers,
LinkedHashMap<Class<?>, TypeSerializer<?>> registeredSubclassSerializers,
Map<Class<?>, TypeSerializer<?>> nonRegisteredSubclassSerializers) {
final LinkedOptionalMap<Field, TypeSerializerSnapshot<?>> fieldSerializerSnapshots = new LinkedOptionalMap<>(fields.length);
for (int i = 0; i < fields.length; i++) {
Field field = fields[i];
String fieldName = (field == null) ? getDummyNameForMissingField(i) : field.getName();
fieldSerializerSnapshots.put(fieldName, field, TypeSerializerUtils.snapshotBackwardsCompatible(fieldSerializers[i]));
}
LinkedHashMap<Class<?>, TypeSerializerSnapshot<?>> registeredSubclassSerializerSnapshots = new LinkedHashMap<>(registeredSubclassSerializers.size());
registeredSubclassSerializers.forEach((k, v) -> registeredSubclassSerializerSnapshots.put(k, TypeSerializerUtils.snapshotBackwardsCompatible(v)));
Map<Class<?>, TypeSerializerSnapshot<?>> nonRegisteredSubclassSerializerSnapshots = new HashMap<>(nonRegisteredSubclassSerializers.size());
nonRegisteredSubclassSerializers.forEach((k, v) -> nonRegisteredSubclassSerializerSnapshots.put(k, TypeSerializerUtils.snapshotBackwardsCompatible(v)));
return new PojoSerializerSnapshotData<>(
pojoClass,
fieldSerializerSnapshots,
optionalMapOf(registeredSubclassSerializerSnapshots, Class::getName),
optionalMapOf(nonRegisteredSubclassSerializerSnapshots, Class::getName));
} | java | static <T> PojoSerializerSnapshotData<T> createFrom(
Class<T> pojoClass,
Field[] fields,
TypeSerializer<?>[] fieldSerializers,
LinkedHashMap<Class<?>, TypeSerializer<?>> registeredSubclassSerializers,
Map<Class<?>, TypeSerializer<?>> nonRegisteredSubclassSerializers) {
final LinkedOptionalMap<Field, TypeSerializerSnapshot<?>> fieldSerializerSnapshots = new LinkedOptionalMap<>(fields.length);
for (int i = 0; i < fields.length; i++) {
Field field = fields[i];
String fieldName = (field == null) ? getDummyNameForMissingField(i) : field.getName();
fieldSerializerSnapshots.put(fieldName, field, TypeSerializerUtils.snapshotBackwardsCompatible(fieldSerializers[i]));
}
LinkedHashMap<Class<?>, TypeSerializerSnapshot<?>> registeredSubclassSerializerSnapshots = new LinkedHashMap<>(registeredSubclassSerializers.size());
registeredSubclassSerializers.forEach((k, v) -> registeredSubclassSerializerSnapshots.put(k, TypeSerializerUtils.snapshotBackwardsCompatible(v)));
Map<Class<?>, TypeSerializerSnapshot<?>> nonRegisteredSubclassSerializerSnapshots = new HashMap<>(nonRegisteredSubclassSerializers.size());
nonRegisteredSubclassSerializers.forEach((k, v) -> nonRegisteredSubclassSerializerSnapshots.put(k, TypeSerializerUtils.snapshotBackwardsCompatible(v)));
return new PojoSerializerSnapshotData<>(
pojoClass,
fieldSerializerSnapshots,
optionalMapOf(registeredSubclassSerializerSnapshots, Class::getName),
optionalMapOf(nonRegisteredSubclassSerializerSnapshots, Class::getName));
} | [
"static",
"<",
"T",
">",
"PojoSerializerSnapshotData",
"<",
"T",
">",
"createFrom",
"(",
"Class",
"<",
"T",
">",
"pojoClass",
",",
"Field",
"[",
"]",
"fields",
",",
"TypeSerializer",
"<",
"?",
">",
"[",
"]",
"fieldSerializers",
",",
"LinkedHashMap",
"<",
... | Creates a {@link PojoSerializerSnapshotData} from configuration of a {@link PojoSerializer}.
<p>This factory method is meant to be used in regular write paths, i.e. when taking a snapshot
of the {@link PojoSerializer}. All registered subclass classes, and non-registered
subclass classes are all present. Some POJO fields may be absent, if the originating
{@link PojoSerializer} was a restored one with already missing fields, and was never replaced
by a new {@link PojoSerializer} (i.e. because the serialized old data was never accessed). | [
"Creates",
"a",
"{",
"@link",
"PojoSerializerSnapshotData",
"}",
"from",
"configuration",
"of",
"a",
"{",
"@link",
"PojoSerializer",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshotData.java#L86-L112 | train | Creates a new instance of the PojoSerializerSnapshotData class. | [
30522,
10763,
1026,
1056,
1028,
13433,
19929,
11610,
28863,
2015,
2532,
4523,
12326,
2850,
2696,
1026,
1056,
1028,
3443,
19699,
5358,
1006,
2465,
1026,
1056,
1028,
13433,
5558,
26266,
1010,
2492,
1031,
1033,
4249,
1010,
4127,
11610,
28863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/util/HandlerRequestUtils.java | HandlerRequestUtils.getQueryParameter | public static <X, P extends MessageQueryParameter<X>, R extends RequestBody, M extends MessageParameters> X getQueryParameter(
final HandlerRequest<R, M> request,
final Class<P> queryParameterClass) throws RestHandlerException {
return getQueryParameter(request, queryParameterClass, null);
} | java | public static <X, P extends MessageQueryParameter<X>, R extends RequestBody, M extends MessageParameters> X getQueryParameter(
final HandlerRequest<R, M> request,
final Class<P> queryParameterClass) throws RestHandlerException {
return getQueryParameter(request, queryParameterClass, null);
} | [
"public",
"static",
"<",
"X",
",",
"P",
"extends",
"MessageQueryParameter",
"<",
"X",
">",
",",
"R",
"extends",
"RequestBody",
",",
"M",
"extends",
"MessageParameters",
">",
"X",
"getQueryParameter",
"(",
"final",
"HandlerRequest",
"<",
"R",
",",
"M",
">",
... | Returns the value of a query parameter, or {@code null} if the query parameter is not set.
@throws RestHandlerException If the query parameter is repeated. | [
"Returns",
"the",
"value",
"of",
"a",
"query",
"parameter",
"or",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/util/HandlerRequestUtils.java#L43-L48 | train | Gets the query parameter. | [
30522,
2270,
10763,
1026,
1060,
1010,
1052,
8908,
4471,
4226,
2854,
28689,
22828,
1026,
1060,
1028,
1010,
1054,
8908,
5227,
23684,
1010,
1049,
8908,
4471,
28689,
22828,
2015,
1028,
1060,
2131,
4226,
2854,
28689,
22828,
1006,
2345,
28213,
28... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java | RadixSort.sortAtByte | private static void sortAtByte(
LongArray array, long numRecords, long[] counts, int byteIdx, long inIndex, long outIndex,
boolean desc, boolean signed) {
assert counts.length == 256;
long[] offsets = transformCountsToOffsets(
counts, numRecords, array.getBaseOffset() + outIndex * 8L, 8, desc, signed);
Object baseObject = array.getBaseObject();
long baseOffset = array.getBaseOffset() + inIndex * 8L;
long maxOffset = baseOffset + numRecords * 8L;
for (long offset = baseOffset; offset < maxOffset; offset += 8) {
long value = Platform.getLong(baseObject, offset);
int bucket = (int)((value >>> (byteIdx * 8)) & 0xff);
Platform.putLong(baseObject, offsets[bucket], value);
offsets[bucket] += 8;
}
} | java | private static void sortAtByte(
LongArray array, long numRecords, long[] counts, int byteIdx, long inIndex, long outIndex,
boolean desc, boolean signed) {
assert counts.length == 256;
long[] offsets = transformCountsToOffsets(
counts, numRecords, array.getBaseOffset() + outIndex * 8L, 8, desc, signed);
Object baseObject = array.getBaseObject();
long baseOffset = array.getBaseOffset() + inIndex * 8L;
long maxOffset = baseOffset + numRecords * 8L;
for (long offset = baseOffset; offset < maxOffset; offset += 8) {
long value = Platform.getLong(baseObject, offset);
int bucket = (int)((value >>> (byteIdx * 8)) & 0xff);
Platform.putLong(baseObject, offsets[bucket], value);
offsets[bucket] += 8;
}
} | [
"private",
"static",
"void",
"sortAtByte",
"(",
"LongArray",
"array",
",",
"long",
"numRecords",
",",
"long",
"[",
"]",
"counts",
",",
"int",
"byteIdx",
",",
"long",
"inIndex",
",",
"long",
"outIndex",
",",
"boolean",
"desc",
",",
"boolean",
"signed",
")",... | Performs a partial sort by copying data into destination offsets for each byte value at the
specified byte offset.
@param array array to partially sort.
@param numRecords number of data records in the array.
@param counts counts for each byte value. This routine destructively modifies this array.
@param byteIdx the byte in a long to sort at, counting from the least significant byte.
@param inIndex the starting index in the array where input data is located.
@param outIndex the starting index where sorted output data should be written.
@param desc whether this is a descending (binary-order) sort.
@param signed whether this is a signed (two's complement) sort (only applies to last byte). | [
"Performs",
"a",
"partial",
"sort",
"by",
"copying",
"data",
"into",
"destination",
"offsets",
"for",
"each",
"byte",
"value",
"at",
"the",
"specified",
"byte",
"offset",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java#L82-L97 | train | Sort the given byte array at the given index. | [
30522,
2797,
10763,
11675,
4066,
4017,
3762,
2618,
1006,
2146,
2906,
9447,
9140,
1010,
2146,
16371,
2213,
2890,
27108,
5104,
1010,
2146,
1031,
1033,
9294,
1010,
20014,
24880,
3593,
2595,
1010,
2146,
1999,
22254,
10288,
1010,
2146,
2041,
222... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/cache/AbstractCacheMap.java | AbstractCacheMap.remove | @Override
public V remove(Object key) {
CachedValue<K, V> entry = map.remove(key);
if (entry != null) {
onValueRemove(entry);
if (!isValueExpired(entry)) {
return (V) entry.getValue();
}
}
return null;
} | java | @Override
public V remove(Object key) {
CachedValue<K, V> entry = map.remove(key);
if (entry != null) {
onValueRemove(entry);
if (!isValueExpired(entry)) {
return (V) entry.getValue();
}
}
return null;
} | [
"@",
"Override",
"public",
"V",
"remove",
"(",
"Object",
"key",
")",
"{",
"CachedValue",
"<",
"K",
",",
"V",
">",
"entry",
"=",
"map",
".",
"remove",
"(",
"key",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"onValueRemove",
"(",
"entry",
... | /*
(non-Javadoc)
@see java.util.Map#remove(java.lang.Object) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/cache/AbstractCacheMap.java#L237-L247 | train | Removes the value associated with the specified key from the cache. | [
30522,
1030,
2058,
15637,
2270,
1058,
6366,
1006,
4874,
3145,
1007,
1063,
17053,
2094,
10175,
5657,
1026,
1047,
1010,
1058,
1028,
4443,
1027,
4949,
1012,
6366,
1006,
3145,
1007,
1025,
2065,
1006,
4443,
999,
1027,
19701,
1007,
1063,
2006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java | FileSystem.exists | public boolean exists(final Path f) throws IOException {
try {
return (getFileStatus(f) != null);
} catch (FileNotFoundException e) {
return false;
}
} | java | public boolean exists(final Path f) throws IOException {
try {
return (getFileStatus(f) != null);
} catch (FileNotFoundException e) {
return false;
}
} | [
"public",
"boolean",
"exists",
"(",
"final",
"Path",
"f",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"(",
"getFileStatus",
"(",
"f",
")",
"!=",
"null",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"return",
"false",
... | Check if exists.
@param f
source file | [
"Check",
"if",
"exists",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java#L583-L589 | train | Checks if the file exists. | [
30522,
2270,
22017,
20898,
6526,
1006,
2345,
4130,
1042,
1007,
11618,
22834,
10288,
24422,
1063,
3046,
1063,
2709,
1006,
2131,
8873,
4244,
29336,
2271,
1006,
1042,
1007,
999,
1027,
19701,
1007,
1025,
1065,
4608,
1006,
5371,
17048,
14876,
86... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRangeOffsets.java | KeyGroupRangeOffsets.getIntersection | public KeyGroupRangeOffsets getIntersection(KeyGroupRange keyGroupRange) {
Preconditions.checkNotNull(keyGroupRange);
KeyGroupRange intersection = this.keyGroupRange.getIntersection(keyGroupRange);
long[] subOffsets = new long[intersection.getNumberOfKeyGroups()];
if(subOffsets.length > 0) {
System.arraycopy(
offsets,
computeKeyGroupIndex(intersection.getStartKeyGroup()),
subOffsets,
0,
subOffsets.length);
}
return new KeyGroupRangeOffsets(intersection, subOffsets);
} | java | public KeyGroupRangeOffsets getIntersection(KeyGroupRange keyGroupRange) {
Preconditions.checkNotNull(keyGroupRange);
KeyGroupRange intersection = this.keyGroupRange.getIntersection(keyGroupRange);
long[] subOffsets = new long[intersection.getNumberOfKeyGroups()];
if(subOffsets.length > 0) {
System.arraycopy(
offsets,
computeKeyGroupIndex(intersection.getStartKeyGroup()),
subOffsets,
0,
subOffsets.length);
}
return new KeyGroupRangeOffsets(intersection, subOffsets);
} | [
"public",
"KeyGroupRangeOffsets",
"getIntersection",
"(",
"KeyGroupRange",
"keyGroupRange",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"keyGroupRange",
")",
";",
"KeyGroupRange",
"intersection",
"=",
"this",
".",
"keyGroupRange",
".",
"getIntersection",
"(",
... | Returns a key-group range with offsets which is the intersection of the internal key-group range with the given
key-group range.
@param keyGroupRange Key-group range to intersect with the internal key-group range.
@return The key-group range with offsets for the intersection of the internal key-group range with the given
key-group range. | [
"Returns",
"a",
"key",
"-",
"group",
"range",
"with",
"offsets",
"which",
"is",
"the",
"intersection",
"of",
"the",
"internal",
"key",
"-",
"group",
"range",
"with",
"the",
"given",
"key",
"-",
"group",
"range",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRangeOffsets.java#L115-L128 | train | Gets the intersection of this key group range and the given key group range. | [
30522,
2270,
3145,
17058,
24388,
8780,
21807,
8454,
2131,
18447,
2545,
18491,
1006,
3145,
17058,
24388,
2063,
3145,
17058,
24388,
2063,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
3145,
17058,
24388,
2063,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/TransportConf.java | TransportConf.chunkFetchHandlerThreads | public int chunkFetchHandlerThreads() {
if (!this.getModuleName().equalsIgnoreCase("shuffle")) {
return 0;
}
int chunkFetchHandlerThreadsPercent =
conf.getInt("spark.shuffle.server.chunkFetchHandlerThreadsPercent", 100);
int threads =
this.serverThreads() > 0 ? this.serverThreads() : 2 * NettyRuntime.availableProcessors();
return (int) Math.ceil(threads * (chunkFetchHandlerThreadsPercent / 100.0));
} | java | public int chunkFetchHandlerThreads() {
if (!this.getModuleName().equalsIgnoreCase("shuffle")) {
return 0;
}
int chunkFetchHandlerThreadsPercent =
conf.getInt("spark.shuffle.server.chunkFetchHandlerThreadsPercent", 100);
int threads =
this.serverThreads() > 0 ? this.serverThreads() : 2 * NettyRuntime.availableProcessors();
return (int) Math.ceil(threads * (chunkFetchHandlerThreadsPercent / 100.0));
} | [
"public",
"int",
"chunkFetchHandlerThreads",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"getModuleName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"\"shuffle\"",
")",
")",
"{",
"return",
"0",
";",
"}",
"int",
"chunkFetchHandlerThreadsPercent",
"=",
"conf",
".... | Percentage of io.serverThreads used by netty to process ChunkFetchRequest.
Shuffle server will use a separate EventLoopGroup to process ChunkFetchRequest messages.
Although when calling the async writeAndFlush on the underlying channel to send
response back to client, the I/O on the channel is still being handled by
{@link org.apache.spark.network.server.TransportServer}'s default EventLoopGroup
that's registered with the Channel, by waiting inside the ChunkFetchRequest handler
threads for the completion of sending back responses, we are able to put a limit on
the max number of threads from TransportServer's default EventLoopGroup that are
going to be consumed by writing response to ChunkFetchRequest, which are I/O intensive
and could take long time to process due to disk contentions. By configuring a slightly
higher number of shuffler server threads, we are able to reserve some threads for
handling other RPC messages, thus making the Client less likely to experience timeout
when sending RPC messages to the shuffle server. The number of threads used for handling
chunked fetch requests are percentage of io.serverThreads (if defined) else it is a percentage
of 2 * #cores. However, a percentage of 0 means netty default number of threads which
is 2 * #cores ignoring io.serverThreads. The percentage here is configured via
spark.shuffle.server.chunkFetchHandlerThreadsPercent. The returned value is rounded off to
ceiling of the nearest integer. | [
"Percentage",
"of",
"io",
".",
"serverThreads",
"used",
"by",
"netty",
"to",
"process",
"ChunkFetchRequest",
".",
"Shuffle",
"server",
"will",
"use",
"a",
"separate",
"EventLoopGroup",
"to",
"process",
"ChunkFetchRequest",
"messages",
".",
"Although",
"when",
"cal... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/TransportConf.java#L333-L342 | train | Get the number of threads that will be used to handle the chunk fetching of the server. | [
30522,
2270,
20014,
20000,
7959,
10649,
11774,
3917,
2705,
16416,
5104,
1006,
1007,
1063,
2065,
1006,
999,
2023,
1012,
2131,
5302,
8566,
20844,
4168,
1006,
1007,
1012,
19635,
23773,
5686,
18382,
1006,
1000,
23046,
1000,
1007,
1007,
1063,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/ValueSerializer.java | ValueSerializer.readObject | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
// kryoRegistrations may be null if this value serializer is deserialized from an old version
if (kryoRegistrations == null) {
this.kryoRegistrations = asKryoRegistrations(type);
}
} | java | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
// kryoRegistrations may be null if this value serializer is deserialized from an old version
if (kryoRegistrations == null) {
this.kryoRegistrations = asKryoRegistrations(type);
}
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"in",
".",
"defaultReadObject",
"(",
")",
";",
"// kryoRegistrations may be null if this value serializer is deserialized from an old version",
"if... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/ValueSerializer.java#L241-L248 | train | Read the object from an input stream. | [
30522,
2797,
11675,
3191,
16429,
20614,
1006,
4874,
2378,
18780,
21422,
1999,
1007,
11618,
22834,
10288,
24422,
1010,
2465,
17048,
14876,
8630,
10288,
24422,
1063,
1999,
1012,
12398,
16416,
3527,
2497,
20614,
1006,
1007,
30524,
4078,
11610,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/common/WordNet.java | WordNet.add | public void add(int line, Vertex vertex)
{
for (Vertex oldVertex : vertexes[line])
{
// 保证唯一性
if (oldVertex.realWord.length() == vertex.realWord.length()) return;
}
vertexes[line].add(vertex);
++size;
} | java | public void add(int line, Vertex vertex)
{
for (Vertex oldVertex : vertexes[line])
{
// 保证唯一性
if (oldVertex.realWord.length() == vertex.realWord.length()) return;
}
vertexes[line].add(vertex);
++size;
} | [
"public",
"void",
"add",
"(",
"int",
"line",
",",
"Vertex",
"vertex",
")",
"{",
"for",
"(",
"Vertex",
"oldVertex",
":",
"vertexes",
"[",
"line",
"]",
")",
"{",
"// 保证唯一性",
"if",
"(",
"oldVertex",
".",
"realWord",
".",
"length",
"(",
")",
"==",
"verte... | 添加顶点
@param line 行号
@param vertex 顶点 | [
"添加顶点"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/WordNet.java#L101-L110 | train | Add a new CRS element to a line of the CRS. | [
30522,
2270,
11675,
5587,
1006,
20014,
2240,
1010,
19449,
19449,
1007,
1063,
2005,
1006,
19449,
2214,
16874,
10288,
1024,
19449,
2229,
1031,
2240,
1033,
1007,
1063,
1013,
1013,
1766,
100,
100,
1740,
100,
2065,
1006,
2214,
16874,
10288,
1012... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONGetter.java | JSONGetter.get | public <T> T get(K key, Class<T> type, boolean ignoreError) throws ConvertException{
final Object value = this.getObj(key);
if(null == value){
return null;
}
return JSONConverter.jsonConvert(type, value, ignoreError);
} | java | public <T> T get(K key, Class<T> type, boolean ignoreError) throws ConvertException{
final Object value = this.getObj(key);
if(null == value){
return null;
}
return JSONConverter.jsonConvert(type, value, ignoreError);
} | [
"public",
"<",
"T",
">",
"T",
"get",
"(",
"K",
"key",
",",
"Class",
"<",
"T",
">",
"type",
",",
"boolean",
"ignoreError",
")",
"throws",
"ConvertException",
"{",
"final",
"Object",
"value",
"=",
"this",
".",
"getObj",
"(",
"key",
")",
";",
"if",
"(... | 获取指定类型的对象
@param <T> 获取的对象类型
@param key 键
@param type 获取对象类型
@param ignoreError 是否跳过转换失败的对象或值
@return 对象
@throws ConvertException 转换异常
@since 3.0.8 | [
"获取指定类型的对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONGetter.java#L126-L132 | train | Get a object from the underlying store. | [
30522,
2270,
1026,
1056,
1028,
1056,
2131,
1006,
1047,
3145,
1010,
2465,
1026,
1056,
1028,
2828,
1010,
22017,
20898,
8568,
2121,
29165,
1007,
11618,
10463,
10288,
24422,
1063,
2345,
4874,
3643,
1027,
2023,
1012,
2131,
16429,
3501,
1006,
314... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/yaml/engine/YamlEngine.java | YamlEngine.unmarshal | public static Map<?, ?> unmarshal(final String yamlContent) {
return Strings.isNullOrEmpty(yamlContent) ? new LinkedHashMap<>() : (Map) new Yaml().load(yamlContent);
} | java | public static Map<?, ?> unmarshal(final String yamlContent) {
return Strings.isNullOrEmpty(yamlContent) ? new LinkedHashMap<>() : (Map) new Yaml().load(yamlContent);
} | [
"public",
"static",
"Map",
"<",
"?",
",",
"?",
">",
"unmarshal",
"(",
"final",
"String",
"yamlContent",
")",
"{",
"return",
"Strings",
".",
"isNullOrEmpty",
"(",
"yamlContent",
")",
"?",
"new",
"LinkedHashMap",
"<>",
"(",
")",
":",
"(",
"Map",
")",
"ne... | Unmarshal YAML.
@param yamlContent YAML content
@return map from YAML | [
"Unmarshal",
"YAML",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/yaml/engine/YamlEngine.java#L96-L98 | train | Unmarshals the given yaml content into a map. | [
30522,
2270,
10763,
4949,
1026,
1029,
1010,
1029,
1028,
4895,
7849,
7377,
2140,
1006,
2345,
5164,
8038,
19968,
8663,
6528,
2102,
1007,
1063,
2709,
7817,
1012,
3475,
18083,
5686,
27718,
2100,
1006,
8038,
19968,
8663,
6528,
2102,
1007,
1029,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Dict.java | Dict.toBeanIgnoreCase | public <T> T toBeanIgnoreCase(T bean) {
BeanUtil.fillBeanWithMapIgnoreCase(this, bean, false);
return bean;
} | java | public <T> T toBeanIgnoreCase(T bean) {
BeanUtil.fillBeanWithMapIgnoreCase(this, bean, false);
return bean;
} | [
"public",
"<",
"T",
">",
"T",
"toBeanIgnoreCase",
"(",
"T",
"bean",
")",
"{",
"BeanUtil",
".",
"fillBeanWithMapIgnoreCase",
"(",
"this",
",",
"bean",
",",
"false",
")",
";",
"return",
"bean",
";",
"}"
] | 转换为Bean对象
@param <T> Bean类型
@param bean Bean
@return Bean
@since 3.3.1 | [
"转换为Bean对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Dict.java#L105-L108 | train | Converts this object to a bean with the same name ignoring case. | [
30522,
2270,
1026,
1056,
1028,
1056,
2000,
4783,
7088,
26745,
2890,
18382,
1006,
1056,
14068,
1007,
1063,
14068,
21823,
2140,
1012,
6039,
4783,
2319,
24415,
2863,
8197,
26745,
2890,
18382,
1006,
2023,
1010,
14068,
1010,
6270,
1007,
1025,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java | ZooKeeperUtils.createZooKeeperStateHandleStore | public static <T extends Serializable> ZooKeeperStateHandleStore<T> createZooKeeperStateHandleStore(
final CuratorFramework client,
final String path,
final RetrievableStateStorageHelper<T> stateStorage) throws Exception {
return new ZooKeeperStateHandleStore<>(useNamespaceAndEnsurePath(client, path), stateStorage);
} | java | public static <T extends Serializable> ZooKeeperStateHandleStore<T> createZooKeeperStateHandleStore(
final CuratorFramework client,
final String path,
final RetrievableStateStorageHelper<T> stateStorage) throws Exception {
return new ZooKeeperStateHandleStore<>(useNamespaceAndEnsurePath(client, path), stateStorage);
} | [
"public",
"static",
"<",
"T",
"extends",
"Serializable",
">",
"ZooKeeperStateHandleStore",
"<",
"T",
">",
"createZooKeeperStateHandleStore",
"(",
"final",
"CuratorFramework",
"client",
",",
"final",
"String",
"path",
",",
"final",
"RetrievableStateStorageHelper",
"<",
... | Creates an instance of {@link ZooKeeperStateHandleStore}.
@param client ZK client
@param path Path to use for the client namespace
@param stateStorage RetrievableStateStorageHelper that persist the actual state and whose
returned state handle is then written to ZooKeeper
@param <T> Type of state
@return {@link ZooKeeperStateHandleStore} instance
@throws Exception ZK errors | [
"Creates",
"an",
"instance",
"of",
"{",
"@link",
"ZooKeeperStateHandleStore",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java#L316-L321 | train | Create a ZooKeeperStateHandleStore. | [
30522,
2270,
10763,
1026,
1056,
8908,
7642,
21335,
3468,
1028,
9201,
24764,
12259,
11774,
4244,
19277,
1026,
1056,
1028,
3443,
23221,
24764,
12259,
11774,
4244,
19277,
1006,
2345,
13023,
15643,
6198,
7396,
1010,
2345,
5164,
4130,
1010,
2345,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java | OptimizerNode.setBroadcastInputs | public void setBroadcastInputs(Map<Operator<?>, OptimizerNode> operatorToNode, ExecutionMode defaultExchangeMode) {
// skip for Operators that don't support broadcast variables
if (!(getOperator() instanceof AbstractUdfOperator<?, ?>)) {
return;
}
// get all broadcast inputs
AbstractUdfOperator<?, ?> operator = ((AbstractUdfOperator<?, ?>) getOperator());
// create connections and add them
for (Map.Entry<String, Operator<?>> input : operator.getBroadcastInputs().entrySet()) {
OptimizerNode predecessor = operatorToNode.get(input.getValue());
DagConnection connection = new DagConnection(predecessor, this,
ShipStrategyType.BROADCAST, defaultExchangeMode);
addBroadcastConnection(input.getKey(), connection);
predecessor.addOutgoingConnection(connection);
}
} | java | public void setBroadcastInputs(Map<Operator<?>, OptimizerNode> operatorToNode, ExecutionMode defaultExchangeMode) {
// skip for Operators that don't support broadcast variables
if (!(getOperator() instanceof AbstractUdfOperator<?, ?>)) {
return;
}
// get all broadcast inputs
AbstractUdfOperator<?, ?> operator = ((AbstractUdfOperator<?, ?>) getOperator());
// create connections and add them
for (Map.Entry<String, Operator<?>> input : operator.getBroadcastInputs().entrySet()) {
OptimizerNode predecessor = operatorToNode.get(input.getValue());
DagConnection connection = new DagConnection(predecessor, this,
ShipStrategyType.BROADCAST, defaultExchangeMode);
addBroadcastConnection(input.getKey(), connection);
predecessor.addOutgoingConnection(connection);
}
} | [
"public",
"void",
"setBroadcastInputs",
"(",
"Map",
"<",
"Operator",
"<",
"?",
">",
",",
"OptimizerNode",
">",
"operatorToNode",
",",
"ExecutionMode",
"defaultExchangeMode",
")",
"{",
"// skip for Operators that don't support broadcast variables ",
"if",
"(",
"!",
"(",
... | This function connects the operators that produce the broadcast inputs to this operator.
@param operatorToNode The map from program operators to optimizer nodes.
@param defaultExchangeMode The data exchange mode to use, if the operator does not
specify one.
@throws CompilerException | [
"This",
"function",
"connects",
"the",
"operators",
"that",
"produce",
"the",
"broadcast",
"inputs",
"to",
"this",
"operator",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java#L177-L194 | train | Adds all broadcast inputs to the given operatorToNode. | [
30522,
2270,
11675,
2275,
12618,
4215,
10526,
2378,
18780,
2015,
1006,
4949,
1026,
6872,
1026,
1029,
1028,
1010,
23569,
27605,
6290,
3630,
3207,
1028,
6872,
2669,
10244,
1010,
7781,
5302,
3207,
12398,
10288,
22305,
6633,
10244,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.toBean | public static <T> T toBean(Class<T> beanClass, ValueProvider<String> valueProvider, CopyOptions copyOptions) {
return fillBean(ReflectUtil.newInstance(beanClass), valueProvider, copyOptions);
} | java | public static <T> T toBean(Class<T> beanClass, ValueProvider<String> valueProvider, CopyOptions copyOptions) {
return fillBean(ReflectUtil.newInstance(beanClass), valueProvider, copyOptions);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"toBean",
"(",
"Class",
"<",
"T",
">",
"beanClass",
",",
"ValueProvider",
"<",
"String",
">",
"valueProvider",
",",
"CopyOptions",
"copyOptions",
")",
"{",
"return",
"fillBean",
"(",
"ReflectUtil",
".",
"newInstance",
... | ServletRequest 参数转Bean
@param <T> Bean类型
@param beanClass Bean Class
@param valueProvider 值提供者
@param copyOptions 拷贝选项,见 {@link CopyOptions}
@return Bean | [
"ServletRequest",
"参数转Bean"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L457-L459 | train | Create a new instance of the specified bean class using the specified value provider. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
2000,
4783,
2319,
1006,
2465,
1026,
1056,
1028,
14068,
26266,
1010,
3643,
21572,
17258,
2121,
1026,
5164,
1028,
3643,
21572,
17258,
2121,
1010,
6100,
7361,
9285,
6100,
7361,
9285,
1007,
1063,
2709... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java | InstrumentedExecutors.privilegedThreadFactory | public static InstrumentedThreadFactory privilegedThreadFactory(MetricRegistry registry, String name) {
return new InstrumentedThreadFactory(Executors.privilegedThreadFactory(), registry, name);
} | java | public static InstrumentedThreadFactory privilegedThreadFactory(MetricRegistry registry, String name) {
return new InstrumentedThreadFactory(Executors.privilegedThreadFactory(), registry, name);
} | [
"public",
"static",
"InstrumentedThreadFactory",
"privilegedThreadFactory",
"(",
"MetricRegistry",
"registry",
",",
"String",
"name",
")",
"{",
"return",
"new",
"InstrumentedThreadFactory",
"(",
"Executors",
".",
"privilegedThreadFactory",
"(",
")",
",",
"registry",
","... | Returns an instrumented thread factory used to create new threads that
have the same permissions as the current thread.
<p>
This factory creates threads with the same settings as {@link
Executors#defaultThreadFactory}, additionally setting the
AccessControlContext and contextClassLoader of new threads to
be the same as the thread invoking this
{@code privilegedThreadFactory} method. A new
{@code privilegedThreadFactory} can be created within an
{@link java.security.AccessController#doPrivileged AccessController.doPrivileged}
action setting the current thread's access control context to
create threads with the selected permission settings holding
within that action.
</p>
<p>Note that while tasks running within such threads will have
the same access control and class loader settings as the
current thread, they need not have the same {@link
java.lang.ThreadLocal} or {@link
java.lang.InheritableThreadLocal} values. If necessary,
particular values of thread locals can be set or reset before
any task runs in {@link ThreadPoolExecutor} subclasses using
{@link ThreadPoolExecutor#beforeExecute(Thread, Runnable)}.
Also, if it is necessary to initialize worker threads to have
the same InheritableThreadLocal settings as some other
designated thread, you can create a custom ThreadFactory in
which that thread waits for and services requests to create
others that will inherit its values.
@param registry the {@link MetricRegistry} that will contain the metrics.
@param name the (metrics) name for this executor service, see {@link MetricRegistry#name(String, String...)}.
@return a thread factory
@throws java.security.AccessControlException if the current access control
context does not have permission to both get and set context
class loader
@see Executors#privilegedThreadFactory() | [
"Returns",
"an",
"instrumented",
"thread",
"factory",
"used",
"to",
"create",
"new",
"threads",
"that",
"have",
"the",
"same",
"permissions",
"as",
"the",
"current",
"thread",
".",
"<p",
">",
"This",
"factory",
"creates",
"threads",
"with",
"the",
"same",
"s... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java#L547-L549 | train | Create a privileged thread factory. | [
30522,
2270,
10763,
6602,
2098,
2705,
16416,
20952,
18908,
10253,
21598,
2705,
16416,
20952,
18908,
10253,
1006,
12046,
2890,
24063,
2854,
15584,
1010,
5164,
2171,
1007,
1063,
2709,
2047,
6602,
2098,
2705,
16416,
20952,
18908,
10253,
1006,
46... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | handler/src/main/java/com/networknt/handler/Handler.java | Handler.addSourceChain | private static void addSourceChain(PathChain sourceChain) {
try {
Class sourceClass = Class.forName(sourceChain.getSource());
EndpointSource source = (EndpointSource)sourceClass.newInstance();
for (EndpointSource.Endpoint endpoint : source.listEndpoints()) {
PathChain sourcedPath = new PathChain();
sourcedPath.setPath(endpoint.getPath());
sourcedPath.setMethod(endpoint.getMethod());
sourcedPath.setExec(sourceChain.getExec());
sourcedPath.validate(sourceChain.getSource());
addPathChain(sourcedPath);
}
} catch (Exception e) {
logger.error("Failed to inject handler.yml paths from: " + sourceChain);
if(e instanceof RuntimeException) {
throw (RuntimeException)e;
} else {
throw new RuntimeException(e);
}
}
} | java | private static void addSourceChain(PathChain sourceChain) {
try {
Class sourceClass = Class.forName(sourceChain.getSource());
EndpointSource source = (EndpointSource)sourceClass.newInstance();
for (EndpointSource.Endpoint endpoint : source.listEndpoints()) {
PathChain sourcedPath = new PathChain();
sourcedPath.setPath(endpoint.getPath());
sourcedPath.setMethod(endpoint.getMethod());
sourcedPath.setExec(sourceChain.getExec());
sourcedPath.validate(sourceChain.getSource());
addPathChain(sourcedPath);
}
} catch (Exception e) {
logger.error("Failed to inject handler.yml paths from: " + sourceChain);
if(e instanceof RuntimeException) {
throw (RuntimeException)e;
} else {
throw new RuntimeException(e);
}
}
} | [
"private",
"static",
"void",
"addSourceChain",
"(",
"PathChain",
"sourceChain",
")",
"{",
"try",
"{",
"Class",
"sourceClass",
"=",
"Class",
".",
"forName",
"(",
"sourceChain",
".",
"getSource",
"(",
")",
")",
";",
"EndpointSource",
"source",
"=",
"(",
"Endpo... | Add PathChains crated from the EndpointSource given in sourceChain | [
"Add",
"PathChains",
"crated",
"from",
"the",
"EndpointSource",
"given",
"in",
"sourceChain"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/handler/src/main/java/com/networknt/handler/Handler.java#L147-L167 | train | Adds the source chain to the path chain. | [
30522,
2797,
10763,
11675,
9909,
8162,
3401,
24925,
2078,
1006,
4130,
24925,
2078,
3120,
24925,
2078,
1007,
1063,
3046,
1063,
2465,
3120,
26266,
1027,
2465,
1012,
2005,
18442,
1006,
3120,
24925,
2078,
1012,
4152,
8162,
3401,
1006,
1007,
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-http/src/main/java/cn/hutool/http/HttpUtil.java | HttpUtil.downloadFile | public static long downloadFile(String url, File destFile, int timeout, StreamProgress streamProgress) {
if (StrUtil.isBlank(url)) {
throw new NullPointerException("[url] is null!");
}
if (null == destFile) {
throw new NullPointerException("[destFile] is null!");
}
final HttpResponse response = HttpRequest.get(url).timeout(timeout).executeAsync();
if (false == response.isOk()) {
throw new HttpException("Server response error with status code: [{}]", response.getStatus());
}
return response.writeBody(destFile, streamProgress);
} | java | public static long downloadFile(String url, File destFile, int timeout, StreamProgress streamProgress) {
if (StrUtil.isBlank(url)) {
throw new NullPointerException("[url] is null!");
}
if (null == destFile) {
throw new NullPointerException("[destFile] is null!");
}
final HttpResponse response = HttpRequest.get(url).timeout(timeout).executeAsync();
if (false == response.isOk()) {
throw new HttpException("Server response error with status code: [{}]", response.getStatus());
}
return response.writeBody(destFile, streamProgress);
} | [
"public",
"static",
"long",
"downloadFile",
"(",
"String",
"url",
",",
"File",
"destFile",
",",
"int",
"timeout",
",",
"StreamProgress",
"streamProgress",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"url",
")",
")",
"{",
"throw",
"new",
"NullPoint... | 下载远程文件
@param url 请求的url
@param destFile 目标文件或目录,当为目录时,取URL中的文件名,取不到使用编码后的URL做为文件名
@param timeout 超时,单位毫秒,-1表示默认超时
@param streamProgress 进度条
@return 文件大小
@since 4.0.4 | [
"下载远程文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L304-L316 | train | Downloads a file from the given URL and writes it to the given file. | [
30522,
2270,
10763,
2146,
8816,
8873,
2571,
1006,
5164,
24471,
2140,
1010,
5371,
4078,
24475,
9463,
1010,
20014,
2051,
5833,
1010,
5460,
21572,
17603,
4757,
5460,
21572,
17603,
4757,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslHandler.java | SslHandler.setHandshakeFailure | private void setHandshakeFailure(ChannelHandlerContext ctx, Throwable cause) {
setHandshakeFailure(ctx, cause, true, true, false);
} | java | private void setHandshakeFailure(ChannelHandlerContext ctx, Throwable cause) {
setHandshakeFailure(ctx, cause, true, true, false);
} | [
"private",
"void",
"setHandshakeFailure",
"(",
"ChannelHandlerContext",
"ctx",
",",
"Throwable",
"cause",
")",
"{",
"setHandshakeFailure",
"(",
"ctx",
",",
"cause",
",",
"true",
",",
"true",
",",
"false",
")",
";",
"}"
] | Notify all the handshake futures about the failure during the handshake. | [
"Notify",
"all",
"the",
"handshake",
"futures",
"about",
"the",
"failure",
"during",
"the",
"handshake",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslHandler.java#L1759-L1761 | train | Set the handshake failure. | [
30522,
2797,
11675,
6662,
29560,
20459,
30524,
1010,
3426,
1010,
2995,
1010,
2995,
1010,
6270,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-socks/src/main/java/io/netty/handler/codec/socks/SocksCommonUtils.java | SocksCommonUtils.ipv6toStr | public static String ipv6toStr(byte[] src) {
assert src.length == 16;
StringBuilder sb = new StringBuilder(39);
ipv6toStr(sb, src, 0, 8);
return sb.toString();
} | java | public static String ipv6toStr(byte[] src) {
assert src.length == 16;
StringBuilder sb = new StringBuilder(39);
ipv6toStr(sb, src, 0, 8);
return sb.toString();
} | [
"public",
"static",
"String",
"ipv6toStr",
"(",
"byte",
"[",
"]",
"src",
")",
"{",
"assert",
"src",
".",
"length",
"==",
"16",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"39",
")",
";",
"ipv6toStr",
"(",
"sb",
",",
"src",
",",
"0",... | Converts numeric IPv6 to standard (non-compressed) format. | [
"Converts",
"numeric",
"IPv6",
"to",
"standard",
"(",
"non",
"-",
"compressed",
")",
"format",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksCommonUtils.java#L38-L43 | train | Convert an IPv6 address to a string. | [
30522,
2270,
10763,
5164,
12997,
2615,
2575,
13122,
16344,
1006,
24880,
1031,
1033,
5034,
2278,
1007,
1063,
20865,
5034,
2278,
1012,
3091,
1027,
1027,
2385,
1025,
5164,
8569,
23891,
2099,
24829,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
44... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.copy | public static File copy(File src, File dest, boolean isOverride) throws IORuntimeException {
return FileCopier.create(src, dest).setOverride(isOverride).copy();
} | java | public static File copy(File src, File dest, boolean isOverride) throws IORuntimeException {
return FileCopier.create(src, dest).setOverride(isOverride).copy();
} | [
"public",
"static",
"File",
"copy",
"(",
"File",
"src",
",",
"File",
"dest",
",",
"boolean",
"isOverride",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileCopier",
".",
"create",
"(",
"src",
",",
"dest",
")",
".",
"setOverride",
"(",
"isOverride",
... | 复制文件或目录<br>
情况如下:
<pre>
1、src和dest都为目录,则将src目录及其目录下所有文件目录拷贝到dest下
2、src和dest都为文件,直接复制,名字为dest
3、src为文件,dest为目录,将src拷贝到dest目录下
</pre>
@param src 源文件
@param dest 目标文件或目录,目标不存在会自动创建(目录、文件都创建)
@param isOverride 是否覆盖目标文件
@return 目标目录或文件
@throws IORuntimeException IO异常 | [
"复制文件或目录<br",
">",
"情况如下:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1003-L1005 | train | Copies the source file to the destination file. | [
30522,
2270,
10763,
5371,
6100,
1006,
5371,
5034,
2278,
1010,
5371,
4078,
2102,
1010,
22017,
20898,
11163,
6299,
15637,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
5371,
3597,
14756,
2099,
1012,
3443,
1006,
5034,
2278,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/IterativeStream.java | IterativeStream.closeWith | @SuppressWarnings({ "unchecked", "rawtypes" })
public DataStream<T> closeWith(DataStream<T> feedbackStream) {
Collection<StreamTransformation<?>> predecessors = feedbackStream.getTransformation().getTransitivePredecessors();
if (!predecessors.contains(this.transformation)) {
throw new UnsupportedOperationException(
"Cannot close an iteration with a feedback DataStream that does not originate from said iteration.");
}
((FeedbackTransformation) getTransformation()).addFeedbackEdge(feedbackStream.getTransformation());
return feedbackStream;
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public DataStream<T> closeWith(DataStream<T> feedbackStream) {
Collection<StreamTransformation<?>> predecessors = feedbackStream.getTransformation().getTransitivePredecessors();
if (!predecessors.contains(this.transformation)) {
throw new UnsupportedOperationException(
"Cannot close an iteration with a feedback DataStream that does not originate from said iteration.");
}
((FeedbackTransformation) getTransformation()).addFeedbackEdge(feedbackStream.getTransformation());
return feedbackStream;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"DataStream",
"<",
"T",
">",
"closeWith",
"(",
"DataStream",
"<",
"T",
">",
"feedbackStream",
")",
"{",
"Collection",
"<",
"StreamTransformation",
"<",
"?",
">",
">"... | Closes the iteration. This method defines the end of the iterative
program part that will be fed back to the start of the iteration.
<p>A common usage pattern for streaming iterations is to use output
splitting to send a part of the closing data stream to the head. Refer to
{@link DataStream#split(org.apache.flink.streaming.api.collector.selector.OutputSelector)}
for more information.
@param feedbackStream
{@link DataStream} that will be used as input to the iteration
head.
@return The feedback stream. | [
"Closes",
"the",
"iteration",
".",
"This",
"method",
"defines",
"the",
"end",
"of",
"the",
"iterative",
"program",
"part",
"that",
"will",
"be",
"fed",
"back",
"to",
"the",
"start",
"of",
"the",
"iteration",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/IterativeStream.java#L67-L80 | train | Closes the iteration with the given feedback DataStream. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
4895,
5403,
18141,
1000,
1010,
1000,
6315,
13874,
2015,
1000,
1065,
1007,
2270,
2951,
21422,
1026,
1056,
1028,
2485,
24415,
1006,
2951,
21422,
1026,
1056,
1028,
12247,
21422,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/statement/dcl/DCLStatement.java | DCLStatement.isDCL | public static boolean isDCL(final TokenType primaryTokenType, final TokenType secondaryTokenType) {
return STATEMENT_PREFIX.contains(primaryTokenType) || (PRIMARY_STATEMENT_PREFIX.contains(primaryTokenType) && SECONDARY_STATEMENT_PREFIX.contains(secondaryTokenType));
} | java | public static boolean isDCL(final TokenType primaryTokenType, final TokenType secondaryTokenType) {
return STATEMENT_PREFIX.contains(primaryTokenType) || (PRIMARY_STATEMENT_PREFIX.contains(primaryTokenType) && SECONDARY_STATEMENT_PREFIX.contains(secondaryTokenType));
} | [
"public",
"static",
"boolean",
"isDCL",
"(",
"final",
"TokenType",
"primaryTokenType",
",",
"final",
"TokenType",
"secondaryTokenType",
")",
"{",
"return",
"STATEMENT_PREFIX",
".",
"contains",
"(",
"primaryTokenType",
")",
"||",
"(",
"PRIMARY_STATEMENT_PREFIX",
".",
... | Is DCL statement.
@param primaryTokenType primary token type
@param secondaryTokenType secondary token type
@return is DCL or not | [
"Is",
"DCL",
"statement",
"."
] | 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/sql/statement/dcl/DCLStatement.java#L56-L58 | train | Is DCL. | [
30522,
2270,
10763,
22017,
20898,
2003,
16409,
2140,
1006,
2345,
19204,
13874,
3078,
18715,
4765,
18863,
1010,
2345,
19204,
13874,
3905,
18715,
4765,
18863,
1007,
1063,
2709,
4861,
1035,
17576,
1012,
3397,
1006,
3078,
18715,
4765,
18863,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/logging/MessageFormatter.java | MessageFormatter.format | static FormattingTuple format(String messagePattern, Object arg) {
return arrayFormat(messagePattern, new Object[]{arg});
} | java | static FormattingTuple format(String messagePattern, Object arg) {
return arrayFormat(messagePattern, new Object[]{arg});
} | [
"static",
"FormattingTuple",
"format",
"(",
"String",
"messagePattern",
",",
"Object",
"arg",
")",
"{",
"return",
"arrayFormat",
"(",
"messagePattern",
",",
"new",
"Object",
"[",
"]",
"{",
"arg",
"}",
")",
";",
"}"
] | Performs single argument substitution for the 'messagePattern' passed as
parameter.
<p/>
For example,
<p/>
<pre>
MessageFormatter.format("Hi {}.", "there");
</pre>
<p/>
will return the string "Hi there.".
<p/>
@param messagePattern The message pattern which will be parsed and formatted
@param arg The argument to be substituted in place of the formatting anchor
@return The formatted message | [
"Performs",
"single",
"argument",
"substitution",
"for",
"the",
"messagePattern",
"passed",
"as",
"parameter",
".",
"<p",
"/",
">",
"For",
"example",
"<p",
"/",
">",
"<pre",
">",
"MessageFormatter",
".",
"format",
"(",
""",
";",
"Hi",
"{}",
".",
""... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/logging/MessageFormatter.java#L132-L134 | train | Format a message pattern with an argument. | [
30522,
10763,
4289,
3436,
8525,
10814,
4289,
1006,
5164,
4471,
4502,
12079,
2078,
1010,
4874,
12098,
2290,
1007,
1063,
2709,
9140,
14192,
4017,
1006,
4471,
4502,
12079,
2078,
1010,
2047,
4874,
1031,
1033,
1063,
12098,
2290,
1065,
1007,
1025... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerServicesConfiguration.java | TaskManagerServicesConfiguration.fromConfiguration | public static TaskManagerServicesConfiguration fromConfiguration(
Configuration configuration,
long maxJvmHeapMemory,
InetAddress remoteAddress,
boolean localCommunication) {
final String[] tmpDirs = ConfigurationUtils.parseTempDirectories(configuration);
String[] localStateRootDir = ConfigurationUtils.parseLocalStateDirectories(configuration);
if (localStateRootDir.length == 0) {
// default to temp dirs.
localStateRootDir = tmpDirs;
}
boolean localRecoveryMode = configuration.getBoolean(CheckpointingOptions.LOCAL_RECOVERY);
final NetworkEnvironmentConfiguration networkConfig = NetworkEnvironmentConfiguration.fromConfiguration(
configuration,
maxJvmHeapMemory,
localCommunication,
remoteAddress);
final QueryableStateConfiguration queryableStateConfig = QueryableStateConfiguration.fromConfiguration(configuration);
boolean preAllocateMemory = configuration.getBoolean(TaskManagerOptions.MANAGED_MEMORY_PRE_ALLOCATE);
long timerServiceShutdownTimeout = AkkaUtils.getTimeout(configuration).toMillis();
final RetryingRegistrationConfiguration retryingRegistrationConfiguration = RetryingRegistrationConfiguration.fromConfiguration(configuration);
return new TaskManagerServicesConfiguration(
remoteAddress,
tmpDirs,
localStateRootDir,
localRecoveryMode,
networkConfig,
queryableStateConfig,
ConfigurationParserUtils.getSlot(configuration),
ConfigurationParserUtils.getManagedMemorySize(configuration),
ConfigurationParserUtils.getMemoryType(configuration),
preAllocateMemory,
ConfigurationParserUtils.getManagedMemoryFraction(configuration),
timerServiceShutdownTimeout,
retryingRegistrationConfiguration,
ConfigurationUtils.getSystemResourceMetricsProbingInterval(configuration));
} | java | public static TaskManagerServicesConfiguration fromConfiguration(
Configuration configuration,
long maxJvmHeapMemory,
InetAddress remoteAddress,
boolean localCommunication) {
final String[] tmpDirs = ConfigurationUtils.parseTempDirectories(configuration);
String[] localStateRootDir = ConfigurationUtils.parseLocalStateDirectories(configuration);
if (localStateRootDir.length == 0) {
// default to temp dirs.
localStateRootDir = tmpDirs;
}
boolean localRecoveryMode = configuration.getBoolean(CheckpointingOptions.LOCAL_RECOVERY);
final NetworkEnvironmentConfiguration networkConfig = NetworkEnvironmentConfiguration.fromConfiguration(
configuration,
maxJvmHeapMemory,
localCommunication,
remoteAddress);
final QueryableStateConfiguration queryableStateConfig = QueryableStateConfiguration.fromConfiguration(configuration);
boolean preAllocateMemory = configuration.getBoolean(TaskManagerOptions.MANAGED_MEMORY_PRE_ALLOCATE);
long timerServiceShutdownTimeout = AkkaUtils.getTimeout(configuration).toMillis();
final RetryingRegistrationConfiguration retryingRegistrationConfiguration = RetryingRegistrationConfiguration.fromConfiguration(configuration);
return new TaskManagerServicesConfiguration(
remoteAddress,
tmpDirs,
localStateRootDir,
localRecoveryMode,
networkConfig,
queryableStateConfig,
ConfigurationParserUtils.getSlot(configuration),
ConfigurationParserUtils.getManagedMemorySize(configuration),
ConfigurationParserUtils.getMemoryType(configuration),
preAllocateMemory,
ConfigurationParserUtils.getManagedMemoryFraction(configuration),
timerServiceShutdownTimeout,
retryingRegistrationConfiguration,
ConfigurationUtils.getSystemResourceMetricsProbingInterval(configuration));
} | [
"public",
"static",
"TaskManagerServicesConfiguration",
"fromConfiguration",
"(",
"Configuration",
"configuration",
",",
"long",
"maxJvmHeapMemory",
",",
"InetAddress",
"remoteAddress",
",",
"boolean",
"localCommunication",
")",
"{",
"final",
"String",
"[",
"]",
"tmpDirs"... | Utility method to extract TaskManager config parameters from the configuration and to
sanity check them.
@param configuration The configuration.
@param maxJvmHeapMemory The maximum JVM heap size, in bytes.
@param remoteAddress identifying the IP address under which the TaskManager will be accessible
@param localCommunication True, to skip initializing the network stack.
Use only in cases where only one task manager runs.
@return TaskExecutorConfiguration that wrappers InstanceConnectionInfo, NetworkEnvironmentConfiguration, etc. | [
"Utility",
"method",
"to",
"extract",
"TaskManager",
"config",
"parameters",
"from",
"the",
"configuration",
"and",
"to",
"sanity",
"check",
"them",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerServicesConfiguration.java#L205-L248 | train | Creates a new TaskManagerServicesConfiguration from the given configuration. | [
30522,
2270,
10763,
4708,
24805,
15776,
2121,
7903,
2229,
8663,
8873,
27390,
3370,
2013,
8663,
8873,
27390,
3370,
1006,
9563,
9563,
1010,
2146,
4098,
3501,
2615,
2213,
20192,
9737,
6633,
10253,
1010,
1999,
12928,
14141,
8303,
6556,
4215,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.writeAsText | public DataSink<T> writeAsText(String filePath, WriteMode writeMode) {
TextOutputFormat<T> tof = new TextOutputFormat<>(new Path(filePath));
tof.setWriteMode(writeMode);
return output(tof);
} | java | public DataSink<T> writeAsText(String filePath, WriteMode writeMode) {
TextOutputFormat<T> tof = new TextOutputFormat<>(new Path(filePath));
tof.setWriteMode(writeMode);
return output(tof);
} | [
"public",
"DataSink",
"<",
"T",
">",
"writeAsText",
"(",
"String",
"filePath",
",",
"WriteMode",
"writeMode",
")",
"{",
"TextOutputFormat",
"<",
"T",
">",
"tof",
"=",
"new",
"TextOutputFormat",
"<>",
"(",
"new",
"Path",
"(",
"filePath",
")",
")",
";",
"t... | Writes a DataSet as text file(s) to the specified location.
<p>For each element of the DataSet the result of {@link Object#toString()} is written.
@param filePath The path pointing to the location the text file is written to.
@param writeMode Control the behavior for existing files. Options are NO_OVERWRITE and OVERWRITE.
@return The DataSink that writes the DataSet.
@see TextOutputFormat
@see DataSet#writeAsText(String) Output files and directories | [
"Writes",
"a",
"DataSet",
"as",
"text",
"file",
"(",
"s",
")",
"to",
"the",
"specified",
"location",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1508-L1512 | train | Write the data to a file as text. | [
30522,
2270,
2951,
11493,
2243,
1026,
1056,
1028,
4339,
14083,
10288,
2102,
1006,
5164,
5371,
15069,
1010,
4339,
5302,
3207,
4339,
5302,
3207,
1007,
1063,
3793,
5833,
18780,
14192,
4017,
1026,
1056,
1028,
2000,
2546,
1027,
2047,
3793,
5833,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/validation/InvalidVertexIdsValidator.java | InvalidVertexIdsValidator.validate | @Override
public boolean validate(Graph<K, VV, EV> graph) throws Exception {
DataSet<Tuple1<K>> edgeIds = graph.getEdges()
.flatMap(new MapEdgeIds<>()).distinct();
DataSet<K> invalidIds = graph.getVertices().coGroup(edgeIds).where(0)
.equalTo(0).with(new GroupInvalidIds<>()).first(1);
return invalidIds.map(new KToTupleMap<>()).count() == 0;
} | java | @Override
public boolean validate(Graph<K, VV, EV> graph) throws Exception {
DataSet<Tuple1<K>> edgeIds = graph.getEdges()
.flatMap(new MapEdgeIds<>()).distinct();
DataSet<K> invalidIds = graph.getVertices().coGroup(edgeIds).where(0)
.equalTo(0).with(new GroupInvalidIds<>()).first(1);
return invalidIds.map(new KToTupleMap<>()).count() == 0;
} | [
"@",
"Override",
"public",
"boolean",
"validate",
"(",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"graph",
")",
"throws",
"Exception",
"{",
"DataSet",
"<",
"Tuple1",
"<",
"K",
">>",
"edgeIds",
"=",
"graph",
".",
"getEdges",
"(",
")",
".",
"flatMap... | Checks that the edge set input contains valid vertex Ids, i.e. that they
also exist in the vertex input set.
@return a boolean stating whether a graph is valid
with respect to its vertex ids. | [
"Checks",
"that",
"the",
"edge",
"set",
"input",
"contains",
"valid",
"vertex",
"Ids",
"i",
".",
"e",
".",
"that",
"they",
"also",
"exist",
"in",
"the",
"vertex",
"input",
"set",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/validation/InvalidVertexIdsValidator.java#L48-L56 | train | Validate the graph. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
9398,
3686,
1006,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
30524,
1027,
10629,
1012,
2131,
24225,
2015,
1006,
1007,
1012,
4257,
2863,
2361,
1006,
2047,
4949,
24225,
9821,
1026,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.compress | public static void compress(File imageFile, File outFile, float quality) throws IORuntimeException {
Img.from(imageFile).setQuality(quality).write(outFile);
} | java | public static void compress(File imageFile, File outFile, float quality) throws IORuntimeException {
Img.from(imageFile).setQuality(quality).write(outFile);
} | [
"public",
"static",
"void",
"compress",
"(",
"File",
"imageFile",
",",
"File",
"outFile",
",",
"float",
"quality",
")",
"throws",
"IORuntimeException",
"{",
"Img",
".",
"from",
"(",
"imageFile",
")",
".",
"setQuality",
"(",
"quality",
")",
".",
"write",
"(... | 压缩图像,输出图像只支持jpg文件
@param imageFile 图像文件
@param outFile 输出文件,只支持jpg文件
@throws IORuntimeException IO异常
@since 4.3.2 | [
"压缩图像,输出图像只支持jpg文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1130-L1132 | train | Compress the image file to a file with the specified quality. | [
30522,
2270,
10763,
11675,
4012,
20110,
1006,
5371,
3746,
8873,
2571,
1010,
5371,
2041,
8873,
2571,
1010,
14257,
3737,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
10047,
2290,
1012,
2013,
1006,
3746,
8873,
2571,
1007,
1012,
2275,
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... |
alibaba/canal | meta/src/main/java/com/alibaba/otter/canal/meta/FileMixedMetaManager.java | FileMixedMetaManager.getDataFile | private File getDataFile(String destination) {
File destinationMetaDir = new File(dataDir, destination);
if (!destinationMetaDir.exists()) {
try {
FileUtils.forceMkdir(destinationMetaDir);
} catch (IOException e) {
throw new CanalMetaManagerException(e);
}
}
return new File(destinationMetaDir, dataFileName);
} | java | private File getDataFile(String destination) {
File destinationMetaDir = new File(dataDir, destination);
if (!destinationMetaDir.exists()) {
try {
FileUtils.forceMkdir(destinationMetaDir);
} catch (IOException e) {
throw new CanalMetaManagerException(e);
}
}
return new File(destinationMetaDir, dataFileName);
} | [
"private",
"File",
"getDataFile",
"(",
"String",
"destination",
")",
"{",
"File",
"destinationMetaDir",
"=",
"new",
"File",
"(",
"dataDir",
",",
"destination",
")",
";",
"if",
"(",
"!",
"destinationMetaDir",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
... | ============================ helper method ====================== | [
"============================",
"helper",
"method",
"======================"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/meta/src/main/java/com/alibaba/otter/canal/meta/FileMixedMetaManager.java#L181-L192 | train | Get the data file. | [
30522,
2797,
5371,
2131,
2850,
2696,
8873,
2571,
1006,
5164,
7688,
1007,
1063,
5371,
7688,
11368,
17190,
2099,
1027,
2047,
5371,
1006,
2951,
4305,
2099,
1010,
7688,
1007,
1025,
2065,
1006,
999,
7688,
11368,
17190,
2099,
1012,
6526,
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/executiongraph/restart/RestartStrategyFactory.java | RestartStrategyFactory.createRestartStrategy | public static RestartStrategy createRestartStrategy(RestartStrategies.RestartStrategyConfiguration restartStrategyConfiguration) {
if (restartStrategyConfiguration instanceof RestartStrategies.NoRestartStrategyConfiguration) {
return new NoRestartStrategy();
} else if (restartStrategyConfiguration instanceof RestartStrategies.FixedDelayRestartStrategyConfiguration) {
RestartStrategies.FixedDelayRestartStrategyConfiguration fixedDelayConfig =
(RestartStrategies.FixedDelayRestartStrategyConfiguration) restartStrategyConfiguration;
return new FixedDelayRestartStrategy(
fixedDelayConfig.getRestartAttempts(),
fixedDelayConfig.getDelayBetweenAttemptsInterval().toMilliseconds());
} else if (restartStrategyConfiguration instanceof RestartStrategies.FailureRateRestartStrategyConfiguration) {
RestartStrategies.FailureRateRestartStrategyConfiguration config =
(RestartStrategies.FailureRateRestartStrategyConfiguration) restartStrategyConfiguration;
return new FailureRateRestartStrategy(
config.getMaxFailureRate(),
config.getFailureInterval(),
config.getDelayBetweenAttemptsInterval()
);
} else if (restartStrategyConfiguration instanceof RestartStrategies.FallbackRestartStrategyConfiguration) {
return null;
} else {
throw new IllegalArgumentException("Unknown restart strategy configuration " +
restartStrategyConfiguration + ".");
}
} | java | public static RestartStrategy createRestartStrategy(RestartStrategies.RestartStrategyConfiguration restartStrategyConfiguration) {
if (restartStrategyConfiguration instanceof RestartStrategies.NoRestartStrategyConfiguration) {
return new NoRestartStrategy();
} else if (restartStrategyConfiguration instanceof RestartStrategies.FixedDelayRestartStrategyConfiguration) {
RestartStrategies.FixedDelayRestartStrategyConfiguration fixedDelayConfig =
(RestartStrategies.FixedDelayRestartStrategyConfiguration) restartStrategyConfiguration;
return new FixedDelayRestartStrategy(
fixedDelayConfig.getRestartAttempts(),
fixedDelayConfig.getDelayBetweenAttemptsInterval().toMilliseconds());
} else if (restartStrategyConfiguration instanceof RestartStrategies.FailureRateRestartStrategyConfiguration) {
RestartStrategies.FailureRateRestartStrategyConfiguration config =
(RestartStrategies.FailureRateRestartStrategyConfiguration) restartStrategyConfiguration;
return new FailureRateRestartStrategy(
config.getMaxFailureRate(),
config.getFailureInterval(),
config.getDelayBetweenAttemptsInterval()
);
} else if (restartStrategyConfiguration instanceof RestartStrategies.FallbackRestartStrategyConfiguration) {
return null;
} else {
throw new IllegalArgumentException("Unknown restart strategy configuration " +
restartStrategyConfiguration + ".");
}
} | [
"public",
"static",
"RestartStrategy",
"createRestartStrategy",
"(",
"RestartStrategies",
".",
"RestartStrategyConfiguration",
"restartStrategyConfiguration",
")",
"{",
"if",
"(",
"restartStrategyConfiguration",
"instanceof",
"RestartStrategies",
".",
"NoRestartStrategyConfiguratio... | Creates a {@link RestartStrategy} instance from the given {@link org.apache.flink.api.common.restartstrategy.RestartStrategies.RestartStrategyConfiguration}.
@param restartStrategyConfiguration Restart strategy configuration which specifies which
restart strategy to instantiate
@return RestartStrategy instance | [
"Creates",
"a",
"{",
"@link",
"RestartStrategy",
"}",
"instance",
"from",
"the",
"given",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"api",
".",
"common",
".",
"restartstrategy",
".",
"RestartStrategies",
".",
"RestartStrategyConfiguration",
"}",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/restart/RestartStrategyFactory.java#L52-L76 | train | Creates a restart strategy from the given configuration. | [
30522,
2270,
10763,
23818,
20528,
2618,
6292,
3443,
28533,
20591,
6494,
2618,
6292,
1006,
23818,
20528,
2618,
17252,
1012,
23818,
20528,
2618,
6292,
8663,
8873,
27390,
3370,
23818,
20528,
2618,
6292,
8663,
8873,
27390,
3370,
1007,
1063,
2065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.validateSelect | protected void validateSelect(
SqlSelect select,
RelDataType targetRowType) {
assert targetRowType != null;
// Namespace is either a select namespace or a wrapper around one.
final SelectNamespace ns =
getNamespace(select).unwrap(SelectNamespace.class);
// Its rowtype is null, meaning it hasn't been validated yet.
// This is important, because we need to take the targetRowType into
// account.
assert ns.rowType == null;
if (select.isDistinct()) {
validateFeature(RESOURCE.sQLFeature_E051_01(),
select.getModifierNode(SqlSelectKeyword.DISTINCT)
.getParserPosition());
}
final SqlNodeList selectItems = select.getSelectList();
RelDataType fromType = unknownType;
if (selectItems.size() == 1) {
final SqlNode selectItem = selectItems.get(0);
if (selectItem instanceof SqlIdentifier) {
SqlIdentifier id = (SqlIdentifier) selectItem;
if (id.isStar() && (id.names.size() == 1)) {
// Special case: for INSERT ... VALUES(?,?), the SQL
// standard says we're supposed to propagate the target
// types down. So iff the select list is an unqualified
// star (as it will be after an INSERT ... VALUES has been
// expanded), then propagate.
fromType = targetRowType;
}
}
}
// Make sure that items in FROM clause have distinct aliases.
final SelectScope fromScope = (SelectScope) getFromScope(select);
List<String> names = fromScope.getChildNames();
if (!catalogReader.nameMatcher().isCaseSensitive()) {
names = Lists.transform(names, s -> s.toUpperCase(Locale.ROOT));
}
final int duplicateAliasOrdinal = Util.firstDuplicate(names);
if (duplicateAliasOrdinal >= 0) {
final ScopeChild child =
fromScope.children.get(duplicateAliasOrdinal);
throw newValidationError(child.namespace.getEnclosingNode(),
RESOURCE.fromAliasDuplicate(child.name));
}
if (select.getFrom() == null) {
if (conformance.isFromRequired()) {
throw newValidationError(select, RESOURCE.selectMissingFrom());
}
} else {
validateFrom(select.getFrom(), fromType, fromScope);
}
validateWhereClause(select);
validateGroupClause(select);
validateHavingClause(select);
validateWindowClause(select);
handleOffsetFetch(select.getOffset(), select.getFetch());
// Validate the SELECT clause late, because a select item might
// depend on the GROUP BY list, or the window function might reference
// window name in the WINDOW clause etc.
final RelDataType rowType =
validateSelectList(selectItems, select, targetRowType);
ns.setType(rowType);
// Validate ORDER BY after we have set ns.rowType because in some
// dialects you can refer to columns of the select list, e.g.
// "SELECT empno AS x FROM emp ORDER BY x"
validateOrderList(select);
if (shouldCheckForRollUp(select.getFrom())) {
checkRollUpInSelectList(select);
checkRollUp(null, select, select.getWhere(), getWhereScope(select));
checkRollUp(null, select, select.getHaving(), getHavingScope(select));
checkRollUpInWindowDecl(select);
checkRollUpInGroupBy(select);
checkRollUpInOrderBy(select);
}
} | java | protected void validateSelect(
SqlSelect select,
RelDataType targetRowType) {
assert targetRowType != null;
// Namespace is either a select namespace or a wrapper around one.
final SelectNamespace ns =
getNamespace(select).unwrap(SelectNamespace.class);
// Its rowtype is null, meaning it hasn't been validated yet.
// This is important, because we need to take the targetRowType into
// account.
assert ns.rowType == null;
if (select.isDistinct()) {
validateFeature(RESOURCE.sQLFeature_E051_01(),
select.getModifierNode(SqlSelectKeyword.DISTINCT)
.getParserPosition());
}
final SqlNodeList selectItems = select.getSelectList();
RelDataType fromType = unknownType;
if (selectItems.size() == 1) {
final SqlNode selectItem = selectItems.get(0);
if (selectItem instanceof SqlIdentifier) {
SqlIdentifier id = (SqlIdentifier) selectItem;
if (id.isStar() && (id.names.size() == 1)) {
// Special case: for INSERT ... VALUES(?,?), the SQL
// standard says we're supposed to propagate the target
// types down. So iff the select list is an unqualified
// star (as it will be after an INSERT ... VALUES has been
// expanded), then propagate.
fromType = targetRowType;
}
}
}
// Make sure that items in FROM clause have distinct aliases.
final SelectScope fromScope = (SelectScope) getFromScope(select);
List<String> names = fromScope.getChildNames();
if (!catalogReader.nameMatcher().isCaseSensitive()) {
names = Lists.transform(names, s -> s.toUpperCase(Locale.ROOT));
}
final int duplicateAliasOrdinal = Util.firstDuplicate(names);
if (duplicateAliasOrdinal >= 0) {
final ScopeChild child =
fromScope.children.get(duplicateAliasOrdinal);
throw newValidationError(child.namespace.getEnclosingNode(),
RESOURCE.fromAliasDuplicate(child.name));
}
if (select.getFrom() == null) {
if (conformance.isFromRequired()) {
throw newValidationError(select, RESOURCE.selectMissingFrom());
}
} else {
validateFrom(select.getFrom(), fromType, fromScope);
}
validateWhereClause(select);
validateGroupClause(select);
validateHavingClause(select);
validateWindowClause(select);
handleOffsetFetch(select.getOffset(), select.getFetch());
// Validate the SELECT clause late, because a select item might
// depend on the GROUP BY list, or the window function might reference
// window name in the WINDOW clause etc.
final RelDataType rowType =
validateSelectList(selectItems, select, targetRowType);
ns.setType(rowType);
// Validate ORDER BY after we have set ns.rowType because in some
// dialects you can refer to columns of the select list, e.g.
// "SELECT empno AS x FROM emp ORDER BY x"
validateOrderList(select);
if (shouldCheckForRollUp(select.getFrom())) {
checkRollUpInSelectList(select);
checkRollUp(null, select, select.getWhere(), getWhereScope(select));
checkRollUp(null, select, select.getHaving(), getHavingScope(select));
checkRollUpInWindowDecl(select);
checkRollUpInGroupBy(select);
checkRollUpInOrderBy(select);
}
} | [
"protected",
"void",
"validateSelect",
"(",
"SqlSelect",
"select",
",",
"RelDataType",
"targetRowType",
")",
"{",
"assert",
"targetRowType",
"!=",
"null",
";",
"// Namespace is either a select namespace or a wrapper around one.",
"final",
"SelectNamespace",
"ns",
"=",
"getN... | Validates a SELECT statement.
@param select Select statement
@param targetRowType Desired row type, must not be null, may be the data
type 'unknown'. | [
"Validates",
"a",
"SELECT",
"statement",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3252-L3336 | train | Validate a select statement. | [
30522,
5123,
11675,
9398,
8520,
12260,
6593,
1006,
29296,
11246,
22471,
7276,
1010,
2128,
15150,
29336,
18863,
4539,
10524,
13874,
1007,
1063,
20865,
4539,
10524,
13874,
999,
1027,
19701,
1025,
1013,
1013,
3415,
15327,
2003,
2593,
1037,
7276,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getWriter | public static BufferedWriter getWriter(File file, Charset charset, boolean isAppend) throws IORuntimeException {
return FileWriter.create(file, charset).getWriter(isAppend);
} | java | public static BufferedWriter getWriter(File file, Charset charset, boolean isAppend) throws IORuntimeException {
return FileWriter.create(file, charset).getWriter(isAppend);
} | [
"public",
"static",
"BufferedWriter",
"getWriter",
"(",
"File",
"file",
",",
"Charset",
"charset",
",",
"boolean",
"isAppend",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
"(",
"file",
",",
"charset",
")",
".",
"getWriter",
... | 获得一个带缓存的写入对象
@param file 输出文件
@param charset 字符集
@param isAppend 是否追加
@return BufferedReader对象
@throws IORuntimeException IO异常 | [
"获得一个带缓存的写入对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2624-L2626 | train | Returns a BufferedWriter for a file. | [
30522,
2270,
10763,
17698,
2098,
15994,
2131,
15994,
1006,
5371,
5371,
1010,
25869,
13462,
25869,
13462,
1010,
22017,
20898,
18061,
21512,
4859,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
5371,
15994,
1012,
3443,
1006,
5371,
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-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/DeweyNumber.java | DeweyNumber.increase | public DeweyNumber increase(int times) {
int[] newDeweyNumber = Arrays.copyOf(deweyNumber, deweyNumber.length);
newDeweyNumber[deweyNumber.length - 1] += times;
return new DeweyNumber(newDeweyNumber);
} | java | public DeweyNumber increase(int times) {
int[] newDeweyNumber = Arrays.copyOf(deweyNumber, deweyNumber.length);
newDeweyNumber[deweyNumber.length - 1] += times;
return new DeweyNumber(newDeweyNumber);
} | [
"public",
"DeweyNumber",
"increase",
"(",
"int",
"times",
")",
"{",
"int",
"[",
"]",
"newDeweyNumber",
"=",
"Arrays",
".",
"copyOf",
"(",
"deweyNumber",
",",
"deweyNumber",
".",
"length",
")",
";",
"newDeweyNumber",
"[",
"deweyNumber",
".",
"length",
"-",
... | Creates a new dewey number from this such that its last digit is increased by the supplied
number.
@param times how many times to increase the Dewey number
@return A new dewey number derived from this whose last digit is increased by given number | [
"Creates",
"a",
"new",
"dewey",
"number",
"from",
"this",
"such",
"that",
"its",
"last",
"digit",
"is",
"increased",
"by",
"the",
"supplied",
"number",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/DeweyNumber.java#L119-L124 | train | Increments the number by the given amount. | [
30522,
2270,
20309,
19172,
5677,
3623,
1006,
20014,
2335,
1007,
1063,
20014,
1031,
1033,
2047,
3207,
8545,
6038,
29440,
1027,
27448,
1012,
6100,
11253,
1006,
20309,
19172,
5677,
1010,
20309,
19172,
5677,
1012,
3091,
1007,
1025,
2047,
3207,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/Main.java | Main.main | public static void main(String[] argsArray) throws Exception {
checkArgument(argsArray.length > 0, "Not enough arguments: missing class name.");
List<String> args = new ArrayList<>(Arrays.asList(argsArray));
String className = args.remove(0);
boolean printLaunchCommand = !isEmpty(System.getenv("SPARK_PRINT_LAUNCH_COMMAND"));
Map<String, String> env = new HashMap<>();
List<String> cmd;
if (className.equals("org.apache.spark.deploy.SparkSubmit")) {
try {
AbstractCommandBuilder builder = new SparkSubmitCommandBuilder(args);
cmd = buildCommand(builder, env, printLaunchCommand);
} catch (IllegalArgumentException e) {
printLaunchCommand = false;
System.err.println("Error: " + e.getMessage());
System.err.println();
MainClassOptionParser parser = new MainClassOptionParser();
try {
parser.parse(args);
} catch (Exception ignored) {
// Ignore parsing exceptions.
}
List<String> help = new ArrayList<>();
if (parser.className != null) {
help.add(parser.CLASS);
help.add(parser.className);
}
help.add(parser.USAGE_ERROR);
AbstractCommandBuilder builder = new SparkSubmitCommandBuilder(help);
cmd = buildCommand(builder, env, printLaunchCommand);
}
} else {
AbstractCommandBuilder builder = new SparkClassCommandBuilder(className, args);
cmd = buildCommand(builder, env, printLaunchCommand);
}
if (isWindows()) {
System.out.println(prepareWindowsCommand(cmd, env));
} else {
// In bash, use NULL as the arg separator since it cannot be used in an argument.
List<String> bashCmd = prepareBashCommand(cmd, env);
for (String c : bashCmd) {
System.out.print(c);
System.out.print('\0');
}
}
} | java | public static void main(String[] argsArray) throws Exception {
checkArgument(argsArray.length > 0, "Not enough arguments: missing class name.");
List<String> args = new ArrayList<>(Arrays.asList(argsArray));
String className = args.remove(0);
boolean printLaunchCommand = !isEmpty(System.getenv("SPARK_PRINT_LAUNCH_COMMAND"));
Map<String, String> env = new HashMap<>();
List<String> cmd;
if (className.equals("org.apache.spark.deploy.SparkSubmit")) {
try {
AbstractCommandBuilder builder = new SparkSubmitCommandBuilder(args);
cmd = buildCommand(builder, env, printLaunchCommand);
} catch (IllegalArgumentException e) {
printLaunchCommand = false;
System.err.println("Error: " + e.getMessage());
System.err.println();
MainClassOptionParser parser = new MainClassOptionParser();
try {
parser.parse(args);
} catch (Exception ignored) {
// Ignore parsing exceptions.
}
List<String> help = new ArrayList<>();
if (parser.className != null) {
help.add(parser.CLASS);
help.add(parser.className);
}
help.add(parser.USAGE_ERROR);
AbstractCommandBuilder builder = new SparkSubmitCommandBuilder(help);
cmd = buildCommand(builder, env, printLaunchCommand);
}
} else {
AbstractCommandBuilder builder = new SparkClassCommandBuilder(className, args);
cmd = buildCommand(builder, env, printLaunchCommand);
}
if (isWindows()) {
System.out.println(prepareWindowsCommand(cmd, env));
} else {
// In bash, use NULL as the arg separator since it cannot be used in an argument.
List<String> bashCmd = prepareBashCommand(cmd, env);
for (String c : bashCmd) {
System.out.print(c);
System.out.print('\0');
}
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"argsArray",
")",
"throws",
"Exception",
"{",
"checkArgument",
"(",
"argsArray",
".",
"length",
">",
"0",
",",
"\"Not enough arguments: missing class name.\"",
")",
";",
"List",
"<",
"String",
">",
"... | Usage: Main [class] [class args]
<p>
This CLI works in two different modes:
<ul>
<li>"spark-submit": if <i>class</i> is "org.apache.spark.deploy.SparkSubmit", the
{@link SparkLauncher} class is used to launch a Spark application.</li>
<li>"spark-class": if another class is provided, an internal Spark class is run.</li>
</ul>
This class works in tandem with the "bin/spark-class" script on Unix-like systems, and
"bin/spark-class2.cmd" batch script on Windows to execute the final command.
<p>
On Unix-like systems, the output is a list of command arguments, separated by the NULL
character. On Windows, the output is a command line suitable for direct execution from the
script. | [
"Usage",
":",
"Main",
"[",
"class",
"]",
"[",
"class",
"args",
"]",
"<p",
">",
"This",
"CLI",
"works",
"in",
"two",
"different",
"modes",
":",
"<ul",
">",
"<li",
">",
"spark",
"-",
"submit",
":",
"if",
"<i",
">",
"class<",
"/",
"i",
">",
"is",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/Main.java#L51-L100 | train | Main method for the Spark application. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
2906,
9447,
1007,
11618,
6453,
1063,
4638,
2906,
22850,
4765,
1006,
12098,
5620,
2906,
9447,
1012,
3091,
1028,
1014,
1010,
1000,
2025,
2438,
9918,
1024,
4394,
2465,
2171,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java | KeyedStream.asQueryableState | @PublicEvolving
public QueryableStateStream<KEY, T> asQueryableState(String queryableStateName) {
ValueStateDescriptor<T> valueStateDescriptor = new ValueStateDescriptor<T>(
UUID.randomUUID().toString(),
getType());
return asQueryableState(queryableStateName, valueStateDescriptor);
} | java | @PublicEvolving
public QueryableStateStream<KEY, T> asQueryableState(String queryableStateName) {
ValueStateDescriptor<T> valueStateDescriptor = new ValueStateDescriptor<T>(
UUID.randomUUID().toString(),
getType());
return asQueryableState(queryableStateName, valueStateDescriptor);
} | [
"@",
"PublicEvolving",
"public",
"QueryableStateStream",
"<",
"KEY",
",",
"T",
">",
"asQueryableState",
"(",
"String",
"queryableStateName",
")",
"{",
"ValueStateDescriptor",
"<",
"T",
">",
"valueStateDescriptor",
"=",
"new",
"ValueStateDescriptor",
"<",
"T",
">",
... | Publishes the keyed stream as queryable ValueState instance.
@param queryableStateName Name under which to the publish the queryable state instance
@return Queryable state instance | [
"Publishes",
"the",
"keyed",
"stream",
"as",
"queryable",
"ValueState",
"instance",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java#L1003-L1010 | train | Returns a new QueryableStateStream with a random value state descriptor. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
23032,
3085,
9153,
22199,
16416,
2213,
1026,
3145,
1010,
1056,
1028,
2004,
4226,
20444,
13510,
12259,
1006,
5164,
23032,
3085,
9153,
6528,
14074,
1007,
1063,
5300,
16238,
2229,
23235,
2953,
1026,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/BloomFilter.java | BloomFilter.optimalNumOfHashFunctions | static int optimalNumOfHashFunctions(long expectEntries, long bitSize) {
return Math.max(1, (int) Math.round((double) bitSize / expectEntries * Math.log(2)));
} | java | static int optimalNumOfHashFunctions(long expectEntries, long bitSize) {
return Math.max(1, (int) Math.round((double) bitSize / expectEntries * Math.log(2)));
} | [
"static",
"int",
"optimalNumOfHashFunctions",
"(",
"long",
"expectEntries",
",",
"long",
"bitSize",
")",
"{",
"return",
"Math",
".",
"max",
"(",
"1",
",",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"(",
"double",
")",
"bitSize",
"/",
"expectEntries",
"*... | compute the optimal hash function number with given input entries and bits size, which would
make the false positive probability lowest.
@param expectEntries
@param bitSize
@return hash function number | [
"compute",
"the",
"optimal",
"hash",
"function",
"number",
"with",
"given",
"input",
"entries",
"and",
"bits",
"size",
"which",
"would",
"make",
"the",
"false",
"positive",
"probability",
"lowest",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/BloomFilter.java#L97-L99 | train | Returns the optimal number of hash functions to use based on the bit size and the number of entries. | [
30522,
10763,
20014,
15502,
19172,
11253,
14949,
2232,
11263,
27989,
2015,
1006,
2146,
5987,
4765,
5134,
1010,
2146,
9017,
4697,
1007,
1063,
2709,
8785,
1012,
4098,
1006,
1015,
1010,
1006,
20014,
1007,
8785,
1012,
2461,
1006,
1006,
3313,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java | PojoSerializer.getRegisteredSubclassesFromExecutionConfig | private static LinkedHashSet<Class<?>> getRegisteredSubclassesFromExecutionConfig(
Class<?> basePojoClass,
ExecutionConfig executionConfig) {
LinkedHashSet<Class<?>> subclassesInRegistrationOrder = new LinkedHashSet<>(executionConfig.getRegisteredPojoTypes().size());
for (Class<?> registeredClass : executionConfig.getRegisteredPojoTypes()) {
if (registeredClass.equals(basePojoClass)) {
continue;
}
if (!basePojoClass.isAssignableFrom(registeredClass)) {
continue;
}
subclassesInRegistrationOrder.add(registeredClass);
}
return subclassesInRegistrationOrder;
} | java | private static LinkedHashSet<Class<?>> getRegisteredSubclassesFromExecutionConfig(
Class<?> basePojoClass,
ExecutionConfig executionConfig) {
LinkedHashSet<Class<?>> subclassesInRegistrationOrder = new LinkedHashSet<>(executionConfig.getRegisteredPojoTypes().size());
for (Class<?> registeredClass : executionConfig.getRegisteredPojoTypes()) {
if (registeredClass.equals(basePojoClass)) {
continue;
}
if (!basePojoClass.isAssignableFrom(registeredClass)) {
continue;
}
subclassesInRegistrationOrder.add(registeredClass);
}
return subclassesInRegistrationOrder;
} | [
"private",
"static",
"LinkedHashSet",
"<",
"Class",
"<",
"?",
">",
">",
"getRegisteredSubclassesFromExecutionConfig",
"(",
"Class",
"<",
"?",
">",
"basePojoClass",
",",
"ExecutionConfig",
"executionConfig",
")",
"{",
"LinkedHashSet",
"<",
"Class",
"<",
"?",
">",
... | Extracts the subclasses of the base POJO class registered in the execution config. | [
"Extracts",
"the",
"subclasses",
"of",
"the",
"base",
"POJO",
"class",
"registered",
"in",
"the",
"execution",
"config",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java#L1001-L1017 | train | Get the registered subclasses from the given execution config. | [
30522,
2797,
10763,
5799,
14949,
7898,
3388,
1026,
2465,
1026,
1029,
1028,
1028,
2131,
2890,
24063,
6850,
6342,
9818,
27102,
2229,
19699,
8462,
2595,
8586,
13700,
8663,
8873,
2290,
1006,
2465,
1026,
1029,
1028,
2918,
6873,
5558,
26266,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java | FastDatePrinter.selectNumberRule | protected NumberRule selectNumberRule(final int field, final int padding) {
switch (padding) {
case 1:
return new UnpaddedNumberField(field);
case 2:
return new TwoDigitNumberField(field);
default:
return new PaddedNumberField(field, padding);
}
} | java | protected NumberRule selectNumberRule(final int field, final int padding) {
switch (padding) {
case 1:
return new UnpaddedNumberField(field);
case 2:
return new TwoDigitNumberField(field);
default:
return new PaddedNumberField(field, padding);
}
} | [
"protected",
"NumberRule",
"selectNumberRule",
"(",
"final",
"int",
"field",
",",
"final",
"int",
"padding",
")",
"{",
"switch",
"(",
"padding",
")",
"{",
"case",
"1",
":",
"return",
"new",
"UnpaddedNumberField",
"(",
"field",
")",
";",
"case",
"2",
":",
... | <p>
Gets an appropriate rule for the padding required.
</p>
@param field the field to get a rule for
@param padding the padding required
@return a new rule with the correct padding | [
"<p",
">",
"Gets",
"an",
"appropriate",
"rule",
"for",
"the",
"padding",
"required",
".",
"<",
"/",
"p",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java#L275-L284 | train | Select number rule. | [
30522,
5123,
2193,
6820,
2571,
7276,
19172,
5677,
6820,
2571,
1006,
2345,
20014,
2492,
1010,
2345,
20014,
11687,
4667,
1007,
1063,
6942,
1006,
11687,
4667,
1007,
1063,
2553,
1015,
1024,
2709,
2047,
4895,
15455,
5732,
19172,
5677,
3790,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/BaseAsymmetric.java | BaseAsymmetric.getPublicKeyBase64 | public String getPublicKeyBase64() {
final PublicKey publicKey = getPublicKey();
return (null == publicKey) ? null : Base64.encode(publicKey.getEncoded());
} | java | public String getPublicKeyBase64() {
final PublicKey publicKey = getPublicKey();
return (null == publicKey) ? null : Base64.encode(publicKey.getEncoded());
} | [
"public",
"String",
"getPublicKeyBase64",
"(",
")",
"{",
"final",
"PublicKey",
"publicKey",
"=",
"getPublicKey",
"(",
")",
";",
"return",
"(",
"null",
"==",
"publicKey",
")",
"?",
"null",
":",
"Base64",
".",
"encode",
"(",
"publicKey",
".",
"getEncoded",
"... | 获得公钥
@return 获得公钥 | [
"获得公钥"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/BaseAsymmetric.java#L103-L106 | train | Returns the Base64 encoded public key. | [
30522,
2270,
5164,
2131,
14289,
16558,
6799,
3240,
15058,
21084,
1006,
1007,
1063,
2345,
2270,
14839,
2270,
14839,
1027,
2131,
14289,
16558,
6799,
3240,
1006,
1007,
1025,
2709,
1006,
19701,
1027,
1027,
2270,
14839,
1007,
1029,
19701,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.round | public static BigDecimal round(BigDecimal number, int scale, RoundingMode roundingMode) {
if (null == number) {
number = BigDecimal.ZERO;
}
if (scale < 0) {
scale = 0;
}
if (null == roundingMode) {
roundingMode = RoundingMode.HALF_UP;
}
return number.setScale(scale, roundingMode);
} | java | public static BigDecimal round(BigDecimal number, int scale, RoundingMode roundingMode) {
if (null == number) {
number = BigDecimal.ZERO;
}
if (scale < 0) {
scale = 0;
}
if (null == roundingMode) {
roundingMode = RoundingMode.HALF_UP;
}
return number.setScale(scale, roundingMode);
} | [
"public",
"static",
"BigDecimal",
"round",
"(",
"BigDecimal",
"number",
",",
"int",
"scale",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"if",
"(",
"null",
"==",
"number",
")",
"{",
"number",
"=",
"BigDecimal",
".",
"ZERO",
";",
"}",
"if",
"(",
"scale... | 保留固定位数小数<br>
例如保留四位小数:123.456789 =》 123.4567
@param number 数字值
@param scale 保留小数位数,如果传入小于0,则默认0
@param roundingMode 保留小数的模式 {@link RoundingMode},如果传入null则默认四舍五入
@return 新值 | [
"保留固定位数小数<br",
">",
"例如保留四位小数:123",
".",
"456789",
"=",
"》",
"123",
".",
"4567"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L873-L885 | train | Returns a new BigDecimal that is rounded to the specified scale. | [
30522,
2270,
10763,
2502,
3207,
6895,
9067,
2461,
1006,
2502,
3207,
6895,
9067,
2193,
1010,
20014,
4094,
1010,
26939,
5302,
3207,
26939,
5302,
3207,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
2193,
1007,
1063,
2193,
1027,
2502,
3207,
6895,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java | TomcatServletWebServerFactory.resetDefaultLocaleMapping | private void resetDefaultLocaleMapping(TomcatEmbeddedContext context) {
context.addLocaleEncodingMappingParameter(Locale.ENGLISH.toString(),
DEFAULT_CHARSET.displayName());
context.addLocaleEncodingMappingParameter(Locale.FRENCH.toString(),
DEFAULT_CHARSET.displayName());
} | java | private void resetDefaultLocaleMapping(TomcatEmbeddedContext context) {
context.addLocaleEncodingMappingParameter(Locale.ENGLISH.toString(),
DEFAULT_CHARSET.displayName());
context.addLocaleEncodingMappingParameter(Locale.FRENCH.toString(),
DEFAULT_CHARSET.displayName());
} | [
"private",
"void",
"resetDefaultLocaleMapping",
"(",
"TomcatEmbeddedContext",
"context",
")",
"{",
"context",
".",
"addLocaleEncodingMappingParameter",
"(",
"Locale",
".",
"ENGLISH",
".",
"toString",
"(",
")",
",",
"DEFAULT_CHARSET",
".",
"displayName",
"(",
")",
")... | Override Tomcat's default locale mappings to align with other servers. See
{@code org.apache.catalina.util.CharsetMapperDefault.properties}.
@param context the context to reset | [
"Override",
"Tomcat",
"s",
"default",
"locale",
"mappings",
"to",
"align",
"with",
"other",
"servers",
".",
"See",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java#L243-L248 | train | Reset the default locale mapping. | [
30522,
2797,
11675,
25141,
3207,
7011,
11314,
4135,
9289,
14545,
14853,
1006,
3419,
16280,
18552,
19520,
8663,
18209,
6123,
1007,
1063,
6123,
1012,
5587,
4135,
9289,
12129,
3597,
4667,
2863,
14853,
28689,
22828,
1006,
2334,
2063,
1012,
2394,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java | JSONObject.getDouble | public double getDouble(String name) throws JSONException {
Object object = get(name);
Double result = JSON.toDouble(object);
if (result == null) {
throw JSON.typeMismatch(name, object, "double");
}
return result;
} | java | public double getDouble(String name) throws JSONException {
Object object = get(name);
Double result = JSON.toDouble(object);
if (result == null) {
throw JSON.typeMismatch(name, object, "double");
}
return result;
} | [
"public",
"double",
"getDouble",
"(",
"String",
"name",
")",
"throws",
"JSONException",
"{",
"Object",
"object",
"=",
"get",
"(",
"name",
")",
";",
"Double",
"result",
"=",
"JSON",
".",
"toDouble",
"(",
"object",
")",
";",
"if",
"(",
"result",
"==",
"n... | Returns the value mapped by {@code name} if it exists and is a double or can be
coerced to a double.
@param name the name of the property
@return the value
@throws JSONException if the mapping doesn't exist or cannot be coerced to a
double. | [
"Returns",
"the",
"value",
"mapped",
"by",
"{",
"@code",
"name",
"}",
"if",
"it",
"exists",
"and",
"is",
"a",
"double",
"or",
"can",
"be",
"coerced",
"to",
"a",
"double",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L439-L446 | train | Get the double value associated with a name. | [
30522,
2270,
3313,
2131,
26797,
3468,
1006,
5164,
2171,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
4874,
4874,
1027,
2131,
1006,
2171,
1007,
1025,
3313,
2765,
1027,
1046,
3385,
1012,
28681,
7140,
3468,
1006,
4874,
1007,
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-java/src/main/java/org/apache/flink/api/java/operators/DataSource.java | DataSource.getSplitDataProperties | @PublicEvolving
public SplitDataProperties<OUT> getSplitDataProperties() {
if (this.splitDataProperties == null) {
this.splitDataProperties = new SplitDataProperties<OUT>(this);
}
return this.splitDataProperties;
} | java | @PublicEvolving
public SplitDataProperties<OUT> getSplitDataProperties() {
if (this.splitDataProperties == null) {
this.splitDataProperties = new SplitDataProperties<OUT>(this);
}
return this.splitDataProperties;
} | [
"@",
"PublicEvolving",
"public",
"SplitDataProperties",
"<",
"OUT",
">",
"getSplitDataProperties",
"(",
")",
"{",
"if",
"(",
"this",
".",
"splitDataProperties",
"==",
"null",
")",
"{",
"this",
".",
"splitDataProperties",
"=",
"new",
"SplitDataProperties",
"<",
"... | Returns the {@link org.apache.flink.api.java.io.SplitDataProperties} for the
{@link org.apache.flink.core.io.InputSplit}s of this DataSource
for configurations.
<p>SplitDataProperties can help to generate more efficient execution plans.
<p><b>
IMPORTANT: Incorrect configuration of SplitDataProperties can cause wrong results!
</b>
@return The SplitDataProperties for the InputSplits of this DataSource. | [
"Returns",
"the",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"api",
".",
"java",
".",
"io",
".",
"SplitDataProperties",
"}",
"for",
"the",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"core",
".",
"io",
".",
"InputSplit",
"}",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/DataSource.java#L116-L122 | train | Gets the split data properties. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
3975,
2850,
2696,
21572,
4842,
7368,
1026,
2041,
1028,
4152,
24759,
4183,
2850,
2696,
21572,
4842,
7368,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
3975,
2850,
2696,
21572,
4842,
7368,
1027,
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... |
networknt/light-4j | client/src/main/java/com/networknt/client/Http2Client.java | Http2Client.addAuthTokenTrace | public void addAuthTokenTrace(ClientRequest request, String token, String traceabilityId) {
if(token != null && !token.startsWith("Bearer ")) {
if(token.toUpperCase().startsWith("BEARER ")) {
// other cases of Bearer
token = "Bearer " + token.substring(7);
} else {
token = "Bearer " + token;
}
}
request.getRequestHeaders().put(Headers.AUTHORIZATION, token);
request.getRequestHeaders().put(HttpStringConstants.TRACEABILITY_ID, traceabilityId);
} | java | public void addAuthTokenTrace(ClientRequest request, String token, String traceabilityId) {
if(token != null && !token.startsWith("Bearer ")) {
if(token.toUpperCase().startsWith("BEARER ")) {
// other cases of Bearer
token = "Bearer " + token.substring(7);
} else {
token = "Bearer " + token;
}
}
request.getRequestHeaders().put(Headers.AUTHORIZATION, token);
request.getRequestHeaders().put(HttpStringConstants.TRACEABILITY_ID, traceabilityId);
} | [
"public",
"void",
"addAuthTokenTrace",
"(",
"ClientRequest",
"request",
",",
"String",
"token",
",",
"String",
"traceabilityId",
")",
"{",
"if",
"(",
"token",
"!=",
"null",
"&&",
"!",
"token",
".",
"startsWith",
"(",
"\"Bearer \"",
")",
")",
"{",
"if",
"("... | Add Authorization Code grant token the caller app gets from OAuth2 server and add traceabilityId
This is the method called from client like web server that want to have traceabilityId pass through.
@param request the http request
@param token the bearer token
@param traceabilityId the traceability id | [
"Add",
"Authorization",
"Code",
"grant",
"token",
"the",
"caller",
"app",
"gets",
"from",
"OAuth2",
"server",
"and",
"add",
"traceabilityId"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/Http2Client.java#L294-L305 | train | Add the authorization token to the request. | [
30522,
2270,
11675,
5587,
4887,
2705,
18715,
4765,
22903,
1006,
7396,
2890,
15500,
5227,
1010,
5164,
19204,
1010,
5164,
7637,
8010,
3593,
1007,
1063,
2065,
1006,
19204,
999,
1027,
19701,
1004,
1004,
999,
19204,
1012,
4627,
24415,
1006,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java | WebMonitorUtils.loadWebSubmissionExtension | public static WebMonitorExtension loadWebSubmissionExtension(
GatewayRetriever<? extends DispatcherGateway> leaderRetriever,
Time timeout,
Map<String, String> responseHeaders,
CompletableFuture<String> localAddressFuture,
java.nio.file.Path uploadDir,
Executor executor,
Configuration configuration) throws FlinkException {
if (isFlinkRuntimeWebInClassPath()) {
try {
final Constructor<?> webSubmissionExtensionConstructor = Class
.forName("org.apache.flink.runtime.webmonitor.WebSubmissionExtension")
.getConstructor(
Configuration.class,
GatewayRetriever.class,
Map.class,
CompletableFuture.class,
java.nio.file.Path.class,
Executor.class,
Time.class);
return (WebMonitorExtension) webSubmissionExtensionConstructor.newInstance(
configuration,
leaderRetriever,
responseHeaders,
localAddressFuture,
uploadDir,
executor,
timeout);
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | InvocationTargetException | IllegalAccessException e) {
throw new FlinkException("Could not load web submission extension.", e);
}
} else {
throw new FlinkException("The module flink-runtime-web could not be found in the class path. Please add " +
"this jar in order to enable web based job submission.");
}
} | java | public static WebMonitorExtension loadWebSubmissionExtension(
GatewayRetriever<? extends DispatcherGateway> leaderRetriever,
Time timeout,
Map<String, String> responseHeaders,
CompletableFuture<String> localAddressFuture,
java.nio.file.Path uploadDir,
Executor executor,
Configuration configuration) throws FlinkException {
if (isFlinkRuntimeWebInClassPath()) {
try {
final Constructor<?> webSubmissionExtensionConstructor = Class
.forName("org.apache.flink.runtime.webmonitor.WebSubmissionExtension")
.getConstructor(
Configuration.class,
GatewayRetriever.class,
Map.class,
CompletableFuture.class,
java.nio.file.Path.class,
Executor.class,
Time.class);
return (WebMonitorExtension) webSubmissionExtensionConstructor.newInstance(
configuration,
leaderRetriever,
responseHeaders,
localAddressFuture,
uploadDir,
executor,
timeout);
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | InvocationTargetException | IllegalAccessException e) {
throw new FlinkException("Could not load web submission extension.", e);
}
} else {
throw new FlinkException("The module flink-runtime-web could not be found in the class path. Please add " +
"this jar in order to enable web based job submission.");
}
} | [
"public",
"static",
"WebMonitorExtension",
"loadWebSubmissionExtension",
"(",
"GatewayRetriever",
"<",
"?",
"extends",
"DispatcherGateway",
">",
"leaderRetriever",
",",
"Time",
"timeout",
",",
"Map",
"<",
"String",
",",
"String",
">",
"responseHeaders",
",",
"Completa... | Loads the {@link WebMonitorExtension} which enables web submission.
@param leaderRetriever to retrieve the leader
@param timeout for asynchronous requests
@param responseHeaders for the web submission handlers
@param localAddressFuture of the underlying REST server endpoint
@param uploadDir where the web submission handler store uploaded jars
@param executor to run asynchronous operations
@param configuration used to instantiate the web submission extension
@return Web submission extension
@throws FlinkException if the web submission extension could not be loaded | [
"Loads",
"the",
"{",
"@link",
"WebMonitorExtension",
"}",
"which",
"enables",
"web",
"submission",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java#L158-L195 | train | Load the web submission extension. | [
30522,
2270,
10763,
4773,
8202,
15660,
10288,
29048,
7170,
8545,
5910,
12083,
25481,
10288,
29048,
1006,
11909,
13465,
7373,
6299,
1026,
1029,
8908,
18365,
2121,
5867,
4576,
1028,
3003,
13465,
7373,
6299,
1010,
2051,
2051,
5833,
1010,
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... |
netty/netty | common/src/main/java/io/netty/util/internal/PendingWrite.java | PendingWrite.newInstance | public static PendingWrite newInstance(Object msg, Promise<Void> promise) {
PendingWrite pending = RECYCLER.get();
pending.msg = msg;
pending.promise = promise;
return pending;
} | java | public static PendingWrite newInstance(Object msg, Promise<Void> promise) {
PendingWrite pending = RECYCLER.get();
pending.msg = msg;
pending.promise = promise;
return pending;
} | [
"public",
"static",
"PendingWrite",
"newInstance",
"(",
"Object",
"msg",
",",
"Promise",
"<",
"Void",
">",
"promise",
")",
"{",
"PendingWrite",
"pending",
"=",
"RECYCLER",
".",
"get",
"(",
")",
";",
"pending",
".",
"msg",
"=",
"msg",
";",
"pending",
".",... | Create a new empty {@link RecyclableArrayList} instance | [
"Create",
"a",
"new",
"empty",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PendingWrite.java#L36-L41 | train | Create a new PendingWrite instance. | [
30522,
2270,
10763,
14223,
26373,
2047,
7076,
26897,
1006,
4874,
5796,
2290,
1010,
4872,
1026,
11675,
1028,
4872,
1007,
1063,
14223,
26373,
14223,
1027,
28667,
2100,
14321,
2099,
1012,
2131,
1006,
1007,
1025,
14223,
1012,
5796,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-common/src/main/java/org/apache/shardingsphere/core/yaml/engine/YamlEngine.java | YamlEngine.unmarshal | public static <T extends YamlConfiguration> T unmarshal(final File yamlFile, final Class<T> classType) throws IOException {
try (
FileInputStream fileInputStream = new FileInputStream(yamlFile);
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8")
) {
return new Yaml(new Constructor(classType)).loadAs(inputStreamReader, classType);
}
} | java | public static <T extends YamlConfiguration> T unmarshal(final File yamlFile, final Class<T> classType) throws IOException {
try (
FileInputStream fileInputStream = new FileInputStream(yamlFile);
InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8")
) {
return new Yaml(new Constructor(classType)).loadAs(inputStreamReader, classType);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"YamlConfiguration",
">",
"T",
"unmarshal",
"(",
"final",
"File",
"yamlFile",
",",
"final",
"Class",
"<",
"T",
">",
"classType",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileInputStream",
"fileInputStream",
"=",
... | Unmarshal YAML.
@param yamlFile YAML file
@param classType class type
@param <T> type of class
@return object from YAML
@throws IOException IO Exception | [
"Unmarshal",
"YAML",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/yaml/engine/YamlEngine.java#L54-L61 | train | Unmarshals a YAML file to an object of the specified class type. | [
30522,
2270,
10763,
1026,
1056,
8908,
8038,
19968,
8663,
8873,
27390,
3370,
1028,
1056,
4895,
7849,
7377,
2140,
1006,
2345,
5371,
8038,
19968,
8873,
2571,
1010,
2345,
2465,
1026,
1056,
1028,
2465,
13874,
1007,
11618,
22834,
10288,
24422,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java | JSONArray.getBoolean | public boolean getBoolean(int index) throws JSONException {
Object object = get(index);
Boolean result = JSON.toBoolean(object);
if (result == null) {
throw JSON.typeMismatch(index, object, "boolean");
}
return result;
} | java | public boolean getBoolean(int index) throws JSONException {
Object object = get(index);
Boolean result = JSON.toBoolean(object);
if (result == null) {
throw JSON.typeMismatch(index, object, "boolean");
}
return result;
} | [
"public",
"boolean",
"getBoolean",
"(",
"int",
"index",
")",
"throws",
"JSONException",
"{",
"Object",
"object",
"=",
"get",
"(",
"index",
")",
";",
"Boolean",
"result",
"=",
"JSON",
".",
"toBoolean",
"(",
"object",
")",
";",
"if",
"(",
"result",
"==",
... | Returns the value at {@code index} if it exists and is a boolean or can be coerced
to a boolean.
@param index the index to get the value from
@return the value at {@code index}
@throws JSONException if the value at {@code index} doesn't exist or cannot be
coerced to a boolean. | [
"Returns",
"the",
"value",
"at",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java#L330-L337 | train | Get the boolean value at the given index. | [
30522,
2270,
22017,
20898,
2131,
5092,
9890,
2319,
1006,
20014,
5950,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
4874,
4874,
1027,
2131,
1006,
5950,
1007,
1025,
22017,
20898,
2765,
1027,
1046,
3385,
1012,
2000,
5092,
9890,
2319,
1006,
487... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/WorkbookUtil.java | WorkbookUtil.getOrCreateSheet | public static Sheet getOrCreateSheet(Workbook book, String sheetName) {
if (null == book) {
return null;
}
sheetName = StrUtil.isBlank(sheetName) ? "sheet1" : sheetName;
Sheet sheet = book.getSheet(sheetName);
if (null == sheet) {
sheet = book.createSheet(sheetName);
}
return sheet;
} | java | public static Sheet getOrCreateSheet(Workbook book, String sheetName) {
if (null == book) {
return null;
}
sheetName = StrUtil.isBlank(sheetName) ? "sheet1" : sheetName;
Sheet sheet = book.getSheet(sheetName);
if (null == sheet) {
sheet = book.createSheet(sheetName);
}
return sheet;
} | [
"public",
"static",
"Sheet",
"getOrCreateSheet",
"(",
"Workbook",
"book",
",",
"String",
"sheetName",
")",
"{",
"if",
"(",
"null",
"==",
"book",
")",
"{",
"return",
"null",
";",
"}",
"sheetName",
"=",
"StrUtil",
".",
"isBlank",
"(",
"sheetName",
")",
"?"... | 获取或者创建sheet表<br>
如果sheet表在Workbook中已经存在,则获取之,否则创建之
@param book 工作簿{@link Workbook}
@param sheetName 工作表名
@return 工作表{@link Sheet}
@since 4.0.2 | [
"获取或者创建sheet表<br",
">",
"如果sheet表在Workbook中已经存在,则获取之,否则创建之"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java#L220-L230 | train | Gets or creates a sheet from a workbook. | [
30522,
2270,
10763,
7123,
2131,
2953,
16748,
8520,
21030,
2102,
1006,
2147,
8654,
2338,
1010,
5164,
7123,
18442,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
2338,
1007,
1063,
2709,
19701,
1025,
1065,
7123,
18442,
1027,
2358,
22134,
4014,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/instance/SlotSharingGroupAssignment.java | SlotSharingGroupAssignment.getSlotForTask | public SimpleSlot getSlotForTask(JobVertexID vertexID, Iterable<TaskManagerLocation> locationPreferences) {
synchronized (lock) {
Tuple2<SharedSlot, Locality> p = getSharedSlotForTask(vertexID, locationPreferences, false);
if (p != null) {
SharedSlot ss = p.f0;
SimpleSlot slot = ss.allocateSubSlot(vertexID);
slot.setLocality(p.f1);
return slot;
}
else {
return null;
}
}
} | java | public SimpleSlot getSlotForTask(JobVertexID vertexID, Iterable<TaskManagerLocation> locationPreferences) {
synchronized (lock) {
Tuple2<SharedSlot, Locality> p = getSharedSlotForTask(vertexID, locationPreferences, false);
if (p != null) {
SharedSlot ss = p.f0;
SimpleSlot slot = ss.allocateSubSlot(vertexID);
slot.setLocality(p.f1);
return slot;
}
else {
return null;
}
}
} | [
"public",
"SimpleSlot",
"getSlotForTask",
"(",
"JobVertexID",
"vertexID",
",",
"Iterable",
"<",
"TaskManagerLocation",
">",
"locationPreferences",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"Tuple2",
"<",
"SharedSlot",
",",
"Locality",
">",
"p",
"=",
"getS... | Gets a slot suitable for the given task vertex. This method will prefer slots that are local
(with respect to {@link ExecutionVertex#getPreferredLocationsBasedOnInputs()}), but will return non local
slots if no local slot is available. The method returns null, when this sharing group has
no slot available for the given JobVertexID.
@param vertexID the vertex id
@param locationPreferences location preferences
@return A slot to execute the given ExecutionVertex in, or null, if none is available. | [
"Gets",
"a",
"slot",
"suitable",
"for",
"the",
"given",
"task",
"vertex",
".",
"This",
"method",
"will",
"prefer",
"slots",
"that",
"are",
"local",
"(",
"with",
"respect",
"to",
"{",
"@link",
"ExecutionVertex#getPreferredLocationsBasedOnInputs",
"()",
"}",
")",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/SlotSharingGroupAssignment.java#L275-L289 | train | Get a slot for a given task. | [
30522,
2270,
3722,
14540,
4140,
4152,
10994,
13028,
19895,
1006,
3105,
16874,
10288,
3593,
19449,
3593,
1010,
2009,
6906,
3468,
1026,
4708,
24805,
4590,
4135,
10719,
1028,
3295,
28139,
25523,
2015,
1007,
1063,
25549,
1006,
5843,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.setHeader | @Deprecated
public static void setHeader(HttpMessage message, String name, Object value) {
message.headers().set(name, value);
} | java | @Deprecated
public static void setHeader(HttpMessage message, String name, Object value) {
message.headers().set(name, value);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"setHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"set",
"(",
"name",
",",
"value",
")",
";",
"}"
] | @deprecated Use {@link #set(CharSequence, Object)} instead.
@see #setHeader(HttpMessage, CharSequence, Object) | [
"@deprecated",
"Use",
"{",
"@link",
"#set",
"(",
"CharSequence",
"Object",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L599-L602 | train | Sets a header value. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
11675,
6662,
13775,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
5164,
2171,
1010,
4874,
3643,
1007,
1063,
4471,
1012,
20346,
2015,
1006,
1007,
1012,
2275,
1006,
2171,
1010,
3643,
1007,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java | CheckpointCoordinator.addMasterHook | public boolean addMasterHook(MasterTriggerRestoreHook<?> hook) {
checkNotNull(hook);
final String id = hook.getIdentifier();
checkArgument(!StringUtils.isNullOrWhitespaceOnly(id), "The hook has a null or empty id");
synchronized (lock) {
if (!masterHooks.containsKey(id)) {
masterHooks.put(id, hook);
return true;
}
else {
return false;
}
}
} | java | public boolean addMasterHook(MasterTriggerRestoreHook<?> hook) {
checkNotNull(hook);
final String id = hook.getIdentifier();
checkArgument(!StringUtils.isNullOrWhitespaceOnly(id), "The hook has a null or empty id");
synchronized (lock) {
if (!masterHooks.containsKey(id)) {
masterHooks.put(id, hook);
return true;
}
else {
return false;
}
}
} | [
"public",
"boolean",
"addMasterHook",
"(",
"MasterTriggerRestoreHook",
"<",
"?",
">",
"hook",
")",
"{",
"checkNotNull",
"(",
"hook",
")",
";",
"final",
"String",
"id",
"=",
"hook",
".",
"getIdentifier",
"(",
")",
";",
"checkArgument",
"(",
"!",
"StringUtils"... | Adds the given master hook to the checkpoint coordinator. This method does nothing, if
the checkpoint coordinator already contained a hook with the same ID (as defined via
{@link MasterTriggerRestoreHook#getIdentifier()}).
@param hook The hook to add.
@return True, if the hook was added, false if the checkpoint coordinator already
contained a hook with the same ID. | [
"Adds",
"the",
"given",
"master",
"hook",
"to",
"the",
"checkpoint",
"coordinator",
".",
"This",
"method",
"does",
"nothing",
"if",
"the",
"checkpoint",
"coordinator",
"already",
"contained",
"a",
"hook",
"with",
"the",
"same",
"ID",
"(",
"as",
"defined",
"v... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java#L278-L293 | train | Adds a master hook to be called when the restore hook is triggered. | [
30522,
2270,
22017,
20898,
5587,
8706,
6806,
6559,
1006,
3040,
18886,
13327,
28533,
5686,
6806,
6559,
1026,
1029,
1028,
8103,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
8103,
1007,
1025,
2345,
5164,
8909,
1027,
8103,
1012,
2131,
5178,
1677... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.singleTableSimpleFiledInsert | private void singleTableSimpleFiledInsert(ESSyncConfig config, Dml dml, Map<String, Object> data) {
ESMapping mapping = config.getEsMapping();
Map<String, Object> esFieldData = new LinkedHashMap<>();
Object idVal = esTemplate.getESDataFromDmlData(mapping, data, esFieldData);
if (logger.isTraceEnabled()) {
logger.trace("Single table insert to es index, destination:{}, table: {}, index: {}, id: {}",
config.getDestination(),
dml.getTable(),
mapping.get_index(),
idVal);
}
esTemplate.insert(mapping, idVal, esFieldData);
} | java | private void singleTableSimpleFiledInsert(ESSyncConfig config, Dml dml, Map<String, Object> data) {
ESMapping mapping = config.getEsMapping();
Map<String, Object> esFieldData = new LinkedHashMap<>();
Object idVal = esTemplate.getESDataFromDmlData(mapping, data, esFieldData);
if (logger.isTraceEnabled()) {
logger.trace("Single table insert to es index, destination:{}, table: {}, index: {}, id: {}",
config.getDestination(),
dml.getTable(),
mapping.get_index(),
idVal);
}
esTemplate.insert(mapping, idVal, esFieldData);
} | [
"private",
"void",
"singleTableSimpleFiledInsert",
"(",
"ESSyncConfig",
"config",
",",
"Dml",
"dml",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
")",
"{",
"ESMapping",
"mapping",
"=",
"config",
".",
"getEsMapping",
"(",
")",
";",
"Map",
"<",
"St... | 单表简单字段insert
@param config es配置
@param dml dml信息
@param data 单行dml数据 | [
"单表简单字段insert"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/service/ESSyncService.java#L433-L446 | train | Insert a single table in the ES template. | [
30522,
2797,
11675,
2309,
10880,
5332,
23344,
8873,
3709,
7076,
8743,
1006,
9686,
6508,
12273,
8663,
8873,
2290,
9530,
8873,
2290,
1010,
1040,
19968,
1040,
19968,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
2951,
1007,
1063,
9686,
2863,
14853... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/LombokPropertyDescriptor.java | LombokPropertyDescriptor.hasLombokPublicAccessor | private boolean hasLombokPublicAccessor(MetadataGenerationEnvironment env,
boolean getter) {
String annotation = (getter ? LOMBOK_GETTER_ANNOTATION
: LOMBOK_SETTER_ANNOTATION);
AnnotationMirror lombokMethodAnnotationOnField = env.getAnnotation(getField(),
annotation);
if (lombokMethodAnnotationOnField != null) {
return isAccessLevelPublic(env, lombokMethodAnnotationOnField);
}
AnnotationMirror lombokMethodAnnotationOnElement = env
.getAnnotation(getOwnerElement(), annotation);
if (lombokMethodAnnotationOnElement != null) {
return isAccessLevelPublic(env, lombokMethodAnnotationOnElement);
}
return (env.getAnnotation(getOwnerElement(), LOMBOK_DATA_ANNOTATION) != null);
} | java | private boolean hasLombokPublicAccessor(MetadataGenerationEnvironment env,
boolean getter) {
String annotation = (getter ? LOMBOK_GETTER_ANNOTATION
: LOMBOK_SETTER_ANNOTATION);
AnnotationMirror lombokMethodAnnotationOnField = env.getAnnotation(getField(),
annotation);
if (lombokMethodAnnotationOnField != null) {
return isAccessLevelPublic(env, lombokMethodAnnotationOnField);
}
AnnotationMirror lombokMethodAnnotationOnElement = env
.getAnnotation(getOwnerElement(), annotation);
if (lombokMethodAnnotationOnElement != null) {
return isAccessLevelPublic(env, lombokMethodAnnotationOnElement);
}
return (env.getAnnotation(getOwnerElement(), LOMBOK_DATA_ANNOTATION) != null);
} | [
"private",
"boolean",
"hasLombokPublicAccessor",
"(",
"MetadataGenerationEnvironment",
"env",
",",
"boolean",
"getter",
")",
"{",
"String",
"annotation",
"=",
"(",
"getter",
"?",
"LOMBOK_GETTER_ANNOTATION",
":",
"LOMBOK_SETTER_ANNOTATION",
")",
";",
"AnnotationMirror",
... | Determine if the current {@link #getField() field} defines a public accessor using
lombok annotations.
@param env the {@link MetadataGenerationEnvironment}
@param getter {@code true} to look for the read accessor, {@code false} for the
write accessor
@return {@code true} if this field has a public accessor of the specified type | [
"Determine",
"if",
"the",
"current",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/LombokPropertyDescriptor.java#L96-L111 | train | Checks if the given environment has a public accessor on the LOMBOK_ACCESS_TYPE field. | [
30522,
2797,
22017,
20898,
2038,
21297,
5092,
2243,
14289,
16558,
5555,
9468,
7971,
2953,
1006,
27425,
6914,
16754,
2368,
21663,
2239,
3672,
4372,
2615,
1010,
22017,
20898,
2131,
3334,
1007,
1063,
5164,
5754,
17287,
3508,
1027,
1006,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONStringer.java | JSONStringer.open | JSONStringer open(Scope empty, String openBracket) throws JSONException {
if (this.stack.isEmpty() && this.out.length() > 0) {
throw new JSONException("Nesting problem: multiple top-level roots");
}
beforeValue();
this.stack.add(empty);
this.out.append(openBracket);
return this;
} | java | JSONStringer open(Scope empty, String openBracket) throws JSONException {
if (this.stack.isEmpty() && this.out.length() > 0) {
throw new JSONException("Nesting problem: multiple top-level roots");
}
beforeValue();
this.stack.add(empty);
this.out.append(openBracket);
return this;
} | [
"JSONStringer",
"open",
"(",
"Scope",
"empty",
",",
"String",
"openBracket",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"this",
".",
"stack",
".",
"isEmpty",
"(",
")",
"&&",
"this",
".",
"out",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"throw... | Enters a new scope by appending any necessary whitespace and the given bracket.
@param empty any necessary whitespace
@param openBracket the open bracket
@return this object
@throws JSONException if processing of json failed | [
"Enters",
"a",
"new",
"scope",
"by",
"appending",
"any",
"necessary",
"whitespace",
"and",
"the",
"given",
"bracket",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONStringer.java#L175-L183 | train | Open a scope. | [
30522,
1046,
23345,
18886,
11392,
2330,
1006,
9531,
4064,
1010,
5164,
2330,
10024,
19869,
2102,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
2065,
1006,
2023,
1012,
9991,
1012,
2003,
6633,
13876,
2100,
1006,
1007,
1004,
1004,
2023,
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 | buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java | PooledByteBufAllocator.numThreadLocalCaches | @Deprecated
public int numThreadLocalCaches() {
PoolArena<?>[] arenas = heapArenas != null ? heapArenas : directArenas;
if (arenas == null) {
return 0;
}
int total = 0;
for (PoolArena<?> arena : arenas) {
total += arena.numThreadCaches.get();
}
return total;
} | java | @Deprecated
public int numThreadLocalCaches() {
PoolArena<?>[] arenas = heapArenas != null ? heapArenas : directArenas;
if (arenas == null) {
return 0;
}
int total = 0;
for (PoolArena<?> arena : arenas) {
total += arena.numThreadCaches.get();
}
return total;
} | [
"@",
"Deprecated",
"public",
"int",
"numThreadLocalCaches",
"(",
")",
"{",
"PoolArena",
"<",
"?",
">",
"[",
"]",
"arenas",
"=",
"heapArenas",
"!=",
"null",
"?",
"heapArenas",
":",
"directArenas",
";",
"if",
"(",
"arenas",
"==",
"null",
")",
"{",
"return"... | Return the number of thread local caches used by this {@link PooledByteBufAllocator}.
@deprecated use {@link PooledByteBufAllocatorMetric#numThreadLocalCaches()}. | [
"Return",
"the",
"number",
"of",
"thread",
"local",
"caches",
"used",
"by",
"this",
"{",
"@link",
"PooledByteBufAllocator",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java#L547-L560 | train | Get the number of thread - local caches in this Arena. | [
30522,
1030,
2139,
28139,
12921,
2270,
20014,
16371,
20492,
28362,
4215,
4135,
9289,
3540,
8376,
1006,
1007,
1063,
4770,
12069,
2532,
1026,
1029,
1028,
1031,
1033,
26434,
1027,
16721,
12069,
11649,
999,
1027,
19701,
1029,
16721,
12069,
11649,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestServerEndpoint.java | RestServerEndpoint.checkAndCreateUploadDir | private static synchronized void checkAndCreateUploadDir(final Path uploadDir, final Logger log) throws IOException {
if (Files.exists(uploadDir) && Files.isWritable(uploadDir)) {
log.info("Using directory {} for file uploads.", uploadDir);
} else if (Files.isWritable(Files.createDirectories(uploadDir))) {
log.info("Created directory {} for file uploads.", uploadDir);
} else {
log.warn("Upload directory {} cannot be created or is not writable.", uploadDir);
throw new IOException(
String.format("Upload directory %s cannot be created or is not writable.",
uploadDir));
}
} | java | private static synchronized void checkAndCreateUploadDir(final Path uploadDir, final Logger log) throws IOException {
if (Files.exists(uploadDir) && Files.isWritable(uploadDir)) {
log.info("Using directory {} for file uploads.", uploadDir);
} else if (Files.isWritable(Files.createDirectories(uploadDir))) {
log.info("Created directory {} for file uploads.", uploadDir);
} else {
log.warn("Upload directory {} cannot be created or is not writable.", uploadDir);
throw new IOException(
String.format("Upload directory %s cannot be created or is not writable.",
uploadDir));
}
} | [
"private",
"static",
"synchronized",
"void",
"checkAndCreateUploadDir",
"(",
"final",
"Path",
"uploadDir",
",",
"final",
"Logger",
"log",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Files",
".",
"exists",
"(",
"uploadDir",
")",
"&&",
"Files",
".",
"isWritab... | Checks whether the given directory exists and is writable. If it doesn't exist, this method
will attempt to create it.
@param uploadDir directory to check
@param log logger used for logging output
@throws IOException if the directory does not exist and cannot be created, or if the
directory isn't writable | [
"Checks",
"whether",
"the",
"given",
"directory",
"exists",
"and",
"is",
"writable",
".",
"If",
"it",
"doesn",
"t",
"exist",
"this",
"method",
"will",
"attempt",
"to",
"create",
"it",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestServerEndpoint.java#L472-L483 | train | Check if the upload directory exists and is writable. | [
30522,
2797,
10763,
25549,
11675,
4638,
5685,
16748,
3686,
6279,
11066,
4305,
2099,
1006,
2345,
4130,
2039,
11066,
4305,
2099,
1010,
2345,
8833,
4590,
8833,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
6764,
1012,
6526,
1006,
2039,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/yaml/YamlOrchestrationMasterSlaveDataSourceFactory.java | YamlOrchestrationMasterSlaveDataSourceFactory.createDataSource | public static DataSource createDataSource(final File yamlFile) throws SQLException, IOException {
YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlFile);
return createDataSource(config.getDataSources(), config.getMasterSlaveRule(), config.getProps(), config.getOrchestration());
} | java | public static DataSource createDataSource(final File yamlFile) throws SQLException, IOException {
YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlFile);
return createDataSource(config.getDataSources(), config.getMasterSlaveRule(), config.getProps(), config.getOrchestration());
} | [
"public",
"static",
"DataSource",
"createDataSource",
"(",
"final",
"File",
"yamlFile",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"YamlOrchestrationMasterSlaveRuleConfiguration",
"config",
"=",
"unmarshal",
"(",
"yamlFile",
")",
";",
"return",
"createDataS... | Create master-slave data source.
@param yamlFile YAML file for master-slave rule configuration with data sources
@return master-slave data source
@throws SQLException SQL exception
@throws IOException IO exception | [
"Create",
"master",
"-",
"slave",
"data",
"source",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/yaml/YamlOrchestrationMasterSlaveDataSourceFactory.java#L60-L63 | train | Create a DataSource from a YAML file. | [
30522,
2270,
10763,
2951,
6499,
3126,
3401,
2580,
6790,
6499,
3126,
3401,
1006,
2345,
5371,
8038,
19968,
8873,
2571,
1007,
11618,
29296,
10288,
24422,
1010,
22834,
10288,
24422,
1063,
8038,
19968,
2953,
8376,
6494,
3508,
27751,
14973,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/server/src/org/openqa/selenium/remote/server/log/PerSessionLogHandler.java | PerSessionLogHandler.removeSessionLogs | public synchronized void removeSessionLogs(SessionId sessionId) {
if (storeLogsOnSessionQuit) {
return;
}
ThreadKey threadId = sessionToThreadMap.get(sessionId);
SessionId sessionIdForThread = threadToSessionMap.get(threadId);
if (threadId != null && sessionIdForThread != null && sessionIdForThread.equals(sessionId)) {
threadToSessionMap.remove(threadId);
sessionToThreadMap.remove(sessionId);
}
perSessionRecords.remove(sessionId);
logFileRepository.removeLogFile(sessionId);
} | java | public synchronized void removeSessionLogs(SessionId sessionId) {
if (storeLogsOnSessionQuit) {
return;
}
ThreadKey threadId = sessionToThreadMap.get(sessionId);
SessionId sessionIdForThread = threadToSessionMap.get(threadId);
if (threadId != null && sessionIdForThread != null && sessionIdForThread.equals(sessionId)) {
threadToSessionMap.remove(threadId);
sessionToThreadMap.remove(sessionId);
}
perSessionRecords.remove(sessionId);
logFileRepository.removeLogFile(sessionId);
} | [
"public",
"synchronized",
"void",
"removeSessionLogs",
"(",
"SessionId",
"sessionId",
")",
"{",
"if",
"(",
"storeLogsOnSessionQuit",
")",
"{",
"return",
";",
"}",
"ThreadKey",
"threadId",
"=",
"sessionToThreadMap",
".",
"get",
"(",
"sessionId",
")",
";",
"Sessio... | Removes session logs for the given session id.
NB! If the handler has been configured to capture logs on quit no logs will be removed.
@param sessionId The session id to use. | [
"Removes",
"session",
"logs",
"for",
"the",
"given",
"session",
"id",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/selenium/remote/server/log/PerSessionLogHandler.java#L132-L144 | train | Remove all log records for a given session. | [
30522,
2270,
25549,
11675,
20362,
7971,
3258,
21197,
2015,
1006,
5219,
3593,
5219,
3593,
1007,
1063,
2065,
1006,
3573,
21197,
23345,
7971,
3258,
15549,
2102,
1007,
1063,
2709,
1025,
1065,
11689,
14839,
11689,
3593,
1027,
5219,
3406,
2705,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRange.java | KeyGroupRange.of | public static KeyGroupRange of(int startKeyGroup, int endKeyGroup) {
return startKeyGroup <= endKeyGroup ? new KeyGroupRange(startKeyGroup, endKeyGroup) : EMPTY_KEY_GROUP_RANGE;
} | java | public static KeyGroupRange of(int startKeyGroup, int endKeyGroup) {
return startKeyGroup <= endKeyGroup ? new KeyGroupRange(startKeyGroup, endKeyGroup) : EMPTY_KEY_GROUP_RANGE;
} | [
"public",
"static",
"KeyGroupRange",
"of",
"(",
"int",
"startKeyGroup",
",",
"int",
"endKeyGroup",
")",
"{",
"return",
"startKeyGroup",
"<=",
"endKeyGroup",
"?",
"new",
"KeyGroupRange",
"(",
"startKeyGroup",
",",
"endKeyGroup",
")",
":",
"EMPTY_KEY_GROUP_RANGE",
"... | Factory method that also handles creation of empty key-groups.
@param startKeyGroup start of the range (inclusive)
@param endKeyGroup end of the range (inclusive)
@return the key-group from start to end or an empty key-group range. | [
"Factory",
"method",
"that",
"also",
"handles",
"creation",
"of",
"empty",
"key",
"-",
"groups",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRange.java#L186-L188 | train | Returns a new KeyGroupRange with the specified start and end key groups. | [
30522,
2270,
10763,
3145,
17058,
24388,
2063,
1997,
1006,
20014,
2707,
14839,
17058,
1010,
20014,
2203,
14839,
17058,
1007,
1063,
2709,
2707,
14839,
17058,
1026,
1027,
2203,
14839,
17058,
1029,
2047,
3145,
17058,
24388,
2063,
1006,
2707,
1483... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CookieUtil.java | CookieUtil.validCookieValueOctets | private static BitSet validCookieValueOctets() {
BitSet bits = new BitSet(8);
for (int i = 35; i < 127; i++) {
// US-ASCII characters excluding CTLs (%x00-1F / %x7F)
bits.set(i);
}
bits.set('"', false); // exclude DQUOTE = %x22
bits.set(',', false); // exclude comma = %x2C
bits.set(';', false); // exclude semicolon = %x3B
bits.set('\\', false); // exclude backslash = %x5C
return bits;
} | java | private static BitSet validCookieValueOctets() {
BitSet bits = new BitSet(8);
for (int i = 35; i < 127; i++) {
// US-ASCII characters excluding CTLs (%x00-1F / %x7F)
bits.set(i);
}
bits.set('"', false); // exclude DQUOTE = %x22
bits.set(',', false); // exclude comma = %x2C
bits.set(';', false); // exclude semicolon = %x3B
bits.set('\\', false); // exclude backslash = %x5C
return bits;
} | [
"private",
"static",
"BitSet",
"validCookieValueOctets",
"(",
")",
"{",
"BitSet",
"bits",
"=",
"new",
"BitSet",
"(",
"8",
")",
";",
"for",
"(",
"int",
"i",
"=",
"35",
";",
"i",
"<",
"127",
";",
"i",
"++",
")",
"{",
"// US-ASCII characters excluding CTLs ... | US-ASCII characters excluding CTLs, whitespace, DQUOTE, comma, semicolon, and backslash | [
"US",
"-",
"ASCII",
"characters",
"excluding",
"CTLs",
"whitespace",
"DQUOTE",
"comma",
"semicolon",
"and",
"backslash"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/CookieUtil.java#L31-L42 | train | Returns a BitSet of valid cookie value octets. | [
30522,
2797,
10763,
9017,
3388,
9398,
3597,
23212,
13331,
7630,
8780,
6593,
8454,
1006,
1007,
1063,
9017,
3388,
9017,
1027,
2047,
9017,
3388,
1006,
1022,
1007,
1025,
2005,
1006,
20014,
1045,
1027,
3486,
1025,
1045,
1026,
13029,
1025,
1045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.init | public boolean init(Resource resource, Charset charset, boolean isUseVariable) {
if (resource == null) {
throw new NullPointerException("Null setting url define!");
}
this.settingUrl = resource.getUrl();
this.charset = charset;
this.isUseVariable = isUseVariable;
return load();
} | java | public boolean init(Resource resource, Charset charset, boolean isUseVariable) {
if (resource == null) {
throw new NullPointerException("Null setting url define!");
}
this.settingUrl = resource.getUrl();
this.charset = charset;
this.isUseVariable = isUseVariable;
return load();
} | [
"public",
"boolean",
"init",
"(",
"Resource",
"resource",
",",
"Charset",
"charset",
",",
"boolean",
"isUseVariable",
")",
"{",
"if",
"(",
"resource",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Null setting url define!\"",
")",
";",
... | 初始化设定文件
@param resource {@link Resource}
@param charset 字符集
@param isUseVariable 是否使用变量
@return 成功初始化与否 | [
"初始化设定文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L152-L161 | train | Initializes the object with the specified setting url charset and isUseVariable. | [
30522,
2270,
22017,
20898,
1999,
4183,
1006,
7692,
7692,
1010,
25869,
13462,
25869,
13462,
1010,
22017,
20898,
2003,
8557,
10755,
19210,
1007,
1063,
2065,
1006,
7692,
30524,
2131,
3126,
2140,
1006,
1007,
1025,
2023,
1012,
25869,
13462,
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... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SignatureAlgorithmConverter.java | SignatureAlgorithmConverter.toJavaName | static String toJavaName(String opensslName) {
if (opensslName == null) {
return null;
}
Matcher matcher = PATTERN.matcher(opensslName);
if (matcher.matches()) {
String group1 = matcher.group(1);
if (group1 != null) {
return group1.toUpperCase(Locale.ROOT) + "with" + matcher.group(2).toUpperCase(Locale.ROOT);
}
if (matcher.group(3) != null) {
return matcher.group(4).toUpperCase(Locale.ROOT) + "with" + matcher.group(3).toUpperCase(Locale.ROOT);
}
if (matcher.group(5) != null) {
return matcher.group(6).toUpperCase(Locale.ROOT) + "with" + matcher.group(5).toUpperCase(Locale.ROOT);
}
}
return null;
} | java | static String toJavaName(String opensslName) {
if (opensslName == null) {
return null;
}
Matcher matcher = PATTERN.matcher(opensslName);
if (matcher.matches()) {
String group1 = matcher.group(1);
if (group1 != null) {
return group1.toUpperCase(Locale.ROOT) + "with" + matcher.group(2).toUpperCase(Locale.ROOT);
}
if (matcher.group(3) != null) {
return matcher.group(4).toUpperCase(Locale.ROOT) + "with" + matcher.group(3).toUpperCase(Locale.ROOT);
}
if (matcher.group(5) != null) {
return matcher.group(6).toUpperCase(Locale.ROOT) + "with" + matcher.group(5).toUpperCase(Locale.ROOT);
}
}
return null;
} | [
"static",
"String",
"toJavaName",
"(",
"String",
"opensslName",
")",
"{",
"if",
"(",
"opensslName",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Matcher",
"matcher",
"=",
"PATTERN",
".",
"matcher",
"(",
"opensslName",
")",
";",
"if",
"(",
"matche... | Converts an OpenSSL algorithm name to a Java algorithm name and return it,
or return {@code null} if the conversation failed because the format is not known. | [
"Converts",
"an",
"OpenSSL",
"algorithm",
"name",
"to",
"a",
"Java",
"algorithm",
"name",
"and",
"return",
"it",
"or",
"return",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SignatureAlgorithmConverter.java#L54-L73 | train | Convert a OpenSSL name to a Java name. | [
30522,
10763,
5164,
2000,
3900,
27313,
4168,
1006,
5164,
7480,
14540,
18442,
1007,
1063,
2065,
1006,
7480,
14540,
18442,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2674,
2121,
2674,
2121,
1027,
5418,
1012,
2674,
2121,
1006,
748... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/remote/server/Dispatcher.java | Dispatcher.handle | public boolean handle(ServerHttpRequest request, ServerHttpResponse response)
throws IOException {
for (HandlerMapper mapper : this.mappers) {
Handler handler = mapper.getHandler(request);
if (handler != null) {
handle(handler, request, response);
return true;
}
}
return false;
} | java | public boolean handle(ServerHttpRequest request, ServerHttpResponse response)
throws IOException {
for (HandlerMapper mapper : this.mappers) {
Handler handler = mapper.getHandler(request);
if (handler != null) {
handle(handler, request, response);
return true;
}
}
return false;
} | [
"public",
"boolean",
"handle",
"(",
"ServerHttpRequest",
"request",
",",
"ServerHttpResponse",
"response",
")",
"throws",
"IOException",
"{",
"for",
"(",
"HandlerMapper",
"mapper",
":",
"this",
".",
"mappers",
")",
"{",
"Handler",
"handler",
"=",
"mapper",
".",
... | Dispatch the specified request to an appropriate {@link Handler}.
@param request the request
@param response the response
@return {@code true} if the request was dispatched
@throws IOException in case of I/O errors | [
"Dispatch",
"the",
"specified",
"request",
"to",
"an",
"appropriate",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/server/Dispatcher.java#L60-L70 | train | Handle the request. | [
30522,
2270,
22017,
20898,
5047,
1006,
8241,
11039,
25856,
2890,
15500,
5227,
1010,
8241,
11039,
25856,
6072,
26029,
3366,
3433,
1007,
11618,
22834,
10288,
24422,
1063,
2005,
1006,
28213,
2863,
18620,
4949,
4842,
1024,
2023,
1012,
4949,
7347,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java | DependencyCustomizer.add | public DependencyCustomizer add(String... modules) {
for (String module : modules) {
add(module, null, null, true);
}
return this;
} | java | public DependencyCustomizer add(String... modules) {
for (String module : modules) {
add(module, null, null, true);
}
return this;
} | [
"public",
"DependencyCustomizer",
"add",
"(",
"String",
"...",
"modules",
")",
"{",
"for",
"(",
"String",
"module",
":",
"modules",
")",
"{",
"add",
"(",
"module",
",",
"null",
",",
"null",
",",
"true",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Add dependencies and all of their dependencies. The group ID and version of the
dependencies are resolved from the modules using the customizer's
{@link ArtifactCoordinatesResolver}.
@param modules the module IDs
@return this {@link DependencyCustomizer} for continued use | [
"Add",
"dependencies",
"and",
"all",
"of",
"their",
"dependencies",
".",
"The",
"group",
"ID",
"and",
"version",
"of",
"the",
"dependencies",
"are",
"resolved",
"from",
"the",
"modules",
"using",
"the",
"customizer",
"s",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java#L191-L196 | train | Add a list of modules to the customizer. | [
30522,
2270,
24394,
7874,
20389,
17629,
5587,
1006,
5164,
1012,
1012,
1012,
14184,
1007,
1063,
2005,
1006,
5164,
11336,
1024,
14184,
1007,
1063,
5587,
1006,
11336,
1010,
19701,
1010,
19701,
1010,
2995,
1007,
1025,
1065,
2709,
2023,
1025,
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-cep/src/main/java/org/apache/flink/cep/PatternStream.java | PatternStream.flatSelect | public <R> SingleOutputStreamOperator<R> flatSelect(
final PatternFlatSelectFunction<T, R> patternFlatSelectFunction,
final TypeInformation<R> outTypeInfo) {
final PatternProcessFunction<T, R> processFunction =
fromFlatSelect(builder.clean(patternFlatSelectFunction))
.build();
return process(processFunction, outTypeInfo);
} | java | public <R> SingleOutputStreamOperator<R> flatSelect(
final PatternFlatSelectFunction<T, R> patternFlatSelectFunction,
final TypeInformation<R> outTypeInfo) {
final PatternProcessFunction<T, R> processFunction =
fromFlatSelect(builder.clean(patternFlatSelectFunction))
.build();
return process(processFunction, outTypeInfo);
} | [
"public",
"<",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"flatSelect",
"(",
"final",
"PatternFlatSelectFunction",
"<",
"T",
",",
"R",
">",
"patternFlatSelectFunction",
",",
"final",
"TypeInformation",
"<",
"R",
">",
"outTypeInfo",
")",
"{",
"final",... | Applies a flat select function to the detected pattern sequence. For each pattern sequence
the provided {@link PatternFlatSelectFunction} is called. The pattern flat select function
can produce an arbitrary number of resulting elements.
@param patternFlatSelectFunction The pattern flat select function which is called for each
detected pattern sequence.
@param <R> Type of the resulting elements
@param outTypeInfo Explicit specification of output type.
@return {@link DataStream} which contains the resulting elements from the pattern flat select
function. | [
"Applies",
"a",
"flat",
"select",
"function",
"to",
"the",
"detected",
"pattern",
"sequence",
".",
"For",
"each",
"pattern",
"sequence",
"the",
"provided",
"{",
"@link",
"PatternFlatSelectFunction",
"}",
"is",
"called",
".",
"The",
"pattern",
"flat",
"select",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternStream.java#L358-L367 | train | Flat select. | [
30522,
2270,
1026,
1054,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
14201,
12260,
6593,
1006,
2345,
5418,
10258,
11149,
12260,
6593,
11263,
27989,
1026,
1056,
1010,
1054,
1028,
5418,
10258,
11149,
12260,
6593,
11263,
27989... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/ConnectionInputStream.java | ConnectionInputStream.readHeader | public String readHeader() throws IOException {
byte[] buffer = new byte[BUFFER_SIZE];
StringBuilder content = new StringBuilder(BUFFER_SIZE);
while (content.indexOf(HEADER_END) == -1) {
int amountRead = checkedRead(buffer, 0, BUFFER_SIZE);
content.append(new String(buffer, 0, amountRead));
}
return content.substring(0, content.indexOf(HEADER_END));
} | java | public String readHeader() throws IOException {
byte[] buffer = new byte[BUFFER_SIZE];
StringBuilder content = new StringBuilder(BUFFER_SIZE);
while (content.indexOf(HEADER_END) == -1) {
int amountRead = checkedRead(buffer, 0, BUFFER_SIZE);
content.append(new String(buffer, 0, amountRead));
}
return content.substring(0, content.indexOf(HEADER_END));
} | [
"public",
"String",
"readHeader",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"BUFFER_SIZE",
"]",
";",
"StringBuilder",
"content",
"=",
"new",
"StringBuilder",
"(",
"BUFFER_SIZE",
")",
";",
"while",
"(",
"co... | Read the HTTP header from the {@link InputStream}. Note: This method doesn't expect
any HTTP content after the header since the initial request is usually just a
WebSocket upgrade.
@return the HTTP header
@throws IOException in case of I/O errors | [
"Read",
"the",
"HTTP",
"header",
"from",
"the",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/ConnectionInputStream.java#L45-L53 | train | Read the header. | [
30522,
2270,
5164,
3191,
4974,
2121,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
24880,
1031,
1033,
17698,
1027,
2047,
24880,
1031,
17698,
1035,
2946,
1033,
1025,
5164,
8569,
23891,
2099,
4180,
1027,
2047,
5164,
8569,
23891,
2099,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java | JSONObject.getInt | public int getInt(String name) throws JSONException {
Object object = get(name);
Integer result = JSON.toInteger(object);
if (result == null) {
throw JSON.typeMismatch(name, object, "int");
}
return result;
} | java | public int getInt(String name) throws JSONException {
Object object = get(name);
Integer result = JSON.toInteger(object);
if (result == null) {
throw JSON.typeMismatch(name, object, "int");
}
return result;
} | [
"public",
"int",
"getInt",
"(",
"String",
"name",
")",
"throws",
"JSONException",
"{",
"Object",
"object",
"=",
"get",
"(",
"name",
")",
";",
"Integer",
"result",
"=",
"JSON",
".",
"toInteger",
"(",
"object",
")",
";",
"if",
"(",
"result",
"==",
"null"... | Returns the value mapped by {@code name} if it exists and is an int or can be
coerced to an int.
@param name the name of the property
@return the value
@throws JSONException if the mapping doesn't exist or cannot be coerced to an int. | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L478-L485 | train | Get the integer value associated with a name. | [
30522,
2270,
20014,
2131,
18447,
1006,
5164,
2171,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
4874,
4874,
1027,
2131,
1006,
2171,
1007,
1025,
16109,
2765,
1027,
1046,
3385,
1012,
2000,
18447,
26320,
1006,
4874,
1007,
1025,
2065,
1006,
276... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.print | public void print() throws Exception {
List<T> elements = collect();
for (T e: elements) {
System.out.println(e);
}
} | java | public void print() throws Exception {
List<T> elements = collect();
for (T e: elements) {
System.out.println(e);
}
} | [
"public",
"void",
"print",
"(",
")",
"throws",
"Exception",
"{",
"List",
"<",
"T",
">",
"elements",
"=",
"collect",
"(",
")",
";",
"for",
"(",
"T",
"e",
":",
"elements",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"e",
")",
";",
"}",
"... | Prints the elements in a DataSet to the standard output stream {@link System#out} of the JVM that calls
the print() method. For programs that are executed in a cluster, this method needs
to gather the contents of the DataSet back to the client, to print it there.
<p>The string written for each element is defined by the {@link Object#toString()} method.
<p>This method immediately triggers the program execution, similar to the
{@link #collect()} and {@link #count()} methods.
@see #printToErr()
@see #printOnTaskManager(String) | [
"Prints",
"the",
"elements",
"in",
"a",
"DataSet",
"to",
"the",
"standard",
"output",
"stream",
"{",
"@link",
"System#out",
"}",
"of",
"the",
"JVM",
"that",
"calls",
"the",
"print",
"()",
"method",
".",
"For",
"programs",
"that",
"are",
"executed",
"in",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1651-L1656 | train | Print the elements in the collection. | [
30522,
2270,
11675,
6140,
1006,
1007,
11618,
6453,
1063,
2862,
1026,
1056,
1028,
3787,
1027,
8145,
1006,
1007,
1025,
2005,
1006,
1056,
1041,
1024,
3787,
1007,
1063,
2291,
1012,
2041,
1012,
6140,
19666,
1006,
1041,
1007,
1025,
1065,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java | HAProxyMessageDecoder.decodeLine | private ByteBuf decodeLine(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
final int eol = findEndOfLine(buffer);
if (!discarding) {
if (eol >= 0) {
final int length = eol - buffer.readerIndex();
if (length > V1_MAX_LENGTH) {
buffer.readerIndex(eol + DELIMITER_LENGTH);
failOverLimit(ctx, length);
return null;
}
ByteBuf frame = buffer.readSlice(length);
buffer.skipBytes(DELIMITER_LENGTH);
return frame;
} else {
final int length = buffer.readableBytes();
if (length > V1_MAX_LENGTH) {
discardedBytes = length;
buffer.skipBytes(length);
discarding = true;
failOverLimit(ctx, "over " + discardedBytes);
}
return null;
}
} else {
if (eol >= 0) {
final int delimLength = buffer.getByte(eol) == '\r' ? 2 : 1;
buffer.readerIndex(eol + delimLength);
discardedBytes = 0;
discarding = false;
} else {
discardedBytes = buffer.readableBytes();
buffer.skipBytes(discardedBytes);
}
return null;
}
} | java | private ByteBuf decodeLine(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
final int eol = findEndOfLine(buffer);
if (!discarding) {
if (eol >= 0) {
final int length = eol - buffer.readerIndex();
if (length > V1_MAX_LENGTH) {
buffer.readerIndex(eol + DELIMITER_LENGTH);
failOverLimit(ctx, length);
return null;
}
ByteBuf frame = buffer.readSlice(length);
buffer.skipBytes(DELIMITER_LENGTH);
return frame;
} else {
final int length = buffer.readableBytes();
if (length > V1_MAX_LENGTH) {
discardedBytes = length;
buffer.skipBytes(length);
discarding = true;
failOverLimit(ctx, "over " + discardedBytes);
}
return null;
}
} else {
if (eol >= 0) {
final int delimLength = buffer.getByte(eol) == '\r' ? 2 : 1;
buffer.readerIndex(eol + delimLength);
discardedBytes = 0;
discarding = false;
} else {
discardedBytes = buffer.readableBytes();
buffer.skipBytes(discardedBytes);
}
return null;
}
} | [
"private",
"ByteBuf",
"decodeLine",
"(",
"ChannelHandlerContext",
"ctx",
",",
"ByteBuf",
"buffer",
")",
"throws",
"Exception",
"{",
"final",
"int",
"eol",
"=",
"findEndOfLine",
"(",
"buffer",
")",
";",
"if",
"(",
"!",
"discarding",
")",
"{",
"if",
"(",
"eo... | Create a frame out of the {@link ByteBuf} and return it.
Based on code from {@link LineBasedFrameDecoder#decode(ChannelHandlerContext, ByteBuf)}.
@param ctx the {@link ChannelHandlerContext} which this {@link HAProxyMessageDecoder} belongs to
@param buffer the {@link ByteBuf} from which to read data
@return frame the {@link ByteBuf} which represent the frame or {@code null} if no frame could
be created | [
"Create",
"a",
"frame",
"out",
"of",
"the",
"{",
"@link",
"ByteBuf",
"}",
"and",
"return",
"it",
".",
"Based",
"on",
"code",
"from",
"{",
"@link",
"LineBasedFrameDecoder#decode",
"(",
"ChannelHandlerContext",
"ByteBuf",
")",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java#L312-L347 | train | Decodes a single line from the buffer. | [
30522,
2797,
24880,
8569,
2546,
21933,
9247,
3170,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
24880,
8569,
2546,
17698,
1007,
11618,
6453,
1063,
2345,
20014,
1041,
4747,
1027,
2424,
10497,
11253,
4179,
1006,
17698,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/streaming/connectors/elasticsearch/ElasticsearchSinkBase.java | ElasticsearchSinkBase.buildBulkProcessor | @VisibleForTesting
protected BulkProcessor buildBulkProcessor(BulkProcessor.Listener listener) {
checkNotNull(listener);
BulkProcessor.Builder bulkProcessorBuilder = callBridge.createBulkProcessorBuilder(client, listener);
// This makes flush() blocking
bulkProcessorBuilder.setConcurrentRequests(0);
if (bulkProcessorFlushMaxActions != null) {
bulkProcessorBuilder.setBulkActions(bulkProcessorFlushMaxActions);
}
if (bulkProcessorFlushMaxSizeMb != null) {
bulkProcessorBuilder.setBulkSize(new ByteSizeValue(bulkProcessorFlushMaxSizeMb, ByteSizeUnit.MB));
}
if (bulkProcessorFlushIntervalMillis != null) {
bulkProcessorBuilder.setFlushInterval(TimeValue.timeValueMillis(bulkProcessorFlushIntervalMillis));
}
// if backoff retrying is disabled, bulkProcessorFlushBackoffPolicy will be null
callBridge.configureBulkProcessorBackoff(bulkProcessorBuilder, bulkProcessorFlushBackoffPolicy);
return bulkProcessorBuilder.build();
} | java | @VisibleForTesting
protected BulkProcessor buildBulkProcessor(BulkProcessor.Listener listener) {
checkNotNull(listener);
BulkProcessor.Builder bulkProcessorBuilder = callBridge.createBulkProcessorBuilder(client, listener);
// This makes flush() blocking
bulkProcessorBuilder.setConcurrentRequests(0);
if (bulkProcessorFlushMaxActions != null) {
bulkProcessorBuilder.setBulkActions(bulkProcessorFlushMaxActions);
}
if (bulkProcessorFlushMaxSizeMb != null) {
bulkProcessorBuilder.setBulkSize(new ByteSizeValue(bulkProcessorFlushMaxSizeMb, ByteSizeUnit.MB));
}
if (bulkProcessorFlushIntervalMillis != null) {
bulkProcessorBuilder.setFlushInterval(TimeValue.timeValueMillis(bulkProcessorFlushIntervalMillis));
}
// if backoff retrying is disabled, bulkProcessorFlushBackoffPolicy will be null
callBridge.configureBulkProcessorBackoff(bulkProcessorBuilder, bulkProcessorFlushBackoffPolicy);
return bulkProcessorBuilder.build();
} | [
"@",
"VisibleForTesting",
"protected",
"BulkProcessor",
"buildBulkProcessor",
"(",
"BulkProcessor",
".",
"Listener",
"listener",
")",
"{",
"checkNotNull",
"(",
"listener",
")",
";",
"BulkProcessor",
".",
"Builder",
"bulkProcessorBuilder",
"=",
"callBridge",
".",
"crea... | Build the {@link BulkProcessor}.
<p>Note: this is exposed for testing purposes. | [
"Build",
"the",
"{",
"@link",
"BulkProcessor",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/streaming/connectors/elasticsearch/ElasticsearchSinkBase.java#L351-L376 | train | Build bulk processor. | [
30522,
1030,
5710,
13028,
4355,
2075,
5123,
9625,
21572,
9623,
21748,
3857,
8569,
13687,
21572,
9623,
21748,
1006,
9625,
21572,
9623,
21748,
1012,
19373,
19373,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
19373,
1007,
1025,
9625,
21572,
9623,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/similarity/AdamicAdar.java | AdamicAdar.setMinimumRatio | public AdamicAdar<K, VV, EV> setMinimumRatio(float ratio) {
Preconditions.checkArgument(ratio >= 0, "Minimum ratio must be non-negative");
this.minimumRatio = ratio;
return this;
} | java | public AdamicAdar<K, VV, EV> setMinimumRatio(float ratio) {
Preconditions.checkArgument(ratio >= 0, "Minimum ratio must be non-negative");
this.minimumRatio = ratio;
return this;
} | [
"public",
"AdamicAdar",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"setMinimumRatio",
"(",
"float",
"ratio",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"ratio",
">=",
"0",
",",
"\"Minimum ratio must be non-negative\"",
")",
";",
"this",
".",
"minimumRatio... | Filter out Adamic-Adar scores less than the given ratio times the average score.
@param ratio minimum ratio
@return this | [
"Filter",
"out",
"Adamic",
"-",
"Adar",
"scores",
"less",
"than",
"the",
"given",
"ratio",
"times",
"the",
"average",
"score",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/similarity/AdamicAdar.java#L108-L114 | train | Sets the minimum ratio. | [
30522,
2270,
4205,
5555,
7662,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
2275,
25300,
27147,
8609,
3695,
1006,
14257,
6463,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
6463,
1028,
1027,
1014,
1010,
1000,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliStrings.java | CliStrings.messageInfo | public static AttributedString messageInfo(String message) {
return new AttributedStringBuilder()
.style(AttributedStyle.DEFAULT.bold().foreground(AttributedStyle.BLUE))
.append("[INFO] ")
.append(message)
.toAttributedString();
} | java | public static AttributedString messageInfo(String message) {
return new AttributedStringBuilder()
.style(AttributedStyle.DEFAULT.bold().foreground(AttributedStyle.BLUE))
.append("[INFO] ")
.append(message)
.toAttributedString();
} | [
"public",
"static",
"AttributedString",
"messageInfo",
"(",
"String",
"message",
")",
"{",
"return",
"new",
"AttributedStringBuilder",
"(",
")",
".",
"style",
"(",
"AttributedStyle",
".",
"DEFAULT",
".",
"bold",
"(",
")",
".",
"foreground",
"(",
"AttributedStyle... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliStrings.java#L227-L233 | train | Create an attributed string with an info message. | [
30522,
2270,
10763,
7108,
3367,
4892,
4471,
2378,
14876,
1006,
5164,
4471,
1007,
1063,
2709,
2047,
7108,
3367,
4892,
8569,
23891,
2099,
1006,
1007,
1012,
2806,
1006,
7108,
21756,
2571,
1012,
12398,
1012,
7782,
1006,
1007,
1012,
18921,
16365... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/thread/GlobalThreadPool.java | GlobalThreadPool.submit | public static <T> Future<T> submit(Callable<T> task) {
return executor.submit(task);
} | java | public static <T> Future<T> submit(Callable<T> task) {
return executor.submit(task);
} | [
"public",
"static",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"submit",
"(",
"Callable",
"<",
"T",
">",
"task",
")",
"{",
"return",
"executor",
".",
"submit",
"(",
"task",
")",
";",
"}"
] | 执行有返回值的异步方法<br>
Future代表一个异步执行的操作,通过get()方法可以获得操作的结果,如果异步操作还没有完成,则,get()会使当前线程阻塞
@param <T> 执行的Task
@param task {@link Callable}
@return Future | [
"执行有返回值的异步方法<br",
">",
"Future代表一个异步执行的操作,通过get",
"()",
"方法可以获得操作的结果,如果异步操作还没有完成,则,get",
"()",
"会使当前线程阻塞"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/GlobalThreadPool.java#L80-L82 | train | Submits a task to the pool. | [
30522,
2270,
10763,
1026,
1056,
1028,
2925,
1026,
1056,
1028,
12040,
1006,
2655,
3085,
1026,
1056,
1028,
4708,
1007,
1063,
2709,
4654,
8586,
16161,
2099,
1012,
12040,
1006,
4708,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.updateConnectAddr | public InetSocketAddress updateConnectAddr(
String hostProperty,
String addressProperty,
String defaultAddressValue,
InetSocketAddress addr) {
final String host = get(hostProperty);
final String connectHostPort = getTrimmed(addressProperty, defaultAddressValue);
if (host == null || host.isEmpty() || connectHostPort == null || connectHostPort.isEmpty()) {
//not our case, fall back to original logic
return updateConnectAddr(addressProperty, addr);
}
final String connectHost = connectHostPort.split(":")[0];
// Create connect address using client address hostname and server port.
return updateConnectAddr(addressProperty, NetUtils.createSocketAddrForHost(
connectHost, addr.getPort()));
} | java | public InetSocketAddress updateConnectAddr(
String hostProperty,
String addressProperty,
String defaultAddressValue,
InetSocketAddress addr) {
final String host = get(hostProperty);
final String connectHostPort = getTrimmed(addressProperty, defaultAddressValue);
if (host == null || host.isEmpty() || connectHostPort == null || connectHostPort.isEmpty()) {
//not our case, fall back to original logic
return updateConnectAddr(addressProperty, addr);
}
final String connectHost = connectHostPort.split(":")[0];
// Create connect address using client address hostname and server port.
return updateConnectAddr(addressProperty, NetUtils.createSocketAddrForHost(
connectHost, addr.getPort()));
} | [
"public",
"InetSocketAddress",
"updateConnectAddr",
"(",
"String",
"hostProperty",
",",
"String",
"addressProperty",
",",
"String",
"defaultAddressValue",
",",
"InetSocketAddress",
"addr",
")",
"{",
"final",
"String",
"host",
"=",
"get",
"(",
"hostProperty",
")",
";... | Set the socket address a client can use to connect for the
<code>name</code> property as a <code>host:port</code>. The wildcard
address is replaced with the local host's address. If the host and address
properties are configured the host component of the address will be combined
with the port component of the addr to generate the address. This is to allow
optional control over which host name is used in multi-home bind-host
cases where a host can have multiple names
@param hostProperty the bind-host configuration name
@param addressProperty the service address configuration name
@param defaultAddressValue the service default address configuration value
@param addr InetSocketAddress of the service listener
@return InetSocketAddress for clients to connect | [
"Set",
"the",
"socket",
"address",
"a",
"client",
"can",
"use",
"to",
"connect",
"for",
"the",
"<code",
">",
"name<",
"/",
"code",
">",
"property",
"as",
"a",
"<code",
">",
"host",
":",
"port<",
"/",
"code",
">",
".",
"The",
"wildcard",
"address",
"i... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2330-L2348 | train | Update the connect address. | [
30522,
2270,
1999,
8454,
7432,
12928,
14141,
8303,
10651,
8663,
2638,
25572,
14141,
2099,
1006,
5164,
3677,
21572,
4842,
3723,
1010,
5164,
4769,
21572,
4842,
3723,
1010,
5164,
12398,
4215,
16200,
4757,
10175,
5657,
1010,
1999,
8454,
7432,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalStater.java | CanalStater.destroy | synchronized void destroy() throws Throwable {
if (controller != null) {
controller.stop();
controller = null;
}
if (shutdownThread != null) {
Runtime.getRuntime().removeShutdownHook(shutdownThread);
shutdownThread = null;
}
if (canalMQProducer != null && canalMQStarter != null) {
canalMQStarter.destroy();
canalMQStarter = null;
canalMQProducer = null;
}
} | java | synchronized void destroy() throws Throwable {
if (controller != null) {
controller.stop();
controller = null;
}
if (shutdownThread != null) {
Runtime.getRuntime().removeShutdownHook(shutdownThread);
shutdownThread = null;
}
if (canalMQProducer != null && canalMQStarter != null) {
canalMQStarter.destroy();
canalMQStarter = null;
canalMQProducer = null;
}
} | [
"synchronized",
"void",
"destroy",
"(",
")",
"throws",
"Throwable",
"{",
"if",
"(",
"controller",
"!=",
"null",
")",
"{",
"controller",
".",
"stop",
"(",
")",
";",
"controller",
"=",
"null",
";",
"}",
"if",
"(",
"shutdownThread",
"!=",
"null",
")",
"{"... | 销毁方法,远程配置变更时调用
@throws Throwable | [
"销毁方法,远程配置变更时调用"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalStater.java#L124-L138 | train | Destroy the instance of the class. | [
30522,
25549,
11675,
6033,
1006,
1007,
11618,
5466,
3085,
1063,
2065,
1006,
11486,
999,
1027,
19701,
1007,
1063,
11486,
1012,
2644,
1006,
1007,
1025,
11486,
1027,
19701,
1025,
1065,
2065,
1006,
3844,
7698,
2705,
16416,
2094,
999,
1027,
1970... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/NetUtil.java | NetUtil.toSocketAddressString | public static String toSocketAddressString(InetSocketAddress addr) {
String port = String.valueOf(addr.getPort());
final StringBuilder sb;
if (addr.isUnresolved()) {
String hostname = getHostname(addr);
sb = newSocketAddressStringBuilder(hostname, port, !isValidIpV6Address(hostname));
} else {
InetAddress address = addr.getAddress();
String hostString = toAddressString(address);
sb = newSocketAddressStringBuilder(hostString, port, address instanceof Inet4Address);
}
return sb.append(':').append(port).toString();
} | java | public static String toSocketAddressString(InetSocketAddress addr) {
String port = String.valueOf(addr.getPort());
final StringBuilder sb;
if (addr.isUnresolved()) {
String hostname = getHostname(addr);
sb = newSocketAddressStringBuilder(hostname, port, !isValidIpV6Address(hostname));
} else {
InetAddress address = addr.getAddress();
String hostString = toAddressString(address);
sb = newSocketAddressStringBuilder(hostString, port, address instanceof Inet4Address);
}
return sb.append(':').append(port).toString();
} | [
"public",
"static",
"String",
"toSocketAddressString",
"(",
"InetSocketAddress",
"addr",
")",
"{",
"String",
"port",
"=",
"String",
".",
"valueOf",
"(",
"addr",
".",
"getPort",
"(",
")",
")",
";",
"final",
"StringBuilder",
"sb",
";",
"if",
"(",
"addr",
"."... | Returns the {@link String} representation of an {@link InetSocketAddress}.
<p>
The output does not include Scope ID.
@param addr {@link InetSocketAddress} to be converted to an address string
@return {@code String} containing the text-formatted IP address | [
"Returns",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/NetUtil.java#L939-L952 | train | To address string. | [
30522,
2270,
10763,
5164,
2000,
6499,
19869,
17713,
16200,
4757,
3367,
4892,
1006,
1999,
8454,
7432,
12928,
14141,
8303,
5587,
2099,
1007,
1063,
5164,
3417,
1027,
5164,
1012,
3643,
11253,
1006,
5587,
2099,
1012,
2131,
6442,
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/util/TypeUtil.java | TypeUtil.toParameterizedType | public static ParameterizedType toParameterizedType(Type type) {
if (type instanceof ParameterizedType) {
return (ParameterizedType) type;
} else if (type instanceof Class) {
return toParameterizedType(((Class<?>) type).getGenericSuperclass());
}
return null;
} | java | public static ParameterizedType toParameterizedType(Type type) {
if (type instanceof ParameterizedType) {
return (ParameterizedType) type;
} else if (type instanceof Class) {
return toParameterizedType(((Class<?>) type).getGenericSuperclass());
}
return null;
} | [
"public",
"static",
"ParameterizedType",
"toParameterizedType",
"(",
"Type",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"ParameterizedType",
")",
"{",
"return",
"(",
"ParameterizedType",
")",
"type",
";",
"}",
"else",
"if",
"(",
"type",
"instanceof",
"... | 将{@link Type} 转换为{@link ParameterizedType}<br>
{@link ParameterizedType}用于获取当前类或父类中泛型参数化后的类型<br>
一般用于获取泛型参数具体的参数类型,例如:
<pre>
class A<T>
class B extends A<String>
</pre>
通过此方法,传入B.class即可得到B{@link ParameterizedType},从而获取到String
@param type {@link Type}
@return {@link ParameterizedType}
@since 4.5.2 | [
"将",
"{",
"@link",
"Type",
"}",
"转换为",
"{",
"@link",
"ParameterizedType",
"}",
"<br",
">",
"{",
"@link",
"ParameterizedType",
"}",
"用于获取当前类或父类中泛型参数化后的类型<br",
">",
"一般用于获取泛型参数具体的参数类型,例如:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java#L255-L262 | train | Converts a type to a parameterized type. | [
30522,
2270,
10763,
16381,
3550,
13874,
2327,
5400,
22828,
3550,
13874,
1006,
2828,
2828,
1007,
1063,
2065,
1006,
2828,
6013,
11253,
16381,
3550,
13874,
1007,
1063,
2709,
1006,
16381,
3550,
13874,
1007,
2828,
1025,
1065,
2842,
2065,
1006,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/IdcardUtil.java | IdcardUtil.getPowerSum | private static int getPowerSum(char[] iArr) {
int iSum = 0;
if (power.length == iArr.length) {
for (int i = 0; i < iArr.length; i++) {
iSum += Integer.valueOf(String.valueOf(iArr[i])) * power[i];
}
}
return iSum;
} | java | private static int getPowerSum(char[] iArr) {
int iSum = 0;
if (power.length == iArr.length) {
for (int i = 0; i < iArr.length; i++) {
iSum += Integer.valueOf(String.valueOf(iArr[i])) * power[i];
}
}
return iSum;
} | [
"private",
"static",
"int",
"getPowerSum",
"(",
"char",
"[",
"]",
"iArr",
")",
"{",
"int",
"iSum",
"=",
"0",
";",
"if",
"(",
"power",
".",
"length",
"==",
"iArr",
".",
"length",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"iArr",... | 将身份证的每位和对应位的加权因子相乘之后,再得到和值
@param iArr
@return 身份证编码。 | [
"将身份证的每位和对应位的加权因子相乘之后,再得到和值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/IdcardUtil.java#L582-L590 | train | Gets the sum of the power of the char array. | [
30522,
2797,
10763,
20014,
2131,
11452,
17421,
1006,
25869,
1031,
1033,
24264,
12171,
1007,
1063,
20014,
2003,
2819,
1027,
1014,
1025,
2065,
1006,
2373,
1012,
3091,
1027,
1027,
24264,
12171,
1012,
3091,
1007,
1063,
2005,
1006,
20014,
1045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ChannelHandlerMask.java | ChannelHandlerMask.mask0 | private static int mask0(Class<? extends ChannelHandler> handlerType) {
int mask = MASK_EXCEPTION_CAUGHT;
try {
if (ChannelInboundHandler.class.isAssignableFrom(handlerType)) {
mask |= MASK_ALL_INBOUND;
if (isSkippable(handlerType, "channelRegistered", ChannelHandlerContext.class)) {
mask &= ~MASK_CHANNEL_REGISTERED;
}
if (isSkippable(handlerType, "channelUnregistered", ChannelHandlerContext.class)) {
mask &= ~MASK_CHANNEL_UNREGISTERED;
}
if (isSkippable(handlerType, "channelActive", ChannelHandlerContext.class)) {
mask &= ~MASK_CHANNEL_ACTIVE;
}
if (isSkippable(handlerType, "channelInactive", ChannelHandlerContext.class)) {
mask &= ~MASK_CHANNEL_INACTIVE;
}
if (isSkippable(handlerType, "channelRead", ChannelHandlerContext.class, Object.class)) {
mask &= ~MASK_CHANNEL_READ;
}
if (isSkippable(handlerType, "channelReadComplete", ChannelHandlerContext.class)) {
mask &= ~MASK_CHANNEL_READ_COMPLETE;
}
if (isSkippable(handlerType, "channelWritabilityChanged", ChannelHandlerContext.class)) {
mask &= ~MASK_CHANNEL_WRITABILITY_CHANGED;
}
if (isSkippable(handlerType, "userEventTriggered", ChannelHandlerContext.class, Object.class)) {
mask &= ~MASK_USER_EVENT_TRIGGERED;
}
}
if (ChannelOutboundHandler.class.isAssignableFrom(handlerType)) {
mask |= MASK_ALL_OUTBOUND;
if (isSkippable(handlerType, "bind", ChannelHandlerContext.class,
SocketAddress.class, ChannelPromise.class)) {
mask &= ~MASK_BIND;
}
if (isSkippable(handlerType, "connect", ChannelHandlerContext.class, SocketAddress.class,
SocketAddress.class, ChannelPromise.class)) {
mask &= ~MASK_CONNECT;
}
if (isSkippable(handlerType, "disconnect", ChannelHandlerContext.class, ChannelPromise.class)) {
mask &= ~MASK_DISCONNECT;
}
if (isSkippable(handlerType, "close", ChannelHandlerContext.class, ChannelPromise.class)) {
mask &= ~MASK_CLOSE;
}
if (isSkippable(handlerType, "deregister", ChannelHandlerContext.class, ChannelPromise.class)) {
mask &= ~MASK_DEREGISTER;
}
if (isSkippable(handlerType, "read", ChannelHandlerContext.class)) {
mask &= ~MASK_READ;
}
if (isSkippable(handlerType, "write", ChannelHandlerContext.class,
Object.class, ChannelPromise.class)) {
mask &= ~MASK_WRITE;
}
if (isSkippable(handlerType, "flush", ChannelHandlerContext.class)) {
mask &= ~MASK_FLUSH;
}
}
if (isSkippable(handlerType, "exceptionCaught", ChannelHandlerContext.class, Throwable.class)) {
mask &= ~MASK_EXCEPTION_CAUGHT;
}
} catch (Exception e) {
// Should never reach here.
PlatformDependent.throwException(e);
}
return mask;
} | java | private static int mask0(Class<? extends ChannelHandler> handlerType) {
int mask = MASK_EXCEPTION_CAUGHT;
try {
if (ChannelInboundHandler.class.isAssignableFrom(handlerType)) {
mask |= MASK_ALL_INBOUND;
if (isSkippable(handlerType, "channelRegistered", ChannelHandlerContext.class)) {
mask &= ~MASK_CHANNEL_REGISTERED;
}
if (isSkippable(handlerType, "channelUnregistered", ChannelHandlerContext.class)) {
mask &= ~MASK_CHANNEL_UNREGISTERED;
}
if (isSkippable(handlerType, "channelActive", ChannelHandlerContext.class)) {
mask &= ~MASK_CHANNEL_ACTIVE;
}
if (isSkippable(handlerType, "channelInactive", ChannelHandlerContext.class)) {
mask &= ~MASK_CHANNEL_INACTIVE;
}
if (isSkippable(handlerType, "channelRead", ChannelHandlerContext.class, Object.class)) {
mask &= ~MASK_CHANNEL_READ;
}
if (isSkippable(handlerType, "channelReadComplete", ChannelHandlerContext.class)) {
mask &= ~MASK_CHANNEL_READ_COMPLETE;
}
if (isSkippable(handlerType, "channelWritabilityChanged", ChannelHandlerContext.class)) {
mask &= ~MASK_CHANNEL_WRITABILITY_CHANGED;
}
if (isSkippable(handlerType, "userEventTriggered", ChannelHandlerContext.class, Object.class)) {
mask &= ~MASK_USER_EVENT_TRIGGERED;
}
}
if (ChannelOutboundHandler.class.isAssignableFrom(handlerType)) {
mask |= MASK_ALL_OUTBOUND;
if (isSkippable(handlerType, "bind", ChannelHandlerContext.class,
SocketAddress.class, ChannelPromise.class)) {
mask &= ~MASK_BIND;
}
if (isSkippable(handlerType, "connect", ChannelHandlerContext.class, SocketAddress.class,
SocketAddress.class, ChannelPromise.class)) {
mask &= ~MASK_CONNECT;
}
if (isSkippable(handlerType, "disconnect", ChannelHandlerContext.class, ChannelPromise.class)) {
mask &= ~MASK_DISCONNECT;
}
if (isSkippable(handlerType, "close", ChannelHandlerContext.class, ChannelPromise.class)) {
mask &= ~MASK_CLOSE;
}
if (isSkippable(handlerType, "deregister", ChannelHandlerContext.class, ChannelPromise.class)) {
mask &= ~MASK_DEREGISTER;
}
if (isSkippable(handlerType, "read", ChannelHandlerContext.class)) {
mask &= ~MASK_READ;
}
if (isSkippable(handlerType, "write", ChannelHandlerContext.class,
Object.class, ChannelPromise.class)) {
mask &= ~MASK_WRITE;
}
if (isSkippable(handlerType, "flush", ChannelHandlerContext.class)) {
mask &= ~MASK_FLUSH;
}
}
if (isSkippable(handlerType, "exceptionCaught", ChannelHandlerContext.class, Throwable.class)) {
mask &= ~MASK_EXCEPTION_CAUGHT;
}
} catch (Exception e) {
// Should never reach here.
PlatformDependent.throwException(e);
}
return mask;
} | [
"private",
"static",
"int",
"mask0",
"(",
"Class",
"<",
"?",
"extends",
"ChannelHandler",
">",
"handlerType",
")",
"{",
"int",
"mask",
"=",
"MASK_EXCEPTION_CAUGHT",
";",
"try",
"{",
"if",
"(",
"ChannelInboundHandler",
".",
"class",
".",
"isAssignableFrom",
"("... | Calculate the {@code executionMask}. | [
"Calculate",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/ChannelHandlerMask.java#L85-L158 | train | mask 0 for all exceptions | [
30522,
2797,
10763,
20014,
7308,
2692,
1006,
2465,
1026,
1029,
8908,
3149,
11774,
3917,
1028,
28213,
13874,
1007,
1063,
20014,
7308,
1027,
7308,
1035,
6453,
1035,
3236,
1025,
3046,
1063,
2065,
1006,
3149,
2378,
15494,
11774,
3917,
1012,
246... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollServerSocketChannelConfig.java | EpollServerSocketChannelConfig.setTcpDeferAccept | public EpollServerSocketChannelConfig setTcpDeferAccept(int deferAccept) {
try {
((EpollServerSocketChannel) channel).socket.setTcpDeferAccept(deferAccept);
return this;
} catch (IOException e) {
throw new ChannelException(e);
}
} | java | public EpollServerSocketChannelConfig setTcpDeferAccept(int deferAccept) {
try {
((EpollServerSocketChannel) channel).socket.setTcpDeferAccept(deferAccept);
return this;
} catch (IOException e) {
throw new ChannelException(e);
}
} | [
"public",
"EpollServerSocketChannelConfig",
"setTcpDeferAccept",
"(",
"int",
"deferAccept",
")",
"{",
"try",
"{",
"(",
"(",
"EpollServerSocketChannel",
")",
"channel",
")",
".",
"socket",
".",
"setTcpDeferAccept",
"(",
"deferAccept",
")",
";",
"return",
"this",
";... | Set the {@code TCP_DEFER_ACCEPT} option on the socket. See {@code man 7 tcp} for more details. | [
"Set",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollServerSocketChannelConfig.java#L269-L276 | train | Sets the TCP Defer Accept option. | [
30522,
2270,
4958,
14511,
8043,
14028,
7432,
3388,
26058,
8663,
8873,
2290,
2275,
13535,
17299,
27235,
22648,
3401,
13876,
1006,
20014,
13366,
6906,
9468,
23606,
1007,
1063,
3046,
1063,
1006,
1006,
4958,
14511,
8043,
14028,
7432,
3388,
26058,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.validateExpr | private void validateExpr(SqlNode expr, SqlValidatorScope scope) {
if (expr instanceof SqlCall) {
final SqlOperator op = ((SqlCall) expr).getOperator();
if (op.isAggregator() && op.requiresOver()) {
throw newValidationError(expr,
RESOURCE.absentOverClause());
}
}
// Call on the expression to validate itself.
expr.validateExpr(this, scope);
// Perform any validation specific to the scope. For example, an
// aggregating scope requires that expressions are valid aggregations.
scope.validateExpr(expr);
} | java | private void validateExpr(SqlNode expr, SqlValidatorScope scope) {
if (expr instanceof SqlCall) {
final SqlOperator op = ((SqlCall) expr).getOperator();
if (op.isAggregator() && op.requiresOver()) {
throw newValidationError(expr,
RESOURCE.absentOverClause());
}
}
// Call on the expression to validate itself.
expr.validateExpr(this, scope);
// Perform any validation specific to the scope. For example, an
// aggregating scope requires that expressions are valid aggregations.
scope.validateExpr(expr);
} | [
"private",
"void",
"validateExpr",
"(",
"SqlNode",
"expr",
",",
"SqlValidatorScope",
"scope",
")",
"{",
"if",
"(",
"expr",
"instanceof",
"SqlCall",
")",
"{",
"final",
"SqlOperator",
"op",
"=",
"(",
"(",
"SqlCall",
")",
"expr",
")",
".",
"getOperator",
"(",... | Validates an expression.
@param expr Expression
@param scope Scope in which expression occurs | [
"Validates",
"an",
"expression",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L4101-L4116 | train | Validate an expression. | [
30522,
2797,
11675,
9398,
3686,
10288,
18098,
1006,
29296,
3630,
3207,
4654,
18098,
1010,
29296,
10175,
8524,
6591,
16186,
9531,
1007,
1063,
2065,
1006,
4654,
18098,
6013,
11253,
29296,
9289,
2140,
1007,
1063,
2345,
29296,
25918,
8844,
6728,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/TaskExecutionState.java | TaskExecutionState.getError | public Throwable getError(ClassLoader userCodeClassloader) {
if (this.throwable == null) {
return null;
}
else {
return this.throwable.deserializeError(userCodeClassloader);
}
} | java | public Throwable getError(ClassLoader userCodeClassloader) {
if (this.throwable == null) {
return null;
}
else {
return this.throwable.deserializeError(userCodeClassloader);
}
} | [
"public",
"Throwable",
"getError",
"(",
"ClassLoader",
"userCodeClassloader",
")",
"{",
"if",
"(",
"this",
".",
"throwable",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"this",
".",
"throwable",
".",
"deserializeError",
"(",
... | Gets the attached exception, which is in serialized form. Returns null,
if the status update is no failure with an associated exception.
@param userCodeClassloader The classloader that can resolve user-defined exceptions.
@return The attached exception, or null, if none. | [
"Gets",
"the",
"attached",
"exception",
"which",
"is",
"in",
"serialized",
"form",
".",
"Returns",
"null",
"if",
"the",
"status",
"update",
"is",
"no",
"failure",
"with",
"an",
"associated",
"exception",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/TaskExecutionState.java#L130-L137 | train | Get the error from the exception. | [
30522,
2270,
5466,
3085,
2131,
2121,
29165,
1006,
2465,
11066,
2121,
5310,
16044,
26266,
11066,
2121,
1007,
1063,
2065,
1006,
2023,
1012,
5466,
3085,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2842,
1063,
2709,
2023,
1012,
5466... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/StatementUtil.java | StatementUtil.prepareStatement | public static PreparedStatement prepareStatement(Connection conn, String sql, Object... params) throws SQLException {
Assert.notBlank(sql, "Sql String must be not blank!");
sql = sql.trim();
SqlLog.INSTASNCE.log(sql, params);
PreparedStatement ps;
if (StrUtil.startWithIgnoreCase(sql, "insert")) {
// 插入默认返回主键
ps = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
} else {
ps = conn.prepareStatement(sql);
}
return fillParams(ps, params);
} | java | public static PreparedStatement prepareStatement(Connection conn, String sql, Object... params) throws SQLException {
Assert.notBlank(sql, "Sql String must be not blank!");
sql = sql.trim();
SqlLog.INSTASNCE.log(sql, params);
PreparedStatement ps;
if (StrUtil.startWithIgnoreCase(sql, "insert")) {
// 插入默认返回主键
ps = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
} else {
ps = conn.prepareStatement(sql);
}
return fillParams(ps, params);
} | [
"public",
"static",
"PreparedStatement",
"prepareStatement",
"(",
"Connection",
"conn",
",",
"String",
"sql",
",",
"Object",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"Assert",
".",
"notBlank",
"(",
"sql",
",",
"\"Sql String must be not blank!\"",
")",
... | 创建{@link PreparedStatement}
@param conn 数据库连接
@param sql SQL语句,使用"?"做为占位符
@param params "?"对应参数列表
@return {@link PreparedStatement}
@throws SQLException SQL异常
@since 3.2.3 | [
"创建",
"{",
"@link",
"PreparedStatement",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/StatementUtil.java#L138-L151 | train | Create a PreparedStatement object from the given SQL and parameters. | [
30522,
2270,
10763,
4810,
9153,
18532,
4765,
20776,
12259,
3672,
1006,
4434,
9530,
2078,
1010,
5164,
29296,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
29296,
10288,
24422,
1063,
20865,
1012,
2025,
28522,
8950,
1006,
29296,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/FixedLengthRecordSorter.java | FixedLengthRecordSorter.compare | @Override
public int compare(int i, int j) {
final int segmentNumberI = i / this.recordsPerSegment;
final int segmentOffsetI = (i % this.recordsPerSegment) * this.recordSize;
final int segmentNumberJ = j / this.recordsPerSegment;
final int segmentOffsetJ = (j % this.recordsPerSegment) * this.recordSize;
return compare(segmentNumberI, segmentOffsetI, segmentNumberJ, segmentOffsetJ);
} | java | @Override
public int compare(int i, int j) {
final int segmentNumberI = i / this.recordsPerSegment;
final int segmentOffsetI = (i % this.recordsPerSegment) * this.recordSize;
final int segmentNumberJ = j / this.recordsPerSegment;
final int segmentOffsetJ = (j % this.recordsPerSegment) * this.recordSize;
return compare(segmentNumberI, segmentOffsetI, segmentNumberJ, segmentOffsetJ);
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"final",
"int",
"segmentNumberI",
"=",
"i",
"/",
"this",
".",
"recordsPerSegment",
";",
"final",
"int",
"segmentOffsetI",
"=",
"(",
"i",
"%",
"this",
".",
"records... | ------------------------------------------------------------------------- | [
"-------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/FixedLengthRecordSorter.java#L266-L275 | train | Compare two records. | [
30522,
1030,
2058,
15637,
2270,
20014,
12826,
1006,
20014,
1045,
1010,
20014,
1046,
1007,
1063,
2345,
20014,
6903,
19172,
5677,
2072,
1027,
1045,
1013,
2023,
1012,
2636,
7347,
13910,
3672,
1025,
2345,
20014,
6903,
27475,
20624,
1027,
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... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getDecimal | public final BigDecimal getDecimal(final int pos, final int precision, final int scale) {
final int intg = precision - scale;
final int frac = scale;
final int intg0 = intg / DIG_PER_INT32;
final int frac0 = frac / DIG_PER_INT32;
final int intg0x = intg - intg0 * DIG_PER_INT32;
final int frac0x = frac - frac0 * DIG_PER_INT32;
final int binSize = intg0 * SIZE_OF_INT32 + dig2bytes[intg0x] + frac0 * SIZE_OF_INT32 + dig2bytes[frac0x];
if (pos + binSize > limit || pos < 0) {
throw new IllegalArgumentException("limit excceed: " + (pos < 0 ? pos : (pos + binSize)));
}
return getDecimal0(origin + pos, intg, frac, // NL
intg0,
frac0,
intg0x,
frac0x);
} | java | public final BigDecimal getDecimal(final int pos, final int precision, final int scale) {
final int intg = precision - scale;
final int frac = scale;
final int intg0 = intg / DIG_PER_INT32;
final int frac0 = frac / DIG_PER_INT32;
final int intg0x = intg - intg0 * DIG_PER_INT32;
final int frac0x = frac - frac0 * DIG_PER_INT32;
final int binSize = intg0 * SIZE_OF_INT32 + dig2bytes[intg0x] + frac0 * SIZE_OF_INT32 + dig2bytes[frac0x];
if (pos + binSize > limit || pos < 0) {
throw new IllegalArgumentException("limit excceed: " + (pos < 0 ? pos : (pos + binSize)));
}
return getDecimal0(origin + pos, intg, frac, // NL
intg0,
frac0,
intg0x,
frac0x);
} | [
"public",
"final",
"BigDecimal",
"getDecimal",
"(",
"final",
"int",
"pos",
",",
"final",
"int",
"precision",
",",
"final",
"int",
"scale",
")",
"{",
"final",
"int",
"intg",
"=",
"precision",
"-",
"scale",
";",
"final",
"int",
"frac",
"=",
"scale",
";",
... | Return big decimal from buffer.
@see mysql-5.1.60/strings/decimal.c - bin2decimal() | [
"Return",
"big",
"decimal",
"from",
"buffer",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L1229-L1246 | train | Gets the decimal value of a single entry in a binary format. | [
30522,
2270,
2345,
2502,
3207,
6895,
9067,
2131,
3207,
6895,
9067,
1006,
2345,
20014,
13433,
2015,
1010,
2345,
20014,
11718,
1010,
2345,
20014,
4094,
1007,
1063,
2345,
20014,
20014,
2290,
1027,
11718,
1011,
4094,
1025,
2345,
20014,
25312,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/KafkaTableSourceBase.java | KafkaTableSourceBase.validateProctimeAttribute | private Optional<String> validateProctimeAttribute(Optional<String> proctimeAttribute) {
return proctimeAttribute.map((attribute) -> {
// validate that field exists and is of correct type
Optional<TypeInformation<?>> tpe = schema.getFieldType(attribute);
if (!tpe.isPresent()) {
throw new ValidationException("Processing time attribute '" + attribute + "' is not present in TableSchema.");
} else if (tpe.get() != Types.SQL_TIMESTAMP()) {
throw new ValidationException("Processing time attribute '" + attribute + "' is not of type SQL_TIMESTAMP.");
}
return attribute;
} | java | private Optional<String> validateProctimeAttribute(Optional<String> proctimeAttribute) {
return proctimeAttribute.map((attribute) -> {
// validate that field exists and is of correct type
Optional<TypeInformation<?>> tpe = schema.getFieldType(attribute);
if (!tpe.isPresent()) {
throw new ValidationException("Processing time attribute '" + attribute + "' is not present in TableSchema.");
} else if (tpe.get() != Types.SQL_TIMESTAMP()) {
throw new ValidationException("Processing time attribute '" + attribute + "' is not of type SQL_TIMESTAMP.");
}
return attribute;
} | [
"private",
"Optional",
"<",
"String",
">",
"validateProctimeAttribute",
"(",
"Optional",
"<",
"String",
">",
"proctimeAttribute",
")",
"{",
"return",
"proctimeAttribute",
".",
"map",
"(",
"(",
"attribute",
")",
"-",
">",
"{",
"// validate that field exists and is of... | Validates a field of the schema to be the processing time attribute.
@param proctimeAttribute The name of the field that becomes the processing time field. | [
"Validates",
"a",
"field",
"of",
"the",
"schema",
"to",
"be",
"the",
"processing",
"time",
"attribute",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/KafkaTableSourceBase.java#L286-L296 | train | Validate the given attribute. | [
30522,
2797,
11887,
1026,
5164,
1028,
9398,
3686,
21572,
6593,
14428,
19321,
3089,
8569,
2618,
1006,
11887,
1026,
5164,
1028,
4013,
6593,
14428,
19321,
3089,
8569,
2618,
1007,
1063,
2709,
4013,
6593,
14428,
19321,
3089,
8569,
2618,
1012,
49... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/TableSchema.java | TableSchema.fromTypeInfo | public static TableSchema fromTypeInfo(TypeInformation<?> typeInfo) {
if (typeInfo instanceof CompositeType<?>) {
final CompositeType<?> compositeType = (CompositeType<?>) typeInfo;
// get field names and types from composite type
final String[] fieldNames = compositeType.getFieldNames();
final TypeInformation<?>[] fieldTypes = new TypeInformation[fieldNames.length];
for (int i = 0; i < fieldTypes.length; i++) {
fieldTypes[i] = compositeType.getTypeAt(i);
}
return new TableSchema(fieldNames, fieldTypes);
} else {
// create table schema with a single field named "f0" of the given type.
return new TableSchema(
new String[]{ATOMIC_TYPE_FIELD_NAME},
new TypeInformation<?>[]{typeInfo});
}
} | java | public static TableSchema fromTypeInfo(TypeInformation<?> typeInfo) {
if (typeInfo instanceof CompositeType<?>) {
final CompositeType<?> compositeType = (CompositeType<?>) typeInfo;
// get field names and types from composite type
final String[] fieldNames = compositeType.getFieldNames();
final TypeInformation<?>[] fieldTypes = new TypeInformation[fieldNames.length];
for (int i = 0; i < fieldTypes.length; i++) {
fieldTypes[i] = compositeType.getTypeAt(i);
}
return new TableSchema(fieldNames, fieldTypes);
} else {
// create table schema with a single field named "f0" of the given type.
return new TableSchema(
new String[]{ATOMIC_TYPE_FIELD_NAME},
new TypeInformation<?>[]{typeInfo});
}
} | [
"public",
"static",
"TableSchema",
"fromTypeInfo",
"(",
"TypeInformation",
"<",
"?",
">",
"typeInfo",
")",
"{",
"if",
"(",
"typeInfo",
"instanceof",
"CompositeType",
"<",
"?",
">",
")",
"{",
"final",
"CompositeType",
"<",
"?",
">",
"compositeType",
"=",
"(",... | Creates a table schema from a {@link TypeInformation} instance. If the type information is
a {@link CompositeType}, the field names and types for the composite type are used to
construct the {@link TableSchema} instance. Otherwise, a table schema with a single field
is created. The field name is "f0" and the field type the provided type.
@param typeInfo The {@link TypeInformation} from which the table schema is generated.
@return The table schema that was generated from the given {@link TypeInformation}. | [
"Creates",
"a",
"table",
"schema",
"from",
"a",
"{",
"@link",
"TypeInformation",
"}",
"instance",
".",
"If",
"the",
"type",
"information",
"is",
"a",
"{",
"@link",
"CompositeType",
"}",
"the",
"field",
"names",
"and",
"types",
"for",
"the",
"composite",
"t... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/TableSchema.java#L216-L232 | train | Creates a table schema from a type information object. | [
30522,
2270,
10763,
7251,
5403,
2863,
2013,
13874,
2378,
14876,
1006,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
2828,
2378,
14876,
1007,
1063,
2065,
1006,
2828,
2378,
14876,
6013,
11253,
12490,
13874,
1026,
1029,
1028,
1007,
1063,
2345,
12... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/util/FieldSet.java | FieldSet.toArray | public int[] toArray() {
int[] a = new int[this.collection.size()];
int i = 0;
for (int col : this.collection) {
a[i++] = col;
}
return a;
} | java | public int[] toArray() {
int[] a = new int[this.collection.size()];
int i = 0;
for (int col : this.collection) {
a[i++] = col;
}
return a;
} | [
"public",
"int",
"[",
"]",
"toArray",
"(",
")",
"{",
"int",
"[",
"]",
"a",
"=",
"new",
"int",
"[",
"this",
".",
"collection",
".",
"size",
"(",
")",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"int",
"col",
":",
"this",
".",
"collection"... | Transforms the field set into an array of field IDs. Whether the IDs are ordered
or unordered depends on the specific subclass of the field set.
@return An array of all contained field IDs. | [
"Transforms",
"the",
"field",
"set",
"into",
"an",
"array",
"of",
"field",
"IDs",
".",
"Whether",
"the",
"IDs",
"are",
"ordered",
"or",
"unordered",
"depends",
"on",
"the",
"specific",
"subclass",
"of",
"the",
"field",
"set",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/util/FieldSet.java#L207-L214 | train | Returns an array of the elements in this collection. | [
30522,
2270,
20014,
1031,
1033,
2000,
2906,
9447,
1006,
1007,
1063,
20014,
1031,
1033,
1037,
1027,
2047,
20014,
1031,
2023,
1012,
3074,
1012,
2946,
1006,
1007,
1033,
1025,
20014,
1045,
1027,
1014,
1025,
2005,
1006,
20014,
8902,
1024,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java | Wrapper.wrap | public String wrap(String field){
if(preWrapQuote == null || sufWrapQuote == null || StrUtil.isBlank(field)) {
return field;
}
//如果已经包含包装的引号,返回原字符
if(StrUtil.isSurround(field, preWrapQuote, sufWrapQuote)){
return field;
}
//如果字段中包含通配符或者括号(字段通配符或者函数),不做包装
if(StrUtil.containsAnyIgnoreCase(field, "*", "(", " ", "as")) {
return field;
}
//对于Oracle这类数据库,表名中包含用户名需要单独拆分包装
if(field.contains(StrUtil.DOT)){
final Collection<String> target = CollectionUtil.filter(StrUtil.split(field, StrUtil.C_DOT), new Editor<String>(){
@Override
public String edit(String t) {
return StrUtil.format("{}{}{}", preWrapQuote, t, sufWrapQuote);
}
});
return CollectionUtil.join(target, StrUtil.DOT);
}
return StrUtil.format("{}{}{}", preWrapQuote, field, sufWrapQuote);
} | java | public String wrap(String field){
if(preWrapQuote == null || sufWrapQuote == null || StrUtil.isBlank(field)) {
return field;
}
//如果已经包含包装的引号,返回原字符
if(StrUtil.isSurround(field, preWrapQuote, sufWrapQuote)){
return field;
}
//如果字段中包含通配符或者括号(字段通配符或者函数),不做包装
if(StrUtil.containsAnyIgnoreCase(field, "*", "(", " ", "as")) {
return field;
}
//对于Oracle这类数据库,表名中包含用户名需要单独拆分包装
if(field.contains(StrUtil.DOT)){
final Collection<String> target = CollectionUtil.filter(StrUtil.split(field, StrUtil.C_DOT), new Editor<String>(){
@Override
public String edit(String t) {
return StrUtil.format("{}{}{}", preWrapQuote, t, sufWrapQuote);
}
});
return CollectionUtil.join(target, StrUtil.DOT);
}
return StrUtil.format("{}{}{}", preWrapQuote, field, sufWrapQuote);
} | [
"public",
"String",
"wrap",
"(",
"String",
"field",
")",
"{",
"if",
"(",
"preWrapQuote",
"==",
"null",
"||",
"sufWrapQuote",
"==",
"null",
"||",
"StrUtil",
".",
"isBlank",
"(",
"field",
")",
")",
"{",
"return",
"field",
";",
"}",
"//如果已经包含包装的引号,返回原字符\r",
... | 包装字段名<br>
有时字段与SQL的某些关键字冲突,导致SQL出错,因此需要将字段名用单引号或者反引号包装起来,避免冲突
@param field 字段名
@return 包装后的字段名 | [
"包装字段名<br",
">",
"有时字段与SQL的某些关键字冲突,导致SQL出错,因此需要将字段名用单引号或者反引号包装起来,避免冲突"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java#L84-L111 | train | Wrap the specified field with the specified quote. | [
30522,
2270,
5164,
10236,
1006,
5164,
2492,
1007,
1063,
2065,
1006,
3653,
13088,
9331,
28940,
12184,
1027,
1027,
19701,
1064,
1064,
10514,
2546,
13088,
9331,
28940,
12184,
1027,
1027,
19701,
1064,
1064,
2358,
22134,
4014,
1012,
2003,
28522,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.