repo stringclasses 11 values | path stringlengths 41 234 | func_name stringlengths 5 78 | original_string stringlengths 71 14.1k | language stringclasses 1 value | code stringlengths 71 14.1k | code_tokens listlengths 22 2.65k | docstring stringlengths 2 5.35k | docstring_tokens listlengths 1 369 | sha stringclasses 11 values | url stringlengths 129 339 | partition stringclasses 1 value | summary stringlengths 7 175 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java | TomcatReactiveWebServerFactory.setContextLifecycleListeners | public void setContextLifecycleListeners(
Collection<? extends LifecycleListener> contextLifecycleListeners) {
Assert.notNull(contextLifecycleListeners,
"ContextLifecycleListeners must not be null");
this.contextLifecycleListeners = new ArrayList<>(contextLifecycleListeners);
} | java | public void setContextLifecycleListeners(
Collection<? extends LifecycleListener> contextLifecycleListeners) {
Assert.notNull(contextLifecycleListeners,
"ContextLifecycleListeners must not be null");
this.contextLifecycleListeners = new ArrayList<>(contextLifecycleListeners);
} | [
"public",
"void",
"setContextLifecycleListeners",
"(",
"Collection",
"<",
"?",
"extends",
"LifecycleListener",
">",
"contextLifecycleListeners",
")",
"{",
"Assert",
".",
"notNull",
"(",
"contextLifecycleListeners",
",",
"\"ContextLifecycleListeners must not be null\"",
")",
... | Set {@link LifecycleListener}s that should be applied to the Tomcat
{@link Context}. Calling this method will replace any existing listeners.
@param contextLifecycleListeners the listeners to set | [
"Set",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java#L368-L373 | train | Sets the collection of lifecycle listeners to be notified of context lifecycle events. | [
30522,
2270,
11675,
2275,
8663,
18209,
15509,
23490,
9863,
24454,
2015,
1006,
3074,
1026,
1029,
8908,
2166,
23490,
9863,
24454,
1028,
6123,
15509,
23490,
9863,
24454,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
6123,
15509,
23490,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/enjoy/EnjoyEngine.java | EnjoyEngine.createEngine | private static com.jfinal.template.Engine createEngine(TemplateConfig config) {
Assert.notNull(config, "Template config is null !");
final com.jfinal.template.Engine engine = com.jfinal.template.Engine.create("Hutool-Enjoy-Engine-" + config.toString());
engine.setEncoding(config.getCharsetStr());
switch (config.getResourceMode()) {
case STRING:
// 默认字符串类型资源:
break;
case CLASSPATH:
engine.setToClassPathSourceFactory();
engine.setBaseTemplatePath(config.getPath());
break;
case FILE:
engine.setSourceFactory(new FileSourceFactory());
engine.setBaseTemplatePath(config.getPath());
break;
case WEB_ROOT:
engine.setSourceFactory(new FileSourceFactory());
engine.setBaseTemplatePath(FileUtil.getAbsolutePath(FileUtil.getWebRoot()));
break;
default:
break;
}
return engine;
} | java | private static com.jfinal.template.Engine createEngine(TemplateConfig config) {
Assert.notNull(config, "Template config is null !");
final com.jfinal.template.Engine engine = com.jfinal.template.Engine.create("Hutool-Enjoy-Engine-" + config.toString());
engine.setEncoding(config.getCharsetStr());
switch (config.getResourceMode()) {
case STRING:
// 默认字符串类型资源:
break;
case CLASSPATH:
engine.setToClassPathSourceFactory();
engine.setBaseTemplatePath(config.getPath());
break;
case FILE:
engine.setSourceFactory(new FileSourceFactory());
engine.setBaseTemplatePath(config.getPath());
break;
case WEB_ROOT:
engine.setSourceFactory(new FileSourceFactory());
engine.setBaseTemplatePath(FileUtil.getAbsolutePath(FileUtil.getWebRoot()));
break;
default:
break;
}
return engine;
} | [
"private",
"static",
"com",
".",
"jfinal",
".",
"template",
".",
"Engine",
"createEngine",
"(",
"TemplateConfig",
"config",
")",
"{",
"Assert",
".",
"notNull",
"(",
"config",
",",
"\"Template config is null !\"",
")",
";",
"final",
"com",
".",
"jfinal",
".",
... | 创建引擎
@param config 模板配置
@return {@link GroupTemplate} | [
"创建引擎"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/enjoy/EnjoyEngine.java#L68-L94 | train | Creates a new instance of the Hutool - Enjoy - Engine class. | [
30522,
2797,
10763,
4012,
1012,
1046,
16294,
2389,
1012,
23561,
1012,
3194,
3443,
13159,
3170,
1006,
23561,
8663,
8873,
2290,
9530,
8873,
2290,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
9530,
8873,
2290,
1010,
1000,
23561,
9530,
887... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/Segment.java | Segment.seg | public List<Term> seg(char[] text)
{
assert text != null;
if (HanLP.Config.Normalization)
{
CharTable.normalization(text);
}
return segSentence(text);
} | java | public List<Term> seg(char[] text)
{
assert text != null;
if (HanLP.Config.Normalization)
{
CharTable.normalization(text);
}
return segSentence(text);
} | [
"public",
"List",
"<",
"Term",
">",
"seg",
"(",
"char",
"[",
"]",
"text",
")",
"{",
"assert",
"text",
"!=",
"null",
";",
"if",
"(",
"HanLP",
".",
"Config",
".",
"Normalization",
")",
"{",
"CharTable",
".",
"normalization",
"(",
"text",
")",
";",
"}... | 分词
@param text 待分词文本
@return 单词列表 | [
"分词"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Segment.java#L588-L596 | train | segSentence This method is used to generate a sequence of terms from a text. | [
30522,
2270,
2862,
1026,
2744,
1028,
7367,
2290,
1006,
25869,
1031,
1033,
3793,
1007,
1063,
20865,
3793,
999,
1027,
19701,
1025,
2065,
1006,
7658,
14277,
1012,
9530,
8873,
2290,
1012,
3671,
3989,
1007,
1063,
3673,
3085,
1012,
3671,
3989,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Vertex.java | Vertex.confirmNature | public boolean confirmNature(Nature nature)
{
if (attribute.nature.length == 1 && attribute.nature[0] == nature)
{
return true;
}
boolean result = true;
int frequency = attribute.getNatureFrequency(nature);
if (frequency == 0)
{
frequency = 1000;
result = false;
}
attribute = new CoreDictionary.Attribute(nature, frequency);
return result;
} | java | public boolean confirmNature(Nature nature)
{
if (attribute.nature.length == 1 && attribute.nature[0] == nature)
{
return true;
}
boolean result = true;
int frequency = attribute.getNatureFrequency(nature);
if (frequency == 0)
{
frequency = 1000;
result = false;
}
attribute = new CoreDictionary.Attribute(nature, frequency);
return result;
} | [
"public",
"boolean",
"confirmNature",
"(",
"Nature",
"nature",
")",
"{",
"if",
"(",
"attribute",
".",
"nature",
".",
"length",
"==",
"1",
"&&",
"attribute",
".",
"nature",
"[",
"0",
"]",
"==",
"nature",
")",
"{",
"return",
"true",
";",
"}",
"boolean",
... | 将属性的词性锁定为nature
@param nature 词性
@return 如果锁定词性在词性列表中,返回真,否则返回假 | [
"将属性的词性锁定为nature"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/Vertex.java#L241-L256 | train | Confirm nature. | [
30522,
2270,
22017,
20898,
12210,
19833,
5397,
1006,
3267,
3267,
1007,
1063,
2065,
1006,
17961,
1012,
3267,
1012,
3091,
1027,
1027,
1015,
1004,
1004,
17961,
1012,
3267,
1031,
1014,
1033,
1027,
1027,
3267,
1007,
1063,
2709,
2995,
1025,
1065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
redisson/redisson | redisson/src/main/java/org/redisson/RedissonBitSet.java | RedissonBitSet.fromByteArrayReverse | private static BitSet fromByteArrayReverse(byte[] bytes) {
if (bytes == null) {
return new BitSet();
}
BitSet bits = new BitSet();
for (int i = 0; i < bytes.length * 8; i++) {
if ((bytes[i / 8] & (1 << (7 - (i % 8)))) != 0) {
bits.set(i);
}
}
return bits;
} | java | private static BitSet fromByteArrayReverse(byte[] bytes) {
if (bytes == null) {
return new BitSet();
}
BitSet bits = new BitSet();
for (int i = 0; i < bytes.length * 8; i++) {
if ((bytes[i / 8] & (1 << (7 - (i % 8)))) != 0) {
bits.set(i);
}
}
return bits;
} | [
"private",
"static",
"BitSet",
"fromByteArrayReverse",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"if",
"(",
"bytes",
"==",
"null",
")",
"{",
"return",
"new",
"BitSet",
"(",
")",
";",
"}",
"BitSet",
"bits",
"=",
"new",
"BitSet",
"(",
")",
";",
"for",
... | Copied from: https://github.com/xetorthio/jedis/issues/301 | [
"Copied",
"from",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"xetorthio",
"/",
"jedis",
"/",
"issues",
"/",
"301"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/RedissonBitSet.java#L168-L180 | train | Converts a byte array to a BitSet. | [
30522,
2797,
10763,
9017,
3388,
2013,
3762,
27058,
11335,
16363,
16070,
1006,
24880,
1031,
1033,
27507,
1007,
1063,
2065,
1006,
27507,
1027,
1027,
19701,
1007,
1063,
2709,
2047,
9017,
3388,
1006,
1007,
1025,
1065,
9017,
3388,
9017,
1027,
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 | handler/src/main/java/io/netty/handler/ssl/PemX509Certificate.java | PemX509Certificate.append | private static ByteBuf append(ByteBufAllocator allocator, boolean useDirect,
PemEncoded encoded, int count, ByteBuf pem) {
ByteBuf content = encoded.content();
if (pem == null) {
// see the other append() method
pem = newBuffer(allocator, useDirect, content.readableBytes() * count);
}
pem.writeBytes(content.slice());
return pem;
} | java | private static ByteBuf append(ByteBufAllocator allocator, boolean useDirect,
PemEncoded encoded, int count, ByteBuf pem) {
ByteBuf content = encoded.content();
if (pem == null) {
// see the other append() method
pem = newBuffer(allocator, useDirect, content.readableBytes() * count);
}
pem.writeBytes(content.slice());
return pem;
} | [
"private",
"static",
"ByteBuf",
"append",
"(",
"ByteBufAllocator",
"allocator",
",",
"boolean",
"useDirect",
",",
"PemEncoded",
"encoded",
",",
"int",
"count",
",",
"ByteBuf",
"pem",
")",
"{",
"ByteBuf",
"content",
"=",
"encoded",
".",
"content",
"(",
")",
"... | Appends the {@link PemEncoded} value to the {@link ByteBuf} (last arg) and returns it.
If the {@link ByteBuf} didn't exist yet it'll create it using the {@link ByteBufAllocator}. | [
"Appends",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/PemX509Certificate.java#L105-L117 | train | Append a sequence of bytes to a CRA - CENTID SEGMENT. | [
30522,
2797,
10763,
24880,
8569,
2546,
10439,
10497,
1006,
24880,
8569,
13976,
24755,
4263,
2035,
24755,
4263,
1010,
22017,
20898,
2109,
7442,
6593,
1010,
21877,
3549,
16044,
2094,
12359,
1010,
20014,
4175,
1010,
24880,
8569,
2546,
21877,
221... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SM2.java | SM2.initCipherParams | private SM2 initCipherParams() {
try {
if (null != this.publicKey) {
this.publicKeyParams = (ECPublicKeyParameters) ECUtil.generatePublicKeyParameter(this.publicKey);
}
if (null != privateKey) {
this.privateKeyParams = (ECPrivateKeyParameters) ECUtil.generatePrivateKeyParameter(this.privateKey);
}
} catch (InvalidKeyException e) {
throw new CryptoException(e);
}
return this;
} | java | private SM2 initCipherParams() {
try {
if (null != this.publicKey) {
this.publicKeyParams = (ECPublicKeyParameters) ECUtil.generatePublicKeyParameter(this.publicKey);
}
if (null != privateKey) {
this.privateKeyParams = (ECPrivateKeyParameters) ECUtil.generatePrivateKeyParameter(this.privateKey);
}
} catch (InvalidKeyException e) {
throw new CryptoException(e);
}
return this;
} | [
"private",
"SM2",
"initCipherParams",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"null",
"!=",
"this",
".",
"publicKey",
")",
"{",
"this",
".",
"publicKeyParams",
"=",
"(",
"ECPublicKeyParameters",
")",
"ECUtil",
".",
"generatePublicKeyParameter",
"(",
"this",
".... | 初始化加密解密参数
@return this | [
"初始化加密解密参数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2.java#L257-L270 | train | Initializes the CipherParams. | [
30522,
2797,
15488,
2475,
1999,
4183,
6895,
27921,
28689,
5244,
1006,
1007,
1063,
3046,
1063,
2065,
1006,
19701,
999,
1027,
2023,
1012,
2270,
14839,
1007,
1063,
2023,
1012,
2270,
14839,
28689,
5244,
1027,
1006,
14925,
14289,
16558,
6799,
32... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/UploadFileHeader.java | UploadFileHeader.getContentType | private String getContentType(String dataHeader) {
String token = "Content-Type:";
int start = dataHeader.indexOf(token);
if (start == -1) {
return StrUtil.EMPTY;
}
start += token.length();
return dataHeader.substring(start);
} | java | private String getContentType(String dataHeader) {
String token = "Content-Type:";
int start = dataHeader.indexOf(token);
if (start == -1) {
return StrUtil.EMPTY;
}
start += token.length();
return dataHeader.substring(start);
} | [
"private",
"String",
"getContentType",
"(",
"String",
"dataHeader",
")",
"{",
"String",
"token",
"=",
"\"Content-Type:\"",
";",
"int",
"start",
"=",
"dataHeader",
".",
"indexOf",
"(",
"token",
")",
";",
"if",
"(",
"start",
"==",
"-",
"1",
")",
"{",
"retu... | 头信息中获得content type
@param dataHeader data header string
@return content type or an empty string if no content type defined | [
"头信息中获得content",
"type"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/UploadFileHeader.java#L122-L130 | train | Returns the content type of the response. | [
30522,
2797,
5164,
2131,
8663,
6528,
15353,
5051,
1006,
5164,
2951,
4974,
2121,
1007,
1063,
5164,
19204,
1027,
1000,
4180,
1011,
2828,
1024,
1000,
1025,
20014,
2707,
1027,
2951,
4974,
2121,
1012,
5950,
11253,
1006,
19204,
1007,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java | AbstractCoalescingBufferQueue.add | public final void add(ByteBuf buf, ChannelFutureListener listener) {
// buffers are added before promises so that we naturally 'consume' the entire buffer during removal
// before we complete it's promise.
bufAndListenerPairs.add(buf);
if (listener != null) {
bufAndListenerPairs.add(listener);
}
incrementReadableBytes(buf.readableBytes());
} | java | public final void add(ByteBuf buf, ChannelFutureListener listener) {
// buffers are added before promises so that we naturally 'consume' the entire buffer during removal
// before we complete it's promise.
bufAndListenerPairs.add(buf);
if (listener != null) {
bufAndListenerPairs.add(listener);
}
incrementReadableBytes(buf.readableBytes());
} | [
"public",
"final",
"void",
"add",
"(",
"ByteBuf",
"buf",
",",
"ChannelFutureListener",
"listener",
")",
"{",
"// buffers are added before promises so that we naturally 'consume' the entire buffer during removal",
"// before we complete it's promise.",
"bufAndListenerPairs",
".",
"add... | Add a buffer to the end of the queue and associate a listener with it that should be completed when
all the buffers bytes have been consumed from the queue and written.
@param buf to add to the tail of the queue
@param listener to notify when all the bytes have been consumed and written, can be {@code null}. | [
"Add",
"a",
"buffer",
"to",
"the",
"end",
"of",
"the",
"queue",
"and",
"associate",
"a",
"listener",
"with",
"it",
"that",
"should",
"be",
"completed",
"when",
"all",
"the",
"buffers",
"bytes",
"have",
"been",
"consumed",
"from",
"the",
"queue",
"and",
"... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java#L93-L101 | train | Add a buffer to the cache. | [
30522,
2270,
2345,
11675,
5587,
1006,
24880,
8569,
2546,
20934,
2546,
1010,
3149,
11263,
11244,
9863,
24454,
19373,
1007,
1063,
1013,
1013,
17698,
2015,
2024,
2794,
2077,
10659,
2061,
2008,
2057,
8100,
1005,
16678,
1005,
1996,
2972,
17698,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateGeneral | public static <T extends CharSequence> T validateGeneral(T value, String errorMsg) throws ValidateException {
if (false == isGeneral(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validateGeneral(T value, String errorMsg) throws ValidateException {
if (false == isGeneral(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateGeneral",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isGeneral",
"(",
"value",
")",
")",
"{",
"throw",
"new",... | 验证是否为英文字母 、数字和下划线
@param <T> 字符串类型
@param value 值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证是否为英文字母",
"、数字和下划线"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L358-L363 | train | Validate a string for a
value. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
9398,
3686,
6914,
21673,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
1027,
2003,
6914,
21673... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/operators/async/queue/StreamElementQueueEntry.java | StreamElementQueueEntry.onComplete | public void onComplete(
final Consumer<StreamElementQueueEntry<T>> completeFunction,
Executor executor) {
final StreamElementQueueEntry<T> thisReference = this;
getFuture().whenCompleteAsync(
// call the complete function for normal completion as well as exceptional completion
// see FLINK-6435
(value, throwable) -> completeFunction.accept(thisReference),
executor);
} | java | public void onComplete(
final Consumer<StreamElementQueueEntry<T>> completeFunction,
Executor executor) {
final StreamElementQueueEntry<T> thisReference = this;
getFuture().whenCompleteAsync(
// call the complete function for normal completion as well as exceptional completion
// see FLINK-6435
(value, throwable) -> completeFunction.accept(thisReference),
executor);
} | [
"public",
"void",
"onComplete",
"(",
"final",
"Consumer",
"<",
"StreamElementQueueEntry",
"<",
"T",
">",
">",
"completeFunction",
",",
"Executor",
"executor",
")",
"{",
"final",
"StreamElementQueueEntry",
"<",
"T",
">",
"thisReference",
"=",
"this",
";",
"getFut... | Register the given complete function to be called once this queue entry has been completed.
@param completeFunction to call when the queue entry has been completed
@param executor to run the complete function | [
"Register",
"the",
"given",
"complete",
"function",
"to",
"be",
"called",
"once",
"this",
"queue",
"entry",
"has",
"been",
"completed",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/async/queue/StreamElementQueueEntry.java#L64-L74 | train | Completes the stream element queue entry by invoking the given complete function asynchronously. | [
30522,
2270,
11675,
2006,
9006,
10814,
2618,
1006,
2345,
7325,
1026,
5460,
12260,
3672,
4226,
5657,
4765,
2854,
1026,
1056,
1028,
1028,
3143,
11263,
27989,
1010,
4654,
8586,
16161,
2099,
4654,
8586,
16161,
2099,
1007,
1063,
2345,
5460,
1226... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java | SqlDateTimeUtils.extractYearMonth | public static int extractYearMonth(TimeUnitRange range, int v) {
switch (range) {
case YEAR: return v / 12;
case MONTH: return v % 12;
case QUARTER: return (v % 12 + 2) / 3;
default: throw new UnsupportedOperationException("Unsupported TimeUnitRange: " + range);
}
} | java | public static int extractYearMonth(TimeUnitRange range, int v) {
switch (range) {
case YEAR: return v / 12;
case MONTH: return v % 12;
case QUARTER: return (v % 12 + 2) / 3;
default: throw new UnsupportedOperationException("Unsupported TimeUnitRange: " + range);
}
} | [
"public",
"static",
"int",
"extractYearMonth",
"(",
"TimeUnitRange",
"range",
",",
"int",
"v",
")",
"{",
"switch",
"(",
"range",
")",
"{",
"case",
"YEAR",
":",
"return",
"v",
"/",
"12",
";",
"case",
"MONTH",
":",
"return",
"v",
"%",
"12",
";",
"case"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L499-L506 | train | Extract the year and month from a value. | [
30522,
2270,
10763,
20014,
30524,
2095,
1024,
2709,
1058,
1013,
2260,
1025,
2553,
3204,
1024,
2709,
1058,
1003,
2260,
1025,
2553,
4284,
1024,
2709,
1006,
1058,
1003,
2260,
1009,
1016,
1007,
1013,
1017,
1025,
12398,
1024,
5466,
2047,
4895,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Graph.java | Graph.union | public Graph<K, VV, EV> union(Graph<K, VV, EV> graph) {
DataSet<Vertex<K, VV>> unionedVertices = graph
.getVertices()
.union(this.getVertices())
.name("Vertices")
.distinct()
.name("Vertices");
DataSet<Edge<K, EV>> unionedEdges = graph
.getEdges()
.union(this.getEdges())
.name("Edges");
return new Graph<>(unionedVertices, unionedEdges, this.context);
} | java | public Graph<K, VV, EV> union(Graph<K, VV, EV> graph) {
DataSet<Vertex<K, VV>> unionedVertices = graph
.getVertices()
.union(this.getVertices())
.name("Vertices")
.distinct()
.name("Vertices");
DataSet<Edge<K, EV>> unionedEdges = graph
.getEdges()
.union(this.getEdges())
.name("Edges");
return new Graph<>(unionedVertices, unionedEdges, this.context);
} | [
"public",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"union",
"(",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"graph",
")",
"{",
"DataSet",
"<",
"Vertex",
"<",
"K",
",",
"VV",
">",
">",
"unionedVertices",
"=",
"graph",
".",
"getVertices",
... | Performs union on the vertices and edges sets of the input graphs
removing duplicate vertices but maintaining duplicate edges.
@param graph the graph to perform union with
@return a new graph | [
"Performs",
"union",
"on",
"the",
"vertices",
"and",
"edges",
"sets",
"of",
"the",
"input",
"graphs",
"removing",
"duplicate",
"vertices",
"but",
"maintaining",
"duplicate",
"edges",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1599-L1613 | train | Returns a new Graph that is the union of this graph with the given graph. | [
30522,
2270,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
2586,
1006,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
10629,
1007,
1063,
2951,
13462,
1026,
19449,
1026,
1047,
1010,
1058,
2615,
1028,
1028,
2586,
2098,
1687... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.readLines | public static void readLines(InputStream in, Charset charset, LineHandler lineHandler) throws IORuntimeException {
readLines(getReader(in, charset), lineHandler);
} | java | public static void readLines(InputStream in, Charset charset, LineHandler lineHandler) throws IORuntimeException {
readLines(getReader(in, charset), lineHandler);
} | [
"public",
"static",
"void",
"readLines",
"(",
"InputStream",
"in",
",",
"Charset",
"charset",
",",
"LineHandler",
"lineHandler",
")",
"throws",
"IORuntimeException",
"{",
"readLines",
"(",
"getReader",
"(",
"in",
",",
"charset",
")",
",",
"lineHandler",
")",
"... | 按行读取数据,针对每行的数据做处理
@param in {@link InputStream}
@param charset {@link Charset}编码
@param lineHandler 行处理接口,实现handle方法用于编辑一行的数据后入到指定地方
@throws IORuntimeException IO异常
@since 3.0.9 | [
"按行读取数据,针对每行的数据做处理"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L702-L704 | train | Reads the contents of the given input stream into a LineHandler. | [
30522,
2270,
10763,
11675,
3191,
12735,
1006,
20407,
25379,
1999,
1010,
25869,
13462,
25869,
13462,
1010,
2240,
11774,
3917,
2240,
11774,
3917,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
3191,
12735,
1006,
2131,
16416,
4063,
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... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/AbstractService.java | AbstractService.init | @Override
public synchronized void init(HiveConf hiveConf) {
ensureCurrentState(STATE.NOTINITED);
this.hiveConf = hiveConf;
changeState(STATE.INITED);
LOG.info("Service:" + getName() + " is inited.");
} | java | @Override
public synchronized void init(HiveConf hiveConf) {
ensureCurrentState(STATE.NOTINITED);
this.hiveConf = hiveConf;
changeState(STATE.INITED);
LOG.info("Service:" + getName() + " is inited.");
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"init",
"(",
"HiveConf",
"hiveConf",
")",
"{",
"ensureCurrentState",
"(",
"STATE",
".",
"NOTINITED",
")",
";",
"this",
".",
"hiveConf",
"=",
"hiveConf",
";",
"changeState",
"(",
"STATE",
".",
"INITED",
")",
... | {@inheritDoc}
@throws IllegalStateException
if the current service state does not permit
this action | [
"{",
"@inheritDoc",
"}"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/AbstractService.java#L84-L90 | train | Initializes the service. | [
30522,
1030,
2058,
15637,
2270,
25549,
11675,
1999,
4183,
1006,
26736,
8663,
2546,
26736,
8663,
2546,
1007,
1063,
5676,
10841,
14343,
7666,
12259,
1006,
2110,
1012,
2025,
5498,
3064,
1007,
1025,
2023,
1012,
26736,
8663,
2546,
1027,
26736,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/Select.java | Select.deselectByVisibleText | @Override
public void deselectByVisibleText(String text) {
if (!isMultiple()) {
throw new UnsupportedOperationException(
"You may only deselect options of a multi-select");
}
List<WebElement> options = element.findElements(By.xpath(
".//option[normalize-space(.) = " + Quotes.escape(text) + "]"));
if (options.isEmpty()) {
throw new NoSuchElementException("Cannot locate option with text: " + text);
}
for (WebElement option : options) {
setSelected(option, false);
}
} | java | @Override
public void deselectByVisibleText(String text) {
if (!isMultiple()) {
throw new UnsupportedOperationException(
"You may only deselect options of a multi-select");
}
List<WebElement> options = element.findElements(By.xpath(
".//option[normalize-space(.) = " + Quotes.escape(text) + "]"));
if (options.isEmpty()) {
throw new NoSuchElementException("Cannot locate option with text: " + text);
}
for (WebElement option : options) {
setSelected(option, false);
}
} | [
"@",
"Override",
"public",
"void",
"deselectByVisibleText",
"(",
"String",
"text",
")",
"{",
"if",
"(",
"!",
"isMultiple",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"You may only deselect options of a multi-select\"",
")",
";",
"}",... | Deselect all options that display text matching the argument. That is, when given "Bar" this
would deselect an option like:
<option value="foo">Bar</option>
@param text The visible text to match against
@throws NoSuchElementException If no matching option elements are found
@throws UnsupportedOperationException If the SELECT does not support multiple selections | [
"Deselect",
"all",
"options",
"that",
"display",
"text",
"matching",
"the",
"argument",
".",
"That",
"is",
"when",
"given",
"Bar",
"this",
"would",
"deselect",
"an",
"option",
"like",
":"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/Select.java#L262-L278 | train | Deselect all options that have a visible text. | [
30522,
1030,
2058,
15637,
2270,
11675,
4078,
12260,
6593,
3762,
11365,
7028,
18209,
1006,
5164,
3793,
1007,
1063,
2065,
1006,
999,
2003,
12274,
7096,
11514,
2571,
1006,
1007,
1007,
1063,
5466,
2047,
4895,
6342,
9397,
15613,
25918,
3370,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java | TaskExecutor.notifyOfNewResourceManagerLeader | private void notifyOfNewResourceManagerLeader(String newLeaderAddress, ResourceManagerId newResourceManagerId) {
resourceManagerAddress = createResourceManagerAddress(newLeaderAddress, newResourceManagerId);
reconnectToResourceManager(new FlinkException(String.format("ResourceManager leader changed to new address %s", resourceManagerAddress)));
} | java | private void notifyOfNewResourceManagerLeader(String newLeaderAddress, ResourceManagerId newResourceManagerId) {
resourceManagerAddress = createResourceManagerAddress(newLeaderAddress, newResourceManagerId);
reconnectToResourceManager(new FlinkException(String.format("ResourceManager leader changed to new address %s", resourceManagerAddress)));
} | [
"private",
"void",
"notifyOfNewResourceManagerLeader",
"(",
"String",
"newLeaderAddress",
",",
"ResourceManagerId",
"newResourceManagerId",
")",
"{",
"resourceManagerAddress",
"=",
"createResourceManagerAddress",
"(",
"newLeaderAddress",
",",
"newResourceManagerId",
")",
";",
... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java#L880-L883 | train | Notifies the FlinkResourceManager that a new leader is being created. | [
30522,
2797,
11675,
2025,
8757,
11253,
2638,
13088,
2229,
8162,
3401,
24805,
4590,
19000,
1006,
5164,
2047,
19000,
4215,
16200,
4757,
1010,
7692,
24805,
4590,
3593,
2047,
6072,
8162,
3401,
24805,
4590,
3593,
1007,
1063,
7692,
24805,
4590,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/aggregate/MiniBatchGlobalGroupAggFunction.java | MiniBatchGlobalGroupAggFunction.addInput | @Override
public BaseRow addInput(@Nullable BaseRow previousAcc, BaseRow input) throws Exception {
BaseRow currentAcc;
if (previousAcc == null) {
currentAcc = localAgg.createAccumulators();
} else {
currentAcc = previousAcc;
}
localAgg.setAccumulators(currentAcc);
localAgg.merge(input);
return localAgg.getAccumulators();
} | java | @Override
public BaseRow addInput(@Nullable BaseRow previousAcc, BaseRow input) throws Exception {
BaseRow currentAcc;
if (previousAcc == null) {
currentAcc = localAgg.createAccumulators();
} else {
currentAcc = previousAcc;
}
localAgg.setAccumulators(currentAcc);
localAgg.merge(input);
return localAgg.getAccumulators();
} | [
"@",
"Override",
"public",
"BaseRow",
"addInput",
"(",
"@",
"Nullable",
"BaseRow",
"previousAcc",
",",
"BaseRow",
"input",
")",
"throws",
"Exception",
"{",
"BaseRow",
"currentAcc",
";",
"if",
"(",
"previousAcc",
"==",
"null",
")",
"{",
"currentAcc",
"=",
"lo... | The {@code previousAcc} is accumulator, but input is a row in <key, accumulator> schema,
the specific generated {@link #localAgg} will project the {@code input} to accumulator
in merge method. | [
"The",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/aggregate/MiniBatchGlobalGroupAggFunction.java#L149-L161 | train | Add an input to the aggregation. | [
30522,
1030,
2058,
15637,
2270,
2918,
10524,
5587,
2378,
18780,
1006,
1030,
19701,
3085,
2918,
10524,
3025,
6305,
2278,
1010,
2918,
10524,
7953,
1007,
11618,
6453,
1063,
2918,
10524,
2783,
6305,
2278,
1025,
2065,
1006,
3025,
6305,
2278,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoFactory.java | MongoFactory.getDS | public static MongoDS getDS(Setting setting, Collection<String> groups) {
return getDS(setting, groups.toArray(new String[groups.size()]));
} | java | public static MongoDS getDS(Setting setting, Collection<String> groups) {
return getDS(setting, groups.toArray(new String[groups.size()]));
} | [
"public",
"static",
"MongoDS",
"getDS",
"(",
"Setting",
"setting",
",",
"Collection",
"<",
"String",
">",
"groups",
")",
"{",
"return",
"getDS",
"(",
"setting",
",",
"groups",
".",
"toArray",
"(",
"new",
"String",
"[",
"groups",
".",
"size",
"(",
")",
... | 获取MongoDB数据源<br>
@param setting 配置文件
@param groups 分组列表
@return MongoDB连接 | [
"获取MongoDB数据源<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoFactory.java#L109-L111 | train | Gets the DS object for the given setting and groups. | [
30522,
2270,
10763,
12256,
3995,
5104,
2131,
5104,
1006,
4292,
4292,
1010,
3074,
1026,
5164,
1028,
2967,
1007,
1063,
2709,
2131,
5104,
1006,
4292,
1010,
2967,
1012,
2000,
2906,
9447,
1006,
2047,
5164,
1031,
2967,
1012,
2946,
1006,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.reverse | public static <T> Map<T, T> reverse(Map<T, T> map) {
return filter(map, new Editor<Map.Entry<T, T>>() {
@Override
public Entry<T, T> edit(final Entry<T, T> t) {
return new Entry<T, T>() {
@Override
public T getKey() {
return t.getValue();
}
@Override
public T getValue() {
return t.getKey();
}
@Override
public T setValue(T value) {
throw new UnsupportedOperationException("Unsupported setValue method !");
}
};
}
});
} | java | public static <T> Map<T, T> reverse(Map<T, T> map) {
return filter(map, new Editor<Map.Entry<T, T>>() {
@Override
public Entry<T, T> edit(final Entry<T, T> t) {
return new Entry<T, T>() {
@Override
public T getKey() {
return t.getValue();
}
@Override
public T getValue() {
return t.getKey();
}
@Override
public T setValue(T value) {
throw new UnsupportedOperationException("Unsupported setValue method !");
}
};
}
});
} | [
"public",
"static",
"<",
"T",
">",
"Map",
"<",
"T",
",",
"T",
">",
"reverse",
"(",
"Map",
"<",
"T",
",",
"T",
">",
"map",
")",
"{",
"return",
"filter",
"(",
"map",
",",
"new",
"Editor",
"<",
"Map",
".",
"Entry",
"<",
"T",
",",
"T",
">",
">"... | Map的键和值互换
@param <T> 键和值类型
@param map Map对象,键值类型必须一致
@return 互换后的Map
@since 3.2.2 | [
"Map的键和值互换"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L579-L602 | train | Returns a reverse view of the specified map. | [
30522,
2270,
10763,
1026,
1056,
1028,
4949,
1026,
1056,
1010,
1056,
1028,
7901,
1006,
4949,
1026,
1056,
1010,
1056,
1028,
4949,
1007,
1063,
2709,
11307,
1006,
4949,
1010,
2047,
3559,
1026,
4949,
1012,
4443,
1026,
1056,
1010,
1056,
1028,
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/util/SignalHandler.java | SignalHandler.register | public static void register(final Logger LOG) {
synchronized (SignalHandler.class) {
if (registered) {
return;
}
registered = true;
final String[] SIGNALS = OperatingSystem.isWindows()
? new String[]{ "TERM", "INT"}
: new String[]{ "TERM", "HUP", "INT" };
StringBuilder bld = new StringBuilder();
bld.append("Registered UNIX signal handlers for [");
String separator = "";
for (String signalName : SIGNALS) {
try {
new Handler(signalName, LOG);
bld.append(separator);
bld.append(signalName);
separator = ", ";
} catch (Exception e) {
LOG.info("Error while registering signal handler", e);
}
}
bld.append("]");
LOG.info(bld.toString());
}
} | java | public static void register(final Logger LOG) {
synchronized (SignalHandler.class) {
if (registered) {
return;
}
registered = true;
final String[] SIGNALS = OperatingSystem.isWindows()
? new String[]{ "TERM", "INT"}
: new String[]{ "TERM", "HUP", "INT" };
StringBuilder bld = new StringBuilder();
bld.append("Registered UNIX signal handlers for [");
String separator = "";
for (String signalName : SIGNALS) {
try {
new Handler(signalName, LOG);
bld.append(separator);
bld.append(signalName);
separator = ", ";
} catch (Exception e) {
LOG.info("Error while registering signal handler", e);
}
}
bld.append("]");
LOG.info(bld.toString());
}
} | [
"public",
"static",
"void",
"register",
"(",
"final",
"Logger",
"LOG",
")",
"{",
"synchronized",
"(",
"SignalHandler",
".",
"class",
")",
"{",
"if",
"(",
"registered",
")",
"{",
"return",
";",
"}",
"registered",
"=",
"true",
";",
"final",
"String",
"[",
... | Register some signal handlers.
@param LOG The slf4j logger | [
"Register",
"some",
"signal",
"handlers",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/SignalHandler.java#L64-L92 | train | Registers the UNIX signal handlers. | [
30522,
2270,
10763,
11675,
4236,
1006,
2345,
8833,
4590,
8833,
1007,
1063,
25549,
1006,
4742,
11774,
3917,
1012,
2465,
1007,
1063,
2065,
1006,
5068,
1007,
1063,
2709,
1025,
1065,
5068,
1027,
2995,
1025,
2345,
5164,
1031,
1033,
7755,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java | KeyedStream.fold | @Deprecated
public <R> SingleOutputStreamOperator<R> fold(R initialValue, FoldFunction<T, R> folder) {
TypeInformation<R> outType = TypeExtractor.getFoldReturnTypes(
clean(folder), getType(), Utils.getCallLocationName(), true);
return transform("Keyed Fold", outType, new StreamGroupedFold<>(clean(folder), initialValue));
} | java | @Deprecated
public <R> SingleOutputStreamOperator<R> fold(R initialValue, FoldFunction<T, R> folder) {
TypeInformation<R> outType = TypeExtractor.getFoldReturnTypes(
clean(folder), getType(), Utils.getCallLocationName(), true);
return transform("Keyed Fold", outType, new StreamGroupedFold<>(clean(folder), initialValue));
} | [
"@",
"Deprecated",
"public",
"<",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"fold",
"(",
"R",
"initialValue",
",",
"FoldFunction",
"<",
"T",
",",
"R",
">",
"folder",
")",
"{",
"TypeInformation",
"<",
"R",
">",
"outType",
"=",
"TypeExtractor",
... | Applies a fold transformation on the grouped data stream grouped on by
the given key position. The {@link FoldFunction} will receive input
values based on the key value. Only input values with the same key will
go to the same folder.
@param folder
The {@link FoldFunction} that will be called for every element
of the input values with the same key.
@param initialValue
The initialValue passed to the folders for each key.
@return The transformed DataStream.
@deprecated will be removed in a future version | [
"Applies",
"a",
"fold",
"transformation",
"on",
"the",
"grouped",
"data",
"stream",
"grouped",
"on",
"by",
"the",
"given",
"key",
"position",
".",
"The",
"{",
"@link",
"FoldFunction",
"}",
"will",
"receive",
"input",
"values",
"based",
"on",
"the",
"key",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java#L710-L717 | train | Folds the stream into a single output stream. | [
30522,
1030,
2139,
28139,
12921,
2270,
1026,
1054,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
10671,
1006,
1054,
3988,
10175,
5657,
1010,
10671,
11263,
27989,
1026,
1056,
1010,
1054,
1028,
19622,
1007,
1063,
2828,
2378,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java | ExceptionUtil.getMessage | public static String getMessage(Throwable e) {
if (null == e) {
return NULL;
}
return StrUtil.format("{}: {}", e.getClass().getSimpleName(), e.getMessage());
} | java | public static String getMessage(Throwable e) {
if (null == e) {
return NULL;
}
return StrUtil.format("{}: {}", e.getClass().getSimpleName(), e.getMessage());
} | [
"public",
"static",
"String",
"getMessage",
"(",
"Throwable",
"e",
")",
"{",
"if",
"(",
"null",
"==",
"e",
")",
"{",
"return",
"NULL",
";",
"}",
"return",
"StrUtil",
".",
"format",
"(",
"\"{}: {}\"",
",",
"e",
".",
"getClass",
"(",
")",
".",
"getSimp... | 获得完整消息,包括异常名
@param e 异常
@return 完整消息 | [
"获得完整消息,包括异常名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java#L31-L36 | train | Get the message of the throwable. | [
30522,
2270,
10763,
5164,
2131,
7834,
3736,
3351,
1006,
5466,
3085,
1041,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1041,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
2358,
22134,
4014,
1012,
4289,
1006,
1000,
1063,
1065,
1024,
1063,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | core/src/main/java/org/apache/spark/memory/MemoryConsumer.java | MemoryConsumer.allocatePage | protected MemoryBlock allocatePage(long required) {
MemoryBlock page = taskMemoryManager.allocatePage(Math.max(pageSize, required), this);
if (page == null || page.size() < required) {
throwOom(page, required);
}
used += page.size();
return page;
} | java | protected MemoryBlock allocatePage(long required) {
MemoryBlock page = taskMemoryManager.allocatePage(Math.max(pageSize, required), this);
if (page == null || page.size() < required) {
throwOom(page, required);
}
used += page.size();
return page;
} | [
"protected",
"MemoryBlock",
"allocatePage",
"(",
"long",
"required",
")",
"{",
"MemoryBlock",
"page",
"=",
"taskMemoryManager",
".",
"allocatePage",
"(",
"Math",
".",
"max",
"(",
"pageSize",
",",
"required",
")",
",",
"this",
")",
";",
"if",
"(",
"page",
"... | Allocate a memory block with at least `required` bytes.
@throws SparkOutOfMemoryError | [
"Allocate",
"a",
"memory",
"block",
"with",
"at",
"least",
"required",
"bytes",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/memory/MemoryConsumer.java#L116-L123 | train | Allocate a page of data. | [
30522,
5123,
3638,
23467,
2035,
24755,
2618,
13704,
1006,
2146,
3223,
1007,
1063,
3638,
23467,
3931,
1027,
4708,
4168,
5302,
2854,
24805,
4590,
1012,
2035,
24755,
2618,
13704,
1006,
8785,
1012,
4098,
1006,
5530,
4697,
1010,
3223,
1007,
1010... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/codec/Base64Encoder.java | Base64Encoder.encodeUrlSafe | public static String encodeUrlSafe(byte[] source, String charset) {
return StrUtil.str(encodeUrlSafe(source, false), charset);
} | java | public static String encodeUrlSafe(byte[] source, String charset) {
return StrUtil.str(encodeUrlSafe(source, false), charset);
} | [
"public",
"static",
"String",
"encodeUrlSafe",
"(",
"byte",
"[",
"]",
"source",
",",
"String",
"charset",
")",
"{",
"return",
"StrUtil",
".",
"str",
"(",
"encodeUrlSafe",
"(",
"source",
",",
"false",
")",
",",
"charset",
")",
";",
"}"
] | base64编码,URL安全的
@param source 被编码的base64字符串
@param charset 字符集
@return 被加密后的字符串
@since 3.0.6 | [
"base64编码,URL安全的"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/Base64Encoder.java#L154-L156 | train | Encodes the given byte array into a URL safe string. | [
30522,
2270,
10763,
5164,
4372,
16044,
3126,
4877,
10354,
2063,
1006,
24880,
1031,
1033,
3120,
1010,
5164,
25869,
13462,
1007,
1063,
2709,
2358,
22134,
4014,
1012,
2358,
2099,
1006,
4372,
16044,
3126,
4877,
10354,
2063,
1006,
3120,
1010,
62... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-0.11/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/FlinkKafkaProducer.java | FlinkKafkaProducer.resumeTransaction | public void resumeTransaction(long producerId, short epoch) {
Preconditions.checkState(producerId >= 0 && epoch >= 0, "Incorrect values for producerId {} and epoch {}", producerId, epoch);
LOG.info("Attempting to resume transaction {} with producerId {} and epoch {}", transactionalId, producerId, epoch);
Object transactionManager = getValue(kafkaProducer, "transactionManager");
synchronized (transactionManager) {
Object sequenceNumbers = getValue(transactionManager, "sequenceNumbers");
invoke(transactionManager, "transitionTo", getEnum("org.apache.kafka.clients.producer.internals.TransactionManager$State.INITIALIZING"));
invoke(sequenceNumbers, "clear");
Object producerIdAndEpoch = getValue(transactionManager, "producerIdAndEpoch");
setValue(producerIdAndEpoch, "producerId", producerId);
setValue(producerIdAndEpoch, "epoch", epoch);
invoke(transactionManager, "transitionTo", getEnum("org.apache.kafka.clients.producer.internals.TransactionManager$State.READY"));
invoke(transactionManager, "transitionTo", getEnum("org.apache.kafka.clients.producer.internals.TransactionManager$State.IN_TRANSACTION"));
setValue(transactionManager, "transactionStarted", true);
}
} | java | public void resumeTransaction(long producerId, short epoch) {
Preconditions.checkState(producerId >= 0 && epoch >= 0, "Incorrect values for producerId {} and epoch {}", producerId, epoch);
LOG.info("Attempting to resume transaction {} with producerId {} and epoch {}", transactionalId, producerId, epoch);
Object transactionManager = getValue(kafkaProducer, "transactionManager");
synchronized (transactionManager) {
Object sequenceNumbers = getValue(transactionManager, "sequenceNumbers");
invoke(transactionManager, "transitionTo", getEnum("org.apache.kafka.clients.producer.internals.TransactionManager$State.INITIALIZING"));
invoke(sequenceNumbers, "clear");
Object producerIdAndEpoch = getValue(transactionManager, "producerIdAndEpoch");
setValue(producerIdAndEpoch, "producerId", producerId);
setValue(producerIdAndEpoch, "epoch", epoch);
invoke(transactionManager, "transitionTo", getEnum("org.apache.kafka.clients.producer.internals.TransactionManager$State.READY"));
invoke(transactionManager, "transitionTo", getEnum("org.apache.kafka.clients.producer.internals.TransactionManager$State.IN_TRANSACTION"));
setValue(transactionManager, "transactionStarted", true);
}
} | [
"public",
"void",
"resumeTransaction",
"(",
"long",
"producerId",
",",
"short",
"epoch",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"producerId",
">=",
"0",
"&&",
"epoch",
">=",
"0",
",",
"\"Incorrect values for producerId {} and epoch {}\"",
",",
"producerI... | Instead of obtaining producerId and epoch from the transaction coordinator, re-use previously obtained ones,
so that we can resume transaction after a restart. Implementation of this method is based on
{@link org.apache.kafka.clients.producer.KafkaProducer#initTransactions}. | [
"Instead",
"of",
"obtaining",
"producerId",
"and",
"epoch",
"from",
"the",
"transaction",
"coordinator",
"re",
"-",
"use",
"previously",
"obtained",
"ones",
"so",
"that",
"we",
"can",
"resume",
"transaction",
"after",
"a",
"restart",
".",
"Implementation",
"of",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.11/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/FlinkKafkaProducer.java#L191-L211 | train | Resume a transactional with the given producerId and epoch. | [
30522,
2270,
11675,
13746,
6494,
3619,
18908,
3258,
1006,
2146,
3135,
3593,
1010,
2460,
25492,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
14148,
12259,
1006,
3135,
3593,
1028,
1027,
1014,
1004,
1004,
25492,
1028,
1027,
1014,
1010,
1000,
165... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/ParquetInputFormat.java | ParquetInputFormat.selectFields | public void selectFields(String[] fieldNames) {
checkNotNull(fieldNames, "fieldNames");
this.fieldNames = fieldNames;
RowTypeInfo rowTypeInfo = (RowTypeInfo) ParquetSchemaConverter.fromParquetType(expectedFileSchema);
TypeInformation[] selectFieldTypes = new TypeInformation[fieldNames.length];
for (int i = 0; i < fieldNames.length; i++) {
try {
selectFieldTypes[i] = rowTypeInfo.getTypeAt(fieldNames[i]);
} catch (IndexOutOfBoundsException e) {
throw new IllegalArgumentException(String.format("Fail to access Field %s , "
+ "which is not contained in the file schema", fieldNames[i]), e);
}
}
this.fieldTypes = selectFieldTypes;
} | java | public void selectFields(String[] fieldNames) {
checkNotNull(fieldNames, "fieldNames");
this.fieldNames = fieldNames;
RowTypeInfo rowTypeInfo = (RowTypeInfo) ParquetSchemaConverter.fromParquetType(expectedFileSchema);
TypeInformation[] selectFieldTypes = new TypeInformation[fieldNames.length];
for (int i = 0; i < fieldNames.length; i++) {
try {
selectFieldTypes[i] = rowTypeInfo.getTypeAt(fieldNames[i]);
} catch (IndexOutOfBoundsException e) {
throw new IllegalArgumentException(String.format("Fail to access Field %s , "
+ "which is not contained in the file schema", fieldNames[i]), e);
}
}
this.fieldTypes = selectFieldTypes;
} | [
"public",
"void",
"selectFields",
"(",
"String",
"[",
"]",
"fieldNames",
")",
"{",
"checkNotNull",
"(",
"fieldNames",
",",
"\"fieldNames\"",
")",
";",
"this",
".",
"fieldNames",
"=",
"fieldNames",
";",
"RowTypeInfo",
"rowTypeInfo",
"=",
"(",
"RowTypeInfo",
")"... | Configures the fields to be read and returned by the ParquetInputFormat. Selected fields must be present
in the configured schema.
@param fieldNames Names of all selected fields. | [
"Configures",
"the",
"fields",
"to",
"be",
"read",
"and",
"returned",
"by",
"the",
"ParquetInputFormat",
".",
"Selected",
"fields",
"must",
"be",
"present",
"in",
"the",
"configured",
"schema",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/ParquetInputFormat.java#L130-L144 | train | Selects the fields in the file. | [
30522,
2270,
11675,
7276,
15155,
1006,
5164,
1031,
1033,
2492,
18442,
2015,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
2492,
18442,
2015,
1010,
1000,
2492,
18442,
2015,
1000,
1007,
1025,
2023,
1012,
2492,
18442,
2015,
1027,
2492,
18442,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/Session.java | Session.commit | public void commit() throws SQLException {
try {
getConnection().commit();
} catch (SQLException e) {
throw e;
} finally {
try {
getConnection().setAutoCommit(true); // 事务结束,恢复自动提交
} catch (SQLException e) {
log.error(e);
}
}
} | java | public void commit() throws SQLException {
try {
getConnection().commit();
} catch (SQLException e) {
throw e;
} finally {
try {
getConnection().setAutoCommit(true); // 事务结束,恢复自动提交
} catch (SQLException e) {
log.error(e);
}
}
} | [
"public",
"void",
"commit",
"(",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"getConnection",
"(",
")",
".",
"commit",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"finally",
"{",
"try",
"{",
"getConnec... | 提交事务
@throws SQLException SQL执行异常 | [
"提交事务"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Session.java#L122-L134 | train | Commit the current transaction. | [
30522,
2270,
11675,
10797,
1006,
1007,
11618,
29296,
10288,
24422,
1063,
3046,
1063,
2131,
8663,
2638,
7542,
1006,
1007,
1012,
10797,
1006,
1007,
1025,
1065,
4608,
1006,
29296,
10288,
24422,
1041,
1007,
1063,
5466,
1041,
1025,
1065,
2633,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.read | @Override
public void read(DataInputView in) throws IOException {
synchronized (this.confData) {
final int numberOfProperties = in.readInt();
for (int i = 0; i < numberOfProperties; i++) {
String key = StringValue.readString(in);
Object value;
byte type = in.readByte();
switch (type) {
case TYPE_STRING:
value = StringValue.readString(in);
break;
case TYPE_INT:
value = in.readInt();
break;
case TYPE_LONG:
value = in.readLong();
break;
case TYPE_FLOAT:
value = in.readFloat();
break;
case TYPE_DOUBLE:
value = in.readDouble();
break;
case TYPE_BOOLEAN:
value = in.readBoolean();
break;
case TYPE_BYTES:
byte[] bytes = new byte[in.readInt()];
in.readFully(bytes);
value = bytes;
break;
default:
throw new IOException("Unrecognized type: " + type);
}
this.confData.put(key, value);
}
}
} | java | @Override
public void read(DataInputView in) throws IOException {
synchronized (this.confData) {
final int numberOfProperties = in.readInt();
for (int i = 0; i < numberOfProperties; i++) {
String key = StringValue.readString(in);
Object value;
byte type = in.readByte();
switch (type) {
case TYPE_STRING:
value = StringValue.readString(in);
break;
case TYPE_INT:
value = in.readInt();
break;
case TYPE_LONG:
value = in.readLong();
break;
case TYPE_FLOAT:
value = in.readFloat();
break;
case TYPE_DOUBLE:
value = in.readDouble();
break;
case TYPE_BOOLEAN:
value = in.readBoolean();
break;
case TYPE_BYTES:
byte[] bytes = new byte[in.readInt()];
in.readFully(bytes);
value = bytes;
break;
default:
throw new IOException("Unrecognized type: " + type);
}
this.confData.put(key, value);
}
}
} | [
"@",
"Override",
"public",
"void",
"read",
"(",
"DataInputView",
"in",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"this",
".",
"confData",
")",
"{",
"final",
"int",
"numberOfProperties",
"=",
"in",
".",
"readInt",
"(",
")",
";",
"for",
"(",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L952-L993 | train | Read the configuration data from the specified input view. | [
30522,
1030,
2058,
15637,
2270,
11675,
3191,
1006,
2951,
2378,
18780,
8584,
1999,
1007,
11618,
22834,
10288,
24422,
1063,
25549,
1006,
2023,
1012,
9530,
2546,
2850,
2696,
1007,
1063,
2345,
20014,
2193,
30524,
3145,
1027,
5164,
10175,
5657,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/client/RootUriTemplateHandler.java | RootUriTemplateHandler.addTo | public static RootUriTemplateHandler addTo(RestTemplate restTemplate,
String rootUri) {
Assert.notNull(restTemplate, "RestTemplate must not be null");
RootUriTemplateHandler handler = new RootUriTemplateHandler(rootUri,
restTemplate.getUriTemplateHandler());
restTemplate.setUriTemplateHandler(handler);
return handler;
} | java | public static RootUriTemplateHandler addTo(RestTemplate restTemplate,
String rootUri) {
Assert.notNull(restTemplate, "RestTemplate must not be null");
RootUriTemplateHandler handler = new RootUriTemplateHandler(rootUri,
restTemplate.getUriTemplateHandler());
restTemplate.setUriTemplateHandler(handler);
return handler;
} | [
"public",
"static",
"RootUriTemplateHandler",
"addTo",
"(",
"RestTemplate",
"restTemplate",
",",
"String",
"rootUri",
")",
"{",
"Assert",
".",
"notNull",
"(",
"restTemplate",
",",
"\"RestTemplate must not be null\"",
")",
";",
"RootUriTemplateHandler",
"handler",
"=",
... | Add a {@link RootUriTemplateHandler} instance to the given {@link RestTemplate}.
@param restTemplate the {@link RestTemplate} to add the handler to
@param rootUri the root URI
@return the added {@link RootUriTemplateHandler}. | [
"Add",
"a",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RootUriTemplateHandler.java#L93-L100 | train | Add a RootUriTemplateHandler to the RestTemplate. | [
30522,
2270,
10763,
7117,
9496,
18532,
15725,
11774,
3917,
5587,
3406,
1006,
2717,
18532,
15725,
2717,
18532,
15725,
1010,
5164,
7117,
9496,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
2717,
18532,
15725,
1010,
1000,
2717,
18532,
15725,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/entrypoint/ClusterEntrypoint.java | ClusterEntrypoint.getRPCPortRange | protected String getRPCPortRange(Configuration configuration) {
if (ZooKeeperUtils.isZooKeeperRecoveryMode(configuration)) {
return configuration.getString(HighAvailabilityOptions.HA_JOB_MANAGER_PORT_RANGE);
} else {
return String.valueOf(configuration.getInteger(JobManagerOptions.PORT));
}
} | java | protected String getRPCPortRange(Configuration configuration) {
if (ZooKeeperUtils.isZooKeeperRecoveryMode(configuration)) {
return configuration.getString(HighAvailabilityOptions.HA_JOB_MANAGER_PORT_RANGE);
} else {
return String.valueOf(configuration.getInteger(JobManagerOptions.PORT));
}
} | [
"protected",
"String",
"getRPCPortRange",
"(",
"Configuration",
"configuration",
")",
"{",
"if",
"(",
"ZooKeeperUtils",
".",
"isZooKeeperRecoveryMode",
"(",
"configuration",
")",
")",
"{",
"return",
"configuration",
".",
"getString",
"(",
"HighAvailabilityOptions",
".... | Returns the port range for the common {@link RpcService}.
@param configuration to extract the port range from
@return Port range for the common {@link RpcService} | [
"Returns",
"the",
"port",
"range",
"for",
"the",
"common",
"{",
"@link",
"RpcService",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java#L283-L289 | train | Get the port range for the job manager. | [
30522,
5123,
5164,
2131,
14536,
21906,
11589,
24388,
2063,
1006,
9563,
9563,
1007,
1063,
2065,
1006,
9201,
13106,
21823,
4877,
1012,
2003,
23221,
13106,
2890,
3597,
27900,
5302,
3207,
1006,
9563,
1007,
1007,
1063,
2709,
9563,
1012,
4152,
18... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getBeUlong48 | public final long getBeUlong48(final int pos) {
final int position = origin + pos;
if (pos + 5 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 5)));
byte[] buf = buffer;
return ((long) (0xff & buf[position + 5])) | ((long) (0xff & buf[position + 4]) << 8)
| ((long) (0xff & buf[position + 3]) << 16) | ((long) (0xff & buf[position + 2]) << 24)
| ((long) (0xff & buf[position + 1]) << 32) | ((long) (0xff & buf[position]) << 40);
} | java | public final long getBeUlong48(final int pos) {
final int position = origin + pos;
if (pos + 5 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 5)));
byte[] buf = buffer;
return ((long) (0xff & buf[position + 5])) | ((long) (0xff & buf[position + 4]) << 8)
| ((long) (0xff & buf[position + 3]) << 16) | ((long) (0xff & buf[position + 2]) << 24)
| ((long) (0xff & buf[position + 1]) << 32) | ((long) (0xff & buf[position]) << 40);
} | [
"public",
"final",
"long",
"getBeUlong48",
"(",
"final",
"int",
"pos",
")",
"{",
"final",
"int",
"position",
"=",
"origin",
"+",
"pos",
";",
"if",
"(",
"pos",
"+",
"5",
">=",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentExceptio... | Return 48-bit unsigned long from buffer. (big-endian)
@see mysql-5.6.10/include/myisampack.h - mi_uint6korr | [
"Return",
"48",
"-",
"bit",
"unsigned",
"long",
"from",
"buffer",
".",
"(",
"big",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L730-L740 | train | Gets a long from the buffer starting at the given position in the block which is stored in a SHORT field. | [
30522,
2270,
2345,
2146,
2131,
4783,
18845,
3070,
18139,
1006,
2345,
20014,
13433,
2015,
1007,
1063,
2345,
20014,
2597,
1027,
4761,
1009,
13433,
2015,
1025,
2065,
1006,
13433,
2015,
1009,
1019,
1028,
1027,
5787,
1064,
1064,
13433,
2015,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TSessionHandle.java | TSessionHandle.isSet | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case SESSION_ID:
return isSetSessionId();
}
throw new IllegalStateException();
} | java | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case SESSION_ID:
return isSetSessionId();
}
throw new IllegalStateException();
} | [
"public",
"boolean",
"isSet",
"(",
"_Fields",
"field",
")",
"{",
"if",
"(",
"field",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"switch",
"(",
"field",
")",
"{",
"case",
"SESSION_ID",
":",
"return",
"isSetSess... | Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise | [
"Returns",
"true",
"if",
"field",
"corresponding",
"to",
"fieldID",
"is",
"set",
"(",
"has",
"been",
"assigned",
"a",
"value",
")",
"and",
"false",
"otherwise"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TSessionHandle.java#L189-L199 | train | Checks if field is set to the value of the passed in CRA. | [
30522,
2270,
22017,
20898,
26354,
3388,
1006,
1035,
4249,
2492,
1007,
1063,
2065,
1006,
2492,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1007,
1025,
1065,
6942,
1006,
2492,
1007,
1063,
2553,
5219... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.visibilityOfAllElements | public static ExpectedCondition<List<WebElement>> visibilityOfAllElements(
final List<WebElement> elements) {
return new ExpectedCondition<List<WebElement>>() {
@Override
public List<WebElement> apply(WebDriver driver) {
for (WebElement element : elements) {
if (!element.isDisplayed()) {
return null;
}
}
return elements.size() > 0 ? elements : null;
}
@Override
public String toString() {
return "visibility of all " + elements;
}
};
} | java | public static ExpectedCondition<List<WebElement>> visibilityOfAllElements(
final List<WebElement> elements) {
return new ExpectedCondition<List<WebElement>>() {
@Override
public List<WebElement> apply(WebDriver driver) {
for (WebElement element : elements) {
if (!element.isDisplayed()) {
return null;
}
}
return elements.size() > 0 ? elements : null;
}
@Override
public String toString() {
return "visibility of all " + elements;
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"List",
"<",
"WebElement",
">",
">",
"visibilityOfAllElements",
"(",
"final",
"List",
"<",
"WebElement",
">",
"elements",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"List",
"<",
"WebElement",
">",
">",
"(... | An expectation for checking that all elements present on the web page that match the locator
are visible. Visibility means that the elements are not only displayed but also have a height
and width that is greater than 0.
@param elements list of WebElements
@return the list of WebElements once they are located | [
"An",
"expectation",
"for",
"checking",
"that",
"all",
"elements",
"present",
"on",
"the",
"web",
"page",
"that",
"match",
"the",
"locator",
"are",
"visible",
".",
"Visibility",
"means",
"that",
"the",
"elements",
"are",
"not",
"only",
"displayed",
"but",
"a... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L268-L286 | train | An expectation for checking that all elements in a list are visible. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
2862,
1026,
4773,
12260,
3672,
1028,
1028,
16476,
11253,
24164,
16930,
11187,
1006,
2345,
2862,
1026,
4773,
12260,
3672,
1028,
3787,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
2862,
1026,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBNativeMetricMonitor.java | RocksDBNativeMetricMonitor.setProperty | private void setProperty(ColumnFamilyHandle handle, String property, RocksDBNativeMetricView metricView) {
if (metricView.isClosed()) {
return;
}
try {
synchronized (lock) {
if (rocksDB != null) {
long value = rocksDB.getLongProperty(handle, property);
metricView.setValue(value);
}
}
} catch (RocksDBException e) {
metricView.close();
LOG.warn("Failed to read native metric %s from RocksDB", property, e);
}
} | java | private void setProperty(ColumnFamilyHandle handle, String property, RocksDBNativeMetricView metricView) {
if (metricView.isClosed()) {
return;
}
try {
synchronized (lock) {
if (rocksDB != null) {
long value = rocksDB.getLongProperty(handle, property);
metricView.setValue(value);
}
}
} catch (RocksDBException e) {
metricView.close();
LOG.warn("Failed to read native metric %s from RocksDB", property, e);
}
} | [
"private",
"void",
"setProperty",
"(",
"ColumnFamilyHandle",
"handle",
",",
"String",
"property",
",",
"RocksDBNativeMetricView",
"metricView",
")",
"{",
"if",
"(",
"metricView",
".",
"isClosed",
"(",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"synchronize... | Updates the value of metricView if the reference is still valid. | [
"Updates",
"the",
"value",
"of",
"metricView",
"if",
"the",
"reference",
"is",
"still",
"valid",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBNativeMetricMonitor.java#L85-L100 | train | Sets the value of the native metric view. | [
30522,
2797,
11675,
2275,
21572,
4842,
3723,
1006,
5930,
7011,
4328,
2135,
11774,
2571,
5047,
1010,
5164,
3200,
1010,
5749,
18939,
19833,
3512,
12589,
8584,
12046,
8584,
1007,
1063,
2065,
1006,
12046,
8584,
1012,
2003,
20464,
24768,
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... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java | NettyUtils.getRemoteAddress | public static String getRemoteAddress(Channel channel) {
if (channel != null && channel.remoteAddress() != null) {
return channel.remoteAddress().toString();
}
return "<unknown remote>";
} | java | public static String getRemoteAddress(Channel channel) {
if (channel != null && channel.remoteAddress() != null) {
return channel.remoteAddress().toString();
}
return "<unknown remote>";
} | [
"public",
"static",
"String",
"getRemoteAddress",
"(",
"Channel",
"channel",
")",
"{",
"if",
"(",
"channel",
"!=",
"null",
"&&",
"channel",
".",
"remoteAddress",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"channel",
".",
"remoteAddress",
"(",
")",
".",
... | Returns the remote address on the channel or "<unknown remote>" if none exists. | [
"Returns",
"the",
"remote",
"address",
"on",
"the",
"channel",
"or",
"<",
";",
"unknown",
"remote>",
";",
"if",
"none",
"exists",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java#L107-L112 | train | Get the remote address of the channel | [
30522,
2270,
10763,
5164,
2131,
28578,
12184,
4215,
16200,
4757,
1006,
3149,
3149,
1007,
1063,
2065,
1006,
3149,
999,
1027,
19701,
1004,
1004,
3149,
1012,
6556,
4215,
16200,
4757,
1006,
1007,
999,
1027,
19701,
1007,
1063,
2709,
3149,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/GroupCombineOperator.java | GroupCombineOperator.translateSelectorFunctionReducer | @SuppressWarnings("unchecked")
private static <IN, OUT, K> PlanUnwrappingGroupCombineOperator<IN, OUT, K> translateSelectorFunctionReducer(
SelectorFunctionKeys<IN, ?> rawKeys,
GroupCombineFunction<IN, OUT> function,
TypeInformation<OUT> outputType,
String name,
Operator<IN> input) {
final SelectorFunctionKeys<IN, K> keys = (SelectorFunctionKeys<IN, K>) rawKeys;
TypeInformation<Tuple2<K, IN>> typeInfoWithKey = KeyFunctions.createTypeWithKey(keys);
Operator<Tuple2<K, IN>> keyedInput = KeyFunctions.appendKeyExtractor(input, keys);
PlanUnwrappingGroupCombineOperator<IN, OUT, K> reducer =
new PlanUnwrappingGroupCombineOperator<>(function, keys, name, outputType, typeInfoWithKey);
reducer.setInput(keyedInput);
return reducer;
} | java | @SuppressWarnings("unchecked")
private static <IN, OUT, K> PlanUnwrappingGroupCombineOperator<IN, OUT, K> translateSelectorFunctionReducer(
SelectorFunctionKeys<IN, ?> rawKeys,
GroupCombineFunction<IN, OUT> function,
TypeInformation<OUT> outputType,
String name,
Operator<IN> input) {
final SelectorFunctionKeys<IN, K> keys = (SelectorFunctionKeys<IN, K>) rawKeys;
TypeInformation<Tuple2<K, IN>> typeInfoWithKey = KeyFunctions.createTypeWithKey(keys);
Operator<Tuple2<K, IN>> keyedInput = KeyFunctions.appendKeyExtractor(input, keys);
PlanUnwrappingGroupCombineOperator<IN, OUT, K> reducer =
new PlanUnwrappingGroupCombineOperator<>(function, keys, name, outputType, typeInfoWithKey);
reducer.setInput(keyedInput);
return reducer;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"<",
"IN",
",",
"OUT",
",",
"K",
">",
"PlanUnwrappingGroupCombineOperator",
"<",
"IN",
",",
"OUT",
",",
"K",
">",
"translateSelectorFunctionReducer",
"(",
"SelectorFunctionKeys",
"<",
"IN",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/GroupCombineOperator.java#L192-L209 | train | Translate a selector function reducer into a plan - unwrapping group combine operator. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2797,
10763,
1026,
1999,
1010,
2041,
1010,
1047,
1028,
2933,
4609,
13088,
29098,
2075,
17058,
18274,
3170,
25918,
8844,
1026,
1999,
1010,
2041,
1010,
1047,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-cache/src/main/java/cn/hutool/cache/impl/CacheObjIterator.java | CacheObjIterator.nextValue | private void nextValue() {
while (iterator.hasNext()) {
nextValue = iterator.next();
if (nextValue.isExpired() == false) {
return;
}
}
nextValue = null;
} | java | private void nextValue() {
while (iterator.hasNext()) {
nextValue = iterator.next();
if (nextValue.isExpired() == false) {
return;
}
}
nextValue = null;
} | [
"private",
"void",
"nextValue",
"(",
")",
"{",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"nextValue",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"nextValue",
".",
"isExpired",
"(",
")",
"==",
"false",
")",
"{",
"ret... | 下一个值,当不存在则下一个值为null | [
"下一个值,当不存在则下一个值为null"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cache/src/main/java/cn/hutool/cache/impl/CacheObjIterator.java#L63-L71 | train | Returns the next value in the iterator. | [
30522,
2797,
11675,
2279,
10175,
5657,
1006,
1007,
1063,
2096,
1006,
2009,
6906,
4263,
1012,
8440,
10288,
2102,
1006,
1007,
1007,
1063,
2279,
10175,
5657,
1027,
2009,
6906,
4263,
1012,
2279,
1006,
1007,
1025,
2065,
1006,
2279,
10175,
5657,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/utils/RefCountedFile.java | RefCountedFile.newFile | public static RefCountedFile newFile(
final File file,
final OutputStream currentOut) throws IOException {
return new RefCountedFile(file, currentOut, 0L);
} | java | public static RefCountedFile newFile(
final File file,
final OutputStream currentOut) throws IOException {
return new RefCountedFile(file, currentOut, 0L);
} | [
"public",
"static",
"RefCountedFile",
"newFile",
"(",
"final",
"File",
"file",
",",
"final",
"OutputStream",
"currentOut",
")",
"throws",
"IOException",
"{",
"return",
"new",
"RefCountedFile",
"(",
"file",
",",
"currentOut",
",",
"0L",
")",
";",
"}"
] | ------------------------------ Factory methods for initializing a temporary file ------------------------------ | [
"------------------------------",
"Factory",
"methods",
"for",
"initializing",
"a",
"temporary",
"file",
"------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/utils/RefCountedFile.java#L128-L132 | train | Create a new file with the specified file and output stream. | [
30522,
2270,
10763,
25416,
3597,
16671,
2098,
8873,
2571,
2047,
8873,
2571,
1006,
2345,
5371,
5371,
1010,
2345,
27852,
25379,
2783,
5833,
1007,
11618,
22834,
10288,
24422,
1063,
2709,
2047,
25416,
3597,
16671,
2098,
8873,
2571,
1006,
5371,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | config/src/main/java/com/networknt/config/ConfigInjection.java | ConfigInjection.isExclusionConfigFile | public static boolean isExclusionConfigFile(String configName) {
List<Object> exclusionConfigFileList = (exclusionMap == null) ? new ArrayList<>() : (List<Object>) exclusionMap.get(EXCLUSION_CONFIG_FILE_LIST);
return CENTRALIZED_MANAGEMENT.equals(configName)
|| SCALABLE_CONFIG.equals(configName)
|| exclusionConfigFileList.contains(configName);
} | java | public static boolean isExclusionConfigFile(String configName) {
List<Object> exclusionConfigFileList = (exclusionMap == null) ? new ArrayList<>() : (List<Object>) exclusionMap.get(EXCLUSION_CONFIG_FILE_LIST);
return CENTRALIZED_MANAGEMENT.equals(configName)
|| SCALABLE_CONFIG.equals(configName)
|| exclusionConfigFileList.contains(configName);
} | [
"public",
"static",
"boolean",
"isExclusionConfigFile",
"(",
"String",
"configName",
")",
"{",
"List",
"<",
"Object",
">",
"exclusionConfigFileList",
"=",
"(",
"exclusionMap",
"==",
"null",
")",
"?",
"new",
"ArrayList",
"<>",
"(",
")",
":",
"(",
"List",
"<",... | Double check values and exclusions to ensure no dead loop | [
"Double",
"check",
"values",
"and",
"exclusions",
"to",
"ensure",
"no",
"dead",
"loop"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/config/src/main/java/com/networknt/config/ConfigInjection.java#L79-L84 | train | Checks if the given config name is an exclusion config file. | [
30522,
2270,
10763,
22017,
20898,
2003,
10288,
20464,
14499,
8663,
8873,
25708,
9463,
1006,
5164,
9530,
8873,
16989,
4168,
1007,
1063,
2862,
1026,
4874,
1028,
15945,
8663,
8873,
25708,
9463,
9863,
1027,
1006,
15945,
2863,
2361,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/ReOpenableHashPartition.java | ReOpenableHashPartition.restorePartitionBuffers | void restorePartitionBuffers(IOManager ioManager, List<MemorySegment> availableMemory) throws IOException {
final BulkBlockChannelReader reader = ioManager.createBulkBlockChannelReader(this.initialBuildSideChannel,
availableMemory, this.initialPartitionBuffersCount);
reader.close();
final List<MemorySegment> partitionBuffersFromDisk = reader.getFullSegments();
this.partitionBuffers = (MemorySegment[]) partitionBuffersFromDisk.toArray(new MemorySegment[partitionBuffersFromDisk.size()]);
this.overflowSegments = new MemorySegment[2];
this.numOverflowSegments = 0;
this.nextOverflowBucket = 0;
this.isRestored = true;
} | java | void restorePartitionBuffers(IOManager ioManager, List<MemorySegment> availableMemory) throws IOException {
final BulkBlockChannelReader reader = ioManager.createBulkBlockChannelReader(this.initialBuildSideChannel,
availableMemory, this.initialPartitionBuffersCount);
reader.close();
final List<MemorySegment> partitionBuffersFromDisk = reader.getFullSegments();
this.partitionBuffers = (MemorySegment[]) partitionBuffersFromDisk.toArray(new MemorySegment[partitionBuffersFromDisk.size()]);
this.overflowSegments = new MemorySegment[2];
this.numOverflowSegments = 0;
this.nextOverflowBucket = 0;
this.isRestored = true;
} | [
"void",
"restorePartitionBuffers",
"(",
"IOManager",
"ioManager",
",",
"List",
"<",
"MemorySegment",
">",
"availableMemory",
")",
"throws",
"IOException",
"{",
"final",
"BulkBlockChannelReader",
"reader",
"=",
"ioManager",
".",
"createBulkBlockChannelReader",
"(",
"this... | This method is called every time a multi-match hash map is opened again for a new probe input.
@param ioManager
@param availableMemory
@throws IOException | [
"This",
"method",
"is",
"called",
"every",
"time",
"a",
"multi",
"-",
"match",
"hash",
"map",
"is",
"opened",
"again",
"for",
"a",
"new",
"probe",
"input",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/ReOpenableHashPartition.java#L124-L135 | train | Restores the partition buffers from the disk. | [
30522,
11675,
9239,
19362,
3775,
3508,
8569,
12494,
2015,
1006,
22834,
24805,
4590,
22834,
24805,
4590,
1010,
2862,
1026,
3638,
3366,
21693,
4765,
1028,
2800,
4168,
5302,
2854,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
9625,
23467,
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/spark | common/network-common/src/main/java/org/apache/spark/network/client/TransportResponseHandler.java | TransportResponseHandler.failOutstandingRequests | private void failOutstandingRequests(Throwable cause) {
for (Map.Entry<StreamChunkId, ChunkReceivedCallback> entry : outstandingFetches.entrySet()) {
try {
entry.getValue().onFailure(entry.getKey().chunkIndex, cause);
} catch (Exception e) {
logger.warn("ChunkReceivedCallback.onFailure throws exception", e);
}
}
for (Map.Entry<Long, RpcResponseCallback> entry : outstandingRpcs.entrySet()) {
try {
entry.getValue().onFailure(cause);
} catch (Exception e) {
logger.warn("RpcResponseCallback.onFailure throws exception", e);
}
}
for (Pair<String, StreamCallback> entry : streamCallbacks) {
try {
entry.getValue().onFailure(entry.getKey(), cause);
} catch (Exception e) {
logger.warn("StreamCallback.onFailure throws exception", e);
}
}
// It's OK if new fetches appear, as they will fail immediately.
outstandingFetches.clear();
outstandingRpcs.clear();
streamCallbacks.clear();
} | java | private void failOutstandingRequests(Throwable cause) {
for (Map.Entry<StreamChunkId, ChunkReceivedCallback> entry : outstandingFetches.entrySet()) {
try {
entry.getValue().onFailure(entry.getKey().chunkIndex, cause);
} catch (Exception e) {
logger.warn("ChunkReceivedCallback.onFailure throws exception", e);
}
}
for (Map.Entry<Long, RpcResponseCallback> entry : outstandingRpcs.entrySet()) {
try {
entry.getValue().onFailure(cause);
} catch (Exception e) {
logger.warn("RpcResponseCallback.onFailure throws exception", e);
}
}
for (Pair<String, StreamCallback> entry : streamCallbacks) {
try {
entry.getValue().onFailure(entry.getKey(), cause);
} catch (Exception e) {
logger.warn("StreamCallback.onFailure throws exception", e);
}
}
// It's OK if new fetches appear, as they will fail immediately.
outstandingFetches.clear();
outstandingRpcs.clear();
streamCallbacks.clear();
} | [
"private",
"void",
"failOutstandingRequests",
"(",
"Throwable",
"cause",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"StreamChunkId",
",",
"ChunkReceivedCallback",
">",
"entry",
":",
"outstandingFetches",
".",
"entrySet",
"(",
")",
")",
"{",
"try",
"{",
... | Fire the failure callback for all outstanding requests. This is called when we have an
uncaught exception or pre-mature connection termination. | [
"Fire",
"the",
"failure",
"callback",
"for",
"all",
"outstanding",
"requests",
".",
"This",
"is",
"called",
"when",
"we",
"have",
"an",
"uncaught",
"exception",
"or",
"pre",
"-",
"mature",
"connection",
"termination",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/client/TransportResponseHandler.java#L107-L134 | train | Fail outstanding requests. | [
30522,
2797,
11675,
8246,
12166,
5794,
4667,
2890,
15500,
2015,
1006,
5466,
3085,
3426,
1007,
1063,
2005,
1006,
4949,
1012,
4443,
1026,
5460,
20760,
8950,
3593,
1010,
20000,
2890,
3401,
3512,
16409,
8095,
5963,
1028,
4443,
1024,
5151,
7959,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Graph.java | Graph.reduceOnEdges | public DataSet<Tuple2<K, EV>> reduceOnEdges(ReduceEdgesFunction<EV> reduceEdgesFunction,
EdgeDirection direction) throws IllegalArgumentException {
switch (direction) {
case IN:
return edges.map(new ProjectVertexWithEdgeValueMap<>(1))
.withForwardedFields("f1->f0")
.name("Vertex with in-edges")
.groupBy(0).reduce(new ApplyReduceFunction<>(reduceEdgesFunction))
.name("Reduce on edges");
case OUT:
return edges.map(new ProjectVertexWithEdgeValueMap<>(0))
.withForwardedFields("f0->f0")
.name("Vertex with out-edges")
.groupBy(0).reduce(new ApplyReduceFunction<>(reduceEdgesFunction))
.name("Reduce on edges");
case ALL:
return edges.flatMap(new EmitOneVertexWithEdgeValuePerNode<>())
.withForwardedFields("f2->f1")
.name("Vertex with all edges")
.groupBy(0).reduce(new ApplyReduceFunction<>(reduceEdgesFunction))
.name("Reduce on edges");
default:
throw new IllegalArgumentException("Illegal edge direction");
}
} | java | public DataSet<Tuple2<K, EV>> reduceOnEdges(ReduceEdgesFunction<EV> reduceEdgesFunction,
EdgeDirection direction) throws IllegalArgumentException {
switch (direction) {
case IN:
return edges.map(new ProjectVertexWithEdgeValueMap<>(1))
.withForwardedFields("f1->f0")
.name("Vertex with in-edges")
.groupBy(0).reduce(new ApplyReduceFunction<>(reduceEdgesFunction))
.name("Reduce on edges");
case OUT:
return edges.map(new ProjectVertexWithEdgeValueMap<>(0))
.withForwardedFields("f0->f0")
.name("Vertex with out-edges")
.groupBy(0).reduce(new ApplyReduceFunction<>(reduceEdgesFunction))
.name("Reduce on edges");
case ALL:
return edges.flatMap(new EmitOneVertexWithEdgeValuePerNode<>())
.withForwardedFields("f2->f1")
.name("Vertex with all edges")
.groupBy(0).reduce(new ApplyReduceFunction<>(reduceEdgesFunction))
.name("Reduce on edges");
default:
throw new IllegalArgumentException("Illegal edge direction");
}
} | [
"public",
"DataSet",
"<",
"Tuple2",
"<",
"K",
",",
"EV",
">",
">",
"reduceOnEdges",
"(",
"ReduceEdgesFunction",
"<",
"EV",
">",
"reduceEdgesFunction",
",",
"EdgeDirection",
"direction",
")",
"throws",
"IllegalArgumentException",
"{",
"switch",
"(",
"direction",
... | Compute a reduce transformation over the edge values of each vertex.
For each vertex, the transformation consecutively calls a
{@link ReduceEdgesFunction} until only a single value for each edge remains.
The {@link ReduceEdgesFunction} combines two edge values into one new value of the same type.
@param reduceEdgesFunction the reduce function to apply to the neighbors of each vertex.
@param direction the edge direction (in-, out-, all-)
@return a Dataset of Tuple2, with one tuple per vertex.
The first field of the Tuple2 is the vertex ID and the second field
is the aggregate value computed by the provided {@link ReduceEdgesFunction}.
@throws IllegalArgumentException | [
"Compute",
"a",
"reduce",
"transformation",
"over",
"the",
"edge",
"values",
"of",
"each",
"vertex",
".",
"For",
"each",
"vertex",
"the",
"transformation",
"consecutively",
"calls",
"a",
"{",
"@link",
"ReduceEdgesFunction",
"}",
"until",
"only",
"a",
"single",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L2304-L2329 | train | Reduce on edges DataSet. | [
30522,
2270,
2951,
13462,
1026,
10722,
10814,
2475,
1026,
1047,
1010,
23408,
1028,
1028,
5547,
17799,
8449,
1006,
5547,
24225,
22747,
4609,
7542,
1026,
23408,
1028,
5547,
24225,
22747,
4609,
30524,
7926,
1012,
4949,
1006,
2047,
2622,
16874,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/internals/ClosableBlockingQueue.java | ClosableBlockingQueue.pollBatch | public List<E> pollBatch() {
lock.lock();
try {
if (open) {
if (elements.size() > 0) {
ArrayList<E> result = new ArrayList<>(elements);
elements.clear();
return result;
} else {
return null;
}
} else {
throw new IllegalStateException("queue is closed");
}
} finally {
lock.unlock();
}
} | java | public List<E> pollBatch() {
lock.lock();
try {
if (open) {
if (elements.size() > 0) {
ArrayList<E> result = new ArrayList<>(elements);
elements.clear();
return result;
} else {
return null;
}
} else {
throw new IllegalStateException("queue is closed");
}
} finally {
lock.unlock();
}
} | [
"public",
"List",
"<",
"E",
">",
"pollBatch",
"(",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"open",
")",
"{",
"if",
"(",
"elements",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"ArrayList",
"<",
"E",
">",
"result",
... | Returns all of the queue's current elements in a list, if the queue is non-empty.
Otherwise, this method returns null.
<p>The method throws an {@code IllegalStateException} if the queue is closed.
Checking whether the queue is open and removing the elements is one atomic operation.
<p>This method never blocks.
@return All of the queue's elements, or null, if the queue is empty.
@throws IllegalStateException Thrown, if the queue is closed. | [
"Returns",
"all",
"of",
"the",
"queue",
"s",
"current",
"elements",
"in",
"a",
"list",
"if",
"the",
"queue",
"is",
"non",
"-",
"empty",
".",
"Otherwise",
"this",
"method",
"returns",
"null",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/ClosableBlockingQueue.java#L288-L305 | train | Poll the queue for more elements. | [
30522,
2270,
2862,
1026,
1041,
1028,
8554,
14479,
2818,
1006,
1007,
1063,
5843,
1012,
5843,
1006,
1007,
1025,
3046,
1063,
2065,
1006,
2330,
1007,
1063,
2065,
1006,
3787,
1012,
2946,
1006,
1007,
1028,
1014,
1007,
30524,
2047,
9140,
9863,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java | ReUtil.replaceAll | public static String replaceAll(CharSequence content, Pattern pattern, String replacementTemplate) {
if (StrUtil.isEmpty(content)) {
return StrUtil.str(content);
}
final Matcher matcher = pattern.matcher(content);
boolean result = matcher.find();
if (result) {
final Set<String> varNums = findAll(PatternPool.GROUP_VAR, replacementTemplate, 1, new HashSet<String>());
final StringBuffer sb = new StringBuffer();
do {
String replacement = replacementTemplate;
for (String var : varNums) {
int group = Integer.parseInt(var);
replacement = replacement.replace("$" + var, matcher.group(group));
}
matcher.appendReplacement(sb, escape(replacement));
result = matcher.find();
} while (result);
matcher.appendTail(sb);
return sb.toString();
}
return StrUtil.str(content);
} | java | public static String replaceAll(CharSequence content, Pattern pattern, String replacementTemplate) {
if (StrUtil.isEmpty(content)) {
return StrUtil.str(content);
}
final Matcher matcher = pattern.matcher(content);
boolean result = matcher.find();
if (result) {
final Set<String> varNums = findAll(PatternPool.GROUP_VAR, replacementTemplate, 1, new HashSet<String>());
final StringBuffer sb = new StringBuffer();
do {
String replacement = replacementTemplate;
for (String var : varNums) {
int group = Integer.parseInt(var);
replacement = replacement.replace("$" + var, matcher.group(group));
}
matcher.appendReplacement(sb, escape(replacement));
result = matcher.find();
} while (result);
matcher.appendTail(sb);
return sb.toString();
}
return StrUtil.str(content);
} | [
"public",
"static",
"String",
"replaceAll",
"(",
"CharSequence",
"content",
",",
"Pattern",
"pattern",
",",
"String",
"replacementTemplate",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isEmpty",
"(",
"content",
")",
")",
"{",
"return",
"StrUtil",
".",
"str",
"(",
... | 正则替换指定值<br>
通过正则查找到字符串,然后把匹配到的字符串加入到replacementTemplate中,$1表示分组1的字符串
@param content 文本
@param pattern {@link Pattern}
@param replacementTemplate 替换的文本模板,可以使用$1类似的变量提取正则匹配出的内容
@return 处理后的文本
@since 3.0.4 | [
"正则替换指定值<br",
">",
"通过正则查找到字符串,然后把匹配到的字符串加入到replacementTemplate中,$1表示分组1的字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L615-L638 | train | Replaces all occurrences of the given pattern with the given replacement template. | [
30522,
2270,
10763,
5164,
5672,
8095,
1006,
25869,
3366,
4226,
5897,
4180,
1010,
5418,
5418,
1010,
5164,
6110,
18532,
15725,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
6633,
13876,
2100,
1006,
4180,
1007,
1007,
1063,
2709,
2358,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java | TypeExtractor.createTypeInfoFromInput | @SuppressWarnings({"unchecked", "rawtypes"})
private <IN1> TypeInformation<?> createTypeInfoFromInput(TypeVariable<?> returnTypeVar, ArrayList<Type> inputTypeHierarchy, Type inType, TypeInformation<IN1> inTypeInfo) {
TypeInformation<?> info = null;
// use a factory to find corresponding type information to type variable
final ArrayList<Type> factoryHierarchy = new ArrayList<>(inputTypeHierarchy);
final TypeInfoFactory<?> factory = getClosestFactory(factoryHierarchy, inType);
if (factory != null) {
// the type that defines the factory is last in factory hierarchy
final Type factoryDefiningType = factoryHierarchy.get(factoryHierarchy.size() - 1);
// defining type has generics, the factory need to be asked for a mapping of subtypes to type information
if (factoryDefiningType instanceof ParameterizedType) {
final Type[] typeParams = typeToClass(factoryDefiningType).getTypeParameters();
final Type[] actualParams = ((ParameterizedType) factoryDefiningType).getActualTypeArguments();
// go thru all elements and search for type variables
for (int i = 0; i < actualParams.length; i++) {
final Map<String, TypeInformation<?>> componentInfo = inTypeInfo.getGenericParameters();
final String typeParamName = typeParams[i].toString();
if (!componentInfo.containsKey(typeParamName) || componentInfo.get(typeParamName) == null) {
throw new InvalidTypesException("TypeInformation '" + inTypeInfo.getClass().getSimpleName() +
"' does not supply a mapping of TypeVariable '" + typeParamName + "' to corresponding TypeInformation. " +
"Input type inference can only produce a result with this information. " +
"Please implement method 'TypeInformation.getGenericParameters()' for this.");
}
info = createTypeInfoFromInput(returnTypeVar, factoryHierarchy, actualParams[i], componentInfo.get(typeParamName));
if (info != null) {
break;
}
}
}
}
// the input is a type variable
else if (sameTypeVars(inType, returnTypeVar)) {
return inTypeInfo;
}
else if (inType instanceof TypeVariable) {
Type resolvedInType = materializeTypeVariable(inputTypeHierarchy, (TypeVariable<?>) inType);
if (resolvedInType != inType) {
info = createTypeInfoFromInput(returnTypeVar, inputTypeHierarchy, resolvedInType, inTypeInfo);
}
}
// input is an array
else if (inType instanceof GenericArrayType) {
TypeInformation<?> componentInfo = null;
if (inTypeInfo instanceof BasicArrayTypeInfo) {
componentInfo = ((BasicArrayTypeInfo<?,?>) inTypeInfo).getComponentInfo();
}
else if (inTypeInfo instanceof PrimitiveArrayTypeInfo) {
componentInfo = BasicTypeInfo.getInfoFor(inTypeInfo.getTypeClass().getComponentType());
}
else if (inTypeInfo instanceof ObjectArrayTypeInfo) {
componentInfo = ((ObjectArrayTypeInfo<?,?>) inTypeInfo).getComponentInfo();
}
info = createTypeInfoFromInput(returnTypeVar, inputTypeHierarchy, ((GenericArrayType) inType).getGenericComponentType(), componentInfo);
}
// the input is a tuple
else if (inTypeInfo instanceof TupleTypeInfo && isClassType(inType) && Tuple.class.isAssignableFrom(typeToClass(inType))) {
ParameterizedType tupleBaseClass;
// get tuple from possible tuple subclass
while (!(isClassType(inType) && typeToClass(inType).getSuperclass().equals(Tuple.class))) {
inputTypeHierarchy.add(inType);
inType = typeToClass(inType).getGenericSuperclass();
}
inputTypeHierarchy.add(inType);
// we can assume to be parameterized since we
// already did input validation
tupleBaseClass = (ParameterizedType) inType;
Type[] tupleElements = tupleBaseClass.getActualTypeArguments();
// go thru all tuple elements and search for type variables
for (int i = 0; i < tupleElements.length; i++) {
info = createTypeInfoFromInput(returnTypeVar, inputTypeHierarchy, tupleElements[i], ((TupleTypeInfo<?>) inTypeInfo).getTypeAt(i));
if(info != null) {
break;
}
}
}
// the input is a pojo
else if (inTypeInfo instanceof PojoTypeInfo && isClassType(inType)) {
// build the entire type hierarchy for the pojo
getTypeHierarchy(inputTypeHierarchy, inType, Object.class);
// determine a field containing the type variable
List<Field> fields = getAllDeclaredFields(typeToClass(inType), false);
for (Field field : fields) {
Type fieldType = field.getGenericType();
if (fieldType instanceof TypeVariable && sameTypeVars(returnTypeVar, materializeTypeVariable(inputTypeHierarchy, (TypeVariable<?>) fieldType))) {
return getTypeOfPojoField(inTypeInfo, field);
}
else if (fieldType instanceof ParameterizedType || fieldType instanceof GenericArrayType) {
ArrayList<Type> typeHierarchyWithFieldType = new ArrayList<>(inputTypeHierarchy);
typeHierarchyWithFieldType.add(fieldType);
TypeInformation<?> foundInfo = createTypeInfoFromInput(returnTypeVar, typeHierarchyWithFieldType, fieldType, getTypeOfPojoField(inTypeInfo, field));
if (foundInfo != null) {
return foundInfo;
}
}
}
}
return info;
} | java | @SuppressWarnings({"unchecked", "rawtypes"})
private <IN1> TypeInformation<?> createTypeInfoFromInput(TypeVariable<?> returnTypeVar, ArrayList<Type> inputTypeHierarchy, Type inType, TypeInformation<IN1> inTypeInfo) {
TypeInformation<?> info = null;
// use a factory to find corresponding type information to type variable
final ArrayList<Type> factoryHierarchy = new ArrayList<>(inputTypeHierarchy);
final TypeInfoFactory<?> factory = getClosestFactory(factoryHierarchy, inType);
if (factory != null) {
// the type that defines the factory is last in factory hierarchy
final Type factoryDefiningType = factoryHierarchy.get(factoryHierarchy.size() - 1);
// defining type has generics, the factory need to be asked for a mapping of subtypes to type information
if (factoryDefiningType instanceof ParameterizedType) {
final Type[] typeParams = typeToClass(factoryDefiningType).getTypeParameters();
final Type[] actualParams = ((ParameterizedType) factoryDefiningType).getActualTypeArguments();
// go thru all elements and search for type variables
for (int i = 0; i < actualParams.length; i++) {
final Map<String, TypeInformation<?>> componentInfo = inTypeInfo.getGenericParameters();
final String typeParamName = typeParams[i].toString();
if (!componentInfo.containsKey(typeParamName) || componentInfo.get(typeParamName) == null) {
throw new InvalidTypesException("TypeInformation '" + inTypeInfo.getClass().getSimpleName() +
"' does not supply a mapping of TypeVariable '" + typeParamName + "' to corresponding TypeInformation. " +
"Input type inference can only produce a result with this information. " +
"Please implement method 'TypeInformation.getGenericParameters()' for this.");
}
info = createTypeInfoFromInput(returnTypeVar, factoryHierarchy, actualParams[i], componentInfo.get(typeParamName));
if (info != null) {
break;
}
}
}
}
// the input is a type variable
else if (sameTypeVars(inType, returnTypeVar)) {
return inTypeInfo;
}
else if (inType instanceof TypeVariable) {
Type resolvedInType = materializeTypeVariable(inputTypeHierarchy, (TypeVariable<?>) inType);
if (resolvedInType != inType) {
info = createTypeInfoFromInput(returnTypeVar, inputTypeHierarchy, resolvedInType, inTypeInfo);
}
}
// input is an array
else if (inType instanceof GenericArrayType) {
TypeInformation<?> componentInfo = null;
if (inTypeInfo instanceof BasicArrayTypeInfo) {
componentInfo = ((BasicArrayTypeInfo<?,?>) inTypeInfo).getComponentInfo();
}
else if (inTypeInfo instanceof PrimitiveArrayTypeInfo) {
componentInfo = BasicTypeInfo.getInfoFor(inTypeInfo.getTypeClass().getComponentType());
}
else if (inTypeInfo instanceof ObjectArrayTypeInfo) {
componentInfo = ((ObjectArrayTypeInfo<?,?>) inTypeInfo).getComponentInfo();
}
info = createTypeInfoFromInput(returnTypeVar, inputTypeHierarchy, ((GenericArrayType) inType).getGenericComponentType(), componentInfo);
}
// the input is a tuple
else if (inTypeInfo instanceof TupleTypeInfo && isClassType(inType) && Tuple.class.isAssignableFrom(typeToClass(inType))) {
ParameterizedType tupleBaseClass;
// get tuple from possible tuple subclass
while (!(isClassType(inType) && typeToClass(inType).getSuperclass().equals(Tuple.class))) {
inputTypeHierarchy.add(inType);
inType = typeToClass(inType).getGenericSuperclass();
}
inputTypeHierarchy.add(inType);
// we can assume to be parameterized since we
// already did input validation
tupleBaseClass = (ParameterizedType) inType;
Type[] tupleElements = tupleBaseClass.getActualTypeArguments();
// go thru all tuple elements and search for type variables
for (int i = 0; i < tupleElements.length; i++) {
info = createTypeInfoFromInput(returnTypeVar, inputTypeHierarchy, tupleElements[i], ((TupleTypeInfo<?>) inTypeInfo).getTypeAt(i));
if(info != null) {
break;
}
}
}
// the input is a pojo
else if (inTypeInfo instanceof PojoTypeInfo && isClassType(inType)) {
// build the entire type hierarchy for the pojo
getTypeHierarchy(inputTypeHierarchy, inType, Object.class);
// determine a field containing the type variable
List<Field> fields = getAllDeclaredFields(typeToClass(inType), false);
for (Field field : fields) {
Type fieldType = field.getGenericType();
if (fieldType instanceof TypeVariable && sameTypeVars(returnTypeVar, materializeTypeVariable(inputTypeHierarchy, (TypeVariable<?>) fieldType))) {
return getTypeOfPojoField(inTypeInfo, field);
}
else if (fieldType instanceof ParameterizedType || fieldType instanceof GenericArrayType) {
ArrayList<Type> typeHierarchyWithFieldType = new ArrayList<>(inputTypeHierarchy);
typeHierarchyWithFieldType.add(fieldType);
TypeInformation<?> foundInfo = createTypeInfoFromInput(returnTypeVar, typeHierarchyWithFieldType, fieldType, getTypeOfPojoField(inTypeInfo, field));
if (foundInfo != null) {
return foundInfo;
}
}
}
}
return info;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"private",
"<",
"IN1",
">",
"TypeInformation",
"<",
"?",
">",
"createTypeInfoFromInput",
"(",
"TypeVariable",
"<",
"?",
">",
"returnTypeVar",
",",
"ArrayList",
"<",
"Type",
">",... | Finds the type information to a type variable.
It solve the following:
Return the type information for "returnTypeVar" given that "inType" has type information "inTypeInfo".
Thus "inType" must contain "returnTypeVar" in a "inputTypeHierarchy", otherwise null is returned. | [
"Finds",
"the",
"type",
"information",
"to",
"a",
"type",
"variable",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L988-L1089 | train | Create the TypeInformation from the input type. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
4895,
5403,
18141,
1000,
1010,
1000,
6315,
13874,
2015,
1000,
1065,
1007,
2797,
1026,
1999,
2487,
1028,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
3443,
13874,
2378,
14876,
19699,
2093... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorRegistryFactory.java | ReactiveHealthIndicatorRegistryFactory.createReactiveHealthIndicatorRegistry | public ReactiveHealthIndicatorRegistry createReactiveHealthIndicatorRegistry(
Map<String, ReactiveHealthIndicator> reactiveHealthIndicators,
Map<String, HealthIndicator> healthIndicators) {
Assert.notNull(reactiveHealthIndicators,
"ReactiveHealthIndicators must not be null");
return initialize(new DefaultReactiveHealthIndicatorRegistry(),
reactiveHealthIndicators, healthIndicators);
} | java | public ReactiveHealthIndicatorRegistry createReactiveHealthIndicatorRegistry(
Map<String, ReactiveHealthIndicator> reactiveHealthIndicators,
Map<String, HealthIndicator> healthIndicators) {
Assert.notNull(reactiveHealthIndicators,
"ReactiveHealthIndicators must not be null");
return initialize(new DefaultReactiveHealthIndicatorRegistry(),
reactiveHealthIndicators, healthIndicators);
} | [
"public",
"ReactiveHealthIndicatorRegistry",
"createReactiveHealthIndicatorRegistry",
"(",
"Map",
"<",
"String",
",",
"ReactiveHealthIndicator",
">",
"reactiveHealthIndicators",
",",
"Map",
"<",
"String",
",",
"HealthIndicator",
">",
"healthIndicators",
")",
"{",
"Assert",
... | Create a {@link ReactiveHealthIndicatorRegistry} based on the specified health
indicators. Each {@link HealthIndicator} are wrapped to a
{@link HealthIndicatorReactiveAdapter}. If two instances share the same name, the
reactive variant takes precedence.
@param reactiveHealthIndicators the {@link ReactiveHealthIndicator} instances
mapped by name
@param healthIndicators the {@link HealthIndicator} instances mapped by name if
any.
@return a {@link ReactiveHealthIndicator} that delegates to the specified
{@code reactiveHealthIndicators}. | [
"Create",
"a",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/ReactiveHealthIndicatorRegistryFactory.java#L57-L64 | train | Creates a ReactiveHealthIndicatorRegistry with the given health indicators. | [
30522,
2270,
22643,
20192,
24658,
22254,
5555,
4263,
2890,
24063,
2854,
3443,
16416,
15277,
20192,
24658,
22254,
5555,
4263,
2890,
24063,
2854,
1006,
4949,
1026,
5164,
1010,
22643,
20192,
24658,
22254,
5555,
4263,
1028,
22643,
20192,
24658,
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/convert/Convert.java | Convert.convertTime | public static long convertTime(long sourceDuration, TimeUnit sourceUnit, TimeUnit destUnit) {
Assert.notNull(sourceUnit, "sourceUnit is null !");
Assert.notNull(destUnit, "destUnit is null !");
return destUnit.convert(sourceDuration, sourceUnit);
} | java | public static long convertTime(long sourceDuration, TimeUnit sourceUnit, TimeUnit destUnit) {
Assert.notNull(sourceUnit, "sourceUnit is null !");
Assert.notNull(destUnit, "destUnit is null !");
return destUnit.convert(sourceDuration, sourceUnit);
} | [
"public",
"static",
"long",
"convertTime",
"(",
"long",
"sourceDuration",
",",
"TimeUnit",
"sourceUnit",
",",
"TimeUnit",
"destUnit",
")",
"{",
"Assert",
".",
"notNull",
"(",
"sourceUnit",
",",
"\"sourceUnit is null !\"",
")",
";",
"Assert",
".",
"notNull",
"(",... | 转换时间单位
@param sourceDuration 时长
@param sourceUnit 源单位
@param destUnit 目标单位
@return 目标单位的时长 | [
"转换时间单位"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L796-L800 | train | Convert the duration of the source duration to the destination duration. | [
30522,
2270,
10763,
2146,
10463,
7292,
1006,
2146,
23184,
18924,
1010,
2051,
19496,
2102,
3120,
19496,
2102,
1010,
2051,
19496,
2102,
4078,
8525,
3490,
2102,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
3120,
19496,
2102,
1010,
1000,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/codec/BCD.java | BCD.ascToBcd | public static byte[] ascToBcd(byte[] ascii, int ascLength) {
byte[] bcd = new byte[ascLength / 2];
int j = 0;
for (int i = 0; i < (ascLength + 1) / 2; i++) {
bcd[i] = ascToBcd(ascii[j++]);
bcd[i] = (byte) (((j >= ascLength) ? 0x00 : ascToBcd(ascii[j++])) + (bcd[i] << 4));
}
return bcd;
} | java | public static byte[] ascToBcd(byte[] ascii, int ascLength) {
byte[] bcd = new byte[ascLength / 2];
int j = 0;
for (int i = 0; i < (ascLength + 1) / 2; i++) {
bcd[i] = ascToBcd(ascii[j++]);
bcd[i] = (byte) (((j >= ascLength) ? 0x00 : ascToBcd(ascii[j++])) + (bcd[i] << 4));
}
return bcd;
} | [
"public",
"static",
"byte",
"[",
"]",
"ascToBcd",
"(",
"byte",
"[",
"]",
"ascii",
",",
"int",
"ascLength",
")",
"{",
"byte",
"[",
"]",
"bcd",
"=",
"new",
"byte",
"[",
"ascLength",
"/",
"2",
"]",
";",
"int",
"j",
"=",
"0",
";",
"for",
"(",
"int"... | ASCII转BCD
@param ascii ASCII byte数组
@param ascLength 长度
@return BCD | [
"ASCII转BCD"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/BCD.java#L69-L77 | train | Converts an ASCII string to BCD. | [
30522,
2270,
10763,
24880,
1031,
1033,
2004,
6593,
16429,
19797,
1006,
24880,
1031,
1033,
2004,
6895,
2072,
1010,
20014,
2004,
14321,
3070,
2705,
1007,
1063,
24880,
1031,
1033,
4647,
2094,
1027,
2047,
24880,
1031,
2004,
14321,
3070,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java | HttpResponseStatus.parseLine | public static HttpResponseStatus parseLine(String line) {
try {
int space = line.indexOf(' ');
return space == -1 ? valueOf(parseInt(line)) :
valueOf(parseInt(line.substring(0, space)), line.substring(space + 1));
} catch (Exception e) {
throw new IllegalArgumentException("malformed status line: " + line, e);
}
} | java | public static HttpResponseStatus parseLine(String line) {
try {
int space = line.indexOf(' ');
return space == -1 ? valueOf(parseInt(line)) :
valueOf(parseInt(line.substring(0, space)), line.substring(space + 1));
} catch (Exception e) {
throw new IllegalArgumentException("malformed status line: " + line, e);
}
} | [
"public",
"static",
"HttpResponseStatus",
"parseLine",
"(",
"String",
"line",
")",
"{",
"try",
"{",
"int",
"space",
"=",
"line",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"return",
"space",
"==",
"-",
"1",
"?",
"valueOf",
"(",
"parseInt",
"(",
"line",
... | Parses the specified HTTP status line into a {@link HttpResponseStatus}. The expected formats of the line are:
<ul>
<li>{@code statusCode} (e.g. 200)</li>
<li>{@code statusCode} {@code reasonPhrase} (e.g. 404 Not Found)</li>
</ul>
@throws IllegalArgumentException if the specified status line is malformed | [
"Parses",
"the",
"specified",
"HTTP",
"status",
"line",
"into",
"a",
"{",
"@link",
"HttpResponseStatus",
"}",
".",
"The",
"expected",
"formats",
"of",
"the",
"line",
"are",
":",
"<ul",
">",
"<li",
">",
"{",
"@code",
"statusCode",
"}",
"(",
"e",
".",
"g... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java#L492-L500 | train | Parses a single HTTP status line. | [
30522,
2270,
10763,
8299,
6072,
26029,
8583,
29336,
2271,
11968,
11246,
3170,
1006,
5164,
2240,
1007,
1063,
3046,
1063,
20014,
2686,
1027,
2240,
1012,
5950,
11253,
1006,
1005,
1005,
1007,
1025,
2709,
2686,
1027,
1027,
1011,
1015,
1029,
3643... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.parseDate | public static DateTime parseDate(String dateString) {
dateString = normalize(dateString);
return parse(dateString, DatePattern.NORM_DATE_FORMAT);
} | java | public static DateTime parseDate(String dateString) {
dateString = normalize(dateString);
return parse(dateString, DatePattern.NORM_DATE_FORMAT);
} | [
"public",
"static",
"DateTime",
"parseDate",
"(",
"String",
"dateString",
")",
"{",
"dateString",
"=",
"normalize",
"(",
"dateString",
")",
";",
"return",
"parse",
"(",
"dateString",
",",
"DatePattern",
".",
"NORM_DATE_FORMAT",
")",
";",
"}"
] | 格式yyyy-MM-dd
@param dateString 标准形式的日期字符串
@return 日期对象 | [
"格式yyyy",
"-",
"MM",
"-",
"dd"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L640-L643 | train | Parse a string of date format into a DateTime object. | [
30522,
2270,
10763,
3058,
7292,
11968,
6924,
3686,
1006,
5164,
5246,
18886,
3070,
1007,
1063,
5246,
18886,
3070,
1027,
3671,
4697,
1006,
5246,
18886,
3070,
1007,
1025,
2709,
11968,
3366,
1006,
5246,
18886,
3070,
1010,
3058,
4502,
12079,
207... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.readFully | public void readFully(byte[] buffer, int offset, int length) throws IOException {
while (length > 0) {
int amountRead = checkedRead(buffer, offset, length);
offset += amountRead;
length -= amountRead;
}
} | java | public void readFully(byte[] buffer, int offset, int length) throws IOException {
while (length > 0) {
int amountRead = checkedRead(buffer, offset, length);
offset += amountRead;
length -= amountRead;
}
} | [
"public",
"void",
"readFully",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"while",
"(",
"length",
">",
"0",
")",
"{",
"int",
"amountRead",
"=",
"checkedRead",
"(",
"buffer",
",",
"off... | Repeatedly read the underlying {@link InputStream} until the requested number of
bytes have been loaded.
@param buffer the destination buffer
@param offset the buffer offset
@param length the amount of data to read
@throws IOException in case of I/O errors | [
"Repeatedly",
"read",
"the",
"underlying",
"{"
] | 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#L63-L69 | train | Read a block of bytes from the underlying stream. | [
30522,
2270,
11675,
3191,
7699,
1006,
24880,
1031,
1033,
17698,
1010,
20014,
16396,
1010,
20014,
3091,
1007,
11618,
22834,
10288,
24422,
1063,
2096,
1006,
3091,
1028,
1014,
1007,
1063,
20014,
3815,
16416,
2094,
1027,
7039,
16416,
2094,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java | NetUtil.getNetworkInterfaces | public static Collection<NetworkInterface> getNetworkInterfaces() {
Enumeration<NetworkInterface> networkInterfaces = null;
try {
networkInterfaces = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
return null;
}
return CollectionUtil.addAll(new ArrayList<NetworkInterface>(), networkInterfaces);
} | java | public static Collection<NetworkInterface> getNetworkInterfaces() {
Enumeration<NetworkInterface> networkInterfaces = null;
try {
networkInterfaces = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
return null;
}
return CollectionUtil.addAll(new ArrayList<NetworkInterface>(), networkInterfaces);
} | [
"public",
"static",
"Collection",
"<",
"NetworkInterface",
">",
"getNetworkInterfaces",
"(",
")",
"{",
"Enumeration",
"<",
"NetworkInterface",
">",
"networkInterfaces",
"=",
"null",
";",
"try",
"{",
"networkInterfaces",
"=",
"NetworkInterface",
".",
"getNetworkInterfa... | 获取本机所有网卡
@return 所有网卡,异常返回<code>null</code>
@since 3.0.1 | [
"获取本机所有网卡"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L299-L308 | train | Gets the list of network interfaces. | [
30522,
2270,
10763,
3074,
1026,
2897,
18447,
2121,
12172,
1028,
2131,
7159,
6198,
18447,
2121,
12172,
2015,
1006,
1007,
1063,
4372,
17897,
8156,
1026,
2897,
18447,
2121,
12172,
1028,
2897,
18447,
2121,
12172,
2015,
1027,
19701,
1025,
3046,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerBuilder.java | TaskSchedulerBuilder.threadNamePrefix | public TaskSchedulerBuilder threadNamePrefix(String threadNamePrefix) {
return new TaskSchedulerBuilder(this.poolSize, this.awaitTermination,
this.awaitTerminationPeriod, threadNamePrefix, this.customizers);
} | java | public TaskSchedulerBuilder threadNamePrefix(String threadNamePrefix) {
return new TaskSchedulerBuilder(this.poolSize, this.awaitTermination,
this.awaitTerminationPeriod, threadNamePrefix, this.customizers);
} | [
"public",
"TaskSchedulerBuilder",
"threadNamePrefix",
"(",
"String",
"threadNamePrefix",
")",
"{",
"return",
"new",
"TaskSchedulerBuilder",
"(",
"this",
".",
"poolSize",
",",
"this",
".",
"awaitTermination",
",",
"this",
".",
"awaitTerminationPeriod",
",",
"threadName... | Set the prefix to use for the names of newly created threads.
@param threadNamePrefix the thread name prefix to set
@return a new builder instance | [
"Set",
"the",
"prefix",
"to",
"use",
"for",
"the",
"names",
"of",
"newly",
"created",
"threads",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerBuilder.java#L114-L117 | train | Returns a new TaskSchedulerBuilder with the specified thread name prefix. | [
30522,
2270,
8518,
7690,
9307,
15185,
19231,
4063,
11689,
18442,
28139,
8873,
2595,
1006,
5164,
11689,
18442,
28139,
8873,
2595,
1007,
1063,
2709,
2047,
8518,
7690,
9307,
15185,
19231,
4063,
1006,
2023,
1012,
12679,
4697,
1010,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/Actions.java | Actions.dragAndDropBy | public Actions dragAndDropBy(WebElement source, int xOffset, int yOffset) {
if (isBuildingActions()) {
action.addAction(new ClickAndHoldAction(jsonMouse, (Locatable) source));
action.addAction(new MoveToOffsetAction(jsonMouse, null, xOffset, yOffset));
action.addAction(new ButtonReleaseAction(jsonMouse, null));
}
return moveInTicks(source, 0, 0)
.tick(defaultMouse.createPointerDown(LEFT.asArg()))
.tick(defaultMouse.createPointerMove(Duration.ofMillis(250), Origin.pointer(), xOffset, yOffset))
.tick(defaultMouse.createPointerUp(LEFT.asArg()));
} | java | public Actions dragAndDropBy(WebElement source, int xOffset, int yOffset) {
if (isBuildingActions()) {
action.addAction(new ClickAndHoldAction(jsonMouse, (Locatable) source));
action.addAction(new MoveToOffsetAction(jsonMouse, null, xOffset, yOffset));
action.addAction(new ButtonReleaseAction(jsonMouse, null));
}
return moveInTicks(source, 0, 0)
.tick(defaultMouse.createPointerDown(LEFT.asArg()))
.tick(defaultMouse.createPointerMove(Duration.ofMillis(250), Origin.pointer(), xOffset, yOffset))
.tick(defaultMouse.createPointerUp(LEFT.asArg()));
} | [
"public",
"Actions",
"dragAndDropBy",
"(",
"WebElement",
"source",
",",
"int",
"xOffset",
",",
"int",
"yOffset",
")",
"{",
"if",
"(",
"isBuildingActions",
"(",
")",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"ClickAndHoldAction",
"(",
"jsonMouse",
","... | A convenience method that performs click-and-hold at the location of the source element,
moves by a given offset, then releases the mouse.
@param source element to emulate button down at.
@param xOffset horizontal move offset.
@param yOffset vertical move offset.
@return A self reference. | [
"A",
"convenience",
"method",
"that",
"performs",
"click",
"-",
"and",
"-",
"hold",
"at",
"the",
"location",
"of",
"the",
"source",
"element",
"moves",
"by",
"a",
"given",
"offset",
"then",
"releases",
"the",
"mouse",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L470-L481 | train | Drag and drop by actions | [
30522,
2270,
4506,
8011,
5685,
25711,
3762,
1006,
4773,
12260,
3672,
3120,
1010,
20014,
1060,
27475,
3388,
1010,
20014,
10930,
21807,
3388,
1007,
1063,
2065,
1006,
2003,
25820,
18908,
8496,
1006,
1007,
1007,
1063,
2895,
1012,
5587,
18908,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.write | public static void write(HttpServletResponse response, File file) {
final String fileName = file.getName();
final String contentType = ObjectUtil.defaultIfNull(FileUtil.getMimeType(fileName), "application/octet-stream");
BufferedInputStream in = null;
try {
in = FileUtil.getInputStream(file);
write(response, in, contentType, fileName);
} finally {
IoUtil.close(in);
}
} | java | public static void write(HttpServletResponse response, File file) {
final String fileName = file.getName();
final String contentType = ObjectUtil.defaultIfNull(FileUtil.getMimeType(fileName), "application/octet-stream");
BufferedInputStream in = null;
try {
in = FileUtil.getInputStream(file);
write(response, in, contentType, fileName);
} finally {
IoUtil.close(in);
}
} | [
"public",
"static",
"void",
"write",
"(",
"HttpServletResponse",
"response",
",",
"File",
"file",
")",
"{",
"final",
"String",
"fileName",
"=",
"file",
".",
"getName",
"(",
")",
";",
"final",
"String",
"contentType",
"=",
"ObjectUtil",
".",
"defaultIfNull",
... | 返回文件给客户端
@param response 响应对象{@link HttpServletResponse}
@param file 写出的文件对象
@since 4.1.15 | [
"返回文件给客户端"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L501-L511 | train | Write a file to the response. | [
30522,
2270,
10763,
11675,
4339,
1006,
16770,
2121,
2615,
7485,
6072,
26029,
3366,
3433,
1010,
5371,
5371,
1007,
1063,
2345,
5164,
5371,
18442,
1027,
5371,
1012,
2131,
18442,
1006,
1007,
1025,
2345,
5164,
4180,
13874,
1027,
4874,
21823,
214... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/StateUtil.java | StateUtil.bestEffortDiscardAllStateObjects | public static void bestEffortDiscardAllStateObjects(
Iterable<? extends StateObject> handlesToDiscard) throws Exception {
LambdaUtil.applyToAllWhileSuppressingExceptions(handlesToDiscard, StateObject::discardState);
} | java | public static void bestEffortDiscardAllStateObjects(
Iterable<? extends StateObject> handlesToDiscard) throws Exception {
LambdaUtil.applyToAllWhileSuppressingExceptions(handlesToDiscard, StateObject::discardState);
} | [
"public",
"static",
"void",
"bestEffortDiscardAllStateObjects",
"(",
"Iterable",
"<",
"?",
"extends",
"StateObject",
">",
"handlesToDiscard",
")",
"throws",
"Exception",
"{",
"LambdaUtil",
".",
"applyToAllWhileSuppressingExceptions",
"(",
"handlesToDiscard",
",",
"StateOb... | Iterates through the passed state handles and calls discardState() on each handle that is not null. All
occurring exceptions are suppressed and collected until the iteration is over and emitted as a single exception.
@param handlesToDiscard State handles to discard. Passed iterable is allowed to deliver null values.
@throws Exception exception that is a collection of all suppressed exceptions that were caught during iteration | [
"Iterates",
"through",
"the",
"passed",
"state",
"handles",
"and",
"calls",
"discardState",
"()",
"on",
"each",
"handle",
"that",
"is",
"not",
"null",
".",
"All",
"occurring",
"exceptions",
"are",
"suppressed",
"and",
"collected",
"until",
"the",
"iteration",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/StateUtil.java#L58-L61 | train | Discards all state objects that are not handled by the given handlesToDiscard. | [
30522,
2270,
10763,
11675,
2190,
12879,
13028,
10521,
11522,
8095,
9153,
2618,
16429,
20614,
2015,
1006,
2009,
6906,
3468,
1026,
1029,
8908,
2110,
16429,
20614,
1028,
16024,
3406,
10521,
11522,
1007,
11618,
6453,
1063,
23375,
21823,
2140,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/orm/jpa/hibernate/SpringPhysicalNamingStrategy.java | SpringPhysicalNamingStrategy.getIdentifier | protected Identifier getIdentifier(String name, boolean quoted,
JdbcEnvironment jdbcEnvironment) {
if (isCaseInsensitive(jdbcEnvironment)) {
name = name.toLowerCase(Locale.ROOT);
}
return new Identifier(name, quoted);
} | java | protected Identifier getIdentifier(String name, boolean quoted,
JdbcEnvironment jdbcEnvironment) {
if (isCaseInsensitive(jdbcEnvironment)) {
name = name.toLowerCase(Locale.ROOT);
}
return new Identifier(name, quoted);
} | [
"protected",
"Identifier",
"getIdentifier",
"(",
"String",
"name",
",",
"boolean",
"quoted",
",",
"JdbcEnvironment",
"jdbcEnvironment",
")",
"{",
"if",
"(",
"isCaseInsensitive",
"(",
"jdbcEnvironment",
")",
")",
"{",
"name",
"=",
"name",
".",
"toLowerCase",
"(",... | Get an identifier for the specified details. By default this method will return an
identifier with the name adapted based on the result of
{@link #isCaseInsensitive(JdbcEnvironment)}
@param name the name of the identifier
@param quoted if the identifier is quoted
@param jdbcEnvironment the JDBC environment
@return an identifier instance | [
"Get",
"an",
"identifier",
"for",
"the",
"specified",
"details",
".",
"By",
"default",
"this",
"method",
"will",
"return",
"an",
"identifier",
"with",
"the",
"name",
"adapted",
"based",
"on",
"the",
"result",
"of",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/orm/jpa/hibernate/SpringPhysicalNamingStrategy.java#L88-L94 | train | Returns an Identifier object for the given name. | [
30522,
5123,
8909,
4765,
18095,
2131,
5178,
16778,
8873,
2121,
1006,
5164,
2171,
1010,
22017,
20898,
9339,
1010,
26219,
9818,
2368,
21663,
2239,
3672,
26219,
9818,
2368,
21663,
2239,
3672,
1007,
1063,
2065,
1006,
2003,
18382,
7076,
6132,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/SortedGrouping.java | SortedGrouping.sortGroup | public SortedGrouping<T> sortGroup(int field, Order order) {
if (groupSortSelectorFunctionKey != null) {
throw new InvalidProgramException("Chaining sortGroup with KeySelector sorting is not supported");
}
if (!Keys.ExpressionKeys.isSortKey(field, inputDataSet.getType())) {
throw new InvalidProgramException("Selected sort key is not a sortable type");
}
ExpressionKeys<T> ek = new ExpressionKeys<>(field, inputDataSet.getType());
addSortGroupInternal(ek, order);
return this;
} | java | public SortedGrouping<T> sortGroup(int field, Order order) {
if (groupSortSelectorFunctionKey != null) {
throw new InvalidProgramException("Chaining sortGroup with KeySelector sorting is not supported");
}
if (!Keys.ExpressionKeys.isSortKey(field, inputDataSet.getType())) {
throw new InvalidProgramException("Selected sort key is not a sortable type");
}
ExpressionKeys<T> ek = new ExpressionKeys<>(field, inputDataSet.getType());
addSortGroupInternal(ek, order);
return this;
} | [
"public",
"SortedGrouping",
"<",
"T",
">",
"sortGroup",
"(",
"int",
"field",
",",
"Order",
"order",
")",
"{",
"if",
"(",
"groupSortSelectorFunctionKey",
"!=",
"null",
")",
"{",
"throw",
"new",
"InvalidProgramException",
"(",
"\"Chaining sortGroup with KeySelector so... | Sorts {@link org.apache.flink.api.java.tuple.Tuple} elements within a group on the specified field in the specified {@link Order}.
<p><b>Note: Only groups of Tuple or Pojo elements can be sorted.</b>
<p>Groups can be sorted by multiple fields by chaining {@link #sortGroup(int, Order)} calls.
@param field The Tuple field on which the group is sorted.
@param order The Order in which the specified Tuple field is sorted.
@return A SortedGrouping with specified order of group element.
@see org.apache.flink.api.java.tuple.Tuple
@see Order | [
"Sorts",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"api",
".",
"java",
".",
"tuple",
".",
"Tuple",
"}",
"elements",
"within",
"a",
"group",
"on",
"the",
"specified",
"field",
"in",
"the",
"specified",
"{",
"@link",
"Order",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/SortedGrouping.java#L231-L243 | train | Add a sort group to the grouping. | [
30522,
2270,
19616,
17058,
2075,
1026,
1056,
1028,
4066,
17058,
1006,
20014,
2492,
1010,
2344,
2344,
1007,
1063,
2065,
1006,
2967,
11589,
11246,
22471,
16347,
4609,
7542,
14839,
999,
1027,
19701,
1007,
1063,
5466,
2047,
19528,
21572,
13113,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/MDAG/MDAGMap.java | MDAGMap.commonPrefixSearchWithValue | public LinkedList<Entry<String, V>> commonPrefixSearchWithValue(String key)
{
return commonPrefixSearchWithValue(key.toCharArray(), 0);
} | java | public LinkedList<Entry<String, V>> commonPrefixSearchWithValue(String key)
{
return commonPrefixSearchWithValue(key.toCharArray(), 0);
} | [
"public",
"LinkedList",
"<",
"Entry",
"<",
"String",
",",
"V",
">",
">",
"commonPrefixSearchWithValue",
"(",
"String",
"key",
")",
"{",
"return",
"commonPrefixSearchWithValue",
"(",
"key",
".",
"toCharArray",
"(",
")",
",",
"0",
")",
";",
"}"
] | 前缀查询
@param key
@return | [
"前缀查询"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAGMap.java#L105-L108 | train | Returns a list of entries that are common to all the keys in the cache. | [
30522,
2270,
5799,
9863,
1026,
4443,
1026,
5164,
1010,
1058,
1028,
1028,
2691,
28139,
8873,
2595,
17310,
11140,
24415,
10175,
5657,
1006,
5164,
3145,
1007,
1063,
2709,
2691,
28139,
8873,
2595,
17310,
11140,
24415,
10175,
5657,
1006,
3145,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.loopFiles | public static List<File> loopFiles(File file, FileFilter fileFilter) {
List<File> fileList = new ArrayList<File>();
if (null == file) {
return fileList;
} else if (false == file.exists()) {
return fileList;
}
if (file.isDirectory()) {
final File[] subFiles = file.listFiles();
if (ArrayUtil.isNotEmpty(subFiles)) {
for (File tmp : subFiles) {
fileList.addAll(loopFiles(tmp, fileFilter));
}
}
} else {
if (null == fileFilter || fileFilter.accept(file)) {
fileList.add(file);
}
}
return fileList;
} | java | public static List<File> loopFiles(File file, FileFilter fileFilter) {
List<File> fileList = new ArrayList<File>();
if (null == file) {
return fileList;
} else if (false == file.exists()) {
return fileList;
}
if (file.isDirectory()) {
final File[] subFiles = file.listFiles();
if (ArrayUtil.isNotEmpty(subFiles)) {
for (File tmp : subFiles) {
fileList.addAll(loopFiles(tmp, fileFilter));
}
}
} else {
if (null == fileFilter || fileFilter.accept(file)) {
fileList.add(file);
}
}
return fileList;
} | [
"public",
"static",
"List",
"<",
"File",
">",
"loopFiles",
"(",
"File",
"file",
",",
"FileFilter",
"fileFilter",
")",
"{",
"List",
"<",
"File",
">",
"fileList",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"if",
"(",
"null",
"==",
"file"... | 递归遍历目录以及子目录中的所有文件<br>
如果提供file为文件,直接返回过滤结果
@param file 当前遍历文件或目录
@param fileFilter 文件过滤规则对象,选择要保留的文件,只对文件有效,不过滤目录
@return 文件列表 | [
"递归遍历目录以及子目录中的所有文件<br",
">",
"如果提供file为文件,直接返回过滤结果"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L199-L221 | train | Returns a list of files that match the given filter. | [
30522,
2270,
10763,
2862,
1026,
5371,
1028,
7077,
8873,
4244,
1006,
5371,
5371,
1010,
5371,
8873,
21928,
5371,
8873,
21928,
1007,
1063,
2862,
1026,
5371,
1028,
5371,
9863,
1027,
2047,
9140,
9863,
1026,
5371,
1028,
1006,
1007,
1025,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java | PerceptronClassifier.predict | public String predict(String text)
{
int y = model.decode(extractFeature(text, model.featureMap));
if (y == -1)
y = 0;
return model.tagSet().stringOf(y);
} | java | public String predict(String text)
{
int y = model.decode(extractFeature(text, model.featureMap));
if (y == -1)
y = 0;
return model.tagSet().stringOf(y);
} | [
"public",
"String",
"predict",
"(",
"String",
"text",
")",
"{",
"int",
"y",
"=",
"model",
".",
"decode",
"(",
"extractFeature",
"(",
"text",
",",
"model",
".",
"featureMap",
")",
")",
";",
"if",
"(",
"y",
"==",
"-",
"1",
")",
"y",
"=",
"0",
";",
... | 预测
@param text
@return | [
"预测"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java#L139-L145 | train | Predict a phrase from a text string. | [
30522,
2270,
5164,
16014,
1006,
5164,
3793,
1007,
1063,
20014,
1061,
1027,
2944,
1012,
21933,
3207,
1006,
14817,
7959,
4017,
5397,
1006,
3793,
1010,
2944,
1012,
3444,
2863,
2361,
1007,
1007,
1025,
2065,
1006,
1061,
1027,
1027,
1011,
1015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/nosql/redis/RedisDS.java | RedisDS.setStr | public String setStr(String key, String value) {
try (Jedis jedis = getJedis()) {
return jedis.set(key, value);
}
} | java | public String setStr(String key, String value) {
try (Jedis jedis = getJedis()) {
return jedis.set(key, value);
}
} | [
"public",
"String",
"setStr",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"try",
"(",
"Jedis",
"jedis",
"=",
"getJedis",
"(",
")",
")",
"{",
"return",
"jedis",
".",
"set",
"(",
"key",
",",
"value",
")",
";",
"}",
"}"
] | 从Redis中获取值
@param key 键
@param value 值
@return 状态码 | [
"从Redis中获取值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/nosql/redis/RedisDS.java#L158-L162 | train | Set a string value in redis | [
30522,
2270,
5164,
4520,
16344,
1006,
5164,
3145,
1010,
5164,
3643,
1007,
1063,
3046,
1006,
27273,
2015,
27273,
2015,
1027,
2131,
6460,
10521,
1006,
1007,
1007,
1063,
2709,
27273,
2015,
1012,
2275,
1006,
3145,
1010,
3643,
1007,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/ChannelWriterOutputView.java | ChannelWriterOutputView.close | public List<MemorySegment> close() throws IOException
{
// send off set last segment
writeSegment(getCurrentSegment(), getCurrentPositionInSegment(), true);
clear();
// close the writer and gather all segments
final LinkedBlockingQueue<MemorySegment> queue = this.writer.getReturnQueue();
this.writer.close();
// re-collect all memory segments
ArrayList<MemorySegment> list = new ArrayList<MemorySegment>(this.numSegments);
for (int i = 0; i < this.numSegments; i++) {
final MemorySegment m = queue.poll();
if (m == null) {
// we get null if the queue is empty. that should not be the case if the reader was properly closed.
throw new RuntimeException("ChannelWriterOutputView: MemorySegments have been taken from return queue by different actor.");
}
list.add(m);
}
return list;
} | java | public List<MemorySegment> close() throws IOException
{
// send off set last segment
writeSegment(getCurrentSegment(), getCurrentPositionInSegment(), true);
clear();
// close the writer and gather all segments
final LinkedBlockingQueue<MemorySegment> queue = this.writer.getReturnQueue();
this.writer.close();
// re-collect all memory segments
ArrayList<MemorySegment> list = new ArrayList<MemorySegment>(this.numSegments);
for (int i = 0; i < this.numSegments; i++) {
final MemorySegment m = queue.poll();
if (m == null) {
// we get null if the queue is empty. that should not be the case if the reader was properly closed.
throw new RuntimeException("ChannelWriterOutputView: MemorySegments have been taken from return queue by different actor.");
}
list.add(m);
}
return list;
} | [
"public",
"List",
"<",
"MemorySegment",
">",
"close",
"(",
")",
"throws",
"IOException",
"{",
"// send off set last segment",
"writeSegment",
"(",
"getCurrentSegment",
"(",
")",
",",
"getCurrentPositionInSegment",
"(",
")",
",",
"true",
")",
";",
"clear",
"(",
"... | Closes this OutputView, closing the underlying writer and returning all memory segments.
@return A list containing all memory segments originally supplied to this view.
@throws IOException Thrown, if the underlying writer could not be properly closed. | [
"Closes",
"this",
"OutputView",
"closing",
"the",
"underlying",
"writer",
"and",
"returning",
"all",
"memory",
"segments",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/ChannelWriterOutputView.java#L139-L161 | train | Close the underlying writer and return all MemorySegments. | [
30522,
2270,
2862,
1026,
3638,
3366,
21693,
4765,
1028,
2485,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
4604,
2125,
2275,
2197,
6903,
7009,
13910,
3672,
1006,
2131,
10841,
14343,
7666,
13910,
3672,
1006,
1007,
1010,
2131,
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-actuator/src/main/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpoint.java | ConfigurationPropertiesReportEndpoint.extractPrefix | private String extractPrefix(ApplicationContext context,
ConfigurationBeanFactoryMetadata beanFactoryMetaData, String beanName) {
ConfigurationProperties annotation = context.findAnnotationOnBean(beanName,
ConfigurationProperties.class);
if (beanFactoryMetaData != null) {
ConfigurationProperties override = beanFactoryMetaData
.findFactoryAnnotation(beanName, ConfigurationProperties.class);
if (override != null) {
// The @Bean-level @ConfigurationProperties overrides the one at type
// level when binding. Arguably we should render them both, but this one
// might be the most relevant for a starting point.
annotation = override;
}
}
return annotation.prefix();
} | java | private String extractPrefix(ApplicationContext context,
ConfigurationBeanFactoryMetadata beanFactoryMetaData, String beanName) {
ConfigurationProperties annotation = context.findAnnotationOnBean(beanName,
ConfigurationProperties.class);
if (beanFactoryMetaData != null) {
ConfigurationProperties override = beanFactoryMetaData
.findFactoryAnnotation(beanName, ConfigurationProperties.class);
if (override != null) {
// The @Bean-level @ConfigurationProperties overrides the one at type
// level when binding. Arguably we should render them both, but this one
// might be the most relevant for a starting point.
annotation = override;
}
}
return annotation.prefix();
} | [
"private",
"String",
"extractPrefix",
"(",
"ApplicationContext",
"context",
",",
"ConfigurationBeanFactoryMetadata",
"beanFactoryMetaData",
",",
"String",
"beanName",
")",
"{",
"ConfigurationProperties",
"annotation",
"=",
"context",
".",
"findAnnotationOnBean",
"(",
"beanN... | Extract configuration prefix from
{@link ConfigurationProperties @ConfigurationProperties} annotation.
@param context the application context
@param beanFactoryMetaData the bean factory meta-data
@param beanName the bean name
@return the prefix | [
"Extract",
"configuration",
"prefix",
"from",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpoint.java#L214-L229 | train | Extract the prefix from the configuration properties. | [
30522,
2797,
5164,
14817,
28139,
8873,
2595,
1006,
4646,
8663,
18209,
6123,
1010,
9563,
4783,
2319,
21450,
11368,
8447,
2696,
14068,
21450,
11368,
8447,
2696,
1010,
5164,
14068,
18442,
1007,
1063,
9563,
21572,
4842,
7368,
5754,
17287,
3508,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashBucketArea.java | BinaryHashBucketArea.findFirstSameBuildRow | private boolean findFirstSameBuildRow(
MemorySegment bucket,
int searchHashCode,
int bucketInSegmentOffset,
BinaryRow buildRowToInsert) {
int posInSegment = bucketInSegmentOffset + BUCKET_HEADER_LENGTH;
int countInBucket = bucket.getShort(bucketInSegmentOffset + HEADER_COUNT_OFFSET);
int numInBucket = 0;
RandomAccessInputView view = partition.getBuildStateInputView();
while (countInBucket != 0) {
while (numInBucket < countInBucket) {
final int thisCode = bucket.getInt(posInSegment);
posInSegment += HASH_CODE_LEN;
if (thisCode == searchHashCode) {
final int pointer = bucket.getInt(bucketInSegmentOffset +
BUCKET_POINTER_START_OFFSET + (numInBucket * POINTER_LEN));
numInBucket++;
try {
view.setReadPosition(pointer);
BinaryRow row = table.binaryBuildSideSerializer.mapFromPages(table.reuseBuildRow, view);
if (buildRowToInsert.equals(row)) {
return true;
}
} catch (IOException e) {
throw new RuntimeException("Error deserializing key or value from the hashtable: " +
e.getMessage(), e);
}
} else {
numInBucket++;
}
}
// this segment is done. check if there is another chained bucket
final int forwardPointer = bucket.getInt(bucketInSegmentOffset + HEADER_FORWARD_OFFSET);
if (forwardPointer == BUCKET_FORWARD_POINTER_NOT_SET) {
return false;
}
final int overflowSegIndex = forwardPointer >>> table.segmentSizeBits;
bucket = overflowSegments[overflowSegIndex];
bucketInSegmentOffset = forwardPointer & table.segmentSizeMask;
countInBucket = bucket.getShort(bucketInSegmentOffset + HEADER_COUNT_OFFSET);
posInSegment = bucketInSegmentOffset + BUCKET_HEADER_LENGTH;
numInBucket = 0;
}
return false;
} | java | private boolean findFirstSameBuildRow(
MemorySegment bucket,
int searchHashCode,
int bucketInSegmentOffset,
BinaryRow buildRowToInsert) {
int posInSegment = bucketInSegmentOffset + BUCKET_HEADER_LENGTH;
int countInBucket = bucket.getShort(bucketInSegmentOffset + HEADER_COUNT_OFFSET);
int numInBucket = 0;
RandomAccessInputView view = partition.getBuildStateInputView();
while (countInBucket != 0) {
while (numInBucket < countInBucket) {
final int thisCode = bucket.getInt(posInSegment);
posInSegment += HASH_CODE_LEN;
if (thisCode == searchHashCode) {
final int pointer = bucket.getInt(bucketInSegmentOffset +
BUCKET_POINTER_START_OFFSET + (numInBucket * POINTER_LEN));
numInBucket++;
try {
view.setReadPosition(pointer);
BinaryRow row = table.binaryBuildSideSerializer.mapFromPages(table.reuseBuildRow, view);
if (buildRowToInsert.equals(row)) {
return true;
}
} catch (IOException e) {
throw new RuntimeException("Error deserializing key or value from the hashtable: " +
e.getMessage(), e);
}
} else {
numInBucket++;
}
}
// this segment is done. check if there is another chained bucket
final int forwardPointer = bucket.getInt(bucketInSegmentOffset + HEADER_FORWARD_OFFSET);
if (forwardPointer == BUCKET_FORWARD_POINTER_NOT_SET) {
return false;
}
final int overflowSegIndex = forwardPointer >>> table.segmentSizeBits;
bucket = overflowSegments[overflowSegIndex];
bucketInSegmentOffset = forwardPointer & table.segmentSizeMask;
countInBucket = bucket.getShort(bucketInSegmentOffset + HEADER_COUNT_OFFSET);
posInSegment = bucketInSegmentOffset + BUCKET_HEADER_LENGTH;
numInBucket = 0;
}
return false;
} | [
"private",
"boolean",
"findFirstSameBuildRow",
"(",
"MemorySegment",
"bucket",
",",
"int",
"searchHashCode",
",",
"int",
"bucketInSegmentOffset",
",",
"BinaryRow",
"buildRowToInsert",
")",
"{",
"int",
"posInSegment",
"=",
"bucketInSegmentOffset",
"+",
"BUCKET_HEADER_LENGT... | For distinct build. | [
"For",
"distinct",
"build",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashBucketArea.java#L475-L523 | train | Find the first build row in the hashtable that is the same as the build row to insert. | [
30522,
2797,
22017,
20898,
2424,
8873,
12096,
21559,
15878,
19231,
22196,
2860,
1006,
3638,
3366,
21693,
4765,
13610,
1010,
20014,
3945,
14949,
16257,
10244,
1010,
20014,
13610,
7076,
13910,
23065,
21807,
3388,
1010,
12441,
10524,
3857,
10524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/CronUtil.java | CronUtil.schedule | public static String schedule(String schedulingPattern, Runnable task) {
return scheduler.schedule(schedulingPattern, task);
} | java | public static String schedule(String schedulingPattern, Runnable task) {
return scheduler.schedule(schedulingPattern, task);
} | [
"public",
"static",
"String",
"schedule",
"(",
"String",
"schedulingPattern",
",",
"Runnable",
"task",
")",
"{",
"return",
"scheduler",
".",
"schedule",
"(",
"schedulingPattern",
",",
"task",
")",
";",
"}"
] | 加入定时任务
@param schedulingPattern 定时任务执行时间的crontab表达式
@param task 任务
@return 定时任务ID | [
"加入定时任务"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/CronUtil.java#L95-L97 | train | Schedule a Runnable in the background. | [
30522,
2270,
10763,
5164,
6134,
1006,
5164,
19940,
4502,
12079,
2078,
1010,
2448,
22966,
4708,
1007,
1063,
2709,
6134,
2099,
1012,
6134,
1006,
19940,
4502,
12079,
2078,
1010,
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... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.createCipher | public static Cipher createCipher(String algorithm) {
final Provider provider = GlobalBouncyCastleProvider.INSTANCE.getProvider();
Cipher cipher;
try {
cipher = (null == provider) ? Cipher.getInstance(algorithm) : Cipher.getInstance(algorithm, provider);
} catch (Exception e) {
throw new CryptoException(e);
}
return cipher;
} | java | public static Cipher createCipher(String algorithm) {
final Provider provider = GlobalBouncyCastleProvider.INSTANCE.getProvider();
Cipher cipher;
try {
cipher = (null == provider) ? Cipher.getInstance(algorithm) : Cipher.getInstance(algorithm, provider);
} catch (Exception e) {
throw new CryptoException(e);
}
return cipher;
} | [
"public",
"static",
"Cipher",
"createCipher",
"(",
"String",
"algorithm",
")",
"{",
"final",
"Provider",
"provider",
"=",
"GlobalBouncyCastleProvider",
".",
"INSTANCE",
".",
"getProvider",
"(",
")",
";",
"Cipher",
"cipher",
";",
"try",
"{",
"cipher",
"=",
"(",... | 创建{@link Cipher}
@param algorithm 算法
@since 4.5.2 | [
"创建",
"{",
"@link",
"Cipher",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L976-L987 | train | Creates a new instance of the specified algorithm. | [
30522,
2270,
10763,
27715,
3443,
6895,
27921,
1006,
5164,
9896,
1007,
1063,
2345,
10802,
10802,
1027,
3795,
5092,
4609,
5666,
23662,
21572,
17258,
2121,
1012,
6013,
1012,
2131,
21572,
17258,
2121,
1006,
1007,
1025,
27715,
27715,
1025,
3046,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ExecutionVertex.java | ExecutionVertex.getPreferredLocationsBasedOnInputs | public Collection<CompletableFuture<TaskManagerLocation>> getPreferredLocationsBasedOnInputs() {
// otherwise, base the preferred locations on the input connections
if (inputEdges == null) {
return Collections.emptySet();
}
else {
Set<CompletableFuture<TaskManagerLocation>> locations = new HashSet<>(getTotalNumberOfParallelSubtasks());
Set<CompletableFuture<TaskManagerLocation>> inputLocations = new HashSet<>(getTotalNumberOfParallelSubtasks());
// go over all inputs
for (int i = 0; i < inputEdges.length; i++) {
inputLocations.clear();
ExecutionEdge[] sources = inputEdges[i];
if (sources != null) {
// go over all input sources
for (int k = 0; k < sources.length; k++) {
// look-up assigned slot of input source
CompletableFuture<TaskManagerLocation> locationFuture = sources[k].getSource().getProducer().getCurrentTaskManagerLocationFuture();
// add input location
inputLocations.add(locationFuture);
// inputs which have too many distinct sources are not considered
if (inputLocations.size() > MAX_DISTINCT_LOCATIONS_TO_CONSIDER) {
inputLocations.clear();
break;
}
}
}
// keep the locations of the input with the least preferred locations
if (locations.isEmpty() || // nothing assigned yet
(!inputLocations.isEmpty() && inputLocations.size() < locations.size())) {
// current input has fewer preferred locations
locations.clear();
locations.addAll(inputLocations);
}
}
return locations.isEmpty() ? Collections.emptyList() : locations;
}
} | java | public Collection<CompletableFuture<TaskManagerLocation>> getPreferredLocationsBasedOnInputs() {
// otherwise, base the preferred locations on the input connections
if (inputEdges == null) {
return Collections.emptySet();
}
else {
Set<CompletableFuture<TaskManagerLocation>> locations = new HashSet<>(getTotalNumberOfParallelSubtasks());
Set<CompletableFuture<TaskManagerLocation>> inputLocations = new HashSet<>(getTotalNumberOfParallelSubtasks());
// go over all inputs
for (int i = 0; i < inputEdges.length; i++) {
inputLocations.clear();
ExecutionEdge[] sources = inputEdges[i];
if (sources != null) {
// go over all input sources
for (int k = 0; k < sources.length; k++) {
// look-up assigned slot of input source
CompletableFuture<TaskManagerLocation> locationFuture = sources[k].getSource().getProducer().getCurrentTaskManagerLocationFuture();
// add input location
inputLocations.add(locationFuture);
// inputs which have too many distinct sources are not considered
if (inputLocations.size() > MAX_DISTINCT_LOCATIONS_TO_CONSIDER) {
inputLocations.clear();
break;
}
}
}
// keep the locations of the input with the least preferred locations
if (locations.isEmpty() || // nothing assigned yet
(!inputLocations.isEmpty() && inputLocations.size() < locations.size())) {
// current input has fewer preferred locations
locations.clear();
locations.addAll(inputLocations);
}
}
return locations.isEmpty() ? Collections.emptyList() : locations;
}
} | [
"public",
"Collection",
"<",
"CompletableFuture",
"<",
"TaskManagerLocation",
">",
">",
"getPreferredLocationsBasedOnInputs",
"(",
")",
"{",
"// otherwise, base the preferred locations on the input connections",
"if",
"(",
"inputEdges",
"==",
"null",
")",
"{",
"return",
"Co... | Gets the location preferences of the vertex's current task execution, as determined by the locations
of the predecessors from which it receives input data.
If there are more than MAX_DISTINCT_LOCATIONS_TO_CONSIDER different locations of source data, this
method returns {@code null} to indicate no location preference.
@return The preferred locations based in input streams, or an empty iterable,
if there is no input-based preference. | [
"Gets",
"the",
"location",
"preferences",
"of",
"the",
"vertex",
"s",
"current",
"task",
"execution",
"as",
"determined",
"by",
"the",
"locations",
"of",
"the",
"predecessors",
"from",
"which",
"it",
"receives",
"input",
"data",
".",
"If",
"there",
"are",
"m... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java#L523-L561 | train | Returns the preferred locations of the tasks that are assigned to the tasks in the execution graph based on the locations of the input connections. | [
30522,
2270,
3074,
1026,
4012,
10814,
10880,
11263,
11244,
1026,
4708,
24805,
4590,
4135,
10719,
1028,
1028,
2131,
28139,
7512,
5596,
4135,
10719,
19022,
11022,
5280,
2378,
18780,
2015,
1006,
1007,
1063,
1013,
1013,
4728,
1010,
2918,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/BinaryIndexedSortable.java | BinaryIndexedSortable.writeIndexAndNormalizedKey | protected void writeIndexAndNormalizedKey(BaseRow record, long currOffset) {
// add the pointer and the normalized key
this.currentSortIndexSegment.putLong(this.currentSortIndexOffset, currOffset);
if (this.numKeyBytes != 0) {
normalizedKeyComputer.putKey(record, this.currentSortIndexSegment, this.currentSortIndexOffset + OFFSET_LEN);
}
this.currentSortIndexOffset += this.indexEntrySize;
this.numRecords++;
} | java | protected void writeIndexAndNormalizedKey(BaseRow record, long currOffset) {
// add the pointer and the normalized key
this.currentSortIndexSegment.putLong(this.currentSortIndexOffset, currOffset);
if (this.numKeyBytes != 0) {
normalizedKeyComputer.putKey(record, this.currentSortIndexSegment, this.currentSortIndexOffset + OFFSET_LEN);
}
this.currentSortIndexOffset += this.indexEntrySize;
this.numRecords++;
} | [
"protected",
"void",
"writeIndexAndNormalizedKey",
"(",
"BaseRow",
"record",
",",
"long",
"currOffset",
")",
"{",
"// add the pointer and the normalized key",
"this",
".",
"currentSortIndexSegment",
".",
"putLong",
"(",
"this",
".",
"currentSortIndexOffset",
",",
"currOff... | Write of index and normalizedKey. | [
"Write",
"of",
"index",
"and",
"normalizedKey",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/BinaryIndexedSortable.java#L138-L148 | train | Write the index and normalized key. | [
30522,
5123,
11675,
4339,
22254,
10288,
5685,
12131,
9067,
3550,
14839,
1006,
2918,
10524,
2501,
1010,
2146,
12731,
18933,
21807,
3388,
1007,
1063,
1013,
1013,
5587,
1996,
20884,
1998,
1996,
3671,
3550,
3145,
2023,
1012,
14731,
11589,
22254,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/ml/IncrementalLearningSkeleton.java | IncrementalLearningSkeleton.main | public static void main(String[] args) throws Exception {
// Checking input parameters
final ParameterTool params = ParameterTool.fromArgs(args);
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
DataStream<Integer> trainingData = env.addSource(new FiniteTrainingDataSource());
DataStream<Integer> newData = env.addSource(new FiniteNewDataSource());
// build new model on every second of new data
DataStream<Double[]> model = trainingData
.assignTimestampsAndWatermarks(new LinearTimestamp())
.timeWindowAll(Time.of(5000, TimeUnit.MILLISECONDS))
.apply(new PartialModelBuilder());
// use partial model for newData
DataStream<Integer> prediction = newData.connect(model).map(new Predictor());
// emit result
if (params.has("output")) {
prediction.writeAsText(params.get("output"));
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
prediction.print();
}
// execute program
env.execute("Streaming Incremental Learning");
} | java | public static void main(String[] args) throws Exception {
// Checking input parameters
final ParameterTool params = ParameterTool.fromArgs(args);
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
DataStream<Integer> trainingData = env.addSource(new FiniteTrainingDataSource());
DataStream<Integer> newData = env.addSource(new FiniteNewDataSource());
// build new model on every second of new data
DataStream<Double[]> model = trainingData
.assignTimestampsAndWatermarks(new LinearTimestamp())
.timeWindowAll(Time.of(5000, TimeUnit.MILLISECONDS))
.apply(new PartialModelBuilder());
// use partial model for newData
DataStream<Integer> prediction = newData.connect(model).map(new Predictor());
// emit result
if (params.has("output")) {
prediction.writeAsText(params.get("output"));
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
prediction.print();
}
// execute program
env.execute("Streaming Incremental Learning");
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"// Checking input parameters",
"final",
"ParameterTool",
"params",
"=",
"ParameterTool",
".",
"fromArgs",
"(",
"args",
")",
";",
"StreamExecutionEnvironment",
"e... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/ml/IncrementalLearningSkeleton.java#L58-L88 | train | Main method to run the Streaming Incremental Learning program. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
1013,
1013,
9361,
7953,
11709,
2345,
16381,
3406,
4747,
11498,
5244,
1027,
16381,
3406,
4747,
1012,
2013,
2906,
5620,
1006,
12098,
5620,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java | QrCodeUtil.generatePng | public static byte[] generatePng(String content, QrConfig config) {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
generate(content, config, ImgUtil.IMAGE_TYPE_PNG, out);
return out.toByteArray();
} | java | public static byte[] generatePng(String content, QrConfig config) {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
generate(content, config, ImgUtil.IMAGE_TYPE_PNG, out);
return out.toByteArray();
} | [
"public",
"static",
"byte",
"[",
"]",
"generatePng",
"(",
"String",
"content",
",",
"QrConfig",
"config",
")",
"{",
"final",
"ByteArrayOutputStream",
"out",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"generate",
"(",
"content",
",",
"config",
",",
"... | 生成PNG格式的二维码图片,以byte[]形式表示
@param content 内容
@param config 二维码配置,包括长、宽、边距、颜色等
@return 图片的byte[]
@since 4.1.2 | [
"生成PNG格式的二维码图片,以byte",
"[]",
"形式表示"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L61-L65 | train | Generates a PNG image from the given content. | [
30522,
2270,
10763,
24880,
1031,
1033,
9699,
2361,
3070,
1006,
5164,
4180,
1010,
1053,
29566,
2078,
8873,
2290,
9530,
8873,
2290,
1007,
1063,
2345,
24880,
2906,
9447,
5833,
18780,
21422,
2041,
1027,
2047,
24880,
2906,
9447,
5833,
18780,
214... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java | IOManagerAsync.shutdown | @Override
public void shutdown() {
// mark shut down and exit if it already was shut down
if (!isShutdown.compareAndSet(false, true)) {
return;
}
// Remove shutdown hook to prevent resource leaks
ShutdownHookUtil.removeShutdownHook(shutdownHook, getClass().getSimpleName(), LOG);
try {
if (LOG.isDebugEnabled()) {
LOG.debug("Shutting down I/O manager.");
}
// close writing and reading threads with best effort and log problems
// first notify all to close, then wait until all are closed
for (WriterThread wt : writers) {
try {
wt.shutdown();
}
catch (Throwable t) {
LOG.error("Error while shutting down IO Manager writer thread.", t);
}
}
for (ReaderThread rt : readers) {
try {
rt.shutdown();
}
catch (Throwable t) {
LOG.error("Error while shutting down IO Manager reader thread.", t);
}
}
try {
for (WriterThread wt : writers) {
wt.join();
}
for (ReaderThread rt : readers) {
rt.join();
}
}
catch (InterruptedException iex) {
// ignore this on shutdown
}
}
finally {
// make sure we call the super implementation in any case and at the last point,
// because this will clean up the I/O directories
super.shutdown();
}
} | java | @Override
public void shutdown() {
// mark shut down and exit if it already was shut down
if (!isShutdown.compareAndSet(false, true)) {
return;
}
// Remove shutdown hook to prevent resource leaks
ShutdownHookUtil.removeShutdownHook(shutdownHook, getClass().getSimpleName(), LOG);
try {
if (LOG.isDebugEnabled()) {
LOG.debug("Shutting down I/O manager.");
}
// close writing and reading threads with best effort and log problems
// first notify all to close, then wait until all are closed
for (WriterThread wt : writers) {
try {
wt.shutdown();
}
catch (Throwable t) {
LOG.error("Error while shutting down IO Manager writer thread.", t);
}
}
for (ReaderThread rt : readers) {
try {
rt.shutdown();
}
catch (Throwable t) {
LOG.error("Error while shutting down IO Manager reader thread.", t);
}
}
try {
for (WriterThread wt : writers) {
wt.join();
}
for (ReaderThread rt : readers) {
rt.join();
}
}
catch (InterruptedException iex) {
// ignore this on shutdown
}
}
finally {
// make sure we call the super implementation in any case and at the last point,
// because this will clean up the I/O directories
super.shutdown();
}
} | [
"@",
"Override",
"public",
"void",
"shutdown",
"(",
")",
"{",
"// mark shut down and exit if it already was shut down",
"if",
"(",
"!",
"isShutdown",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"return",
";",
"}",
"// Remove shutdown hook to prev... | Close method. Shuts down the reader and writer threads immediately, not waiting for their
pending requests to be served. This method waits until the threads have actually ceased their
operation. | [
"Close",
"method",
".",
"Shuts",
"down",
"the",
"reader",
"and",
"writer",
"threads",
"immediately",
"not",
"waiting",
"for",
"their",
"pending",
"requests",
"to",
"be",
"served",
".",
"This",
"method",
"waits",
"until",
"the",
"threads",
"have",
"actually",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/IOManagerAsync.java#L111-L162 | train | Shuts down the IO Manager. | [
30522,
1030,
2058,
15637,
2270,
11675,
3844,
7698,
1006,
1007,
1063,
1013,
1013,
2928,
3844,
2091,
1998,
6164,
2065,
2009,
2525,
2001,
3844,
2091,
2065,
1006,
999,
26354,
6979,
2102,
7698,
1012,
12826,
29560,
3388,
1006,
6270,
1010,
2995,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java | SegmentsUtil.bitUnSet | public static void bitUnSet(MemorySegment segment, int baseOffset, int index) {
int offset = baseOffset + ((index & BIT_BYTE_POSITION_MASK) >>> 3);
byte current = segment.get(offset);
current &= ~(1 << (index & BIT_BYTE_INDEX_MASK));
segment.put(offset, current);
} | java | public static void bitUnSet(MemorySegment segment, int baseOffset, int index) {
int offset = baseOffset + ((index & BIT_BYTE_POSITION_MASK) >>> 3);
byte current = segment.get(offset);
current &= ~(1 << (index & BIT_BYTE_INDEX_MASK));
segment.put(offset, current);
} | [
"public",
"static",
"void",
"bitUnSet",
"(",
"MemorySegment",
"segment",
",",
"int",
"baseOffset",
",",
"int",
"index",
")",
"{",
"int",
"offset",
"=",
"baseOffset",
"+",
"(",
"(",
"index",
"&",
"BIT_BYTE_POSITION_MASK",
")",
">>>",
"3",
")",
";",
"byte",
... | unset bit.
@param segment target segment.
@param baseOffset bits base offset.
@param index bit index from base offset. | [
"unset",
"bit",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L419-L424 | train | Unset bit. | [
30522,
2270,
10763,
11675,
2978,
4609,
13462,
1006,
3638,
3366,
21693,
4765,
6903,
1010,
20014,
2918,
27475,
3388,
1010,
20014,
5950,
1007,
1063,
20014,
16396,
1027,
2918,
27475,
3388,
1009,
1006,
1006,
5950,
1004,
2978,
1035,
24880,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/SingleInputSemanticProperties.java | SingleInputSemanticProperties.addReadFields | public void addReadFields(FieldSet readFields) {
if (this.readFields == null) {
this.readFields = readFields;
} else {
this.readFields = this.readFields.addFields(readFields);
}
} | java | public void addReadFields(FieldSet readFields) {
if (this.readFields == null) {
this.readFields = readFields;
} else {
this.readFields = this.readFields.addFields(readFields);
}
} | [
"public",
"void",
"addReadFields",
"(",
"FieldSet",
"readFields",
")",
"{",
"if",
"(",
"this",
".",
"readFields",
"==",
"null",
")",
"{",
"this",
".",
"readFields",
"=",
"readFields",
";",
"}",
"else",
"{",
"this",
".",
"readFields",
"=",
"this",
".",
... | Adds, to the existing information, field(s) that are read in
the source record(s).
@param readFields the position(s) in the source record(s) | [
"Adds",
"to",
"the",
"existing",
"information",
"field",
"(",
"s",
")",
"that",
"are",
"read",
"in",
"the",
"source",
"record",
"(",
"s",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/SingleInputSemanticProperties.java#L117-L123 | train | Adds the given FieldSet to the read fields. | [
30522,
2270,
11675,
5587,
16416,
20952,
12891,
2015,
1006,
4249,
3388,
3191,
15155,
1007,
1063,
2065,
1006,
2023,
1012,
3191,
15155,
1027,
1027,
19701,
1007,
1063,
2023,
1012,
3191,
15155,
1027,
3191,
15155,
1025,
1065,
2842,
1063,
2023,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | handler/src/main/java/com/networknt/handler/Handler.java | Handler.initChains | static void initChains() {
if (config != null && config.getChains() != null) {
// add the chains to the handler list by id list.
for (String chainName : config.getChains().keySet()) {
List<String> chain = config.getChains().get(chainName);
List<HttpHandler> handlerChain = new ArrayList<>();
for (String chainItemName : chain) {
HttpHandler chainItem = handlers.get(chainItemName);
if (chainItem == null)
throw new RuntimeException("Chain " + chainName + " uses Unknown handler: " + chainItemName);
handlerChain.add(chainItem);
}
handlerListById.put(chainName, handlerChain);
}
}
} | java | static void initChains() {
if (config != null && config.getChains() != null) {
// add the chains to the handler list by id list.
for (String chainName : config.getChains().keySet()) {
List<String> chain = config.getChains().get(chainName);
List<HttpHandler> handlerChain = new ArrayList<>();
for (String chainItemName : chain) {
HttpHandler chainItem = handlers.get(chainItemName);
if (chainItem == null)
throw new RuntimeException("Chain " + chainName + " uses Unknown handler: " + chainItemName);
handlerChain.add(chainItem);
}
handlerListById.put(chainName, handlerChain);
}
}
} | [
"static",
"void",
"initChains",
"(",
")",
"{",
"if",
"(",
"config",
"!=",
"null",
"&&",
"config",
".",
"getChains",
"(",
")",
"!=",
"null",
")",
"{",
"// add the chains to the handler list by id list.",
"for",
"(",
"String",
"chainName",
":",
"config",
".",
... | Construct chains of handlers, if any are configured NOTE: It is recommended
to define reusable chains of handlers | [
"Construct",
"chains",
"of",
"handlers",
"if",
"any",
"are",
"configured",
"NOTE",
":",
"It",
"is",
"recommended",
"to",
"define",
"reusable",
"chains",
"of",
"handlers"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/handler/src/main/java/com/networknt/handler/Handler.java#L101-L116 | train | Initialize the chains. | [
30522,
10763,
11675,
1999,
20189,
28247,
1006,
1007,
1063,
2065,
1006,
9530,
8873,
2290,
999,
1027,
19701,
1004,
1004,
9530,
8873,
2290,
1012,
2131,
24925,
3619,
1006,
1007,
999,
1027,
19701,
1007,
1063,
1013,
1013,
5587,
1996,
8859,
2000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java | CLIService.fetchResults | @Override
public RowSet fetchResults(OperationHandle opHandle)
throws HiveSQLException {
return fetchResults(opHandle, Operation.DEFAULT_FETCH_ORIENTATION,
Operation.DEFAULT_FETCH_MAX_ROWS, FetchType.QUERY_OUTPUT);
} | java | @Override
public RowSet fetchResults(OperationHandle opHandle)
throws HiveSQLException {
return fetchResults(opHandle, Operation.DEFAULT_FETCH_ORIENTATION,
Operation.DEFAULT_FETCH_MAX_ROWS, FetchType.QUERY_OUTPUT);
} | [
"@",
"Override",
"public",
"RowSet",
"fetchResults",
"(",
"OperationHandle",
"opHandle",
")",
"throws",
"HiveSQLException",
"{",
"return",
"fetchResults",
"(",
"opHandle",
",",
"Operation",
".",
"DEFAULT_FETCH_ORIENTATION",
",",
"Operation",
".",
"DEFAULT_FETCH_MAX_ROWS... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#fetchResults(org.apache.hive.service.cli.OperationHandle) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java#L444-L449 | train | Fetch the result set of a
from the database. | [
30522,
1030,
2058,
15637,
2270,
10281,
3388,
18584,
6072,
11314,
2015,
1006,
3169,
11774,
2571,
6728,
11774,
2571,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
2709,
18584,
6072,
11314,
2015,
1006,
6728,
11774,
2571,
1010,
3169,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java | CLIService.getTables | @Override
public OperationHandle getTables(SessionHandle sessionHandle,
String catalogName, String schemaName, String tableName, List<String> tableTypes)
throws HiveSQLException {
OperationHandle opHandle = sessionManager.getSession(sessionHandle)
.getTables(catalogName, schemaName, tableName, tableTypes);
LOG.debug(sessionHandle + ": getTables()");
return opHandle;
} | java | @Override
public OperationHandle getTables(SessionHandle sessionHandle,
String catalogName, String schemaName, String tableName, List<String> tableTypes)
throws HiveSQLException {
OperationHandle opHandle = sessionManager.getSession(sessionHandle)
.getTables(catalogName, schemaName, tableName, tableTypes);
LOG.debug(sessionHandle + ": getTables()");
return opHandle;
} | [
"@",
"Override",
"public",
"OperationHandle",
"getTables",
"(",
"SessionHandle",
"sessionHandle",
",",
"String",
"catalogName",
",",
"String",
"schemaName",
",",
"String",
"tableName",
",",
"List",
"<",
"String",
">",
"tableTypes",
")",
"throws",
"HiveSQLException",... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#getTables(org.apache.hive.service.cli.SessionHandle, java.lang.String, java.lang.String, java.lang.String, java.util.List) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java#L321-L329 | train | Get tables. | [
30522,
1030,
2058,
15637,
2270,
3169,
11774,
2571,
2131,
10880,
2015,
1006,
5219,
11774,
2571,
5219,
11774,
2571,
1010,
5164,
12105,
18442,
1010,
5164,
8040,
28433,
18442,
1010,
5164,
2795,
18442,
1010,
2862,
1026,
5164,
1028,
13855,
18863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/JSONTokener.java | JSONTokener.toJSONArray | public JSONArray toJSONArray() {
JSONArray jsonArray = new JSONArray();
if (this.nextClean() != '[') {
throw this.syntaxError("A JSONArray text must start with '['");
}
if (this.nextClean() != ']') {
this.back();
while (true) {
if (this.nextClean() == ',') {
this.back();
jsonArray.add(JSONNull.NULL);
} else {
this.back();
jsonArray.add(this.nextValue());
}
switch (this.nextClean()) {
case ',':
if (this.nextClean() == ']') {
return jsonArray;
}
this.back();
break;
case ']':
return jsonArray;
default:
throw this.syntaxError("Expected a ',' or ']'");
}
}
}
return jsonArray;
} | java | public JSONArray toJSONArray() {
JSONArray jsonArray = new JSONArray();
if (this.nextClean() != '[') {
throw this.syntaxError("A JSONArray text must start with '['");
}
if (this.nextClean() != ']') {
this.back();
while (true) {
if (this.nextClean() == ',') {
this.back();
jsonArray.add(JSONNull.NULL);
} else {
this.back();
jsonArray.add(this.nextValue());
}
switch (this.nextClean()) {
case ',':
if (this.nextClean() == ']') {
return jsonArray;
}
this.back();
break;
case ']':
return jsonArray;
default:
throw this.syntaxError("Expected a ',' or ']'");
}
}
}
return jsonArray;
} | [
"public",
"JSONArray",
"toJSONArray",
"(",
")",
"{",
"JSONArray",
"jsonArray",
"=",
"new",
"JSONArray",
"(",
")",
";",
"if",
"(",
"this",
".",
"nextClean",
"(",
")",
"!=",
"'",
"'",
")",
"{",
"throw",
"this",
".",
"syntaxError",
"(",
"\"A JSONArray text ... | 转为 {@link JSONArray}
@return {@link JSONArray} | [
"转为",
"{",
"@link",
"JSONArray",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONTokener.java#L381-L411 | train | Returns the next JSONArray text in the input stream. | [
30522,
2270,
1046,
3385,
2906,
9447,
2000,
22578,
7856,
11335,
2100,
1006,
1007,
1063,
1046,
3385,
2906,
9447,
1046,
3385,
2906,
9447,
1027,
2047,
1046,
3385,
2906,
9447,
1006,
1007,
1025,
2065,
1006,
2023,
1012,
2279,
14321,
2319,
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-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSnapshotSerializationUtil.java | TypeSerializerSnapshotSerializationUtil.writeSerializerSnapshot | public static <T> void writeSerializerSnapshot(
DataOutputView out,
TypeSerializerSnapshot<T> serializerSnapshot,
TypeSerializer<T> serializer) throws IOException {
new TypeSerializerSnapshotSerializationProxy<>(serializerSnapshot, serializer).write(out);
} | java | public static <T> void writeSerializerSnapshot(
DataOutputView out,
TypeSerializerSnapshot<T> serializerSnapshot,
TypeSerializer<T> serializer) throws IOException {
new TypeSerializerSnapshotSerializationProxy<>(serializerSnapshot, serializer).write(out);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"writeSerializerSnapshot",
"(",
"DataOutputView",
"out",
",",
"TypeSerializerSnapshot",
"<",
"T",
">",
"serializerSnapshot",
",",
"TypeSerializer",
"<",
"T",
">",
"serializer",
")",
"throws",
"IOException",
"{",
"new",
... | Writes a {@link TypeSerializerSnapshot} to the provided data output view.
<p>It is written with a format that can be later read again using
{@link #readSerializerSnapshot(DataInputView, ClassLoader, TypeSerializer)}.
@param out the data output view
@param serializerSnapshot the serializer configuration snapshot to write
@param serializer the prior serializer. This needs to be written of the serializer snapshot
if the serializer snapshot is still the legacy {@link TypeSerializerConfigSnapshot}. | [
"Writes",
"a",
"{",
"@link",
"TypeSerializerSnapshot",
"}",
"to",
"the",
"provided",
"data",
"output",
"view",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSnapshotSerializationUtil.java#L50-L56 | train | Write a serializer snapshot. | [
30522,
2270,
10763,
1026,
1056,
1028,
11675,
7009,
11610,
28863,
2015,
2532,
4523,
12326,
1006,
2951,
5833,
18780,
8584,
2041,
1010,
4127,
11610,
28863,
2015,
2532,
4523,
12326,
1026,
1056,
1028,
7642,
17629,
2015,
2532,
4523,
12326,
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/io/network/netty/CreditBasedPartitionRequestClientHandler.java | CreditBasedPartitionRequestClientHandler.checkError | private void checkError() throws IOException {
final Throwable t = channelError.get();
if (t != null) {
if (t instanceof IOException) {
throw (IOException) t;
} else {
throw new IOException("There has been an error in the channel.", t);
}
}
} | java | private void checkError() throws IOException {
final Throwable t = channelError.get();
if (t != null) {
if (t instanceof IOException) {
throw (IOException) t;
} else {
throw new IOException("There has been an error in the channel.", t);
}
}
} | [
"private",
"void",
"checkError",
"(",
")",
"throws",
"IOException",
"{",
"final",
"Throwable",
"t",
"=",
"channelError",
".",
"get",
"(",
")",
";",
"if",
"(",
"t",
"!=",
"null",
")",
"{",
"if",
"(",
"t",
"instanceof",
"IOException",
")",
"{",
"throw",
... | Checks for an error and rethrows it if one was reported. | [
"Checks",
"for",
"an",
"error",
"and",
"rethrows",
"it",
"if",
"one",
"was",
"reported",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/CreditBasedPartitionRequestClientHandler.java#L232-L242 | train | Check if there has been an error in the channel. | [
30522,
2797,
11675,
4638,
2121,
29165,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
5466,
3085,
1056,
1027,
3149,
2121,
29165,
1012,
2131,
1006,
1007,
1025,
2065,
1006,
1056,
999,
1027,
19701,
1007,
1063,
2065,
1006,
1056,
6013,
1125... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/NFA.java | NFA.computeNextStates | private Collection<ComputationState> computeNextStates(
final SharedBufferAccessor<T> sharedBufferAccessor,
final ComputationState computationState,
final EventWrapper event,
final TimerService timerService) throws Exception {
final ConditionContext context = new ConditionContext(
sharedBufferAccessor,
computationState,
timerService,
event.getTimestamp());
final OutgoingEdges<T> outgoingEdges = createDecisionGraph(context, computationState, event.getEvent());
// Create the computing version based on the previously computed edges
// We need to defer the creation of computation states until we know how many edges start
// at this computation state so that we can assign proper version
final List<StateTransition<T>> edges = outgoingEdges.getEdges();
int takeBranchesToVisit = Math.max(0, outgoingEdges.getTotalTakeBranches() - 1);
int ignoreBranchesToVisit = outgoingEdges.getTotalIgnoreBranches();
int totalTakeToSkip = Math.max(0, outgoingEdges.getTotalTakeBranches() - 1);
final List<ComputationState> resultingComputationStates = new ArrayList<>();
for (StateTransition<T> edge : edges) {
switch (edge.getAction()) {
case IGNORE: {
if (!isStartState(computationState)) {
final DeweyNumber version;
if (isEquivalentState(edge.getTargetState(), getState(computationState))) {
//Stay in the same state (it can be either looping one or singleton)
final int toIncrease = calculateIncreasingSelfState(
outgoingEdges.getTotalIgnoreBranches(),
outgoingEdges.getTotalTakeBranches());
version = computationState.getVersion().increase(toIncrease);
} else {
//IGNORE after PROCEED
version = computationState.getVersion()
.increase(totalTakeToSkip + ignoreBranchesToVisit)
.addStage();
ignoreBranchesToVisit--;
}
addComputationState(
sharedBufferAccessor,
resultingComputationStates,
edge.getTargetState(),
computationState.getPreviousBufferEntry(),
version,
computationState.getStartTimestamp(),
computationState.getStartEventID()
);
}
}
break;
case TAKE:
final State<T> nextState = edge.getTargetState();
final State<T> currentState = edge.getSourceState();
final NodeId previousEntry = computationState.getPreviousBufferEntry();
final DeweyNumber currentVersion = computationState.getVersion().increase(takeBranchesToVisit);
final DeweyNumber nextVersion = new DeweyNumber(currentVersion).addStage();
takeBranchesToVisit--;
final NodeId newEntry = sharedBufferAccessor.put(
currentState.getName(),
event.getEventId(),
previousEntry,
currentVersion);
final long startTimestamp;
final EventId startEventId;
if (isStartState(computationState)) {
startTimestamp = event.getTimestamp();
startEventId = event.getEventId();
} else {
startTimestamp = computationState.getStartTimestamp();
startEventId = computationState.getStartEventID();
}
addComputationState(
sharedBufferAccessor,
resultingComputationStates,
nextState,
newEntry,
nextVersion,
startTimestamp,
startEventId);
//check if newly created state is optional (have a PROCEED path to Final state)
final State<T> finalState = findFinalStateAfterProceed(context, nextState, event.getEvent());
if (finalState != null) {
addComputationState(
sharedBufferAccessor,
resultingComputationStates,
finalState,
newEntry,
nextVersion,
startTimestamp,
startEventId);
}
break;
}
}
if (isStartState(computationState)) {
int totalBranches = calculateIncreasingSelfState(
outgoingEdges.getTotalIgnoreBranches(),
outgoingEdges.getTotalTakeBranches());
DeweyNumber startVersion = computationState.getVersion().increase(totalBranches);
ComputationState startState = ComputationState.createStartState(computationState.getCurrentStateName(), startVersion);
resultingComputationStates.add(startState);
}
if (computationState.getPreviousBufferEntry() != null) {
// release the shared entry referenced by the current computation state.
sharedBufferAccessor.releaseNode(computationState.getPreviousBufferEntry());
}
return resultingComputationStates;
} | java | private Collection<ComputationState> computeNextStates(
final SharedBufferAccessor<T> sharedBufferAccessor,
final ComputationState computationState,
final EventWrapper event,
final TimerService timerService) throws Exception {
final ConditionContext context = new ConditionContext(
sharedBufferAccessor,
computationState,
timerService,
event.getTimestamp());
final OutgoingEdges<T> outgoingEdges = createDecisionGraph(context, computationState, event.getEvent());
// Create the computing version based on the previously computed edges
// We need to defer the creation of computation states until we know how many edges start
// at this computation state so that we can assign proper version
final List<StateTransition<T>> edges = outgoingEdges.getEdges();
int takeBranchesToVisit = Math.max(0, outgoingEdges.getTotalTakeBranches() - 1);
int ignoreBranchesToVisit = outgoingEdges.getTotalIgnoreBranches();
int totalTakeToSkip = Math.max(0, outgoingEdges.getTotalTakeBranches() - 1);
final List<ComputationState> resultingComputationStates = new ArrayList<>();
for (StateTransition<T> edge : edges) {
switch (edge.getAction()) {
case IGNORE: {
if (!isStartState(computationState)) {
final DeweyNumber version;
if (isEquivalentState(edge.getTargetState(), getState(computationState))) {
//Stay in the same state (it can be either looping one or singleton)
final int toIncrease = calculateIncreasingSelfState(
outgoingEdges.getTotalIgnoreBranches(),
outgoingEdges.getTotalTakeBranches());
version = computationState.getVersion().increase(toIncrease);
} else {
//IGNORE after PROCEED
version = computationState.getVersion()
.increase(totalTakeToSkip + ignoreBranchesToVisit)
.addStage();
ignoreBranchesToVisit--;
}
addComputationState(
sharedBufferAccessor,
resultingComputationStates,
edge.getTargetState(),
computationState.getPreviousBufferEntry(),
version,
computationState.getStartTimestamp(),
computationState.getStartEventID()
);
}
}
break;
case TAKE:
final State<T> nextState = edge.getTargetState();
final State<T> currentState = edge.getSourceState();
final NodeId previousEntry = computationState.getPreviousBufferEntry();
final DeweyNumber currentVersion = computationState.getVersion().increase(takeBranchesToVisit);
final DeweyNumber nextVersion = new DeweyNumber(currentVersion).addStage();
takeBranchesToVisit--;
final NodeId newEntry = sharedBufferAccessor.put(
currentState.getName(),
event.getEventId(),
previousEntry,
currentVersion);
final long startTimestamp;
final EventId startEventId;
if (isStartState(computationState)) {
startTimestamp = event.getTimestamp();
startEventId = event.getEventId();
} else {
startTimestamp = computationState.getStartTimestamp();
startEventId = computationState.getStartEventID();
}
addComputationState(
sharedBufferAccessor,
resultingComputationStates,
nextState,
newEntry,
nextVersion,
startTimestamp,
startEventId);
//check if newly created state is optional (have a PROCEED path to Final state)
final State<T> finalState = findFinalStateAfterProceed(context, nextState, event.getEvent());
if (finalState != null) {
addComputationState(
sharedBufferAccessor,
resultingComputationStates,
finalState,
newEntry,
nextVersion,
startTimestamp,
startEventId);
}
break;
}
}
if (isStartState(computationState)) {
int totalBranches = calculateIncreasingSelfState(
outgoingEdges.getTotalIgnoreBranches(),
outgoingEdges.getTotalTakeBranches());
DeweyNumber startVersion = computationState.getVersion().increase(totalBranches);
ComputationState startState = ComputationState.createStartState(computationState.getCurrentStateName(), startVersion);
resultingComputationStates.add(startState);
}
if (computationState.getPreviousBufferEntry() != null) {
// release the shared entry referenced by the current computation state.
sharedBufferAccessor.releaseNode(computationState.getPreviousBufferEntry());
}
return resultingComputationStates;
} | [
"private",
"Collection",
"<",
"ComputationState",
">",
"computeNextStates",
"(",
"final",
"SharedBufferAccessor",
"<",
"T",
">",
"sharedBufferAccessor",
",",
"final",
"ComputationState",
"computationState",
",",
"final",
"EventWrapper",
"event",
",",
"final",
"TimerServ... | Computes the next computation states based on the given computation state, the current event,
its timestamp and the internal state machine. The algorithm is:
<ol>
<li>Decide on valid transitions and number of branching paths. See {@link OutgoingEdges}</li>
<li>Perform transitions:
<ol>
<li>IGNORE (links in {@link SharedBuffer} will still point to the previous event)</li>
<ul>
<li>do not perform for Start State - special case</li>
<li>if stays in the same state increase the current stage for future use with number of outgoing edges</li>
<li>if after PROCEED increase current stage and add new stage (as we change the state)</li>
<li>lock the entry in {@link SharedBuffer} as it is needed in the created branch</li>
</ul>
<li>TAKE (links in {@link SharedBuffer} will point to the current event)</li>
<ul>
<li>add entry to the shared buffer with version of the current computation state</li>
<li>add stage and then increase with number of takes for the future computation states</li>
<li>peek to the next state if it has PROCEED path to a Final State, if true create Final
ComputationState to emit results</li>
</ul>
</ol>
</li>
<li>Handle the Start State, as it always have to remain </li>
<li>Release the corresponding entries in {@link SharedBuffer}.</li>
</ol>
@param sharedBufferAccessor The accessor to shared buffer that we need to change
@param computationState Current computation state
@param event Current event which is processed
@param timerService timer service which provides access to time related features
@return Collection of computation states which result from the current one
@throws Exception Thrown if the system cannot access the state. | [
"Computes",
"the",
"next",
"computation",
"states",
"based",
"on",
"the",
"given",
"computation",
"state",
"the",
"current",
"event",
"its",
"timestamp",
"and",
"the",
"internal",
"state",
"machine",
".",
"The",
"algorithm",
"is",
":",
"<ol",
">",
"<li",
">"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/NFA.java#L539-L660 | train | Compute the next states. | [
30522,
2797,
3074,
1026,
22334,
9153,
2618,
1028,
24134,
2638,
18413,
9153,
4570,
1006,
2345,
4207,
8569,
12494,
6305,
9623,
21748,
1026,
1056,
1028,
4207,
8569,
12494,
6305,
9623,
21748,
1010,
2345,
22334,
9153,
2618,
22334,
9153,
2618,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/util/ExecutorThreadFactory.java | ExecutorThreadFactory.newThread | @Override
public Thread newThread(Runnable runnable) {
Thread t = new Thread(group, runnable, namePrefix + threadNumber.getAndIncrement());
t.setDaemon(true);
t.setPriority(threadPriority);
// optional handler for uncaught exceptions
if (exceptionHandler != null) {
t.setUncaughtExceptionHandler(exceptionHandler);
}
return t;
} | java | @Override
public Thread newThread(Runnable runnable) {
Thread t = new Thread(group, runnable, namePrefix + threadNumber.getAndIncrement());
t.setDaemon(true);
t.setPriority(threadPriority);
// optional handler for uncaught exceptions
if (exceptionHandler != null) {
t.setUncaughtExceptionHandler(exceptionHandler);
}
return t;
} | [
"@",
"Override",
"public",
"Thread",
"newThread",
"(",
"Runnable",
"runnable",
")",
"{",
"Thread",
"t",
"=",
"new",
"Thread",
"(",
"group",
",",
"runnable",
",",
"namePrefix",
"+",
"threadNumber",
".",
"getAndIncrement",
"(",
")",
")",
";",
"t",
".",
"se... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/ExecutorThreadFactory.java#L107-L120 | train | Creates a new thread with the specified runnable. | [
30522,
1030,
2058,
15637,
2270,
11689,
25597,
28362,
4215,
1006,
2448,
22966,
2448,
22966,
1007,
1063,
11689,
1056,
1027,
2047,
11689,
1006,
2177,
1010,
2448,
22966,
1010,
2171,
28139,
8873,
2595,
1009,
11689,
19172,
5677,
1012,
2131,
5685,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/StaticLog.java | StaticLog.warn | public static void warn(Throwable e, String format, Object... arguments) {
warn(LogFactory.get(CallerUtil.getCallerCaller()), e, StrUtil.format(format, arguments));
} | java | public static void warn(Throwable e, String format, Object... arguments) {
warn(LogFactory.get(CallerUtil.getCallerCaller()), e, StrUtil.format(format, arguments));
} | [
"public",
"static",
"void",
"warn",
"(",
"Throwable",
"e",
",",
"String",
"format",
",",
"Object",
"...",
"arguments",
")",
"{",
"warn",
"(",
"LogFactory",
".",
"get",
"(",
"CallerUtil",
".",
"getCallerCaller",
"(",
")",
")",
",",
"e",
",",
"StrUtil",
... | Warn等级日志,小于Error<br>
由于动态获取Log,效率较低,建议在非频繁调用的情况下使用!!
@param e 需在日志中堆栈打印的异常
@param format 格式文本,{} 代表变量
@param arguments 变量对应的参数 | [
"Warn等级日志,小于Error<br",
">",
"由于动态获取Log,效率较低,建议在非频繁调用的情况下使用!!"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/StaticLog.java#L115-L117 | train | Logs a WARN level message with a throwable. | [
30522,
2270,
10763,
11675,
11582,
1006,
5466,
3085,
1041,
1010,
5164,
4289,
1010,
4874,
1012,
1012,
1012,
9918,
1007,
1063,
11582,
1006,
8833,
21450,
1012,
2131,
1006,
20587,
21823,
2140,
1012,
2131,
9289,
3917,
9289,
3917,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/api/BatchResult.java | BatchResult.subList | @Deprecated
public List<E> subList(int fromIndex, int toIndex) {
return responses.subList(fromIndex, toIndex);
} | java | @Deprecated
public List<E> subList(int fromIndex, int toIndex) {
return responses.subList(fromIndex, toIndex);
} | [
"@",
"Deprecated",
"public",
"List",
"<",
"E",
">",
"subList",
"(",
"int",
"fromIndex",
",",
"int",
"toIndex",
")",
"{",
"return",
"responses",
".",
"subList",
"(",
"fromIndex",
",",
"toIndex",
")",
";",
"}"
] | Use {@link #getResponses()} | [
"Use",
"{"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/BatchResult.java#L236-L239 | train | Returns a sub - list of the sequence of tokens. | [
30522,
1030,
2139,
28139,
12921,
2270,
2862,
1026,
1041,
1028,
4942,
9863,
1006,
20014,
2013,
22254,
10288,
1010,
20014,
2000,
22254,
10288,
1007,
1063,
2709,
10960,
1012,
4942,
9863,
1006,
2013,
22254,
10288,
1010,
2000,
22254,
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... |
networknt/light-4j | service/src/main/java/com/networknt/service/ServiceUtil.java | ServiceUtil.constructByParameterizedConstructor | public static Object constructByParameterizedConstructor(Class clazz, List parameters) throws Exception {
// find out how many constructors this class has and match the one with the same sequence of
// parameters.
Object instance = null;
Constructor[] allConstructors = clazz.getDeclaredConstructors();
// iterate all constructors of this class and try each non-default one with parameters
// from parameter list also flag if there is default constructor without argument.
boolean hasDefaultConstructor = false;
for (Constructor ctor : allConstructors) {
Class<?>[] pType = ctor.getParameterTypes();
if(pType.length > 0) {
if(pType.length == parameters.size()) {
// number of parameters is matched. Make sure that each parameter type is matched.
boolean matched = true;
Object[] params = new Object[pType.length];
for (int j = 0; j < pType.length; j++) {
//System.out.println("pType = " + pType[j]);
Map<String, Object> parameter = (Map)parameters.get(j);
Iterator it = parameter.entrySet().iterator();
if (it.hasNext()) { // there is only one object in each item.
Map.Entry<String, Object> pair = (Map.Entry) it.next();
String key = pair.getKey();
Object value = pair.getValue();
if(pType[j].getName().equals(key)) {
params[j] = value;
} else {
matched = false;
break;
}
}
}
if(matched) {
// this constructor parameters are found.
instance = ctor.newInstance(params);
break;
}
}
} else {
hasDefaultConstructor = true;
}
}
if(instance != null) {
return instance;
} else {
if(hasDefaultConstructor) {
return clazz.getConstructor().newInstance();
} else {
// error that no instance can be created.
throw new Exception("No instance can be created for class " + clazz);
}
}
} | java | public static Object constructByParameterizedConstructor(Class clazz, List parameters) throws Exception {
// find out how many constructors this class has and match the one with the same sequence of
// parameters.
Object instance = null;
Constructor[] allConstructors = clazz.getDeclaredConstructors();
// iterate all constructors of this class and try each non-default one with parameters
// from parameter list also flag if there is default constructor without argument.
boolean hasDefaultConstructor = false;
for (Constructor ctor : allConstructors) {
Class<?>[] pType = ctor.getParameterTypes();
if(pType.length > 0) {
if(pType.length == parameters.size()) {
// number of parameters is matched. Make sure that each parameter type is matched.
boolean matched = true;
Object[] params = new Object[pType.length];
for (int j = 0; j < pType.length; j++) {
//System.out.println("pType = " + pType[j]);
Map<String, Object> parameter = (Map)parameters.get(j);
Iterator it = parameter.entrySet().iterator();
if (it.hasNext()) { // there is only one object in each item.
Map.Entry<String, Object> pair = (Map.Entry) it.next();
String key = pair.getKey();
Object value = pair.getValue();
if(pType[j].getName().equals(key)) {
params[j] = value;
} else {
matched = false;
break;
}
}
}
if(matched) {
// this constructor parameters are found.
instance = ctor.newInstance(params);
break;
}
}
} else {
hasDefaultConstructor = true;
}
}
if(instance != null) {
return instance;
} else {
if(hasDefaultConstructor) {
return clazz.getConstructor().newInstance();
} else {
// error that no instance can be created.
throw new Exception("No instance can be created for class " + clazz);
}
}
} | [
"public",
"static",
"Object",
"constructByParameterizedConstructor",
"(",
"Class",
"clazz",
",",
"List",
"parameters",
")",
"throws",
"Exception",
"{",
"// find out how many constructors this class has and match the one with the same sequence of",
"// parameters.",
"Object",
"insta... | Build an object out of a given class and a list of single element maps of object type to value.
A constructor is searched for that matches the given set. If not found, the default is attempted.
@param clazz The class to be created.
@param parameters A list of single element maps of object type to value.
@return An instantiated parameters.
@throws Exception when no instance can be created | [
"Build",
"an",
"object",
"out",
"of",
"a",
"given",
"class",
"and",
"a",
"list",
"of",
"single",
"element",
"maps",
"of",
"object",
"type",
"to",
"value",
".",
"A",
"constructor",
"is",
"searched",
"for",
"that",
"matches",
"the",
"given",
"set",
".",
... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/ServiceUtil.java#L92-L143 | train | Construct by parameterized constructor. | [
30522,
2270,
10763,
4874,
9570,
3762,
28689,
22828,
3550,
8663,
3367,
6820,
16761,
1006,
2465,
18856,
10936,
2480,
1010,
2862,
11709,
1007,
11618,
6453,
1063,
1013,
1013,
2424,
2041,
2129,
2116,
9570,
5668,
2023,
2465,
2038,
1998,
2674,
199... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ObjectUtil.java | ObjectUtil.getTypeArgument | public static Class<?> getTypeArgument(Object obj, int index) {
return ClassUtil.getTypeArgument(obj.getClass(), index);
} | java | public static Class<?> getTypeArgument(Object obj, int index) {
return ClassUtil.getTypeArgument(obj.getClass(), index);
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getTypeArgument",
"(",
"Object",
"obj",
",",
"int",
"index",
")",
"{",
"return",
"ClassUtil",
".",
"getTypeArgument",
"(",
"obj",
".",
"getClass",
"(",
")",
",",
"index",
")",
";",
"}"
] | 获得给定类的第一个泛型参数
@param obj 被检查的对象
@param index 泛型类型的索引号,既第几个泛型类型
@return {@link Class}
@since 3.0.8 | [
"获得给定类的第一个泛型参数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ObjectUtil.java#L475-L477 | train | Gets the type argument of the object at the given index. | [
30522,
2270,
10763,
2465,
1026,
1029,
1028,
2131,
13874,
2906,
22850,
4765,
1006,
4874,
27885,
3501,
1010,
20014,
5950,
1007,
1063,
2709,
2465,
21823,
2140,
1012,
2131,
13874,
2906,
22850,
4765,
1006,
27885,
3501,
1012,
2131,
26266,
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... |
alibaba/canal | server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java | CanalServerWithEmbedded.getEvents | private Events<Event> getEvents(CanalEventStore eventStore, Position start, int batchSize, Long timeout,
TimeUnit unit) {
if (timeout == null) {
return eventStore.tryGet(start, batchSize);
} else {
try {
if (timeout <= 0) {
return eventStore.get(start, batchSize);
} else {
return eventStore.get(start, batchSize, timeout, unit);
}
} catch (Exception e) {
throw new CanalServerException(e);
}
}
} | java | private Events<Event> getEvents(CanalEventStore eventStore, Position start, int batchSize, Long timeout,
TimeUnit unit) {
if (timeout == null) {
return eventStore.tryGet(start, batchSize);
} else {
try {
if (timeout <= 0) {
return eventStore.get(start, batchSize);
} else {
return eventStore.get(start, batchSize, timeout, unit);
}
} catch (Exception e) {
throw new CanalServerException(e);
}
}
} | [
"private",
"Events",
"<",
"Event",
">",
"getEvents",
"(",
"CanalEventStore",
"eventStore",
",",
"Position",
"start",
",",
"int",
"batchSize",
",",
"Long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"if",
"(",
"timeout",
"==",
"null",
")",
"{",
"return",... | 根据不同的参数,选择不同的方式获取数据 | [
"根据不同的参数,选择不同的方式获取数据"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/server/src/main/java/com/alibaba/otter/canal/server/embedded/CanalServerWithEmbedded.java#L505-L520 | train | Gets the events from the event store. | [
30522,
2797,
2824,
1026,
2724,
1028,
2131,
18697,
7666,
1006,
5033,
18697,
7666,
19277,
2824,
19277,
1010,
2597,
2707,
1010,
20014,
14108,
5332,
4371,
1010,
2146,
2051,
5833,
1010,
2051,
19496,
2102,
3131,
1007,
1063,
2065,
1006,
2051,
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-formats/flink-avro-confluent-registry/src/main/java/org/apache/flink/formats/avro/registry/confluent/ConfluentRegistryAvroDeserializationSchema.java | ConfluentRegistryAvroDeserializationSchema.forSpecific | public static <T extends SpecificRecord> ConfluentRegistryAvroDeserializationSchema<T> forSpecific(Class<T> tClass,
String url) {
return forSpecific(tClass, url, DEFAULT_IDENTITY_MAP_CAPACITY);
} | java | public static <T extends SpecificRecord> ConfluentRegistryAvroDeserializationSchema<T> forSpecific(Class<T> tClass,
String url) {
return forSpecific(tClass, url, DEFAULT_IDENTITY_MAP_CAPACITY);
} | [
"public",
"static",
"<",
"T",
"extends",
"SpecificRecord",
">",
"ConfluentRegistryAvroDeserializationSchema",
"<",
"T",
">",
"forSpecific",
"(",
"Class",
"<",
"T",
">",
"tClass",
",",
"String",
"url",
")",
"{",
"return",
"forSpecific",
"(",
"tClass",
",",
"url... | Creates {@link AvroDeserializationSchema} that produces classes that were generated from avro
schema and looks up writer schema in Confluent Schema Registry.
@param tClass class of record to be produced
@param url url of schema registry to connect
@return deserialized record | [
"Creates",
"{",
"@link",
"AvroDeserializationSchema",
"}",
"that",
"produces",
"classes",
"that",
"were",
"generated",
"from",
"avro",
"schema",
"and",
"looks",
"up",
"writer",
"schema",
"in",
"Confluent",
"Schema",
"Registry",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro-confluent-registry/src/main/java/org/apache/flink/formats/avro/registry/confluent/ConfluentRegistryAvroDeserializationSchema.java#L95-L98 | train | Returns a schema for a specific Avro type. | [
30522,
2270,
10763,
1026,
1056,
8908,
3563,
2890,
27108,
2094,
1028,
9530,
10258,
24997,
7913,
24063,
20444,
19716,
19847,
11610,
22731,
22842,
2863,
1026,
1056,
1028,
2005,
13102,
8586,
18513,
1006,
2465,
1026,
1056,
1028,
22975,
27102,
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-script/src/main/java/cn/hutool/script/FullSupportScriptEngine.java | FullSupportScriptEngine.invokeMethod | @Override
public Object invokeMethod(Object thiz, String name, Object... args) throws ScriptException, NoSuchMethodException {
return ((Invocable) engine).invokeMethod(thiz, name, args);
} | java | @Override
public Object invokeMethod(Object thiz, String name, Object... args) throws ScriptException, NoSuchMethodException {
return ((Invocable) engine).invokeMethod(thiz, name, args);
} | [
"@",
"Override",
"public",
"Object",
"invokeMethod",
"(",
"Object",
"thiz",
",",
"String",
"name",
",",
"Object",
"...",
"args",
")",
"throws",
"ScriptException",
",",
"NoSuchMethodException",
"{",
"return",
"(",
"(",
"Invocable",
")",
"engine",
")",
".",
"i... | ----------------------------------------------------------------------------------------------- Invocable | [
"-----------------------------------------------------------------------------------------------",
"Invocable"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-script/src/main/java/cn/hutool/script/FullSupportScriptEngine.java#L57-L60 | train | Override this method to allow subclasses to override the default implementation of the method. | [
30522,
1030,
2058,
15637,
2270,
4874,
1999,
6767,
3489,
11368,
6806,
2094,
1006,
4874,
16215,
10993,
1010,
5164,
2171,
1010,
4874,
1012,
1012,
1012,
12098,
5620,
1007,
11618,
5896,
10288,
24422,
1010,
16839,
10875,
11368,
6806,
3207,
2595,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpBase.java | HttpBase.addHeaders | public T addHeaders(Map<String, String> headers) {
if(CollectionUtil.isEmpty(headers)) {
return (T)this;
}
for (Entry<String,String> entry : headers.entrySet()) {
this.header(entry.getKey(), StrUtil.nullToEmpty(entry.getValue()), false);
}
return (T)this;
} | java | public T addHeaders(Map<String, String> headers) {
if(CollectionUtil.isEmpty(headers)) {
return (T)this;
}
for (Entry<String,String> entry : headers.entrySet()) {
this.header(entry.getKey(), StrUtil.nullToEmpty(entry.getValue()), false);
}
return (T)this;
} | [
"public",
"T",
"addHeaders",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"{",
"if",
"(",
"CollectionUtil",
".",
"isEmpty",
"(",
"headers",
")",
")",
"{",
"return",
"(",
"T",
")",
"this",
";",
"}",
"for",
"(",
"Entry",
"<",
"Strin... | 新增请求头<br>
不覆盖原有请求头
@param headers 请求头
@return this
@since 4.0.3 | [
"新增请求头<br",
">",
"不覆盖原有请求头"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpBase.java#L180-L189 | train | Adds the specified headers to the response. | [
30522,
2270,
1056,
5587,
4974,
2545,
1006,
4949,
1026,
5164,
1010,
5164,
1028,
20346,
2015,
1007,
1063,
2065,
1006,
3074,
21823,
2140,
1012,
2003,
6633,
13876,
2100,
1006,
20346,
2015,
1007,
1007,
1063,
2709,
1006,
1056,
1007,
2023,
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... |
netty/netty | codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java | ByteToMessageDecoder.callDecode | protected void callDecode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
try {
while (in.isReadable()) {
int outSize = out.size();
if (outSize > 0) {
fireChannelRead(ctx, out, outSize);
out.clear();
// Check if this handler was removed before continuing with decoding.
// If it was removed, it is not safe to continue to operate on the buffer.
//
// See:
// - https://github.com/netty/netty/issues/4635
if (ctx.isRemoved()) {
break;
}
outSize = 0;
}
int oldInputLength = in.readableBytes();
decodeRemovalReentryProtection(ctx, in, out);
// Check if this handler was removed before continuing the loop.
// If it was removed, it is not safe to continue to operate on the buffer.
//
// See https://github.com/netty/netty/issues/1664
if (ctx.isRemoved()) {
break;
}
if (outSize == out.size()) {
if (oldInputLength == in.readableBytes()) {
break;
} else {
continue;
}
}
if (oldInputLength == in.readableBytes()) {
throw new DecoderException(
StringUtil.simpleClassName(getClass()) +
".decode() did not read anything but decoded a message.");
}
if (isSingleDecode()) {
break;
}
}
} catch (DecoderException e) {
throw e;
} catch (Exception cause) {
throw new DecoderException(cause);
}
} | java | protected void callDecode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
try {
while (in.isReadable()) {
int outSize = out.size();
if (outSize > 0) {
fireChannelRead(ctx, out, outSize);
out.clear();
// Check if this handler was removed before continuing with decoding.
// If it was removed, it is not safe to continue to operate on the buffer.
//
// See:
// - https://github.com/netty/netty/issues/4635
if (ctx.isRemoved()) {
break;
}
outSize = 0;
}
int oldInputLength = in.readableBytes();
decodeRemovalReentryProtection(ctx, in, out);
// Check if this handler was removed before continuing the loop.
// If it was removed, it is not safe to continue to operate on the buffer.
//
// See https://github.com/netty/netty/issues/1664
if (ctx.isRemoved()) {
break;
}
if (outSize == out.size()) {
if (oldInputLength == in.readableBytes()) {
break;
} else {
continue;
}
}
if (oldInputLength == in.readableBytes()) {
throw new DecoderException(
StringUtil.simpleClassName(getClass()) +
".decode() did not read anything but decoded a message.");
}
if (isSingleDecode()) {
break;
}
}
} catch (DecoderException e) {
throw e;
} catch (Exception cause) {
throw new DecoderException(cause);
}
} | [
"protected",
"void",
"callDecode",
"(",
"ChannelHandlerContext",
"ctx",
",",
"ByteBuf",
"in",
",",
"List",
"<",
"Object",
">",
"out",
")",
"{",
"try",
"{",
"while",
"(",
"in",
".",
"isReadable",
"(",
")",
")",
"{",
"int",
"outSize",
"=",
"out",
".",
... | Called once data should be decoded from the given {@link ByteBuf}. This method will call
{@link #decode(ChannelHandlerContext, ByteBuf, List)} as long as decoding should take place.
@param ctx the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to
@param in the {@link ByteBuf} from which to read data
@param out the {@link List} to which decoded messages should be added | [
"Called",
"once",
"data",
"should",
"be",
"decoded",
"from",
"the",
"given",
"{",
"@link",
"ByteBuf",
"}",
".",
"This",
"method",
"will",
"call",
"{",
"@link",
"#decode",
"(",
"ChannelHandlerContext",
"ByteBuf",
"List",
")",
"}",
"as",
"long",
"as",
"decod... | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java#L420-L474 | train | Call the decode method of the IIMHandler. | [
30522,
5123,
11675,
2655,
3207,
16044,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
24880,
8569,
2546,
1999,
1010,
2862,
1026,
4874,
1028,
2041,
1007,
1063,
3046,
1063,
2096,
1006,
1999,
1012,
2003,
16416,
20782,
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... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/function/FunctionUtils.java | FunctionUtils.uncheckedFunction | public static <A, B> Function<A, B> uncheckedFunction(FunctionWithException<A, B, ?> functionWithException) {
return (A value) -> {
try {
return functionWithException.apply(value);
} catch (Throwable t) {
ExceptionUtils.rethrow(t);
// we need this to appease the compiler :-(
return null;
}
};
} | java | public static <A, B> Function<A, B> uncheckedFunction(FunctionWithException<A, B, ?> functionWithException) {
return (A value) -> {
try {
return functionWithException.apply(value);
} catch (Throwable t) {
ExceptionUtils.rethrow(t);
// we need this to appease the compiler :-(
return null;
}
};
} | [
"public",
"static",
"<",
"A",
",",
"B",
">",
"Function",
"<",
"A",
",",
"B",
">",
"uncheckedFunction",
"(",
"FunctionWithException",
"<",
"A",
",",
"B",
",",
"?",
">",
"functionWithException",
")",
"{",
"return",
"(",
"A",
"value",
")",
"->",
"{",
"t... | Convert at {@link FunctionWithException} into a {@link Function}.
@param functionWithException function with exception to convert into a function
@param <A> input type
@param <B> output type
@return {@link Function} which throws all checked exception as an unchecked exception. | [
"Convert",
"at",
"{",
"@link",
"FunctionWithException",
"}",
"into",
"a",
"{",
"@link",
"Function",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/function/FunctionUtils.java#L70-L80 | train | Returns a function that throws an exception. | [
30522,
2270,
10763,
1026,
1037,
1010,
1038,
1028,
3853,
1026,
1037,
1010,
1038,
1028,
4895,
5403,
18141,
11263,
27989,
1006,
3853,
24415,
10288,
24422,
1026,
1037,
1010,
1038,
1010,
1029,
1028,
3853,
24415,
10288,
24422,
1007,
1063,
2709,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.scale | public static void scale(File srcImageFile, File destImageFile, int width, int height, Color fixedColor) throws IORuntimeException {
write(scale(read(srcImageFile), width, height, fixedColor), destImageFile);
} | java | public static void scale(File srcImageFile, File destImageFile, int width, int height, Color fixedColor) throws IORuntimeException {
write(scale(read(srcImageFile), width, height, fixedColor), destImageFile);
} | [
"public",
"static",
"void",
"scale",
"(",
"File",
"srcImageFile",
",",
"File",
"destImageFile",
",",
"int",
"width",
",",
"int",
"height",
",",
"Color",
"fixedColor",
")",
"throws",
"IORuntimeException",
"{",
"write",
"(",
"scale",
"(",
"read",
"(",
"srcImag... | 缩放图像(按高度和宽度缩放)<br>
缩放后默认为jpeg格式
@param srcImageFile 源图像文件地址
@param destImageFile 缩放后的图像地址
@param width 缩放后的宽度
@param height 缩放后的高度
@param fixedColor 比例不对时补充的颜色,不补充为<code>null</code>
@throws IORuntimeException IO异常 | [
"缩放图像(按高度和宽度缩放)<br",
">",
"缩放后默认为jpeg格式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L184-L186 | train | Scales the srcImageFile to fit into the destImageFile. | [
30522,
2270,
10763,
11675,
4094,
1006,
5371,
5034,
6895,
26860,
8873,
2571,
1010,
5371,
4078,
3775,
26860,
8873,
2571,
1010,
20014,
9381,
1010,
20014,
4578,
1010,
3609,
4964,
18717,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
4339,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.getDateHeader | @Deprecated
public static Date getDateHeader(HttpMessage message, CharSequence name, Date defaultValue) {
final String value = getHeader(message, name);
Date date = DateFormatter.parseHttpDate(value);
return date != null ? date : defaultValue;
} | java | @Deprecated
public static Date getDateHeader(HttpMessage message, CharSequence name, Date defaultValue) {
final String value = getHeader(message, name);
Date date = DateFormatter.parseHttpDate(value);
return date != null ? date : defaultValue;
} | [
"@",
"Deprecated",
"public",
"static",
"Date",
"getDateHeader",
"(",
"HttpMessage",
"message",
",",
"CharSequence",
"name",
",",
"Date",
"defaultValue",
")",
"{",
"final",
"String",
"value",
"=",
"getHeader",
"(",
"message",
",",
"name",
")",
";",
"Date",
"d... | @deprecated Use {@link #getTimeMillis(CharSequence, long)} instead.
Returns the date header value with the specified header name. If
there are more than one header value for the specified header name, the
first value is returned.
@return the header value or the {@code defaultValue} if there is no such
header or the header value is not a formatted date | [
"@deprecated",
"Use",
"{",
"@link",
"#getTimeMillis",
"(",
"CharSequence",
"long",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L875-L880 | train | Get a date header. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
3058,
2131,
13701,
4974,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
25869,
3366,
4226,
5897,
2171,
1010,
3058,
12398,
10175,
5657,
1007,
1063,
2345,
5164,
3643,
1027,
2131,
4974,
2121,
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... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java | SslContextBuilder.forServer | public static SslContextBuilder forServer(PrivateKey key, X509Certificate... keyCertChain) {
return new SslContextBuilder(true).keyManager(key, keyCertChain);
} | java | public static SslContextBuilder forServer(PrivateKey key, X509Certificate... keyCertChain) {
return new SslContextBuilder(true).keyManager(key, keyCertChain);
} | [
"public",
"static",
"SslContextBuilder",
"forServer",
"(",
"PrivateKey",
"key",
",",
"X509Certificate",
"...",
"keyCertChain",
")",
"{",
"return",
"new",
"SslContextBuilder",
"(",
"true",
")",
".",
"keyManager",
"(",
"key",
",",
"keyCertChain",
")",
";",
"}"
] | Creates a builder for new server-side {@link SslContext}.
@param key a PKCS#8 private key
@param keyCertChain the X.509 certificate chain
@see #keyManager(PrivateKey, X509Certificate[]) | [
"Creates",
"a",
"builder",
"for",
"new",
"server",
"-",
"side",
"{",
"@link",
"SslContext",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L75-L77 | train | Create a SslContextBuilder for a server. | [
30522,
2270,
10763,
7020,
22499,
10111,
18413,
8569,
23891,
2099,
2005,
8043,
6299,
1006,
2797,
14839,
3145,
1010,
1060,
12376,
2683,
17119,
3775,
8873,
16280,
1012,
1012,
1012,
3145,
17119,
10649,
8113,
1007,
1063,
2709,
2047,
7020,
22499,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.setAll | public HttpHeaders setAll(HttpHeaders headers) {
checkNotNull(headers, "headers");
if (headers.isEmpty()) {
return this;
}
for (Entry<String, String> entry : headers) {
set(entry.getKey(), entry.getValue());
}
return this;
} | java | public HttpHeaders setAll(HttpHeaders headers) {
checkNotNull(headers, "headers");
if (headers.isEmpty()) {
return this;
}
for (Entry<String, String> entry : headers) {
set(entry.getKey(), entry.getValue());
}
return this;
} | [
"public",
"HttpHeaders",
"setAll",
"(",
"HttpHeaders",
"headers",
")",
"{",
"checkNotNull",
"(",
"headers",
",",
"\"headers\"",
")",
";",
"if",
"(",
"headers",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"for",
"(",
"Entry",
"<",
"S... | Retains all current headers but calls {@link #set(String, Object)} for each entry in {@code headers}
@param headers The headers used to {@link #set(String, Object)} values in this instance
@return {@code this} | [
"Retains",
"all",
"current",
"headers",
"but",
"calls",
"{",
"@link",
"#set",
"(",
"String",
"Object",
")",
"}",
"for",
"each",
"entry",
"in",
"{",
"@code",
"headers",
"}"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1516-L1527 | train | Sets all the headers in this request. | [
30522,
2270,
8299,
4974,
2545,
2275,
8095,
1006,
8299,
4974,
2545,
20346,
2015,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
20346,
2015,
1010,
1000,
20346,
2015,
1000,
1007,
1025,
2065,
1006,
20346,
2015,
1012,
2003,
6633,
13876,
2100,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/cluster/Document.java | Document.idf | void idf(HashMap<Integer, Integer> df, int ndocs)
{
for (Map.Entry<Integer, Double> entry : feature_.entrySet())
{
Integer denom = df.get(entry.getKey());
if (denom == null) denom = 1;
entry.setValue((double) (entry.getValue() * Math.log(ndocs / denom)));
}
} | java | void idf(HashMap<Integer, Integer> df, int ndocs)
{
for (Map.Entry<Integer, Double> entry : feature_.entrySet())
{
Integer denom = df.get(entry.getKey());
if (denom == null) denom = 1;
entry.setValue((double) (entry.getValue() * Math.log(ndocs / denom)));
}
} | [
"void",
"idf",
"(",
"HashMap",
"<",
"Integer",
",",
"Integer",
">",
"df",
",",
"int",
"ndocs",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"Double",
">",
"entry",
":",
"feature_",
".",
"entrySet",
"(",
")",
")",
"{",
"Integer",
... | Apply IDF(inverse document frequency) weighting.
@param df document frequencies
@param ndocs the number of documents | [
"Apply",
"IDF",
"(",
"inverse",
"document",
"frequency",
")",
"weighting",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/Document.java#L91-L99 | train | This method is used to calculate the log of ndocs | [
30522,
11675,
24011,
1006,
23325,
2863,
2361,
1026,
16109,
1010,
16109,
1028,
1040,
2546,
1010,
20014,
1050,
3527,
6169,
1007,
1063,
2005,
1006,
4949,
1012,
4443,
1026,
16109,
1010,
3313,
1028,
4443,
1024,
3444,
1035,
1012,
4443,
13462,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/occurrence/Occurrence.java | Occurrence.computeRightEntropy | public double computeRightEntropy(PairFrequency pair)
{
Set<Map.Entry<String, TriaFrequency>> entrySet = trieTria.prefixSearch(pair.getKey() + RIGHT);
return computeEntropy(entrySet);
} | java | public double computeRightEntropy(PairFrequency pair)
{
Set<Map.Entry<String, TriaFrequency>> entrySet = trieTria.prefixSearch(pair.getKey() + RIGHT);
return computeEntropy(entrySet);
} | [
"public",
"double",
"computeRightEntropy",
"(",
"PairFrequency",
"pair",
")",
"{",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"TriaFrequency",
">",
">",
"entrySet",
"=",
"trieTria",
".",
"prefixSearch",
"(",
"pair",
".",
"getKey",
"(",
")",
"+",
... | 计算右熵
@param pair
@return | [
"计算右熵"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/occurrence/Occurrence.java#L322-L326 | train | Compute the entropy of the right term of a pair. | [
30522,
2270,
3313,
3274,
18743,
4765,
18981,
2100,
1006,
3940,
19699,
2063,
4226,
9407,
3940,
1007,
1063,
2275,
1026,
4949,
1012,
4443,
1026,
5164,
1010,
13012,
10354,
2890,
4226,
9407,
1028,
1028,
4443,
13462,
1027,
13012,
3388,
4360,
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-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.offsetMonth | public static DateTime offsetMonth(Date date, int offset) {
return offset(date, DateField.MONTH, offset);
} | java | public static DateTime offsetMonth(Date date, int offset) {
return offset(date, DateField.MONTH, offset);
} | [
"public",
"static",
"DateTime",
"offsetMonth",
"(",
"Date",
"date",
",",
"int",
"offset",
")",
"{",
"return",
"offset",
"(",
"date",
",",
"DateField",
".",
"MONTH",
",",
"offset",
")",
";",
"}"
] | 偏移月
@param date 日期
@param offset 偏移月数,正数向未来偏移,负数向历史偏移
@return 偏移后的日期 | [
"偏移月"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1186-L1188 | train | Create an offset of the given date with the specified offset. | [
30522,
2270,
10763,
3058,
7292,
16396,
9629,
2232,
1006,
3058,
3058,
1010,
20014,
16396,
1007,
1063,
2709,
16396,
1006,
3058,
1010,
3058,
3790,
1012,
3204,
1010,
16396,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.