repo stringclasses 11 values | path stringlengths 41 214 | func_name stringlengths 7 82 | original_string stringlengths 77 11.9k | language stringclasses 1 value | code stringlengths 77 11.9k | code_tokens listlengths 22 1.57k | docstring stringlengths 2 2.27k | docstring_tokens listlengths 1 352 | sha stringclasses 11 values | url stringlengths 129 319 | partition stringclasses 1 value | summary stringlengths 7 191 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/CollectionExecutor.java | CollectionExecutor.execute | public JobExecutionResult execute(Plan program) throws Exception {
long startTime = System.currentTimeMillis();
initCache(program.getCachedFiles());
Collection<? extends GenericDataSinkBase<?>> sinks = program.getDataSinks();
for (Operator<?> sink : sinks) {
execute(sink);
}
long endTime = System.currentTimeMillis();
Map<String, OptionalFailure<Object>> accumulatorResults = AccumulatorHelper.toResultMap(accumulators);
return new JobExecutionResult(null, endTime - startTime, accumulatorResults);
} | java | public JobExecutionResult execute(Plan program) throws Exception {
long startTime = System.currentTimeMillis();
initCache(program.getCachedFiles());
Collection<? extends GenericDataSinkBase<?>> sinks = program.getDataSinks();
for (Operator<?> sink : sinks) {
execute(sink);
}
long endTime = System.currentTimeMillis();
Map<String, OptionalFailure<Object>> accumulatorResults = AccumulatorHelper.toResultMap(accumulators);
return new JobExecutionResult(null, endTime - startTime, accumulatorResults);
} | [
"public",
"JobExecutionResult",
"execute",
"(",
"Plan",
"program",
")",
"throws",
"Exception",
"{",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"initCache",
"(",
"program",
".",
"getCachedFiles",
"(",
")",
")",
";",
"Collection... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/CollectionExecutor.java#L109-L121 | train | Execute the given program. | [
30522,
2270,
3105,
10288,
8586,
13700,
6072,
11314,
15389,
1006,
2933,
2565,
1007,
11618,
6453,
1063,
2146,
2707,
7292,
1027,
2291,
1012,
2783,
7292,
19912,
2483,
1006,
1007,
1025,
1999,
4183,
3540,
5403,
1006,
2565,
1012,
2131,
3540,
7690,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java | KeyUtil.generatePrivateKey | public static PrivateKey generatePrivateKey(String algorithm, KeySpec keySpec) {
if (null == keySpec) {
return null;
}
algorithm = getAlgorithmAfterWith(algorithm);
try {
return getKeyFactory(algorithm).generatePrivate(keySpec);
} catch (Exception e) {
throw new CryptoException(e);
}
} | java | public static PrivateKey generatePrivateKey(String algorithm, KeySpec keySpec) {
if (null == keySpec) {
return null;
}
algorithm = getAlgorithmAfterWith(algorithm);
try {
return getKeyFactory(algorithm).generatePrivate(keySpec);
} catch (Exception e) {
throw new CryptoException(e);
}
} | [
"public",
"static",
"PrivateKey",
"generatePrivateKey",
"(",
"String",
"algorithm",
",",
"KeySpec",
"keySpec",
")",
"{",
"if",
"(",
"null",
"==",
"keySpec",
")",
"{",
"return",
"null",
";",
"}",
"algorithm",
"=",
"getAlgorithmAfterWith",
"(",
"algorithm",
")",... | 生成私钥,仅用于非对称加密<br>
算法见:https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#KeyFactory
@param algorithm 算法
@param keySpec {@link KeySpec}
@return 私钥 {@link PrivateKey}
@since 3.1.1 | [
"生成私钥,仅用于非对称加密<br",
">",
"算法见:https",
":",
"//",
"docs",
".",
"oracle",
".",
"com",
"/",
"javase",
"/",
"7",
"/",
"docs",
"/",
"technotes",
"/",
"guides",
"/",
"security",
"/",
"StandardNames",
".",
"html#KeyFactory"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L235-L245 | train | Generates a private key using the specified algorithm and key spec. | [
30522,
2270,
10763,
2797,
14839,
9699,
18098,
21466,
14839,
1006,
5164,
9896,
1010,
6309,
5051,
2278,
6309,
5051,
2278,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
6309,
5051,
2278,
1007,
1063,
2709,
19701,
1025,
1065,
9896,
1027,
2131,
2389... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapBuilder.java | MapBuilder.joinIgnoreNull | public String joinIgnoreNull(String separator, final String keyValueSeparator) {
return MapUtil.joinIgnoreNull(this.map, separator, keyValueSeparator);
} | java | public String joinIgnoreNull(String separator, final String keyValueSeparator) {
return MapUtil.joinIgnoreNull(this.map, separator, keyValueSeparator);
} | [
"public",
"String",
"joinIgnoreNull",
"(",
"String",
"separator",
",",
"final",
"String",
"keyValueSeparator",
")",
"{",
"return",
"MapUtil",
".",
"joinIgnoreNull",
"(",
"this",
".",
"map",
",",
"separator",
",",
"keyValueSeparator",
")",
";",
"}"
] | 将map转成字符串
@param separator entry之间的连接符
@param keyValueSeparator kv之间的连接符
@return 连接后的字符串 | [
"将map转成字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapBuilder.java#L97-L99 | train | Join the contents of this map ignoring null values. | [
30522,
2270,
5164,
3693,
23773,
5686,
11231,
3363,
1006,
5164,
19802,
25879,
2953,
1010,
2345,
5164,
3145,
10175,
15808,
13699,
25879,
2953,
1007,
1063,
2709,
4949,
21823,
2140,
1012,
3693,
23773,
5686,
11231,
3363,
1006,
2023,
1012,
4949,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java | OpenSslSessionStats.connect | public long connect() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionConnect(context.ctx);
} finally {
readerLock.unlock();
}
} | java | public long connect() {
Lock readerLock = context.ctxLock.readLock();
readerLock.lock();
try {
return SSLContext.sessionConnect(context.ctx);
} finally {
readerLock.unlock();
}
} | [
"public",
"long",
"connect",
"(",
")",
"{",
"Lock",
"readerLock",
"=",
"context",
".",
"ctxLock",
".",
"readLock",
"(",
")",
";",
"readerLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"SSLContext",
".",
"sessionConnect",
"(",
"context",
".",
... | Returns the number of started SSL/TLS handshakes in client mode. | [
"Returns",
"the",
"number",
"of",
"started",
"SSL",
"/",
"TLS",
"handshakes",
"in",
"client",
"mode",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionStats.java#L56-L64 | train | Connect to the server. | [
30522,
2270,
2146,
7532,
1006,
1007,
1063,
5843,
8068,
7878,
1027,
6123,
1012,
14931,
2595,
7878,
1012,
3191,
7878,
1006,
1007,
1025,
8068,
7878,
1012,
5843,
1006,
1007,
1025,
3046,
1063,
2709,
7020,
22499,
10111,
18413,
1012,
5219,
8663,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/dialect/Props.java | Props.autoLoad | public void autoLoad(boolean autoReload) {
if (autoReload) {
Assert.notNull(this.propertiesFileUrl, "Properties URL is null !");
if (null != this.watchMonitor) {
// 先关闭之前的监听
this.watchMonitor.close();
}
this.watchMonitor = WatchUtil.createModify(this.propertiesFileUrl, new SimpleWatcher(){
@Override
public void onModify(WatchEvent<?> event, Path currentPath) {
load();
}
});
this.watchMonitor.start();
} else {
IoUtil.close(this.watchMonitor);
this.watchMonitor = null;
}
} | java | public void autoLoad(boolean autoReload) {
if (autoReload) {
Assert.notNull(this.propertiesFileUrl, "Properties URL is null !");
if (null != this.watchMonitor) {
// 先关闭之前的监听
this.watchMonitor.close();
}
this.watchMonitor = WatchUtil.createModify(this.propertiesFileUrl, new SimpleWatcher(){
@Override
public void onModify(WatchEvent<?> event, Path currentPath) {
load();
}
});
this.watchMonitor.start();
} else {
IoUtil.close(this.watchMonitor);
this.watchMonitor = null;
}
} | [
"public",
"void",
"autoLoad",
"(",
"boolean",
"autoReload",
")",
"{",
"if",
"(",
"autoReload",
")",
"{",
"Assert",
".",
"notNull",
"(",
"this",
".",
"propertiesFileUrl",
",",
"\"Properties URL is null !\"",
")",
";",
"if",
"(",
"null",
"!=",
"this",
".",
"... | 在配置文件变更时自动加载
@param autoReload 是否自动加载 | [
"在配置文件变更时自动加载"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/dialect/Props.java#L272-L290 | train | Auto load the properties file. | [
30522,
2270,
11675,
8285,
11066,
1006,
22017,
20898,
8285,
16570,
10441,
2094,
1007,
1063,
2065,
1006,
8285,
16570,
10441,
2094,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
2023,
1012,
5144,
8873,
2571,
3126,
2140,
1010,
1000,
5144,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/dartsclone/DoubleArray.java | DoubleArray.exactMatchSearch | public int exactMatchSearch(byte[] key)
{
int unit = _array[0];
int nodePos = 0;
for (byte b : key)
{
// nodePos ^= unit.offset() ^ b
nodePos ^= ((unit >>> 10) << ((unit & (1 << 9)) >>> 6)) ^ (b & 0xFF);
unit = _array[nodePos];
// if (unit.label() != b)
if ((unit & ((1 << 31) | 0xFF)) != (b & 0xff))
{
return -1;
}
}
// if (!unit.has_leaf()) {
if (((unit >>> 8) & 1) != 1)
{
return -1;
}
// unit = _array[nodePos ^ unit.offset()];
unit = _array[nodePos ^ ((unit >>> 10) << ((unit & (1 << 9)) >>> 6))];
// return unit.value();
return unit & ((1 << 31) - 1);
} | java | public int exactMatchSearch(byte[] key)
{
int unit = _array[0];
int nodePos = 0;
for (byte b : key)
{
// nodePos ^= unit.offset() ^ b
nodePos ^= ((unit >>> 10) << ((unit & (1 << 9)) >>> 6)) ^ (b & 0xFF);
unit = _array[nodePos];
// if (unit.label() != b)
if ((unit & ((1 << 31) | 0xFF)) != (b & 0xff))
{
return -1;
}
}
// if (!unit.has_leaf()) {
if (((unit >>> 8) & 1) != 1)
{
return -1;
}
// unit = _array[nodePos ^ unit.offset()];
unit = _array[nodePos ^ ((unit >>> 10) << ((unit & (1 << 9)) >>> 6))];
// return unit.value();
return unit & ((1 << 31) - 1);
} | [
"public",
"int",
"exactMatchSearch",
"(",
"byte",
"[",
"]",
"key",
")",
"{",
"int",
"unit",
"=",
"_array",
"[",
"0",
"]",
";",
"int",
"nodePos",
"=",
"0",
";",
"for",
"(",
"byte",
"b",
":",
"key",
")",
"{",
"// nodePos ^= unit.offset() ^ b",
"nodePos",... | Returns the corresponding value if the key is found. Otherwise returns -1.
@param key search key
@return found value | [
"Returns",
"the",
"corresponding",
"value",
"if",
"the",
"key",
"is",
"found",
".",
"Otherwise",
"returns",
"-",
"1",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/dartsclone/DoubleArray.java#L140-L165 | train | Exact match search. | [
30522,
2270,
20014,
6635,
18900,
18069,
14644,
2818,
1006,
24880,
1031,
1033,
3145,
1007,
1063,
20014,
3131,
1027,
1035,
9140,
1031,
1014,
1033,
1025,
20014,
13045,
6873,
2015,
1027,
1014,
30524,
1006,
1006,
3131,
1028,
1028,
1028,
2184,
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-java/src/main/java/org/apache/flink/api/java/operators/SingleInputUdfOperator.java | SingleInputUdfOperator.withForwardedFields | public O withForwardedFields(String... forwardedFields) {
if (this.udfSemantics == null) {
// extract semantic properties from function annotations
setSemanticProperties(extractSemanticAnnotations(getFunction().getClass()));
}
if (this.udfSemantics == null
|| this.analyzedUdfSemantics) { // discard analyzed semantic properties
setSemanticProperties(new SingleInputSemanticProperties());
SemanticPropUtil.getSemanticPropsSingleFromString(this.udfSemantics, forwardedFields, null, null, this.getInputType(), this.getResultType());
} else {
if (udfWithForwardedFieldsAnnotation(getFunction().getClass())) {
// refuse semantic information as it would override the function annotation
throw new SemanticProperties.InvalidSemanticAnnotationException("Forwarded field information " +
"has already been added by a function annotation for this operator. " +
"Cannot overwrite function annotations.");
} else {
SemanticPropUtil.getSemanticPropsSingleFromString(this.udfSemantics, forwardedFields, null, null, this.getInputType(), this.getResultType());
}
}
@SuppressWarnings("unchecked")
O returnType = (O) this;
return returnType;
} | java | public O withForwardedFields(String... forwardedFields) {
if (this.udfSemantics == null) {
// extract semantic properties from function annotations
setSemanticProperties(extractSemanticAnnotations(getFunction().getClass()));
}
if (this.udfSemantics == null
|| this.analyzedUdfSemantics) { // discard analyzed semantic properties
setSemanticProperties(new SingleInputSemanticProperties());
SemanticPropUtil.getSemanticPropsSingleFromString(this.udfSemantics, forwardedFields, null, null, this.getInputType(), this.getResultType());
} else {
if (udfWithForwardedFieldsAnnotation(getFunction().getClass())) {
// refuse semantic information as it would override the function annotation
throw new SemanticProperties.InvalidSemanticAnnotationException("Forwarded field information " +
"has already been added by a function annotation for this operator. " +
"Cannot overwrite function annotations.");
} else {
SemanticPropUtil.getSemanticPropsSingleFromString(this.udfSemantics, forwardedFields, null, null, this.getInputType(), this.getResultType());
}
}
@SuppressWarnings("unchecked")
O returnType = (O) this;
return returnType;
} | [
"public",
"O",
"withForwardedFields",
"(",
"String",
"...",
"forwardedFields",
")",
"{",
"if",
"(",
"this",
".",
"udfSemantics",
"==",
"null",
")",
"{",
"// extract semantic properties from function annotations",
"setSemanticProperties",
"(",
"extractSemanticAnnotations",
... | Adds semantic information about forwarded fields of the user-defined function.
The forwarded fields information declares fields which are never modified by the function and
which are forwarded at the same position to the output or unchanged copied to another position in the output.
<p>Fields that are forwarded at the same position are specified by their position.
The specified position must be valid for the input and output data type and have the same type.
For example <code>withForwardedFields("f2")</code> declares that the third field of a Java input tuple is
copied to the third field of an output tuple.
<p>Fields which are unchanged copied to another position in the output are declared by specifying the
source field reference in the input and the target field reference in the output.
{@code withForwardedFields("f0->f2")} denotes that the first field of the Java input tuple is
unchanged copied to the third field of the Java output tuple. When using a wildcard ("*") ensure that
the number of declared fields and their types in input and output type match.
<p>Multiple forwarded fields can be annotated in one ({@code withForwardedFields("f2; f3->f0; f4")})
or separate Strings ({@code withForwardedFields("f2", "f3->f0", "f4")}).
Please refer to the JavaDoc of {@link org.apache.flink.api.common.functions.Function} or Flink's documentation for
details on field references such as nested fields and wildcard.
<p>It is not possible to override existing semantic information about forwarded fields which was
for example added by a {@link org.apache.flink.api.java.functions.FunctionAnnotation.ForwardedFields} class annotation.
<p><b>NOTE: Adding semantic information for functions is optional!
If used correctly, semantic information can help the Flink optimizer to generate more efficient execution plans.
However, incorrect semantic information can cause the optimizer to generate incorrect execution plans which compute wrong results!
So be careful when adding semantic information.
</b>
@param forwardedFields A list of field forward expressions.
@return This operator with annotated forwarded field information.
@see org.apache.flink.api.java.functions.FunctionAnnotation
@see org.apache.flink.api.java.functions.FunctionAnnotation.ForwardedFields | [
"Adds",
"semantic",
"information",
"about",
"forwarded",
"fields",
"of",
"the",
"user",
"-",
"defined",
"function",
".",
"The",
"forwarded",
"fields",
"information",
"declares",
"fields",
"which",
"are",
"never",
"modified",
"by",
"the",
"function",
"and",
"whic... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/SingleInputUdfOperator.java#L149-L174 | train | Adds forwarded fields information to the result type. | [
30522,
2270,
1051,
2007,
29278,
7652,
2098,
15155,
1006,
5164,
1012,
1012,
1012,
2830,
2098,
15155,
1007,
1063,
2065,
1006,
2023,
1012,
20904,
10343,
16704,
14606,
1027,
1027,
19701,
1007,
30524,
1007,
1007,
1007,
1025,
1065,
2065,
1006,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/proxy/KinesisProxy.java | KinesisProxy.getShardIterator | @Override
public String getShardIterator(StreamShardHandle shard, String shardIteratorType, @Nullable Object startingMarker) throws InterruptedException {
GetShardIteratorRequest getShardIteratorRequest = new GetShardIteratorRequest()
.withStreamName(shard.getStreamName())
.withShardId(shard.getShard().getShardId())
.withShardIteratorType(shardIteratorType);
switch (ShardIteratorType.fromValue(shardIteratorType)) {
case TRIM_HORIZON:
case LATEST:
break;
case AT_TIMESTAMP:
if (startingMarker instanceof Date) {
getShardIteratorRequest.setTimestamp((Date) startingMarker);
} else {
throw new IllegalArgumentException("Invalid object given for GetShardIteratorRequest() when ShardIteratorType is AT_TIMESTAMP. Must be a Date object.");
}
break;
case AT_SEQUENCE_NUMBER:
case AFTER_SEQUENCE_NUMBER:
if (startingMarker instanceof String) {
getShardIteratorRequest.setStartingSequenceNumber((String) startingMarker);
} else {
throw new IllegalArgumentException("Invalid object given for GetShardIteratorRequest() when ShardIteratorType is AT_SEQUENCE_NUMBER or AFTER_SEQUENCE_NUMBER. Must be a String.");
}
}
return getShardIterator(getShardIteratorRequest);
} | java | @Override
public String getShardIterator(StreamShardHandle shard, String shardIteratorType, @Nullable Object startingMarker) throws InterruptedException {
GetShardIteratorRequest getShardIteratorRequest = new GetShardIteratorRequest()
.withStreamName(shard.getStreamName())
.withShardId(shard.getShard().getShardId())
.withShardIteratorType(shardIteratorType);
switch (ShardIteratorType.fromValue(shardIteratorType)) {
case TRIM_HORIZON:
case LATEST:
break;
case AT_TIMESTAMP:
if (startingMarker instanceof Date) {
getShardIteratorRequest.setTimestamp((Date) startingMarker);
} else {
throw new IllegalArgumentException("Invalid object given for GetShardIteratorRequest() when ShardIteratorType is AT_TIMESTAMP. Must be a Date object.");
}
break;
case AT_SEQUENCE_NUMBER:
case AFTER_SEQUENCE_NUMBER:
if (startingMarker instanceof String) {
getShardIteratorRequest.setStartingSequenceNumber((String) startingMarker);
} else {
throw new IllegalArgumentException("Invalid object given for GetShardIteratorRequest() when ShardIteratorType is AT_SEQUENCE_NUMBER or AFTER_SEQUENCE_NUMBER. Must be a String.");
}
}
return getShardIterator(getShardIteratorRequest);
} | [
"@",
"Override",
"public",
"String",
"getShardIterator",
"(",
"StreamShardHandle",
"shard",
",",
"String",
"shardIteratorType",
",",
"@",
"Nullable",
"Object",
"startingMarker",
")",
"throws",
"InterruptedException",
"{",
"GetShardIteratorRequest",
"getShardIteratorRequest"... | {@inheritDoc} | [
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/proxy/KinesisProxy.java#L290-L317 | train | Get the shard iterator. | [
30522,
1030,
2058,
15637,
2270,
5164,
4152,
11783,
21646,
8844,
1006,
9199,
11783,
11774,
2571,
21146,
4103,
1010,
5164,
21146,
30524,
24422,
1063,
4152,
11783,
21646,
8844,
2890,
15500,
4152,
11783,
21646,
8844,
2890,
15500,
1027,
2047,
4152... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ExecutionGraph.java | ExecutionGraph.getAccumulatorResultsStringified | @Override
public StringifiedAccumulatorResult[] getAccumulatorResultsStringified() {
Map<String, OptionalFailure<Accumulator<?, ?>>> accumulatorMap = aggregateUserAccumulators();
return StringifiedAccumulatorResult.stringifyAccumulatorResults(accumulatorMap);
} | java | @Override
public StringifiedAccumulatorResult[] getAccumulatorResultsStringified() {
Map<String, OptionalFailure<Accumulator<?, ?>>> accumulatorMap = aggregateUserAccumulators();
return StringifiedAccumulatorResult.stringifyAccumulatorResults(accumulatorMap);
} | [
"@",
"Override",
"public",
"StringifiedAccumulatorResult",
"[",
"]",
"getAccumulatorResultsStringified",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"OptionalFailure",
"<",
"Accumulator",
"<",
"?",
",",
"?",
">",
">",
">",
"accumulatorMap",
"=",
"aggregateUserAccumu... | Returns the a stringified version of the user-defined accumulators.
@return an Array containing the StringifiedAccumulatorResult objects | [
"Returns",
"the",
"a",
"stringified",
"version",
"of",
"the",
"user",
"-",
"defined",
"accumulators",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java#L797-L801 | train | Returns an array of StringifiedAccumulatorResult objects. | [
30522,
1030,
2058,
15637,
2270,
5164,
7810,
6305,
24894,
20350,
6072,
11314,
1031,
1033,
2131,
6305,
24894,
20350,
6072,
11314,
4757,
18886,
3070,
7810,
1006,
1007,
1063,
4949,
1026,
5164,
1010,
11887,
7011,
4014,
5397,
1026,
16222,
2819,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java | JSONObject.getLong | public long getLong(String name) throws JSONException {
Object object = get(name);
Long result = JSON.toLong(object);
if (result == null) {
throw JSON.typeMismatch(name, object, "long");
}
return result;
} | java | public long getLong(String name) throws JSONException {
Object object = get(name);
Long result = JSON.toLong(object);
if (result == null) {
throw JSON.typeMismatch(name, object, "long");
}
return result;
} | [
"public",
"long",
"getLong",
"(",
"String",
"name",
")",
"throws",
"JSONException",
"{",
"Object",
"object",
"=",
"get",
"(",
"name",
")",
";",
"Long",
"result",
"=",
"JSON",
".",
"toLong",
"(",
"object",
")",
";",
"if",
"(",
"result",
"==",
"null",
... | Returns the value mapped by {@code name} if it exists and is a long or can be
coerced to a long. Note that JSON represents numbers as doubles, so this is
<a href="#lossy">lossy</a>; use strings to transfer numbers via JSON.
@param name the name of the property
@return the value
@throws JSONException if the mapping doesn't exist or cannot be coerced to a long. | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L518-L525 | train | Get a long property. | [
30522,
2270,
2146,
2131,
10052,
1006,
5164,
2171,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
4874,
4874,
1027,
2131,
1006,
2171,
1007,
1025,
2146,
2765,
1027,
1046,
3385,
1012,
2000,
10052,
1006,
4874,
1007,
1025,
2065,
1006,
2765,
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-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/util/StringUtf8Utils.java | StringUtf8Utils.encodeUTF8 | public static byte[] encodeUTF8(String str) {
byte[] bytes = allocateReuseBytes(str.length() * MAX_BYTES_PER_CHAR);
int len = encodeUTF8(str, bytes);
return Arrays.copyOf(bytes, len);
} | java | public static byte[] encodeUTF8(String str) {
byte[] bytes = allocateReuseBytes(str.length() * MAX_BYTES_PER_CHAR);
int len = encodeUTF8(str, bytes);
return Arrays.copyOf(bytes, len);
} | [
"public",
"static",
"byte",
"[",
"]",
"encodeUTF8",
"(",
"String",
"str",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"allocateReuseBytes",
"(",
"str",
".",
"length",
"(",
")",
"*",
"MAX_BYTES_PER_CHAR",
")",
";",
"int",
"len",
"=",
"encodeUTF8",
"(",
"s... | This method must have the same result with JDK's String.getBytes. | [
"This",
"method",
"must",
"have",
"the",
"same",
"result",
"with",
"JDK",
"s",
"String",
".",
"getBytes",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/util/StringUtf8Utils.java#L41-L45 | train | Encode a String to a byte array. | [
30522,
2270,
10763,
24880,
1031,
1033,
4372,
16044,
4904,
2546,
2620,
1006,
5164,
2358,
2099,
1007,
1063,
24880,
1031,
1033,
27507,
1027,
2035,
24755,
3334,
10600,
15878,
17250,
2015,
1006,
2358,
2099,
1012,
3091,
1006,
1007,
1008,
4098,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BaseNode.java | BaseNode.transition | public BaseNode<V> transition(char path)
{
BaseNode<V> cur = this;
cur = cur.getChild(path);
if (cur == null || cur.status == Status.UNDEFINED_0) return null;
return cur;
} | java | public BaseNode<V> transition(char path)
{
BaseNode<V> cur = this;
cur = cur.getChild(path);
if (cur == null || cur.status == Status.UNDEFINED_0) return null;
return cur;
} | [
"public",
"BaseNode",
"<",
"V",
">",
"transition",
"(",
"char",
"path",
")",
"{",
"BaseNode",
"<",
"V",
">",
"cur",
"=",
"this",
";",
"cur",
"=",
"cur",
".",
"getChild",
"(",
"path",
")",
";",
"if",
"(",
"cur",
"==",
"null",
"||",
"cur",
".",
"... | 转移状态
@param path
@return | [
"转移状态"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BaseNode.java#L80-L86 | train | Transition to a child of this node. | [
30522,
2270,
2918,
3630,
3207,
1026,
1058,
1028,
6653,
1006,
25869,
4130,
1007,
1063,
2918,
3630,
3207,
1026,
1058,
1028,
12731,
2099,
1027,
2023,
1025,
12731,
2099,
1027,
12731,
2099,
1012,
2131,
19339,
1006,
4130,
1007,
1025,
2065,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/scheduler/Scheduler.java | Scheduler.getNewSlotForSharingGroup | protected SimpleSlot getNewSlotForSharingGroup(ExecutionVertex vertex,
Iterable<TaskManagerLocation> requestedLocations,
SlotSharingGroupAssignment groupAssignment,
CoLocationConstraint constraint,
boolean localOnly)
{
// we need potentially to loop multiple times, because there may be false positives
// in the set-with-available-instances
while (true) {
Pair<Instance, Locality> instanceLocalityPair = findInstance(requestedLocations, localOnly);
if (instanceLocalityPair == null) {
// nothing is available
return null;
}
final Instance instanceToUse = instanceLocalityPair.getLeft();
final Locality locality = instanceLocalityPair.getRight();
try {
JobVertexID groupID = vertex.getJobvertexId();
// allocate a shared slot from the instance
SharedSlot sharedSlot = instanceToUse.allocateSharedSlot(groupAssignment);
// if the instance has further available slots, re-add it to the set of available resources.
if (instanceToUse.hasResourcesAvailable()) {
this.instancesWithAvailableResources.put(instanceToUse.getTaskManagerID(), instanceToUse);
}
if (sharedSlot != null) {
// add the shared slot to the assignment group and allocate a sub-slot
SimpleSlot slot = constraint == null ?
groupAssignment.addSharedSlotAndAllocateSubSlot(sharedSlot, locality, groupID) :
groupAssignment.addSharedSlotAndAllocateSubSlot(sharedSlot, locality, constraint);
if (slot != null) {
return slot;
}
else {
// could not add and allocate the sub-slot, so release shared slot
sharedSlot.releaseSlot(new FlinkException("Could not allocate sub-slot."));
}
}
}
catch (InstanceDiedException e) {
// the instance died it has not yet been propagated to this scheduler
// remove the instance from the set of available instances
removeInstance(instanceToUse);
}
// if we failed to get a slot, fall through the loop
}
} | java | protected SimpleSlot getNewSlotForSharingGroup(ExecutionVertex vertex,
Iterable<TaskManagerLocation> requestedLocations,
SlotSharingGroupAssignment groupAssignment,
CoLocationConstraint constraint,
boolean localOnly)
{
// we need potentially to loop multiple times, because there may be false positives
// in the set-with-available-instances
while (true) {
Pair<Instance, Locality> instanceLocalityPair = findInstance(requestedLocations, localOnly);
if (instanceLocalityPair == null) {
// nothing is available
return null;
}
final Instance instanceToUse = instanceLocalityPair.getLeft();
final Locality locality = instanceLocalityPair.getRight();
try {
JobVertexID groupID = vertex.getJobvertexId();
// allocate a shared slot from the instance
SharedSlot sharedSlot = instanceToUse.allocateSharedSlot(groupAssignment);
// if the instance has further available slots, re-add it to the set of available resources.
if (instanceToUse.hasResourcesAvailable()) {
this.instancesWithAvailableResources.put(instanceToUse.getTaskManagerID(), instanceToUse);
}
if (sharedSlot != null) {
// add the shared slot to the assignment group and allocate a sub-slot
SimpleSlot slot = constraint == null ?
groupAssignment.addSharedSlotAndAllocateSubSlot(sharedSlot, locality, groupID) :
groupAssignment.addSharedSlotAndAllocateSubSlot(sharedSlot, locality, constraint);
if (slot != null) {
return slot;
}
else {
// could not add and allocate the sub-slot, so release shared slot
sharedSlot.releaseSlot(new FlinkException("Could not allocate sub-slot."));
}
}
}
catch (InstanceDiedException e) {
// the instance died it has not yet been propagated to this scheduler
// remove the instance from the set of available instances
removeInstance(instanceToUse);
}
// if we failed to get a slot, fall through the loop
}
} | [
"protected",
"SimpleSlot",
"getNewSlotForSharingGroup",
"(",
"ExecutionVertex",
"vertex",
",",
"Iterable",
"<",
"TaskManagerLocation",
">",
"requestedLocations",
",",
"SlotSharingGroupAssignment",
"groupAssignment",
",",
"CoLocationConstraint",
"constraint",
",",
"boolean",
"... | Tries to allocate a new slot for a vertex that is part of a slot sharing group. If one
of the instances has a slot available, the method will allocate it as a shared slot, add that
shared slot to the sharing group, and allocate a simple slot from that shared slot.
<p>This method will try to allocate a slot from one of the local instances, and fall back to
non-local instances, if permitted.</p>
@param vertex The vertex to allocate the slot for.
@param requestedLocations The locations that are considered local. May be null or empty, if the
vertex has no location preferences.
@param groupAssignment The slot sharing group of the vertex. Mandatory parameter.
@param constraint The co-location constraint of the vertex. May be null.
@param localOnly Flag to indicate if non-local choices are acceptable.
@return A sub-slot for the given vertex, or {@code null}, if no slot is available. | [
"Tries",
"to",
"allocate",
"a",
"new",
"slot",
"for",
"a",
"vertex",
"that",
"is",
"part",
"of",
"a",
"slot",
"sharing",
"group",
".",
"If",
"one",
"of",
"the",
"instances",
"has",
"a",
"slot",
"available",
"the",
"method",
"will",
"allocate",
"it",
"a... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/scheduler/Scheduler.java#L421-L474 | train | This method is used to allocate a new slot for a sharing group. | [
30522,
5123,
3722,
14540,
4140,
2131,
2638,
9333,
10994,
29278,
7377,
4892,
17058,
1006,
7781,
16874,
10288,
19449,
1010,
2009,
6906,
3468,
1026,
4708,
24805,
4590,
4135,
10719,
1028,
7303,
4135,
10719,
2015,
1010,
19832,
18428,
3070,
17058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServerArchiveFetcher.java | HistoryServerArchiveFetcher.updateJobOverview | private static void updateJobOverview(File webOverviewDir, File webDir) {
try (JsonGenerator gen = jacksonFactory.createGenerator(HistoryServer.createOrGetFile(webDir, JobsOverviewHeaders.URL))) {
File[] overviews = new File(webOverviewDir.getPath()).listFiles();
if (overviews != null) {
Collection<JobDetails> allJobs = new ArrayList<>(overviews.length);
for (File overview : overviews) {
MultipleJobsDetails subJobs = mapper.readValue(overview, MultipleJobsDetails.class);
allJobs.addAll(subJobs.getJobs());
}
mapper.writeValue(gen, new MultipleJobsDetails(allJobs));
}
} catch (IOException ioe) {
LOG.error("Failed to update job overview.", ioe);
}
} | java | private static void updateJobOverview(File webOverviewDir, File webDir) {
try (JsonGenerator gen = jacksonFactory.createGenerator(HistoryServer.createOrGetFile(webDir, JobsOverviewHeaders.URL))) {
File[] overviews = new File(webOverviewDir.getPath()).listFiles();
if (overviews != null) {
Collection<JobDetails> allJobs = new ArrayList<>(overviews.length);
for (File overview : overviews) {
MultipleJobsDetails subJobs = mapper.readValue(overview, MultipleJobsDetails.class);
allJobs.addAll(subJobs.getJobs());
}
mapper.writeValue(gen, new MultipleJobsDetails(allJobs));
}
} catch (IOException ioe) {
LOG.error("Failed to update job overview.", ioe);
}
} | [
"private",
"static",
"void",
"updateJobOverview",
"(",
"File",
"webOverviewDir",
",",
"File",
"webDir",
")",
"{",
"try",
"(",
"JsonGenerator",
"gen",
"=",
"jacksonFactory",
".",
"createGenerator",
"(",
"HistoryServer",
".",
"createOrGetFile",
"(",
"webDir",
",",
... | This method replicates the JSON response that would be given by the JobsOverviewHandler when
listing both running and finished jobs.
<p>Every job archive contains a joboverview.json file containing the same structure. Since jobs are archived on
their own however the list of finished jobs only contains a single job.
<p>For the display in the HistoryServer WebFrontend we have to combine these overviews. | [
"This",
"method",
"replicates",
"the",
"JSON",
"response",
"that",
"would",
"be",
"given",
"by",
"the",
"JobsOverviewHandler",
"when",
"listing",
"both",
"running",
"and",
"finished",
"jobs",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServerArchiveFetcher.java#L285-L299 | train | Update the job overview. | [
30522,
2797,
10763,
11675,
10651,
5558,
5092,
6299,
8584,
1006,
5371,
4773,
7840,
8584,
4305,
2099,
1010,
5371,
4773,
4305,
2099,
1007,
1063,
3046,
1006,
1046,
3385,
6914,
6906,
4263,
8991,
1027,
4027,
21450,
1012,
3443,
6914,
6906,
4263,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/PoolThreadCache.java | PoolThreadCache.add | @SuppressWarnings({ "unchecked", "rawtypes" })
boolean add(PoolArena<?> area, PoolChunk chunk, ByteBuffer nioBuffer,
long handle, int normCapacity, SizeClass sizeClass) {
MemoryRegionCache<?> cache = cache(area, normCapacity, sizeClass);
if (cache == null) {
return false;
}
return cache.add(chunk, nioBuffer, handle);
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
boolean add(PoolArena<?> area, PoolChunk chunk, ByteBuffer nioBuffer,
long handle, int normCapacity, SizeClass sizeClass) {
MemoryRegionCache<?> cache = cache(area, normCapacity, sizeClass);
if (cache == null) {
return false;
}
return cache.add(chunk, nioBuffer, handle);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"boolean",
"add",
"(",
"PoolArena",
"<",
"?",
">",
"area",
",",
"PoolChunk",
"chunk",
",",
"ByteBuffer",
"nioBuffer",
",",
"long",
"handle",
",",
"int",
"normCapacity",
",",
... | Add {@link PoolChunk} and {@code handle} to the cache if there is enough room.
Returns {@code true} if it fit into the cache {@code false} otherwise. | [
"Add",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/PoolThreadCache.java#L201-L209 | train | Add a chunk to the cache. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
4895,
5403,
18141,
1000,
1010,
1000,
6315,
13874,
2015,
1000,
1065,
1007,
22017,
20898,
5587,
1006,
4770,
12069,
2532,
1026,
1029,
1028,
2181,
1010,
4770,
20760,
8950,
20000,
1010,
248... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/csv/CsvParser.java | CsvParser.getHeader | public List<String> getHeader() {
if (false == config.containsHeader) {
throw new IllegalStateException("No header available - header parsing is disabled");
}
if (lineNo == 0) {
throw new IllegalStateException("No header available - call nextRow() first");
}
return header.fields;
} | java | public List<String> getHeader() {
if (false == config.containsHeader) {
throw new IllegalStateException("No header available - header parsing is disabled");
}
if (lineNo == 0) {
throw new IllegalStateException("No header available - call nextRow() first");
}
return header.fields;
} | [
"public",
"List",
"<",
"String",
">",
"getHeader",
"(",
")",
"{",
"if",
"(",
"false",
"==",
"config",
".",
"containsHeader",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No header available - header parsing is disabled\"",
")",
";",
"}",
"if",
"(",... | 获取头部字段列表,如果containsHeader设置为false则抛出异常
@return 头部列表
@throws IllegalStateException 如果不解析头部或者没有调用nextRow()方法 | [
"获取头部字段列表,如果containsHeader设置为false则抛出异常"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvParser.java#L74-L82 | train | Returns the header of the table. | [
30522,
2270,
2862,
1026,
5164,
1028,
2131,
4974,
2121,
1006,
1007,
1063,
2065,
1006,
6270,
1027,
1027,
9530,
8873,
2290,
1012,
3397,
4974,
2121,
1007,
1063,
5466,
2047,
6206,
9153,
17389,
2595,
24422,
1006,
1000,
2053,
20346,
2800,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/functions/source/SerializedCheckpointData.java | SerializedCheckpointData.toDeque | public static <T> ArrayDeque<Tuple2<Long, Set<T>>> toDeque(
SerializedCheckpointData[] data,
TypeSerializer<T> serializer) throws IOException {
ArrayDeque<Tuple2<Long, Set<T>>> deque = new ArrayDeque<>(data.length);
DataInputDeserializer deser = null;
for (SerializedCheckpointData checkpoint : data) {
byte[] serializedData = checkpoint.getSerializedData();
if (deser == null) {
deser = new DataInputDeserializer(serializedData, 0, serializedData.length);
}
else {
deser.setBuffer(serializedData);
}
final Set<T> ids = new HashSet<>(checkpoint.getNumIds());
final int numIds = checkpoint.getNumIds();
for (int i = 0; i < numIds; i++) {
ids.add(serializer.deserialize(deser));
}
deque.addLast(new Tuple2<Long, Set<T>>(checkpoint.checkpointId, ids));
}
return deque;
} | java | public static <T> ArrayDeque<Tuple2<Long, Set<T>>> toDeque(
SerializedCheckpointData[] data,
TypeSerializer<T> serializer) throws IOException {
ArrayDeque<Tuple2<Long, Set<T>>> deque = new ArrayDeque<>(data.length);
DataInputDeserializer deser = null;
for (SerializedCheckpointData checkpoint : data) {
byte[] serializedData = checkpoint.getSerializedData();
if (deser == null) {
deser = new DataInputDeserializer(serializedData, 0, serializedData.length);
}
else {
deser.setBuffer(serializedData);
}
final Set<T> ids = new HashSet<>(checkpoint.getNumIds());
final int numIds = checkpoint.getNumIds();
for (int i = 0; i < numIds; i++) {
ids.add(serializer.deserialize(deser));
}
deque.addLast(new Tuple2<Long, Set<T>>(checkpoint.checkpointId, ids));
}
return deque;
} | [
"public",
"static",
"<",
"T",
">",
"ArrayDeque",
"<",
"Tuple2",
"<",
"Long",
",",
"Set",
"<",
"T",
">",
">",
">",
"toDeque",
"(",
"SerializedCheckpointData",
"[",
"]",
"data",
",",
"TypeSerializer",
"<",
"T",
">",
"serializer",
")",
"throws",
"IOExceptio... | De-serializes an array of SerializedCheckpointData back into an ArrayDeque of element checkpoints.
@param data The data to be deserialized.
@param serializer The serializer used to deserialize the data.
@param <T> The type of the elements.
@return An ArrayDeque of element checkpoints.
@throws IOException Thrown, if the serialization fails. | [
"De",
"-",
"serializes",
"an",
"array",
"of",
"SerializedCheckpointData",
"back",
"into",
"an",
"ArrayDeque",
"of",
"element",
"checkpoints",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/SerializedCheckpointData.java#L152-L179 | train | Converts a sequence of serialized checkpoint data to an array of Tuple2<Long Set<T>> objects. | [
30522,
2270,
10763,
1026,
1056,
1028,
9140,
3207,
4226,
1026,
10722,
10814,
2475,
1026,
2146,
1010,
2275,
1026,
1056,
1028,
1028,
1028,
28681,
2063,
4226,
1006,
27289,
5403,
3600,
8400,
2850,
2696,
1031,
1033,
2951,
1010,
4127,
11610,
28863... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/costs/Costs.java | Costs.compareTo | @Override
public int compareTo(Costs o) {
// check the network cost. if we have actual costs on both, use them, otherwise use the heuristic costs.
if (this.networkCost != UNKNOWN && o.networkCost != UNKNOWN) {
if (this.networkCost != o.networkCost) {
return this.networkCost < o.networkCost ? -1 : 1;
}
} else if (this.heuristicNetworkCost < o.heuristicNetworkCost) {
return -1;
} else if (this.heuristicNetworkCost > o.heuristicNetworkCost) {
return 1;
}
// next, check the disk cost. again, if we have actual costs on both, use them, otherwise use the heuristic costs.
if (this.diskCost != UNKNOWN && o.diskCost != UNKNOWN) {
if (this.diskCost != o.diskCost) {
return this.diskCost < o.diskCost ? -1 : 1;
}
} else if (this.heuristicDiskCost < o.heuristicDiskCost) {
return -1;
} else if (this.heuristicDiskCost > o.heuristicDiskCost) {
return 1;
}
// next, check the CPU cost. again, if we have actual costs on both, use them, otherwise use the heuristic costs.
if (this.cpuCost != UNKNOWN && o.cpuCost != UNKNOWN) {
return this.cpuCost < o.cpuCost ? -1 : this.cpuCost > o.cpuCost ? 1 : 0;
} else if (this.heuristicCpuCost < o.heuristicCpuCost) {
return -1;
} else if (this.heuristicCpuCost > o.heuristicCpuCost) {
return 1;
} else {
return 0;
}
} | java | @Override
public int compareTo(Costs o) {
// check the network cost. if we have actual costs on both, use them, otherwise use the heuristic costs.
if (this.networkCost != UNKNOWN && o.networkCost != UNKNOWN) {
if (this.networkCost != o.networkCost) {
return this.networkCost < o.networkCost ? -1 : 1;
}
} else if (this.heuristicNetworkCost < o.heuristicNetworkCost) {
return -1;
} else if (this.heuristicNetworkCost > o.heuristicNetworkCost) {
return 1;
}
// next, check the disk cost. again, if we have actual costs on both, use them, otherwise use the heuristic costs.
if (this.diskCost != UNKNOWN && o.diskCost != UNKNOWN) {
if (this.diskCost != o.diskCost) {
return this.diskCost < o.diskCost ? -1 : 1;
}
} else if (this.heuristicDiskCost < o.heuristicDiskCost) {
return -1;
} else if (this.heuristicDiskCost > o.heuristicDiskCost) {
return 1;
}
// next, check the CPU cost. again, if we have actual costs on both, use them, otherwise use the heuristic costs.
if (this.cpuCost != UNKNOWN && o.cpuCost != UNKNOWN) {
return this.cpuCost < o.cpuCost ? -1 : this.cpuCost > o.cpuCost ? 1 : 0;
} else if (this.heuristicCpuCost < o.heuristicCpuCost) {
return -1;
} else if (this.heuristicCpuCost > o.heuristicCpuCost) {
return 1;
} else {
return 0;
}
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"Costs",
"o",
")",
"{",
"// check the network cost. if we have actual costs on both, use them, otherwise use the heuristic costs.",
"if",
"(",
"this",
".",
"networkCost",
"!=",
"UNKNOWN",
"&&",
"o",
".",
"networkCost",
"... | The order of comparison is: network first, then disk, then CPU. The comparison here happens each time
primarily after the heuristic costs, then after the quantifiable costs.
@see java.lang.Comparable#compareTo(java.lang.Object) | [
"The",
"order",
"of",
"comparison",
"is",
":",
"network",
"first",
"then",
"disk",
"then",
"CPU",
".",
"The",
"comparison",
"here",
"happens",
"each",
"time",
"primarily",
"after",
"the",
"heuristic",
"costs",
"then",
"after",
"the",
"quantifiable",
"costs",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/costs/Costs.java#L406-L440 | train | Compare two costs. | [
30522,
1030,
2058,
15637,
2270,
20014,
12826,
3406,
1006,
5366,
1051,
1007,
1063,
1013,
1013,
4638,
1996,
2897,
3465,
1012,
2065,
2057,
2031,
5025,
5366,
2006,
2119,
1010,
2224,
2068,
1010,
4728,
2224,
1996,
2002,
9496,
10074,
5366,
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-core/src/main/java/org/apache/flink/api/common/JobExecutionResult.java | JobExecutionResult.getAllAccumulatorResults | public Map<String, Object> getAllAccumulatorResults() {
return accumulatorResults.entrySet()
.stream()
.collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().getUnchecked()));
} | java | public Map<String, Object> getAllAccumulatorResults() {
return accumulatorResults.entrySet()
.stream()
.collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().getUnchecked()));
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getAllAccumulatorResults",
"(",
")",
"{",
"return",
"accumulatorResults",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"collect",
"(",
"Collectors",
".",
"toMap",
"(",
"Map",
".",
"Entry",
... | Gets all accumulators produced by the job. The map contains the accumulators as
mappings from the accumulator name to the accumulator value.
@return A map containing all accumulators produced by the job. | [
"Gets",
"all",
"accumulators",
"produced",
"by",
"the",
"job",
".",
"The",
"map",
"contains",
"the",
"accumulators",
"as",
"mappings",
"from",
"the",
"accumulator",
"name",
"to",
"the",
"accumulator",
"value",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/JobExecutionResult.java#L99-L103 | train | Get all accumulator results. | [
30522,
2270,
4949,
1026,
5164,
1010,
4874,
1028,
2131,
25425,
9468,
2819,
20350,
6072,
11314,
2015,
1006,
1007,
1063,
2709,
16222,
2819,
20350,
6072,
11314,
2015,
1012,
4443,
13462,
1006,
1007,
1012,
5460,
1006,
1007,
1012,
8145,
1006,
1425... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactory.java | RepositoryConfigurationFactory.createDefaultRepositoryConfiguration | public static List<RepositoryConfiguration> createDefaultRepositoryConfiguration() {
MavenSettings mavenSettings = new MavenSettingsReader().readSettings();
List<RepositoryConfiguration> repositoryConfiguration = new ArrayList<>();
repositoryConfiguration.add(MAVEN_CENTRAL);
if (!Boolean.getBoolean("disableSpringSnapshotRepos")) {
repositoryConfiguration.add(SPRING_MILESTONE);
repositoryConfiguration.add(SPRING_SNAPSHOT);
}
addDefaultCacheAsRepository(mavenSettings.getLocalRepository(),
repositoryConfiguration);
addActiveProfileRepositories(mavenSettings.getActiveProfiles(),
repositoryConfiguration);
return repositoryConfiguration;
} | java | public static List<RepositoryConfiguration> createDefaultRepositoryConfiguration() {
MavenSettings mavenSettings = new MavenSettingsReader().readSettings();
List<RepositoryConfiguration> repositoryConfiguration = new ArrayList<>();
repositoryConfiguration.add(MAVEN_CENTRAL);
if (!Boolean.getBoolean("disableSpringSnapshotRepos")) {
repositoryConfiguration.add(SPRING_MILESTONE);
repositoryConfiguration.add(SPRING_SNAPSHOT);
}
addDefaultCacheAsRepository(mavenSettings.getLocalRepository(),
repositoryConfiguration);
addActiveProfileRepositories(mavenSettings.getActiveProfiles(),
repositoryConfiguration);
return repositoryConfiguration;
} | [
"public",
"static",
"List",
"<",
"RepositoryConfiguration",
">",
"createDefaultRepositoryConfiguration",
"(",
")",
"{",
"MavenSettings",
"mavenSettings",
"=",
"new",
"MavenSettingsReader",
"(",
")",
".",
"readSettings",
"(",
")",
";",
"List",
"<",
"RepositoryConfigura... | Create a new default repository configuration.
@return the newly-created default repository configuration | [
"Create",
"a",
"new",
"default",
"repository",
"configuration",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/RepositoryConfigurationFactory.java#L60-L73 | train | Creates a default repository configuration. | [
30522,
2270,
10763,
2862,
1026,
22409,
8663,
8873,
27390,
3370,
1028,
2580,
12879,
23505,
2890,
6873,
28307,
2100,
8663,
8873,
27390,
3370,
1006,
1007,
1063,
5003,
8159,
21678,
8613,
5003,
8159,
21678,
8613,
1027,
2047,
5003,
8159,
21678,
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... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/ds/pooled/DbSetting.java | DbSetting.getDbConfig | public DbConfig getDbConfig(String group) {
final Setting config = setting.getSetting(group);
if (CollectionUtil.isEmpty(config)) {
throw new DbRuntimeException("No Hutool pool config for group: [{}]", group);
}
final DbConfig dbConfig = new DbConfig();
// 基本信息
final String url = config.getAndRemoveStr(DSFactory.KEY_ALIAS_URL);
if (StrUtil.isBlank(url)) {
throw new DbRuntimeException("No JDBC URL for group: [{}]", group);
}
dbConfig.setUrl(url);
// 自动识别Driver
final String driver = config.getAndRemoveStr(DSFactory.KEY_ALIAS_DRIVER);
dbConfig.setDriver(StrUtil.isNotBlank(driver) ? driver : DriverUtil.identifyDriver(url));
dbConfig.setUser(config.getAndRemoveStr(DSFactory.KEY_ALIAS_USER));
dbConfig.setPass(config.getAndRemoveStr(DSFactory.KEY_ALIAS_PASSWORD));
// 连接池相关信息
dbConfig.setInitialSize(setting.getInt("initialSize", group, 0));
dbConfig.setMinIdle(setting.getInt("minIdle", group, 0));
dbConfig.setMaxActive(setting.getInt("maxActive", group, 8));
dbConfig.setMaxWait(setting.getLong("maxWait", group, 6000L));
return dbConfig;
} | java | public DbConfig getDbConfig(String group) {
final Setting config = setting.getSetting(group);
if (CollectionUtil.isEmpty(config)) {
throw new DbRuntimeException("No Hutool pool config for group: [{}]", group);
}
final DbConfig dbConfig = new DbConfig();
// 基本信息
final String url = config.getAndRemoveStr(DSFactory.KEY_ALIAS_URL);
if (StrUtil.isBlank(url)) {
throw new DbRuntimeException("No JDBC URL for group: [{}]", group);
}
dbConfig.setUrl(url);
// 自动识别Driver
final String driver = config.getAndRemoveStr(DSFactory.KEY_ALIAS_DRIVER);
dbConfig.setDriver(StrUtil.isNotBlank(driver) ? driver : DriverUtil.identifyDriver(url));
dbConfig.setUser(config.getAndRemoveStr(DSFactory.KEY_ALIAS_USER));
dbConfig.setPass(config.getAndRemoveStr(DSFactory.KEY_ALIAS_PASSWORD));
// 连接池相关信息
dbConfig.setInitialSize(setting.getInt("initialSize", group, 0));
dbConfig.setMinIdle(setting.getInt("minIdle", group, 0));
dbConfig.setMaxActive(setting.getInt("maxActive", group, 8));
dbConfig.setMaxWait(setting.getLong("maxWait", group, 6000L));
return dbConfig;
} | [
"public",
"DbConfig",
"getDbConfig",
"(",
"String",
"group",
")",
"{",
"final",
"Setting",
"config",
"=",
"setting",
".",
"getSetting",
"(",
"group",
")",
";",
"if",
"(",
"CollectionUtil",
".",
"isEmpty",
"(",
"config",
")",
")",
"{",
"throw",
"new",
"Db... | 获得数据库连接信息
@param group 分组
@return 分组 | [
"获得数据库连接信息"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/ds/pooled/DbSetting.java#L48-L75 | train | Gets the db config from the given group. | [
30522,
2270,
16962,
8663,
8873,
2290,
2131,
18939,
8663,
8873,
2290,
1006,
5164,
2177,
1007,
1063,
2345,
4292,
9530,
8873,
2290,
1027,
4292,
1012,
4152,
18319,
3070,
1006,
2177,
1007,
1025,
2065,
1006,
3074,
21823,
2140,
1012,
2003,
6633,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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() {
if (position + 5 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 5));
byte[] buf = buffer;
return ((long) (0xff & buf[position++]) << 40) | ((long) (0xff & buf[position++]) << 32)
| ((long) (0xff & buf[position++]) << 24) | ((long) (0xff & buf[position++]) << 16)
| ((long) (0xff & buf[position++]) << 8) | ((long) (0xff & buf[position++]));
} | java | public final long getBeUlong48() {
if (position + 5 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 5));
byte[] buf = buffer;
return ((long) (0xff & buf[position++]) << 40) | ((long) (0xff & buf[position++]) << 32)
| ((long) (0xff & buf[position++]) << 24) | ((long) (0xff & buf[position++]) << 16)
| ((long) (0xff & buf[position++]) << 8) | ((long) (0xff & buf[position++]));
} | [
"public",
"final",
"long",
"getBeUlong48",
"(",
")",
"{",
"if",
"(",
"position",
"+",
"5",
">=",
"origin",
"+",
"limit",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"(",
"position",
"-",
"origin",
"+",
"5",
")",
")",
... | Return next 48-bit unsigned long from buffer. (big-endian)
@see mysql-5.6.10/include/myisampack.h - mi_uint6korr | [
"Return",
"next",
"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#L762-L770 | train | Gets a long value in the buffer as encoded in a BEU48 format. | [
30522,
2270,
2345,
2146,
2131,
4783,
18845,
3070,
18139,
1006,
1007,
1063,
2065,
1006,
2597,
1009,
1019,
1028,
1027,
4761,
1009,
5787,
1007,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
5787,
4654,
9468,
13089,
1024,
1000,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/algorithm/Viterbi.java | Viterbi.compute | public static void compute(List<Vertex> vertexList, TransformMatrix transformMatrixDictionary)
{
if (Nature.values().length != transformMatrixDictionary.states.length)
transformMatrixDictionary.extend(Nature.values().length);
int length = vertexList.size() - 1;
double[][] cost = new double[2][]; // 滚动数组
Iterator<Vertex> iterator = vertexList.iterator();
Vertex start = iterator.next();
Nature pre = start.attribute.nature[0];
// 第一个是确定的
// start.confirmNature(pre);
// 第二个也可以简单地算出来
Vertex preItem;
Nature[] preTagSet;
{
Vertex item = iterator.next();
cost[0] = new double[item.attribute.nature.length];
int j = 0;
int curIndex = 0;
for (Nature cur : item.attribute.nature)
{
cost[0][j] = transformMatrixDictionary.transititon_probability[pre.ordinal()][cur.ordinal()] - Math.log((item.attribute.frequency[curIndex] + 1e-8) / transformMatrixDictionary.getTotalFrequency(cur.ordinal()));
++j;
++curIndex;
}
preTagSet = item.attribute.nature;
preItem = item;
}
// 第三个开始复杂一些
for (int i = 1; i < length; ++i)
{
int index_i = i & 1;
int index_i_1 = 1 - index_i;
Vertex item = iterator.next();
cost[index_i] = new double[item.attribute.nature.length];
double perfect_cost_line = Double.MAX_VALUE;
int k = 0;
Nature[] curTagSet = item.attribute.nature;
for (Nature cur : curTagSet)
{
cost[index_i][k] = Double.MAX_VALUE;
int j = 0;
for (Nature p : preTagSet)
{
double now = cost[index_i_1][j] + transformMatrixDictionary.transititon_probability[p.ordinal()][cur.ordinal()] - Math.log((item.attribute.frequency[k] + 1e-8) / transformMatrixDictionary.getTotalFrequency(cur.ordinal()));
if (now < cost[index_i][k])
{
cost[index_i][k] = now;
if (now < perfect_cost_line)
{
perfect_cost_line = now;
pre = p;
}
}
++j;
}
++k;
}
preItem.confirmNature(pre);
preTagSet = curTagSet;
preItem = item;
}
} | java | public static void compute(List<Vertex> vertexList, TransformMatrix transformMatrixDictionary)
{
if (Nature.values().length != transformMatrixDictionary.states.length)
transformMatrixDictionary.extend(Nature.values().length);
int length = vertexList.size() - 1;
double[][] cost = new double[2][]; // 滚动数组
Iterator<Vertex> iterator = vertexList.iterator();
Vertex start = iterator.next();
Nature pre = start.attribute.nature[0];
// 第一个是确定的
// start.confirmNature(pre);
// 第二个也可以简单地算出来
Vertex preItem;
Nature[] preTagSet;
{
Vertex item = iterator.next();
cost[0] = new double[item.attribute.nature.length];
int j = 0;
int curIndex = 0;
for (Nature cur : item.attribute.nature)
{
cost[0][j] = transformMatrixDictionary.transititon_probability[pre.ordinal()][cur.ordinal()] - Math.log((item.attribute.frequency[curIndex] + 1e-8) / transformMatrixDictionary.getTotalFrequency(cur.ordinal()));
++j;
++curIndex;
}
preTagSet = item.attribute.nature;
preItem = item;
}
// 第三个开始复杂一些
for (int i = 1; i < length; ++i)
{
int index_i = i & 1;
int index_i_1 = 1 - index_i;
Vertex item = iterator.next();
cost[index_i] = new double[item.attribute.nature.length];
double perfect_cost_line = Double.MAX_VALUE;
int k = 0;
Nature[] curTagSet = item.attribute.nature;
for (Nature cur : curTagSet)
{
cost[index_i][k] = Double.MAX_VALUE;
int j = 0;
for (Nature p : preTagSet)
{
double now = cost[index_i_1][j] + transformMatrixDictionary.transititon_probability[p.ordinal()][cur.ordinal()] - Math.log((item.attribute.frequency[k] + 1e-8) / transformMatrixDictionary.getTotalFrequency(cur.ordinal()));
if (now < cost[index_i][k])
{
cost[index_i][k] = now;
if (now < perfect_cost_line)
{
perfect_cost_line = now;
pre = p;
}
}
++j;
}
++k;
}
preItem.confirmNature(pre);
preTagSet = curTagSet;
preItem = item;
}
} | [
"public",
"static",
"void",
"compute",
"(",
"List",
"<",
"Vertex",
">",
"vertexList",
",",
"TransformMatrix",
"transformMatrixDictionary",
")",
"{",
"if",
"(",
"Nature",
".",
"values",
"(",
")",
".",
"length",
"!=",
"transformMatrixDictionary",
".",
"states",
... | 特化版的求解HMM模型
@param vertexList 包含Vertex.B节点的路径
@param transformMatrixDictionary 词典对应的转移矩阵 | [
"特化版的求解HMM模型"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/Viterbi.java#L103-L165 | train | Compute the National Sequence of Points. | [
30522,
2270,
10763,
11675,
24134,
1006,
2862,
1026,
19449,
1028,
19449,
9863,
1010,
10938,
18900,
17682,
10938,
18900,
17682,
29201,
3258,
5649,
1007,
1063,
2065,
1006,
3267,
1012,
5300,
1006,
1007,
1012,
3091,
999,
1027,
10938,
18900,
17682,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java | DependencyCustomizer.add | public DependencyCustomizer add(String module, boolean transitive) {
return add(module, null, null, transitive);
} | java | public DependencyCustomizer add(String module, boolean transitive) {
return add(module, null, null, transitive);
} | [
"public",
"DependencyCustomizer",
"add",
"(",
"String",
"module",
",",
"boolean",
"transitive",
")",
"{",
"return",
"add",
"(",
"module",
",",
"null",
",",
"null",
",",
"transitive",
")",
";",
"}"
] | Add a single dependency and, optionally, all of its dependencies. The group ID and
version of the dependency are resolved from the module using the customizer's
{@link ArtifactCoordinatesResolver}.
@param module the module ID
@param transitive {@code true} if the transitive dependencies should also be added,
otherwise {@code false}
@return this {@link DependencyCustomizer} for continued use | [
"Add",
"a",
"single",
"dependency",
"and",
"optionally",
"all",
"of",
"its",
"dependencies",
".",
"The",
"group",
"ID",
"and",
"version",
"of",
"the",
"dependency",
"are",
"resolved",
"from",
"the",
"module",
"using",
"the",
"customizer",
"s",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/DependencyCustomizer.java#L207-L209 | train | Add a module to the list of dependencies. | [
30522,
2270,
24394,
7874,
20389,
17629,
5587,
1006,
5164,
11336,
1010,
22017,
20898,
6671,
3512,
1007,
1063,
2709,
5587,
1006,
11336,
1010,
19701,
1010,
19701,
1010,
6671,
3512,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/digest/DigestUtil.java | DigestUtil.md5Hex | public static String md5Hex(String data, String charset) {
return new MD5().digestHex(data, charset);
} | java | public static String md5Hex(String data, String charset) {
return new MD5().digestHex(data, charset);
} | [
"public",
"static",
"String",
"md5Hex",
"(",
"String",
"data",
",",
"String",
"charset",
")",
"{",
"return",
"new",
"MD5",
"(",
")",
".",
"digestHex",
"(",
"data",
",",
"charset",
")",
";",
"}"
] | 计算16位MD5摘要值,并转为16进制字符串
@param data 被摘要数据
@param charset 编码
@return MD5摘要的16进制表示 | [
"计算16位MD5摘要值,并转为16进制字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/digest/DigestUtil.java#L87-L89 | train | Returns the MD5 hash of the given data. | [
30522,
2270,
10763,
5164,
9108,
2629,
5369,
2595,
1006,
5164,
2951,
1010,
5164,
25869,
13462,
1007,
1063,
2709,
2047,
9108,
2629,
1006,
1007,
1012,
17886,
5369,
2595,
1006,
2951,
1010,
25869,
13462,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getBoolean | public boolean getBoolean(String key, boolean defaultValue) {
Object o = getRawValue(key);
if (o == null) {
return defaultValue;
}
return convertToBoolean(o);
} | java | public boolean getBoolean(String key, boolean defaultValue) {
Object o = getRawValue(key);
if (o == null) {
return defaultValue;
}
return convertToBoolean(o);
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"Object",
"o",
"=",
"getRawValue",
"(",
"key",
")",
";",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"return",
"convertToBo... | Returns the value associated with the given key as a boolean.
@param key
the key pointing to the associated value
@param defaultValue
the default value which is returned in case there is no value associated with the given key
@return the (default) value associated with the given key | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"key",
"as",
"a",
"boolean",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L352-L359 | train | Returns the boolean value for the given key. | [
30522,
2270,
22017,
20898,
2131,
5092,
9890,
2319,
1006,
5164,
3145,
1010,
22017,
20898,
12398,
10175,
5657,
1007,
1063,
4874,
1051,
1027,
2131,
2527,
2860,
10175,
5657,
1006,
3145,
1007,
1025,
2065,
1006,
1051,
1027,
1027,
19701,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java | BufferUtil.lineEnd | public static int lineEnd(ByteBuffer buffer, int maxLength) {
int primitivePosition = buffer.position();
boolean canEnd = false;
int charIndex = primitivePosition;
byte b;
while (buffer.hasRemaining()) {
b = buffer.get();
charIndex++;
if (b == StrUtil.C_CR) {
canEnd = true;
} else if (b == StrUtil.C_LF) {
return canEnd ? charIndex - 2 : charIndex - 1;
} else {
// 只有\r无法确认换行
canEnd = false;
}
if (charIndex - primitivePosition > maxLength) {
// 查找到尽头,未找到,还原位置
buffer.position(primitivePosition);
throw new IndexOutOfBoundsException(StrUtil.format("Position is out of maxLength: {}", maxLength));
}
}
// 查找到buffer尽头,未找到,还原位置
buffer.position(primitivePosition);
// 读到结束位置
return -1;
} | java | public static int lineEnd(ByteBuffer buffer, int maxLength) {
int primitivePosition = buffer.position();
boolean canEnd = false;
int charIndex = primitivePosition;
byte b;
while (buffer.hasRemaining()) {
b = buffer.get();
charIndex++;
if (b == StrUtil.C_CR) {
canEnd = true;
} else if (b == StrUtil.C_LF) {
return canEnd ? charIndex - 2 : charIndex - 1;
} else {
// 只有\r无法确认换行
canEnd = false;
}
if (charIndex - primitivePosition > maxLength) {
// 查找到尽头,未找到,还原位置
buffer.position(primitivePosition);
throw new IndexOutOfBoundsException(StrUtil.format("Position is out of maxLength: {}", maxLength));
}
}
// 查找到buffer尽头,未找到,还原位置
buffer.position(primitivePosition);
// 读到结束位置
return -1;
} | [
"public",
"static",
"int",
"lineEnd",
"(",
"ByteBuffer",
"buffer",
",",
"int",
"maxLength",
")",
"{",
"int",
"primitivePosition",
"=",
"buffer",
".",
"position",
"(",
")",
";",
"boolean",
"canEnd",
"=",
"false",
";",
"int",
"charIndex",
"=",
"primitivePositi... | 一行的末尾位置,查找位置时位移ByteBuffer到结束位置<br>
支持的换行符如下:
<pre>
1. \r\n
2. \n
</pre>
@param buffer {@link ByteBuffer}
@param maxLength 读取最大长度
@return 末尾位置,未找到或达到最大长度返回-1 | [
"一行的末尾位置,查找位置时位移ByteBuffer到结束位置<br",
">",
"支持的换行符如下:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java#L161-L189 | train | Reads the next line of data from the given ByteBuffer. | [
30522,
2270,
10763,
20014,
2240,
10497,
1006,
24880,
8569,
12494,
17698,
1010,
20014,
4098,
7770,
13512,
2232,
1007,
1063,
20014,
10968,
26994,
1027,
17698,
1012,
2597,
1006,
1007,
1025,
22017,
20898,
11942,
4859,
1027,
6270,
1025,
20014,
258... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java | ExcelReader.addHeaderAlias | public ExcelReader addHeaderAlias(String header, String alias) {
this.headerAlias.put(header, alias);
return this;
} | java | public ExcelReader addHeaderAlias(String header, String alias) {
this.headerAlias.put(header, alias);
return this;
} | [
"public",
"ExcelReader",
"addHeaderAlias",
"(",
"String",
"header",
",",
"String",
"alias",
")",
"{",
"this",
".",
"headerAlias",
".",
"put",
"(",
"header",
",",
"alias",
")",
";",
"return",
"this",
";",
"}"
] | 增加标题别名
@param header 标题
@param alias 别名
@return this | [
"增加标题别名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java#L190-L193 | train | Adds an alias for a header. | [
30522,
2270,
24970,
16416,
4063,
5587,
4974,
21673,
7951,
1006,
5164,
20346,
1010,
5164,
14593,
1007,
1063,
2023,
1012,
20346,
22786,
2015,
1012,
2404,
1006,
20346,
1010,
14593,
1007,
1025,
2709,
2023,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java | WebClientExchangeTags.outcome | public static Tag outcome(ClientResponse response) {
try {
if (response != null) {
HttpStatus status = response.statusCode();
if (status.is1xxInformational()) {
return OUTCOME_INFORMATIONAL;
}
if (status.is2xxSuccessful()) {
return OUTCOME_SUCCESS;
}
if (status.is3xxRedirection()) {
return OUTCOME_REDIRECTION;
}
if (status.is4xxClientError()) {
return OUTCOME_CLIENT_ERROR;
}
if (status.is5xxServerError()) {
return OUTCOME_SERVER_ERROR;
}
}
return OUTCOME_UNKNOWN;
}
catch (IllegalArgumentException exc) {
return OUTCOME_UNKNOWN;
}
} | java | public static Tag outcome(ClientResponse response) {
try {
if (response != null) {
HttpStatus status = response.statusCode();
if (status.is1xxInformational()) {
return OUTCOME_INFORMATIONAL;
}
if (status.is2xxSuccessful()) {
return OUTCOME_SUCCESS;
}
if (status.is3xxRedirection()) {
return OUTCOME_REDIRECTION;
}
if (status.is4xxClientError()) {
return OUTCOME_CLIENT_ERROR;
}
if (status.is5xxServerError()) {
return OUTCOME_SERVER_ERROR;
}
}
return OUTCOME_UNKNOWN;
}
catch (IllegalArgumentException exc) {
return OUTCOME_UNKNOWN;
}
} | [
"public",
"static",
"Tag",
"outcome",
"(",
"ClientResponse",
"response",
")",
"{",
"try",
"{",
"if",
"(",
"response",
"!=",
"null",
")",
"{",
"HttpStatus",
"status",
"=",
"response",
".",
"statusCode",
"(",
")",
";",
"if",
"(",
"status",
".",
"is1xxInfor... | Creates an {@code outcome} {@code Tag} derived from the
{@link ClientResponse#statusCode() status} of the given {@code response}.
@param response the response
@return the outcome tag
@since 2.2.0 | [
"Creates",
"an",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java#L135-L160 | train | Returns the outcome of the response. | [
30522,
2270,
10763,
6415,
9560,
1006,
7396,
6072,
26029,
3366,
3433,
1007,
1063,
3046,
1063,
2065,
1006,
3433,
999,
1027,
19701,
1007,
1063,
16770,
29336,
2271,
3570,
1027,
3433,
1012,
3570,
16044,
1006,
1007,
1025,
2065,
1006,
3570,
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/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceUtils.java | ServiceUtils.indexOfDomainMatch | public static int indexOfDomainMatch(String userName) {
if (userName == null) {
return -1;
}
int idx = userName.indexOf('/');
int idx2 = userName.indexOf('@');
int endIdx = Math.min(idx, idx2); // Use the earlier match.
// Unless at least one of '/' or '@' was not found, in
// which case, user the latter match.
if (endIdx == -1) {
endIdx = Math.max(idx, idx2);
}
return endIdx;
} | java | public static int indexOfDomainMatch(String userName) {
if (userName == null) {
return -1;
}
int idx = userName.indexOf('/');
int idx2 = userName.indexOf('@');
int endIdx = Math.min(idx, idx2); // Use the earlier match.
// Unless at least one of '/' or '@' was not found, in
// which case, user the latter match.
if (endIdx == -1) {
endIdx = Math.max(idx, idx2);
}
return endIdx;
} | [
"public",
"static",
"int",
"indexOfDomainMatch",
"(",
"String",
"userName",
")",
"{",
"if",
"(",
"userName",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"int",
"idx",
"=",
"userName",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"int",
"idx2",
... | /*
Get the index separating the user name from domain name (the user's name up
to the first '/' or '@').
@param userName full user name.
@return index of domain match or -1 if not found | [
"/",
"*",
"Get",
"the",
"index",
"separating",
"the",
"user",
"name",
"from",
"domain",
"name",
"(",
"the",
"user",
"s",
"name",
"up",
"to",
"the",
"first",
"/",
"or",
"@",
")",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceUtils.java#L29-L43 | train | Gets the index of the domain match. | [
30522,
2270,
10763,
20014,
5950,
11253,
9527,
8113,
18900,
2818,
1006,
5164,
5310,
18442,
1007,
1063,
2065,
1006,
5310,
18442,
1027,
1027,
19701,
1007,
1063,
2709,
1011,
1015,
1025,
1065,
20014,
8909,
2595,
1027,
5310,
18442,
1012,
5950,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.group | public static <T> List<List<T>> group(Collection<T> collection, Hash<T> hash) {
final List<List<T>> result = new ArrayList<>();
if (isEmpty(collection)) {
return result;
}
if (null == hash) {
// 默认hash算法,按照元素的hashCode分组
hash = new Hash<T>() {
@Override
public int hash(T t) {
return null == t ? 0 : t.hashCode();
}
};
}
int index;
List<T> subList;
for (T t : collection) {
index = hash.hash(t);
if (result.size() - 1 < index) {
while (result.size() - 1 < index) {
result.add(null);
}
result.set(index, newArrayList(t));
} else {
subList = result.get(index);
if (null == subList) {
result.set(index, newArrayList(t));
} else {
subList.add(t);
}
}
}
return result;
} | java | public static <T> List<List<T>> group(Collection<T> collection, Hash<T> hash) {
final List<List<T>> result = new ArrayList<>();
if (isEmpty(collection)) {
return result;
}
if (null == hash) {
// 默认hash算法,按照元素的hashCode分组
hash = new Hash<T>() {
@Override
public int hash(T t) {
return null == t ? 0 : t.hashCode();
}
};
}
int index;
List<T> subList;
for (T t : collection) {
index = hash.hash(t);
if (result.size() - 1 < index) {
while (result.size() - 1 < index) {
result.add(null);
}
result.set(index, newArrayList(t));
} else {
subList = result.get(index);
if (null == subList) {
result.set(index, newArrayList(t));
} else {
subList.add(t);
}
}
}
return result;
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"List",
"<",
"T",
">",
">",
"group",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"Hash",
"<",
"T",
">",
"hash",
")",
"{",
"final",
"List",
"<",
"List",
"<",
"T",
">",
">",
"result",
"=",
... | 分组,按照{@link Hash}接口定义的hash算法,集合中的元素放入hash值对应的子列表中
@param <T> 元素类型
@param collection 被分组的集合
@param hash Hash值算法,决定元素放在第几个分组的规则
@return 分组后的集合 | [
"分组,按照",
"{",
"@link",
"Hash",
"}",
"接口定义的hash算法,集合中的元素放入hash值对应的子列表中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2286-L2320 | train | Creates a list of lists containing all the items in the specified collection that match the specified hash. | [
30522,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
2862,
1026,
1056,
1028,
1028,
2177,
1006,
3074,
1026,
1056,
1028,
3074,
1010,
23325,
1026,
1056,
1028,
23325,
1007,
1063,
2345,
2862,
1026,
2862,
1026,
1056,
1028,
1028,
2765,
1027,
2047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.setTimeDuration | public void setTimeDuration(String name, long value, TimeUnit unit) {
set(name, value + ParsedTimeDuration.unitFor(unit).suffix());
} | java | public void setTimeDuration(String name, long value, TimeUnit unit) {
set(name, value + ParsedTimeDuration.unitFor(unit).suffix());
} | [
"public",
"void",
"setTimeDuration",
"(",
"String",
"name",
",",
"long",
"value",
",",
"TimeUnit",
"unit",
")",
"{",
"set",
"(",
"name",
",",
"value",
"+",
"ParsedTimeDuration",
".",
"unitFor",
"(",
"unit",
")",
".",
"suffix",
"(",
")",
")",
";",
"}"
] | Set the value of <code>name</code> to the given time duration. This
is equivalent to <code>set(<name>, value + <time suffix>)</code>.
@param name Property name
@param value Time duration
@param unit Unit of time | [
"Set",
"the",
"value",
"of",
"<code",
">",
"name<",
"/",
"code",
">",
"to",
"the",
"given",
"time",
"duration",
".",
"This",
"is",
"equivalent",
"to",
"<code",
">",
"set",
"(",
"<",
";",
"name>",
";",
"value",
"+",
"<",
";",
"time",
"suffix>"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1648-L1650 | train | Sets the value of the named time duration property. | [
30522,
2270,
11675,
2275,
7292,
24979,
3370,
1006,
5164,
2171,
1010,
2146,
3643,
1010,
2051,
19496,
2102,
3131,
1007,
1063,
2275,
1006,
2171,
1010,
3643,
1009,
11968,
6924,
7292,
24979,
3370,
1012,
3131,
29278,
1006,
3131,
1007,
1012,
16809... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CodecOutputList.java | CodecOutputList.recycle | void recycle() {
for (int i = 0 ; i < size; i ++) {
array[i] = null;
}
size = 0;
insertSinceRecycled = false;
recycler.recycle(this);
} | java | void recycle() {
for (int i = 0 ; i < size; i ++) {
array[i] = null;
}
size = 0;
insertSinceRecycled = false;
recycler.recycle(this);
} | [
"void",
"recycle",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"array",
"[",
"i",
"]",
"=",
"null",
";",
"}",
"size",
"=",
"0",
";",
"insertSinceRecycled",
"=",
"false",
";",
"recycler",
"... | Recycle the array which will clear it and null out all entries in the internal storage. | [
"Recycle",
"the",
"array",
"which",
"will",
"clear",
"it",
"and",
"null",
"out",
"all",
"entries",
"in",
"the",
"internal",
"storage",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/CodecOutputList.java#L190-L198 | train | Recycle the array of the exception. | [
30522,
11675,
28667,
2100,
14321,
1006,
1007,
1063,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
2946,
1025,
1045,
1009,
1009,
1007,
1063,
9140,
1031,
1045,
1033,
1027,
19701,
1025,
1065,
2946,
1027,
1014,
1025,
19274,
11493,
1711... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/GlobalLogFactory.java | GlobalLogFactory.set | public static LogFactory set(Class<? extends LogFactory> logFactoryClass) {
try {
return set(logFactoryClass.newInstance());
} catch (Exception e) {
throw new IllegalArgumentException("Can not instance LogFactory class!", e);
}
} | java | public static LogFactory set(Class<? extends LogFactory> logFactoryClass) {
try {
return set(logFactoryClass.newInstance());
} catch (Exception e) {
throw new IllegalArgumentException("Can not instance LogFactory class!", e);
}
} | [
"public",
"static",
"LogFactory",
"set",
"(",
"Class",
"<",
"?",
"extends",
"LogFactory",
">",
"logFactoryClass",
")",
"{",
"try",
"{",
"return",
"set",
"(",
"logFactoryClass",
".",
"newInstance",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
... | 自定义日志实现
@see Slf4jLogFactory
@see Log4jLogFactory
@see Log4j2LogFactory
@see ApacheCommonsLogFactory
@see JdkLogFactory
@see ConsoleLogFactory
@param logFactoryClass 日志工厂类
@return 自定义的日志工厂类 | [
"自定义日志实现"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/GlobalLogFactory.java#L50-L56 | train | Set the LogFactory instance with the given class. | [
30522,
2270,
10763,
8833,
21450,
2275,
1006,
2465,
1026,
1029,
8908,
8833,
21450,
1028,
8833,
21450,
26266,
1007,
1063,
3046,
1063,
2709,
2275,
1006,
8833,
21450,
26266,
1012,
2047,
7076,
26897,
1006,
1007,
1007,
1025,
1065,
4608,
1006,
645... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.getFieldValue | public static Object getFieldValue(Object bean, String fieldNameOrIndex) {
if (null == bean || null == fieldNameOrIndex) {
return null;
}
if (bean instanceof Map) {
return ((Map<?, ?>) bean).get(fieldNameOrIndex);
} else if (bean instanceof Collection) {
return CollUtil.get((Collection<?>) bean, Integer.parseInt(fieldNameOrIndex));
} else if (ArrayUtil.isArray(bean)) {
return ArrayUtil.get(bean, Integer.parseInt(fieldNameOrIndex));
} else {// 普通Bean对象
return ReflectUtil.getFieldValue(bean, fieldNameOrIndex);
}
} | java | public static Object getFieldValue(Object bean, String fieldNameOrIndex) {
if (null == bean || null == fieldNameOrIndex) {
return null;
}
if (bean instanceof Map) {
return ((Map<?, ?>) bean).get(fieldNameOrIndex);
} else if (bean instanceof Collection) {
return CollUtil.get((Collection<?>) bean, Integer.parseInt(fieldNameOrIndex));
} else if (ArrayUtil.isArray(bean)) {
return ArrayUtil.get(bean, Integer.parseInt(fieldNameOrIndex));
} else {// 普通Bean对象
return ReflectUtil.getFieldValue(bean, fieldNameOrIndex);
}
} | [
"public",
"static",
"Object",
"getFieldValue",
"(",
"Object",
"bean",
",",
"String",
"fieldNameOrIndex",
")",
"{",
"if",
"(",
"null",
"==",
"bean",
"||",
"null",
"==",
"fieldNameOrIndex",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"bean",
"instanceof... | 获得字段值,通过反射直接获得字段值,并不调用getXXX方法<br>
对象同样支持Map类型,fieldNameOrIndex即为key
@param bean Bean对象
@param fieldNameOrIndex 字段名或序号,序号支持负数
@return 字段值 | [
"获得字段值,通过反射直接获得字段值,并不调用getXXX方法<br",
">",
"对象同样支持Map类型,fieldNameOrIndex即为key"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L254-L268 | train | Gets the value of the specified field in the specified bean. | [
30522,
2270,
10763,
4874,
2131,
3790,
10175,
5657,
1006,
4874,
14068,
1010,
5164,
2492,
18442,
28741,
3207,
2595,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
14068,
1064,
1064,
19701,
1027,
1027,
2492,
18442,
28741,
3207,
2595,
1007,
1063,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getBeUlong56 | public final long getBeUlong56(final int pos) {
final int position = origin + pos;
if (pos + 6 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 6)));
byte[] buf = buffer;
return ((long) (0xff & buf[position + 6])) | ((long) (0xff & buf[position + 5]) << 8)
| ((long) (0xff & buf[position + 4]) << 16) | ((long) (0xff & buf[position + 3]) << 24)
| ((long) (0xff & buf[position + 2]) << 32) | ((long) (0xff & buf[position + 1]) << 40)
| ((long) (0xff & buf[position]) << 48);
} | java | public final long getBeUlong56(final int pos) {
final int position = origin + pos;
if (pos + 6 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 6)));
byte[] buf = buffer;
return ((long) (0xff & buf[position + 6])) | ((long) (0xff & buf[position + 5]) << 8)
| ((long) (0xff & buf[position + 4]) << 16) | ((long) (0xff & buf[position + 3]) << 24)
| ((long) (0xff & buf[position + 2]) << 32) | ((long) (0xff & buf[position + 1]) << 40)
| ((long) (0xff & buf[position]) << 48);
} | [
"public",
"final",
"long",
"getBeUlong56",
"(",
"final",
"int",
"pos",
")",
"{",
"final",
"int",
"position",
"=",
"origin",
"+",
"pos",
";",
"if",
"(",
"pos",
"+",
"6",
">=",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentExceptio... | Return 56-bit unsigned int from buffer. (big-endian) | [
"Return",
"56",
"-",
"bit",
"unsigned",
"int",
"from",
"buffer",
".",
"(",
"big",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L805-L816 | train | Gets a long from the buffer at the given position in the beacon. | [
30522,
2270,
2345,
2146,
2131,
4783,
18845,
3070,
26976,
1006,
2345,
20014,
13433,
2015,
1007,
1063,
2345,
20014,
2597,
1027,
4761,
1009,
13433,
2015,
1025,
2065,
1006,
13433,
2015,
1009,
1020,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/occurrence/Occurrence.java | Occurrence.computeLeftEntropy | public double computeLeftEntropy(PairFrequency pair)
{
Set<Map.Entry<String, TriaFrequency>> entrySet = trieTria.prefixSearch(pair.getKey() + LEFT);
return computeEntropy(entrySet);
} | java | public double computeLeftEntropy(PairFrequency pair)
{
Set<Map.Entry<String, TriaFrequency>> entrySet = trieTria.prefixSearch(pair.getKey() + LEFT);
return computeEntropy(entrySet);
} | [
"public",
"double",
"computeLeftEntropy",
"(",
"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#L310-L314 | train | Compute the entropy of the left term of a pair. | [
30522,
2270,
3313,
24134,
2571,
6199,
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... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.printToErr | public void printToErr() throws Exception {
List<T> elements = collect();
for (T e: elements) {
System.err.println(e);
}
} | java | public void printToErr() throws Exception {
List<T> elements = collect();
for (T e: elements) {
System.err.println(e);
}
} | [
"public",
"void",
"printToErr",
"(",
")",
"throws",
"Exception",
"{",
"List",
"<",
"T",
">",
"elements",
"=",
"collect",
"(",
")",
";",
"for",
"(",
"T",
"e",
":",
"elements",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"e",
")",
";",
"}"... | Prints the elements in a DataSet to the standard error stream {@link System#err} of the JVM that calls
the print() method. For programs that are executed in a cluster, this method needs
to gather the contents of the DataSet back to the client, to print it there.
<p>The string written for each element is defined by the {@link Object#toString()} method.
<p>This method immediately triggers the program execution, similar to the
{@link #collect()} and {@link #count()} methods.
@see #print()
@see #printOnTaskManager(String) | [
"Prints",
"the",
"elements",
"in",
"a",
"DataSet",
"to",
"the",
"standard",
"error",
"stream",
"{",
"@link",
"System#err",
"}",
"of",
"the",
"JVM",
"that",
"calls",
"the",
"print",
"()",
"method",
".",
"For",
"programs",
"that",
"are",
"executed",
"in",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1671-L1676 | train | Print the results to stderr. | [
30522,
2270,
11675,
6140,
3406,
2121,
2099,
1006,
1007,
11618,
6453,
1063,
2862,
1026,
1056,
1028,
3787,
1027,
8145,
1006,
1007,
1025,
2005,
1006,
1056,
1041,
1024,
3787,
1007,
1063,
2291,
1012,
9413,
2099,
1012,
6140,
19666,
1006,
1041,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.escape | public static String escape(char c) {
final StringBuilder builder = new StringBuilder();
if (RE_KEYS.contains(c)) {
builder.append('\\');
}
builder.append(c);
return builder.toString();
} | java | public static String escape(char c) {
final StringBuilder builder = new StringBuilder();
if (RE_KEYS.contains(c)) {
builder.append('\\');
}
builder.append(c);
return builder.toString();
} | [
"public",
"static",
"String",
"escape",
"(",
"char",
"c",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"RE_KEYS",
".",
"contains",
"(",
"c",
")",
")",
"{",
"builder",
".",
"append",
"(",
"'",
"... | 转义字符,将正则的关键字转义
@param c 字符
@return 转义后的文本 | [
"转义字符,将正则的关键字转义"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L686-L693 | train | Escape a character. | [
30522,
2270,
10763,
5164,
4019,
1006,
25869,
1039,
1007,
1063,
2345,
5164,
8569,
23891,
2099,
12508,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
1007,
1025,
2065,
1006,
2128,
1035,
6309,
1012,
3397,
1006,
1039,
1007,
1007,
1063,
12508,
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/DataSet.java | DataSet.writeAsCsv | public DataSink<T> writeAsCsv(String filePath, String rowDelimiter, String fieldDelimiter, WriteMode writeMode) {
return internalWriteAsCsv(new Path(filePath), rowDelimiter, fieldDelimiter, writeMode);
} | java | public DataSink<T> writeAsCsv(String filePath, String rowDelimiter, String fieldDelimiter, WriteMode writeMode) {
return internalWriteAsCsv(new Path(filePath), rowDelimiter, fieldDelimiter, writeMode);
} | [
"public",
"DataSink",
"<",
"T",
">",
"writeAsCsv",
"(",
"String",
"filePath",
",",
"String",
"rowDelimiter",
",",
"String",
"fieldDelimiter",
",",
"WriteMode",
"writeMode",
")",
"{",
"return",
"internalWriteAsCsv",
"(",
"new",
"Path",
"(",
"filePath",
")",
","... | Writes a {@link Tuple} DataSet as CSV file(s) to the specified location with the specified field and line delimiters.
<p><b>Note: Only a Tuple DataSet can written as a CSV file.</b>
For each Tuple field the result of {@link Object#toString()} is written.
@param filePath The path pointing to the location the CSV file is written to.
@param rowDelimiter The row delimiter to separate Tuples.
@param fieldDelimiter The field delimiter to separate Tuple fields.
@param writeMode The behavior regarding existing files. Options are NO_OVERWRITE and OVERWRITE.
@see Tuple
@see CsvOutputFormat
@see DataSet#writeAsText(String) Output files and directories | [
"Writes",
"a",
"{",
"@link",
"Tuple",
"}",
"DataSet",
"as",
"CSV",
"file",
"(",
"s",
")",
"to",
"the",
"specified",
"location",
"with",
"the",
"specified",
"field",
"and",
"line",
"delimiters",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1624-L1626 | train | Write data sink to file using CSV. | [
30522,
2270,
2951,
11493,
2243,
1026,
1056,
1028,
4339,
3022,
6169,
2615,
1006,
5164,
5371,
15069,
1010,
5164,
5216,
9247,
27605,
3334,
1010,
5164,
2492,
9247,
27605,
3334,
1010,
4339,
5302,
3207,
4339,
5302,
3207,
1007,
1063,
2709,
4722,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/logging/AbstractLoggingSystem.java | AbstractLoggingSystem.getSpringConfigLocations | protected String[] getSpringConfigLocations() {
String[] locations = getStandardConfigLocations();
for (int i = 0; i < locations.length; i++) {
String extension = StringUtils.getFilenameExtension(locations[i]);
locations[i] = locations[i].substring(0,
locations[i].length() - extension.length() - 1) + "-spring."
+ extension;
}
return locations;
} | java | protected String[] getSpringConfigLocations() {
String[] locations = getStandardConfigLocations();
for (int i = 0; i < locations.length; i++) {
String extension = StringUtils.getFilenameExtension(locations[i]);
locations[i] = locations[i].substring(0,
locations[i].length() - extension.length() - 1) + "-spring."
+ extension;
}
return locations;
} | [
"protected",
"String",
"[",
"]",
"getSpringConfigLocations",
"(",
")",
"{",
"String",
"[",
"]",
"locations",
"=",
"getStandardConfigLocations",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"locations",
".",
"length",
";",
"i",
"++",
... | Return the spring config locations for this system. By default this method returns
a set of locations based on {@link #getStandardConfigLocations()}.
@return the spring config locations
@see #getSpringInitializationConfig() | [
"Return",
"the",
"spring",
"config",
"locations",
"for",
"this",
"system",
".",
"By",
"default",
"this",
"method",
"returns",
"a",
"set",
"of",
"locations",
"based",
"on",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java#L131-L140 | train | Get the list of locations for the Spring configuration file. | [
30522,
5123,
5164,
1031,
1033,
4152,
18098,
2075,
8663,
8873,
23296,
23909,
2015,
1006,
1007,
1063,
5164,
1031,
1033,
5269,
1027,
4152,
5794,
7662,
16409,
2239,
8873,
23296,
23909,
2015,
1006,
1007,
1025,
2005,
1006,
20014,
1045,
1027,
1014... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2MoveToFrontTable.java | Bzip2MoveToFrontTable.valueToFront | int valueToFront(final byte value) {
int index = 0;
byte temp = mtf[0];
if (value != temp) {
mtf[0] = value;
while (value != temp) {
index++;
final byte temp2 = temp;
temp = mtf[index];
mtf[index] = temp2;
}
}
return index;
} | java | int valueToFront(final byte value) {
int index = 0;
byte temp = mtf[0];
if (value != temp) {
mtf[0] = value;
while (value != temp) {
index++;
final byte temp2 = temp;
temp = mtf[index];
mtf[index] = temp2;
}
}
return index;
} | [
"int",
"valueToFront",
"(",
"final",
"byte",
"value",
")",
"{",
"int",
"index",
"=",
"0",
";",
"byte",
"temp",
"=",
"mtf",
"[",
"0",
"]",
";",
"if",
"(",
"value",
"!=",
"temp",
")",
"{",
"mtf",
"[",
"0",
"]",
"=",
"value",
";",
"while",
"(",
... | Moves a value to the head of the MTF list (forward Move To Front transform).
@param value The value to move
@return The position the value moved from | [
"Moves",
"a",
"value",
"to",
"the",
"head",
"of",
"the",
"MTF",
"list",
"(",
"forward",
"Move",
"To",
"Front",
"transform",
")",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2MoveToFrontTable.java#L57-L70 | train | This method is used to put a value into the front of the array. | [
30522,
20014,
3643,
3406,
12792,
1006,
2345,
24880,
3643,
1007,
1063,
20014,
5950,
1027,
1014,
1025,
24880,
8915,
8737,
1027,
11047,
2546,
1031,
1014,
1033,
1025,
2065,
1006,
3643,
999,
1027,
8915,
8737,
1007,
1063,
11047,
2546,
1031,
1014,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.readUtf8Lines | public static <T extends Collection<String>> T readUtf8Lines(InputStream in, T collection) throws IORuntimeException {
return readLines(in, CharsetUtil.CHARSET_UTF_8, collection);
} | java | public static <T extends Collection<String>> T readUtf8Lines(InputStream in, T collection) throws IORuntimeException {
return readLines(in, CharsetUtil.CHARSET_UTF_8, collection);
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"String",
">",
">",
"T",
"readUtf8Lines",
"(",
"InputStream",
"in",
",",
"T",
"collection",
")",
"throws",
"IORuntimeException",
"{",
"return",
"readLines",
"(",
"in",
",",
"CharsetUtil",
".",
"CHAR... | 从流中读取内容,使用UTF-8编码
@param <T> 集合类型
@param in 输入流
@param collection 返回集合
@return 内容
@throws IORuntimeException IO异常 | [
"从流中读取内容,使用UTF",
"-",
"8编码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L630-L632 | train | Reads a collection of UTF - 8 lines from the given input stream. | [
30522,
2270,
10763,
1026,
1056,
8908,
3074,
1026,
5164,
1028,
1028,
1056,
3191,
4904,
2546,
2620,
12735,
1006,
20407,
25379,
1999,
1010,
1056,
3074,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
3191,
12735,
1006,
1999,
1010,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/scheduler/Scheduler.java | Scheduler.getHostnamesFromInstances | private static String getHostnamesFromInstances(Iterable<TaskManagerLocation> locations) {
StringBuilder bld = new StringBuilder();
boolean successive = false;
for (TaskManagerLocation loc : locations) {
if (successive) {
bld.append(", ");
} else {
successive = true;
}
bld.append(loc.getHostname());
}
return bld.toString();
} | java | private static String getHostnamesFromInstances(Iterable<TaskManagerLocation> locations) {
StringBuilder bld = new StringBuilder();
boolean successive = false;
for (TaskManagerLocation loc : locations) {
if (successive) {
bld.append(", ");
} else {
successive = true;
}
bld.append(loc.getHostname());
}
return bld.toString();
} | [
"private",
"static",
"String",
"getHostnamesFromInstances",
"(",
"Iterable",
"<",
"TaskManagerLocation",
">",
"locations",
")",
"{",
"StringBuilder",
"bld",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"successive",
"=",
"false",
";",
"for",
"(",
"Task... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/scheduler/Scheduler.java#L828-L842 | train | Get the hostname from the list of TaskManagerLocation objects. | [
30522,
2797,
10763,
5164,
2131,
15006,
2102,
18442,
22747,
21716,
7076,
26897,
2015,
1006,
2009,
6906,
3468,
1026,
4708,
24805,
4590,
4135,
10719,
1028,
5269,
1007,
1063,
5164,
8569,
23891,
2099,
1038,
6392,
1027,
2047,
5164,
8569,
23891,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java | ExcelReader.aliasHeader | private String aliasHeader(Object headerObj, int index) {
if(null == headerObj) {
return ExcelUtil.indexToColName(index);
}
final String header = headerObj.toString();
return ObjectUtil.defaultIfNull(this.headerAlias.get(header), header);
} | java | private String aliasHeader(Object headerObj, int index) {
if(null == headerObj) {
return ExcelUtil.indexToColName(index);
}
final String header = headerObj.toString();
return ObjectUtil.defaultIfNull(this.headerAlias.get(header), header);
} | [
"private",
"String",
"aliasHeader",
"(",
"Object",
"headerObj",
",",
"int",
"index",
")",
"{",
"if",
"(",
"null",
"==",
"headerObj",
")",
"{",
"return",
"ExcelUtil",
".",
"indexToColName",
"(",
"index",
")",
";",
"}",
"final",
"String",
"header",
"=",
"h... | 转换标题别名,如果没有别名则使用原标题,当标题为空时,列号对应的字母便是header
@param headerObj 原标题
@param index 标题所在列号,当标题为空时,列号对应的字母便是header
@return 转换别名列表
@since 4.3.2 | [
"转换标题别名,如果没有别名则使用原标题,当标题为空时,列号对应的字母便是header"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelReader.java#L466-L473 | train | Returns the name of the header object for the given index. | [
30522,
2797,
5164,
14593,
4974,
2121,
1006,
4874,
20346,
16429,
3501,
1010,
20014,
5950,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
20346,
16429,
3501,
1007,
1063,
2709,
24970,
21823,
2140,
1012,
5950,
3406,
25778,
18442,
1006,
5950,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java | JSONObject.get | public Object get(String name) throws JSONException {
Object result = this.nameValuePairs.get(name);
if (result == null) {
throw new JSONException("No value for " + name);
}
return result;
} | java | public Object get(String name) throws JSONException {
Object result = this.nameValuePairs.get(name);
if (result == null) {
throw new JSONException("No value for " + name);
}
return result;
} | [
"public",
"Object",
"get",
"(",
"String",
"name",
")",
"throws",
"JSONException",
"{",
"Object",
"result",
"=",
"this",
".",
"nameValuePairs",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"throw",
"new",
"JSONException"... | Returns the value mapped by {@code name}.
@param name the name of the property
@return the value
@throws JSONException if no such mapping exists. | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L373-L379 | train | Get the value associated with a name. | [
30522,
2270,
4874,
2131,
1006,
5164,
2171,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
4874,
2765,
1027,
2023,
1012,
2171,
10175,
5657,
4502,
18894,
1012,
2131,
1006,
2171,
1007,
1025,
2065,
1006,
2765,
1027,
1027,
19701,
1007,
1063,
5466,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/types/ListValue.java | ListValue.subList | @Override
public List<V> subList(final int fromIndex, final int toIndex) {
return this.list.subList(fromIndex, toIndex);
} | java | @Override
public List<V> subList(final int fromIndex, final int toIndex) {
return this.list.subList(fromIndex, toIndex);
} | [
"@",
"Override",
"public",
"List",
"<",
"V",
">",
"subList",
"(",
"final",
"int",
"fromIndex",
",",
"final",
"int",
"toIndex",
")",
"{",
"return",
"this",
".",
"list",
".",
"subList",
"(",
"fromIndex",
",",
"toIndex",
")",
";",
"}"
] | /*
(non-Javadoc)
@see java.util.List#subList(int, int) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/ListValue.java#L333-L336 | train | Gets a sub - list. | [
30522,
1030,
2058,
15637,
2270,
2862,
1026,
1058,
1028,
4942,
9863,
1006,
2345,
20014,
2013,
22254,
10288,
1010,
2345,
20014,
2000,
22254,
10288,
1007,
1063,
2709,
2023,
1012,
2862,
1012,
4942,
9863,
1006,
2013,
22254,
10288,
1010,
2000,
22... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/HeaderPacket.java | HeaderPacket.toBytes | public byte[] toBytes() {
byte[] data = new byte[4];
data[0] = (byte) (packetBodyLength & 0xFF);
data[1] = (byte) (packetBodyLength >>> 8);
data[2] = (byte) (packetBodyLength >>> 16);
data[3] = getPacketSequenceNumber();
return data;
} | java | public byte[] toBytes() {
byte[] data = new byte[4];
data[0] = (byte) (packetBodyLength & 0xFF);
data[1] = (byte) (packetBodyLength >>> 8);
data[2] = (byte) (packetBodyLength >>> 16);
data[3] = getPacketSequenceNumber();
return data;
} | [
"public",
"byte",
"[",
"]",
"toBytes",
"(",
")",
"{",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"data",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"packetBodyLength",
"&",
"0xFF",
")",
";",
"data",
"[",
"1",
"]",
"=",
... | little-endian byte order | [
"little",
"-",
"endian",
"byte",
"order"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/HeaderPacket.java#L35-L42 | train | Returns the bytes of the record header. | [
30522,
2270,
24880,
1031,
1033,
11291,
4570,
1006,
1007,
1063,
24880,
1031,
1033,
2951,
1027,
2047,
24880,
1031,
1018,
1033,
1025,
2951,
1031,
1014,
1033,
1027,
1006,
24880,
1007,
1006,
14771,
23684,
7770,
13512,
2232,
1004,
1014,
2595,
424... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.registerQuery | private void registerQuery(
SqlValidatorScope parentScope,
SqlValidatorScope usingScope,
SqlNode node,
SqlNode enclosingNode,
String alias,
boolean forceNullable) {
Preconditions.checkArgument(usingScope == null || alias != null);
registerQuery(
parentScope,
usingScope,
node,
enclosingNode,
alias,
forceNullable,
true);
} | java | private void registerQuery(
SqlValidatorScope parentScope,
SqlValidatorScope usingScope,
SqlNode node,
SqlNode enclosingNode,
String alias,
boolean forceNullable) {
Preconditions.checkArgument(usingScope == null || alias != null);
registerQuery(
parentScope,
usingScope,
node,
enclosingNode,
alias,
forceNullable,
true);
} | [
"private",
"void",
"registerQuery",
"(",
"SqlValidatorScope",
"parentScope",
",",
"SqlValidatorScope",
"usingScope",
",",
"SqlNode",
"node",
",",
"SqlNode",
"enclosingNode",
",",
"String",
"alias",
",",
"boolean",
"forceNullable",
")",
"{",
"Preconditions",
".",
"ch... | Registers a query in a parent scope.
@param parentScope Parent scope which this scope turns to in order to
resolve objects
@param usingScope Scope whose child list this scope should add itself to
@param node Query node
@param alias Name of this query within its parent. Must be specified
if usingScope != null | [
"Registers",
"a",
"query",
"in",
"a",
"parent",
"scope",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2341-L2357 | train | Register a query with the SQLValidator. | [
30522,
2797,
11675,
4236,
4226,
2854,
1006,
29296,
10175,
8524,
6591,
16186,
3008,
16186,
1010,
29296,
10175,
8524,
6591,
16186,
2478,
26127,
1010,
29296,
3630,
3207,
13045,
1010,
29296,
3630,
3207,
4372,
20464,
18606,
3630,
3207,
1010,
5164,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/chaining/ChainedTerminationCriterionDriver.java | ChainedTerminationCriterionDriver.setup | @Override
public void setup(AbstractInvokable parent) {
agg = ((IterationRuntimeContext) getUdfRuntimeContext()).getIterationAggregator(BulkIterationBase.TERMINATION_CRITERION_AGGREGATOR_NAME);
} | java | @Override
public void setup(AbstractInvokable parent) {
agg = ((IterationRuntimeContext) getUdfRuntimeContext()).getIterationAggregator(BulkIterationBase.TERMINATION_CRITERION_AGGREGATOR_NAME);
} | [
"@",
"Override",
"public",
"void",
"setup",
"(",
"AbstractInvokable",
"parent",
")",
"{",
"agg",
"=",
"(",
"(",
"IterationRuntimeContext",
")",
"getUdfRuntimeContext",
"(",
")",
")",
".",
"getIterationAggregator",
"(",
"BulkIterationBase",
".",
"TERMINATION_CRITERIO... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/chaining/ChainedTerminationCriterionDriver.java#L34-L37 | train | Set up the iteration aggregator. | [
30522,
1030,
2058,
15637,
2270,
11675,
16437,
1006,
10061,
2378,
6767,
2912,
3468,
6687,
1007,
1063,
12943,
2290,
1027,
1006,
1006,
27758,
15532,
7292,
8663,
18209,
1007,
2131,
6784,
19699,
16671,
14428,
8663,
18209,
1006,
1007,
1007,
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-runtime/src/main/java/org/apache/flink/runtime/operators/resettable/AbstractBlockResettableIterator.java | AbstractBlockResettableIterator.close | public void close() {
synchronized (this) {
if (this.closed) {
return;
}
this.closed = true;
}
this.numRecordsInBuffer = 0;
this.numRecordsReturned = 0;
// add the full segments to the empty ones
for (int i = this.fullSegments.size() - 1; i >= 0; i--) {
this.emptySegments.add(this.fullSegments.remove(i));
}
// release the memory segment
this.memoryManager.release(this.emptySegments);
this.emptySegments.clear();
if (LOG.isDebugEnabled()) {
LOG.debug("Block Resettable Iterator closed.");
}
} | java | public void close() {
synchronized (this) {
if (this.closed) {
return;
}
this.closed = true;
}
this.numRecordsInBuffer = 0;
this.numRecordsReturned = 0;
// add the full segments to the empty ones
for (int i = this.fullSegments.size() - 1; i >= 0; i--) {
this.emptySegments.add(this.fullSegments.remove(i));
}
// release the memory segment
this.memoryManager.release(this.emptySegments);
this.emptySegments.clear();
if (LOG.isDebugEnabled()) {
LOG.debug("Block Resettable Iterator closed.");
}
} | [
"public",
"void",
"close",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"this",
".",
"closed",
")",
"{",
"return",
";",
"}",
"this",
".",
"closed",
"=",
"true",
";",
"}",
"this",
".",
"numRecordsInBuffer",
"=",
"0",
";",
"this",... | This method closes the iterator and releases all resources. This method works both as a regular
shutdown and as a canceling method. The method may be called multiple times and will not produce
an error. | [
"This",
"method",
"closes",
"the",
"iterator",
"and",
"releases",
"all",
"resources",
".",
"This",
"method",
"works",
"both",
"as",
"a",
"regular",
"shutdown",
"and",
"as",
"a",
"canceling",
"method",
".",
"The",
"method",
"may",
"be",
"called",
"multiple",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/resettable/AbstractBlockResettableIterator.java#L131-L154 | train | Closes the iterator. | [
30522,
2270,
11675,
2485,
1006,
1007,
1063,
25549,
1006,
2023,
1007,
1063,
2065,
1006,
2023,
1012,
2701,
1007,
1063,
2709,
1025,
1065,
2023,
1012,
2701,
1027,
2995,
1025,
1065,
2023,
1012,
16371,
2213,
2890,
27108,
5104,
2378,
8569,
12494,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/annotation/AnnotationUtil.java | AnnotationUtil.getTargetType | public static ElementType[] getTargetType(Class<? extends Annotation> annotationType) {
final Target target = annotationType.getAnnotation(Target.class);
if (null == target) {
return new ElementType[] { ElementType.TYPE, //
ElementType.FIELD, //
ElementType.METHOD, //
ElementType.PARAMETER, //
ElementType.CONSTRUCTOR, //
ElementType.LOCAL_VARIABLE, //
ElementType.ANNOTATION_TYPE, //
ElementType.PACKAGE//
};
}
return target.value();
} | java | public static ElementType[] getTargetType(Class<? extends Annotation> annotationType) {
final Target target = annotationType.getAnnotation(Target.class);
if (null == target) {
return new ElementType[] { ElementType.TYPE, //
ElementType.FIELD, //
ElementType.METHOD, //
ElementType.PARAMETER, //
ElementType.CONSTRUCTOR, //
ElementType.LOCAL_VARIABLE, //
ElementType.ANNOTATION_TYPE, //
ElementType.PACKAGE//
};
}
return target.value();
} | [
"public",
"static",
"ElementType",
"[",
"]",
"getTargetType",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
")",
"{",
"final",
"Target",
"target",
"=",
"annotationType",
".",
"getAnnotation",
"(",
"Target",
".",
"class",
")",
";",
"... | 获取注解类可以用来修饰哪些程序元素,如 TYPE, METHOD, CONSTRUCTOR, FIELD, PARAMETER 等
@param annotationType 注解类
@return 注解修饰的程序元素数组 | [
"获取注解类可以用来修饰哪些程序元素,如",
"TYPE",
"METHOD",
"CONSTRUCTOR",
"FIELD",
"PARAMETER",
"等"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationUtil.java#L161-L175 | train | Gets the target type. | [
30522,
2270,
10763,
5783,
13874,
1031,
1033,
2131,
7559,
18150,
13874,
1006,
2465,
1026,
1029,
8908,
5754,
17287,
3508,
1028,
5754,
17287,
3508,
13874,
1007,
1063,
2345,
4539,
4539,
1027,
5754,
17287,
3508,
13874,
1012,
2131,
11639,
17287,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/info/InfoPropertiesInfoContributor.java | InfoPropertiesInfoContributor.extractContent | protected Map<String, Object> extractContent(PropertySource<?> propertySource) {
return new Binder(ConfigurationPropertySources.from(propertySource))
.bind("", STRING_OBJECT_MAP).orElseGet(LinkedHashMap::new);
} | java | protected Map<String, Object> extractContent(PropertySource<?> propertySource) {
return new Binder(ConfigurationPropertySources.from(propertySource))
.bind("", STRING_OBJECT_MAP).orElseGet(LinkedHashMap::new);
} | [
"protected",
"Map",
"<",
"String",
",",
"Object",
">",
"extractContent",
"(",
"PropertySource",
"<",
"?",
">",
"propertySource",
")",
"{",
"return",
"new",
"Binder",
"(",
"ConfigurationPropertySources",
".",
"from",
"(",
"propertySource",
")",
")",
".",
"bind"... | Extract the raw content based on the specified {@link PropertySource}.
@param propertySource the property source to use
@return the raw content | [
"Extract",
"the",
"raw",
"content",
"based",
"on",
"the",
"specified",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/info/InfoPropertiesInfoContributor.java#L94-L97 | train | Extract content from property source. | [
30522,
5123,
4949,
1026,
5164,
1010,
4874,
1028,
14817,
8663,
6528,
2102,
1006,
3200,
6499,
3126,
3401,
1026,
1029,
1028,
3200,
6499,
3126,
3401,
1007,
1063,
2709,
2047,
14187,
2121,
1006,
9563,
21572,
4842,
3723,
6499,
3126,
9623,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryFormat.java | BinaryFormat.readBinaryFieldFromSegments | static byte[] readBinaryFieldFromSegments(
MemorySegment[] segments, int baseOffset, int fieldOffset,
long variablePartOffsetAndLen) {
long mark = variablePartOffsetAndLen & HIGHEST_FIRST_BIT;
if (mark == 0) {
final int subOffset = (int) (variablePartOffsetAndLen >> 32);
final int len = (int) variablePartOffsetAndLen;
return SegmentsUtil.copyToBytes(segments, baseOffset + subOffset, len);
} else {
int len = (int) ((variablePartOffsetAndLen & HIGHEST_SECOND_TO_EIGHTH_BIT) >>> 56);
if (SegmentsUtil.LITTLE_ENDIAN) {
return SegmentsUtil.copyToBytes(segments, fieldOffset, len);
} else {
// fieldOffset + 1 to skip header.
return SegmentsUtil.copyToBytes(segments, fieldOffset + 1, len);
}
}
} | java | static byte[] readBinaryFieldFromSegments(
MemorySegment[] segments, int baseOffset, int fieldOffset,
long variablePartOffsetAndLen) {
long mark = variablePartOffsetAndLen & HIGHEST_FIRST_BIT;
if (mark == 0) {
final int subOffset = (int) (variablePartOffsetAndLen >> 32);
final int len = (int) variablePartOffsetAndLen;
return SegmentsUtil.copyToBytes(segments, baseOffset + subOffset, len);
} else {
int len = (int) ((variablePartOffsetAndLen & HIGHEST_SECOND_TO_EIGHTH_BIT) >>> 56);
if (SegmentsUtil.LITTLE_ENDIAN) {
return SegmentsUtil.copyToBytes(segments, fieldOffset, len);
} else {
// fieldOffset + 1 to skip header.
return SegmentsUtil.copyToBytes(segments, fieldOffset + 1, len);
}
}
} | [
"static",
"byte",
"[",
"]",
"readBinaryFieldFromSegments",
"(",
"MemorySegment",
"[",
"]",
"segments",
",",
"int",
"baseOffset",
",",
"int",
"fieldOffset",
",",
"long",
"variablePartOffsetAndLen",
")",
"{",
"long",
"mark",
"=",
"variablePartOffsetAndLen",
"&",
"HI... | Get binary, if len less than 8, will be include in variablePartOffsetAndLen.
<p>Note: Need to consider the ByteOrder.
@param baseOffset base offset of composite binary format.
@param fieldOffset absolute start offset of 'variablePartOffsetAndLen'.
@param variablePartOffsetAndLen a long value, real data or offset and len. | [
"Get",
"binary",
"if",
"len",
"less",
"than",
"8",
"will",
"be",
"include",
"in",
"variablePartOffsetAndLen",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryFormat.java#L119-L136 | train | Read binary field from segments. | [
30522,
10763,
24880,
1031,
1033,
3191,
21114,
2854,
3790,
19699,
22225,
13910,
8163,
1006,
3638,
3366,
21693,
4765,
1031,
1033,
9214,
1010,
20014,
2918,
27475,
3388,
1010,
20014,
2492,
27475,
3388,
1010,
2146,
8023,
19362,
3406,
21807,
12928,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/TypeStringUtils.java | TypeStringUtils.containsDelimiter | private static boolean containsDelimiter(String string) {
final char[] charArray = string.toCharArray();
for (char c : charArray) {
if (isDelimiter(c)) {
return true;
}
}
return false;
} | java | private static boolean containsDelimiter(String string) {
final char[] charArray = string.toCharArray();
for (char c : charArray) {
if (isDelimiter(c)) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"containsDelimiter",
"(",
"String",
"string",
")",
"{",
"final",
"char",
"[",
"]",
"charArray",
"=",
"string",
".",
"toCharArray",
"(",
")",
";",
"for",
"(",
"char",
"c",
":",
"charArray",
")",
"{",
"if",
"(",
"isDelimiter... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/utils/TypeStringUtils.java#L166-L174 | train | Checks if the string contains a delimiter. | [
30522,
2797,
10763,
22017,
20898,
3397,
9247,
27605,
3334,
1006,
5164,
5164,
1007,
1063,
2345,
25869,
1031,
1033,
25869,
2906,
9447,
1027,
5164,
1012,
2000,
7507,
19848,
9447,
1006,
1007,
1025,
2005,
1006,
25869,
1039,
1024,
25869,
2906,
94... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/JSONArray.java | JSONArray.init | private void init(Object object) throws JSONException{
if (object instanceof CharSequence) {
// JSON字符串
init((CharSequence) object);
} else {
Iterator<?> iter;
if (object.getClass().isArray()) {// 数组
iter = new ArrayIter<>(object);
} else if (object instanceof Iterator<?>) {// Iterator
iter = ((Iterator<?>) object);
} else if (object instanceof Iterable<?>) {// Iterable
iter = ((Iterable<?>) object).iterator();
} else {
throw new JSONException("JSONArray initial value should be a string or collection or array.");
}
while (iter.hasNext()) {
this.add(iter.next());
}
}
} | java | private void init(Object object) throws JSONException{
if (object instanceof CharSequence) {
// JSON字符串
init((CharSequence) object);
} else {
Iterator<?> iter;
if (object.getClass().isArray()) {// 数组
iter = new ArrayIter<>(object);
} else if (object instanceof Iterator<?>) {// Iterator
iter = ((Iterator<?>) object);
} else if (object instanceof Iterable<?>) {// Iterable
iter = ((Iterable<?>) object).iterator();
} else {
throw new JSONException("JSONArray initial value should be a string or collection or array.");
}
while (iter.hasNext()) {
this.add(iter.next());
}
}
} | [
"private",
"void",
"init",
"(",
"Object",
"object",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"object",
"instanceof",
"CharSequence",
")",
"{",
"// JSON字符串\r",
"init",
"(",
"(",
"CharSequence",
")",
"object",
")",
";",
"}",
"else",
"{",
"Iterator",
"... | 初始化
@param object 数组或集合或JSON数组字符串
@throws JSONException 非数组或集合 | [
"初始化"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONArray.java#L560-L579 | train | Initializes the object with the data from the given object. | [
30522,
2797,
11675,
1999,
4183,
1006,
4874,
4874,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
2065,
1006,
4874,
6013,
11253,
25869,
3366,
4226,
5897,
1007,
1063,
1013,
1013,
1046,
3385,
100,
100,
100,
1999,
4183,
1006,
1006,
25869,
3366,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java | ExcelWriter.addHeaderAlias | public ExcelWriter addHeaderAlias(String name, String alias) {
Map<String, String> headerAlias = this.headerAlias;
if (null == headerAlias) {
headerAlias = new LinkedHashMap<>();
}
this.headerAlias = headerAlias;
headerAlias.put(name, alias);
return this;
} | java | public ExcelWriter addHeaderAlias(String name, String alias) {
Map<String, String> headerAlias = this.headerAlias;
if (null == headerAlias) {
headerAlias = new LinkedHashMap<>();
}
this.headerAlias = headerAlias;
headerAlias.put(name, alias);
return this;
} | [
"public",
"ExcelWriter",
"addHeaderAlias",
"(",
"String",
"name",
",",
"String",
"alias",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"headerAlias",
"=",
"this",
".",
"headerAlias",
";",
"if",
"(",
"null",
"==",
"headerAlias",
")",
"{",
"headerAlia... | 增加标题别名
@param name 原标题
@param alias 别名
@return this
@since 4.1.5 | [
"增加标题别名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L412-L420 | train | Adds a header alias. | [
30522,
2270,
24970,
15994,
30524,
2015,
1025,
2065,
1006,
19701,
1027,
1027,
20346,
22786,
2015,
1007,
1063,
20346,
22786,
2015,
1027,
2047,
5799,
14949,
22444,
2361,
1026,
1028,
1006,
1007,
1025,
1065,
2023,
1012,
20346,
22786,
2015,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/WordBasedSegment.java | WordBasedSegment.atomSegment | private static List<AtomNode> atomSegment(String sSentence, int start, int end)
{
if (end < start)
{
throw new RuntimeException("start=" + start + " < end=" + end);
}
List<AtomNode> atomSegment = new ArrayList<AtomNode>();
int pCur = 0, nCurType, nNextType;
StringBuilder sb = new StringBuilder();
char c;
//==============================================================================================
// by zhenyulu:
//
// TODO: 使用一系列正则表达式将句子中的完整成分(百分比、日期、电子邮件、URL等)预先提取出来
//==============================================================================================
char[] charArray = sSentence.substring(start, end).toCharArray();
int[] charTypeArray = new int[charArray.length];
// 生成对应单个汉字的字符类型数组
for (int i = 0; i < charArray.length; ++i)
{
c = charArray[i];
charTypeArray[i] = CharType.get(c);
if (c == '.' && i < (charArray.length - 1) && CharType.get(charArray[i + 1]) == CharType.CT_NUM)
charTypeArray[i] = CharType.CT_NUM;
else if (c == '.' && i < (charArray.length - 1) && charArray[i + 1] >= '0' && charArray[i + 1] <= '9')
charTypeArray[i] = CharType.CT_SINGLE;
else if (charTypeArray[i] == CharType.CT_LETTER)
charTypeArray[i] = CharType.CT_SINGLE;
}
// 根据字符类型数组中的内容完成原子切割
while (pCur < charArray.length)
{
nCurType = charTypeArray[pCur];
if (nCurType == CharType.CT_CHINESE || nCurType == CharType.CT_INDEX ||
nCurType == CharType.CT_DELIMITER || nCurType == CharType.CT_OTHER)
{
String single = String.valueOf(charArray[pCur]);
if (single.length() != 0)
atomSegment.add(new AtomNode(single, nCurType));
pCur++;
}
//如果是字符、数字或者后面跟随了数字的小数点“.”则一直取下去。
else if (pCur < charArray.length - 1 && ((nCurType == CharType.CT_SINGLE) || nCurType == CharType.CT_NUM))
{
sb.delete(0, sb.length());
sb.append(charArray[pCur]);
boolean reachEnd = true;
while (pCur < charArray.length - 1)
{
nNextType = charTypeArray[++pCur];
if (nNextType == nCurType)
sb.append(charArray[pCur]);
else
{
reachEnd = false;
break;
}
}
atomSegment.add(new AtomNode(sb.toString(), nCurType));
if (reachEnd)
pCur++;
}
// 对于所有其它情况
else
{
atomSegment.add(new AtomNode(charArray[pCur], nCurType));
pCur++;
}
}
// logger.trace("原子分词:" + atomSegment);
return atomSegment;
} | java | private static List<AtomNode> atomSegment(String sSentence, int start, int end)
{
if (end < start)
{
throw new RuntimeException("start=" + start + " < end=" + end);
}
List<AtomNode> atomSegment = new ArrayList<AtomNode>();
int pCur = 0, nCurType, nNextType;
StringBuilder sb = new StringBuilder();
char c;
//==============================================================================================
// by zhenyulu:
//
// TODO: 使用一系列正则表达式将句子中的完整成分(百分比、日期、电子邮件、URL等)预先提取出来
//==============================================================================================
char[] charArray = sSentence.substring(start, end).toCharArray();
int[] charTypeArray = new int[charArray.length];
// 生成对应单个汉字的字符类型数组
for (int i = 0; i < charArray.length; ++i)
{
c = charArray[i];
charTypeArray[i] = CharType.get(c);
if (c == '.' && i < (charArray.length - 1) && CharType.get(charArray[i + 1]) == CharType.CT_NUM)
charTypeArray[i] = CharType.CT_NUM;
else if (c == '.' && i < (charArray.length - 1) && charArray[i + 1] >= '0' && charArray[i + 1] <= '9')
charTypeArray[i] = CharType.CT_SINGLE;
else if (charTypeArray[i] == CharType.CT_LETTER)
charTypeArray[i] = CharType.CT_SINGLE;
}
// 根据字符类型数组中的内容完成原子切割
while (pCur < charArray.length)
{
nCurType = charTypeArray[pCur];
if (nCurType == CharType.CT_CHINESE || nCurType == CharType.CT_INDEX ||
nCurType == CharType.CT_DELIMITER || nCurType == CharType.CT_OTHER)
{
String single = String.valueOf(charArray[pCur]);
if (single.length() != 0)
atomSegment.add(new AtomNode(single, nCurType));
pCur++;
}
//如果是字符、数字或者后面跟随了数字的小数点“.”则一直取下去。
else if (pCur < charArray.length - 1 && ((nCurType == CharType.CT_SINGLE) || nCurType == CharType.CT_NUM))
{
sb.delete(0, sb.length());
sb.append(charArray[pCur]);
boolean reachEnd = true;
while (pCur < charArray.length - 1)
{
nNextType = charTypeArray[++pCur];
if (nNextType == nCurType)
sb.append(charArray[pCur]);
else
{
reachEnd = false;
break;
}
}
atomSegment.add(new AtomNode(sb.toString(), nCurType));
if (reachEnd)
pCur++;
}
// 对于所有其它情况
else
{
atomSegment.add(new AtomNode(charArray[pCur], nCurType));
pCur++;
}
}
// logger.trace("原子分词:" + atomSegment);
return atomSegment;
} | [
"private",
"static",
"List",
"<",
"AtomNode",
">",
"atomSegment",
"(",
"String",
"sSentence",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"if",
"(",
"end",
"<",
"start",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"start=\"",
"+",
"start",... | 原子分词
@param sSentence
@param start
@param end
@return
@deprecated 应该使用字符数组的版本 | [
"原子分词"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/WordBasedSegment.java#L257-L338 | train | AtomSegment method. | [
30522,
2797,
10763,
2862,
1026,
13787,
3630,
3207,
1028,
13353,
13910,
3672,
1006,
5164,
7020,
15781,
5897,
1010,
20014,
2707,
1010,
20014,
2203,
1007,
30524,
2707,
1009,
1000,
1026,
2203,
1027,
1000,
1009,
2203,
1007,
1025,
1065,
2862,
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-http/src/main/java/cn/hutool/http/webservice/SoapClient.java | SoapClient.setParam | public SoapClient setParam(String name, Object value) {
return setParam(name, value, true);
} | java | public SoapClient setParam(String name, Object value) {
return setParam(name, value, true);
} | [
"public",
"SoapClient",
"setParam",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"return",
"setParam",
"(",
"name",
",",
"value",
",",
"true",
")",
";",
"}"
] | 设置方法参数,使用方法的前缀
@param name 参数名
@param value 参数值,可以是字符串或Map或{@link SOAPElement}
@return this | [
"设置方法参数,使用方法的前缀"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/webservice/SoapClient.java#L302-L304 | train | Sets a parameter to the request. | [
30522,
2270,
7815,
20464,
11638,
2275,
28689,
2213,
1006,
5164,
2171,
1010,
4874,
3643,
1007,
1063,
2709,
2275,
28689,
2213,
1006,
2171,
1010,
3643,
1010,
2995,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.dragAndDrop | public Actions dragAndDrop(WebElement source, WebElement target) {
if (isBuildingActions()) {
action.addAction(new ClickAndHoldAction(jsonMouse, (Locatable) source));
action.addAction(new MoveMouseAction(jsonMouse, (Locatable) target));
action.addAction(new ButtonReleaseAction(jsonMouse, (Locatable) target));
}
return moveInTicks(source, 0, 0)
.tick(defaultMouse.createPointerDown(LEFT.asArg()))
.moveInTicks(target, 0, 0)
.tick(defaultMouse.createPointerUp(LEFT.asArg()));
} | java | public Actions dragAndDrop(WebElement source, WebElement target) {
if (isBuildingActions()) {
action.addAction(new ClickAndHoldAction(jsonMouse, (Locatable) source));
action.addAction(new MoveMouseAction(jsonMouse, (Locatable) target));
action.addAction(new ButtonReleaseAction(jsonMouse, (Locatable) target));
}
return moveInTicks(source, 0, 0)
.tick(defaultMouse.createPointerDown(LEFT.asArg()))
.moveInTicks(target, 0, 0)
.tick(defaultMouse.createPointerUp(LEFT.asArg()));
} | [
"public",
"Actions",
"dragAndDrop",
"(",
"WebElement",
"source",
",",
"WebElement",
"target",
")",
"{",
"if",
"(",
"isBuildingActions",
"(",
")",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"ClickAndHoldAction",
"(",
"jsonMouse",
",",
"(",
"Locatable",
... | A convenience method that performs click-and-hold at the location of the source element,
moves to the location of the target element, then releases the mouse.
@param source element to emulate button down at.
@param target element to move to and release the mouse at.
@return A self reference. | [
"A",
"convenience",
"method",
"that",
"performs",
"click",
"-",
"and",
"-",
"hold",
"at",
"the",
"location",
"of",
"the",
"source",
"element",
"moves",
"to",
"the",
"location",
"of",
"the",
"target",
"element",
"then",
"releases",
"the",
"mouse",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L448-L459 | train | Drag and drop actions. | [
30522,
2270,
4506,
8011,
5685,
25711,
1006,
4773,
12260,
3672,
3120,
1010,
4773,
12260,
3672,
4539,
1007,
1063,
2065,
1006,
2003,
25820,
18908,
8496,
1006,
1007,
1007,
1063,
2895,
1012,
5587,
18908,
3258,
30524,
12640,
18908,
3258,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getInt32BE | private static final int getInt32BE(byte[] buffer, final int pos) {
return (buffer[pos] << 24) | ((0xff & buffer[pos + 1]) << 16) | ((0xff & buffer[pos + 2]) << 8)
| (0xff & buffer[pos + 3]);
} | java | private static final int getInt32BE(byte[] buffer, final int pos) {
return (buffer[pos] << 24) | ((0xff & buffer[pos + 1]) << 16) | ((0xff & buffer[pos + 2]) << 8)
| (0xff & buffer[pos + 3]);
} | [
"private",
"static",
"final",
"int",
"getInt32BE",
"(",
"byte",
"[",
"]",
"buffer",
",",
"final",
"int",
"pos",
")",
"{",
"return",
"(",
"buffer",
"[",
"pos",
"]",
"<<",
"24",
")",
"|",
"(",
"(",
"0xff",
"&",
"buffer",
"[",
"pos",
"+",
"1",
"]",
... | Return 32-bit signed int from buffer. (big-endian)
@see mysql-5.1.60/include/myisampack.h - mi_sint4korr | [
"Return",
"32",
"-",
"bit",
"signed",
"int",
"from",
"buffer",
".",
"(",
"big",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L1209-L1212 | train | Gets an int 32 - bit from the buffer starting at the given position. | [
30522,
2797,
10763,
2345,
20014,
2131,
18447,
16703,
4783,
1006,
24880,
1031,
1033,
17698,
1010,
2345,
20014,
13433,
2015,
1007,
1063,
2709,
1006,
17698,
1031,
13433,
2015,
1033,
1026,
1026,
2484,
1007,
1064,
1006,
1006,
1014,
2595,
4246,
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-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java | SM2Engine.nextK | private BigInteger nextK() {
final int qBitLength = this.ecParams.getN().bitLength();
BigInteger k;
do {
k = new BigInteger(qBitLength, this.random);
} while (k.equals(ECConstants.ZERO) || k.compareTo(this.ecParams.getN()) >= 0);
return k;
} | java | private BigInteger nextK() {
final int qBitLength = this.ecParams.getN().bitLength();
BigInteger k;
do {
k = new BigInteger(qBitLength, this.random);
} while (k.equals(ECConstants.ZERO) || k.compareTo(this.ecParams.getN()) >= 0);
return k;
} | [
"private",
"BigInteger",
"nextK",
"(",
")",
"{",
"final",
"int",
"qBitLength",
"=",
"this",
".",
"ecParams",
".",
"getN",
"(",
")",
".",
"bitLength",
"(",
")",
";",
"BigInteger",
"k",
";",
"do",
"{",
"k",
"=",
"new",
"BigInteger",
"(",
"qBitLength",
... | 下一个K值
@return K值 | [
"下一个K值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java#L337-L346 | train | Returns the next k. | [
30522,
2797,
2502,
18447,
26320,
2279,
2243,
1006,
1007,
1063,
2345,
20014,
26171,
4183,
7770,
13512,
2232,
1027,
2023,
1012,
14925,
28689,
5244,
1012,
2131,
2078,
1006,
1007,
1012,
2978,
7770,
13512,
2232,
1006,
1007,
1025,
2502,
18447,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Rot.java | Rot.encodeChar | private static char encodeChar(char c, int offset, boolean isDecodeNumber) {
if (isDecodeNumber) {
if (c >= CHAR0 && c <= CHAR9) {
c -= CHAR0;
c = (char) ((c + offset) % 10);
c += CHAR0;
}
}
// A == 65, Z == 90
if (c >= ACHAR && c <= ZCHAR) {
c -= ACHAR;
c = (char) ((c + offset) % 26);
c += ACHAR;
}
// a == 97, z == 122.
else if (c >= aCHAR && c <= zCHAR) {
c -= aCHAR;
c = (char) ((c + offset) % 26);
c += aCHAR;
}
return c;
} | java | private static char encodeChar(char c, int offset, boolean isDecodeNumber) {
if (isDecodeNumber) {
if (c >= CHAR0 && c <= CHAR9) {
c -= CHAR0;
c = (char) ((c + offset) % 10);
c += CHAR0;
}
}
// A == 65, Z == 90
if (c >= ACHAR && c <= ZCHAR) {
c -= ACHAR;
c = (char) ((c + offset) % 26);
c += ACHAR;
}
// a == 97, z == 122.
else if (c >= aCHAR && c <= zCHAR) {
c -= aCHAR;
c = (char) ((c + offset) % 26);
c += aCHAR;
}
return c;
} | [
"private",
"static",
"char",
"encodeChar",
"(",
"char",
"c",
",",
"int",
"offset",
",",
"boolean",
"isDecodeNumber",
")",
"{",
"if",
"(",
"isDecodeNumber",
")",
"{",
"if",
"(",
"c",
">=",
"CHAR0",
"&&",
"c",
"<=",
"CHAR9",
")",
"{",
"c",
"-=",
"CHAR0... | 解码字符
@param c 字符
@param offset 位移
@param isDecodeNumber 是否解码数字
@return 解码后的字符串 | [
"解码字符"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/Rot.java#L106-L128 | train | Encodes a character with the specified offset. | [
30522,
2797,
10763,
25869,
4372,
16044,
7507,
2099,
1006,
25869,
1039,
1010,
20014,
16396,
1010,
22017,
20898,
2003,
3207,
16044,
19172,
5677,
1007,
1063,
2065,
1006,
2003,
3207,
16044,
19172,
5677,
1007,
1063,
2065,
1006,
1039,
1028,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/ConnectedStreams.java | ConnectedStreams.process | @Internal
public <R> SingleOutputStreamOperator<R> process(
CoProcessFunction<IN1, IN2, R> coProcessFunction,
TypeInformation<R> outputType) {
TwoInputStreamOperator<IN1, IN2, R> operator;
if ((inputStream1 instanceof KeyedStream) && (inputStream2 instanceof KeyedStream)) {
operator = new KeyedCoProcessOperator<>(inputStream1.clean(coProcessFunction));
} else {
operator = new CoProcessOperator<>(inputStream1.clean(coProcessFunction));
}
return transform("Co-Process", outputType, operator);
} | java | @Internal
public <R> SingleOutputStreamOperator<R> process(
CoProcessFunction<IN1, IN2, R> coProcessFunction,
TypeInformation<R> outputType) {
TwoInputStreamOperator<IN1, IN2, R> operator;
if ((inputStream1 instanceof KeyedStream) && (inputStream2 instanceof KeyedStream)) {
operator = new KeyedCoProcessOperator<>(inputStream1.clean(coProcessFunction));
} else {
operator = new CoProcessOperator<>(inputStream1.clean(coProcessFunction));
}
return transform("Co-Process", outputType, operator);
} | [
"@",
"Internal",
"public",
"<",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"process",
"(",
"CoProcessFunction",
"<",
"IN1",
",",
"IN2",
",",
"R",
">",
"coProcessFunction",
",",
"TypeInformation",
"<",
"R",
">",
"outputType",
")",
"{",
"TwoInputSt... | Applies the given {@link CoProcessFunction} on the connected input streams,
thereby creating a transformed output stream.
<p>The function will be called for every element in the input streams and can produce zero
or more output elements. Contrary to the {@link #flatMap(CoFlatMapFunction)} function,
this function can also query the time and set timers. When reacting to the firing of set
timers the function can directly emit elements and/or register yet more timers.
@param coProcessFunction The {@link CoProcessFunction} that is called for each element
in the stream.
@param <R> The type of elements emitted by the {@code CoProcessFunction}.
@return The transformed {@link DataStream}. | [
"Applies",
"the",
"given",
"{",
"@link",
"CoProcessFunction",
"}",
"on",
"the",
"connected",
"input",
"streams",
"thereby",
"creating",
"a",
"transformed",
"output",
"stream",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/ConnectedStreams.java#L326-L340 | train | Process the two input stream of this stream into a single output stream of the given type. | [
30522,
1030,
4722,
2270,
1026,
1054,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
2832,
1006,
8872,
3217,
9623,
22747,
4609,
7542,
1026,
1999,
2487,
1010,
1999,
2475,
1010,
1054,
1028,
8872,
3217,
9623,
22747,
4609,
7542,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/NumberWordFormater.java | NumberWordFormater.format | private static String format(String x) {
int z = x.indexOf("."); // 取小数点位置
String lstr = "", rstr = "";
if (z > -1) { // 看是否有小数,如果有,则分别取左边和右边
lstr = x.substring(0, z);
rstr = x.substring(z + 1);
} else {
// 否则就是全部
lstr = x;
}
String lstrrev = StrUtil.reverse(lstr); // 对左边的字串取反
String[] a = new String[5]; // 定义5个字串变量来存放解析出来的叁位一组的字串
switch (lstrrev.length() % 3) {
case 1:
lstrrev += "00";
break;
case 2:
lstrrev += "0";
break;
}
String lm = ""; // 用来存放转换後的整数部分
for (int i = 0; i < lstrrev.length() / 3; i++) {
a[i] = StrUtil.reverse(lstrrev.substring(3 * i, 3 * i + 3)); // 截取第一个叁位
if (!a[i].equals("000")) { // 用来避免这种情况:1000000 = one million
// thousand only
if (i != 0) {
lm = transThree(a[i]) + " " + parseMore(String.valueOf(i)) + " " + lm; // 加:
// thousand、million、billion
} else {
lm = transThree(a[i]); // 防止i=0时, 在多加两个空格.
}
} else {
lm += transThree(a[i]);
}
}
String xs = ""; // 用来存放转换後小数部分
if (z > -1) {
xs = "AND CENTS " + transTwo(rstr) + " "; // 小数部分存在时转换小数
}
return lm.trim() + " " + xs + "ONLY";
} | java | private static String format(String x) {
int z = x.indexOf("."); // 取小数点位置
String lstr = "", rstr = "";
if (z > -1) { // 看是否有小数,如果有,则分别取左边和右边
lstr = x.substring(0, z);
rstr = x.substring(z + 1);
} else {
// 否则就是全部
lstr = x;
}
String lstrrev = StrUtil.reverse(lstr); // 对左边的字串取反
String[] a = new String[5]; // 定义5个字串变量来存放解析出来的叁位一组的字串
switch (lstrrev.length() % 3) {
case 1:
lstrrev += "00";
break;
case 2:
lstrrev += "0";
break;
}
String lm = ""; // 用来存放转换後的整数部分
for (int i = 0; i < lstrrev.length() / 3; i++) {
a[i] = StrUtil.reverse(lstrrev.substring(3 * i, 3 * i + 3)); // 截取第一个叁位
if (!a[i].equals("000")) { // 用来避免这种情况:1000000 = one million
// thousand only
if (i != 0) {
lm = transThree(a[i]) + " " + parseMore(String.valueOf(i)) + " " + lm; // 加:
// thousand、million、billion
} else {
lm = transThree(a[i]); // 防止i=0时, 在多加两个空格.
}
} else {
lm += transThree(a[i]);
}
}
String xs = ""; // 用来存放转换後小数部分
if (z > -1) {
xs = "AND CENTS " + transTwo(rstr) + " "; // 小数部分存在时转换小数
}
return lm.trim() + " " + xs + "ONLY";
} | [
"private",
"static",
"String",
"format",
"(",
"String",
"x",
")",
"{",
"int",
"z",
"=",
"x",
".",
"indexOf",
"(",
"\".\"",
")",
";",
"// 取小数点位置\r",
"String",
"lstr",
"=",
"\"\"",
",",
"rstr",
"=",
"\"\"",
";",
"if",
"(",
"z",
">",
"-",
"1",
")",
... | 将阿拉伯数字转为英文表达式
@param x
阿拉伯数字字符串
@return 英文表达式 | [
"将阿拉伯数字转为英文表达式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/NumberWordFormater.java#L46-L90 | train | Format a string with the appropriate number of characters to be used in the file. | [
30522,
2797,
10763,
5164,
4289,
1006,
5164,
1060,
1007,
1063,
20014,
1062,
1027,
1060,
1012,
5950,
11253,
1006,
1000,
1012,
1000,
1007,
1025,
1013,
1013,
100,
1829,
100,
100,
100,
100,
5164,
1048,
3367,
2099,
1027,
1000,
1000,
1010,
12667... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/highavailability/nonha/embedded/EmbeddedLeaderService.java | EmbeddedLeaderService.addContender | private void addContender(EmbeddedLeaderElectionService service, LeaderContender contender) {
synchronized (lock) {
checkState(!shutdown, "leader election service is shut down");
checkState(!service.running, "leader election service is already started");
try {
if (!allLeaderContenders.add(service)) {
throw new IllegalStateException("leader election service was added to this service multiple times");
}
service.contender = contender;
service.running = true;
updateLeader().whenComplete((aVoid, throwable) -> {
if (throwable != null) {
fatalError(throwable);
}
});
}
catch (Throwable t) {
fatalError(t);
}
}
} | java | private void addContender(EmbeddedLeaderElectionService service, LeaderContender contender) {
synchronized (lock) {
checkState(!shutdown, "leader election service is shut down");
checkState(!service.running, "leader election service is already started");
try {
if (!allLeaderContenders.add(service)) {
throw new IllegalStateException("leader election service was added to this service multiple times");
}
service.contender = contender;
service.running = true;
updateLeader().whenComplete((aVoid, throwable) -> {
if (throwable != null) {
fatalError(throwable);
}
});
}
catch (Throwable t) {
fatalError(t);
}
}
} | [
"private",
"void",
"addContender",
"(",
"EmbeddedLeaderElectionService",
"service",
",",
"LeaderContender",
"contender",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"checkState",
"(",
"!",
"shutdown",
",",
"\"leader election service is shut down\"",
")",
";",
"ch... | Callback from leader contenders when they start their service. | [
"Callback",
"from",
"leader",
"contenders",
"when",
"they",
"start",
"their",
"service",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/nonha/embedded/EmbeddedLeaderService.java#L168-L191 | train | Add a new leader contender to the list of all leader contenders. | [
30522,
2797,
11675,
5587,
8663,
6528,
4063,
1006,
11157,
19000,
12260,
22014,
2121,
7903,
2063,
2326,
1010,
3003,
8663,
6528,
4063,
20127,
1007,
1063,
25549,
1006,
5843,
1007,
1063,
14148,
12259,
1006,
999,
3844,
7698,
1010,
1000,
3003,
260... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java | ParameterTool.getShort | public short getShort(String key) {
addToDefaults(key, null);
String value = getRequired(key);
return Short.valueOf(value);
} | java | public short getShort(String key) {
addToDefaults(key, null);
String value = getRequired(key);
return Short.valueOf(value);
} | [
"public",
"short",
"getShort",
"(",
"String",
"key",
")",
"{",
"addToDefaults",
"(",
"key",
",",
"null",
")",
";",
"String",
"value",
"=",
"getRequired",
"(",
"key",
")",
";",
"return",
"Short",
".",
"valueOf",
"(",
"value",
")",
";",
"}"
] | Returns the Short value for the given key.
The method fails if the key does not exist. | [
"Returns",
"the",
"Short",
"value",
"for",
"the",
"given",
"key",
".",
"The",
"method",
"fails",
"if",
"the",
"key",
"does",
"not",
"exist",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L413-L417 | train | Returns the Short value for the given key. If the key does not exist it will be created and returned. | [
30522,
2270,
2460,
4152,
27794,
1006,
5164,
3145,
1007,
1063,
5587,
3406,
3207,
7011,
11314,
2015,
1006,
3145,
1010,
19701,
1007,
1025,
5164,
3643,
1027,
2131,
2890,
15549,
5596,
1006,
3145,
1007,
1025,
2709,
2460,
1012,
3643,
11253,
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 | codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitReader.java | Bzip2BitReader.hasReadableBytes | boolean hasReadableBytes(int count) {
if (count < 0 || count > MAX_COUNT_OF_READABLE_BYTES) {
throw new IllegalArgumentException("count: " + count
+ " (expected: 0-" + MAX_COUNT_OF_READABLE_BYTES + ')');
}
return hasReadableBits(count << 3);
} | java | boolean hasReadableBytes(int count) {
if (count < 0 || count > MAX_COUNT_OF_READABLE_BYTES) {
throw new IllegalArgumentException("count: " + count
+ " (expected: 0-" + MAX_COUNT_OF_READABLE_BYTES + ')');
}
return hasReadableBits(count << 3);
} | [
"boolean",
"hasReadableBytes",
"(",
"int",
"count",
")",
"{",
"if",
"(",
"count",
"<",
"0",
"||",
"count",
">",
"MAX_COUNT_OF_READABLE_BYTES",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"count: \"",
"+",
"count",
"+",
"\" (expected: 0-\"",
"+",... | Checks that the specified number of bytes available for reading.
@param count The number of bytes to check
@return {@code true} if {@code count} bytes are available for reading, otherwise {@code false} | [
"Checks",
"that",
"the",
"specified",
"number",
"of",
"bytes",
"available",
"for",
"reading",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitReader.java#L150-L156 | train | Check if a byte array contains readable bytes. | [
30522,
22017,
20898,
2038,
16416,
20782,
3762,
4570,
1006,
20014,
4175,
1007,
1063,
2065,
1006,
4175,
1026,
1014,
1064,
1064,
4175,
1028,
4098,
1035,
4175,
1035,
1997,
1035,
3191,
3085,
1035,
27507,
1007,
1063,
5466,
2047,
6206,
2906,
22850... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.mkParentDirs | public static File mkParentDirs(File file) {
final File parentFile = file.getParentFile();
if (null != parentFile && false == parentFile.exists()) {
parentFile.mkdirs();
}
return parentFile;
} | java | public static File mkParentDirs(File file) {
final File parentFile = file.getParentFile();
if (null != parentFile && false == parentFile.exists()) {
parentFile.mkdirs();
}
return parentFile;
} | [
"public",
"static",
"File",
"mkParentDirs",
"(",
"File",
"file",
")",
"{",
"final",
"File",
"parentFile",
"=",
"file",
".",
"getParentFile",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"parentFile",
"&&",
"false",
"==",
"parentFile",
".",
"exists",
"(",
")",... | 创建所给文件或目录的父目录
@param file 文件或目录
@return 父目录 | [
"创建所给文件或目录的父目录"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L657-L663 | train | Create the parent directories of the given file. | [
30522,
2270,
10763,
5371,
12395,
19362,
4765,
4305,
2869,
1006,
5371,
5371,
1007,
1063,
2345,
5371,
6687,
8873,
2571,
1027,
5371,
1012,
2131,
19362,
4765,
8873,
2571,
1006,
1007,
1025,
2065,
1006,
19701,
999,
1027,
6687,
8873,
2571,
1004,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/Unpooled.java | Unpooled.copiedBuffer | public static ByteBuf copiedBuffer(CharSequence string, Charset charset) {
if (string == null) {
throw new NullPointerException("string");
}
if (string instanceof CharBuffer) {
return copiedBuffer((CharBuffer) string, charset);
}
return copiedBuffer(CharBuffer.wrap(string), charset);
} | java | public static ByteBuf copiedBuffer(CharSequence string, Charset charset) {
if (string == null) {
throw new NullPointerException("string");
}
if (string instanceof CharBuffer) {
return copiedBuffer((CharBuffer) string, charset);
}
return copiedBuffer(CharBuffer.wrap(string), charset);
} | [
"public",
"static",
"ByteBuf",
"copiedBuffer",
"(",
"CharSequence",
"string",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"string",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"string\"",
")",
";",
"}",
"if",
"(",
"string",
"... | Creates a new big-endian buffer whose content is the specified
{@code string} encoded in the specified {@code charset}.
The new buffer's {@code readerIndex} and {@code writerIndex} are
{@code 0} and the length of the encoded string respectively. | [
"Creates",
"a",
"new",
"big",
"-",
"endian",
"buffer",
"whose",
"content",
"is",
"the",
"specified",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L577-L587 | train | Returns a copied buffer from the specified string. | [
30522,
2270,
10763,
24880,
8569,
2546,
15826,
8569,
12494,
1006,
25869,
3366,
4226,
5897,
5164,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2065,
1006,
5164,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
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-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBCachingPriorityQueueSet.java | RocksDBCachingPriorityQueueSet.size | @Override
public int size() {
if (allElementsInCache) {
return orderedCache.size();
} else {
int count = 0;
try (final RocksBytesIterator iterator = orderedBytesIterator()) {
while (iterator.hasNext()) {
iterator.next();
++count;
}
}
return count;
}
} | java | @Override
public int size() {
if (allElementsInCache) {
return orderedCache.size();
} else {
int count = 0;
try (final RocksBytesIterator iterator = orderedBytesIterator()) {
while (iterator.hasNext()) {
iterator.next();
++count;
}
}
return count;
}
} | [
"@",
"Override",
"public",
"int",
"size",
"(",
")",
"{",
"if",
"(",
"allElementsInCache",
")",
"{",
"return",
"orderedCache",
".",
"size",
"(",
")",
";",
"}",
"else",
"{",
"int",
"count",
"=",
"0",
";",
"try",
"(",
"final",
"RocksBytesIterator",
"itera... | This implementation comes at a relatively high cost per invocation. It should not be called repeatedly when it is
clear that the value did not change. Currently this is only truly used to realize certain higher-level tests. | [
"This",
"implementation",
"comes",
"at",
"a",
"relatively",
"high",
"cost",
"per",
"invocation",
".",
"It",
"should",
"not",
"be",
"called",
"repeatedly",
"when",
"it",
"is",
"clear",
"that",
"the",
"value",
"did",
"not",
"change",
".",
"Currently",
"this",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBCachingPriorityQueueSet.java#L275-L290 | train | Returns the number of elements in the cache. | [
30522,
1030,
2058,
15637,
2270,
20014,
2946,
1006,
1007,
1063,
2065,
1006,
2035,
12260,
8163,
2378,
3540,
5403,
1007,
1063,
2709,
3641,
3540,
5403,
1012,
2946,
1006,
1007,
1025,
1065,
2842,
1063,
20014,
4175,
1027,
1014,
1025,
3046,
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/spark | launcher/src/main/java/org/apache/spark/launcher/SparkSubmitOptionParser.java | SparkSubmitOptionParser.parse | protected final void parse(List<String> args) {
Pattern eqSeparatedOpt = Pattern.compile("(--[^=]+)=(.+)");
int idx = 0;
for (idx = 0; idx < args.size(); idx++) {
String arg = args.get(idx);
String value = null;
Matcher m = eqSeparatedOpt.matcher(arg);
if (m.matches()) {
arg = m.group(1);
value = m.group(2);
}
// Look for options with a value.
String name = findCliOption(arg, opts);
if (name != null) {
if (value == null) {
if (idx == args.size() - 1) {
throw new IllegalArgumentException(
String.format("Missing argument for option '%s'.", arg));
}
idx++;
value = args.get(idx);
}
if (!handle(name, value)) {
break;
}
continue;
}
// Look for a switch.
name = findCliOption(arg, switches);
if (name != null) {
if (!handle(name, null)) {
break;
}
continue;
}
if (!handleUnknown(arg)) {
break;
}
}
if (idx < args.size()) {
idx++;
}
handleExtraArgs(args.subList(idx, args.size()));
} | java | protected final void parse(List<String> args) {
Pattern eqSeparatedOpt = Pattern.compile("(--[^=]+)=(.+)");
int idx = 0;
for (idx = 0; idx < args.size(); idx++) {
String arg = args.get(idx);
String value = null;
Matcher m = eqSeparatedOpt.matcher(arg);
if (m.matches()) {
arg = m.group(1);
value = m.group(2);
}
// Look for options with a value.
String name = findCliOption(arg, opts);
if (name != null) {
if (value == null) {
if (idx == args.size() - 1) {
throw new IllegalArgumentException(
String.format("Missing argument for option '%s'.", arg));
}
idx++;
value = args.get(idx);
}
if (!handle(name, value)) {
break;
}
continue;
}
// Look for a switch.
name = findCliOption(arg, switches);
if (name != null) {
if (!handle(name, null)) {
break;
}
continue;
}
if (!handleUnknown(arg)) {
break;
}
}
if (idx < args.size()) {
idx++;
}
handleExtraArgs(args.subList(idx, args.size()));
} | [
"protected",
"final",
"void",
"parse",
"(",
"List",
"<",
"String",
">",
"args",
")",
"{",
"Pattern",
"eqSeparatedOpt",
"=",
"Pattern",
".",
"compile",
"(",
"\"(--[^=]+)=(.+)\"",
")",
";",
"int",
"idx",
"=",
"0",
";",
"for",
"(",
"idx",
"=",
"0",
";",
... | Parse a list of spark-submit command line options.
<p>
See SparkSubmitArguments.scala for a more formal description of available options.
@throws IllegalArgumentException If an error is found during parsing. | [
"Parse",
"a",
"list",
"of",
"spark",
"-",
"submit",
"command",
"line",
"options",
".",
"<p",
">",
"See",
"SparkSubmitArguments",
".",
"scala",
"for",
"a",
"more",
"formal",
"description",
"of",
"available",
"options",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/SparkSubmitOptionParser.java#L138-L187 | train | Parse command line options and values. | [
30522,
5123,
2345,
11675,
11968,
3366,
1006,
2862,
1026,
5164,
1028,
12098,
5620,
1007,
1063,
5418,
1041,
4160,
3366,
28689,
3064,
7361,
2102,
1027,
5418,
1012,
4012,
22090,
1006,
1000,
1006,
1011,
1011,
1031,
1034,
1027,
1033,
1009,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java | SlotPoolImpl.requestNewAllocatedSlotInternal | @Nonnull
private CompletableFuture<AllocatedSlot> requestNewAllocatedSlotInternal(
@Nonnull SlotRequestId slotRequestId,
@Nonnull ResourceProfile resourceProfile,
@Nonnull Time timeout) {
componentMainThreadExecutor.assertRunningInMainThread();
final PendingRequest pendingRequest = new PendingRequest(
slotRequestId,
resourceProfile);
// register request timeout
FutureUtils
.orTimeout(
pendingRequest.getAllocatedSlotFuture(),
timeout.toMilliseconds(),
TimeUnit.MILLISECONDS,
componentMainThreadExecutor)
.whenComplete(
(AllocatedSlot ignored, Throwable throwable) -> {
if (throwable instanceof TimeoutException) {
timeoutPendingSlotRequest(slotRequestId);
}
});
if (resourceManagerGateway == null) {
stashRequestWaitingForResourceManager(pendingRequest);
} else {
requestSlotFromResourceManager(resourceManagerGateway, pendingRequest);
}
return pendingRequest.getAllocatedSlotFuture();
} | java | @Nonnull
private CompletableFuture<AllocatedSlot> requestNewAllocatedSlotInternal(
@Nonnull SlotRequestId slotRequestId,
@Nonnull ResourceProfile resourceProfile,
@Nonnull Time timeout) {
componentMainThreadExecutor.assertRunningInMainThread();
final PendingRequest pendingRequest = new PendingRequest(
slotRequestId,
resourceProfile);
// register request timeout
FutureUtils
.orTimeout(
pendingRequest.getAllocatedSlotFuture(),
timeout.toMilliseconds(),
TimeUnit.MILLISECONDS,
componentMainThreadExecutor)
.whenComplete(
(AllocatedSlot ignored, Throwable throwable) -> {
if (throwable instanceof TimeoutException) {
timeoutPendingSlotRequest(slotRequestId);
}
});
if (resourceManagerGateway == null) {
stashRequestWaitingForResourceManager(pendingRequest);
} else {
requestSlotFromResourceManager(resourceManagerGateway, pendingRequest);
}
return pendingRequest.getAllocatedSlotFuture();
} | [
"@",
"Nonnull",
"private",
"CompletableFuture",
"<",
"AllocatedSlot",
">",
"requestNewAllocatedSlotInternal",
"(",
"@",
"Nonnull",
"SlotRequestId",
"slotRequestId",
",",
"@",
"Nonnull",
"ResourceProfile",
"resourceProfile",
",",
"@",
"Nonnull",
"Time",
"timeout",
")",
... | Requests a new slot with the given {@link ResourceProfile} from the ResourceManager. If there is
currently not ResourceManager connected, then the request is stashed and send once a new
ResourceManager is connected.
@param slotRequestId identifying the requested slot
@param resourceProfile which the requested slot should fulfill
@param timeout timeout before the slot allocation times out
@return An {@link AllocatedSlot} future which is completed once the slot is offered to the {@link SlotPool} | [
"Requests",
"a",
"new",
"slot",
"with",
"the",
"given",
"{",
"@link",
"ResourceProfile",
"}",
"from",
"the",
"ResourceManager",
".",
"If",
"there",
"is",
"currently",
"not",
"ResourceManager",
"connected",
"then",
"the",
"request",
"is",
"stashed",
"and",
"sen... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java#L272-L305 | train | Request a new allocated slot. | [
30522,
1030,
2512,
11231,
3363,
2797,
4012,
10814,
10880,
11263,
11244,
1026,
11095,
14540,
4140,
1028,
5227,
2638,
9628,
24755,
3064,
14540,
4140,
18447,
11795,
2389,
1006,
1030,
2512,
11231,
3363,
10453,
2890,
15500,
3593,
10453,
2890,
1550... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.joinWithHuge | public <R> JoinOperatorSets<T, R> joinWithHuge(DataSet<R> other) {
return new JoinOperatorSets<>(this, other, JoinHint.BROADCAST_HASH_FIRST);
} | java | public <R> JoinOperatorSets<T, R> joinWithHuge(DataSet<R> other) {
return new JoinOperatorSets<>(this, other, JoinHint.BROADCAST_HASH_FIRST);
} | [
"public",
"<",
"R",
">",
"JoinOperatorSets",
"<",
"T",
",",
"R",
">",
"joinWithHuge",
"(",
"DataSet",
"<",
"R",
">",
"other",
")",
"{",
"return",
"new",
"JoinOperatorSets",
"<>",
"(",
"this",
",",
"other",
",",
"JoinHint",
".",
"BROADCAST_HASH_FIRST",
")... | Initiates a Join transformation.
<p>A Join transformation joins the elements of two
{@link DataSet DataSets} on key equality and provides multiple ways to combine
joining elements into one DataSet.
<p>This method also gives the hint to the optimizer that the second DataSet to join is much
larger than the first one.
<p>This method returns a {@link JoinOperatorSets} on which one of the {@code where} methods
can be called to define the join key of the first joining (i.e., this) DataSet.
@param other The other DataSet with which this DataSet is joined.
@return A JoinOperatorSet to continue the definition of the Join transformation.
@see JoinOperatorSets
@see DataSet | [
"Initiates",
"a",
"Join",
"transformation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L820-L822 | train | Joins this DataSet with the given DataSet. | [
30522,
2270,
1026,
1054,
1028,
3693,
25918,
18926,
8454,
1026,
1056,
1010,
1054,
1028,
3693,
24415,
6979,
3351,
1006,
2951,
13462,
1026,
1054,
1028,
2060,
1007,
1063,
2709,
2047,
3693,
25918,
18926,
8454,
1026,
1028,
1006,
2023,
1010,
2060,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java | IterUtil.fieldValueList | public static <V> List<Object> fieldValueList(Iterator<V> iter, String fieldName) {
final List<Object> result = new ArrayList<>();
if (null != iter) {
V value;
while (iter.hasNext()) {
value = iter.next();
result.add(ReflectUtil.getFieldValue(value, fieldName));
}
}
return result;
} | java | public static <V> List<Object> fieldValueList(Iterator<V> iter, String fieldName) {
final List<Object> result = new ArrayList<>();
if (null != iter) {
V value;
while (iter.hasNext()) {
value = iter.next();
result.add(ReflectUtil.getFieldValue(value, fieldName));
}
}
return result;
} | [
"public",
"static",
"<",
"V",
">",
"List",
"<",
"Object",
">",
"fieldValueList",
"(",
"Iterator",
"<",
"V",
">",
"iter",
",",
"String",
"fieldName",
")",
"{",
"final",
"List",
"<",
"Object",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";"... | 获取指定Bean列表中某个字段,生成新的列表
@param <V> 对象类型
@param iter 对象列表
@param fieldName 字段名(会通过反射获取其值)
@return 某个字段值与对象对应Map
@since 4.0.10 | [
"获取指定Bean列表中某个字段,生成新的列表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L242-L252 | train | Returns a list of objects from the iterator of the specified field. | [
30522,
2270,
10763,
1026,
1058,
1028,
2862,
1026,
4874,
1028,
2492,
10175,
16284,
2923,
1006,
2009,
6906,
4263,
1026,
1058,
1028,
2009,
2121,
1010,
5164,
2492,
18442,
1007,
1063,
2345,
2862,
1026,
4874,
1028,
2765,
1027,
2047,
30524,
19701,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/chaining/ChainedFlatMapDriver.java | ChainedFlatMapDriver.setup | @Override
public void setup(AbstractInvokable parent) {
@SuppressWarnings("unchecked")
final FlatMapFunction<IT, OT> mapper =
BatchTask.instantiateUserCode(this.config, userCodeClassLoader, FlatMapFunction.class);
this.mapper = mapper;
FunctionUtils.setFunctionRuntimeContext(mapper, getUdfRuntimeContext());
} | java | @Override
public void setup(AbstractInvokable parent) {
@SuppressWarnings("unchecked")
final FlatMapFunction<IT, OT> mapper =
BatchTask.instantiateUserCode(this.config, userCodeClassLoader, FlatMapFunction.class);
this.mapper = mapper;
FunctionUtils.setFunctionRuntimeContext(mapper, getUdfRuntimeContext());
} | [
"@",
"Override",
"public",
"void",
"setup",
"(",
"AbstractInvokable",
"parent",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"final",
"FlatMapFunction",
"<",
"IT",
",",
"OT",
">",
"mapper",
"=",
"BatchTask",
".",
"instantiateUserCode",
"(",
"t... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/chaining/ChainedFlatMapDriver.java#L35-L42 | train | Setup the task. | [
30522,
1030,
2058,
15637,
2270,
11675,
16437,
1006,
10061,
2378,
6767,
2912,
3468,
6687,
1007,
1063,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2345,
4257,
2863,
14376,
4609,
7542,
1026,
2009,
1010,
27178,
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-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java | KinesisDataFetcher.convertToStreamShardHandle | public static StreamShardHandle convertToStreamShardHandle(StreamShardMetadata streamShardMetadata) {
Shard shard = new Shard();
shard.withShardId(streamShardMetadata.getShardId());
shard.withParentShardId(streamShardMetadata.getParentShardId());
shard.withAdjacentParentShardId(streamShardMetadata.getAdjacentParentShardId());
HashKeyRange hashKeyRange = new HashKeyRange();
hashKeyRange.withStartingHashKey(streamShardMetadata.getStartingHashKey());
hashKeyRange.withEndingHashKey(streamShardMetadata.getEndingHashKey());
shard.withHashKeyRange(hashKeyRange);
SequenceNumberRange sequenceNumberRange = new SequenceNumberRange();
sequenceNumberRange.withStartingSequenceNumber(streamShardMetadata.getStartingSequenceNumber());
sequenceNumberRange.withEndingSequenceNumber(streamShardMetadata.getEndingSequenceNumber());
shard.withSequenceNumberRange(sequenceNumberRange);
return new StreamShardHandle(streamShardMetadata.getStreamName(), shard);
} | java | public static StreamShardHandle convertToStreamShardHandle(StreamShardMetadata streamShardMetadata) {
Shard shard = new Shard();
shard.withShardId(streamShardMetadata.getShardId());
shard.withParentShardId(streamShardMetadata.getParentShardId());
shard.withAdjacentParentShardId(streamShardMetadata.getAdjacentParentShardId());
HashKeyRange hashKeyRange = new HashKeyRange();
hashKeyRange.withStartingHashKey(streamShardMetadata.getStartingHashKey());
hashKeyRange.withEndingHashKey(streamShardMetadata.getEndingHashKey());
shard.withHashKeyRange(hashKeyRange);
SequenceNumberRange sequenceNumberRange = new SequenceNumberRange();
sequenceNumberRange.withStartingSequenceNumber(streamShardMetadata.getStartingSequenceNumber());
sequenceNumberRange.withEndingSequenceNumber(streamShardMetadata.getEndingSequenceNumber());
shard.withSequenceNumberRange(sequenceNumberRange);
return new StreamShardHandle(streamShardMetadata.getStreamName(), shard);
} | [
"public",
"static",
"StreamShardHandle",
"convertToStreamShardHandle",
"(",
"StreamShardMetadata",
"streamShardMetadata",
")",
"{",
"Shard",
"shard",
"=",
"new",
"Shard",
"(",
")",
";",
"shard",
".",
"withShardId",
"(",
"streamShardMetadata",
".",
"getShardId",
"(",
... | Utility function to convert {@link StreamShardMetadata} into {@link StreamShardHandle}.
@param streamShardMetadata the {@link StreamShardMetadata} to be converted
@return a {@link StreamShardHandle} object | [
"Utility",
"function",
"to",
"convert",
"{",
"@link",
"StreamShardMetadata",
"}",
"into",
"{",
"@link",
"StreamShardHandle",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java#L900-L917 | train | Converts a StreamShardMetadata to a StreamShardHandle | [
30522,
2270,
10763,
9199,
11783,
11774,
2571,
10463,
13122,
25379,
7377,
4103,
11774,
2571,
1006,
9199,
11783,
11368,
8447,
2696,
9199,
11783,
11368,
8447,
2696,
1007,
1063,
21146,
4103,
21146,
4103,
1027,
2047,
21146,
4103,
1006,
1007,
1025,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java | ReferenceCountedOpenSslEngine.shutdown | public final synchronized void shutdown() {
if (DESTROYED_UPDATER.compareAndSet(this, 0, 1)) {
engineMap.remove(ssl);
SSL.freeSSL(ssl);
ssl = networkBIO = 0;
isInboundDone = outboundClosed = true;
}
// On shutdown clear all errors
SSL.clearError();
} | java | public final synchronized void shutdown() {
if (DESTROYED_UPDATER.compareAndSet(this, 0, 1)) {
engineMap.remove(ssl);
SSL.freeSSL(ssl);
ssl = networkBIO = 0;
isInboundDone = outboundClosed = true;
}
// On shutdown clear all errors
SSL.clearError();
} | [
"public",
"final",
"synchronized",
"void",
"shutdown",
"(",
")",
"{",
"if",
"(",
"DESTROYED_UPDATER",
".",
"compareAndSet",
"(",
"this",
",",
"0",
",",
"1",
")",
")",
"{",
"engineMap",
".",
"remove",
"(",
"ssl",
")",
";",
"SSL",
".",
"freeSSL",
"(",
... | Destroys this engine. | [
"Destroys",
"this",
"engine",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java#L487-L498 | train | Shutdown the session. | [
30522,
2270,
2345,
25549,
11675,
3844,
7698,
1006,
1007,
1063,
2065,
1006,
3908,
1035,
10651,
2099,
1012,
12826,
29560,
3388,
1006,
2023,
1010,
1014,
1010,
1015,
1007,
1007,
1063,
3194,
2863,
2361,
1012,
6366,
1006,
7020,
2140,
1007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/ProgramDeployer.java | ProgramDeployer.deployJob | private <T> void deployJob(ExecutionContext<T> context, JobGraph jobGraph, Result<T> result) {
// create or retrieve cluster and deploy job
try (final ClusterDescriptor<T> clusterDescriptor = context.createClusterDescriptor()) {
try {
// new cluster
if (context.getClusterId() == null) {
deployJobOnNewCluster(clusterDescriptor, jobGraph, result, context.getClassLoader());
}
// reuse existing cluster
else {
deployJobOnExistingCluster(context.getClusterId(), clusterDescriptor, jobGraph, result);
}
} catch (Exception e) {
throw new SqlExecutionException("Could not retrieve or create a cluster.", e);
}
} catch (SqlExecutionException e) {
throw e;
} catch (Exception e) {
throw new SqlExecutionException("Could not locate a cluster.", e);
}
} | java | private <T> void deployJob(ExecutionContext<T> context, JobGraph jobGraph, Result<T> result) {
// create or retrieve cluster and deploy job
try (final ClusterDescriptor<T> clusterDescriptor = context.createClusterDescriptor()) {
try {
// new cluster
if (context.getClusterId() == null) {
deployJobOnNewCluster(clusterDescriptor, jobGraph, result, context.getClassLoader());
}
// reuse existing cluster
else {
deployJobOnExistingCluster(context.getClusterId(), clusterDescriptor, jobGraph, result);
}
} catch (Exception e) {
throw new SqlExecutionException("Could not retrieve or create a cluster.", e);
}
} catch (SqlExecutionException e) {
throw e;
} catch (Exception e) {
throw new SqlExecutionException("Could not locate a cluster.", e);
}
} | [
"private",
"<",
"T",
">",
"void",
"deployJob",
"(",
"ExecutionContext",
"<",
"T",
">",
"context",
",",
"JobGraph",
"jobGraph",
",",
"Result",
"<",
"T",
">",
"result",
")",
"{",
"// create or retrieve cluster and deploy job",
"try",
"(",
"final",
"ClusterDescript... | Deploys a job. Depending on the deployment creates a new job cluster. It saves the cluster id in
the result and blocks until job completion. | [
"Deploys",
"a",
"job",
".",
"Depending",
"on",
"the",
"deployment",
"creates",
"a",
"new",
"job",
"cluster",
".",
"It",
"saves",
"the",
"cluster",
"id",
"in",
"the",
"result",
"and",
"blocks",
"until",
"job",
"completion",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/ProgramDeployer.java#L89-L109 | train | Deploys a job. | [
30522,
2797,
1026,
1056,
1028,
11675,
21296,
5558,
2497,
1006,
7781,
8663,
18209,
1026,
1056,
1028,
6123,
1010,
3105,
14413,
3105,
14413,
1010,
2765,
1026,
1056,
1028,
2765,
1007,
1063,
1013,
1013,
3443,
2030,
12850,
9324,
1998,
21296,
3105... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.duplicate | public final LogBuffer duplicate() {
// XXX: Do momery copy avoid buffer modified.
byte[] buf = Arrays.copyOfRange(buffer, origin, origin + limit);
return new LogBuffer(buf, 0, limit);
} | java | public final LogBuffer duplicate() {
// XXX: Do momery copy avoid buffer modified.
byte[] buf = Arrays.copyOfRange(buffer, origin, origin + limit);
return new LogBuffer(buf, 0, limit);
} | [
"public",
"final",
"LogBuffer",
"duplicate",
"(",
")",
"{",
"// XXX: Do momery copy avoid buffer modified.\r",
"byte",
"[",
"]",
"buf",
"=",
"Arrays",
".",
"copyOfRange",
"(",
"buffer",
",",
"origin",
",",
"origin",
"+",
"limit",
")",
";",
"return",
"new",
"Lo... | Return next n bytes in this buffer. | [
"Return",
"next",
"n",
"bytes",
"in",
"this",
"buffer",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L67-L71 | train | Create a duplicate of this buffer. | [
30522,
2270,
2345,
8833,
8569,
12494,
24473,
1006,
1007,
1063,
1013,
1013,
22038,
2595,
1024,
2079,
3566,
7301,
6100,
4468,
17698,
6310,
1012,
24880,
1031,
1033,
20934,
2546,
1027,
27448,
1012,
6100,
11253,
24388,
2063,
1006,
17698,
1010,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.isAssignable | public static void isAssignable(Class<?> superType, Class<?> subType) throws IllegalArgumentException {
isAssignable(superType, subType, "{} is not assignable to {})", subType, superType);
} | java | public static void isAssignable(Class<?> superType, Class<?> subType) throws IllegalArgumentException {
isAssignable(superType, subType, "{} is not assignable to {})", subType, superType);
} | [
"public",
"static",
"void",
"isAssignable",
"(",
"Class",
"<",
"?",
">",
"superType",
",",
"Class",
"<",
"?",
">",
"subType",
")",
"throws",
"IllegalArgumentException",
"{",
"isAssignable",
"(",
"superType",
",",
"subType",
",",
"\"{} is not assignable to {})\"",
... | 断言 {@code superType.isAssignableFrom(subType)} 是否为 {@code true}.
<pre class="code">
Assert.isAssignable(Number.class, myClass);
</pre>
@param superType 需要检查的父类或接口
@param subType 需要检查的子类
@throws IllegalArgumentException 如果子类非继承父类,抛出此异常 | [
"断言",
"{",
"@code",
"superType",
".",
"isAssignableFrom",
"(",
"subType",
")",
"}",
"是否为",
"{",
"@code",
"true",
"}",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L468-L470 | train | Checks if the given type is assignable to the given type. | [
30522,
2270,
10763,
11675,
18061,
18719,
16989,
3468,
1006,
2465,
1026,
1029,
1028,
3565,
13874,
1010,
2465,
1026,
1029,
1028,
4942,
13874,
1007,
11618,
6206,
2906,
22850,
15781,
2595,
24422,
1063,
18061,
18719,
16989,
3468,
1006,
3565,
13874... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java | ClusterClient.run | public JobSubmissionResult run(JobWithJars jobWithJars, int parallelism, SavepointRestoreSettings savepointSettings)
throws CompilerException, ProgramInvocationException {
ClassLoader classLoader = jobWithJars.getUserCodeClassLoader();
if (classLoader == null) {
throw new IllegalArgumentException("The given JobWithJars does not provide a usercode class loader.");
}
OptimizedPlan optPlan = getOptimizedPlan(compiler, jobWithJars, parallelism);
return run(optPlan, jobWithJars.getJarFiles(), jobWithJars.getClasspaths(), classLoader, savepointSettings);
} | java | public JobSubmissionResult run(JobWithJars jobWithJars, int parallelism, SavepointRestoreSettings savepointSettings)
throws CompilerException, ProgramInvocationException {
ClassLoader classLoader = jobWithJars.getUserCodeClassLoader();
if (classLoader == null) {
throw new IllegalArgumentException("The given JobWithJars does not provide a usercode class loader.");
}
OptimizedPlan optPlan = getOptimizedPlan(compiler, jobWithJars, parallelism);
return run(optPlan, jobWithJars.getJarFiles(), jobWithJars.getClasspaths(), classLoader, savepointSettings);
} | [
"public",
"JobSubmissionResult",
"run",
"(",
"JobWithJars",
"jobWithJars",
",",
"int",
"parallelism",
",",
"SavepointRestoreSettings",
"savepointSettings",
")",
"throws",
"CompilerException",
",",
"ProgramInvocationException",
"{",
"ClassLoader",
"classLoader",
"=",
"jobWit... | Runs a program on the Flink cluster to which this client is connected. The call blocks until the
execution is complete, and returns afterwards.
@param jobWithJars The program to be executed.
@param parallelism The default parallelism to use when running the program. The default parallelism is used
when the program does not set a parallelism by itself.
@throws CompilerException Thrown, if the compiler encounters an illegal situation.
@throws ProgramInvocationException Thrown, if the program could not be instantiated from its jar file,
or if the submission failed. That might be either due to an I/O problem,
i.e. the job-manager is unreachable, or due to the fact that the
parallel execution failed. | [
"Runs",
"a",
"program",
"on",
"the",
"Flink",
"cluster",
"to",
"which",
"this",
"client",
"is",
"connected",
".",
"The",
"call",
"blocks",
"until",
"the",
"execution",
"is",
"complete",
"and",
"returns",
"afterwards",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java#L309-L318 | train | Run the given job with the given parallelism and savepoint settings. | [
30522,
2270,
5841,
12083,
25481,
6072,
11314,
2448,
1006,
3105,
24415,
16084,
2015,
3105,
24415,
16084,
2015,
1010,
20014,
5903,
2964,
1010,
3828,
8400,
28533,
16610,
18319,
3070,
2015,
3828,
26521,
18319,
3070,
2015,
1007,
11618,
21624,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java | ExecutionGraph.aggregateUserAccumulators | public Map<String, OptionalFailure<Accumulator<?, ?>>> aggregateUserAccumulators() {
Map<String, OptionalFailure<Accumulator<?, ?>>> userAccumulators = new HashMap<>();
for (ExecutionVertex vertex : getAllExecutionVertices()) {
Map<String, Accumulator<?, ?>> next = vertex.getCurrentExecutionAttempt().getUserAccumulators();
if (next != null) {
AccumulatorHelper.mergeInto(userAccumulators, next);
}
}
return userAccumulators;
} | java | public Map<String, OptionalFailure<Accumulator<?, ?>>> aggregateUserAccumulators() {
Map<String, OptionalFailure<Accumulator<?, ?>>> userAccumulators = new HashMap<>();
for (ExecutionVertex vertex : getAllExecutionVertices()) {
Map<String, Accumulator<?, ?>> next = vertex.getCurrentExecutionAttempt().getUserAccumulators();
if (next != null) {
AccumulatorHelper.mergeInto(userAccumulators, next);
}
}
return userAccumulators;
} | [
"public",
"Map",
"<",
"String",
",",
"OptionalFailure",
"<",
"Accumulator",
"<",
"?",
",",
"?",
">",
">",
">",
"aggregateUserAccumulators",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"OptionalFailure",
"<",
"Accumulator",
"<",
"?",
",",
"?",
">",
">",
"... | Merges all accumulator results from the tasks previously executed in the Executions.
@return The accumulator map | [
"Merges",
"all",
"accumulator",
"results",
"from",
"the",
"tasks",
"previously",
"executed",
"in",
"the",
"Executions",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java#L749-L761 | train | Aggregate all user accumulators for all executions. | [
30522,
2270,
4949,
1026,
5164,
1010,
11887,
7011,
4014,
5397,
1026,
16222,
2819,
20350,
1026,
1029,
1010,
1029,
1028,
1028,
1028,
9572,
20330,
6305,
24894,
20350,
2015,
1006,
1007,
1063,
4949,
1026,
5164,
1010,
11887,
7011,
4014,
5397,
1026... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/instance/Instance.java | Instance.addFeatureThenClear | protected static void addFeatureThenClear(StringBuilder rawFeature, List<Integer> featureVector, FeatureMap featureMap)
{
int id = featureMap.idOf(rawFeature.toString());
if (id != -1)
{
featureVector.add(id);
}
rawFeature.setLength(0);
} | java | protected static void addFeatureThenClear(StringBuilder rawFeature, List<Integer> featureVector, FeatureMap featureMap)
{
int id = featureMap.idOf(rawFeature.toString());
if (id != -1)
{
featureVector.add(id);
}
rawFeature.setLength(0);
} | [
"protected",
"static",
"void",
"addFeatureThenClear",
"(",
"StringBuilder",
"rawFeature",
",",
"List",
"<",
"Integer",
">",
"featureVector",
",",
"FeatureMap",
"featureMap",
")",
"{",
"int",
"id",
"=",
"featureMap",
".",
"idOf",
"(",
"rawFeature",
".",
"toString... | 添加特征,同时清空缓存
@param rawFeature
@param featureVector
@param featureMap | [
"添加特征,同时清空缓存"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/instance/Instance.java#L69-L77 | train | Add the feature then clear the featureVector | [
30522,
5123,
10763,
11675,
5587,
7959,
4017,
5397,
10760,
12273,
19738,
2099,
1006,
5164,
8569,
23891,
2099,
6315,
7959,
4017,
5397,
1010,
2862,
1026,
16109,
1028,
3444,
3726,
16761,
1010,
3444,
2863,
2361,
3444,
2863,
2361,
1007,
1063,
200... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/MathUtils.java | MathUtils.jenkinsHash | public static int jenkinsHash(int code) {
code = (code + 0x7ed55d16) + (code << 12);
code = (code ^ 0xc761c23c) ^ (code >>> 19);
code = (code + 0x165667b1) + (code << 5);
code = (code + 0xd3a2646c) ^ (code << 9);
code = (code + 0xfd7046c5) + (code << 3);
code = (code ^ 0xb55a4f09) ^ (code >>> 16);
return code >= 0 ? code : -(code + 1);
} | java | public static int jenkinsHash(int code) {
code = (code + 0x7ed55d16) + (code << 12);
code = (code ^ 0xc761c23c) ^ (code >>> 19);
code = (code + 0x165667b1) + (code << 5);
code = (code + 0xd3a2646c) ^ (code << 9);
code = (code + 0xfd7046c5) + (code << 3);
code = (code ^ 0xb55a4f09) ^ (code >>> 16);
return code >= 0 ? code : -(code + 1);
} | [
"public",
"static",
"int",
"jenkinsHash",
"(",
"int",
"code",
")",
"{",
"code",
"=",
"(",
"code",
"+",
"0x7ed55d16",
")",
"+",
"(",
"code",
"<<",
"12",
")",
";",
"code",
"=",
"(",
"code",
"^",
"0xc761c23c",
")",
"^",
"(",
"code",
">>>",
"19",
")"... | This function hashes an integer value. It is adapted from Bob Jenkins' website
<a href="http://www.burtleburtle.net/bob/hash/integer.html">http://www.burtleburtle.net/bob/hash/integer.html</a>.
The hash function has the <i>full avalanche</i> property, meaning that every bit of the value to be hashed
affects every bit of the hash value.
<p>It is crucial to use different hash functions to partition data across machines and the internal partitioning of
data structures. This hash function is intended for partitioning internally in data structures.
@param code The integer to be hashed.
@return The non-negative hash code for the integer. | [
"This",
"function",
"hashes",
"an",
"integer",
"value",
".",
"It",
"is",
"adapted",
"from",
"Bob",
"Jenkins",
"website",
"<a",
"href",
"=",
"http",
":",
"//",
"www",
".",
"burtleburtle",
".",
"net",
"/",
"bob",
"/",
"hash",
"/",
"integer",
".",
"html",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/MathUtils.java#L115-L123 | train | Jenkins hash function. | [
30522,
30524,
3642,
1027,
1006,
3642,
1009,
1014,
2595,
2581,
2098,
24087,
2094,
16048,
1007,
1009,
1006,
3642,
1026,
1026,
2260,
1007,
1025,
3642,
1027,
1006,
3642,
1034,
1014,
2595,
2278,
2581,
2575,
2487,
2278,
21926,
2278,
1007,
1034,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/HeaderPacket.java | HeaderPacket.fromBytes | public void fromBytes(byte[] data) {
if (data == null || data.length != 4) {
throw new IllegalArgumentException("invalid header data. It can't be null and the length must be 4 byte.");
}
this.packetBodyLength = (data[0] & 0xFF) | ((data[1] & 0xFF) << 8) | ((data[2] & 0xFF) << 16);
this.setPacketSequenceNumber(data[3]);
} | java | public void fromBytes(byte[] data) {
if (data == null || data.length != 4) {
throw new IllegalArgumentException("invalid header data. It can't be null and the length must be 4 byte.");
}
this.packetBodyLength = (data[0] & 0xFF) | ((data[1] & 0xFF) << 8) | ((data[2] & 0xFF) << 16);
this.setPacketSequenceNumber(data[3]);
} | [
"public",
"void",
"fromBytes",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"data",
"==",
"null",
"||",
"data",
".",
"length",
"!=",
"4",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"invalid header data. It can't be null and the length mu... | little-endian byte order | [
"little",
"-",
"endian",
"byte",
"order"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/HeaderPacket.java#L47-L53 | train | Set the value from the byte array. | [
30522,
2270,
11675,
2013,
3762,
4570,
1006,
24880,
1031,
1033,
2951,
1007,
1063,
2065,
1006,
2951,
1027,
1027,
19701,
1064,
1064,
2951,
1012,
3091,
999,
1027,
1018,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/fs/Path.java | Path.normalizePath | private String normalizePath(String path) {
// remove leading and tailing whitespaces
path = path.trim();
// remove consecutive slashes & backslashes
path = path.replace("\\", "/");
path = path.replaceAll("/+", "/");
// remove tailing separator
if (path.endsWith(SEPARATOR) &&
!path.equals(SEPARATOR) && // UNIX root path
!WINDOWS_ROOT_DIR_REGEX.matcher(path).matches()) { // Windows root path)
// remove tailing slash
path = path.substring(0, path.length() - SEPARATOR.length());
}
return path;
} | java | private String normalizePath(String path) {
// remove leading and tailing whitespaces
path = path.trim();
// remove consecutive slashes & backslashes
path = path.replace("\\", "/");
path = path.replaceAll("/+", "/");
// remove tailing separator
if (path.endsWith(SEPARATOR) &&
!path.equals(SEPARATOR) && // UNIX root path
!WINDOWS_ROOT_DIR_REGEX.matcher(path).matches()) { // Windows root path)
// remove tailing slash
path = path.substring(0, path.length() - SEPARATOR.length());
}
return path;
} | [
"private",
"String",
"normalizePath",
"(",
"String",
"path",
")",
"{",
"// remove leading and tailing whitespaces",
"path",
"=",
"path",
".",
"trim",
"(",
")",
";",
"// remove consecutive slashes & backslashes",
"path",
"=",
"path",
".",
"replace",
"(",
"\"\\\\\"",
... | Normalizes a path string.
@param path
the path string to normalize
@return the normalized path string | [
"Normalizes",
"a",
"path",
"string",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/Path.java#L260-L279 | train | Normalize the path. | [
30522,
2797,
5164,
3671,
4697,
15069,
1006,
5164,
4130,
1007,
1063,
1013,
1013,
6366,
2877,
1998,
5725,
2075,
12461,
15327,
2015,
4130,
1027,
4130,
1012,
12241,
1006,
1007,
1025,
1013,
1013,
6366,
5486,
18296,
2229,
1004,
10457,
27067,
2229... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DataSink.java | DataSink.sortLocalOutput | @Deprecated
@PublicEvolving
public DataSink<T> sortLocalOutput(int field, Order order) {
// get flat keys
Keys.ExpressionKeys<T> ek = new Keys.ExpressionKeys<>(field, this.type);
int[] flatKeys = ek.computeLogicalKeyPositions();
if (!Keys.ExpressionKeys.isSortKey(field, this.type)) {
throw new InvalidProgramException("Selected sort key is not a sortable type");
}
if (this.sortKeyPositions == null) {
// set sorting info
this.sortKeyPositions = flatKeys;
this.sortOrders = new Order[flatKeys.length];
Arrays.fill(this.sortOrders, order);
} else {
// append sorting info to exising info
int oldLength = this.sortKeyPositions.length;
int newLength = oldLength + flatKeys.length;
this.sortKeyPositions = Arrays.copyOf(this.sortKeyPositions, newLength);
this.sortOrders = Arrays.copyOf(this.sortOrders, newLength);
for (int i = 0; i < flatKeys.length; i++) {
this.sortKeyPositions[oldLength + i] = flatKeys[i];
this.sortOrders[oldLength + i] = order;
}
}
return this;
} | java | @Deprecated
@PublicEvolving
public DataSink<T> sortLocalOutput(int field, Order order) {
// get flat keys
Keys.ExpressionKeys<T> ek = new Keys.ExpressionKeys<>(field, this.type);
int[] flatKeys = ek.computeLogicalKeyPositions();
if (!Keys.ExpressionKeys.isSortKey(field, this.type)) {
throw new InvalidProgramException("Selected sort key is not a sortable type");
}
if (this.sortKeyPositions == null) {
// set sorting info
this.sortKeyPositions = flatKeys;
this.sortOrders = new Order[flatKeys.length];
Arrays.fill(this.sortOrders, order);
} else {
// append sorting info to exising info
int oldLength = this.sortKeyPositions.length;
int newLength = oldLength + flatKeys.length;
this.sortKeyPositions = Arrays.copyOf(this.sortKeyPositions, newLength);
this.sortOrders = Arrays.copyOf(this.sortOrders, newLength);
for (int i = 0; i < flatKeys.length; i++) {
this.sortKeyPositions[oldLength + i] = flatKeys[i];
this.sortOrders[oldLength + i] = order;
}
}
return this;
} | [
"@",
"Deprecated",
"@",
"PublicEvolving",
"public",
"DataSink",
"<",
"T",
">",
"sortLocalOutput",
"(",
"int",
"field",
",",
"Order",
"order",
")",
"{",
"// get flat keys",
"Keys",
".",
"ExpressionKeys",
"<",
"T",
">",
"ek",
"=",
"new",
"Keys",
".",
"Expres... | Sorts each local partition of a {@link org.apache.flink.api.java.tuple.Tuple} data set
on the specified field in the specified {@link Order} before it is emitted by the output format.
<p><b>Note: Only tuple data sets can be sorted using integer field indices.</b>
<p>The tuple data set can be sorted on multiple fields in different orders
by chaining {@link #sortLocalOutput(int, Order)} calls.
@param field The Tuple field on which the data set is locally sorted.
@param order The Order in which the specified Tuple field is locally sorted.
@return This data sink operator with specified output order.
@see org.apache.flink.api.java.tuple.Tuple
@see Order
@deprecated Use {@link DataSet#sortPartition(int, Order)} instead | [
"Sorts",
"each",
"local",
"partition",
"of",
"a",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"api",
".",
"java",
".",
"tuple",
".",
"Tuple",
"}",
"data",
"set",
"on",
"the",
"specified",
"field",
"in",
"the",
"specified",
"{",
"@link",
"O... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/DataSink.java#L127-L158 | train | Sort the data sink by field and order | [
30522,
1030,
2139,
28139,
12921,
1030,
2270,
6777,
4747,
6455,
2270,
2951,
11493,
2243,
1026,
1056,
1028,
4066,
4135,
9289,
5833,
18780,
1006,
20014,
2492,
1010,
2344,
2344,
1007,
1063,
1013,
1013,
2131,
4257,
6309,
6309,
1012,
3670,
14839,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SqlFunctionUtils.java | SqlFunctionUtils.regexpExtract | public static String regexpExtract(String str, String regex, int extractIndex) {
if (extractIndex < 0) {
return null;
}
try {
Matcher m = REGEXP_PATTERN_CACHE.get(regex).matcher(str);
if (m.find()) {
MatchResult mr = m.toMatchResult();
return mr.group(extractIndex);
}
return null;
} catch (Exception e) {
LOG.error(
String.format("Exception in regexpExtract('%s', '%s', '%d')", str, regex, extractIndex),
e);
return null;
}
} | java | public static String regexpExtract(String str, String regex, int extractIndex) {
if (extractIndex < 0) {
return null;
}
try {
Matcher m = REGEXP_PATTERN_CACHE.get(regex).matcher(str);
if (m.find()) {
MatchResult mr = m.toMatchResult();
return mr.group(extractIndex);
}
return null;
} catch (Exception e) {
LOG.error(
String.format("Exception in regexpExtract('%s', '%s', '%d')", str, regex, extractIndex),
e);
return null;
}
} | [
"public",
"static",
"String",
"regexpExtract",
"(",
"String",
"str",
",",
"String",
"regex",
",",
"int",
"extractIndex",
")",
"{",
"if",
"(",
"extractIndex",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"Matcher",
"m",
"=",
"REGEXP_PATTERN... | Returns a string extracted with a specified regular expression and a regex
match group index. | [
"Returns",
"a",
"string",
"extracted",
"with",
"a",
"specified",
"regular",
"expression",
"and",
"a",
"regex",
"match",
"group",
"index",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java#L372-L390 | train | Extract a string from a regular expression. | [
30522,
2270,
10763,
5164,
19723,
10288,
5051,
18413,
22648,
2102,
1006,
5164,
2358,
2099,
1010,
5164,
19723,
10288,
1010,
20014,
14817,
22254,
10288,
1007,
1063,
2065,
1006,
14817,
22254,
10288,
1026,
1014,
1007,
1063,
2709,
19701,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java | Matrix.times | public Matrix times(Matrix B)
{
if (B.m != n)
{
throw new IllegalArgumentException("Matrix inner dimensions must agree.");
}
Matrix X = new Matrix(m, B.n);
double[][] C = X.getArray();
double[] Bcolj = new double[n];
for (int j = 0; j < B.n; j++)
{
for (int k = 0; k < n; k++)
{
Bcolj[k] = B.A[k][j];
}
for (int i = 0; i < m; i++)
{
double[] Arowi = A[i];
double s = 0;
for (int k = 0; k < n; k++)
{
s += Arowi[k] * Bcolj[k];
}
C[i][j] = s;
}
}
return X;
} | java | public Matrix times(Matrix B)
{
if (B.m != n)
{
throw new IllegalArgumentException("Matrix inner dimensions must agree.");
}
Matrix X = new Matrix(m, B.n);
double[][] C = X.getArray();
double[] Bcolj = new double[n];
for (int j = 0; j < B.n; j++)
{
for (int k = 0; k < n; k++)
{
Bcolj[k] = B.A[k][j];
}
for (int i = 0; i < m; i++)
{
double[] Arowi = A[i];
double s = 0;
for (int k = 0; k < n; k++)
{
s += Arowi[k] * Bcolj[k];
}
C[i][j] = s;
}
}
return X;
} | [
"public",
"Matrix",
"times",
"(",
"Matrix",
"B",
")",
"{",
"if",
"(",
"B",
".",
"m",
"!=",
"n",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Matrix inner dimensions must agree.\"",
")",
";",
"}",
"Matrix",
"X",
"=",
"new",
"Matrix",
"(",
... | Linear algebraic matrix multiplication, A * B
@param B another matrix
@return Matrix product, A * B
@throws IllegalArgumentException Matrix inner dimensions must agree. | [
"Linear",
"algebraic",
"matrix",
"multiplication",
"A",
"*",
"B"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L941-L968 | train | Returns the product of this matrix with B. | [
30522,
2270,
8185,
2335,
1006,
8185,
1038,
1007,
1063,
2065,
1006,
1038,
1012,
1049,
999,
1027,
1050,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
8185,
5110,
9646,
2442,
5993,
1012,
1000,
1007,
1025,
1065,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.isModifed | public static boolean isModifed(File file, long lastModifyTime) {
if (null == file || false == file.exists()) {
return true;
}
return file.lastModified() != lastModifyTime;
} | java | public static boolean isModifed(File file, long lastModifyTime) {
if (null == file || false == file.exists()) {
return true;
}
return file.lastModified() != lastModifyTime;
} | [
"public",
"static",
"boolean",
"isModifed",
"(",
"File",
"file",
",",
"long",
"lastModifyTime",
")",
"{",
"if",
"(",
"null",
"==",
"file",
"||",
"false",
"==",
"file",
".",
"exists",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"file",
"... | 判断文件是否被改动<br>
如果文件对象为 null 或者文件不存在,被视为改动
@param file 文件对象
@param lastModifyTime 上次的改动时间
@return 是否被改动 | [
"判断文件是否被改动<br",
">",
"如果文件对象为",
"null",
"或者文件不存在,被视为改动"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1487-L1492 | train | Checks if the file is modified. | [
30522,
2270,
10763,
22017,
20898,
2003,
5302,
4305,
25031,
1006,
5371,
5371,
1010,
2146,
2197,
5302,
4305,
12031,
7292,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
5371,
1064,
1064,
6270,
1027,
1027,
5371,
1012,
6526,
1006,
1007,
1007,
1063,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/PropertyMapper.java | PropertyMapper.from | public <T> Source<T> from(Supplier<T> supplier) {
Assert.notNull(supplier, "Supplier must not be null");
Source<T> source = getSource(supplier);
if (this.sourceOperator != null) {
source = this.sourceOperator.apply(source);
}
return source;
} | java | public <T> Source<T> from(Supplier<T> supplier) {
Assert.notNull(supplier, "Supplier must not be null");
Source<T> source = getSource(supplier);
if (this.sourceOperator != null) {
source = this.sourceOperator.apply(source);
}
return source;
} | [
"public",
"<",
"T",
">",
"Source",
"<",
"T",
">",
"from",
"(",
"Supplier",
"<",
"T",
">",
"supplier",
")",
"{",
"Assert",
".",
"notNull",
"(",
"supplier",
",",
"\"Supplier must not be null\"",
")",
";",
"Source",
"<",
"T",
">",
"source",
"=",
"getSourc... | Return a new {@link Source} from the specified value supplier that can be used to
perform the mapping.
@param <T> the source type
@param supplier the value supplier
@return a {@link Source} that can be used to complete the mapping
@see #from(Object) | [
"Return",
"a",
"new",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/PropertyMapper.java#L102-L109 | train | Returns a source from the given supplier. | [
30522,
2270,
1026,
1056,
1028,
3120,
1026,
1056,
1028,
2013,
1006,
17024,
1026,
1056,
1028,
17024,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
17024,
1010,
1000,
17024,
2442,
2025,
2022,
19701,
1000,
1007,
1025,
3120,
1026,
1056,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-socket/src/main/java/cn/hutool/socket/nio/NioClient.java | NioClient.read | public NioClient read(ByteBuffer buffer) {
try {
this.channel.read(buffer);
} catch (IOException e) {
throw new IORuntimeException(e);
}
return this;
} | java | public NioClient read(ByteBuffer buffer) {
try {
this.channel.read(buffer);
} catch (IOException e) {
throw new IORuntimeException(e);
}
return this;
} | [
"public",
"NioClient",
"read",
"(",
"ByteBuffer",
"buffer",
")",
"{",
"try",
"{",
"this",
".",
"channel",
".",
"read",
"(",
"buffer",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IORuntimeException",
"(",
"e",
")",
";",
... | 处理读事件<br>
当收到读取准备就绪的信号后,回调此方法,用户可读取从客户端传世来的消息
@param buffer 服务端数据存储缓存 | [
"处理读事件<br",
">",
"当收到读取准备就绪的信号后,回调此方法,用户可读取从客户端传世来的消息"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-socket/src/main/java/cn/hutool/socket/nio/NioClient.java#L60-L67 | train | Reads a chunk of data from the underlying file. | [
30522,
2270,
9152,
10085,
8751,
3372,
3191,
1006,
24880,
8569,
12494,
17698,
1007,
1063,
3046,
1063,
2023,
1012,
3149,
1012,
3191,
1006,
17698,
1007,
1025,
1065,
4608,
1006,
22834,
10288,
24422,
1041,
1007,
30524,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.wrapRuntime | public static RuntimeException wrapRuntime(Throwable throwable) {
if (throwable instanceof RuntimeException) {
return (RuntimeException) throwable;
}
if (throwable instanceof Error) {
throw (Error) throwable;
}
return new RuntimeException(throwable);
} | java | public static RuntimeException wrapRuntime(Throwable throwable) {
if (throwable instanceof RuntimeException) {
return (RuntimeException) throwable;
}
if (throwable instanceof Error) {
throw (Error) throwable;
}
return new RuntimeException(throwable);
} | [
"public",
"static",
"RuntimeException",
"wrapRuntime",
"(",
"Throwable",
"throwable",
")",
"{",
"if",
"(",
"throwable",
"instanceof",
"RuntimeException",
")",
"{",
"return",
"(",
"RuntimeException",
")",
"throwable",
";",
"}",
"if",
"(",
"throwable",
"instanceof",... | 使用运行时异常包装编译异常
@param throwable 异常
@return 运行时异常 | [
"使用运行时异常包装编译异常"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/exceptions/ExceptionUtil.java#L54-L62 | train | Wraps a throwable in a RuntimeException. | [
30522,
2270,
10763,
2448,
7292,
10288,
24422,
10236,
15532,
7292,
1006,
5466,
3085,
5466,
3085,
1007,
1063,
2065,
1006,
5466,
3085,
6013,
11253,
2448,
7292,
10288,
24422,
1007,
1063,
2709,
1006,
2448,
7292,
10288,
24422,
1007,
5466,
3085,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/MDAG/SimpleMDAGNode.java | SimpleMDAGNode.binarySearch | private int binarySearch(SimpleMDAGNode[] mdagDataArray, char node)
{
if (transitionSetSize < 1)
{
return -1;
}
int high = transitionSetBeginIndex + transitionSetSize - 1;
int low = transitionSetBeginIndex;
while (low <= high)
{
int mid = ((low + high) >>> 1);
int cmp = mdagDataArray[mid].getLetter() - node;
if (cmp < 0)
low = mid + 1;
else if (cmp > 0)
high = mid - 1;
else
return mid;
}
return -1;
} | java | private int binarySearch(SimpleMDAGNode[] mdagDataArray, char node)
{
if (transitionSetSize < 1)
{
return -1;
}
int high = transitionSetBeginIndex + transitionSetSize - 1;
int low = transitionSetBeginIndex;
while (low <= high)
{
int mid = ((low + high) >>> 1);
int cmp = mdagDataArray[mid].getLetter() - node;
if (cmp < 0)
low = mid + 1;
else if (cmp > 0)
high = mid - 1;
else
return mid;
}
return -1;
} | [
"private",
"int",
"binarySearch",
"(",
"SimpleMDAGNode",
"[",
"]",
"mdagDataArray",
",",
"char",
"node",
")",
"{",
"if",
"(",
"transitionSetSize",
"<",
"1",
")",
"{",
"return",
"-",
"1",
";",
"}",
"int",
"high",
"=",
"transitionSetBeginIndex",
"+",
"transi... | 二分搜索
@param mdagDataArray
@param node
@return | [
"二分搜索"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/SimpleMDAGNode.java#L174-L195 | train | Searches for the first occurrence of the specified node in the array of SimpleMDAGNodes. | [
30522,
2797,
20014,
12441,
17310,
11140,
1006,
3722,
26876,
8490,
3630,
3207,
1031,
1033,
9108,
8490,
2850,
2696,
30524,
1025,
2096,
1006,
2659,
1026,
1027,
2152,
1007,
1063,
20014,
3054,
1027,
1006,
1006,
2659,
1009,
2152,
1007,
1028,
1028... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronPOSTagger.java | PerceptronPOSTagger.tag | @Override
public String[] tag(String... words)
{
POSInstance instance = new POSInstance(words, model.featureMap);
return tag(instance);
} | java | @Override
public String[] tag(String... words)
{
POSInstance instance = new POSInstance(words, model.featureMap);
return tag(instance);
} | [
"@",
"Override",
"public",
"String",
"[",
"]",
"tag",
"(",
"String",
"...",
"words",
")",
"{",
"POSInstance",
"instance",
"=",
"new",
"POSInstance",
"(",
"words",
",",
"model",
".",
"featureMap",
")",
";",
"return",
"tag",
"(",
"instance",
")",
";",
"}... | 标注
@param words
@return | [
"标注"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronPOSTagger.java#L63-L68 | train | Tag a set of words. | [
30522,
1030,
2058,
15637,
2270,
5164,
1031,
1033,
6415,
1006,
5164,
1012,
1012,
1012,
2616,
1007,
1063,
13433,
11493,
12693,
3401,
6013,
1027,
2047,
13433,
11493,
12693,
3401,
1006,
2616,
1010,
2944,
1012,
3444,
2863,
2361,
1007,
1025,
2709... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java | ReUtil.contains | public static boolean contains(Pattern pattern, CharSequence content) {
if (null == pattern || null == content) {
return false;
}
return pattern.matcher(content).find();
} | java | public static boolean contains(Pattern pattern, CharSequence content) {
if (null == pattern || null == content) {
return false;
}
return pattern.matcher(content).find();
} | [
"public",
"static",
"boolean",
"contains",
"(",
"Pattern",
"pattern",
",",
"CharSequence",
"content",
")",
"{",
"if",
"(",
"null",
"==",
"pattern",
"||",
"null",
"==",
"content",
")",
"{",
"return",
"false",
";",
"}",
"return",
"pattern",
".",
"matcher",
... | 指定内容中是否有表达式匹配的内容
@param pattern 编译后的正则模式
@param content 被查找的内容
@return 指定内容中是否有表达式匹配的内容
@since 3.3.1 | [
"指定内容中是否有表达式匹配的内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L536-L541 | train | Checks if the given CharSequence contains the given pattern. | [
30522,
2270,
10763,
22017,
20898,
3397,
1006,
5418,
5418,
1010,
25869,
3366,
4226,
5897,
4180,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
5418,
1064,
1064,
19701,
1027,
1027,
4180,
1007,
1063,
2709,
6270,
1025,
1065,
2709,
5418,
1012,
2674,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/copier/BeanCopier.java | BeanCopier.beanToBean | private void beanToBean(Object providerBean, Object destBean) {
valueProviderToBean(new BeanValueProvider(providerBean, this.copyOptions.ignoreCase, this.copyOptions.ignoreError), destBean);
} | java | private void beanToBean(Object providerBean, Object destBean) {
valueProviderToBean(new BeanValueProvider(providerBean, this.copyOptions.ignoreCase, this.copyOptions.ignoreError), destBean);
} | [
"private",
"void",
"beanToBean",
"(",
"Object",
"providerBean",
",",
"Object",
"destBean",
")",
"{",
"valueProviderToBean",
"(",
"new",
"BeanValueProvider",
"(",
"providerBean",
",",
"this",
".",
"copyOptions",
".",
"ignoreCase",
",",
"this",
".",
"copyOptions",
... | Bean和Bean之间属性拷贝
@param providerBean 来源Bean
@param destBean 目标Bean | [
"Bean和Bean之间属性拷贝"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/copier/BeanCopier.java#L117-L119 | train | Copies the bean from providerBean to destBean. | [
30522,
2797,
11675,
14068,
3406,
4783,
2319,
1006,
4874,
10802,
4783,
2319,
1010,
4874,
4078,
2102,
4783,
2319,
1007,
1063,
3643,
21572,
17258,
8743,
20891,
2319,
1006,
2047,
14068,
10175,
5657,
21572,
17258,
2121,
1006,
10802,
4783,
2319,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonStreamExecutionEnvironment.java | PythonStreamExecutionEnvironment.execute | public JobExecutionResult execute(String job_name) throws Exception {
distributeFiles();
JobExecutionResult result = this.env.execute(job_name);
return result;
} | java | public JobExecutionResult execute(String job_name) throws Exception {
distributeFiles();
JobExecutionResult result = this.env.execute(job_name);
return result;
} | [
"public",
"JobExecutionResult",
"execute",
"(",
"String",
"job_name",
")",
"throws",
"Exception",
"{",
"distributeFiles",
"(",
")",
";",
"JobExecutionResult",
"result",
"=",
"this",
".",
"env",
".",
"execute",
"(",
"job_name",
")",
";",
"return",
"result",
";"... | A thin wrapper layer over {@link StreamExecutionEnvironment#execute(java.lang.String)}.
@return The result of the job execution, containing elapsed time and accumulators.
@throws Exception which occurs during job execution. | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"StreamExecutionEnvironment#execute",
"(",
"java",
".",
"lang",
".",
"String",
")",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/environment/PythonStreamExecutionEnvironment.java#L255-L259 | train | Execute a job. | [
30522,
2270,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/costs/Costs.java | Costs.subtractCosts | public void subtractCosts(Costs other) {
if (this.networkCost != UNKNOWN && other.networkCost != UNKNOWN) {
this.networkCost -= other.networkCost;
if (this.networkCost < 0) {
throw new IllegalArgumentException("Cannot subtract more cost then there is.");
}
}
if (this.diskCost != UNKNOWN && other.diskCost != UNKNOWN) {
this.diskCost -= other.diskCost;
if (this.diskCost < 0) {
throw new IllegalArgumentException("Cannot subtract more cost then there is.");
}
}
if (this.cpuCost != UNKNOWN && other.cpuCost != UNKNOWN) {
this.cpuCost -= other.cpuCost;
if (this.cpuCost < 0) {
throw new IllegalArgumentException("Cannot subtract more cost then there is.");
}
}
// ---------- relative costs ----------
this.heuristicNetworkCost -= other.heuristicNetworkCost;
if (this.heuristicNetworkCost < 0) {
throw new IllegalArgumentException("Cannot subtract more cost then there is.");
}
this.heuristicDiskCost -= other.heuristicDiskCost;
if (this.heuristicDiskCost < 0) {
throw new IllegalArgumentException("Cannot subtract more cost then there is.");
}
this.heuristicCpuCost -= other.heuristicCpuCost;
if (this.heuristicCpuCost < 0) {
throw new IllegalArgumentException("Cannot subtract more cost then there is.");
}
} | java | public void subtractCosts(Costs other) {
if (this.networkCost != UNKNOWN && other.networkCost != UNKNOWN) {
this.networkCost -= other.networkCost;
if (this.networkCost < 0) {
throw new IllegalArgumentException("Cannot subtract more cost then there is.");
}
}
if (this.diskCost != UNKNOWN && other.diskCost != UNKNOWN) {
this.diskCost -= other.diskCost;
if (this.diskCost < 0) {
throw new IllegalArgumentException("Cannot subtract more cost then there is.");
}
}
if (this.cpuCost != UNKNOWN && other.cpuCost != UNKNOWN) {
this.cpuCost -= other.cpuCost;
if (this.cpuCost < 0) {
throw new IllegalArgumentException("Cannot subtract more cost then there is.");
}
}
// ---------- relative costs ----------
this.heuristicNetworkCost -= other.heuristicNetworkCost;
if (this.heuristicNetworkCost < 0) {
throw new IllegalArgumentException("Cannot subtract more cost then there is.");
}
this.heuristicDiskCost -= other.heuristicDiskCost;
if (this.heuristicDiskCost < 0) {
throw new IllegalArgumentException("Cannot subtract more cost then there is.");
}
this.heuristicCpuCost -= other.heuristicCpuCost;
if (this.heuristicCpuCost < 0) {
throw new IllegalArgumentException("Cannot subtract more cost then there is.");
}
} | [
"public",
"void",
"subtractCosts",
"(",
"Costs",
"other",
")",
"{",
"if",
"(",
"this",
".",
"networkCost",
"!=",
"UNKNOWN",
"&&",
"other",
".",
"networkCost",
"!=",
"UNKNOWN",
")",
"{",
"this",
".",
"networkCost",
"-=",
"other",
".",
"networkCost",
";",
... | Subtracts the given costs from these costs. If the given costs are unknown, then these costs are remain unchanged.
@param other The costs to subtract. | [
"Subtracts",
"the",
"given",
"costs",
"from",
"these",
"costs",
".",
"If",
"the",
"given",
"costs",
"are",
"unknown",
"then",
"these",
"costs",
"are",
"remain",
"unchanged",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/costs/Costs.java#L343-L377 | train | Subtracts the given costs from this costs. | [
30522,
2270,
11675,
4942,
6494,
6593,
13186,
3215,
1006,
5366,
2060,
1007,
1063,
2065,
1006,
2023,
1012,
2897,
13186,
2102,
999,
1027,
4242,
1004,
1004,
2060,
1012,
2897,
13186,
2102,
999,
1027,
4242,
1007,
1063,
2023,
1012,
2897,
13186,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.