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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SeleniumHQ/selenium | java/client/src/com/thoughtworks/selenium/BrowserConfigurationOptions.java | BrowserConfigurationOptions.set | public BrowserConfigurationOptions set(String key, String value) {
if (value != null) {
options.put(key, value);
}
return this;
} | java | public BrowserConfigurationOptions set(String key, String value) {
if (value != null) {
options.put(key, value);
}
return this;
} | [
"public",
"BrowserConfigurationOptions",
"set",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"options",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Sets the given key to the given value unless the value is null. In that case, no entry for the
key is made.
@param key the name of the key
@param value the value for the key
@return this / self | [
"Sets",
"the",
"given",
"key",
"to",
"the",
"given",
"value",
"unless",
"the",
"value",
"is",
"null",
".",
"In",
"that",
"case",
"no",
"entry",
"for",
"the",
"key",
"is",
"made",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/com/thoughtworks/selenium/BrowserConfigurationOptions.java#L238-L243 | train | Sets a value for a key in the options. | [
30522,
2270,
16602,
8663,
8873,
27390,
3370,
7361,
9285,
2275,
1006,
5164,
3145,
1010,
5164,
3643,
1007,
1063,
2065,
1006,
3643,
999,
1027,
19701,
1007,
1063,
7047,
1012,
2404,
1006,
3145,
1010,
3643,
1007,
1025,
1065,
2709,
2023,
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... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java | ParameterTool.fromPropertiesFile | public static ParameterTool fromPropertiesFile(File file) throws IOException {
if (!file.exists()) {
throw new FileNotFoundException("Properties file " + file.getAbsolutePath() + " does not exist");
}
try (FileInputStream fis = new FileInputStream(file)) {
return fromPropertiesFile(fis);
}
} | java | public static ParameterTool fromPropertiesFile(File file) throws IOException {
if (!file.exists()) {
throw new FileNotFoundException("Properties file " + file.getAbsolutePath() + " does not exist");
}
try (FileInputStream fis = new FileInputStream(file)) {
return fromPropertiesFile(fis);
}
} | [
"public",
"static",
"ParameterTool",
"fromPropertiesFile",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"\"Properties file \"",
"+",
"file",
"."... | Returns {@link ParameterTool} for the given {@link Properties} file.
@param file File object to the properties file
@return A {@link ParameterTool}
@throws IOException If the file does not exist
@see Properties | [
"Returns",
"{",
"@link",
"ParameterTool",
"}",
"for",
"the",
"given",
"{",
"@link",
"Properties",
"}",
"file",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L133-L140 | train | Creates a ParameterTool from a properties file. | [
30522,
2270,
10763,
16381,
3406,
4747,
2013,
21572,
4842,
7368,
8873,
2571,
1006,
5371,
5371,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
999,
5371,
1012,
6526,
1006,
1007,
1007,
1063,
5466,
2047,
5371,
17048,
14876,
8630,
10288,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/StringUtils.java | StringUtils.writeString | public static void writeString(@Nonnull String str, DataOutputView out) throws IOException {
checkNotNull(str);
StringValue.writeString(str, out);
} | java | public static void writeString(@Nonnull String str, DataOutputView out) throws IOException {
checkNotNull(str);
StringValue.writeString(str, out);
} | [
"public",
"static",
"void",
"writeString",
"(",
"@",
"Nonnull",
"String",
"str",
",",
"DataOutputView",
"out",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"str",
")",
";",
"StringValue",
".",
"writeString",
"(",
"str",
",",
"out",
")",
";",
"}"... | Writes a String to the given output.
The written string can be read with {@link #readString(DataInputView)}.
@param str The string to write
@param out The output to write to
@throws IOException Thrown, if the writing or the serialization fails. | [
"Writes",
"a",
"String",
"to",
"the",
"given",
"output",
".",
"The",
"written",
"string",
"can",
"be",
"read",
"with",
"{",
"@link",
"#readString",
"(",
"DataInputView",
")",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringUtils.java#L293-L296 | train | Write a String to a DataOutputView. | [
30522,
2270,
10763,
11675,
7009,
18886,
3070,
1006,
1030,
2512,
11231,
3363,
5164,
2358,
2099,
1010,
2951,
5833,
18780,
8584,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
4638,
17048,
11231,
3363,
1006,
2358,
2099,
1007,
1025,
5164,
10175,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/TypeExtractionUtils.java | TypeExtractionUtils.getSingleAbstractMethod | public static Method getSingleAbstractMethod(Class<?> baseClass) {
if (!baseClass.isInterface()) {
throw new InvalidTypesException("Given class: " + baseClass + "is not a FunctionalInterface.");
}
Method sam = null;
for (Method method : baseClass.getMethods()) {
if (Modifier.isAbstract(method.getModifiers())) {
if (sam == null) {
sam = method;
} else {
throw new InvalidTypesException("Given class: " + baseClass +
" is not a FunctionalInterface. It has more than one abstract method.");
}
}
}
if (sam == null) {
throw new InvalidTypesException(
"Given class: " + baseClass + " is not a FunctionalInterface. It does not have any abstract methods.");
}
return sam;
} | java | public static Method getSingleAbstractMethod(Class<?> baseClass) {
if (!baseClass.isInterface()) {
throw new InvalidTypesException("Given class: " + baseClass + "is not a FunctionalInterface.");
}
Method sam = null;
for (Method method : baseClass.getMethods()) {
if (Modifier.isAbstract(method.getModifiers())) {
if (sam == null) {
sam = method;
} else {
throw new InvalidTypesException("Given class: " + baseClass +
" is not a FunctionalInterface. It has more than one abstract method.");
}
}
}
if (sam == null) {
throw new InvalidTypesException(
"Given class: " + baseClass + " is not a FunctionalInterface. It does not have any abstract methods.");
}
return sam;
} | [
"public",
"static",
"Method",
"getSingleAbstractMethod",
"(",
"Class",
"<",
"?",
">",
"baseClass",
")",
"{",
"if",
"(",
"!",
"baseClass",
".",
"isInterface",
"(",
")",
")",
"{",
"throw",
"new",
"InvalidTypesException",
"(",
"\"Given class: \"",
"+",
"baseClass... | Extracts a Single Abstract Method (SAM) as defined in Java Specification (4.3.2. The Class Object,
9.8 Functional Interfaces, 9.4.3 Interface Method Body) from given class.
@param baseClass a class that is a FunctionalInterface to retrieve a SAM from
@throws InvalidTypesException if the given class does not implement FunctionalInterface
@return single abstract method of the given class | [
"Extracts",
"a",
"Single",
"Abstract",
"Method",
"(",
"SAM",
")",
"as",
"defined",
"in",
"Java",
"Specification",
"(",
"4",
".",
"3",
".",
"2",
".",
"The",
"Class",
"Object",
"9",
".",
"8",
"Functional",
"Interfaces",
"9",
".",
"4",
".",
"3",
"Interf... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java#L218-L242 | train | Gets the single abstract method from the given base class. | [
30522,
2270,
10763,
4118,
4152,
2075,
19738,
5910,
6494,
6593,
11368,
6806,
2094,
1006,
2465,
1026,
1029,
1028,
2918,
26266,
1007,
1063,
2065,
1006,
999,
2918,
26266,
1012,
2003,
18447,
2121,
12172,
1006,
1007,
1007,
1063,
5466,
2047,
19528... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/expressions/javalang/typed.java | typed.sumLong | public static <T> TypedColumn<T, Long> sumLong(MapFunction<T, Long> f) {
return new TypedSumLong<T>(f).toColumnJava();
} | java | public static <T> TypedColumn<T, Long> sumLong(MapFunction<T, Long> f) {
return new TypedSumLong<T>(f).toColumnJava();
} | [
"public",
"static",
"<",
"T",
">",
"TypedColumn",
"<",
"T",
",",
"Long",
">",
"sumLong",
"(",
"MapFunction",
"<",
"T",
",",
"Long",
">",
"f",
")",
"{",
"return",
"new",
"TypedSumLong",
"<",
"T",
">",
"(",
"f",
")",
".",
"toColumnJava",
"(",
")",
... | Sum aggregate function for integral (long, i.e. 64 bit integer) type.
@since 2.0.0 | [
"Sum",
"aggregate",
"function",
"for",
"integral",
"(",
"long",
"i",
".",
"e",
".",
"64",
"bit",
"integer",
")",
"type",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/expressions/javalang/typed.java#L72-L74 | train | Sum Long | [
30522,
2270,
10763,
1026,
1056,
1028,
21189,
25778,
2819,
2078,
1026,
1056,
1010,
2146,
1028,
7680,
10052,
1006,
4949,
11263,
27989,
1026,
1056,
1010,
2146,
1028,
1042,
1007,
1063,
2709,
2047,
21189,
17421,
10052,
1026,
1056,
1028,
1006,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateIpv6 | public static <T extends CharSequence> T validateIpv6(T value, String errorMsg) throws ValidateException {
if (false == isIpv6(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validateIpv6(T value, String errorMsg) throws ValidateException {
if (false == isIpv6(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateIpv6",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isIpv6",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"Va... | 验证是否为IPV6地址
@param <T> 字符串类型
@param value 值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证是否为IPV6地址"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L835-L840 | train | Validate an IPv6 address. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
9398,
3686,
11514,
2615,
2575,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
1027,
2003,
11514... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | mask/src/main/java/com/networknt/mask/Mask.java | Mask.maskRegex | public static String maskRegex(String input, String key, String name) {
Map<String, Object> regexConfig = (Map<String, Object>) config.get(MASK_TYPE_REGEX);
if (regexConfig != null) {
Map<String, Object> keyConfig = (Map<String, Object>) regexConfig.get(key);
if (keyConfig != null) {
String regex = (String) keyConfig.get(name);
if (regex != null && regex.length() > 0) {
return replaceWithMask(input, MASK_REPLACEMENT_CHAR.charAt(0), regex);
}
}
}
return input;
} | java | public static String maskRegex(String input, String key, String name) {
Map<String, Object> regexConfig = (Map<String, Object>) config.get(MASK_TYPE_REGEX);
if (regexConfig != null) {
Map<String, Object> keyConfig = (Map<String, Object>) regexConfig.get(key);
if (keyConfig != null) {
String regex = (String) keyConfig.get(name);
if (regex != null && regex.length() > 0) {
return replaceWithMask(input, MASK_REPLACEMENT_CHAR.charAt(0), regex);
}
}
}
return input;
} | [
"public",
"static",
"String",
"maskRegex",
"(",
"String",
"input",
",",
"String",
"key",
",",
"String",
"name",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"regexConfig",
"=",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"config",
".",
... | Replace a string input with a pattern found in regex section with key as index. Usually,
it is used to replace header, query parameter, uri parameter to same length of stars(*)
@param input String The source of the string that needs to be masked
@param key String The key maps to a list of name to pattern pair
@param name String The name of the pattern in the key list
@return String Masked result | [
"Replace",
"a",
"string",
"input",
"with",
"a",
"pattern",
"found",
"in",
"regex",
"section",
"with",
"key",
"as",
"index",
".",
"Usually",
"it",
"is",
"used",
"to",
"replace",
"header",
"query",
"parameter",
"uri",
"parameter",
"to",
"same",
"length",
"of... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/mask/src/main/java/com/networknt/mask/Mask.java#L89-L101 | train | Mask regex. | [
30522,
2270,
10763,
5164,
7308,
2890,
3351,
2595,
1006,
5164,
7953,
1010,
5164,
3145,
1010,
5164,
2171,
1007,
1063,
4949,
1026,
5164,
1010,
4874,
1028,
19723,
10288,
8663,
8873,
2290,
1027,
1006,
4949,
1026,
5164,
1010,
4874,
1028,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/word2vec/DocVectorModel.java | DocVectorModel.addDocument | public Vector addDocument(int id, String content)
{
Vector result = query(content);
if (result == null) return null;
storage.put(id, result);
return result;
} | java | public Vector addDocument(int id, String content)
{
Vector result = query(content);
if (result == null) return null;
storage.put(id, result);
return result;
} | [
"public",
"Vector",
"addDocument",
"(",
"int",
"id",
",",
"String",
"content",
")",
"{",
"Vector",
"result",
"=",
"query",
"(",
"content",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"return",
"null",
";",
"storage",
".",
"put",
"(",
"id",
",",... | 添加文档
@param id 文档id
@param content 文档内容
@return 文档向量 | [
"添加文档"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/DocVectorModel.java#L41-L47 | train | Add a document to the database. | [
30522,
2270,
9207,
5587,
3527,
24894,
4765,
1006,
20014,
8909,
1010,
5164,
4180,
1007,
1063,
9207,
2765,
1027,
23032,
1006,
4180,
1007,
1025,
2065,
1006,
2765,
1027,
1027,
19701,
1007,
2709,
19701,
1025,
5527,
1012,
2404,
1006,
8909,
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/collection/IterUtil.java | IterUtil.fieldValueMap | public static <K, V> Map<K, V> fieldValueMap(Iterable<V> iter, String fieldName) {
return fieldValueMap(null == iter ? null : iter.iterator(), fieldName);
} | java | public static <K, V> Map<K, V> fieldValueMap(Iterable<V> iter, String fieldName) {
return fieldValueMap(null == iter ? null : iter.iterator(), fieldName);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"fieldValueMap",
"(",
"Iterable",
"<",
"V",
">",
"iter",
",",
"String",
"fieldName",
")",
"{",
"return",
"fieldValueMap",
"(",
"null",
"==",
"iter",
"?",
"null",
":",
"ite... | 字段值与列表值对应的Map,常用于元素对象中有唯一ID时需要按照这个ID查找对象的情况<br>
例如:车牌号 =》车
@param <K> 字段名对应值得类型,不确定请使用Object
@param <V> 对象类型
@param iter 对象列表
@param fieldName 字段名(会通过反射获取其值)
@return 某个字段值与对象对应Map
@since 4.0.4 | [
"字段值与列表值对应的Map,常用于元素对象中有唯一ID时需要按照这个ID查找对象的情况<br",
">",
"例如:车牌号",
"=",
"》车"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L181-L183 | train | Returns a field value map from an iterable. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
4949,
1026,
1047,
1010,
1058,
1028,
2492,
10175,
5657,
2863,
2361,
1006,
2009,
6906,
3468,
1026,
1058,
1028,
2009,
2121,
1010,
5164,
2492,
18442,
1007,
1063,
2709,
2492,
10175,
5657,
2863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/DataFormatConverters.java | DataFormatConverters.getConverterForTypeInfo | @SuppressWarnings("unchecked")
public static DataFormatConverter getConverterForTypeInfo(TypeInformation typeInfo) {
DataFormatConverter converter = TYPE_INFO_TO_CONVERTER.get(typeInfo);
if (converter != null) {
return converter;
}
if (typeInfo instanceof BasicArrayTypeInfo) {
BasicArrayTypeInfo arrayType = (BasicArrayTypeInfo) typeInfo;
return new ObjectArrayConverter(arrayType.getTypeClass(), arrayType.getComponentInfo());
} else if (typeInfo instanceof ObjectArrayTypeInfo) {
ObjectArrayTypeInfo arrayType = (ObjectArrayTypeInfo) typeInfo;
return new ObjectArrayConverter(arrayType.getTypeClass(), arrayType.getComponentInfo());
} else if (typeInfo instanceof MapTypeInfo) {
MapTypeInfo mapType = (MapTypeInfo) typeInfo;
return new MapConverter(mapType.getKeyTypeInfo(), mapType.getValueTypeInfo());
} else if (typeInfo instanceof RowTypeInfo) {
return new RowConverter((RowTypeInfo) typeInfo);
} else if (typeInfo instanceof PojoTypeInfo) {
return new PojoConverter((PojoTypeInfo) typeInfo);
} else if (typeInfo instanceof TupleTypeInfo) {
return new TupleConverter((TupleTypeInfo) typeInfo);
} else if (typeInfo instanceof TupleTypeInfoBase && Product.class.isAssignableFrom(typeInfo.getTypeClass())) {
return new CaseClassConverter((TupleTypeInfoBase) typeInfo);
} else if (typeInfo instanceof BinaryArrayTypeInfo) {
return BinaryArrayConverter.INSTANCE;
} else if (typeInfo instanceof BinaryMapTypeInfo) {
return BinaryMapConverter.INSTANCE;
} else if (typeInfo instanceof BaseRowTypeInfo) {
return new BaseRowConverter(typeInfo.getArity());
} else if (typeInfo.equals(BasicTypeInfo.BIG_DEC_TYPE_INFO)) {
return new BaseRowConverter(typeInfo.getArity());
} else if (typeInfo instanceof DecimalTypeInfo) {
DecimalTypeInfo decimalType = (DecimalTypeInfo) typeInfo;
return new DecimalConverter(decimalType.precision(), decimalType.scale());
} else if (typeInfo instanceof BigDecimalTypeInfo) {
BigDecimalTypeInfo decimalType = (BigDecimalTypeInfo) typeInfo;
return new BigDecimalConverter(decimalType.precision(), decimalType.scale());
} else if (typeInfo instanceof BinaryGenericTypeInfo) {
return BinaryGenericConverter.INSTANCE;
} else {
return new GenericConverter(typeInfo.createSerializer(new ExecutionConfig()));
}
} | java | @SuppressWarnings("unchecked")
public static DataFormatConverter getConverterForTypeInfo(TypeInformation typeInfo) {
DataFormatConverter converter = TYPE_INFO_TO_CONVERTER.get(typeInfo);
if (converter != null) {
return converter;
}
if (typeInfo instanceof BasicArrayTypeInfo) {
BasicArrayTypeInfo arrayType = (BasicArrayTypeInfo) typeInfo;
return new ObjectArrayConverter(arrayType.getTypeClass(), arrayType.getComponentInfo());
} else if (typeInfo instanceof ObjectArrayTypeInfo) {
ObjectArrayTypeInfo arrayType = (ObjectArrayTypeInfo) typeInfo;
return new ObjectArrayConverter(arrayType.getTypeClass(), arrayType.getComponentInfo());
} else if (typeInfo instanceof MapTypeInfo) {
MapTypeInfo mapType = (MapTypeInfo) typeInfo;
return new MapConverter(mapType.getKeyTypeInfo(), mapType.getValueTypeInfo());
} else if (typeInfo instanceof RowTypeInfo) {
return new RowConverter((RowTypeInfo) typeInfo);
} else if (typeInfo instanceof PojoTypeInfo) {
return new PojoConverter((PojoTypeInfo) typeInfo);
} else if (typeInfo instanceof TupleTypeInfo) {
return new TupleConverter((TupleTypeInfo) typeInfo);
} else if (typeInfo instanceof TupleTypeInfoBase && Product.class.isAssignableFrom(typeInfo.getTypeClass())) {
return new CaseClassConverter((TupleTypeInfoBase) typeInfo);
} else if (typeInfo instanceof BinaryArrayTypeInfo) {
return BinaryArrayConverter.INSTANCE;
} else if (typeInfo instanceof BinaryMapTypeInfo) {
return BinaryMapConverter.INSTANCE;
} else if (typeInfo instanceof BaseRowTypeInfo) {
return new BaseRowConverter(typeInfo.getArity());
} else if (typeInfo.equals(BasicTypeInfo.BIG_DEC_TYPE_INFO)) {
return new BaseRowConverter(typeInfo.getArity());
} else if (typeInfo instanceof DecimalTypeInfo) {
DecimalTypeInfo decimalType = (DecimalTypeInfo) typeInfo;
return new DecimalConverter(decimalType.precision(), decimalType.scale());
} else if (typeInfo instanceof BigDecimalTypeInfo) {
BigDecimalTypeInfo decimalType = (BigDecimalTypeInfo) typeInfo;
return new BigDecimalConverter(decimalType.precision(), decimalType.scale());
} else if (typeInfo instanceof BinaryGenericTypeInfo) {
return BinaryGenericConverter.INSTANCE;
} else {
return new GenericConverter(typeInfo.createSerializer(new ExecutionConfig()));
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"DataFormatConverter",
"getConverterForTypeInfo",
"(",
"TypeInformation",
"typeInfo",
")",
"{",
"DataFormatConverter",
"converter",
"=",
"TYPE_INFO_TO_CONVERTER",
".",
"get",
"(",
"typeInfo",
")",
"... | Get {@link DataFormatConverter} for {@link TypeInformation}.
@param typeInfo DataFormatConverter is oriented to Java format, while InternalType has
lost its specific Java format. Only TypeInformation retains all its
Java format information. | [
"Get",
"{",
"@link",
"DataFormatConverter",
"}",
"for",
"{",
"@link",
"TypeInformation",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/DataFormatConverters.java#L120-L163 | train | Get the appropriate converter for the given type information. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
2951,
14192,
30524,
14876,
1007,
1063,
2951,
14192,
4017,
8663,
16874,
2121,
10463,
2121,
1027,
2828,
1035,
18558,
1035,
2000,
1035,
10463,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/rtsp/RtspResponseStatuses.java | RtspResponseStatuses.valueOf | public static HttpResponseStatus valueOf(int code) {
switch (code) {
case 250: return LOW_STORAGE_SPACE;
case 302: return MOVED_TEMPORARILY;
case 451: return PARAMETER_NOT_UNDERSTOOD;
case 452: return CONFERENCE_NOT_FOUND;
case 453: return NOT_ENOUGH_BANDWIDTH;
case 454: return SESSION_NOT_FOUND;
case 455: return METHOD_NOT_VALID;
case 456: return HEADER_FIELD_NOT_VALID;
case 457: return INVALID_RANGE;
case 458: return PARAMETER_IS_READONLY;
case 459: return AGGREGATE_OPERATION_NOT_ALLOWED;
case 460: return ONLY_AGGREGATE_OPERATION_ALLOWED;
case 461: return UNSUPPORTED_TRANSPORT;
case 462: return DESTINATION_UNREACHABLE;
case 463: return KEY_MANAGEMENT_FAILURE;
case 505: return RTSP_VERSION_NOT_SUPPORTED;
case 551: return OPTION_NOT_SUPPORTED;
default: return HttpResponseStatus.valueOf(code);
}
} | java | public static HttpResponseStatus valueOf(int code) {
switch (code) {
case 250: return LOW_STORAGE_SPACE;
case 302: return MOVED_TEMPORARILY;
case 451: return PARAMETER_NOT_UNDERSTOOD;
case 452: return CONFERENCE_NOT_FOUND;
case 453: return NOT_ENOUGH_BANDWIDTH;
case 454: return SESSION_NOT_FOUND;
case 455: return METHOD_NOT_VALID;
case 456: return HEADER_FIELD_NOT_VALID;
case 457: return INVALID_RANGE;
case 458: return PARAMETER_IS_READONLY;
case 459: return AGGREGATE_OPERATION_NOT_ALLOWED;
case 460: return ONLY_AGGREGATE_OPERATION_ALLOWED;
case 461: return UNSUPPORTED_TRANSPORT;
case 462: return DESTINATION_UNREACHABLE;
case 463: return KEY_MANAGEMENT_FAILURE;
case 505: return RTSP_VERSION_NOT_SUPPORTED;
case 551: return OPTION_NOT_SUPPORTED;
default: return HttpResponseStatus.valueOf(code);
}
} | [
"public",
"static",
"HttpResponseStatus",
"valueOf",
"(",
"int",
"code",
")",
"{",
"switch",
"(",
"code",
")",
"{",
"case",
"250",
":",
"return",
"LOW_STORAGE_SPACE",
";",
"case",
"302",
":",
"return",
"MOVED_TEMPORARILY",
";",
"case",
"451",
":",
"return",
... | Returns the {@link HttpResponseStatus} represented by the specified code.
If the specified code is a standard RTSP getStatus code, a cached instance
will be returned. Otherwise, a new instance will be returned. | [
"Returns",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/rtsp/RtspResponseStatuses.java#L267-L288 | train | Gets the status code from the response code. | [
30522,
2270,
10763,
8299,
6072,
26029,
8583,
29336,
2271,
3643,
11253,
1006,
20014,
3642,
1007,
1063,
6942,
1006,
3642,
1007,
1063,
2553,
5539,
1024,
2709,
2659,
1035,
5527,
1035,
2686,
1025,
2553,
22060,
1024,
2709,
2333,
1035,
8184,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/RedissonBoundedBlockingQueue.java | RedissonBoundedBlockingQueue.pollFromAnyAsync | @Override
public RFuture<V> pollFromAnyAsync(long timeout, TimeUnit unit, String... queueNames) {
RFuture<V> takeFuture = commandExecutor.pollFromAnyAsync(getName(), codec, RedisCommands.BLPOP_VALUE, toSeconds(timeout, unit), queueNames);
return wrapTakeFuture(takeFuture);
} | java | @Override
public RFuture<V> pollFromAnyAsync(long timeout, TimeUnit unit, String... queueNames) {
RFuture<V> takeFuture = commandExecutor.pollFromAnyAsync(getName(), codec, RedisCommands.BLPOP_VALUE, toSeconds(timeout, unit), queueNames);
return wrapTakeFuture(takeFuture);
} | [
"@",
"Override",
"public",
"RFuture",
"<",
"V",
">",
"pollFromAnyAsync",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
",",
"String",
"...",
"queueNames",
")",
"{",
"RFuture",
"<",
"V",
">",
"takeFuture",
"=",
"commandExecutor",
".",
"pollFromAnyAsync",
"... | /*
(non-Javadoc)
@see org.redisson.core.RBlockingQueueAsync#pollFromAnyAsync(long, java.util.concurrent.TimeUnit, java.lang.String[]) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/RedissonBoundedBlockingQueue.java#L229-L233 | train | Asynchronously poll the cache entry from the cache. | [
30522,
1030,
2058,
15637,
2270,
21792,
4904,
5397,
1026,
1058,
1028,
8554,
19699,
20778,
16303,
6038,
2278,
1006,
2146,
2051,
5833,
1010,
2051,
19496,
2102,
3131,
1010,
5164,
1012,
1012,
1012,
24240,
18442,
2015,
1007,
1063,
21792,
4904,
53... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/ActiveEntity.java | ActiveEntity.load | public ActiveEntity load() {
try {
final Entity result = db.get(this);
if(MapUtil.isNotEmpty(result)) {
this.putAll(result);
}
} catch (SQLException e) {
throw new DbRuntimeException(e);
}
return this;
} | java | public ActiveEntity load() {
try {
final Entity result = db.get(this);
if(MapUtil.isNotEmpty(result)) {
this.putAll(result);
}
} catch (SQLException e) {
throw new DbRuntimeException(e);
}
return this;
} | [
"public",
"ActiveEntity",
"load",
"(",
")",
"{",
"try",
"{",
"final",
"Entity",
"result",
"=",
"db",
".",
"get",
"(",
"this",
")",
";",
"if",
"(",
"MapUtil",
".",
"isNotEmpty",
"(",
"result",
")",
")",
"{",
"this",
".",
"putAll",
"(",
"result",
")"... | 根据Entity中现有字段条件从数据库中加载一个Entity对象
@return this | [
"根据Entity中现有字段条件从数据库中加载一个Entity对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/ActiveEntity.java#L191-L201 | train | Loads the entity from the database. | [
30522,
2270,
3161,
4765,
3012,
7170,
1006,
1007,
1063,
3046,
1063,
2345,
9178,
2765,
1027,
16962,
1012,
2131,
1006,
2023,
1007,
1025,
2065,
1006,
4949,
21823,
2140,
1012,
3475,
12184,
27718,
2100,
1006,
2765,
1007,
1007,
1063,
2023,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/CEP.java | CEP.pattern | public static <T> PatternStream<T> pattern(DataStream<T> input, Pattern<T, ?> pattern) {
return new PatternStream<>(input, pattern);
} | java | public static <T> PatternStream<T> pattern(DataStream<T> input, Pattern<T, ?> pattern) {
return new PatternStream<>(input, pattern);
} | [
"public",
"static",
"<",
"T",
">",
"PatternStream",
"<",
"T",
">",
"pattern",
"(",
"DataStream",
"<",
"T",
">",
"input",
",",
"Pattern",
"<",
"T",
",",
"?",
">",
"pattern",
")",
"{",
"return",
"new",
"PatternStream",
"<>",
"(",
"input",
",",
"pattern... | Creates a {@link PatternStream} from an input data stream and a pattern.
@param input DataStream containing the input events
@param pattern Pattern specification which shall be detected
@param <T> Type of the input events
@return Resulting pattern stream | [
"Creates",
"a",
"{",
"@link",
"PatternStream",
"}",
"from",
"an",
"input",
"data",
"stream",
"and",
"a",
"pattern",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/CEP.java#L38-L40 | train | Creates a pattern stream from a data stream and a pattern. | [
30522,
2270,
10763,
1026,
1056,
1028,
7060,
25379,
1026,
1056,
1028,
5418,
1006,
2951,
21422,
1026,
1056,
1028,
7953,
1010,
5418,
1026,
1056,
1010,
1029,
1028,
5418,
1007,
1063,
2709,
2047,
7060,
25379,
1026,
1028,
1006,
7953,
1010,
5418,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/Unpooled.java | Unpooled.copyShort | public static ByteBuf copyShort(int value) {
ByteBuf buf = buffer(2);
buf.writeShort(value);
return buf;
} | java | public static ByteBuf copyShort(int value) {
ByteBuf buf = buffer(2);
buf.writeShort(value);
return buf;
} | [
"public",
"static",
"ByteBuf",
"copyShort",
"(",
"int",
"value",
")",
"{",
"ByteBuf",
"buf",
"=",
"buffer",
"(",
"2",
")",
";",
"buf",
".",
"writeShort",
"(",
"value",
")",
";",
"return",
"buf",
";",
"}"
] | Creates a new 2-byte big-endian buffer that holds the specified 16-bit integer. | [
"Creates",
"a",
"new",
"2",
"-",
"byte",
"big",
"-",
"endian",
"buffer",
"that",
"holds",
"the",
"specified",
"16",
"-",
"bit",
"integer",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L699-L703 | train | Create a new big - endian buffer that holds a single short integer. | [
30522,
2270,
10763,
24880,
8569,
2546,
6100,
22231,
5339,
1006,
20014,
3643,
1007,
1063,
24880,
8569,
2546,
20934,
2546,
1027,
17698,
1006,
1016,
1007,
1025,
20934,
2546,
1012,
7009,
27794,
1006,
3643,
1007,
1025,
2709,
20934,
2546,
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/date/format/FastDateFormat.java | FastDateFormat.getTimeInstance | public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone, final Locale locale) {
return cache.getTimeInstance(style, timeZone, locale);
} | java | public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone, final Locale locale) {
return cache.getTimeInstance(style, timeZone, locale);
} | [
"public",
"static",
"FastDateFormat",
"getTimeInstance",
"(",
"final",
"int",
"style",
",",
"final",
"TimeZone",
"timeZone",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"cache",
".",
"getTimeInstance",
"(",
"style",
",",
"timeZone",
",",
"locale",
")... | 获得 {@link FastDateFormat} 实例<br>
支持缓存
@param style time style: FULL, LONG, MEDIUM, or SHORT
@param timeZone optional time zone, overrides time zone of formatted time
@param locale {@link Locale} 日期地理位置
@return 本地化 {@link FastDateFormat} | [
"获得",
"{",
"@link",
"FastDateFormat",
"}",
"实例<br",
">",
"支持缓存"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L207-L209 | train | Gets the time instance. | [
30522,
2270,
10763,
3435,
13701,
14192,
4017,
2131,
7292,
7076,
26897,
1006,
2345,
20014,
2806,
1010,
2345,
2051,
15975,
2051,
15975,
1010,
2345,
2334,
2063,
2334,
2063,
1007,
1063,
2709,
17053,
1012,
2131,
7292,
7076,
26897,
1006,
2806,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/proxy/GraphAlgorithmWrappingBase.java | GraphAlgorithmWrappingBase.setParallelism | public GraphAlgorithmWrappingBase<K, VV, EV, R> setParallelism(int parallelism) {
Preconditions.checkArgument(parallelism > 0 || parallelism == PARALLELISM_DEFAULT,
"The parallelism must be at least one, or ExecutionConfig.PARALLELISM_DEFAULT (use system default).");
this.parallelism = parallelism;
return this;
} | java | public GraphAlgorithmWrappingBase<K, VV, EV, R> setParallelism(int parallelism) {
Preconditions.checkArgument(parallelism > 0 || parallelism == PARALLELISM_DEFAULT,
"The parallelism must be at least one, or ExecutionConfig.PARALLELISM_DEFAULT (use system default).");
this.parallelism = parallelism;
return this;
} | [
"public",
"GraphAlgorithmWrappingBase",
"<",
"K",
",",
"VV",
",",
"EV",
",",
"R",
">",
"setParallelism",
"(",
"int",
"parallelism",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"parallelism",
">",
"0",
"||",
"parallelism",
"==",
"PARALLELISM_DEFAULT",
... | Set the parallelism for this algorithm's operators. This parameter is
necessary because processing a small amount of data with high operator
parallelism is slow and wasteful with memory and buffers.
<p>Operator parallelism should be set to this given value unless
processing asymptotically more data, in which case the default job
parallelism should be inherited.
@param parallelism operator parallelism
@return this | [
"Set",
"the",
"parallelism",
"for",
"this",
"algorithm",
"s",
"operators",
".",
"This",
"parameter",
"is",
"necessary",
"because",
"processing",
"a",
"small",
"amount",
"of",
"data",
"with",
"high",
"operator",
"parallelism",
"is",
"slow",
"and",
"wasteful",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/proxy/GraphAlgorithmWrappingBase.java#L59-L66 | train | Sets the parallelism of the algorithm. | [
30522,
2270,
10629,
2389,
20255,
8939,
2213,
13088,
29098,
2075,
15058,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1010,
1054,
1028,
2275,
28689,
6216,
28235,
1006,
20014,
5903,
2964,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
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/ClassUtil.java | ClassUtil.isPublic | public static boolean isPublic(Method method) {
Assert.notNull(method, "Method to provided is null.");
return Modifier.isPublic(method.getModifiers());
} | java | public static boolean isPublic(Method method) {
Assert.notNull(method, "Method to provided is null.");
return Modifier.isPublic(method.getModifiers());
} | [
"public",
"static",
"boolean",
"isPublic",
"(",
"Method",
"method",
")",
"{",
"Assert",
".",
"notNull",
"(",
"method",
",",
"\"Method to provided is null.\"",
")",
";",
"return",
"Modifier",
".",
"isPublic",
"(",
"method",
".",
"getModifiers",
"(",
")",
")",
... | 指定方法是否为Public
@param method 方法
@return 是否为public | [
"指定方法是否为Public"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L816-L819 | train | Checks if the given method is public. | [
30522,
2270,
10763,
30524,
2003,
14289,
16558,
2594,
1006,
4118,
1012,
2131,
5302,
4305,
8873,
2545,
1006,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/filewatch/FileSystemWatcher.java | FileSystemWatcher.stopAfter | void stopAfter(int remainingScans) {
Thread thread;
synchronized (this.monitor) {
thread = this.watchThread;
if (thread != null) {
this.remainingScans.set(remainingScans);
if (remainingScans <= 0) {
thread.interrupt();
}
}
this.watchThread = null;
}
if (thread != null && Thread.currentThread() != thread) {
try {
thread.join();
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
} | java | void stopAfter(int remainingScans) {
Thread thread;
synchronized (this.monitor) {
thread = this.watchThread;
if (thread != null) {
this.remainingScans.set(remainingScans);
if (remainingScans <= 0) {
thread.interrupt();
}
}
this.watchThread = null;
}
if (thread != null && Thread.currentThread() != thread) {
try {
thread.join();
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
} | [
"void",
"stopAfter",
"(",
"int",
"remainingScans",
")",
"{",
"Thread",
"thread",
";",
"synchronized",
"(",
"this",
".",
"monitor",
")",
"{",
"thread",
"=",
"this",
".",
"watchThread",
";",
"if",
"(",
"thread",
"!=",
"null",
")",
"{",
"this",
".",
"rema... | Stop monitoring the source folders.
@param remainingScans the number of remaining scans | [
"Stop",
"monitoring",
"the",
"source",
"folders",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java#L187-L207 | train | Stop the watch thread after the number of scans have been exhausted. | [
30522,
11675,
2644,
10354,
3334,
1006,
20014,
3588,
29378,
2015,
1007,
1063,
11689,
11689,
1025,
25549,
1006,
2023,
1012,
8080,
1007,
1063,
11689,
1027,
2023,
1012,
3422,
2705,
16416,
2094,
1025,
2065,
1006,
11689,
999,
1027,
19701,
1007,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/FailoverRegion.java | FailoverRegion.cancel | private void cancel(final long globalModVersionOfFailover) {
executionGraph.getJobMasterMainThreadExecutor().assertRunningInMainThread();
while (true) {
JobStatus curStatus = this.state;
if (curStatus.equals(JobStatus.RUNNING)) {
if (transitionState(curStatus, JobStatus.CANCELLING)) {
createTerminationFutureOverAllConnectedVertexes()
.thenAccept((nullptr) -> allVerticesInTerminalState(globalModVersionOfFailover));
break;
}
} else {
LOG.info("FailoverRegion {} is {} when cancel.", id, state);
break;
}
}
} | java | private void cancel(final long globalModVersionOfFailover) {
executionGraph.getJobMasterMainThreadExecutor().assertRunningInMainThread();
while (true) {
JobStatus curStatus = this.state;
if (curStatus.equals(JobStatus.RUNNING)) {
if (transitionState(curStatus, JobStatus.CANCELLING)) {
createTerminationFutureOverAllConnectedVertexes()
.thenAccept((nullptr) -> allVerticesInTerminalState(globalModVersionOfFailover));
break;
}
} else {
LOG.info("FailoverRegion {} is {} when cancel.", id, state);
break;
}
}
} | [
"private",
"void",
"cancel",
"(",
"final",
"long",
"globalModVersionOfFailover",
")",
"{",
"executionGraph",
".",
"getJobMasterMainThreadExecutor",
"(",
")",
".",
"assertRunningInMainThread",
"(",
")",
";",
"while",
"(",
"true",
")",
"{",
"JobStatus",
"curStatus",
... | cancel all executions in this sub graph | [
"cancel",
"all",
"executions",
"in",
"this",
"sub",
"graph"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/FailoverRegion.java#L140-L156 | train | Cancel the failover region. | [
30522,
2797,
11675,
17542,
1006,
2345,
2146,
3795,
5302,
2094,
27774,
7245,
12502,
7840,
1007,
1063,
7781,
14413,
1012,
2131,
5558,
25526,
24268,
24238,
2705,
16416,
3207,
2595,
8586,
16161,
2099,
1006,
1007,
1012,
20865,
15532,
5582,
2378,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | client/src/main/java/com/networknt/client/oauth/TokenManager.java | TokenManager.getJwt | public Result<Jwt> getJwt(Jwt.Key key) {
Jwt cachedJwt = getJwt(cacheStrategy, key);
Result<Jwt> result = OauthHelper.populateCCToken(cachedJwt);
//update JWT
if (result.isSuccess()) {
cacheStrategy.cacheJwt(key, result.getResult());
}
return result;
} | java | public Result<Jwt> getJwt(Jwt.Key key) {
Jwt cachedJwt = getJwt(cacheStrategy, key);
Result<Jwt> result = OauthHelper.populateCCToken(cachedJwt);
//update JWT
if (result.isSuccess()) {
cacheStrategy.cacheJwt(key, result.getResult());
}
return result;
} | [
"public",
"Result",
"<",
"Jwt",
">",
"getJwt",
"(",
"Jwt",
".",
"Key",
"key",
")",
"{",
"Jwt",
"cachedJwt",
"=",
"getJwt",
"(",
"cacheStrategy",
",",
"key",
")",
";",
"Result",
"<",
"Jwt",
">",
"result",
"=",
"OauthHelper",
".",
"populateCCToken",
"(",... | get a Jwt with a provided Key (Key is either scope or a service id inputted by user, for caching usage):
1.if a token is cached with provided key
- if the token is expired, renew it right away.
- if the token is almost expired, use this token and renew it silently.
- if the token is not almost expired, just use this token.
2.if a token is not cached with provided key
- get a new jwt from oauth server
3.after getting the valid token, cache that token no matter if it's already cached or not. The strategy should determine how to cache it.
@param key either based on scope or service id
@return a Jwt if successful, otherwise return error Status. | [
"get",
"a",
"Jwt",
"with",
"a",
"provided",
"Key",
"(",
"Key",
"is",
"either",
"scope",
"or",
"a",
"service",
"id",
"inputted",
"by",
"user",
"for",
"caching",
"usage",
")",
":",
"1",
".",
"if",
"a",
"token",
"is",
"cached",
"with",
"provided",
"key"... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/TokenManager.java#L75-L84 | train | Get a JWT from the cache. | [
30522,
2270,
2765,
1026,
1046,
26677,
1028,
2131,
3501,
26677,
1006,
1046,
26677,
1012,
3145,
3145,
1007,
1063,
1046,
26677,
17053,
2094,
3501,
26677,
1027,
2131,
3501,
26677,
1006,
17053,
20528,
2618,
6292,
1010,
3145,
1007,
1025,
2765,
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-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java | ExcelWriter.merge | public ExcelWriter merge(int lastColumn, Object content, boolean isSetHeaderStyle) {
Assert.isFalse(this.isClosed, "ExcelWriter has been closed!");
final int rowIndex = this.currentRow.get();
merge(rowIndex, rowIndex, 0, lastColumn, content, isSetHeaderStyle);
// 设置内容后跳到下一行
if (null != content) {
this.currentRow.incrementAndGet();
}
return this;
} | java | public ExcelWriter merge(int lastColumn, Object content, boolean isSetHeaderStyle) {
Assert.isFalse(this.isClosed, "ExcelWriter has been closed!");
final int rowIndex = this.currentRow.get();
merge(rowIndex, rowIndex, 0, lastColumn, content, isSetHeaderStyle);
// 设置内容后跳到下一行
if (null != content) {
this.currentRow.incrementAndGet();
}
return this;
} | [
"public",
"ExcelWriter",
"merge",
"(",
"int",
"lastColumn",
",",
"Object",
"content",
",",
"boolean",
"isSetHeaderStyle",
")",
"{",
"Assert",
".",
"isFalse",
"(",
"this",
".",
"isClosed",
",",
"\"ExcelWriter has been closed!\"",
")",
";",
"final",
"int",
"rowInd... | 合并某行的单元格,并写入对象到单元格<br>
如果写到单元格中的内容非null,行号自动+1,否则当前行号不变<br>
样式为默认标题样式,可使用{@link #getHeadCellStyle()}方法调用后自定义默认样式
@param lastColumn 合并到的最后一个列号
@param content 合并单元格后的内容
@param isSetHeaderStyle 是否为合并后的单元格设置默认标题样式
@return this
@since 4.0.10 | [
"合并某行的单元格,并写入对象到单元格<br",
">",
"如果写到单元格中的内容非null,行号自动",
"+",
"1,否则当前行号不变<br",
">",
"样式为默认标题样式,可使用",
"{",
"@link",
"#getHeadCellStyle",
"()",
"}",
"方法调用后自定义默认样式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L518-L529 | train | Merges the specified content with the specified last column. | [
30522,
2270,
24970,
15994,
13590,
1006,
20014,
2197,
25778,
2819,
2078,
1010,
4874,
4180,
1010,
22017,
20898,
26354,
11031,
13775,
2545,
27983,
1007,
1063,
20865,
1012,
2003,
7011,
4877,
2063,
1006,
2023,
1012,
2003,
20464,
24768,
1010,
1000,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java | SslContextBuilder.trustManager | public SslContextBuilder trustManager(File trustCertCollectionFile) {
try {
return trustManager(SslContext.toX509Certificates(trustCertCollectionFile));
} catch (Exception e) {
throw new IllegalArgumentException("File does not contain valid certificates: "
+ trustCertCollectionFile, e);
}
} | java | public SslContextBuilder trustManager(File trustCertCollectionFile) {
try {
return trustManager(SslContext.toX509Certificates(trustCertCollectionFile));
} catch (Exception e) {
throw new IllegalArgumentException("File does not contain valid certificates: "
+ trustCertCollectionFile, e);
}
} | [
"public",
"SslContextBuilder",
"trustManager",
"(",
"File",
"trustCertCollectionFile",
")",
"{",
"try",
"{",
"return",
"trustManager",
"(",
"SslContext",
".",
"toX509Certificates",
"(",
"trustCertCollectionFile",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
... | Trusted certificates for verifying the remote endpoint's certificate. The file should
contain an X.509 certificate collection in PEM format. {@code null} uses the system default. | [
"Trusted",
"certificates",
"for",
"verifying",
"the",
"remote",
"endpoint",
"s",
"certificate",
".",
"The",
"file",
"should",
"contain",
"an",
"X",
".",
"509",
"certificate",
"collection",
"in",
"PEM",
"format",
".",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L178-L185 | train | Create a SslContextBuilder using the specified trust certificate collection file. | [
30522,
2270,
7020,
22499,
10111,
18413,
8569,
23891,
2099,
3404,
24805,
4590,
1006,
5371,
3404,
17119,
13535,
14511,
18491,
8873,
2571,
1007,
1063,
3046,
1063,
2709,
3404,
24805,
4590,
1006,
7020,
22499,
10111,
18413,
1012,
2000,
2595,
12376,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java | TypeUtil.getClass | public static Class<?> getClass(Type type) {
if (null != type) {
if (type instanceof Class) {
return (Class<?>) type;
} else if (type instanceof ParameterizedType) {
return (Class<?>) ((ParameterizedType) type).getRawType();
} else if (type instanceof TypeVariable) {
return (Class<?>) ((TypeVariable<?>) type).getBounds()[0];
} else if (type instanceof WildcardType) {
final Type[] upperBounds = ((WildcardType) type).getUpperBounds();
if (upperBounds.length == 1) {
return getClass(upperBounds[0]);
}
}
}
return null;
} | java | public static Class<?> getClass(Type type) {
if (null != type) {
if (type instanceof Class) {
return (Class<?>) type;
} else if (type instanceof ParameterizedType) {
return (Class<?>) ((ParameterizedType) type).getRawType();
} else if (type instanceof TypeVariable) {
return (Class<?>) ((TypeVariable<?>) type).getBounds()[0];
} else if (type instanceof WildcardType) {
final Type[] upperBounds = ((WildcardType) type).getUpperBounds();
if (upperBounds.length == 1) {
return getClass(upperBounds[0]);
}
}
}
return null;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getClass",
"(",
"Type",
"type",
")",
"{",
"if",
"(",
"null",
"!=",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"Class",
")",
"{",
"return",
"(",
"Class",
"<",
"?",
">",
")",
"type",
";",
"}",
... | 获得Type对应的原始类
@param type {@link Type}
@return 原始类,如果无法获取原始类,返回{@code null} | [
"获得Type对应的原始类"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java#L33-L49 | train | Gets the Class<? > for the given type. | [
30522,
2270,
10763,
2465,
1026,
1029,
1028,
2131,
26266,
1006,
2828,
2828,
1007,
1063,
2065,
1006,
19701,
999,
1027,
2828,
1007,
1063,
2065,
1006,
2828,
6013,
11253,
2465,
1007,
1063,
2709,
1006,
2465,
1026,
1029,
1028,
1007,
2828,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.isStatic | public static boolean isStatic(Method method) {
Assert.notNull(method, "Method to provided is null.");
return Modifier.isStatic(method.getModifiers());
} | java | public static boolean isStatic(Method method) {
Assert.notNull(method, "Method to provided is null.");
return Modifier.isStatic(method.getModifiers());
} | [
"public",
"static",
"boolean",
"isStatic",
"(",
"Method",
"method",
")",
"{",
"Assert",
".",
"notNull",
"(",
"method",
",",
"\"Method to provided is null.\"",
")",
";",
"return",
"Modifier",
".",
"isStatic",
"(",
"method",
".",
"getModifiers",
"(",
")",
")",
... | 是否为静态方法
@param method 方法
@return 是否为静态方法 | [
"是否为静态方法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L847-L850 | train | Checks if the given method is static. | [
30522,
2270,
10763,
22017,
20898,
26354,
29336,
2594,
1006,
4118,
4118,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
4118,
1010,
1000,
4118,
2000,
3024,
2003,
19701,
1012,
1000,
1007,
1025,
2709,
16913,
18095,
1012,
26354,
29336,
2594,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/cli/Args.java | Args.parseOrExit | public static List<String> parseOrExit(Object target, String[] args)
{
try
{
return parse(target, args);
}
catch (IllegalArgumentException e)
{
System.err.println(e.getMessage());
Args.usage(target);
System.exit(1);
throw e;
}
} | java | public static List<String> parseOrExit(Object target, String[] args)
{
try
{
return parse(target, args);
}
catch (IllegalArgumentException e)
{
System.err.println(e.getMessage());
Args.usage(target);
System.exit(1);
throw e;
}
} | [
"public",
"static",
"List",
"<",
"String",
">",
"parseOrExit",
"(",
"Object",
"target",
",",
"String",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"return",
"parse",
"(",
"target",
",",
"args",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
... | A convenience method for parsing and automatically producing error messages.
@param target Either an instance or a class
@param args The arguments you want to parse and populate
@return The list of arguments that were not consumed | [
"A",
"convenience",
"method",
"for",
"parsing",
"and",
"automatically",
"producing",
"error",
"messages",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/cli/Args.java#L30-L43 | train | Parses the target object or exits with an error if an exception occurs. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
11968,
3366,
5686,
9048,
2102,
1006,
4874,
4539,
1010,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
3046,
1063,
2709,
11968,
3366,
1006,
4539,
1010,
12098,
5620,
1007,
1025,
1065,
4608,
1006,
6206,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/concurrent/FutureUtils.java | FutureUtils.combineAll | public static <T> ConjunctFuture<Collection<T>> combineAll(Collection<? extends CompletableFuture<? extends T>> futures) {
checkNotNull(futures, "futures");
return new ResultConjunctFuture<>(futures);
} | java | public static <T> ConjunctFuture<Collection<T>> combineAll(Collection<? extends CompletableFuture<? extends T>> futures) {
checkNotNull(futures, "futures");
return new ResultConjunctFuture<>(futures);
} | [
"public",
"static",
"<",
"T",
">",
"ConjunctFuture",
"<",
"Collection",
"<",
"T",
">",
">",
"combineAll",
"(",
"Collection",
"<",
"?",
"extends",
"CompletableFuture",
"<",
"?",
"extends",
"T",
">",
">",
"futures",
")",
"{",
"checkNotNull",
"(",
"futures",
... | Creates a future that is complete once multiple other futures completed.
The future fails (completes exceptionally) once one of the futures in the
conjunction fails. Upon successful completion, the future returns the
collection of the futures' results.
<p>The ConjunctFuture gives access to how many Futures in the conjunction have already
completed successfully, via {@link ConjunctFuture#getNumFuturesCompleted()}.
@param futures The futures that make up the conjunction. No null entries are allowed.
@return The ConjunctFuture that completes once all given futures are complete (or one fails). | [
"Creates",
"a",
"future",
"that",
"is",
"complete",
"once",
"multiple",
"other",
"futures",
"completed",
".",
"The",
"future",
"fails",
"(",
"completes",
"exceptionally",
")",
"once",
"one",
"of",
"the",
"futures",
"in",
"the",
"conjunction",
"fails",
".",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java#L511-L515 | train | Combine all the given futures into a single one. | [
30522,
2270,
10763,
1026,
1056,
1028,
9530,
19792,
6593,
11263,
11244,
1026,
3074,
1026,
1056,
1028,
1028,
11506,
8095,
1006,
3074,
1026,
1029,
8908,
4012,
10814,
10880,
11263,
11244,
1026,
1029,
8908,
1056,
1028,
1028,
17795,
1007,
1063,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/Convert.java | Convert.bytesToLong | public static long bytesToLong(byte[] bytes) {
// Magic number 8 should be defined as Long.SIZE / Byte.SIZE
long values = 0;
for (int i = 0; i < 8; i++) {
values <<= 8;
values |= (bytes[i] & 0xff);
}
return values;
} | java | public static long bytesToLong(byte[] bytes) {
// Magic number 8 should be defined as Long.SIZE / Byte.SIZE
long values = 0;
for (int i = 0; i < 8; i++) {
values <<= 8;
values |= (bytes[i] & 0xff);
}
return values;
} | [
"public",
"static",
"long",
"bytesToLong",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"// Magic number 8 should be defined as Long.SIZE / Byte.SIZE\r",
"long",
"values",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"++",
")... | byte数组转long<br>
from: https://stackoverflow.com/questions/4485128/how-do-i-convert-long-to-byte-and-back-in-java
@param bytes byte数组
@return long值
@since 3.2.0 | [
"byte数组转long<br",
">",
"from",
":",
"https",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"4485128",
"/",
"how",
"-",
"do",
"-",
"i",
"-",
"convert",
"-",
"long",
"-",
"to",
"-",
"byte",
"-",
"and",
"-",
"back",
"-",
"in",
"-",
... | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L969-L977 | train | Converts a byte array to a long value. | [
30522,
2270,
10763,
2146,
27507,
3406,
10052,
1006,
24880,
1031,
1033,
27507,
1007,
1063,
1013,
1013,
3894,
2193,
1022,
2323,
2022,
4225,
2004,
2146,
1012,
2946,
1013,
24880,
1012,
2946,
2146,
5300,
1027,
1014,
1025,
2005,
1006,
20014,
1045... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanDesc.java | BeanDesc.isMatchGetter | private boolean isMatchGetter(String methodName, String fieldName, boolean isBooeanField) {
// 全部转为小写,忽略大小写比较
methodName = methodName.toLowerCase();
fieldName = fieldName.toLowerCase();
if (false == methodName.startsWith("get") && false == methodName.startsWith("is")) {
// 非标准Getter方法
return false;
}
if("getclass".equals(methodName)) {
//跳过getClass方法
return false;
}
// 针对Boolean类型特殊检查
if (isBooeanField) {
if (fieldName.startsWith("is")) {
// 字段已经是is开头
if (methodName.equals(fieldName) // isName -》 isName
|| methodName.equals("get" + fieldName)// isName -》 getIsName
|| methodName.equals("is" + fieldName)// isName -》 isIsName
) {
return true;
}
} else if (methodName.equals("is" + fieldName)) {
// 字段非is开头, name -》 isName
return true;
}
}
// 包括boolean的任何类型只有一种匹配情况:name -》 getName
return methodName.equals("get" + fieldName);
} | java | private boolean isMatchGetter(String methodName, String fieldName, boolean isBooeanField) {
// 全部转为小写,忽略大小写比较
methodName = methodName.toLowerCase();
fieldName = fieldName.toLowerCase();
if (false == methodName.startsWith("get") && false == methodName.startsWith("is")) {
// 非标准Getter方法
return false;
}
if("getclass".equals(methodName)) {
//跳过getClass方法
return false;
}
// 针对Boolean类型特殊检查
if (isBooeanField) {
if (fieldName.startsWith("is")) {
// 字段已经是is开头
if (methodName.equals(fieldName) // isName -》 isName
|| methodName.equals("get" + fieldName)// isName -》 getIsName
|| methodName.equals("is" + fieldName)// isName -》 isIsName
) {
return true;
}
} else if (methodName.equals("is" + fieldName)) {
// 字段非is开头, name -》 isName
return true;
}
}
// 包括boolean的任何类型只有一种匹配情况:name -》 getName
return methodName.equals("get" + fieldName);
} | [
"private",
"boolean",
"isMatchGetter",
"(",
"String",
"methodName",
",",
"String",
"fieldName",
",",
"boolean",
"isBooeanField",
")",
"{",
"// 全部转为小写,忽略大小写比较\r",
"methodName",
"=",
"methodName",
".",
"toLowerCase",
"(",
")",
";",
"fieldName",
"=",
"fieldName",
"."... | 方法是否为Getter方法<br>
匹配规则如下(忽略大小写):
<pre>
字段名 -》 方法名
isName -》 isName
isName -》 isIsName
isName -》 getIsName
name -》 isName
name -》 getName
</pre>
@param methodName 方法名
@param fieldName 字段名
@param isBooeanField 是否为Boolean类型字段
@return 是否匹配 | [
"方法是否为Getter方法<br",
">",
"匹配规则如下(忽略大小写):"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanDesc.java#L217-L249 | train | Checks if the specified method name and field name match the getter method name. | [
30522,
2797,
22017,
20898,
2003,
18900,
2818,
18150,
3334,
1006,
5164,
4118,
18442,
1010,
5164,
2492,
18442,
1010,
22017,
20898,
2003,
5092,
8913,
2319,
3790,
1007,
1063,
1013,
1013,
100,
1960,
100,
100,
1829,
100,
1989,
100,
100,
1810,
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/typeutils/CompositeType.java | CompositeType.createComparator | @PublicEvolving
public TypeComparator<T> createComparator(int[] logicalKeyFields, boolean[] orders, int logicalFieldOffset, ExecutionConfig config) {
TypeComparatorBuilder<T> builder = createTypeComparatorBuilder();
builder.initializeTypeComparatorBuilder(logicalKeyFields.length);
for (int logicalKeyFieldIndex = 0; logicalKeyFieldIndex < logicalKeyFields.length; logicalKeyFieldIndex++) {
int logicalKeyField = logicalKeyFields[logicalKeyFieldIndex];
int logicalField = logicalFieldOffset; // this is the global/logical field number
boolean comparatorAdded = false;
for (int localFieldId = 0; localFieldId < this.getArity() && logicalField <= logicalKeyField && !comparatorAdded; localFieldId++) {
TypeInformation<?> localFieldType = this.getTypeAt(localFieldId);
if (localFieldType instanceof AtomicType && logicalField == logicalKeyField) {
// we found an atomic key --> create comparator
builder.addComparatorField(
localFieldId,
((AtomicType<?>) localFieldType).createComparator(
orders[logicalKeyFieldIndex],
config));
comparatorAdded = true;
}
// must be composite type and check that the logicalKeyField is within the bounds
// of the composite type's logical fields
else if (localFieldType instanceof CompositeType &&
logicalField <= logicalKeyField &&
logicalKeyField <= logicalField + (localFieldType.getTotalFields() - 1)) {
// we found a compositeType that is containing the logicalKeyField we are looking for --> create comparator
builder.addComparatorField(
localFieldId,
((CompositeType<?>) localFieldType).createComparator(
new int[]{logicalKeyField},
new boolean[]{orders[logicalKeyFieldIndex]},
logicalField,
config)
);
comparatorAdded = true;
}
if (localFieldType instanceof CompositeType) {
// we need to subtract 1 because we are not accounting for the local field (not accessible for the user)
logicalField += localFieldType.getTotalFields() - 1;
}
logicalField++;
}
if (!comparatorAdded) {
throw new IllegalArgumentException("Could not add a comparator for the logical" +
"key field index " + logicalKeyFieldIndex + ".");
}
}
return builder.createTypeComparator(config);
} | java | @PublicEvolving
public TypeComparator<T> createComparator(int[] logicalKeyFields, boolean[] orders, int logicalFieldOffset, ExecutionConfig config) {
TypeComparatorBuilder<T> builder = createTypeComparatorBuilder();
builder.initializeTypeComparatorBuilder(logicalKeyFields.length);
for (int logicalKeyFieldIndex = 0; logicalKeyFieldIndex < logicalKeyFields.length; logicalKeyFieldIndex++) {
int logicalKeyField = logicalKeyFields[logicalKeyFieldIndex];
int logicalField = logicalFieldOffset; // this is the global/logical field number
boolean comparatorAdded = false;
for (int localFieldId = 0; localFieldId < this.getArity() && logicalField <= logicalKeyField && !comparatorAdded; localFieldId++) {
TypeInformation<?> localFieldType = this.getTypeAt(localFieldId);
if (localFieldType instanceof AtomicType && logicalField == logicalKeyField) {
// we found an atomic key --> create comparator
builder.addComparatorField(
localFieldId,
((AtomicType<?>) localFieldType).createComparator(
orders[logicalKeyFieldIndex],
config));
comparatorAdded = true;
}
// must be composite type and check that the logicalKeyField is within the bounds
// of the composite type's logical fields
else if (localFieldType instanceof CompositeType &&
logicalField <= logicalKeyField &&
logicalKeyField <= logicalField + (localFieldType.getTotalFields() - 1)) {
// we found a compositeType that is containing the logicalKeyField we are looking for --> create comparator
builder.addComparatorField(
localFieldId,
((CompositeType<?>) localFieldType).createComparator(
new int[]{logicalKeyField},
new boolean[]{orders[logicalKeyFieldIndex]},
logicalField,
config)
);
comparatorAdded = true;
}
if (localFieldType instanceof CompositeType) {
// we need to subtract 1 because we are not accounting for the local field (not accessible for the user)
logicalField += localFieldType.getTotalFields() - 1;
}
logicalField++;
}
if (!comparatorAdded) {
throw new IllegalArgumentException("Could not add a comparator for the logical" +
"key field index " + logicalKeyFieldIndex + ".");
}
}
return builder.createTypeComparator(config);
} | [
"@",
"PublicEvolving",
"public",
"TypeComparator",
"<",
"T",
">",
"createComparator",
"(",
"int",
"[",
"]",
"logicalKeyFields",
",",
"boolean",
"[",
"]",
"orders",
",",
"int",
"logicalFieldOffset",
",",
"ExecutionConfig",
"config",
")",
"{",
"TypeComparatorBuilder... | Generic implementation of the comparator creation. Composite types are supplying the infrastructure
to create the actual comparators
@return The comparator | [
"Generic",
"implementation",
"of",
"the",
"comparator",
"creation",
".",
"Composite",
"types",
"are",
"supplying",
"the",
"infrastructure",
"to",
"create",
"the",
"actual",
"comparators"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/CompositeType.java#L110-L168 | train | Creates a type comparator for the given logical key fields. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
2828,
9006,
28689,
4263,
1026,
1056,
1028,
3443,
9006,
28689,
4263,
1006,
20014,
1031,
1033,
11177,
14839,
15155,
1010,
22017,
20898,
1031,
1033,
4449,
1010,
20014,
11177,
3790,
27475,
3388,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-0.9/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/Kafka09Fetcher.java | Kafka09Fetcher.runFetchLoop | @Override
public void runFetchLoop() throws Exception {
try {
final Handover handover = this.handover;
// kick off the actual Kafka consumer
consumerThread.start();
while (running) {
// this blocks until we get the next records
// it automatically re-throws exceptions encountered in the consumer thread
final ConsumerRecords<byte[], byte[]> records = handover.pollNext();
// get the records for each topic partition
for (KafkaTopicPartitionState<TopicPartition> partition : subscribedPartitionStates()) {
List<ConsumerRecord<byte[], byte[]>> partitionRecords =
records.records(partition.getKafkaPartitionHandle());
for (ConsumerRecord<byte[], byte[]> record : partitionRecords) {
final T value = deserializer.deserialize(record);
if (deserializer.isEndOfStream(value)) {
// end of stream signaled
running = false;
break;
}
// emit the actual record. this also updates offset state atomically
// and deals with timestamps and watermark generation
emitRecord(value, partition, record.offset(), record);
}
}
}
}
finally {
// this signals the consumer thread that no more work is to be done
consumerThread.shutdown();
}
// on a clean exit, wait for the runner thread
try {
consumerThread.join();
}
catch (InterruptedException e) {
// may be the result of a wake-up interruption after an exception.
// we ignore this here and only restore the interruption state
Thread.currentThread().interrupt();
}
} | java | @Override
public void runFetchLoop() throws Exception {
try {
final Handover handover = this.handover;
// kick off the actual Kafka consumer
consumerThread.start();
while (running) {
// this blocks until we get the next records
// it automatically re-throws exceptions encountered in the consumer thread
final ConsumerRecords<byte[], byte[]> records = handover.pollNext();
// get the records for each topic partition
for (KafkaTopicPartitionState<TopicPartition> partition : subscribedPartitionStates()) {
List<ConsumerRecord<byte[], byte[]>> partitionRecords =
records.records(partition.getKafkaPartitionHandle());
for (ConsumerRecord<byte[], byte[]> record : partitionRecords) {
final T value = deserializer.deserialize(record);
if (deserializer.isEndOfStream(value)) {
// end of stream signaled
running = false;
break;
}
// emit the actual record. this also updates offset state atomically
// and deals with timestamps and watermark generation
emitRecord(value, partition, record.offset(), record);
}
}
}
}
finally {
// this signals the consumer thread that no more work is to be done
consumerThread.shutdown();
}
// on a clean exit, wait for the runner thread
try {
consumerThread.join();
}
catch (InterruptedException e) {
// may be the result of a wake-up interruption after an exception.
// we ignore this here and only restore the interruption state
Thread.currentThread().interrupt();
}
} | [
"@",
"Override",
"public",
"void",
"runFetchLoop",
"(",
")",
"throws",
"Exception",
"{",
"try",
"{",
"final",
"Handover",
"handover",
"=",
"this",
".",
"handover",
";",
"// kick off the actual Kafka consumer",
"consumerThread",
".",
"start",
"(",
")",
";",
"whil... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.9/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/Kafka09Fetcher.java#L125-L175 | train | Run the fetch loop. | [
30522,
1030,
2058,
15637,
2270,
11675,
2448,
7959,
10649,
4135,
7361,
1006,
1007,
11618,
6453,
1063,
3046,
1063,
2345,
2192,
7840,
2192,
7840,
1027,
2023,
1012,
2192,
7840,
1025,
1013,
1013,
5926,
2125,
1996,
5025,
10556,
24316,
2050,
7325,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONUtil.java | JSONUtil.parse | public static JSON parse(Object obj) {
if (null == obj) {
return null;
}
JSON json = null;
if (obj instanceof JSON) {
json = (JSON) obj;
} else if (obj instanceof String) {
String jsonStr = ((String) obj).trim();
if (jsonStr.startsWith("[")) {
json = parseArray(jsonStr);
} else {
json = parseObj(jsonStr);
}
} else if (obj instanceof Collection || obj.getClass().isArray()) {// 列表
json = new JSONArray(obj);
} else {// 对象
json = new JSONObject(obj);
}
return json;
} | java | public static JSON parse(Object obj) {
if (null == obj) {
return null;
}
JSON json = null;
if (obj instanceof JSON) {
json = (JSON) obj;
} else if (obj instanceof String) {
String jsonStr = ((String) obj).trim();
if (jsonStr.startsWith("[")) {
json = parseArray(jsonStr);
} else {
json = parseObj(jsonStr);
}
} else if (obj instanceof Collection || obj.getClass().isArray()) {// 列表
json = new JSONArray(obj);
} else {// 对象
json = new JSONObject(obj);
}
return json;
} | [
"public",
"static",
"JSON",
"parse",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"null",
"==",
"obj",
")",
"{",
"return",
"null",
";",
"}",
"JSON",
"json",
"=",
"null",
";",
"if",
"(",
"obj",
"instanceof",
"JSON",
")",
"{",
"json",
"=",
"(",
"JSON... | 转换对象为JSON<br>
支持的对象:<br>
String: 转换为相应的对象<br>
Array Collection:转换为JSONArray<br>
Bean对象:转为JSONObject
@param obj 对象
@return JSON | [
"转换对象为JSON<br",
">",
"支持的对象:<br",
">",
"String",
":",
"转换为相应的对象<br",
">",
"Array",
"Collection:转换为JSONArray<br",
">",
"Bean对象:转为JSONObject"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L140-L162 | train | Parse a
JSON object. | [
30522,
2270,
10763,
1046,
3385,
11968,
3366,
1006,
4874,
27885,
3501,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
27885,
3501,
1007,
1063,
2709,
19701,
1025,
1065,
1046,
3385,
1046,
3385,
1027,
19701,
1025,
2065,
1006,
27885,
3501,
6013,
112... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java | WorkbookUtil.createSXSSFBook | public static SXSSFWorkbook createSXSSFBook(InputStream in, String password, boolean closeAfterRead) {
return toSXSSFBook(createBook(in, password, closeAfterRead));
} | java | public static SXSSFWorkbook createSXSSFBook(InputStream in, String password, boolean closeAfterRead) {
return toSXSSFBook(createBook(in, password, closeAfterRead));
} | [
"public",
"static",
"SXSSFWorkbook",
"createSXSSFBook",
"(",
"InputStream",
"in",
",",
"String",
"password",
",",
"boolean",
"closeAfterRead",
")",
"{",
"return",
"toSXSSFBook",
"(",
"createBook",
"(",
"in",
",",
"password",
",",
"closeAfterRead",
")",
")",
";",... | 创建或加载SXSSFWorkbook工作簿
@param in Excel输入流
@param password 密码
@param closeAfterRead 读取结束是否关闭流
@return {@link SXSSFWorkbook}
@since 4.1.13 | [
"创建或加载SXSSFWorkbook工作簿"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java#L170-L172 | train | Creates a new SXSSFWorkbook from an input stream. | [
30522,
2270,
10763,
1055,
2595,
4757,
2546,
6198,
8654,
9005,
2595,
4757,
26337,
14659,
1006,
20407,
25379,
1999,
1010,
5164,
20786,
1010,
22017,
20898,
2485,
10354,
3334,
16416,
2094,
1007,
1063,
2709,
2000,
2015,
2595,
4757,
26337,
14659,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/concurrent/FutureUtils.java | FutureUtils.composeAfterwards | public static CompletableFuture<Void> composeAfterwards(
CompletableFuture<?> future,
Supplier<CompletableFuture<?>> composedAction) {
final CompletableFuture<Void> resultFuture = new CompletableFuture<>();
future.whenComplete(
(Object outerIgnored, Throwable outerThrowable) -> {
final CompletableFuture<?> composedActionFuture = composedAction.get();
composedActionFuture.whenComplete(
(Object innerIgnored, Throwable innerThrowable) -> {
if (innerThrowable != null) {
resultFuture.completeExceptionally(ExceptionUtils.firstOrSuppressed(innerThrowable, outerThrowable));
} else if (outerThrowable != null) {
resultFuture.completeExceptionally(outerThrowable);
} else {
resultFuture.complete(null);
}
});
});
return resultFuture;
} | java | public static CompletableFuture<Void> composeAfterwards(
CompletableFuture<?> future,
Supplier<CompletableFuture<?>> composedAction) {
final CompletableFuture<Void> resultFuture = new CompletableFuture<>();
future.whenComplete(
(Object outerIgnored, Throwable outerThrowable) -> {
final CompletableFuture<?> composedActionFuture = composedAction.get();
composedActionFuture.whenComplete(
(Object innerIgnored, Throwable innerThrowable) -> {
if (innerThrowable != null) {
resultFuture.completeExceptionally(ExceptionUtils.firstOrSuppressed(innerThrowable, outerThrowable));
} else if (outerThrowable != null) {
resultFuture.completeExceptionally(outerThrowable);
} else {
resultFuture.complete(null);
}
});
});
return resultFuture;
} | [
"public",
"static",
"CompletableFuture",
"<",
"Void",
">",
"composeAfterwards",
"(",
"CompletableFuture",
"<",
"?",
">",
"future",
",",
"Supplier",
"<",
"CompletableFuture",
"<",
"?",
">",
">",
"composedAction",
")",
"{",
"final",
"CompletableFuture",
"<",
"Void... | Run the given asynchronous action after the completion of the given future. The given future can be
completed normally or exceptionally. In case of an exceptional completion, the
asynchronous action's exception will be added to the initial exception.
@param future to wait for its completion
@param composedAction asynchronous action which is triggered after the future's completion
@return Future which is completed after the asynchronous action has completed. This future can contain
an exception if an error occurred in the given future or asynchronous action. | [
"Run",
"the",
"given",
"asynchronous",
"action",
"after",
"the",
"completion",
"of",
"the",
"given",
"future",
".",
"The",
"given",
"future",
"can",
"be",
"completed",
"normally",
"or",
"exceptionally",
".",
"In",
"case",
"of",
"an",
"exceptional",
"completion... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java#L471-L493 | train | Composes the given CompletableFuture afterwards. | [
30522,
2270,
10763,
4012,
10814,
10880,
11263,
11244,
1026,
11675,
1028,
17202,
10354,
3334,
7652,
2015,
1006,
4012,
10814,
10880,
11263,
11244,
1026,
1029,
1028,
2925,
1010,
17024,
1026,
4012,
10814,
10880,
11263,
11244,
1026,
1029,
1028,
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/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/Platform.java | Platform.allocateDirectBuffer | public static ByteBuffer allocateDirectBuffer(int size) {
try {
if (CLEANER_CREATE_METHOD == null) {
// Can't set a Cleaner (see comments on field), so need to allocate via normal Java APIs
try {
return ByteBuffer.allocateDirect(size);
} catch (OutOfMemoryError oome) {
// checkstyle.off: RegexpSinglelineJava
throw new OutOfMemoryError("Failed to allocate direct buffer (" + oome.getMessage() +
"); try increasing -XX:MaxDirectMemorySize=... to, for example, your heap size");
// checkstyle.on: RegexpSinglelineJava
}
}
// Otherwise, use internal JDK APIs to allocate a DirectByteBuffer while ignoring the JVM's
// MaxDirectMemorySize limit (the default limit is too low and we do not want to
// require users to increase it).
long memory = allocateMemory(size);
ByteBuffer buffer = (ByteBuffer) DBB_CONSTRUCTOR.newInstance(memory, size);
try {
DBB_CLEANER_FIELD.set(buffer,
CLEANER_CREATE_METHOD.invoke(null, buffer, (Runnable) () -> freeMemory(memory)));
} catch (IllegalAccessException | InvocationTargetException e) {
freeMemory(memory);
throw new IllegalStateException(e);
}
return buffer;
} catch (Exception e) {
throwException(e);
}
throw new IllegalStateException("unreachable");
} | java | public static ByteBuffer allocateDirectBuffer(int size) {
try {
if (CLEANER_CREATE_METHOD == null) {
// Can't set a Cleaner (see comments on field), so need to allocate via normal Java APIs
try {
return ByteBuffer.allocateDirect(size);
} catch (OutOfMemoryError oome) {
// checkstyle.off: RegexpSinglelineJava
throw new OutOfMemoryError("Failed to allocate direct buffer (" + oome.getMessage() +
"); try increasing -XX:MaxDirectMemorySize=... to, for example, your heap size");
// checkstyle.on: RegexpSinglelineJava
}
}
// Otherwise, use internal JDK APIs to allocate a DirectByteBuffer while ignoring the JVM's
// MaxDirectMemorySize limit (the default limit is too low and we do not want to
// require users to increase it).
long memory = allocateMemory(size);
ByteBuffer buffer = (ByteBuffer) DBB_CONSTRUCTOR.newInstance(memory, size);
try {
DBB_CLEANER_FIELD.set(buffer,
CLEANER_CREATE_METHOD.invoke(null, buffer, (Runnable) () -> freeMemory(memory)));
} catch (IllegalAccessException | InvocationTargetException e) {
freeMemory(memory);
throw new IllegalStateException(e);
}
return buffer;
} catch (Exception e) {
throwException(e);
}
throw new IllegalStateException("unreachable");
} | [
"public",
"static",
"ByteBuffer",
"allocateDirectBuffer",
"(",
"int",
"size",
")",
"{",
"try",
"{",
"if",
"(",
"CLEANER_CREATE_METHOD",
"==",
"null",
")",
"{",
"// Can't set a Cleaner (see comments on field), so need to allocate via normal Java APIs",
"try",
"{",
"return",
... | Allocate a DirectByteBuffer, potentially bypassing the JVM's MaxDirectMemorySize limit. | [
"Allocate",
"a",
"DirectByteBuffer",
"potentially",
"bypassing",
"the",
"JVM",
"s",
"MaxDirectMemorySize",
"limit",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/Platform.java#L214-L244 | train | Allocate a direct buffer of the specified size using the Java APIs to allocate a direct buffer. | [
30522,
2270,
10763,
24880,
8569,
12494,
11095,
7442,
6593,
8569,
12494,
1006,
20014,
2946,
1007,
1063,
3046,
1063,
2065,
1006,
20133,
1035,
3443,
1035,
4118,
1027,
1027,
19701,
1007,
1063,
1013,
1013,
2064,
1005,
1056,
2275,
1037,
20133,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.readCookieMap | public final static Map<String, Cookie> readCookieMap(HttpServletRequest httpServletRequest) {
Map<String, Cookie> cookieMap = new HashMap<String, Cookie>();
Cookie[] cookies = httpServletRequest.getCookies();
if (null == cookies) {
return null;
}
for (Cookie cookie : cookies) {
cookieMap.put(cookie.getName().toLowerCase(), cookie);
}
return cookieMap;
} | java | public final static Map<String, Cookie> readCookieMap(HttpServletRequest httpServletRequest) {
Map<String, Cookie> cookieMap = new HashMap<String, Cookie>();
Cookie[] cookies = httpServletRequest.getCookies();
if (null == cookies) {
return null;
}
for (Cookie cookie : cookies) {
cookieMap.put(cookie.getName().toLowerCase(), cookie);
}
return cookieMap;
} | [
"public",
"final",
"static",
"Map",
"<",
"String",
",",
"Cookie",
">",
"readCookieMap",
"(",
"HttpServletRequest",
"httpServletRequest",
")",
"{",
"Map",
"<",
"String",
",",
"Cookie",
">",
"cookieMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Cookie",
">"... | 将cookie封装到Map里面
@param httpServletRequest {@link HttpServletRequest}
@return Cookie map | [
"将cookie封装到Map里面"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L389-L399 | train | Reads a map of cookies from the given request. | [
30522,
2270,
2345,
10763,
4949,
1026,
5164,
1010,
17387,
1028,
3191,
3597,
23212,
14545,
2361,
1006,
16770,
2121,
2615,
7485,
2890,
15500,
16770,
2121,
2615,
7485,
2890,
15500,
1007,
1063,
4949,
1026,
5164,
1010,
17387,
1028,
17387,
2863,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoFieldUtils.java | PojoFieldUtils.writeField | static void writeField(DataOutputView out, Field field) throws IOException {
Class<?> declaringClass = field.getDeclaringClass();
out.writeUTF(declaringClass.getName());
out.writeUTF(field.getName());
} | java | static void writeField(DataOutputView out, Field field) throws IOException {
Class<?> declaringClass = field.getDeclaringClass();
out.writeUTF(declaringClass.getName());
out.writeUTF(field.getName());
} | [
"static",
"void",
"writeField",
"(",
"DataOutputView",
"out",
",",
"Field",
"field",
")",
"throws",
"IOException",
"{",
"Class",
"<",
"?",
">",
"declaringClass",
"=",
"field",
".",
"getDeclaringClass",
"(",
")",
";",
"out",
".",
"writeUTF",
"(",
"declaringCl... | Writes a field to the given {@link DataOutputView}.
<p>This write method avoids Java serialization, by writing only the classname of the field's declaring class
and the field name. The written field can be read using {@link #readField(DataInputView, ClassLoader)}.
@param out the output view to write to.
@param field the field to write. | [
"Writes",
"a",
"field",
"to",
"the",
"given",
"{",
"@link",
"DataOutputView",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoFieldUtils.java#L45-L49 | train | Write a field to the output. | [
30522,
10763,
11675,
4339,
3790,
1006,
2951,
5833,
18780,
8584,
2041,
1010,
2492,
2492,
1007,
11618,
22834,
10288,
24422,
1063,
2465,
1026,
1029,
1028,
13752,
26266,
1027,
2492,
1012,
2131,
3207,
20464,
22397,
26266,
1006,
1007,
1025,
2041,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/TextSimilarity.java | TextSimilarity.removeSign | private static String removeSign(String str) {
StringBuilder sb = StrUtil.builder(str.length());
// 遍历字符串str,如果是汉字数字或字母,则追加到ab上面
int length = str.length();
for (int i = 0; i < length; i++) {
sb.append(charReg(str.charAt(i)));
}
return sb.toString();
} | java | private static String removeSign(String str) {
StringBuilder sb = StrUtil.builder(str.length());
// 遍历字符串str,如果是汉字数字或字母,则追加到ab上面
int length = str.length();
for (int i = 0; i < length; i++) {
sb.append(charReg(str.charAt(i)));
}
return sb.toString();
} | [
"private",
"static",
"String",
"removeSign",
"(",
"String",
"str",
")",
"{",
"StringBuilder",
"sb",
"=",
"StrUtil",
".",
"builder",
"(",
"str",
".",
"length",
"(",
")",
")",
";",
"// 遍历字符串str,如果是汉字数字或字母,则追加到ab上面",
"int",
"length",
"=",
"str",
".",
"length",
... | 将字符串的所有数据依次写成一行,去除无意义字符串
@param str 字符串
@return 处理后的字符串 | [
"将字符串的所有数据依次写成一行,去除无意义字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/TextSimilarity.java#L56-L64 | train | remove sign from string | [
30522,
2797,
10763,
5164,
20362,
23773,
1006,
5164,
2358,
2099,
1007,
1063,
5164,
8569,
23891,
2099,
24829,
1027,
2358,
22134,
4014,
1012,
12508,
1006,
2358,
2099,
1012,
3091,
1006,
1007,
1007,
1025,
1013,
1013,
100,
100,
100,
100,
100,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java | ParameterTool.getDouble | public double getDouble(String key) {
addToDefaults(key, null);
String value = getRequired(key);
return Double.valueOf(value);
} | java | public double getDouble(String key) {
addToDefaults(key, null);
String value = getRequired(key);
return Double.valueOf(value);
} | [
"public",
"double",
"getDouble",
"(",
"String",
"key",
")",
"{",
"addToDefaults",
"(",
"key",
",",
"null",
")",
";",
"String",
"value",
"=",
"getRequired",
"(",
"key",
")",
";",
"return",
"Double",
".",
"valueOf",
"(",
"value",
")",
";",
"}"
] | Returns the Double value for the given key.
The method fails if the key does not exist. | [
"Returns",
"the",
"Double",
"value",
"for",
"the",
"given",
"key",
".",
"The",
"method",
"fails",
"if",
"the",
"key",
"does",
"not",
"exist",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L361-L365 | train | Gets a double value. | [
30522,
2270,
3313,
2131,
26797,
3468,
1006,
5164,
3145,
1007,
1063,
5587,
3406,
3207,
7011,
11314,
2015,
1006,
3145,
1010,
19701,
1007,
1025,
5164,
3643,
1027,
2131,
2890,
15549,
5596,
1006,
3145,
1007,
1025,
2709,
3313,
1012,
3643,
11253,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/word/TfIdf.java | TfIdf.tf | public static <TERM> Map<TERM, Double> tf(Collection<TERM> document)
{
return tf(document, TfType.NATURAL);
} | java | public static <TERM> Map<TERM, Double> tf(Collection<TERM> document)
{
return tf(document, TfType.NATURAL);
} | [
"public",
"static",
"<",
"TERM",
">",
"Map",
"<",
"TERM",
",",
"Double",
">",
"tf",
"(",
"Collection",
"<",
"TERM",
">",
"document",
")",
"{",
"return",
"tf",
"(",
"document",
",",
"TfType",
".",
"NATURAL",
")",
";",
"}"
] | 单文档词频
@param document 词袋
@param <TERM> 词语类型
@return 一个包含词频的Map | [
"单文档词频"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word/TfIdf.java#L88-L91 | train | Gets the NUCENT language terms. | [
30522,
2270,
10763,
1026,
2744,
1028,
4949,
1026,
2744,
1010,
3313,
1028,
1056,
2546,
1006,
3074,
1026,
2744,
1028,
6254,
1007,
1063,
2709,
1056,
2546,
1006,
6254,
1010,
1056,
6199,
18863,
1012,
3019,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Zodiac.java | Zodiac.getZodiac | public static String getZodiac(int month, int day) {
// 在分隔日前为前一个星座,否则为后一个星座
return day < dayArr[month] ? ZODIACS[month] : ZODIACS[month + 1];
} | java | public static String getZodiac(int month, int day) {
// 在分隔日前为前一个星座,否则为后一个星座
return day < dayArr[month] ? ZODIACS[month] : ZODIACS[month + 1];
} | [
"public",
"static",
"String",
"getZodiac",
"(",
"int",
"month",
",",
"int",
"day",
")",
"{",
"// 在分隔日前为前一个星座,否则为后一个星座\r",
"return",
"day",
"<",
"dayArr",
"[",
"month",
"]",
"?",
"ZODIACS",
"[",
"month",
"]",
":",
"ZODIACS",
"[",
"month",
"+",
"1",
"]",
... | 通过生日计算星座
@param month 月,从0开始计数,见{@link Month#getValue()}
@param day 天
@return 星座名 | [
"通过生日计算星座"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/Zodiac.java#L62-L65 | train | Gets the zodiac name for a given month and day | [
30522,
2270,
10763,
5164,
2131,
6844,
9032,
2278,
1006,
20014,
3204,
1010,
20014,
2154,
1007,
1063,
1013,
1013,
100,
1775,
100,
1864,
1776,
100,
1776,
1740,
100,
1866,
100,
1989,
100,
100,
100,
100,
1740,
100,
1866,
100,
2709,
2154,
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... |
netty/netty | transport/src/main/java/io/netty/channel/pool/AbstractChannelPoolMap.java | AbstractChannelPoolMap.remove | public final boolean remove(K key) {
P pool = map.remove(checkNotNull(key, "key"));
if (pool != null) {
pool.close();
return true;
}
return false;
} | java | public final boolean remove(K key) {
P pool = map.remove(checkNotNull(key, "key"));
if (pool != null) {
pool.close();
return true;
}
return false;
} | [
"public",
"final",
"boolean",
"remove",
"(",
"K",
"key",
")",
"{",
"P",
"pool",
"=",
"map",
".",
"remove",
"(",
"checkNotNull",
"(",
"key",
",",
"\"key\"",
")",
")",
";",
"if",
"(",
"pool",
"!=",
"null",
")",
"{",
"pool",
".",
"close",
"(",
")",
... | Remove the {@link ChannelPool} from this {@link AbstractChannelPoolMap}. Returns {@code true} if removed,
{@code false} otherwise.
Please note that {@code null} keys are not allowed. | [
"Remove",
"the",
"{",
"@link",
"ChannelPool",
"}",
"from",
"this",
"{",
"@link",
"AbstractChannelPoolMap",
"}",
".",
"Returns",
"{",
"@code",
"true",
"}",
"if",
"removed",
"{",
"@code",
"false",
"}",
"otherwise",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/pool/AbstractChannelPoolMap.java#L56-L63 | train | Removes the entry from the cache. | [
30522,
2270,
2345,
22017,
20898,
6366,
1006,
1047,
3145,
1007,
1063,
1052,
4770,
1027,
4949,
1012,
6366,
1006,
4638,
17048,
11231,
3363,
1006,
3145,
1010,
1000,
3145,
1000,
1007,
1007,
1025,
2065,
1006,
4770,
999,
1027,
19701,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/cluster/SparseVector.java | SparseVector.add_vector | void add_vector(SparseVector vec)
{
for (Map.Entry<Integer, Double> entry : vec.entrySet())
{
Double v = get(entry.getKey());
if (v == null)
v = 0.;
put(entry.getKey(), v + entry.getValue());
}
} | java | void add_vector(SparseVector vec)
{
for (Map.Entry<Integer, Double> entry : vec.entrySet())
{
Double v = get(entry.getKey());
if (v == null)
v = 0.;
put(entry.getKey(), v + entry.getValue());
}
} | [
"void",
"add_vector",
"(",
"SparseVector",
"vec",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"Double",
">",
"entry",
":",
"vec",
".",
"entrySet",
"(",
")",
")",
"{",
"Double",
"v",
"=",
"get",
"(",
"entry",
".",
"getKey",
"(",
... | Add other vector. | [
"Add",
"other",
"vector",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/SparseVector.java#L77-L87 | train | Add a vector to the CIS. | [
30522,
11675,
5587,
1035,
9207,
1006,
20288,
3726,
16761,
2310,
2278,
1007,
1063,
2005,
1006,
4949,
1012,
4443,
1026,
16109,
1010,
3313,
1028,
4443,
1024,
2310,
2278,
1012,
4443,
13462,
1006,
1007,
1007,
1063,
3313,
1058,
1027,
2131,
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-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java | Sftp.lsFiles | public List<String> lsFiles(String path) {
return ls(path, new Filter<LsEntry>() {
@Override
public boolean accept(LsEntry t) {
return false == t.getAttrs().isDir();
}
});
} | java | public List<String> lsFiles(String path) {
return ls(path, new Filter<LsEntry>() {
@Override
public boolean accept(LsEntry t) {
return false == t.getAttrs().isDir();
}
});
} | [
"public",
"List",
"<",
"String",
">",
"lsFiles",
"(",
"String",
"path",
")",
"{",
"return",
"ls",
"(",
"path",
",",
"new",
"Filter",
"<",
"LsEntry",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"LsEntry",
"t",
")",
"{",
... | 遍历某个目录下所有文件,不会递归遍历
@param path 遍历某个目录下所有文件
@return 文件名列表
@since 4.0.5 | [
"遍历某个目录下所有文件,不会递归遍历"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java#L222-L229 | train | Returns a list of files in the specified directory. | [
30522,
2270,
2862,
1026,
5164,
1028,
1048,
22747,
9463,
2015,
1006,
5164,
4130,
1007,
1063,
2709,
1048,
2015,
1006,
4130,
1010,
2047,
11307,
1026,
1048,
5054,
11129,
1028,
1006,
1007,
1063,
1030,
2058,
15637,
2270,
22017,
20898,
5138,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java | ExceptionUtils.stripException | public static Throwable stripException(Throwable throwableToStrip, Class<? extends Throwable> typeToStrip) {
while (typeToStrip.isAssignableFrom(throwableToStrip.getClass()) && throwableToStrip.getCause() != null) {
throwableToStrip = throwableToStrip.getCause();
}
return throwableToStrip;
} | java | public static Throwable stripException(Throwable throwableToStrip, Class<? extends Throwable> typeToStrip) {
while (typeToStrip.isAssignableFrom(throwableToStrip.getClass()) && throwableToStrip.getCause() != null) {
throwableToStrip = throwableToStrip.getCause();
}
return throwableToStrip;
} | [
"public",
"static",
"Throwable",
"stripException",
"(",
"Throwable",
"throwableToStrip",
",",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"typeToStrip",
")",
"{",
"while",
"(",
"typeToStrip",
".",
"isAssignableFrom",
"(",
"throwableToStrip",
".",
"getClass",
"... | Unpacks an specified exception and returns its cause. Otherwise the given
{@link Throwable} is returned.
@param throwableToStrip to strip
@param typeToStrip type to strip
@return Unpacked cause or given Throwable if not packed | [
"Unpacks",
"an",
"specified",
"exception",
"and",
"returns",
"its",
"cause",
".",
"Otherwise",
"the",
"given",
"{",
"@link",
"Throwable",
"}",
"is",
"returned",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java#L419-L425 | train | Strip an exception from a Throwable. | [
30522,
2270,
10763,
5466,
3085,
18247,
2595,
24422,
1006,
5466,
3085,
5466,
3085,
13122,
24901,
1010,
2465,
1026,
1029,
8908,
5466,
3085,
1028,
2828,
13122,
24901,
1007,
1063,
2096,
1006,
2828,
13122,
24901,
1012,
18061,
18719,
16989,
3468,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/store/ZooKeeperMesosWorkerStore.java | ZooKeeperMesosWorkerStore.getPathForWorker | private static String getPathForWorker(Protos.TaskID taskID) {
checkNotNull(taskID, "taskID");
return String.format("/%s", taskID.getValue());
} | java | private static String getPathForWorker(Protos.TaskID taskID) {
checkNotNull(taskID, "taskID");
return String.format("/%s", taskID.getValue());
} | [
"private",
"static",
"String",
"getPathForWorker",
"(",
"Protos",
".",
"TaskID",
"taskID",
")",
"{",
"checkNotNull",
"(",
"taskID",
",",
"\"taskID\"",
")",
";",
"return",
"String",
".",
"format",
"(",
"\"/%s\"",
",",
"taskID",
".",
"getValue",
"(",
")",
")... | Get the ZK path for the given task ID (with leading slash). | [
"Get",
"the",
"ZK",
"path",
"for",
"the",
"given",
"task",
"ID",
"(",
"with",
"leading",
"slash",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/store/ZooKeeperMesosWorkerStore.java#L246-L249 | train | Get the path for a worker. | [
30522,
2797,
10763,
5164,
2131,
15069,
29278,
6198,
2121,
1006,
15053,
2015,
1012,
4708,
3593,
4708,
3593,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
4708,
3593,
1010,
1000,
4708,
3593,
1000,
1007,
1025,
2709,
5164,
1012,
4289,
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... |
alibaba/canal | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/MysqlUpdateExecutor.java | MysqlUpdateExecutor.update | public OKPacket update(String updateString) throws IOException {
QueryCommandPacket cmd = new QueryCommandPacket();
cmd.setQueryString(updateString);
byte[] bodyBytes = cmd.toBytes();
PacketManager.writeBody(connector.getChannel(), bodyBytes);
logger.debug("read update result...");
byte[] body = PacketManager.readBytes(connector.getChannel(),
PacketManager.readHeader(connector.getChannel(), 4).getPacketBodyLength());
if (body[0] < 0) {
ErrorPacket packet = new ErrorPacket();
packet.fromBytes(body);
throw new IOException(packet + "\n with command: " + updateString);
}
OKPacket packet = new OKPacket();
packet.fromBytes(body);
return packet;
} | java | public OKPacket update(String updateString) throws IOException {
QueryCommandPacket cmd = new QueryCommandPacket();
cmd.setQueryString(updateString);
byte[] bodyBytes = cmd.toBytes();
PacketManager.writeBody(connector.getChannel(), bodyBytes);
logger.debug("read update result...");
byte[] body = PacketManager.readBytes(connector.getChannel(),
PacketManager.readHeader(connector.getChannel(), 4).getPacketBodyLength());
if (body[0] < 0) {
ErrorPacket packet = new ErrorPacket();
packet.fromBytes(body);
throw new IOException(packet + "\n with command: " + updateString);
}
OKPacket packet = new OKPacket();
packet.fromBytes(body);
return packet;
} | [
"public",
"OKPacket",
"update",
"(",
"String",
"updateString",
")",
"throws",
"IOException",
"{",
"QueryCommandPacket",
"cmd",
"=",
"new",
"QueryCommandPacket",
"(",
")",
";",
"cmd",
".",
"setQueryString",
"(",
"updateString",
")",
";",
"byte",
"[",
"]",
"body... | /*
public MysqlUpdateExecutor(SocketChannel ch){ this.channel = ch; } | [
"/",
"*",
"public",
"MysqlUpdateExecutor",
"(",
"SocketChannel",
"ch",
")",
"{",
"this",
".",
"channel",
"=",
"ch",
";",
"}"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/MysqlUpdateExecutor.java#L37-L55 | train | Update the record with the specified update string. | [
30522,
2270,
7929,
23947,
3388,
10651,
1006,
5164,
14409,
18886,
3070,
1007,
11618,
22834,
10288,
24422,
1063,
23032,
9006,
2386,
18927,
8684,
3388,
4642,
2094,
1027,
2047,
23032,
9006,
2386,
18927,
8684,
3388,
1006,
1007,
1025,
4642,
2094,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | balance/src/main/java/com/networknt/balance/LocalFirstLoadBalance.java | LocalFirstLoadBalance.select | @Override
public URL select(List<URL> urls, String requestKey) {
// search for a URL in the same ip first
List<URL> localUrls = searchLocalUrls(urls, ip);
if(localUrls.size() > 0) {
if(localUrls.size() == 1) {
return localUrls.get(0);
} else {
// round robin within localUrls
return doSelect(localUrls);
}
} else {
// round robin within urls
return doSelect(urls);
}
} | java | @Override
public URL select(List<URL> urls, String requestKey) {
// search for a URL in the same ip first
List<URL> localUrls = searchLocalUrls(urls, ip);
if(localUrls.size() > 0) {
if(localUrls.size() == 1) {
return localUrls.get(0);
} else {
// round robin within localUrls
return doSelect(localUrls);
}
} else {
// round robin within urls
return doSelect(urls);
}
} | [
"@",
"Override",
"public",
"URL",
"select",
"(",
"List",
"<",
"URL",
">",
"urls",
",",
"String",
"requestKey",
")",
"{",
"// search for a URL in the same ip first",
"List",
"<",
"URL",
">",
"localUrls",
"=",
"searchLocalUrls",
"(",
"urls",
",",
"ip",
")",
";... | Local first requestKey is not used as it is ip on the localhost. It first needs to
find a list of urls on the localhost for the service, and then round robin in the
list to pick up one.
Currently, this load balance is only used if you deploy the service as standalone
java process on data center hosts. We need to find a way to identify two VMs or two
docker containers sitting on the same physical machine in the future to improve it.
It is also suitable if your services are built on top of light-hybrid-4j and want
to use the remote interface for service to service communication.
@param urls List
@param requestKey String
@return URL | [
"Local",
"first",
"requestKey",
"is",
"not",
"used",
"as",
"it",
"is",
"ip",
"on",
"the",
"localhost",
".",
"It",
"first",
"needs",
"to",
"find",
"a",
"list",
"of",
"urls",
"on",
"the",
"localhost",
"for",
"the",
"service",
"and",
"then",
"round",
"rob... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/balance/src/main/java/com/networknt/balance/LocalFirstLoadBalance.java#L71-L86 | train | Select a URL from a list of URLs. | [
30522,
1030,
2058,
15637,
2270,
24471,
2140,
7276,
1006,
2862,
1026,
24471,
30524,
2005,
1037,
24471,
2140,
1999,
1996,
2168,
12997,
2034,
2862,
1026,
24471,
2140,
1028,
2334,
3126,
4877,
1027,
3945,
4135,
9289,
3126,
4877,
1006,
24471,
487... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/CharUtil.java | CharUtil.isBlankChar | public static boolean isBlankChar(int c) {
return Character.isWhitespace(c) || Character.isSpaceChar(c) || c == '\ufeff' || c == '\u202a';
} | java | public static boolean isBlankChar(int c) {
return Character.isWhitespace(c) || Character.isSpaceChar(c) || c == '\ufeff' || c == '\u202a';
} | [
"public",
"static",
"boolean",
"isBlankChar",
"(",
"int",
"c",
")",
"{",
"return",
"Character",
".",
"isWhitespace",
"(",
"c",
")",
"||",
"Character",
".",
"isSpaceChar",
"(",
"c",
")",
"||",
"c",
"==",
"'",
"'",
"||",
"c",
"==",
"'",
"'",
";",
"}"... | 是否空白符<br>
空白符包括空格、制表符、全角空格和不间断空格<br>
@see Character#isWhitespace(int)
@see Character#isSpaceChar(int)
@param c 字符
@return 是否空白符
@since 4.0.10 | [
"是否空白符<br",
">",
"空白符包括空格、制表符、全角空格和不间断空格<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/CharUtil.java#L274-L276 | train | Checks if a character is a blank character. | [
30522,
2270,
10763,
30524,
1039,
1007,
1063,
2709,
2839,
1012,
2003,
2860,
16584,
2229,
15327,
1006,
1039,
1007,
1064,
1064,
2839,
1012,
26354,
15327,
7507,
2099,
1006,
1039,
1007,
1064,
1064,
1039,
1027,
1027,
1005,
1032,
1057,
7959,
4246,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/NativeLibraryLoader.java | NativeLibraryLoader.load | public static void load(String originalName, ClassLoader loader) {
// Adjust expected name to support shading of native libraries.
String packagePrefix = calculatePackagePrefix().replace('.', '_');
String name = packagePrefix + originalName;
List<Throwable> suppressed = new ArrayList<Throwable>();
try {
// first try to load from java.library.path
loadLibrary(loader, name, false);
return;
} catch (Throwable ex) {
suppressed.add(ex);
logger.debug(
"{} cannot be loaded from java.library.path, "
+ "now trying export to -Dio.netty.native.workdir: {}", name, WORKDIR, ex);
}
String libname = System.mapLibraryName(name);
String path = NATIVE_RESOURCE_HOME + libname;
InputStream in = null;
OutputStream out = null;
File tmpFile = null;
URL url;
if (loader == null) {
url = ClassLoader.getSystemResource(path);
} else {
url = loader.getResource(path);
}
try {
if (url == null) {
if (PlatformDependent.isOsx()) {
String fileName = path.endsWith(".jnilib") ? NATIVE_RESOURCE_HOME + "lib" + name + ".dynlib" :
NATIVE_RESOURCE_HOME + "lib" + name + ".jnilib";
if (loader == null) {
url = ClassLoader.getSystemResource(fileName);
} else {
url = loader.getResource(fileName);
}
if (url == null) {
FileNotFoundException fnf = new FileNotFoundException(fileName);
ThrowableUtil.addSuppressedAndClear(fnf, suppressed);
throw fnf;
}
} else {
FileNotFoundException fnf = new FileNotFoundException(path);
ThrowableUtil.addSuppressedAndClear(fnf, suppressed);
throw fnf;
}
}
int index = libname.lastIndexOf('.');
String prefix = libname.substring(0, index);
String suffix = libname.substring(index, libname.length());
tmpFile = File.createTempFile(prefix, suffix, WORKDIR);
in = url.openStream();
out = new FileOutputStream(tmpFile);
if (shouldShadedLibraryIdBePatched(packagePrefix)) {
patchShadedLibraryId(in, out, originalName, name);
} else {
byte[] buffer = new byte[8192];
int length;
while ((length = in.read(buffer)) > 0) {
out.write(buffer, 0, length);
}
}
out.flush();
// Close the output stream before loading the unpacked library,
// because otherwise Windows will refuse to load it when it's in use by other process.
closeQuietly(out);
out = null;
loadLibrary(loader, tmpFile.getPath(), true);
} catch (UnsatisfiedLinkError e) {
try {
if (tmpFile != null && tmpFile.isFile() && tmpFile.canRead() &&
!NoexecVolumeDetector.canExecuteExecutable(tmpFile)) {
// Pass "io.netty.native.workdir" as an argument to allow shading tools to see
// the string. Since this is printed out to users to tell them what to do next,
// we want the value to be correct even when shading.
logger.info("{} exists but cannot be executed even when execute permissions set; " +
"check volume for \"noexec\" flag; use -D{}=[path] " +
"to set native working directory separately.",
tmpFile.getPath(), "io.netty.native.workdir");
}
} catch (Throwable t) {
suppressed.add(t);
logger.debug("Error checking if {} is on a file store mounted with noexec", tmpFile, t);
}
// Re-throw to fail the load
ThrowableUtil.addSuppressedAndClear(e, suppressed);
throw e;
} catch (Exception e) {
UnsatisfiedLinkError ule = new UnsatisfiedLinkError("could not load a native library: " + name);
ule.initCause(e);
ThrowableUtil.addSuppressedAndClear(ule, suppressed);
throw ule;
} finally {
closeQuietly(in);
closeQuietly(out);
// After we load the library it is safe to delete the file.
// We delete the file immediately to free up resources as soon as possible,
// and if this fails fallback to deleting on JVM exit.
if (tmpFile != null && (!DELETE_NATIVE_LIB_AFTER_LOADING || !tmpFile.delete())) {
tmpFile.deleteOnExit();
}
}
} | java | public static void load(String originalName, ClassLoader loader) {
// Adjust expected name to support shading of native libraries.
String packagePrefix = calculatePackagePrefix().replace('.', '_');
String name = packagePrefix + originalName;
List<Throwable> suppressed = new ArrayList<Throwable>();
try {
// first try to load from java.library.path
loadLibrary(loader, name, false);
return;
} catch (Throwable ex) {
suppressed.add(ex);
logger.debug(
"{} cannot be loaded from java.library.path, "
+ "now trying export to -Dio.netty.native.workdir: {}", name, WORKDIR, ex);
}
String libname = System.mapLibraryName(name);
String path = NATIVE_RESOURCE_HOME + libname;
InputStream in = null;
OutputStream out = null;
File tmpFile = null;
URL url;
if (loader == null) {
url = ClassLoader.getSystemResource(path);
} else {
url = loader.getResource(path);
}
try {
if (url == null) {
if (PlatformDependent.isOsx()) {
String fileName = path.endsWith(".jnilib") ? NATIVE_RESOURCE_HOME + "lib" + name + ".dynlib" :
NATIVE_RESOURCE_HOME + "lib" + name + ".jnilib";
if (loader == null) {
url = ClassLoader.getSystemResource(fileName);
} else {
url = loader.getResource(fileName);
}
if (url == null) {
FileNotFoundException fnf = new FileNotFoundException(fileName);
ThrowableUtil.addSuppressedAndClear(fnf, suppressed);
throw fnf;
}
} else {
FileNotFoundException fnf = new FileNotFoundException(path);
ThrowableUtil.addSuppressedAndClear(fnf, suppressed);
throw fnf;
}
}
int index = libname.lastIndexOf('.');
String prefix = libname.substring(0, index);
String suffix = libname.substring(index, libname.length());
tmpFile = File.createTempFile(prefix, suffix, WORKDIR);
in = url.openStream();
out = new FileOutputStream(tmpFile);
if (shouldShadedLibraryIdBePatched(packagePrefix)) {
patchShadedLibraryId(in, out, originalName, name);
} else {
byte[] buffer = new byte[8192];
int length;
while ((length = in.read(buffer)) > 0) {
out.write(buffer, 0, length);
}
}
out.flush();
// Close the output stream before loading the unpacked library,
// because otherwise Windows will refuse to load it when it's in use by other process.
closeQuietly(out);
out = null;
loadLibrary(loader, tmpFile.getPath(), true);
} catch (UnsatisfiedLinkError e) {
try {
if (tmpFile != null && tmpFile.isFile() && tmpFile.canRead() &&
!NoexecVolumeDetector.canExecuteExecutable(tmpFile)) {
// Pass "io.netty.native.workdir" as an argument to allow shading tools to see
// the string. Since this is printed out to users to tell them what to do next,
// we want the value to be correct even when shading.
logger.info("{} exists but cannot be executed even when execute permissions set; " +
"check volume for \"noexec\" flag; use -D{}=[path] " +
"to set native working directory separately.",
tmpFile.getPath(), "io.netty.native.workdir");
}
} catch (Throwable t) {
suppressed.add(t);
logger.debug("Error checking if {} is on a file store mounted with noexec", tmpFile, t);
}
// Re-throw to fail the load
ThrowableUtil.addSuppressedAndClear(e, suppressed);
throw e;
} catch (Exception e) {
UnsatisfiedLinkError ule = new UnsatisfiedLinkError("could not load a native library: " + name);
ule.initCause(e);
ThrowableUtil.addSuppressedAndClear(ule, suppressed);
throw ule;
} finally {
closeQuietly(in);
closeQuietly(out);
// After we load the library it is safe to delete the file.
// We delete the file immediately to free up resources as soon as possible,
// and if this fails fallback to deleting on JVM exit.
if (tmpFile != null && (!DELETE_NATIVE_LIB_AFTER_LOADING || !tmpFile.delete())) {
tmpFile.deleteOnExit();
}
}
} | [
"public",
"static",
"void",
"load",
"(",
"String",
"originalName",
",",
"ClassLoader",
"loader",
")",
"{",
"// Adjust expected name to support shading of native libraries.",
"String",
"packagePrefix",
"=",
"calculatePackagePrefix",
"(",
")",
".",
"replace",
"(",
"'",
"'... | Load the given library with the specified {@link ClassLoader} | [
"Load",
"the",
"given",
"library",
"with",
"the",
"specified",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java#L129-L238 | train | Load a single class from the system library. | [
30522,
2270,
10763,
11675,
7170,
1006,
5164,
2434,
18442,
1010,
2465,
11066,
2121,
7170,
2121,
1007,
1063,
1013,
1013,
14171,
3517,
2171,
2000,
2490,
21146,
4667,
1997,
3128,
8860,
1012,
5164,
7427,
28139,
8873,
2595,
1027,
18422,
23947,
42... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/AbstractDb.java | AbstractDb.find | public <T> T find(Query query, RsHandler<T> rsh) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return runner.find(conn, query, rsh);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | java | public <T> T find(Query query, RsHandler<T> rsh) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return runner.find(conn, query, rsh);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | [
"public",
"<",
"T",
">",
"T",
"find",
"(",
"Query",
"query",
",",
"RsHandler",
"<",
"T",
">",
"rsh",
")",
"throws",
"SQLException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"try",
"{",
"conn",
"=",
"this",
".",
"getConnection",
"(",
")",
";",
"... | 查询<br>
Query为查询所需数据的一个实体类,此对象中可以定义返回字段、查询条件,查询的表、分页等信息
@param <T> 需要处理成的结果对象类型
@param query {@link Query}对象,此对象中可以定义返回字段、查询条件,查询的表、分页等信息
@param rsh 结果集处理对象
@return 结果对象
@throws SQLException SQL执行异常
@since 4.0.0 | [
"查询<br",
">",
"Query为查询所需数据的一个实体类,此对象中可以定义返回字段、查询条件,查询的表、分页等信息"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L455-L465 | train | Returns a single row of the table that matches the specified query. | [
30522,
2270,
1026,
1056,
1028,
1056,
2424,
1006,
23032,
23032,
1010,
12667,
11774,
3917,
1026,
1056,
1028,
12667,
2232,
1007,
11618,
29296,
10288,
24422,
1063,
4434,
9530,
2078,
1027,
19701,
1025,
3046,
1063,
9530,
2078,
1027,
2023,
1012,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/NestedMapsStateTable.java | NestedMapsStateTable.countMappingsInKeyGroup | private static <K, N, S> int countMappingsInKeyGroup(final Map<N, Map<K, S>> keyGroupMap) {
int count = 0;
for (Map<K, S> namespaceMap : keyGroupMap.values()) {
count += namespaceMap.size();
}
return count;
} | java | private static <K, N, S> int countMappingsInKeyGroup(final Map<N, Map<K, S>> keyGroupMap) {
int count = 0;
for (Map<K, S> namespaceMap : keyGroupMap.values()) {
count += namespaceMap.size();
}
return count;
} | [
"private",
"static",
"<",
"K",
",",
"N",
",",
"S",
">",
"int",
"countMappingsInKeyGroup",
"(",
"final",
"Map",
"<",
"N",
",",
"Map",
"<",
"K",
",",
"S",
">",
">",
"keyGroupMap",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"Map",
"<",
"... | snapshots --------------------------------------------------------------------------------------------------- | [
"snapshots",
"---------------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/NestedMapsStateTable.java#L325-L332 | train | Count the number of mappings in a key group. | [
30522,
2797,
10763,
1026,
1047,
1010,
1050,
1010,
1055,
1028,
20014,
4175,
2863,
14853,
11493,
14839,
17058,
1006,
2345,
4949,
1026,
1050,
1010,
4949,
1026,
1047,
1010,
1055,
1028,
1028,
3145,
17058,
2863,
2361,
1007,
1063,
20014,
4175,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java | BinaryString.endsWith | public boolean endsWith(final BinaryString suffix) {
ensureMaterialized();
suffix.ensureMaterialized();
return matchAt(suffix, sizeInBytes - suffix.sizeInBytes);
} | java | public boolean endsWith(final BinaryString suffix) {
ensureMaterialized();
suffix.ensureMaterialized();
return matchAt(suffix, sizeInBytes - suffix.sizeInBytes);
} | [
"public",
"boolean",
"endsWith",
"(",
"final",
"BinaryString",
"suffix",
")",
"{",
"ensureMaterialized",
"(",
")",
";",
"suffix",
".",
"ensureMaterialized",
"(",
")",
";",
"return",
"matchAt",
"(",
"suffix",
",",
"sizeInBytes",
"-",
"suffix",
".",
"sizeInBytes... | Same to like '%suffix'. | [
"Same",
"to",
"like",
"%suffix",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L574-L578 | train | Checks if this string ends with the given suffix. | [
30522,
2270,
22017,
20898,
4515,
24415,
1006,
2345,
12441,
3367,
4892,
16809,
1007,
1063,
5676,
8585,
14482,
30524,
4570,
1011,
16809,
1012,
2946,
2378,
3762,
4570,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/WordCountSQL.java | WordCountSQL.main | public static void main(String[] args) throws Exception {
// set up execution environment
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
BatchTableEnvironment tEnv = BatchTableEnvironment.create(env);
DataSet<WC> input = env.fromElements(
new WC("Hello", 1),
new WC("Ciao", 1),
new WC("Hello", 1));
// register the DataSet as table "WordCount"
tEnv.registerDataSet("WordCount", input, "word, frequency");
// run a SQL query on the Table and retrieve the result as a new Table
Table table = tEnv.sqlQuery(
"SELECT word, SUM(frequency) as frequency FROM WordCount GROUP BY word");
DataSet<WC> result = tEnv.toDataSet(table, WC.class);
result.print();
} | java | public static void main(String[] args) throws Exception {
// set up execution environment
ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
BatchTableEnvironment tEnv = BatchTableEnvironment.create(env);
DataSet<WC> input = env.fromElements(
new WC("Hello", 1),
new WC("Ciao", 1),
new WC("Hello", 1));
// register the DataSet as table "WordCount"
tEnv.registerDataSet("WordCount", input, "word, frequency");
// run a SQL query on the Table and retrieve the result as a new Table
Table table = tEnv.sqlQuery(
"SELECT word, SUM(frequency) as frequency FROM WordCount GROUP BY word");
DataSet<WC> result = tEnv.toDataSet(table, WC.class);
result.print();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"// set up execution environment",
"ExecutionEnvironment",
"env",
"=",
"ExecutionEnvironment",
".",
"getExecutionEnvironment",
"(",
")",
";",
"BatchTableEnvironment",
... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-table/src/main/java/org/apache/flink/table/examples/java/WordCountSQL.java#L40-L61 | train | Main method to run the CRUD test. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
1013,
1013,
2275,
2039,
7781,
4044,
7781,
2368,
21663,
2239,
3672,
4372,
2615,
1027,
7781,
2368,
21663,
2239,
3672,
1012,
2131,
10288,
8586,
1370... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/avro/ParquetAvroWriters.java | ParquetAvroWriters.forGenericRecord | public static ParquetWriterFactory<GenericRecord> forGenericRecord(Schema schema) {
final String schemaString = schema.toString();
final ParquetBuilder<GenericRecord> builder = (out) -> createAvroParquetWriter(schemaString, GenericData.get(), out);
return new ParquetWriterFactory<>(builder);
} | java | public static ParquetWriterFactory<GenericRecord> forGenericRecord(Schema schema) {
final String schemaString = schema.toString();
final ParquetBuilder<GenericRecord> builder = (out) -> createAvroParquetWriter(schemaString, GenericData.get(), out);
return new ParquetWriterFactory<>(builder);
} | [
"public",
"static",
"ParquetWriterFactory",
"<",
"GenericRecord",
">",
"forGenericRecord",
"(",
"Schema",
"schema",
")",
"{",
"final",
"String",
"schemaString",
"=",
"schema",
".",
"toString",
"(",
")",
";",
"final",
"ParquetBuilder",
"<",
"GenericRecord",
">",
... | Creates a ParquetWriterFactory that accepts and writes Avro generic types.
The Parquet writers will use the given schema to build and write the columnar data.
@param schema The schema of the generic type. | [
"Creates",
"a",
"ParquetWriterFactory",
"that",
"accepts",
"and",
"writes",
"Avro",
"generic",
"types",
".",
"The",
"Parquet",
"writers",
"will",
"use",
"the",
"given",
"schema",
"to",
"build",
"and",
"write",
"the",
"columnar",
"data",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/avro/ParquetAvroWriters.java#L59-L63 | train | Creates a ParquetWriterFactory for a generic record. | [
30522,
2270,
10763,
11968,
12647,
15994,
21450,
1026,
12391,
2890,
27108,
2094,
1028,
15681,
3678,
2594,
2890,
27108,
2094,
1006,
8040,
28433,
8040,
28433,
1007,
1063,
2345,
5164,
8040,
28433,
3367,
4892,
1027,
8040,
28433,
1012,
2000,
3367,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/mapred/HadoopMapFunction.java | HadoopMapFunction.writeObject | private void writeObject(final ObjectOutputStream out) throws IOException {
out.writeObject(mapper.getClass());
jobConf.write(out);
} | java | private void writeObject(final ObjectOutputStream out) throws IOException {
out.writeObject(mapper.getClass());
jobConf.write(out);
} | [
"private",
"void",
"writeObject",
"(",
"final",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"writeObject",
"(",
"mapper",
".",
"getClass",
"(",
")",
")",
";",
"jobConf",
".",
"write",
"(",
"out",
")",
";",
"}"
] | Custom serialization methods.
@see <a href="http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html">http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html</a> | [
"Custom",
"serialization",
"methods",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/mapred/HadoopMapFunction.java#L119-L122 | train | Write the object. | [
30522,
2797,
11675,
4339,
16429,
20614,
1006,
2345,
4874,
5833,
18780,
21422,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
2041,
1012,
4339,
16429,
20614,
1006,
4949,
4842,
1012,
2131,
26266,
1006,
1007,
1007,
1025,
3105,
8663,
2546,
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... |
alibaba/canal | deployer/src/main/java/com/alibaba/otter/canal/deployer/monitor/remote/DbRemoteConfigLoader.java | DbRemoteConfigLoader.startMonitor | public void startMonitor(final RemoteCanalConfigMonitor remoteCanalConfigMonitor) {
// 监听canal.properties变化
executor.scheduleWithFixedDelay(new Runnable() {
public void run() {
try {
Properties properties = loadRemoteConfig();
if (properties != null) {
remoteCanalConfigMonitor.onChange(properties);
}
} catch (Throwable e) {
logger.error("Scan remote canal config failed", e);
}
}
}, 10, scanIntervalInSecond, TimeUnit.SECONDS);
// 监听instance变化
executor.scheduleWithFixedDelay(new Runnable() {
public void run() {
try {
loadRemoteInstanceConfigs();
} catch (Throwable e) {
logger.error("Scan remote instance config failed", e);
}
}
}, 10, 3, TimeUnit.SECONDS);
} | java | public void startMonitor(final RemoteCanalConfigMonitor remoteCanalConfigMonitor) {
// 监听canal.properties变化
executor.scheduleWithFixedDelay(new Runnable() {
public void run() {
try {
Properties properties = loadRemoteConfig();
if (properties != null) {
remoteCanalConfigMonitor.onChange(properties);
}
} catch (Throwable e) {
logger.error("Scan remote canal config failed", e);
}
}
}, 10, scanIntervalInSecond, TimeUnit.SECONDS);
// 监听instance变化
executor.scheduleWithFixedDelay(new Runnable() {
public void run() {
try {
loadRemoteInstanceConfigs();
} catch (Throwable e) {
logger.error("Scan remote instance config failed", e);
}
}
}, 10, 3, TimeUnit.SECONDS);
} | [
"public",
"void",
"startMonitor",
"(",
"final",
"RemoteCanalConfigMonitor",
"remoteCanalConfigMonitor",
")",
"{",
"// 监听canal.properties变化",
"executor",
".",
"scheduleWithFixedDelay",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"tr... | 监听 canal 主配置和 instance 配置变化
@param remoteCanalConfigMonitor 监听回调方法 | [
"监听",
"canal",
"主配置和",
"instance",
"配置变化"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/deployer/src/main/java/com/alibaba/otter/canal/deployer/monitor/remote/DbRemoteConfigLoader.java#L221-L250 | train | Start monitor. | [
30522,
2270,
11675,
2707,
8202,
15660,
1006,
2345,
6556,
28621,
22499,
2078,
8873,
21693,
10698,
4263,
6556,
28621,
22499,
2078,
8873,
21693,
10698,
4263,
1007,
1063,
1013,
1013,
100,
100,
5033,
1012,
5144,
100,
100,
4654,
8586,
16161,
2099... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | buffer/src/main/java/io/netty/buffer/PoolChunk.java | PoolChunk.allocateRun | private long allocateRun(int normCapacity) {
int d = maxOrder - (log2(normCapacity) - pageShifts);
int id = allocateNode(d);
if (id < 0) {
return id;
}
freeBytes -= runLength(id);
return id;
} | java | private long allocateRun(int normCapacity) {
int d = maxOrder - (log2(normCapacity) - pageShifts);
int id = allocateNode(d);
if (id < 0) {
return id;
}
freeBytes -= runLength(id);
return id;
} | [
"private",
"long",
"allocateRun",
"(",
"int",
"normCapacity",
")",
"{",
"int",
"d",
"=",
"maxOrder",
"-",
"(",
"log2",
"(",
"normCapacity",
")",
"-",
"pageShifts",
")",
";",
"int",
"id",
"=",
"allocateNode",
"(",
"d",
")",
";",
"if",
"(",
"id",
"<",
... | Allocate a run of pages (>=1)
@param normCapacity normalized capacity
@return index in memoryMap | [
"Allocate",
"a",
"run",
"of",
"pages",
"(",
">",
"=",
"1",
")"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/PoolChunk.java#L322-L330 | train | Allocate a run of a single page. | [
30522,
2797,
2146,
2035,
24755,
3334,
4609,
1006,
20014,
13373,
17695,
6305,
3012,
1007,
1063,
20014,
1040,
1027,
4098,
8551,
2121,
1011,
1006,
8833,
30524,
20014,
8909,
1027,
2035,
24755,
6528,
10244,
1006,
1040,
1007,
1025,
2065,
1006,
89... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/types/Record.java | Record.getField | @SuppressWarnings("unchecked")
public <T extends Value> T getField(int fieldNum, T target) {
// range check
if (fieldNum < 0 || fieldNum >= this.numFields) {
throw new IndexOutOfBoundsException();
}
if (target == null) {
throw new NullPointerException("The target object may not be null");
}
// get offset and check for null
final int offset = this.offsets[fieldNum];
if (offset == NULL_INDICATOR_OFFSET) {
return null;
}
else if (offset == MODIFIED_INDICATOR_OFFSET) {
// value that has been set is new or modified
// bring the binary in sync so that the deserialization gives the correct result
return (T) this.writeFields[fieldNum];
}
final int limit = offset + this.lengths[fieldNum];
deserialize(target, offset, limit, fieldNum);
return target;
} | java | @SuppressWarnings("unchecked")
public <T extends Value> T getField(int fieldNum, T target) {
// range check
if (fieldNum < 0 || fieldNum >= this.numFields) {
throw new IndexOutOfBoundsException();
}
if (target == null) {
throw new NullPointerException("The target object may not be null");
}
// get offset and check for null
final int offset = this.offsets[fieldNum];
if (offset == NULL_INDICATOR_OFFSET) {
return null;
}
else if (offset == MODIFIED_INDICATOR_OFFSET) {
// value that has been set is new or modified
// bring the binary in sync so that the deserialization gives the correct result
return (T) this.writeFields[fieldNum];
}
final int limit = offset + this.lengths[fieldNum];
deserialize(target, offset, limit, fieldNum);
return target;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"Value",
">",
"T",
"getField",
"(",
"int",
"fieldNum",
",",
"T",
"target",
")",
"{",
"// range check",
"if",
"(",
"fieldNum",
"<",
"0",
"||",
"fieldNum",
">=",
"this",
"."... | Gets the field at the given position. The method tries to deserialize the fields into the given target value.
If the fields has been changed since the last (de)serialization, or is null, them the target value is left
unchanged and the changed value (or null) is returned.
<p>
In all cases, the returned value contains the correct data (or is correctly null).
@param fieldNum The position of the field.
@param target The value to deserialize the field into.
@return The value with the contents of the requested field, or null, if the field is null. | [
"Gets",
"the",
"field",
"at",
"the",
"given",
"position",
".",
"The",
"method",
"tries",
"to",
"deserialize",
"the",
"fields",
"into",
"the",
"given",
"target",
"value",
".",
"If",
"the",
"fields",
"has",
"been",
"changed",
"since",
"the",
"last",
"(",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/Record.java#L269-L293 | train | Gets the value of the specified field in the binary object. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
1026,
1056,
8908,
3643,
1028,
1056,
2131,
3790,
1006,
20014,
2492,
19172,
1010,
1056,
4539,
1007,
1063,
1013,
1013,
2846,
4638,
2065,
1006,
2492,
19172,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SqlBuilder.java | SqlBuilder.from | public SqlBuilder from(String... tableNames) {
if (ArrayUtil.isEmpty(tableNames) || StrUtil.hasBlank(tableNames)) {
throw new DbRuntimeException("Table name is blank in table names !");
}
if (null != wrapper) {
// 包装表名
tableNames = wrapper.wrap(tableNames);
}
sql.append(" FROM ").append(ArrayUtil.join(tableNames, StrUtil.COMMA));
return this;
} | java | public SqlBuilder from(String... tableNames) {
if (ArrayUtil.isEmpty(tableNames) || StrUtil.hasBlank(tableNames)) {
throw new DbRuntimeException("Table name is blank in table names !");
}
if (null != wrapper) {
// 包装表名
tableNames = wrapper.wrap(tableNames);
}
sql.append(" FROM ").append(ArrayUtil.join(tableNames, StrUtil.COMMA));
return this;
} | [
"public",
"SqlBuilder",
"from",
"(",
"String",
"...",
"tableNames",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"tableNames",
")",
"||",
"StrUtil",
".",
"hasBlank",
"(",
"tableNames",
")",
")",
"{",
"throw",
"new",
"DbRuntimeException",
"(",
"\"... | 添加 from语句
@param tableNames 表名列表(多个表名用于多表查询)
@return 自己 | [
"添加",
"from语句"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java#L270-L283 | train | Create a FROM statement. | [
30522,
2270,
29296,
8569,
23891,
2099,
2013,
1006,
5164,
1012,
1012,
1012,
2795,
18442,
2015,
1007,
1063,
2065,
1006,
9140,
21823,
2140,
1012,
2003,
6633,
13876,
2100,
1006,
2795,
18442,
2015,
1007,
1064,
1064,
2358,
22134,
4014,
1012,
2038... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SingleOutputStreamOperator.java | SingleOutputStreamOperator.returns | public SingleOutputStreamOperator<T> returns(Class<T> typeClass) {
requireNonNull(typeClass, "type class must not be null.");
try {
return returns(TypeInformation.of(typeClass));
}
catch (InvalidTypesException e) {
throw new InvalidTypesException("Cannot infer the type information from the class alone." +
"This is most likely because the class represents a generic type. In that case," +
"please use the 'returns(TypeHint)' method instead.");
}
} | java | public SingleOutputStreamOperator<T> returns(Class<T> typeClass) {
requireNonNull(typeClass, "type class must not be null.");
try {
return returns(TypeInformation.of(typeClass));
}
catch (InvalidTypesException e) {
throw new InvalidTypesException("Cannot infer the type information from the class alone." +
"This is most likely because the class represents a generic type. In that case," +
"please use the 'returns(TypeHint)' method instead.");
}
} | [
"public",
"SingleOutputStreamOperator",
"<",
"T",
">",
"returns",
"(",
"Class",
"<",
"T",
">",
"typeClass",
")",
"{",
"requireNonNull",
"(",
"typeClass",
",",
"\"type class must not be null.\"",
")",
";",
"try",
"{",
"return",
"returns",
"(",
"TypeInformation",
... | Adds a type information hint about the return type of this operator. This method
can be used in cases where Flink cannot determine automatically what the produced
type of a function is. That can be the case if the function uses generic type variables
in the return type that cannot be inferred from the input type.
<p>Classes can be used as type hints for non-generic types (classes without generic parameters),
but not for generic types like for example Tuples. For those generic types, please
use the {@link #returns(TypeHint)} method.
@param typeClass The class of the returned data type.
@return This operator with the type information corresponding to the given type class. | [
"Adds",
"a",
"type",
"information",
"hint",
"about",
"the",
"return",
"type",
"of",
"this",
"operator",
".",
"This",
"method",
"can",
"be",
"used",
"in",
"cases",
"where",
"Flink",
"cannot",
"determine",
"automatically",
"what",
"the",
"produced",
"type",
"o... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/SingleOutputStreamOperator.java#L309-L320 | train | Returns an operator that returns the type information of the given type class. | [
30522,
2270,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1056,
1028,
5651,
1006,
2465,
1026,
1056,
1028,
2828,
26266,
1007,
1063,
5478,
8540,
11231,
3363,
1006,
2828,
26266,
1010,
1000,
2828,
2465,
2442,
2025,
2022,
19701,
1012,
1000,
1007... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/resource/NoResourceException.java | NoResourceException.causeInstanceOf | public boolean causeInstanceOf(Class<? extends Throwable> clazz) {
Throwable cause = this.getCause();
if (null != cause && clazz.isInstance(cause)) {
return true;
}
return false;
} | java | public boolean causeInstanceOf(Class<? extends Throwable> clazz) {
Throwable cause = this.getCause();
if (null != cause && clazz.isInstance(cause)) {
return true;
}
return false;
} | [
"public",
"boolean",
"causeInstanceOf",
"(",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"clazz",
")",
"{",
"Throwable",
"cause",
"=",
"this",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"cause",
"&&",
"clazz",
".",
"isInstance",
"(",
... | 导致这个异常的异常是否是指定类型的异常
@param clazz 异常类
@return 是否为指定类型异常 | [
"导致这个异常的异常是否是指定类型的异常"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/NoResourceException.java#L42-L48 | train | Returns true if this exception is an instance of the specified exception class. | [
30522,
2270,
22017,
20898,
3426,
7076,
26897,
11253,
1006,
2465,
1026,
1029,
8908,
5466,
3085,
1028,
18856,
10936,
2480,
1007,
1063,
5466,
3085,
3426,
1027,
2023,
1012,
2131,
3540,
8557,
1006,
1007,
1025,
2065,
1006,
19701,
999,
1027,
3426,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | server/src/main/java/com/networknt/server/Server.java | Server.serverOptionInit | private static void serverOptionInit() {
Map<String, Object> mapConfig = Config.getInstance().getJsonMapConfigNoCache(SERVER_CONFIG_NAME);
ServerOption.serverOptionInit(mapConfig, getServerConfig());
} | java | private static void serverOptionInit() {
Map<String, Object> mapConfig = Config.getInstance().getJsonMapConfigNoCache(SERVER_CONFIG_NAME);
ServerOption.serverOptionInit(mapConfig, getServerConfig());
} | [
"private",
"static",
"void",
"serverOptionInit",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"mapConfig",
"=",
"Config",
".",
"getInstance",
"(",
")",
".",
"getJsonMapConfigNoCache",
"(",
"SERVER_CONFIG_NAME",
")",
";",
"ServerOption",
".",
"serve... | Method used to initialize server options. If the user has configured a valid server option,
load it into the server configuration, otherwise use the default value | [
"Method",
"used",
"to",
"initialize",
"server",
"options",
".",
"If",
"the",
"user",
"has",
"configured",
"a",
"valid",
"server",
"option",
"load",
"it",
"into",
"the",
"server",
"configuration",
"otherwise",
"use",
"the",
"default",
"value"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/server/src/main/java/com/networknt/server/Server.java#L215-L218 | train | Initialize the server option. | [
30522,
2797,
10763,
11675,
8241,
7361,
3508,
5498,
2102,
1006,
1007,
1063,
4949,
1026,
5164,
1010,
4874,
1028,
4949,
8663,
8873,
2290,
1027,
9530,
8873,
2290,
1012,
2131,
7076,
26897,
1006,
1007,
1012,
2131,
22578,
2239,
2863,
15042,
2239,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | service/src/main/java/com/networknt/service/SingletonServiceFactory.java | SingletonServiceFactory.handleSingletonList | private static void handleSingletonList(String key, List<Object> value) throws Exception {
List<String> interfaceClasses = new ArrayList();
if(key.contains(",")) {
String[] interfaces = key.split(",");
interfaceClasses.addAll(Arrays.asList(interfaces));
} else {
interfaceClasses.add(key);
}
// the value can be a list of implementation class names or a map.
if(value != null && value.size() == 1) {
handleSingleImpl(interfaceClasses, value);
} else {
handleMultipleImpl(interfaceClasses, value);
}
} | java | private static void handleSingletonList(String key, List<Object> value) throws Exception {
List<String> interfaceClasses = new ArrayList();
if(key.contains(",")) {
String[] interfaces = key.split(",");
interfaceClasses.addAll(Arrays.asList(interfaces));
} else {
interfaceClasses.add(key);
}
// the value can be a list of implementation class names or a map.
if(value != null && value.size() == 1) {
handleSingleImpl(interfaceClasses, value);
} else {
handleMultipleImpl(interfaceClasses, value);
}
} | [
"private",
"static",
"void",
"handleSingletonList",
"(",
"String",
"key",
",",
"List",
"<",
"Object",
">",
"value",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"interfaceClasses",
"=",
"new",
"ArrayList",
"(",
")",
";",
"if",
"(",
"key",
... | For each singleton definition, create object for the interface with the implementation class,
and push it into the service map with key and implemented object.
@param key String interface or multiple interface separated by ","
@param value List of implementations of interface(s) defined in the key
@throws Exception exception thrown from the object creation | [
"For",
"each",
"singleton",
"definition",
"create",
"object",
"for",
"the",
"interface",
"with",
"the",
"implementation",
"class",
"and",
"push",
"it",
"into",
"the",
"service",
"map",
"with",
"key",
"and",
"implemented",
"object",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/SingletonServiceFactory.java#L210-L225 | train | Handle singleton list. | [
30522,
2797,
10763,
11675,
16024,
2075,
19263,
9863,
1006,
5164,
3145,
1010,
2862,
1026,
4874,
1028,
3643,
1007,
11618,
6453,
1063,
2862,
1026,
5164,
1028,
8278,
26266,
2229,
1027,
2047,
9140,
9863,
1006,
1007,
1025,
2065,
1006,
3145,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java | HttpStaticFileServerHandler.sendNotModified | private void sendNotModified(ChannelHandlerContext ctx) {
FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, NOT_MODIFIED);
setDateHeader(response);
this.sendAndCleanupConnection(ctx, response);
} | java | private void sendNotModified(ChannelHandlerContext ctx) {
FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, NOT_MODIFIED);
setDateHeader(response);
this.sendAndCleanupConnection(ctx, response);
} | [
"private",
"void",
"sendNotModified",
"(",
"ChannelHandlerContext",
"ctx",
")",
"{",
"FullHttpResponse",
"response",
"=",
"new",
"DefaultFullHttpResponse",
"(",
"HTTP_1_1",
",",
"NOT_MODIFIED",
")",
";",
"setDateHeader",
"(",
"response",
")",
";",
"this",
".",
"se... | When file timestamp is the same as what the browser is sending up, send a "304 Not Modified"
@param ctx
Context | [
"When",
"file",
"timestamp",
"is",
"the",
"same",
"as",
"what",
"the",
"browser",
"is",
"sending",
"up",
"send",
"a",
"304",
"Not",
"Modified"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java#L338-L343 | train | Sends a 304 Not Modified response. | [
30522,
2797,
11675,
4604,
17048,
5302,
4305,
10451,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1007,
1063,
2440,
11039,
25856,
6072,
26029,
3366,
3433,
1027,
2047,
12398,
3993,
2140,
11039,
25856,
6072,
26029,
3366,
1006,
8299,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-dfa/src/main/java/cn/hutool/dfa/SensitiveUtil.java | SensitiveUtil.init | public static void init(final Collection<String> sensitiveWords, boolean isAsync){
if(isAsync){
ThreadUtil.execAsync(new Callable<Boolean>(){
@Override
public Boolean call() throws Exception {
init(sensitiveWords);
return true;
}
});
}else{
init(sensitiveWords);
}
} | java | public static void init(final Collection<String> sensitiveWords, boolean isAsync){
if(isAsync){
ThreadUtil.execAsync(new Callable<Boolean>(){
@Override
public Boolean call() throws Exception {
init(sensitiveWords);
return true;
}
});
}else{
init(sensitiveWords);
}
} | [
"public",
"static",
"void",
"init",
"(",
"final",
"Collection",
"<",
"String",
">",
"sensitiveWords",
",",
"boolean",
"isAsync",
")",
"{",
"if",
"(",
"isAsync",
")",
"{",
"ThreadUtil",
".",
"execAsync",
"(",
"new",
"Callable",
"<",
"Boolean",
">",
"(",
"... | 初始化敏感词树
@param isAsync 是否异步初始化
@param sensitiveWords 敏感词列表 | [
"初始化敏感词树"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-dfa/src/main/java/cn/hutool/dfa/SensitiveUtil.java#L34-L47 | train | Initializes the entity with the specified sensitive words. | [
30522,
2270,
10763,
11675,
1999,
4183,
1006,
2345,
3074,
1026,
5164,
1028,
7591,
22104,
1010,
22017,
20898,
18061,
6508,
12273,
1007,
1063,
2065,
1006,
18061,
6508,
12273,
1007,
1063,
11689,
21823,
2140,
1012,
4654,
19281,
6508,
12273,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Settings.java | Http2Settings.getIntValue | public Integer getIntValue(char key) {
Long value = get(key);
if (value == null) {
return null;
}
return value.intValue();
} | java | public Integer getIntValue(char key) {
Long value = get(key);
if (value == null) {
return null;
}
return value.intValue();
} | [
"public",
"Integer",
"getIntValue",
"(",
"char",
"key",
")",
"{",
"Long",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"value",
".",
"intValue",
"(",
")",
";",
"}"
] | A helper method that returns {@link Long#intValue()} on the return of {@link #get(char)}, if present. Note that
if the range of the value exceeds {@link Integer#MAX_VALUE}, the {@link #get(char)} method should
be used instead to avoid truncation of the value. | [
"A",
"helper",
"method",
"that",
"returns",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Settings.java#L197-L203 | train | Gets the value of a CRASS Locale attribute as an Integer. | [
30522,
2270,
16109,
2131,
18447,
10175,
5657,
1006,
25869,
3145,
1007,
1063,
2146,
3643,
1027,
2131,
1006,
3145,
1007,
1025,
2065,
1006,
3643,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
3643,
1012,
20014,
10175,
5657,
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-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/HadoopConfigLoader.java | HadoopConfigLoader.mirrorCertainHadoopConfig | private org.apache.hadoop.conf.Configuration mirrorCertainHadoopConfig(
org.apache.hadoop.conf.Configuration hadoopConfig) {
for (String[] mirrored : mirroredConfigKeys) {
String value = hadoopConfig.get(mirrored[0], null);
if (value != null) {
hadoopConfig.set(mirrored[1], value);
}
}
return hadoopConfig;
} | java | private org.apache.hadoop.conf.Configuration mirrorCertainHadoopConfig(
org.apache.hadoop.conf.Configuration hadoopConfig) {
for (String[] mirrored : mirroredConfigKeys) {
String value = hadoopConfig.get(mirrored[0], null);
if (value != null) {
hadoopConfig.set(mirrored[1], value);
}
}
return hadoopConfig;
} | [
"private",
"org",
".",
"apache",
".",
"hadoop",
".",
"conf",
".",
"Configuration",
"mirrorCertainHadoopConfig",
"(",
"org",
".",
"apache",
".",
"hadoop",
".",
"conf",
".",
"Configuration",
"hadoopConfig",
")",
"{",
"for",
"(",
"String",
"[",
"]",
"mirrored",... | with different keys | [
"with",
"different",
"keys"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-s3-fs-base/src/main/java/org/apache/flink/fs/s3/common/HadoopConfigLoader.java#L113-L122 | train | Mirrored the hadoop config. | [
30522,
2797,
8917,
1012,
15895,
1012,
2018,
18589,
1012,
9530,
2546,
1012,
9563,
5259,
17119,
18249,
16102,
18589,
8663,
8873,
2290,
1006,
8917,
1012,
15895,
1012,
2018,
18589,
1012,
9530,
2546,
1012,
9563,
2018,
18589,
8663,
8873,
2290,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | client/src/main/java/com/networknt/client/Http2Client.java | Http2Client.addAuthToken | public void addAuthToken(ClientRequest request, String token) {
if(token != null && !token.startsWith("Bearer ")) {
if(token.toUpperCase().startsWith("BEARER ")) {
// other cases of Bearer
token = "Bearer " + token.substring(7);
} else {
token = "Bearer " + token;
}
}
request.getRequestHeaders().put(Headers.AUTHORIZATION, token);
} | java | public void addAuthToken(ClientRequest request, String token) {
if(token != null && !token.startsWith("Bearer ")) {
if(token.toUpperCase().startsWith("BEARER ")) {
// other cases of Bearer
token = "Bearer " + token.substring(7);
} else {
token = "Bearer " + token;
}
}
request.getRequestHeaders().put(Headers.AUTHORIZATION, token);
} | [
"public",
"void",
"addAuthToken",
"(",
"ClientRequest",
"request",
",",
"String",
"token",
")",
"{",
"if",
"(",
"token",
"!=",
"null",
"&&",
"!",
"token",
".",
"startsWith",
"(",
"\"Bearer \"",
")",
")",
"{",
"if",
"(",
"token",
".",
"toUpperCase",
"(",
... | Add Authorization Code grant token the caller app gets from OAuth2 server.
This is the method called from client like web server
@param request the http request
@param token the bearer token | [
"Add",
"Authorization",
"Code",
"grant",
"token",
"the",
"caller",
"app",
"gets",
"from",
"OAuth2",
"server",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/Http2Client.java#L273-L283 | train | Add the authorization token to the request. | [
30522,
2270,
11675,
5587,
4887,
2705,
18715,
30524,
20905,
1000,
1007,
1007,
1063,
2065,
1006,
19204,
1012,
2000,
29547,
18992,
3366,
1006,
1007,
1012,
4627,
24415,
1006,
1000,
20905,
1000,
1007,
1007,
1063,
1013,
1013,
2060,
3572,
1997,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java | TaskSlotTable.start | public void start(SlotActions initialSlotActions) {
this.slotActions = Preconditions.checkNotNull(initialSlotActions);
timerService.start(this);
started = true;
} | java | public void start(SlotActions initialSlotActions) {
this.slotActions = Preconditions.checkNotNull(initialSlotActions);
timerService.start(this);
started = true;
} | [
"public",
"void",
"start",
"(",
"SlotActions",
"initialSlotActions",
")",
"{",
"this",
".",
"slotActions",
"=",
"Preconditions",
".",
"checkNotNull",
"(",
"initialSlotActions",
")",
";",
"timerService",
".",
"start",
"(",
"this",
")",
";",
"started",
"=",
"tru... | Start the task slot table with the given slot actions.
@param initialSlotActions to use for slot actions | [
"Start",
"the",
"task",
"slot",
"table",
"with",
"the",
"given",
"slot",
"actions",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java#L119-L125 | train | Start the slot timer. | [
30522,
2270,
11675,
2707,
1006,
10453,
18908,
8496,
20381,
10994,
18908,
8496,
1007,
1063,
2023,
1012,
10453,
18908,
8496,
1027,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
20381,
10994,
18908,
8496,
1007,
1025,
25309,
8043... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java | RestTemplateBuilder.configure | public <T extends RestTemplate> T configure(T restTemplate) {
configureRequestFactory(restTemplate);
if (!CollectionUtils.isEmpty(this.messageConverters)) {
restTemplate.setMessageConverters(new ArrayList<>(this.messageConverters));
}
if (this.uriTemplateHandler != null) {
restTemplate.setUriTemplateHandler(this.uriTemplateHandler);
}
if (this.errorHandler != null) {
restTemplate.setErrorHandler(this.errorHandler);
}
if (this.rootUri != null) {
RootUriTemplateHandler.addTo(restTemplate, this.rootUri);
}
if (this.basicAuthentication != null) {
restTemplate.getInterceptors().add(this.basicAuthentication);
}
restTemplate.getInterceptors().addAll(this.interceptors);
if (!CollectionUtils.isEmpty(this.restTemplateCustomizers)) {
for (RestTemplateCustomizer customizer : this.restTemplateCustomizers) {
customizer.customize(restTemplate);
}
}
return restTemplate;
} | java | public <T extends RestTemplate> T configure(T restTemplate) {
configureRequestFactory(restTemplate);
if (!CollectionUtils.isEmpty(this.messageConverters)) {
restTemplate.setMessageConverters(new ArrayList<>(this.messageConverters));
}
if (this.uriTemplateHandler != null) {
restTemplate.setUriTemplateHandler(this.uriTemplateHandler);
}
if (this.errorHandler != null) {
restTemplate.setErrorHandler(this.errorHandler);
}
if (this.rootUri != null) {
RootUriTemplateHandler.addTo(restTemplate, this.rootUri);
}
if (this.basicAuthentication != null) {
restTemplate.getInterceptors().add(this.basicAuthentication);
}
restTemplate.getInterceptors().addAll(this.interceptors);
if (!CollectionUtils.isEmpty(this.restTemplateCustomizers)) {
for (RestTemplateCustomizer customizer : this.restTemplateCustomizers) {
customizer.customize(restTemplate);
}
}
return restTemplate;
} | [
"public",
"<",
"T",
"extends",
"RestTemplate",
">",
"T",
"configure",
"(",
"T",
"restTemplate",
")",
"{",
"configureRequestFactory",
"(",
"restTemplate",
")",
";",
"if",
"(",
"!",
"CollectionUtils",
".",
"isEmpty",
"(",
"this",
".",
"messageConverters",
")",
... | Configure the provided {@link RestTemplate} instance using this builder.
@param <T> the type of rest template
@param restTemplate the {@link RestTemplate} to configure
@return the rest template instance
@see RestTemplateBuilder#build()
@see RestTemplateBuilder#build(Class) | [
"Configure",
"the",
"provided",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java#L522-L546 | train | Configures the given RestTemplate with the configuration of this RestTemplateBuilder. | [
30522,
2270,
1026,
1056,
8908,
2717,
18532,
15725,
1028,
1056,
9530,
8873,
27390,
2063,
1006,
1056,
2717,
18532,
15725,
1007,
1063,
9530,
8873,
27390,
7869,
15500,
21450,
1006,
2717,
18532,
15725,
1007,
1025,
2065,
1006,
999,
3074,
21823,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java | JSONObject.optJSONArray | public JSONArray optJSONArray(String name) {
Object object = opt(name);
return object instanceof JSONArray ? (JSONArray) object : null;
} | java | public JSONArray optJSONArray(String name) {
Object object = opt(name);
return object instanceof JSONArray ? (JSONArray) object : null;
} | [
"public",
"JSONArray",
"optJSONArray",
"(",
"String",
"name",
")",
"{",
"Object",
"object",
"=",
"opt",
"(",
"name",
")",
";",
"return",
"object",
"instanceof",
"JSONArray",
"?",
"(",
"JSONArray",
")",
"object",
":",
"null",
";",
"}"
] | Returns the value mapped by {@code name} if it exists and is a {@code
JSONArray}. Returns null otherwise.
@param name the name of the property
@return the value or {@code null} | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L616-L619 | train | Get the optional JSONArray value associated with a name. | [
30522,
2270,
1046,
3385,
2906,
9447,
23569,
22578,
7856,
11335,
2100,
1006,
5164,
2171,
1007,
1063,
4874,
4874,
1027,
23569,
1006,
2171,
1007,
1025,
2709,
4874,
6013,
11253,
1046,
3385,
2906,
9447,
1029,
1006,
1046,
3385,
2906,
9447,
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-clients/src/main/java/org/apache/flink/client/program/DetachedEnvironment.java | DetachedEnvironment.finalizeExecute | JobSubmissionResult finalizeExecute() throws ProgramInvocationException {
return client.run(detachedPlan, jarFilesToAttach, classpathsToAttach, userCodeClassLoader, savepointSettings);
} | java | JobSubmissionResult finalizeExecute() throws ProgramInvocationException {
return client.run(detachedPlan, jarFilesToAttach, classpathsToAttach, userCodeClassLoader, savepointSettings);
} | [
"JobSubmissionResult",
"finalizeExecute",
"(",
")",
"throws",
"ProgramInvocationException",
"{",
"return",
"client",
".",
"run",
"(",
"detachedPlan",
",",
"jarFilesToAttach",
",",
"classpathsToAttach",
",",
"userCodeClassLoader",
",",
"savepointSettings",
")",
";",
"}"
... | Finishes this Context Environment's execution by explicitly running the plan constructed. | [
"Finishes",
"this",
"Context",
"Environment",
"s",
"execution",
"by",
"explicitly",
"running",
"the",
"plan",
"constructed",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/program/DetachedEnvironment.java#L76-L78 | train | Finalize the execution of the job. | [
30522,
5841,
12083,
25481,
6072,
11314,
2345,
4697,
10288,
8586,
10421,
1006,
1007,
11618,
2565,
2378,
19152,
10288,
24422,
1063,
2709,
7396,
1012,
2448,
1006,
12230,
24759,
2319,
1010,
15723,
8873,
4244,
3406,
19321,
6776,
1010,
2465,
15069,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.getDateHeader | @Deprecated
public static Date getDateHeader(HttpMessage message, String name) throws ParseException {
return getDateHeader(message, (CharSequence) name);
} | java | @Deprecated
public static Date getDateHeader(HttpMessage message, String name) throws ParseException {
return getDateHeader(message, (CharSequence) name);
} | [
"@",
"Deprecated",
"public",
"static",
"Date",
"getDateHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
")",
"throws",
"ParseException",
"{",
"return",
"getDateHeader",
"(",
"message",
",",
"(",
"CharSequence",
")",
"name",
")",
";",
"}"
] | @deprecated Use {@link #getTimeMillis(CharSequence)} instead.
@see #getDateHeader(HttpMessage, CharSequence) | [
"@deprecated",
"Use",
"{",
"@link",
"#getTimeMillis",
"(",
"CharSequence",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L826-L829 | train | Gets the date header value from the given message. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
3058,
2131,
13701,
4974,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
5164,
2171,
1007,
11618,
11968,
19763,
2595,
24422,
1063,
2709,
2131,
13701,
4974,
2121,
1006,
4471,
1010,
1006,
25869,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/GroupedMap.java | GroupedMap.get | public String get(String group, String key) {
readLock.lock();
try {
LinkedHashMap<String, String> map = this.get(StrUtil.nullToEmpty(group));
if (MapUtil.isNotEmpty(map)) {
return map.get(key);
}
} finally {
readLock.unlock();
}
return null;
} | java | public String get(String group, String key) {
readLock.lock();
try {
LinkedHashMap<String, String> map = this.get(StrUtil.nullToEmpty(group));
if (MapUtil.isNotEmpty(map)) {
return map.get(key);
}
} finally {
readLock.unlock();
}
return null;
} | [
"public",
"String",
"get",
"(",
"String",
"group",
",",
"String",
"key",
")",
"{",
"readLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
"map",
"=",
"this",
".",
"get",
"(",
"StrUtil",
".",
"nullToEmp... | 获取分组对应的值,如果分组不存在或者值不存在则返回null
@param group 分组
@param key 键
@return 值,如果分组不存在或者值不存在则返回null | [
"获取分组对应的值,如果分组不存在或者值不存在则返回null"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/GroupedMap.java#L38-L49 | train | Gets the value of the specified group and key from the specified group. | [
30522,
2270,
5164,
2131,
1006,
5164,
2177,
1010,
5164,
3145,
1007,
1063,
3191,
7878,
1012,
5843,
1006,
1007,
1025,
3046,
1063,
5799,
14949,
22444,
2361,
1026,
5164,
1010,
5164,
1028,
4949,
1027,
2023,
1012,
2131,
1006,
2358,
22134,
4014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/Proxy.java | Proxy.setSocksVersion | public Proxy setSocksVersion(Integer socksVersion) {
verifyProxyTypeCompatibility(ProxyType.MANUAL);
this.proxyType = ProxyType.MANUAL;
this.socksVersion = socksVersion;
return this;
} | java | public Proxy setSocksVersion(Integer socksVersion) {
verifyProxyTypeCompatibility(ProxyType.MANUAL);
this.proxyType = ProxyType.MANUAL;
this.socksVersion = socksVersion;
return this;
} | [
"public",
"Proxy",
"setSocksVersion",
"(",
"Integer",
"socksVersion",
")",
"{",
"verifyProxyTypeCompatibility",
"(",
"ProxyType",
".",
"MANUAL",
")",
";",
"this",
".",
"proxyType",
"=",
"ProxyType",
".",
"MANUAL",
";",
"this",
".",
"socksVersion",
"=",
"socksVer... | Specifies which version of SOCKS to use (4 or 5).
@param socksVersion SOCKS version, 4 or 5
@return reference to self | [
"Specifies",
"which",
"version",
"of",
"SOCKS",
"to",
"use",
"(",
"4",
"or",
"5",
")",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/Proxy.java#L327-L332 | train | Sets the SOCKS version of the proxy. | [
30522,
2270,
24540,
4520,
25384,
27774,
1006,
16109,
14829,
27774,
1007,
1063,
20410,
21572,
18037,
13874,
9006,
24952,
8553,
1006,
24540,
13874,
1012,
6410,
1007,
1025,
2023,
1012,
24540,
13874,
1027,
24540,
13874,
1012,
6410,
1025,
2023,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/csv/CsvWriter.java | CsvWriter.writeLine | public void writeLine() throws IORuntimeException {
try {
writer.write(config.lineDelimiter);
} catch (IOException e) {
throw new IORuntimeException(e);
}
newline = true;
} | java | public void writeLine() throws IORuntimeException {
try {
writer.write(config.lineDelimiter);
} catch (IOException e) {
throw new IORuntimeException(e);
}
newline = true;
} | [
"public",
"void",
"writeLine",
"(",
")",
"throws",
"IORuntimeException",
"{",
"try",
"{",
"writer",
".",
"write",
"(",
"config",
".",
"lineDelimiter",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IORuntimeException",
"(",
"e"... | 追加新行(换行)
@throws IORuntimeException IO异常 | [
"追加新行(换行)"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvWriter.java#L203-L210 | train | Write a line of text. | [
30522,
2270,
11675,
4339,
4179,
1006,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
3046,
1063,
3213,
1012,
4339,
1006,
9530,
8873,
2290,
1012,
7732,
20806,
23419,
2099,
1007,
1025,
1065,
4608,
1006,
22834,
10288,
24422,
1041,
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/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/rule/registry/extractor/ExtractorRuleDefinition.java | ExtractorRuleDefinition.init | @SneakyThrows
public void init(final ExtractorRuleDefinitionEntity ruleDefinitionEntity) {
for (ExtractorRuleEntity each : ruleDefinitionEntity.getRules()) {
rules.put(each.getId(), (SQLSegmentExtractor) Class.forName(each.getExtractorClass()).newInstance());
}
} | java | @SneakyThrows
public void init(final ExtractorRuleDefinitionEntity ruleDefinitionEntity) {
for (ExtractorRuleEntity each : ruleDefinitionEntity.getRules()) {
rules.put(each.getId(), (SQLSegmentExtractor) Class.forName(each.getExtractorClass()).newInstance());
}
} | [
"@",
"SneakyThrows",
"public",
"void",
"init",
"(",
"final",
"ExtractorRuleDefinitionEntity",
"ruleDefinitionEntity",
")",
"{",
"for",
"(",
"ExtractorRuleEntity",
"each",
":",
"ruleDefinitionEntity",
".",
"getRules",
"(",
")",
")",
"{",
"rules",
".",
"put",
"(",
... | Initialize SQL extractor rule definition.
@param ruleDefinitionEntity extractor rule definition entity | [
"Initialize",
"SQL",
"extractor",
"rule",
"definition",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/rule/registry/extractor/ExtractorRuleDefinition.java#L45-L50 | train | Initializes the extractor rule definition entity. | [
30522,
1030,
13583,
22123,
8093,
15568,
2270,
11675,
1999,
4183,
1006,
2345,
14817,
2953,
6820,
3709,
12879,
5498,
3508,
4765,
3012,
5451,
12879,
5498,
3508,
4765,
3012,
1007,
1063,
2005,
1006,
14817,
2953,
6820,
24129,
3775,
3723,
2169,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/TaskStateSnapshot.java | TaskStateSnapshot.hasState | public boolean hasState() {
for (OperatorSubtaskState operatorSubtaskState : subtaskStatesByOperatorID.values()) {
if (operatorSubtaskState != null && operatorSubtaskState.hasState()) {
return true;
}
}
return false;
} | java | public boolean hasState() {
for (OperatorSubtaskState operatorSubtaskState : subtaskStatesByOperatorID.values()) {
if (operatorSubtaskState != null && operatorSubtaskState.hasState()) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"hasState",
"(",
")",
"{",
"for",
"(",
"OperatorSubtaskState",
"operatorSubtaskState",
":",
"subtaskStatesByOperatorID",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"operatorSubtaskState",
"!=",
"null",
"&&",
"operatorSubtaskState",
".",
"ha... | Returns true if at least one {@link OperatorSubtaskState} in subtaskStatesByOperatorID has state. | [
"Returns",
"true",
"if",
"at",
"least",
"one",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/TaskStateSnapshot.java#L99-L106 | train | Returns true if this subtask has a state. | [
30522,
2270,
22017,
20898,
2038,
9153,
2618,
1006,
1007,
30524,
14478,
25918,
8844,
3593,
1012,
5300,
1006,
1007,
1007,
1063,
2065,
1006,
9224,
12083,
10230,
5705,
12259,
999,
1027,
19701,
1004,
1004,
9224,
12083,
10230,
5705,
12259,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/WindowOperator.java | WindowOperator.cleanupTime | private long cleanupTime(W window) {
if (windowAssigner.isEventTime()) {
long cleanupTime = Math.max(0, window.maxTimestamp() + allowedLateness);
return cleanupTime >= window.maxTimestamp() ? cleanupTime : Long.MAX_VALUE;
} else {
return Math.max(0, window.maxTimestamp());
}
} | java | private long cleanupTime(W window) {
if (windowAssigner.isEventTime()) {
long cleanupTime = Math.max(0, window.maxTimestamp() + allowedLateness);
return cleanupTime >= window.maxTimestamp() ? cleanupTime : Long.MAX_VALUE;
} else {
return Math.max(0, window.maxTimestamp());
}
} | [
"private",
"long",
"cleanupTime",
"(",
"W",
"window",
")",
"{",
"if",
"(",
"windowAssigner",
".",
"isEventTime",
"(",
")",
")",
"{",
"long",
"cleanupTime",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"window",
".",
"maxTimestamp",
"(",
")",
"+",
"allowedLa... | Returns the cleanup time for a window, which is
{@code window.maxTimestamp + allowedLateness}. In
case this leads to a value greated than {@link Long#MAX_VALUE}
then a cleanup time of {@link Long#MAX_VALUE} is
returned.
@param window the window whose cleanup time we are computing. | [
"Returns",
"the",
"cleanup",
"time",
"for",
"a",
"window",
"which",
"is",
"{",
"@code",
"window",
".",
"maxTimestamp",
"+",
"allowedLateness",
"}",
".",
"In",
"case",
"this",
"leads",
"to",
"a",
"value",
"greated",
"than",
"{",
"@link",
"Long#MAX_VALUE",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/WindowOperator.java#L495-L502 | train | Returns the maximum timestamp of the event. | [
30522,
2797,
2146,
27686,
7292,
1006,
1059,
3332,
1007,
1063,
2065,
1006,
3332,
12054,
23773,
2121,
1012,
2003,
18697,
3372,
7292,
1006,
1007,
1007,
1063,
2146,
27686,
7292,
1027,
8785,
1012,
4098,
1006,
1014,
1010,
3332,
1012,
4098,
7292,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.putIntLittleEndian | public final void putIntLittleEndian(int index, int value) {
if (LITTLE_ENDIAN) {
putInt(index, value);
} else {
putInt(index, Integer.reverseBytes(value));
}
} | java | public final void putIntLittleEndian(int index, int value) {
if (LITTLE_ENDIAN) {
putInt(index, value);
} else {
putInt(index, Integer.reverseBytes(value));
}
} | [
"public",
"final",
"void",
"putIntLittleEndian",
"(",
"int",
"index",
",",
"int",
"value",
")",
"{",
"if",
"(",
"LITTLE_ENDIAN",
")",
"{",
"putInt",
"(",
"index",
",",
"value",
")",
";",
"}",
"else",
"{",
"putInt",
"(",
"index",
",",
"Integer",
".",
... | Writes the given int value (32bit, 4 bytes) to the given position in little endian
byte order. This method's speed depends on the system's native byte order, and it
is possibly slower than {@link #putInt(int, int)}. For most cases (such as
transient storage in memory or serialization for I/O and network),
it suffices to know that the byte order in which the value is written is the same as the
one in which it is read, and {@link #putInt(int, int)} is the preferable choice.
@param index The position at which the value will be written.
@param value The int value to be written.
@throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment
size minus 4. | [
"Writes",
"the",
"given",
"int",
"value",
"(",
"32bit",
"4",
"bytes",
")",
"to",
"the",
"given",
"position",
"in",
"little",
"endian",
"byte",
"order",
".",
"This",
"method",
"s",
"speed",
"depends",
"on",
"the",
"system",
"s",
"native",
"byte",
"order",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L790-L796 | train | Puts an int value into the buffer at the given index in little - endian order. | [
30522,
2270,
2345,
11675,
22072,
19646,
12474,
24129,
11692,
1006,
20014,
5950,
1010,
20014,
3643,
1007,
1063,
2065,
1006,
2210,
1035,
2203,
2937,
1007,
1063,
22072,
2102,
1006,
5950,
1010,
3643,
1007,
1025,
1065,
2842,
1063,
22072,
2102,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java | JSONObject.optJSONObject | public JSONObject optJSONObject(String name) {
Object object = opt(name);
return object instanceof JSONObject ? (JSONObject) object : null;
} | java | public JSONObject optJSONObject(String name) {
Object object = opt(name);
return object instanceof JSONObject ? (JSONObject) object : null;
} | [
"public",
"JSONObject",
"optJSONObject",
"(",
"String",
"name",
")",
"{",
"Object",
"object",
"=",
"opt",
"(",
"name",
")",
";",
"return",
"object",
"instanceof",
"JSONObject",
"?",
"(",
"JSONObject",
")",
"object",
":",
"null",
";",
"}"
] | Returns the value mapped by {@code name} if it exists and is a {@code
JSONObject}. Returns null otherwise.
@param name the name of the property
@return the value or {@code null} | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L645-L648 | train | Get the optional JSONObject associated with a name. | [
30522,
2270,
1046,
3385,
16429,
20614,
23569,
22578,
17175,
2497,
20614,
1006,
5164,
2171,
1007,
1063,
4874,
4874,
1027,
23569,
1006,
2171,
1007,
1025,
2709,
4874,
6013,
11253,
1046,
3385,
16429,
20614,
1029,
1006,
1046,
3385,
16429,
20614,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/LocalExecutor.java | LocalExecutor.getPlanAsJSON | public static String getPlanAsJSON(Plan plan) {
List<DataSinkNode> sinks = Optimizer.createPreOptimizedPlan(plan);
return new PlanJSONDumpGenerator().getPactPlanAsJSON(sinks);
} | java | public static String getPlanAsJSON(Plan plan) {
List<DataSinkNode> sinks = Optimizer.createPreOptimizedPlan(plan);
return new PlanJSONDumpGenerator().getPactPlanAsJSON(sinks);
} | [
"public",
"static",
"String",
"getPlanAsJSON",
"(",
"Plan",
"plan",
")",
"{",
"List",
"<",
"DataSinkNode",
">",
"sinks",
"=",
"Optimizer",
".",
"createPreOptimizedPlan",
"(",
"plan",
")",
";",
"return",
"new",
"PlanJSONDumpGenerator",
"(",
")",
".",
"getPactPl... | Creates a JSON representation of the given dataflow plan.
@param plan The dataflow plan.
@return The dataflow plan (prior to optimization) as a JSON string. | [
"Creates",
"a",
"JSON",
"representation",
"of",
"the",
"given",
"dataflow",
"plan",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/LocalExecutor.java#L314-L317 | train | Get the plan as a JSON string. | [
30522,
2270,
10763,
5164,
2131,
24759,
5162,
2015,
22578,
2239,
1006,
2933,
2933,
1007,
1063,
2862,
1026,
2951,
11493,
2243,
3630,
3207,
1028,
23462,
1027,
23569,
27605,
6290,
1012,
3443,
28139,
7361,
3775,
4328,
5422,
24759,
2319,
1006,
29... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java | NetUtil.getLocalhostStr | public static String getLocalhostStr() {
InetAddress localhost = getLocalhost();
if (null != localhost) {
return localhost.getHostAddress();
}
return null;
} | java | public static String getLocalhostStr() {
InetAddress localhost = getLocalhost();
if (null != localhost) {
return localhost.getHostAddress();
}
return null;
} | [
"public",
"static",
"String",
"getLocalhostStr",
"(",
")",
"{",
"InetAddress",
"localhost",
"=",
"getLocalhost",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"localhost",
")",
"{",
"return",
"localhost",
".",
"getHostAddress",
"(",
")",
";",
"}",
"return",
"nul... | 获取本机网卡IP地址,这个地址为所有网卡中非回路地址的第一个<br>
如果获取失败调用 {@link InetAddress#getLocalHost()}方法获取。<br>
此方法不会抛出异常,获取失败将返回<code>null</code><br>
参考:http://stackoverflow.com/questions/9481865/getting-the-ip-address-of-the-current-machine-using-java
@return 本机网卡IP地址,获取失败返回<code>null</code>
@since 3.0.7 | [
"获取本机网卡IP地址,这个地址为所有网卡中非回路地址的第一个<br",
">",
"如果获取失败调用",
"{",
"@link",
"InetAddress#getLocalHost",
"()",
"}",
"方法获取。<br",
">",
"此方法不会抛出异常,获取失败将返回<code",
">",
"null<",
"/",
"code",
">",
"<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L354-L360 | train | Returns the local host string. | [
30522,
2270,
10763,
5164,
2131,
4135,
9289,
15006,
3215,
16344,
1006,
1007,
1063,
1999,
12928,
14141,
8303,
2334,
15006,
2102,
1027,
2131,
4135,
9289,
15006,
2102,
1006,
1007,
1025,
2065,
1006,
19701,
999,
1027,
2334,
15006,
2102,
1007,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/CoreDictionary.java | CoreDictionary.loadDat | static boolean loadDat(String path)
{
try
{
ByteArray byteArray = ByteArray.createByteArray(path + Predefine.BIN_EXT);
if (byteArray == null) return false;
int size = byteArray.nextInt();
CoreDictionary.Attribute[] attributes = new CoreDictionary.Attribute[size];
final Nature[] natureIndexArray = Nature.values();
for (int i = 0; i < size; ++i)
{
// 第一个是全部频次,第二个是词性个数
int currentTotalFrequency = byteArray.nextInt();
int length = byteArray.nextInt();
attributes[i] = new CoreDictionary.Attribute(length);
attributes[i].totalFrequency = currentTotalFrequency;
for (int j = 0; j < length; ++j)
{
attributes[i].nature[j] = natureIndexArray[byteArray.nextInt()];
attributes[i].frequency[j] = byteArray.nextInt();
}
}
if (!trie.load(byteArray, attributes) || byteArray.hasMore()) return false;
}
catch (Exception e)
{
logger.warning("读取失败,问题发生在" + e);
return false;
}
return true;
} | java | static boolean loadDat(String path)
{
try
{
ByteArray byteArray = ByteArray.createByteArray(path + Predefine.BIN_EXT);
if (byteArray == null) return false;
int size = byteArray.nextInt();
CoreDictionary.Attribute[] attributes = new CoreDictionary.Attribute[size];
final Nature[] natureIndexArray = Nature.values();
for (int i = 0; i < size; ++i)
{
// 第一个是全部频次,第二个是词性个数
int currentTotalFrequency = byteArray.nextInt();
int length = byteArray.nextInt();
attributes[i] = new CoreDictionary.Attribute(length);
attributes[i].totalFrequency = currentTotalFrequency;
for (int j = 0; j < length; ++j)
{
attributes[i].nature[j] = natureIndexArray[byteArray.nextInt()];
attributes[i].frequency[j] = byteArray.nextInt();
}
}
if (!trie.load(byteArray, attributes) || byteArray.hasMore()) return false;
}
catch (Exception e)
{
logger.warning("读取失败,问题发生在" + e);
return false;
}
return true;
} | [
"static",
"boolean",
"loadDat",
"(",
"String",
"path",
")",
"{",
"try",
"{",
"ByteArray",
"byteArray",
"=",
"ByteArray",
".",
"createByteArray",
"(",
"path",
"+",
"Predefine",
".",
"BIN_EXT",
")",
";",
"if",
"(",
"byteArray",
"==",
"null",
")",
"return",
... | 从磁盘加载双数组
@param path
@return | [
"从磁盘加载双数组"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CoreDictionary.java#L135-L165 | train | Load the data from a file. | [
30522,
10763,
22017,
20898,
7170,
2850,
2102,
1006,
5164,
4130,
1007,
1063,
3046,
1063,
24880,
2906,
9447,
24880,
2906,
9447,
1027,
24880,
2906,
9447,
1012,
3443,
3762,
27058,
11335,
2100,
1006,
4130,
1009,
3653,
3207,
23460,
1012,
8026,
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-table/flink-sql-client/src/main/java/org/apache/flink/table/client/SqlClient.java | SqlClient.validateEnvironment | private static void validateEnvironment(SessionContext context, Executor executor) {
System.out.print("Validating current environment...");
try {
executor.validateSession(context);
System.out.println("done.");
} catch (SqlExecutionException e) {
throw new SqlClientException(
"The configured environment is invalid. Please check your environment files again.", e);
}
} | java | private static void validateEnvironment(SessionContext context, Executor executor) {
System.out.print("Validating current environment...");
try {
executor.validateSession(context);
System.out.println("done.");
} catch (SqlExecutionException e) {
throw new SqlClientException(
"The configured environment is invalid. Please check your environment files again.", e);
}
} | [
"private",
"static",
"void",
"validateEnvironment",
"(",
"SessionContext",
"context",
",",
"Executor",
"executor",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"Validating current environment...\"",
")",
";",
"try",
"{",
"executor",
".",
"validateSession",
... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/SqlClient.java#L141-L150 | train | Validate the environment. | [
30522,
2797,
10763,
11675,
9398,
3686,
2368,
21663,
2239,
3672,
1006,
5219,
8663,
18209,
6123,
1010,
4654,
8586,
16161,
2099,
4654,
8586,
16161,
2099,
1007,
1063,
2291,
1012,
2041,
1012,
6140,
1006,
1000,
9398,
5844,
2783,
4044,
1012,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStreamUtils.java | DataStreamUtils.reinterpretAsKeyedStream | public static <T, K> KeyedStream<T, K> reinterpretAsKeyedStream(
DataStream<T> stream,
KeySelector<T, K> keySelector,
TypeInformation<K> typeInfo) {
PartitionTransformation<T> partitionTransformation = new PartitionTransformation<>(
stream.getTransformation(),
new ForwardPartitioner<>());
return new KeyedStream<>(
stream,
partitionTransformation,
keySelector,
typeInfo);
} | java | public static <T, K> KeyedStream<T, K> reinterpretAsKeyedStream(
DataStream<T> stream,
KeySelector<T, K> keySelector,
TypeInformation<K> typeInfo) {
PartitionTransformation<T> partitionTransformation = new PartitionTransformation<>(
stream.getTransformation(),
new ForwardPartitioner<>());
return new KeyedStream<>(
stream,
partitionTransformation,
keySelector,
typeInfo);
} | [
"public",
"static",
"<",
"T",
",",
"K",
">",
"KeyedStream",
"<",
"T",
",",
"K",
">",
"reinterpretAsKeyedStream",
"(",
"DataStream",
"<",
"T",
">",
"stream",
",",
"KeySelector",
"<",
"T",
",",
"K",
">",
"keySelector",
",",
"TypeInformation",
"<",
"K",
"... | Reinterprets the given {@link DataStream} as a {@link KeyedStream}, which extracts keys with the given
{@link KeySelector}.
<p>IMPORTANT: For every partition of the base stream, the keys of events in the base stream must be
partitioned exactly in the same way as if it was created through a {@link DataStream#keyBy(KeySelector)}.
@param stream The data stream to reinterpret. For every partition, this stream must be partitioned exactly
in the same way as if it was created through a {@link DataStream#keyBy(KeySelector)}.
@param keySelector Function that defines how keys are extracted from the data stream.
@param typeInfo Explicit type information about the key type.
@param <T> Type of events in the data stream.
@param <K> Type of the extracted keys.
@return The reinterpretation of the {@link DataStream} as a {@link KeyedStream}. | [
"Reinterprets",
"the",
"given",
"{",
"@link",
"DataStream",
"}",
"as",
"a",
"{",
"@link",
"KeyedStream",
"}",
"which",
"extracts",
"keys",
"with",
"the",
"given",
"{",
"@link",
"KeySelector",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStreamUtils.java#L129-L143 | train | Reinterprets a data stream as a KeyedStream. | [
30522,
2270,
10763,
1026,
1056,
1010,
1047,
1028,
3145,
2098,
21422,
1026,
1056,
1010,
1047,
1028,
27788,
3334,
28139,
10230,
14839,
2098,
21422,
1006,
2951,
21422,
1026,
1056,
1028,
5460,
1010,
6309,
12260,
16761,
1026,
1056,
1010,
1047,
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-cron/src/main/java/cn/hutool/cron/TaskTable.java | TaskTable.getPattern | public CronPattern getPattern(String id) {
final int index = ids.indexOf(id);
if (index > -1) {
return getPattern(index);
}
return null;
} | java | public CronPattern getPattern(String id) {
final int index = ids.indexOf(id);
if (index > -1) {
return getPattern(index);
}
return null;
} | [
"public",
"CronPattern",
"getPattern",
"(",
"String",
"id",
")",
"{",
"final",
"int",
"index",
"=",
"ids",
".",
"indexOf",
"(",
"id",
")",
";",
"if",
"(",
"index",
">",
"-",
"1",
")",
"{",
"return",
"getPattern",
"(",
"index",
")",
";",
"}",
"retur... | 获得指定id的{@link CronPattern}
@param id ID
@return {@link CronPattern}
@since 3.1.1 | [
"获得指定id的",
"{",
"@link",
"CronPattern",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/TaskTable.java#L187-L193 | train | Gets the pattern with the given id. | [
30522,
2270,
13675,
2239,
4502,
12079,
2078,
2131,
4502,
12079,
2078,
1006,
5164,
8909,
1007,
1063,
2345,
20014,
5950,
1027,
8909,
2015,
1012,
5950,
11253,
1006,
8909,
1007,
1025,
2065,
1006,
5950,
1028,
1011,
1015,
1007,
1063,
2709,
2131,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readString | public static String readString(String path, Charset charset) throws IORuntimeException {
return readString(file(path), charset);
} | java | public static String readString(String path, Charset charset) throws IORuntimeException {
return readString(file(path), charset);
} | [
"public",
"static",
"String",
"readString",
"(",
"String",
"path",
",",
"Charset",
"charset",
")",
"throws",
"IORuntimeException",
"{",
"return",
"readString",
"(",
"file",
"(",
"path",
")",
",",
"charset",
")",
";",
"}"
] | 读取文件内容
@param path 文件路径
@param charset 字符集
@return 内容
@throws IORuntimeException IO异常 | [
"读取文件内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2126-L2128 | train | Reads a string from a file. | [
30522,
2270,
10763,
5164,
9631,
18886,
3070,
1006,
5164,
4130,
1010,
25869,
13462,
25869,
13462,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
9631,
18886,
3070,
1006,
5371,
1006,
4130,
1007,
1010,
25869,
13462,
1007,
1025,
1065,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
redisson/redisson | redisson/src/main/java/org/redisson/RedissonBitSet.java | RedissonBitSet.toByteArrayReverse | private static byte[] toByteArrayReverse(BitSet bits) {
byte[] bytes = new byte[bits.length() / 8 + 1];
for (int i = 0; i < bits.length(); i++) {
if (bits.get(i)) {
final int value = bytes[i / 8] | (1 << (7 - (i % 8)));
bytes[i / 8] = (byte) value;
}
}
return bytes;
} | java | private static byte[] toByteArrayReverse(BitSet bits) {
byte[] bytes = new byte[bits.length() / 8 + 1];
for (int i = 0; i < bits.length(); i++) {
if (bits.get(i)) {
final int value = bytes[i / 8] | (1 << (7 - (i % 8)));
bytes[i / 8] = (byte) value;
}
}
return bytes;
} | [
"private",
"static",
"byte",
"[",
"]",
"toByteArrayReverse",
"(",
"BitSet",
"bits",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"bits",
".",
"length",
"(",
")",
"/",
"8",
"+",
"1",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
"... | Copied from: https://github.com/xetorthio/jedis/issues/301 | [
"Copied",
"from",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"xetorthio",
"/",
"jedis",
"/",
"issues",
"/",
"301"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/RedissonBitSet.java#L183-L192 | train | Convert the bit set to a byte array. | [
30522,
2797,
10763,
24880,
1031,
1033,
11291,
27058,
11335,
16363,
16070,
1006,
9017,
3388,
9017,
1007,
1063,
24880,
1031,
1033,
27507,
1027,
2047,
24880,
1031,
9017,
1012,
3091,
1006,
1007,
1013,
1022,
1009,
1015,
1033,
1025,
2005,
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... |
apache/flink | flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/table/descriptors/Elasticsearch.java | Elasticsearch.failureHandlerCustom | public Elasticsearch failureHandlerCustom(Class<? extends ActionRequestFailureHandler> failureHandlerClass) {
internalProperties.putString(CONNECTOR_FAILURE_HANDLER, ElasticsearchValidator.CONNECTOR_FAILURE_HANDLER_VALUE_CUSTOM);
internalProperties.putClass(CONNECTOR_FAILURE_HANDLER_CLASS, failureHandlerClass);
return this;
} | java | public Elasticsearch failureHandlerCustom(Class<? extends ActionRequestFailureHandler> failureHandlerClass) {
internalProperties.putString(CONNECTOR_FAILURE_HANDLER, ElasticsearchValidator.CONNECTOR_FAILURE_HANDLER_VALUE_CUSTOM);
internalProperties.putClass(CONNECTOR_FAILURE_HANDLER_CLASS, failureHandlerClass);
return this;
} | [
"public",
"Elasticsearch",
"failureHandlerCustom",
"(",
"Class",
"<",
"?",
"extends",
"ActionRequestFailureHandler",
">",
"failureHandlerClass",
")",
"{",
"internalProperties",
".",
"putString",
"(",
"CONNECTOR_FAILURE_HANDLER",
",",
"ElasticsearchValidator",
".",
"CONNECTO... | Configures a failure handling strategy in case a request to Elasticsearch fails.
<p>This strategy allows for custom failure handling using a {@link ActionRequestFailureHandler}. | [
"Configures",
"a",
"failure",
"handling",
"strategy",
"in",
"case",
"a",
"request",
"to",
"Elasticsearch",
"fails",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/table/descriptors/Elasticsearch.java#L174-L178 | train | Sets the failure handler class to use for the Elasticsearch client. | [
30522,
2270,
21274,
17310,
11140,
4945,
11774,
3917,
7874,
20389,
1006,
2465,
1026,
1029,
8908,
2895,
2890,
15500,
7011,
4014,
5397,
11774,
3917,
1028,
4945,
11774,
3917,
26266,
1007,
1063,
4722,
21572,
4842,
7368,
1012,
8509,
18886,
3070,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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() {
if (position + 5 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 5));
byte[] buf = buffer;
return ((long) (0xff & buf[position++])) | ((long) (0xff & buf[position++]) << 8)
| ((long) (0xff & buf[position++]) << 16) | ((long) (0xff & buf[position++]) << 24)
| ((long) (0xff & buf[position++]) << 32) | ((long) (0xff & buf[position++]) << 40);
} | java | public final long getUlong48() {
if (position + 5 >= origin + limit) throw new IllegalArgumentException("limit excceed: "
+ (position - origin + 5));
byte[] buf = buffer;
return ((long) (0xff & buf[position++])) | ((long) (0xff & buf[position++]) << 8)
| ((long) (0xff & buf[position++]) << 16) | ((long) (0xff & buf[position++]) << 24)
| ((long) (0xff & buf[position++]) << 32) | ((long) (0xff & buf[position++]) << 40);
} | [
"public",
"final",
"long",
"getUlong48",
"(",
")",
"{",
"if",
"(",
"position",
"+",
"5",
">=",
"origin",
"+",
"limit",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit excceed: \"",
"+",
"(",
"position",
"-",
"origin",
"+",
"5",
")",
")",
"... | Return next 48-bit unsigned long from buffer. (little-endian)
@see mysql-5.1.60/include/my_global.h - uint6korr | [
"Return",
"next",
"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#L747-L755 | train | Gets a 48 - bit unsigned integer from the buffer. | [
30522,
2270,
2345,
2146,
2131,
18845,
3070,
18139,
1006,
1007,
1063,
2065,
1006,
2597,
1009,
1019,
1028,
1027,
4761,
1009,
5787,
1007,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
5787,
4654,
9468,
13089,
1024,
1000,
1009,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/FailoverRegion.java | FailoverRegion.reset | private void reset(long globalModVersionOfFailover) {
try {
// reset all connected ExecutionVertexes
final Collection<CoLocationGroup> colGroups = new HashSet<>();
final long restartTimestamp = System.currentTimeMillis();
for (ExecutionVertex ev : connectedExecutionVertexes) {
CoLocationGroup cgroup = ev.getJobVertex().getCoLocationGroup();
if (cgroup != null && !colGroups.contains(cgroup)){
cgroup.resetConstraints();
colGroups.add(cgroup);
}
ev.resetForNewExecution(restartTimestamp, globalModVersionOfFailover);
}
if (transitionState(JobStatus.CANCELED, JobStatus.CREATED)) {
restart(globalModVersionOfFailover);
}
else {
LOG.info("FailoverRegion {} switched from CANCELLING to CREATED fail, will fail this region again.", id);
failover(globalModVersionOfFailover);
}
}
catch (GlobalModVersionMismatch e) {
// happens when a global recovery happens concurrently to the regional recovery
// go back to a clean state
state = JobStatus.RUNNING;
}
catch (Throwable e) {
LOG.info("FailoverRegion {} reset fail, will failover again.", id);
failover(globalModVersionOfFailover);
}
} | java | private void reset(long globalModVersionOfFailover) {
try {
// reset all connected ExecutionVertexes
final Collection<CoLocationGroup> colGroups = new HashSet<>();
final long restartTimestamp = System.currentTimeMillis();
for (ExecutionVertex ev : connectedExecutionVertexes) {
CoLocationGroup cgroup = ev.getJobVertex().getCoLocationGroup();
if (cgroup != null && !colGroups.contains(cgroup)){
cgroup.resetConstraints();
colGroups.add(cgroup);
}
ev.resetForNewExecution(restartTimestamp, globalModVersionOfFailover);
}
if (transitionState(JobStatus.CANCELED, JobStatus.CREATED)) {
restart(globalModVersionOfFailover);
}
else {
LOG.info("FailoverRegion {} switched from CANCELLING to CREATED fail, will fail this region again.", id);
failover(globalModVersionOfFailover);
}
}
catch (GlobalModVersionMismatch e) {
// happens when a global recovery happens concurrently to the regional recovery
// go back to a clean state
state = JobStatus.RUNNING;
}
catch (Throwable e) {
LOG.info("FailoverRegion {} reset fail, will failover again.", id);
failover(globalModVersionOfFailover);
}
} | [
"private",
"void",
"reset",
"(",
"long",
"globalModVersionOfFailover",
")",
"{",
"try",
"{",
"// reset all connected ExecutionVertexes",
"final",
"Collection",
"<",
"CoLocationGroup",
">",
"colGroups",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"final",
"long",
"... | reset all executions in this sub graph | [
"reset",
"all",
"executions",
"in",
"this",
"sub",
"graph"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/FailoverRegion.java#L172-L204 | train | Resets all the executions in this region. | [
30522,
2797,
11675,
25141,
1006,
2146,
3795,
5302,
2094,
27774,
7245,
12502,
7840,
1007,
1063,
3046,
1063,
1013,
1013,
25141,
2035,
4198,
7781,
16874,
10288,
2229,
2345,
3074,
1026,
8902,
23909,
17058,
1028,
8902,
17058,
2015,
1027,
2047,
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-http/src/main/java/cn/hutool/http/HtmlUtil.java | HtmlUtil.removeAllHtmlAttr | public static String removeAllHtmlAttr(String content, String... tagNames) {
String regex = null;
for (String tagName : tagNames) {
regex = StrUtil.format("(?i)<{}[^>]*?>", tagName);
content = content.replaceAll(regex, StrUtil.format("<{}>", tagName));
}
return content;
} | java | public static String removeAllHtmlAttr(String content, String... tagNames) {
String regex = null;
for (String tagName : tagNames) {
regex = StrUtil.format("(?i)<{}[^>]*?>", tagName);
content = content.replaceAll(regex, StrUtil.format("<{}>", tagName));
}
return content;
} | [
"public",
"static",
"String",
"removeAllHtmlAttr",
"(",
"String",
"content",
",",
"String",
"...",
"tagNames",
")",
"{",
"String",
"regex",
"=",
"null",
";",
"for",
"(",
"String",
"tagName",
":",
"tagNames",
")",
"{",
"regex",
"=",
"StrUtil",
".",
"format"... | 去除指定标签的所有属性
@param content 内容
@param tagNames 指定标签
@return 处理后的文本 | [
"去除指定标签的所有属性"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HtmlUtil.java#L166-L173 | train | Removes all html attributes from the given content. | [
30522,
2270,
10763,
5164,
6366,
8095,
11039,
19968,
19321,
2099,
1006,
5164,
4180,
1010,
5164,
1012,
1012,
1012,
6415,
18442,
2015,
1007,
1063,
5164,
19723,
10288,
1027,
19701,
1025,
2005,
1006,
5164,
6415,
18442,
1024,
6415,
18442,
2015,
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-sql-client/src/main/java/org/apache/flink/table/client/cli/CliTableResultView.java | CliTableResultView.updatePage | private void updatePage() {
// retrieve page
final int retrievalPage = page == LAST_PAGE ? pageCount : page;
final List<Row> rows;
try {
rows = client.getExecutor().retrieveResultPage(resultDescriptor.getResultId(), retrievalPage);
} catch (SqlExecutionException e) {
close(e);
return;
}
// convert page
final List<String[]> stringRows = rows
.stream()
.map(CliUtils::rowToString)
.collect(Collectors.toList());
// update results
if (previousResultsPage == retrievalPage) {
// only use the previous results if the current page number has not changed
// this allows for updated results when the key space remains constant
previousResults = results;
} else {
previousResults = null;
previousResultsPage = retrievalPage;
}
results = stringRows;
// check if selected row is still valid
if (selectedRow != NO_ROW_SELECTED) {
if (selectedRow >= results.size()) {
selectedRow = NO_ROW_SELECTED;
}
}
// reset view
resetAllParts();
} | java | private void updatePage() {
// retrieve page
final int retrievalPage = page == LAST_PAGE ? pageCount : page;
final List<Row> rows;
try {
rows = client.getExecutor().retrieveResultPage(resultDescriptor.getResultId(), retrievalPage);
} catch (SqlExecutionException e) {
close(e);
return;
}
// convert page
final List<String[]> stringRows = rows
.stream()
.map(CliUtils::rowToString)
.collect(Collectors.toList());
// update results
if (previousResultsPage == retrievalPage) {
// only use the previous results if the current page number has not changed
// this allows for updated results when the key space remains constant
previousResults = results;
} else {
previousResults = null;
previousResultsPage = retrievalPage;
}
results = stringRows;
// check if selected row is still valid
if (selectedRow != NO_ROW_SELECTED) {
if (selectedRow >= results.size()) {
selectedRow = NO_ROW_SELECTED;
}
}
// reset view
resetAllParts();
} | [
"private",
"void",
"updatePage",
"(",
")",
"{",
"// retrieve page",
"final",
"int",
"retrievalPage",
"=",
"page",
"==",
"LAST_PAGE",
"?",
"pageCount",
":",
"page",
";",
"final",
"List",
"<",
"Row",
">",
"rows",
";",
"try",
"{",
"rows",
"=",
"client",
"."... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliTableResultView.java#L251-L289 | train | Update the page number and the previous results page number. | [
30522,
2797,
11675,
10651,
13704,
1006,
1007,
1063,
1013,
1013,
12850,
3931,
2345,
20014,
26384,
13704,
1027,
3931,
1027,
1027,
2197,
1035,
3931,
1029,
3931,
3597,
16671,
1024,
3931,
1025,
2345,
2862,
1026,
5216,
1028,
10281,
1025,
3046,
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/util/NumberUtil.java | NumberUtil.round | public static BigDecimal round(double v, int scale, RoundingMode roundingMode) {
return round(Double.toString(v), scale, roundingMode);
} | java | public static BigDecimal round(double v, int scale, RoundingMode roundingMode) {
return round(Double.toString(v), scale, roundingMode);
} | [
"public",
"static",
"BigDecimal",
"round",
"(",
"double",
"v",
",",
"int",
"scale",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"round",
"(",
"Double",
".",
"toString",
"(",
"v",
")",
",",
"scale",
",",
"roundingMode",
")",
";",
"}"
] | 保留固定位数小数<br>
例如保留四位小数:123.456789 =》 123.4567
@param v 值
@param scale 保留小数位数
@param roundingMode 保留小数的模式 {@link RoundingMode}
@return 新值 | [
"保留固定位数小数<br",
">",
"例如保留四位小数:123",
".",
"456789",
"=",
"》",
"123",
".",
"4567"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L829-L831 | train | Round a double value to a given scale. | [
30522,
2270,
10763,
2502,
3207,
6895,
9067,
2461,
1006,
3313,
1058,
1010,
20014,
4094,
1010,
26939,
5302,
3207,
26939,
5302,
3207,
1007,
1063,
2709,
2461,
1006,
3313,
1012,
2000,
3367,
4892,
1006,
1058,
1007,
1010,
4094,
1010,
26939,
5302,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.beanToMap | public static Map<String, Object> beanToMap(Object bean, Map<String, Object> targetMap, final boolean isToUnderlineCase, boolean ignoreNullValue) {
if (bean == null) {
return null;
}
return beanToMap(bean, targetMap, ignoreNullValue, new Editor<String>() {
@Override
public String edit(String key) {
return isToUnderlineCase ? StrUtil.toUnderlineCase(key) : key;
}
});
} | java | public static Map<String, Object> beanToMap(Object bean, Map<String, Object> targetMap, final boolean isToUnderlineCase, boolean ignoreNullValue) {
if (bean == null) {
return null;
}
return beanToMap(bean, targetMap, ignoreNullValue, new Editor<String>() {
@Override
public String edit(String key) {
return isToUnderlineCase ? StrUtil.toUnderlineCase(key) : key;
}
});
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"beanToMap",
"(",
"Object",
"bean",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"targetMap",
",",
"final",
"boolean",
"isToUnderlineCase",
",",
"boolean",
"ignoreNullValue",
")",
"{",
"if",
"... | 对象转Map
@param bean bean对象
@param targetMap 目标的Map
@param isToUnderlineCase 是否转换为下划线模式
@param ignoreNullValue 是否忽略值为空的字段
@return Map
@since 3.2.3 | [
"对象转Map"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L511-L523 | train | Returns a map of the specified bean object and all of its properties. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
4874,
1028,
14068,
20389,
9331,
1006,
4874,
14068,
1010,
4949,
1026,
5164,
1010,
4874,
1028,
4539,
2863,
2361,
1010,
2345,
22017,
20898,
21541,
28819,
2121,
4179,
18382,
1010,
22017,
20898,
8568,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternStream.java | PatternStream.flatSelect | public <L, R> SingleOutputStreamOperator<R> flatSelect(
final OutputTag<L> timedOutPartialMatchesTag,
final PatternFlatTimeoutFunction<T, L> patternFlatTimeoutFunction,
final PatternFlatSelectFunction<T, R> patternFlatSelectFunction) {
final TypeInformation<R> rightTypeInfo = TypeExtractor.getUnaryOperatorReturnType(
patternFlatSelectFunction,
PatternFlatSelectFunction.class,
0,
1,
new int[]{1, 0},
builder.getInputType(),
null,
false);
return flatSelect(
timedOutPartialMatchesTag,
patternFlatTimeoutFunction,
rightTypeInfo,
patternFlatSelectFunction);
} | java | public <L, R> SingleOutputStreamOperator<R> flatSelect(
final OutputTag<L> timedOutPartialMatchesTag,
final PatternFlatTimeoutFunction<T, L> patternFlatTimeoutFunction,
final PatternFlatSelectFunction<T, R> patternFlatSelectFunction) {
final TypeInformation<R> rightTypeInfo = TypeExtractor.getUnaryOperatorReturnType(
patternFlatSelectFunction,
PatternFlatSelectFunction.class,
0,
1,
new int[]{1, 0},
builder.getInputType(),
null,
false);
return flatSelect(
timedOutPartialMatchesTag,
patternFlatTimeoutFunction,
rightTypeInfo,
patternFlatSelectFunction);
} | [
"public",
"<",
"L",
",",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"flatSelect",
"(",
"final",
"OutputTag",
"<",
"L",
">",
"timedOutPartialMatchesTag",
",",
"final",
"PatternFlatTimeoutFunction",
"<",
"T",
",",
"L",
">",
"patternFlatTimeoutFunction",
... | Applies a flat select function to the detected pattern sequence. For each pattern sequence the
provided {@link PatternFlatSelectFunction} is called. The pattern select function can produce
exactly one resulting element.
<p>Applies a timeout function to a partial pattern sequence which has timed out. For each
partial pattern sequence the provided {@link PatternFlatTimeoutFunction} is called. The pattern
timeout function can produce exactly one resulting element.
<p>You can get the stream of timed-out data resulting from the
{@link SingleOutputStreamOperator#getSideOutput(OutputTag)} on the
{@link SingleOutputStreamOperator} resulting from the select operation
with the same {@link OutputTag}.
@param timedOutPartialMatchesTag {@link OutputTag} that identifies side output with timed out patterns
@param patternFlatTimeoutFunction The pattern timeout function which is called for each partial
pattern sequence which has timed out.
@param patternFlatSelectFunction The pattern select function which is called for each detected
pattern sequence.
@param <L> Type of the resulting timeout elements
@param <R> Type of the resulting elements
@return {@link DataStream} which contains the resulting elements with the resulting timeout
elements in a side output. | [
"Applies",
"a",
"flat",
"select",
"function",
"to",
"the",
"detected",
"pattern",
"sequence",
".",
"For",
"each",
"pattern",
"sequence",
"the",
"provided",
"{",
"@link",
"PatternFlatSelectFunction",
"}",
"is",
"called",
".",
"The",
"pattern",
"select",
"function... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternStream.java#L393-L413 | train | Flat select. | [
30522,
2270,
1026,
1048,
1010,
1054,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
14201,
12260,
6593,
1006,
2345,
6434,
15900,
1026,
1048,
1028,
22313,
5833,
19362,
20925,
18900,
8376,
15900,
1010,
2345,
5418,
10258,
19321,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.touch | public static File touch(File parent, String path) throws IORuntimeException {
return touch(file(parent, path));
} | java | public static File touch(File parent, String path) throws IORuntimeException {
return touch(file(parent, path));
} | [
"public",
"static",
"File",
"touch",
"(",
"File",
"parent",
",",
"String",
"path",
")",
"throws",
"IORuntimeException",
"{",
"return",
"touch",
"(",
"file",
"(",
"parent",
",",
"path",
")",
")",
";",
"}"
] | 创建文件及其父目录,如果这个文件存在,直接返回这个文件<br>
此方法不对File对象类型做判断,如果File不存在,无法判断其类型
@param parent 父文件对象
@param path 文件路径
@return File
@throws IORuntimeException IO异常 | [
"创建文件及其父目录,如果这个文件存在,直接返回这个文件<br",
">",
"此方法不对File对象类型做判断,如果File不存在,无法判断其类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L634-L636 | train | Creates a new file with the specified parent and path and creates a new file with the specified permissions. | [
30522,
2270,
10763,
5371,
3543,
1006,
5371,
6687,
1010,
5164,
4130,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
3543,
1006,
5371,
1006,
6687,
1010,
4130,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java | JobMaster.declineCheckpoint | @Override
public void declineCheckpoint(DeclineCheckpoint decline) {
final CheckpointCoordinator checkpointCoordinator = executionGraph.getCheckpointCoordinator();
if (checkpointCoordinator != null) {
getRpcService().execute(() -> {
try {
checkpointCoordinator.receiveDeclineMessage(decline);
} catch (Exception e) {
log.error("Error in CheckpointCoordinator while processing {}", decline, e);
}
});
} else {
String errorMessage = "Received DeclineCheckpoint message for job {} with no CheckpointCoordinator";
if (executionGraph.getState() == JobStatus.RUNNING) {
log.error(errorMessage, jobGraph.getJobID());
} else {
log.debug(errorMessage, jobGraph.getJobID());
}
}
} | java | @Override
public void declineCheckpoint(DeclineCheckpoint decline) {
final CheckpointCoordinator checkpointCoordinator = executionGraph.getCheckpointCoordinator();
if (checkpointCoordinator != null) {
getRpcService().execute(() -> {
try {
checkpointCoordinator.receiveDeclineMessage(decline);
} catch (Exception e) {
log.error("Error in CheckpointCoordinator while processing {}", decline, e);
}
});
} else {
String errorMessage = "Received DeclineCheckpoint message for job {} with no CheckpointCoordinator";
if (executionGraph.getState() == JobStatus.RUNNING) {
log.error(errorMessage, jobGraph.getJobID());
} else {
log.debug(errorMessage, jobGraph.getJobID());
}
}
} | [
"@",
"Override",
"public",
"void",
"declineCheckpoint",
"(",
"DeclineCheckpoint",
"decline",
")",
"{",
"final",
"CheckpointCoordinator",
"checkpointCoordinator",
"=",
"executionGraph",
".",
"getCheckpointCoordinator",
"(",
")",
";",
"if",
"(",
"checkpointCoordinator",
"... | TODO: This method needs a leader session ID | [
"TODO",
":",
"This",
"method",
"needs",
"a",
"leader",
"session",
"ID"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java#L531-L551 | train | Declines a checkpoint. | [
30522,
1030,
2058,
15637,
2270,
11675,
6689,
5403,
3600,
8400,
1006,
6689,
5403,
3600,
8400,
6689,
1007,
1063,
2345,
26520,
3597,
8551,
23207,
26520,
3597,
8551,
23207,
1027,
7781,
14413,
1012,
2131,
5403,
3600,
8400,
3597,
8551,
23207,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.