repo stringclasses 11 values | path stringlengths 41 234 | func_name stringlengths 5 78 | original_string stringlengths 71 14.1k | language stringclasses 1 value | code stringlengths 71 14.1k | code_tokens listlengths 22 2.65k | docstring stringlengths 2 5.35k | docstring_tokens listlengths 1 369 | sha stringclasses 11 values | url stringlengths 129 339 | partition stringclasses 1 value | summary stringlengths 7 175 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/util/ClassLoaderUtil.java | ClassLoaderUtil.validateClassLoadable | public static boolean validateClassLoadable(ClassNotFoundException cnfe, ClassLoader cl) {
try {
String className = cnfe.getMessage();
Class.forName(className, false, cl);
return true;
}
catch (ClassNotFoundException e) {
return false;
}
catch (Exception e) {
return false;
}
} | java | public static boolean validateClassLoadable(ClassNotFoundException cnfe, ClassLoader cl) {
try {
String className = cnfe.getMessage();
Class.forName(className, false, cl);
return true;
}
catch (ClassNotFoundException e) {
return false;
}
catch (Exception e) {
return false;
}
} | [
"public",
"static",
"boolean",
"validateClassLoadable",
"(",
"ClassNotFoundException",
"cnfe",
",",
"ClassLoader",
"cl",
")",
"{",
"try",
"{",
"String",
"className",
"=",
"cnfe",
".",
"getMessage",
"(",
")",
";",
"Class",
".",
"forName",
"(",
"className",
",",... | Checks, whether the class that was not found in the given exception, can be resolved through
the given class loader.
@param cnfe The ClassNotFoundException that defines the name of the class.
@param cl The class loader to use for the class resolution.
@return True, if the class can be resolved with the given class loader, false if not. | [
"Checks",
"whether",
"the",
"class",
"that",
"was",
"not",
"found",
"in",
"the",
"given",
"exception",
"can",
"be",
"resolved",
"through",
"the",
"given",
"class",
"loader",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/ClassLoaderUtil.java#L119-L131 | train | Validate if the given exception is a class loadable exception. | [
30522,
2270,
10763,
22017,
20898,
9398,
3686,
26266,
11066,
3085,
1006,
2465,
17048,
14876,
8630,
10288,
24422,
27166,
7959,
1010,
2465,
11066,
2121,
18856,
1007,
1063,
3046,
1063,
5164,
2465,
18442,
1027,
27166,
7959,
1012,
2131,
7834,
3736,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/minicluster/MiniCluster.java | MiniCluster.runDetached | public void runDetached(JobGraph job) throws JobExecutionException, InterruptedException {
checkNotNull(job, "job is null");
final CompletableFuture<JobSubmissionResult> submissionFuture = submitJob(job);
try {
submissionFuture.get();
} catch (ExecutionException e) {
throw new JobExecutionException(job.getJobID(), ExceptionUtils.stripExecutionException(e));
}
} | java | public void runDetached(JobGraph job) throws JobExecutionException, InterruptedException {
checkNotNull(job, "job is null");
final CompletableFuture<JobSubmissionResult> submissionFuture = submitJob(job);
try {
submissionFuture.get();
} catch (ExecutionException e) {
throw new JobExecutionException(job.getJobID(), ExceptionUtils.stripExecutionException(e));
}
} | [
"public",
"void",
"runDetached",
"(",
"JobGraph",
"job",
")",
"throws",
"JobExecutionException",
",",
"InterruptedException",
"{",
"checkNotNull",
"(",
"job",
",",
"\"job is null\"",
")",
";",
"final",
"CompletableFuture",
"<",
"JobSubmissionResult",
">",
"submissionF... | This method executes a job in detached mode. The method returns immediately after the job
has been added to the
@param job The Flink job to execute
@throws JobExecutionException Thrown if anything went amiss during initial job launch,
or if the job terminally failed. | [
"This",
"method",
"executes",
"a",
"job",
"in",
"detached",
"mode",
".",
"The",
"method",
"returns",
"immediately",
"after",
"the",
"job",
"has",
"been",
"added",
"to",
"the"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java#L587-L597 | train | Run a detached job. | [
30522,
2270,
11675,
2448,
3207,
2696,
7690,
1006,
3105,
14413,
3105,
1007,
11618,
3105,
10288,
8586,
13700,
10288,
24422,
1010,
7153,
10288,
24422,
1063,
4638,
17048,
11231,
3363,
1006,
3105,
1010,
1000,
3105,
2003,
19701,
1000,
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-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/Translate.java | Translate.translateVertexIds | public static <OLD, NEW, VV> DataSet<Vertex<NEW, VV>> translateVertexIds(DataSet<Vertex<OLD, VV>> vertices, TranslateFunction<OLD, NEW> translator) {
return translateVertexIds(vertices, translator, PARALLELISM_DEFAULT);
} | java | public static <OLD, NEW, VV> DataSet<Vertex<NEW, VV>> translateVertexIds(DataSet<Vertex<OLD, VV>> vertices, TranslateFunction<OLD, NEW> translator) {
return translateVertexIds(vertices, translator, PARALLELISM_DEFAULT);
} | [
"public",
"static",
"<",
"OLD",
",",
"NEW",
",",
"VV",
">",
"DataSet",
"<",
"Vertex",
"<",
"NEW",
",",
"VV",
">",
">",
"translateVertexIds",
"(",
"DataSet",
"<",
"Vertex",
"<",
"OLD",
",",
"VV",
">",
">",
"vertices",
",",
"TranslateFunction",
"<",
"O... | Translate {@link Vertex} IDs using the given {@link TranslateFunction}.
@param vertices input vertices
@param translator implements conversion from {@code OLD} to {@code NEW}
@param <OLD> old vertex ID type
@param <NEW> new vertex ID type
@param <VV> vertex value type
@return translated vertices | [
"Translate",
"{",
"@link",
"Vertex",
"}",
"IDs",
"using",
"the",
"given",
"{",
"@link",
"TranslateFunction",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/Translate.java#L54-L56 | train | Translate a DataSet of vertices using the given translator. | [
30522,
2270,
10763,
1026,
2214,
1010,
2047,
1010,
1058,
2615,
1028,
2951,
13462,
1026,
19449,
1026,
2047,
1010,
1058,
2615,
1028,
1028,
17637,
16874,
10288,
9821,
1006,
2951,
13462,
1026,
19449,
1026,
2214,
1010,
1058,
2615,
1028,
1028,
189... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java | ZipUtil.unZlib | public static byte[] unZlib(InputStream in, int length) {
final ByteArrayOutputStream out = new ByteArrayOutputStream(length);
inflater(in, out);
return out.toByteArray();
} | java | public static byte[] unZlib(InputStream in, int length) {
final ByteArrayOutputStream out = new ByteArrayOutputStream(length);
inflater(in, out);
return out.toByteArray();
} | [
"public",
"static",
"byte",
"[",
"]",
"unZlib",
"(",
"InputStream",
"in",
",",
"int",
"length",
")",
"{",
"final",
"ByteArrayOutputStream",
"out",
"=",
"new",
"ByteArrayOutputStream",
"(",
"length",
")",
";",
"inflater",
"(",
"in",
",",
"out",
")",
";",
... | 解压缩zlib
@param in 数据流
@param length 预估长度
@return 解压后的bytes
@since 4.1.19 | [
"解压缩zlib"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L732-L736 | train | Unzlib a byte array from an input stream. | [
30522,
2270,
10763,
24880,
1031,
1033,
4895,
2480,
29521,
1006,
20407,
25379,
1999,
1010,
20014,
3091,
1007,
1063,
2345,
24880,
2906,
9447,
5833,
18780,
21422,
2041,
1027,
2047,
24880,
2906,
9447,
5833,
18780,
21422,
1006,
3091,
30524,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.sub | public static Object[] sub(Object array, int start, int end) {
return sub(array, start, end, 1);
} | java | public static Object[] sub(Object array, int start, int end) {
return sub(array, start, end, 1);
} | [
"public",
"static",
"Object",
"[",
"]",
"sub",
"(",
"Object",
"array",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"sub",
"(",
"array",
",",
"start",
",",
"end",
",",
"1",
")",
";",
"}"
] | 获取子数组
@param array 数组
@param start 开始位置(包括)
@param end 结束位置(不包括)
@return 新的数组
@since 4.0.6 | [
"获取子数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L2170-L2172 | train | Returns a sub - range of the specified array. | [
30522,
2270,
10763,
4874,
1031,
1033,
4942,
1006,
4874,
9140,
1010,
20014,
2707,
1010,
20014,
2203,
1007,
1063,
2709,
4942,
1006,
9140,
1010,
2707,
1010,
2203,
1010,
1015,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupPartitioner.java | KeyGroupPartitioner.buildHistogramByAccumulatingCounts | private int buildHistogramByAccumulatingCounts() {
int sum = 0;
for (int i = 0; i < counterHistogram.length; ++i) {
int currentSlotValue = counterHistogram[i];
counterHistogram[i] = sum;
sum += currentSlotValue;
}
return sum;
} | java | private int buildHistogramByAccumulatingCounts() {
int sum = 0;
for (int i = 0; i < counterHistogram.length; ++i) {
int currentSlotValue = counterHistogram[i];
counterHistogram[i] = sum;
sum += currentSlotValue;
}
return sum;
} | [
"private",
"int",
"buildHistogramByAccumulatingCounts",
"(",
")",
"{",
"int",
"sum",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"counterHistogram",
".",
"length",
";",
"++",
"i",
")",
"{",
"int",
"currentSlotValue",
"=",
"counterHist... | This method creates a histogram from the counts per key-group in {@link #counterHistogram}. | [
"This",
"method",
"creates",
"a",
"histogram",
"from",
"the",
"counts",
"per",
"key",
"-",
"group",
"in",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupPartitioner.java#L170-L178 | train | Builds the histogram by accumulating counts. | [
30522,
2797,
20014,
3857,
24158,
3406,
13113,
3762,
6305,
24894,
10924,
3597,
16671,
2015,
1006,
1007,
1063,
20014,
7680,
1027,
1014,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
4675,
24158,
3406,
13113,
1012,
3091,
1025,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.roundStr | public static String roundStr(String numberStr, int scale, RoundingMode roundingMode) {
return round(numberStr, scale, roundingMode).toString();
} | java | public static String roundStr(String numberStr, int scale, RoundingMode roundingMode) {
return round(numberStr, scale, roundingMode).toString();
} | [
"public",
"static",
"String",
"roundStr",
"(",
"String",
"numberStr",
",",
"int",
"scale",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"round",
"(",
"numberStr",
",",
"scale",
",",
"roundingMode",
")",
".",
"toString",
"(",
")",
";",
"}"
] | 保留固定位数小数<br>
例如保留四位小数:123.456789 =》 123.4567
@param numberStr 数字值的字符串表现形式
@param scale 保留小数位数
@param roundingMode 保留小数的模式 {@link RoundingMode}
@return 新值
@since 3.2.2 | [
"保留固定位数小数<br",
">",
"例如保留四位小数:123",
".",
"456789",
"=",
"》",
"123",
".",
"4567"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L897-L899 | train | Round a string to a given scale. | [
30522,
2270,
10763,
5164,
6241,
16344,
1006,
5164,
3616,
16344,
1010,
20014,
4094,
1010,
26939,
5302,
3207,
26939,
5302,
3207,
1007,
1063,
2709,
2461,
1006,
3616,
16344,
1010,
4094,
1010,
26939,
5302,
3207,
1007,
1012,
2000,
3367,
4892,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpoint.java | PendingCheckpoint.setCancellerHandle | public boolean setCancellerHandle(ScheduledFuture<?> cancellerHandle) {
synchronized (lock) {
if (this.cancellerHandle == null) {
if (!discarded) {
this.cancellerHandle = cancellerHandle;
return true;
} else {
return false;
}
}
else {
throw new IllegalStateException("A canceller handle was already set");
}
}
} | java | public boolean setCancellerHandle(ScheduledFuture<?> cancellerHandle) {
synchronized (lock) {
if (this.cancellerHandle == null) {
if (!discarded) {
this.cancellerHandle = cancellerHandle;
return true;
} else {
return false;
}
}
else {
throw new IllegalStateException("A canceller handle was already set");
}
}
} | [
"public",
"boolean",
"setCancellerHandle",
"(",
"ScheduledFuture",
"<",
"?",
">",
"cancellerHandle",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"this",
".",
"cancellerHandle",
"==",
"null",
")",
"{",
"if",
"(",
"!",
"discarded",
")",
"{",
... | Sets the handle for the canceller to this pending checkpoint. This method fails
with an exception if a handle has already been set.
@return true, if the handle was set, false, if the checkpoint is already disposed; | [
"Sets",
"the",
"handle",
"for",
"the",
"canceller",
"to",
"this",
"pending",
"checkpoint",
".",
"This",
"method",
"fails",
"with",
"an",
"exception",
"if",
"a",
"handle",
"has",
"already",
"been",
"set",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpoint.java#L218-L232 | train | Sets the handle of the canceller to be used. | [
30522,
2270,
22017,
20898,
2275,
9336,
29109,
3917,
11774,
2571,
1006,
5115,
11263,
11244,
1026,
1029,
1028,
17542,
3917,
11774,
2571,
1007,
1063,
25549,
1006,
5843,
1007,
1063,
2065,
1006,
2023,
1012,
17542,
3917,
11774,
2571,
1027,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java | NettyUtils.createPooledByteBufAllocator | public static PooledByteBufAllocator createPooledByteBufAllocator(
boolean allowDirectBufs,
boolean allowCache,
int numCores) {
if (numCores == 0) {
numCores = Runtime.getRuntime().availableProcessors();
}
return new PooledByteBufAllocator(
allowDirectBufs && PlatformDependent.directBufferPreferred(),
Math.min(PooledByteBufAllocator.defaultNumHeapArena(), numCores),
Math.min(PooledByteBufAllocator.defaultNumDirectArena(), allowDirectBufs ? numCores : 0),
PooledByteBufAllocator.defaultPageSize(),
PooledByteBufAllocator.defaultMaxOrder(),
allowCache ? PooledByteBufAllocator.defaultTinyCacheSize() : 0,
allowCache ? PooledByteBufAllocator.defaultSmallCacheSize() : 0,
allowCache ? PooledByteBufAllocator.defaultNormalCacheSize() : 0,
allowCache ? PooledByteBufAllocator.defaultUseCacheForAllThreads() : false
);
} | java | public static PooledByteBufAllocator createPooledByteBufAllocator(
boolean allowDirectBufs,
boolean allowCache,
int numCores) {
if (numCores == 0) {
numCores = Runtime.getRuntime().availableProcessors();
}
return new PooledByteBufAllocator(
allowDirectBufs && PlatformDependent.directBufferPreferred(),
Math.min(PooledByteBufAllocator.defaultNumHeapArena(), numCores),
Math.min(PooledByteBufAllocator.defaultNumDirectArena(), allowDirectBufs ? numCores : 0),
PooledByteBufAllocator.defaultPageSize(),
PooledByteBufAllocator.defaultMaxOrder(),
allowCache ? PooledByteBufAllocator.defaultTinyCacheSize() : 0,
allowCache ? PooledByteBufAllocator.defaultSmallCacheSize() : 0,
allowCache ? PooledByteBufAllocator.defaultNormalCacheSize() : 0,
allowCache ? PooledByteBufAllocator.defaultUseCacheForAllThreads() : false
);
} | [
"public",
"static",
"PooledByteBufAllocator",
"createPooledByteBufAllocator",
"(",
"boolean",
"allowDirectBufs",
",",
"boolean",
"allowCache",
",",
"int",
"numCores",
")",
"{",
"if",
"(",
"numCores",
"==",
"0",
")",
"{",
"numCores",
"=",
"Runtime",
".",
"getRuntim... | Create a pooled ByteBuf allocator but disables the thread-local cache. Thread-local caches
are disabled for TransportClients because the ByteBufs are allocated by the event loop thread,
but released by the executor thread rather than the event loop thread. Those thread-local
caches actually delay the recycling of buffers, leading to larger memory usage. | [
"Create",
"a",
"pooled",
"ByteBuf",
"allocator",
"but",
"disables",
"the",
"thread",
"-",
"local",
"cache",
".",
"Thread",
"-",
"local",
"caches",
"are",
"disabled",
"for",
"TransportClients",
"because",
"the",
"ByteBufs",
"are",
"allocated",
"by",
"the",
"eve... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/NettyUtils.java#L152-L170 | train | Create a pooled ByteBuf allocator. | [
30522,
2270,
10763,
19107,
18939,
17250,
8569,
13976,
24755,
4263,
3443,
16869,
2098,
3762,
2618,
8569,
13976,
24755,
4263,
1006,
22017,
20898,
3499,
4305,
2890,
6593,
8569,
10343,
1010,
22017,
20898,
3499,
3540,
5403,
1010,
20014,
16371,
124... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/watch/watchers/DelayWatcher.java | DelayWatcher.onDelayModify | private void onDelayModify(WatchEvent<?> event, Path currentPath) {
Path eventPath = Paths.get(currentPath.toString(), event.context().toString());
if(eventSet.contains(eventPath)) {
//此事件已经被触发过,后续事件忽略,等待统一处理。
return;
}
//事件第一次触发,此时标记事件,并启动处理线程延迟处理,处理结束后会删除标记
eventSet.add(eventPath);
startHandleModifyThread(event, currentPath);
} | java | private void onDelayModify(WatchEvent<?> event, Path currentPath) {
Path eventPath = Paths.get(currentPath.toString(), event.context().toString());
if(eventSet.contains(eventPath)) {
//此事件已经被触发过,后续事件忽略,等待统一处理。
return;
}
//事件第一次触发,此时标记事件,并启动处理线程延迟处理,处理结束后会删除标记
eventSet.add(eventPath);
startHandleModifyThread(event, currentPath);
} | [
"private",
"void",
"onDelayModify",
"(",
"WatchEvent",
"<",
"?",
">",
"event",
",",
"Path",
"currentPath",
")",
"{",
"Path",
"eventPath",
"=",
"Paths",
".",
"get",
"(",
"currentPath",
".",
"toString",
"(",
")",
",",
"event",
".",
"context",
"(",
")",
"... | 触发延迟修改
@param event 事件
@param currentPath 事件发生的当前Path路径 | [
"触发延迟修改"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/watchers/DelayWatcher.java#L79-L89 | train | Handle delay modify event. | [
30522,
2797,
11675,
2006,
9247,
4710,
5302,
4305,
12031,
1006,
3422,
18697,
3372,
1026,
1029,
1028,
2724,
1010,
4130,
2783,
15069,
1007,
1063,
4130,
2724,
15069,
1027,
10425,
1012,
2131,
1006,
2783,
15069,
1012,
2000,
3367,
4892,
1006,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/GroupedMap.java | GroupedMap.clear | public GroupedMap clear(String group) {
group = StrUtil.nullToEmpty(group).trim();
writeLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
valueMap.clear();
}
} finally {
writeLock.unlock();
}
return this;
} | java | public GroupedMap clear(String group) {
group = StrUtil.nullToEmpty(group).trim();
writeLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
valueMap.clear();
}
} finally {
writeLock.unlock();
}
return this;
} | [
"public",
"GroupedMap",
"clear",
"(",
"String",
"group",
")",
"{",
"group",
"=",
"StrUtil",
".",
"nullToEmpty",
"(",
"group",
")",
".",
"trim",
"(",
")",
";",
"writeLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"final",
"LinkedHashMap",
"<",
"String",... | 清除指定分组下的所有键值对
@param group 分组
@return this | [
"清除指定分组下的所有键值对"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/GroupedMap.java#L218-L230 | train | Removes all values from the specified group from this map. | [
30522,
2270,
15131,
2863,
2361,
3154,
1006,
5164,
2177,
1007,
1063,
2177,
1027,
2358,
22134,
4014,
1012,
19701,
3406,
6633,
13876,
2100,
1006,
2177,
1007,
1012,
12241,
1006,
1007,
1025,
4339,
7878,
1012,
5843,
1006,
1007,
1025,
3046,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/summary/BM25.java | BM25.sim | public double sim(List<String> sentence, int index)
{
double score = 0;
for (String word : sentence)
{
if (!f[index].containsKey(word)) continue;
int d = docs.get(index).size();
Integer tf = f[index].get(word);
score += (idf.get(word) * tf * (k1 + 1)
/ (tf + k1 * (1 - b + b * d
/ avgdl)));
}
return score;
} | java | public double sim(List<String> sentence, int index)
{
double score = 0;
for (String word : sentence)
{
if (!f[index].containsKey(word)) continue;
int d = docs.get(index).size();
Integer tf = f[index].get(word);
score += (idf.get(word) * tf * (k1 + 1)
/ (tf + k1 * (1 - b + b * d
/ avgdl)));
}
return score;
} | [
"public",
"double",
"sim",
"(",
"List",
"<",
"String",
">",
"sentence",
",",
"int",
"index",
")",
"{",
"double",
"score",
"=",
"0",
";",
"for",
"(",
"String",
"word",
":",
"sentence",
")",
"{",
"if",
"(",
"!",
"f",
"[",
"index",
"]",
".",
"contai... | 计算一个句子与一个文档的BM25相似度
@param sentence 句子(查询语句)
@param index 文档(用语料库中的下标表示)
@return BM25 score | [
"计算一个句子与一个文档的BM25相似度"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/summary/BM25.java#L119-L133 | train | sim returns the score of a sentence | [
30522,
2270,
3313,
21934,
1006,
2862,
1026,
5164,
1028,
6251,
1010,
20014,
5950,
1007,
1063,
3313,
3556,
1027,
1014,
1025,
2005,
1006,
5164,
2773,
1024,
6251,
1007,
1063,
2065,
1006,
999,
1042,
1031,
5950,
1033,
1012,
3397,
14839,
1006,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.round | public static BigDecimal round(String numberStr, int scale) {
return round(numberStr, scale, RoundingMode.HALF_UP);
} | java | public static BigDecimal round(String numberStr, int scale) {
return round(numberStr, scale, RoundingMode.HALF_UP);
} | [
"public",
"static",
"BigDecimal",
"round",
"(",
"String",
"numberStr",
",",
"int",
"scale",
")",
"{",
"return",
"round",
"(",
"numberStr",
",",
"scale",
",",
"RoundingMode",
".",
"HALF_UP",
")",
";",
"}"
] | 保留固定位数小数<br>
采用四舍五入策略 {@link RoundingMode#HALF_UP}<br>
例如保留2位小数:123.456789 =》 123.46
@param numberStr 数字值的字符串表现形式
@param scale 保留小数位数
@return 新值 | [
"保留固定位数小数<br",
">",
"采用四舍五入策略",
"{",
"@link",
"RoundingMode#HALF_UP",
"}",
"<br",
">",
"例如保留2位小数:123",
".",
"456789",
"=",
"》",
"123",
".",
"46"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L788-L790 | train | Round a string to a given scale. | [
30522,
2270,
10763,
2502,
3207,
6895,
9067,
2461,
1006,
5164,
3616,
16344,
1010,
20014,
4094,
1007,
1063,
2709,
2461,
1006,
3616,
16344,
1010,
4094,
1010,
26939,
5302,
3207,
1012,
2431,
1035,
2039,
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-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/DoubleParameter.java | DoubleParameter.setMinimumValue | public DoubleParameter setMinimumValue(double minimumValue, boolean inclusive) {
if (hasDefaultValue) {
if (inclusive) {
Util.checkParameter(minimumValue <= defaultValue,
"Minimum value (" + minimumValue + ") must be less than or equal to default (" + defaultValue + ")");
} else {
Util.checkParameter(minimumValue < defaultValue,
"Minimum value (" + minimumValue + ") must be less than default (" + defaultValue + ")");
}
} else if (hasMaximumValue) {
if (inclusive && maximumValueInclusive) {
Util.checkParameter(minimumValue <= maximumValue,
"Minimum value (" + minimumValue + ") must be less than or equal to maximum (" + maximumValue + ")");
} else {
Util.checkParameter(minimumValue < maximumValue,
"Minimum value (" + minimumValue + ") must be less than maximum (" + maximumValue + ")");
}
}
this.hasMinimumValue = true;
this.minimumValue = minimumValue;
this.minimumValueInclusive = inclusive;
return this;
} | java | public DoubleParameter setMinimumValue(double minimumValue, boolean inclusive) {
if (hasDefaultValue) {
if (inclusive) {
Util.checkParameter(minimumValue <= defaultValue,
"Minimum value (" + minimumValue + ") must be less than or equal to default (" + defaultValue + ")");
} else {
Util.checkParameter(minimumValue < defaultValue,
"Minimum value (" + minimumValue + ") must be less than default (" + defaultValue + ")");
}
} else if (hasMaximumValue) {
if (inclusive && maximumValueInclusive) {
Util.checkParameter(minimumValue <= maximumValue,
"Minimum value (" + minimumValue + ") must be less than or equal to maximum (" + maximumValue + ")");
} else {
Util.checkParameter(minimumValue < maximumValue,
"Minimum value (" + minimumValue + ") must be less than maximum (" + maximumValue + ")");
}
}
this.hasMinimumValue = true;
this.minimumValue = minimumValue;
this.minimumValueInclusive = inclusive;
return this;
} | [
"public",
"DoubleParameter",
"setMinimumValue",
"(",
"double",
"minimumValue",
",",
"boolean",
"inclusive",
")",
"{",
"if",
"(",
"hasDefaultValue",
")",
"{",
"if",
"(",
"inclusive",
")",
"{",
"Util",
".",
"checkParameter",
"(",
"minimumValue",
"<=",
"defaultValu... | Set the minimum value. The minimum value is an acceptable value if and
only if inclusive is set to true.
@param minimumValue the minimum value
@param inclusive whether the minimum value is a valid value
@return this | [
"Set",
"the",
"minimum",
"value",
".",
"The",
"minimum",
"value",
"is",
"an",
"acceptable",
"value",
"if",
"and",
"only",
"if",
"inclusive",
"is",
"set",
"to",
"true",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/DoubleParameter.java#L88-L112 | train | Sets the minimum value. | [
30522,
2270,
3313,
28689,
22828,
2275,
25300,
27147,
10175,
5657,
1006,
3313,
6263,
10175,
5657,
1010,
22017,
20898,
18678,
1007,
1063,
2065,
1006,
2038,
3207,
7011,
11314,
10175,
5657,
1007,
1063,
2065,
1006,
18678,
1007,
1063,
21183,
4014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java | PerceptronClassifier.evaluate | public BinaryClassificationFMeasure evaluate(String corpus)
{
Instance[] instanceList = readInstance(corpus, model.featureMap);
return evaluate(instanceList);
} | java | public BinaryClassificationFMeasure evaluate(String corpus)
{
Instance[] instanceList = readInstance(corpus, model.featureMap);
return evaluate(instanceList);
} | [
"public",
"BinaryClassificationFMeasure",
"evaluate",
"(",
"String",
"corpus",
")",
"{",
"Instance",
"[",
"]",
"instanceList",
"=",
"readInstance",
"(",
"corpus",
",",
"model",
".",
"featureMap",
")",
";",
"return",
"evaluate",
"(",
"instanceList",
")",
";",
"... | 评估
@param corpus
@return | [
"评估"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java#L153-L157 | train | Evaluate the binary classification FMeasure for a corpus | [
30522,
2270,
12441,
26266,
9031,
16715,
5243,
28632,
16157,
1006,
5164,
13931,
1007,
1063,
6013,
1031,
1033,
6013,
9863,
1027,
3191,
7076,
26897,
1006,
13931,
1010,
2944,
1012,
3444,
2863,
2361,
1007,
1025,
2709,
16157,
1006,
6013,
9863,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/MethodlessRouter.java | MethodlessRouter.addRoute | public MethodlessRouter<T> addRoute(String pathPattern, T target) {
PathPattern p = new PathPattern(pathPattern);
if (routes.containsKey(p)) {
return this;
}
routes.put(p, target);
return this;
} | java | public MethodlessRouter<T> addRoute(String pathPattern, T target) {
PathPattern p = new PathPattern(pathPattern);
if (routes.containsKey(p)) {
return this;
}
routes.put(p, target);
return this;
} | [
"public",
"MethodlessRouter",
"<",
"T",
">",
"addRoute",
"(",
"String",
"pathPattern",
",",
"T",
"target",
")",
"{",
"PathPattern",
"p",
"=",
"new",
"PathPattern",
"(",
"pathPattern",
")",
";",
"if",
"(",
"routes",
".",
"containsKey",
"(",
"p",
")",
")",... | This method does nothing if the path pattern has already been added.
A path pattern can only point to one target. | [
"This",
"method",
"does",
"nothing",
"if",
"the",
"path",
"pattern",
"has",
"already",
"been",
"added",
".",
"A",
"path",
"pattern",
"can",
"only",
"point",
"to",
"one",
"target",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/MethodlessRouter.java#L60-L68 | train | Add a route to this router. | [
30522,
2270,
4118,
3238,
22494,
3334,
1026,
1056,
1028,
5587,
22494,
2618,
1006,
5164,
4130,
4502,
30524,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | example/src/main/java/io/netty/example/http2/Http2ExampleUtil.java | Http2ExampleUtil.toByteBuf | public static ByteBuf toByteBuf(InputStream input) throws IOException {
ByteBuf buf = Unpooled.buffer();
int n = 0;
do {
n = buf.writeBytes(input, BLOCK_SIZE);
} while (n > 0);
return buf;
} | java | public static ByteBuf toByteBuf(InputStream input) throws IOException {
ByteBuf buf = Unpooled.buffer();
int n = 0;
do {
n = buf.writeBytes(input, BLOCK_SIZE);
} while (n > 0);
return buf;
} | [
"public",
"static",
"ByteBuf",
"toByteBuf",
"(",
"InputStream",
"input",
")",
"throws",
"IOException",
"{",
"ByteBuf",
"buf",
"=",
"Unpooled",
".",
"buffer",
"(",
")",
";",
"int",
"n",
"=",
"0",
";",
"do",
"{",
"n",
"=",
"buf",
".",
"writeBytes",
"(",
... | Reads an InputStream into a byte array.
@param input the InputStream.
@return a byte array representation of the InputStream.
@throws IOException if an I/O exception of some sort happens while reading the InputStream. | [
"Reads",
"an",
"InputStream",
"into",
"a",
"byte",
"array",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http2/Http2ExampleUtil.java#L61-L68 | train | Convert an input stream to a byte buffer. | [
30522,
2270,
10763,
24880,
8569,
2546,
11291,
2618,
8569,
2546,
1006,
20407,
25379,
7953,
1007,
11618,
22834,
10288,
24422,
1063,
24880,
8569,
2546,
20934,
2546,
1027,
4895,
16869,
2098,
1012,
17698,
1006,
1007,
1025,
20014,
1050,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java | IOUtil.getSuffix | public static String getSuffix(String name, String delimiter)
{
return name.substring(name.lastIndexOf(delimiter) + 1);
} | java | public static String getSuffix(String name, String delimiter)
{
return name.substring(name.lastIndexOf(delimiter) + 1);
} | [
"public",
"static",
"String",
"getSuffix",
"(",
"String",
"name",
",",
"String",
"delimiter",
")",
"{",
"return",
"name",
".",
"substring",
"(",
"name",
".",
"lastIndexOf",
"(",
"delimiter",
")",
"+",
"1",
")",
";",
"}"
] | 获取最后一个分隔符的后缀
@param name
@param delimiter
@return | [
"获取最后一个分隔符的后缀"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java#L647-L650 | train | Get the suffix of a class file name. | [
30522,
2270,
10763,
5164,
4152,
16093,
8873,
2595,
1006,
5164,
2171,
1010,
5164,
3972,
27605,
3334,
1007,
1063,
2709,
2171,
1012,
4942,
3367,
4892,
1006,
2171,
1012,
2197,
22254,
10288,
11253,
1006,
3972,
27605,
3334,
1007,
1009,
1015,
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/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java | TypeUtils.getType | public String getType(TypeElement element, TypeMirror type) {
if (type == null) {
return null;
}
return type.accept(this.typeExtractor, createTypeDescriptor(element));
} | java | public String getType(TypeElement element, TypeMirror type) {
if (type == null) {
return null;
}
return type.accept(this.typeExtractor, createTypeDescriptor(element));
} | [
"public",
"String",
"getType",
"(",
"TypeElement",
"element",
",",
"TypeMirror",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"type",
".",
"accept",
"(",
"this",
".",
"typeExtractor",
",",
"createType... | Return the type of the specified {@link TypeMirror} including all its generic
information.
@param element the {@link TypeElement} in which this {@code type} is declared
@param type the type to handle
@return a representation of the type including all its generic information | [
"Return",
"the",
"type",
"of",
"the",
"specified",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java#L138-L143 | train | Gets the type of the given element. | [
30522,
2270,
5164,
2131,
13874,
1006,
2828,
12260,
3672,
5783,
1010,
2828,
14503,
29165,
2828,
1007,
1063,
2065,
1006,
2828,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
2828,
1012,
5138,
1006,
2023,
1012,
2828,
10288,
6494... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/io/IOUtil.java | IOUtil.readLineListWithLessMemory | public static LinkedList<String> readLineListWithLessMemory(String path)
{
LinkedList<String> result = new LinkedList<String>();
String line = null;
boolean first = true;
try
{
BufferedReader bw = new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8"));
while ((line = bw.readLine()) != null)
{
if (first)
{
first = false;
if (!line.isEmpty() && line.charAt(0) == '\uFEFF')
line = line.substring(1);
}
result.add(line);
}
bw.close();
}
catch (Exception e)
{
logger.warning("加载" + path + "失败," + e);
}
return result;
} | java | public static LinkedList<String> readLineListWithLessMemory(String path)
{
LinkedList<String> result = new LinkedList<String>();
String line = null;
boolean first = true;
try
{
BufferedReader bw = new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8"));
while ((line = bw.readLine()) != null)
{
if (first)
{
first = false;
if (!line.isEmpty() && line.charAt(0) == '\uFEFF')
line = line.substring(1);
}
result.add(line);
}
bw.close();
}
catch (Exception e)
{
logger.warning("加载" + path + "失败," + e);
}
return result;
} | [
"public",
"static",
"LinkedList",
"<",
"String",
">",
"readLineListWithLessMemory",
"(",
"String",
"path",
")",
"{",
"LinkedList",
"<",
"String",
">",
"result",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",
"String",
"line",
"=",
"null",
";"... | 用省内存的方式读取大文件
@param path
@return | [
"用省内存的方式读取大文件"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java#L325-L351 | train | Read line list with less memory. | [
30522,
2270,
10763,
5799,
9863,
1026,
5164,
1028,
3191,
4179,
9863,
24415,
3238,
4168,
5302,
2854,
1006,
5164,
4130,
1007,
1063,
5799,
9863,
1026,
5164,
1028,
2765,
1027,
2047,
5799,
9863,
1026,
5164,
1028,
1006,
1007,
1025,
5164,
2240,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java | FirefoxDriver.dropCapabilities | private static Capabilities dropCapabilities(Capabilities capabilities) {
if (capabilities == null) {
return new ImmutableCapabilities();
}
MutableCapabilities caps;
if (isLegacy(capabilities)) {
final Set<String> toRemove = Sets.newHashSet(BINARY, PROFILE);
caps = new MutableCapabilities(
Maps.filterKeys(capabilities.asMap(), key -> !toRemove.contains(key)));
} else {
caps = new MutableCapabilities(capabilities);
}
// Ensure that the proxy is in a state fit to be sent to the extension
Proxy proxy = Proxy.extractFrom(capabilities);
if (proxy != null) {
caps.setCapability(PROXY, proxy);
}
return caps;
} | java | private static Capabilities dropCapabilities(Capabilities capabilities) {
if (capabilities == null) {
return new ImmutableCapabilities();
}
MutableCapabilities caps;
if (isLegacy(capabilities)) {
final Set<String> toRemove = Sets.newHashSet(BINARY, PROFILE);
caps = new MutableCapabilities(
Maps.filterKeys(capabilities.asMap(), key -> !toRemove.contains(key)));
} else {
caps = new MutableCapabilities(capabilities);
}
// Ensure that the proxy is in a state fit to be sent to the extension
Proxy proxy = Proxy.extractFrom(capabilities);
if (proxy != null) {
caps.setCapability(PROXY, proxy);
}
return caps;
} | [
"private",
"static",
"Capabilities",
"dropCapabilities",
"(",
"Capabilities",
"capabilities",
")",
"{",
"if",
"(",
"capabilities",
"==",
"null",
")",
"{",
"return",
"new",
"ImmutableCapabilities",
"(",
")",
";",
"}",
"MutableCapabilities",
"caps",
";",
"if",
"("... | Drops capabilities that we shouldn't send over the wire.
Used for capabilities which aren't BeanToJson-convertable, and are only used by the local
launcher. | [
"Drops",
"capabilities",
"that",
"we",
"shouldn",
"t",
"send",
"over",
"the",
"wire",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java#L231-L253 | train | Drop the capabilities from the capabilities object. | [
30522,
2797,
10763,
9859,
4530,
17695,
28518,
30524,
2275,
1026,
5164,
1028,
9538,
5302,
3726,
1027,
4520,
1012,
2047,
14949,
7898,
3388,
1006,
12441,
1010,
6337,
1007,
1025,
9700,
1027,
2047,
14163,
10880,
17695,
28518,
15909,
3111,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | SpringApplication.run | public static ConfigurableApplicationContext run(Class<?>[] primarySources,
String[] args) {
return new SpringApplication(primarySources).run(args);
} | java | public static ConfigurableApplicationContext run(Class<?>[] primarySources,
String[] args) {
return new SpringApplication(primarySources).run(args);
} | [
"public",
"static",
"ConfigurableApplicationContext",
"run",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"primarySources",
",",
"String",
"[",
"]",
"args",
")",
"{",
"return",
"new",
"SpringApplication",
"(",
"primarySources",
")",
".",
"run",
"(",
"args",
")",
... | Static helper that can be used to run a {@link SpringApplication} from the
specified sources using default settings and user supplied arguments.
@param primarySources the primary sources to load
@param args the application arguments (usually passed from a Java main method)
@return the running {@link ApplicationContext} | [
"Static",
"helper",
"that",
"can",
"be",
"used",
"to",
"run",
"a",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L1273-L1276 | train | Run application with given primary sources and command line arguments. | [
30522,
2270,
10763,
9530,
8873,
27390,
3085,
29098,
19341,
3508,
8663,
18209,
2448,
1006,
2465,
1026,
1029,
1028,
1031,
1033,
3078,
6499,
3126,
9623,
1010,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
2709,
2047,
3500,
29098,
19341,
3508,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/CoGroupWithSolutionSetSecondDriver.java | CoGroupWithSolutionSetSecondDriver.initialize | @Override
@SuppressWarnings("unchecked")
public void initialize() throws Exception {
final TypeComparator<IT2> solutionSetComparator;
// grab a handle to the hash table from the iteration broker
if (taskContext instanceof AbstractIterativeTask) {
AbstractIterativeTask<?, ?> iterativeTaskContext = (AbstractIterativeTask<?, ?>) taskContext;
String identifier = iterativeTaskContext.brokerKey();
Object table = SolutionSetBroker.instance().get(identifier);
if (table instanceof CompactingHashTable) {
this.hashTable = (CompactingHashTable<IT2>) table;
solutionSetSerializer = this.hashTable.getBuildSideSerializer();
solutionSetComparator = this.hashTable.getBuildSideComparator().duplicate();
}
else if (table instanceof JoinHashMap) {
this.objectMap = (JoinHashMap<IT2>) table;
solutionSetSerializer = this.objectMap.getBuildSerializer();
solutionSetComparator = this.objectMap.getBuildComparator().duplicate();
}
else {
throw new RuntimeException("Unrecognized solution set index: " + table);
}
}
else {
throw new Exception("The task context of this driver is no iterative task context.");
}
TaskConfig config = taskContext.getTaskConfig();
ClassLoader classLoader = taskContext.getUserCodeClassLoader();
TypeComparatorFactory<IT1> probeSideComparatorFactory = config.getDriverComparator(0, classLoader);
this.probeSideSerializer = taskContext.<IT1>getInputSerializer(0).getSerializer();
this.probeSideComparator = probeSideComparatorFactory.createComparator();
ExecutionConfig executionConfig = taskContext.getExecutionConfig();
objectReuseEnabled = executionConfig.isObjectReuseEnabled();
if (objectReuseEnabled) {
solutionSideRecord = solutionSetSerializer.createInstance();
};
TypePairComparatorFactory<IT1, IT2> factory = taskContext.getTaskConfig().getPairComparatorFactory(taskContext.getUserCodeClassLoader());
pairComparator = factory.createComparator12(this.probeSideComparator, solutionSetComparator);
} | java | @Override
@SuppressWarnings("unchecked")
public void initialize() throws Exception {
final TypeComparator<IT2> solutionSetComparator;
// grab a handle to the hash table from the iteration broker
if (taskContext instanceof AbstractIterativeTask) {
AbstractIterativeTask<?, ?> iterativeTaskContext = (AbstractIterativeTask<?, ?>) taskContext;
String identifier = iterativeTaskContext.brokerKey();
Object table = SolutionSetBroker.instance().get(identifier);
if (table instanceof CompactingHashTable) {
this.hashTable = (CompactingHashTable<IT2>) table;
solutionSetSerializer = this.hashTable.getBuildSideSerializer();
solutionSetComparator = this.hashTable.getBuildSideComparator().duplicate();
}
else if (table instanceof JoinHashMap) {
this.objectMap = (JoinHashMap<IT2>) table;
solutionSetSerializer = this.objectMap.getBuildSerializer();
solutionSetComparator = this.objectMap.getBuildComparator().duplicate();
}
else {
throw new RuntimeException("Unrecognized solution set index: " + table);
}
}
else {
throw new Exception("The task context of this driver is no iterative task context.");
}
TaskConfig config = taskContext.getTaskConfig();
ClassLoader classLoader = taskContext.getUserCodeClassLoader();
TypeComparatorFactory<IT1> probeSideComparatorFactory = config.getDriverComparator(0, classLoader);
this.probeSideSerializer = taskContext.<IT1>getInputSerializer(0).getSerializer();
this.probeSideComparator = probeSideComparatorFactory.createComparator();
ExecutionConfig executionConfig = taskContext.getExecutionConfig();
objectReuseEnabled = executionConfig.isObjectReuseEnabled();
if (objectReuseEnabled) {
solutionSideRecord = solutionSetSerializer.createInstance();
};
TypePairComparatorFactory<IT1, IT2> factory = taskContext.getTaskConfig().getPairComparatorFactory(taskContext.getUserCodeClassLoader());
pairComparator = factory.createComparator12(this.probeSideComparator, solutionSetComparator);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"initialize",
"(",
")",
"throws",
"Exception",
"{",
"final",
"TypeComparator",
"<",
"IT2",
">",
"solutionSetComparator",
";",
"// grab a handle to the hash table from the iteration brok... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/CoGroupWithSolutionSetSecondDriver.java#L100-L147 | train | Initialize the driver. | [
30522,
1030,
2058,
15637,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
11675,
3988,
4697,
1006,
1007,
11618,
6453,
1063,
2345,
2828,
9006,
28689,
4263,
1026,
2009,
2475,
1028,
7300,
3388,
9006,
28689,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java | Restarter.initialize | public static void initialize(String[] args, boolean forceReferenceCleanup,
RestartInitializer initializer) {
initialize(args, forceReferenceCleanup, initializer, true);
} | java | public static void initialize(String[] args, boolean forceReferenceCleanup,
RestartInitializer initializer) {
initialize(args, forceReferenceCleanup, initializer, true);
} | [
"public",
"static",
"void",
"initialize",
"(",
"String",
"[",
"]",
"args",
",",
"boolean",
"forceReferenceCleanup",
",",
"RestartInitializer",
"initializer",
")",
"{",
"initialize",
"(",
"args",
",",
"forceReferenceCleanup",
",",
"initializer",
",",
"true",
")",
... | Initialize restart support. See
{@link #initialize(String[], boolean, RestartInitializer, boolean)} for details.
@param args main application arguments
@param forceReferenceCleanup if forcing of soft/weak reference should happen on
@param initializer the restart initializer
@see #initialize(String[], boolean, RestartInitializer) | [
"Initialize",
"restart",
"support",
".",
"See",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java#L534-L537 | train | Initialize the context. | [
30522,
2270,
10763,
11675,
3988,
4697,
1006,
5164,
1031,
1033,
12098,
5620,
1010,
22017,
20898,
2486,
2890,
25523,
14321,
24076,
2361,
1010,
23818,
5498,
20925,
17629,
3988,
17629,
1007,
1063,
3988,
4697,
1006,
12098,
5620,
1010,
2486,
2890,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java | ThriftCLIServiceClient.openSession | @Override
public SessionHandle openSession(String username, String password,
Map<String, String> configuration)
throws HiveSQLException {
try {
TOpenSessionReq req = new TOpenSessionReq();
req.setUsername(username);
req.setPassword(password);
req.setConfiguration(configuration);
TOpenSessionResp resp = cliService.OpenSession(req);
checkStatus(resp.getStatus());
return new SessionHandle(resp.getSessionHandle(), resp.getServerProtocolVersion());
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | java | @Override
public SessionHandle openSession(String username, String password,
Map<String, String> configuration)
throws HiveSQLException {
try {
TOpenSessionReq req = new TOpenSessionReq();
req.setUsername(username);
req.setPassword(password);
req.setConfiguration(configuration);
TOpenSessionResp resp = cliService.OpenSession(req);
checkStatus(resp.getStatus());
return new SessionHandle(resp.getSessionHandle(), resp.getServerProtocolVersion());
} catch (HiveSQLException e) {
throw e;
} catch (Exception e) {
throw new HiveSQLException(e);
}
} | [
"@",
"Override",
"public",
"SessionHandle",
"openSession",
"(",
"String",
"username",
",",
"String",
"password",
",",
"Map",
"<",
"String",
",",
"String",
">",
"configuration",
")",
"throws",
"HiveSQLException",
"{",
"try",
"{",
"TOpenSessionReq",
"req",
"=",
... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#openSession(java.lang.String, java.lang.String, java.util.Map) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftCLIServiceClient.java#L48-L65 | train | Override openSession to create a new session. | [
30522,
1030,
2058,
15637,
2270,
5219,
11774,
2571,
7480,
7971,
3258,
1006,
5164,
5310,
18442,
1010,
5164,
20786,
1010,
4949,
1026,
5164,
1010,
5164,
1028,
9563,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
3046,
1063,
2327,
1670... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DoubleArrayTrie.java | DoubleArrayTrie.set | public boolean set(String key, V value)
{
int index = exactMatchSearch(key);
if (index >= 0)
{
v[index] = value;
return true;
}
return false;
} | java | public boolean set(String key, V value)
{
int index = exactMatchSearch(key);
if (index >= 0)
{
v[index] = value;
return true;
}
return false;
} | [
"public",
"boolean",
"set",
"(",
"String",
"key",
",",
"V",
"value",
")",
"{",
"int",
"index",
"=",
"exactMatchSearch",
"(",
"key",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"v",
"[",
"index",
"]",
"=",
"value",
";",
"return",
"true",
";... | 更新某个键对应的值
@param key 键
@param value 值
@return 是否成功(失败的原因是没有这个键) | [
"更新某个键对应的值"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L1410-L1420 | train | Set a value in the CIS. | [
30522,
2270,
22017,
20898,
2275,
1006,
5164,
3145,
1010,
1058,
3643,
1007,
1063,
20014,
5950,
1027,
6635,
18900,
18069,
14644,
2818,
1006,
3145,
1007,
1025,
2065,
1006,
5950,
1028,
1027,
1014,
1007,
1063,
1058,
1031,
5950,
1033,
1027,
3643,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/swing/DesktopUtil.java | DesktopUtil.open | public static void open(File file) {
final Desktop dsktop = getDsktop();
try {
dsktop.open(file);
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static void open(File file) {
final Desktop dsktop = getDsktop();
try {
dsktop.open(file);
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"void",
"open",
"(",
"File",
"file",
")",
"{",
"final",
"Desktop",
"dsktop",
"=",
"getDsktop",
"(",
")",
";",
"try",
"{",
"dsktop",
".",
"open",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"n... | 启动关联应用程序来打开文件
@param file URL地址 | [
"启动关联应用程序来打开文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/swing/DesktopUtil.java#L47-L54 | train | Opens the specified file and creates a new Desktop instance. | [
30522,
2270,
10763,
11675,
2330,
1006,
5371,
5371,
1007,
1063,
2345,
15363,
16233,
25509,
7361,
1027,
2131,
5104,
25509,
7361,
1006,
1007,
1025,
3046,
1063,
16233,
25509,
7361,
1012,
2330,
1006,
5371,
1007,
1025,
1065,
4608,
1006,
22834,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Dict.java | Dict.removeEqual | public <T extends Dict> void removeEqual(T dict, String... withoutNames) {
HashSet<String> withoutSet = CollectionUtil.newHashSet(withoutNames);
for (Map.Entry<String, Object> entry : dict.entrySet()) {
if (withoutSet.contains(entry.getKey())) {
continue;
}
final Object value = this.get(entry.getKey());
if (null != value && value.equals(entry.getValue())) {
this.remove(entry.getKey());
}
}
} | java | public <T extends Dict> void removeEqual(T dict, String... withoutNames) {
HashSet<String> withoutSet = CollectionUtil.newHashSet(withoutNames);
for (Map.Entry<String, Object> entry : dict.entrySet()) {
if (withoutSet.contains(entry.getKey())) {
continue;
}
final Object value = this.get(entry.getKey());
if (null != value && value.equals(entry.getValue())) {
this.remove(entry.getKey());
}
}
} | [
"public",
"<",
"T",
"extends",
"Dict",
">",
"void",
"removeEqual",
"(",
"T",
"dict",
",",
"String",
"...",
"withoutNames",
")",
"{",
"HashSet",
"<",
"String",
">",
"withoutSet",
"=",
"CollectionUtil",
".",
"newHashSet",
"(",
"withoutNames",
")",
";",
"for"... | 与给定实体对比并去除相同的部分<br>
此方法用于在更新操作时避免所有字段被更新,跳过不需要更新的字段 version from 2.0.0
@param <T> 字典对象类型
@param dict 字典对象
@param withoutNames 不需要去除的字段名 | [
"与给定实体对比并去除相同的部分<br",
">",
"此方法用于在更新操作时避免所有字段被更新,跳过不需要更新的字段",
"version",
"from",
"2",
".",
"0",
".",
"0"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Dict.java#L195-L207 | train | Remove equal values from this dictionary. | [
30522,
2270,
1026,
1056,
8908,
4487,
6593,
1028,
11675,
6366,
2063,
26426,
1006,
1056,
4487,
6593,
1010,
5164,
1012,
1012,
1012,
2302,
18442,
2015,
1007,
1063,
23325,
13462,
1026,
5164,
1028,
2302,
13462,
1027,
3074,
21823,
2140,
1012,
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-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java | DescriptorProperties.getOptionalCharacter | public Optional<Character> getOptionalCharacter(String key) {
return optionalGet(key).map((c) -> {
if (c.length() != 1) {
throw new ValidationException("The value of '" + key + "' must only contain one character.");
}
return c.charAt(0);
} | java | public Optional<Character> getOptionalCharacter(String key) {
return optionalGet(key).map((c) -> {
if (c.length() != 1) {
throw new ValidationException("The value of '" + key + "' must only contain one character.");
}
return c.charAt(0);
} | [
"public",
"Optional",
"<",
"Character",
">",
"getOptionalCharacter",
"(",
"String",
"key",
")",
"{",
"return",
"optionalGet",
"(",
"key",
")",
".",
"map",
"(",
"(",
"c",
")",
"-",
">",
"{",
"if",
"(",
"c",
".",
"length",
"(",
")",
"!=",
"1",
")",
... | Returns a character value under the given key if it exists. | [
"Returns",
"a",
"character",
"value",
"under",
"the",
"given",
"key",
"if",
"it",
"exists",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java#L259-L265 | train | Get an optional character value. | [
30522,
2270,
11887,
1026,
2839,
1028,
2131,
7361,
3508,
2389,
7507,
22648,
3334,
1006,
5164,
3145,
1007,
1063,
2709,
11887,
18150,
1006,
3145,
1007,
1012,
4949,
1006,
1006,
1039,
1007,
1011,
1028,
1063,
2065,
1006,
1039,
1012,
3091,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java | HexUtil.encodeColor | public static String encodeColor(Color color, String prefix) {
final StringBuffer builder = new StringBuffer(prefix);
String colorHex;
colorHex = Integer.toHexString(color.getRed());
if (1 == colorHex.length()) {
builder.append('0');
}
builder.append(colorHex);
colorHex = Integer.toHexString(color.getGreen());
if (1 == colorHex.length()) {
builder.append('0');
}
builder.append(colorHex);
colorHex = Integer.toHexString(color.getBlue());
if (1 == colorHex.length()) {
builder.append('0');
}
builder.append(colorHex);
return builder.toString();
} | java | public static String encodeColor(Color color, String prefix) {
final StringBuffer builder = new StringBuffer(prefix);
String colorHex;
colorHex = Integer.toHexString(color.getRed());
if (1 == colorHex.length()) {
builder.append('0');
}
builder.append(colorHex);
colorHex = Integer.toHexString(color.getGreen());
if (1 == colorHex.length()) {
builder.append('0');
}
builder.append(colorHex);
colorHex = Integer.toHexString(color.getBlue());
if (1 == colorHex.length()) {
builder.append('0');
}
builder.append(colorHex);
return builder.toString();
} | [
"public",
"static",
"String",
"encodeColor",
"(",
"Color",
"color",
",",
"String",
"prefix",
")",
"{",
"final",
"StringBuffer",
"builder",
"=",
"new",
"StringBuffer",
"(",
"prefix",
")",
";",
"String",
"colorHex",
";",
"colorHex",
"=",
"Integer",
".",
"toHex... | 将{@link Color}编码为Hex形式
@param color {@link Color}
@param prefix 前缀字符串,可以是#、0x等
@return Hex字符串
@since 3.0.8 | [
"将",
"{",
"@link",
"Color",
"}",
"编码为Hex形式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java#L222-L241 | train | Encodes the given color into a hex string. | [
30522,
2270,
10763,
5164,
4372,
16044,
18717,
1006,
3609,
3609,
1010,
5164,
17576,
1007,
1063,
2345,
5164,
8569,
12494,
12508,
1027,
2047,
5164,
8569,
12494,
1006,
17576,
1007,
1025,
5164,
3609,
5369,
2595,
1025,
3609,
5369,
2595,
1027,
161... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getFirstNumber | public static Integer getFirstNumber(CharSequence StringWithNumber) {
return Convert.toInt(get(PatternPool.NUMBERS, StringWithNumber, 0), null);
} | java | public static Integer getFirstNumber(CharSequence StringWithNumber) {
return Convert.toInt(get(PatternPool.NUMBERS, StringWithNumber, 0), null);
} | [
"public",
"static",
"Integer",
"getFirstNumber",
"(",
"CharSequence",
"StringWithNumber",
")",
"{",
"return",
"Convert",
".",
"toInt",
"(",
"get",
"(",
"PatternPool",
".",
"NUMBERS",
",",
"StringWithNumber",
",",
"0",
")",
",",
"null",
")",
";",
"}"
] | 从字符串中获得第一个整数
@param StringWithNumber 带数字的字符串
@return 整数 | [
"从字符串中获得第一个整数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L549-L551 | train | Gets the first number of the given string. | [
30522,
2270,
10763,
16109,
2131,
8873,
12096,
19172,
5677,
1006,
25869,
3366,
4226,
5897,
5164,
24415,
19172,
5677,
1007,
1063,
2709,
10463,
1012,
2000,
18447,
1006,
2131,
1006,
5418,
16869,
1012,
3616,
1010,
5164,
24415,
19172,
5677,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.inverse | @Deprecated
public static <K, V> Map<V, K> inverse(Map<K, V> map) {
Map<V, K> inverseMap;
if (map instanceof LinkedHashMap) {
inverseMap = new LinkedHashMap<>(map.size());
} else if (map instanceof TreeMap) {
inverseMap = new TreeMap<>();
} else {
inverseMap = new HashMap<>(map.size());
}
for (Entry<K, V> entry : map.entrySet()) {
inverseMap.put(entry.getValue(), entry.getKey());
}
return inverseMap;
} | java | @Deprecated
public static <K, V> Map<V, K> inverse(Map<K, V> map) {
Map<V, K> inverseMap;
if (map instanceof LinkedHashMap) {
inverseMap = new LinkedHashMap<>(map.size());
} else if (map instanceof TreeMap) {
inverseMap = new TreeMap<>();
} else {
inverseMap = new HashMap<>(map.size());
}
for (Entry<K, V> entry : map.entrySet()) {
inverseMap.put(entry.getValue(), entry.getKey());
}
return inverseMap;
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"V",
",",
"K",
">",
"inverse",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
")",
"{",
"Map",
"<",
"V",
",",
"K",
">",
"inverseMap",
";",
"if",
"(",
"map",
"instanceof"... | 逆转Map的key和value
@param <K> 键类型,目标的值类型
@param <V> 值类型,目标的键类型
@param map 被转换的Map
@return 逆转后的Map
@deprecated 请使用{@link MapUtil#reverse(Map)} 代替 | [
"逆转Map的key和value"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L613-L628 | train | Returns the inverse of the given map. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
4949,
1026,
1058,
1010,
1047,
1028,
19262,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
4949,
1007,
1063,
4949,
1026,
1058,
1010,
1047,
1028,
19262,
2863,
2361,
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... |
networknt/light-4j | metrics/src/main/java/io/dropwizard/metrics/influxdb/TimeUtils.java | TimeUtils.toTimePrecision | public static String toTimePrecision(final TimeUnit t) {
switch (t) {
case HOURS:
return "h";
case MINUTES:
return "m";
case SECONDS:
return "s";
case MILLISECONDS:
return "ms";
case MICROSECONDS:
return "u";
case NANOSECONDS:
return "n";
default:
EnumSet<TimeUnit> allowedTimeunits = EnumSet.of(
TimeUnit.HOURS,
TimeUnit.MINUTES,
TimeUnit.SECONDS,
TimeUnit.MILLISECONDS,
TimeUnit.MICROSECONDS,
TimeUnit.NANOSECONDS);
throw new IllegalArgumentException("time precision must be one of:" + allowedTimeunits);
}
} | java | public static String toTimePrecision(final TimeUnit t) {
switch (t) {
case HOURS:
return "h";
case MINUTES:
return "m";
case SECONDS:
return "s";
case MILLISECONDS:
return "ms";
case MICROSECONDS:
return "u";
case NANOSECONDS:
return "n";
default:
EnumSet<TimeUnit> allowedTimeunits = EnumSet.of(
TimeUnit.HOURS,
TimeUnit.MINUTES,
TimeUnit.SECONDS,
TimeUnit.MILLISECONDS,
TimeUnit.MICROSECONDS,
TimeUnit.NANOSECONDS);
throw new IllegalArgumentException("time precision must be one of:" + allowedTimeunits);
}
} | [
"public",
"static",
"String",
"toTimePrecision",
"(",
"final",
"TimeUnit",
"t",
")",
"{",
"switch",
"(",
"t",
")",
"{",
"case",
"HOURS",
":",
"return",
"\"h\"",
";",
"case",
"MINUTES",
":",
"return",
"\"m\"",
";",
"case",
"SECONDS",
":",
"return",
"\"s\"... | Convert from a TimeUnit to a influxDB timeunit String.
@param t time unit
@return the String representation. | [
"Convert",
"from",
"a",
"TimeUnit",
"to",
"a",
"influxDB",
"timeunit",
"String",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/influxdb/TimeUtils.java#L32-L56 | train | To time precision. | [
30522,
2270,
10763,
5164,
2000,
7292,
28139,
28472,
1006,
2345,
2051,
19496,
2102,
1056,
1007,
1063,
6942,
1006,
1056,
1007,
1063,
2553,
2847,
1024,
2709,
1000,
1044,
1000,
1025,
2553,
2781,
1024,
2709,
1000,
1049,
1000,
1025,
2553,
3823,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.getBeUint16 | public final int getBeUint16() {
if (position + 1 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 1));
byte[] buf = buffer;
return ((0xff & buf[position++]) << 8) | (0xff & buf[position++]);
} | java | public final int getBeUint16() {
if (position + 1 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 1));
byte[] buf = buffer;
return ((0xff & buf[position++]) << 8) | (0xff & buf[position++]);
} | [
"public",
"final",
"int",
"getBeUint16",
"(",
")",
"{",
"if",
"(",
"position",
"+",
"1",
">=",
"origin",
"+",
"limit",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"(",
"position",
"-",
"origin",
"+",
"1",
")",
")",
"... | Return next 16-bit unsigned int from buffer. (big-endian)
@see mysql-5.6.10/include/myisampack.h - mi_usint2korr | [
"Return",
"next",
"16",
"-",
"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#L344-L350 | train | Gets a 16 - bit unsigned integer from the buffer. | [
30522,
2270,
2345,
20014,
2131,
4783,
20023,
2102,
16048,
1006,
1007,
1063,
2065,
1006,
2597,
1009,
1015,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/safari/SafariOptions.java | SafariOptions.fromCapabilities | public static SafariOptions fromCapabilities(Capabilities capabilities)
throws WebDriverException {
if (capabilities instanceof SafariOptions) {
return (SafariOptions) capabilities;
}
Object cap = capabilities.getCapability(SafariOptions.CAPABILITY);
if (cap instanceof SafariOptions) {
return (SafariOptions) cap;
} else if (cap instanceof Map) {
return new SafariOptions(new MutableCapabilities(((Map<String, ?>) cap)));
} else {
return new SafariOptions();
}
} | java | public static SafariOptions fromCapabilities(Capabilities capabilities)
throws WebDriverException {
if (capabilities instanceof SafariOptions) {
return (SafariOptions) capabilities;
}
Object cap = capabilities.getCapability(SafariOptions.CAPABILITY);
if (cap instanceof SafariOptions) {
return (SafariOptions) cap;
} else if (cap instanceof Map) {
return new SafariOptions(new MutableCapabilities(((Map<String, ?>) cap)));
} else {
return new SafariOptions();
}
} | [
"public",
"static",
"SafariOptions",
"fromCapabilities",
"(",
"Capabilities",
"capabilities",
")",
"throws",
"WebDriverException",
"{",
"if",
"(",
"capabilities",
"instanceof",
"SafariOptions",
")",
"{",
"return",
"(",
"SafariOptions",
")",
"capabilities",
";",
"}",
... | Construct a {@link SafariOptions} instance from given capabilities.
When the {@link #CAPABILITY} capability is set, all other capabilities will be ignored!
@param capabilities Desired capabilities from which the options are derived.
@return SafariOptions
@throws WebDriverException If an error occurred during the reconstruction of the options | [
"Construct",
"a",
"{",
"@link",
"SafariOptions",
"}",
"instance",
"from",
"given",
"capabilities",
".",
"When",
"the",
"{",
"@link",
"#CAPABILITY",
"}",
"capability",
"is",
"set",
"all",
"other",
"capabilities",
"will",
"be",
"ignored!"
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/safari/SafariOptions.java#L102-L115 | train | Create a new instance of the SafariOptions class from the capabilities | [
30522,
2270,
10763,
23591,
7361,
9285,
2013,
17695,
28518,
15909,
3111,
1006,
9859,
9859,
1007,
11618,
4773,
23663,
2890,
2595,
24422,
1063,
2065,
1006,
9859,
6013,
11253,
23591,
7361,
9285,
1007,
1063,
2709,
1006,
23591,
7361,
9285,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/Db.java | Db.tx | public Db tx(TransactionLevel transactionLevel, VoidFunc1<Db> func) throws SQLException {
final Connection conn = getConnection();
// 检查是否支持事务
checkTransactionSupported(conn);
// 设置事务级别
if (null != transactionLevel) {
final int level = transactionLevel.getLevel();
if (conn.getTransactionIsolation() < level) {
// 用户定义的事务级别如果比默认级别更严格,则按照严格的级别进行
conn.setTransactionIsolation(level);
}
}
// 开始事务
boolean autoCommit = conn.getAutoCommit();
if (autoCommit) {
conn.setAutoCommit(false);
}
// 执行事务
try {
func.call(this);
// 提交
conn.commit();
} catch (Throwable e) {
quietRollback(conn);
throw (e instanceof SQLException) ? (SQLException) e : new SQLException(e);
} finally {
// 还原事务状态
quietSetAutoCommit(conn, autoCommit);
// 关闭连接或将连接归还连接池
closeConnection(conn);
}
return this;
} | java | public Db tx(TransactionLevel transactionLevel, VoidFunc1<Db> func) throws SQLException {
final Connection conn = getConnection();
// 检查是否支持事务
checkTransactionSupported(conn);
// 设置事务级别
if (null != transactionLevel) {
final int level = transactionLevel.getLevel();
if (conn.getTransactionIsolation() < level) {
// 用户定义的事务级别如果比默认级别更严格,则按照严格的级别进行
conn.setTransactionIsolation(level);
}
}
// 开始事务
boolean autoCommit = conn.getAutoCommit();
if (autoCommit) {
conn.setAutoCommit(false);
}
// 执行事务
try {
func.call(this);
// 提交
conn.commit();
} catch (Throwable e) {
quietRollback(conn);
throw (e instanceof SQLException) ? (SQLException) e : new SQLException(e);
} finally {
// 还原事务状态
quietSetAutoCommit(conn, autoCommit);
// 关闭连接或将连接归还连接池
closeConnection(conn);
}
return this;
} | [
"public",
"Db",
"tx",
"(",
"TransactionLevel",
"transactionLevel",
",",
"VoidFunc1",
"<",
"Db",
">",
"func",
")",
"throws",
"SQLException",
"{",
"final",
"Connection",
"conn",
"=",
"getConnection",
"(",
")",
";",
"// 检查是否支持事务\r",
"checkTransactionSupported",
"(",
... | 执行事务<br>
在同一事务中,所有对数据库操作都是原子的,同时提交或者同时回滚
@param transactionLevel 事务级别枚举,null表示使用JDBC默认事务
@param func 事务函数,所有操作应在同一函数下执行,确保在同一事务中
@return this
@throws SQLException SQL异常 | [
"执行事务<br",
">",
"在同一事务中,所有对数据库操作都是原子的,同时提交或者同时回滚"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Db.java#L167-L204 | train | Creates a new transaction. | [
30522,
2270,
16962,
19067,
1006,
12598,
20414,
2884,
12598,
20414,
2884,
1010,
11675,
11263,
12273,
2487,
1026,
16962,
1028,
4569,
2278,
1007,
11618,
29296,
10288,
24422,
1063,
2345,
4434,
9530,
2078,
1027,
2131,
8663,
2638,
7542,
1006,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | consul/src/main/java/com/networknt/consul/ConsulRegistry.java | ConsulRegistry.lookupConsulService | private ConsulResponse<List<ConsulService>> lookupConsulService(String serviceName, Long lastConsulIndexId) {
ConsulResponse<List<ConsulService>> response = client.lookupHealthService(serviceName, null, lastConsulIndexId, getConsulToken());
return response;
} | java | private ConsulResponse<List<ConsulService>> lookupConsulService(String serviceName, Long lastConsulIndexId) {
ConsulResponse<List<ConsulService>> response = client.lookupHealthService(serviceName, null, lastConsulIndexId, getConsulToken());
return response;
} | [
"private",
"ConsulResponse",
"<",
"List",
"<",
"ConsulService",
">",
">",
"lookupConsulService",
"(",
"String",
"serviceName",
",",
"Long",
"lastConsulIndexId",
")",
"{",
"ConsulResponse",
"<",
"List",
"<",
"ConsulService",
">>",
"response",
"=",
"client",
".",
... | directly fetch consul service data.
@param serviceName
@return ConsulResponse or null | [
"directly",
"fetch",
"consul",
"service",
"data",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/consul/src/main/java/com/networknt/consul/ConsulRegistry.java#L216-L219 | train | Lookup a consul service. | [
30522,
2797,
11801,
6072,
26029,
3366,
1026,
2862,
1026,
11801,
8043,
7903,
2063,
1028,
1028,
2298,
6279,
8663,
23722,
8043,
7903,
2063,
1006,
5164,
2326,
18442,
1010,
2146,
2197,
8663,
23722,
22254,
10288,
3593,
1007,
1063,
11801,
6072,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java | HealthStatusHttpMapper.addStatusMapping | public void addStatusMapping(String statusCode, Integer httpStatus) {
Assert.notNull(statusCode, "StatusCode must not be null");
Assert.notNull(httpStatus, "HttpStatus must not be null");
this.statusMapping.put(statusCode, httpStatus);
} | java | public void addStatusMapping(String statusCode, Integer httpStatus) {
Assert.notNull(statusCode, "StatusCode must not be null");
Assert.notNull(httpStatus, "HttpStatus must not be null");
this.statusMapping.put(statusCode, httpStatus);
} | [
"public",
"void",
"addStatusMapping",
"(",
"String",
"statusCode",
",",
"Integer",
"httpStatus",
")",
"{",
"Assert",
".",
"notNull",
"(",
"statusCode",
",",
"\"StatusCode must not be null\"",
")",
";",
"Assert",
".",
"notNull",
"(",
"httpStatus",
",",
"\"HttpStatu... | Add a status mapping to the existing set.
@param statusCode the status code to map
@param httpStatus the http status | [
"Add",
"a",
"status",
"mapping",
"to",
"the",
"existing",
"set",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java#L83-L87 | train | Add a status mapping. | [
30522,
2270,
11675,
9909,
29336,
2271,
2863,
14853,
1006,
5164,
3570,
16044,
1010,
30524,
1006,
3570,
16044,
1010,
1000,
3570,
16044,
2442,
2025,
2022,
19701,
1000,
1007,
1025,
20865,
1012,
2025,
11231,
3363,
1006,
16770,
29336,
2271,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/NamedSql.java | NamedSql.parse | private void parse(String namedSql, Map<String, Object> paramMap) {
int len = namedSql.length();
final StrBuilder name = StrUtil.strBuilder();
final StrBuilder sqlBuilder = StrUtil.strBuilder();
char c;
Character nameStartChar = null;
for (int i = 0; i < len; i++) {
c = namedSql.charAt(i);
if (c == ':' || c == '@' || c == '?') {
nameStartChar = c;
} else if (null != nameStartChar) {
// 变量状态
if (isGenerateChar(c)) {
// 变量名
name.append(c);
} else {
// 变量结束
String nameStr = name.toString();
if(paramMap.containsKey(nameStr)) {
// 有变量对应值(值可以为null),替换占位符
final Object paramValue = paramMap.get(nameStr);
sqlBuilder.append('?');
this.params.add(paramValue);
} else {
// 无变量对应值,原样输出
sqlBuilder.append(nameStartChar).append(name);
}
nameStartChar = null;
name.clear();
sqlBuilder.append(c);
}
} else {
sqlBuilder.append(c);
}
}
if (false == name.isEmpty()) {
// SQL结束依旧有变量名存在,说明变量位于末尾
final Object paramValue = paramMap.get(name.toString());
if (null != paramValue) {
// 有变量对应值,替换占位符
sqlBuilder.append('?');
this.params.add(paramValue);
} else {
// 无变量对应值,原样输出
sqlBuilder.append(nameStartChar).append(name);
}
nameStartChar = null;
name.clear();
}
this.sql = sqlBuilder.toString();
} | java | private void parse(String namedSql, Map<String, Object> paramMap) {
int len = namedSql.length();
final StrBuilder name = StrUtil.strBuilder();
final StrBuilder sqlBuilder = StrUtil.strBuilder();
char c;
Character nameStartChar = null;
for (int i = 0; i < len; i++) {
c = namedSql.charAt(i);
if (c == ':' || c == '@' || c == '?') {
nameStartChar = c;
} else if (null != nameStartChar) {
// 变量状态
if (isGenerateChar(c)) {
// 变量名
name.append(c);
} else {
// 变量结束
String nameStr = name.toString();
if(paramMap.containsKey(nameStr)) {
// 有变量对应值(值可以为null),替换占位符
final Object paramValue = paramMap.get(nameStr);
sqlBuilder.append('?');
this.params.add(paramValue);
} else {
// 无变量对应值,原样输出
sqlBuilder.append(nameStartChar).append(name);
}
nameStartChar = null;
name.clear();
sqlBuilder.append(c);
}
} else {
sqlBuilder.append(c);
}
}
if (false == name.isEmpty()) {
// SQL结束依旧有变量名存在,说明变量位于末尾
final Object paramValue = paramMap.get(name.toString());
if (null != paramValue) {
// 有变量对应值,替换占位符
sqlBuilder.append('?');
this.params.add(paramValue);
} else {
// 无变量对应值,原样输出
sqlBuilder.append(nameStartChar).append(name);
}
nameStartChar = null;
name.clear();
}
this.sql = sqlBuilder.toString();
} | [
"private",
"void",
"parse",
"(",
"String",
"namedSql",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"paramMap",
")",
"{",
"int",
"len",
"=",
"namedSql",
".",
"length",
"(",
")",
";",
"final",
"StrBuilder",
"name",
"=",
"StrUtil",
".",
"strBuilder",
"... | 解析命名占位符的SQL
@param namedSql 命名占位符的SQL
@param paramMap 名和参数的对应Map | [
"解析命名占位符的SQL"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/NamedSql.java#L71-L124 | train | Parses the named SQL string and creates a list of parameters. | [
30522,
2797,
11675,
11968,
3366,
1006,
5164,
2315,
2015,
4160,
2140,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
11498,
14760,
2361,
1007,
1063,
20014,
18798,
1027,
2315,
2015,
4160,
2140,
1012,
3091,
1006,
1007,
1025,
2345,
2358,
15185,
1923... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/tsdb/TableMetaTSDBBuilder.java | TableMetaTSDBBuilder.build | public static TableMetaTSDB build(String destination, String springXml) {
if (StringUtils.isNotEmpty(springXml)) {
ClassPathXmlApplicationContext applicationContext = contexts.get(destination);
if (applicationContext == null) {
synchronized (contexts) {
if (applicationContext == null) {
applicationContext = new ClassPathXmlApplicationContext(springXml);
contexts.put(destination, applicationContext);
}
}
}
TableMetaTSDB tableMetaTSDB = (TableMetaTSDB) applicationContext.getBean("tableMetaTSDB");
logger.info("{} init TableMetaTSDB with {}", destination, springXml);
return tableMetaTSDB;
} else {
return null;
}
} | java | public static TableMetaTSDB build(String destination, String springXml) {
if (StringUtils.isNotEmpty(springXml)) {
ClassPathXmlApplicationContext applicationContext = contexts.get(destination);
if (applicationContext == null) {
synchronized (contexts) {
if (applicationContext == null) {
applicationContext = new ClassPathXmlApplicationContext(springXml);
contexts.put(destination, applicationContext);
}
}
}
TableMetaTSDB tableMetaTSDB = (TableMetaTSDB) applicationContext.getBean("tableMetaTSDB");
logger.info("{} init TableMetaTSDB with {}", destination, springXml);
return tableMetaTSDB;
} else {
return null;
}
} | [
"public",
"static",
"TableMetaTSDB",
"build",
"(",
"String",
"destination",
",",
"String",
"springXml",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"springXml",
")",
")",
"{",
"ClassPathXmlApplicationContext",
"applicationContext",
"=",
"contexts",
... | 代理一下tableMetaTSDB的获取,使用隔离的spring定义 | [
"代理一下tableMetaTSDB的获取",
"使用隔离的spring定义"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/tsdb/TableMetaTSDBBuilder.java#L27-L44 | train | Build a TableMetaTSDB object from the given destination and spring. xml. | [
30522,
2270,
10763,
2795,
11368,
11149,
18939,
3857,
1006,
5164,
7688,
1010,
5164,
3500,
2595,
19968,
1007,
1063,
2065,
1006,
5164,
21823,
4877,
1012,
3475,
12184,
27718,
2100,
1006,
3500,
2595,
19968,
1007,
1007,
1063,
2465,
15069,
2595,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java | SpringBootCondition.matches | protected final boolean matches(ConditionContext context,
AnnotatedTypeMetadata metadata, Condition condition) {
if (condition instanceof SpringBootCondition) {
return ((SpringBootCondition) condition).getMatchOutcome(context, metadata)
.isMatch();
}
return condition.matches(context, metadata);
} | java | protected final boolean matches(ConditionContext context,
AnnotatedTypeMetadata metadata, Condition condition) {
if (condition instanceof SpringBootCondition) {
return ((SpringBootCondition) condition).getMatchOutcome(context, metadata)
.isMatch();
}
return condition.matches(context, metadata);
} | [
"protected",
"final",
"boolean",
"matches",
"(",
"ConditionContext",
"context",
",",
"AnnotatedTypeMetadata",
"metadata",
",",
"Condition",
"condition",
")",
"{",
"if",
"(",
"condition",
"instanceof",
"SpringBootCondition",
")",
"{",
"return",
"(",
"(",
"SpringBootC... | Return true if any of the specified condition matches.
@param context the context
@param metadata the annotation meta-data
@param condition condition to test
@return {@code true} if the condition matches. | [
"Return",
"true",
"if",
"any",
"of",
"the",
"specified",
"condition",
"matches",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/SpringBootCondition.java#L152-L159 | train | Checks if the given condition is a match. | [
30522,
5123,
2345,
22017,
20898,
3503,
1006,
4650,
8663,
18209,
6123,
1010,
5754,
17287,
3064,
13874,
11368,
8447,
2696,
27425,
1010,
4650,
4650,
1007,
1063,
2065,
1006,
4650,
6013,
11253,
3500,
27927,
8663,
20562,
1007,
1063,
2709,
1006,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.getTableConstructorRowType | RelDataType getTableConstructorRowType(
SqlCall values,
SqlValidatorScope scope) {
final List<SqlNode> rows = values.getOperandList();
assert rows.size() >= 1;
final List<RelDataType> rowTypes = new ArrayList<>();
for (final SqlNode row : rows) {
assert row.getKind() == SqlKind.ROW;
SqlCall rowConstructor = (SqlCall) row;
// REVIEW jvs 10-Sept-2003: Once we support single-row queries as
// rows, need to infer aliases from there.
final List<String> aliasList = new ArrayList<>();
final List<RelDataType> typeList = new ArrayList<>();
for (Ord<SqlNode> column : Ord.zip(rowConstructor.getOperandList())) {
final String alias = deriveAlias(column.e, column.i);
aliasList.add(alias);
final RelDataType type = deriveType(scope, column.e);
typeList.add(type);
}
rowTypes.add(typeFactory.createStructType(typeList, aliasList));
}
if (rows.size() == 1) {
// TODO jvs 10-Oct-2005: get rid of this workaround once
// leastRestrictive can handle all cases
return rowTypes.get(0);
}
return typeFactory.leastRestrictive(rowTypes);
} | java | RelDataType getTableConstructorRowType(
SqlCall values,
SqlValidatorScope scope) {
final List<SqlNode> rows = values.getOperandList();
assert rows.size() >= 1;
final List<RelDataType> rowTypes = new ArrayList<>();
for (final SqlNode row : rows) {
assert row.getKind() == SqlKind.ROW;
SqlCall rowConstructor = (SqlCall) row;
// REVIEW jvs 10-Sept-2003: Once we support single-row queries as
// rows, need to infer aliases from there.
final List<String> aliasList = new ArrayList<>();
final List<RelDataType> typeList = new ArrayList<>();
for (Ord<SqlNode> column : Ord.zip(rowConstructor.getOperandList())) {
final String alias = deriveAlias(column.e, column.i);
aliasList.add(alias);
final RelDataType type = deriveType(scope, column.e);
typeList.add(type);
}
rowTypes.add(typeFactory.createStructType(typeList, aliasList));
}
if (rows.size() == 1) {
// TODO jvs 10-Oct-2005: get rid of this workaround once
// leastRestrictive can handle all cases
return rowTypes.get(0);
}
return typeFactory.leastRestrictive(rowTypes);
} | [
"RelDataType",
"getTableConstructorRowType",
"(",
"SqlCall",
"values",
",",
"SqlValidatorScope",
"scope",
")",
"{",
"final",
"List",
"<",
"SqlNode",
">",
"rows",
"=",
"values",
".",
"getOperandList",
"(",
")",
";",
"assert",
"rows",
".",
"size",
"(",
")",
">... | Returns null if there is no common type. E.g. if the rows have a
different number of columns. | [
"Returns",
"null",
"if",
"there",
"is",
"no",
"common",
"type",
".",
"E",
".",
"g",
".",
"if",
"the",
"rows",
"have",
"a",
"different",
"number",
"of",
"columns",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L1531-L1559 | train | Get the type of the row constructor. | [
30522,
2128,
15150,
29336,
18863,
2131,
10880,
8663,
3367,
6820,
16761,
10524,
13874,
1006,
29296,
9289,
2140,
5300,
1010,
29296,
10175,
8524,
6591,
16186,
9531,
1007,
1063,
2345,
2862,
1026,
29296,
3630,
3207,
1028,
10281,
1027,
5300,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.fillBeanWithMap | public static <T> T fillBeanWithMap(Map<?, ?> map, T bean, boolean isToCamelCase, CopyOptions copyOptions) {
if (MapUtil.isEmpty(map)) {
return bean;
}
if (isToCamelCase) {
map = MapUtil.toCamelCaseMap(map);
}
return BeanCopier.create(map, bean, copyOptions).copy();
} | java | public static <T> T fillBeanWithMap(Map<?, ?> map, T bean, boolean isToCamelCase, CopyOptions copyOptions) {
if (MapUtil.isEmpty(map)) {
return bean;
}
if (isToCamelCase) {
map = MapUtil.toCamelCaseMap(map);
}
return BeanCopier.create(map, bean, copyOptions).copy();
} | [
"public",
"static",
"<",
"T",
">",
"T",
"fillBeanWithMap",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
",",
"T",
"bean",
",",
"boolean",
"isToCamelCase",
",",
"CopyOptions",
"copyOptions",
")",
"{",
"if",
"(",
"MapUtil",
".",
"isEmpty",
"(",
"map",
"... | 使用Map填充Bean对象
@param <T> Bean类型
@param map Map
@param bean Bean
@param isToCamelCase 是否将Map中的下划线风格key转换为驼峰风格
@param copyOptions 属性复制选项 {@link CopyOptions}
@return Bean
@since 3.3.1 | [
"使用Map填充Bean对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L423-L431 | train | Fill a bean with a map. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
6039,
4783,
2319,
24415,
2863,
2361,
1006,
4949,
1026,
1029,
1010,
1029,
1028,
4949,
1010,
1056,
14068,
1010,
22017,
20898,
21541,
24755,
10199,
18382,
1010,
6100,
7361,
9285,
6100,
7361,
9285,
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/corpus/io/IOUtil.java | IOUtil.newOutputStream | public static OutputStream newOutputStream(String path) throws IOException
{
if (IOAdapter == null) return new FileOutputStream(path);
return IOAdapter.create(path);
} | java | public static OutputStream newOutputStream(String path) throws IOException
{
if (IOAdapter == null) return new FileOutputStream(path);
return IOAdapter.create(path);
} | [
"public",
"static",
"OutputStream",
"newOutputStream",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"IOAdapter",
"==",
"null",
")",
"return",
"new",
"FileOutputStream",
"(",
"path",
")",
";",
"return",
"IOAdapter",
".",
"create",
"(",
... | 创建输出流(经过IO适配器创建)
@param path
@return
@throws IOException | [
"创建输出流(经过IO适配器创建)"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java#L635-L639 | train | Create an OutputStream for a file. | [
30522,
2270,
10763,
27852,
25379,
2047,
5833,
18780,
21422,
1006,
5164,
4130,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
22834,
8447,
13876,
2121,
1027,
1027,
19701,
1007,
2709,
2047,
5371,
5833,
18780,
21422,
1006,
4130,
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-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java | PojoSerializer.createRegisteredSubclassSerializers | private static TypeSerializer<?>[] createRegisteredSubclassSerializers(
LinkedHashSet<Class<?>> registeredSubclasses,
ExecutionConfig executionConfig) {
final TypeSerializer<?>[] subclassSerializers = new TypeSerializer[registeredSubclasses.size()];
int i = 0;
for (Class<?> registeredClass : registeredSubclasses) {
subclassSerializers[i] = TypeExtractor.createTypeInfo(registeredClass).createSerializer(executionConfig);
i++;
}
return subclassSerializers;
} | java | private static TypeSerializer<?>[] createRegisteredSubclassSerializers(
LinkedHashSet<Class<?>> registeredSubclasses,
ExecutionConfig executionConfig) {
final TypeSerializer<?>[] subclassSerializers = new TypeSerializer[registeredSubclasses.size()];
int i = 0;
for (Class<?> registeredClass : registeredSubclasses) {
subclassSerializers[i] = TypeExtractor.createTypeInfo(registeredClass).createSerializer(executionConfig);
i++;
}
return subclassSerializers;
} | [
"private",
"static",
"TypeSerializer",
"<",
"?",
">",
"[",
"]",
"createRegisteredSubclassSerializers",
"(",
"LinkedHashSet",
"<",
"Class",
"<",
"?",
">",
">",
"registeredSubclasses",
",",
"ExecutionConfig",
"executionConfig",
")",
"{",
"final",
"TypeSerializer",
"<"... | Creates an array of serializers for provided list of registered subclasses.
Order of returned serializers will correspond to order of provided subclasses. | [
"Creates",
"an",
"array",
"of",
"serializers",
"for",
"provided",
"list",
"of",
"registered",
"subclasses",
".",
"Order",
"of",
"returned",
"serializers",
"will",
"correspond",
"to",
"order",
"of",
"provided",
"subclasses",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializer.java#L1039-L1052 | train | Create the serializers for the registered subclasses. | [
30522,
2797,
10763,
4127,
11610,
28863,
1026,
1029,
1028,
1031,
1033,
3443,
2890,
24063,
6850,
6342,
9818,
27102,
8043,
4818,
17629,
2015,
1006,
5799,
14949,
7898,
3388,
1026,
2465,
1026,
1029,
1028,
1028,
5068,
6342,
9818,
27102,
2229,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java | OptimizerNode.mergeLists | protected final boolean mergeLists(List<UnclosedBranchDescriptor> child1open,
List<UnclosedBranchDescriptor> child2open,
List<UnclosedBranchDescriptor> result,
boolean markJoinedBranchesAsPipelineBreaking) {
//remove branches which have already been closed
removeClosedBranches(child1open);
removeClosedBranches(child2open);
result.clear();
// check how many open branches we have. the cases:
// 1) if both are null or empty, the result is null
// 2) if one side is null (or empty), the result is the other side.
// 3) both are set, then we need to merge.
if (child1open == null || child1open.isEmpty()) {
if(child2open != null && !child2open.isEmpty()) {
result.addAll(child2open);
}
return false;
}
if (child2open == null || child2open.isEmpty()) {
result.addAll(child1open);
return false;
}
int index1 = child1open.size() - 1;
int index2 = child2open.size() - 1;
boolean didCloseABranch = false;
// as both lists (child1open and child2open) are sorted in ascending ID order
// we can do a merge-join-like loop which preserved the order in the result list
// and eliminates duplicates
while (index1 >= 0 || index2 >= 0) {
int id1 = -1;
int id2 = index2 >= 0 ? child2open.get(index2).getBranchingNode().getId() : -1;
while (index1 >= 0 && (id1 = child1open.get(index1).getBranchingNode().getId()) > id2) {
result.add(child1open.get(index1));
index1--;
}
while (index2 >= 0 && (id2 = child2open.get(index2).getBranchingNode().getId()) > id1) {
result.add(child2open.get(index2));
index2--;
}
// match: they share a common branching child
if (id1 == id2) {
didCloseABranch = true;
// if this is the latest common child, remember it
OptimizerNode currBanchingNode = child1open.get(index1).getBranchingNode();
long vector1 = child1open.get(index1).getJoinedPathsVector();
long vector2 = child2open.get(index2).getJoinedPathsVector();
// check if this is the same descriptor, (meaning that it contains the same paths)
// if it is the same, add it only once, otherwise process the join of the paths
if (vector1 == vector2) {
result.add(child1open.get(index1));
}
else {
// we merge (re-join) a branch
// mark the branch as a point where we break the pipeline
if (markJoinedBranchesAsPipelineBreaking) {
currBanchingNode.markAllOutgoingConnectionsAsPipelineBreaking();
}
if (this.hereJoinedBranches == null) {
this.hereJoinedBranches = new ArrayList<OptimizerNode>(2);
}
this.hereJoinedBranches.add(currBanchingNode);
// see, if this node closes the branch
long joinedInputs = vector1 | vector2;
// this is 2^size - 1, which is all bits set at positions 0..size-1
long allInputs = (0x1L << currBanchingNode.getOutgoingConnections().size()) - 1;
if (joinedInputs == allInputs) {
// closed - we can remove it from the stack
addClosedBranch(currBanchingNode);
} else {
// not quite closed
result.add(new UnclosedBranchDescriptor(currBanchingNode, joinedInputs));
}
}
index1--;
index2--;
}
}
// merged. now we need to reverse the list, because we added the elements in reverse order
Collections.reverse(result);
return didCloseABranch;
} | java | protected final boolean mergeLists(List<UnclosedBranchDescriptor> child1open,
List<UnclosedBranchDescriptor> child2open,
List<UnclosedBranchDescriptor> result,
boolean markJoinedBranchesAsPipelineBreaking) {
//remove branches which have already been closed
removeClosedBranches(child1open);
removeClosedBranches(child2open);
result.clear();
// check how many open branches we have. the cases:
// 1) if both are null or empty, the result is null
// 2) if one side is null (or empty), the result is the other side.
// 3) both are set, then we need to merge.
if (child1open == null || child1open.isEmpty()) {
if(child2open != null && !child2open.isEmpty()) {
result.addAll(child2open);
}
return false;
}
if (child2open == null || child2open.isEmpty()) {
result.addAll(child1open);
return false;
}
int index1 = child1open.size() - 1;
int index2 = child2open.size() - 1;
boolean didCloseABranch = false;
// as both lists (child1open and child2open) are sorted in ascending ID order
// we can do a merge-join-like loop which preserved the order in the result list
// and eliminates duplicates
while (index1 >= 0 || index2 >= 0) {
int id1 = -1;
int id2 = index2 >= 0 ? child2open.get(index2).getBranchingNode().getId() : -1;
while (index1 >= 0 && (id1 = child1open.get(index1).getBranchingNode().getId()) > id2) {
result.add(child1open.get(index1));
index1--;
}
while (index2 >= 0 && (id2 = child2open.get(index2).getBranchingNode().getId()) > id1) {
result.add(child2open.get(index2));
index2--;
}
// match: they share a common branching child
if (id1 == id2) {
didCloseABranch = true;
// if this is the latest common child, remember it
OptimizerNode currBanchingNode = child1open.get(index1).getBranchingNode();
long vector1 = child1open.get(index1).getJoinedPathsVector();
long vector2 = child2open.get(index2).getJoinedPathsVector();
// check if this is the same descriptor, (meaning that it contains the same paths)
// if it is the same, add it only once, otherwise process the join of the paths
if (vector1 == vector2) {
result.add(child1open.get(index1));
}
else {
// we merge (re-join) a branch
// mark the branch as a point where we break the pipeline
if (markJoinedBranchesAsPipelineBreaking) {
currBanchingNode.markAllOutgoingConnectionsAsPipelineBreaking();
}
if (this.hereJoinedBranches == null) {
this.hereJoinedBranches = new ArrayList<OptimizerNode>(2);
}
this.hereJoinedBranches.add(currBanchingNode);
// see, if this node closes the branch
long joinedInputs = vector1 | vector2;
// this is 2^size - 1, which is all bits set at positions 0..size-1
long allInputs = (0x1L << currBanchingNode.getOutgoingConnections().size()) - 1;
if (joinedInputs == allInputs) {
// closed - we can remove it from the stack
addClosedBranch(currBanchingNode);
} else {
// not quite closed
result.add(new UnclosedBranchDescriptor(currBanchingNode, joinedInputs));
}
}
index1--;
index2--;
}
}
// merged. now we need to reverse the list, because we added the elements in reverse order
Collections.reverse(result);
return didCloseABranch;
} | [
"protected",
"final",
"boolean",
"mergeLists",
"(",
"List",
"<",
"UnclosedBranchDescriptor",
">",
"child1open",
",",
"List",
"<",
"UnclosedBranchDescriptor",
">",
"child2open",
",",
"List",
"<",
"UnclosedBranchDescriptor",
">",
"result",
",",
"boolean",
"markJoinedBra... | The node IDs are assigned in graph-traversal order (pre-order), hence, each list is
sorted by ID in ascending order and all consecutive lists start with IDs in ascending order.
@param markJoinedBranchesAsPipelineBreaking True, if the | [
"The",
"node",
"IDs",
"are",
"assigned",
"in",
"graph",
"-",
"traversal",
"order",
"(",
"pre",
"-",
"order",
")",
"hence",
"each",
"list",
"is",
"sorted",
"by",
"ID",
"in",
"ascending",
"order",
"and",
"all",
"consecutive",
"lists",
"start",
"with",
"IDs... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java#L998-L1097 | train | Merge two lists of branching nodes. | [
30522,
5123,
2345,
22017,
20898,
13590,
27103,
1006,
2862,
1026,
4895,
20464,
24768,
10024,
12680,
6155,
23235,
2953,
1028,
2775,
2487,
26915,
1010,
2862,
1026,
4895,
20464,
24768,
10024,
12680,
6155,
23235,
2953,
1028,
2775,
2475,
26915,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/ObjectUtil.java | ObjectUtil.checkNonEmpty | public static <T extends Collection<?>> T checkNonEmpty(T collection, String name) {
checkNotNull(collection, name);
checkPositive(collection.size(), name + ".size");
return collection;
} | java | public static <T extends Collection<?>> T checkNonEmpty(T collection, String name) {
checkNotNull(collection, name);
checkPositive(collection.size(), name + ".size");
return collection;
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"?",
">",
">",
"T",
"checkNonEmpty",
"(",
"T",
"collection",
",",
"String",
"name",
")",
"{",
"checkNotNull",
"(",
"collection",
",",
"name",
")",
";",
"checkPositive",
"(",
"collection",
".",
"... | Checks that the given argument is neither null nor empty.
If it is, throws {@link NullPointerException} or {@link IllegalArgumentException}.
Otherwise, returns the argument. | [
"Checks",
"that",
"the",
"given",
"argument",
"is",
"neither",
"null",
"nor",
"empty",
".",
"If",
"it",
"is",
"throws",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ObjectUtil.java#L98-L102 | train | Check that the collection is non - empty. | [
30522,
2270,
10763,
1026,
1056,
8908,
3074,
1026,
1029,
1028,
1028,
1056,
4638,
8540,
6633,
13876,
2100,
1006,
1056,
3074,
1010,
5164,
2171,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
3074,
1010,
2171,
1007,
1025,
4638,
6873,
28032,
3512,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/StrSpliter.java | StrSpliter.splitIgnoreCase | public static List<String> splitIgnoreCase(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty){
return split(str, separator, limit, isTrim, ignoreEmpty, true);
} | java | public static List<String> splitIgnoreCase(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty){
return split(str, separator, limit, isTrim, ignoreEmpty, true);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"splitIgnoreCase",
"(",
"String",
"str",
",",
"String",
"separator",
",",
"int",
"limit",
",",
"boolean",
"isTrim",
",",
"boolean",
"ignoreEmpty",
")",
"{",
"return",
"split",
"(",
"str",
",",
"separator",
",... | 切分字符串,忽略大小写
@param str 被切分的字符串
@param separator 分隔符字符串
@param limit 限制分片数
@param isTrim 是否去除切分字符串后每个元素两边的空格
@param ignoreEmpty 是否忽略空串
@return 切分后的集合
@since 3.2.1 | [
"切分字符串,忽略大小写"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java#L259-L261 | train | Splits the given string ignoring case. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
3975,
23773,
5686,
18382,
30524,
20898,
8568,
6633,
13876,
2100,
1007,
1063,
2709,
3975,
1006,
2358,
2099,
1010,
19802,
25879,
2953,
1010,
5787,
1010,
21541,
20026,
1010,
8568,
6633,
13876,
2100,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/web/servlet/console/DefaultProxyHtmlRenderer.java | DefaultProxyHtmlRenderer.nodeTabs | private String nodeTabs() {
StringBuilder builder = new StringBuilder();
builder.append("<div class='tabs'>");
builder.append("<ul>");
builder
.append("<li class='tab' type='browsers'><a title='test slots' href='#'>Browsers</a></li>");
builder
.append("<li class='tab' type='config'><a title='node configuration' href='#'>Configuration</a></li>");
builder.append("</ul>");
builder.append("</div>");
return builder.toString();
} | java | private String nodeTabs() {
StringBuilder builder = new StringBuilder();
builder.append("<div class='tabs'>");
builder.append("<ul>");
builder
.append("<li class='tab' type='browsers'><a title='test slots' href='#'>Browsers</a></li>");
builder
.append("<li class='tab' type='config'><a title='node configuration' href='#'>Configuration</a></li>");
builder.append("</ul>");
builder.append("</div>");
return builder.toString();
} | [
"private",
"String",
"nodeTabs",
"(",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"\"<div class='tabs'>\"",
")",
";",
"builder",
".",
"append",
"(",
"\"<ul>\"",
")",
";",
"builder",
".",
... | the tabs header. | [
"the",
"tabs",
"header",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/web/servlet/console/DefaultProxyHtmlRenderer.java#L172-L183 | train | node tabs | [
30522,
2797,
5164,
13045,
2696,
5910,
1006,
1007,
1063,
5164,
8569,
23891,
2099,
12508,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
1007,
1025,
12508,
1012,
10439,
10497,
30524,
1006,
1000,
1026,
5622,
2465,
1027,
1005,
21628,
1005,
2828,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/CompilerHints.java | CompilerHints.copyFrom | protected void copyFrom(CompilerHints source) {
this.outputSize = source.outputSize;
this.outputCardinality = source.outputCardinality;
this.avgOutputRecordSize = source.avgOutputRecordSize;
this.filterFactor = source.filterFactor;
if (source.uniqueFields != null && source.uniqueFields.size() > 0) {
if (this.uniqueFields == null) {
this.uniqueFields = new HashSet<FieldSet>();
} else {
this.uniqueFields.clear();
}
this.uniqueFields.addAll(source.uniqueFields);
}
} | java | protected void copyFrom(CompilerHints source) {
this.outputSize = source.outputSize;
this.outputCardinality = source.outputCardinality;
this.avgOutputRecordSize = source.avgOutputRecordSize;
this.filterFactor = source.filterFactor;
if (source.uniqueFields != null && source.uniqueFields.size() > 0) {
if (this.uniqueFields == null) {
this.uniqueFields = new HashSet<FieldSet>();
} else {
this.uniqueFields.clear();
}
this.uniqueFields.addAll(source.uniqueFields);
}
} | [
"protected",
"void",
"copyFrom",
"(",
"CompilerHints",
"source",
")",
"{",
"this",
".",
"outputSize",
"=",
"source",
".",
"outputSize",
";",
"this",
".",
"outputCardinality",
"=",
"source",
".",
"outputCardinality",
";",
"this",
".",
"avgOutputRecordSize",
"=",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/CompilerHints.java#L158-L173 | train | Copy the compiler hints from another compiler hints object. | [
30522,
5123,
11675,
6100,
19699,
5358,
1006,
21624,
10606,
3215,
3120,
1007,
1063,
2023,
1012,
27852,
4697,
1027,
3120,
1012,
27852,
4697,
1025,
2023,
1012,
6434,
11522,
13290,
3012,
1027,
3120,
1012,
6434,
11522,
13290,
3012,
1025,
2023,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/NetUtil.java | NetUtil.bytesToIpAddress | public static String bytesToIpAddress(byte[] bytes, int offset, int length) {
switch (length) {
case 4: {
return new StringBuilder(15)
.append(bytes[offset] & 0xff)
.append('.')
.append(bytes[offset + 1] & 0xff)
.append('.')
.append(bytes[offset + 2] & 0xff)
.append('.')
.append(bytes[offset + 3] & 0xff).toString();
}
case 16:
return toAddressString(bytes, offset, false);
default:
throw new IllegalArgumentException("length: " + length + " (expected: 4 or 16)");
}
} | java | public static String bytesToIpAddress(byte[] bytes, int offset, int length) {
switch (length) {
case 4: {
return new StringBuilder(15)
.append(bytes[offset] & 0xff)
.append('.')
.append(bytes[offset + 1] & 0xff)
.append('.')
.append(bytes[offset + 2] & 0xff)
.append('.')
.append(bytes[offset + 3] & 0xff).toString();
}
case 16:
return toAddressString(bytes, offset, false);
default:
throw new IllegalArgumentException("length: " + length + " (expected: 4 or 16)");
}
} | [
"public",
"static",
"String",
"bytesToIpAddress",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"switch",
"(",
"length",
")",
"{",
"case",
"4",
":",
"{",
"return",
"new",
"StringBuilder",
"(",
"15",
")",
".",
"... | Converts 4-byte or 16-byte data into an IPv4 or IPv6 string respectively.
@throws IllegalArgumentException
if {@code length} is not {@code 4} nor {@code 16} | [
"Converts",
"4",
"-",
"byte",
"or",
"16",
"-",
"byte",
"data",
"into",
"an",
"IPv4",
"or",
"IPv6",
"string",
"respectively",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/NetUtil.java#L447-L464 | train | This method converts a byte array to an IP address string. | [
30522,
2270,
10763,
5164,
27507,
3406,
11514,
4215,
16200,
4757,
1006,
24880,
1031,
1033,
27507,
1010,
20014,
16396,
1010,
20014,
3091,
1007,
1063,
6942,
1006,
3091,
1007,
1063,
2553,
1018,
1024,
1063,
2709,
2047,
5164,
8569,
23891,
2099,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/operators/DualInputSemanticProperties.java | DualInputSemanticProperties.addForwardedField | public void addForwardedField(int input, int sourceField, int targetField) {
Map<Integer, FieldSet> fieldMapping;
if (input != 0 && input != 1) {
throw new IndexOutOfBoundsException();
} else if (input == 0) {
fieldMapping = this.fieldMapping1;
} else {
fieldMapping = this.fieldMapping2;
}
if(isTargetFieldPresent(targetField, fieldMapping)) {
throw new InvalidSemanticAnnotationException("Target field "+targetField+" was added twice to input "+input);
}
FieldSet targetFields = fieldMapping.get(sourceField);
if (targetFields != null) {
fieldMapping.put(sourceField, targetFields.addField(targetField));
} else {
fieldMapping.put(sourceField, new FieldSet(targetField));
}
} | java | public void addForwardedField(int input, int sourceField, int targetField) {
Map<Integer, FieldSet> fieldMapping;
if (input != 0 && input != 1) {
throw new IndexOutOfBoundsException();
} else if (input == 0) {
fieldMapping = this.fieldMapping1;
} else {
fieldMapping = this.fieldMapping2;
}
if(isTargetFieldPresent(targetField, fieldMapping)) {
throw new InvalidSemanticAnnotationException("Target field "+targetField+" was added twice to input "+input);
}
FieldSet targetFields = fieldMapping.get(sourceField);
if (targetFields != null) {
fieldMapping.put(sourceField, targetFields.addField(targetField));
} else {
fieldMapping.put(sourceField, new FieldSet(targetField));
}
} | [
"public",
"void",
"addForwardedField",
"(",
"int",
"input",
",",
"int",
"sourceField",
",",
"int",
"targetField",
")",
"{",
"Map",
"<",
"Integer",
",",
"FieldSet",
">",
"fieldMapping",
";",
"if",
"(",
"input",
"!=",
"0",
"&&",
"input",
"!=",
"1",
")",
... | Adds, to the existing information, a field that is forwarded directly
from the source record(s) in the first input to the destination
record(s).
@param input the input of the source field
@param sourceField the position in the source record
@param targetField the position in the destination record | [
"Adds",
"to",
"the",
"existing",
"information",
"a",
"field",
"that",
"is",
"forwarded",
"directly",
"from",
"the",
"source",
"record",
"(",
"s",
")",
"in",
"the",
"first",
"input",
"to",
"the",
"destination",
"record",
"(",
"s",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/DualInputSemanticProperties.java#L122-L144 | train | Adds a forwarded field to the source field. | [
30522,
2270,
11675,
5587,
29278,
7652,
2098,
3790,
1006,
20014,
7953,
1010,
20014,
3120,
3790,
1010,
20014,
4539,
3790,
1007,
1063,
4949,
1026,
16109,
1010,
4249,
3388,
1028,
2492,
2863,
14853,
1025,
2065,
1006,
7953,
999,
1027,
1014,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java | TaskExecutor.requestSlot | @Override
public CompletableFuture<Acknowledge> requestSlot(
final SlotID slotId,
final JobID jobId,
final AllocationID allocationId,
final String targetAddress,
final ResourceManagerId resourceManagerId,
final Time timeout) {
// TODO: Filter invalid requests from the resource manager by using the instance/registration Id
log.info("Receive slot request {} for job {} from resource manager with leader id {}.",
allocationId, jobId, resourceManagerId);
try {
if (!isConnectedToResourceManager(resourceManagerId)) {
final String message = String.format("TaskManager is not connected to the resource manager %s.", resourceManagerId);
log.debug(message);
throw new TaskManagerException(message);
}
if (taskSlotTable.isSlotFree(slotId.getSlotNumber())) {
if (taskSlotTable.allocateSlot(slotId.getSlotNumber(), jobId, allocationId, taskManagerConfiguration.getTimeout())) {
log.info("Allocated slot for {}.", allocationId);
} else {
log.info("Could not allocate slot for {}.", allocationId);
throw new SlotAllocationException("Could not allocate slot.");
}
} else if (!taskSlotTable.isAllocated(slotId.getSlotNumber(), jobId, allocationId)) {
final String message = "The slot " + slotId + " has already been allocated for a different job.";
log.info(message);
final AllocationID allocationID = taskSlotTable.getCurrentAllocation(slotId.getSlotNumber());
throw new SlotOccupiedException(message, allocationID, taskSlotTable.getOwningJob(allocationID));
}
if (jobManagerTable.contains(jobId)) {
offerSlotsToJobManager(jobId);
} else {
try {
jobLeaderService.addJob(jobId, targetAddress);
} catch (Exception e) {
// free the allocated slot
try {
taskSlotTable.freeSlot(allocationId);
} catch (SlotNotFoundException slotNotFoundException) {
// slot no longer existent, this should actually never happen, because we've
// just allocated the slot. So let's fail hard in this case!
onFatalError(slotNotFoundException);
}
// release local state under the allocation id.
localStateStoresManager.releaseLocalStateForAllocationId(allocationId);
// sanity check
if (!taskSlotTable.isSlotFree(slotId.getSlotNumber())) {
onFatalError(new Exception("Could not free slot " + slotId));
}
throw new SlotAllocationException("Could not add job to job leader service.", e);
}
}
} catch (TaskManagerException taskManagerException) {
return FutureUtils.completedExceptionally(taskManagerException);
}
return CompletableFuture.completedFuture(Acknowledge.get());
} | java | @Override
public CompletableFuture<Acknowledge> requestSlot(
final SlotID slotId,
final JobID jobId,
final AllocationID allocationId,
final String targetAddress,
final ResourceManagerId resourceManagerId,
final Time timeout) {
// TODO: Filter invalid requests from the resource manager by using the instance/registration Id
log.info("Receive slot request {} for job {} from resource manager with leader id {}.",
allocationId, jobId, resourceManagerId);
try {
if (!isConnectedToResourceManager(resourceManagerId)) {
final String message = String.format("TaskManager is not connected to the resource manager %s.", resourceManagerId);
log.debug(message);
throw new TaskManagerException(message);
}
if (taskSlotTable.isSlotFree(slotId.getSlotNumber())) {
if (taskSlotTable.allocateSlot(slotId.getSlotNumber(), jobId, allocationId, taskManagerConfiguration.getTimeout())) {
log.info("Allocated slot for {}.", allocationId);
} else {
log.info("Could not allocate slot for {}.", allocationId);
throw new SlotAllocationException("Could not allocate slot.");
}
} else if (!taskSlotTable.isAllocated(slotId.getSlotNumber(), jobId, allocationId)) {
final String message = "The slot " + slotId + " has already been allocated for a different job.";
log.info(message);
final AllocationID allocationID = taskSlotTable.getCurrentAllocation(slotId.getSlotNumber());
throw new SlotOccupiedException(message, allocationID, taskSlotTable.getOwningJob(allocationID));
}
if (jobManagerTable.contains(jobId)) {
offerSlotsToJobManager(jobId);
} else {
try {
jobLeaderService.addJob(jobId, targetAddress);
} catch (Exception e) {
// free the allocated slot
try {
taskSlotTable.freeSlot(allocationId);
} catch (SlotNotFoundException slotNotFoundException) {
// slot no longer existent, this should actually never happen, because we've
// just allocated the slot. So let's fail hard in this case!
onFatalError(slotNotFoundException);
}
// release local state under the allocation id.
localStateStoresManager.releaseLocalStateForAllocationId(allocationId);
// sanity check
if (!taskSlotTable.isSlotFree(slotId.getSlotNumber())) {
onFatalError(new Exception("Could not free slot " + slotId));
}
throw new SlotAllocationException("Could not add job to job leader service.", e);
}
}
} catch (TaskManagerException taskManagerException) {
return FutureUtils.completedExceptionally(taskManagerException);
}
return CompletableFuture.completedFuture(Acknowledge.get());
} | [
"@",
"Override",
"public",
"CompletableFuture",
"<",
"Acknowledge",
">",
"requestSlot",
"(",
"final",
"SlotID",
"slotId",
",",
"final",
"JobID",
"jobId",
",",
"final",
"AllocationID",
"allocationId",
",",
"final",
"String",
"targetAddress",
",",
"final",
"Resource... | ---------------------------------------------------------------------- | [
"----------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutor.java#L735-L802 | train | This method is used to request a slot from a resource manager. | [
30522,
1030,
2058,
15637,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
13399,
1028,
11186,
10994,
1006,
2345,
10453,
3593,
10453,
3593,
1010,
2345,
3105,
3593,
3105,
3593,
1010,
2345,
16169,
3593,
16169,
3593,
1010,
2345,
5164,
4539,
4215,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-hadoop-fs/src/main/java/org/apache/flink/runtime/fs/hdfs/HadoopBlockLocation.java | HadoopBlockLocation.stripHostname | private static String stripHostname(final String originalHostname) {
// Check if the hostname domains the domain separator character
final int index = originalHostname.indexOf(DOMAIN_SEPARATOR);
if (index == -1) {
return originalHostname;
}
// Make sure we are not stripping an IPv4 address
final Matcher matcher = IPV4_PATTERN.matcher(originalHostname);
if (matcher.matches()) {
return originalHostname;
}
if (index == 0) {
throw new IllegalStateException("Hostname " + originalHostname + " starts with a " + DOMAIN_SEPARATOR);
}
return originalHostname.substring(0, index);
} | java | private static String stripHostname(final String originalHostname) {
// Check if the hostname domains the domain separator character
final int index = originalHostname.indexOf(DOMAIN_SEPARATOR);
if (index == -1) {
return originalHostname;
}
// Make sure we are not stripping an IPv4 address
final Matcher matcher = IPV4_PATTERN.matcher(originalHostname);
if (matcher.matches()) {
return originalHostname;
}
if (index == 0) {
throw new IllegalStateException("Hostname " + originalHostname + " starts with a " + DOMAIN_SEPARATOR);
}
return originalHostname.substring(0, index);
} | [
"private",
"static",
"String",
"stripHostname",
"(",
"final",
"String",
"originalHostname",
")",
"{",
"// Check if the hostname domains the domain separator character",
"final",
"int",
"index",
"=",
"originalHostname",
".",
"indexOf",
"(",
"DOMAIN_SEPARATOR",
")",
";",
"i... | Looks for a domain suffix in a FQDN and strips it if present.
@param originalHostname
the original hostname, possibly an FQDN
@return the stripped hostname without the domain suffix | [
"Looks",
"for",
"a",
"domain",
"suffix",
"in",
"a",
"FQDN",
"and",
"strips",
"it",
"if",
"present",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/fs/hdfs/HadoopBlockLocation.java#L93-L112 | train | Strip the hostname from the original hostname. | [
30522,
2797,
10763,
5164,
6167,
15006,
2102,
18442,
1006,
2345,
5164,
2434,
15006,
2102,
18442,
1007,
1063,
1013,
1013,
4638,
2065,
1996,
3677,
18442,
13100,
1996,
5884,
19802,
25879,
2953,
2839,
2345,
20014,
5950,
1027,
2434,
15006,
2102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java | FastDateParser.getStrategy | private Strategy getStrategy(final char f, final int width, final Calendar definingCalendar) {
switch (f) {
default:
throw new IllegalArgumentException("Format '" + f + "' not supported");
case 'D':
return DAY_OF_YEAR_STRATEGY;
case 'E':
return getLocaleSpecificStrategy(Calendar.DAY_OF_WEEK, definingCalendar);
case 'F':
return DAY_OF_WEEK_IN_MONTH_STRATEGY;
case 'G':
return getLocaleSpecificStrategy(Calendar.ERA, definingCalendar);
case 'H': // Hour in day (0-23)
return HOUR_OF_DAY_STRATEGY;
case 'K': // Hour in am/pm (0-11)
return HOUR_STRATEGY;
case 'M':
return width >= 3 ? getLocaleSpecificStrategy(Calendar.MONTH, definingCalendar) : NUMBER_MONTH_STRATEGY;
case 'S':
return MILLISECOND_STRATEGY;
case 'W':
return WEEK_OF_MONTH_STRATEGY;
case 'a':
return getLocaleSpecificStrategy(Calendar.AM_PM, definingCalendar);
case 'd':
return DAY_OF_MONTH_STRATEGY;
case 'h': // Hour in am/pm (1-12), i.e. midday/midnight is 12, not 0
return HOUR12_STRATEGY;
case 'k': // Hour in day (1-24), i.e. midnight is 24, not 0
return HOUR24_OF_DAY_STRATEGY;
case 'm':
return MINUTE_STRATEGY;
case 's':
return SECOND_STRATEGY;
case 'u':
return DAY_OF_WEEK_STRATEGY;
case 'w':
return WEEK_OF_YEAR_STRATEGY;
case 'y':
case 'Y':
return width > 2 ? LITERAL_YEAR_STRATEGY : ABBREVIATED_YEAR_STRATEGY;
case 'X':
return ISO8601TimeZoneStrategy.getStrategy(width);
case 'Z':
if (width == 2) {
return ISO8601TimeZoneStrategy.ISO_8601_3_STRATEGY;
}
//$FALL-THROUGH$
case 'z':
return getLocaleSpecificStrategy(Calendar.ZONE_OFFSET, definingCalendar);
}
} | java | private Strategy getStrategy(final char f, final int width, final Calendar definingCalendar) {
switch (f) {
default:
throw new IllegalArgumentException("Format '" + f + "' not supported");
case 'D':
return DAY_OF_YEAR_STRATEGY;
case 'E':
return getLocaleSpecificStrategy(Calendar.DAY_OF_WEEK, definingCalendar);
case 'F':
return DAY_OF_WEEK_IN_MONTH_STRATEGY;
case 'G':
return getLocaleSpecificStrategy(Calendar.ERA, definingCalendar);
case 'H': // Hour in day (0-23)
return HOUR_OF_DAY_STRATEGY;
case 'K': // Hour in am/pm (0-11)
return HOUR_STRATEGY;
case 'M':
return width >= 3 ? getLocaleSpecificStrategy(Calendar.MONTH, definingCalendar) : NUMBER_MONTH_STRATEGY;
case 'S':
return MILLISECOND_STRATEGY;
case 'W':
return WEEK_OF_MONTH_STRATEGY;
case 'a':
return getLocaleSpecificStrategy(Calendar.AM_PM, definingCalendar);
case 'd':
return DAY_OF_MONTH_STRATEGY;
case 'h': // Hour in am/pm (1-12), i.e. midday/midnight is 12, not 0
return HOUR12_STRATEGY;
case 'k': // Hour in day (1-24), i.e. midnight is 24, not 0
return HOUR24_OF_DAY_STRATEGY;
case 'm':
return MINUTE_STRATEGY;
case 's':
return SECOND_STRATEGY;
case 'u':
return DAY_OF_WEEK_STRATEGY;
case 'w':
return WEEK_OF_YEAR_STRATEGY;
case 'y':
case 'Y':
return width > 2 ? LITERAL_YEAR_STRATEGY : ABBREVIATED_YEAR_STRATEGY;
case 'X':
return ISO8601TimeZoneStrategy.getStrategy(width);
case 'Z':
if (width == 2) {
return ISO8601TimeZoneStrategy.ISO_8601_3_STRATEGY;
}
//$FALL-THROUGH$
case 'z':
return getLocaleSpecificStrategy(Calendar.ZONE_OFFSET, definingCalendar);
}
} | [
"private",
"Strategy",
"getStrategy",
"(",
"final",
"char",
"f",
",",
"final",
"int",
"width",
",",
"final",
"Calendar",
"definingCalendar",
")",
"{",
"switch",
"(",
"f",
")",
"{",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Format '\""... | Obtain a Strategy given a field from a SimpleDateFormat pattern
@param formatField A sub-sequence of the SimpleDateFormat pattern
@param definingCalendar The calendar to obtain the short and long values
@return The Strategy that will handle parsing for the field | [
"Obtain",
"a",
"Strategy",
"given",
"a",
"field",
"from",
"a",
"SimpleDateFormat",
"pattern"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java#L396-L447 | train | Gets the strategy for the given format and width. | [
30522,
2797,
5656,
4152,
6494,
2618,
6292,
1006,
2345,
25869,
1042,
1010,
2345,
20014,
9381,
1010,
2345,
8094,
12854,
9289,
10497,
2906,
1007,
1063,
6942,
1006,
1042,
1007,
1063,
12398,
1024,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
2442... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/Setting.java | Setting.init | public boolean init(Resource resource, Charset charset, boolean isUseVariable) {
if (resource == null) {
throw new NullPointerException("Null setting url define!");
}
this.settingUrl = resource.getUrl();
this.charset = charset;
this.isUseVariable = isUseVariable;
return load();
} | java | public boolean init(Resource resource, Charset charset, boolean isUseVariable) {
if (resource == null) {
throw new NullPointerException("Null setting url define!");
}
this.settingUrl = resource.getUrl();
this.charset = charset;
this.isUseVariable = isUseVariable;
return load();
} | [
"public",
"boolean",
"init",
"(",
"Resource",
"resource",
",",
"Charset",
"charset",
",",
"boolean",
"isUseVariable",
")",
"{",
"if",
"(",
"resource",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Null setting url define!\"",
")",
";",
... | 初始化设定文件
@param resource {@link Resource}
@param charset 字符集
@param isUseVariable 是否使用变量
@return 成功初始化与否 | [
"初始化设定文件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L152-L161 | train | Initializes the object with the specified setting url charset and isUseVariable. | [
30522,
2270,
22017,
20898,
1999,
4183,
1006,
7692,
7692,
1010,
25869,
13462,
25869,
13462,
1010,
22017,
20898,
2003,
8557,
10755,
19210,
1007,
1063,
2065,
1006,
7692,
30524,
2131,
3126,
2140,
1006,
1007,
1025,
2023,
1012,
25869,
13462,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/cluster/Cluster.java | Cluster.section | void section(int nclusters)
{
if (size() < nclusters)
return;
sectioned_clusters_ = new ArrayList<Cluster<K>>(nclusters);
List<Document> centroids = new ArrayList<Document>(nclusters);
// choose_randomly(nclusters, centroids);
choose_smartly(nclusters, centroids);
for (int i = 0; i < centroids.size(); i++)
{
Cluster<K> cluster = new Cluster<K>();
sectioned_clusters_.add(cluster);
}
for (Document<K> d : documents_)
{
double max_similarity = -1.0;
int max_index = 0;
for (int j = 0; j < centroids.size(); j++)
{
double similarity = SparseVector.inner_product(d.feature(), centroids.get(j).feature());
if (max_similarity < similarity)
{
max_similarity = similarity;
max_index = j;
}
}
sectioned_clusters_.get(max_index).add_document(d);
}
} | java | void section(int nclusters)
{
if (size() < nclusters)
return;
sectioned_clusters_ = new ArrayList<Cluster<K>>(nclusters);
List<Document> centroids = new ArrayList<Document>(nclusters);
// choose_randomly(nclusters, centroids);
choose_smartly(nclusters, centroids);
for (int i = 0; i < centroids.size(); i++)
{
Cluster<K> cluster = new Cluster<K>();
sectioned_clusters_.add(cluster);
}
for (Document<K> d : documents_)
{
double max_similarity = -1.0;
int max_index = 0;
for (int j = 0; j < centroids.size(); j++)
{
double similarity = SparseVector.inner_product(d.feature(), centroids.get(j).feature());
if (max_similarity < similarity)
{
max_similarity = similarity;
max_index = j;
}
}
sectioned_clusters_.get(max_index).add_document(d);
}
} | [
"void",
"section",
"(",
"int",
"nclusters",
")",
"{",
"if",
"(",
"size",
"(",
")",
"<",
"nclusters",
")",
"return",
";",
"sectioned_clusters_",
"=",
"new",
"ArrayList",
"<",
"Cluster",
"<",
"K",
">",
">",
"(",
"nclusters",
")",
";",
"List",
"<",
"Doc... | 将本簇划分为nclusters个簇
@param nclusters | [
"将本簇划分为nclusters个簇"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/Cluster.java#L289-L319 | train | Section the document set. | [
30522,
11675,
2930,
1006,
20014,
13316,
7393,
7747,
1007,
1063,
2065,
1006,
2946,
1006,
1007,
1026,
13316,
7393,
7747,
1007,
2709,
1025,
2930,
2098,
1035,
12906,
1035,
1027,
2047,
9140,
9863,
1026,
9324,
1026,
1047,
1028,
1028,
1006,
13316,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.readLines | public static <T extends Collection<String>> T readLines(String path, Charset charset, T collection) throws IORuntimeException {
return readLines(file(path), charset, collection);
} | java | public static <T extends Collection<String>> T readLines(String path, Charset charset, T collection) throws IORuntimeException {
return readLines(file(path), charset, collection);
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"String",
">",
">",
"T",
"readLines",
"(",
"String",
"path",
",",
"Charset",
"charset",
",",
"T",
"collection",
")",
"throws",
"IORuntimeException",
"{",
"return",
"readLines",
"(",
"file",
"(",
"... | 从文件中读取每一行数据
@param <T> 集合类型
@param path 文件路径
@param charset 字符集
@param collection 集合
@return 文件中的每行内容的集合
@throws IORuntimeException IO异常 | [
"从文件中读取每一行数据"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2192-L2194 | train | Reads lines from a file. | [
30522,
2270,
10763,
1026,
1056,
8908,
3074,
1026,
5164,
1028,
1028,
1056,
3191,
12735,
1006,
5164,
4130,
1010,
25869,
13462,
25869,
13462,
1010,
1056,
3074,
1007,
11618,
22834,
15532,
7292,
10288,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/Setting.java | Setting.containsValue | @Override
public boolean containsValue(Object value) {
return this.groupedMap.containsValue(DEFAULT_GROUP, Convert.toStr(value));
} | java | @Override
public boolean containsValue(Object value) {
return this.groupedMap.containsValue(DEFAULT_GROUP, Convert.toStr(value));
} | [
"@",
"Override",
"public",
"boolean",
"containsValue",
"(",
"Object",
"value",
")",
"{",
"return",
"this",
".",
"groupedMap",
".",
"containsValue",
"(",
"DEFAULT_GROUP",
",",
"Convert",
".",
"toStr",
"(",
"value",
")",
")",
";",
"}"
] | 默认分组(空分组)中是否包含指定值
@param value 值
@return 默认分组中是否包含指定值 | [
"默认分组(空分组)中是否包含指定值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L538-L541 | train | Override this method to check if the specified value is in the default group. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
3397,
10175,
5657,
1006,
4874,
3643,
1007,
1063,
2709,
2023,
1012,
15131,
2863,
2361,
1012,
3397,
10175,
5657,
1006,
12398,
1035,
2177,
1010,
10463,
1012,
2000,
3367,
2099,
1006,
3643,
1007,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/TaskExecutorManager.java | TaskExecutorManager.spawnExecutor | public TaskExecutor spawnExecutor(Task task) {
final TaskExecutor executor = new TaskExecutor(this.scheduler, task);
synchronized (this.executors) {
this.executors.add(executor);
}
// 子线程是否为deamon线程取决于父线程,因此此处无需显示调用
// executor.setDaemon(this.scheduler.daemon);
// executor.start();
this.scheduler.threadExecutor.execute(executor);
return executor;
} | java | public TaskExecutor spawnExecutor(Task task) {
final TaskExecutor executor = new TaskExecutor(this.scheduler, task);
synchronized (this.executors) {
this.executors.add(executor);
}
// 子线程是否为deamon线程取决于父线程,因此此处无需显示调用
// executor.setDaemon(this.scheduler.daemon);
// executor.start();
this.scheduler.threadExecutor.execute(executor);
return executor;
} | [
"public",
"TaskExecutor",
"spawnExecutor",
"(",
"Task",
"task",
")",
"{",
"final",
"TaskExecutor",
"executor",
"=",
"new",
"TaskExecutor",
"(",
"this",
".",
"scheduler",
",",
"task",
")",
";",
"synchronized",
"(",
"this",
".",
"executors",
")",
"{",
"this",
... | 启动 TaskExecutor
@param task {@link Task}
@return {@link TaskExecutor} | [
"启动",
"TaskExecutor"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/TaskExecutorManager.java#L31-L41 | train | Spawn a new task executor. | [
30522,
2270,
4708,
10288,
8586,
16161,
2099,
25645,
10288,
8586,
16161,
2099,
1006,
4708,
4708,
1007,
1063,
2345,
4708,
10288,
8586,
16161,
2099,
4654,
8586,
16161,
2099,
1027,
2047,
4708,
10288,
8586,
16161,
2099,
1006,
2023,
1012,
6134,
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/incubator-shardingsphere | sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/state/listener/StateChangedListenerManager.java | StateChangedListenerManager.initListeners | public void initListeners() {
instanceStateChangedListener.watch(ChangedType.UPDATED);
dataSourceStateChangedListener.watch(ChangedType.UPDATED, ChangedType.DELETED);
} | java | public void initListeners() {
instanceStateChangedListener.watch(ChangedType.UPDATED);
dataSourceStateChangedListener.watch(ChangedType.UPDATED, ChangedType.DELETED);
} | [
"public",
"void",
"initListeners",
"(",
")",
"{",
"instanceStateChangedListener",
".",
"watch",
"(",
"ChangedType",
".",
"UPDATED",
")",
";",
"dataSourceStateChangedListener",
".",
"watch",
"(",
"ChangedType",
".",
"UPDATED",
",",
"ChangedType",
".",
"DELETED",
")... | Initialize all state changed listeners. | [
"Initialize",
"all",
"state",
"changed",
"listeners",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/state/listener/StateChangedListenerManager.java#L42-L45 | train | Initialize the listeners. | [
30522,
2270,
11675,
1999,
4183,
9863,
24454,
2015,
1006,
1007,
1063,
12107,
12259,
22305,
2098,
9863,
24454,
1012,
3422,
1006,
2904,
13874,
1012,
7172,
1007,
1025,
2951,
6499,
3126,
9623,
12259,
22305,
2098,
9863,
24454,
1012,
3422,
1006,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getInt32 | public final int getInt32(final int pos) {
final int position = origin + pos;
if (pos + 3 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 3)));
byte[] buf = buffer;
return (0xff & buf[position]) | ((0xff & buf[position + 1]) << 8) | ((0xff & buf[position + 2]) << 16)
| ((buf[position + 3]) << 24);
} | java | public final int getInt32(final int pos) {
final int position = origin + pos;
if (pos + 3 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 3)));
byte[] buf = buffer;
return (0xff & buf[position]) | ((0xff & buf[position + 1]) << 8) | ((0xff & buf[position + 2]) << 16)
| ((buf[position + 3]) << 24);
} | [
"public",
"final",
"int",
"getInt32",
"(",
"final",
"int",
"pos",
")",
"{",
"final",
"int",
"position",
"=",
"origin",
"+",
"pos",
";",
"if",
"(",
"pos",
"+",
"3",
">=",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
... | Return 32-bit signed int from buffer. (little-endian)
@see mysql-5.1.60/include/my_global.h - sint4korr | [
"Return",
"32",
"-",
"bit",
"signed",
"int",
"from",
"buffer",
".",
"(",
"little",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L469-L478 | train | Gets an int32 from the buffer. | [
30522,
2270,
2345,
20014,
2131,
18447,
16703,
1006,
2345,
20014,
13433,
2015,
1007,
1063,
2345,
20014,
2597,
1027,
4761,
1009,
13433,
2015,
1025,
2065,
1006,
13433,
2015,
1009,
1017,
1028,
1027,
5787,
1064,
1064,
13433,
2015,
1026,
1014,
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... |
SeleniumHQ/selenium | java/server/src/org/openqa/selenium/remote/server/log/SessionLogsToFileRepository.java | SessionLogsToFileRepository.flushRecordsToLogFile | synchronized public void flushRecordsToLogFile(SessionId sessionId,
List<LogRecord> records) throws IOException {
LogFile logFile = sessionToLogFileMap.get(sessionId);
if (logFile == null) {
createLogFileAndAddToMap(sessionId);
logFile = sessionToLogFileMap.get(sessionId);
}
logFile.openLogWriter();
for (LogRecord record : records) {
logFile.getLogWriter().writeObject(record);
}
logFile.closeLogWriter();
} | java | synchronized public void flushRecordsToLogFile(SessionId sessionId,
List<LogRecord> records) throws IOException {
LogFile logFile = sessionToLogFileMap.get(sessionId);
if (logFile == null) {
createLogFileAndAddToMap(sessionId);
logFile = sessionToLogFileMap.get(sessionId);
}
logFile.openLogWriter();
for (LogRecord record : records) {
logFile.getLogWriter().writeObject(record);
}
logFile.closeLogWriter();
} | [
"synchronized",
"public",
"void",
"flushRecordsToLogFile",
"(",
"SessionId",
"sessionId",
",",
"List",
"<",
"LogRecord",
">",
"records",
")",
"throws",
"IOException",
"{",
"LogFile",
"logFile",
"=",
"sessionToLogFileMap",
".",
"get",
"(",
"sessionId",
")",
";",
... | This creates a mapping between session and file representation of logs if doesnt exist already.
Writes the log records to the log file. This does *NOT* flush the logs to file. This does *NOT*
clear the records after writing to file.
@param sessionId session-id to which the log records belong
@param records logRecords that need to be stored
@throws IOException file i/o exception can occur because of a temp file created | [
"This",
"creates",
"a",
"mapping",
"between",
"session",
"and",
"file",
"representation",
"of",
"logs",
"if",
"doesnt",
"exist",
"already",
".",
"Writes",
"the",
"log",
"records",
"to",
"the",
"log",
"file",
".",
"This",
"does",
"*",
"NOT",
"*",
"flush",
... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/selenium/remote/server/log/SessionLogsToFileRepository.java#L67-L81 | train | Flush the records to the log file. | [
30522,
25549,
2270,
11675,
13862,
2890,
27108,
5104,
3406,
21197,
8873,
2571,
1006,
5219,
3593,
5219,
3593,
1010,
2862,
1026,
8833,
2890,
27108,
2094,
1028,
2636,
1007,
11618,
22834,
10288,
24422,
1063,
8833,
8873,
2571,
8833,
8873,
2571,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/MigrationUtils.java | MigrationUtils.skipSerializedStates | static void skipSerializedStates(DataInputView in) throws IOException {
TypeSerializer<String> nameSerializer = StringSerializer.INSTANCE;
TypeSerializer<State.StateType> stateTypeSerializer = new EnumSerializer<>(State.StateType.class);
TypeSerializer<StateTransitionAction> actionSerializer = new EnumSerializer<>(StateTransitionAction.class);
final int noOfStates = in.readInt();
for (int i = 0; i < noOfStates; i++) {
nameSerializer.deserialize(in);
stateTypeSerializer.deserialize(in);
}
for (int i = 0; i < noOfStates; i++) {
String srcName = nameSerializer.deserialize(in);
int noOfTransitions = in.readInt();
for (int j = 0; j < noOfTransitions; j++) {
String src = nameSerializer.deserialize(in);
Preconditions.checkState(src.equals(srcName),
"Source Edge names do not match (" + srcName + " - " + src + ").");
nameSerializer.deserialize(in);
actionSerializer.deserialize(in);
try {
skipCondition(in);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
} | java | static void skipSerializedStates(DataInputView in) throws IOException {
TypeSerializer<String> nameSerializer = StringSerializer.INSTANCE;
TypeSerializer<State.StateType> stateTypeSerializer = new EnumSerializer<>(State.StateType.class);
TypeSerializer<StateTransitionAction> actionSerializer = new EnumSerializer<>(StateTransitionAction.class);
final int noOfStates = in.readInt();
for (int i = 0; i < noOfStates; i++) {
nameSerializer.deserialize(in);
stateTypeSerializer.deserialize(in);
}
for (int i = 0; i < noOfStates; i++) {
String srcName = nameSerializer.deserialize(in);
int noOfTransitions = in.readInt();
for (int j = 0; j < noOfTransitions; j++) {
String src = nameSerializer.deserialize(in);
Preconditions.checkState(src.equals(srcName),
"Source Edge names do not match (" + srcName + " - " + src + ").");
nameSerializer.deserialize(in);
actionSerializer.deserialize(in);
try {
skipCondition(in);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
} | [
"static",
"void",
"skipSerializedStates",
"(",
"DataInputView",
"in",
")",
"throws",
"IOException",
"{",
"TypeSerializer",
"<",
"String",
">",
"nameSerializer",
"=",
"StringSerializer",
".",
"INSTANCE",
";",
"TypeSerializer",
"<",
"State",
".",
"StateType",
">",
"... | Skips bytes corresponding to serialized states. In flink 1.6+ the states are no longer kept in state. | [
"Skips",
"bytes",
"corresponding",
"to",
"serialized",
"states",
".",
"In",
"flink",
"1",
".",
"6",
"+",
"the",
"states",
"are",
"no",
"longer",
"kept",
"in",
"state",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/MigrationUtils.java#L44-L75 | train | Skips serialized states. | [
30522,
10763,
11675,
13558,
8043,
4818,
3550,
9153,
4570,
1006,
2951,
2378,
18780,
8584,
1999,
1007,
11618,
22834,
10288,
24422,
1063,
4127,
11610,
28863,
1026,
5164,
1028,
3415,
11610,
28863,
1027,
7817,
11610,
28863,
1012,
6013,
1025,
4127,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/DataStream.java | DataStream.assignTimestampsAndWatermarks | public SingleOutputStreamOperator<T> assignTimestampsAndWatermarks(
AssignerWithPeriodicWatermarks<T> timestampAndWatermarkAssigner) {
// match parallelism to input, otherwise dop=1 sources could lead to some strange
// behaviour: the watermark will creep along very slowly because the elements
// from the source go to each extraction operator round robin.
final int inputParallelism = getTransformation().getParallelism();
final AssignerWithPeriodicWatermarks<T> cleanedAssigner = clean(timestampAndWatermarkAssigner);
TimestampsAndPeriodicWatermarksOperator<T> operator =
new TimestampsAndPeriodicWatermarksOperator<>(cleanedAssigner);
return transform("Timestamps/Watermarks", getTransformation().getOutputType(), operator)
.setParallelism(inputParallelism);
} | java | public SingleOutputStreamOperator<T> assignTimestampsAndWatermarks(
AssignerWithPeriodicWatermarks<T> timestampAndWatermarkAssigner) {
// match parallelism to input, otherwise dop=1 sources could lead to some strange
// behaviour: the watermark will creep along very slowly because the elements
// from the source go to each extraction operator round robin.
final int inputParallelism = getTransformation().getParallelism();
final AssignerWithPeriodicWatermarks<T> cleanedAssigner = clean(timestampAndWatermarkAssigner);
TimestampsAndPeriodicWatermarksOperator<T> operator =
new TimestampsAndPeriodicWatermarksOperator<>(cleanedAssigner);
return transform("Timestamps/Watermarks", getTransformation().getOutputType(), operator)
.setParallelism(inputParallelism);
} | [
"public",
"SingleOutputStreamOperator",
"<",
"T",
">",
"assignTimestampsAndWatermarks",
"(",
"AssignerWithPeriodicWatermarks",
"<",
"T",
">",
"timestampAndWatermarkAssigner",
")",
"{",
"// match parallelism to input, otherwise dop=1 sources could lead to some strange",
"// behaviour: t... | Assigns timestamps to the elements in the data stream and periodically creates
watermarks to signal event time progress.
<p>This method creates watermarks periodically (for example every second), based
on the watermarks indicated by the given watermark generator. Even when no new elements
in the stream arrive, the given watermark generator will be periodically checked for
new watermarks. The interval in which watermarks are generated is defined in
{@link ExecutionConfig#setAutoWatermarkInterval(long)}.
<p>Use this method for the common cases, where some characteristic over all elements
should generate the watermarks, or where watermarks are simply trailing behind the
wall clock time by a certain amount.
<p>For the second case and when the watermarks are required to lag behind the maximum
timestamp seen so far in the elements of the stream by a fixed amount of time, and this
amount is known in advance, use the
{@link BoundedOutOfOrdernessTimestampExtractor}.
<p>For cases where watermarks should be created in an irregular fashion, for example
based on certain markers that some element carry, use the
{@link AssignerWithPunctuatedWatermarks}.
@param timestampAndWatermarkAssigner The implementation of the timestamp assigner and
watermark generator.
@return The stream after the transformation, with assigned timestamps and watermarks.
@see AssignerWithPeriodicWatermarks
@see AssignerWithPunctuatedWatermarks
@see #assignTimestampsAndWatermarks(AssignerWithPunctuatedWatermarks) | [
"Assigns",
"timestamps",
"to",
"the",
"elements",
"in",
"the",
"data",
"stream",
"and",
"periodically",
"creates",
"watermarks",
"to",
"signal",
"event",
"time",
"progress",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L883-L897 | train | Assigns timestamps to the output stream. | [
30522,
2270,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1056,
1028,
23911,
7292,
9153,
25370,
5685,
5880,
27373,
1006,
23911,
2121,
24415,
4842,
3695,
14808,
5880,
27373,
1026,
1056,
1028,
2335,
15464,
9739,
2094,
5880,
10665,
12054,
23773,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/BinTrie.java | BinTrie.keySet | public Set<String> keySet()
{
TreeSet<String> keySet = new TreeSet<String>();
for (Map.Entry<String, V> entry : entrySet())
{
keySet.add(entry.getKey());
}
return keySet;
} | java | public Set<String> keySet()
{
TreeSet<String> keySet = new TreeSet<String>();
for (Map.Entry<String, V> entry : entrySet())
{
keySet.add(entry.getKey());
}
return keySet;
} | [
"public",
"Set",
"<",
"String",
">",
"keySet",
"(",
")",
"{",
"TreeSet",
"<",
"String",
">",
"keySet",
"=",
"new",
"TreeSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"V",
">",
"entry",
":",
"entrySe... | 键集合
@return | [
"键集合"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java#L201-L210 | train | Get a set of all the key elements in this map. | [
30522,
2270,
2275,
1026,
5164,
1028,
6309,
3388,
1006,
1007,
1063,
3628,
3388,
1026,
5164,
1028,
6309,
3388,
1027,
2047,
3628,
3388,
1026,
5164,
1028,
1006,
1007,
1025,
2005,
1006,
4949,
1012,
4443,
1026,
5164,
1010,
1058,
1028,
4443,
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/incubator-shardingsphere | sharding-proxy/sharding-proxy-bootstrap/src/main/java/org/apache/shardingsphere/shardingproxy/Bootstrap.java | Bootstrap.main | public static void main(final String[] args) throws IOException {
ShardingConfiguration shardingConfig = new ShardingConfigurationLoader().load();
int port = getPort(args);
if (null == shardingConfig.getServerConfiguration().getOrchestration()) {
startWithoutRegistryCenter(shardingConfig.getRuleConfigurationMap(), shardingConfig.getServerConfiguration().getAuthentication(), shardingConfig.getServerConfiguration().getProps(), port);
} else {
startWithRegistryCenter(shardingConfig.getServerConfiguration(), shardingConfig.getRuleConfigurationMap().keySet(), shardingConfig.getRuleConfigurationMap(), port);
}
} | java | public static void main(final String[] args) throws IOException {
ShardingConfiguration shardingConfig = new ShardingConfigurationLoader().load();
int port = getPort(args);
if (null == shardingConfig.getServerConfiguration().getOrchestration()) {
startWithoutRegistryCenter(shardingConfig.getRuleConfigurationMap(), shardingConfig.getServerConfiguration().getAuthentication(), shardingConfig.getServerConfiguration().getProps(), port);
} else {
startWithRegistryCenter(shardingConfig.getServerConfiguration(), shardingConfig.getRuleConfigurationMap().keySet(), shardingConfig.getRuleConfigurationMap(), port);
}
} | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"ShardingConfiguration",
"shardingConfig",
"=",
"new",
"ShardingConfigurationLoader",
"(",
")",
".",
"load",
"(",
")",
";",
"int",
"port",
"=",
"... | Main entrance.
@param args startup arguments
@throws IOException IO exception | [
"Main",
"entrance",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-bootstrap/src/main/java/org/apache/shardingsphere/shardingproxy/Bootstrap.java#L69-L77 | train | Main method for the sharding application. | [
30522,
2270,
10763,
11675,
2364,
1006,
2345,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
22834,
10288,
24422,
1063,
21146,
17080,
3070,
8663,
8873,
27390,
3370,
21146,
17080,
3070,
8663,
8873,
2290,
1027,
2047,
21146,
17080,
3070,
8663,
8873,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/ReferenceCountUtil.java | ReferenceCountUtil.safeRelease | public static void safeRelease(Object msg) {
try {
release(msg);
} catch (Throwable t) {
logger.warn("Failed to release a message: {}", msg, t);
}
} | java | public static void safeRelease(Object msg) {
try {
release(msg);
} catch (Throwable t) {
logger.warn("Failed to release a message: {}", msg, t);
}
} | [
"public",
"static",
"void",
"safeRelease",
"(",
"Object",
"msg",
")",
"{",
"try",
"{",
"release",
"(",
"msg",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Failed to release a message: {}\"",
",",
"msg",
",",
"t"... | Try to call {@link ReferenceCounted#release()} if the specified message implements {@link ReferenceCounted}.
If the specified message doesn't implement {@link ReferenceCounted}, this method does nothing.
Unlike {@link #release(Object)} this method catches an exception raised by {@link ReferenceCounted#release()}
and logs it, rather than rethrowing it to the caller. It is usually recommended to use {@link #release(Object)}
instead, unless you absolutely need to swallow an exception. | [
"Try",
"to",
"call",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ReferenceCountUtil.java#L111-L117 | train | Release a message. | [
30522,
2270,
10763,
11675,
13726,
12260,
11022,
1006,
4874,
5796,
2290,
1007,
1063,
3046,
1063,
2713,
1006,
5796,
2290,
1007,
1025,
1065,
4608,
1006,
5466,
3085,
1056,
1007,
1063,
8833,
4590,
1012,
11582,
1006,
1000,
3478,
2000,
2713,
1037,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/table/descriptors/Kafka.java | Kafka.startFromSpecificOffsets | public Kafka startFromSpecificOffsets(Map<Integer, Long> specificOffsets) {
this.startupMode = StartupMode.SPECIFIC_OFFSETS;
this.specificOffsets = Preconditions.checkNotNull(specificOffsets);
return this;
} | java | public Kafka startFromSpecificOffsets(Map<Integer, Long> specificOffsets) {
this.startupMode = StartupMode.SPECIFIC_OFFSETS;
this.specificOffsets = Preconditions.checkNotNull(specificOffsets);
return this;
} | [
"public",
"Kafka",
"startFromSpecificOffsets",
"(",
"Map",
"<",
"Integer",
",",
"Long",
">",
"specificOffsets",
")",
"{",
"this",
".",
"startupMode",
"=",
"StartupMode",
".",
"SPECIFIC_OFFSETS",
";",
"this",
".",
"specificOffsets",
"=",
"Preconditions",
".",
"ch... | Configures to start reading partitions from specific offsets, set independently for each partition.
Resets previously set offsets.
@param specificOffsets the specified offsets for partitions
@see FlinkKafkaConsumerBase#setStartFromSpecificOffsets(Map) | [
"Configures",
"to",
"start",
"reading",
"partitions",
"from",
"specific",
"offsets",
"set",
"independently",
"for",
"each",
"partition",
".",
"Resets",
"previously",
"set",
"offsets",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/table/descriptors/Kafka.java#L163-L167 | train | Start Kafka from specific offsets. | [
30522,
2270,
10556,
24316,
2050,
2707,
19699,
22225,
5051,
6895,
8873,
3597,
21807,
8454,
1006,
4949,
1026,
16109,
1010,
2146,
1028,
3563,
27475,
8454,
1007,
1063,
2023,
1012,
22752,
5302,
3207,
1027,
22752,
5302,
3207,
1012,
3563,
1035,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumer08.java | FlinkKafkaConsumer08.validateZooKeeperConfig | protected static void validateZooKeeperConfig(Properties props) {
if (props.getProperty("zookeeper.connect") == null) {
throw new IllegalArgumentException("Required property 'zookeeper.connect' has not been set in the properties");
}
if (props.getProperty(ConsumerConfig.GROUP_ID_CONFIG) == null) {
throw new IllegalArgumentException("Required property '" + ConsumerConfig.GROUP_ID_CONFIG
+ "' has not been set in the properties");
}
try {
//noinspection ResultOfMethodCallIgnored
Integer.parseInt(props.getProperty("zookeeper.session.timeout.ms", "0"));
}
catch (NumberFormatException e) {
throw new IllegalArgumentException("Property 'zookeeper.session.timeout.ms' is not a valid integer");
}
try {
//noinspection ResultOfMethodCallIgnored
Integer.parseInt(props.getProperty("zookeeper.connection.timeout.ms", "0"));
}
catch (NumberFormatException e) {
throw new IllegalArgumentException("Property 'zookeeper.connection.timeout.ms' is not a valid integer");
}
} | java | protected static void validateZooKeeperConfig(Properties props) {
if (props.getProperty("zookeeper.connect") == null) {
throw new IllegalArgumentException("Required property 'zookeeper.connect' has not been set in the properties");
}
if (props.getProperty(ConsumerConfig.GROUP_ID_CONFIG) == null) {
throw new IllegalArgumentException("Required property '" + ConsumerConfig.GROUP_ID_CONFIG
+ "' has not been set in the properties");
}
try {
//noinspection ResultOfMethodCallIgnored
Integer.parseInt(props.getProperty("zookeeper.session.timeout.ms", "0"));
}
catch (NumberFormatException e) {
throw new IllegalArgumentException("Property 'zookeeper.session.timeout.ms' is not a valid integer");
}
try {
//noinspection ResultOfMethodCallIgnored
Integer.parseInt(props.getProperty("zookeeper.connection.timeout.ms", "0"));
}
catch (NumberFormatException e) {
throw new IllegalArgumentException("Property 'zookeeper.connection.timeout.ms' is not a valid integer");
}
} | [
"protected",
"static",
"void",
"validateZooKeeperConfig",
"(",
"Properties",
"props",
")",
"{",
"if",
"(",
"props",
".",
"getProperty",
"(",
"\"zookeeper.connect\"",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Required property '... | Validate the ZK configuration, checking for required parameters.
@param props Properties to check | [
"Validate",
"the",
"ZK",
"configuration",
"checking",
"for",
"required",
"parameters",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumer08.java#L293-L317 | train | Validate ZooKeeper configuration. | [
30522,
5123,
10763,
11675,
9398,
3686,
23221,
13106,
8663,
8873,
2290,
1006,
5144,
24387,
1007,
1063,
2065,
1006,
24387,
1012,
2131,
21572,
4842,
3723,
1006,
1000,
9201,
13106,
1012,
7532,
1000,
1007,
1027,
1027,
19701,
1007,
1063,
5466,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getUlong48 | public final long getUlong48(final int pos) {
final int position = origin + pos;
if (pos + 5 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 5)));
byte[] buf = buffer;
return ((long) (0xff & buf[position])) | ((long) (0xff & buf[position + 1]) << 8)
| ((long) (0xff & buf[position + 2]) << 16) | ((long) (0xff & buf[position + 3]) << 24)
| ((long) (0xff & buf[position + 4]) << 32) | ((long) (0xff & buf[position + 5]) << 40);
} | java | public final long getUlong48(final int pos) {
final int position = origin + pos;
if (pos + 5 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 5)));
byte[] buf = buffer;
return ((long) (0xff & buf[position])) | ((long) (0xff & buf[position + 1]) << 8)
| ((long) (0xff & buf[position + 2]) << 16) | ((long) (0xff & buf[position + 3]) << 24)
| ((long) (0xff & buf[position + 4]) << 32) | ((long) (0xff & buf[position + 5]) << 40);
} | [
"public",
"final",
"long",
"getUlong48",
"(",
"final",
"int",
"pos",
")",
"{",
"final",
"int",
"position",
"=",
"origin",
"+",
"pos",
";",
"if",
"(",
"pos",
"+",
"5",
">=",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException"... | Return 48-bit unsigned long from buffer. (little-endian)
@see mysql-5.1.60/include/my_global.h - uint6korr | [
"Return",
"48",
"-",
"bit",
"unsigned",
"long",
"from",
"buffer",
".",
"(",
"little",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L713-L723 | train | Gets a long from the buffer at the given position in the buffer as an long. | [
30522,
2270,
2345,
2146,
2131,
18845,
3070,
18139,
1006,
2345,
20014,
13433,
2015,
1007,
1063,
2345,
20014,
2597,
1027,
4761,
1009,
13433,
2015,
1025,
2065,
1006,
13433,
2015,
1009,
1019,
1028,
1027,
5787,
1064,
1064,
13433,
2015,
1026,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.divisor | public static int divisor(int m, int n) {
while (m % n != 0) {
int temp = m % n;
m = n;
n = temp;
}
return n;
} | java | public static int divisor(int m, int n) {
while (m % n != 0) {
int temp = m % n;
m = n;
n = temp;
}
return n;
} | [
"public",
"static",
"int",
"divisor",
"(",
"int",
"m",
",",
"int",
"n",
")",
"{",
"while",
"(",
"m",
"%",
"n",
"!=",
"0",
")",
"{",
"int",
"temp",
"=",
"m",
"%",
"n",
";",
"m",
"=",
"n",
";",
"n",
"=",
"temp",
";",
"}",
"return",
"n",
";"... | 最大公约数
@param m 第一个值
@param n 第二个值
@return 最大公约数 | [
"最大公约数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L1451-L1458 | train | Returns the divisor of m with n. | [
30522,
2270,
10763,
20014,
4487,
11365,
2953,
1006,
20014,
1049,
1010,
20014,
1050,
1007,
1063,
2096,
1006,
1049,
1003,
1050,
999,
1027,
1014,
1007,
1063,
20014,
8915,
8737,
1027,
1049,
1003,
1050,
1025,
1049,
1027,
1050,
1025,
1050,
1027,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/GroupedMap.java | GroupedMap.containsValue | public boolean containsValue(String group, String value) {
group = StrUtil.nullToEmpty(group).trim();
readLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
return valueMap.containsValue(value);
}
} finally {
readLock.unlock();
}
return false;
} | java | public boolean containsValue(String group, String value) {
group = StrUtil.nullToEmpty(group).trim();
readLock.lock();
try {
final LinkedHashMap<String, String> valueMap = this.get(group);
if (MapUtil.isNotEmpty(valueMap)) {
return valueMap.containsValue(value);
}
} finally {
readLock.unlock();
}
return false;
} | [
"public",
"boolean",
"containsValue",
"(",
"String",
"group",
",",
"String",
"value",
")",
"{",
"group",
"=",
"StrUtil",
".",
"nullToEmpty",
"(",
"group",
")",
".",
"trim",
"(",
")",
";",
"readLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"final",
"... | 指定分组中是否包含指定值
@param group 分组
@param value 值
@return 是否包含值 | [
"指定分组中是否包含指定值"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/GroupedMap.java#L198-L210 | train | Checks if the specified group contains the specified value. | [
30522,
2270,
22017,
20898,
3397,
10175,
5657,
1006,
5164,
2177,
1010,
5164,
3643,
1007,
1063,
2177,
1027,
2358,
22134,
4014,
1012,
19701,
3406,
6633,
13876,
2100,
1006,
2177,
1007,
1012,
12241,
1006,
1007,
1025,
3191,
7878,
1012,
5843,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java | DataStream.writeToSocket | @PublicEvolving
public DataStreamSink<T> writeToSocket(String hostName, int port, SerializationSchema<T> schema) {
DataStreamSink<T> returnStream = addSink(new SocketClientSink<>(hostName, port, schema, 0));
returnStream.setParallelism(1); // It would not work if multiple instances would connect to the same port
return returnStream;
} | java | @PublicEvolving
public DataStreamSink<T> writeToSocket(String hostName, int port, SerializationSchema<T> schema) {
DataStreamSink<T> returnStream = addSink(new SocketClientSink<>(hostName, port, schema, 0));
returnStream.setParallelism(1); // It would not work if multiple instances would connect to the same port
return returnStream;
} | [
"@",
"PublicEvolving",
"public",
"DataStreamSink",
"<",
"T",
">",
"writeToSocket",
"(",
"String",
"hostName",
",",
"int",
"port",
",",
"SerializationSchema",
"<",
"T",
">",
"schema",
")",
"{",
"DataStreamSink",
"<",
"T",
">",
"returnStream",
"=",
"addSink",
... | Writes the DataStream to a socket as a byte array. The format of the
output is specified by a {@link SerializationSchema}.
@param hostName
host of the socket
@param port
port of the socket
@param schema
schema for serialization
@return the closed DataStream | [
"Writes",
"the",
"DataStream",
"to",
"a",
"socket",
"as",
"a",
"byte",
"array",
".",
"The",
"format",
"of",
"the",
"output",
"is",
"specified",
"by",
"a",
"{",
"@link",
"SerializationSchema",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L1139-L1144 | train | Write to socket. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
2951,
21422,
11493,
2243,
1026,
1056,
1028,
4339,
13122,
7432,
3388,
1006,
5164,
3677,
18442,
1010,
20014,
3417,
1010,
7642,
22318,
5403,
2863,
1026,
1056,
1028,
8040,
28433,
1007,
1063,
2951,
2142... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java | DateTimeUtils.addMonths | public static long addMonths(long timestamp, int m) {
final long millis =
DateTimeUtils.floorMod(timestamp, DateTimeUtils.MILLIS_PER_DAY);
timestamp -= millis;
final long x =
addMonths((int) (timestamp / DateTimeUtils.MILLIS_PER_DAY), m);
return x * DateTimeUtils.MILLIS_PER_DAY + millis;
} | java | public static long addMonths(long timestamp, int m) {
final long millis =
DateTimeUtils.floorMod(timestamp, DateTimeUtils.MILLIS_PER_DAY);
timestamp -= millis;
final long x =
addMonths((int) (timestamp / DateTimeUtils.MILLIS_PER_DAY), m);
return x * DateTimeUtils.MILLIS_PER_DAY + millis;
} | [
"public",
"static",
"long",
"addMonths",
"(",
"long",
"timestamp",
",",
"int",
"m",
")",
"{",
"final",
"long",
"millis",
"=",
"DateTimeUtils",
".",
"floorMod",
"(",
"timestamp",
",",
"DateTimeUtils",
".",
"MILLIS_PER_DAY",
")",
";",
"timestamp",
"-=",
"milli... | Adds a given number of months to a timestamp, represented as the number
of milliseconds since the epoch. | [
"Adds",
"a",
"given",
"number",
"of",
"months",
"to",
"a",
"timestamp",
"represented",
"as",
"the",
"number",
"of",
"milliseconds",
"since",
"the",
"epoch",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java#L1059-L1066 | train | Add months to a timestamp. | [
30522,
2270,
10763,
2146,
5587,
9629,
7898,
1006,
2146,
2335,
15464,
2361,
1010,
20014,
1049,
1007,
1063,
2345,
2146,
4971,
2483,
1027,
3058,
7292,
21823,
4877,
1012,
2723,
5302,
2094,
1006,
2335,
15464,
2361,
1010,
3058,
7292,
21823,
4877,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/common/WordNet.java | WordNet.clean | public void clean()
{
for (List<Vertex> vertexList : vertexes)
{
for (Vertex vertex : vertexList)
{
vertex.from = null;
}
}
} | java | public void clean()
{
for (List<Vertex> vertexList : vertexes)
{
for (Vertex vertex : vertexList)
{
vertex.from = null;
}
}
} | [
"public",
"void",
"clean",
"(",
")",
"{",
"for",
"(",
"List",
"<",
"Vertex",
">",
"vertexList",
":",
"vertexes",
")",
"{",
"for",
"(",
"Vertex",
"vertex",
":",
"vertexList",
")",
"{",
"vertex",
".",
"from",
"=",
"null",
";",
"}",
"}",
"}"
] | 清理from属性 | [
"清理from属性"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/WordNet.java#L406-L415 | train | Clean up the RAID SEGMENTS. | [
30522,
2270,
11675,
4550,
1006,
1007,
1063,
2005,
1006,
2862,
1026,
19449,
1028,
19449,
9863,
1024,
19449,
2229,
1007,
1063,
2005,
1006,
19449,
19449,
1024,
19449,
9863,
1007,
1063,
19449,
1012,
2013,
1027,
19701,
1025,
1065,
1065,
1065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java | NetUtil.getMacAddress | public static String getMacAddress(InetAddress inetAddress, String separator) {
if (null == inetAddress) {
return null;
}
byte[] mac;
try {
mac = NetworkInterface.getByInetAddress(inetAddress).getHardwareAddress();
} catch (SocketException e) {
throw new UtilException(e);
}
if (null != mac) {
final StringBuilder sb = new StringBuilder();
String s;
for (int i = 0; i < mac.length; i++) {
if (i != 0) {
sb.append(separator);
}
// 字节转换为整数
s = Integer.toHexString(mac[i] & 0xFF);
sb.append(s.length() == 1 ? 0 + s : s);
}
return sb.toString();
}
return null;
} | java | public static String getMacAddress(InetAddress inetAddress, String separator) {
if (null == inetAddress) {
return null;
}
byte[] mac;
try {
mac = NetworkInterface.getByInetAddress(inetAddress).getHardwareAddress();
} catch (SocketException e) {
throw new UtilException(e);
}
if (null != mac) {
final StringBuilder sb = new StringBuilder();
String s;
for (int i = 0; i < mac.length; i++) {
if (i != 0) {
sb.append(separator);
}
// 字节转换为整数
s = Integer.toHexString(mac[i] & 0xFF);
sb.append(s.length() == 1 ? 0 + s : s);
}
return sb.toString();
}
return null;
} | [
"public",
"static",
"String",
"getMacAddress",
"(",
"InetAddress",
"inetAddress",
",",
"String",
"separator",
")",
"{",
"if",
"(",
"null",
"==",
"inetAddress",
")",
"{",
"return",
"null",
";",
"}",
"byte",
"[",
"]",
"mac",
";",
"try",
"{",
"mac",
"=",
... | 获得指定地址信息中的MAC地址
@param inetAddress {@link InetAddress}
@param separator 分隔符,推荐使用“-”或者“:”
@return MAC地址,用-分隔 | [
"获得指定地址信息中的MAC地址"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L432-L457 | train | Gets the MAC address from an inet address. | [
30522,
2270,
10763,
5164,
2131,
22911,
4215,
16200,
4757,
1006,
1999,
12928,
14141,
8303,
1999,
12928,
14141,
8303,
1010,
5164,
19802,
25879,
2953,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
1999,
12928,
14141,
8303,
1007,
1063,
2709,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.pathEndsWith | public static boolean pathEndsWith(File file, String suffix) {
return file.getPath().toLowerCase().endsWith(suffix);
} | java | public static boolean pathEndsWith(File file, String suffix) {
return file.getPath().toLowerCase().endsWith(suffix);
} | [
"public",
"static",
"boolean",
"pathEndsWith",
"(",
"File",
"file",
",",
"String",
"suffix",
")",
"{",
"return",
"file",
".",
"getPath",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"suffix",
")",
";",
"}"
] | 判断文件路径是否有指定后缀,忽略大小写<br>
常用语判断扩展名
@param file 文件或目录
@param suffix 后缀
@return 是否有指定后缀 | [
"判断文件路径是否有指定后缀,忽略大小写<br",
">",
"常用语判断扩展名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1845-L1847 | train | Checks if the path ends with the given suffix. | [
30522,
2270,
10763,
22017,
20898,
4130,
10497,
26760,
8939,
1006,
5371,
5371,
1010,
5164,
16809,
1007,
1063,
2709,
5371,
1012,
2131,
15069,
1006,
1007,
1012,
2000,
27663,
18992,
3366,
1006,
1007,
1012,
4515,
24415,
1006,
16809,
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-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonIterativeStream.java | PythonIterativeStream.close_with | public PythonDataStream close_with(PythonDataStream<? extends DataStream<PyObject>> feedback_stream) {
((IterativeStream<PyObject>) this.stream).closeWith(feedback_stream.stream);
return feedback_stream;
} | java | public PythonDataStream close_with(PythonDataStream<? extends DataStream<PyObject>> feedback_stream) {
((IterativeStream<PyObject>) this.stream).closeWith(feedback_stream.stream);
return feedback_stream;
} | [
"public",
"PythonDataStream",
"close_with",
"(",
"PythonDataStream",
"<",
"?",
"extends",
"DataStream",
"<",
"PyObject",
">",
">",
"feedback_stream",
")",
"{",
"(",
"(",
"IterativeStream",
"<",
"PyObject",
">",
")",
"this",
".",
"stream",
")",
".",
"closeWith"... | A thin wrapper layer over {@link IterativeStream#closeWith(org.apache.flink.streaming.api.datastream.DataStream)}
<p>Please note that this function works with {@link PythonDataStream} and thus wherever a DataStream is mentioned in
the above {@link IterativeStream#closeWith(org.apache.flink.streaming.api.datastream.DataStream)} description,
the user may regard it as {@link PythonDataStream} .
@param feedback_stream {@link PythonDataStream} that will be used as input to the iteration
head.
@return The feedback stream. | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"IterativeStream#closeWith",
"(",
"org",
".",
"apache",
".",
"flink",
".",
"streaming",
".",
"api",
".",
"datastream",
".",
"DataStream",
")",
"}"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonIterativeStream.java#L51-L54 | train | Close the given data stream and return the new data stream. | [
30522,
2270,
18750,
2850,
10230,
25379,
2485,
1035,
2007,
1006,
18750,
2850,
10230,
25379,
1026,
1029,
8908,
2951,
21422,
1026,
1052,
7677,
2497,
20614,
1028,
1028,
12247,
1035,
5460,
1007,
1063,
1006,
1006,
2009,
25284,
21422,
1026,
1052,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AbstractDependencyParser.java | AbstractDependencyParser.setDeprelTranslater | public IDependencyParser setDeprelTranslater(String deprelTranslatorPath)
{
deprelTranslater = GlobalObjectPool.get(deprelTranslatorPath);
if (deprelTranslater != null) return this;
IOUtil.LineIterator iterator = new IOUtil.LineIterator(deprelTranslatorPath);
deprelTranslater = new TreeMap<String, String>();
while (iterator.hasNext())
{
String[] args = iterator.next().split("\\s");
deprelTranslater.put(args[0], args[1]);
}
if (deprelTranslater.size() == 0)
{
deprelTranslater = null;
}
GlobalObjectPool.put(deprelTranslatorPath, deprelTranslater);
return this;
} | java | public IDependencyParser setDeprelTranslater(String deprelTranslatorPath)
{
deprelTranslater = GlobalObjectPool.get(deprelTranslatorPath);
if (deprelTranslater != null) return this;
IOUtil.LineIterator iterator = new IOUtil.LineIterator(deprelTranslatorPath);
deprelTranslater = new TreeMap<String, String>();
while (iterator.hasNext())
{
String[] args = iterator.next().split("\\s");
deprelTranslater.put(args[0], args[1]);
}
if (deprelTranslater.size() == 0)
{
deprelTranslater = null;
}
GlobalObjectPool.put(deprelTranslatorPath, deprelTranslater);
return this;
} | [
"public",
"IDependencyParser",
"setDeprelTranslater",
"(",
"String",
"deprelTranslatorPath",
")",
"{",
"deprelTranslater",
"=",
"GlobalObjectPool",
".",
"get",
"(",
"deprelTranslatorPath",
")",
";",
"if",
"(",
"deprelTranslater",
"!=",
"null",
")",
"return",
"this",
... | 设置映射表
@param deprelTranslatorPath 映射表路径
@return | [
"设置映射表"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/AbstractDependencyParser.java#L99-L118 | train | Set the deprel translator. | [
30522,
2270,
8909,
13699,
10497,
11916,
19362,
8043,
2275,
3207,
28139,
7096,
5521,
14540,
24932,
1006,
5164,
2139,
28139,
7096,
5521,
14540,
8844,
15069,
1007,
1063,
2139,
30524,
1027,
2047,
22834,
21823,
2140,
1012,
2240,
21646,
8844,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/maxent/MaxEntModel.java | MaxEntModel.eval | public static double[] eval(int[] context, double[] prior, EvalParameters model)
{
Context[] params = model.getParams();
int numfeats[] = new int[model.getNumOutcomes()];
int[] activeOutcomes;
double[] activeParameters;
double value = 1;
for (int ci = 0; ci < context.length; ci++)
{
if (context[ci] >= 0)
{
Context predParams = params[context[ci]];
activeOutcomes = predParams.getOutcomes();
activeParameters = predParams.getParameters();
for (int ai = 0; ai < activeOutcomes.length; ai++)
{
int oid = activeOutcomes[ai];
numfeats[oid]++;
prior[oid] += activeParameters[ai] * value;
}
}
}
double normal = 0.0;
for (int oid = 0; oid < model.getNumOutcomes(); oid++)
{
if (model.getCorrectionParam() != 0)
{
prior[oid] = Math
.exp(prior[oid]
* model.getConstantInverse()
+ ((1.0 - ((double) numfeats[oid] / model
.getCorrectionConstant())) * model.getCorrectionParam()));
}
else
{
prior[oid] = Math.exp(prior[oid] * model.getConstantInverse());
}
normal += prior[oid];
}
for (int oid = 0; oid < model.getNumOutcomes(); oid++)
{
prior[oid] /= normal;
}
return prior;
} | java | public static double[] eval(int[] context, double[] prior, EvalParameters model)
{
Context[] params = model.getParams();
int numfeats[] = new int[model.getNumOutcomes()];
int[] activeOutcomes;
double[] activeParameters;
double value = 1;
for (int ci = 0; ci < context.length; ci++)
{
if (context[ci] >= 0)
{
Context predParams = params[context[ci]];
activeOutcomes = predParams.getOutcomes();
activeParameters = predParams.getParameters();
for (int ai = 0; ai < activeOutcomes.length; ai++)
{
int oid = activeOutcomes[ai];
numfeats[oid]++;
prior[oid] += activeParameters[ai] * value;
}
}
}
double normal = 0.0;
for (int oid = 0; oid < model.getNumOutcomes(); oid++)
{
if (model.getCorrectionParam() != 0)
{
prior[oid] = Math
.exp(prior[oid]
* model.getConstantInverse()
+ ((1.0 - ((double) numfeats[oid] / model
.getCorrectionConstant())) * model.getCorrectionParam()));
}
else
{
prior[oid] = Math.exp(prior[oid] * model.getConstantInverse());
}
normal += prior[oid];
}
for (int oid = 0; oid < model.getNumOutcomes(); oid++)
{
prior[oid] /= normal;
}
return prior;
} | [
"public",
"static",
"double",
"[",
"]",
"eval",
"(",
"int",
"[",
"]",
"context",
",",
"double",
"[",
"]",
"prior",
",",
"EvalParameters",
"model",
")",
"{",
"Context",
"[",
"]",
"params",
"=",
"model",
".",
"getParams",
"(",
")",
";",
"int",
"numfeat... | 预测
@param context 环境
@param prior 先验概率
@param model 特征函数
@return | [
"预测"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/maxent/MaxEntModel.java#L148-L194 | train | Evaluate a single context and prior matrix. | [
30522,
2270,
10763,
3313,
1031,
1033,
9345,
2140,
1006,
20014,
1031,
1033,
6123,
1010,
3313,
1031,
1033,
3188,
1010,
9345,
14277,
5400,
22828,
2015,
2944,
1007,
1063,
6123,
1031,
1033,
11498,
5244,
1027,
2944,
1012,
2131,
28689,
5244,
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 | sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TRow.java | TRow.isSet | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COL_VALS:
return isSetColVals();
}
throw new IllegalStateException();
} | java | public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COL_VALS:
return isSetColVals();
}
throw new IllegalStateException();
} | [
"public",
"boolean",
"isSet",
"(",
"_Fields",
"field",
")",
"{",
"if",
"(",
"field",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"switch",
"(",
"field",
")",
"{",
"case",
"COL_VALS",
":",
"return",
"isSetColVal... | Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise | [
"Returns",
"true",
"if",
"field",
"corresponding",
"to",
"fieldID",
"is",
"set",
"(",
"has",
"been",
"assigned",
"a",
"value",
")",
"and",
"false",
"otherwise"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TRow.java#L209-L219 | train | Checks if the specified field is set to a value. | [
30522,
2270,
22017,
20898,
26354,
3388,
1006,
1035,
4249,
2492,
1007,
1063,
2065,
1006,
2492,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1007,
1025,
1065,
6942,
1006,
2492,
1007,
1063,
2553,
8902... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java | CLIService.getInfo | @Override
public GetInfoValue getInfo(SessionHandle sessionHandle, GetInfoType getInfoType)
throws HiveSQLException {
GetInfoValue infoValue = sessionManager.getSession(sessionHandle)
.getInfo(getInfoType);
LOG.debug(sessionHandle + ": getInfo()");
return infoValue;
} | java | @Override
public GetInfoValue getInfo(SessionHandle sessionHandle, GetInfoType getInfoType)
throws HiveSQLException {
GetInfoValue infoValue = sessionManager.getSession(sessionHandle)
.getInfo(getInfoType);
LOG.debug(sessionHandle + ": getInfo()");
return infoValue;
} | [
"@",
"Override",
"public",
"GetInfoValue",
"getInfo",
"(",
"SessionHandle",
"sessionHandle",
",",
"GetInfoType",
"getInfoType",
")",
"throws",
"HiveSQLException",
"{",
"GetInfoValue",
"infoValue",
"=",
"sessionManager",
".",
"getSession",
"(",
"sessionHandle",
")",
".... | /* (non-Javadoc)
@see org.apache.hive.service.cli.ICLIService#getInfo(org.apache.hive.service.cli.SessionHandle, java.util.List) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java#L244-L251 | train | Get the info value for the given session handle. | [
30522,
1030,
2058,
15637,
2270,
2131,
2378,
14876,
10175,
5657,
2131,
2378,
14876,
1006,
5219,
11774,
2571,
5219,
11774,
2571,
1010,
2131,
2378,
14876,
13874,
2131,
2378,
14876,
13874,
1007,
11618,
26736,
2015,
4160,
2571,
2595,
24422,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/state/ImmutableMapState.java | ImmutableMapState.entries | @Override
public Iterable<Map.Entry<K, V>> entries() {
return Collections.unmodifiableSet(state.entrySet());
} | java | @Override
public Iterable<Map.Entry<K, V>> entries() {
return Collections.unmodifiableSet(state.entrySet());
} | [
"@",
"Override",
"public",
"Iterable",
"<",
"Map",
".",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"entries",
"(",
")",
"{",
"return",
"Collections",
".",
"unmodifiableSet",
"(",
"state",
".",
"entrySet",
"(",
")",
")",
";",
"}"
] | Returns all the mappings in the state in a {@link Collections#unmodifiableSet(Set)}.
@return A read-only iterable view of all the key-value pairs in the state. | [
"Returns",
"all",
"the",
"mappings",
"in",
"the",
"state",
"in",
"a",
"{",
"@link",
"Collections#unmodifiableSet",
"(",
"Set",
")",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/state/ImmutableMapState.java#L80-L83 | train | Returns an unmodifiable collection of entries in the state. | [
30522,
1030,
2058,
15637,
2270,
2009,
6906,
3468,
1026,
4949,
1012,
4443,
1026,
1047,
1010,
1058,
1028,
1028,
10445,
1006,
1007,
1063,
2709,
6407,
1012,
4895,
5302,
4305,
22749,
13510,
3388,
1006,
2110,
1012,
4443,
13462,
1006,
1007,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java | TableFactoryService.filterSupportedPropertiesFactorySpecific | private static List<String> filterSupportedPropertiesFactorySpecific(
TableFactory factory,
List<String> keys) {
if (factory instanceof TableFormatFactory) {
boolean includeSchema = ((TableFormatFactory) factory).supportsSchemaDerivation();
return keys.stream().filter(k -> {
if (includeSchema) {
return k.startsWith(Schema.SCHEMA + ".") ||
k.startsWith(FormatDescriptorValidator.FORMAT + ".");
} else {
return k.startsWith(FormatDescriptorValidator.FORMAT + ".");
}
}).collect(Collectors.toList());
} else {
return keys;
}
} | java | private static List<String> filterSupportedPropertiesFactorySpecific(
TableFactory factory,
List<String> keys) {
if (factory instanceof TableFormatFactory) {
boolean includeSchema = ((TableFormatFactory) factory).supportsSchemaDerivation();
return keys.stream().filter(k -> {
if (includeSchema) {
return k.startsWith(Schema.SCHEMA + ".") ||
k.startsWith(FormatDescriptorValidator.FORMAT + ".");
} else {
return k.startsWith(FormatDescriptorValidator.FORMAT + ".");
}
}).collect(Collectors.toList());
} else {
return keys;
}
} | [
"private",
"static",
"List",
"<",
"String",
">",
"filterSupportedPropertiesFactorySpecific",
"(",
"TableFactory",
"factory",
",",
"List",
"<",
"String",
">",
"keys",
")",
"{",
"if",
"(",
"factory",
"instanceof",
"TableFormatFactory",
")",
"{",
"boolean",
"includeS... | Performs filtering for special cases (i.e. table format factories with schema derivation). | [
"Performs",
"filtering",
"for",
"special",
"cases",
"(",
"i",
".",
"e",
".",
"table",
"format",
"factories",
"with",
"schema",
"derivation",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java#L355-L372 | train | Filter supported properties factory specific. | [
30522,
2797,
10763,
2862,
1026,
5164,
1028,
17736,
6279,
6442,
2098,
21572,
4842,
7368,
21450,
13102,
8586,
18513,
1006,
2795,
21450,
4713,
1010,
2862,
1026,
5164,
1028,
6309,
1007,
1063,
2065,
1006,
4713,
6013,
11253,
2795,
14192,
4017,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java | VectorizedParquetRecordReader.initialize | @Override
public void initialize(String path, List<String> columns) throws IOException,
UnsupportedOperationException {
super.initialize(path, columns);
initializeInternal();
} | java | @Override
public void initialize(String path, List<String> columns) throws IOException,
UnsupportedOperationException {
super.initialize(path, columns);
initializeInternal();
} | [
"@",
"Override",
"public",
"void",
"initialize",
"(",
"String",
"path",
",",
"List",
"<",
"String",
">",
"columns",
")",
"throws",
"IOException",
",",
"UnsupportedOperationException",
"{",
"super",
".",
"initialize",
"(",
"path",
",",
"columns",
")",
";",
"i... | Utility API that will read all the data in path. This circumvents the need to create Hadoop
objects to use this class. `columns` can contain the list of columns to project. | [
"Utility",
"API",
"that",
"will",
"read",
"all",
"the",
"data",
"in",
"path",
".",
"This",
"circumvents",
"the",
"need",
"to",
"create",
"Hadoop",
"objects",
"to",
"use",
"this",
"class",
".",
"columns",
"can",
"contain",
"the",
"list",
"of",
"columns",
... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java#L139-L144 | train | Override the initialize method to initialize the CRT file. | [
30522,
1030,
2058,
15637,
2270,
11675,
3988,
4697,
1006,
5164,
4130,
1010,
2862,
1026,
5164,
1028,
7753,
1007,
11618,
22834,
10288,
24422,
1010,
4895,
6342,
9397,
15613,
25918,
3370,
10288,
24422,
1063,
3565,
1012,
3988,
4697,
1006,
4130,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.filter | public static <K, V> Map<K, V> filter(Map<K, V> map, Filter<Entry<K, V>> filter) {
if(null == map || null == filter) {
return map;
}
final Map<K, V> map2 = ObjectUtil.clone(map);
if (isEmpty(map2)) {
return map2;
}
map2.clear();
for (Entry<K, V> entry : map.entrySet()) {
if (filter.accept(entry)) {
map2.put(entry.getKey(), entry.getValue());
}
}
return map2;
} | java | public static <K, V> Map<K, V> filter(Map<K, V> map, Filter<Entry<K, V>> filter) {
if(null == map || null == filter) {
return map;
}
final Map<K, V> map2 = ObjectUtil.clone(map);
if (isEmpty(map2)) {
return map2;
}
map2.clear();
for (Entry<K, V> entry : map.entrySet()) {
if (filter.accept(entry)) {
map2.put(entry.getKey(), entry.getValue());
}
}
return map2;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"filter",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"Filter",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"filter",
")",
"{",
"if",
"(",
"null",
"==",
"ma... | 过滤<br>
过滤过程通过传入的Editor实现来返回需要的元素内容,这个Filter实现可以实现以下功能:
<pre>
1、过滤出需要的对象,如果返回null表示这个元素对象抛弃
</pre>
@param <K> Key类型
@param <V> Value类型
@param map Map
@param filter 编辑器接口
@return 过滤后的Map
@since 3.1.0 | [
"过滤<br",
">",
"过滤过程通过传入的Editor实现来返回需要的元素内容,这个Filter实现可以实现以下功能:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L526-L543 | train | Returns a shallow copy of the given map with entries filtered by the given filter. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
4949,
1026,
1047,
1010,
1058,
1028,
11307,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
4949,
1010,
11307,
1026,
4443,
1026,
1047,
1010,
1058,
1028,
1028,
11307,
1007,
1063,
2065,
1006,
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... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/MutableCapabilities.java | MutableCapabilities.merge | @Override
public MutableCapabilities merge(Capabilities extraCapabilities) {
if (extraCapabilities == null) {
return this;
}
extraCapabilities.asMap().forEach(this::setCapability);
return this;
} | java | @Override
public MutableCapabilities merge(Capabilities extraCapabilities) {
if (extraCapabilities == null) {
return this;
}
extraCapabilities.asMap().forEach(this::setCapability);
return this;
} | [
"@",
"Override",
"public",
"MutableCapabilities",
"merge",
"(",
"Capabilities",
"extraCapabilities",
")",
"{",
"if",
"(",
"extraCapabilities",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"extraCapabilities",
".",
"asMap",
"(",
")",
".",
"forEach",
"(",... | Merge the extra capabilities provided into this DesiredCapabilities instance. If capabilities
with the same name exist in this instance, they will be overridden by the values from the
extraCapabilities object.
@param extraCapabilities Additional capabilities to be added.
@return The DesiredCapabilities instance after the merge. | [
"Merge",
"the",
"extra",
"capabilities",
"provided",
"into",
"this",
"DesiredCapabilities",
"instance",
".",
"If",
"capabilities",
"with",
"the",
"same",
"name",
"exist",
"in",
"this",
"instance",
"they",
"will",
"be",
"overridden",
"by",
"the",
"values",
"from"... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/MutableCapabilities.java#L67-L76 | train | Merge the extra capabilities into this capabilities. | [
30522,
1030,
2058,
15637,
2270,
14163,
10880,
17695,
28518,
15909,
3111,
13590,
1006,
9859,
4469,
17695,
28518,
15909,
3111,
1007,
1063,
2065,
1006,
4469,
17695,
28518,
15909,
3111,
1027,
1027,
19701,
1007,
1063,
2709,
2023,
1025,
1065,
4469,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | instance/manager/src/main/java/com/alibaba/otter/canal/instance/manager/model/CanalParameter.java | CanalParameter.buildPosition | private String buildPosition(String journalName, Long position, Long timestamp) {
StringBuilder masterBuilder = new StringBuilder();
if (StringUtils.isNotEmpty(journalName) || position != null || timestamp != null) {
masterBuilder.append('{');
if (StringUtils.isNotEmpty(journalName)) {
masterBuilder.append("\"journalName\":\"").append(journalName).append("\"");
}
if (position != null) {
if (masterBuilder.length() > 1) {
masterBuilder.append(",");
}
masterBuilder.append("\"position\":").append(position);
}
if (timestamp != null) {
if (masterBuilder.length() > 1) {
masterBuilder.append(",");
}
masterBuilder.append("\"timestamp\":").append(timestamp);
}
masterBuilder.append('}');
return masterBuilder.toString();
} else {
return null;
}
} | java | private String buildPosition(String journalName, Long position, Long timestamp) {
StringBuilder masterBuilder = new StringBuilder();
if (StringUtils.isNotEmpty(journalName) || position != null || timestamp != null) {
masterBuilder.append('{');
if (StringUtils.isNotEmpty(journalName)) {
masterBuilder.append("\"journalName\":\"").append(journalName).append("\"");
}
if (position != null) {
if (masterBuilder.length() > 1) {
masterBuilder.append(",");
}
masterBuilder.append("\"position\":").append(position);
}
if (timestamp != null) {
if (masterBuilder.length() > 1) {
masterBuilder.append(",");
}
masterBuilder.append("\"timestamp\":").append(timestamp);
}
masterBuilder.append('}');
return masterBuilder.toString();
} else {
return null;
}
} | [
"private",
"String",
"buildPosition",
"(",
"String",
"journalName",
",",
"Long",
"position",
",",
"Long",
"timestamp",
")",
"{",
"StringBuilder",
"masterBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"jo... | ===========================兼容字段 | [
"===========================",
"兼容字段"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/instance/manager/src/main/java/com/alibaba/otter/canal/instance/manager/model/CanalParameter.java#L755-L781 | train | Build position. | [
30522,
2797,
5164,
3857,
26994,
1006,
5164,
3485,
18442,
1010,
2146,
2597,
1010,
2146,
2335,
15464,
2361,
1007,
1063,
5164,
8569,
23891,
2099,
3040,
8569,
23891,
2099,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
1007,
1025,
2065,
1006,
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... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslHandler.java | SslHandler.ignoreException | private boolean ignoreException(Throwable t) {
if (!(t instanceof SSLException) && t instanceof IOException && sslClosePromise.isDone()) {
String message = t.getMessage();
// first try to match connection reset / broke peer based on the regex. This is the fastest way
// but may fail on different jdk impls or OS's
if (message != null && IGNORABLE_ERROR_MESSAGE.matcher(message).matches()) {
return true;
}
// Inspect the StackTraceElements to see if it was a connection reset / broken pipe or not
StackTraceElement[] elements = t.getStackTrace();
for (StackTraceElement element: elements) {
String classname = element.getClassName();
String methodname = element.getMethodName();
// skip all classes that belong to the io.netty package
if (classname.startsWith("io.netty.")) {
continue;
}
// check if the method name is read if not skip it
if (!"read".equals(methodname)) {
continue;
}
// This will also match against SocketInputStream which is used by openjdk 7 and maybe
// also others
if (IGNORABLE_CLASS_IN_STACK.matcher(classname).matches()) {
return true;
}
try {
// No match by now.. Try to load the class via classloader and inspect it.
// This is mainly done as other JDK implementations may differ in name of
// the impl.
Class<?> clazz = PlatformDependent.getClassLoader(getClass()).loadClass(classname);
if (SocketChannel.class.isAssignableFrom(clazz)
|| DatagramChannel.class.isAssignableFrom(clazz)) {
return true;
}
// also match against SctpChannel via String matching as it may not present.
if (PlatformDependent.javaVersion() >= 7
&& "com.sun.nio.sctp.SctpChannel".equals(clazz.getSuperclass().getName())) {
return true;
}
} catch (Throwable cause) {
logger.debug("Unexpected exception while loading class {} classname {}",
getClass(), classname, cause);
}
}
}
return false;
} | java | private boolean ignoreException(Throwable t) {
if (!(t instanceof SSLException) && t instanceof IOException && sslClosePromise.isDone()) {
String message = t.getMessage();
// first try to match connection reset / broke peer based on the regex. This is the fastest way
// but may fail on different jdk impls or OS's
if (message != null && IGNORABLE_ERROR_MESSAGE.matcher(message).matches()) {
return true;
}
// Inspect the StackTraceElements to see if it was a connection reset / broken pipe or not
StackTraceElement[] elements = t.getStackTrace();
for (StackTraceElement element: elements) {
String classname = element.getClassName();
String methodname = element.getMethodName();
// skip all classes that belong to the io.netty package
if (classname.startsWith("io.netty.")) {
continue;
}
// check if the method name is read if not skip it
if (!"read".equals(methodname)) {
continue;
}
// This will also match against SocketInputStream which is used by openjdk 7 and maybe
// also others
if (IGNORABLE_CLASS_IN_STACK.matcher(classname).matches()) {
return true;
}
try {
// No match by now.. Try to load the class via classloader and inspect it.
// This is mainly done as other JDK implementations may differ in name of
// the impl.
Class<?> clazz = PlatformDependent.getClassLoader(getClass()).loadClass(classname);
if (SocketChannel.class.isAssignableFrom(clazz)
|| DatagramChannel.class.isAssignableFrom(clazz)) {
return true;
}
// also match against SctpChannel via String matching as it may not present.
if (PlatformDependent.javaVersion() >= 7
&& "com.sun.nio.sctp.SctpChannel".equals(clazz.getSuperclass().getName())) {
return true;
}
} catch (Throwable cause) {
logger.debug("Unexpected exception while loading class {} classname {}",
getClass(), classname, cause);
}
}
}
return false;
} | [
"private",
"boolean",
"ignoreException",
"(",
"Throwable",
"t",
")",
"{",
"if",
"(",
"!",
"(",
"t",
"instanceof",
"SSLException",
")",
"&&",
"t",
"instanceof",
"IOException",
"&&",
"sslClosePromise",
".",
"isDone",
"(",
")",
")",
"{",
"String",
"message",
... | Checks if the given {@link Throwable} can be ignore and just "swallowed"
When an ssl connection is closed a close_notify message is sent.
After that the peer also sends close_notify however, it's not mandatory to receive
the close_notify. The party who sent the initial close_notify can close the connection immediately
then the peer will get connection reset error. | [
"Checks",
"if",
"the",
"given",
"{",
"@link",
"Throwable",
"}",
"can",
"be",
"ignore",
"and",
"just",
"swallowed"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslHandler.java#L1111-L1167 | train | Ignore exception. | [
30522,
2797,
22017,
20898,
8568,
10288,
24422,
1006,
5466,
3085,
1056,
1007,
1063,
2065,
1006,
999,
1006,
1056,
6013,
11253,
7020,
2571,
2595,
24422,
1007,
1004,
1004,
1056,
6013,
11253,
22834,
10288,
24422,
1004,
1004,
7020,
15472,
10483,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.createTargetRowType | protected RelDataType createTargetRowType(
SqlValidatorTable table,
SqlNodeList targetColumnList,
boolean append) {
RelDataType baseRowType = table.getRowType();
if (targetColumnList == null) {
return baseRowType;
}
List<RelDataTypeField> targetFields = baseRowType.getFieldList();
final List<Map.Entry<String, RelDataType>> fields = new ArrayList<>();
if (append) {
for (RelDataTypeField targetField : targetFields) {
fields.add(
Pair.of(SqlUtil.deriveAliasFromOrdinal(fields.size()),
targetField.getType()));
}
}
final Set<Integer> assignedFields = new HashSet<>();
final RelOptTable relOptTable = table instanceof RelOptTable
? ((RelOptTable) table) : null;
for (SqlNode node : targetColumnList) {
SqlIdentifier id = (SqlIdentifier) node;
RelDataTypeField targetField =
SqlValidatorUtil.getTargetField(
baseRowType, typeFactory, id, catalogReader, relOptTable);
if (targetField == null) {
throw newValidationError(id,
RESOURCE.unknownTargetColumn(id.toString()));
}
if (!assignedFields.add(targetField.getIndex())) {
throw newValidationError(id,
RESOURCE.duplicateTargetColumn(targetField.getName()));
}
fields.add(targetField);
}
return typeFactory.createStructType(fields);
} | java | protected RelDataType createTargetRowType(
SqlValidatorTable table,
SqlNodeList targetColumnList,
boolean append) {
RelDataType baseRowType = table.getRowType();
if (targetColumnList == null) {
return baseRowType;
}
List<RelDataTypeField> targetFields = baseRowType.getFieldList();
final List<Map.Entry<String, RelDataType>> fields = new ArrayList<>();
if (append) {
for (RelDataTypeField targetField : targetFields) {
fields.add(
Pair.of(SqlUtil.deriveAliasFromOrdinal(fields.size()),
targetField.getType()));
}
}
final Set<Integer> assignedFields = new HashSet<>();
final RelOptTable relOptTable = table instanceof RelOptTable
? ((RelOptTable) table) : null;
for (SqlNode node : targetColumnList) {
SqlIdentifier id = (SqlIdentifier) node;
RelDataTypeField targetField =
SqlValidatorUtil.getTargetField(
baseRowType, typeFactory, id, catalogReader, relOptTable);
if (targetField == null) {
throw newValidationError(id,
RESOURCE.unknownTargetColumn(id.toString()));
}
if (!assignedFields.add(targetField.getIndex())) {
throw newValidationError(id,
RESOURCE.duplicateTargetColumn(targetField.getName()));
}
fields.add(targetField);
}
return typeFactory.createStructType(fields);
} | [
"protected",
"RelDataType",
"createTargetRowType",
"(",
"SqlValidatorTable",
"table",
",",
"SqlNodeList",
"targetColumnList",
",",
"boolean",
"append",
")",
"{",
"RelDataType",
"baseRowType",
"=",
"table",
".",
"getRowType",
"(",
")",
";",
"if",
"(",
"targetColumnLi... | Derives a row-type for INSERT and UPDATE operations.
@param table Target table for INSERT/UPDATE
@param targetColumnList List of target columns, or null if not specified
@param append Whether to append fields to those in <code>
baseRowType</code>
@return Rowtype | [
"Derives",
"a",
"row",
"-",
"type",
"for",
"INSERT",
"and",
"UPDATE",
"operations",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L4175-L4211 | train | Create the target row type. | [
30522,
5123,
2128,
15150,
29336,
18863,
3443,
7559,
18150,
10524,
13874,
1006,
29296,
10175,
8524,
25485,
3085,
2795,
1010,
29296,
3630,
9247,
2923,
4539,
25778,
2819,
20554,
2923,
1010,
22017,
20898,
10439,
10497,
1007,
1063,
2128,
15150,
29... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateRegistry.java | KvStateRegistry.registerListener | public void registerListener(JobID jobId, KvStateRegistryListener listener) {
final KvStateRegistryListener previousValue = listeners.putIfAbsent(jobId, listener);
if (previousValue != null) {
throw new IllegalStateException("Listener already registered under " + jobId + '.');
}
} | java | public void registerListener(JobID jobId, KvStateRegistryListener listener) {
final KvStateRegistryListener previousValue = listeners.putIfAbsent(jobId, listener);
if (previousValue != null) {
throw new IllegalStateException("Listener already registered under " + jobId + '.');
}
} | [
"public",
"void",
"registerListener",
"(",
"JobID",
"jobId",
",",
"KvStateRegistryListener",
"listener",
")",
"{",
"final",
"KvStateRegistryListener",
"previousValue",
"=",
"listeners",
".",
"putIfAbsent",
"(",
"jobId",
",",
"listener",
")",
";",
"if",
"(",
"previ... | Registers a listener with the registry.
@param jobId identifying the job for which to register a {@link KvStateRegistryListener}
@param listener The registry listener.
@throws IllegalStateException If there is a registered listener | [
"Registers",
"a",
"listener",
"with",
"the",
"registry",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateRegistry.java#L56-L62 | train | Registers a listener for the given job id. | [
30522,
2270,
11675,
4236,
9863,
24454,
1006,
3105,
3593,
3105,
3593,
1010,
24888,
9153,
3334,
13910,
2923,
23320,
27870,
3678,
19373,
1007,
1063,
2345,
24888,
9153,
3334,
13910,
2923,
23320,
27870,
3678,
3025,
10175,
5657,
1027,
13810,
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/io/network/buffer/LocalBufferPool.java | LocalBufferPool.lazyDestroy | @Override
public void lazyDestroy() {
// NOTE: if you change this logic, be sure to update recycle() as well!
synchronized (availableMemorySegments) {
if (!isDestroyed) {
MemorySegment segment;
while ((segment = availableMemorySegments.poll()) != null) {
returnMemorySegment(segment);
}
BufferListener listener;
while ((listener = registeredListeners.poll()) != null) {
listener.notifyBufferDestroyed();
}
isDestroyed = true;
}
}
try {
networkBufferPool.destroyBufferPool(this);
} catch (IOException e) {
ExceptionUtils.rethrow(e);
}
} | java | @Override
public void lazyDestroy() {
// NOTE: if you change this logic, be sure to update recycle() as well!
synchronized (availableMemorySegments) {
if (!isDestroyed) {
MemorySegment segment;
while ((segment = availableMemorySegments.poll()) != null) {
returnMemorySegment(segment);
}
BufferListener listener;
while ((listener = registeredListeners.poll()) != null) {
listener.notifyBufferDestroyed();
}
isDestroyed = true;
}
}
try {
networkBufferPool.destroyBufferPool(this);
} catch (IOException e) {
ExceptionUtils.rethrow(e);
}
} | [
"@",
"Override",
"public",
"void",
"lazyDestroy",
"(",
")",
"{",
"// NOTE: if you change this logic, be sure to update recycle() as well!",
"synchronized",
"(",
"availableMemorySegments",
")",
"{",
"if",
"(",
"!",
"isDestroyed",
")",
"{",
"MemorySegment",
"segment",
";",
... | Destroy is called after the produce or consume phase of a task finishes. | [
"Destroy",
"is",
"called",
"after",
"the",
"produce",
"or",
"consume",
"phase",
"of",
"a",
"task",
"finishes",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/LocalBufferPool.java#L315-L339 | train | This method is called by the buffer pool when it is being destroyed. | [
30522,
1030,
2058,
15637,
2270,
11675,
13971,
6155,
13181,
2100,
1006,
1007,
1063,
1013,
1013,
3602,
1024,
2065,
2017,
2689,
2023,
7961,
1010,
2022,
2469,
2000,
10651,
28667,
2100,
14321,
1006,
1007,
2004,
2092,
999,
25549,
1006,
2800,
4168... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/ZooKeeperLeaderElectionService.java | ZooKeeperLeaderElectionService.writeLeaderInformation | protected void writeLeaderInformation(UUID leaderSessionID) {
// this method does not have to be synchronized because the curator framework client
// is thread-safe
try {
if (LOG.isDebugEnabled()) {
LOG.debug(
"Write leader information: Leader={}, session ID={}.",
leaderContender.getAddress(),
leaderSessionID);
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeUTF(leaderContender.getAddress());
oos.writeObject(leaderSessionID);
oos.close();
boolean dataWritten = false;
while (!dataWritten && leaderLatch.hasLeadership()) {
Stat stat = client.checkExists().forPath(leaderPath);
if (stat != null) {
long owner = stat.getEphemeralOwner();
long sessionID = client.getZookeeperClient().getZooKeeper().getSessionId();
if (owner == sessionID) {
try {
client.setData().forPath(leaderPath, baos.toByteArray());
dataWritten = true;
} catch (KeeperException.NoNodeException noNode) {
// node was deleted in the meantime
}
} else {
try {
client.delete().forPath(leaderPath);
} catch (KeeperException.NoNodeException noNode) {
// node was deleted in the meantime --> try again
}
}
} else {
try {
client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(
leaderPath,
baos.toByteArray());
dataWritten = true;
} catch (KeeperException.NodeExistsException nodeExists) {
// node has been created in the meantime --> try again
}
}
}
if (LOG.isDebugEnabled()) {
LOG.debug(
"Successfully wrote leader information: Leader={}, session ID={}.",
leaderContender.getAddress(),
leaderSessionID);
}
} catch (Exception e) {
leaderContender.handleError(
new Exception("Could not write leader address and leader session ID to " +
"ZooKeeper.", e));
}
} | java | protected void writeLeaderInformation(UUID leaderSessionID) {
// this method does not have to be synchronized because the curator framework client
// is thread-safe
try {
if (LOG.isDebugEnabled()) {
LOG.debug(
"Write leader information: Leader={}, session ID={}.",
leaderContender.getAddress(),
leaderSessionID);
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeUTF(leaderContender.getAddress());
oos.writeObject(leaderSessionID);
oos.close();
boolean dataWritten = false;
while (!dataWritten && leaderLatch.hasLeadership()) {
Stat stat = client.checkExists().forPath(leaderPath);
if (stat != null) {
long owner = stat.getEphemeralOwner();
long sessionID = client.getZookeeperClient().getZooKeeper().getSessionId();
if (owner == sessionID) {
try {
client.setData().forPath(leaderPath, baos.toByteArray());
dataWritten = true;
} catch (KeeperException.NoNodeException noNode) {
// node was deleted in the meantime
}
} else {
try {
client.delete().forPath(leaderPath);
} catch (KeeperException.NoNodeException noNode) {
// node was deleted in the meantime --> try again
}
}
} else {
try {
client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(
leaderPath,
baos.toByteArray());
dataWritten = true;
} catch (KeeperException.NodeExistsException nodeExists) {
// node has been created in the meantime --> try again
}
}
}
if (LOG.isDebugEnabled()) {
LOG.debug(
"Successfully wrote leader information: Leader={}, session ID={}.",
leaderContender.getAddress(),
leaderSessionID);
}
} catch (Exception e) {
leaderContender.handleError(
new Exception("Could not write leader address and leader session ID to " +
"ZooKeeper.", e));
}
} | [
"protected",
"void",
"writeLeaderInformation",
"(",
"UUID",
"leaderSessionID",
")",
"{",
"// this method does not have to be synchronized because the curator framework client",
"// is thread-safe",
"try",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LO... | Writes the current leader's address as well the given leader session ID to ZooKeeper.
@param leaderSessionID Leader session ID which is written to ZooKeeper | [
"Writes",
"the",
"current",
"leader",
"s",
"address",
"as",
"well",
"the",
"given",
"leader",
"session",
"ID",
"to",
"ZooKeeper",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/ZooKeeperLeaderElectionService.java#L326-L392 | train | Write leader information to ZooKeeper. | [
30522,
5123,
11675,
4339,
19000,
2378,
14192,
3370,
1006,
1057,
21272,
4177,
7971,
3258,
3593,
1007,
1063,
1013,
1013,
2023,
4118,
2515,
2025,
2031,
2000,
2022,
25549,
2138,
1996,
13023,
7705,
7396,
1013,
1013,
2003,
11689,
1011,
3647,
3046... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java | WindowedStream.allowedLateness | @PublicEvolving
public WindowedStream<T, K, W> allowedLateness(Time lateness) {
final long millis = lateness.toMilliseconds();
checkArgument(millis >= 0, "The allowed lateness cannot be negative.");
this.allowedLateness = millis;
return this;
} | java | @PublicEvolving
public WindowedStream<T, K, W> allowedLateness(Time lateness) {
final long millis = lateness.toMilliseconds();
checkArgument(millis >= 0, "The allowed lateness cannot be negative.");
this.allowedLateness = millis;
return this;
} | [
"@",
"PublicEvolving",
"public",
"WindowedStream",
"<",
"T",
",",
"K",
",",
"W",
">",
"allowedLateness",
"(",
"Time",
"lateness",
")",
"{",
"final",
"long",
"millis",
"=",
"lateness",
".",
"toMilliseconds",
"(",
")",
";",
"checkArgument",
"(",
"millis",
">... | Sets the time by which elements are allowed to be late. Elements that
arrive behind the watermark by more than the specified time will be dropped.
By default, the allowed lateness is {@code 0L}.
<p>Setting an allowed lateness is only valid for event-time windows. | [
"Sets",
"the",
"time",
"by",
"which",
"elements",
"are",
"allowed",
"to",
"be",
"late",
".",
"Elements",
"that",
"arrive",
"behind",
"the",
"watermark",
"by",
"more",
"than",
"the",
"specified",
"time",
"will",
"be",
"dropped",
".",
"By",
"default",
"the",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java#L157-L164 | train | Sets the allowed lateness. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
3332,
2098,
21422,
1026,
1056,
1010,
1047,
1010,
1059,
1028,
3039,
13806,
2791,
1006,
2051,
2397,
2791,
1007,
1063,
2345,
2146,
4971,
2483,
1027,
2397,
2791,
1012,
3419,
8591,
5562,
8663,
5104,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/codegen/UTF8StringBuilder.java | UTF8StringBuilder.grow | private void grow(int neededSize) {
if (neededSize > ARRAY_MAX - totalSize()) {
throw new UnsupportedOperationException(
"Cannot grow internal buffer by size " + neededSize + " because the size after growing " +
"exceeds size limitation " + ARRAY_MAX);
}
final int length = totalSize() + neededSize;
if (buffer.length < length) {
int newLength = length < ARRAY_MAX / 2 ? length * 2 : ARRAY_MAX;
final byte[] tmp = new byte[newLength];
Platform.copyMemory(
buffer,
Platform.BYTE_ARRAY_OFFSET,
tmp,
Platform.BYTE_ARRAY_OFFSET,
totalSize());
buffer = tmp;
}
} | java | private void grow(int neededSize) {
if (neededSize > ARRAY_MAX - totalSize()) {
throw new UnsupportedOperationException(
"Cannot grow internal buffer by size " + neededSize + " because the size after growing " +
"exceeds size limitation " + ARRAY_MAX);
}
final int length = totalSize() + neededSize;
if (buffer.length < length) {
int newLength = length < ARRAY_MAX / 2 ? length * 2 : ARRAY_MAX;
final byte[] tmp = new byte[newLength];
Platform.copyMemory(
buffer,
Platform.BYTE_ARRAY_OFFSET,
tmp,
Platform.BYTE_ARRAY_OFFSET,
totalSize());
buffer = tmp;
}
} | [
"private",
"void",
"grow",
"(",
"int",
"neededSize",
")",
"{",
"if",
"(",
"neededSize",
">",
"ARRAY_MAX",
"-",
"totalSize",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Cannot grow internal buffer by size \"",
"+",
"neededSize",
"+"... | Grows the buffer by at least `neededSize` | [
"Grows",
"the",
"buffer",
"by",
"at",
"least",
"neededSize"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/codegen/UTF8StringBuilder.java#L41-L59 | train | Grows the internal buffer by the specified size. | [
30522,
2797,
11675,
4982,
1006,
20014,
2734,
5332,
4371,
1007,
1063,
2065,
1006,
2734,
5332,
4371,
1028,
9140,
1035,
4098,
1011,
21948,
4697,
1006,
1007,
1007,
1063,
5466,
2047,
4895,
6342,
9397,
15613,
25918,
3370,
10288,
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... |
looly/hutool | hutool-cache/src/main/java/cn/hutool/cache/CacheUtil.java | CacheUtil.newWeakCache | public static <K, V> WeakCache<K, V> newWeakCache(long timeout){
return new WeakCache<K, V>(timeout);
} | java | public static <K, V> WeakCache<K, V> newWeakCache(long timeout){
return new WeakCache<K, V>(timeout);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"WeakCache",
"<",
"K",
",",
"V",
">",
"newWeakCache",
"(",
"long",
"timeout",
")",
"{",
"return",
"new",
"WeakCache",
"<",
"K",
",",
"V",
">",
"(",
"timeout",
")",
";",
"}"
] | 创建弱引用缓存.
@param <K> Key类型
@param <V> Value类型
@param timeout 过期时长,单位:毫秒
@return {@link WeakCache}
@since 3.0.7 | [
"创建弱引用缓存",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cache/src/main/java/cn/hutool/cache/CacheUtil.java#L114-L116 | train | Creates a new weak cache with the specified timeout. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
5410,
3540,
5403,
1026,
1047,
1010,
1058,
1028,
2047,
8545,
4817,
3540,
5403,
1006,
2146,
2051,
5833,
1007,
1063,
2709,
2047,
5410,
3540,
5403,
1026,
1047,
1010,
1058,
1028,
1006,
2051,
58... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/DomainNameMapping.java | DomainNameMapping.matches | static boolean matches(String template, String hostName) {
if (template.startsWith("*.")) {
return template.regionMatches(2, hostName, 0, hostName.length())
|| commonSuffixOfLength(hostName, template, template.length() - 1);
}
return template.equals(hostName);
} | java | static boolean matches(String template, String hostName) {
if (template.startsWith("*.")) {
return template.regionMatches(2, hostName, 0, hostName.length())
|| commonSuffixOfLength(hostName, template, template.length() - 1);
}
return template.equals(hostName);
} | [
"static",
"boolean",
"matches",
"(",
"String",
"template",
",",
"String",
"hostName",
")",
"{",
"if",
"(",
"template",
".",
"startsWith",
"(",
"\"*.\"",
")",
")",
"{",
"return",
"template",
".",
"regionMatches",
"(",
"2",
",",
"hostName",
",",
"0",
",",
... | Simple function to match <a href="http://en.wikipedia.org/wiki/Wildcard_DNS_record">DNS wildcard</a>. | [
"Simple",
"function",
"to",
"match",
"<a",
"href",
"=",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Wildcard_DNS_record",
">",
"DNS",
"wildcard<",
"/",
"a",
">",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/DomainNameMapping.java#L96-L102 | train | Check if the template matches the hostName. | [
30522,
10763,
22017,
20898,
3503,
1006,
5164,
23561,
1010,
5164,
3677,
18442,
1007,
1063,
2065,
1006,
23561,
1012,
4627,
24415,
1006,
1000,
1008,
1012,
1000,
1007,
1007,
1063,
2709,
23561,
1012,
2555,
18900,
8376,
1006,
1016,
1010,
3677,
18... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.addCookie | public final static void addCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds) {
addCookie(response, name, value, maxAgeInSeconds, "/", null);
} | java | public final static void addCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds) {
addCookie(response, name, value, maxAgeInSeconds, "/", null);
} | [
"public",
"final",
"static",
"void",
"addCookie",
"(",
"HttpServletResponse",
"response",
",",
"String",
"name",
",",
"String",
"value",
",",
"int",
"maxAgeInSeconds",
")",
"{",
"addCookie",
"(",
"response",
",",
"name",
",",
"value",
",",
"maxAgeInSeconds",
"... | 设定返回给客户端的Cookie<br>
Path: "/"<br>
No Domain
@param response 响应对象{@link HttpServletResponse}
@param name cookie名
@param value cookie值
@param maxAgeInSeconds -1: 关闭浏览器清除Cookie. 0: 立即清除Cookie. >0 : Cookie存在的秒数. | [
"设定返回给客户端的Cookie<br",
">",
"Path",
":",
"/",
"<br",
">",
"No",
"Domain"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L452-L454 | train | Adds a cookie to the response. | [
30522,
2270,
2345,
10763,
11675,
5587,
3597,
23212,
2063,
1006,
16770,
2121,
2615,
7485,
6072,
26029,
3366,
3433,
1010,
5164,
2171,
1010,
5164,
3643,
1010,
20014,
4098,
4270,
7076,
8586,
15422,
2015,
1007,
1063,
5587,
3597,
23212,
2063,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java | TaskSlotTable.isValidTimeout | public boolean isValidTimeout(AllocationID allocationId, UUID ticket) {
checkInit();
return timerService.isValid(allocationId, ticket);
} | java | public boolean isValidTimeout(AllocationID allocationId, UUID ticket) {
checkInit();
return timerService.isValid(allocationId, ticket);
} | [
"public",
"boolean",
"isValidTimeout",
"(",
"AllocationID",
"allocationId",
",",
"UUID",
"ticket",
")",
"{",
"checkInit",
"(",
")",
";",
"return",
"timerService",
".",
"isValid",
"(",
"allocationId",
",",
"ticket",
")",
";",
"}"
] | Check whether the timeout with ticket is valid for the given allocation id.
@param allocationId to check against
@param ticket of the timeout
@return True if the timeout is valid; otherwise false | [
"Check",
"whether",
"the",
"timeout",
"with",
"ticket",
"is",
"valid",
"for",
"the",
"given",
"allocation",
"id",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java#L361-L365 | train | Check if the timeout is valid for the given allocation id and ticket. | [
30522,
2270,
22017,
20898,
2003,
10175,
3593,
7292,
5833,
1006,
16169,
3593,
16169,
3593,
1010,
1057,
21272,
7281,
1007,
1063,
4638,
5498,
2102,
1006,
1007,
1025,
2709,
25309,
8043,
7903,
2063,
1012,
2003,
10175,
3593,
1006,
16169,
3593,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.